@neon/sdk 1.4.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +257 -30
  2. package/dist/client/client/client.gen.js +1 -3
  3. package/dist/client/client/client.gen.js.map +1 -1
  4. package/dist/client/client/utils.gen.js +1 -3
  5. package/dist/client/client/utils.gen.js.map +1 -1
  6. package/dist/client/index.d.ts +3 -3
  7. package/dist/client/index.js +2 -2
  8. package/dist/client/raw.gen.d.ts +146 -16
  9. package/dist/client/raw.gen.d.ts.map +1 -1
  10. package/dist/client/raw.gen.js +8 -3
  11. package/dist/client/raw.gen.js.map +1 -1
  12. package/dist/client/sdk.gen.d.ts +137 -78
  13. package/dist/client/sdk.gen.d.ts.map +1 -1
  14. package/dist/client/sdk.gen.js +258 -96
  15. package/dist/client/sdk.gen.js.map +1 -1
  16. package/dist/client/types.gen.d.ts +1397 -315
  17. package/dist/client/types.gen.d.ts.map +1 -1
  18. package/dist/index.d.ts +6 -5
  19. package/dist/index.js +2 -2
  20. package/dist/neon/client.d.ts +2 -0
  21. package/dist/neon/client.d.ts.map +1 -1
  22. package/dist/neon/client.js +2 -0
  23. package/dist/neon/client.js.map +1 -1
  24. package/dist/neon/config.d.ts +13 -0
  25. package/dist/neon/config.d.ts.map +1 -1
  26. package/dist/neon/config.js +2 -0
  27. package/dist/neon/config.js.map +1 -1
  28. package/dist/neon/context.d.ts +26 -6
  29. package/dist/neon/context.d.ts.map +1 -1
  30. package/dist/neon/context.js +60 -10
  31. package/dist/neon/context.js.map +1 -1
  32. package/dist/neon/coverage.d.ts.map +1 -1
  33. package/dist/neon/coverage.js +12 -2
  34. package/dist/neon/coverage.js.map +1 -1
  35. package/dist/neon/deadline.d.ts +81 -0
  36. package/dist/neon/deadline.d.ts.map +1 -0
  37. package/dist/neon/deadline.js +143 -0
  38. package/dist/neon/deadline.js.map +1 -0
  39. package/dist/neon/errors.d.ts +22 -3
  40. package/dist/neon/errors.d.ts.map +1 -1
  41. package/dist/neon/errors.js +22 -2
  42. package/dist/neon/errors.js.map +1 -1
  43. package/dist/neon/paginate.d.ts +6 -1
  44. package/dist/neon/paginate.d.ts.map +1 -1
  45. package/dist/neon/paginate.js +63 -25
  46. package/dist/neon/paginate.js.map +1 -1
  47. package/dist/neon/raw-wrap.d.ts.map +1 -1
  48. package/dist/neon/raw-wrap.js +17 -2
  49. package/dist/neon/raw-wrap.js.map +1 -1
  50. package/dist/neon/resources/account.d.ts.map +1 -1
  51. package/dist/neon/resources/account.js +18 -12
  52. package/dist/neon/resources/account.js.map +1 -1
  53. package/dist/neon/resources/ai-gateway.js +3 -2
  54. package/dist/neon/resources/ai-gateway.js.map +1 -1
  55. package/dist/neon/resources/auth.d.ts.map +1 -1
  56. package/dist/neon/resources/auth.js +42 -28
  57. package/dist/neon/resources/auth.js.map +1 -1
  58. package/dist/neon/resources/branches.d.ts +1 -8
  59. package/dist/neon/resources/branches.d.ts.map +1 -1
  60. package/dist/neon/resources/branches.js +32 -32
  61. package/dist/neon/resources/branches.js.map +1 -1
  62. package/dist/neon/resources/bucket-objects.d.ts.map +1 -1
  63. package/dist/neon/resources/bucket-objects.js +15 -10
  64. package/dist/neon/resources/bucket-objects.js.map +1 -1
  65. package/dist/neon/resources/buckets.d.ts.map +1 -1
  66. package/dist/neon/resources/buckets.js +9 -6
  67. package/dist/neon/resources/buckets.js.map +1 -1
  68. package/dist/neon/resources/consumption.d.ts +4 -4
  69. package/dist/neon/resources/consumption.d.ts.map +1 -1
  70. package/dist/neon/resources/consumption.js +6 -6
  71. package/dist/neon/resources/consumption.js.map +1 -1
  72. package/dist/neon/resources/credentials.d.ts.map +1 -1
  73. package/dist/neon/resources/credentials.js +9 -6
  74. package/dist/neon/resources/credentials.js.map +1 -1
  75. package/dist/neon/resources/dataapi.d.ts.map +1 -1
  76. package/dist/neon/resources/dataapi.js +12 -8
  77. package/dist/neon/resources/dataapi.js.map +1 -1
  78. package/dist/neon/resources/databases.d.ts.map +1 -1
  79. package/dist/neon/resources/databases.js +15 -10
  80. package/dist/neon/resources/databases.js.map +1 -1
  81. package/dist/neon/resources/endpoints.d.ts.map +1 -1
  82. package/dist/neon/resources/endpoints.js +27 -18
  83. package/dist/neon/resources/endpoints.js.map +1 -1
  84. package/dist/neon/resources/functions.d.ts +1 -1
  85. package/dist/neon/resources/functions.d.ts.map +1 -1
  86. package/dist/neon/resources/functions.js +14 -10
  87. package/dist/neon/resources/functions.js.map +1 -1
  88. package/dist/neon/resources/logs.d.ts +76 -0
  89. package/dist/neon/resources/logs.d.ts.map +1 -0
  90. package/dist/neon/resources/logs.js +90 -0
  91. package/dist/neon/resources/logs.js.map +1 -0
  92. package/dist/neon/resources/operations.d.ts +12 -3
  93. package/dist/neon/resources/operations.d.ts.map +1 -1
  94. package/dist/neon/resources/operations.js +5 -4
  95. package/dist/neon/resources/operations.js.map +1 -1
  96. package/dist/neon/resources/postgres.d.ts.map +1 -1
  97. package/dist/neon/resources/postgres.js +10 -1
  98. package/dist/neon/resources/postgres.js.map +1 -1
  99. package/dist/neon/resources/projects.d.ts +62 -5
  100. package/dist/neon/resources/projects.d.ts.map +1 -1
  101. package/dist/neon/resources/projects.js +106 -29
  102. package/dist/neon/resources/projects.js.map +1 -1
  103. package/dist/neon/resources/roles.d.ts.map +1 -1
  104. package/dist/neon/resources/roles.js +18 -12
  105. package/dist/neon/resources/roles.js.map +1 -1
  106. package/dist/neon/resources/snapshots.d.ts +10 -1
  107. package/dist/neon/resources/snapshots.d.ts.map +1 -1
  108. package/dist/neon/resources/snapshots.js +37 -19
  109. package/dist/neon/resources/snapshots.js.map +1 -1
  110. package/dist/neon/resources/storage.js +3 -2
  111. package/dist/neon/resources/storage.js.map +1 -1
  112. package/dist/neon/retry.d.ts +30 -8
  113. package/dist/neon/retry.d.ts.map +1 -1
  114. package/dist/neon/retry.js +59 -20
  115. package/dist/neon/retry.js.map +1 -1
  116. package/dist/neon/wait.d.ts +7 -1
  117. package/dist/neon/wait.d.ts.map +1 -1
  118. package/dist/neon/wait.js +53 -34
  119. package/dist/neon/wait.js.map +1 -1
  120. package/dist/raw.d.ts +3 -3
  121. package/dist/raw.js +8 -3
  122. package/package.json +2 -1
@@ -1,4 +1,5 @@
1
1
  import { NeonError, toNeonError } from "../errors.js";
2
+ import { cancelled, runBounded } from "../deadline.js";
2
3
  import { err, finalize, ok } from "../result.js";
3
4
  import { getConnectionUri, listProjectBranchDatabases, listProjectBranchRoles, listProjectBranches } from "../../client/sdk.gen.js";
4
5
  import { DataApi } from "./dataapi.js";
@@ -26,7 +27,15 @@ var Postgres = class {
26
27
  }
