@neon/sdk 0.0.0 → 0.2.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 (222) hide show
  1. package/LICENSE.md +178 -0
  2. package/README.md +349 -0
  3. package/dist/_virtual/_rolldown/runtime.js +14 -0
  4. package/dist/client/client/client.gen.d.ts +7 -0
  5. package/dist/client/client/client.gen.d.ts.map +1 -0
  6. package/dist/client/client/client.gen.js +176 -0
  7. package/dist/client/client/client.gen.js.map +1 -0
  8. package/dist/client/client/index.d.ts +10 -0
  9. package/dist/client/client/index.js +6 -0
  10. package/dist/client/client/types.gen.d.ts +124 -0
  11. package/dist/client/client/types.gen.d.ts.map +1 -0
  12. package/dist/client/client/types.gen.js +1 -0
  13. package/dist/client/client/utils.gen.d.ts +42 -0
  14. package/dist/client/client/utils.gen.d.ts.map +1 -0
  15. package/dist/client/client/utils.gen.js +179 -0
  16. package/dist/client/client/utils.gen.js.map +1 -0
  17. package/dist/client/client.gen.d.ts +18 -0
  18. package/dist/client/client.gen.d.ts.map +1 -0
  19. package/dist/client/client.gen.js +8 -0
  20. package/dist/client/client.gen.js.map +1 -0
  21. package/dist/client/core/auth.gen.d.ts +29 -0
  22. package/dist/client/core/auth.gen.d.ts.map +1 -0
  23. package/dist/client/core/auth.gen.js +12 -0
  24. package/dist/client/core/auth.gen.js.map +1 -0
  25. package/dist/client/core/bodySerializer.gen.d.ts +29 -0
  26. package/dist/client/core/bodySerializer.gen.d.ts.map +1 -0
  27. package/dist/client/core/bodySerializer.gen.js +33 -0
  28. package/dist/client/core/bodySerializer.gen.js.map +1 -0
  29. package/dist/client/core/params.gen.d.ts +46 -0
  30. package/dist/client/core/params.gen.d.ts.map +1 -0
  31. package/dist/client/core/params.gen.js +65 -0
  32. package/dist/client/core/params.gen.js.map +1 -0
  33. package/dist/client/core/pathSerializer.gen.d.ts +52 -0
  34. package/dist/client/core/pathSerializer.gen.d.ts.map +1 -0
  35. package/dist/client/core/pathSerializer.gen.js +82 -0
  36. package/dist/client/core/pathSerializer.gen.js.map +1 -0
  37. package/dist/client/core/queryKeySerializer.gen.d.ts +22 -0
  38. package/dist/client/core/queryKeySerializer.gen.d.ts.map +1 -0
  39. package/dist/client/core/queryKeySerializer.gen.js +64 -0
  40. package/dist/client/core/queryKeySerializer.gen.js.map +1 -0
  41. package/dist/client/core/serverSentEvents.gen.d.ts +88 -0
  42. package/dist/client/core/serverSentEvents.gen.d.ts.map +1 -0
  43. package/dist/client/core/serverSentEvents.gen.js +95 -0
  44. package/dist/client/core/serverSentEvents.gen.js.map +1 -0
  45. package/dist/client/core/types.gen.d.ts +80 -0
  46. package/dist/client/core/types.gen.d.ts.map +1 -0
  47. package/dist/client/core/types.gen.js +1 -0
  48. package/dist/client/core/utils.gen.d.ts +33 -0
  49. package/dist/client/core/utils.gen.d.ts.map +1 -0
  50. package/dist/client/core/utils.gen.js +78 -0
  51. package/dist/client/core/utils.gen.js.map +1 -0
  52. package/dist/client/index.d.ts +3 -0
  53. package/dist/client/index.js +2 -0
  54. package/dist/client/sdk.gen.d.ts +1362 -0
  55. package/dist/client/sdk.gen.d.ts.map +1 -0
  56. package/dist/client/sdk.gen.js +4315 -0
  57. package/dist/client/sdk.gen.js.map +1 -0
  58. package/dist/client/types.gen.d.ts +9938 -0
  59. package/dist/client/types.gen.d.ts.map +1 -0
  60. package/dist/client/types.gen.js +1 -0
  61. package/dist/index.d.ts +19 -0
  62. package/dist/index.js +4 -0
  63. package/dist/neon/client.d.ts +52 -0
  64. package/dist/neon/client.d.ts.map +1 -0
  65. package/dist/neon/client.js +40 -0
  66. package/dist/neon/client.js.map +1 -0
  67. package/dist/neon/client.test-d.d.ts +1 -0
  68. package/dist/neon/client.test-d.js +76 -0
  69. package/dist/neon/client.test-d.js.map +1 -0
  70. package/dist/neon/config.d.ts +40 -0
  71. package/dist/neon/config.d.ts.map +1 -0
  72. package/dist/neon/config.js +23 -0
  73. package/dist/neon/config.js.map +1 -0
  74. package/dist/neon/connection.d.ts +22 -0
  75. package/dist/neon/connection.d.ts.map +1 -0
  76. package/dist/neon/connection.js +33 -0
  77. package/dist/neon/connection.js.map +1 -0
  78. package/dist/neon/context.d.ts +50 -0
  79. package/dist/neon/context.d.ts.map +1 -0
  80. package/dist/neon/context.js +59 -0
  81. package/dist/neon/context.js.map +1 -0
  82. package/dist/neon/coverage.d.ts +26 -0
  83. package/dist/neon/coverage.d.ts.map +1 -0
  84. package/dist/neon/coverage.js +229 -0
  85. package/dist/neon/coverage.js.map +1 -0
  86. package/dist/neon/errors.d.ts +78 -0
  87. package/dist/neon/errors.d.ts.map +1 -0
  88. package/dist/neon/errors.js +116 -0
  89. package/dist/neon/errors.js.map +1 -0
  90. package/dist/neon/paginate.d.ts +34 -0
  91. package/dist/neon/paginate.d.ts.map +1 -0
  92. package/dist/neon/paginate.js +51 -0
  93. package/dist/neon/paginate.js.map +1 -0
  94. package/dist/neon/resources/account.d.ts +45 -0
  95. package/dist/neon/resources/account.d.ts.map +1 -0
  96. package/dist/neon/resources/account.js +65 -0
  97. package/dist/neon/resources/account.js.map +1 -0
  98. package/dist/neon/resources/branches.d.ts +84 -0
  99. package/dist/neon/resources/branches.d.ts.map +1 -0
  100. package/dist/neon/resources/branches.js +132 -0
  101. package/dist/neon/resources/branches.js.map +1 -0
  102. package/dist/neon/resources/consumption.d.ts +22 -0
  103. package/dist/neon/resources/consumption.d.ts.map +1 -0
  104. package/dist/neon/resources/consumption.js +59 -0
  105. package/dist/neon/resources/consumption.js.map +1 -0
  106. package/dist/neon/resources/dataapi.d.ts +25 -0
  107. package/dist/neon/resources/dataapi.d.ts.map +1 -0
  108. package/dist/neon/resources/dataapi.js +59 -0
  109. package/dist/neon/resources/dataapi.js.map +1 -0
  110. package/dist/neon/resources/databases.d.ts +30 -0
  111. package/dist/neon/resources/databases.d.ts.map +1 -0
  112. package/dist/neon/resources/databases.js +68 -0
  113. package/dist/neon/resources/databases.js.map +1 -0
  114. package/dist/neon/resources/endpoints.d.ts +39 -0
  115. package/dist/neon/resources/endpoints.d.ts.map +1 -0
  116. package/dist/neon/resources/endpoints.js +89 -0
  117. package/dist/neon/resources/endpoints.js.map +1 -0
  118. package/dist/neon/resources/operations.d.ts +27 -0
  119. package/dist/neon/resources/operations.d.ts.map +1 -0
  120. package/dist/neon/resources/operations.js +50 -0
  121. package/dist/neon/resources/operations.js.map +1 -0
  122. package/dist/neon/resources/postgres.d.ts +45 -0
  123. package/dist/neon/resources/postgres.d.ts.map +1 -0
  124. package/dist/neon/resources/postgres.js +104 -0
  125. package/dist/neon/resources/postgres.js.map +1 -0
  126. package/dist/neon/resources/projects.d.ts +84 -0
  127. package/dist/neon/resources/projects.d.ts.map +1 -0
  128. package/dist/neon/resources/projects.js +111 -0
  129. package/dist/neon/resources/projects.js.map +1 -0
  130. package/dist/neon/resources/roles.d.ts +40 -0
  131. package/dist/neon/resources/roles.d.ts.map +1 -0
  132. package/dist/neon/resources/roles.js +78 -0
  133. package/dist/neon/resources/roles.js.map +1 -0
  134. package/dist/neon/resources/snapshots.d.ts +86 -0
  135. package/dist/neon/resources/snapshots.d.ts.map +1 -0
  136. package/dist/neon/resources/snapshots.js +125 -0
  137. package/dist/neon/resources/snapshots.js.map +1 -0
  138. package/dist/neon/result.d.ts +32 -0
  139. package/dist/neon/result.d.ts.map +1 -0
  140. package/dist/neon/result.js +26 -0
  141. package/dist/neon/result.js.map +1 -0
  142. package/dist/neon/retry.d.ts +17 -0
  143. package/dist/neon/retry.d.ts.map +1 -0
  144. package/dist/neon/retry.js +42 -0
  145. package/dist/neon/retry.js.map +1 -0
  146. package/dist/neon/wait.d.ts +27 -0
  147. package/dist/neon/wait.d.ts.map +1 -0
  148. package/dist/neon/wait.js +70 -0
  149. package/dist/neon/wait.js.map +1 -0
  150. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js +879 -0
  151. package/dist/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
  152. package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js +30 -0
  153. package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js.map +1 -0
  154. package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js +578 -0
  155. package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js.map +1 -0
  156. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +92 -0
  157. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
  158. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js +43 -0
  159. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
  160. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js +450 -0
  161. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js.map +1 -0
  162. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js +168 -0
  163. package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
  164. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js +10 -0
  165. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js.map +1 -0
  166. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js +109 -0
  167. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js.map +1 -0
  168. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js +10 -0
  169. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js.map +1 -0
  170. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js +10 -0
  171. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js.map +1 -0
  172. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js +10 -0
  173. package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js.map +1 -0
  174. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +11 -0
  175. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
  176. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +16 -0
  177. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
  178. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +11 -0
  179. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
  180. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +15 -0
  181. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
  182. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +13 -0
  183. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
  184. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +34 -0
  185. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
  186. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +12 -0
  187. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
  188. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +122 -0
  189. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
  190. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +39 -0
  191. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
  192. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +99 -0
  193. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
  194. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +25 -0
  195. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
  196. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +14 -0
  197. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
  198. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +21 -0
  199. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
  200. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
  201. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
  202. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +12 -0
  203. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
  204. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +18 -0
  205. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
  206. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +24 -0
  207. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
  208. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
  209. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
  210. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +30 -0
  211. package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
  212. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
  213. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
  214. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js +7 -0
  215. package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
  216. 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
  217. 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
  218. package/dist/raw.d.ts +13 -0
  219. package/dist/raw.d.ts.map +1 -0
  220. package/dist/raw.js +159 -0
  221. package/dist/raw.js.map +1 -0
  222. package/package.json +58 -16
