@infracraft/pulumi 0.2.1 → 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/dist/neon/branch.cjs +20 -42
- package/dist/neon/branch.cjs.map +1 -1
- package/dist/neon/branch.d.cts +19 -16
- package/dist/neon/branch.d.cts.map +1 -1
- package/dist/neon/branch.d.mts +19 -16
- package/dist/neon/branch.d.mts.map +1 -1
- package/dist/neon/branch.mjs +20 -42
- package/dist/neon/branch.mjs.map +1 -1
- package/dist/neon/database.cjs +20 -40
- package/dist/neon/database.cjs.map +1 -1
- package/dist/neon/database.d.cts +21 -19
- package/dist/neon/database.d.cts.map +1 -1
- package/dist/neon/database.d.mts +21 -19
- package/dist/neon/database.d.mts.map +1 -1
- package/dist/neon/database.mjs +20 -40
- package/dist/neon/database.mjs.map +1 -1
- package/dist/neon/endpoint.cjs +24 -52
- package/dist/neon/endpoint.cjs.map +1 -1
- package/dist/neon/endpoint.d.cts +24 -23
- package/dist/neon/endpoint.d.cts.map +1 -1
- package/dist/neon/endpoint.d.mts +24 -23
- package/dist/neon/endpoint.d.mts.map +1 -1
- package/dist/neon/endpoint.mjs +24 -52
- package/dist/neon/endpoint.mjs.map +1 -1
- package/dist/neon/index.cjs +2 -0
- package/dist/neon/index.d.cts +7 -6
- package/dist/neon/index.d.mts +7 -6
- package/dist/neon/index.mjs +2 -1
- package/dist/neon/project.cjs +24 -47
- package/dist/neon/project.cjs.map +1 -1
- package/dist/neon/project.d.cts +17 -24
- package/dist/neon/project.d.cts.map +1 -1
- package/dist/neon/project.d.mts +17 -24
- package/dist/neon/project.d.mts.map +1 -1
- package/dist/neon/project.mjs +24 -47
- package/dist/neon/project.mjs.map +1 -1
- package/dist/neon/provider.cjs +34 -0
- package/dist/neon/provider.cjs.map +1 -0
- package/dist/neon/provider.d.cts +33 -0
- package/dist/neon/provider.d.cts.map +1 -0
- package/dist/neon/provider.d.mts +33 -0
- package/dist/neon/provider.d.mts.map +1 -0
- package/dist/neon/provider.mjs +32 -0
- package/dist/neon/provider.mjs.map +1 -0
- package/dist/neon/role.cjs +23 -51
- package/dist/neon/role.cjs.map +1 -1
- package/dist/neon/role.d.cts +20 -21
- package/dist/neon/role.d.cts.map +1 -1
- package/dist/neon/role.d.mts +20 -21
- package/dist/neon/role.d.mts.map +1 -1
- package/dist/neon/role.mjs +23 -51
- package/dist/neon/role.mjs.map +1 -1
- package/dist/railway/deploy.cjs +13 -3
- package/dist/railway/deploy.cjs.map +1 -1
- package/dist/railway/deploy.d.cts +23 -10
- package/dist/railway/deploy.d.cts.map +1 -1
- package/dist/railway/deploy.d.mts +23 -10
- package/dist/railway/deploy.d.mts.map +1 -1
- package/dist/railway/deploy.mjs +13 -3
- package/dist/railway/deploy.mjs.map +1 -1
- package/dist/railway/domain.cjs +28 -67
- package/dist/railway/domain.cjs.map +1 -1
- package/dist/railway/domain.d.cts +24 -23
- package/dist/railway/domain.d.cts.map +1 -1
- package/dist/railway/domain.d.mts +24 -23
- package/dist/railway/domain.d.mts.map +1 -1
- package/dist/railway/domain.mjs +28 -67
- package/dist/railway/domain.mjs.map +1 -1
- package/dist/railway/environment.cjs +116 -0
- package/dist/railway/environment.cjs.map +1 -0
- package/dist/railway/environment.d.cts +39 -0
- package/dist/railway/environment.d.cts.map +1 -0
- package/dist/railway/environment.d.mts +39 -0
- package/dist/railway/environment.d.mts.map +1 -0
- package/dist/railway/environment.mjs +114 -0
- package/dist/railway/environment.mjs.map +1 -0
- package/dist/railway/index.cjs +4 -0
- package/dist/railway/index.d.cts +9 -7
- package/dist/railway/index.d.mts +9 -7
- package/dist/railway/index.mjs +3 -1
- package/dist/railway/project.cjs +31 -17
- package/dist/railway/project.cjs.map +1 -1
- package/dist/railway/project.d.cts +20 -18
- package/dist/railway/project.d.cts.map +1 -1
- package/dist/railway/project.d.mts +20 -18
- package/dist/railway/project.d.mts.map +1 -1
- package/dist/railway/project.mjs +31 -17
- package/dist/railway/project.mjs.map +1 -1
- package/dist/railway/provider.cjs +32 -0
- package/dist/railway/provider.cjs.map +1 -0
- package/dist/railway/provider.d.cts +29 -0
- package/dist/railway/provider.d.cts.map +1 -0
- package/dist/railway/provider.d.mts +29 -0
- package/dist/railway/provider.d.mts.map +1 -0
- package/dist/railway/provider.mjs +30 -0
- package/dist/railway/provider.mjs.map +1 -0
- package/dist/railway/service.cjs +27 -38
- package/dist/railway/service.cjs.map +1 -1
- package/dist/railway/service.d.cts +43 -33
- package/dist/railway/service.d.cts.map +1 -1
- package/dist/railway/service.d.mts +43 -33
- package/dist/railway/service.d.mts.map +1 -1
- package/dist/railway/service.mjs +27 -38
- package/dist/railway/service.mjs.map +1 -1
- package/dist/railway/variable.cjs +20 -38
- package/dist/railway/variable.cjs.map +1 -1
- package/dist/railway/variable.d.cts +21 -24
- package/dist/railway/variable.d.cts.map +1 -1
- package/dist/railway/variable.d.mts +21 -24
- package/dist/railway/variable.d.mts.map +1 -1
- package/dist/railway/variable.mjs +20 -38
- package/dist/railway/variable.mjs.map +1 -1
- package/dist/railway/volume.cjs +25 -60
- package/dist/railway/volume.cjs.map +1 -1
- package/dist/railway/volume.d.cts +21 -24
- package/dist/railway/volume.d.cts.map +1 -1
- package/dist/railway/volume.d.mts +21 -24
- package/dist/railway/volume.d.mts.map +1 -1
- package/dist/railway/volume.mjs +25 -60
- package/dist/railway/volume.mjs.map +1 -1
- package/dist/vercel/deploy.cjs +7 -13
- package/dist/vercel/deploy.cjs.map +1 -1
- package/dist/vercel/deploy.d.cts +10 -16
- package/dist/vercel/deploy.d.cts.map +1 -1
- package/dist/vercel/deploy.d.mts +10 -16
- package/dist/vercel/deploy.d.mts.map +1 -1
- package/dist/vercel/deploy.mjs +7 -13
- package/dist/vercel/deploy.mjs.map +1 -1
- package/dist/vercel/index.cjs +2 -0
- package/dist/vercel/index.d.cts +3 -2
- package/dist/vercel/index.d.mts +3 -2
- package/dist/vercel/index.mjs +2 -1
- package/dist/vercel/provider.cjs +37 -0
- package/dist/vercel/provider.cjs.map +1 -0
- package/dist/vercel/provider.d.cts +33 -0
- package/dist/vercel/provider.d.cts.map +1 -0
- package/dist/vercel/provider.d.mts +33 -0
- package/dist/vercel/provider.d.mts.map +1 -0
- package/dist/vercel/provider.mjs +35 -0
- package/dist/vercel/provider.mjs.map +1 -0
- package/dist/vercel/variable.cjs +25 -93
- package/dist/vercel/variable.cjs.map +1 -1
- package/dist/vercel/variable.d.cts +18 -25
- package/dist/vercel/variable.d.cts.map +1 -1
- package/dist/vercel/variable.d.mts +18 -25
- package/dist/vercel/variable.d.mts.map +1 -1
- package/dist/vercel/variable.mjs +25 -93
- package/dist/vercel/variable.mjs.map +1 -1
- package/package.json +1 -1
package/dist/neon/branch.cjs
CHANGED
|
@@ -7,11 +7,6 @@ _pulumi_pulumi = require_chunk.__toESM(_pulumi_pulumi, 1);
|
|
|
7
7
|
//#region src/neon/branch.ts
|
|
8
8
|
/**
|
|
9
9
|
* Finds an existing Neon branch by name within a project.
|
|
10
|
-
*
|
|
11
|
-
* @param client Authenticated Neon API client
|
|
12
|
-
* @param projectId Neon project ID
|
|
13
|
-
* @param name Exact branch name to match
|
|
14
|
-
* @returns The branch ID if found, `undefined` otherwise
|
|
15
10
|
*/
|
|
16
11
|
async function findBranchByName(client, projectId, name) {
|
|
17
12
|
return (await client.get(`/projects/${projectId}/branches`)).branches.find((b) => b.name === name)?.id;
|
|
@@ -20,15 +15,9 @@ async function findBranchByName(client, projectId, name) {
|
|
|
20
15
|
* Dynamic provider implementing CRUD for Neon branches.
|
|
21
16
|
*
|
|
22
17
|
* Uses adopt-or-create on `create()`: finds an existing branch by name
|
|
23
|
-
* before creating a new one
|
|
18
|
+
* before creating a new one.
|
|
24
19
|
*/
|
|
25
|
-
var
|
|
26
|
-
/**
|
|
27
|
-
* Creates or adopts a Neon branch by name.
|
|
28
|
-
*
|
|
29
|
-
* @param inputs Resolved branch configuration
|
|
30
|
-
* @returns The Neon branch ID as the resource ID
|
|
31
|
-
*/
|
|
20
|
+
var NeonBranchResourceProvider = class {
|
|
32
21
|
async create(inputs) {
|
|
33
22
|
const client = new require_neon_client.NeonClient(inputs.apiKey);
|
|
34
23
|
let branchId = await findBranchByName(client, inputs.projectId, inputs.name);
|
|
@@ -39,14 +28,6 @@ var NeonBranchProvider = class {
|
|
|
39
28
|
outs: inputs
|
|
40
29
|
};
|
|
41
30
|
}
|
|
42
|
-
/**
|
|
43
|
-
* Reads current state for `pulumi refresh`.
|
|
44
|
-
*
|
|
45
|
-
* @param id Current Neon branch ID
|
|
46
|
-
* @param props Last known persisted state
|
|
47
|
-
* @returns Refreshed resource ID and properties
|
|
48
|
-
* @throws {Error} If the branch no longer exists
|
|
49
|
-
*/
|
|
50
31
|
async read(id, props) {
|
|
51
32
|
const result = await new require_neon_client.NeonClient(props.apiKey).get(`/projects/${props.projectId}/branches/${id}`);
|
|
52
33
|
return {
|
|
@@ -57,12 +38,6 @@ var NeonBranchProvider = class {
|
|
|
57
38
|
}
|
|
58
39
|
};
|
|
59
40
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Deletes the Neon branch. Silently succeeds if already deleted.
|
|
62
|
-
*
|
|
63
|
-
* @param id Neon branch ID to delete
|
|
64
|
-
* @param props Last known persisted state
|
|
65
|
-
*/
|
|
66
41
|
async delete(id, props) {
|
|
67
42
|
const client = new require_neon_client.NeonClient(props.apiKey);
|
|
68
43
|
try {
|
|
@@ -71,10 +46,6 @@ var NeonBranchProvider = class {
|
|
|
71
46
|
_pulumi_pulumi.log.warn(`Failed to delete Neon branch (may already be deleted)`);
|
|
72
47
|
}
|
|
73
48
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Compares old and new inputs to detect changes.
|
|
76
|
-
* Changing `projectId` triggers replacement.
|
|
77
|
-
*/
|
|
78
49
|
async diff(_id, olds, news) {
|
|
79
50
|
const replaces = [];
|
|
80
51
|
if (olds.projectId !== news.projectId) replaces.push("projectId");
|
|
@@ -85,26 +56,33 @@ var NeonBranchProvider = class {
|
|
|
85
56
|
};
|
|
86
57
|
}
|
|
87
58
|
};
|
|
59
|
+
/** Internal dynamic resource — not part of the public API. */
|
|
60
|
+
var NeonBranchResource = class extends _pulumi_pulumi.dynamic.Resource {
|
|
61
|
+
constructor(name, args, opts) {
|
|
62
|
+
super(new NeonBranchResourceProvider(), name, { ...args }, opts);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
88
65
|
/**
|
|
89
66
|
* Manages a Neon branch with adopt-or-create semantics.
|
|
90
67
|
*
|
|
91
68
|
* @example
|
|
92
69
|
* ```typescript
|
|
93
|
-
* const branch = new NeonBranch("
|
|
94
|
-
* apiKey: config.requireSecret("neonApiKey"),
|
|
95
|
-
* projectId: "quiet-forest-69719462",
|
|
70
|
+
* const branch = new NeonBranch("production", {
|
|
96
71
|
* name: "production",
|
|
97
|
-
* });
|
|
72
|
+
* }, { provider, project });
|
|
98
73
|
* ```
|
|
99
74
|
*/
|
|
100
|
-
var NeonBranch = class extends _pulumi_pulumi.
|
|
101
|
-
/**
|
|
102
|
-
* @param name Pulumi resource name
|
|
103
|
-
* @param args Branch configuration inputs
|
|
104
|
-
* @param opts Standard Pulumi resource options
|
|
105
|
-
*/
|
|
75
|
+
var NeonBranch = class extends _pulumi_pulumi.ComponentResource {
|
|
106
76
|
constructor(name, args, opts) {
|
|
107
|
-
|
|
77
|
+
const { provider, project, ...pulumiOpts } = opts;
|
|
78
|
+
super("infracraft:neon:Branch", name, {}, pulumiOpts);
|
|
79
|
+
const resource = new NeonBranchResource(`${name}-resource`, {
|
|
80
|
+
apiKey: provider.apiKey,
|
|
81
|
+
projectId: project.projectId,
|
|
82
|
+
name: args.name
|
|
83
|
+
}, { parent: this });
|
|
84
|
+
this.branchId = resource.id;
|
|
85
|
+
this.registerOutputs({ branchId: this.branchId });
|
|
108
86
|
}
|
|
109
87
|
};
|
|
110
88
|
|
package/dist/neon/branch.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.cjs","names":["NeonClient","pulumi"],"sources":["../../src/neon/branch.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport { NeonClient } from \"./client.js\";\n\n/** Resolved inputs for the Neon branch dynamic provider. */\nexport interface NeonBranchInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID (e.g. `\"quiet-forest-69719462\"`). */\n\tprojectId: string;\n\n\t/** Branch display name (e.g. `\"production\"`, `\"development\"`). */\n\tname: string;\n}\n\n/** Persisted state for the Neon branch. */\ninterface NeonBranchOutputs extends NeonBranchInputs {}\n\n/** Neon API response for a branch. */\ninterface BranchResponse {\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tproject_id: string;\n\t};\n}\n\n/** Neon API response for branch creation. */\ninterface BranchCreateResponse {\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tproject_id: string;\n\t};\n}\n\n/** Neon API response for listing branches. */\ninterface BranchListResponse {\n\tbranches: Array<{\n\t\tid: string;\n\t\tname: string;\n\t}>;\n}\n\n/**\n * Finds an existing Neon branch by name within a project.\n
|
|
1
|
+
{"version":3,"file":"branch.cjs","names":["NeonClient","pulumi"],"sources":["../../src/neon/branch.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport { NeonClient } from \"./client.js\";\nimport type { NeonProject } from \"./project.js\";\nimport type { NeonProvider } from \"./provider.js\";\n\n/** Resolved inputs for the Neon branch dynamic provider. */\nexport interface NeonBranchInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID (e.g. `\"quiet-forest-69719462\"`). */\n\tprojectId: string;\n\n\t/** Branch display name (e.g. `\"production\"`, `\"development\"`). */\n\tname: string;\n}\n\n/** Persisted state for the Neon branch. */\ninterface NeonBranchOutputs extends NeonBranchInputs {}\n\n/** Neon API response for a branch. */\ninterface BranchResponse {\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tproject_id: string;\n\t};\n}\n\n/** Neon API response for branch creation. */\ninterface BranchCreateResponse {\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tproject_id: string;\n\t};\n}\n\n/** Neon API response for listing branches. */\ninterface BranchListResponse {\n\tbranches: Array<{\n\t\tid: string;\n\t\tname: string;\n\t}>;\n}\n\n/**\n * Finds an existing Neon branch by name within a project.\n */\nasync function findBranchByName(\n\tclient: NeonClient,\n\tprojectId: string,\n\tname: string,\n): Promise<string | undefined> {\n\tconst result = await client.get<BranchListResponse>(\n\t\t`/projects/${projectId}/branches`,\n\t);\n\n\tconst match = result.branches.find((b) => b.name === name);\n\n\treturn match?.id;\n}\n\n/**\n * Dynamic provider implementing CRUD for Neon branches.\n *\n * Uses adopt-or-create on `create()`: finds an existing branch by name\n * before creating a new one.\n */\nclass NeonBranchResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(inputs: NeonBranchInputs): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new NeonClient(inputs.apiKey);\n\n\t\tlet branchId = await findBranchByName(\n\t\t\tclient,\n\t\t\tinputs.projectId,\n\t\t\tinputs.name,\n\t\t);\n\n\t\tif (branchId) {\n\t\t\tpulumi.log.info(\n\t\t\t\t`Adopting existing Neon branch \"${inputs.name}\" (${branchId})`,\n\t\t\t);\n\t\t} else {\n\t\t\tconst result = await client.post<BranchCreateResponse>(\n\t\t\t\t`/projects/${inputs.projectId}/branches`,\n\t\t\t\t{ branch: { name: inputs.name } },\n\t\t\t);\n\n\t\t\tbranchId = result.branch.id;\n\t\t}\n\n\t\treturn { id: branchId, outs: inputs };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: NeonBranchOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\tconst result = await client.get<BranchResponse>(\n\t\t\t`/projects/${props.projectId}/branches/${id}`,\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.branch.id,\n\t\t\tprops: { ...props, name: result.branch.name },\n\t\t};\n\t}\n\n\tasync delete(id: string, props: NeonBranchOutputs): Promise<void> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\ttry {\n\t\t\tawait client.delete(`/projects/${props.projectId}/branches/${id}`);\n\t\t} catch {\n\t\t\tpulumi.log.warn(`Failed to delete Neon branch (may already be deleted)`);\n\t\t}\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: NeonBranchOutputs,\n\t\tnews: NeonBranchInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.projectId !== news.projectId) {\n\t\t\treplaces.push(\"projectId\");\n\t\t}\n\n\t\treturn {\n\t\t\tchanges: replaces.length > 0 || olds.name !== news.name,\n\t\t\treplaces,\n\t\t\tdeleteBeforeReplace: true,\n\t\t};\n\t}\n}\n\n/** Internal dynamic resource — not part of the public API. */\nclass NeonBranchResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly branchId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\tapiKey: pulumi.Input<string>;\n\t\t\tprojectId: pulumi.Input<string>;\n\t\t\tname: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(new NeonBranchResourceProvider(), name, { ...args }, opts);\n\t}\n}\n\n/** Options type for NeonBranch — replaces Pulumi's native `provider` field. */\ntype NeonBranchOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\t/** Neon authentication context. */\n\tprovider: NeonProvider;\n\n\t/** Neon project context. */\n\tproject: NeonProject;\n};\n\n/** Args for NeonBranch. */\nexport interface NeonBranchArgs {\n\t/** Branch display name. */\n\tname: pulumi.Input<string>;\n}\n\n/**\n * Manages a Neon branch with adopt-or-create semantics.\n *\n * @example\n * ```typescript\n * const branch = new NeonBranch(\"production\", {\n * name: \"production\",\n * }, { provider, project });\n * ```\n */\nexport class NeonBranch extends pulumi.ComponentResource {\n\t/** Neon branch ID. */\n\tpublic readonly branchId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: NeonBranchArgs,\n\t\topts: NeonBranchOptions,\n\t) {\n\t\tconst { provider, project, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:neon:Branch\", name, {}, pulumiOpts);\n\n\t\tconst resource = new NeonBranchResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\tapiKey: provider.apiKey,\n\t\t\t\tprojectId: project.projectId,\n\t\t\t\tname: args.name,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.branchId = resource.id;\n\n\t\tthis.registerOutputs({ branchId: this.branchId });\n\t}\n}\n"],"mappings":";;;;;;;;;;AAiDA,eAAe,iBACd,QACA,WACA,MAC8B;CAO9B,QAFc,MAJO,OAAO,IAC3B,aAAa,UAAU,UACxB,GAEqB,SAAS,MAAM,MAAM,EAAE,SAAS,IAE1C,GAAG;AACf;;;;;;;AAQA,IAAM,6BAAN,MAA4E;CAC3E,MAAM,OAAO,QAAgE;EAC5E,MAAM,SAAS,IAAIA,+BAAW,OAAO,MAAM;EAE3C,IAAI,WAAW,MAAM,iBACpB,QACA,OAAO,WACP,OAAO,IACR;EAEA,IAAI,UACH,eAAO,IAAI,KACV,kCAAkC,OAAO,KAAK,KAAK,SAAS,EAC7D;OAOA,YAAW,MALU,OAAO,KAC3B,aAAa,OAAO,UAAU,YAC9B,EAAE,QAAQ,EAAE,MAAM,OAAO,KAAK,EAAE,CACjC,GAEkB,OAAO;EAG1B,OAAO;GAAE,IAAI;GAAU,MAAM;EAAO;CACrC;CAEA,MAAM,KACL,IACA,OACqC;EAGrC,MAAM,SAAS,MAAM,IAFFA,+BAAW,MAAM,MAEV,EAAE,IAC3B,aAAa,MAAM,UAAU,YAAY,IAC1C;EAEA,OAAO;GACN,IAAI,OAAO,OAAO;GAClB,OAAO;IAAE,GAAG;IAAO,MAAM,OAAO,OAAO;GAAK;EAC7C;CACD;CAEA,MAAM,OAAO,IAAY,OAAyC;EACjE,MAAM,SAAS,IAAIA,+BAAW,MAAM,MAAM;EAE1C,IAAI;GACH,MAAM,OAAO,OAAO,aAAa,MAAM,UAAU,YAAY,IAAI;EAClE,QAAQ;GACP,eAAO,IAAI,KAAK,uDAAuD;EACxE;CACD;CAEA,MAAM,KACL,KACA,MACA,MACqC;EACrC,MAAM,WAAqB,CAAC;EAE5B,IAAI,KAAK,cAAc,KAAK,WAC3B,SAAS,KAAK,WAAW;EAG1B,OAAO;GACN,SAAS,SAAS,SAAS,KAAK,KAAK,SAAS,KAAK;GACnD;GACA,qBAAqB;EACtB;CACD;AACD;;AAGA,IAAM,qBAAN,cAAiCC,eAAO,QAAQ,SAAS;CAGxD,YACC,MACA,MAKA,MACC;EACD,MAAM,IAAI,2BAA2B,GAAG,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI;CAChE;AACD;;;;;;;;;;;AA2BA,IAAa,aAAb,cAAgCA,eAAO,kBAAkB;CAIxD,YACC,MACA,MACA,MACC;EACD,MAAM,EAAE,UAAU,SAAS,GAAG,eAAe;EAE7C,MAAM,0BAA0B,MAAM,CAAC,GAAG,UAAU;EAEpD,MAAM,WAAW,IAAI,mBACpB,GAAG,KAAK,YACR;GACC,QAAQ,SAAS;GACjB,WAAW,QAAQ;GACnB,MAAM,KAAK;EACZ,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,WAAW,SAAS;EAEzB,KAAK,gBAAgB,EAAE,UAAU,KAAK,SAAS,CAAC;CACjD;AACD"}
|
package/dist/neon/branch.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "../chunk-OPjESj5l.cjs";
|
|
2
|
+
import { NeonProvider } from "./provider.cjs";
|
|
3
|
+
import { NeonProject } from "./project.cjs";
|
|
2
4
|
import * as pulumi from "@pulumi/pulumi";
|
|
3
5
|
|
|
4
6
|
//#region src/neon/branch.d.ts
|
|
@@ -11,30 +13,31 @@ interface NeonBranchInputs {
|
|
|
11
13
|
/** Branch display name (e.g. `"production"`, `"development"`). */
|
|
12
14
|
name: string;
|
|
13
15
|
}
|
|
16
|
+
/** Options type for NeonBranch — replaces Pulumi's native `provider` field. */
|
|
17
|
+
type NeonBranchOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
|
|
18
|
+
/** Neon authentication context. */provider: NeonProvider; /** Neon project context. */
|
|
19
|
+
project: NeonProject;
|
|
20
|
+
};
|
|
21
|
+
/** Args for NeonBranch. */
|
|
22
|
+
interface NeonBranchArgs {
|
|
23
|
+
/** Branch display name. */
|
|
24
|
+
name: pulumi.Input<string>;
|
|
25
|
+
}
|
|
14
26
|
/**
|
|
15
27
|
* Manages a Neon branch with adopt-or-create semantics.
|
|
16
28
|
*
|
|
17
29
|
* @example
|
|
18
30
|
* ```typescript
|
|
19
|
-
* const branch = new NeonBranch("
|
|
20
|
-
* apiKey: config.requireSecret("neonApiKey"),
|
|
21
|
-
* projectId: "quiet-forest-69719462",
|
|
31
|
+
* const branch = new NeonBranch("production", {
|
|
22
32
|
* name: "production",
|
|
23
|
-
* });
|
|
33
|
+
* }, { provider, project });
|
|
24
34
|
* ```
|
|
25
35
|
*/
|
|
26
|
-
declare class NeonBranch extends pulumi.
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* @param opts Standard Pulumi resource options
|
|
31
|
-
*/
|
|
32
|
-
constructor(name: string, args: {
|
|
33
|
-
/** Neon API key. */apiKey: pulumi.Input<string>; /** Neon project ID. */
|
|
34
|
-
projectId: pulumi.Input<string>; /** Branch display name. */
|
|
35
|
-
name: pulumi.Input<string>;
|
|
36
|
-
}, opts?: pulumi.CustomResourceOptions);
|
|
36
|
+
declare class NeonBranch extends pulumi.ComponentResource {
|
|
37
|
+
/** Neon branch ID. */
|
|
38
|
+
readonly branchId: pulumi.Output<string>;
|
|
39
|
+
constructor(name: string, args: NeonBranchArgs, opts: NeonBranchOptions);
|
|
37
40
|
}
|
|
38
41
|
//#endregion
|
|
39
|
-
export { NeonBranch, NeonBranchInputs };
|
|
42
|
+
export { NeonBranch, NeonBranchArgs, NeonBranchInputs };
|
|
40
43
|
//# sourceMappingURL=branch.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.cts","names":[],"sources":["../../src/neon/branch.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"branch.d.cts","names":[],"sources":["../../src/neon/branch.ts"],"mappings":";;;;;;;UAMiB,gBAAA;;EAEhB,MAAA;EAFgC;EAKhC,SAAA;EALgC;EAQhC,IAAA;AAAA;;KAgJI,iBAAA,GAAoB,IAAA,CAAK,MAAA,CAAO,wBAAA;EAhJhC,mCAkJJ,QAAA,EAAU,YAAA,EAFW;EAKrB,OAAA,EAAS,WAAA;AAAA;;UAIO,cAAA;EAJP;EAMT,IAAA,EAAM,MAAA,CAAO,KAAK;AAAA;;;;;;;;;AANE;AAIrB;cAea,UAAA,SAAmB,MAAA,CAAO,iBAAA;;WAEtB,QAAA,EAAU,MAAA,CAAO,MAAA;cAGhC,IAAA,UACA,IAAA,EAAM,cAAA,EACN,IAAA,EAAM,iBAAA;AAAA"}
|
package/dist/neon/branch.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "../chunk-OPjESj5l.mjs";
|
|
2
|
+
import { NeonProvider } from "./provider.mjs";
|
|
3
|
+
import { NeonProject } from "./project.mjs";
|
|
2
4
|
import * as pulumi from "@pulumi/pulumi";
|
|
3
5
|
|
|
4
6
|
//#region src/neon/branch.d.ts
|
|
@@ -11,30 +13,31 @@ interface NeonBranchInputs {
|
|
|
11
13
|
/** Branch display name (e.g. `"production"`, `"development"`). */
|
|
12
14
|
name: string;
|
|
13
15
|
}
|
|
16
|
+
/** Options type for NeonBranch — replaces Pulumi's native `provider` field. */
|
|
17
|
+
type NeonBranchOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
|
|
18
|
+
/** Neon authentication context. */provider: NeonProvider; /** Neon project context. */
|
|
19
|
+
project: NeonProject;
|
|
20
|
+
};
|
|
21
|
+
/** Args for NeonBranch. */
|
|
22
|
+
interface NeonBranchArgs {
|
|
23
|
+
/** Branch display name. */
|
|
24
|
+
name: pulumi.Input<string>;
|
|
25
|
+
}
|
|
14
26
|
/**
|
|
15
27
|
* Manages a Neon branch with adopt-or-create semantics.
|
|
16
28
|
*
|
|
17
29
|
* @example
|
|
18
30
|
* ```typescript
|
|
19
|
-
* const branch = new NeonBranch("
|
|
20
|
-
* apiKey: config.requireSecret("neonApiKey"),
|
|
21
|
-
* projectId: "quiet-forest-69719462",
|
|
31
|
+
* const branch = new NeonBranch("production", {
|
|
22
32
|
* name: "production",
|
|
23
|
-
* });
|
|
33
|
+
* }, { provider, project });
|
|
24
34
|
* ```
|
|
25
35
|
*/
|
|
26
|
-
declare class NeonBranch extends pulumi.
|
|
27
|
-
/**
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* @param opts Standard Pulumi resource options
|
|
31
|
-
*/
|
|
32
|
-
constructor(name: string, args: {
|
|
33
|
-
/** Neon API key. */apiKey: pulumi.Input<string>; /** Neon project ID. */
|
|
34
|
-
projectId: pulumi.Input<string>; /** Branch display name. */
|
|
35
|
-
name: pulumi.Input<string>;
|
|
36
|
-
}, opts?: pulumi.CustomResourceOptions);
|
|
36
|
+
declare class NeonBranch extends pulumi.ComponentResource {
|
|
37
|
+
/** Neon branch ID. */
|
|
38
|
+
readonly branchId: pulumi.Output<string>;
|
|
39
|
+
constructor(name: string, args: NeonBranchArgs, opts: NeonBranchOptions);
|
|
37
40
|
}
|
|
38
41
|
//#endregion
|
|
39
|
-
export { NeonBranch, NeonBranchInputs };
|
|
42
|
+
export { NeonBranch, NeonBranchArgs, NeonBranchInputs };
|
|
40
43
|
//# sourceMappingURL=branch.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.d.mts","names":[],"sources":["../../src/neon/branch.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"branch.d.mts","names":[],"sources":["../../src/neon/branch.ts"],"mappings":";;;;;;;UAMiB,gBAAA;;EAEhB,MAAA;EAFgC;EAKhC,SAAA;EALgC;EAQhC,IAAA;AAAA;;KAgJI,iBAAA,GAAoB,IAAA,CAAK,MAAA,CAAO,wBAAA;EAhJhC,mCAkJJ,QAAA,EAAU,YAAA,EAFW;EAKrB,OAAA,EAAS,WAAA;AAAA;;UAIO,cAAA;EAJP;EAMT,IAAA,EAAM,MAAA,CAAO,KAAK;AAAA;;;;;;;;;AANE;AAIrB;cAea,UAAA,SAAmB,MAAA,CAAO,iBAAA;;WAEtB,QAAA,EAAU,MAAA,CAAO,MAAA;cAGhC,IAAA,UACA,IAAA,EAAM,cAAA,EACN,IAAA,EAAM,iBAAA;AAAA"}
|
package/dist/neon/branch.mjs
CHANGED
|
@@ -5,11 +5,6 @@ import * as pulumi from "@pulumi/pulumi";
|
|
|
5
5
|
//#region src/neon/branch.ts
|
|
6
6
|
/**
|
|
7
7
|
* Finds an existing Neon branch by name within a project.
|
|
8
|
-
*
|
|
9
|
-
* @param client Authenticated Neon API client
|
|
10
|
-
* @param projectId Neon project ID
|
|
11
|
-
* @param name Exact branch name to match
|
|
12
|
-
* @returns The branch ID if found, `undefined` otherwise
|
|
13
8
|
*/
|
|
14
9
|
async function findBranchByName(client, projectId, name) {
|
|
15
10
|
return (await client.get(`/projects/${projectId}/branches`)).branches.find((b) => b.name === name)?.id;
|
|
@@ -18,15 +13,9 @@ async function findBranchByName(client, projectId, name) {
|
|
|
18
13
|
* Dynamic provider implementing CRUD for Neon branches.
|
|
19
14
|
*
|
|
20
15
|
* Uses adopt-or-create on `create()`: finds an existing branch by name
|
|
21
|
-
* before creating a new one
|
|
16
|
+
* before creating a new one.
|
|
22
17
|
*/
|
|
23
|
-
var
|
|
24
|
-
/**
|
|
25
|
-
* Creates or adopts a Neon branch by name.
|
|
26
|
-
*
|
|
27
|
-
* @param inputs Resolved branch configuration
|
|
28
|
-
* @returns The Neon branch ID as the resource ID
|
|
29
|
-
*/
|
|
18
|
+
var NeonBranchResourceProvider = class {
|
|
30
19
|
async create(inputs) {
|
|
31
20
|
const client = new NeonClient(inputs.apiKey);
|
|
32
21
|
let branchId = await findBranchByName(client, inputs.projectId, inputs.name);
|
|
@@ -37,14 +26,6 @@ var NeonBranchProvider = class {
|
|
|
37
26
|
outs: inputs
|
|
38
27
|
};
|
|
39
28
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Reads current state for `pulumi refresh`.
|
|
42
|
-
*
|
|
43
|
-
* @param id Current Neon branch ID
|
|
44
|
-
* @param props Last known persisted state
|
|
45
|
-
* @returns Refreshed resource ID and properties
|
|
46
|
-
* @throws {Error} If the branch no longer exists
|
|
47
|
-
*/
|
|
48
29
|
async read(id, props) {
|
|
49
30
|
const result = await new NeonClient(props.apiKey).get(`/projects/${props.projectId}/branches/${id}`);
|
|
50
31
|
return {
|
|
@@ -55,12 +36,6 @@ var NeonBranchProvider = class {
|
|
|
55
36
|
}
|
|
56
37
|
};
|
|
57
38
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Deletes the Neon branch. Silently succeeds if already deleted.
|
|
60
|
-
*
|
|
61
|
-
* @param id Neon branch ID to delete
|
|
62
|
-
* @param props Last known persisted state
|
|
63
|
-
*/
|
|
64
39
|
async delete(id, props) {
|
|
65
40
|
const client = new NeonClient(props.apiKey);
|
|
66
41
|
try {
|
|
@@ -69,10 +44,6 @@ var NeonBranchProvider = class {
|
|
|
69
44
|
pulumi.log.warn(`Failed to delete Neon branch (may already be deleted)`);
|
|
70
45
|
}
|
|
71
46
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Compares old and new inputs to detect changes.
|
|
74
|
-
* Changing `projectId` triggers replacement.
|
|
75
|
-
*/
|
|
76
47
|
async diff(_id, olds, news) {
|
|
77
48
|
const replaces = [];
|
|
78
49
|
if (olds.projectId !== news.projectId) replaces.push("projectId");
|
|
@@ -83,26 +54,33 @@ var NeonBranchProvider = class {
|
|
|
83
54
|
};
|
|
84
55
|
}
|
|
85
56
|
};
|
|
57
|
+
/** Internal dynamic resource — not part of the public API. */
|
|
58
|
+
var NeonBranchResource = class extends pulumi.dynamic.Resource {
|
|
59
|
+
constructor(name, args, opts) {
|
|
60
|
+
super(new NeonBranchResourceProvider(), name, { ...args }, opts);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
86
63
|
/**
|
|
87
64
|
* Manages a Neon branch with adopt-or-create semantics.
|
|
88
65
|
*
|
|
89
66
|
* @example
|
|
90
67
|
* ```typescript
|
|
91
|
-
* const branch = new NeonBranch("
|
|
92
|
-
* apiKey: config.requireSecret("neonApiKey"),
|
|
93
|
-
* projectId: "quiet-forest-69719462",
|
|
68
|
+
* const branch = new NeonBranch("production", {
|
|
94
69
|
* name: "production",
|
|
95
|
-
* });
|
|
70
|
+
* }, { provider, project });
|
|
96
71
|
* ```
|
|
97
72
|
*/
|
|
98
|
-
var NeonBranch = class extends pulumi.
|
|
99
|
-
/**
|
|
100
|
-
* @param name Pulumi resource name
|
|
101
|
-
* @param args Branch configuration inputs
|
|
102
|
-
* @param opts Standard Pulumi resource options
|
|
103
|
-
*/
|
|
73
|
+
var NeonBranch = class extends pulumi.ComponentResource {
|
|
104
74
|
constructor(name, args, opts) {
|
|
105
|
-
|
|
75
|
+
const { provider, project, ...pulumiOpts } = opts;
|
|
76
|
+
super("infracraft:neon:Branch", name, {}, pulumiOpts);
|
|
77
|
+
const resource = new NeonBranchResource(`${name}-resource`, {
|
|
78
|
+
apiKey: provider.apiKey,
|
|
79
|
+
projectId: project.projectId,
|
|
80
|
+
name: args.name
|
|
81
|
+
}, { parent: this });
|
|
82
|
+
this.branchId = resource.id;
|
|
83
|
+
this.registerOutputs({ branchId: this.branchId });
|
|
106
84
|
}
|
|
107
85
|
};
|
|
108
86
|
|
package/dist/neon/branch.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"branch.mjs","names":[],"sources":["../../src/neon/branch.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport { NeonClient } from \"./client.js\";\n\n/** Resolved inputs for the Neon branch dynamic provider. */\nexport interface NeonBranchInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID (e.g. `\"quiet-forest-69719462\"`). */\n\tprojectId: string;\n\n\t/** Branch display name (e.g. `\"production\"`, `\"development\"`). */\n\tname: string;\n}\n\n/** Persisted state for the Neon branch. */\ninterface NeonBranchOutputs extends NeonBranchInputs {}\n\n/** Neon API response for a branch. */\ninterface BranchResponse {\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tproject_id: string;\n\t};\n}\n\n/** Neon API response for branch creation. */\ninterface BranchCreateResponse {\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tproject_id: string;\n\t};\n}\n\n/** Neon API response for listing branches. */\ninterface BranchListResponse {\n\tbranches: Array<{\n\t\tid: string;\n\t\tname: string;\n\t}>;\n}\n\n/**\n * Finds an existing Neon branch by name within a project.\n
|
|
1
|
+
{"version":3,"file":"branch.mjs","names":[],"sources":["../../src/neon/branch.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport { NeonClient } from \"./client.js\";\nimport type { NeonProject } from \"./project.js\";\nimport type { NeonProvider } from \"./provider.js\";\n\n/** Resolved inputs for the Neon branch dynamic provider. */\nexport interface NeonBranchInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID (e.g. `\"quiet-forest-69719462\"`). */\n\tprojectId: string;\n\n\t/** Branch display name (e.g. `\"production\"`, `\"development\"`). */\n\tname: string;\n}\n\n/** Persisted state for the Neon branch. */\ninterface NeonBranchOutputs extends NeonBranchInputs {}\n\n/** Neon API response for a branch. */\ninterface BranchResponse {\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tproject_id: string;\n\t};\n}\n\n/** Neon API response for branch creation. */\ninterface BranchCreateResponse {\n\tbranch: {\n\t\tid: string;\n\t\tname: string;\n\t\tproject_id: string;\n\t};\n}\n\n/** Neon API response for listing branches. */\ninterface BranchListResponse {\n\tbranches: Array<{\n\t\tid: string;\n\t\tname: string;\n\t}>;\n}\n\n/**\n * Finds an existing Neon branch by name within a project.\n */\nasync function findBranchByName(\n\tclient: NeonClient,\n\tprojectId: string,\n\tname: string,\n): Promise<string | undefined> {\n\tconst result = await client.get<BranchListResponse>(\n\t\t`/projects/${projectId}/branches`,\n\t);\n\n\tconst match = result.branches.find((b) => b.name === name);\n\n\treturn match?.id;\n}\n\n/**\n * Dynamic provider implementing CRUD for Neon branches.\n *\n * Uses adopt-or-create on `create()`: finds an existing branch by name\n * before creating a new one.\n */\nclass NeonBranchResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(inputs: NeonBranchInputs): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new NeonClient(inputs.apiKey);\n\n\t\tlet branchId = await findBranchByName(\n\t\t\tclient,\n\t\t\tinputs.projectId,\n\t\t\tinputs.name,\n\t\t);\n\n\t\tif (branchId) {\n\t\t\tpulumi.log.info(\n\t\t\t\t`Adopting existing Neon branch \"${inputs.name}\" (${branchId})`,\n\t\t\t);\n\t\t} else {\n\t\t\tconst result = await client.post<BranchCreateResponse>(\n\t\t\t\t`/projects/${inputs.projectId}/branches`,\n\t\t\t\t{ branch: { name: inputs.name } },\n\t\t\t);\n\n\t\t\tbranchId = result.branch.id;\n\t\t}\n\n\t\treturn { id: branchId, outs: inputs };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: NeonBranchOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\tconst result = await client.get<BranchResponse>(\n\t\t\t`/projects/${props.projectId}/branches/${id}`,\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.branch.id,\n\t\t\tprops: { ...props, name: result.branch.name },\n\t\t};\n\t}\n\n\tasync delete(id: string, props: NeonBranchOutputs): Promise<void> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\ttry {\n\t\t\tawait client.delete(`/projects/${props.projectId}/branches/${id}`);\n\t\t} catch {\n\t\t\tpulumi.log.warn(`Failed to delete Neon branch (may already be deleted)`);\n\t\t}\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: NeonBranchOutputs,\n\t\tnews: NeonBranchInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.projectId !== news.projectId) {\n\t\t\treplaces.push(\"projectId\");\n\t\t}\n\n\t\treturn {\n\t\t\tchanges: replaces.length > 0 || olds.name !== news.name,\n\t\t\treplaces,\n\t\t\tdeleteBeforeReplace: true,\n\t\t};\n\t}\n}\n\n/** Internal dynamic resource — not part of the public API. */\nclass NeonBranchResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly branchId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\tapiKey: pulumi.Input<string>;\n\t\t\tprojectId: pulumi.Input<string>;\n\t\t\tname: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(new NeonBranchResourceProvider(), name, { ...args }, opts);\n\t}\n}\n\n/** Options type for NeonBranch — replaces Pulumi's native `provider` field. */\ntype NeonBranchOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\t/** Neon authentication context. */\n\tprovider: NeonProvider;\n\n\t/** Neon project context. */\n\tproject: NeonProject;\n};\n\n/** Args for NeonBranch. */\nexport interface NeonBranchArgs {\n\t/** Branch display name. */\n\tname: pulumi.Input<string>;\n}\n\n/**\n * Manages a Neon branch with adopt-or-create semantics.\n *\n * @example\n * ```typescript\n * const branch = new NeonBranch(\"production\", {\n * name: \"production\",\n * }, { provider, project });\n * ```\n */\nexport class NeonBranch extends pulumi.ComponentResource {\n\t/** Neon branch ID. */\n\tpublic readonly branchId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: NeonBranchArgs,\n\t\topts: NeonBranchOptions,\n\t) {\n\t\tconst { provider, project, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:neon:Branch\", name, {}, pulumiOpts);\n\n\t\tconst resource = new NeonBranchResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\tapiKey: provider.apiKey,\n\t\t\t\tprojectId: project.projectId,\n\t\t\t\tname: args.name,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.branchId = resource.id;\n\n\t\tthis.registerOutputs({ branchId: this.branchId });\n\t}\n}\n"],"mappings":";;;;;;;;AAiDA,eAAe,iBACd,QACA,WACA,MAC8B;CAO9B,QAFc,MAJO,OAAO,IAC3B,aAAa,UAAU,UACxB,GAEqB,SAAS,MAAM,MAAM,EAAE,SAAS,IAE1C,GAAG;AACf;;;;;;;AAQA,IAAM,6BAAN,MAA4E;CAC3E,MAAM,OAAO,QAAgE;EAC5E,MAAM,SAAS,IAAI,WAAW,OAAO,MAAM;EAE3C,IAAI,WAAW,MAAM,iBACpB,QACA,OAAO,WACP,OAAO,IACR;EAEA,IAAI,UACH,OAAO,IAAI,KACV,kCAAkC,OAAO,KAAK,KAAK,SAAS,EAC7D;OAOA,YAAW,MALU,OAAO,KAC3B,aAAa,OAAO,UAAU,YAC9B,EAAE,QAAQ,EAAE,MAAM,OAAO,KAAK,EAAE,CACjC,GAEkB,OAAO;EAG1B,OAAO;GAAE,IAAI;GAAU,MAAM;EAAO;CACrC;CAEA,MAAM,KACL,IACA,OACqC;EAGrC,MAAM,SAAS,MAAM,IAFF,WAAW,MAAM,MAEV,EAAE,IAC3B,aAAa,MAAM,UAAU,YAAY,IAC1C;EAEA,OAAO;GACN,IAAI,OAAO,OAAO;GAClB,OAAO;IAAE,GAAG;IAAO,MAAM,OAAO,OAAO;GAAK;EAC7C;CACD;CAEA,MAAM,OAAO,IAAY,OAAyC;EACjE,MAAM,SAAS,IAAI,WAAW,MAAM,MAAM;EAE1C,IAAI;GACH,MAAM,OAAO,OAAO,aAAa,MAAM,UAAU,YAAY,IAAI;EAClE,QAAQ;GACP,OAAO,IAAI,KAAK,uDAAuD;EACxE;CACD;CAEA,MAAM,KACL,KACA,MACA,MACqC;EACrC,MAAM,WAAqB,CAAC;EAE5B,IAAI,KAAK,cAAc,KAAK,WAC3B,SAAS,KAAK,WAAW;EAG1B,OAAO;GACN,SAAS,SAAS,SAAS,KAAK,KAAK,SAAS,KAAK;GACnD;GACA,qBAAqB;EACtB;CACD;AACD;;AAGA,IAAM,qBAAN,cAAiC,OAAO,QAAQ,SAAS;CAGxD,YACC,MACA,MAKA,MACC;EACD,MAAM,IAAI,2BAA2B,GAAG,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI;CAChE;AACD;;;;;;;;;;;AA2BA,IAAa,aAAb,cAAgC,OAAO,kBAAkB;CAIxD,YACC,MACA,MACA,MACC;EACD,MAAM,EAAE,UAAU,SAAS,GAAG,eAAe;EAE7C,MAAM,0BAA0B,MAAM,CAAC,GAAG,UAAU;EAEpD,MAAM,WAAW,IAAI,mBACpB,GAAG,KAAK,YACR;GACC,QAAQ,SAAS;GACjB,WAAW,QAAQ;GACnB,MAAM,KAAK;EACZ,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,WAAW,SAAS;EAEzB,KAAK,gBAAgB,EAAE,UAAU,KAAK,SAAS,CAAC;CACjD;AACD"}
|
package/dist/neon/database.cjs
CHANGED
|
@@ -7,12 +7,6 @@ _pulumi_pulumi = require_chunk.__toESM(_pulumi_pulumi, 1);
|
|
|
7
7
|
//#region src/neon/database.ts
|
|
8
8
|
/**
|
|
9
9
|
* Finds an existing database by name on a branch.
|
|
10
|
-
*
|
|
11
|
-
* @param client Authenticated Neon API client
|
|
12
|
-
* @param projectId Neon project ID
|
|
13
|
-
* @param branchId Branch ID to search within
|
|
14
|
-
* @param name Exact database name to match
|
|
15
|
-
* @returns `true` if found, `false` otherwise
|
|
16
10
|
*/
|
|
17
11
|
async function findDatabaseByName(client, projectId, branchId, name) {
|
|
18
12
|
return (await client.get(`/projects/${projectId}/branches/${branchId}/databases`)).databases.some((d) => d.name === name);
|
|
@@ -23,13 +17,7 @@ async function findDatabaseByName(client, projectId, branchId, name) {
|
|
|
23
17
|
* Uses adopt-or-create on `create()`: checks if the database already exists
|
|
24
18
|
* before creating a new one.
|
|
25
19
|
*/
|
|
26
|
-
var
|
|
27
|
-
/**
|
|
28
|
-
* Creates or adopts a Neon database by name.
|
|
29
|
-
*
|
|
30
|
-
* @param inputs Resolved database configuration
|
|
31
|
-
* @returns Composite ID `{branchId}/{databaseName}` as the resource ID
|
|
32
|
-
*/
|
|
20
|
+
var NeonDatabaseResourceProvider = class {
|
|
33
21
|
async create(inputs) {
|
|
34
22
|
const client = new require_neon_client.NeonClient(inputs.apiKey);
|
|
35
23
|
if (await findDatabaseByName(client, inputs.projectId, inputs.branchId, inputs.name)) _pulumi_pulumi.log.info(`Adopting existing Neon database "${inputs.name}"`);
|
|
@@ -42,14 +30,6 @@ var NeonDatabaseProvider = class {
|
|
|
42
30
|
outs: inputs
|
|
43
31
|
};
|
|
44
32
|
}
|
|
45
|
-
/**
|
|
46
|
-
* Reads current state for `pulumi refresh`.
|
|
47
|
-
*
|
|
48
|
-
* @param id Current composite database ID
|
|
49
|
-
* @param props Last known persisted state
|
|
50
|
-
* @returns Refreshed resource ID and properties
|
|
51
|
-
* @throws {Error} If the database no longer exists
|
|
52
|
-
*/
|
|
53
33
|
async read(id, props) {
|
|
54
34
|
const result = await new require_neon_client.NeonClient(props.apiKey).get(`/projects/${props.projectId}/branches/${props.branchId}/databases/${props.name}`);
|
|
55
35
|
return {
|
|
@@ -60,9 +40,6 @@ var NeonDatabaseProvider = class {
|
|
|
60
40
|
}
|
|
61
41
|
};
|
|
62
42
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Deletes the Neon database. Silently succeeds if already deleted.
|
|
65
|
-
*/
|
|
66
43
|
async delete(_id, props) {
|
|
67
44
|
const client = new require_neon_client.NeonClient(props.apiKey);
|
|
68
45
|
try {
|
|
@@ -71,10 +48,6 @@ var NeonDatabaseProvider = class {
|
|
|
71
48
|
_pulumi_pulumi.log.warn(`Failed to delete Neon database "${props.name}" (may already be deleted)`);
|
|
72
49
|
}
|
|
73
50
|
}
|
|
74
|
-
/**
|
|
75
|
-
* Compares old and new inputs. All fields trigger replacement
|
|
76
|
-
* since databases cannot be renamed or moved.
|
|
77
|
-
*/
|
|
78
51
|
async diff(_id, olds, news) {
|
|
79
52
|
const replaces = [];
|
|
80
53
|
if (olds.projectId !== news.projectId) replaces.push("projectId");
|
|
@@ -87,28 +60,35 @@ var NeonDatabaseProvider = class {
|
|
|
87
60
|
};
|
|
88
61
|
}
|
|
89
62
|
};
|
|
63
|
+
/** Internal dynamic resource — not part of the public API. */
|
|
64
|
+
var NeonDatabaseResource = class extends _pulumi_pulumi.dynamic.Resource {
|
|
65
|
+
constructor(name, args, opts) {
|
|
66
|
+
super(new NeonDatabaseResourceProvider(), name, { ...args }, opts);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
90
69
|
/**
|
|
91
70
|
* Manages a Neon database with adopt-or-create semantics.
|
|
92
71
|
*
|
|
93
72
|
* @example
|
|
94
73
|
* ```typescript
|
|
95
|
-
* new NeonDatabase("
|
|
96
|
-
* apiKey: config.requireSecret("neonApiKey"),
|
|
97
|
-
* projectId: "quiet-forest-69719462",
|
|
98
|
-
* branchId: branch.id,
|
|
74
|
+
* new NeonDatabase("main", {
|
|
99
75
|
* name: "neondb",
|
|
100
76
|
* ownerName: "neondb_owner",
|
|
101
|
-
* });
|
|
77
|
+
* }, { provider, project, branch });
|
|
102
78
|
* ```
|
|
103
79
|
*/
|
|
104
|
-
var NeonDatabase = class extends _pulumi_pulumi.
|
|
105
|
-
/**
|
|
106
|
-
* @param name Pulumi resource name
|
|
107
|
-
* @param args Database configuration inputs
|
|
108
|
-
* @param opts Standard Pulumi resource options
|
|
109
|
-
*/
|
|
80
|
+
var NeonDatabase = class extends _pulumi_pulumi.ComponentResource {
|
|
110
81
|
constructor(name, args, opts) {
|
|
111
|
-
|
|
82
|
+
const { provider, project, branch, ...pulumiOpts } = opts;
|
|
83
|
+
super("infracraft:neon:Database", name, {}, pulumiOpts);
|
|
84
|
+
new NeonDatabaseResource(`${name}-resource`, {
|
|
85
|
+
apiKey: provider.apiKey,
|
|
86
|
+
projectId: project.projectId,
|
|
87
|
+
branchId: branch.branchId,
|
|
88
|
+
name: args.name,
|
|
89
|
+
ownerName: args.ownerName
|
|
90
|
+
}, { parent: this });
|
|
91
|
+
this.registerOutputs({});
|
|
112
92
|
}
|
|
113
93
|
};
|
|
114
94
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.cjs","names":["NeonClient","pulumi"],"sources":["../../src/neon/database.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport { NeonClient } from \"./client.js\";\n\n/** Resolved inputs for the Neon database dynamic provider. */\nexport interface NeonDatabaseInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID. */\n\tprojectId: string;\n\n\t/** Branch ID the database belongs to. */\n\tbranchId: string;\n\n\t/** Database name (e.g. `\"neondb\"`). */\n\tname: string;\n\n\t/** Owner role name (e.g. `\"neondb_owner\"`). */\n\townerName: string;\n}\n\n/** Persisted state for the Neon database. */\ninterface NeonDatabaseOutputs extends NeonDatabaseInputs {}\n\n/** Neon API response for a database. */\ninterface DatabaseResponse {\n\tdatabase: {\n\t\tid: number;\n\t\tname: string;\n\t\towner_name: string;\n\t\tbranch_id: string;\n\t};\n}\n\n/** Neon API response for listing databases. */\ninterface DatabaseListResponse {\n\tdatabases: Array<{\n\t\tid: number;\n\t\tname: string;\n\t\towner_name: string;\n\t}>;\n}\n\n/**\n * Finds an existing database by name on a branch.\n
|
|
1
|
+
{"version":3,"file":"database.cjs","names":["NeonClient","pulumi"],"sources":["../../src/neon/database.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport { NeonClient } from \"./client.js\";\nimport type { NeonBranch } from \"./branch.js\";\nimport type { NeonProject } from \"./project.js\";\nimport type { NeonProvider } from \"./provider.js\";\n\n/** Resolved inputs for the Neon database dynamic provider. */\nexport interface NeonDatabaseInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID. */\n\tprojectId: string;\n\n\t/** Branch ID the database belongs to. */\n\tbranchId: string;\n\n\t/** Database name (e.g. `\"neondb\"`). */\n\tname: string;\n\n\t/** Owner role name (e.g. `\"neondb_owner\"`). */\n\townerName: string;\n}\n\n/** Persisted state for the Neon database. */\ninterface NeonDatabaseOutputs extends NeonDatabaseInputs {}\n\n/** Neon API response for a database. */\ninterface DatabaseResponse {\n\tdatabase: {\n\t\tid: number;\n\t\tname: string;\n\t\towner_name: string;\n\t\tbranch_id: string;\n\t};\n}\n\n/** Neon API response for listing databases. */\ninterface DatabaseListResponse {\n\tdatabases: Array<{\n\t\tid: number;\n\t\tname: string;\n\t\towner_name: string;\n\t}>;\n}\n\n/**\n * Finds an existing database by name on a branch.\n */\nasync function findDatabaseByName(\n\tclient: NeonClient,\n\tprojectId: string,\n\tbranchId: string,\n\tname: string,\n): Promise<boolean> {\n\tconst result = await client.get<DatabaseListResponse>(\n\t\t`/projects/${projectId}/branches/${branchId}/databases`,\n\t);\n\n\treturn result.databases.some((d) => d.name === name);\n}\n\n/**\n * Dynamic provider implementing CRUD for Neon databases.\n *\n * Uses adopt-or-create on `create()`: checks if the database already exists\n * before creating a new one.\n */\nclass NeonDatabaseResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(\n\t\tinputs: NeonDatabaseInputs,\n\t): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new NeonClient(inputs.apiKey);\n\n\t\tconst exists = await findDatabaseByName(\n\t\t\tclient,\n\t\t\tinputs.projectId,\n\t\t\tinputs.branchId,\n\t\t\tinputs.name,\n\t\t);\n\n\t\tif (exists) {\n\t\t\tpulumi.log.info(`Adopting existing Neon database \"${inputs.name}\"`);\n\t\t} else {\n\t\t\tawait client.post(\n\t\t\t\t`/projects/${inputs.projectId}/branches/${inputs.branchId}/databases`,\n\t\t\t\t{ database: { name: inputs.name, owner_name: inputs.ownerName } },\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tid: `${inputs.branchId}/${inputs.name}`,\n\t\t\touts: inputs,\n\t\t};\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: NeonDatabaseOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\tconst result = await client.get<DatabaseResponse>(\n\t\t\t`/projects/${props.projectId}/branches/${props.branchId}/databases/${props.name}`,\n\t\t);\n\n\t\treturn {\n\t\t\tid,\n\t\t\tprops: { ...props, ownerName: result.database.owner_name },\n\t\t};\n\t}\n\n\tasync delete(_id: string, props: NeonDatabaseOutputs): Promise<void> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\ttry {\n\t\t\tawait client.delete(\n\t\t\t\t`/projects/${props.projectId}/branches/${props.branchId}/databases/${props.name}`,\n\t\t\t);\n\t\t} catch {\n\t\t\tpulumi.log.warn(\n\t\t\t\t`Failed to delete Neon database \"${props.name}\" (may already be deleted)`,\n\t\t\t);\n\t\t}\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: NeonDatabaseOutputs,\n\t\tnews: NeonDatabaseInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.projectId !== news.projectId) {\n\t\t\treplaces.push(\"projectId\");\n\t\t}\n\n\t\tif (olds.branchId !== news.branchId) {\n\t\t\treplaces.push(\"branchId\");\n\t\t}\n\n\t\tif (olds.name !== news.name) {\n\t\t\treplaces.push(\"name\");\n\t\t}\n\n\t\treturn {\n\t\t\tchanges: replaces.length > 0 || olds.ownerName !== news.ownerName,\n\t\t\treplaces,\n\t\t\tdeleteBeforeReplace: true,\n\t\t};\n\t}\n}\n\n/** Internal dynamic resource — not part of the public API. */\nclass NeonDatabaseResource extends pulumi.dynamic.Resource {\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\tapiKey: pulumi.Input<string>;\n\t\t\tprojectId: pulumi.Input<string>;\n\t\t\tbranchId: pulumi.Input<string>;\n\t\t\tname: pulumi.Input<string>;\n\t\t\townerName: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(new NeonDatabaseResourceProvider(), name, { ...args }, opts);\n\t}\n}\n\n/** Options type for NeonDatabase — replaces Pulumi's native `provider` field. */\ntype NeonDatabaseOptions = Omit<\n\tpulumi.ComponentResourceOptions,\n\t\"provider\"\n> & {\n\t/** Neon authentication context. */\n\tprovider: NeonProvider;\n\n\t/** Neon project context. */\n\tproject: NeonProject;\n\n\t/** Neon branch context. */\n\tbranch: NeonBranch;\n};\n\n/** Args for NeonDatabase. */\nexport interface NeonDatabaseArgs {\n\t/** Database name. */\n\tname: pulumi.Input<string>;\n\n\t/** Owner role name. */\n\townerName: pulumi.Input<string>;\n}\n\n/**\n * Manages a Neon database with adopt-or-create semantics.\n *\n * @example\n * ```typescript\n * new NeonDatabase(\"main\", {\n * name: \"neondb\",\n * ownerName: \"neondb_owner\",\n * }, { provider, project, branch });\n * ```\n */\nexport class NeonDatabase extends pulumi.ComponentResource {\n\tconstructor(\n\t\tname: string,\n\t\targs: NeonDatabaseArgs,\n\t\topts: NeonDatabaseOptions,\n\t) {\n\t\tconst { provider, project, branch, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:neon:Database\", name, {}, pulumiOpts);\n\n\t\tnew NeonDatabaseResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\tapiKey: provider.apiKey,\n\t\t\t\tprojectId: project.projectId,\n\t\t\t\tbranchId: branch.branchId,\n\t\t\t\tname: args.name,\n\t\t\t\townerName: args.ownerName,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.registerOutputs({});\n\t}\n}\n"],"mappings":";;;;;;;;;;AAiDA,eAAe,mBACd,QACA,WACA,UACA,MACmB;CAKnB,QAAO,MAJc,OAAO,IAC3B,aAAa,UAAU,YAAY,SAAS,WAC7C,GAEc,UAAU,MAAM,MAAM,EAAE,SAAS,IAAI;AACpD;;;;;;;AAQA,IAAM,+BAAN,MAA8E;CAC7E,MAAM,OACL,QACuC;EACvC,MAAM,SAAS,IAAIA,+BAAW,OAAO,MAAM;EAS3C,IAAI,MAPiB,mBACpB,QACA,OAAO,WACP,OAAO,UACP,OAAO,IACR,GAGC,eAAO,IAAI,KAAK,oCAAoC,OAAO,KAAK,EAAE;OAElE,MAAM,OAAO,KACZ,aAAa,OAAO,UAAU,YAAY,OAAO,SAAS,aAC1D,EAAE,UAAU;GAAE,MAAM,OAAO;GAAM,YAAY,OAAO;EAAU,EAAE,CACjE;EAGD,OAAO;GACN,IAAI,GAAG,OAAO,SAAS,GAAG,OAAO;GACjC,MAAM;EACP;CACD;CAEA,MAAM,KACL,IACA,OACqC;EAGrC,MAAM,SAAS,MAAM,IAFFA,+BAAW,MAAM,MAEV,EAAE,IAC3B,aAAa,MAAM,UAAU,YAAY,MAAM,SAAS,aAAa,MAAM,MAC5E;EAEA,OAAO;GACN;GACA,OAAO;IAAE,GAAG;IAAO,WAAW,OAAO,SAAS;GAAW;EAC1D;CACD;CAEA,MAAM,OAAO,KAAa,OAA2C;EACpE,MAAM,SAAS,IAAIA,+BAAW,MAAM,MAAM;EAE1C,IAAI;GACH,MAAM,OAAO,OACZ,aAAa,MAAM,UAAU,YAAY,MAAM,SAAS,aAAa,MAAM,MAC5E;EACD,QAAQ;GACP,eAAO,IAAI,KACV,mCAAmC,MAAM,KAAK,2BAC/C;EACD;CACD;CAEA,MAAM,KACL,KACA,MACA,MACqC;EACrC,MAAM,WAAqB,CAAC;EAE5B,IAAI,KAAK,cAAc,KAAK,WAC3B,SAAS,KAAK,WAAW;EAG1B,IAAI,KAAK,aAAa,KAAK,UAC1B,SAAS,KAAK,UAAU;EAGzB,IAAI,KAAK,SAAS,KAAK,MACtB,SAAS,KAAK,MAAM;EAGrB,OAAO;GACN,SAAS,SAAS,SAAS,KAAK,KAAK,cAAc,KAAK;GACxD;GACA,qBAAqB;EACtB;CACD;AACD;;AAGA,IAAM,uBAAN,cAAmCC,eAAO,QAAQ,SAAS;CAC1D,YACC,MACA,MAOA,MACC;EACD,MAAM,IAAI,6BAA6B,GAAG,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI;CAClE;AACD;;;;;;;;;;;;AAqCA,IAAa,eAAb,cAAkCA,eAAO,kBAAkB;CAC1D,YACC,MACA,MACA,MACC;EACD,MAAM,EAAE,UAAU,SAAS,QAAQ,GAAG,eAAe;EAErD,MAAM,4BAA4B,MAAM,CAAC,GAAG,UAAU;EAEtD,IAAI,qBACH,GAAG,KAAK,YACR;GACC,QAAQ,SAAS;GACjB,WAAW,QAAQ;GACnB,UAAU,OAAO;GACjB,MAAM,KAAK;GACX,WAAW,KAAK;EACjB,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,gBAAgB,CAAC,CAAC;CACxB;AACD"}
|
package/dist/neon/database.d.cts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { t as __name } from "../chunk-OPjESj5l.cjs";
|
|
2
|
+
import { NeonProvider } from "./provider.cjs";
|
|
3
|
+
import { NeonProject } from "./project.cjs";
|
|
4
|
+
import { NeonBranch } from "./branch.cjs";
|
|
2
5
|
import * as pulumi from "@pulumi/pulumi";
|
|
3
6
|
|
|
4
7
|
//#region src/neon/database.d.ts
|
|
@@ -15,34 +18,33 @@ interface NeonDatabaseInputs {
|
|
|
15
18
|
/** Owner role name (e.g. `"neondb_owner"`). */
|
|
16
19
|
ownerName: string;
|
|
17
20
|
}
|
|
21
|
+
/** Options type for NeonDatabase — replaces Pulumi's native `provider` field. */
|
|
22
|
+
type NeonDatabaseOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
|
|
23
|
+
/** Neon authentication context. */provider: NeonProvider; /** Neon project context. */
|
|
24
|
+
project: NeonProject; /** Neon branch context. */
|
|
25
|
+
branch: NeonBranch;
|
|
26
|
+
};
|
|
27
|
+
/** Args for NeonDatabase. */
|
|
28
|
+
interface NeonDatabaseArgs {
|
|
29
|
+
/** Database name. */
|
|
30
|
+
name: pulumi.Input<string>;
|
|
31
|
+
/** Owner role name. */
|
|
32
|
+
ownerName: pulumi.Input<string>;
|
|
33
|
+
}
|
|
18
34
|
/**
|
|
19
35
|
* Manages a Neon database with adopt-or-create semantics.
|
|
20
36
|
*
|
|
21
37
|
* @example
|
|
22
38
|
* ```typescript
|
|
23
|
-
* new NeonDatabase("
|
|
24
|
-
* apiKey: config.requireSecret("neonApiKey"),
|
|
25
|
-
* projectId: "quiet-forest-69719462",
|
|
26
|
-
* branchId: branch.id,
|
|
39
|
+
* new NeonDatabase("main", {
|
|
27
40
|
* name: "neondb",
|
|
28
41
|
* ownerName: "neondb_owner",
|
|
29
|
-
* });
|
|
42
|
+
* }, { provider, project, branch });
|
|
30
43
|
* ```
|
|
31
44
|
*/
|
|
32
|
-
declare class NeonDatabase extends pulumi.
|
|
33
|
-
|
|
34
|
-
* @param name Pulumi resource name
|
|
35
|
-
* @param args Database configuration inputs
|
|
36
|
-
* @param opts Standard Pulumi resource options
|
|
37
|
-
*/
|
|
38
|
-
constructor(name: string, args: {
|
|
39
|
-
/** Neon API key. */apiKey: pulumi.Input<string>; /** Neon project ID. */
|
|
40
|
-
projectId: pulumi.Input<string>; /** Branch ID the database belongs to. */
|
|
41
|
-
branchId: pulumi.Input<string>; /** Database name. */
|
|
42
|
-
name: pulumi.Input<string>; /** Owner role name. */
|
|
43
|
-
ownerName: pulumi.Input<string>;
|
|
44
|
-
}, opts?: pulumi.CustomResourceOptions);
|
|
45
|
+
declare class NeonDatabase extends pulumi.ComponentResource {
|
|
46
|
+
constructor(name: string, args: NeonDatabaseArgs, opts: NeonDatabaseOptions);
|
|
45
47
|
}
|
|
46
48
|
//#endregion
|
|
47
|
-
export { NeonDatabase, NeonDatabaseInputs };
|
|
49
|
+
export { NeonDatabase, NeonDatabaseArgs, NeonDatabaseInputs };
|
|
48
50
|
//# sourceMappingURL=database.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"database.d.cts","names":[],"sources":["../../src/neon/database.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"database.d.cts","names":[],"sources":["../../src/neon/database.ts"],"mappings":";;;;;;;;UAOiB,kBAAA;;EAEhB,MAAA;EAFkC;EAKlC,SAAA;EALkC;EAQlC,QAAA;EAHA;EAMA,IAAA;EAAA;EAGA,SAAA;AAAA;AAAS;AAAA,KAsJL,mBAAA,GAAsB,IAAA,CAC1B,MAAA,CAAO,wBAAA;EADgB,mCAKvB,QAAA,EAAU,YAAA,EAJV;EAOA,OAAA,EAAS,WAAA,EAHC;EAMV,MAAA,EAAQ,UAAA;AAAA;;UAIQ,gBAAA;EAfU;EAiB1B,IAAA,EAAM,MAAA,CAAO,KAAA;EAhBN;EAmBP,SAAA,EAAW,MAAA,CAAO,KAAK;AAAA;;;;;;AATL;AAInB;;;;;cAmBa,YAAA,SAAqB,MAAA,CAAO,iBAAA;cAEvC,IAAA,UACA,IAAA,EAAM,gBAAA,EACN,IAAA,EAAM,mBAAA;AAAA"}
|