27
28
  async connectionString(params, opts) {
28
29
  const shouldThrow = opts?.throwOnError ?? this.#ctx.defaults.throwOnError;
29
- return finalize(await this.#resolve(params, opts?.signal), shouldThrow);
30
+ const deadline = this.#ctx.deadlineFor(opts);
31
+ try {
32
+ const resolved = await runBounded(deadline, () => this.#resolve(params, deadline.signal));
33
+ const cancellation = cancelled(deadline);
34
+ const result = cancellation !== void 0 ? err(cancellation) : resolved ?? err(new NeonError("The connection-string resolver ended without a result.", "client"));
35
+ return finalize(result, shouldThrow);
36
+ } finally {
37
+ deadline.dispose();
38
+ }
30
39
  }
31
40
  async #resolve(params, signal) {
32
41
  const client = this.#ctx.client;
@@ -1 +1 @@
1
- {"version":3,"file":"postgres.js","names":["#ctx","#resolve"],"sources":["../../../src/neon/resources/postgres.ts"],"sourcesContent":["import {\n\tgetConnectionUri,\n\tlistProjectBranchDatabases,\n\tlistProjectBranches,\n\tlistProjectBranchRoles,\n} from \"../../client/sdk.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport { NeonError, toNeonError } from \"../errors.js\";\nimport { err, finalize, type NeonResult, type Outcome, ok } from \"../result.js\";\nimport { DataApi } from \"./dataapi.js\";\nimport { Databases } from \"./databases.js\";\nimport { Endpoints } from \"./endpoints.js\";\nimport { Roles } from \"./roles.js\";\n\n/** Parameters for {@link Postgres.connectionString}. */\nexport interface ConnectionStringParams {\n\tprojectId: string;\n\t/** Defaults to the project's default branch. */\n\tbranchId?: string;\n\t/** Defaults to the branch's read-write endpoint. */\n\tendpointId?: string;\n\t/** Auto-selected when the branch has exactly one database. */\n\tdatabaseName?: string;\n\t/** Auto-selected when the branch has exactly one role. */\n\troleName?: string;\n\t/** Pooled connection string (default `true`). */\n\tpooled?: boolean;\n}\n\n/**\n * The Postgres data plane of a branch: compute endpoints, roles, databases, the Data API,\n * and a connection-string helper. (Grouped under `neon.postgres.*` so future top-level\n * namespaces like `functions` / `storage` stay unambiguous.)\n */\nexport class Postgres<DThrow extends boolean> {\n\treadonly endpoints: Endpoints<DThrow>;\n\treadonly roles: Roles<DThrow>;\n\treadonly databases: Databases<DThrow>;\n\treadonly dataApi: DataApi<DThrow>;\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t\tthis.endpoints = new Endpoints<DThrow>(ctx);\n\t\tthis.roles = new Roles<DThrow>(ctx);\n\t\tthis.databases = new Databases<DThrow>(ctx);\n\t\tthis.dataApi = new DataApi<DThrow>(ctx);\n\t}\n\n\t/**\n\t * Resolve a Postgres connection string. Auto-selects the default branch and the sole\n\t * role/database when not specified (mirrors `@neon/config`'s `fetchEnv`); returns\n\t * a `client`-kind {@link NeonError} when the selection is ambiguous.\n\t */\n\tconnectionString(\n\t\tparams: ConnectionStringParams,\n\t): Promise<Outcome<string, DThrow>>;\n\tconnectionString<Throw extends boolean = DThrow>(\n\t\tparams: ConnectionStringParams,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<string, Throw>>;\n\tasync connectionString(\n\t\tparams: ConnectionStringParams,\n\t\topts?: CallOptions,\n\t): Promise<string | NeonResult<string>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\treturn finalize(await this.#resolve(params, opts?.signal), shouldThrow);\n\t}\n\n\tasync #resolve(\n\t\tparams: ConnectionStringParams,\n\t\tsignal?: AbortSignal,\n\t): Promise<NeonResult<string>> {\n\t\tconst client = this.#ctx.client;\n\t\tconst projectId = params.projectId;\n\t\tlet branchId = params.branchId;\n\t\tlet roleName = params.roleName;\n\t\tlet databaseName = params.databaseName;\n\n\t\tif ((!roleName || !databaseName) && !branchId) {\n\t\t\tconst branches = await listProjectBranches({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId },\n\t\t\t\tthrowOnError: false,\n\t\t\t\tsignal,\n\t\t\t});\n\t\t\tif (branches.error || !branches.data) {\n\t\t\t\treturn err(toNeonError(branches.error, branches.response));\n\t\t\t}\n\t\t\tbranchId = branches.data.branches.find(\n\t\t\t\t(branch) => branch.default,\n\t\t\t)?.id;\n\t\t\tif (!branchId) {\n\t\t\t\treturn err(\n\t\t\t\t\tnew NeonError(\n\t\t\t\t\t\t\"Could not determine the default branch; pass branchId.\",\n\t\t\t\t\t\t\"client\",\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (!roleName) {\n\t\t\tif (!branchId) return err(branchRequired(\"roleName\"));\n\t\t\tconst roles = await listProjectBranchRoles({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\tthrowOnError: false,\n\t\t\t\tsignal,\n\t\t\t});\n\t\t\tif (roles.error || !roles.data)\n\t\t\t\treturn err(toNeonError(roles.error, roles.response));\n\t\t\tif (roles.data.roles.length !== 1) {\n\t\t\t\treturn err(\n\t\t\t\t\tambiguous(\"role\", roles.data.roles.length, \"roleName\"),\n\t\t\t\t);\n\t\t\t}\n\t\t\troleName = roles.data.roles[0].name;\n\t\t}\n\n\t\tif (!databaseName) {\n\t\t\tif (!branchId) return err(branchRequired(\"databaseName\"));\n\t\t\tconst databases = await listProjectBranchDatabases({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\tthrowOnError: false,\n\t\t\t\tsignal,\n\t\t\t});\n\t\t\tif (databases.error || !databases.data) {\n\t\t\t\treturn err(toNeonError(databases.error, databases.response));\n\t\t\t}\n\t\t\tif (databases.data.databases.length !== 1) {\n\t\t\t\treturn err(\n\t\t\t\t\tambiguous(\n\t\t\t\t\t\t\"database\",\n\t\t\t\t\t\tdatabases.data.databases.length,\n\t\t\t\t\t\t\"databaseName\",\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tdatabaseName = databases.data.databases[0].name;\n\t\t}\n\n\t\tconst conn = await getConnectionUri({\n\t\t\tclient,\n\t\t\tpath: { project_id: projectId },\n\t\t\tquery: {\n\t\t\t\tbranch_id: branchId,\n\t\t\t\tendpoint_id: params.endpointId,\n\t\t\t\tdatabase_name: databaseName,\n\t\t\t\trole_name: roleName,\n\t\t\t\tpooled: params.pooled ?? true,\n\t\t\t},\n\t\t\tthrowOnError: false,\n\t\t\tsignal,\n\t\t});\n\t\tif (conn.error || !conn.data)\n\t\t\treturn err(toNeonError(conn.error, conn.response));\n\t\treturn ok(conn.data.uri);\n\t}\n}\n\nfunction branchRequired(param: string): NeonError {\n\treturn new NeonError(\n\t\t`Pass branchId or ${param} to resolve a connection string.`,\n\t\t\"client\",\n\t);\n}\n\nfunction ambiguous(kind: string, count: number, param: string): NeonError {\n\treturn new NeonError(\n\t\t`Expected exactly one ${kind} to auto-select for the connection string; found ${count}. Pass ${param}.`,\n\t\t\"client\",\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;AAkCA,IAAa,WAAb,MAA8C;CAC7C;CACA;CACA;CACA;CACA;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;EACZ,KAAK,YAAY,IAAI,UAAkB,GAAG;EAC1C,KAAK,QAAQ,IAAI,MAAc,GAAG;EAClC,KAAK,YAAY,IAAI,UAAkB,GAAG;EAC1C,KAAK,UAAU,IAAI,QAAgB,GAAG;CACvC;CAcA,MAAM,iBACL,QACA,MACuC;EACvC,MAAM,cACL,MAAM,gBAAgB,KAAKA,KAA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GACD,IAAI,UAAU,SAAS,CAAC,UAAU,MACjC,OAAO,IAAI,YAAY,UAAU,OAAO,UAAU,QAAQ,CAAC;GAE5D,IAAI,UAAU,KAAK,UAAU,WAAW,GACvC,OAAO,IACN,UACC,YACA,UAAU,KAAK,UAAU,QACzB,cACD,CACD;GAED,eAAe,UAAU,KAAK,UAAU,EAAE,CAAC;EAC5C;EAEA,MAAM,OAAO,MAAM,iBAAiB;GACnC;GACA,MAAM,EAAE,YAAY,UAAU;GAC9B,OAAO;IACN,WAAW;IACX,aAAa,OAAO;IACpB,eAAe;IACf,WAAW;IACX,QAAQ,OAAO,UAAU;GAC1B;GACA,cAAc;GACd;EACD,CAAC;EACD,IAAI,KAAK,SAAS,CAAC,KAAK,MACvB,OAAO,IAAI,YAAY,KAAK,OAAO,KAAK,QAAQ,CAAC;EAClD,OAAO,GAAG,KAAK,KAAK,GAAG;CACxB;AACD;AAEA,SAAS,eAAe,OAA0B;CACjD,OAAO,IAAI,UACV,oBAAoB,MAAM,mCAC1B,QACD;AACD;AAEA,SAAS,UAAU,MAAc,OAAe,OAA0B;CACzE,OAAO,IAAI,UACV,wBAAwB,KAAK,mDAAmD,MAAM,SAAS,MAAM,IACrG,QACD;AACD"}
1
+ {"version":3,"file":"postgres.js","names":["#ctx","#resolve"],"sources":["../../../src/neon/resources/postgres.ts"],"sourcesContent":["import {\n\tgetConnectionUri,\n\tlistProjectBranchDatabases,\n\tlistProjectBranches,\n\tlistProjectBranchRoles,\n} from \"../../client/sdk.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport { cancelled, runBounded } from \"../deadline.js\";\nimport { NeonError, toNeonError } from \"../errors.js\";\nimport { err, finalize, type NeonResult, type Outcome, ok } from \"../result.js\";\nimport { DataApi } from \"./dataapi.js\";\nimport { Databases } from \"./databases.js\";\nimport { Endpoints } from \"./endpoints.js\";\nimport { Roles } from \"./roles.js\";\n\n/** Parameters for {@link Postgres.connectionString}. */\nexport interface ConnectionStringParams {\n\tprojectId: string;\n\t/** Defaults to the project's default branch. */\n\tbranchId?: string;\n\t/** Defaults to the branch's read-write endpoint. */\n\tendpointId?: string;\n\t/** Auto-selected when the branch has exactly one database. */\n\tdatabaseName?: string;\n\t/** Auto-selected when the branch has exactly one role. */\n\troleName?: string;\n\t/** Pooled connection string (default `true`). */\n\tpooled?: boolean;\n}\n\n/**\n * The Postgres data plane of a branch: compute endpoints, roles, databases, the Data API,\n * and a connection-string helper. (Grouped under `neon.postgres.*` so future top-level\n * namespaces like `functions` / `storage` stay unambiguous.)\n */\nexport class Postgres<DThrow extends boolean> {\n\treadonly endpoints: Endpoints<DThrow>;\n\treadonly roles: Roles<DThrow>;\n\treadonly databases: Databases<DThrow>;\n\treadonly dataApi: DataApi<DThrow>;\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t\tthis.endpoints = new Endpoints<DThrow>(ctx);\n\t\tthis.roles = new Roles<DThrow>(ctx);\n\t\tthis.databases = new Databases<DThrow>(ctx);\n\t\tthis.dataApi = new DataApi<DThrow>(ctx);\n\t}\n\n\t/**\n\t * Resolve a Postgres connection string. Auto-selects the default branch and the sole\n\t * role/database when not specified (mirrors `@neon/config`'s `fetchEnv`); returns\n\t * a `client`-kind {@link NeonError} when the selection is ambiguous.\n\t */\n\tconnectionString(\n\t\tparams: ConnectionStringParams,\n\t): Promise<Outcome<string, DThrow>>;\n\tconnectionString<Throw extends boolean = DThrow>(\n\t\tparams: ConnectionStringParams,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<string, Throw>>;\n\tasync connectionString(\n\t\tparams: ConnectionStringParams,\n\t\topts?: CallOptions,\n\t): Promise<string | NeonResult<string>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\t// This resolver makes up to four sequential requests without going through\n\t\t// RequestContext, so it owns the deadline covering all of them.\n\t\tconst deadline = this.#ctx.deadlineFor(opts);\n\t\ttry {\n\t\t\tconst resolved = await runBounded(deadline, () =>\n\t\t\t\tthis.#resolve(params, deadline.signal),\n\t\t\t);\n\t\t\tconst cancellation = cancelled(deadline);\n\t\t\t// `runBounded` resolves undefined only when the deadline won the race, which\n\t\t\t// `cancelled` then reports, so the fallback is unreachable by construction.\n\t\t\tconst result: NeonResult<string> =\n\t\t\t\tcancellation !== undefined\n\t\t\t\t\t? err(cancellation)\n\t\t\t\t\t: (resolved ??\n\t\t\t\t\t\terr(\n\t\t\t\t\t\t\tnew NeonError(\n\t\t\t\t\t\t\t\t\"The connection-string resolver ended without a result.\",\n\t\t\t\t\t\t\t\t\"client\",\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t));\n\t\t\treturn finalize(result, shouldThrow);\n\t\t} finally {\n\t\t\tdeadline.dispose();\n\t\t}\n\t}\n\n\tasync #resolve(\n\t\tparams: ConnectionStringParams,\n\t\tsignal?: AbortSignal,\n\t): Promise<NeonResult<string>> {\n\t\tconst client = this.#ctx.client;\n\t\tconst projectId = params.projectId;\n\t\tlet branchId = params.branchId;\n\t\tlet roleName = params.roleName;\n\t\tlet databaseName = params.databaseName;\n\n\t\tif ((!roleName || !databaseName) && !branchId) {\n\t\t\tconst branches = await listProjectBranches({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId },\n\t\t\t\tthrowOnError: false,\n\t\t\t\tsignal,\n\t\t\t});\n\t\t\tif (branches.error || !branches.data) {\n\t\t\t\treturn err(toNeonError(branches.error, branches.response));\n\t\t\t}\n\t\t\tbranchId = branches.data.branches.find(\n\t\t\t\t(branch) => branch.default,\n\t\t\t)?.id;\n\t\t\tif (!branchId) {\n\t\t\t\treturn err(\n\t\t\t\t\tnew NeonError(\n\t\t\t\t\t\t\"Could not determine the default branch; pass branchId.\",\n\t\t\t\t\t\t\"client\",\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\tif (!roleName) {\n\t\t\tif (!branchId) return err(branchRequired(\"roleName\"));\n\t\t\tconst roles = await listProjectBranchRoles({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\tthrowOnError: false,\n\t\t\t\tsignal,\n\t\t\t});\n\t\t\tif (roles.error || !roles.data)\n\t\t\t\treturn err(toNeonError(roles.error, roles.response));\n\t\t\tif (roles.data.roles.length !== 1) {\n\t\t\t\treturn err(\n\t\t\t\t\tambiguous(\"role\", roles.data.roles.length, \"roleName\"),\n\t\t\t\t);\n\t\t\t}\n\t\t\troleName = roles.data.roles[0].name;\n\t\t}\n\n\t\tif (!databaseName) {\n\t\t\tif (!branchId) return err(branchRequired(\"databaseName\"));\n\t\t\tconst databases = await listProjectBranchDatabases({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\tthrowOnError: false,\n\t\t\t\tsignal,\n\t\t\t});\n\t\t\tif (databases.error || !databases.data) {\n\t\t\t\treturn err(toNeonError(databases.error, databases.response));\n\t\t\t}\n\t\t\tif (databases.data.databases.length !== 1) {\n\t\t\t\treturn err(\n\t\t\t\t\tambiguous(\n\t\t\t\t\t\t\"database\",\n\t\t\t\t\t\tdatabases.data.databases.length,\n\t\t\t\t\t\t\"databaseName\",\n\t\t\t\t\t),\n\t\t\t\t);\n\t\t\t}\n\t\t\tdatabaseName = databases.data.databases[0].name;\n\t\t}\n\n\t\tconst conn = await getConnectionUri({\n\t\t\tclient,\n\t\t\tpath: { project_id: projectId },\n\t\t\tquery: {\n\t\t\t\tbranch_id: branchId,\n\t\t\t\tendpoint_id: params.endpointId,\n\t\t\t\tdatabase_name: databaseName,\n\t\t\t\trole_name: roleName,\n\t\t\t\tpooled: params.pooled ?? true,\n\t\t\t},\n\t\t\tthrowOnError: false,\n\t\t\tsignal,\n\t\t});\n\t\tif (conn.error || !conn.data)\n\t\t\treturn err(toNeonError(conn.error, conn.response));\n\t\treturn ok(conn.data.uri);\n\t}\n}\n\nfunction branchRequired(param: string): NeonError {\n\treturn new NeonError(\n\t\t`Pass branchId or ${param} to resolve a connection string.`,\n\t\t\"client\",\n\t);\n}\n\nfunction ambiguous(kind: string, count: number, param: string): NeonError {\n\treturn new NeonError(\n\t\t`Expected exactly one ${kind} to auto-select for the connection string; found ${count}. Pass ${param}.`,\n\t\t\"client\",\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,IAAa,WAAb,MAA8C;CAC7C;CACA;CACA;CACA;CACA;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;EACZ,KAAK,YAAY,IAAI,UAAkB,GAAG;EAC1C,KAAK,QAAQ,IAAI,MAAc,GAAG;EAClC,KAAK,YAAY,IAAI,UAAkB,GAAG;EAC1C,KAAK,UAAU,IAAI,QAAgB,GAAG;CACvC;CAcA,MAAM,iBACL,QACA,MACuC;EACvC,MAAM,cACL,MAAM,gBAAgB,KAAKA,KAAK,SAAS;EAG1C,MAAM,WAAW,KAAKA,KAAK,YAAY,IAAI;EAC3C,IAAI;GACH,MAAM,WAAW,MAAM,WAAW,gBACjC,KAAKC,SAAS,QAAQ,SAAS,MAAM,CACtC;GACA,MAAM,eAAe,UAAU,QAAQ;GAGvC,MAAM,SACL,iBAAiB,KAAA,IACd,IAAI,YAAY,IACf,YACF,IACC,IAAI,UACH,0DACA,QACD,CACD;GACH,OAAO,SAAS,QAAQ,WAAW;EACpC,UAAU;GACT,SAAS,QAAQ;EAClB;CACD;CAEA,MAAMA,SACL,QACA,QAC8B;EAC9B,MAAM,SAAS,KAAKD,KAAK;EACzB,MAAM,YAAY,OAAO;EACzB,IAAI,WAAW,OAAO;EACtB,IAAI,WAAW,OAAO;EACtB,IAAI,eAAe,OAAO;EAE1B,KAAK,CAAC,YAAY,CAAC,iBAAiB,CAAC,UAAU;GAC9C,MAAM,WAAW,MAAM,oBAAoB;IAC1C;IACA,MAAM,EAAE,YAAY,UAAU;IAC9B,cAAc;IACd;GACD,CAAC;GACD,IAAI,SAAS,SAAS,CAAC,SAAS,MAC/B,OAAO,I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AAS,CAAC,KAAK,MACvB,OAAO,IAAI,YAAY,KAAK,OAAO,KAAK,QAAQ,CAAC;EAClD,OAAO,GAAG,KAAK,KAAK,GAAG;CACxB;AACD;AAEA,SAAS,eAAe,OAA0B;CACjD,OAAO,IAAI,UACV,oBAAoB,MAAM,mCAC1B,QACD;AACD;AAEA,SAAS,UAAU,MAAc,OAAe,OAA0B;CACzE,OAAO,IAAI,UACV,wBAAwB,KAAK,mDAAmD,MAAM,SAAS,MAAM,IACrG,QACD;AACD"}
@@ -1,4 +1,4 @@
1
- import { ListProjectsData, Project, ProjectCreateRequest, ProjectListItem, ProjectPermission, ProjectUpdateRequest } from "../../client/types.gen.js";
1
+ import { ListProjectMembersData, ListProjectsData, Project, ProjectCreateRequest, ProjectListItem, ProjectMember, ProjectMemberRoleResponse, ProjectPermission, ProjectRole, ProjectUpdateRequest } from "../../client/types.gen.js";
2
2
  import { Outcome } from "../result.js";
3
3
  import { CallOptions, RequestContext } from "../context.js";
4
4
  import { Paginated } from "../paginate.js";
@@ -15,6 +15,23 @@ interface TransferProjectsInput {
15
15
  type ListQuery = Omit<NonNullable<ListProjectsData["query"]>, "cursor">;
16
16
  type CreateInput = ProjectCreateRequest["project"];
17
17
  type UpdateInput = ProjectUpdateRequest["project"];
18
+ type MemberListQuery = Omit<NonNullable<ListProjectMembersData["query"]>, "cursor">;
19
+ /** Per-call options for {@link Members.setRole}. */
20
+ interface SetRoleOptions<Throw extends boolean = boolean> extends CallOptions<Throw> {
21
+ /**
22
+ * Acknowledge that the call lowers the caller's own role. The API rejects a
23
+ * self-demotion without it, so it is left off by default.
24
+ */
25
+ confirmSelfDemotion?: boolean;
26
+ }
27
+ /** Per-call options for {@link Members.removeRole}. */
28
+ interface RemoveRoleOptions<Throw extends boolean = boolean> extends CallOptions<Throw> {
29
+ /**
30
+ * Acknowledge that the call can cost the caller management access. The API
31
+ * rejects such a self-removal without it, so it is left off by default.
32
+ */
33
+ confirmSelfLockout?: boolean;
34
+ }
18
35
  /** Per-call options for the connect workflow. */
19
36
  interface WorkflowOptions<Throw extends boolean> extends CallOptions<Throw> {
20
37
  /** Return a pooled connection string (default `true`). */
@@ -39,11 +56,52 @@ declare class Permissions<DThrow extends boolean> {
39
56
  revoke(projectId: string, permissionId: string): Promise<Outcome<ProjectPermission, DThrow>>;
40
57
  revoke<Throw extends boolean = DThrow>(projectId: string, permissionId: string, opts: CallOptions<Throw>): Promise<Outcome<ProjectPermission, Throw>>;
41
58
  }
59
+ /**
60
+ * Per-project roles for members of the owning organization.
61
+ *
62
+ * Distinct from {@link Permissions}, which shares a project with an individual by
63
+ * email address: these act on existing org members by member id, and clearing a
64
+ * grant leaves the member's organization-role default in force rather than
65
+ * removing their access.
66
+ */
67
+ declare class Members<DThrow extends boolean> {
68
+ #private;
69
+ constructor(ctx: RequestContext);
70
+ /**
71
+ * List org members and their project roles (cursor-paginated). Org-owned
72
+ * projects only — a personal project answers `404`, as does an org with
73
+ * per-project role management disabled.
74
+ *
75
+ * @apiCall GET /projects/{project_id}/members (cursor-paginated)
76
+ */
77
+ list(projectId: string, query?: MemberListQuery, opts?: CallOptions): Paginated<ProjectMember>;
78
+ /**
79
+ * Set a member's explicit project role, replacing any existing grant.
80
+ * Idempotent. Check `credential_rotation_recommended` and
81
+ * `org_api_key_rotation_recommended` on the result — a downgrade can leave
82
+ * credentials the member still holds.
83
+ *
84
+ * @apiCall PUT /projects/{project_id}/members/{member_id}/role
85
+ */
86
+ setRole(projectId: string, memberId: string, role: ProjectRole): Promise<Outcome<ProjectMemberRoleResponse, DThrow>>;
87
+ setRole<Throw extends boolean = DThrow>(projectId: string, memberId: string, role: ProjectRole, opts: SetRoleOptions<Throw>): Promise<Outcome<ProjectMemberRoleResponse, Throw>>;
88
+ /**
89
+ * Clear a member's explicit project grant. Idempotent, and a no-op when no
90
+ * explicit grant exists. The member keeps whatever their organization role
91
+ * grants by default, so this narrows access rather than removing it.
92
+ *
93
+ * @apiCall DELETE /projects/{project_id}/members/{member_id}/role
94
+ */
95
+ removeRole(projectId: string, memberId: string): Promise<Outcome<ProjectMemberRoleResponse, DThrow>>;
96
+ removeRole<Throw extends boolean = DThrow>(projectId: string, memberId: string, opts: RemoveRoleOptions<Throw>): Promise<Outcome<ProjectMemberRoleResponse, Throw>>;
97
+ }
42
98
  /** Project resource — one API call per method (`list` is cursor-paginated). */
43
99
  declare class Projects<DThrow extends boolean> {
44
100
  #private;
45
101
  /** Project access grants (share by email). */
46
102
  readonly permissions: Permissions<DThrow>;
103
+ /** Per-project roles for members of the owning organization. */
104
+ readonly members: Members<DThrow>;
47
105
  constructor(ctx: RequestContext);
48
106
  /**
49
107
  * List projects (cursor-paginated). Returns a lazy list — `await .all()`, `.page()`,
@@ -51,7 +109,7 @@ declare class Projects<DThrow extends boolean> {
51
109
  *
52
110
  * @apiCall GET /projects
53
111
  */
54
- list(query?: ListQuery): Paginated<ProjectListItem>;
112
+ list(query?: ListQuery, opts?: CallOptions): Paginated<ProjectListItem>;
55
113
  /** @apiCall GET /projects/{project_id} */
56
114
  get(id: string): Promise<Outcome<Project, DThrow>>;
57
115
  get<Throw extends boolean = DThrow>(id: string, opts: CallOptions<Throw>): Promise<Outcome<Project, Throw>>;
@@ -74,8 +132,7 @@ declare class Projects<DThrow extends boolean> {
74
132
  delete(id: string): Promise<Outcome<Project, DThrow>>;
75
133
  delete<Throw extends boolean = DThrow>(id: string, opts: CallOptions<Throw>): Promise<Outcome<Project, Throw>>;
76
134
  /**
77
- * Recover a soft-deleted project within its retention window (beta). Mirrors
78
- * `branches.recover` at the project level.
135
+ * Recover a soft-deleted project within its retention window (beta).
79
136
  *
80
137
  * @apiCall POST /projects/{project_id}/recover
81
138
  */
@@ -104,5 +161,5 @@ declare class Projects<DThrow extends boolean> {
104
161
  }, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
105
162
  }
106
163
  //#endregion
107
- export { Permissions, ProjectConnection, Projects, TransferProjectsInput };
164
+ export { Members, Permissions, ProjectConnection, Projects, RemoveRoleOptions, SetRoleOptions, TransferProjectsInput };
108
165
  //# sourceMappingURL=projects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"projects.d.ts","names":[],"sources":["../../../src/neon/resources/projects.ts"],"mappings":";;;;;;;UA4BiB,qBAAA;EAAA;EAQZ,SAAA,CAAA,EAAS,MAAA;EAAA;EAAoB,OAAA,EAAA,MAAA;EAAZ,UAAA,EAAA,MAAA,EAAA;AAAL;AAAI,KAAhB,SAAA,GAAY,IAAI,CAAC,WAAD,CAAa,gBAAb,CAAA,OAAA,CAAA,CAAA,EAAA,QAAA,CAAA;AAAA,KAChB,WAAA,GAAc,oBAAA,CAAA,SAAA,CAAA;AAAoB,KAClC,WAAA,GAAc,oBAAA,CAAA,SAAA,CAAA;AAAoB;AAGd,UAAf,eAAe,CAAA,cAAA,OAAA,CAAA,SAAgC,WAAhC,CAA4C,KAA5C,CAAA,CAAA;EAA4C;EAAZ,MAAA,CAAA,EAAA,OAAA;AAAW;AAMpE;AAMa,UANI,iBAAA,CAMO;EAAA,OAAA,EALd,OAKc;EAGN,gBAAA,EAAA,MAAA;AAKwB;AAAqB;AAA7B,cARrB,WAQqB,CAAA,eAAA,OAAA,CAAA,CAAA;EAAR,CAAA,OAAA;EACI,WAAA,CAAA,GAAA,EANZ,cAMY;EAEV;EAAZ,IAAA,CAAA,SAAA,EAAA,MAAA,CAAA,EAHkB,OAGlB,CAH0B,OAG1B,CAHkC,iBAGlC,EAAA,EAHuD,MAGvD,CAAA,CAAA;EACY,IAAA,CAAA,cAAA,OAAA,GAHU,MAGV,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,IAAA,EADZ,WACY,CADA,KACA,CAAA,CAAA,EAAhB,OAAgB,CAAR,OAAQ,CAAA,iBAAA,EAAA,EAAqB,KAArB,CAAA,CAAA;EAAqB;EAA7B,KAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,EAAA,MAAA,CAAA,EAqBR,OArBQ,CAqBA,OArBA,CAqBQ,iBArBR,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,CAqIR,OArIQ,CAqIA,OArIA,EAqIS,KArIT,CAAA,CAAA;EAAS;AAAjB;AAAR;AAiCM;AACU;AAAmB;EAA3B,QAAA,CAAA,KAAA,EA2HK,qBA3HL,CAAA,EA2H6B,OA3H7B,CA2HqC,OA3HrC,CAAA,IAAA,EA2HmD,MA3HnD,CAAA,CAAA;EAAR,QAAA,CAAA,cAAA,OAAA,GA4H8B,MA5H9B,CAAA,CAAA,KAAA,EA6HK,qBA7HL,EAAA,IAAA,EA8HI,WA9HJ,CA8HgB,KA9HhB,CAAA,CAAA,EA+HA,OA/HA,CA+HQ,OA/HR,CAAA,IAAA,EA+HsB,KA/HtB,CAAA,CAAA;EACsC;AACjC;AACe;AAAhB;AACY;EAAmB,gBAAA,CAAA,KAAA,EAAA;IAA3B,OAAA,EAAA,MAAA;IAAR,UAAA,EAAA,MAAA,EAAA;EAsCuB,CAAA,CAAA,EAiItB,OAjIsB,CAiId,OAjIc,CAAA,IAAA,EAiIA,MAjIA,CAAA,CAAA;EAA8B,gBAAA,CAAA,cAAA,OAAA,GAkIf,MAlIe,CAAA,CAAA,KAAA,EAAA;IAAS,OAAA,EAAA,MAAA;IAAjB,UAAA,EAAA,MAAA,EAAA;EAAR,CAAA,EAAA,IAAA,EAoIjC,WApIiC,CAoIrB,KApIqB,CAAA,CAAA,EAqIrC,OArIqC,CAqI7B,OArI6B,CAAA,IAAA,EAqIf,KArIe,CAAA,CAAA;AACT"}
@@ -1,6 +1,6 @@
1
1
  import { NeonError } from "../errors.js";
2
2
  import { err, finalize } from "../result.js";
3
- import { createProject, deleteProject, getProject, grantPermissionToProject, listProjectPermissions, listProjects, recoverProject, revokePermissionFromProject, transferProjectsFromOrgToOrg, transferProjectsFromUserToOrg, updateProject } from "../../client/sdk.gen.js";
3
+ import { createProject, deleteProject, getProject, grantPermissionToProject, listProjectMembers, listProjectPermissions, listProjects, recoverProject, removeProjectMemberRole, revokePermissionFromProject, setProjectMemberRole, transferProjectsFromOrgToOrg, transferProjectsFromUserToOrg, updateProject } from "../../client/sdk.gen.js";
4
4
  import { withConnectionString } from "../connection.js";
5
5
  import { paginate } from "../paginate.js";
6
6
  //#region src/neon/resources/projects.ts
@@ -11,28 +11,92 @@ var Permissions = class {
11
11
  this.#ctx = ctx;
12
12
  }
13
13
  list(projectId, opts) {
14
- return this.#ctx.run(opts, (client) => listProjectPermissions({
14
+ return this.#ctx.run(opts, (client, signal) => listProjectPermissions({
15
15
  client,
16
16
  path: { project_id: projectId },
17
- throwOnError: false
17
+ throwOnError: false,
18
+ signal
18
19
  }), (data) => data.project_permissions);
19
20
  }
20
21
  grant(projectId, email, opts) {
21
- return this.#ctx.run(opts, (client) => grantPermissionToProject({
22
+ return this.#ctx.run(opts, (client, signal) => grantPermissionToProject({
22
23
  client,
23
24
  path: { project_id: projectId },
24
25
  body: { email },
25
- throwOnError: false
26
+ throwOnError: false,
27
+ signal
26
28
  }), (data) => data);
27
29
  }
28
30
  revoke(projectId, permissionId, opts) {
29
- return this.#ctx.run(opts, (client) => revokePermissionFromProject({
31
+ return this.#ctx.run(opts, (client, signal) => revokePermissionFromProject({
30
32
  client,
31
33
  path: {
32
34
  project_id: projectId,
33
35
  permission_id: permissionId
34
36
  },
35
- throwOnError: false
37
+ throwOnError: false,
38
+ signal
39
+ }), (data) => data);
40
+ }
41
+ };
42
+ /**
43
+ * Per-project roles for members of the owning organization.
44
+ *
45
+ * Distinct from {@link Permissions}, which shares a project with an individual by
46
+ * email address: these act on existing org members by member id, and clearing a
47
+ * grant leaves the member's organization-role default in force rather than
48
+ * removing their access.
49
+ */
50
+ var Members = class {
51
+ #ctx;
52
+ constructor(ctx) {
53
+ this.#ctx = ctx;
54
+ }
55
+ /**
56
+ * List org members and their project roles (cursor-paginated). Org-owned
57
+ * projects only — a personal project answers `404`, as does an org with
58
+ * per-project role management disabled.
59
+ *
60
+ * @apiCall GET /projects/{project_id}/members (cursor-paginated)
61
+ */
62
+ list(projectId, query, opts) {
63
+ return paginate((cursor, signal) => listProjectMembers({
64
+ client: this.#ctx.client,
65
+ path: { project_id: projectId },
66
+ query: {
67
+ ...query,
68
+ cursor
69
+ },
70
+ throwOnError: false,
71
+ signal
72
+ }), (data) => ({
73
+ items: data?.project_members ?? [],
74
+ cursor: data?.pagination?.next
75
+ }), () => this.#ctx.deadlineFor(opts));
76
+ }
77
+ setRole(projectId, memberId, role, opts) {
78
+ return this.#ctx.run(opts, (client, signal) => setProjectMemberRole({
79
+ client,
80
+ path: {
81
+ project_id: projectId,
82
+ member_id: memberId
83
+ },
84
+ query: opts?.confirmSelfDemotion ? { confirm_self_demotion: true } : void 0,
85
+ body: { role },
86
+ throwOnError: false,
87
+ signal
88
+ }), (data) => data);
89
+ }
90
+ removeRole(projectId, memberId, opts) {
91
+ return this.#ctx.run(opts, (client, signal) => removeProjectMemberRole({
92
+ client,
93
+ path: {
94
+ project_id: projectId,
95
+ member_id: memberId
96
+ },
97
+ query: opts?.confirmSelfLockout ? { confirm_self_lockout: true } : void 0,
98
+ throwOnError: false,
99
+ signal
36
100
  }), (data) => data);
