@infracraft/pulumi 1.6.2 → 1.6.4
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/endpoint.cjs +2 -1
- package/dist/neon/endpoint.cjs.map +1 -1
- package/dist/neon/endpoint.d.cts.map +1 -1
- package/dist/neon/endpoint.d.mts.map +1 -1
- package/dist/neon/endpoint.mjs +2 -1
- package/dist/neon/endpoint.mjs.map +1 -1
- package/dist/vercel/integration.cjs +8 -3
- package/dist/vercel/integration.cjs.map +1 -1
- package/dist/vercel/integration.d.cts.map +1 -1
- package/dist/vercel/integration.d.mts.map +1 -1
- package/dist/vercel/integration.mjs +8 -3
- package/dist/vercel/integration.mjs.map +1 -1
- package/package.json +1 -1
package/dist/neon/endpoint.cjs
CHANGED
|
@@ -40,7 +40,8 @@ var NeonEndpointResourceProvider = class {
|
|
|
40
40
|
}
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
-
const result = await client.post(`/projects/${inputs.projectId}/
|
|
43
|
+
const result = await client.post(`/projects/${inputs.projectId}/endpoints`, { endpoint: {
|
|
44
|
+
branch_id: inputs.branchId,
|
|
44
45
|
type: "read_write",
|
|
45
46
|
autoscaling_limit_min_cu: inputs.minCu,
|
|
46
47
|
autoscaling_limit_max_cu: inputs.maxCu,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.cjs","names":["NeonClient","pulumi"],"sources":["../../src/neon/endpoint.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { NeonBranch } from \"./branch\";\nimport { NeonClient } from \"./client\";\nimport type { NeonProject } from \"./project\";\nimport type { NeonProvider } from \"./provider\";\n\n/** Resolved inputs for the Neon endpoint dynamic provider. */\nexport interface NeonEndpointInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID. */\n\tprojectId: string;\n\n\t/** Branch ID to attach the endpoint to. */\n\tbranchId: string;\n\n\t/** Minimum compute units (e.g. `0.25`). */\n\tminCu: number;\n\n\t/** Maximum compute units (e.g. `2`). */\n\tmaxCu: number;\n\n\t/** Seconds of inactivity before suspending. `0` means use global default. */\n\tsuspendTimeout: number;\n}\n\n/** Persisted state for the Neon endpoint. */\ninterface NeonEndpointOutputs extends NeonEndpointInputs {\n\t/** Endpoint hostname (e.g. `\"ep-delicate-union-ah0ekn7n.us-east-1.aws.neon.tech\"`). */\n\thost: string;\n}\n\n/** Neon API response for an endpoint. */\ninterface EndpointResponse {\n\tendpoint: {\n\t\tid: string;\n\t\thost: string;\n\t\tbranch_id: string;\n\t\tautoscaling_limit_min_cu: number;\n\t\tautoscaling_limit_max_cu: number;\n\t\tsuspend_timeout_seconds: number;\n\t};\n}\n\n/** Neon API response for listing endpoints. */\ninterface EndpointListResponse {\n\tendpoints: Array<{\n\t\tid: string;\n\t\thost: string;\n\t\tbranch_id: string;\n\t\ttype: string;\n\t}>;\n}\n\n/**\n * Finds an existing read-write endpoint for a branch.\n */\nasync function findEndpointByBranch(\n\tclient: NeonClient,\n\tprojectId: string,\n\tbranchId: string,\n): Promise<{ id: string; host: string } | undefined> {\n\tconst result = await client.get<EndpointListResponse>(\n\t\t`/projects/${projectId}/branches/${branchId}/endpoints`,\n\t);\n\n\tconst match = result.endpoints.find((e) => e.type === \"read_write\");\n\n\treturn match ? { id: match.id, host: match.host } : undefined;\n}\n\n/**\n * Dynamic provider implementing CRUD for Neon compute endpoints.\n *\n * Uses adopt-or-create on `create()`: finds an existing read-write endpoint\n * on the target branch before creating a new one.\n */\nclass NeonEndpointResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(\n\t\tinputs: NeonEndpointInputs,\n\t): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new NeonClient(inputs.apiKey);\n\n\t\tconst existing = await findEndpointByBranch(\n\t\t\tclient,\n\t\t\tinputs.projectId,\n\t\t\tinputs.branchId,\n\t\t);\n\n\t\tif (existing) {\n\t\t\tpulumi.log.info(`Adopting existing Neon endpoint (${existing.id})`);\n\n\t\t\tawait client.patch(\n\t\t\t\t`/projects/${inputs.projectId}/endpoints/${existing.id}`,\n\t\t\t\t{\n\t\t\t\t\tendpoint: {\n\t\t\t\t\t\tautoscaling_limit_min_cu: inputs.minCu,\n\t\t\t\t\t\tautoscaling_limit_max_cu: inputs.maxCu,\n\t\t\t\t\t\tsuspend_timeout_seconds: inputs.suspendTimeout,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tid: existing.id,\n\t\t\t\touts: { ...inputs, host: existing.host },\n\t\t\t};\n\t\t}\n\n\t\tconst result = await client.post<EndpointResponse>(\n\t\t\t`/projects/${inputs.projectId}/branches/${inputs.branchId}/endpoints`,\n\t\t\t{\n\t\t\t\tendpoint: {\n\t\t\t\t\ttype: \"read_write\",\n\t\t\t\t\tautoscaling_limit_min_cu: inputs.minCu,\n\t\t\t\t\tautoscaling_limit_max_cu: inputs.maxCu,\n\t\t\t\t\tsuspend_timeout_seconds: inputs.suspendTimeout,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.endpoint.id,\n\t\t\touts: { ...inputs, host: result.endpoint.host },\n\t\t};\n\t}\n\n\tasync update(\n\t\tid: string,\n\t\t_olds: NeonEndpointOutputs,\n\t\tnews: NeonEndpointInputs,\n\t): Promise<pulumi.dynamic.UpdateResult> {\n\t\tconst client = new NeonClient(news.apiKey);\n\n\t\tconst result = await client.patch<EndpointResponse>(\n\t\t\t`/projects/${news.projectId}/endpoints/${id}`,\n\t\t\t{\n\t\t\t\tendpoint: {\n\t\t\t\t\tautoscaling_limit_min_cu: news.minCu,\n\t\t\t\t\tautoscaling_limit_max_cu: news.maxCu,\n\t\t\t\t\tsuspend_timeout_seconds: news.suspendTimeout,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn { outs: { ...news, host: result.endpoint.host } };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: NeonEndpointOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\tconst result = await client.get<EndpointResponse>(\n\t\t\t`/projects/${props.projectId}/endpoints/${id}`,\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.endpoint.id,\n\t\t\tprops: {\n\t\t\t\t...props,\n\t\t\t\thost: result.endpoint.host,\n\t\t\t\tminCu: result.endpoint.autoscaling_limit_min_cu,\n\t\t\t\tmaxCu: result.endpoint.autoscaling_limit_max_cu,\n\t\t\t\tsuspendTimeout: result.endpoint.suspend_timeout_seconds,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync delete(id: string, props: NeonEndpointOutputs): Promise<void> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\ttry {\n\t\t\tawait client.delete(`/projects/${props.projectId}/endpoints/${id}`);\n\t\t} catch {\n\t\t\tpulumi.log.warn(\n\t\t\t\t`Failed to delete Neon endpoint (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: NeonEndpointOutputs,\n\t\tnews: NeonEndpointInputs,\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\tconst hasChanges =\n\t\t\treplaces.length > 0 ||\n\t\t\tolds.minCu !== news.minCu ||\n\t\t\tolds.maxCu !== news.maxCu ||\n\t\t\tolds.suspendTimeout !== news.suspendTimeout;\n\n\t\treturn { changes: hasChanges, replaces, deleteBeforeReplace: true };\n\t}\n}\n\n/** Internal dynamic resource — not part of the public API. */\nclass NeonEndpointResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly host: 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\tbranchId: pulumi.Input<string>;\n\t\t\tminCu: pulumi.Input<number>;\n\t\t\tmaxCu: pulumi.Input<number>;\n\t\t\tsuspendTimeout: pulumi.Input<number>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew NeonEndpointResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, host: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for NeonEndpoint — replaces Pulumi's native `provider` field. */\ntype NeonEndpointOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\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 NeonEndpoint. */\nexport interface NeonEndpointArgs {\n\t/** Minimum compute units. */\n\tminCu: pulumi.Input<number>;\n\n\t/** Maximum compute units. */\n\tmaxCu: pulumi.Input<number>;\n\n\t/** Seconds of inactivity before suspending. */\n\tsuspendTimeout: pulumi.Input<number>;\n}\n\n/**\n * Manages a Neon compute endpoint with adopt-or-create semantics.\n * Exposes `host` as an output for connection string composition.\n *\n * @example\n * ```typescript\n * const endpoint = new NeonEndpoint(\"production\", {\n * minCu: 0.25,\n * maxCu: 1,\n * suspendTimeout: 0,\n * }, { provider, project, branch });\n * ```\n */\nexport class NeonEndpoint extends pulumi.ComponentResource {\n\t/** Endpoint hostname for connection strings. */\n\tpublic readonly host: pulumi.Output<string>;\n\n\tconstructor(name: string, args: NeonEndpointArgs, opts: NeonEndpointOptions) {\n\t\tconst { provider, project, branch, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:neon:Endpoint\", name, {}, pulumiOpts);\n\n\t\tconst resource = new NeonEndpointResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\tapiKey: provider.apiKey,\n\t\t\t\tprojectId: project.id,\n\t\t\t\tbranchId: branch.id,\n\t\t\t\t...args,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.host = resource.host;\n\n\t\tthis.registerOutputs({ host: this.host });\n\t}\n}\n"],"mappings":";;;;;;;;;;AA0DA,eAAe,qBACd,QACA,WACA,UACoD;CAKpD,MAAM,SAAQ,MAJO,OAAO,IAC3B,aAAa,UAAU,YAAY,SAAS,WAC7C,GAEqB,UAAU,MAAM,MAAM,EAAE,SAAS,YAAY;CAElE,OAAO,QAAQ;EAAE,IAAI,MAAM;EAAI,MAAM,MAAM;CAAK,IAAI;AACrD;;;;;;;AAQA,IAAM,+BAAN,MAA8E;CAC7E,MAAM,OACL,QACuC;EACvC,MAAM,SAAS,IAAIA,+BAAW,OAAO,MAAM;EAE3C,MAAM,WAAW,MAAM,qBACtB,QACA,OAAO,WACP,OAAO,QACR;EAEA,IAAI,UAAU;GACb,eAAO,IAAI,KAAK,oCAAoC,SAAS,GAAG,EAAE;GAElE,MAAM,OAAO,MACZ,aAAa,OAAO,UAAU,aAAa,SAAS,MACpD,EACC,UAAU;IACT,0BAA0B,OAAO;IACjC,0BAA0B,OAAO;IACjC,yBAAyB,OAAO;GACjC,EACD,CACD;GAEA,OAAO;IACN,IAAI,SAAS;IACb,MAAM;KAAE,GAAG;KAAQ,MAAM,SAAS;IAAK;GACxC;EACD;EAEA,MAAM,SAAS,MAAM,OAAO,KAC3B,aAAa,OAAO,UAAU,YAAY,OAAO,SAAS,aAC1D,EACC,UAAU;GACT,MAAM;GACN,0BAA0B,OAAO;GACjC,0BAA0B,OAAO;GACjC,yBAAyB,OAAO;EACjC,EACD,CACD;EAEA,OAAO;GACN,IAAI,OAAO,SAAS;GACpB,MAAM;IAAE,GAAG;IAAQ,MAAM,OAAO,SAAS;GAAK;EAC/C;CACD;CAEA,MAAM,OACL,IACA,OACA,MACuC;EAGvC,MAAM,SAAS,MAAM,IAFFA,+BAAW,KAAK,MAET,EAAE,MAC3B,aAAa,KAAK,UAAU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,MAA2B;EAC5E,MAAM,EAAE,UAAU,SAAS,QAAQ,GAAG,eAAe;EAErD,MAAM,4BAA4B,MAAM,CAAC,GAAG,UAAU;EAEtD,MAAM,WAAW,IAAI,qBACpB,GAAG,KAAK,YACR;GACC,QAAQ,SAAS;GACjB,WAAW,QAAQ;GACnB,UAAU,OAAO;GACjB,GAAG;EACJ,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,OAAO,SAAS;EAErB,KAAK,gBAAgB,EAAE,MAAM,KAAK,KAAK,CAAC;CACzC;AACD"}
|
|
1
|
+
{"version":3,"file":"endpoint.cjs","names":["NeonClient","pulumi"],"sources":["../../src/neon/endpoint.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { NeonBranch } from \"./branch\";\nimport { NeonClient } from \"./client\";\nimport type { NeonProject } from \"./project\";\nimport type { NeonProvider } from \"./provider\";\n\n/** Resolved inputs for the Neon endpoint dynamic provider. */\nexport interface NeonEndpointInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID. */\n\tprojectId: string;\n\n\t/** Branch ID to attach the endpoint to. */\n\tbranchId: string;\n\n\t/** Minimum compute units (e.g. `0.25`). */\n\tminCu: number;\n\n\t/** Maximum compute units (e.g. `2`). */\n\tmaxCu: number;\n\n\t/** Seconds of inactivity before suspending. `0` means use global default. */\n\tsuspendTimeout: number;\n}\n\n/** Persisted state for the Neon endpoint. */\ninterface NeonEndpointOutputs extends NeonEndpointInputs {\n\t/** Endpoint hostname (e.g. `\"ep-delicate-union-ah0ekn7n.us-east-1.aws.neon.tech\"`). */\n\thost: string;\n}\n\n/** Neon API response for an endpoint. */\ninterface EndpointResponse {\n\tendpoint: {\n\t\tid: string;\n\t\thost: string;\n\t\tbranch_id: string;\n\t\tautoscaling_limit_min_cu: number;\n\t\tautoscaling_limit_max_cu: number;\n\t\tsuspend_timeout_seconds: number;\n\t};\n}\n\n/** Neon API response for listing endpoints. */\ninterface EndpointListResponse {\n\tendpoints: Array<{\n\t\tid: string;\n\t\thost: string;\n\t\tbranch_id: string;\n\t\ttype: string;\n\t}>;\n}\n\n/**\n * Finds an existing read-write endpoint for a branch.\n */\nasync function findEndpointByBranch(\n\tclient: NeonClient,\n\tprojectId: string,\n\tbranchId: string,\n): Promise<{ id: string; host: string } | undefined> {\n\tconst result = await client.get<EndpointListResponse>(\n\t\t`/projects/${projectId}/branches/${branchId}/endpoints`,\n\t);\n\n\tconst match = result.endpoints.find((e) => e.type === \"read_write\");\n\n\treturn match ? { id: match.id, host: match.host } : undefined;\n}\n\n/**\n * Dynamic provider implementing CRUD for Neon compute endpoints.\n *\n * Uses adopt-or-create on `create()`: finds an existing read-write endpoint\n * on the target branch before creating a new one.\n */\nclass NeonEndpointResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(\n\t\tinputs: NeonEndpointInputs,\n\t): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new NeonClient(inputs.apiKey);\n\n\t\tconst existing = await findEndpointByBranch(\n\t\t\tclient,\n\t\t\tinputs.projectId,\n\t\t\tinputs.branchId,\n\t\t);\n\n\t\tif (existing) {\n\t\t\tpulumi.log.info(`Adopting existing Neon endpoint (${existing.id})`);\n\n\t\t\tawait client.patch(\n\t\t\t\t`/projects/${inputs.projectId}/endpoints/${existing.id}`,\n\t\t\t\t{\n\t\t\t\t\tendpoint: {\n\t\t\t\t\t\tautoscaling_limit_min_cu: inputs.minCu,\n\t\t\t\t\t\tautoscaling_limit_max_cu: inputs.maxCu,\n\t\t\t\t\t\tsuspend_timeout_seconds: inputs.suspendTimeout,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tid: existing.id,\n\t\t\t\touts: { ...inputs, host: existing.host },\n\t\t\t};\n\t\t}\n\n\t\t// Create the compute endpoint via the project-level endpoints collection with\n\t\t// branch_id in the body. The branch-scoped path (/branches/{id}/endpoints) is\n\t\t// GET-only and returns 405 on POST.\n\t\tconst result = await client.post<EndpointResponse>(\n\t\t\t`/projects/${inputs.projectId}/endpoints`,\n\t\t\t{\n\t\t\t\tendpoint: {\n\t\t\t\t\tbranch_id: inputs.branchId,\n\t\t\t\t\ttype: \"read_write\",\n\t\t\t\t\tautoscaling_limit_min_cu: inputs.minCu,\n\t\t\t\t\tautoscaling_limit_max_cu: inputs.maxCu,\n\t\t\t\t\tsuspend_timeout_seconds: inputs.suspendTimeout,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.endpoint.id,\n\t\t\touts: { ...inputs, host: result.endpoint.host },\n\t\t};\n\t}\n\n\tasync update(\n\t\tid: string,\n\t\t_olds: NeonEndpointOutputs,\n\t\tnews: NeonEndpointInputs,\n\t): Promise<pulumi.dynamic.UpdateResult> {\n\t\tconst client = new NeonClient(news.apiKey);\n\n\t\tconst result = await client.patch<EndpointResponse>(\n\t\t\t`/projects/${news.projectId}/endpoints/${id}`,\n\t\t\t{\n\t\t\t\tendpoint: {\n\t\t\t\t\tautoscaling_limit_min_cu: news.minCu,\n\t\t\t\t\tautoscaling_limit_max_cu: news.maxCu,\n\t\t\t\t\tsuspend_timeout_seconds: news.suspendTimeout,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn { outs: { ...news, host: result.endpoint.host } };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: NeonEndpointOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\tconst result = await client.get<EndpointResponse>(\n\t\t\t`/projects/${props.projectId}/endpoints/${id}`,\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.endpoint.id,\n\t\t\tprops: {\n\t\t\t\t...props,\n\t\t\t\thost: result.endpoint.host,\n\t\t\t\tminCu: result.endpoint.autoscaling_limit_min_cu,\n\t\t\t\tmaxCu: result.endpoint.autoscaling_limit_max_cu,\n\t\t\t\tsuspendTimeout: result.endpoint.suspend_timeout_seconds,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync delete(id: string, props: NeonEndpointOutputs): Promise<void> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\ttry {\n\t\t\tawait client.delete(`/projects/${props.projectId}/endpoints/${id}`);\n\t\t} catch {\n\t\t\tpulumi.log.warn(\n\t\t\t\t`Failed to delete Neon endpoint (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: NeonEndpointOutputs,\n\t\tnews: NeonEndpointInputs,\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\tconst hasChanges =\n\t\t\treplaces.length > 0 ||\n\t\t\tolds.minCu !== news.minCu ||\n\t\t\tolds.maxCu !== news.maxCu ||\n\t\t\tolds.suspendTimeout !== news.suspendTimeout;\n\n\t\treturn { changes: hasChanges, replaces, deleteBeforeReplace: true };\n\t}\n}\n\n/** Internal dynamic resource — not part of the public API. */\nclass NeonEndpointResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly host: 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\tbranchId: pulumi.Input<string>;\n\t\t\tminCu: pulumi.Input<number>;\n\t\t\tmaxCu: pulumi.Input<number>;\n\t\t\tsuspendTimeout: pulumi.Input<number>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew NeonEndpointResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, host: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for NeonEndpoint — replaces Pulumi's native `provider` field. */\ntype NeonEndpointOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\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 NeonEndpoint. */\nexport interface NeonEndpointArgs {\n\t/** Minimum compute units. */\n\tminCu: pulumi.Input<number>;\n\n\t/** Maximum compute units. */\n\tmaxCu: pulumi.Input<number>;\n\n\t/** Seconds of inactivity before suspending. */\n\tsuspendTimeout: pulumi.Input<number>;\n}\n\n/**\n * Manages a Neon compute endpoint with adopt-or-create semantics.\n * Exposes `host` as an output for connection string composition.\n *\n * @example\n * ```typescript\n * const endpoint = new NeonEndpoint(\"production\", {\n * minCu: 0.25,\n * maxCu: 1,\n * suspendTimeout: 0,\n * }, { provider, project, branch });\n * ```\n */\nexport class NeonEndpoint extends pulumi.ComponentResource {\n\t/** Endpoint hostname for connection strings. */\n\tpublic readonly host: pulumi.Output<string>;\n\n\tconstructor(name: string, args: NeonEndpointArgs, opts: NeonEndpointOptions) {\n\t\tconst { provider, project, branch, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:neon:Endpoint\", name, {}, pulumiOpts);\n\n\t\tconst resource = new NeonEndpointResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\tapiKey: provider.apiKey,\n\t\t\t\tprojectId: project.id,\n\t\t\t\tbranchId: branch.id,\n\t\t\t\t...args,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.host = resource.host;\n\n\t\tthis.registerOutputs({ host: this.host });\n\t}\n}\n"],"mappings":";;;;;;;;;;AA0DA,eAAe,qBACd,QACA,WACA,UACoD;CAKpD,MAAM,SAAQ,MAJO,OAAO,IAC3B,aAAa,UAAU,YAAY,SAAS,WAC7C,GAEqB,UAAU,MAAM,MAAM,EAAE,SAAS,YAAY;CAElE,OAAO,QAAQ;EAAE,IAAI,MAAM;EAAI,MAAM,MAAM;CAAK,IAAI;AACrD;;;;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"version":3,"file":"endpoint.d.cts","names":[],"sources":["../../src/neon/endpoint.ts"],"mappings":";;;;;;;;UAOiB,kBAAA;;EAEhB,MAAA;EAFkC;EAKlC,SAAA;EALkC;EAQlC,QAAA;EAHA;EAMA,KAAA;EAAA;EAGA,KAAA;EAGA;EAAA,cAAA;AAAA;AACA;AAAA,
|
|
1
|
+
{"version":3,"file":"endpoint.d.cts","names":[],"sources":["../../src/neon/endpoint.ts"],"mappings":";;;;;;;;UAOiB,kBAAA;;EAEhB,MAAA;EAFkC;EAKlC,SAAA;EALkC;EAQlC,QAAA;EAHA;EAMA,KAAA;EAAA;EAGA,KAAA;EAGA;EAAA,cAAA;AAAA;AACA;AAAA,KAqNI,mBAAA,GAAsB,IAAA,CAAK,MAAA,CAAO,wBAAA;qCAEtC,QAAA,EAAU,YAAA,EAFgB;EAK1B,OAAA,EAAS,WAAA,EAAA;EAGT,MAAA,EAAQ,UAAA;AAAA;;UAIQ,gBAAA;EAZe;EAc/B,KAAA,EAAO,MAAA,CAAO,KAAA;EAZd;EAeA,KAAA,EAAO,MAAA,CAAO,KAAA;EAZd;EAeA,cAAA,EAAgB,MAAA,CAAO,KAAA;AAAA;;;AAZL;AAInB;;;;;;;;;;cAwBa,YAAA,SAAqB,MAAA,CAAO,iBAAA;EAnBxC;EAAA,SAqBgB,IAAA,EAAM,MAAA,CAAO,MAAA;cAEjB,IAAA,UAAc,IAAA,EAAM,gBAAA,EAAkB,IAAA,EAAM,mBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.d.mts","names":[],"sources":["../../src/neon/endpoint.ts"],"mappings":";;;;;;;;UAOiB,kBAAA;;EAEhB,MAAA;EAFkC;EAKlC,SAAA;EALkC;EAQlC,QAAA;EAHA;EAMA,KAAA;EAAA;EAGA,KAAA;EAGA;EAAA,cAAA;AAAA;AACA;AAAA,
|
|
1
|
+
{"version":3,"file":"endpoint.d.mts","names":[],"sources":["../../src/neon/endpoint.ts"],"mappings":";;;;;;;;UAOiB,kBAAA;;EAEhB,MAAA;EAFkC;EAKlC,SAAA;EALkC;EAQlC,QAAA;EAHA;EAMA,KAAA;EAAA;EAGA,KAAA;EAGA;EAAA,cAAA;AAAA;AACA;AAAA,KAqNI,mBAAA,GAAsB,IAAA,CAAK,MAAA,CAAO,wBAAA;qCAEtC,QAAA,EAAU,YAAA,EAFgB;EAK1B,OAAA,EAAS,WAAA,EAAA;EAGT,MAAA,EAAQ,UAAA;AAAA;;UAIQ,gBAAA;EAZe;EAc/B,KAAA,EAAO,MAAA,CAAO,KAAA;EAZd;EAeA,KAAA,EAAO,MAAA,CAAO,KAAA;EAZd;EAeA,cAAA,EAAgB,MAAA,CAAO,KAAA;AAAA;;;AAZL;AAInB;;;;;;;;;;cAwBa,YAAA,SAAqB,MAAA,CAAO,iBAAA;EAnBxC;EAAA,SAqBgB,IAAA,EAAM,MAAA,CAAO,MAAA;cAEjB,IAAA,UAAc,IAAA,EAAM,gBAAA,EAAkB,IAAA,EAAM,mBAAA;AAAA"}
|
package/dist/neon/endpoint.mjs
CHANGED
|
@@ -38,7 +38,8 @@ var NeonEndpointResourceProvider = class {
|
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
const result = await client.post(`/projects/${inputs.projectId}/
|
|
41
|
+
const result = await client.post(`/projects/${inputs.projectId}/endpoints`, { endpoint: {
|
|
42
|
+
branch_id: inputs.branchId,
|
|
42
43
|
type: "read_write",
|
|
43
44
|
autoscaling_limit_min_cu: inputs.minCu,
|
|
44
45
|
autoscaling_limit_max_cu: inputs.maxCu,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoint.mjs","names":[],"sources":["../../src/neon/endpoint.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { NeonBranch } from \"./branch\";\nimport { NeonClient } from \"./client\";\nimport type { NeonProject } from \"./project\";\nimport type { NeonProvider } from \"./provider\";\n\n/** Resolved inputs for the Neon endpoint dynamic provider. */\nexport interface NeonEndpointInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID. */\n\tprojectId: string;\n\n\t/** Branch ID to attach the endpoint to. */\n\tbranchId: string;\n\n\t/** Minimum compute units (e.g. `0.25`). */\n\tminCu: number;\n\n\t/** Maximum compute units (e.g. `2`). */\n\tmaxCu: number;\n\n\t/** Seconds of inactivity before suspending. `0` means use global default. */\n\tsuspendTimeout: number;\n}\n\n/** Persisted state for the Neon endpoint. */\ninterface NeonEndpointOutputs extends NeonEndpointInputs {\n\t/** Endpoint hostname (e.g. `\"ep-delicate-union-ah0ekn7n.us-east-1.aws.neon.tech\"`). */\n\thost: string;\n}\n\n/** Neon API response for an endpoint. */\ninterface EndpointResponse {\n\tendpoint: {\n\t\tid: string;\n\t\thost: string;\n\t\tbranch_id: string;\n\t\tautoscaling_limit_min_cu: number;\n\t\tautoscaling_limit_max_cu: number;\n\t\tsuspend_timeout_seconds: number;\n\t};\n}\n\n/** Neon API response for listing endpoints. */\ninterface EndpointListResponse {\n\tendpoints: Array<{\n\t\tid: string;\n\t\thost: string;\n\t\tbranch_id: string;\n\t\ttype: string;\n\t}>;\n}\n\n/**\n * Finds an existing read-write endpoint for a branch.\n */\nasync function findEndpointByBranch(\n\tclient: NeonClient,\n\tprojectId: string,\n\tbranchId: string,\n): Promise<{ id: string; host: string } | undefined> {\n\tconst result = await client.get<EndpointListResponse>(\n\t\t`/projects/${projectId}/branches/${branchId}/endpoints`,\n\t);\n\n\tconst match = result.endpoints.find((e) => e.type === \"read_write\");\n\n\treturn match ? { id: match.id, host: match.host } : undefined;\n}\n\n/**\n * Dynamic provider implementing CRUD for Neon compute endpoints.\n *\n * Uses adopt-or-create on `create()`: finds an existing read-write endpoint\n * on the target branch before creating a new one.\n */\nclass NeonEndpointResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(\n\t\tinputs: NeonEndpointInputs,\n\t): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new NeonClient(inputs.apiKey);\n\n\t\tconst existing = await findEndpointByBranch(\n\t\t\tclient,\n\t\t\tinputs.projectId,\n\t\t\tinputs.branchId,\n\t\t);\n\n\t\tif (existing) {\n\t\t\tpulumi.log.info(`Adopting existing Neon endpoint (${existing.id})`);\n\n\t\t\tawait client.patch(\n\t\t\t\t`/projects/${inputs.projectId}/endpoints/${existing.id}`,\n\t\t\t\t{\n\t\t\t\t\tendpoint: {\n\t\t\t\t\t\tautoscaling_limit_min_cu: inputs.minCu,\n\t\t\t\t\t\tautoscaling_limit_max_cu: inputs.maxCu,\n\t\t\t\t\t\tsuspend_timeout_seconds: inputs.suspendTimeout,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tid: existing.id,\n\t\t\t\touts: { ...inputs, host: existing.host },\n\t\t\t};\n\t\t}\n\n\t\tconst result = await client.post<EndpointResponse>(\n\t\t\t`/projects/${inputs.projectId}/branches/${inputs.branchId}/endpoints`,\n\t\t\t{\n\t\t\t\tendpoint: {\n\t\t\t\t\ttype: \"read_write\",\n\t\t\t\t\tautoscaling_limit_min_cu: inputs.minCu,\n\t\t\t\t\tautoscaling_limit_max_cu: inputs.maxCu,\n\t\t\t\t\tsuspend_timeout_seconds: inputs.suspendTimeout,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.endpoint.id,\n\t\t\touts: { ...inputs, host: result.endpoint.host },\n\t\t};\n\t}\n\n\tasync update(\n\t\tid: string,\n\t\t_olds: NeonEndpointOutputs,\n\t\tnews: NeonEndpointInputs,\n\t): Promise<pulumi.dynamic.UpdateResult> {\n\t\tconst client = new NeonClient(news.apiKey);\n\n\t\tconst result = await client.patch<EndpointResponse>(\n\t\t\t`/projects/${news.projectId}/endpoints/${id}`,\n\t\t\t{\n\t\t\t\tendpoint: {\n\t\t\t\t\tautoscaling_limit_min_cu: news.minCu,\n\t\t\t\t\tautoscaling_limit_max_cu: news.maxCu,\n\t\t\t\t\tsuspend_timeout_seconds: news.suspendTimeout,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn { outs: { ...news, host: result.endpoint.host } };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: NeonEndpointOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\tconst result = await client.get<EndpointResponse>(\n\t\t\t`/projects/${props.projectId}/endpoints/${id}`,\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.endpoint.id,\n\t\t\tprops: {\n\t\t\t\t...props,\n\t\t\t\thost: result.endpoint.host,\n\t\t\t\tminCu: result.endpoint.autoscaling_limit_min_cu,\n\t\t\t\tmaxCu: result.endpoint.autoscaling_limit_max_cu,\n\t\t\t\tsuspendTimeout: result.endpoint.suspend_timeout_seconds,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync delete(id: string, props: NeonEndpointOutputs): Promise<void> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\ttry {\n\t\t\tawait client.delete(`/projects/${props.projectId}/endpoints/${id}`);\n\t\t} catch {\n\t\t\tpulumi.log.warn(\n\t\t\t\t`Failed to delete Neon endpoint (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: NeonEndpointOutputs,\n\t\tnews: NeonEndpointInputs,\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\tconst hasChanges =\n\t\t\treplaces.length > 0 ||\n\t\t\tolds.minCu !== news.minCu ||\n\t\t\tolds.maxCu !== news.maxCu ||\n\t\t\tolds.suspendTimeout !== news.suspendTimeout;\n\n\t\treturn { changes: hasChanges, replaces, deleteBeforeReplace: true };\n\t}\n}\n\n/** Internal dynamic resource — not part of the public API. */\nclass NeonEndpointResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly host: 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\tbranchId: pulumi.Input<string>;\n\t\t\tminCu: pulumi.Input<number>;\n\t\t\tmaxCu: pulumi.Input<number>;\n\t\t\tsuspendTimeout: pulumi.Input<number>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew NeonEndpointResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, host: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for NeonEndpoint — replaces Pulumi's native `provider` field. */\ntype NeonEndpointOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\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 NeonEndpoint. */\nexport interface NeonEndpointArgs {\n\t/** Minimum compute units. */\n\tminCu: pulumi.Input<number>;\n\n\t/** Maximum compute units. */\n\tmaxCu: pulumi.Input<number>;\n\n\t/** Seconds of inactivity before suspending. */\n\tsuspendTimeout: pulumi.Input<number>;\n}\n\n/**\n * Manages a Neon compute endpoint with adopt-or-create semantics.\n * Exposes `host` as an output for connection string composition.\n *\n * @example\n * ```typescript\n * const endpoint = new NeonEndpoint(\"production\", {\n * minCu: 0.25,\n * maxCu: 1,\n * suspendTimeout: 0,\n * }, { provider, project, branch });\n * ```\n */\nexport class NeonEndpoint extends pulumi.ComponentResource {\n\t/** Endpoint hostname for connection strings. */\n\tpublic readonly host: pulumi.Output<string>;\n\n\tconstructor(name: string, args: NeonEndpointArgs, opts: NeonEndpointOptions) {\n\t\tconst { provider, project, branch, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:neon:Endpoint\", name, {}, pulumiOpts);\n\n\t\tconst resource = new NeonEndpointResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\tapiKey: provider.apiKey,\n\t\t\t\tprojectId: project.id,\n\t\t\t\tbranchId: branch.id,\n\t\t\t\t...args,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.host = resource.host;\n\n\t\tthis.registerOutputs({ host: this.host });\n\t}\n}\n"],"mappings":";;;;;;;;AA0DA,eAAe,qBACd,QACA,WACA,UACoD;CAKpD,MAAM,SAAQ,MAJO,OAAO,IAC3B,aAAa,UAAU,YAAY,SAAS,WAC7C,GAEqB,UAAU,MAAM,MAAM,EAAE,SAAS,YAAY;CAElE,OAAO,QAAQ;EAAE,IAAI,MAAM;EAAI,MAAM,MAAM;CAAK,IAAI;AACrD;;;;;;;AAQA,IAAM,+BAAN,MAA8E;CAC7E,MAAM,OACL,QACuC;EACvC,MAAM,SAAS,IAAI,WAAW,OAAO,MAAM;EAE3C,MAAM,WAAW,MAAM,qBACtB,QACA,OAAO,WACP,OAAO,QACR;EAEA,IAAI,UAAU;GACb,OAAO,IAAI,KAAK,oCAAoC,SAAS,GAAG,EAAE;GAElE,MAAM,OAAO,MACZ,aAAa,OAAO,UAAU,aAAa,SAAS,MACpD,EACC,UAAU;IACT,0BAA0B,OAAO;IACjC,0BAA0B,OAAO;IACjC,yBAAyB,OAAO;GACjC,EACD,CACD;GAEA,OAAO;IACN,IAAI,SAAS;IACb,MAAM;KAAE,GAAG;KAAQ,MAAM,SAAS;IAAK;GACxC;EACD;EAEA,MAAM,SAAS,MAAM,OAAO,KAC3B,aAAa,OAAO,UAAU,YAAY,OAAO,SAAS,aAC1D,EACC,UAAU;GACT,MAAM;GACN,0BAA0B,OAAO;GACjC,0BAA0B,OAAO;GACjC,yBAAyB,OAAO;EACjC,EACD,CACD;EAEA,OAAO;GACN,IAAI,OAAO,SAAS;GACpB,MAAM;IAAE,GAAG;IA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GACjC,MACA;GAAE,GAAG;GAAM,MAAM;EAAU,GAC3B,IACD;CACD;AACD;;;;;;;;;;;;;;AAuCA,IAAa,eAAb,cAAkC,OAAO,kBAAkB;CAI1D,YAAY,MAAc,MAAwB,MAA2B;EAC5E,MAAM,EAAE,UAAU,SAAS,QAAQ,GAAG,eAAe;EAErD,MAAM,4BAA4B,MAAM,CAAC,GAAG,UAAU;EAEtD,MAAM,WAAW,IAAI,qBACpB,GAAG,KAAK,YACR;GACC,QAAQ,SAAS;GACjB,WAAW,QAAQ;GACnB,UAAU,OAAO;GACjB,GAAG;EACJ,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,OAAO,SAAS;EAErB,KAAK,gBAAgB,EAAE,MAAM,KAAK,KAAK,CAAC;CACzC;AACD"}
|
|
1
|
+
{"version":3,"file":"endpoint.mjs","names":[],"sources":["../../src/neon/endpoint.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { NeonBranch } from \"./branch\";\nimport { NeonClient } from \"./client\";\nimport type { NeonProject } from \"./project\";\nimport type { NeonProvider } from \"./provider\";\n\n/** Resolved inputs for the Neon endpoint dynamic provider. */\nexport interface NeonEndpointInputs {\n\t/** Neon API key. */\n\tapiKey: string;\n\n\t/** Neon project ID. */\n\tprojectId: string;\n\n\t/** Branch ID to attach the endpoint to. */\n\tbranchId: string;\n\n\t/** Minimum compute units (e.g. `0.25`). */\n\tminCu: number;\n\n\t/** Maximum compute units (e.g. `2`). */\n\tmaxCu: number;\n\n\t/** Seconds of inactivity before suspending. `0` means use global default. */\n\tsuspendTimeout: number;\n}\n\n/** Persisted state for the Neon endpoint. */\ninterface NeonEndpointOutputs extends NeonEndpointInputs {\n\t/** Endpoint hostname (e.g. `\"ep-delicate-union-ah0ekn7n.us-east-1.aws.neon.tech\"`). */\n\thost: string;\n}\n\n/** Neon API response for an endpoint. */\ninterface EndpointResponse {\n\tendpoint: {\n\t\tid: string;\n\t\thost: string;\n\t\tbranch_id: string;\n\t\tautoscaling_limit_min_cu: number;\n\t\tautoscaling_limit_max_cu: number;\n\t\tsuspend_timeout_seconds: number;\n\t};\n}\n\n/** Neon API response for listing endpoints. */\ninterface EndpointListResponse {\n\tendpoints: Array<{\n\t\tid: string;\n\t\thost: string;\n\t\tbranch_id: string;\n\t\ttype: string;\n\t}>;\n}\n\n/**\n * Finds an existing read-write endpoint for a branch.\n */\nasync function findEndpointByBranch(\n\tclient: NeonClient,\n\tprojectId: string,\n\tbranchId: string,\n): Promise<{ id: string; host: string } | undefined> {\n\tconst result = await client.get<EndpointListResponse>(\n\t\t`/projects/${projectId}/branches/${branchId}/endpoints`,\n\t);\n\n\tconst match = result.endpoints.find((e) => e.type === \"read_write\");\n\n\treturn match ? { id: match.id, host: match.host } : undefined;\n}\n\n/**\n * Dynamic provider implementing CRUD for Neon compute endpoints.\n *\n * Uses adopt-or-create on `create()`: finds an existing read-write endpoint\n * on the target branch before creating a new one.\n */\nclass NeonEndpointResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(\n\t\tinputs: NeonEndpointInputs,\n\t): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new NeonClient(inputs.apiKey);\n\n\t\tconst existing = await findEndpointByBranch(\n\t\t\tclient,\n\t\t\tinputs.projectId,\n\t\t\tinputs.branchId,\n\t\t);\n\n\t\tif (existing) {\n\t\t\tpulumi.log.info(`Adopting existing Neon endpoint (${existing.id})`);\n\n\t\t\tawait client.patch(\n\t\t\t\t`/projects/${inputs.projectId}/endpoints/${existing.id}`,\n\t\t\t\t{\n\t\t\t\t\tendpoint: {\n\t\t\t\t\t\tautoscaling_limit_min_cu: inputs.minCu,\n\t\t\t\t\t\tautoscaling_limit_max_cu: inputs.maxCu,\n\t\t\t\t\t\tsuspend_timeout_seconds: inputs.suspendTimeout,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tid: existing.id,\n\t\t\t\touts: { ...inputs, host: existing.host },\n\t\t\t};\n\t\t}\n\n\t\t// Create the compute endpoint via the project-level endpoints collection with\n\t\t// branch_id in the body. The branch-scoped path (/branches/{id}/endpoints) is\n\t\t// GET-only and returns 405 on POST.\n\t\tconst result = await client.post<EndpointResponse>(\n\t\t\t`/projects/${inputs.projectId}/endpoints`,\n\t\t\t{\n\t\t\t\tendpoint: {\n\t\t\t\t\tbranch_id: inputs.branchId,\n\t\t\t\t\ttype: \"read_write\",\n\t\t\t\t\tautoscaling_limit_min_cu: inputs.minCu,\n\t\t\t\t\tautoscaling_limit_max_cu: inputs.maxCu,\n\t\t\t\t\tsuspend_timeout_seconds: inputs.suspendTimeout,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.endpoint.id,\n\t\t\touts: { ...inputs, host: result.endpoint.host },\n\t\t};\n\t}\n\n\tasync update(\n\t\tid: string,\n\t\t_olds: NeonEndpointOutputs,\n\t\tnews: NeonEndpointInputs,\n\t): Promise<pulumi.dynamic.UpdateResult> {\n\t\tconst client = new NeonClient(news.apiKey);\n\n\t\tconst result = await client.patch<EndpointResponse>(\n\t\t\t`/projects/${news.projectId}/endpoints/${id}`,\n\t\t\t{\n\t\t\t\tendpoint: {\n\t\t\t\t\tautoscaling_limit_min_cu: news.minCu,\n\t\t\t\t\tautoscaling_limit_max_cu: news.maxCu,\n\t\t\t\t\tsuspend_timeout_seconds: news.suspendTimeout,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\n\t\treturn { outs: { ...news, host: result.endpoint.host } };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: NeonEndpointOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\tconst result = await client.get<EndpointResponse>(\n\t\t\t`/projects/${props.projectId}/endpoints/${id}`,\n\t\t);\n\n\t\treturn {\n\t\t\tid: result.endpoint.id,\n\t\t\tprops: {\n\t\t\t\t...props,\n\t\t\t\thost: result.endpoint.host,\n\t\t\t\tminCu: result.endpoint.autoscaling_limit_min_cu,\n\t\t\t\tmaxCu: result.endpoint.autoscaling_limit_max_cu,\n\t\t\t\tsuspendTimeout: result.endpoint.suspend_timeout_seconds,\n\t\t\t},\n\t\t};\n\t}\n\n\tasync delete(id: string, props: NeonEndpointOutputs): Promise<void> {\n\t\tconst client = new NeonClient(props.apiKey);\n\n\t\ttry {\n\t\t\tawait client.delete(`/projects/${props.projectId}/endpoints/${id}`);\n\t\t} catch {\n\t\t\tpulumi.log.warn(\n\t\t\t\t`Failed to delete Neon endpoint (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: NeonEndpointOutputs,\n\t\tnews: NeonEndpointInputs,\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\tconst hasChanges =\n\t\t\treplaces.length > 0 ||\n\t\t\tolds.minCu !== news.minCu ||\n\t\t\tolds.maxCu !== news.maxCu ||\n\t\t\tolds.suspendTimeout !== news.suspendTimeout;\n\n\t\treturn { changes: hasChanges, replaces, deleteBeforeReplace: true };\n\t}\n}\n\n/** Internal dynamic resource — not part of the public API. */\nclass NeonEndpointResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly host: 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\tbranchId: pulumi.Input<string>;\n\t\t\tminCu: pulumi.Input<number>;\n\t\t\tmaxCu: pulumi.Input<number>;\n\t\t\tsuspendTimeout: pulumi.Input<number>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew NeonEndpointResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, host: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for NeonEndpoint — replaces Pulumi's native `provider` field. */\ntype NeonEndpointOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\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 NeonEndpoint. */\nexport interface NeonEndpointArgs {\n\t/** Minimum compute units. */\n\tminCu: pulumi.Input<number>;\n\n\t/** Maximum compute units. */\n\tmaxCu: pulumi.Input<number>;\n\n\t/** Seconds of inactivity before suspending. */\n\tsuspendTimeout: pulumi.Input<number>;\n}\n\n/**\n * Manages a Neon compute endpoint with adopt-or-create semantics.\n * Exposes `host` as an output for connection string composition.\n *\n * @example\n * ```typescript\n * const endpoint = new NeonEndpoint(\"production\", {\n * minCu: 0.25,\n * maxCu: 1,\n * suspendTimeout: 0,\n * }, { provider, project, branch });\n * ```\n */\nexport class NeonEndpoint extends pulumi.ComponentResource {\n\t/** Endpoint hostname for connection strings. */\n\tpublic readonly host: pulumi.Output<string>;\n\n\tconstructor(name: string, args: NeonEndpointArgs, opts: NeonEndpointOptions) {\n\t\tconst { provider, project, branch, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:neon:Endpoint\", name, {}, pulumiOpts);\n\n\t\tconst resource = new NeonEndpointResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\tapiKey: provider.apiKey,\n\t\t\t\tprojectId: project.id,\n\t\t\t\tbranchId: branch.id,\n\t\t\t\t...args,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.host = resource.host;\n\n\t\tthis.registerOutputs({ host: this.host });\n\t}\n}\n"],"mappings":";;;;;;;;AA0DA,eAAe,qBACd,QACA,WACA,UACoD;CAKpD,MAAM,SAAQ,MAJO,OAAO,IAC3B,aAAa,UAAU,YAAY,SAAS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KAAK,OAAO,SAAS;EAErB,KAAK,gBAAgB,EAAE,MAAM,KAAK,KAAK,CAAC;CACzC;AACD"}
|
|
@@ -13,10 +13,15 @@ const VERCEL_API_URL = "https://api.vercel.com";
|
|
|
13
13
|
*/
|
|
14
14
|
var VercelIntegrationResourceProvider = class {
|
|
15
15
|
async create(inputs) {
|
|
16
|
-
const response = await fetch(`${VERCEL_API_URL}/v1/integrations/configurations?teamId=${inputs.teamId}`, { headers: { Authorization: `Bearer ${inputs.token}` } });
|
|
16
|
+
const response = await fetch(`${VERCEL_API_URL}/v1/integrations/configurations?view=account&teamId=${inputs.teamId}`, { headers: { Authorization: `Bearer ${inputs.token}` } });
|
|
17
17
|
if (!response.ok) throw new Error(`Vercel API error fetching integrations (${response.status}): ${await response.text()}`);
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const data = await response.json();
|
|
19
|
+
const configurations = Array.isArray(data) ? data : data.configurations;
|
|
20
|
+
const config = configurations.find((c) => c.slug === inputs.slug);
|
|
21
|
+
if (!config) {
|
|
22
|
+
const available = configurations.map((c) => c.slug).join(", ") || "(none)";
|
|
23
|
+
throw new Error(`Vercel integration "${inputs.slug}" is not installed on this team (available: ${available})`);
|
|
24
|
+
}
|
|
20
25
|
const outs = {
|
|
21
26
|
...inputs,
|
|
22
27
|
configurationId: config.id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.cjs","names":["pulumi"],"sources":["../../src/vercel/integration.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { VercelProvider } from \"./provider\";\n\nconst VERCEL_API_URL = \"https://api.vercel.com\";\n\n/** Resolved inputs for the Vercel integration dynamic provider. */\ninterface VercelIntegrationInputs {\n\t/** Vercel API bearer token. */\n\ttoken: string;\n\n\t/** Vercel team/org ID. */\n\tteamId: string;\n\n\t/** Marketplace integration slug (e.g. `\"upstash\"`, `\"neon\"`). */\n\tslug: string;\n}\n\n/** Persisted state for the Vercel integration. */\ninterface VercelIntegrationOutputs extends VercelIntegrationInputs {\n\t/** Vercel-assigned configuration ID (e.g. `\"icfg_…\"`). */\n\tconfigurationId: string;\n}\n\n/**
|
|
1
|
+
{"version":3,"file":"integration.cjs","names":["pulumi"],"sources":["../../src/vercel/integration.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { VercelProvider } from \"./provider\";\n\nconst VERCEL_API_URL = \"https://api.vercel.com\";\n\n/** Resolved inputs for the Vercel integration dynamic provider. */\ninterface VercelIntegrationInputs {\n\t/** Vercel API bearer token. */\n\ttoken: string;\n\n\t/** Vercel team/org ID. */\n\tteamId: string;\n\n\t/** Marketplace integration slug (e.g. `\"upstash\"`, `\"neon\"`). */\n\tslug: string;\n}\n\n/** Persisted state for the Vercel integration. */\ninterface VercelIntegrationOutputs extends VercelIntegrationInputs {\n\t/** Vercel-assigned configuration ID (e.g. `\"icfg_…\"`). */\n\tconfigurationId: string;\n}\n\n/** A single installed Vercel marketplace integration configuration. */\ninterface VercelIntegrationConfiguration {\n\tid: string;\n\tslug: string;\n}\n\n/**\n * Dynamic provider that resolves an installed Vercel marketplace integration\n * by its slug to its configuration ID (`icfg_…`).\n *\n * @internal Exported only for unit testing; not part of the public API surface.\n */\nexport class VercelIntegrationResourceProvider\n\timplements pulumi.dynamic.ResourceProvider\n{\n\tasync create(\n\t\tinputs: VercelIntegrationInputs,\n\t): Promise<pulumi.dynamic.CreateResult> {\n\t\t// `view=account` is required by the configurations endpoint (a missing view returns 400).\n\t\tconst response = await fetch(\n\t\t\t`${VERCEL_API_URL}/v1/integrations/configurations?view=account&teamId=${inputs.teamId}`,\n\t\t\t{ headers: { Authorization: `Bearer ${inputs.token}` } },\n\t\t);\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(\n\t\t\t\t`Vercel API error fetching integrations (${response.status}): ${await response.text()}`,\n\t\t\t);\n\t\t}\n\n\t\t// The endpoint returns a top-level array; some responses wrap it in { configurations: [...] }.\n\t\tconst data = (await response.json()) as\n\t\t\t| VercelIntegrationConfiguration[]\n\t\t\t| { configurations: VercelIntegrationConfiguration[] };\n\n\t\tconst configurations = Array.isArray(data) ? data : data.configurations;\n\n\t\tconst config = configurations.find((c) => c.slug === inputs.slug);\n\n\t\tif (!config) {\n\t\t\tconst available =\n\t\t\t\tconfigurations.map((c) => c.slug).join(\", \") || \"(none)\";\n\n\t\t\tthrow new Error(\n\t\t\t\t`Vercel integration \"${inputs.slug}\" is not installed on this team (available: ${available})`,\n\t\t\t);\n\t\t}\n\n\t\tconst outs: VercelIntegrationOutputs = {\n\t\t\t...inputs,\n\t\t\tconfigurationId: config.id,\n\t\t};\n\n\t\treturn { id: config.id, outs };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: VercelIntegrationOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\t// Resolver-only: the integration's configuration id (icfg_…) is stable for the\n\t\t// lifetime of an installed integration, so read() does not re-query. If the\n\t\t// integration is uninstalled and reinstalled, a subsequent `up` re-resolves via create().\n\t\treturn { id, props };\n\t}\n\n\tasync delete(): Promise<void> {\n\t\tpulumi.log.warn(\n\t\t\t\"VercelIntegration is a read-only resolver — uninstall the integration from the Vercel dashboard if needed\",\n\t\t);\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: VercelIntegrationOutputs,\n\t\tnews: VercelIntegrationInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.teamId !== news.teamId) {\n\t\t\treplaces.push(\"teamId\");\n\t\t}\n\n\t\tif (olds.slug !== news.slug) {\n\t\t\treplaces.push(\"slug\");\n\t\t}\n\n\t\treturn {\n\t\t\tchanges: replaces.length > 0,\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 VercelIntegrationResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly configurationId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\ttoken: pulumi.Input<string>;\n\t\t\tteamId: pulumi.Input<string>;\n\t\t\tslug: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew VercelIntegrationResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, configurationId: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for VercelIntegration — replaces Pulumi's native `provider` field. */\ntype VercelIntegrationOptions = Omit<\n\tpulumi.ComponentResourceOptions,\n\t\"provider\"\n> & {\n\t/** Vercel authentication context. */\n\tprovider: VercelProvider;\n};\n\n/**\n * Args for {@link VercelIntegration}.\n */\nexport interface VercelIntegrationArgs {\n\t/**\n\t * Marketplace integration slug (e.g. `\"upstash\"`, `\"neon\"`).\n\t * The integration must already be installed on the team via the Vercel dashboard.\n\t */\n\tslug: pulumi.Input<string>;\n}\n\n/**\n * Resolves an installed Vercel marketplace integration by slug to its\n * configuration ID (`icfg_…`).\n *\n * The integration must be installed on the team via the Vercel dashboard\n * (one-time OAuth step) before this resource can be used. This resource is\n * read-only: it looks up the configuration ID and exposes it for downstream\n * marketplace-store resources.\n *\n * @example\n * ```typescript\n * const upstash = new VercelIntegration(\"upstash\", {\n * slug: \"upstash\",\n * }, { provider });\n *\n * // Use configurationId in marketplace store resources\n * export const upstashConfigId = upstash.configurationId;\n * ```\n */\nexport class VercelIntegration extends pulumi.ComponentResource {\n\t/** Vercel integration configuration ID (e.g. `\"icfg_…\"`). */\n\tpublic readonly configurationId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: VercelIntegrationArgs,\n\t\topts: VercelIntegrationOptions,\n\t) {\n\t\tconst { provider, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:vercel:Integration\", name, {}, pulumiOpts);\n\n\t\tconst resource = new VercelIntegrationResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\ttoken: provider.token,\n\t\t\t\tteamId: provider.teamId,\n\t\t\t\tslug: args.slug,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.configurationId = resource.configurationId;\n\n\t\tthis.registerOutputs({ configurationId: this.configurationId });\n\t}\n}\n"],"mappings":";;;;;;AAGA,MAAM,iBAAiB;;;;;;;AAgCvB,IAAa,oCAAb,MAEA;CACC,MAAM,OACL,QACuC;EAEvC,MAAM,WAAW,MAAM,MACtB,GAAG,eAAe,sDAAsD,OAAO,UAC/E,EAAE,SAAS,EAAE,eAAe,UAAU,OAAO,QAAQ,EAAE,CACxD;EAEA,IAAI,CAAC,SAAS,IACb,MAAM,IAAI,MACT,2CAA2C,SAAS,OAAO,KAAK,MAAM,SAAS,KAAK,GACrF;EAID,MAAM,OAAQ,MAAM,SAAS,KAAK;EAIlC,MAAM,iBAAiB,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK;EAEzD,MAAM,SAAS,eAAe,MAAM,MAAM,EAAE,SAAS,OAAO,IAAI;EAEhE,IAAI,CAAC,QAAQ;GACZ,MAAM,YACL,eAAe,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,KAAK;GAEjD,MAAM,IAAI,MACT,uBAAuB,OAAO,KAAK,8CAA8C,UAAU,EAC5F;EACD;EAEA,MAAM,OAAiC;GACtC,GAAG;GACH,iBAAiB,OAAO;EACzB;EAEA,OAAO;GAAE,IAAI,OAAO;GAAI;EAAK;CAC9B;CAEA,MAAM,KACL,IACA,OACqC;EAIrC,OAAO;GAAE;GAAI;EAAM;CACpB;CAEA,MAAM,SAAwB;EAC7B,eAAO,IAAI,KACV,2GACD;CACD;CAEA,MAAM,KACL,KACA,MACA,MACqC;EACrC,MAAM,WAAqB,CAAC;EAE5B,IAAI,KAAK,WAAW,KAAK,QACxB,SAAS,KAAK,QAAQ;EAGvB,IAAI,KAAK,SAAS,KAAK,MACtB,SAAS,KAAK,MAAM;EAGrB,OAAO;GACN,SAAS,SAAS,SAAS;GAC3B;GACA,qBAAqB;EACtB;CACD;AACD;;AAGA,IAAM,4BAAN,cAAwCA,eAAO,QAAQ,SAAS;CAG/D,YACC,MACA,MAKA,MACC;EACD,MACC,IAAI,kCAAkC,GACtC,MACA;GAAE,GAAG;GAAM,iBAAiB;EAAU,GACtC,IACD;CACD;AACD;;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,oBAAb,cAAuCA,eAAO,kBAAkB;CAI/D,YACC,MACA,MACA,MACC;EACD,MAAM,EAAE,UAAU,GAAG,eAAe;EAEpC,MAAM,iCAAiC,MAAM,CAAC,GAAG,UAAU;EAE3D,MAAM,WAAW,IAAI,0BACpB,GAAG,KAAK,YACR;GACC,OAAO,SAAS;GAChB,QAAQ,SAAS;GACjB,MAAM,KAAK;EACZ,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,kBAAkB,SAAS;EAEhC,KAAK,gBAAgB,EAAE,iBAAiB,KAAK,gBAAgB,CAAC;CAC/D;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.cts","names":[],"sources":["../../src/vercel/integration.ts"],"mappings":";;;;;;UAMU,uBAAA;;EAET,KAAA;EAFgC;EAKhC,MAAA;EALgC;EAQhC,IAAA;AAAA;;UAIS,wBAAA,SAAiC,uBAAuB;EAJ7D;EAMJ,eAAe;AAAA;;;AAAA;
|
|
1
|
+
{"version":3,"file":"integration.d.cts","names":[],"sources":["../../src/vercel/integration.ts"],"mappings":";;;;;;UAMU,uBAAA;;EAET,KAAA;EAFgC;EAKhC,MAAA;EALgC;EAQhC,IAAA;AAAA;;UAIS,wBAAA,SAAiC,uBAAuB;EAJ7D;EAMJ,eAAe;AAAA;;;AAAA;AAehB;;;cAAa,iCAAA,YACD,MAAA,CAAO,OAAA,CAAQ,gBAAA;EAEpB,MAAA,CACL,MAAA,EAAQ,uBAAA,GACN,OAAA,CAAQ,MAAA,CAAO,OAAA,CAAQ,YAAA;EAuCpB,IAAA,CACL,EAAA,UACA,KAAA,EAAO,wBAAA,GACL,OAAA,CAAQ,MAAA,CAAO,OAAA,CAAQ,UAAA;EAOpB,MAAA,CAAA,GAAU,OAAA;EAMV,IAAA,CACL,GAAA,UACA,IAAA,EAAM,wBAAA,EACN,IAAA,EAAM,uBAAA,GACJ,OAAA,CAAQ,MAAA,CAAO,OAAA,CAAQ,UAAA;AAAA;;KA0CtB,wBAAA,GAA2B,IAAA,CAC/B,MAAA,CAAO,wBAAA;EA5CA,qCAgDP,QAAA,EAAU,cAAA;AAAA;;;;UAMM,qBAAA;EApHE;;;;EAyHlB,IAAA,EAAM,MAAA,CAAO,KAAK;AAAA;;;;;;;;;;;;;;;;;;;;cAsBN,iBAAA,SAA0B,MAAA,CAAO,iBAAA;EAhFlC;EAAA,SAkFK,eAAA,EAAiB,MAAA,CAAO,MAAA;cAGvC,IAAA,UACA,IAAA,EAAM,qBAAA,EACN,IAAA,EAAM,wBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.d.mts","names":[],"sources":["../../src/vercel/integration.ts"],"mappings":";;;;;;UAMU,uBAAA;;EAET,KAAA;EAFgC;EAKhC,MAAA;EALgC;EAQhC,IAAA;AAAA;;UAIS,wBAAA,SAAiC,uBAAuB;EAJ7D;EAMJ,eAAe;AAAA;;;AAAA;
|
|
1
|
+
{"version":3,"file":"integration.d.mts","names":[],"sources":["../../src/vercel/integration.ts"],"mappings":";;;;;;UAMU,uBAAA;;EAET,KAAA;EAFgC;EAKhC,MAAA;EALgC;EAQhC,IAAA;AAAA;;UAIS,wBAAA,SAAiC,uBAAuB;EAJ7D;EAMJ,eAAe;AAAA;;;AAAA;AAehB;;;cAAa,iCAAA,YACD,MAAA,CAAO,OAAA,CAAQ,gBAAA;EAEpB,MAAA,CACL,MAAA,EAAQ,uBAAA,GACN,OAAA,CAAQ,MAAA,CAAO,OAAA,CAAQ,YAAA;EAuCpB,IAAA,CACL,EAAA,UACA,KAAA,EAAO,wBAAA,GACL,OAAA,CAAQ,MAAA,CAAO,OAAA,CAAQ,UAAA;EAOpB,MAAA,CAAA,GAAU,OAAA;EAMV,IAAA,CACL,GAAA,UACA,IAAA,EAAM,wBAAA,EACN,IAAA,EAAM,uBAAA,GACJ,OAAA,CAAQ,MAAA,CAAO,OAAA,CAAQ,UAAA;AAAA;;KA0CtB,wBAAA,GAA2B,IAAA,CAC/B,MAAA,CAAO,wBAAA;EA5CA,qCAgDP,QAAA,EAAU,cAAA;AAAA;;;;UAMM,qBAAA;EApHE;;;;EAyHlB,IAAA,EAAM,MAAA,CAAO,KAAK;AAAA;;;;;;;;;;;;;;;;;;;;cAsBN,iBAAA,SAA0B,MAAA,CAAO,iBAAA;EAhFlC;EAAA,SAkFK,eAAA,EAAiB,MAAA,CAAO,MAAA;cAGvC,IAAA,UACA,IAAA,EAAM,qBAAA,EACN,IAAA,EAAM,wBAAA;AAAA"}
|
|
@@ -11,10 +11,15 @@ const VERCEL_API_URL = "https://api.vercel.com";
|
|
|
11
11
|
*/
|
|
12
12
|
var VercelIntegrationResourceProvider = class {
|
|
13
13
|
async create(inputs) {
|
|
14
|
-
const response = await fetch(`${VERCEL_API_URL}/v1/integrations/configurations?teamId=${inputs.teamId}`, { headers: { Authorization: `Bearer ${inputs.token}` } });
|
|
14
|
+
const response = await fetch(`${VERCEL_API_URL}/v1/integrations/configurations?view=account&teamId=${inputs.teamId}`, { headers: { Authorization: `Bearer ${inputs.token}` } });
|
|
15
15
|
if (!response.ok) throw new Error(`Vercel API error fetching integrations (${response.status}): ${await response.text()}`);
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const data = await response.json();
|
|
17
|
+
const configurations = Array.isArray(data) ? data : data.configurations;
|
|
18
|
+
const config = configurations.find((c) => c.slug === inputs.slug);
|
|
19
|
+
if (!config) {
|
|
20
|
+
const available = configurations.map((c) => c.slug).join(", ") || "(none)";
|
|
21
|
+
throw new Error(`Vercel integration "${inputs.slug}" is not installed on this team (available: ${available})`);
|
|
22
|
+
}
|
|
18
23
|
const outs = {
|
|
19
24
|
...inputs,
|
|
20
25
|
configurationId: config.id
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integration.mjs","names":[],"sources":["../../src/vercel/integration.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { VercelProvider } from \"./provider\";\n\nconst VERCEL_API_URL = \"https://api.vercel.com\";\n\n/** Resolved inputs for the Vercel integration dynamic provider. */\ninterface VercelIntegrationInputs {\n\t/** Vercel API bearer token. */\n\ttoken: string;\n\n\t/** Vercel team/org ID. */\n\tteamId: string;\n\n\t/** Marketplace integration slug (e.g. `\"upstash\"`, `\"neon\"`). */\n\tslug: string;\n}\n\n/** Persisted state for the Vercel integration. */\ninterface VercelIntegrationOutputs extends VercelIntegrationInputs {\n\t/** Vercel-assigned configuration ID (e.g. `\"icfg_…\"`). */\n\tconfigurationId: string;\n}\n\n/**
|
|
1
|
+
{"version":3,"file":"integration.mjs","names":[],"sources":["../../src/vercel/integration.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\nimport type { VercelProvider } from \"./provider\";\n\nconst VERCEL_API_URL = \"https://api.vercel.com\";\n\n/** Resolved inputs for the Vercel integration dynamic provider. */\ninterface VercelIntegrationInputs {\n\t/** Vercel API bearer token. */\n\ttoken: string;\n\n\t/** Vercel team/org ID. */\n\tteamId: string;\n\n\t/** Marketplace integration slug (e.g. `\"upstash\"`, `\"neon\"`). */\n\tslug: string;\n}\n\n/** Persisted state for the Vercel integration. */\ninterface VercelIntegrationOutputs extends VercelIntegrationInputs {\n\t/** Vercel-assigned configuration ID (e.g. `\"icfg_…\"`). */\n\tconfigurationId: string;\n}\n\n/** A single installed Vercel marketplace integration configuration. */\ninterface VercelIntegrationConfiguration {\n\tid: string;\n\tslug: string;\n}\n\n/**\n * Dynamic provider that resolves an installed Vercel marketplace integration\n * by its slug to its configuration ID (`icfg_…`).\n *\n * @internal Exported only for unit testing; not part of the public API surface.\n */\nexport class VercelIntegrationResourceProvider\n\timplements pulumi.dynamic.ResourceProvider\n{\n\tasync create(\n\t\tinputs: VercelIntegrationInputs,\n\t): Promise<pulumi.dynamic.CreateResult> {\n\t\t// `view=account` is required by the configurations endpoint (a missing view returns 400).\n\t\tconst response = await fetch(\n\t\t\t`${VERCEL_API_URL}/v1/integrations/configurations?view=account&teamId=${inputs.teamId}`,\n\t\t\t{ headers: { Authorization: `Bearer ${inputs.token}` } },\n\t\t);\n\n\t\tif (!response.ok) {\n\t\t\tthrow new Error(\n\t\t\t\t`Vercel API error fetching integrations (${response.status}): ${await response.text()}`,\n\t\t\t);\n\t\t}\n\n\t\t// The endpoint returns a top-level array; some responses wrap it in { configurations: [...] }.\n\t\tconst data = (await response.json()) as\n\t\t\t| VercelIntegrationConfiguration[]\n\t\t\t| { configurations: VercelIntegrationConfiguration[] };\n\n\t\tconst configurations = Array.isArray(data) ? data : data.configurations;\n\n\t\tconst config = configurations.find((c) => c.slug === inputs.slug);\n\n\t\tif (!config) {\n\t\t\tconst available =\n\t\t\t\tconfigurations.map((c) => c.slug).join(\", \") || \"(none)\";\n\n\t\t\tthrow new Error(\n\t\t\t\t`Vercel integration \"${inputs.slug}\" is not installed on this team (available: ${available})`,\n\t\t\t);\n\t\t}\n\n\t\tconst outs: VercelIntegrationOutputs = {\n\t\t\t...inputs,\n\t\t\tconfigurationId: config.id,\n\t\t};\n\n\t\treturn { id: config.id, outs };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: VercelIntegrationOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\t// Resolver-only: the integration's configuration id (icfg_…) is stable for the\n\t\t// lifetime of an installed integration, so read() does not re-query. If the\n\t\t// integration is uninstalled and reinstalled, a subsequent `up` re-resolves via create().\n\t\treturn { id, props };\n\t}\n\n\tasync delete(): Promise<void> {\n\t\tpulumi.log.warn(\n\t\t\t\"VercelIntegration is a read-only resolver — uninstall the integration from the Vercel dashboard if needed\",\n\t\t);\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: VercelIntegrationOutputs,\n\t\tnews: VercelIntegrationInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.teamId !== news.teamId) {\n\t\t\treplaces.push(\"teamId\");\n\t\t}\n\n\t\tif (olds.slug !== news.slug) {\n\t\t\treplaces.push(\"slug\");\n\t\t}\n\n\t\treturn {\n\t\t\tchanges: replaces.length > 0,\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 VercelIntegrationResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly configurationId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\ttoken: pulumi.Input<string>;\n\t\t\tteamId: pulumi.Input<string>;\n\t\t\tslug: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew VercelIntegrationResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, configurationId: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for VercelIntegration — replaces Pulumi's native `provider` field. */\ntype VercelIntegrationOptions = Omit<\n\tpulumi.ComponentResourceOptions,\n\t\"provider\"\n> & {\n\t/** Vercel authentication context. */\n\tprovider: VercelProvider;\n};\n\n/**\n * Args for {@link VercelIntegration}.\n */\nexport interface VercelIntegrationArgs {\n\t/**\n\t * Marketplace integration slug (e.g. `\"upstash\"`, `\"neon\"`).\n\t * The integration must already be installed on the team via the Vercel dashboard.\n\t */\n\tslug: pulumi.Input<string>;\n}\n\n/**\n * Resolves an installed Vercel marketplace integration by slug to its\n * configuration ID (`icfg_…`).\n *\n * The integration must be installed on the team via the Vercel dashboard\n * (one-time OAuth step) before this resource can be used. This resource is\n * read-only: it looks up the configuration ID and exposes it for downstream\n * marketplace-store resources.\n *\n * @example\n * ```typescript\n * const upstash = new VercelIntegration(\"upstash\", {\n * slug: \"upstash\",\n * }, { provider });\n *\n * // Use configurationId in marketplace store resources\n * export const upstashConfigId = upstash.configurationId;\n * ```\n */\nexport class VercelIntegration extends pulumi.ComponentResource {\n\t/** Vercel integration configuration ID (e.g. `\"icfg_…\"`). */\n\tpublic readonly configurationId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: VercelIntegrationArgs,\n\t\topts: VercelIntegrationOptions,\n\t) {\n\t\tconst { provider, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:vercel:Integration\", name, {}, pulumiOpts);\n\n\t\tconst resource = new VercelIntegrationResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\ttoken: provider.token,\n\t\t\t\tteamId: provider.teamId,\n\t\t\t\tslug: args.slug,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.configurationId = resource.configurationId;\n\n\t\tthis.registerOutputs({ configurationId: this.configurationId });\n\t}\n}\n"],"mappings":";;;;AAGA,MAAM,iBAAiB;;;;;;;AAgCvB,IAAa,oCAAb,MAEA;CACC,MAAM,OACL,QACuC;EAEvC,MAAM,WAAW,MAAM,MACtB,GAAG,eAAe,sDAAsD,OAAO,UAC/E,EAAE,SAAS,EAAE,eAAe,UAAU,OAAO,QAAQ,EAAE,CACxD;EAEA,IAAI,CAAC,SAAS,IACb,MAAM,IAAI,MACT,2CAA2C,SAAS,OAAO,KAAK,MAAM,SAAS,KAAK,GACrF;EAID,MAAM,OAAQ,MAAM,SAAS,KAAK;EAIlC,MAAM,iBAAiB,MAAM,QAAQ,IAAI,IAAI,OAAO,KAAK;EAEzD,MAAM,SAAS,eAAe,MAAM,MAAM,EAAE,SAAS,OAAO,IAAI;EAEhE,IAAI,CAAC,QAAQ;GACZ,MAAM,YACL,eAAe,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,IAAI,KAAK;GAEjD,MAAM,IAAI,MACT,uBAAuB,OAAO,KAAK,8CA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