@neon/sdk 1.4.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +257 -30
- package/dist/client/client/client.gen.js +1 -3
- package/dist/client/client/client.gen.js.map +1 -1
- package/dist/client/client/utils.gen.js +1 -3
- package/dist/client/client/utils.gen.js.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 +146 -16
- package/dist/client/raw.gen.d.ts.map +1 -1
- package/dist/client/raw.gen.js +8 -3
- package/dist/client/raw.gen.js.map +1 -1
- package/dist/client/sdk.gen.d.ts +137 -78
- package/dist/client/sdk.gen.d.ts.map +1 -1
- package/dist/client/sdk.gen.js +258 -96
- package/dist/client/sdk.gen.js.map +1 -1
- package/dist/client/types.gen.d.ts +1397 -315
- package/dist/client/types.gen.d.ts.map +1 -1
- package/dist/index.d.ts +6 -5
- package/dist/index.js +2 -2
- package/dist/neon/client.d.ts +2 -0
- package/dist/neon/client.d.ts.map +1 -1
- package/dist/neon/client.js +2 -0
- package/dist/neon/client.js.map +1 -1
- package/dist/neon/config.d.ts +13 -0
- package/dist/neon/config.d.ts.map +1 -1
- package/dist/neon/config.js +2 -0
- package/dist/neon/config.js.map +1 -1
- package/dist/neon/context.d.ts +26 -6
- package/dist/neon/context.d.ts.map +1 -1
- package/dist/neon/context.js +60 -10
- package/dist/neon/context.js.map +1 -1
- package/dist/neon/coverage.d.ts.map +1 -1
- package/dist/neon/coverage.js +12 -2
- package/dist/neon/coverage.js.map +1 -1
- package/dist/neon/deadline.d.ts +81 -0
- package/dist/neon/deadline.d.ts.map +1 -0
- package/dist/neon/deadline.js +143 -0
- package/dist/neon/deadline.js.map +1 -0
- package/dist/neon/errors.d.ts +22 -3
- package/dist/neon/errors.d.ts.map +1 -1
- package/dist/neon/errors.js +22 -2
- package/dist/neon/errors.js.map +1 -1
- package/dist/neon/paginate.d.ts +6 -1
- package/dist/neon/paginate.d.ts.map +1 -1
- package/dist/neon/paginate.js +63 -25
- package/dist/neon/paginate.js.map +1 -1
- package/dist/neon/raw-wrap.d.ts.map +1 -1
- package/dist/neon/raw-wrap.js +17 -2
- package/dist/neon/raw-wrap.js.map +1 -1
- package/dist/neon/resources/account.d.ts.map +1 -1
- package/dist/neon/resources/account.js +18 -12
- package/dist/neon/resources/account.js.map +1 -1
- package/dist/neon/resources/ai-gateway.js +3 -2
- package/dist/neon/resources/ai-gateway.js.map +1 -1
- package/dist/neon/resources/auth.d.ts.map +1 -1
- package/dist/neon/resources/auth.js +42 -28
- package/dist/neon/resources/auth.js.map +1 -1
- package/dist/neon/resources/branches.d.ts +1 -8
- package/dist/neon/resources/branches.d.ts.map +1 -1
- package/dist/neon/resources/branches.js +32 -32
- package/dist/neon/resources/branches.js.map +1 -1
- package/dist/neon/resources/bucket-objects.d.ts.map +1 -1
- package/dist/neon/resources/bucket-objects.js +15 -10
- package/dist/neon/resources/bucket-objects.js.map +1 -1
- package/dist/neon/resources/buckets.d.ts.map +1 -1
- package/dist/neon/resources/buckets.js +9 -6
- package/dist/neon/resources/buckets.js.map +1 -1
- package/dist/neon/resources/consumption.d.ts +4 -4
- package/dist/neon/resources/consumption.d.ts.map +1 -1
- package/dist/neon/resources/consumption.js +6 -6
- package/dist/neon/resources/consumption.js.map +1 -1
- package/dist/neon/resources/credentials.d.ts.map +1 -1
- package/dist/neon/resources/credentials.js +9 -6
- package/dist/neon/resources/credentials.js.map +1 -1
- package/dist/neon/resources/dataapi.d.ts.map +1 -1
- package/dist/neon/resources/dataapi.js +12 -8
- package/dist/neon/resources/dataapi.js.map +1 -1
- package/dist/neon/resources/databases.d.ts.map +1 -1
- package/dist/neon/resources/databases.js +15 -10
- package/dist/neon/resources/databases.js.map +1 -1
- package/dist/neon/resources/endpoints.d.ts.map +1 -1
- package/dist/neon/resources/endpoints.js +27 -18
- package/dist/neon/resources/endpoints.js.map +1 -1
- package/dist/neon/resources/functions.d.ts +1 -1
- package/dist/neon/resources/functions.d.ts.map +1 -1
- package/dist/neon/resources/functions.js +14 -10
- package/dist/neon/resources/functions.js.map +1 -1
- package/dist/neon/resources/logs.d.ts +76 -0
- package/dist/neon/resources/logs.d.ts.map +1 -0
- package/dist/neon/resources/logs.js +90 -0
- package/dist/neon/resources/logs.js.map +1 -0
- package/dist/neon/resources/operations.d.ts +12 -3
- package/dist/neon/resources/operations.d.ts.map +1 -1
- package/dist/neon/resources/operations.js +5 -4
- package/dist/neon/resources/operations.js.map +1 -1
- package/dist/neon/resources/postgres.d.ts.map +1 -1
- package/dist/neon/resources/postgres.js +10 -1
- package/dist/neon/resources/postgres.js.map +1 -1
- package/dist/neon/resources/projects.d.ts +62 -5
- package/dist/neon/resources/projects.d.ts.map +1 -1
- package/dist/neon/resources/projects.js +106 -29
- package/dist/neon/resources/projects.js.map +1 -1
- package/dist/neon/resources/roles.d.ts.map +1 -1
- package/dist/neon/resources/roles.js +18 -12
- package/dist/neon/resources/roles.js.map +1 -1
- package/dist/neon/resources/snapshots.d.ts +10 -1
- package/dist/neon/resources/snapshots.d.ts.map +1 -1
- package/dist/neon/resources/snapshots.js +37 -19
- package/dist/neon/resources/snapshots.js.map +1 -1
- package/dist/neon/resources/storage.js +3 -2
- package/dist/neon/resources/storage.js.map +1 -1
- package/dist/neon/retry.d.ts +30 -8
- package/dist/neon/retry.d.ts.map +1 -1
- package/dist/neon/retry.js +59 -20
- package/dist/neon/retry.js.map +1 -1
- package/dist/neon/wait.d.ts +7 -1
- package/dist/neon/wait.d.ts.map +1 -1
- package/dist/neon/wait.js +53 -34
- package/dist/neon/wait.js.map +1 -1
- package/dist/raw.d.ts +3 -3
- package/dist/raw.js +8 -3
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.d.ts","names":[],"sources":["../../../src/neon/resources/endpoints.ts"],"mappings":";;;;;KAmBK,WAAA,GAAc;KACd,WAAA,GAAc;AAHqC;AAGnD,cAGQ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,OAnJQ,CAmJA,QAnJA,EAmJU,KAnJV,CAAA,CAAA;EAAU;EAAlB,OAAA,CAAA,SAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,CAAA,EA0KR,OA1KQ,CA0KA,OA1KA,CA0KQ,QA1KR,EA0KkB,MA1KlB,CAAA,CAAA;EAAR,OAAA,CAAA,cAAA,OAAA,GA2K6B,MA3K7B,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,IAAA,EA8KI,WA9KJ,CA8KgB,KA9KhB,CAAA,CAAA,EA+KA,OA/KA,CA+KQ,OA/KR,CA+KgB,QA/KhB,EA+K0B,KA/K1B,CAAA,CAAA;AACyB"}
|
|
@@ -7,89 +7,98 @@ var Endpoints = class {
|
|
|
7
7
|
this.#ctx = ctx;
|
|
8
8
|
}
|
|
9
9
|
list(projectId, opts) {
|
|
10
|
-
return this.#ctx.run(opts, (client) => listProjectEndpoints({
|
|
10
|
+
return this.#ctx.run(opts, (client, signal) => listProjectEndpoints({
|
|
11
11
|
client,
|
|
12
12
|
path: { project_id: projectId },
|
|
13
|
-
throwOnError: false
|
|
13
|
+
throwOnError: false,
|
|
14
|
+
signal
|
|
14
15
|
}), (data) => data.endpoints);
|
|
15
16
|
}
|
|
16
17
|
listByBranch(projectId, branchId, opts) {
|
|
17
|
-
return this.#ctx.run(opts, (client) => listProjectBranchEndpoints({
|
|
18
|
+
return this.#ctx.run(opts, (client, signal) => listProjectBranchEndpoints({
|
|
18
19
|
client,
|
|
19
20
|
path: {
|
|
20
21
|
project_id: projectId,
|
|
21
22
|
branch_id: branchId
|
|
22
23
|
},
|
|
23
|
-
throwOnError: false
|
|
24
|
+
throwOnError: false,
|
|
25
|
+
signal
|
|
24
26
|
}), (data) => data.endpoints);
|
|
25
27
|
}
|
|
26
28
|
get(projectId, endpointId, opts) {
|
|
27
|
-
return this.#ctx.run(opts, (client) => getProjectEndpoint({
|
|
29
|
+
return this.#ctx.run(opts, (client, signal) => getProjectEndpoint({
|
|
28
30
|
client,
|
|
29
31
|
path: {
|
|
30
32
|
project_id: projectId,
|
|
31
33
|
endpoint_id: endpointId
|
|
32
34
|
},
|
|
33
|
-
throwOnError: false
|
|
35
|
+
throwOnError: false,
|
|
36
|
+
signal
|
|
34
37
|
}), (data) => data.endpoint);
|
|
35
38
|
}
|
|
36
39
|
create(projectId, input, opts) {
|
|
37
|
-
return this.#ctx.run(opts, (client) => createProjectEndpoint({
|
|
40
|
+
return this.#ctx.run(opts, (client, signal) => createProjectEndpoint({
|
|
38
41
|
client,
|
|
39
42
|
path: { project_id: projectId },
|
|
40
43
|
body: { endpoint: input },
|
|
41
|
-
throwOnError: false
|
|
44
|
+
throwOnError: false,
|
|
45
|
+
signal
|
|
42
46
|
}), (data) => data.endpoint);
|
|
43
47
|
}
|
|
44
48
|
update(projectId, endpointId, input, opts) {
|
|
45
|
-
return this.#ctx.run(opts, (client) => updateProjectEndpoint({
|
|
49
|
+
return this.#ctx.run(opts, (client, signal) => updateProjectEndpoint({
|
|
46
50
|
client,
|
|
47
51
|
path: {
|
|
48
52
|
project_id: projectId,
|
|
49
53
|
endpoint_id: endpointId
|
|
50
54
|
},
|
|
51
55
|
body: { endpoint: input },
|
|
52
|
-
throwOnError: false
|
|
56
|
+
throwOnError: false,
|
|
57
|
+
signal
|
|
53
58
|
}), (data) => data.endpoint);
|
|
54
59
|
}
|
|
55
60
|
delete(projectId, endpointId, opts) {
|
|
56
|
-
return this.#ctx.runVoid(opts, (client) => deleteProjectEndpoint({
|
|
61
|
+
return this.#ctx.runVoid(opts, (client, signal) => deleteProjectEndpoint({
|
|
57
62
|
client,
|
|
58
63
|
path: {
|
|
59
64
|
project_id: projectId,
|
|
60
65
|
endpoint_id: endpointId
|
|
61
66
|
},
|
|
62
|
-
throwOnError: false
|
|
67
|
+
throwOnError: false,
|
|
68
|
+
signal
|
|
63
69
|
}));
|
|
64
70
|
}
|
|
65
71
|
start(projectId, endpointId, opts) {
|
|
66
|
-
return this.#ctx.run(opts, (client) => startProjectEndpoint({
|
|
72
|
+
return this.#ctx.run(opts, (client, signal) => startProjectEndpoint({
|
|
67
73
|
client,
|
|
68
74
|
path: {
|
|
69
75
|
project_id: projectId,
|
|
70
76
|
endpoint_id: endpointId
|
|
71
77
|
},
|
|
72
|
-
throwOnError: false
|
|
78
|
+
throwOnError: false,
|
|
79
|
+
signal
|
|
73
80
|
}), (data) => data.endpoint);
|
|
74
81
|
}
|
|
75
82
|
suspend(projectId, endpointId, opts) {
|
|
76
|
-
return this.#ctx.run(opts, (client) => suspendProjectEndpoint({
|
|
83
|
+
return this.#ctx.run(opts, (client, signal) => suspendProjectEndpoint({
|
|
77
84
|
client,
|
|
78
85
|
path: {
|
|
79
86
|
project_id: projectId,
|
|
80
87
|
endpoint_id: endpointId
|
|
81
88
|
},
|
|
82
|
-
throwOnError: false
|
|
89
|
+
throwOnError: false,
|
|
90
|
+
signal
|
|
83
91
|
}), (data) => data.endpoint);
|
|
84
92
|
}
|
|
85
93
|
restart(projectId, endpointId, opts) {
|
|
86
|
-
return this.#ctx.run(opts, (client) => restartProjectEndpoint({
|
|
94
|
+
return this.#ctx.run(opts, (client, signal) => restartProjectEndpoint({
|
|
87
95
|
client,
|
|
88
96
|
path: {
|
|
89
97
|
project_id: projectId,
|
|
90
98
|
endpoint_id: endpointId
|
|
91
99
|
},
|
|
92
|
-
throwOnError: false
|
|
100
|
+
throwOnError: false,
|
|
101
|
+
signal
|
|
93
102
|
}), (data) => data.endpoint);
|
|
94
103
|
}
|
|
95
104
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.js","names":["#ctx"],"sources":["../../../src/neon/resources/endpoints.ts"],"sourcesContent":["import {\n\tcreateProjectEndpoint,\n\tdeleteProjectEndpoint,\n\tgetProjectEndpoint,\n\tlistProjectBranchEndpoints,\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}/branches/{branch_id}/endpoints */\n\tlistByBranch(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<Endpoint[], DThrow>>;\n\tlistByBranch<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Endpoint[], Throw>>;\n\tlistByBranch(\n\t\tprojectId: string,\n\t\tbranchId: 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\tlistProjectBranchEndpoints({\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.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":";;;AAuBA,IAAa,YAAb,MAA+C;CAC9C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAQA,KACC,WACA,MAC+C;EAC/C,OAAO,KAAKA,KAAK,IAChB,OACC,
|
|
1
|
+
{"version":3,"file":"endpoints.js","names":["#ctx"],"sources":["../../../src/neon/resources/endpoints.ts"],"sourcesContent":["import {\n\tcreateProjectEndpoint,\n\tdeleteProjectEndpoint,\n\tgetProjectEndpoint,\n\tlistProjectBranchEndpoints,\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, signal) =>\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\tsignal,\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}/branches/{branch_id}/endpoints */\n\tlistByBranch(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<Endpoint[], DThrow>>;\n\tlistByBranch<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Endpoint[], Throw>>;\n\tlistByBranch(\n\t\tprojectId: string,\n\t\tbranchId: 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, signal) =>\n\t\t\t\tlistProjectBranchEndpoints({\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\tsignal,\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, signal) =>\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\tsignal,\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, signal) =>\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\tsignal,\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, signal) =>\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\tsignal,\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, signal) =>\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\tsignal,\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, signal) =>\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\tsignal,\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, signal) =>\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\tsignal,\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, signal) =>\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\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.endpoint,\n\t\t);\n\t}\n}\n"],"mappings":";;;AAuBA,IAAa,YAAb,MAA+C;CAC9C;CAEA,YAA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AAK,IAChB,OACC,QAAQ,WACR,qBAAqB;GACpB;GACA,MAAM;IAAE,YAAY;IAAW,aAAa;GAAW;GACvD,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAYA,QACC,WACA,YACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,uBAAuB;GACtB;GACA,MAAM;IAAE,YAAY;IAAW,aAAa;GAAW;GACvD,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAYA,QACC,WACA,YACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,uBAAuB;GACtB;GACA,MAAM;IAAE,YAAY;IAAW,aAAa;GAAW;GACvD,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,QAChB;CACD;AACD"}
|
|
@@ -11,7 +11,7 @@ declare class Functions<DThrow extends boolean> {
|
|
|
11
11
|
#private;
|
|
12
12
|
constructor(ctx: RequestContext);
|
|
13
13
|
/** @apiCall GET /projects/{project_id}/branches/{branch_id}/functions (cursor-paginated) */
|
|
14
|
-
list(projectId: string, branchId: string, query?: ListQuery): Paginated<NeonFunction>;
|
|
14
|
+
list(projectId: string, branchId: string, query?: ListQuery, opts?: CallOptions): Paginated<NeonFunction>;
|
|
15
15
|
/** @apiCall GET /projects/{project_id}/branches/{branch_id}/functions/{slug} */
|
|
16
16
|
get(projectId: string, branchId: string, slug: string): Promise<Outcome<NeonFunction, DThrow>>;
|
|
17
17
|
get<Throw extends boolean = DThrow>(projectId: string, branchId: string, slug: string, opts: CallOptions<Throw>): Promise<Outcome<NeonFunction, Throw>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.d.ts","names":[],"sources":["../../../src/neon/resources/functions.ts"],"mappings":";;;;;;KAkBK,SAAA,GAAY,KAChB,YAAY;KAGR,WAAA,GAAc;AANqC;AAE1C,cAOD,SAPC,CAAA,eAAA,OAAA,CAAA,CAAA;EAC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|
10
10
|
/** @apiCall GET /projects/{project_id}/branches/{branch_id}/functions (cursor-paginated) */
|
|
11
|
-
list(projectId, branchId, query) {
|
|
11
|
+
list(projectId, branchId, query, opts) {
|
|
12
12
|
return paginate((cursor, signal) => listProjectBranchFunctions({
|
|
13
13
|
client: this.#ctx.client,
|
|
14
14
|
path: {
|
|
@@ -24,21 +24,22 @@ var Functions = class {
|
|
|
24
24
|
}), (data) => ({
|
|
25
25
|
items: data?.functions ?? [],
|
|
26
26
|
cursor: data?.pagination?.next
|
|
27
|
-
}));
|
|
27
|
+
}), () => this.#ctx.deadlineFor(opts));
|
|
28
28
|
}
|
|
29
29
|
get(projectId, branchId, slug, opts) {
|
|
30
|
-
return this.#ctx.run(opts, (client) => getProjectBranchFunction({
|
|
30
|
+
return this.#ctx.run(opts, (client, signal) => getProjectBranchFunction({
|
|
31
31
|
client,
|
|
32
32
|
path: {
|
|
33
33
|
project_id: projectId,
|
|
34
34
|
branch_id: branchId,
|
|
35
35
|
slug
|
|
36
36
|
},
|
|
37
|
-
throwOnError: false
|
|
37
|
+
throwOnError: false,
|
|
38
|
+
signal
|
|
38
39
|
}), (data) => data.function);
|
|
39
40
|
}
|
|
40
41
|
update(projectId, branchId, slug, input, opts) {
|
|
41
|
-
return this.#ctx.run(opts, (client) => updateProjectBranchFunction({
|
|
42
|
+
return this.#ctx.run(opts, (client, signal) => updateProjectBranchFunction({
|
|
42
43
|
client,
|
|
43
44
|
path: {
|
|
44
45
|
project_id: projectId,
|
|
@@ -46,22 +47,24 @@ var Functions = class {
|
|
|
46
47
|
slug
|
|
47
48
|
},
|
|
48
49
|
body: input,
|
|
49
|
-
throwOnError: false
|
|
50
|
+
throwOnError: false,
|
|
51
|
+
signal
|
|
50
52
|
}), (data) => data.function);
|
|
51
53
|
}
|
|
52
54
|
delete(projectId, branchId, slug, opts) {
|
|
53
|
-
return this.#ctx.runVoid(opts, (client) => deleteProjectBranchFunction({
|
|
55
|
+
return this.#ctx.runVoid(opts, (client, signal) => deleteProjectBranchFunction({
|
|
54
56
|
client,
|
|
55
57
|
path: {
|
|
56
58
|
project_id: projectId,
|
|
57
59
|
branch_id: branchId,
|
|
58
60
|
slug
|
|
59
61
|
},
|
|
60
|
-
throwOnError: false
|
|
62
|
+
throwOnError: false,
|
|
63
|
+
signal
|
|
61
64
|
}));
|
|
62
65
|
}
|
|
63
66
|
deploy(projectId, branchId, slug, input, opts) {
|
|
64
|
-
return this.#ctx.run(opts, (client) => createProjectBranchFunctionDeployment({
|
|
67
|
+
return this.#ctx.run(opts, (client, signal) => createProjectBranchFunctionDeployment({
|
|
65
68
|
client,
|
|
66
69
|
path: {
|
|
67
70
|
project_id: projectId,
|
|
@@ -69,7 +72,8 @@ var Functions = class {
|
|
|
69
72
|
slug
|
|
70
73
|
},
|
|
71
74
|
body: input ?? {},
|
|
72
|
-
throwOnError: false
|
|
75
|
+
throwOnError: false,
|
|
76
|
+
signal
|
|
73
77
|
}), (data) => data.deployment);
|
|
74
78
|
}
|
|
75
79
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","names":["#ctx"],"sources":["../../../src/neon/resources/functions.ts"],"sourcesContent":["import {\n\tcreateProjectBranchFunctionDeployment,\n\tdeleteProjectBranchFunction,\n\tgetProjectBranchFunction,\n\tlistProjectBranchFunctions,\n\tupdateProjectBranchFunction,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tFunctionDeployRequest,\n\tListProjectBranchFunctionsData,\n\tNeonFunction,\n\tNeonFunctionDeployment,\n\tNeonFunctionUpdateRequest,\n} 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\";\n\ntype ListQuery = Omit<\n\tNonNullable<ListProjectBranchFunctionsData[\"query\"]>,\n\t\"cursor\"\n>;\ntype UpdateInput = NeonFunctionUpdateRequest;\n\n/** Branch-scoped Neon Functions. */\nexport class Functions<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}/functions (cursor-paginated) */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tquery?: ListQuery,\n\t): Paginated<NeonFunction> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tlistProjectBranchFunctions({\n\t\t\t\t\tclient: this.#ctx.client,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tquery: { ...query, cursor },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => ({\n\t\t\t\titems: data?.functions ?? [],\n\t\t\t\tcursor: data?.pagination?.next,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall GET /projects/{project_id}/branches/{branch_id}/functions/{slug} */\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t): Promise<Outcome<NeonFunction, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonFunction, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\topts?: CallOptions,\n\t): Promise<NeonFunction | NeonResult<NeonFunction>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProjectBranchFunction({\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\tslug,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.function,\n\t\t);\n\t}\n\n\t/** @apiCall PATCH /projects/{project_id}/branches/{branch_id}/functions/{slug} */\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput: UpdateInput,\n\t): Promise<Outcome<NeonFunction, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput: UpdateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonFunction, Throw>>;\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput: UpdateInput,\n\t\topts?: CallOptions,\n\t): Promise<NeonFunction | NeonResult<NeonFunction>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tupdateProjectBranchFunction({\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\tslug,\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.function,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/functions/{slug} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdeleteProjectBranchFunction({\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\tslug,\n\t\t\t\t},\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/functions/{slug}/deployments */\n\tdeploy(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput?: FunctionDeployRequest,\n\t): Promise<Outcome<NeonFunctionDeployment, DThrow>>;\n\tdeploy<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput: FunctionDeployRequest | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonFunctionDeployment, Throw>>;\n\tdeploy(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput?: FunctionDeployRequest,\n\t\topts?: CallOptions,\n\t): Promise<NeonFunctionDeployment | NeonResult<NeonFunctionDeployment>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateProjectBranchFunctionDeployment({\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\tslug,\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.deployment,\n\t\t);\n\t}\n}\n"],"mappings":";;;;AAyBA,IAAa,YAAb,MAA+C;CAC9C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;CAGA,KACC,WACA,UACA,
|
|
1
|
+
{"version":3,"file":"functions.js","names":["#ctx"],"sources":["../../../src/neon/resources/functions.ts"],"sourcesContent":["import {\n\tcreateProjectBranchFunctionDeployment,\n\tdeleteProjectBranchFunction,\n\tgetProjectBranchFunction,\n\tlistProjectBranchFunctions,\n\tupdateProjectBranchFunction,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tFunctionDeployRequest,\n\tListProjectBranchFunctionsData,\n\tNeonFunction,\n\tNeonFunctionDeployment,\n\tNeonFunctionUpdateRequest,\n} 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\";\n\ntype ListQuery = Omit<\n\tNonNullable<ListProjectBranchFunctionsData[\"query\"]>,\n\t\"cursor\"\n>;\ntype UpdateInput = NeonFunctionUpdateRequest;\n\n/** Branch-scoped Neon Functions. */\nexport class Functions<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}/functions (cursor-paginated) */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tquery?: ListQuery,\n\t\topts?: CallOptions,\n\t): Paginated<NeonFunction> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tlistProjectBranchFunctions({\n\t\t\t\t\tclient: this.#ctx.client,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tquery: { ...query, cursor },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => ({\n\t\t\t\titems: data?.functions ?? [],\n\t\t\t\tcursor: data?.pagination?.next,\n\t\t\t}),\n\t\t\t() => this.#ctx.deadlineFor(opts),\n\t\t);\n\t}\n\n\t/** @apiCall GET /projects/{project_id}/branches/{branch_id}/functions/{slug} */\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t): Promise<Outcome<NeonFunction, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonFunction, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\topts?: CallOptions,\n\t): Promise<NeonFunction | NeonResult<NeonFunction>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tgetProjectBranchFunction({\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\tslug,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.function,\n\t\t);\n\t}\n\n\t/** @apiCall PATCH /projects/{project_id}/branches/{branch_id}/functions/{slug} */\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput: UpdateInput,\n\t): Promise<Outcome<NeonFunction, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput: UpdateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonFunction, Throw>>;\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput: UpdateInput,\n\t\topts?: CallOptions,\n\t): Promise<NeonFunction | NeonResult<NeonFunction>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tupdateProjectBranchFunction({\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\tslug,\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\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.function,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/functions/{slug} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client, signal) =>\n\t\t\tdeleteProjectBranchFunction({\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\tslug,\n\t\t\t\t},\n\t\t\t\tthrowOnError: false,\n\t\t\t\tsignal,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/functions/{slug}/deployments */\n\tdeploy(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput?: FunctionDeployRequest,\n\t): Promise<Outcome<NeonFunctionDeployment, DThrow>>;\n\tdeploy<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput: FunctionDeployRequest | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonFunctionDeployment, Throw>>;\n\tdeploy(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tslug: string,\n\t\tinput?: FunctionDeployRequest,\n\t\topts?: CallOptions,\n\t): Promise<NeonFunctionDeployment | NeonResult<NeonFunctionDeployment>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tcreateProjectBranchFunctionDeployment({\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\tslug,\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\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.deployment,\n\t\t);\n\t}\n}\n"],"mappings":";;;;AAyBA,IAAa,YAAb,MAA+C;CAC9C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;CAGA,KACC,WACA,UACA,OACA,MAC0B;EAC1B,OAAO,UACL,QAAQ,WACR,2BAA2B;GAC1B,QAAQ,KAAKA,KAAK;GAClB,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,OAAO;IAAE,GAAG;IAAO;GAAO;GAC1B,cAAc;GACd;EACD,CAAC,IACD,UAAU;GACV,OAAO,MAAM,aAAa,CAAC;GAC3B,QAAQ,MAAM,YAAY;EAC3B,UACM,KAAKA,KAAK,YAAY,IAAI,CACjC;CACD;CAcA,IACC,WACA,UACA,MACA,MACmD;EACnD,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,yBAAyB;GACxB;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX;GACD;GACA,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAgBA,OACC,WACA,UACA,MACA,OACA,MACmD;EACnD,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,4BAA4B;GAC3B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX;GACD;GACA,MAAM;GACN,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,QAChB;CACD;CAcA,OACC,WACA,UACA,MACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,QAAQ,WACvC,4BAA4B;GAC3B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX;GACD;GACA,cAAc;GACd;EACD,CAAC,CACF;CACD;CAgBA,OACC,WACA,UACA,MACA,OACA,MACuE;EACvE,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,sCAAsC;GACrC;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX;GACD;GACA,MAAM,SAAS,CAAC;GAChB,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,UAChB;CACD;AACD"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ListProjectBranchLogFieldValuesData, ProjectBranchLogFieldValuesResponse, ProjectBranchLogRecord, ProjectBranchLogsQueryRequest } from "../../client/types.gen.js";
|
|
2
|
+
import { Outcome } from "../result.js";
|
|
3
|
+
import { CallOptions, RequestContext } from "../context.js";
|
|
4
|
+
import { Paginated } from "../paginate.js";
|
|
5
|
+
|
|
6
|
+
//#region src/neon/resources/logs.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Filters for {@link Logs.query}.
|
|
10
|
+
*
|
|
11
|
+
* `cursor` is absent because {@link Paginated} owns paging: the endpoint requires
|
|
12
|
+
* every filter and the time window to be repeated unchanged on each page, and
|
|
13
|
+
* threading the cursor here is what guarantees that.
|
|
14
|
+
*/
|
|
15
|
+
type LogQueryInput = Omit<ProjectBranchLogsQueryRequest, "cursor">;
|
|
16
|
+
/** Query parameters for {@link Logs.fieldValues}. */
|
|
17
|
+
type LogFieldValuesQuery = NonNullable<ListProjectBranchLogFieldValuesData["query"]>;
|
|
18
|
+
/**
|
|
19
|
+
* Branch-scoped logs emitted by the services running on a branch — Neon Functions,
|
|
20
|
+
* object storage, and Postgres computes. Grouped under `neon.logs.*` alongside the
|
|
21
|
+
* other branch-scoped product surfaces.
|
|
22
|
+
*
|
|
23
|
+
* Private Beta. Telemetry is region-gated, so a branch outside an enabled region answers
|
|
24
|
+
* `404` with `reason: "telemetry_not_enabled"` rather than an empty result — treat that
|
|
25
|
+
* as an ordinary outcome. A branch that has telemetry but nothing recorded answers `200`
|
|
26
|
+
* with an empty array, and one whose backend is down answers `503`, which the client
|
|
27
|
+
* retries on by default.
|
|
28
|
+
*
|
|
29
|
+
* The spec is wider than the backend: of the three `source` values only `function` and
|
|
30
|
+
* `storage` were observed emitting, and `minimum_severity` can be rejected as unsupported
|
|
31
|
+
* by a branch's log backend, where `severity_text` still works.
|
|
32
|
+
*/
|
|
33
|
+
declare class Logs<DThrow extends boolean> {
|
|
34
|
+
#private;
|
|
35
|
+
constructor(ctx: RequestContext);
|
|
36
|
+
/**
|
|
37
|
+
* Query branch logs (cursor-paginated). Every supplied filter is combined with
|
|
38
|
+
* `AND`.
|
|
39
|
+
*
|
|
40
|
+
* Give the window as either `since` or `start_time` — supplying both is rejected.
|
|
41
|
+
* `logql` replaces the seven content filters rather than adding to them, while
|
|
42
|
+
* `limit`, `sort_order`, and the time window still apply alongside it. With no
|
|
43
|
+
* window the query covers the last hour, and seven days is the widest range served.
|
|
44
|
+
*
|
|
45
|
+
* @apiCall POST /projects/{project_id}/branches/{branch_id}/logs/query (cursor-paginated)
|
|
46
|
+
*/
|
|
47
|
+
query(projectId: string, branchId: string, input?: LogQueryInput, opts?: CallOptions): Paginated<ProjectBranchLogRecord>;
|
|
48
|
+
/**
|
|
49
|
+
* List the log fields whose values {@link Logs.fieldValues} can enumerate on
|
|
50
|
+
* this branch. Computed per branch and grows as fields are observed, so read it
|
|
51
|
+
* rather than assuming a fixed set.
|
|
52
|
+
*
|
|
53
|
+
* @apiCall GET /projects/{project_id}/branches/{branch_id}/logs/fields
|
|
54
|
+
*/
|
|
55
|
+
fields(projectId: string, branchId: string): Promise<Outcome<string[], DThrow>>;
|
|
56
|
+
fields<Throw extends boolean = DThrow>(projectId: string, branchId: string, opts: CallOptions<Throw>): Promise<Outcome<string[], Throw>>;
|
|
57
|
+
/**
|
|
58
|
+
* List the distinct values observed for one log field, for use as a filter.
|
|
59
|
+
* `fieldName` must be one of the names {@link Logs.fields} reports; anything else is
|
|
60
|
+
* rejected with `unknown_field`. The enumerable set and the set {@link Logs.query} can
|
|
61
|
+
* filter on overlap rather than nest: `source` is a filter but is not enumerable, and
|
|
62
|
+
* `entity_type` is enumerable but is not a filter.
|
|
63
|
+
*
|
|
64
|
+
* The whole response is returned rather than the bare values because
|
|
65
|
+
* `is_truncated` decides whether the list can be trusted: when it is `true` the
|
|
66
|
+
* values are an arbitrary subset, and the window or `source` needs narrowing
|
|
67
|
+
* before filtering on them.
|
|
68
|
+
*
|
|
69
|
+
* @apiCall GET /projects/{project_id}/branches/{branch_id}/logs/fields/{field_name}/values
|
|
70
|
+
*/
|
|
71
|
+
fieldValues(projectId: string, branchId: string, fieldName: string, query?: LogFieldValuesQuery): Promise<Outcome<ProjectBranchLogFieldValuesResponse, DThrow>>;
|
|
72
|
+
fieldValues<Throw extends boolean = DThrow>(projectId: string, branchId: string, fieldName: string, query: LogFieldValuesQuery | undefined, opts: CallOptions<Throw>): Promise<Outcome<ProjectBranchLogFieldValuesResponse, Throw>>;
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
75
|
+
export { LogFieldValuesQuery, LogQueryInput, Logs };
|
|
76
|
+
//# sourceMappingURL=logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.d.ts","names":[],"sources":["../../../src/neon/resources/logs.ts"],"mappings":";;;;;;;;;AAwBA;AAAyB;AAAQ;AAAL;AAAI;AAGpB,KAHA,aAAA,GAAgB,IAGG,CAHE,6BAGF,EAAA,QAAA,CAAA;AAAA;AAC9B,KADW,mBAAA,GAAsB,WACjC,CAAA,mCAAA,CAAA,OAAA,CAAA,CAAA;AADiC;AAAW;AAmB7C;AAAiB;AAGC;AAkBR;AACD;AACK;AAAV;AAgD0B;AAAlB;AAAR;AAC4B;AAGZ;AAAZ;AACsB,cA5EjB,IA4EiB,CAAA,eAAA,OAAA,CAAA,CAAA;EAAlB,CAAA,OAAA;EAAR,WAAA,CAAA,GAAA,EAzEc,cAyEd;EAqCM;AACU;AAAqC;AAA7C;AAAR;AACiC;AAI5B;AACW;AAAZ;AACY;AAAqC;EAA7C,KAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,KAAA,CAAA,EApGF,aAoGE,EAAA,IAAA,CAAA,EAnGH,WAmGG,CAAA,EAlGR,SAkGQ,CAlGE,sBAkGF,CAAA;EAAR;AAAO;;;;;;+CAlDP,QAAQ,kBAAkB;iCACE,mDAGxB,YAAY,SAChB,QAAQ,kBAAkB;;;;;;;;;;;;;;;8EAqCpB,sBACN,QAAQ,QAAQ,qCAAqC;sCACpB,uEAI5B,uCACD,YAAY,SAChB,QAAQ,QAAQ,qCAAqC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { NeonError } from "../errors.js";
|
|
2
|
+
import { listProjectBranchLogFieldValues, listProjectBranchLogFields, queryProjectBranchLogs } from "../../client/sdk.gen.js";
|
|
3
|
+
import { paginate } from "../paginate.js";
|
|
4
|
+
//#region src/neon/resources/logs.ts
|
|
5
|
+
/**
|
|
6
|
+
* Branch-scoped logs emitted by the services running on a branch — Neon Functions,
|
|
7
|
+
* object storage, and Postgres computes. Grouped under `neon.logs.*` alongside the
|
|
8
|
+
* other branch-scoped product surfaces.
|
|
9
|
+
*
|
|
10
|
+
* Private Beta. Telemetry is region-gated, so a branch outside an enabled region answers
|
|
11
|
+
* `404` with `reason: "telemetry_not_enabled"` rather than an empty result — treat that
|
|
12
|
+
* as an ordinary outcome. A branch that has telemetry but nothing recorded answers `200`
|
|
13
|
+
* with an empty array, and one whose backend is down answers `503`, which the client
|
|
14
|
+
* retries on by default.
|
|
15
|
+
*
|
|
16
|
+
* The spec is wider than the backend: of the three `source` values only `function` and
|
|
17
|
+
* `storage` were observed emitting, and `minimum_severity` can be rejected as unsupported
|
|
18
|
+
* by a branch's log backend, where `severity_text` still works.
|
|
19
|
+
*/
|
|
20
|
+
var Logs = class {
|
|
21
|
+
#ctx;
|
|
22
|
+
constructor(ctx) {
|
|
23
|
+
this.#ctx = ctx;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Query branch logs (cursor-paginated). Every supplied filter is combined with
|
|
27
|
+
* `AND`.
|
|
28
|
+
*
|
|
29
|
+
* Give the window as either `since` or `start_time` — supplying both is rejected.
|
|
30
|
+
* `logql` replaces the seven content filters rather than adding to them, while
|
|
31
|
+
* `limit`, `sort_order`, and the time window still apply alongside it. With no
|
|
32
|
+
* window the query covers the last hour, and seven days is the widest range served.
|
|
33
|
+
*
|
|
34
|
+
* @apiCall POST /projects/{project_id}/branches/{branch_id}/logs/query (cursor-paginated)
|
|
35
|
+
*/
|
|
36
|
+
query(projectId, branchId, input, opts) {
|
|
37
|
+
const filters = { ...input };
|
|
38
|
+
return paginate(async (cursor, signal) => {
|
|
39
|
+
const page = await queryProjectBranchLogs({
|
|
40
|
+
client: this.#ctx.client,
|
|
41
|
+
path: {
|
|
42
|
+
project_id: projectId,
|
|
43
|
+
branch_id: branchId
|
|
44
|
+
},
|
|
45
|
+
body: {
|
|
46
|
+
...filters,
|
|
47
|
+
cursor
|
|
48
|
+
},
|
|
49
|
+
throwOnError: false,
|
|
50
|
+
signal
|
|
51
|
+
});
|
|
52
|
+
if (page.data?.is_truncated && !page.data.next_cursor) return {
|
|
53
|
+
response: page.response,
|
|
54
|
+
error: new NeonError("Neon reported more log records than it returned but gave no cursor to reach them.", "client")
|
|
55
|
+
};
|
|
56
|
+
return page;
|
|
57
|
+
}, (data) => ({
|
|
58
|
+
items: data?.logs ?? [],
|
|
59
|
+
cursor: data?.is_truncated ? data.next_cursor : void 0
|
|
60
|
+
}), () => this.#ctx.deadlineFor(opts));
|
|
61
|
+
}
|
|
62
|
+
fields(projectId, branchId, opts) {
|
|
63
|
+
return this.#ctx.run(opts, (client, signal) => listProjectBranchLogFields({
|
|
64
|
+
client,
|
|
65
|
+
path: {
|
|
66
|
+
project_id: projectId,
|
|
67
|
+
branch_id: branchId
|
|
68
|
+
},
|
|
69
|
+
throwOnError: false,
|
|
70
|
+
signal
|
|
71
|
+
}), (data) => data.fields);
|
|
72
|
+
}
|
|
73
|
+
fieldValues(projectId, branchId, fieldName, query, opts) {
|
|
74
|
+
return this.#ctx.run(opts, (client, signal) => listProjectBranchLogFieldValues({
|
|
75
|
+
client,
|
|
76
|
+
path: {
|
|
77
|
+
project_id: projectId,
|
|
78
|
+
branch_id: branchId,
|
|
79
|
+
field_name: fieldName
|
|
80
|
+
},
|
|
81
|
+
query,
|
|
82
|
+
throwOnError: false,
|
|
83
|
+
signal
|
|
84
|
+
}), (data) => data);
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
//#endregion
|
|
88
|
+
export { Logs };
|
|
89
|
+
|
|
90
|
+
//# sourceMappingURL=logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logs.js","names":["#ctx"],"sources":["../../../src/neon/resources/logs.ts"],"sourcesContent":["import {\n\tlistProjectBranchLogFields,\n\tlistProjectBranchLogFieldValues,\n\tqueryProjectBranchLogs,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tListProjectBranchLogFieldValuesData,\n\tProjectBranchLogFieldValuesResponse,\n\tProjectBranchLogRecord,\n\tProjectBranchLogsQueryRequest,\n\tProjectBranchLogsQueryResponse,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport { NeonError } from \"../errors.js\";\nimport { type Paginated, paginate } from \"../paginate.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\n/**\n * Filters for {@link Logs.query}.\n *\n * `cursor` is absent because {@link Paginated} owns paging: the endpoint requires\n * every filter and the time window to be repeated unchanged on each page, and\n * threading the cursor here is what guarantees that.\n */\nexport type LogQueryInput = Omit<ProjectBranchLogsQueryRequest, \"cursor\">;\n\n/** Query parameters for {@link Logs.fieldValues}. */\nexport type LogFieldValuesQuery = NonNullable<\n\tListProjectBranchLogFieldValuesData[\"query\"]\n>;\n\n/**\n * Branch-scoped logs emitted by the services running on a branch — Neon Functions,\n * object storage, and Postgres computes. Grouped under `neon.logs.*` alongside the\n * other branch-scoped product surfaces.\n *\n * Private Beta. Telemetry is region-gated, so a branch outside an enabled region answers\n * `404` with `reason: \"telemetry_not_enabled\"` rather than an empty result — treat that\n * as an ordinary outcome. A branch that has telemetry but nothing recorded answers `200`\n * with an empty array, and one whose backend is down answers `503`, which the client\n * retries on by default.\n *\n * The spec is wider than the backend: of the three `source` values only `function` and\n * `storage` were observed emitting, and `minimum_severity` can be rejected as unsupported\n * by a branch's log backend, where `severity_text` still works.\n */\nexport class Logs<DThrow extends boolean> {\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\t/**\n\t * Query branch logs (cursor-paginated). Every supplied filter is combined with\n\t * `AND`.\n\t *\n\t * Give the window as either `since` or `start_time` — supplying both is rejected.\n\t * `logql` replaces the seven content filters rather than adding to them, while\n\t * `limit`, `sort_order`, and the time window still apply alongside it. With no\n\t * window the query covers the last hour, and seven days is the widest range served.\n\t *\n\t * @apiCall POST /projects/{project_id}/branches/{branch_id}/logs/query (cursor-paginated)\n\t */\n\tquery(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput?: LogQueryInput,\n\t\topts?: CallOptions,\n\t): Paginated<ProjectBranchLogRecord> {\n\t\t// Snapshot the filters. The endpoint returns wrong results unless every page\n\t\t// repeats them unchanged, and a `Paginated` is lazy — reading `input` per page\n\t\t// would let a caller mutating it afterwards change the query mid-walk.\n\t\tconst filters = { ...input };\n\t\treturn paginate<ProjectBranchLogRecord, ProjectBranchLogsQueryResponse>(\n\t\t\tasync (cursor, signal) => {\n\t\t\t\tconst page = await queryProjectBranchLogs({\n\t\t\t\t\tclient: this.#ctx.client,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tbody: { ...filters, cursor },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\t// Truncated with nothing to resume from: the remaining records are\n\t\t\t\t// unreachable. Stopping here would hand back a partial page that looks\n\t\t\t\t// like the whole result.\n\t\t\t\tif (page.data?.is_truncated && !page.data.next_cursor) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tresponse: page.response,\n\t\t\t\t\t\terror: new NeonError(\n\t\t\t\t\t\t\t\"Neon reported more log records than it returned but gave no cursor to reach them.\",\n\t\t\t\t\t\t\t\"client\",\n\t\t\t\t\t\t),\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\treturn page;\n\t\t\t},\n\t\t\t(data) => ({\n\t\t\t\titems: data?.logs ?? [],\n\t\t\t\t// `next_cursor` is present but empty on the last page, so truncation is\n\t\t\t\t// the flag that ends the walk.\n\t\t\t\tcursor: data?.is_truncated ? data.next_cursor : undefined,\n\t\t\t}),\n\t\t\t() => this.#ctx.deadlineFor(opts),\n\t\t);\n\t}\n\n\t/**\n\t * List the log fields whose values {@link Logs.fieldValues} can enumerate on\n\t * this branch. Computed per branch and grows as fields are observed, so read it\n\t * rather than assuming a fixed set.\n\t *\n\t * @apiCall GET /projects/{project_id}/branches/{branch_id}/logs/fields\n\t */\n\tfields(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<string[], DThrow>>;\n\tfields<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<string[], Throw>>;\n\tfields(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<string[] | NeonResult<string[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tlistProjectBranchLogFields({\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\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data.fields,\n\t\t);\n\t}\n\n\t/**\n\t * List the distinct values observed for one log field, for use as a filter.\n\t * `fieldName` must be one of the names {@link Logs.fields} reports; anything else is\n\t * rejected with `unknown_field`. The enumerable set and the set {@link Logs.query} can\n\t * filter on overlap rather than nest: `source` is a filter but is not enumerable, and\n\t * `entity_type` is enumerable but is not a filter.\n\t *\n\t * The whole response is returned rather than the bare values because\n\t * `is_truncated` decides whether the list can be trusted: when it is `true` the\n\t * values are an arbitrary subset, and the window or `source` needs narrowing\n\t * before filtering on them.\n\t *\n\t * @apiCall GET /projects/{project_id}/branches/{branch_id}/logs/fields/{field_name}/values\n\t */\n\tfieldValues(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tfieldName: string,\n\t\tquery?: LogFieldValuesQuery,\n\t): Promise<Outcome<ProjectBranchLogFieldValuesResponse, DThrow>>;\n\tfieldValues<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tfieldName: string,\n\t\tquery: LogFieldValuesQuery | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<ProjectBranchLogFieldValuesResponse, Throw>>;\n\tfieldValues(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tfieldName: string,\n\t\tquery?: LogFieldValuesQuery,\n\t\topts?: CallOptions,\n\t): Promise<\n\t\t| ProjectBranchLogFieldValuesResponse\n\t\t| NeonResult<ProjectBranchLogFieldValuesResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tlistProjectBranchLogFieldValues({\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\tfield_name: fieldName,\n\t\t\t\t\t},\n\t\t\t\t\tquery,\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8CA,IAAa,OAAb,MAA0C;CACzC;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;;;;;;;;;;;CAaA,MACC,WACA,UACA,OACA,MACoC;EAIpC,MAAM,UAAU,EAAE,GAAG,MAAM;EAC3B,OAAO,SACN,OAAO,QAAQ,WAAW;GACzB,MAAM,OAAO,MAAM,uBAAuB;IACzC,QAAQ,KAAKA,KAAK;IAClB,MAAM;KAAE,YAAY;KAAW,WAAW;IAAS;IACnD,MAAM;KAAE,GAAG;KAAS;IAAO;IAC3B,cAAc;IACd;GACD,CAAC;GAID,IAAI,KAAK,MAAM,gBAAgB,CAAC,KAAK,KAAK,aACzC,OAAO;IACN,UAAU,KAAK;IACf,OAAO,IAAI,UACV,qFACA,QACD;GACD;GAED,OAAO;EACR,IACC,UAAU;GACV,OAAO,MAAM,QAAQ,CAAC;GAGtB,QAAQ,MAAM,eAAe,KAAK,cAAc,KAAA;EACjD,UACM,KAAKA,KAAK,YAAY,IAAI,CACjC;CACD;CAkBA,OACC,WACA,UACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,2BAA2B;GAC1B;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,MAChB;CACD;CA6BA,YACC,WACA,UACA,WACA,OACA,MAIC;EACD,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,gCAAgC;GAC/B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,YAAY;GACb;GACA;GACA,cAAc;GACd;EACD,CAAC,IACD,SAAS,IACX;CACD;AACD"}
|
|
@@ -5,12 +5,21 @@ import { CallOptions, RequestContext } from "../context.js";
|
|
|
5
5
|
import { Paginated } from "../paginate.js";
|
|
6
6
|
|
|
7
7
|
//#region src/neon/resources/operations.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Options for {@link Operations.waitFor}.
|
|
11
|
+
*
|
|
12
|
+
* `requestTimeoutMs` and `waitForReadiness` are deliberately excluded. Readiness is
|
|
13
|
+
* budgeted by `timeoutMs`, and waiting *is* the readiness step — accepting either would
|
|
14
|
+
* offer a knob that silently did nothing.
|
|
15
|
+
*/
|
|
16
|
+
type WaitForForOptions<Throw extends boolean> = WaitForOptions & Omit<CallOptions<Throw>, "requestTimeoutMs" | "waitForReadiness">;
|
|
8
17
|
/** Operation resource — read operations and wait for them to finish. */
|
|
9
18
|
declare class Operations<DThrow extends boolean> {
|
|
10
19
|
#private;
|
|
11
20
|
constructor(ctx: RequestContext);
|
|
12
21
|
/** @apiCall GET /projects/{project_id}/operations (cursor-paginated) */
|
|
13
|
-
list(projectId: string): Paginated<Operation>;
|
|
22
|
+
list(projectId: string, opts?: CallOptions): Paginated<Operation>;
|
|
14
23
|
/** @apiCall GET /projects/{project_id}/operations/{operation_id} */
|
|
15
24
|
get(projectId: string, operationId: string): Promise<Outcome<Operation, DThrow>>;
|
|
16
25
|
get<Throw extends boolean = DThrow>(projectId: string, operationId: string, opts: CallOptions<Throw>): Promise<Outcome<Operation, Throw>>;
|
|
@@ -20,8 +29,8 @@ declare class Operations<DThrow extends boolean> {
|
|
|
20
29
|
* from any source (e.g. a raw call or a create response).
|
|
21
30
|
*/
|
|
22
31
|
waitFor(operations: readonly Operation[]): Promise<Outcome<void, DThrow>>;
|
|
23
|
-
waitFor<Throw extends boolean = DThrow>(operations: readonly Operation[], opts:
|
|
32
|
+
waitFor<Throw extends boolean = DThrow>(operations: readonly Operation[], opts: WaitForForOptions<Throw>): Promise<Outcome<void, Throw>>;
|
|
24
33
|
}
|
|
25
34
|
//#endregion
|
|
26
|
-
export { Operations };
|
|
35
|
+
export { Operations, WaitForForOptions };
|
|
27
36
|
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","names":[],"sources":["../../../src/neon/resources/operations.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"operations.d.ts","names":[],"sources":["../../../src/neon/resources/operations.ts"],"mappings":";;;;;;;;;;AAiBA;AAA6B;AAA0B;AACrC;AAAZ;AAAL,KADW,iBACX,CAAA,cAAA,OAAA,CAAA,GADsD,cACtD,GAAA,IAAA,CAAK,WAAL,CAAiB,KAAjB,CAAA,EAAA,kBAAA,GAAA,kBAAA,CAAA;AAAI;AAGQ,cAAA,UAAU,CAAA,eAAA,OAAA,CAAA,CAAA;EAAA,CAAA,OAAA;EAGL,WAAA,CAAA,GAAA,EAAA,cAAA;EAKc;EAAwB,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,IAAA,CAAA,EAAxB,WAAwB,CAAA,EAAV,SAAU,CAAA,SAAA,CAAA;EAAV;EAsB1B,GAAA,CAAA,SAAA,EAAA,MAAA,EAAA,WAAA,EAAA,MAAA,CAAA,EAAhB,OAAgB,CAAR,OAAQ,CAAA,SAAA,EAAW,MAAX,CAAA,CAAA;EAAW,GAAA,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;EAAnB;AAAR;AACyB;AAGT;AAAZ;EACY,OAAA,CAAA,UAAA,EAAA,SAwBU,SAxBV,EAAA,CAAA,EAwBwB,OAxBxB,CAwBgC,OAxBhC,CAAA,IAAA,EAwB8C,MAxB9C,CAAA,CAAA;EAAW,OAAA,CAAA,cAAA,OAAA,GAyBE,MAzBF,CAAA,CAAA,UAAA,EAAA,SA0BR,SA1BQ,EAAA,EAAA,IAAA,EA2BvB,iBA3BuB,CA2BL,KA3BK,CAAA,CAAA,EA4B3B,OA5B2B,CA4BnB,OA5BmB,CAAA,IAAA,EA4BL,KA5BK,CAAA,CAAA;AAAnB"}
|
|
@@ -9,7 +9,7 @@ var Operations = class {
|
|
|
9
9
|
this.#ctx = ctx;
|
|
10
10
|
}
|
|
11
11
|
/** @apiCall GET /projects/{project_id}/operations (cursor-paginated) */
|
|
12
|
-
list(projectId) {
|
|
12
|
+
list(projectId, opts) {
|
|
13
13
|
return paginate((cursor, signal) => listProjectOperations({
|
|
14
14
|
client: this.#ctx.client,
|
|
15
15
|
path: { project_id: projectId },
|
|
@@ -19,16 +19,17 @@ var Operations = class {
|
|
|
19
19
|
}), (data) => ({
|
|
20
20
|
items: data?.operations ?? [],
|
|
21
21
|
cursor: data?.pagination?.cursor
|
|
22
|
-
}));
|
|
22
|
+
}), () => this.#ctx.deadlineFor(opts));
|
|
23
23
|
}
|
|
24
24
|
get(projectId, operationId, opts) {
|
|
25
|
-
return this.#ctx.run(opts, (client) => getProjectOperation({
|
|
25
|
+
return this.#ctx.run(opts, (client, signal) => getProjectOperation({
|
|
26
26
|
client,
|
|
27
27
|
path: {
|
|
28
28
|
project_id: projectId,
|
|
29
29
|
operation_id: operationId
|
|
30
30
|
},
|
|
31
|
-
throwOnError: false
|
|
31
|
+
throwOnError: false,
|
|
32
|
+
signal
|
|
32
33
|
}), (data) => data.operation);
|
|
33
34
|
}
|
|
34
35
|
async waitFor(operations, opts) {
|
|
@@ -1 +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:
|
|
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/**\n * Options for {@link Operations.waitFor}.\n *\n * `requestTimeoutMs` and `waitForReadiness` are deliberately excluded. Readiness is\n * budgeted by `timeoutMs`, and waiting *is* the readiness step — accepting either would\n * offer a knob that silently did nothing.\n */\nexport type WaitForForOptions<Throw extends boolean> = WaitForOptions &\n\tOmit<CallOptions<Throw>, \"requestTimeoutMs\" | \"waitForReadiness\">;\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, opts?: CallOptions): 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\t() => this.#ctx.deadlineFor(opts),\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, signal) =>\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\tsignal,\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: WaitForForOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tasync waitFor(\n\t\toperations: readonly Operation[],\n\t\topts?: WaitForForOptions<boolean>,\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":";;;;;AAqBA,IAAa,aAAb,MAAgD;CAC/C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;CAGA,KAAK,WAAmB,MAA0C;EACjE,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,UACM,KAAKA,KAAK,YAAY,IAAI,CACjC;CACD;CAYA,IACC,WACA,aACA,MAC6C;EAC7C,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,oBAAoB;GACnB;GACA,MAAM;IAAE,YAAY;IAAW,cAAc;GAAY;GACzD,cAAc;GACd;EACD,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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","names":[],"sources":["../../../src/neon/resources/postgres.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","names":[],"sources":["../../../src/neon/resources/postgres.ts"],"mappings":";;;;;;;;;UAgBiB,sBAAA;EAAA,SAAA,EAAA,MAAA;EAmBJ;EAAQ,QAAA,CAAA,EAAA,MAAA;EACU;EAAV,UAAA,CAAA,EAAA,MAAA;EACE;EAAN,YAAA,CAAA,EAAA,MAAA;EACc;EAAV,QAAA,CAAA,EAAA,MAAA;EACM;EAAR,MAAA,CAAA,EAAA,OAAA;AAGD;AAcR;AACkB;AAAhB;AAAR;AACsC;AAChC,cAxBG,QAwBH,CAAA,eAAA,OAAA,CAAA,CAAA;EACU,CAAA,OAAA;EAAZ,SAAA,SAAA,EAxBa,SAwBb,CAxBuB,MAwBvB,CAAA;EACoB,SAAA,KAAA,EAxBX,KAwBW,CAxBL,MAwBK,CAAA;EAAhB,SAAA,SAAA,EAvBS,SAuBT,CAvBmB,MAuBnB,CAAA;EAAR,SAAA,OAAA,EAtBe,OAsBf,CAtBuB,MAsBvB,CAAA;EAAO,WAAA,CAAA,GAAA,EAnBO,cAmBP;;;;;;2BALD,yBACN,QAAQ,gBAAgB;2CACc,gBAChC,8BACF,YAAY,SAChB,QAAQ,gBAAgB"}
|