37
101
  }
38
102
  };
@@ -41,9 +105,12 @@ var Projects = class {
41
105
  #ctx;
42
106
  /** Project access grants (share by email). */
43
107
  permissions;
108
+ /** Per-project roles for members of the owning organization. */
109
+ members;
44
110
  constructor(ctx) {
45
111
  this.#ctx = ctx;
46
112
  this.permissions = new Permissions(ctx);
113
+ this.members = new Members(ctx);
47
114
  }
48
115
  /**
49
116
  * List projects (cursor-paginated). Returns a lazy list — `await .all()`, `.page()`,
@@ -51,7 +118,7 @@ var Projects = class {
51
118
  *
52
119
  * @apiCall GET /projects
53
120
  */
54
- list(query) {
121
+ list(query, opts) {
55
122
  return paginate((cursor, signal) => listProjects({
56
123
  client: this.#ctx.client,
57
124
  query: {
@@ -64,90 +131,100 @@ var Projects = class {
64
131
  }), (data) => ({
65
132
  items: data?.projects ?? [],
66
133
  cursor: data?.pagination?.cursor
67
- }));
134
+ }), () => this.#ctx.deadlineFor(opts));
68
135
  }
69
136
  get(id, opts) {
70
- return this.#ctx.run(opts, (client) => getProject({
137
+ return this.#ctx.run(opts, (client, signal) => getProject({
71
138
  client,
72
139
  path: { project_id: id },
73
- throwOnError: false
140
+ throwOnError: false,
141
+ signal
74
142
  }), (data) => data.project);
