@neon/sdk 0.1.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +133 -5
- package/dist/_virtual/_rolldown/runtime.js +2 -1
- package/dist/client/core/pathSerializer.gen.d.ts.map +1 -1
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.js +2 -2
- package/dist/client/raw.gen.d.ts +4282 -0
- package/dist/client/raw.gen.d.ts.map +1 -0
- package/dist/client/raw.gen.js +170 -0
- package/dist/client/raw.gen.js.map +1 -0
- package/dist/client/sdk.gen.d.ts +252 -2
- package/dist/client/sdk.gen.d.ts.map +1 -1
- package/dist/client/sdk.gen.js +634 -1
- package/dist/client/sdk.gen.js.map +1 -1
- package/dist/client/types.gen.d.ts +2602 -1530
- package/dist/client/types.gen.d.ts.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/neon/client.d.ts +10 -0
- package/dist/neon/client.d.ts.map +1 -1
- package/dist/neon/client.js +10 -0
- package/dist/neon/client.js.map +1 -1
- package/dist/neon/client.test-d.d.ts +1 -0
- package/dist/neon/client.test-d.js +93 -0
- package/dist/neon/client.test-d.js.map +1 -0
- package/dist/neon/coverage.d.ts.map +1 -1
- package/dist/neon/coverage.js +57 -0
- package/dist/neon/coverage.js.map +1 -1
- package/dist/neon/raw-wrap.d.ts +63 -0
- package/dist/neon/raw-wrap.d.ts.map +1 -0
- package/dist/neon/raw-wrap.js +47 -0
- package/dist/neon/raw-wrap.js.map +1 -0
- package/dist/neon/resources/ai-gateway.d.ts +16 -0
- package/dist/neon/resources/ai-gateway.d.ts.map +1 -0
- package/dist/neon/resources/ai-gateway.js +23 -0
- package/dist/neon/resources/ai-gateway.js.map +1 -0
- package/dist/neon/resources/auth.d.ts +81 -0
- package/dist/neon/resources/auth.d.ts.map +1 -0
- package/dist/neon/resources/auth.js +197 -0
- package/dist/neon/resources/auth.js.map +1 -0
- package/dist/neon/resources/branches.d.ts +7 -0
- package/dist/neon/resources/branches.d.ts.map +1 -1
- package/dist/neon/resources/branches.js +11 -1
- package/dist/neon/resources/branches.js.map +1 -1
- package/dist/neon/resources/bucket-objects.d.ts +33 -0
- package/dist/neon/resources/bucket-objects.d.ts.map +1 -0
- package/dist/neon/resources/bucket-objects.js +74 -0
- package/dist/neon/resources/bucket-objects.js.map +1 -0
- package/dist/neon/resources/buckets.d.ts +23 -0
- package/dist/neon/resources/buckets.d.ts.map +1 -0
- package/dist/neon/resources/buckets.js +45 -0
- package/dist/neon/resources/buckets.js.map +1 -0
- package/dist/neon/resources/credentials.d.ts +23 -0
- package/dist/neon/resources/credentials.d.ts.map +1 -0
- package/dist/neon/resources/credentials.js +45 -0
- package/dist/neon/resources/credentials.js.map +1 -0
- package/dist/neon/resources/endpoints.d.ts +3 -0
- package/dist/neon/resources/endpoints.d.ts.map +1 -1
- package/dist/neon/resources/endpoints.js +11 -1
- package/dist/neon/resources/endpoints.js.map +1 -1
- package/dist/neon/resources/functions.d.ts +30 -0
- package/dist/neon/resources/functions.d.ts.map +1 -0
- package/dist/neon/resources/functions.js +79 -0
- package/dist/neon/resources/functions.js.map +1 -0
- package/dist/neon/resources/postgres.d.ts +1 -1
- package/dist/neon/resources/postgres.js.map +1 -1
- package/dist/neon/resources/projects.d.ts +26 -2
- package/dist/neon/resources/projects.d.ts.map +1 -1
- package/dist/neon/resources/projects.js +44 -2
- package/dist/neon/resources/projects.js.map +1 -1
- package/dist/neon/resources/storage.d.ts +24 -0
- package/dist/neon/resources/storage.d.ts.map +1 -0
- package/dist/neon/resources/storage.js +32 -0
- package/dist/neon/resources/storage.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js +879 -0
- package/dist/node_modules/.pnpm/@vitest_pretty-format@3.0.9/node_modules/@vitest/pretty-format/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js +30 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/chunk-tasks.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js +579 -0
- package/dist/node_modules/.pnpm/@vitest_runner@3.0.9/node_modules/@vitest/runner/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js +92 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js +43 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/helpers.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js +450 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js +168 -0
- package/dist/node_modules/.pnpm/@vitest_utils@3.0.9/node_modules/@vitest/utils/dist/source-map.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js +10 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/branding.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js +109 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/index.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js +10 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/messages.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js +10 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/overloads.js.map +1 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js +10 -0
- package/dist/node_modules/.pnpm/expect-type@1.2.1/node_modules/expect-type/dist/utils.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js +11 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/arguments.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js +16 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/array.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js +11 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/bigint.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js +15 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/class.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js +13 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/date.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js +34 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/error.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js +12 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/function.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js +122 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/helpers.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js +39 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/html.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js +99 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/index.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js +25 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/map.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js +14 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/number.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js +21 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/object.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js +6 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/promise.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js +12 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/regexp.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js +18 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/set.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js +24 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/string.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js +9 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/symbol.js.map +1 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js +30 -0
- package/dist/node_modules/.pnpm/loupe@3.2.1/node_modules/loupe/lib/typedarray.js.map +1 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js +82 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/chunk-BVHSVHOK.js.map +1 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js +7 -0
- package/dist/node_modules/.pnpm/tinyrainbow@2.0.0/node_modules/tinyrainbow/dist/node.js.map +1 -0
- package/dist/node_modules/.pnpm/vitest@3.0.9_@types_debug@4.1.13_@types_node@20.19.17_jiti@2.7.0_jsdom@26.1.0_lightning_fb7ae83398b95c49208c9194029bba02/node_modules/vitest/dist/index.js +8 -0
- package/dist/node_modules/.pnpm/vitest@3.0.9_@types_debug@4.1.13_@types_node@20.19.17_jiti@2.7.0_jsdom@26.1.0_lightning_fb7ae83398b95c49208c9194029bba02/node_modules/vitest/dist/index.js.map +1 -0
- package/dist/raw.d.ts +4 -3
- package/dist/raw.js +24 -3
- package/dist/raw.js.map +1 -1
- package/package.json +4 -3
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { CreateBranchNeonAuthNewUserRequest, EnableNeonAuthIntegrationRequest, NeonAuthAddDomainToRedirectUriWhitelistRequest, NeonAuthAddOAuthProviderRequest, NeonAuthConfigResponse, NeonAuthConfigUpdate, NeonAuthCreateIntegrationResponse, NeonAuthCreateNewUserResponse, NeonAuthDeleteDomainFromRedirectUriWhitelistRequest, NeonAuthIntegration, NeonAuthOauthProvider, NeonAuthOauthProviderId, NeonAuthRedirectUriWhitelistDomain, NeonAuthUpdateOAuthProviderRequest, UpdateNeonAuthUserRoleResponse } from "../../client/types.gen.js";
|
|
2
|
+
import { Outcome } from "../result.js";
|
|
3
|
+
import { CallOptions, RequestContext } from "../context.js";
|
|
4
|
+
|
|
5
|
+
//#region src/neon/resources/auth.d.ts
|
|
6
|
+
/** Branch-scoped Neon Auth OAuth providers (Google, GitHub, …). */
|
|
7
|
+
declare class AuthOauthProviders<DThrow extends boolean> {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(ctx: RequestContext);
|
|
10
|
+
/** @apiCall GET /projects/{project_id}/branches/{branch_id}/auth/oauth_providers */
|
|
11
|
+
list(projectId: string, branchId: string): Promise<Outcome<NeonAuthOauthProvider[], DThrow>>;
|
|
12
|
+
list<Throw extends boolean = DThrow>(projectId: string, branchId: string, opts: CallOptions<Throw>): Promise<Outcome<NeonAuthOauthProvider[], Throw>>;
|
|
13
|
+
/** @apiCall POST /projects/{project_id}/branches/{branch_id}/auth/oauth_providers */
|
|
14
|
+
add(projectId: string, branchId: string, input: NeonAuthAddOAuthProviderRequest): Promise<Outcome<NeonAuthOauthProvider, DThrow>>;
|
|
15
|
+
add<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: NeonAuthAddOAuthProviderRequest, opts: CallOptions<Throw>): Promise<Outcome<NeonAuthOauthProvider, Throw>>;
|
|
16
|
+
/** @apiCall PATCH …/auth/oauth_providers/{oauth_provider_id} */
|
|
17
|
+
update(projectId: string, branchId: string, providerId: NeonAuthOauthProviderId, input: NeonAuthUpdateOAuthProviderRequest): Promise<Outcome<NeonAuthOauthProvider, DThrow>>;
|
|
18
|
+
update<Throw extends boolean = DThrow>(projectId: string, branchId: string, providerId: NeonAuthOauthProviderId, input: NeonAuthUpdateOAuthProviderRequest, opts: CallOptions<Throw>): Promise<Outcome<NeonAuthOauthProvider, Throw>>;
|
|
19
|
+
/** @apiCall DELETE …/auth/oauth_providers/{oauth_provider_id} */
|
|
20
|
+
delete(projectId: string, branchId: string, providerId: NeonAuthOauthProviderId): Promise<Outcome<void, DThrow>>;
|
|
21
|
+
delete<Throw extends boolean = DThrow>(projectId: string, branchId: string, providerId: NeonAuthOauthProviderId, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
|
|
22
|
+
}
|
|
23
|
+
/** Branch-scoped Neon Auth trusted domains (redirect URI whitelist). */
|
|
24
|
+
declare class AuthTrustedDomains<DThrow extends boolean> {
|
|
25
|
+
#private;
|
|
26
|
+
constructor(ctx: RequestContext);
|
|
27
|
+
/** @apiCall GET …/auth/trusted_domains */
|
|
28
|
+
list(projectId: string, branchId: string): Promise<Outcome<NeonAuthRedirectUriWhitelistDomain[], DThrow>>;
|
|
29
|
+
list<Throw extends boolean = DThrow>(projectId: string, branchId: string, opts: CallOptions<Throw>): Promise<Outcome<NeonAuthRedirectUriWhitelistDomain[], Throw>>;
|
|
30
|
+
/** @apiCall POST …/auth/trusted_domains */
|
|
31
|
+
add(projectId: string, branchId: string, input: NeonAuthAddDomainToRedirectUriWhitelistRequest): Promise<Outcome<void, DThrow>>;
|
|
32
|
+
add<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: NeonAuthAddDomainToRedirectUriWhitelistRequest, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
|
|
33
|
+
/** @apiCall DELETE …/auth/trusted_domains */
|
|
34
|
+
delete(projectId: string, branchId: string, input: NeonAuthDeleteDomainFromRedirectUriWhitelistRequest): Promise<Outcome<void, DThrow>>;
|
|
35
|
+
delete<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: NeonAuthDeleteDomainFromRedirectUriWhitelistRequest, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
|
|
36
|
+
}
|
|
37
|
+
/** Branch-scoped Neon Auth users. */
|
|
38
|
+
declare class AuthUsers<DThrow extends boolean> {
|
|
39
|
+
#private;
|
|
40
|
+
constructor(ctx: RequestContext);
|
|
41
|
+
/** @apiCall POST …/auth/users */
|
|
42
|
+
create(projectId: string, branchId: string, input: CreateBranchNeonAuthNewUserRequest): Promise<Outcome<NeonAuthCreateNewUserResponse, DThrow>>;
|
|
43
|
+
create<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: CreateBranchNeonAuthNewUserRequest, opts: CallOptions<Throw>): Promise<Outcome<NeonAuthCreateNewUserResponse, Throw>>;
|
|
44
|
+
/** @apiCall DELETE …/auth/users/{auth_user_id} */
|
|
45
|
+
delete(projectId: string, branchId: string, authUserId: string): Promise<Outcome<void, DThrow>>;
|
|
46
|
+
delete<Throw extends boolean = DThrow>(projectId: string, branchId: string, authUserId: string, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
|
|
47
|
+
/** @apiCall PATCH …/auth/users/{auth_user_id}/role */
|
|
48
|
+
updateRole(projectId: string, branchId: string, authUserId: string, roles: string[]): Promise<Outcome<UpdateNeonAuthUserRoleResponse, DThrow>>;
|
|
49
|
+
updateRole<Throw extends boolean = DThrow>(projectId: string, branchId: string, authUserId: string, roles: string[], opts: CallOptions<Throw>): Promise<Outcome<UpdateNeonAuthUserRoleResponse, Throw>>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Branch-scoped Neon Auth. Enable/disable the integration, tune its config, and manage
|
|
53
|
+
* OAuth providers, trusted domains, and users. The legacy project-scoped auth endpoints are
|
|
54
|
+
* deprecated and stay raw-only.
|
|
55
|
+
*/
|
|
56
|
+
declare class Auth<DThrow extends boolean> {
|
|
57
|
+
#private;
|
|
58
|
+
readonly oauthProviders: AuthOauthProviders<DThrow>;
|
|
59
|
+
readonly trustedDomains: AuthTrustedDomains<DThrow>;
|
|
60
|
+
readonly users: AuthUsers<DThrow>;
|
|
61
|
+
constructor(ctx: RequestContext);
|
|
62
|
+
/** @apiCall GET /projects/{project_id}/branches/{branch_id}/auth */
|
|
63
|
+
get(projectId: string, branchId: string): Promise<Outcome<NeonAuthIntegration, DThrow>>;
|
|
64
|
+
get<Throw extends boolean = DThrow>(projectId: string, branchId: string, opts: CallOptions<Throw>): Promise<Outcome<NeonAuthIntegration, Throw>>;
|
|
65
|
+
/** @apiCall POST /projects/{project_id}/branches/{branch_id}/auth */
|
|
66
|
+
create(projectId: string, branchId: string, input: EnableNeonAuthIntegrationRequest): Promise<Outcome<NeonAuthCreateIntegrationResponse, DThrow>>;
|
|
67
|
+
create<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: EnableNeonAuthIntegrationRequest, opts: CallOptions<Throw>): Promise<Outcome<NeonAuthCreateIntegrationResponse, Throw>>;
|
|
68
|
+
/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/auth */
|
|
69
|
+
disable(projectId: string, branchId: string, input?: {
|
|
70
|
+
deleteData?: boolean;
|
|
71
|
+
}): Promise<Outcome<void, DThrow>>;
|
|
72
|
+
disable<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: {
|
|
73
|
+
deleteData?: boolean;
|
|
74
|
+
} | undefined, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
|
|
75
|
+
/** @apiCall PATCH /projects/{project_id}/branches/{branch_id}/auth/config */
|
|
76
|
+
updateConfig(projectId: string, branchId: string, input: NeonAuthConfigUpdate): Promise<Outcome<NeonAuthConfigResponse, DThrow>>;
|
|
77
|
+
updateConfig<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: NeonAuthConfigUpdate, opts: CallOptions<Throw>): Promise<Outcome<NeonAuthConfigResponse, Throw>>;
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { Auth, AuthOauthProviders, AuthTrustedDomains, AuthUsers };
|
|
81
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../src/neon/resources/auth.ts"],"mappings":";;;;;;cAqCa;EAAA,CAAA,OAAA;EAAkB,WAAA,CAAA,GAAA,EAGb,cAHa;;MAWX,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,CAAA,EAAhB,OAAgB,CAAR,OAAQ,CAAA,qBAAA,EAAA,EAAyB,MAAzB,CAAA,CAAA;MAAyB,CAAA,cAAA,OAAA,GACf,MADe,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAIrC,WAJqC,CAIzB,KAJyB,CAAA,CAAA,EAKzC,OALyC,CAKjC,OALiC,CAKzB,qBALyB,EAAA,EAKA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I,CA6PQ,KA7PR,CAAA,CAAA,EA8PR,OA9PQ,CA8PA,OA9PA,CA8PQ,iCA9PR,EA8P2C,KA9P3C,CAAA,CAAA;;SACkB,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,MAAA,EAAA;IAGV,UAAA,CAAA,EAAA,OAAA;MAsRhB,OAtRI,CAsRI,OAtRJ,CAAA,IAAA,EAsRkB,MAtRlB,CAAA,CAAA;SACY,CAAA,cAAA,OAAA,GAsRa,MAtRb,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,KAAA,EAAA;IAAsC,UAAA,CAAA,EAAA,OAAA;MAA9C,SAAA,EAAA,IAAA,EA0RJ,WA1RI,CA0RQ,KA1RR,CAAA,CAAA,EA2RR,OA3RQ,CA2RA,OA3RA,CAAA,IAAA,EA2Rc,KA3Rd,CAAA,CAAA;;cAyBH,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,KAAA,EAuRA,oBAvRA,CAAA,EAwRL,OAxRK,CAwRG,OAxRH,CAwRW,sBAxRX,EAwRmC,MAxRnC,CAAA,CAAA;cACiB,CAAA,cAAA,OAAA,GAwRY,MAxRZ,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,KAAA,EA2RjB,oBA3RiB,EAAA,IAAA,EA4RlB,WA5RkB,CA4RN,KA5RM,CAAA,CAAA,EA6RtB,OA7RsB,CA6Rd,OA7Rc,CA6RN,sBA7RM,EA6RkB,KA7RlB,CAAA,CAAA"}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { addBranchNeonAuthOauthProvider, addBranchNeonAuthTrustedDomain, createBranchNeonAuthNewUser, createNeonAuth, deleteBranchNeonAuthOauthProvider, deleteBranchNeonAuthTrustedDomain, deleteBranchNeonAuthUser, disableNeonAuth, getNeonAuth, listBranchNeonAuthOauthProviders, listBranchNeonAuthTrustedDomains, updateBranchNeonAuthOauthProvider, updateNeonAuthConfig, updateNeonAuthUserRole } from "../../client/sdk.gen.js";
|
|
2
|
+
//#region src/neon/resources/auth.ts
|
|
3
|
+
/** Branch-scoped Neon Auth OAuth providers (Google, GitHub, …). */
|
|
4
|
+
var AuthOauthProviders = class {
|
|
5
|
+
#ctx;
|
|
6
|
+
constructor(ctx) {
|
|
7
|
+
this.#ctx = ctx;
|
|
8
|
+
}
|
|
9
|
+
list(projectId, branchId, opts) {
|
|
10
|
+
return this.#ctx.run(opts, (client) => listBranchNeonAuthOauthProviders({
|
|
11
|
+
client,
|
|
12
|
+
path: {
|
|
13
|
+
project_id: projectId,
|
|
14
|
+
branch_id: branchId
|
|
15
|
+
},
|
|
16
|
+
throwOnError: false
|
|
17
|
+
}), (data) => data.providers);
|
|
18
|
+
}
|
|
19
|
+
add(projectId, branchId, input, opts) {
|
|
20
|
+
return this.#ctx.run(opts, (client) => addBranchNeonAuthOauthProvider({
|
|
21
|
+
client,
|
|
22
|
+
path: {
|
|
23
|
+
project_id: projectId,
|
|
24
|
+
branch_id: branchId
|
|
25
|
+
},
|
|
26
|
+
body: input,
|
|
27
|
+
throwOnError: false
|
|
28
|
+
}), (data) => data);
|
|
29
|
+
}
|
|
30
|
+
update(projectId, branchId, providerId, input, opts) {
|
|
31
|
+
return this.#ctx.run(opts, (client) => updateBranchNeonAuthOauthProvider({
|
|
32
|
+
client,
|
|
33
|
+
path: {
|
|
34
|
+
project_id: projectId,
|
|
35
|
+
branch_id: branchId,
|
|
36
|
+
oauth_provider_id: providerId
|
|
37
|
+
},
|
|
38
|
+
body: input,
|
|
39
|
+
throwOnError: false
|
|
40
|
+
}), (data) => data);
|
|
41
|
+
}
|
|
42
|
+
delete(projectId, branchId, providerId, opts) {
|
|
43
|
+
return this.#ctx.runVoid(opts, (client) => deleteBranchNeonAuthOauthProvider({
|
|
44
|
+
client,
|
|
45
|
+
path: {
|
|
46
|
+
project_id: projectId,
|
|
47
|
+
branch_id: branchId,
|
|
48
|
+
oauth_provider_id: providerId
|
|
49
|
+
},
|
|
50
|
+
throwOnError: false
|
|
51
|
+
}));
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
/** Branch-scoped Neon Auth trusted domains (redirect URI whitelist). */
|
|
55
|
+
var AuthTrustedDomains = class {
|
|
56
|
+
#ctx;
|
|
57
|
+
constructor(ctx) {
|
|
58
|
+
this.#ctx = ctx;
|
|
59
|
+
}
|
|
60
|
+
list(projectId, branchId, opts) {
|
|
61
|
+
return this.#ctx.run(opts, (client) => listBranchNeonAuthTrustedDomains({
|
|
62
|
+
client,
|
|
63
|
+
path: {
|
|
64
|
+
project_id: projectId,
|
|
65
|
+
branch_id: branchId
|
|
66
|
+
},
|
|
67
|
+
throwOnError: false
|
|
68
|
+
}), (data) => data.domains);
|
|
69
|
+
}
|
|
70
|
+
add(projectId, branchId, input, opts) {
|
|
71
|
+
return this.#ctx.runVoid(opts, (client) => addBranchNeonAuthTrustedDomain({
|
|
72
|
+
client,
|
|
73
|
+
path: {
|
|
74
|
+
project_id: projectId,
|
|
75
|
+
branch_id: branchId
|
|
76
|
+
},
|
|
77
|
+
body: input,
|
|
78
|
+
throwOnError: false
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
delete(projectId, branchId, input, opts) {
|
|
82
|
+
return this.#ctx.runVoid(opts, (client) => deleteBranchNeonAuthTrustedDomain({
|
|
83
|
+
client,
|
|
84
|
+
path: {
|
|
85
|
+
project_id: projectId,
|
|
86
|
+
branch_id: branchId
|
|
87
|
+
},
|
|
88
|
+
body: input,
|
|
89
|
+
throwOnError: false
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
/** Branch-scoped Neon Auth users. */
|
|
94
|
+
var AuthUsers = class {
|
|
95
|
+
#ctx;
|
|
96
|
+
constructor(ctx) {
|
|
97
|
+
this.#ctx = ctx;
|
|
98
|
+
}
|
|
99
|
+
create(projectId, branchId, input, opts) {
|
|
100
|
+
return this.#ctx.run(opts, (client) => createBranchNeonAuthNewUser({
|
|
101
|
+
client,
|
|
102
|
+
path: {
|
|
103
|
+
project_id: projectId,
|
|
104
|
+
branch_id: branchId
|
|
105
|
+
},
|
|
106
|
+
body: input,
|
|
107
|
+
throwOnError: false
|
|
108
|
+
}), (data) => data);
|
|
109
|
+
}
|
|
110
|
+
delete(projectId, branchId, authUserId, opts) {
|
|
111
|
+
return this.#ctx.runVoid(opts, (client) => deleteBranchNeonAuthUser({
|
|
112
|
+
client,
|
|
113
|
+
path: {
|
|
114
|
+
project_id: projectId,
|
|
115
|
+
branch_id: branchId,
|
|
116
|
+
auth_user_id: authUserId
|
|
117
|
+
},
|
|
118
|
+
throwOnError: false
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
updateRole(projectId, branchId, authUserId, roles, opts) {
|
|
122
|
+
return this.#ctx.run(opts, (client) => updateNeonAuthUserRole({
|
|
123
|
+
client,
|
|
124
|
+
path: {
|
|
125
|
+
project_id: projectId,
|
|
126
|
+
branch_id: branchId,
|
|
127
|
+
auth_user_id: authUserId
|
|
128
|
+
},
|
|
129
|
+
body: { roles },
|
|
130
|
+
throwOnError: false
|
|
131
|
+
}), (data) => data);
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Branch-scoped Neon Auth. Enable/disable the integration, tune its config, and manage
|
|
136
|
+
* OAuth providers, trusted domains, and users. The legacy project-scoped auth endpoints are
|
|
137
|
+
* deprecated and stay raw-only.
|
|
138
|
+
*/
|
|
139
|
+
var Auth = class {
|
|
140
|
+
#ctx;
|
|
141
|
+
oauthProviders;
|
|
142
|
+
trustedDomains;
|
|
143
|
+
users;
|
|
144
|
+
constructor(ctx) {
|
|
145
|
+
this.#ctx = ctx;
|
|
146
|
+
this.oauthProviders = new AuthOauthProviders(ctx);
|
|
147
|
+
this.trustedDomains = new AuthTrustedDomains(ctx);
|
|
148
|
+
this.users = new AuthUsers(ctx);
|
|
149
|
+
}
|
|
150
|
+
get(projectId, branchId, opts) {
|
|
151
|
+
return this.#ctx.run(opts, (client) => getNeonAuth({
|
|
152
|
+
client,
|
|
153
|
+
path: {
|
|
154
|
+
project_id: projectId,
|
|
155
|
+
branch_id: branchId
|
|
156
|
+
},
|
|
157
|
+
throwOnError: false
|
|
158
|
+
}), (data) => data);
|
|
159
|
+
}
|
|
160
|
+
create(projectId, branchId, input, opts) {
|
|
161
|
+
return this.#ctx.run(opts, (client) => createNeonAuth({
|
|
162
|
+
client,
|
|
163
|
+
path: {
|
|
164
|
+
project_id: projectId,
|
|
165
|
+
branch_id: branchId
|
|
166
|
+
},
|
|
167
|
+
body: input,
|
|
168
|
+
throwOnError: false
|
|
169
|
+
}), (data) => data);
|
|
170
|
+
}
|
|
171
|
+
disable(projectId, branchId, input, opts) {
|
|
172
|
+
return this.#ctx.runVoid(opts, (client) => disableNeonAuth({
|
|
173
|
+
client,
|
|
174
|
+
path: {
|
|
175
|
+
project_id: projectId,
|
|
176
|
+
branch_id: branchId
|
|
177
|
+
},
|
|
178
|
+
body: { delete_data: input?.deleteData },
|
|
179
|
+
throwOnError: false
|
|
180
|
+
}));
|
|
181
|
+
}
|
|
182
|
+
updateConfig(projectId, branchId, input, opts) {
|
|
183
|
+
return this.#ctx.run(opts, (client) => updateNeonAuthConfig({
|
|
184
|
+
client,
|
|
185
|
+
path: {
|
|
186
|
+
project_id: projectId,
|
|
187
|
+
branch_id: branchId
|
|
188
|
+
},
|
|
189
|
+
body: input,
|
|
190
|
+
throwOnError: false
|
|
191
|
+
}), (data) => data);
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
//#endregion
|
|
195
|
+
export { Auth, AuthOauthProviders, AuthTrustedDomains, AuthUsers };
|
|
196
|
+
|
|
197
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","names":["#ctx"],"sources":["../../../src/neon/resources/auth.ts"],"sourcesContent":["import {\n\taddBranchNeonAuthOauthProvider,\n\taddBranchNeonAuthTrustedDomain,\n\tcreateBranchNeonAuthNewUser,\n\tcreateNeonAuth,\n\tdeleteBranchNeonAuthOauthProvider,\n\tdeleteBranchNeonAuthTrustedDomain,\n\tdeleteBranchNeonAuthUser,\n\tdisableNeonAuth,\n\tgetNeonAuth,\n\tlistBranchNeonAuthOauthProviders,\n\tlistBranchNeonAuthTrustedDomains,\n\tupdateBranchNeonAuthOauthProvider,\n\tupdateNeonAuthConfig,\n\tupdateNeonAuthUserRole,\n} from \"../../client/sdk.gen.js\";\nimport type {\n\tCreateBranchNeonAuthNewUserRequest,\n\tEnableNeonAuthIntegrationRequest,\n\tNeonAuthAddDomainToRedirectUriWhitelistRequest,\n\tNeonAuthAddOAuthProviderRequest,\n\tNeonAuthConfigResponse,\n\tNeonAuthConfigUpdate,\n\tNeonAuthCreateIntegrationResponse,\n\tNeonAuthCreateNewUserResponse,\n\tNeonAuthDeleteDomainFromRedirectUriWhitelistRequest,\n\tNeonAuthIntegration,\n\tNeonAuthOauthProvider,\n\tNeonAuthOauthProviderId,\n\tNeonAuthRedirectUriWhitelistDomain,\n\tNeonAuthUpdateOAuthProviderRequest,\n\tUpdateNeonAuthUserRoleResponse,\n} from \"../../client/types.gen.js\";\nimport type { CallOptions, RequestContext } from \"../context.js\";\nimport type { NeonResult, Outcome } from \"../result.js\";\n\n/** Branch-scoped Neon Auth OAuth providers (Google, GitHub, …). */\nexport class AuthOauthProviders<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}/auth/oauth_providers */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<NeonAuthOauthProvider[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonAuthOauthProvider[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<NeonAuthOauthProvider[] | NeonResult<NeonAuthOauthProvider[]>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tlistBranchNeonAuthOauthProviders({\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.providers,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/auth/oauth_providers */\n\tadd(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthAddOAuthProviderRequest,\n\t): Promise<Outcome<NeonAuthOauthProvider, DThrow>>;\n\tadd<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthAddOAuthProviderRequest,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonAuthOauthProvider, Throw>>;\n\tadd(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthAddOAuthProviderRequest,\n\t\topts?: CallOptions,\n\t): Promise<NeonAuthOauthProvider | NeonResult<NeonAuthOauthProvider>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\taddBranchNeonAuthOauthProvider({\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 PATCH …/auth/oauth_providers/{oauth_provider_id} */\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tproviderId: NeonAuthOauthProviderId,\n\t\tinput: NeonAuthUpdateOAuthProviderRequest,\n\t): Promise<Outcome<NeonAuthOauthProvider, DThrow>>;\n\tupdate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tproviderId: NeonAuthOauthProviderId,\n\t\tinput: NeonAuthUpdateOAuthProviderRequest,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonAuthOauthProvider, Throw>>;\n\tupdate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tproviderId: NeonAuthOauthProviderId,\n\t\tinput: NeonAuthUpdateOAuthProviderRequest,\n\t\topts?: CallOptions,\n\t): Promise<NeonAuthOauthProvider | NeonResult<NeonAuthOauthProvider>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tupdateBranchNeonAuthOauthProvider({\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\toauth_provider_id: providerId,\n\t\t\t\t\t},\n\t\t\t\t\tbody: input,\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall DELETE …/auth/oauth_providers/{oauth_provider_id} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tproviderId: NeonAuthOauthProviderId,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tproviderId: NeonAuthOauthProviderId,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tproviderId: NeonAuthOauthProviderId,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdeleteBranchNeonAuthOauthProvider({\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\toauth_provider_id: providerId,\n\t\t\t\t},\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n}\n\n/** Branch-scoped Neon Auth trusted domains (redirect URI whitelist). */\nexport class AuthTrustedDomains<DThrow extends boolean> {\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\t/** @apiCall GET …/auth/trusted_domains */\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<NeonAuthRedirectUriWhitelistDomain[], DThrow>>;\n\tlist<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonAuthRedirectUriWhitelistDomain[], Throw>>;\n\tlist(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<\n\t\t| NeonAuthRedirectUriWhitelistDomain[]\n\t\t| NeonResult<NeonAuthRedirectUriWhitelistDomain[]>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tlistBranchNeonAuthTrustedDomains({\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.domains,\n\t\t);\n\t}\n\n\t/** @apiCall POST …/auth/trusted_domains */\n\tadd(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthAddDomainToRedirectUriWhitelistRequest,\n\t): Promise<Outcome<void, DThrow>>;\n\tadd<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthAddDomainToRedirectUriWhitelistRequest,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tadd(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthAddDomainToRedirectUriWhitelistRequest,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\taddBranchNeonAuthTrustedDomain({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\tbody: input,\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall DELETE …/auth/trusted_domains */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthDeleteDomainFromRedirectUriWhitelistRequest,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthDeleteDomainFromRedirectUriWhitelistRequest,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthDeleteDomainFromRedirectUriWhitelistRequest,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdeleteBranchNeonAuthTrustedDomain({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\tbody: input,\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n}\n\n/** Branch-scoped Neon Auth users. */\nexport class AuthUsers<DThrow extends boolean> {\n\treadonly #ctx: RequestContext;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t}\n\n\t/** @apiCall POST …/auth/users */\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateBranchNeonAuthNewUserRequest,\n\t): Promise<Outcome<NeonAuthCreateNewUserResponse, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateBranchNeonAuthNewUserRequest,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonAuthCreateNewUserResponse, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: CreateBranchNeonAuthNewUserRequest,\n\t\topts?: CallOptions,\n\t): Promise<\n\t\t| NeonAuthCreateNewUserResponse\n\t\t| NeonResult<NeonAuthCreateNewUserResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateBranchNeonAuthNewUser({\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 …/auth/users/{auth_user_id} */\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tauthUserId: string,\n\t): Promise<Outcome<void, DThrow>>;\n\tdelete<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tauthUserId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdelete(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tauthUserId: string,\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdeleteBranchNeonAuthUser({\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\tauth_user_id: authUserId,\n\t\t\t\t},\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall PATCH …/auth/users/{auth_user_id}/role */\n\tupdateRole(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tauthUserId: string,\n\t\troles: string[],\n\t): Promise<Outcome<UpdateNeonAuthUserRoleResponse, DThrow>>;\n\tupdateRole<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tauthUserId: string,\n\t\troles: string[],\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<UpdateNeonAuthUserRoleResponse, Throw>>;\n\tupdateRole(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tauthUserId: string,\n\t\troles: string[],\n\t\topts?: CallOptions,\n\t): Promise<\n\t\t| UpdateNeonAuthUserRoleResponse\n\t\t| NeonResult<UpdateNeonAuthUserRoleResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tupdateNeonAuthUserRole({\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\tauth_user_id: authUserId,\n\t\t\t\t\t},\n\t\t\t\t\tbody: { roles },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n}\n\n/**\n * Branch-scoped Neon Auth. Enable/disable the integration, tune its config, and manage\n * OAuth providers, trusted domains, and users. The legacy project-scoped auth endpoints are\n * deprecated and stay raw-only.\n */\nexport class Auth<DThrow extends boolean> {\n\treadonly #ctx: RequestContext;\n\treadonly oauthProviders: AuthOauthProviders<DThrow>;\n\treadonly trustedDomains: AuthTrustedDomains<DThrow>;\n\treadonly users: AuthUsers<DThrow>;\n\n\tconstructor(ctx: RequestContext) {\n\t\tthis.#ctx = ctx;\n\t\tthis.oauthProviders = new AuthOauthProviders<DThrow>(ctx);\n\t\tthis.trustedDomains = new AuthTrustedDomains<DThrow>(ctx);\n\t\tthis.users = new AuthUsers<DThrow>(ctx);\n\t}\n\n\t/** @apiCall GET /projects/{project_id}/branches/{branch_id}/auth */\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t): Promise<Outcome<NeonAuthIntegration, DThrow>>;\n\tget<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonAuthIntegration, Throw>>;\n\tget(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\topts?: CallOptions,\n\t): Promise<NeonAuthIntegration | NeonResult<NeonAuthIntegration>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tgetNeonAuth({\n\t\t\t\t\tclient,\n\t\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\t\tthrowOnError: false,\n\t\t\t\t}),\n\t\t\t(data) => data,\n\t\t);\n\t}\n\n\t/** @apiCall POST /projects/{project_id}/branches/{branch_id}/auth */\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: EnableNeonAuthIntegrationRequest,\n\t): Promise<Outcome<NeonAuthCreateIntegrationResponse, DThrow>>;\n\tcreate<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: EnableNeonAuthIntegrationRequest,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonAuthCreateIntegrationResponse, Throw>>;\n\tcreate(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: EnableNeonAuthIntegrationRequest,\n\t\topts?: CallOptions,\n\t): Promise<\n\t\t| NeonAuthCreateIntegrationResponse\n\t\t| NeonResult<NeonAuthCreateIntegrationResponse>\n\t> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tcreateNeonAuth({\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}/auth */\n\tdisable(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput?: { deleteData?: boolean },\n\t): Promise<Outcome<void, DThrow>>;\n\tdisable<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: { deleteData?: boolean } | undefined,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<void, Throw>>;\n\tdisable(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput?: { deleteData?: boolean },\n\t\topts?: CallOptions,\n\t): Promise<void | NeonResult<void>> {\n\t\treturn this.#ctx.runVoid(opts, (client) =>\n\t\t\tdisableNeonAuth({\n\t\t\t\tclient,\n\t\t\t\tpath: { project_id: projectId, branch_id: branchId },\n\t\t\t\tbody: { delete_data: input?.deleteData },\n\t\t\t\tthrowOnError: false,\n\t\t\t}),\n\t\t);\n\t}\n\n\t/** @apiCall PATCH /projects/{project_id}/branches/{branch_id}/auth/config */\n\tupdateConfig(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthConfigUpdate,\n\t): Promise<Outcome<NeonAuthConfigResponse, DThrow>>;\n\tupdateConfig<Throw extends boolean = DThrow>(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthConfigUpdate,\n\t\topts: CallOptions<Throw>,\n\t): Promise<Outcome<NeonAuthConfigResponse, Throw>>;\n\tupdateConfig(\n\t\tprojectId: string,\n\t\tbranchId: string,\n\t\tinput: NeonAuthConfigUpdate,\n\t\topts?: CallOptions,\n\t): Promise<NeonAuthConfigResponse | NeonResult<NeonAuthConfigResponse>> {\n\t\treturn this.#ctx.run(\n\t\t\topts,\n\t\t\t(client) =>\n\t\t\t\tupdateNeonAuthConfig({\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"],"mappings":";;;AAqCA,IAAa,qBAAb,MAAwD;CACvD;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAYA,KACC,WACA,UACA,MACyE;EACzE,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,iCAAiC;GAChC;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,SAChB;CACD;CAcA,IACC,WACA,UACA,OACA,MACqE;EACrE,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,+BAA+B;GAC9B;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM;GACN,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;CAgBA,OACC,WACA,UACA,YACA,OACA,MACqE;EACrE,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,kCAAkC;GACjC;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,mBAAmB;GACpB;GACA,MAAM;GACN,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;CAcA,OACC,WACA,UACA,YACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,WAC/B,kCAAkC;GACjC;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,mBAAmB;GACpB;GACA,cAAc;EACf,CAAC,CACF;CACD;AACD;;AAGA,IAAa,qBAAb,MAAwD;CACvD;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;CAYA,KACC,WACA,UACA,MAIC;EACD,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,iCAAiC;GAChC;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,OAChB;CACD;CAcA,IACC,WACA,UACA,OACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,WAC/B,+BAA+B;GAC9B;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM;GACN,cAAc;EACf,CAAC,CACF;CACD;CAcA,OACC,WACA,UACA,OACA,MACmC;EACnC,OAAO,KAAK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d;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM;GACN,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;CAcA,QACC,WACA,UACA,OACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,WAC/B,gBAAgB;GACf;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM,EAAE,aAAa,OAAO,WAAW;GACvC,cAAc;EACf,CAAC,CACF;CACD;CAcA,aACC,WACA,UACA,OACA,MACuE;EACvE,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,qBAAqB;GACpB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM;GACN,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;AACD"}
|
|
@@ -78,6 +78,13 @@ declare class Branches<DThrow extends boolean> {
|
|
|
78
78
|
finalizeRestore<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: {
|
|
79
79
|
name?: string;
|
|
80
80
|
} | undefined, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
|
|
81
|
+
/**
|
|
82
|
+
* Recover a soft-deleted branch within the 7-day recovery window.
|
|
83
|
+
*
|
|
84
|
+
* @apiCall POST /projects/{project_id}/branches/{branch_id}/recover
|
|
85
|
+
*/
|
|
86
|
+
recover(projectId: string, branchId: string): Promise<Outcome<Branch, DThrow>>;
|
|
87
|
+
recover<Throw extends boolean = DThrow>(projectId: string, branchId: string, opts: CallOptions<Throw>): Promise<Outcome<Branch, Throw>>;
|
|
81
88
|
}
|
|
82
89
|
//#endregion
|
|
83
90
|
export { BranchWithCompute, Branches, CreateWithComputeInput };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branches.d.ts","names":[],"sources":["../../../src/neon/resources/branches.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"branches.d.ts","names":[],"sources":["../../../src/neon/resources/branches.ts"],"mappings":";;;;;;KAuBK,SAAA,GAAY,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CA+JI,OA/JJ,CAAA,IAAA,EA+JkB,KA/JlB,CAAA,CAAA;;;;;;SAyB+B,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,CAAA,EAkKnC,OAlKmC,CAkK3B,OAlK2B,CAkKnB,MAlKmB,EAkKX,MAlKW,CAAA,CAAA;SAA3B,CAAA,cAAA,OAAA,GAmKqB,MAnKrB,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,IAAA,EAsKJ,WAtKI,CAsKQ,KAtKR,CAAA,CAAA,EAuKR,OAvKQ,CAuKA,OAvKA,CAuKQ,MAvKR,EAuKgB,KAvKhB,CAAA,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NeonError } from "../errors.js";
|
|
2
2
|
import { err, finalize, ok } from "../result.js";
|
|
3
|
-
import { createProjectBranch, deleteProjectBranch, finalizeRestoreBranch, getProjectBranch, listProjectBranches, setDefaultProjectBranch, updateProjectBranch } from "../../client/sdk.gen.js";
|
|
3
|
+
import { createProjectBranch, deleteProjectBranch, finalizeRestoreBranch, getProjectBranch, listProjectBranches, recoverProjectBranch, setDefaultProjectBranch, updateProjectBranch } from "../../client/sdk.gen.js";
|
|
4
4
|
import { withConnectionString } from "../connection.js";
|
|
5
5
|
import { paginate } from "../paginate.js";
|
|
6
6
|
//#region src/neon/resources/branches.ts
|
|
@@ -125,6 +125,16 @@ var Branches = class {
|
|
|
125
125
|
throwOnError: false
|
|
126
126
|
}), () => void 0);
|
|
127
127
|
}
|
|
128
|
+
recover(projectId, branchId, opts) {
|
|
129
|
+
return this.#ctx.run(opts, (client) => recoverProjectBranch({
|
|
130
|
+
client,
|
|
131
|
+
path: {
|
|
132
|
+
project_id: projectId,
|
|
133
|
+
branch_id: branchId
|
|
134
|
+
},
|
|
135
|
+
throwOnError: false
|
|
136
|
+
}), (data) => data.branch);
|
|
137
|
+
}
|
|
128
138
|
};
|
|
129
139
|
//#endregion
|
|
130
140
|
export { Branches };
|
|
@@ -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\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"],"mappings":";;;;;;;AAqDA,IAAa,WAAb,MAA8C;CAC7C;CAEA,YAAY,KAAqB;EAChC,KAAKA,OAAO;CACb;;CAGA,KAAK,WAAmB,OAAsC;EAC7D,OAAO,UACL,QA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E,MAAM,MAAM;KAAM,WAAW,MAAM;IAAS;IACtD,WAAW,CACV;KACC,MAAM;KACN,0BAA0B,MAAM,SAAS;KACzC,0BAA0B,MAAM,SAAS;KACzC,yBACC,MAAM,SAAS;IACjB,CACD;GACD;GACA,cAAc;EACf,CAAC,IACD,SAAS,IACX,IAGE,SAAS,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;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(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;EAC3B,EACD;CACD;CASA,IACC,WACA,UACA,MACuC;EACvC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,iBAAiB;GAChB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,cAAc;EACf,CAAC,IACD,SAAS,KAAK,MAChB;CACD;CAYA,OACC,WACA,OACA,MACuC;EACvC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,oBAAoB;GACnB;GACA,MAAM,EAAE,YAAY,UAAU;GAC9B,MAAM,EAAE,QAAQ,MAAM;GACtB,cAAc;EACf,CAAC,IACD,SAAS,KAAK,MAChB;CACD;CAcA,OACC,WACA,UACA,OACA,MACuC;EACvC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,oBAAoB;GACnB;GACA,MAAM;IAAE,YAAY;IAAW,WAAW;GAAS;GACnD,MAAM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ACD,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"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BucketObjectsDeletePrefixResponse, BucketObjectsListResponse, ListProjectBranchBucketObjectsData, PresignRequest, PresignResponse } from "../../client/types.gen.js";
|
|
2
|
+
import { Outcome } from "../result.js";
|
|
3
|
+
import { CallOptions, RequestContext } from "../context.js";
|
|
4
|
+
|
|
5
|
+
//#region src/neon/resources/bucket-objects.d.ts
|
|
6
|
+
type ListQuery = Omit<NonNullable<ListProjectBranchBucketObjectsData["query"]>, "cursor">;
|
|
7
|
+
/** Objects inside a branch bucket. */
|
|
8
|
+
declare class BucketObjects<DThrow extends boolean> {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(ctx: RequestContext);
|
|
11
|
+
/** @apiCall GET /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects */
|
|
12
|
+
list(projectId: string, branchId: string, bucketName: string, query?: ListQuery & {
|
|
13
|
+
cursor?: string;
|
|
14
|
+
}): Promise<Outcome<BucketObjectsListResponse, DThrow>>;
|
|
15
|
+
list<Throw extends boolean = DThrow>(projectId: string, branchId: string, bucketName: string, query: (ListQuery & {
|
|
16
|
+
cursor?: string;
|
|
17
|
+
}) | undefined, opts: CallOptions<Throw>): Promise<Outcome<BucketObjectsListResponse, Throw>>;
|
|
18
|
+
/** @apiCall GET /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key}/download */
|
|
19
|
+
get(projectId: string, branchId: string, bucketName: string, objectKey: string): Promise<Outcome<Blob, DThrow>>;
|
|
20
|
+
get<Throw extends boolean = DThrow>(projectId: string, branchId: string, bucketName: string, objectKey: string, opts: CallOptions<Throw>): Promise<Outcome<Blob, Throw>>;
|
|
21
|
+
/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key} */
|
|
22
|
+
delete(projectId: string, branchId: string, bucketName: string, objectKey: string): Promise<Outcome<void, DThrow>>;
|
|
23
|
+
delete<Throw extends boolean = DThrow>(projectId: string, branchId: string, bucketName: string, objectKey: string, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
|
|
24
|
+
/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects-by-prefix */
|
|
25
|
+
deleteByPrefix(projectId: string, branchId: string, bucketName: string, prefix: string): Promise<Outcome<BucketObjectsDeletePrefixResponse, DThrow>>;
|
|
26
|
+
deleteByPrefix<Throw extends boolean = DThrow>(projectId: string, branchId: string, bucketName: string, prefix: string, opts: CallOptions<Throw>): Promise<Outcome<BucketObjectsDeletePrefixResponse, Throw>>;
|
|
27
|
+
/** @apiCall POST /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name}/objects/{object_key}/presign */
|
|
28
|
+
presign(projectId: string, branchId: string, bucketName: string, objectKey: string, input: PresignRequest): Promise<Outcome<PresignResponse, DThrow>>;
|
|
29
|
+
presign<Throw extends boolean = DThrow>(projectId: string, branchId: string, bucketName: string, objectKey: string, input: PresignRequest, opts: CallOptions<Throw>): Promise<Outcome<PresignResponse, Throw>>;
|
|
30
|
+
}
|
|
31
|
+
//#endregion
|
|
32
|
+
export { BucketObjects };
|
|
33
|
+
//# sourceMappingURL=bucket-objects.d.ts.map
|
|
@@ -0,0 +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;aACD,CAAA,GAAA,EAQK,cARL;;MADI,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,KAMJ,CANI,EAkBP,SAlBO,GAAA;IAAI,MAAA,CAAA,EAAA,MAAA;EAMR,CAAA,CAAA,EAaT,OAbS,CAaD,OAbc,CAaN,yBAbM,EAaqB,MAbrB,CAAA,CAAA;EAAA,IAAA,CAAA,cAAA,OAAA,GAcI,MAdJ,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,KAAA,EAAA,CAkBhB,SAlBgB,GAAA;IAGR,MAAA,CAAA,EAAA,MAAA;OASR,SAAA,EAAA,IAAA,EAOF,WAPE,CAOU,KAPV,CAAA,CAAA,EAQN,OARM,CAQE,OARF,CAQU,yBARV,EAQqC,KARrC,CAAA,CAAA;;KACqC,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,CAAA,EAwC3C,OAxC2C,CAwCnC,OAxCmC,CAwC3B,IAxC2B,EAwCrB,MAxCqB,CAAA,CAAA;KAAnC,CAAA,cAAA,OAAA,GAyCiB,MAzCjB,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,SAAA,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AoJyB,MApJzB,CAAA,CAAA;SAAR,CAAA,cAAA,OAAA,GAqJ6B,MArJ7B,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,UAAA,EAAA,MAAA,EAAA,SAAA,EAAA,MAAA,EAAA,KAAA,EA0JK,cA1JL,EAAA,IAAA,EA2JI,WA3JJ,CA2JgB,KA3JhB,CAAA,CAAA,EA4JA,OA5JA,CA4JQ,OA5JR,CA4JgB,eA5JhB,EA4JiC,KA5JjC,CAAA,CAAA"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { deleteProjectBranchBucketObject, deleteProjectBranchBucketObjectsByPrefix, getProjectBranchBucketObject, listProjectBranchBucketObjects, presignProjectBranchBucketObject } from "../../client/sdk.gen.js";
|
|
2
|
+
//#region src/neon/resources/bucket-objects.ts
|
|
3
|
+
/** Objects inside a branch bucket. */
|
|
4
|
+
var BucketObjects = class {
|
|
5
|
+
#ctx;
|
|
6
|
+
constructor(ctx) {
|
|
7
|
+
this.#ctx = ctx;
|
|
8
|
+
}
|
|
9
|
+
list(projectId, branchId, bucketName, query, opts) {
|
|
10
|
+
return this.#ctx.run(opts, (client) => listProjectBranchBucketObjects({
|
|
11
|
+
client,
|
|
12
|
+
path: {
|
|
13
|
+
project_id: projectId,
|
|
14
|
+
branch_id: branchId,
|
|
15
|
+
bucket_name: bucketName
|
|
16
|
+
},
|
|
17
|
+
query,
|
|
18
|
+
throwOnError: false
|
|
19
|
+
}), (data) => data);
|
|
20
|
+
}
|
|
21
|
+
get(projectId, branchId, bucketName, objectKey, opts) {
|
|
22
|
+
return this.#ctx.run(opts, (client) => getProjectBranchBucketObject({
|
|
23
|
+
client,
|
|
24
|
+
path: {
|
|
25
|
+
project_id: projectId,
|
|
26
|
+
branch_id: branchId,
|
|
27
|
+
bucket_name: bucketName,
|
|
28
|
+
object_key: objectKey
|
|
29
|
+
},
|
|
30
|
+
throwOnError: false
|
|
31
|
+
}), (data) => data);
|
|
32
|
+
}
|
|
33
|
+
delete(projectId, branchId, bucketName, objectKey, opts) {
|
|
34
|
+
return this.#ctx.runVoid(opts, (client) => deleteProjectBranchBucketObject({
|
|
35
|
+
client,
|
|
36
|
+
path: {
|
|
37
|
+
project_id: projectId,
|
|
38
|
+
branch_id: branchId,
|
|
39
|
+
bucket_name: bucketName,
|
|
40
|
+
object_key: objectKey
|
|
41
|
+
},
|
|
42
|
+
throwOnError: false
|
|
43
|
+
}));
|
|
44
|
+
}
|
|
45
|
+
deleteByPrefix(projectId, branchId, bucketName, prefix, opts) {
|
|
46
|
+
return this.#ctx.run(opts, (client) => deleteProjectBranchBucketObjectsByPrefix({
|
|
47
|
+
client,
|
|
48
|
+
path: {
|
|
49
|
+
project_id: projectId,
|
|
50
|
+
branch_id: branchId,
|
|
51
|
+
bucket_name: bucketName
|
|
52
|
+
},
|
|
53
|
+
query: { prefix },
|
|
54
|
+
throwOnError: false
|
|
55
|
+
}), (data) => data);
|
|
56
|
+
}
|
|
57
|
+
presign(projectId, branchId, bucketName, objectKey, input, opts) {
|
|
58
|
+
return this.#ctx.run(opts, (client) => presignProjectBranchBucketObject({
|
|
59
|
+
client,
|
|
60
|
+
path: {
|
|
61
|
+
project_id: projectId,
|
|
62
|
+
branch_id: branchId,
|
|
63
|
+
bucket_name: bucketName,
|
|
64
|
+
object_key: objectKey
|
|
65
|
+
},
|
|
66
|
+
body: input,
|
|
67
|
+
throwOnError: false
|
|
68
|
+
}), (data) => data);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
export { BucketObjects };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=bucket-objects.js.map
|
|
@@ -0,0 +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,WACA,+BAA+B;GAC9B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;GACd;GACA;GACA,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;CAgBA,IACC,WACA,UACA,YACA,WACA,MACmC;EACnC,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,6BAA6B;GAC5B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;IACb,YAAY;GACb;GACA,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;CAgBA,OACC,WACA,UACA,YACA,WACA,MACmC;EACnC,OAAO,KAAKA,KAAK,QAAQ,OAAO,WAC/B,gCAAgC;GAC/B;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;IACb,YAAY;GACb;GACA,cAAc;EACf,CAAC,CACF;CACD;CAgBA,eACC,WACA,UACA,YACA,QACA,MAIC;EACD,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,yCAAyC;GACxC;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;GACd;GACA,OAAO,EAAE,OAAO;GAChB,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;CAkBA,QACC,WACA,UACA,YACA,WACA,OACA,MACyD;EACzD,OAAO,KAAKA,KAAK,IAChB,OACC,WACA,iCAAiC;GAChC;GACA,MAAM;IACL,YAAY;IACZ,WAAW;IACX,aAAa;IACb,YAAY;GACb;GACA,MAAM;GACN,cAAc;EACf,CAAC,IACD,SAAS,IACX;CACD;AACD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Bucket, BucketAccessLevel, BucketCreateRequest } from "../../client/types.gen.js";
|
|
2
|
+
import { Outcome } from "../result.js";
|
|
3
|
+
import { CallOptions, RequestContext } from "../context.js";
|
|
4
|
+
|
|
5
|
+
//#region src/neon/resources/buckets.d.ts
|
|
6
|
+
type CreateInput = BucketCreateRequest;
|
|
7
|
+
/** Branch-scoped object-storage buckets. */
|
|
8
|
+
declare class Buckets<DThrow extends boolean> {
|
|
9
|
+
#private;
|
|
10
|
+
constructor(ctx: RequestContext);
|
|
11
|
+
/** @apiCall GET /projects/{project_id}/branches/{branch_id}/buckets */
|
|
12
|
+
list(projectId: string, branchId: string): Promise<Outcome<Bucket[], DThrow>>;
|
|
13
|
+
list<Throw extends boolean = DThrow>(projectId: string, branchId: string, opts: CallOptions<Throw>): Promise<Outcome<Bucket[], Throw>>;
|
|
14
|
+
/** @apiCall POST /projects/{project_id}/branches/{branch_id}/buckets */
|
|
15
|
+
create(projectId: string, branchId: string, input: CreateInput): Promise<Outcome<Bucket, DThrow>>;
|
|
16
|
+
create<Throw extends boolean = DThrow>(projectId: string, branchId: string, input: CreateInput, opts: CallOptions<Throw>): Promise<Outcome<Bucket, Throw>>;
|
|
17
|
+
/** @apiCall DELETE /projects/{project_id}/branches/{branch_id}/buckets/{bucket_name} */
|
|
18
|
+
delete(projectId: string, branchId: string, bucketName: string): Promise<Outcome<void, DThrow>>;
|
|
19
|
+
delete<Throw extends boolean = DThrow>(projectId: string, branchId: string, bucketName: string, opts: CallOptions<Throw>): Promise<Outcome<void, Throw>>;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { type BucketAccessLevel, Buckets };
|
|
23
|
+
//# sourceMappingURL=buckets.d.ts.map
|
|
@@ -0,0 +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;;MAWA,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,CAAA,EAAhB,OAAgB,CAAR,OAAQ,CAAA,MAAA,EAAA,EAAU,MAAV,CAAA,CAAA;MAAU,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;;QAA1B,CAAA,SAAA,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,KAAA,EA2BK,WA3BL,CAAA,EA4BA,OA5BA,CA4BQ,OA5BR,CA4BgB,MA5BhB,EA4BwB,MA5BxB,CAAA,CAAA;QAC0B,CAAA,cAAA,OAAA,GA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