@neon/sdk 0.1.0 → 1.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 (144) hide show
  1. package/README.md +133 -5
  2. package/dist/_virtual/_rolldown/runtime.js +2 -1
  3. package/dist/client/core/pathSerializer.gen.d.ts.map +1 -1
  4. package/dist/client/index.d.ts +3 -3
  5. package/dist/client/index.js +2 -2
  6. package/dist/client/raw.gen.d.ts +4282 -0
  7. package/dist/client/raw.gen.d.ts.map +1 -0
  8. package/dist/client/raw.gen.js +170 -0
  9. package/dist/client/raw.gen.js.map +1 -0
  10. package/dist/client/sdk.gen.d.ts +252 -2
  11. package/dist/client/sdk.gen.d.ts.map +1 -1
  12. package/dist/client/sdk.gen.js +634 -1
  13. package/dist/client/sdk.gen.js.map +1 -1
  14. package/dist/client/types.gen.d.ts +2602 -1530
  15. package/dist/client/types.gen.d.ts.map +1 -1
  16. package/dist/index.d.ts +5 -4
  17. package/dist/neon/client.d.ts +10 -0
  18. package/dist/neon/client.d.ts.map +1 -1
  19. package/dist/neon/client.js +10 -0
  20. package/dist/neon/client.js.map +1 -1
  21. package/dist/neon/client.test-d.d.ts +1 -0
  22. package/dist/neon/client.test-d.js +93 -0
  23. package/dist/neon/client.test-d.js.map +1 -0
  24. package/dist/neon/coverage.d.ts.map +1 -1
  25. package/dist/neon/coverage.js +57 -0
  26. package/dist/neon/coverage.js.map +1 -1
  27. package/dist/neon/raw-wrap.d.ts +63 -0
  28. package/dist/neon/raw-wrap.d.ts.map +1 -0
  29. package/dist/neon/raw-wrap.js +47 -0
  30. package/dist/neon/raw-wrap.js.map +1 -0
  31. package/dist/neon/resources/ai-gateway.d.ts +16 -0
  32. package/dist/neon/resources/ai-gateway.d.ts.map +1 -0
  33. package/dist/neon/resources/ai-gateway.js +23 -0
  34. package/dist/neon/resources/ai-gateway.js.map +1 -0
  35. package/dist/neon/resources/auth.d.ts +81 -0
  36. package/dist/neon/resources/auth.d.ts.map +1 -0
  37. package/dist/neon/resources/auth.js +197 -0
  38. package/dist/neon/resources/auth.js.map +1 -0
  39. package/dist/neon/resources/branches.d.ts +7 -0
  40. package/dist/neon/resources/branches.d.ts.map +1 -1
  41. package/dist/neon/resources/branches.js +11 -1
  42. package/dist/neon/resources/branches.js.map +1 -1
  43. package/dist/neon/resources/bucket-objects.d.ts +33 -0
  44. package/dist/neon/resources/bucket-objects.d.ts.map +1 -0
  45. package/dist/neon/resources/bucket-objects.js +74 -0
  46. package/dist/neon/resources/bucket-objects.js.map +1 -0
  47. package/dist/neon/resources/buckets.d.ts +23 -0
  48. package/dist/neon/resources/buckets.d.ts.map +1 -0
  49. package/dist/neon/resources/buckets.js +45 -0
  50. package/dist/neon/resources/buckets.js.map +1 -0
  51. package/dist/neon/resources/credentials.d.ts +23 -0
  52. package/dist/neon/resources/credentials.d.ts.map +1 -0
  53. package/dist/neon/resources/credentials.js +45 -0
  54. package/dist/neon/resources/credentials.js.map +1 -0
  55. package/dist/neon/resources/endpoints.d.ts +3 -0
  56. package/dist/neon/resources/endpoints.d.ts.map +1 -1
  57. package/dist/neon/resources/endpoints.js +11 -1
  58. package/dist/neon/resources/endpoints.js.map +1 -1
  59. package/dist/neon/resources/functions.d.ts +30 -0
  60. package/dist/neon/resources/functions.d.ts.map +1 -0
  61. package/dist/neon/resources/functions.js +79 -0
  62. package/dist/neon/resources/functions.js.map +1 -0
  63. package/dist/neon/resources/postgres.d.ts +1 -1
  64. package/dist/neon/resources/postgres.js.map +1 -1
  65. package/dist/neon/resources/projects.d.ts +26 -2
  66. package/dist/neon/resources/projects.d.ts.map +1 -1
  67. package/dist/neon/resources/projects.js +44 -2
  68. package/dist/neon/resources/projects.js.map +1 -1
  69. package/dist/neon/resources/storage.d.ts +24 -0
  70. package/dist/neon/resources/storage.d.ts.map +1 -0
  71. package/dist/neon/resources/storage.js +32 -0
  72. package/dist/neon/resources/storage.js.map +1 -0
  73. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js +879 -0
  74. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
  75. package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js +30 -0
  76. package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js.map +1 -0
  77. package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js +579 -0
  78. package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js.map +1 -0
  79. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +92 -0
  80. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
  81. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js +43 -0
  82. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
  83. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js +450 -0
  84. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js.map +1 -0
  85. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js +168 -0
  86. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
  87. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js +10 -0
  88. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js.map +1 -0
  89. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js +109 -0
  90. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js.map +1 -0
  91. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js +10 -0
  92. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js.map +1 -0
  93. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js +10 -0
  94. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js.map +1 -0
  95. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js +10 -0
  96. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js.map +1 -0
  97. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +11 -0
  98. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
  99. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +16 -0
  100. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
  101. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +11 -0
  102. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
  103. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +15 -0
  104. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
  105. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +13 -0
  106. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
  107. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +34 -0
  108. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
  109. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +12 -0
  110. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
  111. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +122 -0
  112. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
  113. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +39 -0
  114. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
  115. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +99 -0
  116. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
  117. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +25 -0
  118. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
  119. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +14 -0
  120. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
  121. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +21 -0
  122. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
  123. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
  124. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
  125. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +12 -0
  126. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
  127. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +18 -0
  128. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
  129. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +24 -0
  130. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
  131. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
  132. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
  133. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +30 -0
  134. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
  135. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
  136. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
  137. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js +7 -0
  138. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
  139. package/dist/node_modules/.pnpm/vitest@3.0.9_@types_debug@4.1.13_@types_node@20.19.17_jiti@2.7.0_jsdom@26.1.0_lightning_fb7ae83398b95c49208c9194029bba02/node_modules/vitest/dist/index.js +8 -0
  140. package/dist/node_modules/.pnpm/vitest@3.0.9_@types_debug@4.1.13_@types_node@20.19.17_jiti@2.7.0_jsdom@26.1.0_lightning_fb7ae83398b95c49208c9194029bba02/node_modules/vitest/dist/index.js.map +1 -0
  141. package/dist/raw.d.ts +4 -3
  142. package/dist/raw.js +24 -3
  143. package/dist/raw.js.map +1 -1
  144. package/package.json +4 -3