75
143
  }
76
144
  create(input, opts) {
77
- return this.#ctx.run(opts, (client) => createProject({
145
+ return this.#ctx.run(opts, (client, signal) => createProject({
78
146
  client,
79
147
  body: { project: {
80
148
  ...this.#ctx.defaults.orgId ? { org_id: this.#ctx.defaults.orgId } : {},
81
149
  ...input
82
150
  } },
83
- throwOnError: false
151
+ throwOnError: false,
152
+ signal
84
153
  }), (data) => data.project);
85
154
  }
86
155
  async createAndConnect(input, opts) {
87
156
  const shouldThrow = opts?.throwOnError ?? this.#ctx.defaults.throwOnError;
88
- return finalize(withConnectionString(await this.#ctx.execute({
157
+ const result = await this.#ctx.execute({
89
158
  ...opts,
90
159
  waitForReadiness: opts?.waitForReadiness ?? true
91
- }, (client) => createProject({
160
+ }, (client, signal) => createProject({
92
161
  client,
93
162
  body: { project: {
94
163
  ...this.#ctx.defaults.orgId ? { org_id: this.#ctx.defaults.orgId } : {},
95
164
  ...input
96
165
  } },
97
- throwOnError: false
98
- }), (data) => data), (data) => data.connection_uris, (data, connectionString) => ({
166
+ throwOnError: false,
167
+ signal
168
+ }), (data) => data);
169
+ const out = withConnectionString(result, (data) => data.connection_uris, (data, connectionString) => ({
99
170
  project: data.project,
100
171
  connectionString
101
- }), opts?.pooled ?? true), shouldThrow);
172
+ }), opts?.pooled ?? true);
173
+ return finalize(out, shouldThrow);
102
174
  }
