{"_id":"@neondatabase/postgrest-js","_rev":"7-c70f110ef9c52f5de181e7fadff48828","name":"@neondatabase/postgrest-js","dist-tags":{"latest":"0.2.0-beta"},"versions":{"0.1.0-alpha.1":{"name":"@neondatabase/postgrest-js","version":"0.1.0-alpha.1","author":{"name":"Pedro Figueiredo","email":"pedro.figueiredo@databricks.com"},"license":"Apache-2.0","_id":"@neondatabase/postgrest-js@0.1.0-alpha.1","maintainers":[{"name":"duskpoet","email":"bird.duskpoet@gmail.com"},{"name":"jawj","email":"george@mackerron.co.uk"},{"name":"amitdahan","email":"amitdahan11@gmail.com"},{"name":"pffigueiredo","email":"klisarkk@gmail.com"},{"name":"shridharneon","email":"shridhar@neon.tech"},{"name":"atilaz","email":"atila@fassina.eu"},{"name":"neonteam","email":"security+npm@neon.tech"},{"name":"lneves_databricks","email":"luis.neves@databricks.com"}],"homepage":"https://github.com/neondatabase-labs/neon-js/","bugs":{"url":"https://github.com/neondatabase-labs/neon-js/issues"},"dist":{"shasum":"20fe40177e45efa1a52740b1b02d4bb196f55980","tarball":"https://registry.npmjs.org/@neondatabase/postgrest-js/-/postgrest-js-0.1.0-alpha.1.tgz","fileCount":9,"integrity":"sha512-+f07qs6uvM8FCSjf+cBzPyr4aoVW3/fWJCLVwS79GhZsDVPMapkiWJRsurY1Y3yppDlPxSXe0zjJjfFwXU2BXA==","signatures":[{"sig":"MEUCIHcAoC69g1WhV5r6lTElwYcs0GN6F530ZYH19KhyW2tvAiEAsbGjdSw4TWzsFZqahppQbQ8UEWC65fQntlbIUCQDptc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":13782},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":"./dist/index.mjs","./client":"./dist/client/index.mjs"},"gitHead":"1bfb79c558152ef3967c87bb52e1ad56ae53733e","scripts":{"dev":"tsdown --watch","lint":"eslint .","test":"vitest","build":"tsdown","release":"bun run build && bumpp --tag 'postgrest-js-v%s' && npm publish --tag latest","test:ci":"vitest run","test:node":"node --run test","typecheck":"tsc --noEmit","test:types":"tsc --noEmit"},"_npmUser":{"name":"pffigueiredo","email":"klisarkk@gmail.com"},"repository":{"url":"git+https://github.com/neondatabase-labs/neon-js.git","type":"git"},"_npmVersion":"11.5.1","description":"Generic PostgreSQL client for Neon Data API (without authentication)","directories":{},"_nodeVersion":"24.7.0","dependencies":{"@supabase/postgrest-js":"2.79.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"^9.39.1","tsdown":"0.16.0","vitest":"4.0.7","@eslint/js":"^9.39.1","typescript":"^5.9.3","vite-tsconfig-paths":"5.1.4","eslint-plugin-unicorn":"^62.0.0"},"_npmOperationalInternal":{"tmp":"tmp/postgrest-js_0.1.0-alpha.1_1764171821775_0.0516311133987255","host":"s3://npm-registry-packages-npm-production"}},"0.1.0-alpha.2":{"name":"@neondatabase/postgrest-js","version":"0.1.0-alpha.2","keywords":["neon","neondb","postgresql","postgres","database","postgrest","data-api","typescript","sdk","query-builder"],"author":"Pedro Figueiredo <pedro.figueiredo@databricks.com>","license":"Apache-2.0","_id":"@neondatabase/postgrest-js@0.1.0-alpha.2","maintainers":[{"name":"duskpoet","email":"bird.duskpoet@gmail.com"},{"name":"jawj","email":"george@mackerron.co.uk"},{"name":"amitdahan","email":"amitdahan11@gmail.com"},{"name":"pffigueiredo","email":"klisarkk@gmail.com"},{"name":"shridharneon","email":"shridhar@neon.tech"},{"name":"atilaz","email":"atila@fassina.eu"},{"name":"neonteam","email":"security+npm@neon.tech"},{"name":"lneves_databricks","email":"luis.neves@databricks.com"}],"homepage":"https://github.com/neondatabase/neon-js/tree/main/packages/postgrest-js#readme","bugs":{"url":"https://github.com/neondatabase/neon-js/issues"},"dist":{"shasum":"1cad0d1b50d887f0ee23a9846583a61625c091e0","tarball":"https://registry.npmjs.org/@neondatabase/postgrest-js/-/postgrest-js-0.1.0-alpha.2.tgz","fileCount":5,"integrity":"sha512-fE3Kd6Tj3uUVx6jvDUA3USW4gZaSAL0NoGePFg31xDfBbmS2EBpdboKUnac8rJVajUiCDQPj6/j4G1eXOleYsg==","signatures":[{"sig":"MEYCIQCWwQ12NPUwiTIkCS8urvYjFnHeygoqJI2/YatbiHdC1gIhANoCshPC4XsuOEXZO+3rfvwRGhWTLzGbhYCYgw4SPGZ0","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":17305},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","shasum":"1cad0d1b50d887f0ee23a9846583a61625c091e0","exports":{".":"./dist/index.mjs"},"funding":{"url":"https://neon.tech"},"scripts":{"dev":"tsdown --watch","lint":"eslint .","test":"vitest","build":"tsdown","clean":"rm -rf node_modules dist","release":"bun run build && bumpp --tag 'postgrest-js-v%s' && bun publish --tag latest","test:ci":"vitest run","test:node":"node --run test","typecheck":"tsc --noEmit","test:types":"tsc --noEmit"},"_npmUser":{"name":"pffigueiredo","email":"klisarkk@gmail.com"},"_integrity":"sha512-fE3Kd6Tj3uUVx6jvDUA3USW4gZaSAL0NoGePFg31xDfBbmS2EBpdboKUnac8rJVajUiCDQPj6/j4G1eXOleYsg==","repository":{"url":"git+https://github.com/neondatabase/neon-js.git","type":"git","directory":"packages/postgrest-js"},"_npmVersion":"10.8.3","description":"PostgreSQL client for Neon Data API - query your database without authentication","directories":{},"sideEffects":false,"_nodeVersion":"24.3.0","dependencies":{"@supabase/postgrest-js":"2.79.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@neondatabase/internal":"0.0.1"},"_npmOperationalInternal":{"tmp":"tmp/postgrest-js_0.1.0-alpha.2_1766500311530_0.7956420486790432","host":"s3://npm-registry-packages-npm-production"}},"0.2.0-beta":{"name":"@neondatabase/postgrest-js","version":"0.2.0-beta","description":"PostgreSQL client for Neon Data API - query your database without authentication","type":"module","license":"Apache-2.0","keywords":["neon","neondb","postgresql","postgres","database","postgrest","data-api","typescript","sdk","query-builder"],"homepage":"https://github.com/neondatabase/neon-js/tree/main/packages/postgrest-js#readme","bugs":{"url":"https://github.com/neondatabase/neon-js/issues"},"repository":{"type":"git","url":"git+https://github.com/neondatabase/neon-js.git","directory":"packages/postgrest-js"},"funding":{"url":"https://neon.tech"},"author":{"name":"Pedro Figueiredo","email":"pedro.figueiredo@databricks.com"},"main":"./dist/index.mjs","module":"./dist/index.mjs","types":"./dist/index.d.mts","exports":{".":"./dist/index.mjs"},"sideEffects":false,"publishConfig":{"access":"public"},"devDependencies":{"@neondatabase/internal":"0.0.1"},"dependencies":{"@supabase/postgrest-js":"2.79.0"},"scripts":{"build":"tsdown","dev":"tsdown --watch","test":"vitest","test:node":"node --run test","test:ci":"vitest run --passWithNoTests","typecheck":"tsc --noEmit","test:types":"tsc --noEmit","release":"npx tsx ../../scripts/release.ts postgrest-js","lint":"eslint .","clean":"rm -rf node_modules dist"},"_id":"@neondatabase/postgrest-js@0.2.0-beta","_integrity":"sha512-Uq+Qzr6g5lD41KG0TFS5lc2Wo7UnQ1PE+HWdYg8Rr4X5f2pfJvJxciaPlXxOqZji6sEeO6WmLquMG40B/0sSGQ==","_resolved":"/home/runner/work/secure-public-registry-releases-eng/secure-public-registry-releases-eng/dist/neondatabase-postgrest-js-0.2.0-beta.tgz","_from":"file:dist/neondatabase-postgrest-js-0.2.0-beta.tgz","_nodeVersion":"22.22.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-Uq+Qzr6g5lD41KG0TFS5lc2Wo7UnQ1PE+HWdYg8Rr4X5f2pfJvJxciaPlXxOqZji6sEeO6WmLquMG40B/0sSGQ==","shasum":"03c2afe31985951d1a40ff2747a450b584a60233","tarball":"https://registry.npmjs.org/@neondatabase/postgrest-js/-/postgrest-js-0.2.0-beta.tgz","fileCount":6,"unpackedSize":28657,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHR09whA8Buom+29FtTeKRBuF0Wsr8VvAuDIMqAvtjTRAiEAiiLOtAOJ0Gfn5FIjMDUVMxzK/c5VlCSbyuqw//cP7vk="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:cb534da5-7245-4cba-aeb2-ee2dd63dd448"}},"directories":{},"maintainers":[{"name":"jawj","email":"george@mackerron.co.uk"},{"name":"amitdahan","email":"amitdahan11@gmail.com"},{"name":"pffigueiredo","email":"klisarkk@gmail.com"},{"name":"shridharneon","email":"shridhar@neon.tech"},{"name":"atilaz","email":"atila@fassina.eu"},{"name":"neonteam","email":"andre@neon.tech"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/postgrest-js_0.2.0-beta_1777465076728_0.2979552805908836"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-26T15:43:41.692Z","modified":"2026-04-29T12:17:57.058Z","0.1.0":"2025-11-26T15:24:16.753Z","0.1.0-alpha.1":"2025-11-26T15:43:41.953Z","0.1.0-alpha.2":"2025-12-23T14:31:51.676Z","0.2.0-beta":"2026-04-29T12:17:56.877Z"},"bugs":{"url":"https://github.com/neondatabase/neon-js/issues"},"author":{"name":"Pedro Figueiredo","email":"pedro.figueiredo@databricks.com"},"license":"Apache-2.0","homepage":"https://github.com/neondatabase/neon-js/tree/main/packages/postgrest-js#readme","keywords":["neon","neondb","postgresql","postgres","database","postgrest","data-api","typescript","sdk","query-builder"],"repository":{"type":"git","url":"git+https://github.com/neondatabase/neon-js.git","directory":"packages/postgrest-js"},"description":"PostgreSQL client for Neon Data API - query your database without authentication","maintainers":[{"name":"jawj","email":"george@mackerron.co.uk"},{"name":"amitdahan","email":"amitdahan11@gmail.com"},{"name":"pffigueiredo","email":"klisarkk@gmail.com"},{"name":"shridharneon","email":"shridhar@neon.tech"},{"name":"atilaz","email":"atila@fassina.eu"},{"name":"neonteam","email":"andre@neon.tech"}],"readme":"# @neondatabase/postgrest-js\n\n[![npm version](https://img.shields.io/npm/v/@neondatabase/postgrest-js.svg)](https://www.npmjs.com/package/@neondatabase/postgrest-js)\n[![npm downloads](https://img.shields.io/npm/dm/@neondatabase/postgrest-js.svg)](https://www.npmjs.com/package/@neondatabase/postgrest-js)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0%2B-blue.svg)](https://www.typescriptlang.org/)\n[![License](https://img.shields.io/npm/l/@neondatabase/postgrest-js.svg)](https://github.com/neondatabase/neon-js/blob/main/LICENSE)\n\nGeneric PostgreSQL client for Neon Data API without built-in authentication.\n\n## Overview\n\n`@neondatabase/postgrest-js` provides a lightweight PostgreSQL client for querying Neon databases without requiring Neon Auth integration. It's ideal for scenarios where:\n\n- Authentication is handled externally (e.g., API keys, custom auth providers)\n- You want to bring your own token management\n- You need a minimal client without auth dependencies\n\nFor auth-integrated clients, use [`@neondatabase/neon-js`](../neon-js) instead.\n\n## Installation\n\n```bash\nnpm install @neondatabase/postgrest-js\n# or\nbun add @neondatabase/postgrest-js\n```\n\n## Usage\n\n### Basic Client\n\n```typescript\nimport { NeonPostgrestClient } from '@neondatabase/postgrest-js';\n\nconst client = new NeonPostgrestClient({\n  dataApiUrl: 'https://ep-xxx.apirest.region.aws.neon.build/dbname/rest/v1',\n  options: {\n    global: {\n      headers: {\n        'Authorization': 'Bearer YOUR_API_KEY',\n      },\n    },\n    db: {\n      schema: 'public',\n    },\n  },\n});\n\n// Query your database\nconst { data, error } = await client\n  .from('users')\n  .select('*')\n  .eq('status', 'active');\n```\n\n### With Token Provider\n\nUse `fetchWithToken()` for dynamic token resolution:\n\n```typescript\nimport { NeonPostgrestClient, fetchWithToken } from '@neondatabase/postgrest-js';\n\n// Your token provider function\nconst getToken = async () => {\n  // Fetch from your auth system, environment, etc.\n  return process.env.DATABASE_TOKEN;\n};\n\nconst client = new NeonPostgrestClient({\n  dataApiUrl: 'https://ep-xxx.apirest.region.aws.neon.build/dbname/rest/v1',\n  options: {\n    global: {\n      fetch: fetchWithToken(getToken),\n    },\n  },\n});\n\n// Automatically injects token on every request\nconst { data } = await client.from('posts').select();\n```\n\n### Custom Fetch Implementation\n\n```typescript\nimport { NeonPostgrestClient, fetchWithToken } from '@neondatabase/postgrest-js';\n\nconst customFetch: typeof fetch = async (input, init) => {\n  console.log('Making request:', input);\n  return fetch(input, init);\n};\n\nconst client = new NeonPostgrestClient({\n  dataApiUrl: 'https://ep-xxx.apirest.region.aws.neon.build/dbname/rest/v1',\n  options: {\n    global: {\n      fetch: fetchWithToken(getToken, customFetch),\n    },\n  },\n});\n```\n\n## API Reference\n\n### `NeonPostgrestClient`\n\nExtends the upstream `PostgrestClient` with Neon-specific configuration.\n\n**Constructor Options:**\n\n```typescript\ntype NeonPostgrestClientConstructorOptions<SchemaName> = {\n  dataApiUrl: string;\n  options?: {\n    db?: {\n      schema?: SchemaName; // Database schema (default: 'public')\n    };\n    global?: {\n      fetch?: typeof fetch; // Custom fetch implementation\n      headers?: Record<string, string>; // Global headers\n    };\n  };\n};\n```\n\n**Example:**\n\n```typescript\nconst client = new NeonPostgrestClient({\n  dataApiUrl: 'https://your-api-url.com/rest/v1',\n  options: {\n    db: { schema: 'public' },\n    global: {\n      headers: { 'X-Custom-Header': 'value' },\n    },\n  },\n});\n```\n\n### `fetchWithToken()`\n\nGeneric fetch wrapper that injects authentication tokens.\n\n**Signature:**\n\n```typescript\nfunction fetchWithToken(\n  getAccessToken: () => Promise<string | null>,\n  customFetch?: typeof fetch\n): typeof fetch\n```\n\n**Parameters:**\n- `getAccessToken`: Async function that returns the current access token\n- `customFetch`: Optional custom fetch implementation (default: global `fetch`)\n\n**Returns:** Wrapped fetch function that automatically adds `Authorization: Bearer <token>` header\n\n**Throws:** `AuthRequiredError` if `getAccessToken()` returns `null`\n\n**Example:**\n\n```typescript\nconst authFetch = fetchWithToken(async () => {\n  return await getTokenFromYourAuthSystem();\n});\n\n// Use with client\nconst client = new NeonPostgrestClient({\n  dataApiUrl: 'https://api.example.com',\n  options: { global: { fetch: authFetch } },\n});\n```\n\n### `AuthRequiredError`\n\nError thrown when a request requires authentication but no token is available.\n\n```typescript\nclass AuthRequiredError extends Error {\n  constructor(message?: string);\n}\n```\n\n**Usage:**\n\n```typescript\nimport { AuthRequiredError } from '@neondatabase/postgrest-js';\n\ntry {\n  await client.from('users').select();\n} catch (error) {\n  if (error instanceof AuthRequiredError) {\n    console.error('Authentication required');\n  }\n}\n```\n\n## Querying\n\nAll PostgrestClient query methods are available:\n\n```typescript\n// SELECT\nconst { data } = await client\n  .from('users')\n  .select('id, name, email')\n  .eq('status', 'active')\n  .order('created_at', { ascending: false })\n  .limit(10);\n\n// INSERT\nconst { data } = await client\n  .from('users')\n  .insert({ name: 'Alice', email: 'alice@example.com' })\n  .select();\n\n// UPDATE\nconst { data } = await client\n  .from('users')\n  .update({ status: 'inactive' })\n  .eq('id', 123);\n\n// DELETE\nconst { data } = await client\n  .from('users')\n  .delete()\n  .eq('id', 123);\n\n// RPC (stored procedures)\nconst { data } = await client\n  .rpc('get_user_stats', { user_id: 123 });\n```\n\n## Environment Compatibility\n\nWorks in both browser and Node.js environments:\n\n- **Browser**: Full fetch API support\n- **Node.js**: Works with Node.js 18+ native fetch or polyfills\n\n## TypeScript\n\nFull TypeScript support with generic database types:\n\n```typescript\ninterface Database {\n  public: {\n    users: {\n      Row: { id: number; name: string; email: string };\n      Insert: { name: string; email: string };\n      Update: { name?: string; email?: string };\n    };\n  };\n}\n\nconst client = new NeonPostgrestClient<Database>({\n  dataApiUrl: 'https://api.example.com',\n});\n\n// Fully typed!\nconst { data } = await client.from('users').select();\n```\n\n## Related Packages\n\n- [`@neondatabase/neon-js`](../neon-js) - Full SDK with Neon Auth integration\n- [`@neondatabase/auth`](../auth) - Standalone auth adapters\n\n## Support\n\n- [GitHub Issues](https://github.com/neondatabase/neon-js/issues)\n- [Neon Community Discord](https://discord.gg/H24eC2UN)\n\n## License\n\nApache-2.0\n","readmeFilename":"README.md"}