@@ -0,0 +1,59 @@
1
+ import { createProjectBranchDataApi, deleteProjectBranchDataApi, getProjectBranchDataApi, updateProjectBranchDataApi } from "../../client/sdk.gen.js";
2
+ //#region src/neon/resources/dataapi.ts
3
+ /** Neon Data API resource (branch + database scoped). */
4
+ var DataApi = class {
5
+ #ctx;
6
+ constructor(ctx) {
7
+ this.#ctx = ctx;
8
+ }
9
+ get(projectId, branchId, databaseName, opts) {
10
+ return this.#ctx.run(opts, (client) => getProjectBranchDataApi({
11
+ client,
12
+ path: {
13
+ project_id: projectId,
14
+ branch_id: branchId,
15
+ database_name: databaseName
16
+ },
17
+ throwOnError: false
18
+ }), (data) => data);
19
+ }
20
+ create(projectId, branchId, databaseName, input, opts) {
21
+ return this.#ctx.run(opts, (client) => createProjectBranchDataApi({
22
+ client,
23
+ path: {
24
+ project_id: projectId,
25
+ branch_id: branchId,
26
+ database_name: databaseName
27
+ },
28
+ body: input,
29
+ throwOnError: false
30
+ }), (data) => data);
31
+ }
32
+ update(projectId, branchId, databaseName, input, opts) {
33
+ return this.#ctx.run(opts, (client) => updateProjectBranchDataApi({
34
+ client,
35
+ path: {
36
+ project_id: projectId,
37
+ branch_id: branchId,
38
+ database_name: databaseName
39
+ },
40
+ body: input,
41
+ throwOnError: false
42
+ }), () => void 0);
43
+ }
44
+ delete(projectId, branchId, databaseName, opts) {
45
+ return this.#ctx.run(opts, (client) => deleteProjectBranchDataApi({
46
+ client,
47
+ path: {
48
+ project_id: projectId,
49
+ branch_id: branchId,
50
+ database_name: databaseName
51
+ },
52
+ throwOnError: false
53
+ }), () => void 0);
54
+ }
55
+ };
56
+ //#endregion
57
+ export { DataApi };
58
+
59
+ //# sourceMappingURL=dataapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataapi.js","names":["#ctx"],"sources":["../../../src/neon/resources/dataapi.ts"],"sourcesContent":["import {\n\tcreateProjectBranchDataApi,\n\tdeleteProjectBranchDataApi,\n\tgetProjectBranchDataApi,\n\tupdateProjectBranchDataApi,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tDataApiCreateRequest,\n\tDataApiCreateResponse,\n\tDataApiReponse,\n\tDataApiUpdateRequest,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\n/** Neon Data API resource (branch + database scoped). */\nexport class DataApi<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}/branches/{branch_id}/data-api/{database_name} */\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t): Promise<Outcome<DataApiReponse, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<DataApiReponse, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t\topts?: CallOptions,\n\t): Promise<DataApiReponse | NeonResult<DataApiReponse>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProjectBranchDataApi({\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\tbranch_id: branchId,\n\t\t\t\t\t\tdatabase_name: databaseName,\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\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/data-api/{database_name} */\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t\tinput?: DataApiCreateRequest,\n\t): Promise<Outcome<DataApiCreateResponse, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t\tinput: DataApiCreateRequest | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<DataApiCreateResponse, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t\tinput?: DataApiCreateRequest,\n\t\topts?: CallOptions,\n\t): Promise<DataApiCreateResponse | NeonResult<DataApiCreateResponse>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateProjectBranchDataApi({\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\tbranch_id: branchId,\n\t\t\t\t\t\tdatabase_name: databaseName,\n\t\t\t\t\t},\n\t\t\t\t\tbody: input,\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 PATCH /projects/{project_id}/branches/{branch_id}/data-api/{database_name} */\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t\tinput?: DataApiUpdateRequest,\n\t): Promise<Outcome<void, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t\tinput: DataApiUpdateRequest | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t\tinput?: DataApiUpdateRequest,\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\tupdateProjectBranchDataApi({\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\tbranch_id: branchId,\n\t\t\t\t\t\tdatabase_name: databaseName,\n\t\t\t\t\t},\n\t\t\t\t\tbody: input,\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/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/data-api/{database_name} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tdatabaseName: 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\tdeleteProjectBranchDataApi({\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\tbranch_id: branchId,\n\t\t\t\t\t\tdatabase_name: databaseName,\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":";;;AAgBA,IAAa,UAAb,MAA6C;CAC5C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAcA,IACC,WACA,UACA,cACA,MACuD;EACvD,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,wBAAwB;GACvB;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,eAAe;GAChB;GACA,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;CAgBA,OACC,WACA,UACA,cACA,OACA,MACqE;EACrE,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,2BAA2B;GAC1B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,eAAe;GAChB;GACA,MAAM;GACN,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;CAgBA,OACC,WACA,UACA,cACA,OACA,MACmC;EACnC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,2BAA2B;GAC1B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,eAAe;GAChB;GACA,MAAM;GACN,cAAc;EACf,CAAC,SACI,KAAA,CACP;CACD;CAcA,OACC,WACA,UACA,cACA,MACmC;EACnC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,2BAA2B;GAC1B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,eAAe;GAChB;GACA,cAAc;EACf,CAAC,SACI,KAAA,CACP;CACD;AACD"}
@@ -0,0 +1,30 @@
1
+ import { Database, DatabaseCreateRequest, DatabaseUpdateRequest } from "../../client/types.gen.js";
2
+ import { Outcome } from "../result.js";
3
+ import { CallOptions, RequestContext } from "../context.js";
4
+
5
+ //#region src/neon/resources/databases.d.ts
6
+ type CreateInput = DatabaseCreateRequest["database"];
7
+ type UpdateInput = DatabaseUpdateRequest["database"];
8
+ /** Database resource (branch-scoped). */
9
+ declare class Databases<DThrow extends boolean> {
10
+ #private;
11
+ constructor(ctx: RequestContext);
12
+ /** @apiCall GET /projects/{project_id}/branches/{branch_id}/databases */
13
+ list(projectId: string, branchId: string): Promise<Outcome<Database[], DThrow>>;
14
+ list<Throw extends boolean = DThrow>(projectId: string, branchId: string, opts: CallOptions<Throw>): Promise<Outcome<Database[], Throw>>;
15
+ /** @apiCall GET /projects/{project_id}/branches/{branch_id}/databases/{database_name} */
16
+ get(projectId: string, branchId: string, name: string): Promise<Outcome<Database, DThrow>>;
17
+ get<Throw extends boolean = DThrow>(projectId: string, branchId: string, name: string, opts: CallOptions<Throw>): Promise<Outcome<Database, Throw>>;
18
+ /** @apiCall POST /projects/{project_id}/branches/{branch_id}/databases */
19
+ create(projectId: string, branchId: string, input: CreateInput): Promise<Outcome<Database, DThrow>>;
20
+ create<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: CreateInput, opts: CallOptions<Throw>): Promise<Outcome<Database, Throw>>;
21
+ /** @apiCall PATCH /projects/{project_id}/branches/{branch_id}/databases/{database_name} */
22
+ update(projectId: string, branchId: string, name: string, input: UpdateInput): Promise<Outcome<Database, DThrow>>;
23
+ update<Throw extends boolean = DThrow>(projectId: string, branchId: string, name: string, input: UpdateInput, opts: CallOptions<Throw>): Promise<Outcome<Database, Throw>>;
24
+ /** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/databases/{database_name} */
25
+ delete(projectId: string, branchId: string, name: string): Promise<Outcome<void, DThrow>>;
26
+ delete<Throw extends boolean = DThrow>(projectId: string, branchId: string, name: string, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
27
+ }
28
+ //#endregion
29
+ export { Databases };
30
+ //# sourceMappingURL=databases.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"databases.d.ts","names":[],"sources":["../../../src/neon/resources/databases.ts"],"mappings":";;;;;KAeK,WAAA,GAAc;KACd,WAAA,GAAc;AAHqC;AAGnD,cAGQ,SAHG,CAAG,eAAA,OAAqB,CAAA,CAAA;EAG3B,CAAA,OAAA;EAAS,WAAA,CAAA,GAAA,EAGJ,cAHI;;MAWF,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,CAAA,EAAhB,OAAgB,CAAR,OAAQ,CAAA,QAAA,EAAA,EAAY,MAAZ,CAAA,CAAA;MAAY,CAAA,cAAA,OAAA,GACF,MADE,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAIxB,WAJwB,CAIZ,KAJY,CAAA,CAAA,EAK5B,OAL4B,CAKpB,OALoB,CAKZ,QALY,EAAA,EAKA,KALA,CAAA,CAAA;;KAA5B,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,CAAA,EA4BA,OA5BA,CA4BQ,OA5BR,CA4BgB,QA5BhB,EA4B0B,MA5B1B,CAAA,CAAA;KAC0B,CAAA,cAAA,OAAA,GA4BD,MA5BC,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EAgCtB,WAhCsB,CAgCV,KAhCU,CAAA,CAAA,EAiC1B,OAjC0B,CAiClB,OAjCkB,CAiCV,QAjCU,EAiCA,KAjCA,CAAA,CAAA;;QAGtB,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,KAAA,EAyDC,WAzDD,CAAA,EA0DJ,OA1DI,CA0DI,OA1DJ,CA0DY,QA1DZ,EA0DsB,MA1DtB,CAAA,CAAA;QACY,CAAA,cAAA,OAAA,GA0DY,MA1DZ,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,KAAA,EA6DX,WA7DW,EAAA,IAAA,EA8DZ,WA9DY,CA8DA,KA9DA,CAAA,CAAA,EA+DhB,OA/DgB,CA+DR,OA/DQ,CA+DA,QA/DA,EA+DU,KA/DV,CAAA,CAAA;;QAAR,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAA,KAAA,EAwFH,WAxFG,CAAA,EAyFR,OAzFQ,CAyFA,OAzFA,CAyFQ,QAzFR,EAyFkB,MAzFlB,CAAA,CAAA;QAAR,CAAA,cAAA,OAAA,GA0F4B,MA1F5B,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAA,KAAA,EA8FK,WA9FL,EAAA,IAAA,EA+FI,WA/FJ,CA+FgB,KA/FhB,CAAA,CAAA,EAgGA,OAhGA,CAgGQ,OAhGR,CAgGgB,QAhGhB,EAgG0B,KAhG1B,CAAA,CAAA;;QAuB0B,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,CAAA,EAuG1B,OAvG0B,CAuGlB,OAvGkB,CAAA,IAAA,EAuGJ,MAvGI,CAAA,CAAA;QAAlB,CAAA,cAAA,OAAA,GAwGoB,MAxGpB,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAAA,MAAA,EAAA,IAAA,EA4GJ,WA5GI,CA4GQ,KA5GR,CAAA,CAAA,EA6GR,OA7GQ,CA6GA,OA7GA,CAAA,IAAA,EA6Gc,KA7Gd,CAAA,CAAA"}
@@ -0,0 +1,68 @@
1
+ import { createProjectBranchDatabase, deleteProjectBranchDatabase, getProjectBranchDatabase, listProjectBranchDatabases, updateProjectBranchDatabase } from "../../client/sdk.gen.js";
2
+ //#region src/neon/resources/databases.ts
3
+ /** Database resource (branch-scoped). */
4
+ var Databases = class {
5
+ #ctx;
6
+ constructor(ctx) {
7
+ this.#ctx = ctx;
8
+ }
9
+ list(projectId, branchId, opts) {
10
+ return this.#ctx.run(opts, (client) => listProjectBranchDatabases({
11
+ client,
12
+ path: {
13
+ project_id: projectId,
14
+ branch_id: branchId
15
+ },
16
+ throwOnError: false
17
+ }), (data) => data.databases);
18
+ }
19
+ get(projectId, branchId, name, opts) {
20
+ return this.#ctx.run(opts, (client) => getProjectBranchDatabase({
21
+ client,
22
+ path: {
23
+ project_id: projectId,
24
+ branch_id: branchId,
25
+ database_name: name
26
+ },
27
+ throwOnError: false
28
+ }), (data) => data.database);
29
+ }
30
+ create(projectId, branchId, input, opts) {
31
+ return this.#ctx.run(opts, (client) => createProjectBranchDatabase({
32
+ client,
33
+ path: {
34
+ project_id: projectId,
35
+ branch_id: branchId
36
+ },
37
+ body: { database: input },
38
+ throwOnError: false
39
+ }), (data) => data.database);
40
+ }
41
+ update(projectId, branchId, name, input, opts) {
42
+ return this.#ctx.run(opts, (client) => updateProjectBranchDatabase({
43
+ client,
44
+ path: {
45
+ project_id: projectId,
46
+ branch_id: branchId,
47
+ database_name: name
48
+ },
49
+ body: { database: input },
50
+ throwOnError: false
51
+ }), (data) => data.database);
52
+ }
53
+ delete(projectId, branchId, name, opts) {
54
+ return this.#ctx.runVoid(opts, (client) => deleteProjectBranchDatabase({
55
+ client,
56
+ path: {
57
+ project_id: projectId,
58
+ branch_id: branchId,
59
+ database_name: name
60
+ },
61
+ throwOnError: false
62
+ }));
63
+ }
64
+ };
65
+ //#endregion
66
+ export { Databases };
67
+
68
+ //# sourceMappingURL=databases.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"databases.js","names":["#ctx"],"sources":["../../../src/neon/resources/databases.ts"],"sourcesContent":["import {\n\tcreateProjectBranchDatabase,\n\tdeleteProjectBranchDatabase,\n\tgetProjectBranchDatabase,\n\tlistProjectBranchDatabases,\n\tupdateProjectBranchDatabase,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tDatabase,\n\tDatabaseCreateRequest,\n\tDatabaseUpdateRequest,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\ntype CreateInput = DatabaseCreateRequest[\"database\"];\ntype UpdateInput = DatabaseUpdateRequest[\"database\"];\n\n/** Database resource (branch-scoped). */\nexport class Databases<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}/branches/{branch_id}/databases */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<Database[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Database[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<Database[] | NeonResult<Database[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tlistProjectBranchDatabases({\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.databases,\n\t\t);\n\t}\n\n\t/** @apiCall GET /projects/{project_id}/branches/{branch_id}/databases/{database_name} */\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tname: string,\n\t): Promise<Outcome<Database, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tname: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Database, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tname: string,\n\t\topts?: CallOptions,\n\t): Promise<Database | NeonResult<Database>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProjectBranchDatabase({\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\tbranch_id: branchId,\n\t\t\t\t\t\tdatabase_name: name,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.database,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/databases */\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t): Promise<Outcome<Database, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Database, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<Database | NeonResult<Database>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateProjectBranchDatabase({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tbody: { database: input },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.database,\n\t\t);\n\t}\n\n\t/** @apiCall PATCH /projects/{project_id}/branches/{branch_id}/databases/{database_name} */\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tname: string,\n\t\tinput: UpdateInput,\n\t): Promise<Outcome<Database, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tname: string,\n\t\tinput: UpdateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Database, Throw>>;\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tname: string,\n\t\tinput: UpdateInput,\n\t\topts?: CallOptions,\n\t): Promise<Database | NeonResult<Database>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tupdateProjectBranchDatabase({\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\tbranch_id: branchId,\n\t\t\t\t\t\tdatabase_name: name,\n\t\t\t\t\t},\n\t\t\t\t\tbody: { database: input },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.database,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/databases/{database_name} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tname: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tname: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tname: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdeleteProjectBranchDatabase({\n\t\t\t\tclient,\n\t\t\t\tpath: {\n\t\t\t\t\tproject_id: projectId,\n\t\t\t\t\tbranch_id: branchId,\n\t\t\t\t\tdatabase_name: name,\n\t\t\t\t},\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n}\n"],"mappings":";;;AAmBA,IAAa,YAAb,MAA+C;CAC9C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAYA,KACC,WACA,UACA,MAC+C;EAC/C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,2BAA2B;GAC1B;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,SAChB;CACD;CAcA,IACC,WACA,UACA,MACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,yBAAyB;GACxB;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,eAAe;GAChB;GACA,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAcA,OACC,WACA,UACA,OACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,4BAA4B;GAC3B;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM,EAAE,UAAU,MAAM;GACxB,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAgBA,OACC,WACA,UACA,MACA,OACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,4BAA4B;GAC3B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,eAAe;GAChB;GACA,MAAM,EAAE,UAAU,MAAM;GACxB,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAcA,OACC,WACA,UACA,MACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,WAC/B,4BAA4B;GAC3B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,eAAe;GAChB;GACA,cAAc;EACf,CAAC,CACF;CACD;AACD"}
@@ -0,0 +1,39 @@
1
+ import { Endpoint, EndpointCreateRequest, EndpointUpdateRequest } from "../../client/types.gen.js";
2
+ import { Outcome } from "../result.js";
3
+ import { CallOptions, RequestContext } from "../context.js";
4
+
5
+ //#region src/neon/resources/endpoints.d.ts
6
+ type CreateInput = EndpointCreateRequest["endpoint"];
7
+ type UpdateInput = EndpointUpdateRequest["endpoint"];
8
+ /** Compute endpoint resource (project-scoped). */
9
+ declare class Endpoints<DThrow extends boolean> {
10
+ #private;
11
+ constructor(ctx: RequestContext);
12
+ /** @apiCall GET /projects/{project_id}/endpoints */
13
+ list(projectId: string): Promise<Outcome<Endpoint[], DThrow>>;
14
+ list<Throw extends boolean = DThrow>(projectId: string, opts: CallOptions<Throw>): Promise<Outcome<Endpoint[], Throw>>;
15
+ /** @apiCall GET /projects/{project_id}/endpoints/{endpoint_id} */
16
+ get(projectId: string, endpointId: string): Promise<Outcome<Endpoint, DThrow>>;
17
+ get<Throw extends boolean = DThrow>(projectId: string, endpointId: string, opts: CallOptions<Throw>): Promise<Outcome<Endpoint, Throw>>;
18
+ /** @apiCall POST /projects/{project_id}/endpoints */
19
+ create(projectId: string, input: CreateInput): Promise<Outcome<Endpoint, DThrow>>;
20
+ create<Throw extends boolean = DThrow>(projectId: string, input: CreateInput, opts: CallOptions<Throw>): Promise<Outcome<Endpoint, Throw>>;
21
+ /** @apiCall PATCH /projects/{project_id}/endpoints/{endpoint_id} */
22
+ update(projectId: string, endpointId: string, input: UpdateInput): Promise<Outcome<Endpoint, DThrow>>;
23
+ update<Throw extends boolean = DThrow>(projectId: string, endpointId: string, input: UpdateInput, opts: CallOptions<Throw>): Promise<Outcome<Endpoint, Throw>>;
24
+ /** @apiCall DELETE /projects/{project_id}/endpoints/{endpoint_id} */
25
+ delete(projectId: string, endpointId: string): Promise<Outcome<void, DThrow>>;
26
+ delete<Throw extends boolean = DThrow>(projectId: string, endpointId: string, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
27
+ /** @apiCall POST /projects/{project_id}/endpoints/{endpoint_id}/start */
28
+ start(projectId: string, endpointId: string): Promise<Outcome<Endpoint, DThrow>>;
29
+ start<Throw extends boolean = DThrow>(projectId: string, endpointId: string, opts: CallOptions<Throw>): Promise<Outcome<Endpoint, Throw>>;
30
+ /** @apiCall POST /projects/{project_id}/endpoints/{endpoint_id}/suspend */
31
+ suspend(projectId: string, endpointId: string): Promise<Outcome<Endpoint, DThrow>>;
32
+ suspend<Throw extends boolean = DThrow>(projectId: string, endpointId: string, opts: CallOptions<Throw>): Promise<Outcome<Endpoint, Throw>>;
33
+ /** @apiCall POST /projects/{project_id}/endpoints/{endpoint_id}/restart */
34
+ restart(projectId: string, endpointId: string): Promise<Outcome<Endpoint, DThrow>>;
35
+ restart<Throw extends boolean = DThrow>(projectId: string, endpointId: string, opts: CallOptions<Throw>): Promise<Outcome<Endpoint, Throw>>;
36
+ }
37
+ //#endregion
38
+ export { Endpoints };
39
+ //# sourceMappingURL=endpoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.d.ts","names":[],"sources":["../../../src/neon/resources/endpoints.ts"],"mappings":"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"}
@@ -0,0 +1,89 @@
1
+ import { createProjectEndpoint, deleteProjectEndpoint, getProjectEndpoint, listProjectEndpoints, restartProjectEndpoint, startProjectEndpoint, suspendProjectEndpoint, updateProjectEndpoint } from "../../client/sdk.gen.js";
2
+ //#region src/neon/resources/endpoints.ts
3
+ /** Compute endpoint resource (project-scoped). */
4
+ var Endpoints = class {
5
+ #ctx;
6
+ constructor(ctx) {
7
+ this.#ctx = ctx;
8
+ }
9
+ list(projectId, opts) {
10
+ return this.#ctx.run(opts, (client) => listProjectEndpoints({
11
+ client,
12
+ path: { project_id: projectId },
13
+ throwOnError: false
14
+ }), (data) => data.endpoints);
15
+ }
16
+ get(projectId, endpointId, opts) {
17
+ return this.#ctx.run(opts, (client) => getProjectEndpoint({
18
+ client,
19
+ path: {
20
+ project_id: projectId,
21
+ endpoint_id: endpointId
22
+ },
23
+ throwOnError: false
24
+ }), (data) => data.endpoint);
25
+ }
26
+ create(projectId, input, opts) {
27
+ return this.#ctx.run(opts, (client) => createProjectEndpoint({
28
+ client,
29
+ path: { project_id: projectId },
30
+ body: { endpoint: input },
31
+ throwOnError: false
32
+ }), (data) => data.endpoint);
33
+ }
34
+ update(projectId, endpointId, input, opts) {
35
+ return this.#ctx.run(opts, (client) => updateProjectEndpoint({
36
+ client,
37
+ path: {
38
+ project_id: projectId,
39
+ endpoint_id: endpointId
40
+ },
41
+ body: { endpoint: input },
42
+ throwOnError: false
43
+ }), (data) => data.endpoint);
44
+ }
45
+ delete(projectId, endpointId, opts) {
46
+ return this.#ctx.runVoid(opts, (client) => deleteProjectEndpoint({
47
+ client,
48
+ path: {
49
+ project_id: projectId,
50
+ endpoint_id: endpointId
51
+ },
52
+ throwOnError: false
53
+ }));
54
+ }
55
+ start(projectId, endpointId, opts) {
56
+ return this.#ctx.run(opts, (client) => startProjectEndpoint({
57
+ client,
58
+ path: {
59
+ project_id: projectId,
60
+ endpoint_id: endpointId
61
+ },
62
+ throwOnError: false
63
+ }), (data) => data.endpoint);
64
+ }
65
+ suspend(projectId, endpointId, opts) {
66
+ return this.#ctx.run(opts, (client) => suspendProjectEndpoint({
67
+ client,
68
+ path: {
69
+ project_id: projectId,
70
+ endpoint_id: endpointId
71
+ },
72
+ throwOnError: false
73
+ }), (data) => data.endpoint);
74
+ }
75
+ restart(projectId, endpointId, opts) {
76
+ return this.#ctx.run(opts, (client) => restartProjectEndpoint({
77
+ client,
78
+ path: {
79
+ project_id: projectId,
80
+ endpoint_id: endpointId
81
+ },
82
+ throwOnError: false
83
+ }), (data) => data.endpoint);
84
+ }
85
+ };
86
+ //#endregion
87
+ export { Endpoints };
88
+
89
+ //# sourceMappingURL=endpoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"endpoints.js","names":["#ctx"],"sources":["../../../src/neon/resources/endpoints.ts"],"sourcesContent":["import {\n\tcreateProjectEndpoint,\n\tdeleteProjectEndpoint,\n\tgetProjectEndpoint,\n\tlistProjectEndpoints,\n\trestartProjectEndpoint,\n\tstartProjectEndpoint,\n\tsuspendProjectEndpoint,\n\tupdateProjectEndpoint,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tEndpoint,\n\tEndpointCreateRequest,\n\tEndpointUpdateRequest,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\ntype CreateInput = EndpointCreateRequest[\"endpoint\"];\ntype UpdateInput = EndpointUpdateRequest[\"endpoint\"];\n\n/** Compute endpoint resource (project-scoped). */\nexport class Endpoints<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}/endpoints */\n\tlist(projectId: string): Promise<Outcome<Endpoint[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Endpoint[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\topts?: CallOptions,\n\t): Promise<Endpoint[] | NeonResult<Endpoint[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tlistProjectEndpoints({\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.endpoints,\n\t\t);\n\t}\n\n\t/** @apiCall GET /projects/{project_id}/endpoints/{endpoint_id} */\n\tget(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t): Promise<Outcome<Endpoint, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Endpoint, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts?: CallOptions,\n\t): Promise<Endpoint | NeonResult<Endpoint>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProjectEndpoint({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, endpoint_id: endpointId },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.endpoint,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/endpoints */\n\tcreate(\n\t\tprojectId: string,\n\t\tinput: CreateInput,\n\t): Promise<Outcome<Endpoint, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tinput: CreateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Endpoint, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tinput: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<Endpoint | NeonResult<Endpoint>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateProjectEndpoint({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tbody: { endpoint: input },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.endpoint,\n\t\t);\n\t}\n\n\t/** @apiCall PATCH /projects/{project_id}/endpoints/{endpoint_id} */\n\tupdate(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\tinput: UpdateInput,\n\t): Promise<Outcome<Endpoint, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\tinput: UpdateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Endpoint, Throw>>;\n\tupdate(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\tinput: UpdateInput,\n\t\topts?: CallOptions,\n\t): Promise<Endpoint | NeonResult<Endpoint>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tupdateProjectEndpoint({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, endpoint_id: endpointId },\n\t\t\t\t\tbody: { endpoint: input },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.endpoint,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/endpoints/{endpoint_id} */\n\tdelete(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdeleteProjectEndpoint({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, endpoint_id: endpointId },\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/endpoints/{endpoint_id}/start */\n\tstart(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t): Promise<Outcome<Endpoint, DThrow>>;\n\tstart<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Endpoint, Throw>>;\n\tstart(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts?: CallOptions,\n\t): Promise<Endpoint | NeonResult<Endpoint>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tstartProjectEndpoint({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, endpoint_id: endpointId },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.endpoint,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/endpoints/{endpoint_id}/suspend */\n\tsuspend(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t): Promise<Outcome<Endpoint, DThrow>>;\n\tsuspend<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Endpoint, Throw>>;\n\tsuspend(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts?: CallOptions,\n\t): Promise<Endpoint | NeonResult<Endpoint>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tsuspendProjectEndpoint({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, endpoint_id: endpointId },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.endpoint,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/endpoints/{endpoint_id}/restart */\n\trestart(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t): Promise<Outcome<Endpoint, DThrow>>;\n\trestart<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Endpoint, Throw>>;\n\trestart(\n\t\tprojectId: string,\n\t\tendpointId: string,\n\t\topts?: CallOptions,\n\t): Promise<Endpoint | NeonResult<Endpoint>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\trestartProjectEndpoint({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, endpoint_id: endpointId },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.endpoint,\n\t\t);\n\t}\n}\n"],"mappings":";;;AAsBA,IAAa,YAAb,MAA+C;CAC9C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAQA,KACC,WACA,MAC+C;EAC/C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,qBAAqB;GACpB;GACA,MAAM,EAAE,YAAY,UAAU;GAC9B,cAAc;EACf,CAAC,IACD,SAAS,KAAK,SAChB;CACD;CAYA,IACC,WACA,YACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,mBAAmB;GAClB;GACA,MAAM;IAAE,YAAY;IAAW,aAAa;GAAW;GACvD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAYA,OACC,WACA,OACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,sBAAsB;GACrB;GACA,MAAM,EAAE,YAAY,UAAU;GAC9B,MAAM,EAAE,UAAU,MAAM;GACxB,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAcA,OACC,WACA,YACA,OACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,sBAAsB;GACrB;GACA,MAAM;IAAE,YAAY;IAAW,aAAa;GAAW;GACvD,MAAM,EAAE,UAAU,MAAM;GACxB,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAYA,OACC,WACA,YACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,WAC/B,sBAAsB;GACrB;GACA,MAAM;IAAE,YAAY;IAAW,aAAa;GAAW;GACvD,cAAc;EACf,CAAC,CACF;CACD;CAYA,MACC,WACA,YACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,qBAAqB;GACpB;GACA,MAAM;IAAE,YAAY;IAAW,aAAa;GAAW;GACvD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAYA,QACC,WACA,YACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,uBAAuB;GACtB;GACA,MAAM;IAAE,YAAY;IAAW,aAAa;GAAW;GACvD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAYA,QACC,WACA,YACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,uBAAuB;GACtB;GACA,MAAM;IAAE,YAAY;IAAW,aAAa;GAAW;GACvD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;CACD;AACD"}
@@ -0,0 +1,27 @@
1
+ import { Operation } from "../../client/types.gen.js";
2
+ import { Outcome } from "../result.js";
3
+ import { WaitForOptions } from "../wait.js";
4
+ import { CallOptions, RequestContext } from "../context.js";
5
+ import { Paginated } from "../paginate.js";
6
+
7
+ //#region src/neon/resources/operations.d.ts
8
+ /** Operation resource — read operations and wait for them to finish. */
9
+ declare class Operations<DThrow extends boolean> {
10
+ #private;
11
+ constructor(ctx: RequestContext);
12
+ /** @apiCall GET /projects/{project_id}/operations (cursor-paginated) */
13
+ list(projectId: string): Paginated<Operation>;
14
+ /** @apiCall GET /projects/{project_id}/operations/{operation_id} */
15
+ get(projectId: string, operationId: string): Promise<Outcome<Operation, DThrow>>;
16
+ get<Throw extends boolean = DThrow>(projectId: string, operationId: string, opts: CallOptions<Throw>): Promise<Outcome<Operation, Throw>>;
17
+ /**
18
+ * Poll until every given operation reaches a terminal `finished`/`skipped` state.
19
+ * The primitive behind `waitForReadiness`; use it directly with operations obtained
20
+ * from any source (e.g. a raw call or a create response).
21
+ */
22
+ waitFor(operations: readonly Operation[]): Promise<Outcome<void, DThrow>>;
23
+ waitFor<Throw extends boolean = DThrow>(operations: readonly Operation[], opts: WaitForOptions & CallOptions<Throw>): Promise<Outcome<void, Throw>>;
24
+ }
25
+ //#endregion
26
+ export { Operations };
27
+ //# sourceMappingURL=operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.d.ts","names":[],"sources":["../../../src/neon/resources/operations.ts"],"mappings":";;;;;;;;cAWa;EAAA,CAAA,OAAA;EAAU,WAAA,CAAA,GAAA,EAGL,cAHK;;MAQa,CAAA,SAAA,EAAA,MAAA,CAAA,EAAV,SAAU,CAAA,SAAA,CAAA;;KAqBhB,CAAA,SAAA,EAAA,MAAA,EAAA,WAAA,EAAA,MAAA,CAAA,EAAhB,OAAgB,CAAR,OAAQ,CAAA,SAAA,EAAW,MAAX,CAAA,CAAA;KAAW,CAAA,cAAA,OAAA,GACF,MADE,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,WAAA,EAAA,MAAA,EAAA,IAAA,EAIvB,WAJuB,CAIX,KAJW,CAAA,CAAA,EAK3B,OAL2B,CAKnB,OALmB,CAKX,SALW,EAKA,KALA,CAAA,CAAA;;;;;;SAKX,CAAA,UAAA,EAAA,SAuBU,SAvBV,EAAA,CAAA,EAuBwB,OAvBxB,CAuBgC,OAvBhC,CAAA,IAAA,EAuB8C,MAvB9C,CAAA,CAAA;SAAW,CAAA,cAAA,OAAA,GAwBE,MAxBF,CAAA,CAAA,UAAA,EAAA,SAyBR,SAzBQ,EAAA,EAAA,IAAA,EA0BvB,cA1BuB,GA0BN,WA1BM,CA0BM,KA1BN,CAAA,CAAA,EA2B3B,OA3B2B,CA2BnB,OA3BmB,CAAA,IAAA,EA2BL,KA3BK,CAAA,CAAA"}
@@ -0,0 +1,50 @@
1
+ import { getProjectOperation, listProjectOperations } from "../../client/sdk.gen.js";
2
+ import { waitForOperations } from "../wait.js";
3
+ import { paginate } from "../paginate.js";
4
+ //#region src/neon/resources/operations.ts
5
+ /** Operation resource — read operations and wait for them to finish. */
6
+ var Operations = class {
7
+ #ctx;
8
+ constructor(ctx) {
9
+ this.#ctx = ctx;
10
+ }
11
+ /** @apiCall GET /projects/{project_id}/operations (cursor-paginated) */
12
+ list(projectId) {
13
+ return paginate((cursor, signal) => listProjectOperations({
14
+ client: this.#ctx.client,
15
+ path: { project_id: projectId },
16
+ query: { cursor },
17
+ throwOnError: false,
18
+ signal
19
+ }), (data) => ({
20
+ items: data?.operations ?? [],
21
+ cursor: data?.pagination?.cursor
22
+ }));
23
+ }
24
+ get(projectId, operationId, opts) {
25
+ return this.#ctx.run(opts, (client) => getProjectOperation({
26
+ client,
27
+ path: {
28
+ project_id: projectId,
29
+ operation_id: operationId
30
+ },
31
+ throwOnError: false
32
+ }), (data) => data.operation);
33
+ }
34
+ async waitFor(operations, opts) {
35
+ const defaults = this.#ctx.defaults;
36
+ const shouldThrow = opts?.throwOnError ?? defaults.throwOnError;
37
+ const result = await waitForOperations(this.#ctx.client, operations, {
38
+ pollIntervalMs: opts?.pollIntervalMs ?? defaults.waitOptions.pollIntervalMs,
39
+ timeoutMs: opts?.timeoutMs ?? defaults.waitOptions.timeoutMs,
40
+ signal: opts?.signal ?? defaults.waitOptions.signal
41
+ });
42
+ if (!shouldThrow) return result;
43
+ if (result.error) throw result.error;
44
+ return result.data;
45
+ }
46
+ };
47
+ //#endregion
48
+ export { Operations };
49
+
50
+ //# sourceMappingURL=operations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","names":["#ctx"],"sources":["../../../src/neon/resources/operations.ts"],"sourcesContent":["import {\n\tgetProjectOperation,\n\tlistProjectOperations,\n} from \"../../client/sdk.gen.js\";\nimport type { Operation } from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport { type Paginated, paginate } from \"../paginate.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\nimport { type WaitForOptions, waitForOperations } from \"../wait.js\";\n\n/** Operation resource — read operations and wait for them to finish. */\nexport class Operations<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}/operations (cursor-paginated) */\n\tlist(projectId: string): Paginated<Operation> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tlistProjectOperations({\n\t\t\t\t\tclient: this.#ctx.client,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tquery: { 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?.operations ?? [],\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}/operations/{operation_id} */\n\tget(\n\t\tprojectId: string,\n\t\toperationId: string,\n\t): Promise<Outcome<Operation, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\toperationId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Operation, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\toperationId: string,\n\t\topts?: CallOptions,\n\t): Promise<Operation | NeonResult<Operation>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProjectOperation({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, operation_id: operationId },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.operation,\n\t\t);\n\t}\n\n\t/**\n\t * Poll until every given operation reaches a terminal `finished`/`skipped` state.\n\t * The primitive behind `waitForReadiness`; use it directly with operations obtained\n\t * from any source (e.g. a raw call or a create response).\n\t */\n\twaitFor(operations: readonly Operation[]): Promise<Outcome<void, DThrow>>;\n\twaitFor<Throw extends boolean = DThrow>(\n\t\toperations: readonly Operation[],\n\t\topts: WaitForOptions & CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tasync waitFor(\n\t\toperations: readonly Operation[],\n\t\topts?: WaitForOptions & CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\tconst defaults = this.#ctx.defaults;\n\t\tconst shouldThrow = opts?.throwOnError ?? defaults.throwOnError;\n\t\tconst result = await waitForOperations(this.#ctx.client, operations, {\n\t\t\tpollIntervalMs:\n\t\t\t\topts?.pollIntervalMs ?? defaults.waitOptions.pollIntervalMs,\n\t\t\ttimeoutMs: opts?.timeoutMs ?? defaults.waitOptions.timeoutMs,\n\t\t\tsignal: opts?.signal ?? defaults.waitOptions.signal,\n\t\t});\n\t\tif (!shouldThrow) return result;\n\t\tif (result.error) throw result.error;\n\t\treturn result.data;\n\t}\n}\n"],"mappings":";;;;;AAWA,IAAa,aAAb,MAAgD;CAC/C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;CAGA,KAAK,WAAyC;EAC7C,OAAO,UACL,QAAQ,WACR,sBAAsB;GACrB,QAAQ,KAAKA,KAAK;GAClB,MAAM,EAAE,YAAY,UAAU;GAC9B,OAAO,EAAE,OAAO;GAChB,cAAc;GACd;EACD,CAAC,IACD,UAAU;GACV,OAAO,MAAM,cAAc,CAAC;GAC5B,QAAQ,MAAM,YAAY;EAC3B,EACD;CACD;CAYA,IACC,WACA,aACA,MAC6C;EAC7C,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,oBAAoB;GACnB;GACA,MAAM;IAAE,YAAY;IAAW,cAAc;GAAY;GACzD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,SAChB;CACD;CAYA,MAAM,QACL,YACA,MACmC;EACnC,MAAM,WAAW,KAAKA,KAAK;EAC3B,MAAM,cAAc,MAAM,gBAAgB,SAAS;EACnD,MAAM,SAAS,MAAM,kBAAkB,KAAKA,KAAK,QAAQ,YAAY;GACpE,gBACC,MAAM,kBAAkB,SAAS,YAAY;GAC9C,WAAW,MAAM,aAAa,SAAS,YAAY;GACnD,QAAQ,MAAM,UAAU,SAAS,YAAY;EAC9C,CAAC;EACD,IAAI,CAAC,aAAa,OAAO;EACzB,IAAI,OAAO,OAAO,MAAM,OAAO;EAC/B,OAAO,OAAO;CACf;AACD"}
@@ -0,0 +1,45 @@
1
+ import { Outcome } from "../result.js";
2
+ import { CallOptions, RequestContext } from "../context.js";
3
+ import { DataApi } from "./dataapi.js";
4
+ import { Databases } from "./databases.js";
5
+ import { Endpoints } from "./endpoints.js";
6
+ import { Roles } from "./roles.js";
7
+
8
+ //#region src/neon/resources/postgres.d.ts
9
+ /** Parameters for {@link Postgres.connectionString}. */
10
+ interface ConnectionStringParams {
11
+ projectId: string;
12
+ /** Defaults to the project's default branch. */
13
+ branchId?: string;
14
+ /** Defaults to the branch's read-write endpoint. */
15
+ endpointId?: string;
16
+ /** Auto-selected when the branch has exactly one database. */
17
+ databaseName?: string;
18
+ /** Auto-selected when the branch has exactly one role. */
19
+ roleName?: string;
20
+ /** Pooled connection string (default `true`). */
21
+ pooled?: boolean;
22
+ }
23
+ /**
24
+ * The Postgres data plane of a branch: compute endpoints, roles, databases, the Data API,
25
+ * and a connection-string helper. (Grouped under `neon.postgres.*` so future top-level
26
+ * namespaces like `functions` / `storage` stay unambiguous.)
27
+ */
28
+ declare class Postgres<DThrow extends boolean> {
29
+ #private;
30
+ readonly endpoints: Endpoints<DThrow>;
31
+ readonly roles: Roles<DThrow>;
32
+ readonly databases: Databases<DThrow>;
33
+ readonly dataApi: DataApi<DThrow>;
34
+ constructor(ctx: RequestContext);
35
+ /**
36
+ * Resolve a Postgres connection string. Auto-selects the default branch and the sole
37
+ * role/database when not specified (mirrors `@neon/config`'s `fetchEnv`); returns
38
+ * a `client`-kind {@link NeonError} when the selection is ambiguous.
39
+ */
40
+ connectionString(params: ConnectionStringParams): Promise<Outcome<string, DThrow>>;
41
+ connectionString<Throw extends boolean = DThrow>(params: ConnectionStringParams, opts: CallOptions<Throw>): Promise<Outcome<string, Throw>>;
42
+ }
43
+ //#endregion
44
+ export { ConnectionStringParams, Postgres };
45
+ //# sourceMappingURL=postgres.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postgres.d.ts","names":[],"sources":["../../../src/neon/resources/postgres.ts"],"mappings":";;;;;;;;;UAeiB,sBAAA;EAAA,SAAA,EAAA,MAAA;EAmBJ;EAAQ,QAAA,CAAA,EAAA,MAAA;;YACA,CAAA,EAAA,MAAA;;cACJ,CAAA,EAAA,MAAA;;UACI,CAAA,EAAA,MAAA;;QACF,CAAA,EAAA,OAAA;;;;;;;AAoBT,cAxBG,QAwBH,CAAA,eAAA,OAAA,CAAA,CAAA;UACU;WAAZ,SAAA,EAxBa,SAwBb,CAxBuB,MAwBvB,CAAA;WACoB,KAAA,EAxBX,KAwBW,CAxBL,MAwBK,CAAA;WAAhB,SAAA,EAvBS,SAuBT,CAvBmB,MAuBnB,CAAA;WAAR,OAAA,EAtBe,OAsBf,CAtBuB,MAsBvB,CAAA;EAAO,WAAA,CAAA,GAAA,EAnBO,cAmBP;;;;;;2BALD,yBACN,QAAQ,gBAAgB;2CACc,gBAChC,8BACF,YAAY,SAChB,QAAQ,gBAAgB"}
@@ -0,0 +1,104 @@
1
+ import { NeonError, toNeonError } from "../errors.js";
2
+ import { err, finalize, ok } from "../result.js";
3
+ import { getConnectionUri, listProjectBranchDatabases, listProjectBranchRoles, listProjectBranches } from "../../client/sdk.gen.js";
4
+ import { DataApi } from "./dataapi.js";
5
+ import { Databases } from "./databases.js";
6
+ import { Endpoints } from "./endpoints.js";
7
+ import { Roles } from "./roles.js";
8
+ //#region src/neon/resources/postgres.ts
9
+ /**
10
+ * The Postgres data plane of a branch: compute endpoints, roles, databases, the Data API,
11
+ * and a connection-string helper. (Grouped under `neon.postgres.*` so future top-level
12
+ * namespaces like `functions` / `storage` stay unambiguous.)
13
+ */
14
+ var Postgres = class {
15
+ endpoints;
16
+ roles;
17
+ databases;
18
+ dataApi;
19
+ #ctx;
20
+ constructor(ctx) {
21
+ this.#ctx = ctx;
22
+ this.endpoints = new Endpoints(ctx);
23
+ this.roles = new Roles(ctx);
24
+ this.databases = new Databases(ctx);
25
+ this.dataApi = new DataApi(ctx);
26
+ }
27
+ async connectionString(params, opts) {
28
+ const shouldThrow = opts?.throwOnError ?? this.#ctx.defaults.throwOnError;
29
+ return finalize(await this.#resolve(params, opts?.signal), shouldThrow);
30
+ }
31
+ async #resolve(params, signal) {
32
+ const client = this.#ctx.client;
33
+ const projectId = params.projectId;
34
+ let branchId = params.branchId;
35
+ let roleName = params.roleName;
36
+ let databaseName = params.databaseName;
37
+ if ((!roleName || !databaseName) && !branchId) {
38
+ const branches = await listProjectBranches({
39
+ client,
40
+ path: { project_id: projectId },
41
+ throwOnError: false,
42
+ signal
43
+ });
44
+ if (branches.error || !branches.data) return err(toNeonError(branches.error, branches.response));
45
+ branchId = branches.data.branches.find((branch) => branch.default)?.id;
46
+ if (!branchId) return err(new NeonError("Could not determine the default branch; pass branchId.", "client"));
47
+ }
48
+ if (!roleName) {
49
+ if (!branchId) return err(branchRequired("roleName"));
50
+ const roles = await listProjectBranchRoles({
51
+ client,
52
+ path: {
53
+ project_id: projectId,
54
+ branch_id: branchId
55
+ },
56
+ throwOnError: false,
57
+ signal
58
+ });
59
+ if (roles.error || !roles.data) return err(toNeonError(roles.error, roles.response));
60
+ if (roles.data.roles.length !== 1) return err(ambiguous("role", roles.data.roles.length, "roleName"));
61
+ roleName = roles.data.roles[0].name;
62
+ }
63
+ if (!databaseName) {
64
+ if (!branchId) return err(branchRequired("databaseName"));
65
+ const databases = await listProjectBranchDatabases({
66
+ client,
67
+ path: {
68
+ project_id: projectId,
69
+ branch_id: branchId
70
+ },
71
+ throwOnError: false,
72
+ signal
73
+ });
74
+ if (databases.error || !databases.data) return err(toNeonError(databases.error, databases.response));
75
+ if (databases.data.databases.length !== 1) return err(ambiguous("database", databases.data.databases.length, "databaseName"));
76
+ databaseName = databases.data.databases[0].name;
77
+ }
78
+ const conn = await getConnectionUri({
79
+ client,
80
+ path: { project_id: projectId },
81
+ query: {
82
+ branch_id: branchId,
83
+ endpoint_id: params.endpointId,
84
+ database_name: databaseName,
85
+ role_name: roleName,
86
+ pooled: params.pooled ?? true
87
+ },
88
+ throwOnError: false,
89
+ signal
90
+ });
91
+ if (conn.error || !conn.data) return err(toNeonError(conn.error, conn.response));
92
+ return ok(conn.data.uri);
93
+ }
94
+ };
95
+ function branchRequired(param) {
96
+ return new NeonError(`Pass branchId or ${param} to resolve a connection string.`, "client");
97
+ }
98
+ function ambiguous(kind, count, param) {
99
+ return new NeonError(`Expected exactly one ${kind} to auto-select for the connection string; found ${count}. Pass ${param}.`, "client");
100
+ }
101
+ //#endregion
102
+ export { Postgres };
103
+
104
+ //# sourceMappingURL=postgres.js.map
@@ -0,0 +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":"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"}