103
175
  update(id, input, opts) {
104
- return this.#ctx.run(opts, (client) => updateProject({
176
+ return this.#ctx.run(opts, (client, signal) => updateProject({
105
177
  client,
106
178
  path: { project_id: id },
107
179
  body: { project: input },
108
- throwOnError: false
180
+ throwOnError: false,
181
+ signal
109
182
  }), (data) => data.project);
110
183
  }
111
184
  delete(id, opts) {
112
- return this.#ctx.run(opts, (client) => deleteProject({
185
+ return this.#ctx.run(opts, (client, signal) => deleteProject({
113
186
  client,
114
187
  path: { project_id: id },
115
- throwOnError: false
188
+ throwOnError: false,
189
+ signal
116
190
  }), (data) => data.project);
117
191
  }
118
192
  recover(id, opts) {
119
- return this.#ctx.run(opts, (client) => recoverProject({
193
+ return this.#ctx.run(opts, (client, signal) => recoverProject({
120
194
  client,
121
195
  path: { project_id: id },
122
- throwOnError: false
196
+ throwOnError: false,
197
+ signal
123
198
  }), (data) => data.project);
124
199
  }
125
200
  async transfer(input, opts) {
126
201
  const shouldThrow = opts?.throwOnError ?? this.#ctx.defaults.throwOnError;
127
202
  const fromOrgId = input.fromOrgId ?? this.#ctx.defaults.orgId;
128
203
  if (!fromOrgId) return finalize(err(new NeonError("Pass fromOrgId or set orgId on the client.", "client")), shouldThrow);
129
- return this.#ctx.run(opts, (client) => transferProjectsFromOrgToOrg({
204
+ return this.#ctx.run(opts, (client, signal) => transferProjectsFromOrgToOrg({
130
205
  client,
131
206
  path: { source_org_id: fromOrgId },
132
207
  body: {
133
208
  destination_org_id: input.toOrgId,
134
209
  project_ids: input.projectIds
135
210
  },
136
- throwOnError: false
211
+ throwOnError: false,
212
+ signal
137
213
  }), () => void 0);