@@ -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\tlistProjects,\n\ttransferProjectsFromOrgToOrg,\n\ttransferProjectsFromUserToOrg,\n\tupdateProject,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tListProjectsData,\n\tProject,\n\tProjectCreateRequest,\n\tProjectListItem,\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 resource — one API call per method (`list` is cursor-paginated). */\nexport class Projects<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 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 * 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":";;;;;;;AAgDA,IAAa,WAAb,MAA8C;CAC7C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;;;;;;CAQA,KAAK,OAA+C;EACnD,OAAO,UACL,QAAQ,WACR,aAAa;GACZ,QAAQ,KAAKA,KAAK;GAClB,OAAO;IACN,QAAQ,KAAKA,KAAK,SAAS;IAC3B,GAAG;IACH;GACD;GACA,cAAc;GACd;EACD,CAAC,IACD,UAAU;GACV,OAAO,MAAM,YAAY,CAAC;GAC1B,QAAQ,MAAM,YAAY;EAC3B,EACD;CACD;CAQA,IACC,IACA,MACyC;EACzC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,WAAW;GACV;GACA,MAAM,EAAE,YAAY,GAAG;GACvB,cAAc;EACf,CAAC,IACD,SAAS,KAAK,OAChB;CACD;CAQA,OACC,OACA,MACyC;EACzC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,cAAc;GACb;GACA,MAAM,EACL,SAAS;IACR,GAAI,KAAKA,KAAK,SAAS,QACpB,EAAE,QAAQ,KAAKA,KAAK,SAAS,MAAM,IACnC,CAAC;IACJ,GAAG;GACJ,EACD;GACA,cAAc;EACf,CAAC,IACD,SAAS,KAAK,OAChB;CACD;CAgBA,MAAM,iBACL,OACA,MAC6D;EAC7D,MAAM,cACL,MAAM,gBAAgB,KAAKA,KAAK,SAAS;EA2B1C,OAAO,SATK,qBACX,MAlBoB,KAAKA,KAAK,QAC9B;GAAE,GAAG;GAAM,kBAAkB,MAAM,oBAAoB;EAAK,IAC3D,WACA,cAAc;GACb;GACA,MAAM,EACL,SAAS;IACR,GAAI,KAAKA,KAAK,SAAS,QACpB,EAAE,QAAQ,KAAKA,KAAK,SAAS,MAAM,IACnC,CAAC;IACJ,GAAG;GACJ,EACD;GACA,cAAc;EACf,CAAC,IACD,SAAS,IACX,IAGE,SAAS,KAAK,kBACd,MAAM,sBAAsB;GAC5B,SAAS,KAAK;GACd;EACD,IACA,MAAM,UAAU,IAEC,GAAG,WAAW;CACjC;CASA,OACC,IACA,OACA,MACyC;EACzC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,cAAc;GACb;GACA,MAAM,EAAE,YAAY,GAAG;GACvB,MAAM,EAAE,SAAS,MAAM;GACvB,cAAc;EACf,CAAC,IACD,SAAS,KAAK,OAChB;CACD;CAQA,OACC,IACA,MACyC;EACzC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,cAAc;GACb;GACA,MAAM,EAAE,YAAY,GAAG;GACvB,cAAc;EACf,CAAC,IACD,SAAS,KAAK,OAChB;CACD;CAaA,MAAM,SACL,OACA,MACmC;EACnC,MAAM,cACL,MAAM,gBAAgB,KAAKA,KAAK,SAAS;EAC1C,MAAM,YAAY,MAAM,aAAa,KAAKA,KAAK,SAAS;EACxD,IAAI,CAAC,WACJ,OAAO,SACN,IACC,IAAI,UACH,8CACA,QACD,CACD,GACA,WACD;EAED,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,6BAA6B;GAC5B;GACA,MAAM,EAAE,eAAe,UAAU;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\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":"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"}
@@ -0,0 +1,24 @@
1
+ import { BranchStorage } from "../../client/types.gen.js";
2
+ import { Outcome } from "../result.js";
3
+ import { CallOptions, RequestContext } from "../context.js";
4
+ import { BucketObjects } from "./bucket-objects.js";
5
+ import { Buckets } from "./buckets.js";
6
+
7
+ //#region src/neon/resources/storage.d.ts
8
+
9
+ /**
10
+ * Branch-scoped object storage: branch storage state, buckets, and bucket objects.
11
+ * Grouped under `neon.storage.*` so it stays distinct from the Postgres data plane.
12
+ */
13
+ declare class Storage<DThrow extends boolean> {
14
+ #private;
15
+ readonly buckets: Buckets<DThrow>;
16
+ readonly objects: BucketObjects<DThrow>;
17
+ constructor(ctx: RequestContext);
18
+ /** @apiCall GET /projects/{project_id}/branches/{branch_id}/storage */
19
+ get(projectId: string, branchId: string): Promise<Outcome<BranchStorage, DThrow>>;
20
+ get<Throw extends boolean = DThrow>(projectId: string, branchId: string, opts: CallOptions<Throw>): Promise<Outcome<BranchStorage, Throw>>;
21
+ }
22
+ //#endregion
23
+ export { Storage };
24
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","names":[],"sources":["../../../src/neon/resources/storage.ts"],"mappings":";;;;;;;;;;AAWA;;AAC2B,cADd,OACc,CAAA,eAAA,OAAA,CAAA,CAAA;UAAR;WACc,OAAA,EADd,OACc,CADN,MACM,CAAA;WAAd,OAAA,EAAA,aAAA,CAAc,MAAd,CAAA;aAGD,CAAA,GAAA,EAAA,cAAA;;KAUiB,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,CAAA,EAA/B,OAA+B,CAAvB,OAAuB,CAAf,aAAe,EAAA,MAAA,CAAA,CAAA;KAAvB,CAAA,cAAA,OAAA,GACiB,MADjB,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAIJ,WAJI,CAIQ,KAJR,CAAA,CAAA,EAKR,OALQ,CAKA,OALA,CAKQ,aALR,EAKuB,KALvB,CAAA,CAAA"}
@@ -0,0 +1,32 @@
1
+ import { getProjectBranchStorage } from "../../client/sdk.gen.js";
2
+ import { BucketObjects } from "./bucket-objects.js";
3
+ import { Buckets } from "./buckets.js";
4
+ //#region src/neon/resources/storage.ts
5
+ /**
6
+ * Branch-scoped object storage: branch storage state, buckets, and bucket objects.
7
+ * Grouped under `neon.storage.*` so it stays distinct from the Postgres data plane.
8
+ */
9
+ var Storage = class {
10
+ buckets;
11
+ objects;
12
+ #ctx;
13
+ constructor(ctx) {
14
+ this.#ctx = ctx;
15
+ this.buckets = new Buckets(ctx);
16
+ this.objects = new BucketObjects(ctx);
17
+ }
18
+ get(projectId, branchId, opts) {
19
+ return this.#ctx.run(opts, (client) => getProjectBranchStorage({
20
+ client,
21
+ path: {
22
+ project_id: projectId,
23
+ branch_id: branchId
24
+ },
25
+ throwOnError: false
26
+ }), (data) => data);
27
+ }
28
+ };
29
+ //#endregion
30
+ export { Storage };
31
+
32
+ //# sourceMappingURL=storage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.js","names":["#ctx"],"sources":["../../../src/neon/resources/storage.ts"],"sourcesContent":["import { getProjectBranchStorage } from \"../../client/sdk.gen.js\";\nimport type { BranchStorage } from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\nimport { BucketObjects } from \"./bucket-objects.js\";\nimport { Buckets } from \"./buckets.js\";\n\n/**\n * Branch-scoped object storage: branch storage state, buckets, and bucket objects.\n * Grouped under `neon.storage.*` so it stays distinct from the Postgres data plane.\n */\nexport class Storage<DThrow extends boolean> {\n\treadonly buckets: Buckets<DThrow>;\n\treadonly objects: BucketObjects<DThrow>;\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t\tthis.buckets = new Buckets(ctx);\n\t\tthis.objects = new BucketObjects(ctx);\n\t}\n\n\t/** @apiCall GET /projects/{project_id}/branches/{branch_id}/storage */\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<BranchStorage, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<BranchStorage, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<BranchStorage | NeonResult<BranchStorage>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProjectBranchStorage({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\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"],"mappings":";;;;;;;;AAWA,IAAa,UAAb,MAA6C;CAC5C;CACA;CACA;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;EACZ,KAAK,UAAU,IAAI,QAAQ,GAAG;EAC9B,KAAK,UAAU,IAAI,cAAc,GAAG;CACrC;CAYA,IACC,WACA,UACA,MACqD;EACrD,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,wBAAwB;GACvB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;AACD"}