@neon/sdk 1.4.1 → 1.5.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 +64 -3
- package/dist/client/types.gen.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- 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 +59 -10
- package/dist/neon/context.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 +59 -24
- 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 -1
- package/dist/neon/resources/branches.d.ts.map +1 -1
- package/dist/neon/resources/branches.js +29 -20
- 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/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 +9 -1
- package/dist/neon/resources/postgres.js.map +1 -1
- package/dist/neon/resources/projects.d.ts +1 -1
- package/dist/neon/resources/projects.d.ts.map +1 -1
- package/dist/neon/resources/projects.js +35 -24
- 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/package.json +2 -1
|
@@ -11,7 +11,7 @@ var Branches = class {
|
|
|
11
11
|
this.#ctx = ctx;
|
|
12
12
|
}
|
|
13
13
|
/** @apiCall GET /projects/{project_id}/branches (cursor-paginated) */
|
|
14
|
-
list(projectId, query) {
|
|
14
|
+
list(projectId, query, opts) {
|
|
15
15
|
return paginate((cursor, signal) => listProjectBranches({
|
|
16
16
|
client: this.#ctx.client,
|
|
17
17
|
path: { project_id: projectId },
|
|
@@ -24,45 +24,49 @@ var Branches = class {
|
|
|
24
24
|
}), (data) => ({
|
|
25
25
|
items: data?.branches ?? [],
|
|
26
26
|
cursor: data?.pagination?.next
|
|
27
|
-
}));
|
|
27
|
+
}), () => this.#ctx.deadlineFor(opts));
|
|
28
28
|
}
|
|
29
29
|
get(projectId, branchId, opts) {
|
|
30
|
-
return this.#ctx.run(opts, (client) => getProjectBranch({
|
|
30
|
+
return this.#ctx.run(opts, (client, signal) => getProjectBranch({
|
|
31
31
|
client,
|
|
32
32
|
path: {
|
|
33
33
|
project_id: projectId,
|
|
34
34
|
branch_id: branchId
|
|
35
35
|
},
|
|
36
|
-
throwOnError: false
|
|
36
|
+
throwOnError: false,
|
|
37
|
+
signal
|
|
37
38
|
}), (data) => data.branch);
|
|
38
39
|
}
|
|
39
40
|
create(projectId, input, opts) {
|
|
40
|
-
return this.#ctx.run(opts, (client) => createProjectBranch({
|
|
41
|
+
return this.#ctx.run(opts, (client, signal) => createProjectBranch({
|
|
41
42
|
client,
|
|
42
43
|
path: { project_id: projectId },
|
|
43
44
|
body: { branch: input },
|
|
44
|
-
throwOnError: false
|
|
45
|
+
throwOnError: false,
|
|
46
|
+
signal
|
|
45
47
|
}), (data) => data.branch);
|
|
46
48
|
}
|
|
47
49
|
update(projectId, branchId, input, opts) {
|
|
48
|
-
return this.#ctx.run(opts, (client) => updateProjectBranch({
|
|
50
|
+
return this.#ctx.run(opts, (client, signal) => updateProjectBranch({
|
|
49
51
|
client,
|
|
50
52
|
path: {
|
|
51
53
|
project_id: projectId,
|
|
52
54
|
branch_id: branchId
|
|
53
55
|
},
|
|
54
56
|
body: { branch: input },
|
|
55
|
-
throwOnError: false
|
|
57
|
+
throwOnError: false,
|
|
58
|
+
signal
|
|
56
59
|
}), (data) => data.branch);
|
|
57
60
|
}
|
|
58
61
|
delete(projectId, branchId, opts) {
|
|
59
|
-
return this.#ctx.runVoid(opts, (client) => deleteProjectBranch({
|
|
62
|
+
return this.#ctx.runVoid(opts, (client, signal) => deleteProjectBranch({
|
|
60
63
|
client,
|
|
61
64
|
path: {
|
|
62
65
|
project_id: projectId,
|
|
63
66
|
branch_id: branchId
|
|
64
67
|
},
|
|
65
|
-
throwOnError: false
|
|
68
|
+
throwOnError: false,
|
|
69
|
+
signal
|
|
66
70
|
}));
|
|
67
71
|
}
|
|
68
72
|
async createWithCompute(projectId, input, opts) {
|
|
@@ -70,7 +74,7 @@ var Branches = class {
|
|
|
70
74
|
return finalize(withConnectionString(await this.#ctx.execute({
|
|
71
75
|
...opts,
|
|
72
76
|
waitForReadiness: opts?.waitForReadiness ?? true
|
|
73
|
-
}, (client) => createProjectBranch({
|
|
77
|
+
}, (client, signal) => createProjectBranch({
|
|
74
78
|
client,
|
|
75
79
|
path: { project_id: projectId },
|
|
76
80
|
body: {
|
|
@@ -85,7 +89,8 @@ var Branches = class {
|
|
|
85
89
|
suspend_timeout_seconds: input.compute?.suspendTimeoutSeconds
|
|
86
90
|
}]
|
|
87
91
|
},
|
|
88
|
-
throwOnError: false
|
|
92
|
+
throwOnError: false,
|
|
93
|
+
signal
|
|
89
94
|
}), (data) => data), (data) => data.connection_uris, (data, connectionString) => ({
|
|
90
95
|
branch: data.branch,
|
|
91
96
|
endpoint: data.endpoints[0],
|
|
@@ -94,10 +99,11 @@ var Branches = class {
|
|
|
94
99
|
}
|
|
95
100
|
async getDefault(projectId, opts) {
|
|
96
101
|
const shouldThrow = opts?.throwOnError ?? this.#ctx.defaults.throwOnError;
|
|
97
|
-
const result = await this.#ctx.execute(opts, (client) => listProjectBranches({
|
|
102
|
+
const result = await this.#ctx.execute(opts, (client, signal) => listProjectBranches({
|
|
98
103
|
client,
|
|
99
104
|
path: { project_id: projectId },
|
|
100
|
-
throwOnError: false
|
|
105
|
+
throwOnError: false,
|
|
106
|
+
signal
|
|
101
107
|
}), (data) => data.branches);
|
|
102
108
|
if (result.error) return finalize(err(result.error), shouldThrow);
|
|
103
109
|
const branch = result.data.find((candidate) => candidate.default);
|
|
@@ -105,34 +111,37 @@ var Branches = class {
|
|
|
105
111
|
return finalize(ok(branch), shouldThrow);
|
|
106
112
|
}
|
|
107
113
|
setDefault(projectId, branchId, opts) {
|
|
108
|
-
return this.#ctx.run(opts, (client) => setDefaultProjectBranch({
|
|
114
|
+
return this.#ctx.run(opts, (client, signal) => setDefaultProjectBranch({
|
|
109
115
|
client,
|
|
110
116
|
path: {
|
|
111
117
|
project_id: projectId,
|
|
112
118
|
branch_id: branchId
|
|
113
119
|
},
|
|
114
|
-
throwOnError: false
|
|
120
|
+
throwOnError: false,
|
|
121
|
+
signal
|
|
115
122
|
}), (data) => data.branch);
|
|
116
123
|
}
|
|
117
124
|
finalizeRestore(projectId, branchId, input, opts) {
|
|
118
|
-
return this.#ctx.run(opts, (client) => finalizeRestoreBranch({
|
|
125
|
+
return this.#ctx.run(opts, (client, signal) => finalizeRestoreBranch({
|
|
119
126
|
client,
|
|
120
127
|
path: {
|
|
121
128
|
project_id: projectId,
|
|
122
129
|
branch_id: branchId
|
|
123
130
|
},
|
|
124
131
|
body: { name: input?.name },
|
|
125
|
-
throwOnError: false
|
|
132
|
+
throwOnError: false,
|
|
133
|
+
signal
|
|
126
134
|
}), () => void 0);
|
|
127
135
|
}
|
|
128
136
|
recover(projectId, branchId, opts) {
|
|
129
|
-
return this.#ctx.run(opts, (client) => recoverProjectBranch({
|
|
137
|
+
return this.#ctx.run(opts, (client, signal) => recoverProjectBranch({
|
|
130
138
|
client,
|
|
131
139
|
path: {
|
|
132
140
|
project_id: projectId,
|
|
133
141
|
branch_id: branchId
|
|
134
142
|
},
|
|
135
|
-
throwOnError: false
|
|
143
|
+
throwOnError: false,
|
|
144
|
+
signal
|
|
136
145
|
}), (data) => data.branch);
|
|
137
146
|
}
|
|
138
147
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branches.js","names":["#ctx"],"sources":["../../../src/neon/resources/branches.ts"],"sourcesContent":["import {\n\tcreateProjectBranch,\n\tdeleteProjectBranch,\n\tfinalizeRestoreBranch,\n\tgetProjectBranch,\n\tlistProjectBranches,\n\trecoverProjectBranch,\n\tsetDefaultProjectBranch,\n\tupdateProjectBranch,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tBranch,\n\tBranchCreateRequest,\n\tBranchUpdateRequest,\n\tEndpoint,\n\tListProjectBranchesData,\n} from \"../../client/types.gen.js\";\nimport { withConnectionString } from \"../connection.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport { NeonError } from \"../errors.js\";\nimport { type Paginated, paginate } from \"../paginate.js\";\nimport { err, finalize, type NeonResult, type Outcome, ok } from \"../result.js\";\n\ntype ListQuery = Omit<NonNullable<ListProjectBranchesData[\"query\"]>, \"cursor\">;\ntype CreateInput = NonNullable<BranchCreateRequest[\"branch\"]>;\ntype UpdateInput = BranchUpdateRequest[\"branch\"];\n\n/** Per-call options for the connect/compute workflows. */\ninterface WorkflowOptions<Throw extends boolean> extends CallOptions<Throw> {\n\t/** Return a pooled connection string (default `true`). */\n\tpooled?: boolean;\n}\n\n/** Input for {@link Branches.createWithCompute}. */\nexport interface CreateWithComputeInput {\n\tname?: string;\n\t/** Parent branch id. Defaults to the project's default branch. */\n\tparentId?: string;\n\t/** Autoscaling settings for the branch's read-write endpoint. */\n\tcompute?: {\n\t\tminCu?: number;\n\t\tmaxCu?: number;\n\t\tsuspendTimeoutSeconds?: number;\n\t};\n}\n\n/** A branch with its read-write endpoint and a ready-to-use connection string. */\nexport interface BranchWithCompute {\n\tbranch: Branch;\n\tendpoint: Endpoint;\n\tconnectionString: string;\n}\n\n/** Branch resource — one API call per CRUD method, plus the `createWithCompute` workflow. */\nexport class Branches<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 (cursor-paginated) */\n\tlist(projectId: string, query?: ListQuery): Paginated<Branch> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tlistProjectBranches({\n\t\t\t\t\tclient: this.#ctx.client,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tquery: { ...query, cursor },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => ({\n\t\t\t\titems: data?.branches ?? [],\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} */\n\tget(projectId: string, branchId: string): Promise<Outcome<Branch, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProjectBranch({\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.branch,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches */\n\tcreate(\n\t\tprojectId: string,\n\t\tinput?: CreateInput,\n\t): Promise<Outcome<Branch, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tinput: CreateInput | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tinput?: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateProjectBranch({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tbody: { branch: input },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.branch,\n\t\t);\n\t}\n\n\t/** @apiCall PATCH /projects/{project_id}/branches/{branch_id} */\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: UpdateInput,\n\t): Promise<Outcome<Branch, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: UpdateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: UpdateInput,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tupdateProjectBranch({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tbody: { branch: input },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data.branch,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id} */\n\tdelete(projectId: string, branchId: string): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdeleteProjectBranch({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Create a branch **with a read-write endpoint** and return a ready-to-use connection\n\t * string. One API call (Neon creates the endpoint inline) plus readiness polling.\n\t *\n\t * @workflow createProjectBranch (with endpoint) + waitForReadiness\n\t */\n\tcreateWithCompute(\n\t\tprojectId: string,\n\t\tinput: CreateWithComputeInput,\n\t): Promise<Outcome<BranchWithCompute, DThrow>>;\n\tcreateWithCompute<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tinput: CreateWithComputeInput,\n\t\topts: WorkflowOptions<Throw>,\n\t): Promise<Outcome<BranchWithCompute, Throw>>;\n\tasync createWithCompute(\n\t\tprojectId: string,\n\t\tinput: CreateWithComputeInput,\n\t\topts?: WorkflowOptions<boolean>,\n\t): Promise<BranchWithCompute | NeonResult<BranchWithCompute>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\tconst result = await this.#ctx.execute(\n\t\t\t{ ...opts, waitForReadiness: opts?.waitForReadiness ?? true },\n\t\t\t(client) =>\n\t\t\t\tcreateProjectBranch({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tbranch: { name: input.name, parent_id: input.parentId },\n\t\t\t\t\t\tendpoints: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"read_write\",\n\t\t\t\t\t\t\t\tautoscaling_limit_min_cu: input.compute?.minCu,\n\t\t\t\t\t\t\t\tautoscaling_limit_max_cu: input.compute?.maxCu,\n\t\t\t\t\t\t\t\tsuspend_timeout_seconds:\n\t\t\t\t\t\t\t\t\tinput.compute?.suspendTimeoutSeconds,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t\tconst out = withConnectionString(\n\t\t\tresult,\n\t\t\t(data) => data.connection_uris,\n\t\t\t(data, connectionString) => ({\n\t\t\t\tbranch: data.branch,\n\t\t\t\tendpoint: data.endpoints[0],\n\t\t\t\tconnectionString,\n\t\t\t}),\n\t\t\topts?.pooled ?? true,\n\t\t);\n\t\treturn finalize(out, shouldThrow);\n\t}\n\n\t/**\n\t * Resolve the project's default branch (by the `default` flag — not by name).\n\t * Returns a `client`-kind {@link NeonError} when no default branch is found.\n\t */\n\tgetDefault(projectId: string): Promise<Outcome<Branch, DThrow>>;\n\tgetDefault<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tasync getDefault(\n\t\tprojectId: string,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\tconst result = await this.#ctx.execute(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tlistProjectBranches({\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.branches,\n\t\t);\n\t\tif (result.error)\n\t\t\treturn finalize(err<Branch>(result.error), shouldThrow);\n\t\tconst branch = result.data.find((candidate) => candidate.default);\n\t\tif (!branch) {\n\t\t\treturn finalize(\n\t\t\t\terr<Branch>(\n\t\t\t\t\tnew NeonError(\n\t\t\t\t\t\t\"No default branch found for the project.\",\n\t\t\t\t\t\t\"client\",\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tshouldThrow,\n\t\t\t);\n\t\t}\n\t\treturn finalize(ok(branch), shouldThrow);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/set_as_default */\n\tsetDefault(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<Branch, DThrow>>;\n\tsetDefault<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tsetDefault(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tsetDefaultProjectBranch({\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.branch,\n\t\t);\n\t}\n\n\t/**\n\t * Complete (commit) a restore previously started with `snapshots.restore({ finalize: false })`:\n\t * moves computes onto the restored branch and renames the replaced one. This is **only**\n\t * the second step — it does not restore anything itself.\n\t *\n\t * @apiCall POST /projects/{project_id}/branches/{branch_id}/restore/finalize\n\t */\n\tfinalizeRestore(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput?: { name?: string },\n\t): Promise<Outcome<void, DThrow>>;\n\tfinalizeRestore<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: { name?: string } | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tfinalizeRestore(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput?: { name?: string },\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tfinalizeRestoreBranch({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tbody: { name: input?.name },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t() => undefined,\n\t\t);\n\t}\n\n\t/**\n\t * Recover a soft-deleted branch within the 7-day recovery window.\n\t *\n\t * @apiCall POST /projects/{project_id}/branches/{branch_id}/recover\n\t */\n\trecover(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<Branch, DThrow>>;\n\trecover<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\trecover(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\trecoverProjectBranch({\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.branch,\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAsDA,IAAa,WAAb,MAA8C;CAC7C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;CAGA,KAAK,WAAmB,OAAsC;EAC7D,OAAO,UACL,QAAQ,WACR,oBAAoB;GACnB,QAAQ,KAAKA,KAAK;GAClB,MAAM,EAAE,YAAY,UAAU;GAC9B,OAAO;IAAE,GAAG;IAAO;GAAO;GAC1B,cAAc;GACd;EACD,CAAC,IACD,UAAU;GACV,OAAO,MAAM,YAAY,CAAC;GAC1B,QAAQ,MAAM,YAAY;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KAAK,kBACd,MAAM,sBAAsB;GAC5B,QAAQ,KAAK;GACb,UAAU,KAAK,UAAU;GACzB;EACD,IACA,MAAM,UAAU,IAEC,GAAG,WAAW;CACjC;CAWA,MAAM,WACL,WACA,MACuC;EACvC,MAAM,cACL,MAAM,gBAAgB,KAAKA,KAAK,SAAS;EAC1C,MAAM,SAAS,MAAM,KAAKA,KAAK,QAC9B,OACC,WACA,oBAAoB;GACnB;GACA,MAAM,EAAE,YAAY,UAAU;GAC9B,cAAc;EACf,CAAC,IACD,SAAS,KAAK,QAChB;EACA,IAAI,OAAO,OACV,OAAO,SAAS,IAAY,OAAO,KAAK,GAAG,WAAW;EACvD,MAAM,SAAS,OAAO,KAAK,MAAM,cAAc,UAAU,OAAO;EAChE,IAAI,CAAC,QACJ,OAAO,SACN,IACC,IAAI,UACH,4CACA,QACD,CACD,GACA,WACD;EAED,OAAO,SAAS,GAAG,MAAM,GAAG,WAAW;CACxC;CAYA,WACC,WACA,UACA,MACuC;EACvC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,wBAAwB;GACvB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,MAChB;CACD;CAoBA,gBACC,WACA,UACA,OACA,MACmC;EACnC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,sBAAsB;GACrB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM,EAAE,MAAM,OAAO,KAAK;GAC1B,cAAc;EACf,CAAC,SACI,KAAA,CACP;CACD;CAgBA,QACC,WACA,UACA,MACuC;EACvC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,qBAAqB;GACpB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,MAChB;CACD;AACD"}
|
|
1
|
+
{"version":3,"file":"branches.js","names":["#ctx"],"sources":["../../../src/neon/resources/branches.ts"],"sourcesContent":["import {\n\tcreateProjectBranch,\n\tdeleteProjectBranch,\n\tfinalizeRestoreBranch,\n\tgetProjectBranch,\n\tlistProjectBranches,\n\trecoverProjectBranch,\n\tsetDefaultProjectBranch,\n\tupdateProjectBranch,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tBranch,\n\tBranchCreateRequest,\n\tBranchUpdateRequest,\n\tEndpoint,\n\tListProjectBranchesData,\n} from \"../../client/types.gen.js\";\nimport { withConnectionString } from \"../connection.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport { NeonError } from \"../errors.js\";\nimport { type Paginated, paginate } from \"../paginate.js\";\nimport { err, finalize, type NeonResult, type Outcome, ok } from \"../result.js\";\n\ntype ListQuery = Omit<NonNullable<ListProjectBranchesData[\"query\"]>, \"cursor\">;\ntype CreateInput = NonNullable<BranchCreateRequest[\"branch\"]>;\ntype UpdateInput = BranchUpdateRequest[\"branch\"];\n\n/** Per-call options for the connect/compute workflows. */\ninterface WorkflowOptions<Throw extends boolean> extends CallOptions<Throw> {\n\t/** Return a pooled connection string (default `true`). */\n\tpooled?: boolean;\n}\n\n/** Input for {@link Branches.createWithCompute}. */\nexport interface CreateWithComputeInput {\n\tname?: string;\n\t/** Parent branch id. Defaults to the project's default branch. */\n\tparentId?: string;\n\t/** Autoscaling settings for the branch's read-write endpoint. */\n\tcompute?: {\n\t\tminCu?: number;\n\t\tmaxCu?: number;\n\t\tsuspendTimeoutSeconds?: number;\n\t};\n}\n\n/** A branch with its read-write endpoint and a ready-to-use connection string. */\nexport interface BranchWithCompute {\n\tbranch: Branch;\n\tendpoint: Endpoint;\n\tconnectionString: string;\n}\n\n/** Branch resource — one API call per CRUD method, plus the `createWithCompute` workflow. */\nexport class Branches<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 (cursor-paginated) */\n\tlist(\n\t\tprojectId: string,\n\t\tquery?: ListQuery,\n\t\topts?: CallOptions,\n\t): Paginated<Branch> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tlistProjectBranches({\n\t\t\t\t\tclient: this.#ctx.client,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tquery: { ...query, cursor },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => ({\n\t\t\t\titems: data?.branches ?? [],\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} */\n\tget(projectId: string, branchId: string): Promise<Outcome<Branch, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tgetProjectBranch({\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.branch,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches */\n\tcreate(\n\t\tprojectId: string,\n\t\tinput?: CreateInput,\n\t): Promise<Outcome<Branch, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tinput: CreateInput | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tinput?: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tcreateProjectBranch({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tbody: { branch: 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.branch,\n\t\t);\n\t}\n\n\t/** @apiCall PATCH /projects/{project_id}/branches/{branch_id} */\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: UpdateInput,\n\t): Promise<Outcome<Branch, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: UpdateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: UpdateInput,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tupdateProjectBranch({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tbody: { branch: 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.branch,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id} */\n\tdelete(projectId: string, branchId: string): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client, signal) =>\n\t\t\tdeleteProjectBranch({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\tthrowOnError: false,\n\t\t\t\tsignal,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/**\n\t * Create a branch **with a read-write endpoint** and return a ready-to-use connection\n\t * string. One API call (Neon creates the endpoint inline) plus readiness polling.\n\t *\n\t * @workflow createProjectBranch (with endpoint) + waitForReadiness\n\t */\n\tcreateWithCompute(\n\t\tprojectId: string,\n\t\tinput: CreateWithComputeInput,\n\t): Promise<Outcome<BranchWithCompute, DThrow>>;\n\tcreateWithCompute<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tinput: CreateWithComputeInput,\n\t\topts: WorkflowOptions<Throw>,\n\t): Promise<Outcome<BranchWithCompute, Throw>>;\n\tasync createWithCompute(\n\t\tprojectId: string,\n\t\tinput: CreateWithComputeInput,\n\t\topts?: WorkflowOptions<boolean>,\n\t): Promise<BranchWithCompute | NeonResult<BranchWithCompute>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\tconst result = await this.#ctx.execute(\n\t\t\t{ ...opts, waitForReadiness: opts?.waitForReadiness ?? true },\n\t\t\t(client, signal) =>\n\t\t\t\tcreateProjectBranch({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId },\n\t\t\t\t\tbody: {\n\t\t\t\t\t\tbranch: { name: input.name, parent_id: input.parentId },\n\t\t\t\t\t\tendpoints: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: \"read_write\",\n\t\t\t\t\t\t\t\tautoscaling_limit_min_cu: input.compute?.minCu,\n\t\t\t\t\t\t\t\tautoscaling_limit_max_cu: input.compute?.maxCu,\n\t\t\t\t\t\t\t\tsuspend_timeout_seconds:\n\t\t\t\t\t\t\t\t\tinput.compute?.suspendTimeoutSeconds,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t\tconst out = withConnectionString(\n\t\t\tresult,\n\t\t\t(data) => data.connection_uris,\n\t\t\t(data, connectionString) => ({\n\t\t\t\tbranch: data.branch,\n\t\t\t\tendpoint: data.endpoints[0],\n\t\t\t\tconnectionString,\n\t\t\t}),\n\t\t\topts?.pooled ?? true,\n\t\t);\n\t\treturn finalize(out, shouldThrow);\n\t}\n\n\t/**\n\t * Resolve the project's default branch (by the `default` flag — not by name).\n\t * Returns a `client`-kind {@link NeonError} when no default branch is found.\n\t */\n\tgetDefault(projectId: string): Promise<Outcome<Branch, DThrow>>;\n\tgetDefault<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tasync getDefault(\n\t\tprojectId: string,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\tconst shouldThrow =\n\t\t\topts?.throwOnError ?? this.#ctx.defaults.throwOnError;\n\t\tconst result = await this.#ctx.execute(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tlistProjectBranches({\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.branches,\n\t\t);\n\t\tif (result.error)\n\t\t\treturn finalize(err<Branch>(result.error), shouldThrow);\n\t\tconst branch = result.data.find((candidate) => candidate.default);\n\t\tif (!branch) {\n\t\t\treturn finalize(\n\t\t\t\terr<Branch>(\n\t\t\t\t\tnew NeonError(\n\t\t\t\t\t\t\"No default branch found for the project.\",\n\t\t\t\t\t\t\"client\",\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tshouldThrow,\n\t\t\t);\n\t\t}\n\t\treturn finalize(ok(branch), shouldThrow);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/set_as_default */\n\tsetDefault(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<Branch, DThrow>>;\n\tsetDefault<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\tsetDefault(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tsetDefaultProjectBranch({\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.branch,\n\t\t);\n\t}\n\n\t/**\n\t * Complete (commit) a restore previously started with `snapshots.restore({ finalize: false })`:\n\t * moves computes onto the restored branch and renames the replaced one. This is **only**\n\t * the second step — it does not restore anything itself.\n\t *\n\t * @apiCall POST /projects/{project_id}/branches/{branch_id}/restore/finalize\n\t */\n\tfinalizeRestore(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput?: { name?: string },\n\t): Promise<Outcome<void, DThrow>>;\n\tfinalizeRestore<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: { name?: string } | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tfinalizeRestore(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput?: { name?: string },\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tfinalizeRestoreBranch({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tbody: { name: input?.name },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t() => undefined,\n\t\t);\n\t}\n\n\t/**\n\t * Recover a soft-deleted branch within the 7-day recovery window.\n\t *\n\t * @apiCall POST /projects/{project_id}/branches/{branch_id}/recover\n\t */\n\trecover(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<Branch, DThrow>>;\n\trecover<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Branch, Throw>>;\n\trecover(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<Branch | NeonResult<Branch>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\trecoverProjectBranch({\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.branch,\n\t\t);\n\t}\n}\n"],"mappings":";;;;;;;AAsDA,IAAa,WAAb,MAA8C;CAC7C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;CAGA,KACC,WACA,OACA,MACoB;EACpB,OAAO,UACL,QAAQ,WACR,oBAAoB;GACnB,QAAQ,KAAKA,KAAK;GAClB,MAAM,EAAE,YAAY,UAAU;GAC9B,OAAO;IAAE,GAAG;IAAO;GAAO;GAC1B,cAAc;GACd;EACD,CAAC,IACD,UAAU;GACV,OAAO,MAAM,YAAY,CAAC;GAC1B,QAAQ,MAAM,YAAY;EAC3B,UACM,KAAKA,KAAK,YAAY,IAAI,CACjC;CACD;CASA,IACC,WACA,UACA,MACuC;EACvC,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,iBAAiB;GAChB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,MAChB;CACD;CAYA,OACC,WACA,OACA,MACuC;EACvC,OAAO,KAAKA,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KAAK,SAAS;EAC1C,MAAM,SAAS,MAAM,KAAKA,KAAK,QAC9B,OACC,QAAQ,WACR,oBAAoB;GACnB;GACA,MAAM,EAAE,YAAY,UAAU;GAC9B,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,QAChB;EACA,IAAI,OAAO,OACV,OAAO,SAAS,IAAY,OAAO,KAAK,GAAG,WAAW;EACvD,MAAM,SAAS,OAAO,KAAK,MAAM,cAAc,UAAU,OAAO;EAChE,IAAI,CAAC,QACJ,OAAO,SACN,IACC,IAAI,UACH,4CACA,QACD,CACD,GACA,WACD;EAED,OAAO,SAAS,GAAG,MAAM,GAAG,WAAW;CACxC;CAYA,WACC,WACA,UACA,MACuC;EACvC,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,wBAAwB;GACvB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,MAChB;CACD;CAoBA,gBACC,WACA,UACA,OACA,MACmC;EACnC,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,sBAAsB;GACrB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM,EAAE,MAAM,OAAO,KAAK;GAC1B,cAAc;GACd;EACD,CAAC,SACI,KAAA,CACP;CACD;CAgBA,QACC,WACA,UACA,MACuC;EACvC,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,qBAAqB;GACpB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,MAChB;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucket-objects.d.ts","names":[],"sources":["../../../src/neon/resources/bucket-objects.ts"],"mappings":";;;;;KAiBK,SAAA,GAAY,KAChB,YAAY;;AADR,cAMQ,aANC,CAAA,eAAA,OAAA,CAAA,CAAA;EAAA,CAAA,OAAA;EACD,WAAA,CA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,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,CAAA,EA8GJ,OA9GI,CA8GI,OA9GJ,CA8GY,iCA9GZ,EA8G+C,MA9G/C,CAAA,CAAA;EACY,cAAA,CAAA,cAAA,OAAA,GA8GoB,MA9GpB,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,MAAA,EAAA,MAAA,EAAA,IAAA,EAmHZ,WAnHY,CAmHA,KAnHA,CAAA,CAAA,EAoHhB,OApHgB,CAoHR,OApHQ,CAoHA,iCApHA,EAoHmC,KApHnC,CAAA,CAAA;EAA2B;EAAnC,OAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,EAAA,KAAA,EAuJH,cAvJG,CAAA,EAwJR,OAxJQ,CAwJA,OAxJA,CAwJQ,eAxJR,EAwJyB,MAxJzB,CAAA,CAAA;EAAR,OAAA,CAAA,cAAA,OAAA,GAyJ6B,MAzJ7B,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,EAAA,KAAA,EA8JK,cA9JL,EAAA,IAAA,EA+JI,WA/JJ,CA+JgB,KA/JhB,CAAA,CAAA,EAgKA,OAhKA,CAgKQ,OAhKR,CAgKgB,eAhKhB,EAgKiC,KAhKjC,CAAA,CAAA;AAkCgB"}
|
|
@@ -7,7 +7,7 @@ var BucketObjects = class {
|
|
|
7
7
|
this.#ctx = ctx;
|
|
8
8
|
}
|
|
9
9
|
list(projectId, branchId, bucketName, query, opts) {
|
|
10
|
-
return this.#ctx.run(opts, (client) => listProjectBranchBucketObjects({
|
|
10
|
+
return this.#ctx.run(opts, (client, signal) => listProjectBranchBucketObjects({
|
|
11
11
|
client,
|
|
12
12
|
path: {
|
|
13
13
|
project_id: projectId,
|
|
@@ -15,11 +15,12 @@ var BucketObjects = class {
|
|
|
15
15
|
bucket_name: bucketName
|
|
16
16
|
},
|
|
17
17
|
query,
|
|
18
|
-
throwOnError: false
|
|
18
|
+
throwOnError: false,
|
|
19
|
+
signal
|
|
19
20
|
}), (data) => data);
|
|
20
21
|
}
|
|
21
22
|
get(projectId, branchId, bucketName, objectKey, opts) {
|
|
22
|
-
return this.#ctx.run(opts, (client) => getProjectBranchBucketObject({
|
|
23
|
+
return this.#ctx.run(opts, (client, signal) => getProjectBranchBucketObject({
|
|
23
24
|
client,
|
|
24
25
|
path: {
|
|
25
26
|
project_id: projectId,
|
|
@@ -27,11 +28,12 @@ var BucketObjects = class {
|
|
|
27
28
|
bucket_name: bucketName,
|
|
28
29
|
object_key: objectKey
|
|
29
30
|
},
|
|
30
|
-
throwOnError: false
|
|
31
|
+
throwOnError: false,
|
|
32
|
+
signal
|
|
31
33
|
}), (data) => data);
|
|
32
34
|
}
|
|
33
35
|
delete(projectId, branchId, bucketName, objectKey, opts) {
|
|
34
|
-
return this.#ctx.runVoid(opts, (client) => deleteProjectBranchBucketObject({
|
|
36
|
+
return this.#ctx.runVoid(opts, (client, signal) => deleteProjectBranchBucketObject({
|
|
35
37
|
client,
|
|
36
38
|
path: {
|
|
37
39
|
project_id: projectId,
|
|
@@ -39,11 +41,12 @@ var BucketObjects = class {
|
|
|
39
41
|
bucket_name: bucketName,
|
|
40
42
|
object_key: objectKey
|
|
41
43
|
},
|
|
42
|
-
throwOnError: false
|
|
44
|
+
throwOnError: false,
|
|
45
|
+
signal
|
|
43
46
|
}));
|
|
44
47
|
}
|
|
45
48
|
deleteByPrefix(projectId, branchId, bucketName, prefix, opts) {
|
|
46
|
-
return this.#ctx.run(opts, (client) => deleteProjectBranchBucketObjectsByPrefix({
|
|
49
|
+
return this.#ctx.run(opts, (client, signal) => deleteProjectBranchBucketObjectsByPrefix({
|
|
47
50
|
client,
|
|
48
51
|
path: {
|
|
49
52
|
project_id: projectId,
|
|
@@ -51,11 +54,12 @@ var BucketObjects = class {
|
|
|
51
54
|
bucket_name: bucketName
|
|
52
55
|
},
|
|
53
56
|
query: { prefix },
|
|
54
|
-
throwOnError: false
|
|
57
|
+
throwOnError: false,
|
|
58
|
+
signal
|
|
55
59
|
}), (data) => data);
|
|
56
60
|
}
|
|
57
61
|
presign(projectId, branchId, bucketName, objectKey, input, opts) {
|
|
58
|
-
return this.#ctx.run(opts, (client) => presignProjectBranchBucketObject({
|
|
62
|
+
return this.#ctx.run(opts, (client, signal) => presignProjectBranchBucketObject({
|
|
59
63
|
client,
|
|
60
64
|
path: {
|
|
61
65
|
project_id: projectId,
|
|
@@ -64,7 +68,8 @@ var BucketObjects = class {
|
|
|
64
68
|
object_key: objectKey
|
|
65
69
|
},
|
|
66
70
|
body: input,
|
|
67
|
-
throwOnError: false
|
|
71
|
+
throwOnError: false,
|
|
72
|
+
signal
|
|
68
73
|
}), (data) => data);
|
|
69
74
|
}
|
|
70
75
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bucket-objects.js","names":["#ctx"],"sources":["../../../src/neon/resources/bucket-objects.ts"],"sourcesContent":["import {\n\tdeleteProjectBranchBucketObject,\n\tdeleteProjectBranchBucketObjectsByPrefix,\n\tgetProjectBranchBucketObject,\n\tlistProjectBranchBucketObjects,\n\tpresignProjectBranchBucketObject,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tBucketObjectsDeletePrefixResponse,\n\tBucketObjectsListResponse,\n\tListProjectBranchBucketObjectsData,\n\tPresignRequest,\n\tPresignResponse,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\ntype ListQuery = Omit<\n\tNonNullable<ListProjectBranchBucketObjectsData[\"query\"]>,\n\t\"cursor\"\n>;\n\n/** Objects inside a branch bucket. */\nexport class BucketObjects<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}/buckets/{bucket_name}/objects */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tquery?: ListQuery & { cursor?: string },\n\t): Promise<Outcome<BucketObjectsListResponse, DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tquery: (ListQuery & { cursor?: string }) | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<BucketObjectsListResponse, Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tquery?: ListQuery & { cursor?: string },\n\t\topts?: CallOptions,\n\t): Promise<\n\t\tBucketObjectsListResponse | NeonResult<BucketObjectsListResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tlistProjectBranchBucketObjects({\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\tbucket_name: bucketName,\n\t\t\t\t\t},\n\t\t\t\t\tquery,\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall GET /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key}/download */\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t): Promise<Outcome<Blob, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Blob, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\topts?: CallOptions,\n\t): Promise<Blob | NeonResult<Blob>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetProjectBranchBucketObject({\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\tbucket_name: bucketName,\n\t\t\t\t\t\tobject_key: objectKey,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdeleteProjectBranchBucketObject({\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\tbucket_name: bucketName,\n\t\t\t\t\tobject_key: objectKey,\n\t\t\t\t},\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects-by-prefix */\n\tdeleteByPrefix(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tprefix: string,\n\t): Promise<Outcome<BucketObjectsDeletePrefixResponse, DThrow>>;\n\tdeleteByPrefix<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tprefix: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<BucketObjectsDeletePrefixResponse, Throw>>;\n\tdeleteByPrefix(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tprefix: string,\n\t\topts?: CallOptions,\n\t): Promise<\n\t\t| BucketObjectsDeletePrefixResponse\n\t\t| NeonResult<BucketObjectsDeletePrefixResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tdeleteProjectBranchBucketObjectsByPrefix({\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\tbucket_name: bucketName,\n\t\t\t\t\t},\n\t\t\t\t\tquery: { prefix },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key}/presign */\n\tpresign(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\tinput: PresignRequest,\n\t): Promise<Outcome<PresignResponse, DThrow>>;\n\tpresign<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\tinput: PresignRequest,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<PresignResponse, Throw>>;\n\tpresign(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\tinput: PresignRequest,\n\t\topts?: CallOptions,\n\t): Promise<PresignResponse | NeonResult<PresignResponse>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tpresignProjectBranchBucketObject({\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\tbucket_name: bucketName,\n\t\t\t\t\t\tobject_key: objectKey,\n\t\t\t\t\t},\n\t\t\t\t\tbody: input,\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n}\n"],"mappings":";;;AAuBA,IAAa,gBAAb,MAAmD;CAClD;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAgBA,KACC,WACA,UACA,YACA,OACA,MAGC;EACD,OAAO,KAAKA,KAAK,IAChB,OACC,
|
|
1
|
+
{"version":3,"file":"bucket-objects.js","names":["#ctx"],"sources":["../../../src/neon/resources/bucket-objects.ts"],"sourcesContent":["import {\n\tdeleteProjectBranchBucketObject,\n\tdeleteProjectBranchBucketObjectsByPrefix,\n\tgetProjectBranchBucketObject,\n\tlistProjectBranchBucketObjects,\n\tpresignProjectBranchBucketObject,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tBucketObjectsDeletePrefixResponse,\n\tBucketObjectsListResponse,\n\tListProjectBranchBucketObjectsData,\n\tPresignRequest,\n\tPresignResponse,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\ntype ListQuery = Omit<\n\tNonNullable<ListProjectBranchBucketObjectsData[\"query\"]>,\n\t\"cursor\"\n>;\n\n/** Objects inside a branch bucket. */\nexport class BucketObjects<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}/buckets/{bucket_name}/objects */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tquery?: ListQuery & { cursor?: string },\n\t): Promise<Outcome<BucketObjectsListResponse, DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tquery: (ListQuery & { cursor?: string }) | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<BucketObjectsListResponse, Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tquery?: ListQuery & { cursor?: string },\n\t\topts?: CallOptions,\n\t): Promise<\n\t\tBucketObjectsListResponse | NeonResult<BucketObjectsListResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tlistProjectBranchBucketObjects({\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\tbucket_name: bucketName,\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\t/** @apiCall GET /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key}/download */\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t): Promise<Outcome<Blob, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Blob, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\topts?: CallOptions,\n\t): Promise<Blob | NeonResult<Blob>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tgetProjectBranchBucketObject({\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\tbucket_name: bucketName,\n\t\t\t\t\t\tobject_key: objectKey,\n\t\t\t\t\t},\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client, signal) =>\n\t\t\tdeleteProjectBranchBucketObject({\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\tbucket_name: bucketName,\n\t\t\t\t\tobject_key: objectKey,\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 DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects-by-prefix */\n\tdeleteByPrefix(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tprefix: string,\n\t): Promise<Outcome<BucketObjectsDeletePrefixResponse, DThrow>>;\n\tdeleteByPrefix<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tprefix: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<BucketObjectsDeletePrefixResponse, Throw>>;\n\tdeleteByPrefix(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tprefix: string,\n\t\topts?: CallOptions,\n\t): Promise<\n\t\t| BucketObjectsDeletePrefixResponse\n\t\t| NeonResult<BucketObjectsDeletePrefixResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tdeleteProjectBranchBucketObjectsByPrefix({\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\tbucket_name: bucketName,\n\t\t\t\t\t},\n\t\t\t\t\tquery: { prefix },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t\tsignal,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key}/presign */\n\tpresign(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\tinput: PresignRequest,\n\t): Promise<Outcome<PresignResponse, DThrow>>;\n\tpresign<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\tinput: PresignRequest,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<PresignResponse, Throw>>;\n\tpresign(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\tobjectKey: string,\n\t\tinput: PresignRequest,\n\t\topts?: CallOptions,\n\t): Promise<PresignResponse | NeonResult<PresignResponse>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tpresignProjectBranchBucketObject({\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\tbucket_name: bucketName,\n\t\t\t\t\t\tobject_key: objectKey,\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,\n\t\t);\n\t}\n}\n"],"mappings":";;;AAuBA,IAAa,gBAAb,MAAmD;CAClD;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAgBA,KACC,WACA,UACA,YACA,OACA,MAGC;EACD,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,+BAA+B;GAC9B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;GACd;GACA;GACA,cAAc;GACd;EACD,CAAC,IACD,SAAS,IACX;CACD;CAgBA,IACC,WACA,UACA,YACA,WACA,MACmC;EACnC,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,6BAA6B;GAC5B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;IACb,YAAY;GACb;GACA,cAAc;GACd;EACD,CAAC,IACD,SAAS,IACX;CACD;CAgBA,OACC,WACA,UACA,YACA,WACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,QAAQ,WACvC,gCAAgC;GAC/B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;IACb,YAAY;GACb;GACA,cAAc;GACd;EACD,CAAC,CACF;CACD;CAgBA,eACC,WACA,UACA,YACA,QACA,MAIC;EACD,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,yCAAyC;GACxC;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;GACd;GACA,OAAO,EAAE,OAAO;GAChB,cAAc;GACd;EACD,CAAC,IACD,SAAS,IACX;CACD;CAkBA,QACC,WACA,UACA,YACA,WACA,OACA,MACyD;EACzD,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,iCAAiC;GAChC;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;IACb,YAAY;GACb;GACA,MAAM;GACN,cAAc;GACd;EACD,CAAC,IACD,SAAS,IACX;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buckets.d.ts","names":[],"sources":["../../../src/neon/resources/buckets.ts"],"mappings":";;;;;KAaK,WAAA,GAAc;;AAAd,cAGQ,OAHG,CAAA,eAAG,OAAmB,CAAA,CAAA;EAGzB,CAAA,OAAA;EAAO,WAAA,CAAA,GAAA,EAGF,cAHE;EAGF;EAQE,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,CAAA,EAAhB,OAAgB,CAAR,OAAQ,CAAA,MAAA,EAAA,EAAU,MAAV,CAAA,CAAA;EAAU,IAAA,CAAA,cAAA,OAAA,GACA,MADA,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAItB,WAJsB,CAIV,KAJU,CAAA,CAAA,EAK1B,OAL0B,CAKlB,OALkB,CAKV,MALU,EAAA,EAKA,KALA,CAAA,CAAA;EAAlB;EAAR,MAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,KAAA,
|
|
1
|
+
{"version":3,"file":"buckets.d.ts","names":[],"sources":["../../../src/neon/resources/buckets.ts"],"mappings":";;;;;KAaK,WAAA,GAAc;;AAAd,cAGQ,OAHG,CAAA,eAAG,OAAmB,CAAA,CAAA;EAGzB,CAAA,OAAA;EAAO,WAAA,CAAA,GAAA,EAGF,cAHE;EAGF;EAQE,IAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,CAAA,EAAhB,OAAgB,CAAR,OAAQ,CAAA,MAAA,EAAA,EAAU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jectBranchBuckets({
|
|
10
|
+
return this.#ctx.run(opts, (client, signal) => listProjectBranchBuckets({
|
|
11
11
|
client,
|
|
12
12
|
path: {
|
|
13
13
|
project_id: projectId,
|
|
14
14
|
branch_id: branchId
|
|
15
15
|
},
|
|
16
|
-
throwOnError: false
|
|
16
|
+
throwOnError: false,
|
|
17
|
+
signal
|
|
17
18
|
}), (data) => data.buckets);
|
|
18
19
|
}
|
|
19
20
|
create(projectId, branchId, input, opts) {
|
|
20
|
-
return this.#ctx.run(opts, (client) => createProjectBranchBucket({
|
|
21
|
+
return this.#ctx.run(opts, (client, signal) => createProjectBranchBucket({
|
|
21
22
|
client,
|
|
22
23
|
path: {
|
|
23
24
|
project_id: projectId,
|
|
24
25
|
branch_id: branchId
|
|
25
26
|
},
|
|
26
27
|
body: input,
|
|
27
|
-
throwOnError: false
|
|
28
|
+
throwOnError: false,
|
|
29
|
+
signal
|
|
28
30
|
}), (data) => data.bucket);
|
|
29
31
|
}
|
|
30
32
|
delete(projectId, branchId, bucketName, opts) {
|
|
31
|
-
return this.#ctx.runVoid(opts, (client) => deleteProjectBranchBucket({
|
|
33
|
+
return this.#ctx.runVoid(opts, (client, signal) => deleteProjectBranchBucket({
|
|
32
34
|
client,
|
|
33
35
|
path: {
|
|
34
36
|
project_id: projectId,
|
|
35
37
|
branch_id: branchId,
|
|
36
38
|
bucket_name: bucketName
|
|
37
39
|
},
|
|
38
|
-
throwOnError: false
|
|
40
|
+
throwOnError: false,
|
|
41
|
+
signal
|
|
39
42
|
}));
|
|
40
43
|
}
|
|
41
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buckets.js","names":["#ctx"],"sources":["../../../src/neon/resources/buckets.ts"],"sourcesContent":["import {\n\tcreateProjectBranchBucket,\n\tdeleteProjectBranchBucket,\n\tlistProjectBranchBuckets,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tBucket,\n\tBucketAccessLevel,\n\tBucketCreateRequest,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\ntype CreateInput = BucketCreateRequest;\n\n/** Branch-scoped object-storage buckets. */\nexport class Buckets<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}/buckets */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<Bucket[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Bucket[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<Bucket[] | NeonResult<Bucket[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tlistProjectBranchBuckets({\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.buckets,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/buckets */\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t): Promise<Outcome<Bucket, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Bucket, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<Bucket | NeonResult<Bucket>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateProjectBranchBucket({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\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.bucket,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdeleteProjectBranchBucket({\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\tbucket_name: bucketName,\n\t\t\t\t},\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n}\n\nexport type { BucketAccessLevel };\n"],"mappings":";;;AAgBA,IAAa,UAAb,MAA6C;CAC5C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAYA,KACC,WACA,UACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,
|
|
1
|
+
{"version":3,"file":"buckets.js","names":["#ctx"],"sources":["../../../src/neon/resources/buckets.ts"],"sourcesContent":["import {\n\tcreateProjectBranchBucket,\n\tdeleteProjectBranchBucket,\n\tlistProjectBranchBuckets,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tBucket,\n\tBucketAccessLevel,\n\tBucketCreateRequest,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\ntype CreateInput = BucketCreateRequest;\n\n/** Branch-scoped object-storage buckets. */\nexport class Buckets<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}/buckets */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<Bucket[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Bucket[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<Bucket[] | NeonResult<Bucket[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tlistProjectBranchBuckets({\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.buckets,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/buckets */\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t): Promise<Outcome<Bucket, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<Bucket, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<Bucket | NeonResult<Bucket>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tcreateProjectBranchBucket({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\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.bucket,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tbucketName: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client, signal) =>\n\t\t\tdeleteProjectBranchBucket({\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\tbucket_name: bucketName,\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\nexport type { BucketAccessLevel };\n"],"mappings":";;;AAgBA,IAAa,UAAb,MAA6C;CAC5C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAYA,KACC,WACA,UACA,MAC2C;EAC3C,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,yBAAyB;GACxB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,OAChB;CACD;CAcA,OACC,WACA,UACA,OACA,MACuC;EACvC,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,0BAA0B;GACzB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM;GACN,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,MAChB;CACD;CAcA,OACC,WACA,UACA,YACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,QAAQ,WACvC,0BAA0B;GACzB;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;GACd;GACA,cAAc;GACd;EACD,CAAC,CACF;CACD;AACD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ConsumptionHistoryPerBranchV2, ConsumptionHistoryPerProject, ConsumptionHistoryPerProjectV2, GetConsumptionHistoryPerBranchV2Data, GetConsumptionHistoryPerProjectData, GetConsumptionHistoryPerProjectV2Data } from "../../client/types.gen.js";
|
|
2
|
-
import { RequestContext } from "../context.js";
|
|
2
|
+
import { CallOptions, RequestContext } from "../context.js";
|
|
3
3
|
import { Paginated } from "../paginate.js";
|
|
4
4
|
|
|
5
5
|
//#region src/neon/resources/consumption.d.ts
|
|
@@ -11,11 +11,11 @@ declare class Consumption {
|
|
|
11
11
|
#private;
|
|
12
12
|
constructor(ctx: RequestContext);
|
|
13
13
|
/** @apiCall GET /consumption_history/projects */
|
|
14
|
-
perProject(query: PerProjectQuery): Paginated<ConsumptionHistoryPerProject>;
|
|
14
|
+
perProject(query: PerProjectQuery, opts?: CallOptions): Paginated<ConsumptionHistoryPerProject>;
|
|
15
15
|
/** @apiCall GET /consumption_history/v2/projects */
|
|
16
|
-
perProjectV2(query: PerProjectV2Query): Paginated<ConsumptionHistoryPerProjectV2>;
|
|
16
|
+
perProjectV2(query: PerProjectV2Query, opts?: CallOptions): Paginated<ConsumptionHistoryPerProjectV2>;
|
|
17
17
|
/** @apiCall GET /consumption_history/v2/branches */
|
|
18
|
-
perBranchV2(query: PerBranchV2Query): Paginated<ConsumptionHistoryPerBranchV2>;
|
|
18
|
+
perBranchV2(query: PerBranchV2Query, opts?: CallOptions): Paginated<ConsumptionHistoryPerBranchV2>;
|
|
19
19
|
}
|
|
20
20
|
//#endregion
|
|
21
21
|
export { Consumption };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumption.d.ts","names":[],"sources":["../../../src/neon/resources/consumption.ts"],"mappings":";;;;;KAgBK,eAAA,GAAkB,KACtB;KAGI,iBAAA,GAAoB,KACxB;AAPyD,KAUrD,gBAAA,GAAmB,IARJ,CASnB,oCATmB,CAAA,OAAA,CAAA,EAAA,QAAA,CAAA;AAAA;AACnB,cAaY,WAAA,CAbZ;EADsB,CAAA,OAAA;EAAI,WAAA,CAAA,GAAA,EAiBT,cAjBS;EAItB;EAAiB,UAAA,CAAA,KAAA,EAmBb,eAnBa,CAAA,
|
|
1
|
+
{"version":3,"file":"consumption.d.ts","names":[],"sources":["../../../src/neon/resources/consumption.ts"],"mappings":";;;;;KAgBK,eAAA,GAAkB,KACtB;KAGI,iBAAA,GAAoB,KACxB;AAPyD,KAUrD,gBAAA,GAAmB,IARJ,CASnB,oCATmB,CAAA,OAAA,CAAA,EAAA,QAAA,CAAA;AAAA;AACnB,cAaY,WAAA,CAbZ;EADsB,CAAA,OAAA;EAAI,WAAA,CAAA,GAAA,EAiBT,cAjBS;EAItB;EAAiB,UAAA,CAAA,KAAA,EAmBb,eAnBa,EAAA,IAAA,CAAA,EAoBb,WApBa,CAAA,EAqBlB,SArBkB,CAqBR,4BArBQ,CAAA;EACrB;EADwB,YAAA,CAAA,KAAA,EAwChB,iBAxCgB,EAAA,IAAA,CAAA,EAyChB,WAzCgB,CAAA,EA0CrB,SA1CqB,CA0CX,8BA1CW,CAAA;EAAI;EAIxB,WAAA,CAAA,KAAA,EAyDI,gBAzDY,EAAA,IAAA,CAAA,EA0DZ,WA1DY,CAAA,EA2DjB,SA3DiB,CA2DP,6BA3DO,CAAA;AAAA"}
|
|
@@ -8,7 +8,7 @@ var Consumption = class {
|
|
|
8
8
|
this.#ctx = ctx;
|
|
9
9
|
}
|
|
10
10
|
/** @apiCall GET /consumption_history/projects */
|
|
11
|
-
perProject(query) {
|
|
11
|
+
perProject(query, opts) {
|
|
12
12
|
return paginate((cursor, signal) => getConsumptionHistoryPerProject({
|
|
13
13
|
client: this.#ctx.client,
|
|
14
14
|
query: {
|
|
@@ -20,10 +20,10 @@ var Consumption = class {
|
|
|
20
20
|
}), (data) => ({
|
|
21
21
|
items: data?.projects ?? [],
|
|
22
22
|
cursor: data?.pagination?.cursor
|
|
23
|
-
}));
|
|
23
|
+
}), () => this.#ctx.deadlineFor(opts));
|
|
24
24
|
}
|
|
25
25
|
/** @apiCall GET /consumption_history/v2/projects */
|
|
26
|
-
perProjectV2(query) {
|
|
26
|
+
perProjectV2(query, opts) {
|
|
27
27
|
return paginate((cursor, signal) => getConsumptionHistoryPerProjectV2({
|
|
28
28
|
client: this.#ctx.client,
|
|
29
29
|
query: {
|
|
@@ -35,10 +35,10 @@ var Consumption = class {
|
|
|
35
35
|
}), (data) => ({
|
|
36
36
|
items: data?.projects ?? [],
|
|
37
37
|
cursor: data?.pagination?.cursor
|
|
38
|
-
}));
|
|
38
|
+
}), () => this.#ctx.deadlineFor(opts));
|
|
39
39
|
}
|
|
40
40
|
/** @apiCall GET /consumption_history/v2/branches */
|
|
41
|
-
perBranchV2(query) {
|
|
41
|
+
perBranchV2(query, opts) {
|
|
42
42
|
return paginate((cursor, signal) => getConsumptionHistoryPerBranchV2({
|
|
43
43
|
client: this.#ctx.client,
|
|
44
44
|
query: {
|
|
@@ -50,7 +50,7 @@ var Consumption = class {
|
|
|
50
50
|
}), (data) => ({
|
|
51
51
|
items: data?.branches ?? [],
|
|
52
52
|
cursor: data?.pagination?.cursor
|
|
53
|
-
}));
|
|
53
|
+
}), () => this.#ctx.deadlineFor(opts));
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
56
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consumption.js","names":["#ctx"],"sources":["../../../src/neon/resources/consumption.ts"],"sourcesContent":["import {\n\tgetConsumptionHistoryPerBranchV2,\n\tgetConsumptionHistoryPerProject,\n\tgetConsumptionHistoryPerProjectV2,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tConsumptionHistoryPerBranchV2,\n\tConsumptionHistoryPerProject,\n\tConsumptionHistoryPerProjectV2,\n\tGetConsumptionHistoryPerBranchV2Data,\n\tGetConsumptionHistoryPerProjectData,\n\tGetConsumptionHistoryPerProjectV2Data,\n} from \"../../client/types.gen.js\";\nimport type { RequestContext } from \"../context.js\";\nimport { type Paginated, paginate } from \"../paginate.js\";\n\ntype PerProjectQuery = Omit<\n\tGetConsumptionHistoryPerProjectData[\"query\"],\n\t\"cursor\"\n>;\ntype PerProjectV2Query = Omit<\n\tGetConsumptionHistoryPerProjectV2Data[\"query\"],\n\t\"cursor\"\n>;\ntype PerBranchV2Query = Omit<\n\tGetConsumptionHistoryPerBranchV2Data[\"query\"],\n\t\"cursor\"\n>;\n\n/** Consumption history (cursor-paginated). */\nexport class Consumption {\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\t/** @apiCall GET /consumption_history/projects */\n\tperProject(\n\t\tquery: PerProjectQuery,\n\t): Paginated<ConsumptionHistoryPerProject> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tgetConsumptionHistoryPerProject({\n\t\t\t\t\tclient: this.#ctx.client,\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?.projects ?? [],\n\t\t\t\tcursor: data?.pagination?.cursor,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall GET /consumption_history/v2/projects */\n\tperProjectV2(\n\t\tquery: PerProjectV2Query,\n\t): Paginated<ConsumptionHistoryPerProjectV2> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tgetConsumptionHistoryPerProjectV2({\n\t\t\t\t\tclient: this.#ctx.client,\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?.projects ?? [],\n\t\t\t\tcursor: data?.pagination?.cursor,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall GET /consumption_history/v2/branches */\n\tperBranchV2(\n\t\tquery: PerBranchV2Query,\n\t): Paginated<ConsumptionHistoryPerBranchV2> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tgetConsumptionHistoryPerBranchV2({\n\t\t\t\t\tclient: this.#ctx.client,\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?.branches ?? [],\n\t\t\t\tcursor: data?.pagination?.cursor,\n\t\t\t}),\n\t\t);\n\t}\n}\n"],"mappings":";;;;AA8BA,IAAa,cAAb,MAAyB;CACxB;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;CAGA,WACC,
|
|
1
|
+
{"version":3,"file":"consumption.js","names":["#ctx"],"sources":["../../../src/neon/resources/consumption.ts"],"sourcesContent":["import {\n\tgetConsumptionHistoryPerBranchV2,\n\tgetConsumptionHistoryPerProject,\n\tgetConsumptionHistoryPerProjectV2,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tConsumptionHistoryPerBranchV2,\n\tConsumptionHistoryPerProject,\n\tConsumptionHistoryPerProjectV2,\n\tGetConsumptionHistoryPerBranchV2Data,\n\tGetConsumptionHistoryPerProjectData,\n\tGetConsumptionHistoryPerProjectV2Data,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport { type Paginated, paginate } from \"../paginate.js\";\n\ntype PerProjectQuery = Omit<\n\tGetConsumptionHistoryPerProjectData[\"query\"],\n\t\"cursor\"\n>;\ntype PerProjectV2Query = Omit<\n\tGetConsumptionHistoryPerProjectV2Data[\"query\"],\n\t\"cursor\"\n>;\ntype PerBranchV2Query = Omit<\n\tGetConsumptionHistoryPerBranchV2Data[\"query\"],\n\t\"cursor\"\n>;\n\n/** Consumption history (cursor-paginated). */\nexport class Consumption {\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\t/** @apiCall GET /consumption_history/projects */\n\tperProject(\n\t\tquery: PerProjectQuery,\n\t\topts?: CallOptions,\n\t): Paginated<ConsumptionHistoryPerProject> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tgetConsumptionHistoryPerProject({\n\t\t\t\t\tclient: this.#ctx.client,\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?.projects ?? [],\n\t\t\t\tcursor: data?.pagination?.cursor,\n\t\t\t}),\n\t\t\t() => this.#ctx.deadlineFor(opts),\n\t\t);\n\t}\n\n\t/** @apiCall GET /consumption_history/v2/projects */\n\tperProjectV2(\n\t\tquery: PerProjectV2Query,\n\t\topts?: CallOptions,\n\t): Paginated<ConsumptionHistoryPerProjectV2> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tgetConsumptionHistoryPerProjectV2({\n\t\t\t\t\tclient: this.#ctx.client,\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?.projects ?? [],\n\t\t\t\tcursor: data?.pagination?.cursor,\n\t\t\t}),\n\t\t\t() => this.#ctx.deadlineFor(opts),\n\t\t);\n\t}\n\n\t/** @apiCall GET /consumption_history/v2/branches */\n\tperBranchV2(\n\t\tquery: PerBranchV2Query,\n\t\topts?: CallOptions,\n\t): Paginated<ConsumptionHistoryPerBranchV2> {\n\t\treturn paginate(\n\t\t\t(cursor, signal) =>\n\t\t\t\tgetConsumptionHistoryPerBranchV2({\n\t\t\t\t\tclient: this.#ctx.client,\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?.branches ?? [],\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"],"mappings":";;;;AA8BA,IAAa,cAAb,MAAyB;CACxB;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;CAGA,WACC,OACA,MAC0C;EAC1C,OAAO,UACL,QAAQ,WACR,gCAAgC;GAC/B,QAAQ,KAAKA,KAAK;GAClB,OAAO;IAAE,GAAG;IAAO;GAAO;GAC1B,cAAc;GACd;EACD,CAAC,IACD,UAAU;GACV,OAAO,MAAM,YAAY,CAAC;GAC1B,QAAQ,MAAM,YAAY;EAC3B,UACM,KAAKA,KAAK,YAAY,IAAI,CACjC;CACD;;CAGA,aACC,OACA,MAC4C;EAC5C,OAAO,UACL,QAAQ,WACR,kCAAkC;GACjC,QAAQ,KAAKA,KAAK;GAClB,OAAO;IAAE,GAAG;IAAO;GAAO;GAC1B,cAAc;GACd;EACD,CAAC,IACD,UAAU;GACV,OAAO,MAAM,YAAY,CAAC;GAC1B,QAAQ,MAAM,YAAY;EAC3B,UACM,KAAKA,KAAK,YAAY,IAAI,CACjC;CACD;;CAGA,YACC,OACA,MAC2C;EAC3C,OAAO,UACL,QAAQ,WACR,iCAAiC;GAChC,QAAQ,KAAKA,KAAK;GAClB,OAAO;IAAE,GAAG;IAAO;GAAO;GAC1B,cAAc;GACd;EACD,CAAC,IACD,UAAU;GACV,OAAO,MAAM,YAAY,CAAC;GAC1B,QAAQ,MAAM,YAAY;EAC3B,UACM,KAAKA,KAAK,YAAY,IAAI,CACjC;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","names":[],"sources":["../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AA,MAAA,EAAA,KAAA,EA4BK,WA5BL,CAAA,EA6BA,OA7BA,CA6BQ,OA7BR,CA6BgB,wBA7BhB,EA6B0C,MA7B1C,CAAA,CAAA;EAC0B,MAAA,CAAA,cAAA,OAAA,GA6BE,MA7BF,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,KAAA,EAgCrB,WAhCqB,EAAA,IAAA,EAiCtB,WAjCsB,CAiCV,KAjCU,CAAA,CAAA,EAkC1B,OAlC0B,CAkClB,OAlCkB,CAkCV,wBAlCU,EAkCgB,KAlChB,CAAA,CAAA;EAGV;EAAZ,MAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EA2DJ,OA3DI,CA2DI,OA3DJ,CAAA,IAAA,EA2DkB,MA3DlB,CAAA,CAAA;EACY,MAAA,CAAA,cAAA,OAAA,GA2DY,MA3DZ,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,IAAA,EA+DZ,WA/DY,CA+DA,KA/DA,CAAA,CAAA,EAgEhB,OAhEgB,CAgER,OAhEQ,CAAA,IAAA,EAgEM,KAhEN,CAAA,CAAA;AAAkB"}
|
|
@@ -7,35 +7,38 @@ var Credentials = class {
|
|
|
7
7
|
this.#ctx = ctx;
|
|
8
8
|
}
|
|
9
9
|
list(projectId, branchId, opts) {
|
|
10
|
-
return this.#ctx.run(opts, (client) => listCredentials({
|
|
10
|
+
return this.#ctx.run(opts, (client, signal) => listCredentials({
|
|
11
11
|
client,
|
|
12
12
|
path: {
|
|
13
13
|
project_id: projectId,
|
|
14
14
|
branch_id: branchId
|
|
15
15
|
},
|
|
16
|
-
throwOnError: false
|
|
16
|
+
throwOnError: false,
|
|
17
|
+
signal
|
|
17
18
|
}), (data) => data.credentials);
|
|
18
19
|
}
|
|
19
20
|
create(projectId, branchId, input, opts) {
|
|
20
|
-
return this.#ctx.run(opts, (client) => createCredential({
|
|
21
|
+
return this.#ctx.run(opts, (client, signal) => createCredential({
|
|
21
22
|
client,
|
|
22
23
|
path: {
|
|
23
24
|
project_id: projectId,
|
|
24
25
|
branch_id: branchId
|
|
25
26
|
},
|
|
26
27
|
body: input,
|
|
27
|
-
throwOnError: false
|
|
28
|
+
throwOnError: false,
|
|
29
|
+
signal
|
|
28
30
|
}), (data) => data);
|
|
29
31
|
}
|
|
30
32
|
revoke(projectId, branchId, tokenId, opts) {
|
|
31
|
-
return this.#ctx.runVoid(opts, (client) => revokeCredential({
|
|
33
|
+
return this.#ctx.runVoid(opts, (client, signal) => revokeCredential({
|
|
32
34
|
client,
|
|
33
35
|
path: {
|
|
34
36
|
project_id: projectId,
|
|
35
37
|
branch_id: branchId,
|
|
36
38
|
token_id: tokenId
|
|
37
39
|
},
|
|
38
|
-
throwOnError: false
|
|
40
|
+
throwOnError: false,
|
|
41
|
+
signal
|
|
39
42
|
}));
|
|
40
43
|
}
|
|
41
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.js","names":["#ctx"],"sources":["../../../src/neon/resources/credentials.ts"],"sourcesContent":["import {\n\tcreateCredential,\n\tlistCredentials,\n\trevokeCredential,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tCreateCredentialRequest,\n\tCreateCredentialResponse,\n\tCredentialMeta,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\ntype CreateInput = CreateCredentialRequest;\n\n/** Branch-scoped scoped credentials. */\nexport class Credentials<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}/credentials */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<CredentialMeta[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<CredentialMeta[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<CredentialMeta[] | NeonResult<CredentialMeta[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tlistCredentials({\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.credentials,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/credentials */\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t): Promise<Outcome<CreateCredentialResponse, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<CreateCredentialResponse, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<\n\t\tCreateCredentialResponse | NeonResult<CreateCredentialResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateCredential({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tbody: input,\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/credentials/{token_id} */\n\trevoke(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\ttokenId: string,\n\t): Promise<Outcome<void, DThrow>>;\n\trevoke<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\ttokenId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\trevoke(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\ttokenId: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\trevokeCredential({\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\ttoken_id: tokenId,\n\t\t\t\t},\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n}\n"],"mappings":";;;AAgBA,IAAa,cAAb,MAAiD;CAChD;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAYA,KACC,WACA,UACA,MAC2D;EAC3D,OAAO,KAAKA,KAAK,IAChB,OACC,
|
|
1
|
+
{"version":3,"file":"credentials.js","names":["#ctx"],"sources":["../../../src/neon/resources/credentials.ts"],"sourcesContent":["import {\n\tcreateCredential,\n\tlistCredentials,\n\trevokeCredential,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tCreateCredentialRequest,\n\tCreateCredentialResponse,\n\tCredentialMeta,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\ntype CreateInput = CreateCredentialRequest;\n\n/** Branch-scoped scoped credentials. */\nexport class Credentials<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}/credentials */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<CredentialMeta[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<CredentialMeta[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<CredentialMeta[] | NeonResult<CredentialMeta[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tlistCredentials({\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.credentials,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/credentials */\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t): Promise<Outcome<CreateCredentialResponse, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<CreateCredentialResponse, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateInput,\n\t\topts?: CallOptions,\n\t): Promise<\n\t\tCreateCredentialResponse | NeonResult<CreateCredentialResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client, signal) =>\n\t\t\t\tcreateCredential({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\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,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/credentials/{token_id} */\n\trevoke(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\ttokenId: string,\n\t): Promise<Outcome<void, DThrow>>;\n\trevoke<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\ttokenId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\trevoke(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\ttokenId: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client, signal) =>\n\t\t\trevokeCredential({\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\ttoken_id: tokenId,\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"],"mappings":";;;AAgBA,IAAa,cAAb,MAAiD;CAChD;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAYA,KACC,WACA,UACA,MAC2D;EAC3D,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,gBAAgB;GACf;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;GACd;EACD,CAAC,IACD,SAAS,KAAK,WAChB;CACD;CAcA,OACC,WACA,UACA,OACA,MAGC;EACD,OAAO,KAAKA,KAAK,IAChB,OACC,QAAQ,WACR,iBAAiB;GAChB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM;GACN,cAAc;GACd;EACD,CAAC,IACD,SAAS,IACX;CACD;CAcA,OACC,WACA,UACA,SACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,QAAQ,WACvC,iBAAiB;GAChB;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,UAAU;GACX;GACA,cAAc;GACd;EACD,CAAC,CACF;CACD;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataapi.d.ts","names":[],"sources":["../../../src/neon/resources/dataapi.ts"],"mappings":";;;;;;cAgBa;EAAA,CAAA,OAAA;EAAO,WAAA,CAAA,GAAA,EAGF,cAHE;EAGF;EASE,GAA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