138
214
  }
139
215
  transferFromUser(input, opts) {
140
- return this.#ctx.run(opts, (client) => transferProjectsFromUserToOrg({
216
+ return this.#ctx.run(opts, (client, signal) => transferProjectsFromUserToOrg({
141
217
  client,
142
218
  body: {
143
219
  destination_org_id: input.toOrgId,
144
220
  project_ids: input.projectIds
145
221
  },
146
- throwOnError: false
222
+ throwOnError: false,
223
+ signal
147
224
  }), () => void 0);
148
225
  }
149
226
  };
150
227
  //#endregion
151
- export { Permissions, Projects };
228
+ export { Members, Permissions, Projects };
152
229
 
153
230
  //# sourceMappingURL=projects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"projects.js","names":["#ctx"],"sources":["../../../src/neon/resources/projects.ts"],"sourcesContent":["import {\n\tcreateProject,\n\tdeleteProject,\n\tgetProject,\n\tgrantPermissionToProject,\n\tlistProjectPermissions,\n\tlistProjects,\n\trecoverProject,\n\trevokePermissionFromProject,\n\ttransferProjectsFromOrgToOrg,\n\ttransferProjectsFromUserToOrg,\n\tupdateProject,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tListProjectsData,\n\tProject,\n\tProjectCreateRequest,\n\tProjectListItem,\n\tProjectPermission,\n\tProjectUpdateRequest,\n} from \"../../client/types.gen.js\";\nimport { withConnectionString } from \"../connection.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport { NeonError } from \"../errors.js\";\nimport { type Paginated, paginate } from \"../paginate.js\";\nimport { err, finalize, type NeonResult, type Outcome } from \"../result.js\";\n\n/** Input for {@link Projects.transfer} (org → org). */\nexport interface TransferProjectsInput {\n\t/** Source org. Defaults to the client's `orgId`. */\n\tfromOrgId?: string;\n\t/** Destination org. */\n\ttoOrgId: string;\n\tprojectIds: string[];\n}\n\ntype ListQuery = Omit<NonNullable<ListProjectsData[\"query\"]>, \"cursor\">;\ntype CreateInput = ProjectCreateRequest[\"project\"];\ntype UpdateInput = ProjectUpdateRequest[\"project\"];\n\n/** Per-call options for the connect workflow. */\ninterface WorkflowOptions<Throw extends boolean> extends CallOptions<Throw> {\n\t/** Return a pooled connection string (default `true`). */\n\tpooled?: boolean;\n}\n\n/** A project with a ready-to-use connection string to its default branch. */\nexport interface ProjectConnection {\n\tproject: Project;\n\tconnectionString: string;\n}\n\n/** Project access grants (share a project with additional users by email). */\nexport class Permissions<DThrow extends boolean> {\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\t/** @apiCall GET /projects/{project_id}/permissions */\n\tlist(projectId: string): Promise<Outcome<ProjectPermission[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<ProjectPermission[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\topts?: CallOptions,\n\t): Promise<ProjectPermission[] | NeonResult<ProjectPermission[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tlistProjectPermissions({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.project_permissions,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/permissions */\n\tgrant(\n\t\tprojectId: string,\n\t\temail: string,\n\t): Promise<Outcome<ProjectPermission, DThrow>>;\n\tgrant<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\temail: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<ProjectPermission, Throw>>;\n\tgrant(\n\t\tprojectId: string,\n\t\temail: string,\n\t\topts?: CallOptions,\n\t): Promise<ProjectPermission | NeonResult<ProjectPermission>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgrantPermissionToProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tbody: { email },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/permissions/{permission_id} */\n\trevoke(\n\t\tprojectId: string,\n\t\tpermissionId: string,\n\t): Promise<Outcome<ProjectPermission, DThrow>>;\n\trevoke<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tpermissionId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<ProjectPermission, Throw>>;\n\trevoke(\n\t\tprojectId: string,\n\t\tpermissionId: string,\n\t\topts?: CallOptions,\n\t): Promise<ProjectPermission | NeonResult<ProjectPermission>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\trevokePermissionFromProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: {\n\t\t\t\t\t\tproject_id: projectId,\n\t\t\t\t\t\tpermission_id: permissionId,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n}\n\n/** Project resource — one API call per method (`list` is cursor-paginated). */\nexport class Projects<DThrow extends boolean> {\n\treadonly #ctx: RequestContext;\n\t/** Project access grants (share by email). */\n\treadonly permissions: Permissions<DThrow>;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t\tthis.permissions = new Permissions<DThrow>(ctx);\n\t}\n\n\t/**\n\t * List projects (cursor-paginated). Returns a lazy list — `await .all()`, `.page()`,\n\t * or `for await (… of …)`.\n\t *\n\t * @apiCall GET /projects\n\t */\n\tlist(query?: ListQuery): Paginated<ProjectListItem> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tlistProjects({\n\t\t\t\t\tclient: this.#ctx.client,\n\t\t\t\t\tquery: {\n\t\t\t\t\t\torg_id: this.#ctx.defaults.orgId,\n\t\t\t\t\t\t...query,\n\t\t\t\t\t\tcursor,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => ({\n\t\t\t\titems: data?.projects ?? [],\n\t\t\t\tcursor: data?.pagination?.cursor,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall GET /projects/{project_id} */\n\tget(id: string): Promise<Outcome<Project, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tid: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\tget(\n\t\tid: string,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: id },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects */\n\tcreate(input?: CreateInput): Promise<Outcome<Project, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tinput: CreateInput | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\tcreate(\n\t\tinput?: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tproject: {\n\t\t\t\t\t\t\t...(this.#ctx.defaults.orgId\n\t\t\t\t\t\t\t\t? { org_id: this.#ctx.defaults.orgId }\n\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/**\n\t * Create a project and return a ready-to-use connection string to its default branch.\n\t * One API call plus readiness polling (the create response already carries the\n\t * connection URI).\n\t *\n\t * @workflow createProject + waitForReadiness\n\t */\n\tcreateAndConnect(\n\t\tinput?: CreateInput,\n\t): Promise<Outcome<ProjectConnection, DThrow>>;\n\tcreateAndConnect<Throw extends boolean = DThrow>(\n\t\tinput: CreateInput | undefined,\n\t\topts: WorkflowOptions<Throw>,\n\t): Promise<Outcome<ProjectConnection, Throw>>;\n\tasync createAndConnect(\n\t\tinput?: CreateInput,\n\t\topts?: WorkflowOptions<boolean>,\n\t): Promise<ProjectConnection | NeonResult<ProjectConnection>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\tconst result = await this.#ctx.execute(\n\t\t\t{ ...opts, waitForReadiness: opts?.waitForReadiness ?? true },\n\t\t\t(client) =>\n\t\t\t\tcreateProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tproject: {\n\t\t\t\t\t\t\t...(this.#ctx.defaults.orgId\n\t\t\t\t\t\t\t\t? { org_id: this.#ctx.defaults.orgId }\n\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t\tconst out = withConnectionString(\n\t\t\tresult,\n\t\t\t(data) => data.connection_uris,\n\t\t\t(data, connectionString) => ({\n\t\t\t\tproject: data.project,\n\t\t\t\tconnectionString,\n\t\t\t}),\n\t\t\topts?.pooled ?? true,\n\t\t);\n\t\treturn finalize(out, shouldThrow);\n\t}\n\n\t/** @apiCall PATCH /projects/{project_id} */\n\tupdate(id: string, input: UpdateInput): Promise<Outcome<Project, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tid: string,\n\t\tinput: UpdateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\tupdate(\n\t\tid: string,\n\t\tinput: UpdateInput,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tupdateProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: id },\n\t\t\t\t\tbody: { project: input },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id} */\n\tdelete(id: string): Promise<Outcome<Project, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tid: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\tdelete(\n\t\tid: string,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tdeleteProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: id },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/**\n\t * Recover a soft-deleted project within its retention window (beta). Mirrors\n\t * `branches.recover` at the project level.\n\t *\n\t * @apiCall POST /projects/{project_id}/recover\n\t */\n\trecover(id: string): Promise<Outcome<Project, DThrow>>;\n\trecover<Throw extends boolean = DThrow>(\n\t\tid: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\trecover(\n\t\tid: string,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\trecoverProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: id },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/**\n\t * Transfer projects from one organization to another (e.g. sponsored → paid). The\n\t * source org defaults to the client's `orgId`. Requires a key with access to both orgs.\n\t *\n\t * @apiCall POST /organizations/{source_org_id}/projects/transfer\n\t */\n\ttransfer(input: TransferProjectsInput): Promise<Outcome<void, DThrow>>;\n\ttransfer<Throw extends boolean = DThrow>(\n\t\tinput: TransferProjectsInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tasync transfer(\n\t\tinput: TransferProjectsInput,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\tconst fromOrgId = input.fromOrgId ?? this.#ctx.defaults.orgId;\n\t\tif (!fromOrgId) {\n\t\t\treturn finalize(\n\t\t\t\terr<void>(\n\t\t\t\t\tnew NeonError(\n\t\t\t\t\t\t\"Pass fromOrgId or set orgId on the client.\",\n\t\t\t\t\t\t\"client\",\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tshouldThrow,\n\t\t\t);\n\t\t}\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\ttransferProjectsFromOrgToOrg({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { source_org_id: fromOrgId },\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tdestination_org_id: input.toOrgId,\n\t\t\t\t\t\tproject_ids: input.projectIds,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t() => undefined,\n\t\t);\n\t}\n\n\t/**\n\t * Transfer projects from the personal account to an organization.\n\t *\n\t * @apiCall POST /users/me/projects/transfer\n\t */\n\ttransferFromUser(input: {\n\t\ttoOrgId: string;\n\t\tprojectIds: string[];\n\t}): Promise<Outcome<void, DThrow>>;\n\ttransferFromUser<Throw extends boolean = DThrow>(\n\t\tinput: { toOrgId: string; projectIds: string[] },\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\ttransferFromUser(\n\t\tinput: { toOrgId: string; projectIds: string[] },\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\ttransferProjectsFromUserToOrg({\n\t\t\t\t\tclient,\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tdestination_org_id: input.toOrgId,\n\t\t\t\t\t\tproject_ids: input.projectIds,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t() => undefined,\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAqDA,IAAa,cAAb,MAAiD;CAChD;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAQA,KACC,WACA,MACiE;EACjE,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,uBAAuB;GACtB;GACA,MAAM,EAAE,YAAY,UAA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U;GACjC,MAAM;IACL,oBAAoB,MAAM;IAC1B,aAAa,MAAM;GACpB;GACA,cAAc;EACf,CAAC,SACI,KAAA,CACP;CACD;CAeA,iBACC,OACA,MACmC;EACnC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,8BAA8B;GAC7B;GACA,MAAM;IACL,oBAAoB,MAAM;IAC1B,aAAa,MAAM;GACpB;GACA,cAAc;EACf,CAAC,SACI,KAAA,CACP;CACD;AACD"}
