@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.
- package/README.md +133 -5
- package/dist/_virtual/_rolldown/runtime.js +2 -1
- package/dist/client/core/pathSerializer.gen.d.ts.map +1 -1
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +2 -2
- package/dist/client/raw.gen.d.ts +4282 -0
- package/dist/client/raw.gen.d.ts.map +1 -0
- package/dist/client/raw.gen.js +170 -0
- package/dist/client/raw.gen.js.map +1 -0
- package/dist/client/sdk.gen.d.ts +252 -2
- package/dist/client/sdk.gen.d.ts.map +1 -1
- package/dist/client/sdk.gen.js +634 -1
- package/dist/client/sdk.gen.js.map +1 -1
- package/dist/client/types.gen.d.ts +2602 -1530
- package/dist/client/types.gen.d.ts.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/neon/client.d.ts +10 -0
- package/dist/neon/client.d.ts.map +1 -1
- package/dist/neon/client.js +10 -0
- package/dist/neon/client.js.map +1 -1
- package/dist/neon/client.test-d.d.ts +1 -0
- package/dist/neon/client.test-d.js +93 -0
- package/dist/neon/client.test-d.js.map +1 -0
- package/dist/neon/coverage.d.ts.map +1 -1
- package/dist/neon/coverage.js +57 -0
- package/dist/neon/coverage.js.map +1 -1
- package/dist/neon/raw-wrap.d.ts +63 -0
- package/dist/neon/raw-wrap.d.ts.map +1 -0
- package/dist/neon/raw-wrap.js +47 -0
- package/dist/neon/raw-wrap.js.map +1 -0
- package/dist/neon/resources/ai-gateway.d.ts +16 -0
- package/dist/neon/resources/ai-gateway.d.ts.map +1 -0
- package/dist/neon/resources/ai-gateway.js +23 -0
- package/dist/neon/resources/ai-gateway.js.map +1 -0
- package/dist/neon/resources/auth.d.ts +81 -0
- package/dist/neon/resources/auth.d.ts.map +1 -0
- package/dist/neon/resources/auth.js +197 -0
- package/dist/neon/resources/auth.js.map +1 -0
- package/dist/neon/resources/branches.d.ts +7 -0
- package/dist/neon/resources/branches.d.ts.map +1 -1
- package/dist/neon/resources/branches.js +11 -1
- package/dist/neon/resources/branches.js.map +1 -1
- package/dist/neon/resources/bucket-objects.d.ts +33 -0
- package/dist/neon/resources/bucket-objects.d.ts.map +1 -0
- package/dist/neon/resources/bucket-objects.js +74 -0
- package/dist/neon/resources/bucket-objects.js.map +1 -0
- package/dist/neon/resources/buckets.d.ts +23 -0
- package/dist/neon/resources/buckets.d.ts.map +1 -0
- package/dist/neon/resources/buckets.js +45 -0
- package/dist/neon/resources/buckets.js.map +1 -0
- package/dist/neon/resources/credentials.d.ts +23 -0
- package/dist/neon/resources/credentials.d.ts.map +1 -0
- package/dist/neon/resources/credentials.js +45 -0
- package/dist/neon/resources/credentials.js.map +1 -0
- package/dist/neon/resources/endpoints.d.ts +3 -0
- package/dist/neon/resources/endpoints.d.ts.map +1 -1
- package/dist/neon/resources/endpoints.js +11 -1
- package/dist/neon/resources/endpoints.js.map +1 -1
- package/dist/neon/resources/functions.d.ts +30 -0
- package/dist/neon/resources/functions.d.ts.map +1 -0
- package/dist/neon/resources/functions.js +79 -0
- package/dist/neon/resources/functions.js.map +1 -0
- package/dist/neon/resources/postgres.d.ts +1 -1
- package/dist/neon/resources/postgres.js.map +1 -1
- package/dist/neon/resources/projects.d.ts +26 -2
- package/dist/neon/resources/projects.d.ts.map +1 -1
- package/dist/neon/resources/projects.js +44 -2
- package/dist/neon/resources/projects.js.map +1 -1
- package/dist/neon/resources/storage.d.ts +24 -0
- package/dist/neon/resources/storage.d.ts.map +1 -0
- package/dist/neon/resources/storage.js +32 -0
- package/dist/neon/resources/storage.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js +879 -0
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js +30 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js +579 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +92 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js +43 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js +450 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js +168 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js +10 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js +109 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js +10 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js +10 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js +10 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +11 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +16 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +11 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +15 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +13 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +34 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +12 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +122 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +39 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +99 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +25 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +14 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +21 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +12 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +18 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +24 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +30 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js +7 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
- 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
- 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
- package/dist/raw.d.ts +4 -3
- package/dist/raw.js +24 -3
- package/dist/raw.js.map +1 -1
- package/package.json +4 -3
package/dist/neon/client.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { Client } from "../client/client/types.gen.js";
|
|
2
2
|
import { NeonConfig } from "./config.js";
|
|
3
3
|
import { ApiKeys, Regions, User } from "./resources/account.js";
|
|
4
|
+
import { AiGateway } from "./resources/ai-gateway.js";
|
|
5
|
+
import { Auth } from "./resources/auth.js";
|
|
4
6
|
import { Branches } from "./resources/branches.js";
|
|
5
7
|
import { Consumption } from "./resources/consumption.js";
|
|
8
|
+
import { Credentials } from "./resources/credentials.js";
|
|
9
|
+
import { Functions } from "./resources/functions.js";
|
|
6
10
|
import { Operations } from "./resources/operations.js";
|
|
7
11
|
import { Postgres } from "./resources/postgres.js";
|
|
8
12
|
import { Projects } from "./resources/projects.js";
|
|
9
13
|
import { Snapshots } from "./resources/snapshots.js";
|
|
14
|
+
import { Storage } from "./resources/storage.js";
|
|
10
15
|
|
|
11
16
|
//#region src/neon/client.d.ts
|
|
12
17
|
|
|
@@ -23,8 +28,13 @@ interface NeonClient<DThrow extends boolean> {
|
|
|
23
28
|
readonly projects: Projects<DThrow>;
|
|
24
29
|
readonly branches: Branches<DThrow>;
|
|
25
30
|
readonly postgres: Postgres<DThrow>;
|
|
31
|
+
readonly storage: Storage<DThrow>;
|
|
32
|
+
readonly functions: Functions<DThrow>;
|
|
33
|
+
readonly credentials: Credentials<DThrow>;
|
|
34
|
+
readonly aiGateway: AiGateway<DThrow>;
|
|
26
35
|
readonly snapshots: Snapshots<DThrow>;
|
|
27
36
|
readonly operations: Operations<DThrow>;
|
|
37
|
+
readonly auth: Auth<DThrow>;
|
|
28
38
|
readonly consumption: Consumption;
|
|
29
39
|
readonly apiKeys: ApiKeys<DThrow>;
|
|
30
40
|
readonly regions: Regions<DThrow>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/neon/client.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","names":[],"sources":["../../src/neon/client.ts"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA;;;;;;;AAGoB,UAHH,UAGG,CAAA,eAAA,OAAA,CAAA,CAAA;WACO,QAAA,EAHP,QAGO,CAHE,MAGF,CAAA;WAAR,QAAA,EAFC,QAED,CAFU,MAEV,CAAA;WACY,QAAA,EAFX,QAEW,CAFF,MAEE,CAAA;WAAV,OAAA,EADF,OACE,CADM,MACN,CAAA;WACc,SAAA,EADd,SACc,CADJ,MACI,CAAA;WAAZ,WAAA,EAAA,WAAA,CAAY,MAAZ,CAAA;WACQ,SAAA,EAAV,SAAU,CAAA,MAAA,CAAA;WAAV,SAAA,EACA,SADA,CACU,MADV,CAAA;WACU,UAAA,EACT,UADS,CACE,MADF,CAAA;WAAV,IAAA,EAEL,IAFK,CAEA,MAFA,CAAA;WACY,WAAA,EAEV,WAFU;WAAX,OAAA,EAGH,OAHG,CAGK,MAHL,CAAA;WACD,OAAA,EAGF,OAHE,CAGM,MAHN,CAAA;WAAL,IAAA,EAIA,IAJA,CAIK,MAJL,CAAA;;;;;WAGG,MAAA,EAMD,MANC;;;;AAMK;AAcxB;;;;;;AAEa;;iBAFG,wDACP,WAAW,SACjB,WAAW"}
|
package/dist/neon/client.js
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { resolveConfig } from "./config.js";
|
|
2
2
|
import { RequestContext } from "./context.js";
|
|
3
3
|
import { ApiKeys, Regions, User } from "./resources/account.js";
|
|
4
|
+
import { AiGateway } from "./resources/ai-gateway.js";
|
|
5
|
+
import { Auth } from "./resources/auth.js";
|
|
4
6
|
import { Branches } from "./resources/branches.js";
|
|
5
7
|
import { Consumption } from "./resources/consumption.js";
|
|
8
|
+
import { Credentials } from "./resources/credentials.js";
|
|
9
|
+
import { Functions } from "./resources/functions.js";
|
|
6
10
|
import { Operations } from "./resources/operations.js";
|
|
7
11
|
import { Postgres } from "./resources/postgres.js";
|
|
8
12
|
import { Projects } from "./resources/projects.js";
|
|
9
13
|
import { Snapshots } from "./resources/snapshots.js";
|
|
14
|
+
import { Storage } from "./resources/storage.js";
|
|
10
15
|
//#region src/neon/client.ts
|
|
11
16
|
/**
|
|
12
17
|
* Create an ergonomic Neon client.
|
|
@@ -25,8 +30,13 @@ function createNeonClient(config) {
|
|
|
25
30
|
projects: new Projects(ctx),
|
|
26
31
|
branches: new Branches(ctx),
|
|
27
32
|
postgres: new Postgres(ctx),
|
|
33
|
+
storage: new Storage(ctx),
|
|
34
|
+
functions: new Functions(ctx),
|
|
35
|
+
credentials: new Credentials(ctx),
|
|
36
|
+
aiGateway: new AiGateway(ctx),
|
|
28
37
|
snapshots: new Snapshots(ctx),
|
|
29
38
|
operations: new Operations(ctx),
|
|
39
|
+
auth: new Auth(ctx),
|
|
30
40
|
consumption: new Consumption(ctx),
|
|
31
41
|
apiKeys: new ApiKeys(ctx),
|
|
32
42
|
regions: new Regions(ctx),
|
package/dist/neon/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","names":[],"sources":["../../src/neon/client.ts"],"sourcesContent":["import type { Client } from \"../client/client/index.js\";\nimport { type NeonConfig, resolveConfig } from \"./config.js\";\nimport { RequestContext } from \"./context.js\";\nimport { ApiKeys, Regions, User } from \"./resources/account.js\";\nimport { Branches } from \"./resources/branches.js\";\nimport { Consumption } from \"./resources/consumption.js\";\nimport { Operations } from \"./resources/operations.js\";\nimport { Postgres } from \"./resources/postgres.js\";\nimport { Projects } from \"./resources/projects.js\";\nimport { Snapshots } from \"./resources/snapshots.js\";\n\n/**\n * The ergonomic Neon client. Resource namespaces wrap the raw operations with auth-once,\n * retries, the `{ data, error }` envelope, optional readiness polling, and typed errors.\n * Drop to the raw layer any time via `.client`.\n *\n * `projects` and `branches` are top-level; the Postgres data plane (compute endpoints,\n * roles, databases, the Data API, connection strings) is grouped under `postgres` so\n * future top-level namespaces (e.g. functions, object storage) stay unambiguous.\n */\nexport interface NeonClient<DThrow extends boolean> {\n\treadonly projects: Projects<DThrow>;\n\treadonly branches: Branches<DThrow>;\n\treadonly postgres: Postgres<DThrow>;\n\treadonly snapshots: Snapshots<DThrow>;\n\treadonly operations: Operations<DThrow>;\n\treadonly consumption: Consumption;\n\treadonly apiKeys: ApiKeys<DThrow>;\n\treadonly regions: Regions<DThrow>;\n\treadonly user: User<DThrow>;\n\t/**\n\t * The underlying configured raw client. Pass it to any raw function\n\t * (`import { raw } from \"@neon/sdk\"`) to reuse this client's auth + base URL.\n\t */\n\treadonly client: Client;\n}\n\n/**\n * Create an ergonomic Neon client.\n *\n * @example\n * ```ts\n * import { createNeonClient } from \"@neon/sdk\";\n *\n * const neon = createNeonClient({ apiKey: process.env.NEON_API_KEY! });\n * const { data, error } = await neon.projects.list().all();\n * ```\n */\nexport function createNeonClient<Throw extends boolean = false>(\n\tconfig: NeonConfig<Throw>,\n): NeonClient<Throw> {\n\tconst ctx = new RequestContext(resolveConfig(config));\n\treturn {\n\t\tprojects: new Projects<Throw>(ctx),\n\t\tbranches: new Branches<Throw>(ctx),\n\t\tpostgres: new Postgres<Throw>(ctx),\n\t\tsnapshots: new Snapshots<Throw>(ctx),\n\t\toperations: new Operations<Throw>(ctx),\n\t\tconsumption: new Consumption(ctx),\n\t\tapiKeys: new ApiKeys<Throw>(ctx),\n\t\tregions: new Regions<Throw>(ctx),\n\t\tuser: new User<Throw>(ctx),\n\t\tclient: ctx.client,\n\t};\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.js","names":[],"sources":["../../src/neon/client.ts"],"sourcesContent":["import type { Client } from \"../client/client/index.js\";\nimport { type NeonConfig, resolveConfig } from \"./config.js\";\nimport { RequestContext } from \"./context.js\";\nimport { ApiKeys, Regions, User } from \"./resources/account.js\";\nimport { AiGateway } from \"./resources/ai-gateway.js\";\nimport { Auth } from \"./resources/auth.js\";\nimport { Branches } from \"./resources/branches.js\";\nimport { Consumption } from \"./resources/consumption.js\";\nimport { Credentials } from \"./resources/credentials.js\";\nimport { Functions } from \"./resources/functions.js\";\nimport { Operations } from \"./resources/operations.js\";\nimport { Postgres } from \"./resources/postgres.js\";\nimport { Projects } from \"./resources/projects.js\";\nimport { Snapshots } from \"./resources/snapshots.js\";\nimport { Storage } from \"./resources/storage.js\";\n\n/**\n * The ergonomic Neon client. Resource namespaces wrap the raw operations with auth-once,\n * retries, the `{ data, error }` envelope, optional readiness polling, and typed errors.\n * Drop to the raw layer any time via `.client`.\n *\n * `projects` and `branches` are top-level; the Postgres data plane (compute endpoints,\n * roles, databases, the Data API, connection strings) is grouped under `postgres` so\n * future top-level namespaces (e.g. functions, object storage) stay unambiguous.\n */\nexport interface NeonClient<DThrow extends boolean> {\n\treadonly projects: Projects<DThrow>;\n\treadonly branches: Branches<DThrow>;\n\treadonly postgres: Postgres<DThrow>;\n\treadonly storage: Storage<DThrow>;\n\treadonly functions: Functions<DThrow>;\n\treadonly credentials: Credentials<DThrow>;\n\treadonly aiGateway: AiGateway<DThrow>;\n\treadonly snapshots: Snapshots<DThrow>;\n\treadonly operations: Operations<DThrow>;\n\treadonly auth: Auth<DThrow>;\n\treadonly consumption: Consumption;\n\treadonly apiKeys: ApiKeys<DThrow>;\n\treadonly regions: Regions<DThrow>;\n\treadonly user: User<DThrow>;\n\t/**\n\t * The underlying configured raw client. Pass it to any raw function\n\t * (`import { raw } from \"@neon/sdk\"`) to reuse this client's auth + base URL.\n\t */\n\treadonly client: Client;\n}\n\n/**\n * Create an ergonomic Neon client.\n *\n * @example\n * ```ts\n * import { createNeonClient } from \"@neon/sdk\";\n *\n * const neon = createNeonClient({ apiKey: process.env.NEON_API_KEY! });\n * const { data, error } = await neon.projects.list().all();\n * ```\n */\nexport function createNeonClient<Throw extends boolean = false>(\n\tconfig: NeonConfig<Throw>,\n): NeonClient<Throw> {\n\tconst ctx = new RequestContext(resolveConfig(config));\n\treturn {\n\t\tprojects: new Projects<Throw>(ctx),\n\t\tbranches: new Branches<Throw>(ctx),\n\t\tpostgres: new Postgres<Throw>(ctx),\n\t\tstorage: new Storage<Throw>(ctx),\n\t\tfunctions: new Functions<Throw>(ctx),\n\t\tcredentials: new Credentials<Throw>(ctx),\n\t\taiGateway: new AiGateway<Throw>(ctx),\n\t\tsnapshots: new Snapshots<Throw>(ctx),\n\t\toperations: new Operations<Throw>(ctx),\n\t\tauth: new Auth<Throw>(ctx),\n\t\tconsumption: new Consumption(ctx),\n\t\tapiKeys: new ApiKeys<Throw>(ctx),\n\t\tregions: new Regions<Throw>(ctx),\n\t\tuser: new User<Throw>(ctx),\n\t\tclient: ctx.client,\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,SAAgB,iBACf,QACoB;CACpB,MAAM,MAAM,IAAI,eAAe,cAAc,MAAM,CAAC;CACpD,OAAO;EACN,UAAU,IAAI,SAAgB,GAAG;EACjC,UAAU,IAAI,SAAgB,GAAG;EACjC,UAAU,IAAI,SAAgB,GAAG;EACjC,SAAS,IAAI,QAAe,GAAG;EAC/B,WAAW,IAAI,UAAiB,GAAG;EACnC,aAAa,IAAI,YAAmB,GAAG;EACvC,WAAW,IAAI,UAAiB,GAAG;EACnC,WAAW,IAAI,UAAiB,GAAG;EACnC,YAAY,IAAI,WAAkB,GAAG;EACrC,MAAM,IAAI,KAAY,GAAG;EACzB,aAAa,IAAI,YAAY,GAAG;EAChC,SAAS,IAAI,QAAe,GAAG;EAC/B,SAAS,IAAI,QAAe,GAAG;EAC/B,MAAM,IAAI,KAAY,GAAG;EACzB,QAAQ,IAAI;CACb;AACD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { createNeonClient } from "./client.js";
|
|
2
|
+
import { it } from "../node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js";
|
|
3
|
+
import { import_dist } from "../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";
|
|
4
|
+
//#region src/neon/client.test-d.ts
|
|
5
|
+
it("default client returns the { data, error } envelope", () => {
|
|
6
|
+
const neon = createNeonClient({ apiKey: "x" });
|
|
7
|
+
(0, import_dist.expectTypeOf)(neon.projects.get("p")).resolves.toEqualTypeOf();
|
|
8
|
+
(0, import_dist.expectTypeOf)(neon.projects.create()).resolves.toEqualTypeOf();
|
|
9
|
+
});
|
|
10
|
+
it("throwOnError on the client narrows methods to the bare resource", () => {
|
|
11
|
+
(0, import_dist.expectTypeOf)(createNeonClient({
|
|
12
|
+
apiKey: "x",
|
|
13
|
+
throwOnError: true
|
|
14
|
+
}).projects.get("p")).resolves.toEqualTypeOf();
|
|
15
|
+
});
|
|
16
|
+
it("per-call throwOnError overrides the client default and narrows", () => {
|
|
17
|
+
(0, import_dist.expectTypeOf)(createNeonClient({ apiKey: "x" }).projects.get("p", { throwOnError: true })).resolves.toEqualTypeOf();
|
|
18
|
+
(0, import_dist.expectTypeOf)(createNeonClient({
|
|
19
|
+
apiKey: "x",
|
|
20
|
+
throwOnError: true
|
|
21
|
+
}).projects.get("p", { throwOnError: false })).resolves.toEqualTypeOf();
|
|
22
|
+
});
|
|
23
|
+
it("branches + workflows carry the envelope and narrow under throwOnError", () => {
|
|
24
|
+
const neon = createNeonClient({ apiKey: "x" });
|
|
25
|
+
(0, import_dist.expectTypeOf)(neon.branches.list("p")).toEqualTypeOf();
|
|
26
|
+
(0, import_dist.expectTypeOf)(neon.branches.get("p", "br")).resolves.toEqualTypeOf();
|
|
27
|
+
(0, import_dist.expectTypeOf)(neon.branches.createWithCompute("p", { name: "x" })).resolves.toEqualTypeOf();
|
|
28
|
+
(0, import_dist.expectTypeOf)(neon.projects.createAndConnect({ name: "x" })).resolves.toEqualTypeOf();
|
|
29
|
+
const throwing = createNeonClient({
|
|
30
|
+
apiKey: "x",
|
|
31
|
+
throwOnError: true
|
|
32
|
+
});
|
|
33
|
+
(0, import_dist.expectTypeOf)(throwing.branches.createWithCompute("p", { name: "x" })).resolves.toEqualTypeOf();
|
|
34
|
+
(0, import_dist.expectTypeOf)(throwing.branches.delete("p", "br")).resolves.toEqualTypeOf();
|
|
35
|
+
});
|
|
36
|
+
it("postgres namespace + tier-2/3 resources are reachable and typed", () => {
|
|
37
|
+
const neon = createNeonClient({ apiKey: "x" });
|
|
38
|
+
(0, import_dist.expectTypeOf)(neon.postgres.endpoints.list("p")).resolves.toEqualTypeOf();
|
|
39
|
+
(0, import_dist.expectTypeOf)(neon.postgres.roles.password("p", "br", "neondb_owner")).resolves.toEqualTypeOf();
|
|
40
|
+
(0, import_dist.expectTypeOf)(neon.postgres.connectionString({ projectId: "p" })).resolves.toEqualTypeOf();
|
|
41
|
+
(0, import_dist.expectTypeOf)(neon.snapshots.list("p")).resolves.toEqualTypeOf();
|
|
42
|
+
const throwing = createNeonClient({
|
|
43
|
+
apiKey: "x",
|
|
44
|
+
throwOnError: true
|
|
45
|
+
});
|
|
46
|
+
(0, import_dist.expectTypeOf)(throwing.postgres.connectionString({ projectId: "p" })).resolves.toEqualTypeOf();
|
|
47
|
+
(0, import_dist.expectTypeOf)(throwing.postgres.dataApi.delete("p", "br", "neondb")).resolves.toEqualTypeOf();
|
|
48
|
+
});
|
|
49
|
+
it("agent-platform helpers (default org, default branch, transfer, finalize) are typed", () => {
|
|
50
|
+
const neon = createNeonClient({
|
|
51
|
+
apiKey: "x",
|
|
52
|
+
orgId: "org-123"
|
|
53
|
+
});
|
|
54
|
+
(0, import_dist.expectTypeOf)(neon.branches.getDefault("p")).resolves.toEqualTypeOf();
|
|
55
|
+
(0, import_dist.expectTypeOf)(neon.branches.setDefault("p", "br")).resolves.toEqualTypeOf();
|
|
56
|
+
(0, import_dist.expectTypeOf)(neon.branches.finalizeRestore("p", "br")).resolves.toEqualTypeOf();
|
|
57
|
+
(0, import_dist.expectTypeOf)(neon.projects.transfer({
|
|
58
|
+
toOrgId: "org-paid",
|
|
59
|
+
projectIds: ["p"]
|
|
60
|
+
})).resolves.toEqualTypeOf();
|
|
61
|
+
(0, import_dist.expectTypeOf)(neon.snapshots.create("p", "br", {
|
|
62
|
+
name: "baseline",
|
|
63
|
+
timestamp: "2026-01-01T00:00:00Z"
|
|
64
|
+
})).resolves.toEqualTypeOf();
|
|
65
|
+
(0, import_dist.expectTypeOf)(neon.snapshots.restore("p", "snap", {
|
|
66
|
+
targetBranchId: "br",
|
|
67
|
+
preview: (restored) => {
|
|
68
|
+
(0, import_dist.expectTypeOf)(restored).toEqualTypeOf();
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
})).resolves.toEqualTypeOf();
|
|
72
|
+
});
|
|
73
|
+
it("phase-1 namespaces (auth, permissions, recover, branch endpoints) are typed", () => {
|
|
74
|
+
const neon = createNeonClient({ apiKey: "x" });
|
|
75
|
+
(0, import_dist.expectTypeOf)(neon.auth.get("p", "br")).resolves.toEqualTypeOf();
|
|
76
|
+
(0, import_dist.expectTypeOf)(neon.auth.oauthProviders.list("p", "br")).resolves.toEqualTypeOf();
|
|
77
|
+
(0, import_dist.expectTypeOf)(neon.auth.oauthProviders.add("p", "br", { id: "google" })).resolves.toEqualTypeOf();
|
|
78
|
+
(0, import_dist.expectTypeOf)(neon.projects.permissions.list("p")).resolves.toEqualTypeOf();
|
|
79
|
+
(0, import_dist.expectTypeOf)(neon.projects.permissions.grant("p", "user@example.com")).resolves.toEqualTypeOf();
|
|
80
|
+
(0, import_dist.expectTypeOf)(neon.projects.recover("p")).resolves.toEqualTypeOf();
|
|
81
|
+
(0, import_dist.expectTypeOf)(neon.postgres.endpoints.listByBranch("p", "br")).resolves.toEqualTypeOf();
|
|
82
|
+
const throwing = createNeonClient({
|
|
83
|
+
apiKey: "x",
|
|
84
|
+
throwOnError: true
|
|
85
|
+
});
|
|
86
|
+
(0, import_dist.expectTypeOf)(throwing.auth.get("p", "br")).resolves.toEqualTypeOf();
|
|
87
|
+
(0, import_dist.expectTypeOf)(throwing.auth.oauthProviders.delete("p", "br", "google")).resolves.toEqualTypeOf();
|
|
88
|
+
(0, import_dist.expectTypeOf)(throwing.projects.permissions.list("p")).resolves.toEqualTypeOf();
|
|
89
|
+
});
|
|
90
|
+
//#endregion
|
|
91
|
+
export {};
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=client.test-d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.test-d.js","names":[],"sources":["../../src/neon/client.test-d.ts"],"sourcesContent":["import { expectTypeOf, it } from \"vitest\";\nimport type {\n\tBranch,\n\tEndpoint,\n\tNeonAuthIntegration,\n\tNeonAuthOauthProvider,\n\tProject,\n\tProjectPermission,\n\tSnapshot,\n} from \"../client/types.gen.js\";\nimport { createNeonClient } from \"./client.js\";\nimport type { Paginated } from \"./paginate.js\";\nimport type { BranchWithCompute } from \"./resources/branches.js\";\nimport type { ProjectConnection } from \"./resources/projects.js\";\nimport type { NeonResult } from \"./result.js\";\n\nit(\"default client returns the { data, error } envelope\", () => {\n\tconst neon = createNeonClient({ apiKey: \"x\" });\n\texpectTypeOf(neon.projects.get(\"p\")).resolves.toEqualTypeOf<\n\t\tNeonResult<Project>\n\t>();\n\texpectTypeOf(neon.projects.create()).resolves.toEqualTypeOf<\n\t\tNeonResult<Project>\n\t>();\n});\n\nit(\"throwOnError on the client narrows methods to the bare resource\", () => {\n\tconst neon = createNeonClient({ apiKey: \"x\", throwOnError: true });\n\texpectTypeOf(neon.projects.get(\"p\")).resolves.toEqualTypeOf<Project>();\n});\n\nit(\"per-call throwOnError overrides the client default and narrows\", () => {\n\tconst neon = createNeonClient({ apiKey: \"x\" });\n\texpectTypeOf(\n\t\tneon.projects.get(\"p\", { throwOnError: true }),\n\t).resolves.toEqualTypeOf<Project>();\n\n\tconst throwing = createNeonClient({ apiKey: \"x\", throwOnError: true });\n\texpectTypeOf(\n\t\tthrowing.projects.get(\"p\", { throwOnError: false }),\n\t).resolves.toEqualTypeOf<NeonResult<Project>>();\n});\n\nit(\"branches + workflows carry the envelope and narrow under throwOnError\", () => {\n\tconst neon = createNeonClient({ apiKey: \"x\" });\n\texpectTypeOf(neon.branches.list(\"p\")).toEqualTypeOf<Paginated<Branch>>();\n\texpectTypeOf(neon.branches.get(\"p\", \"br\")).resolves.toEqualTypeOf<\n\t\tNeonResult<Branch>\n\t>();\n\texpectTypeOf(\n\t\tneon.branches.createWithCompute(\"p\", { name: \"x\" }),\n\t).resolves.toEqualTypeOf<NeonResult<BranchWithCompute>>();\n\texpectTypeOf(\n\t\tneon.projects.createAndConnect({ name: \"x\" }),\n\t).resolves.toEqualTypeOf<NeonResult<ProjectConnection>>();\n\n\tconst throwing = createNeonClient({ apiKey: \"x\", throwOnError: true });\n\texpectTypeOf(\n\t\tthrowing.branches.createWithCompute(\"p\", { name: \"x\" }),\n\t).resolves.toEqualTypeOf<BranchWithCompute>();\n\texpectTypeOf(\n\t\tthrowing.branches.delete(\"p\", \"br\"),\n\t).resolves.toEqualTypeOf<void>();\n});\n\nit(\"postgres namespace + tier-2/3 resources are reachable and typed\", () => {\n\tconst neon = createNeonClient({ apiKey: \"x\" });\n\texpectTypeOf(neon.postgres.endpoints.list(\"p\")).resolves.toEqualTypeOf<\n\t\tNeonResult<Endpoint[]>\n\t>();\n\texpectTypeOf(\n\t\tneon.postgres.roles.password(\"p\", \"br\", \"neondb_owner\"),\n\t).resolves.toEqualTypeOf<NeonResult<string>>();\n\texpectTypeOf(\n\t\tneon.postgres.connectionString({ projectId: \"p\" }),\n\t).resolves.toEqualTypeOf<NeonResult<string>>();\n\texpectTypeOf(neon.snapshots.list(\"p\")).resolves.toEqualTypeOf<\n\t\tNeonResult<Snapshot[]>\n\t>();\n\n\tconst throwing = createNeonClient({ apiKey: \"x\", throwOnError: true });\n\texpectTypeOf(\n\t\tthrowing.postgres.connectionString({ projectId: \"p\" }),\n\t).resolves.toEqualTypeOf<string>();\n\texpectTypeOf(\n\t\tthrowing.postgres.dataApi.delete(\"p\", \"br\", \"neondb\"),\n\t).resolves.toEqualTypeOf<void>();\n});\n\nit(\"agent-platform helpers (default org, default branch, transfer, finalize) are typed\", () => {\n\tconst neon = createNeonClient({ apiKey: \"x\", orgId: \"org-123\" });\n\texpectTypeOf(neon.branches.getDefault(\"p\")).resolves.toEqualTypeOf<\n\t\tNeonResult<Branch>\n\t>();\n\texpectTypeOf(neon.branches.setDefault(\"p\", \"br\")).resolves.toEqualTypeOf<\n\t\tNeonResult<Branch>\n\t>();\n\texpectTypeOf(\n\t\tneon.branches.finalizeRestore(\"p\", \"br\"),\n\t).resolves.toEqualTypeOf<NeonResult<void>>();\n\texpectTypeOf(\n\t\tneon.projects.transfer({ toOrgId: \"org-paid\", projectIds: [\"p\"] }),\n\t).resolves.toEqualTypeOf<NeonResult<void>>();\n\texpectTypeOf(\n\t\tneon.snapshots.create(\"p\", \"br\", {\n\t\t\tname: \"baseline\",\n\t\t\ttimestamp: \"2026-01-01T00:00:00Z\",\n\t\t}),\n\t).resolves.toEqualTypeOf<NeonResult<Snapshot>>();\n\texpectTypeOf(\n\t\tneon.snapshots.restore(\"p\", \"snap\", {\n\t\t\ttargetBranchId: \"br\",\n\t\t\tpreview: (restored) => {\n\t\t\t\texpectTypeOf(restored).toEqualTypeOf<Branch>();\n\t\t\t\treturn true;\n\t\t\t},\n\t\t}),\n\t).resolves.toEqualTypeOf<NeonResult<Branch>>();\n});\n\nit(\"phase-1 namespaces (auth, permissions, recover, branch endpoints) are typed\", () => {\n\tconst neon = createNeonClient({ apiKey: \"x\" });\n\texpectTypeOf(neon.auth.get(\"p\", \"br\")).resolves.toEqualTypeOf<\n\t\tNeonResult<NeonAuthIntegration>\n\t>();\n\texpectTypeOf(\n\t\tneon.auth.oauthProviders.list(\"p\", \"br\"),\n\t).resolves.toEqualTypeOf<NeonResult<NeonAuthOauthProvider[]>>();\n\texpectTypeOf(\n\t\tneon.auth.oauthProviders.add(\"p\", \"br\", { id: \"google\" }),\n\t).resolves.toEqualTypeOf<NeonResult<NeonAuthOauthProvider>>();\n\texpectTypeOf(neon.projects.permissions.list(\"p\")).resolves.toEqualTypeOf<\n\t\tNeonResult<ProjectPermission[]>\n\t>();\n\texpectTypeOf(\n\t\tneon.projects.permissions.grant(\"p\", \"user@example.com\"),\n\t).resolves.toEqualTypeOf<NeonResult<ProjectPermission>>();\n\texpectTypeOf(neon.projects.recover(\"p\")).resolves.toEqualTypeOf<\n\t\tNeonResult<Project>\n\t>();\n\texpectTypeOf(\n\t\tneon.postgres.endpoints.listByBranch(\"p\", \"br\"),\n\t).resolves.toEqualTypeOf<NeonResult<Endpoint[]>>();\n\n\tconst throwing = createNeonClient({ apiKey: \"x\", throwOnError: true });\n\texpectTypeOf(\n\t\tthrowing.auth.get(\"p\", \"br\"),\n\t).resolves.toEqualTypeOf<NeonAuthIntegration>();\n\texpectTypeOf(\n\t\tthrowing.auth.oauthProviders.delete(\"p\", \"br\", \"google\"),\n\t).resolves.toEqualTypeOf<void>();\n\texpectTypeOf(\n\t\tthrowing.projects.permissions.list(\"p\"),\n\t).resolves.toEqualTypeOf<ProjectPermission[]>();\n});\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage.d.ts","names":[],"sources":["../../src/neon/coverage.ts"],"mappings":";;AAiBA;
|
|
1
|
+
{"version":3,"file":"coverage.d.ts","names":[],"sources":["../../src/neon/coverage.ts"],"mappings":";;AAiBA;AAsHA;;;;;;;;;;;;;;cAtHa,SAAS;;;;;cAsHT,qBAAqB"}
|
package/dist/neon/coverage.js
CHANGED
|
@@ -23,6 +23,10 @@ const WRAPPED = /* @__PURE__ */ new Set([
|
|
|
23
23
|
"deleteProject",
|
|
24
24
|
"transferProjectsFromOrgToOrg",
|
|
25
25
|
"transferProjectsFromUserToOrg",
|
|
26
|
+
"recoverProject",
|
|
27
|
+
"listProjectPermissions",
|
|
28
|
+
"grantPermissionToProject",
|
|
29
|
+
"revokePermissionFromProject",
|
|
26
30
|
"listProjectBranches",
|
|
27
31
|
"getProjectBranch",
|
|
28
32
|
"createProjectBranch",
|
|
@@ -30,9 +34,43 @@ const WRAPPED = /* @__PURE__ */ new Set([
|
|
|
30
34
|
"deleteProjectBranch",
|
|
31
35
|
"setDefaultProjectBranch",
|
|
32
36
|
"finalizeRestoreBranch",
|
|
37
|
+
"recoverProjectBranch",
|
|
38
|
+
"getNeonAuth",
|
|
39
|
+
"createNeonAuth",
|
|
40
|
+
"disableNeonAuth",
|
|
41
|
+
"updateNeonAuthConfig",
|
|
42
|
+
"listBranchNeonAuthOauthProviders",
|
|
43
|
+
"addBranchNeonAuthOauthProvider",
|
|
44
|
+
"updateBranchNeonAuthOauthProvider",
|
|
45
|
+
"deleteBranchNeonAuthOauthProvider",
|
|
46
|
+
"listBranchNeonAuthTrustedDomains",
|
|
47
|
+
"addBranchNeonAuthTrustedDomain",
|
|
48
|
+
"deleteBranchNeonAuthTrustedDomain",
|
|
49
|
+
"createBranchNeonAuthNewUser",
|
|
50
|
+
"deleteBranchNeonAuthUser",
|
|
51
|
+
"updateNeonAuthUserRole",
|
|
52
|
+
"getProjectBranchStorage",
|
|
53
|
+
"listProjectBranchBuckets",
|
|
54
|
+
"createProjectBranchBucket",
|
|
55
|
+
"deleteProjectBranchBucket",
|
|
56
|
+
"listProjectBranchBucketObjects",
|
|
57
|
+
"getProjectBranchBucketObject",
|
|
58
|
+
"deleteProjectBranchBucketObject",
|
|
59
|
+
"deleteProjectBranchBucketObjectsByPrefix",
|
|
60
|
+
"presignProjectBranchBucketObject",
|
|
61
|
+
"getProjectBranchAiGateway",
|
|
62
|
+
"listCredentials",
|
|
63
|
+
"createCredential",
|
|
64
|
+
"revokeCredential",
|
|
65
|
+
"listProjectBranchFunctions",
|
|
66
|
+
"getProjectBranchFunction",
|
|
67
|
+
"updateProjectBranchFunction",
|
|
68
|
+
"deleteProjectBranchFunction",
|
|
69
|
+
"createProjectBranchFunctionDeployment",
|
|
33
70
|
"getProjectOperation",
|
|
34
71
|
"listProjectOperations",
|
|
35
72
|
"listProjectEndpoints",
|
|
73
|
+
"listProjectBranchEndpoints",
|
|
36
74
|
"getProjectEndpoint",
|
|
37
75
|
"createProjectEndpoint",
|
|
38
76
|
"updateProjectEndpoint",
|
|
@@ -89,6 +127,7 @@ const EXPECTED_OPERATIONS = /* @__PURE__ */ new Set([
|
|
|
89
127
|
"countProjectBranches",
|
|
90
128
|
"createApiKey",
|
|
91
129
|
"createBranchNeonAuthNewUser",
|
|
130
|
+
"createCredential",
|
|
92
131
|
"createNeonAuth",
|
|
93
132
|
"createNeonAuthIntegration",
|
|
94
133
|
"createNeonAuthNewUser",
|
|
@@ -97,9 +136,11 @@ const EXPECTED_OPERATIONS = /* @__PURE__ */ new Set([
|
|
|
97
136
|
"createOrganizationInvitations",
|
|
98
137
|
"createProject",
|
|
99
138
|
"createProjectBranch",
|
|
139
|
+
"createProjectBranchBucket",
|
|
100
140
|
"createProjectBranchAnonymized",
|
|
101
141
|
"createProjectBranchDataApi",
|
|
102
142
|
"createProjectBranchDatabase",
|
|
143
|
+
"createProjectBranchFunctionDeployment",
|
|
103
144
|
"createProjectBranchRole",
|
|
104
145
|
"createProjectEndpoint",
|
|
105
146
|
"createProjectTransferRequest",
|
|
@@ -115,8 +156,12 @@ const EXPECTED_OPERATIONS = /* @__PURE__ */ new Set([
|
|
|
115
156
|
"deleteOrganizationVpcEndpoint",
|
|
116
157
|
"deleteProject",
|
|
117
158
|
"deleteProjectBranch",
|
|
159
|
+
"deleteProjectBranchBucket",
|
|
160
|
+
"deleteProjectBranchBucketObject",
|
|
161
|
+
"deleteProjectBranchBucketObjectsByPrefix",
|
|
118
162
|
"deleteProjectBranchDataApi",
|
|
119
163
|
"deleteProjectBranchDatabase",
|
|
164
|
+
"deleteProjectBranchFunction",
|
|
120
165
|
"deleteProjectBranchRole",
|
|
121
166
|
"deleteProjectEndpoint",
|
|
122
167
|
"deleteProjectJwks",
|
|
@@ -152,12 +197,16 @@ const EXPECTED_OPERATIONS = /* @__PURE__ */ new Set([
|
|
|
152
197
|
"getProject",
|
|
153
198
|
"getProjectAdvisorSecurityIssues",
|
|
154
199
|
"getProjectBranch",
|
|
200
|
+
"getProjectBranchAiGateway",
|
|
201
|
+
"getProjectBranchBucketObject",
|
|
155
202
|
"getProjectBranchDataApi",
|
|
156
203
|
"getProjectBranchDatabase",
|
|
204
|
+
"getProjectBranchFunction",
|
|
157
205
|
"getProjectBranchRole",
|
|
158
206
|
"getProjectBranchRolePassword",
|
|
159
207
|
"getProjectBranchSchema",
|
|
160
208
|
"getProjectBranchSchemaComparison",
|
|
209
|
+
"getProjectBranchStorage",
|
|
161
210
|
"getProjectEndpoint",
|
|
162
211
|
"getProjectJwks",
|
|
163
212
|
"getProjectOperation",
|
|
@@ -166,6 +215,7 @@ const EXPECTED_OPERATIONS = /* @__PURE__ */ new Set([
|
|
|
166
215
|
"listApiKeys",
|
|
167
216
|
"listBranchNeonAuthOauthProviders",
|
|
168
217
|
"listBranchNeonAuthTrustedDomains",
|
|
218
|
+
"listCredentials",
|
|
169
219
|
"listNeonAuthIntegrations",
|
|
170
220
|
"listNeonAuthOauthProviders",
|
|
171
221
|
"listNeonAuthRedirectUriWhitelistDomains",
|
|
@@ -173,8 +223,11 @@ const EXPECTED_OPERATIONS = /* @__PURE__ */ new Set([
|
|
|
173
223
|
"listOrganizationVpcEndpoints",
|
|
174
224
|
"listOrganizationVpcEndpointsAllRegions",
|
|
175
225
|
"listProjectBranchDatabases",
|
|
226
|
+
"listProjectBranchBucketObjects",
|
|
227
|
+
"listProjectBranchBuckets",
|
|
176
228
|
"listProjectBranchEndpoints",
|
|
177
229
|
"listProjectBranchRoles",
|
|
230
|
+
"listProjectBranchFunctions",
|
|
178
231
|
"listProjectBranches",
|
|
179
232
|
"listProjectEndpoints",
|
|
180
233
|
"listProjectOperations",
|
|
@@ -183,13 +236,16 @@ const EXPECTED_OPERATIONS = /* @__PURE__ */ new Set([
|
|
|
183
236
|
"listProjects",
|
|
184
237
|
"listSharedProjects",
|
|
185
238
|
"listSnapshots",
|
|
239
|
+
"presignProjectBranchBucketObject",
|
|
186
240
|
"recoverProject",
|
|
241
|
+
"recoverProjectBranch",
|
|
187
242
|
"removeOrganizationMember",
|
|
188
243
|
"resetProjectBranchRolePassword",
|
|
189
244
|
"restartProjectEndpoint",
|
|
190
245
|
"restoreProjectBranch",
|
|
191
246
|
"restoreSnapshot",
|
|
192
247
|
"revokeApiKey",
|
|
248
|
+
"revokeCredential",
|
|
193
249
|
"revokeOrgApiKey",
|
|
194
250
|
"revokePermissionFromProject",
|
|
195
251
|
"sendNeonAuthTestEmail",
|
|
@@ -220,6 +276,7 @@ const EXPECTED_OPERATIONS = /* @__PURE__ */ new Set([
|
|
|
220
276
|
"updateProjectBranch",
|
|
221
277
|
"updateProjectBranchDataApi",
|
|
222
278
|
"updateProjectBranchDatabase",
|
|
279
|
+
"updateProjectBranchFunction",
|
|
223
280
|
"updateProjectEndpoint",
|
|
224
281
|
"updateSnapshot"
|
|
225
282
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coverage.js","names":[],"sources":["../../src/neon/coverage.ts"],"sourcesContent":["/**\n * Drift guard for the ergonomic layer.\n *\n * The raw layer is regenerated from the OpenAPI spec, so it auto-tracks new endpoints.\n * The ergonomic resource namespaces are hand-authored, so they can silently fall behind.\n * `coverage.test.ts` compares the generated operation set against {@link EXPECTED_OPERATIONS}\n * and fails CI when they differ — forcing a conscious decision on every spec change:\n * either wrap the new operation in a resource (and add it to {@link WRAPPED}) or accept\n * that it stays raw-only (and add it to the snapshot below).\n *\n * Workflow when the test fails after a `pnpm generate`:\n * 1. Review the `added` / `removed` operations the test reports.\n * 2. Wrap the ones worth ergonomic treatment (and list them in {@link WRAPPED}).\n * 3. Update {@link EXPECTED_OPERATIONS} to match the new generated set.\n */\n\n/** Operations surfaced by the ergonomic `createNeonClient` namespaces. */\nexport const WRAPPED: ReadonlySet<string> = new Set([\n\t// projects\n\t\"listProjects\",\n\t\"getProject\",\n\t\"createProject\",\n\t\"updateProject\",\n\t\"deleteProject\",\n\t// projects: transfer\n\t\"transferProjectsFromOrgToOrg\",\n\t\"transferProjectsFromUserToOrg\",\n\t// branches\n\t\"listProjectBranches\",\n\t\"getProjectBranch\",\n\t\"createProjectBranch\",\n\t\"updateProjectBranch\",\n\t\"deleteProjectBranch\",\n\t\"setDefaultProjectBranch\",\n\t\"finalizeRestoreBranch\",\n\t// operations\n\t\"getProjectOperation\",\n\t\"listProjectOperations\",\n\t// postgres: endpoints\n\t\"listProjectEndpoints\",\n\t\"getProjectEndpoint\",\n\t\"createProjectEndpoint\",\n\t\"updateProjectEndpoint\",\n\t\"deleteProjectEndpoint\",\n\t\"startProjectEndpoint\",\n\t\"suspendProjectEndpoint\",\n\t\"restartProjectEndpoint\",\n\t// postgres: databases\n\t\"listProjectBranchDatabases\",\n\t\"getProjectBranchDatabase\",\n\t\"createProjectBranchDatabase\",\n\t\"updateProjectBranchDatabase\",\n\t\"deleteProjectBranchDatabase\",\n\t// postgres: roles\n\t\"listProjectBranchRoles\",\n\t\"getProjectBranchRole\",\n\t\"createProjectBranchRole\",\n\t\"deleteProjectBranchRole\",\n\t\"getProjectBranchRolePassword\",\n\t\"resetProjectBranchRolePassword\",\n\t// postgres: connection string + data api\n\t\"getConnectionUri\",\n\t\"getProjectBranchDataApi\",\n\t\"createProjectBranchDataApi\",\n\t\"updateProjectBranchDataApi\",\n\t\"deleteProjectBranchDataApi\",\n\t// snapshots\n\t\"listSnapshots\",\n\t\"createSnapshot\",\n\t\"updateSnapshot\",\n\t\"deleteSnapshot\",\n\t\"restoreSnapshot\",\n\t\"getSnapshotSchedule\",\n\t\"setSnapshotSchedule\",\n\t// consumption\n\t\"getConsumptionHistoryPerProject\",\n\t\"getConsumptionHistoryPerProjectV2\",\n\t\"getConsumptionHistoryPerBranchV2\",\n\t// account\n\t\"getCurrentUserInfo\",\n\t\"getCurrentUserOrganizations\",\n\t\"getActiveRegions\",\n\t\"listApiKeys\",\n\t\"createApiKey\",\n\t\"revokeApiKey\",\n]);\n\n/**\n * Committed snapshot of every operation the generated client exposes. Update this\n * deliberately whenever the spec (and thus the generated client) changes.\n */\nexport const EXPECTED_OPERATIONS: ReadonlySet<string> = new Set([\n\t\"acceptProjectTransferRequest\",\n\t\"addBranchNeonAuthOauthProvider\",\n\t\"addBranchNeonAuthTrustedDomain\",\n\t\"addNeonAuthDomainToRedirectUriWhitelist\",\n\t\"addNeonAuthOauthProvider\",\n\t\"addProjectJwks\",\n\t\"assignOrganizationVpcEndpoint\",\n\t\"assignProjectVpcEndpoint\",\n\t\"countProjectBranches\",\n\t\"createApiKey\",\n\t\"createBranchNeonAuthNewUser\",\n\t\"createNeonAuth\",\n\t\"createNeonAuthIntegration\",\n\t\"createNeonAuthNewUser\",\n\t\"createNeonAuthProviderSdkKeys\",\n\t\"createOrgApiKey\",\n\t\"createOrganizationInvitations\",\n\t\"createProject\",\n\t\"createProjectBranch\",\n\t\"createProjectBranchAnonymized\",\n\t\"createProjectBranchDataApi\",\n\t\"createProjectBranchDatabase\",\n\t\"createProjectBranchRole\",\n\t\"createProjectEndpoint\",\n\t\"createProjectTransferRequest\",\n\t\"createSnapshot\",\n\t\"deleteBranchNeonAuthOauthProvider\",\n\t\"deleteBranchNeonAuthTrustedDomain\",\n\t\"deleteBranchNeonAuthUser\",\n\t\"deleteNeonAuthDomainFromRedirectUriWhitelist\",\n\t\"deleteNeonAuthIntegration\",\n\t\"deleteNeonAuthOauthProvider\",\n\t\"deleteNeonAuthUser\",\n\t\"deleteOrganizationSpendingLimit\",\n\t\"deleteOrganizationVpcEndpoint\",\n\t\"deleteProject\",\n\t\"deleteProjectBranch\",\n\t\"deleteProjectBranchDataApi\",\n\t\"deleteProjectBranchDatabase\",\n\t\"deleteProjectBranchRole\",\n\t\"deleteProjectEndpoint\",\n\t\"deleteProjectJwks\",\n\t\"deleteProjectVpcEndpoint\",\n\t\"deleteSnapshot\",\n\t\"disableNeonAuth\",\n\t\"finalizeRestoreBranch\",\n\t\"getActiveRegions\",\n\t\"getAnonymizedBranchStatus\",\n\t\"getAuthDetails\",\n\t\"getAvailablePreloadLibraries\",\n\t\"getConnectionUri\",\n\t\"getConsumptionHistoryPerBranchV2\",\n\t\"getConsumptionHistoryPerProject\",\n\t\"getConsumptionHistoryPerProjectV2\",\n\t\"getCurrentUserInfo\",\n\t\"getCurrentUserOrganizations\",\n\t\"getMaskingRules\",\n\t\"getNeonAuth\",\n\t\"getNeonAuthAllowLocalhost\",\n\t\"getNeonAuthEmailAndPasswordConfig\",\n\t\"getNeonAuthEmailProvider\",\n\t\"getNeonAuthEmailServer\",\n\t\"getNeonAuthPhoneNumberPlugin\",\n\t\"getNeonAuthPluginConfigs\",\n\t\"getNeonAuthWebhookConfig\",\n\t\"getOrganization\",\n\t\"getOrganizationInvitations\",\n\t\"getOrganizationMember\",\n\t\"getOrganizationMembers\",\n\t\"getOrganizationSpendingLimit\",\n\t\"getOrganizationVpcEndpointDetails\",\n\t\"getProject\",\n\t\"getProjectAdvisorSecurityIssues\",\n\t\"getProjectBranch\",\n\t\"getProjectBranchDataApi\",\n\t\"getProjectBranchDatabase\",\n\t\"getProjectBranchRole\",\n\t\"getProjectBranchRolePassword\",\n\t\"getProjectBranchSchema\",\n\t\"getProjectBranchSchemaComparison\",\n\t\"getProjectEndpoint\",\n\t\"getProjectJwks\",\n\t\"getProjectOperation\",\n\t\"getSnapshotSchedule\",\n\t\"grantPermissionToProject\",\n\t\"listApiKeys\",\n\t\"listBranchNeonAuthOauthProviders\",\n\t\"listBranchNeonAuthTrustedDomains\",\n\t\"listNeonAuthIntegrations\",\n\t\"listNeonAuthOauthProviders\",\n\t\"listNeonAuthRedirectUriWhitelistDomains\",\n\t\"listOrgApiKeys\",\n\t\"listOrganizationVpcEndpoints\",\n\t\"listOrganizationVpcEndpointsAllRegions\",\n\t\"listProjectBranchDatabases\",\n\t\"listProjectBranchEndpoints\",\n\t\"listProjectBranchRoles\",\n\t\"listProjectBranches\",\n\t\"listProjectEndpoints\",\n\t\"listProjectOperations\",\n\t\"listProjectPermissions\",\n\t\"listProjectVpcEndpoints\",\n\t\"listProjects\",\n\t\"listSharedProjects\",\n\t\"listSnapshots\",\n\t\"recoverProject\",\n\t\"removeOrganizationMember\",\n\t\"resetProjectBranchRolePassword\",\n\t\"restartProjectEndpoint\",\n\t\"restoreProjectBranch\",\n\t\"restoreSnapshot\",\n\t\"revokeApiKey\",\n\t\"revokeOrgApiKey\",\n\t\"revokePermissionFromProject\",\n\t\"sendNeonAuthTestEmail\",\n\t\"setDefaultProjectBranch\",\n\t\"setOrganizationSpendingLimit\",\n\t\"setSnapshotSchedule\",\n\t\"startAnonymization\",\n\t\"startProjectEndpoint\",\n\t\"suspendProjectEndpoint\",\n\t\"transferNeonAuthProviderProject\",\n\t\"transferProjectsFromOrgToOrg\",\n\t\"transferProjectsFromUserToOrg\",\n\t\"updateBranchNeonAuthOauthProvider\",\n\t\"updateMaskingRules\",\n\t\"updateNeonAuthAllowLocalhost\",\n\t\"updateNeonAuthConfig\",\n\t\"updateNeonAuthEmailAndPasswordConfig\",\n\t\"updateNeonAuthEmailProvider\",\n\t\"updateNeonAuthEmailServer\",\n\t\"updateNeonAuthMagicLinkPlugin\",\n\t\"updateNeonAuthOauthProvider\",\n\t\"updateNeonAuthOrganizationPlugin\",\n\t\"updateNeonAuthPhoneNumberPlugin\",\n\t\"updateNeonAuthUserRole\",\n\t\"updateNeonAuthWebhookConfig\",\n\t\"updateOrganizationMember\",\n\t\"updateProject\",\n\t\"updateProjectBranch\",\n\t\"updateProjectBranchDataApi\",\n\t\"updateProjectBranchDatabase\",\n\t\"updateProjectEndpoint\",\n\t\"updateSnapshot\",\n]);\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAa,0BAA+B,IAAI,IAAI;CAEnD;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;AAMD,MAAa,sCAA2C,IAAI,IAAI;CAC/D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"coverage.js","names":[],"sources":["../../src/neon/coverage.ts"],"sourcesContent":["/**\n * Drift guard for the ergonomic layer.\n *\n * The raw layer is regenerated from the OpenAPI spec, so it auto-tracks new endpoints.\n * The ergonomic resource namespaces are hand-authored, so they can silently fall behind.\n * `coverage.test.ts` compares the generated operation set against {@link EXPECTED_OPERATIONS}\n * and fails CI when they differ — forcing a conscious decision on every spec change:\n * either wrap the new operation in a resource (and add it to {@link WRAPPED}) or accept\n * that it stays raw-only (and add it to the snapshot below).\n *\n * Workflow when the test fails after a `pnpm generate`:\n * 1. Review the `added` / `removed` operations the test reports.\n * 2. Wrap the ones worth ergonomic treatment (and list them in {@link WRAPPED}).\n * 3. Update {@link EXPECTED_OPERATIONS} to match the new generated set.\n */\n\n/** Operations surfaced by the ergonomic `createNeonClient` namespaces. */\nexport const WRAPPED: ReadonlySet<string> = new Set([\n\t// projects\n\t\"listProjects\",\n\t\"getProject\",\n\t\"createProject\",\n\t\"updateProject\",\n\t\"deleteProject\",\n\t// projects: transfer\n\t\"transferProjectsFromOrgToOrg\",\n\t\"transferProjectsFromUserToOrg\",\n\t// projects: recover + permissions\n\t\"recoverProject\",\n\t\"listProjectPermissions\",\n\t\"grantPermissionToProject\",\n\t\"revokePermissionFromProject\",\n\t// branches\n\t\"listProjectBranches\",\n\t\"getProjectBranch\",\n\t\"createProjectBranch\",\n\t\"updateProjectBranch\",\n\t\"deleteProjectBranch\",\n\t\"setDefaultProjectBranch\",\n\t\"finalizeRestoreBranch\",\n\t\"recoverProjectBranch\",\n\t// neon auth (branch-scoped)\n\t\"getNeonAuth\",\n\t\"createNeonAuth\",\n\t\"disableNeonAuth\",\n\t\"updateNeonAuthConfig\",\n\t\"listBranchNeonAuthOauthProviders\",\n\t\"addBranchNeonAuthOauthProvider\",\n\t\"updateBranchNeonAuthOauthProvider\",\n\t\"deleteBranchNeonAuthOauthProvider\",\n\t\"listBranchNeonAuthTrustedDomains\",\n\t\"addBranchNeonAuthTrustedDomain\",\n\t\"deleteBranchNeonAuthTrustedDomain\",\n\t\"createBranchNeonAuthNewUser\",\n\t\"deleteBranchNeonAuthUser\",\n\t\"updateNeonAuthUserRole\",\n\t// storage\n\t\"getProjectBranchStorage\",\n\t\"listProjectBranchBuckets\",\n\t\"createProjectBranchBucket\",\n\t\"deleteProjectBranchBucket\",\n\t\"listProjectBranchBucketObjects\",\n\t\"getProjectBranchBucketObject\",\n\t\"deleteProjectBranchBucketObject\",\n\t\"deleteProjectBranchBucketObjectsByPrefix\",\n\t\"presignProjectBranchBucketObject\",\n\t// ai gateway\n\t\"getProjectBranchAiGateway\",\n\t// credentials\n\t\"listCredentials\",\n\t\"createCredential\",\n\t\"revokeCredential\",\n\t// functions\n\t\"listProjectBranchFunctions\",\n\t\"getProjectBranchFunction\",\n\t\"updateProjectBranchFunction\",\n\t\"deleteProjectBranchFunction\",\n\t\"createProjectBranchFunctionDeployment\",\n\t// operations\n\t\"getProjectOperation\",\n\t\"listProjectOperations\",\n\t// postgres: endpoints\n\t\"listProjectEndpoints\",\n\t\"listProjectBranchEndpoints\",\n\t\"getProjectEndpoint\",\n\t\"createProjectEndpoint\",\n\t\"updateProjectEndpoint\",\n\t\"deleteProjectEndpoint\",\n\t\"startProjectEndpoint\",\n\t\"suspendProjectEndpoint\",\n\t\"restartProjectEndpoint\",\n\t// postgres: databases\n\t\"listProjectBranchDatabases\",\n\t\"getProjectBranchDatabase\",\n\t\"createProjectBranchDatabase\",\n\t\"updateProjectBranchDatabase\",\n\t\"deleteProjectBranchDatabase\",\n\t// postgres: roles\n\t\"listProjectBranchRoles\",\n\t\"getProjectBranchRole\",\n\t\"createProjectBranchRole\",\n\t\"deleteProjectBranchRole\",\n\t\"getProjectBranchRolePassword\",\n\t\"resetProjectBranchRolePassword\",\n\t// postgres: connection string + data api\n\t\"getConnectionUri\",\n\t\"getProjectBranchDataApi\",\n\t\"createProjectBranchDataApi\",\n\t\"updateProjectBranchDataApi\",\n\t\"deleteProjectBranchDataApi\",\n\t// snapshots\n\t\"listSnapshots\",\n\t\"createSnapshot\",\n\t\"updateSnapshot\",\n\t\"deleteSnapshot\",\n\t\"restoreSnapshot\",\n\t\"getSnapshotSchedule\",\n\t\"setSnapshotSchedule\",\n\t// consumption\n\t\"getConsumptionHistoryPerProject\",\n\t\"getConsumptionHistoryPerProjectV2\",\n\t\"getConsumptionHistoryPerBranchV2\",\n\t// account\n\t\"getCurrentUserInfo\",\n\t\"getCurrentUserOrganizations\",\n\t\"getActiveRegions\",\n\t\"listApiKeys\",\n\t\"createApiKey\",\n\t\"revokeApiKey\",\n]);\n\n/**\n * Committed snapshot of every operation the generated client exposes. Update this\n * deliberately whenever the spec (and thus the generated client) changes.\n */\nexport const EXPECTED_OPERATIONS: ReadonlySet<string> = new Set([\n\t\"acceptProjectTransferRequest\",\n\t\"addBranchNeonAuthOauthProvider\",\n\t\"addBranchNeonAuthTrustedDomain\",\n\t\"addNeonAuthDomainToRedirectUriWhitelist\",\n\t\"addNeonAuthOauthProvider\",\n\t\"addProjectJwks\",\n\t\"assignOrganizationVpcEndpoint\",\n\t\"assignProjectVpcEndpoint\",\n\t\"countProjectBranches\",\n\t\"createApiKey\",\n\t\"createBranchNeonAuthNewUser\",\n\t\"createCredential\",\n\t\"createNeonAuth\",\n\t\"createNeonAuthIntegration\",\n\t\"createNeonAuthNewUser\",\n\t\"createNeonAuthProviderSdkKeys\",\n\t\"createOrgApiKey\",\n\t\"createOrganizationInvitations\",\n\t\"createProject\",\n\t\"createProjectBranch\",\n\t\"createProjectBranchBucket\",\n\t\"createProjectBranchAnonymized\",\n\t\"createProjectBranchDataApi\",\n\t\"createProjectBranchDatabase\",\n\t\"createProjectBranchFunctionDeployment\",\n\t\"createProjectBranchRole\",\n\t\"createProjectEndpoint\",\n\t\"createProjectTransferRequest\",\n\t\"createSnapshot\",\n\t\"deleteBranchNeonAuthOauthProvider\",\n\t\"deleteBranchNeonAuthTrustedDomain\",\n\t\"deleteBranchNeonAuthUser\",\n\t\"deleteNeonAuthDomainFromRedirectUriWhitelist\",\n\t\"deleteNeonAuthIntegration\",\n\t\"deleteNeonAuthOauthProvider\",\n\t\"deleteNeonAuthUser\",\n\t\"deleteOrganizationSpendingLimit\",\n\t\"deleteOrganizationVpcEndpoint\",\n\t\"deleteProject\",\n\t\"deleteProjectBranch\",\n\t\"deleteProjectBranchBucket\",\n\t\"deleteProjectBranchBucketObject\",\n\t\"deleteProjectBranchBucketObjectsByPrefix\",\n\t\"deleteProjectBranchDataApi\",\n\t\"deleteProjectBranchDatabase\",\n\t\"deleteProjectBranchFunction\",\n\t\"deleteProjectBranchRole\",\n\t\"deleteProjectEndpoint\",\n\t\"deleteProjectJwks\",\n\t\"deleteProjectVpcEndpoint\",\n\t\"deleteSnapshot\",\n\t\"disableNeonAuth\",\n\t\"finalizeRestoreBranch\",\n\t\"getActiveRegions\",\n\t\"getAnonymizedBranchStatus\",\n\t\"getAuthDetails\",\n\t\"getAvailablePreloadLibraries\",\n\t\"getConnectionUri\",\n\t\"getConsumptionHistoryPerBranchV2\",\n\t\"getConsumptionHistoryPerProject\",\n\t\"getConsumptionHistoryPerProjectV2\",\n\t\"getCurrentUserInfo\",\n\t\"getCurrentUserOrganizations\",\n\t\"getMaskingRules\",\n\t\"getNeonAuth\",\n\t\"getNeonAuthAllowLocalhost\",\n\t\"getNeonAuthEmailAndPasswordConfig\",\n\t\"getNeonAuthEmailProvider\",\n\t\"getNeonAuthEmailServer\",\n\t\"getNeonAuthPhoneNumberPlugin\",\n\t\"getNeonAuthPluginConfigs\",\n\t\"getNeonAuthWebhookConfig\",\n\t\"getOrganization\",\n\t\"getOrganizationInvitations\",\n\t\"getOrganizationMember\",\n\t\"getOrganizationMembers\",\n\t\"getOrganizationSpendingLimit\",\n\t\"getOrganizationVpcEndpointDetails\",\n\t\"getProject\",\n\t\"getProjectAdvisorSecurityIssues\",\n\t\"getProjectBranch\",\n\t\"getProjectBranchAiGateway\",\n\t\"getProjectBranchBucketObject\",\n\t\"getProjectBranchDataApi\",\n\t\"getProjectBranchDatabase\",\n\t\"getProjectBranchFunction\",\n\t\"getProjectBranchRole\",\n\t\"getProjectBranchRolePassword\",\n\t\"getProjectBranchSchema\",\n\t\"getProjectBranchSchemaComparison\",\n\t\"getProjectBranchStorage\",\n\t\"getProjectEndpoint\",\n\t\"getProjectJwks\",\n\t\"getProjectOperation\",\n\t\"getSnapshotSchedule\",\n\t\"grantPermissionToProject\",\n\t\"listApiKeys\",\n\t\"listBranchNeonAuthOauthProviders\",\n\t\"listBranchNeonAuthTrustedDomains\",\n\t\"listCredentials\",\n\t\"listNeonAuthIntegrations\",\n\t\"listNeonAuthOauthProviders\",\n\t\"listNeonAuthRedirectUriWhitelistDomains\",\n\t\"listOrgApiKeys\",\n\t\"listOrganizationVpcEndpoints\",\n\t\"listOrganizationVpcEndpointsAllRegions\",\n\t\"listProjectBranchDatabases\",\n\t\"listProjectBranchBucketObjects\",\n\t\"listProjectBranchBuckets\",\n\t\"listProjectBranchEndpoints\",\n\t\"listProjectBranchRoles\",\n\t\"listProjectBranchFunctions\",\n\t\"listProjectBranches\",\n\t\"listProjectEndpoints\",\n\t\"listProjectOperations\",\n\t\"listProjectPermissions\",\n\t\"listProjectVpcEndpoints\",\n\t\"listProjects\",\n\t\"listSharedProjects\",\n\t\"listSnapshots\",\n\t\"presignProjectBranchBucketObject\",\n\t\"recoverProject\",\n\t\"recoverProjectBranch\",\n\t\"removeOrganizationMember\",\n\t\"resetProjectBranchRolePassword\",\n\t\"restartProjectEndpoint\",\n\t\"restoreProjectBranch\",\n\t\"restoreSnapshot\",\n\t\"revokeApiKey\",\n\t\"revokeCredential\",\n\t\"revokeOrgApiKey\",\n\t\"revokePermissionFromProject\",\n\t\"sendNeonAuthTestEmail\",\n\t\"setDefaultProjectBranch\",\n\t\"setOrganizationSpendingLimit\",\n\t\"setSnapshotSchedule\",\n\t\"startAnonymization\",\n\t\"startProjectEndpoint\",\n\t\"suspendProjectEndpoint\",\n\t\"transferNeonAuthProviderProject\",\n\t\"transferProjectsFromOrgToOrg\",\n\t\"transferProjectsFromUserToOrg\",\n\t\"updateBranchNeonAuthOauthProvider\",\n\t\"updateMaskingRules\",\n\t\"updateNeonAuthAllowLocalhost\",\n\t\"updateNeonAuthConfig\",\n\t\"updateNeonAuthEmailAndPasswordConfig\",\n\t\"updateNeonAuthEmailProvider\",\n\t\"updateNeonAuthEmailServer\",\n\t\"updateNeonAuthMagicLinkPlugin\",\n\t\"updateNeonAuthOauthProvider\",\n\t\"updateNeonAuthOrganizationPlugin\",\n\t\"updateNeonAuthPhoneNumberPlugin\",\n\t\"updateNeonAuthUserRole\",\n\t\"updateNeonAuthWebhookConfig\",\n\t\"updateOrganizationMember\",\n\t\"updateProject\",\n\t\"updateProjectBranch\",\n\t\"updateProjectBranchDataApi\",\n\t\"updateProjectBranchDatabase\",\n\t\"updateProjectBranchFunction\",\n\t\"updateProjectEndpoint\",\n\t\"updateSnapshot\",\n]);\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,MAAa,0BAA+B,IAAI,IAAI;CAEnD;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;CACA;CAEA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;AAMD,MAAa,sCAA2C,IAAI,IAAI;CAC/D;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACD,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { NeonError } from "./errors.js";
|
|
2
|
+
|
|
3
|
+
//#region src/neon/raw-wrap.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Structural shape of any generated raw function: generic over `throwOnError`, resolving to
|
|
7
|
+
* hey-api's envelope. The `any`s live only inside this adapter type so the generated
|
|
8
|
+
* functions (each with their own precise option/response types) remain assignable; the
|
|
9
|
+
* public {@link wrapRaw} overloads recover full type safety per function.
|
|
10
|
+
*/
|
|
11
|
+
type AnyRawFn = (options: any) => Promise<any>;
|
|
12
|
+
/** Extract the success arm of a discriminated fields envelope. */
|
|
13
|
+
type SuccessArm<R> = R extends {
|
|
14
|
+
error: undefined | null;
|
|
15
|
+
} ? R : never;
|
|
16
|
+
/**
|
|
17
|
+
* The success payload of a generated raw function — derived from its default (non-throw,
|
|
18
|
+
* fields) return type, so it stays correct as the client is regenerated.
|
|
19
|
+
*/
|
|
20
|
+
type RawData<F extends AnyRawFn> = SuccessArm<Awaited<ReturnType<F>>> extends {
|
|
21
|
+
data: infer D;
|
|
22
|
+
} ? D : never;
|
|
23
|
+
/** The call options for a wrapped raw function, minus the removed hey-api switches. */
|
|
24
|
+
type RawOptions<F extends AnyRawFn> = Omit<NonNullable<Parameters<F>[0]>, "throwOnError" | "responseStyle">;
|
|
25
|
+
/**
|
|
26
|
+
* The non-throwing result of a wrapped raw call: the ergonomic `{ data, error }` union
|
|
27
|
+
* (typed {@link NeonError}), plus the underlying `response`/`request` for HTTP status and
|
|
28
|
+
* headers.
|
|
29
|
+
*/
|
|
30
|
+
type RawResult<T> = {
|
|
31
|
+
data: T;
|
|
32
|
+
error: undefined;
|
|
33
|
+
response?: Response;
|
|
34
|
+
request?: Request;
|
|
35
|
+
} | {
|
|
36
|
+
data: undefined;
|
|
37
|
+
error: NeonError;
|
|
38
|
+
response?: Response;
|
|
39
|
+
request?: Request;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Wrap a generated raw function so it speaks the ergonomic result contract.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* import { getProject } from "@neon/sdk/raw";
|
|
47
|
+
*
|
|
48
|
+
* const { data, error } = await getProject({ client, path: { project_id } });
|
|
49
|
+
* // or, throwing:
|
|
50
|
+
* const { project } = await getProject({ client, path: { project_id }, throwOnError: true });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
declare function wrapRaw<F extends AnyRawFn>(fn: F & AnyRawFn): {
|
|
54
|
+
(options: RawOptions<F> & {
|
|
55
|
+
throwOnError: true;
|
|
56
|
+
}): Promise<RawData<F>>;
|
|
57
|
+
(options: RawOptions<F> & {
|
|
58
|
+
throwOnError?: false;
|
|
59
|
+
}): Promise<RawResult<RawData<F>>>;
|
|
60
|
+
};
|
|
61
|
+
//#endregion
|
|
62
|
+
export { AnyRawFn, RawData, RawOptions, RawResult, wrapRaw };
|
|
63
|
+
//# sourceMappingURL=raw-wrap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw-wrap.d.ts","names":[],"sources":["../../src/neon/raw-wrap.ts"],"mappings":";;;;;AA8CI;AAIJ;;;;AACa,KAzBD,QAAA,GAyBC,CAAA,OAAA,EAAA,GAAA,EAAA,GAzB4B,OAyB5B,CAAA,GAAA,CAAA;;KAdR,UAawC,CAAA,CAAA,CAAA,GAbxB,CAawB,SAAA;EAAI,KAAA,EAAA,SAAA,GAAA,IAAA;AAUjD,CAAA,GAvB6D,CAuBjD,GAAA,KAAA;;;;;AAIF,KArBE,OAqBF,CAAA,UArBoB,QAqBpB,CAAA,GArBgC,UAqBhC,CApBT,OAoBS,CApBD,UAoBC,CApBU,CAoBV,CAAA,CAAA,CAAA,SAAA;MACI,EAAA,KAAA,EAAA;IAnBX,IAoBU,KAAA;AAAO;AAeJ,KA/BJ,UA+BW,CAAA,UA/BU,QA+BV,CAAA,GA/BsB,IA+BtB,CA9BtB,WA8BsB,CA9BV,UA8BU,CA9BC,CA8BD,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,cAAA,GAAA,eAAA,CAAA;;;;;;AAEZ,KAvBC,SAuBD,CAAA,CAAA,CAAA,GAAA;MACS,EAvBT,CAuBS;OAAR,EAAA,SAAA;UAAR,CAAA,EAvBuC,QAuBvC;SAEkB,CAAA,EAzByC,OAyBzC;;MACQ,EAAA,SAAA;OAAR,EAvBZ,SAuBY;UAAV,CAAA,EAtBE,QAsBF;SAAR,CAAA,EArBS,OAqBT;AAAO,CAAA;;;;;;;;;;;;;iBANK,kBAAkB,cAAc,IAAI;YAEzC,WAAW;;MAClB,QAAQ,QAAQ;YAET,WAAW;;MAClB,QAAQ,UAAU,QAAQ"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { toNeonError } from "./errors.js";
|
|
2
|
+
//#region src/neon/raw-wrap.ts
|
|
3
|
+
/**
|
|
4
|
+
* Wrap a generated raw function so it speaks the ergonomic result contract.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { getProject } from "@neon/sdk/raw";
|
|
9
|
+
*
|
|
10
|
+
* const { data, error } = await getProject({ client, path: { project_id } });
|
|
11
|
+
* // or, throwing:
|
|
12
|
+
* const { project } = await getProject({ client, path: { project_id }, throwOnError: true });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
function wrapRaw(fn) {
|
|
16
|
+
async function call(options) {
|
|
17
|
+
const shouldThrow = options.throwOnError === true;
|
|
18
|
+
const raw = await fn({
|
|
19
|
+
...options,
|
|
20
|
+
throwOnError: false,
|
|
21
|
+
responseStyle: "fields"
|
|
22
|
+
});
|
|
23
|
+
if (raw.error !== void 0 && raw.error !== null) {
|
|
24
|
+
const error = toNeonError(raw.error, raw.response);
|
|
25
|
+
if (shouldThrow) throw error;
|
|
26
|
+
return {
|
|
27
|
+
data: void 0,
|
|
28
|
+
error,
|
|
29
|
+
response: raw.response,
|
|
30
|
+
request: raw.request
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
const data = raw.data;
|
|
34
|
+
if (shouldThrow) return data;
|
|
35
|
+
return {
|
|
36
|
+
data,
|
|
37
|
+
error: void 0,
|
|
38
|
+
response: raw.response,
|
|
39
|
+
request: raw.request
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return call;
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { wrapRaw };
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=raw-wrap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"raw-wrap.js","names":[],"sources":["../../src/neon/raw-wrap.ts"],"sourcesContent":["/**\n * The raw layer's result adapter.\n *\n * The generated `client/sdk.gen.ts` functions return hey-api's `{ data, error, request,\n * response }` envelope and are driven by two orthogonal switches (`throwOnError` and\n * `responseStyle`). {@link wrapRaw} collapses that onto the ergonomic client's contract: a\n * `{ data, error }` result by default (with the typed {@link NeonError} on the error\n * channel), or the bare resource when you pass `throwOnError: true`. `responseStyle` is\n * removed from the public raw surface — `throwOnError` is the only switch and the return\n * type always tracks it.\n *\n * The one difference from the ergonomic `NeonResult` is that the raw result also exposes the\n * underlying `response`/`request`, so power users (and the neonctl CLI) can read HTTP status\n * and headers without dropping to the low-level client.\n */\n\nimport type { NeonError } from \"./errors.js\";\nimport { toNeonError } from \"./errors.js\";\n\n/**\n * Structural shape of any generated raw function: generic over `throwOnError`, resolving to\n * hey-api's envelope. The `any`s live only inside this adapter type so the generated\n * functions (each with their own precise option/response types) remain assignable; the\n * public {@link wrapRaw} overloads recover full type safety per function.\n */\n// biome-ignore lint/suspicious/noExplicitAny: adapter boundary over generated generic fns\nexport type AnyRawFn = (options: any) => Promise<any>;\n\n/** hey-api's non-throw \"fields\" envelope, parameterized by the success payload. */\ninterface RawFieldsResult<T> {\n\tdata?: T;\n\terror?: unknown;\n\tresponse?: Response;\n\trequest?: Request;\n}\n\n/** Extract the success arm of a discriminated fields envelope. */\ntype SuccessArm<R> = R extends { error: undefined | null } ? R : never;\n\n/**\n * The success payload of a generated raw function — derived from its default (non-throw,\n * fields) return type, so it stays correct as the client is regenerated.\n */\nexport type RawData<F extends AnyRawFn> = SuccessArm<\n\tAwaited<ReturnType<F>>\n> extends { data: infer D }\n\t? D\n\t: never;\n\n/** The call options for a wrapped raw function, minus the removed hey-api switches. */\nexport type RawOptions<F extends AnyRawFn> = Omit<\n\tNonNullable<Parameters<F>[0]>,\n\t\"throwOnError\" | \"responseStyle\"\n>;\n\n/**\n * The non-throwing result of a wrapped raw call: the ergonomic `{ data, error }` union\n * (typed {@link NeonError}), plus the underlying `response`/`request` for HTTP status and\n * headers.\n */\nexport type RawResult<T> =\n\t| { data: T; error: undefined; response?: Response; request?: Request }\n\t| {\n\t\t\tdata: undefined;\n\t\t\terror: NeonError;\n\t\t\tresponse?: Response;\n\t\t\trequest?: Request;\n\t };\n\n/**\n * Wrap a generated raw function so it speaks the ergonomic result contract.\n *\n * @example\n * ```ts\n * import { getProject } from \"@neon/sdk/raw\";\n *\n * const { data, error } = await getProject({ client, path: { project_id } });\n * // or, throwing:\n * const { project } = await getProject({ client, path: { project_id }, throwOnError: true });\n * ```\n */\nexport function wrapRaw<F extends AnyRawFn>(fn: F & AnyRawFn) {\n\tfunction call(\n\t\toptions: RawOptions<F> & { throwOnError: true },\n\t): Promise<RawData<F>>;\n\tfunction call(\n\t\toptions: RawOptions<F> & { throwOnError?: false },\n\t): Promise<RawResult<RawData<F>>>;\n\tasync function call(\n\t\toptions: RawOptions<F> & { throwOnError?: boolean },\n\t): Promise<RawData<F> | RawResult<RawData<F>>> {\n\t\tconst shouldThrow = options.throwOnError === true;\n\t\tconst raw: RawFieldsResult<RawData<F>> = await fn({\n\t\t\t...options,\n\t\t\tthrowOnError: false,\n\t\t\tresponseStyle: \"fields\",\n\t\t});\n\t\tif (raw.error !== undefined && raw.error !== null) {\n\t\t\tconst error = toNeonError(raw.error, raw.response);\n\t\t\tif (shouldThrow) throw error;\n\t\t\treturn {\n\t\t\t\tdata: undefined,\n\t\t\t\terror,\n\t\t\t\tresponse: raw.response,\n\t\t\t\trequest: raw.request,\n\t\t\t};\n\t\t}\n\t\t// On success the payload is present (or `void`/`undefined` for 204 endpoints); it is\n\t\t// the declared `RawData<F>` by construction of the generated response types.\n\t\tconst data = raw.data as RawData<F>;\n\t\tif (shouldThrow) return data;\n\t\treturn {\n\t\t\tdata,\n\t\t\terror: undefined,\n\t\t\tresponse: raw.response,\n\t\t\trequest: raw.request,\n\t\t};\n\t}\n\treturn call;\n}\n"],"mappings":";;;;;;;;;;;;;;AAiFA,SAAgB,QAA4B,IAAkB;CAO7D,eAAe,KACd,SAC8C;EAC9C,MAAM,cAAc,QAAQ,iBAAiB;EAC7C,MAAM,MAAmC,MAAM,GAAG;GACjD,GAAG;GACH,cAAc;GACd,eAAe;EAChB,CAAC;EACD,IAAI,IAAI,UAAU,KAAA,KAAa,IAAI,UAAU,MAAM;GAClD,MAAM,QAAQ,YAAY,IAAI,OAAO,IAAI,QAAQ;GACjD,IAAI,aAAa,MAAM;GACvB,OAAO;IACN,MAAM,KAAA;IACN;IACA,UAAU,IAAI;IACd,SAAS,IAAI;GACd;EACD;EAGA,MAAM,OAAO,IAAI;EACjB,IAAI,aAAa,OAAO;EACxB,OAAO;GACN;GACA,OAAO,KAAA;GACP,UAAU,IAAI;GACd,SAAS,IAAI;EACd;CACD;CACA,OAAO;AACR"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BranchAiGateway } from "../../client/types.gen.js";
|
|
2
|
+
import { Outcome } from "../result.js";
|
|
3
|
+
import { CallOptions, RequestContext } from "../context.js";
|
|
4
|
+
|
|
5
|
+
//#region src/neon/resources/ai-gateway.d.ts
|
|
6
|
+
/** Branch-scoped AI Gateway endpoint metadata. */
|
|
7
|
+
declare class AiGateway<DThrow extends boolean> {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(ctx: RequestContext);
|
|
10
|
+
/** @apiCall GET /projects/{project_id}/branches/{branch_id}/ai_gateway */
|
|
11
|
+
get(projectId: string, branchId: string): Promise<Outcome<BranchAiGateway, DThrow>>;
|
|
12
|
+
get<Throw extends boolean = DThrow>(projectId: string, branchId: string, opts: CallOptions<Throw>): Promise<Outcome<BranchAiGateway, Throw>>;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { AiGateway };
|
|
16
|
+
//# sourceMappingURL=ai-gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-gateway.d.ts","names":[],"sources":["../../../src/neon/resources/ai-gateway.ts"],"mappings":";;;;;;cAMa;EAAA,CAAA,OAAA;EAAS,WAAA,CAAA,GAAA,EAGJ,cAHI;;KAWF,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,CAAA,EAAhB,OAAgB,CAAR,OAAQ,CAAA,eAAA,EAAiB,MAAjB,CAAA,CAAA;KAAiB,CAAA,cAAA,OAAA,GACR,MADQ,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAI7B,WAJ6B,CAIjB,KAJiB,CAAA,CAAA,EAKjC,OALiC,CAKzB,OALyB,CAKjB,eALiB,EAKA,KALA,CAAA,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { getProjectBranchAiGateway } from "../../client/sdk.gen.js";
|
|
2
|
+
//#region src/neon/resources/ai-gateway.ts
|
|
3
|
+
/** Branch-scoped AI Gateway endpoint metadata. */
|
|
4
|
+
var AiGateway = class {
|
|
5
|
+
#ctx;
|
|
6
|
+
constructor(ctx) {
|
|
7
|
+
this.#ctx = ctx;
|
|
8
|
+
}
|
|
9
|
+
get(projectId, branchId, opts) {
|
|
10
|
+
return this.#ctx.run(opts, (client) => getProjectBranchAiGateway({
|
|
11
|
+
client,
|
|
12
|
+
path: {
|
|
13
|
+
project_id: projectId,
|
|
14
|
+
branch_id: branchId
|
|
15
|
+
},
|
|
16
|
+
throwOnError: false
|
|
17
|
+
}), (data) => data);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { AiGateway };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=ai-gateway.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ai-gateway.js","names":["#ctx"],"sources":["../../../src/neon/resources/ai-gateway.ts"],"sourcesContent":["import { getProjectBranchAiGateway } from \"../../client/sdk.gen.js\";\nimport type { BranchAiGateway } from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\n/** Branch-scoped AI Gateway endpoint metadata. */\nexport class AiGateway<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}/ai_gateway */\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<BranchAiGateway, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<BranchAiGateway, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<BranchAiGateway | NeonResult<BranchAiGateway>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProjectBranchAiGateway({\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":";;;AAMA,IAAa,YAAb,MAA+C;CAC9C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAYA,IACC,WACA,UACA,MACyD;EACzD,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,0BAA0B;GACzB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;AACD"}
|