{"_id":"@djedjito/supabase-management-js","name":"@djedjito/supabase-management-js","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@djedjito/supabase-management-js","version":"1.0.0","description":"Convenience wrapper for the Supabase Management API (custom Djedjito build)","main":"./dist/index.js","types":"./dist/index.d.ts","module":"./dist/index.mjs","publishConfig":{"access":"public"},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":"./dist/index.js","types":"./dist/index.d.ts"},"./package.json":"./package.json"},"scripts":{"clean":"rimraf dist","build":"npm run clean && npm run build:tsup","build:tsup":"tsup --dts-resolve","typecheck":"tsc --noEmit","generate":"openapi-typescript https://api.supabase.com/api/v1-json -o ./src/api/v1.d.ts","changeset:version":"changeset version","changeset:release":"npm run build && changeset publish"},"dependencies":{"openapi-fetch":"^0.6.1"},"devDependencies":{"@changesets/cli":"^2.26.2","@types/node":"18","esbuild":"^0.19.2","openapi-typescript":"^6.3.4","rimraf":"^3.0.2","tsup":"^8.0.1","tsx":"^4.6.2","typescript":"^4.8.4"},"engines":{"node":">=18.0.0"},"_id":"@djedjito/supabase-management-js@1.0.0","gitHead":"82864a713af617f0e34069e28f4ccdd1c39f1879","_nodeVersion":"20.19.4","_npmVersion":"9.8.1","dist":{"integrity":"sha512-bpeNlqsYNcJHX2ONmrEu5NXrNlioGcDygXUBindqSanWjOUwS6Mgh6CRu89tRBTW0RyWPHfFqfX0APUdlyCR3Q==","shasum":"797bcceb2424bd0cf00dfef46a22feb0b7de7e49","tarball":"https://registry.npmjs.org/@djedjito/supabase-management-js/-/supabase-management-js-1.0.0.tgz","fileCount":8,"unpackedSize":501700,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCSdteaZXwLDMUKnToeRlSJBb/5C0hRVNU3GQve1jV08gIgSe9mY79OOX9vCKJRvd/WrJ3eN94CNG/Dq2berkA7qmg="}]},"_npmUser":{"name":"djedjito","email":"sheltondjedje@outlook.com"},"directories":{},"maintainers":[{"name":"djedjito","email":"sheltondjedje@outlook.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/supabase-management-js_1.0.0_1754739974604_0.8484775752921812"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-09T11:46:14.456Z","1.0.0":"2025-08-09T11:46:14.874Z","modified":"2025-08-09T11:46:15.142Z"},"maintainers":[{"name":"djedjito","email":"sheltondjedje@outlook.com"}],"description":"Convenience wrapper for the Supabase Management API (custom Djedjito build)","readme":"## supabase-management-js\r\n\r\nA convenience wrapper for the [Supabase Management API](https://supabase.com/docs/reference/api/introduction) written in TypeScript.\r\n\r\n### Status\r\n\r\nThe Management API is in beta. It is usable in it's current state, but it's likely that there will be breaking changes.\r\n\r\n### Installation\r\n\r\nTo install `supabase-management-js` in a Node.js project:\r\n\r\n```sh\r\nnpm install supabase-management-js\r\n```\r\n\r\n`supabase-management-js` requires Node.js 18 and above because it relies on the native `fetch` client.\r\n\r\n### Authentication\r\n\r\nYou can configure the `SupabaseManagementAPI` class with an access token, retrieved either through [OAuth](https://supabase.com/docs/guides/integrations/oauth-apps/authorize-an-oauth-app) or by generating an API token in your [account](https://supabase.com/dashboard/account/tokens) page. Your API tokens carry the same privileges as your user account, so be sure to keep it secret.\r\n\r\n```ts\r\nimport { SupabaseManagementAPI } from \"supabase-management-js\";\r\n\r\nconst client = new SupabaseManagementAPI({ accessToken: \"<access token>\" });\r\n```\r\n\r\n### Usage\r\n\r\nThe `SupabaseManagementAPI` class exposes each API endpoint of the [Management API](https://supabase.com/docs/reference/api/introduction) as a function that returns a Promise with the corresponding response data type.\r\n\r\n```ts\r\nimport { SupabaseManagementAPI } from \"supabase-management-js\";\r\n\r\nconst client = new SupabaseManagementAPI({ accessToken: \"<access token>\" });\r\n\r\nconst projects = await client.getProjects();\r\n\r\nif (projects) {\r\n  console.log(`Found ${projects.length} projects`);\r\n}\r\n```\r\n\r\n### Handling errors\r\n\r\nResponse errors are thrown as an instance of `SupabaseManagementAPIError` which is a subclass of `Error`. You can use the exported `isSupabaseError` guard function to narrow the type of an `unknown` error object:\r\n\r\n```ts\r\nimport { SupabaseManagementAPI, isSupabaseError } from \"supabase-management-js\";\r\n\r\nconst client = new SupabaseManagementAPI({ accessToken: \"<access token>\" });\r\n\r\ntry {\r\n  await client.getProjects();\r\n} catch (error) {\r\n  if (isSupabaseError(error)) {\r\n    // error is now typed as SupabaseManagementAPI\r\n    console.log(\r\n      `Supabase Error:  ${error.message}, response status: ${error.response.status}`\r\n    );\r\n  }\r\n}\r\n```\r\n\r\n### Contributing\r\n\r\nContributions to this project are very welcome and greatly appreciated!\r\n\r\n1. Clone the repo into a public GitHub repo (or fork https://github.com/supabase-community/supabase-management-js/fork).\r\n\r\n2. Go to the project folder.\r\n\r\n```sh\r\ncd supabase-management-js\r\n```\r\n\r\n3. Install packages with `npm`:\r\n\r\n```sh\r\nnpm install\r\n```\r\n\r\n4. Make your changes\r\n\r\n5. Make sure types are correct\r\n\r\n```sh\r\nnpm run typecheck\r\n```\r\n\r\n6. Create a changeset to describe your changes if you are making changes to the source code that effects its public API\r\n\r\n```sh\r\nnpm exec changeset\r\n```\r\n\r\n7. Create a branch, commit your changes, and open a Pull Request against the `main` branch in this repo.\r\n\r\n### Regenerating types\r\n\r\nThe [v1.d.ts](./src/api/v1.d.ts) file is auto-generated based on the Supabase [OpenAPI spec](https://api.supabase.com/api/v1-json) file with the following command:\r\n\r\n```sh\r\nnpm run generate\r\n```\r\n","readmeFilename":"README.md","_rev":"1-10888c77cb608dcfe41230864ef963a1"}