1
+ {"version":3,"file":"projects.js","names":["#ctx"],"sources":["../../../src/neon/resources/projects.ts"],"sourcesContent":["import {\n\tcreateProject,\n\tdeleteProject,\n\tgetProject,\n\tgrantPermissionToProject,\n\tlistProjectMembers,\n\tlistProjectPermissions,\n\tlistProjects,\n\trecoverProject,\n\tremoveProjectMemberRole,\n\trevokePermissionFromProject,\n\tsetProjectMemberRole,\n\ttransferProjectsFromOrgToOrg,\n\ttransferProjectsFromUserToOrg,\n\tupdateProject,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tListProjectMembersData,\n\tListProjectsData,\n\tProject,\n\tProjectCreateRequest,\n\tProjectListItem,\n\tProjectMember,\n\tProjectMemberRoleResponse,\n\tProjectPermission,\n\tProjectRole,\n\tProjectUpdateRequest,\n} from \"../../client/types.gen.js\";\nimport { withConnectionString } from \"../connection.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport { NeonError } from \"../errors.js\";\nimport { type Paginated, paginate } from \"../paginate.js\";\nimport { err, finalize, type NeonResult, type Outcome } from \"../result.js\";\n\n/** Input for {@link Projects.transfer} (org → org). */\nexport interface TransferProjectsInput {\n\t/** Source org. Defaults to the client's `orgId`. */\n\tfromOrgId?: string;\n\t/** Destination org. */\n\ttoOrgId: string;\n\tprojectIds: string[];\n}\n\ntype ListQuery = Omit<NonNullable<ListProjectsData[\"query\"]>, \"cursor\">;\ntype CreateInput = ProjectCreateRequest[\"project\"];\ntype UpdateInput = ProjectUpdateRequest[\"project\"];\ntype MemberListQuery = Omit<\n\tNonNullable<ListProjectMembersData[\"query\"]>,\n\t\"cursor\"\n>;\n\n/** Per-call options for {@link Members.setRole}. */\nexport interface SetRoleOptions<Throw extends boolean = boolean>\n\textends CallOptions<Throw> {\n\t/**\n\t * Acknowledge that the call lowers the caller's own role. The API rejects a\n\t * self-demotion without it, so it is left off by default.\n\t */\n\tconfirmSelfDemotion?: boolean;\n}\n\n/** Per-call options for {@link Members.removeRole}. */\nexport interface RemoveRoleOptions<Throw extends boolean = boolean>\n\textends CallOptions<Throw> {\n\t/**\n\t * Acknowledge that the call can cost the caller management access. The API\n\t * rejects such a self-removal without it, so it is left off by default.\n\t */\n\tconfirmSelfLockout?: boolean;\n}\n\n/** Per-call options for the connect workflow. */\ninterface WorkflowOptions<Throw extends boolean> extends CallOptions<Throw> {\n\t/** Return a pooled connection string (default `true`). */\n\tpooled?: boolean;\n}\n\n/** A project with a ready-to-use connection string to its default branch. */\nexport interface ProjectConnection {\n\tproject: Project;\n\tconnectionString: string;\n}\n\n/** Project access grants (share a project with additional users by email). */\nexport class Permissions<DThrow extends boolean> {\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\t/** @apiCall GET /projects/{project_id}/permissions */\n\tlist(projectId: string): Promise<Outcome<ProjectPermission[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<ProjectPermission[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\topts?: CallOptions,\n\t): Promise<ProjectPermission[] | NeonResult<ProjectPermission[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tlistProjectPermissions({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.project_permissions,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/permissions */\n\tgrant(\n\t\tprojectId: string,\n\t\temail: string,\n\t): Promise<Outcome<ProjectPermission, DThrow>>;\n\tgrant<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\temail: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<ProjectPermission, Throw>>;\n\tgrant(\n\t\tprojectId: string,\n\t\temail: string,\n\t\topts?: CallOptions,\n\t): Promise<ProjectPermission | NeonResult<ProjectPermission>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tgrantPermissionToProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tbody: { email },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/permissions/{permission_id} */\n\trevoke(\n\t\tprojectId: string,\n\t\tpermissionId: string,\n\t): Promise<Outcome<ProjectPermission, DThrow>>;\n\trevoke<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tpermissionId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<ProjectPermission, Throw>>;\n\trevoke(\n\t\tprojectId: string,\n\t\tpermissionId: string,\n\t\topts?: CallOptions,\n\t): Promise<ProjectPermission | NeonResult<ProjectPermission>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\trevokePermissionFromProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: {\n\t\t\t\t\t\tproject_id: projectId,\n\t\t\t\t\t\tpermission_id: permissionId,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n}\n\n/**\n * Per-project roles for members of the owning organization.\n *\n * Distinct from {@link Permissions}, which shares a project with an individual by\n * email address: these act on existing org members by member id, and clearing a\n * grant leaves the member's organization-role default in force rather than\n * removing their access.\n */\nexport class Members<DThrow extends boolean> {\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\t/**\n\t * List org members and their project roles (cursor-paginated). Org-owned\n\t * projects only — a personal project answers `404`, as does an org with\n\t * per-project role management disabled.\n\t *\n\t * @apiCall GET /projects/{project_id}/members (cursor-paginated)\n\t */\n\tlist(\n\t\tprojectId: string,\n\t\tquery?: MemberListQuery,\n\t\topts?: CallOptions,\n\t): Paginated<ProjectMember> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tlistProjectMembers({\n\t\t\t\t\tclient: this.#ctx.client,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tquery: { ...query, cursor },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => ({\n\t\t\t\titems: data?.project_members ?? [],\n\t\t\t\tcursor: data?.pagination?.next,\n\t\t\t}),\n\t\t\t() => this.#ctx.deadlineFor(opts),\n\t\t);\n\t}\n\n\t/**\n\t * Set a member's explicit project role, replacing any existing grant.\n\t * Idempotent. Check `credential_rotation_recommended` and\n\t * `org_api_key_rotation_recommended` on the result — a downgrade can leave\n\t * credentials the member still holds.\n\t *\n\t * @apiCall PUT /projects/{project_id}/members/{member_id}/role\n\t */\n\tsetRole(\n\t\tprojectId: string,\n\t\tmemberId: string,\n\t\trole: ProjectRole,\n\t): Promise<Outcome<ProjectMemberRoleResponse, DThrow>>;\n\tsetRole<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tmemberId: string,\n\t\trole: ProjectRole,\n\t\topts: SetRoleOptions<Throw>,\n\t): Promise<Outcome<ProjectMemberRoleResponse, Throw>>;\n\tsetRole(\n\t\tprojectId: string,\n\t\tmemberId: string,\n\t\trole: ProjectRole,\n\t\topts?: SetRoleOptions<boolean>,\n\t): Promise<\n\t\tProjectMemberRoleResponse | NeonResult<ProjectMemberRoleResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tsetProjectMemberRole({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, member_id: memberId },\n\t\t\t\t\tquery: opts?.confirmSelfDemotion\n\t\t\t\t\t\t? { confirm_self_demotion: true }\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tbody: { role },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/**\n\t * Clear a member's explicit project grant. Idempotent, and a no-op when no\n\t * explicit grant exists. The member keeps whatever their organization role\n\t * grants by default, so this narrows access rather than removing it.\n\t *\n\t * @apiCall DELETE /projects/{project_id}/members/{member_id}/role\n\t */\n\tremoveRole(\n\t\tprojectId: string,\n\t\tmemberId: string,\n\t): Promise<Outcome<ProjectMemberRoleResponse, DThrow>>;\n\tremoveRole<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tmemberId: string,\n\t\topts: RemoveRoleOptions<Throw>,\n\t): Promise<Outcome<ProjectMemberRoleResponse, Throw>>;\n\tremoveRole(\n\t\tprojectId: string,\n\t\tmemberId: string,\n\t\topts?: RemoveRoleOptions<boolean>,\n\t): Promise<\n\t\tProjectMemberRoleResponse | NeonResult<ProjectMemberRoleResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tremoveProjectMemberRole({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, member_id: memberId },\n\t\t\t\t\tquery: opts?.confirmSelfLockout\n\t\t\t\t\t\t? { confirm_self_lockout: true }\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n}\n\n/** Project resource — one API call per method (`list` is cursor-paginated). */\nexport class Projects<DThrow extends boolean> {\n\treadonly #ctx: RequestContext;\n\t/** Project access grants (share by email). */\n\treadonly permissions: Permissions<DThrow>;\n\t/** Per-project roles for members of the owning organization. */\n\treadonly members: Members<DThrow>;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t\tthis.permissions = new Permissions<DThrow>(ctx);\n\t\tthis.members = new Members<DThrow>(ctx);\n\t}\n\n\t/**\n\t * List projects (cursor-paginated). Returns a lazy list — `await .all()`, `.page()`,\n\t * or `for await (… of …)`.\n\t *\n\t * @apiCall GET /projects\n\t */\n\tlist(query?: ListQuery, opts?: CallOptions): Paginated<ProjectListItem> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tlistProjects({\n\t\t\t\t\tclient: this.#ctx.client,\n\t\t\t\t\tquery: {\n\t\t\t\t\t\torg_id: this.#ctx.defaults.orgId,\n\t\t\t\t\t\t...query,\n\t\t\t\t\t\tcursor,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => ({\n\t\t\t\titems: data?.projects ?? [],\n\t\t\t\tcursor: data?.pagination?.cursor,\n\t\t\t}),\n\t\t\t() => this.#ctx.deadlineFor(opts),\n\t\t);\n\t}\n\n\t/** @apiCall GET /projects/{project_id} */\n\tget(id: string): Promise<Outcome<Project, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tid: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\tget(\n\t\tid: string,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tgetProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: id },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects */\n\tcreate(input?: CreateInput): Promise<Outcome<Project, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tinput: CreateInput | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\tcreate(\n\t\tinput?: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tcreateProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tproject: {\n\t\t\t\t\t\t\t...(this.#ctx.defaults.orgId\n\t\t\t\t\t\t\t\t? { org_id: this.#ctx.defaults.orgId }\n\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/**\n\t * Create a project and return a ready-to-use connection string to its default branch.\n\t * One API call plus readiness polling (the create response already carries the\n\t * connection URI).\n\t *\n\t * @workflow createProject + waitForReadiness\n\t */\n\tcreateAndConnect(\n\t\tinput?: CreateInput,\n\t): Promise<Outcome<ProjectConnection, DThrow>>;\n\tcreateAndConnect<Throw extends boolean = DThrow>(\n\t\tinput: CreateInput | undefined,\n\t\topts: WorkflowOptions<Throw>,\n\t): Promise<Outcome<ProjectConnection, Throw>>;\n\tasync createAndConnect(\n\t\tinput?: CreateInput,\n\t\topts?: WorkflowOptions<boolean>,\n\t): Promise<ProjectConnection | NeonResult<ProjectConnection>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\tconst result = await this.#ctx.execute(\n\t\t\t{ ...opts, waitForReadiness: opts?.waitForReadiness ?? true },\n\t\t\t(client, signal) =>\n\t\t\t\tcreateProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tproject: {\n\t\t\t\t\t\t\t...(this.#ctx.defaults.orgId\n\t\t\t\t\t\t\t\t? { org_id: this.#ctx.defaults.orgId }\n\t\t\t\t\t\t\t\t: {}),\n\t\t\t\t\t\t\t...input,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t\tconst out = withConnectionString(\n\t\t\tresult,\n\t\t\t(data) => data.connection_uris,\n\t\t\t(data, connectionString) => ({\n\t\t\t\tproject: data.project,\n\t\t\t\tconnectionString,\n\t\t\t}),\n\t\t\topts?.pooled ?? true,\n\t\t);\n\t\treturn finalize(out, shouldThrow);\n\t}\n\n\t/** @apiCall PATCH /projects/{project_id} */\n\tupdate(id: string, input: UpdateInput): Promise<Outcome<Project, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tid: string,\n\t\tinput: UpdateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\tupdate(\n\t\tid: string,\n\t\tinput: UpdateInput,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tupdateProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: id },\n\t\t\t\t\tbody: { project: input },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id} */\n\tdelete(id: string): Promise<Outcome<Project, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tid: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\tdelete(\n\t\tid: string,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tdeleteProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: id },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/**\n\t * Recover a soft-deleted project within its retention window (beta).\n\t *\n\t * @apiCall POST /projects/{project_id}/recover\n\t */\n\trecover(id: string): Promise<Outcome<Project, DThrow>>;\n\trecover<Throw extends boolean = DThrow>(\n\t\tid: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Project, Throw>>;\n\trecover(\n\t\tid: string,\n\t\topts?: CallOptions,\n\t): Promise<Project | NeonResult<Project>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\trecoverProject({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: id },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.project,\n\t\t);\n\t}\n\n\t/**\n\t * Transfer projects from one organization to another (e.g. sponsored → paid). The\n\t * source org defaults to the client's `orgId`. Requires a key with access to both orgs.\n\t *\n\t * @apiCall POST /organizations/{source_org_id}/projects/transfer\n\t */\n\ttransfer(input: TransferProjectsInput): Promise<Outcome<void, DThrow>>;\n\ttransfer<Throw extends boolean = DThrow>(\n\t\tinput: TransferProjectsInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tasync transfer(\n\t\tinput: TransferProjectsInput,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\tconst fromOrgId = input.fromOrgId ?? this.#ctx.defaults.orgId;\n\t\tif (!fromOrgId) {\n\t\t\treturn finalize(\n\t\t\t\terr<void>(\n\t\t\t\t\tnew NeonError(\n\t\t\t\t\t\t\"Pass fromOrgId or set orgId on the client.\",\n\t\t\t\t\t\t\"client\",\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tshouldThrow,\n\t\t\t);\n\t\t}\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\ttransferProjectsFromOrgToOrg({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { source_org_id: fromOrgId },\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tdestination_org_id: input.toOrgId,\n\t\t\t\t\t\tproject_ids: input.projectIds,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t() => undefined,\n\t\t);\n\t}\n\n\t/**\n\t * Transfer projects from the personal account to an organization.\n\t *\n\t * @apiCall POST /users/me/projects/transfer\n\t */\n\ttransferFromUser(input: {\n\t\ttoOrgId: string;\n\t\tprojectIds: string[];\n\t}): Promise<Outcome<void, DThrow>>;\n\ttransferFromUser<Throw extends boolean = DThrow>(\n\t\tinput: { toOrgId: string; projectIds: string[] },\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\ttransferFromUser(\n\t\tinput: { toOrgId: string; projectIds: string[] },\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\ttransferProjectsFromUserToOrg({\n\t\t\t\t\tclient,\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tdestination_org_id: input.toOrgId,\n\t\t\t\t\t\tproject_ids: input.projectIds,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t() => undefined,\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAoFA,IAAa,cAAb,MAAiD;CAChD;CAEA,YAAY,KAAqB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