@infracraft/pulumi 0.1.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/chunk-BVYJZCqc.cjs +44 -0
- package/dist/chunk-OPjESj5l.mjs +9 -0
- package/dist/git-guard.cjs +62 -0
- package/dist/git-guard.cjs.map +1 -0
- package/dist/git-guard.d.cts +13 -0
- package/dist/git-guard.d.cts.map +1 -0
- package/dist/git-guard.d.mts +13 -0
- package/dist/git-guard.d.mts.map +1 -0
- package/dist/git-guard.mjs +56 -0
- package/dist/git-guard.mjs.map +1 -0
- package/dist/hash.cjs +40 -0
- package/dist/hash.cjs.map +1 -0
- package/dist/hash.d.cts +10 -0
- package/dist/hash.d.cts.map +1 -0
- package/dist/hash.d.mts +10 -0
- package/dist/hash.d.mts.map +1 -0
- package/dist/hash.mjs +36 -0
- package/dist/hash.mjs.map +1 -0
- package/dist/neon/branch.cjs +113 -0
- package/dist/neon/branch.cjs.map +1 -0
- package/dist/neon/branch.d.cts +40 -0
- package/dist/neon/branch.d.cts.map +1 -0
- package/dist/neon/branch.d.mts +40 -0
- package/dist/neon/branch.d.mts.map +1 -0
- package/dist/neon/branch.mjs +111 -0
- package/dist/neon/branch.mjs.map +1 -0
- package/dist/neon/client.cjs +85 -0
- package/dist/neon/client.cjs.map +1 -0
- package/dist/neon/client.d.cts +59 -0
- package/dist/neon/client.d.cts.map +1 -0
- package/dist/neon/client.d.mts +59 -0
- package/dist/neon/client.d.mts.map +1 -0
- package/dist/neon/client.mjs +84 -0
- package/dist/neon/client.mjs.map +1 -0
- package/dist/neon/database.cjs +117 -0
- package/dist/neon/database.cjs.map +1 -0
- package/dist/neon/database.d.cts +48 -0
- package/dist/neon/database.d.cts.map +1 -0
- package/dist/neon/database.d.mts +48 -0
- package/dist/neon/database.d.mts.map +1 -0
- package/dist/neon/database.mjs +115 -0
- package/dist/neon/database.mjs.map +1 -0
- package/dist/neon/endpoint.cjs +167 -0
- package/dist/neon/endpoint.cjs.map +1 -0
- package/dist/neon/endpoint.d.cts +57 -0
- package/dist/neon/endpoint.d.cts.map +1 -0
- package/dist/neon/endpoint.d.mts +57 -0
- package/dist/neon/endpoint.d.mts.map +1 -0
- package/dist/neon/endpoint.mjs +165 -0
- package/dist/neon/endpoint.mjs.map +1 -0
- package/dist/neon/index.cjs +14 -0
- package/dist/neon/index.d.cts +7 -0
- package/dist/neon/index.d.mts +7 -0
- package/dist/neon/index.mjs +8 -0
- package/dist/neon/project.cjs +120 -0
- package/dist/neon/project.cjs.map +1 -0
- package/dist/neon/project.d.cts +52 -0
- package/dist/neon/project.d.cts.map +1 -0
- package/dist/neon/project.d.mts +52 -0
- package/dist/neon/project.d.mts.map +1 -0
- package/dist/neon/project.mjs +118 -0
- package/dist/neon/project.mjs.map +1 -0
- package/dist/neon/role.cjs +135 -0
- package/dist/neon/role.cjs.map +1 -0
- package/dist/neon/role.d.cts +49 -0
- package/dist/neon/role.d.cts.map +1 -0
- package/dist/neon/role.d.mts +49 -0
- package/dist/neon/role.d.mts.map +1 -0
- package/dist/neon/role.mjs +133 -0
- package/dist/neon/role.mjs.map +1 -0
- package/dist/railway/client.cjs +59 -0
- package/dist/railway/client.cjs.map +1 -0
- package/dist/railway/client.d.cts +39 -0
- package/dist/railway/client.d.cts.map +1 -0
- package/dist/railway/client.d.mts +39 -0
- package/dist/railway/client.d.mts.map +1 -0
- package/dist/railway/client.mjs +58 -0
- package/dist/railway/client.mjs.map +1 -0
- package/dist/railway/deploy.cjs +40 -0
- package/dist/railway/deploy.cjs.map +1 -0
- package/dist/railway/deploy.d.cts +47 -0
- package/dist/railway/deploy.d.cts.map +1 -0
- package/dist/railway/deploy.d.mts +47 -0
- package/dist/railway/deploy.d.mts.map +1 -0
- package/dist/railway/deploy.mjs +37 -0
- package/dist/railway/deploy.mjs.map +1 -0
- package/dist/railway/domain.cjs +236 -0
- package/dist/railway/domain.cjs.map +1 -0
- package/dist/railway/domain.d.cts +52 -0
- package/dist/railway/domain.d.cts.map +1 -0
- package/dist/railway/domain.d.mts +52 -0
- package/dist/railway/domain.d.mts.map +1 -0
- package/dist/railway/domain.mjs +234 -0
- package/dist/railway/domain.mjs.map +1 -0
- package/dist/railway/index.cjs +16 -0
- package/dist/railway/index.d.cts +8 -0
- package/dist/railway/index.d.mts +8 -0
- package/dist/railway/index.mjs +9 -0
- package/dist/railway/project.cjs +231 -0
- package/dist/railway/project.cjs.map +1 -0
- package/dist/railway/project.d.cts +52 -0
- package/dist/railway/project.d.cts.map +1 -0
- package/dist/railway/project.d.mts +52 -0
- package/dist/railway/project.d.mts.map +1 -0
- package/dist/railway/project.mjs +229 -0
- package/dist/railway/project.mjs.map +1 -0
- package/dist/railway/service.cjs +268 -0
- package/dist/railway/service.cjs.map +1 -0
- package/dist/railway/service.d.cts +88 -0
- package/dist/railway/service.d.cts.map +1 -0
- package/dist/railway/service.d.mts +88 -0
- package/dist/railway/service.d.mts.map +1 -0
- package/dist/railway/service.mjs +266 -0
- package/dist/railway/service.mjs.map +1 -0
- package/dist/railway/variable.cjs +149 -0
- package/dist/railway/variable.cjs.map +1 -0
- package/dist/railway/variable.d.cts +52 -0
- package/dist/railway/variable.d.cts.map +1 -0
- package/dist/railway/variable.d.mts +52 -0
- package/dist/railway/variable.d.mts.map +1 -0
- package/dist/railway/variable.mjs +147 -0
- package/dist/railway/variable.mjs.map +1 -0
- package/dist/railway/volume.cjs +179 -0
- package/dist/railway/volume.cjs.map +1 -0
- package/dist/railway/volume.d.cts +52 -0
- package/dist/railway/volume.d.cts.map +1 -0
- package/dist/railway/volume.d.mts +52 -0
- package/dist/railway/volume.d.mts.map +1 -0
- package/dist/railway/volume.mjs +177 -0
- package/dist/railway/volume.mjs.map +1 -0
- package/dist/vercel/deploy.cjs +65 -0
- package/dist/vercel/deploy.cjs.map +1 -0
- package/dist/vercel/deploy.d.cts +54 -0
- package/dist/vercel/deploy.d.cts.map +1 -0
- package/dist/vercel/deploy.d.mts +54 -0
- package/dist/vercel/deploy.d.mts.map +1 -0
- package/dist/vercel/deploy.mjs +61 -0
- package/dist/vercel/deploy.mjs.map +1 -0
- package/dist/vercel/index.cjs +6 -0
- package/dist/vercel/index.d.cts +3 -0
- package/dist/vercel/index.d.mts +3 -0
- package/dist/vercel/index.mjs +4 -0
- package/dist/vercel/variable.cjs +280 -0
- package/dist/vercel/variable.cjs.map +1 -0
- package/dist/vercel/variable.d.cts +55 -0
- package/dist/vercel/variable.d.cts.map +1 -0
- package/dist/vercel/variable.d.mts +55 -0
- package/dist/vercel/variable.d.mts.map +1 -0
- package/dist/vercel/variable.mjs +278 -0
- package/dist/vercel/variable.mjs.map +1 -0
- package/package.json +62 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
5
|
+
value,
|
|
6
|
+
configurable: true
|
|
7
|
+
});
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
10
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
11
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
15
|
+
key = keys[i];
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
17
|
+
__defProp(to, key, {
|
|
18
|
+
get: ((k) => from[k]).bind(null, key),
|
|
19
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
27
|
+
value: mod,
|
|
28
|
+
enumerable: true
|
|
29
|
+
}) : target, mod));
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
|
|
33
|
+
Object.defineProperty(exports, '__name', {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return __name;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
Object.defineProperty(exports, '__toESM', {
|
|
40
|
+
enumerable: true,
|
|
41
|
+
get: function () {
|
|
42
|
+
return __toESM;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('./chunk-BVYJZCqc.cjs');
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
node_fs = require_chunk.__toESM(node_fs, 1);
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
node_path = require_chunk.__toESM(node_path, 1);
|
|
7
|
+
let _pulumi_command = require("@pulumi/command");
|
|
8
|
+
_pulumi_command = require_chunk.__toESM(_pulumi_command, 1);
|
|
9
|
+
|
|
10
|
+
//#region src/git-guard.ts
|
|
11
|
+
const GUARD_DIR = ".git-infrakit-pulumi-guard";
|
|
12
|
+
function gitGuard(monorepoRoot) {
|
|
13
|
+
const gitPath = node_path.join(monorepoRoot, ".git");
|
|
14
|
+
const guardPath = node_path.join(monorepoRoot, GUARD_DIR);
|
|
15
|
+
ensureGitignore(node_path.join(monorepoRoot, ".gitignore"));
|
|
16
|
+
function restore() {
|
|
17
|
+
try {
|
|
18
|
+
if (node_fs.existsSync(guardPath)) {
|
|
19
|
+
if (node_fs.existsSync(gitPath)) node_fs.rmSync(gitPath, {
|
|
20
|
+
recursive: true,
|
|
21
|
+
force: true
|
|
22
|
+
});
|
|
23
|
+
node_fs.renameSync(guardPath, gitPath);
|
|
24
|
+
}
|
|
25
|
+
} catch {
|
|
26
|
+
console.error(`[git-guard] Failed to restore .git. Run manually: rm -rf ${gitPath} && mv ${guardPath} ${gitPath}`);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
process.on("exit", restore);
|
|
30
|
+
process.on("SIGINT", () => {
|
|
31
|
+
restore();
|
|
32
|
+
process.exit(0);
|
|
33
|
+
});
|
|
34
|
+
process.on("SIGTERM", () => {
|
|
35
|
+
restore();
|
|
36
|
+
process.exit(0);
|
|
37
|
+
});
|
|
38
|
+
return { hide: new _pulumi_command.local.Command("git-guard-hide", {
|
|
39
|
+
create: [
|
|
40
|
+
`test -d .git && test ! -d ${GUARD_DIR}`,
|
|
41
|
+
`&& mv .git ${GUARD_DIR}`,
|
|
42
|
+
`&& git init --quiet`,
|
|
43
|
+
`&& cp ${GUARD_DIR}/index .git/index`,
|
|
44
|
+
`&& echo "hidden"`,
|
|
45
|
+
`|| echo "no-op"`
|
|
46
|
+
].join(" "),
|
|
47
|
+
dir: monorepoRoot,
|
|
48
|
+
triggers: [monorepoRoot]
|
|
49
|
+
}) };
|
|
50
|
+
}
|
|
51
|
+
function ensureGitignore(gitignorePath) {
|
|
52
|
+
const content = node_fs.existsSync(gitignorePath) ? node_fs.readFileSync(gitignorePath, "utf-8") : "";
|
|
53
|
+
if (content.includes(".git-infrakit-pulumi-guard")) return;
|
|
54
|
+
const newline = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
|
|
55
|
+
node_fs.appendFileSync(gitignorePath, `${newline}${GUARD_DIR}\n`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
//#endregion
|
|
59
|
+
exports.GUARD_DIR = GUARD_DIR;
|
|
60
|
+
exports.ensureGitignore = ensureGitignore;
|
|
61
|
+
exports.gitGuard = gitGuard;
|
|
62
|
+
//# sourceMappingURL=git-guard.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-guard.cjs","names":["path","fs","command"],"sources":["../src/git-guard.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport * as command from \"@pulumi/command\";\n\nexport const GUARD_DIR = \".git-infrakit-pulumi-guard\";\n\ninterface GitGuardResult {\n\thide: command.local.Command;\n}\n\nexport function gitGuard(monorepoRoot: string): GitGuardResult {\n\tconst gitPath = path.join(monorepoRoot, \".git\");\n\tconst guardPath = path.join(monorepoRoot, GUARD_DIR);\n\tconst gitignorePath = path.join(monorepoRoot, \".gitignore\");\n\n\tensureGitignore(gitignorePath);\n\n\tfunction restore(): void {\n\t\ttry {\n\t\t\tif (fs.existsSync(guardPath)) {\n\t\t\t\tif (fs.existsSync(gitPath)) {\n\t\t\t\t\tfs.rmSync(gitPath, { recursive: true, force: true });\n\t\t\t\t}\n\n\t\t\t\tfs.renameSync(guardPath, gitPath);\n\t\t\t}\n\t\t} catch {\n\t\t\tconsole.error(\n\t\t\t\t`[git-guard] Failed to restore .git. Run manually: rm -rf ${gitPath} && mv ${guardPath} ${gitPath}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tprocess.on(\"exit\", restore);\n\n\tprocess.on(\"SIGINT\", () => {\n\t\trestore();\n\t\tprocess.exit(0);\n\t});\n\n\tprocess.on(\"SIGTERM\", () => {\n\t\trestore();\n\t\tprocess.exit(0);\n\t});\n\n\tconst hide = new command.local.Command(\"git-guard-hide\", {\n\t\tcreate: [\n\t\t\t`test -d .git && test ! -d ${GUARD_DIR}`,\n\t\t\t`&& mv .git ${GUARD_DIR}`,\n\t\t\t`&& git init --quiet`,\n\t\t\t`&& cp ${GUARD_DIR}/index .git/index`,\n\t\t\t`&& echo \"hidden\"`,\n\t\t\t`|| echo \"no-op\"`,\n\t\t].join(\" \"),\n\t\tdir: monorepoRoot,\n\t\ttriggers: [monorepoRoot],\n\t});\n\n\treturn { hide };\n}\n\nexport function ensureGitignore(gitignorePath: string): void {\n\tconst content = fs.existsSync(gitignorePath)\n\t\t? fs.readFileSync(gitignorePath, \"utf-8\")\n\t\t: \"\";\n\n\tif (content.includes(GUARD_DIR)) {\n\t\treturn;\n\t}\n\n\tconst newline = content.length > 0 && !content.endsWith(\"\\n\") ? \"\\n\" : \"\";\n\n\tfs.appendFileSync(gitignorePath, `${newline}${GUARD_DIR}\\n`);\n}\n"],"mappings":";;;;;;;;;;AAIA,MAAa,YAAY;AAMzB,SAAgB,SAAS,cAAsC;CAC9D,MAAM,UAAUA,UAAK,KAAK,cAAc,MAAM;CAC9C,MAAM,YAAYA,UAAK,KAAK,cAAc,SAAS;CAGnD,gBAFsBA,UAAK,KAAK,cAAc,YAElB,CAAC;CAE7B,SAAS,UAAgB;EACxB,IAAI;GACH,IAAIC,QAAG,WAAW,SAAS,GAAG;IAC7B,IAAIA,QAAG,WAAW,OAAO,GACxB,QAAG,OAAO,SAAS;KAAE,WAAW;KAAM,OAAO;IAAK,CAAC;IAGpD,QAAG,WAAW,WAAW,OAAO;GACjC;EACD,QAAQ;GACP,QAAQ,MACP,4DAA4D,QAAQ,SAAS,UAAU,GAAG,SAC3F;EACD;CACD;CAEA,QAAQ,GAAG,QAAQ,OAAO;CAE1B,QAAQ,GAAG,gBAAgB;EAC1B,QAAQ;EACR,QAAQ,KAAK,CAAC;CACf,CAAC;CAED,QAAQ,GAAG,iBAAiB;EAC3B,QAAQ;EACR,QAAQ,KAAK,CAAC;CACf,CAAC;CAeD,OAAO,EAAE,UAbQC,gBAAQ,MAAM,QAAQ,kBAAkB;EACxD,QAAQ;GACP,6BAA6B;GAC7B,cAAc;GACd;GACA,SAAS,UAAU;GACnB;GACA;EACD,EAAE,KAAK,GAAG;EACV,KAAK;EACL,UAAU,CAAC,YAAY;CACxB,CAEY,EAAE;AACf;AAEA,SAAgB,gBAAgB,eAA6B;CAC5D,MAAM,UAAUD,QAAG,WAAW,aAAa,IACxCA,QAAG,aAAa,eAAe,OAAO,IACtC;CAEH,IAAI,QAAQ,qCAAkB,GAC7B;CAGD,MAAM,UAAU,QAAQ,SAAS,KAAK,CAAC,QAAQ,SAAS,IAAI,IAAI,OAAO;CAEvE,QAAG,eAAe,eAAe,GAAG,UAAU,UAAU,GAAG;AAC5D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-OPjESj5l.cjs";
|
|
2
|
+
import * as command from "@pulumi/command";
|
|
3
|
+
|
|
4
|
+
//#region src/git-guard.d.ts
|
|
5
|
+
declare const GUARD_DIR = ".git-infrakit-pulumi-guard";
|
|
6
|
+
interface GitGuardResult {
|
|
7
|
+
hide: command.local.Command;
|
|
8
|
+
}
|
|
9
|
+
declare function gitGuard(monorepoRoot: string): GitGuardResult;
|
|
10
|
+
declare function ensureGitignore(gitignorePath: string): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { GUARD_DIR, ensureGitignore, gitGuard };
|
|
13
|
+
//# sourceMappingURL=git-guard.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-guard.d.cts","names":[],"sources":["../src/git-guard.ts"],"mappings":";;;;cAIa,SAAA;AAAA,UAEH,cAAA;EACT,IAAA,EAAM,OAAA,CAAQ,KAAA,CAAM,OAAO;AAAA;AAAA,iBAGZ,QAAA,CAAS,YAAA,WAAuB,cAAc;AAAA,iBAmD9C,eAAA,CAAgB,aAAqB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-OPjESj5l.mjs";
|
|
2
|
+
import * as command from "@pulumi/command";
|
|
3
|
+
|
|
4
|
+
//#region src/git-guard.d.ts
|
|
5
|
+
declare const GUARD_DIR = ".git-infrakit-pulumi-guard";
|
|
6
|
+
interface GitGuardResult {
|
|
7
|
+
hide: command.local.Command;
|
|
8
|
+
}
|
|
9
|
+
declare function gitGuard(monorepoRoot: string): GitGuardResult;
|
|
10
|
+
declare function ensureGitignore(gitignorePath: string): void;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { GUARD_DIR, ensureGitignore, gitGuard };
|
|
13
|
+
//# sourceMappingURL=git-guard.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-guard.d.mts","names":[],"sources":["../src/git-guard.ts"],"mappings":";;;;cAIa,SAAA;AAAA,UAEH,cAAA;EACT,IAAA,EAAM,OAAA,CAAQ,KAAA,CAAM,OAAO;AAAA;AAAA,iBAGZ,QAAA,CAAS,YAAA,WAAuB,cAAc;AAAA,iBAmD9C,eAAA,CAAgB,aAAqB"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-OPjESj5l.mjs";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import * as command from "@pulumi/command";
|
|
5
|
+
|
|
6
|
+
//#region src/git-guard.ts
|
|
7
|
+
const GUARD_DIR = ".git-infrakit-pulumi-guard";
|
|
8
|
+
function gitGuard(monorepoRoot) {
|
|
9
|
+
const gitPath = path.join(monorepoRoot, ".git");
|
|
10
|
+
const guardPath = path.join(monorepoRoot, GUARD_DIR);
|
|
11
|
+
ensureGitignore(path.join(monorepoRoot, ".gitignore"));
|
|
12
|
+
function restore() {
|
|
13
|
+
try {
|
|
14
|
+
if (fs.existsSync(guardPath)) {
|
|
15
|
+
if (fs.existsSync(gitPath)) fs.rmSync(gitPath, {
|
|
16
|
+
recursive: true,
|
|
17
|
+
force: true
|
|
18
|
+
});
|
|
19
|
+
fs.renameSync(guardPath, gitPath);
|
|
20
|
+
}
|
|
21
|
+
} catch {
|
|
22
|
+
console.error(`[git-guard] Failed to restore .git. Run manually: rm -rf ${gitPath} && mv ${guardPath} ${gitPath}`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
process.on("exit", restore);
|
|
26
|
+
process.on("SIGINT", () => {
|
|
27
|
+
restore();
|
|
28
|
+
process.exit(0);
|
|
29
|
+
});
|
|
30
|
+
process.on("SIGTERM", () => {
|
|
31
|
+
restore();
|
|
32
|
+
process.exit(0);
|
|
33
|
+
});
|
|
34
|
+
return { hide: new command.local.Command("git-guard-hide", {
|
|
35
|
+
create: [
|
|
36
|
+
`test -d .git && test ! -d ${GUARD_DIR}`,
|
|
37
|
+
`&& mv .git ${GUARD_DIR}`,
|
|
38
|
+
`&& git init --quiet`,
|
|
39
|
+
`&& cp ${GUARD_DIR}/index .git/index`,
|
|
40
|
+
`&& echo "hidden"`,
|
|
41
|
+
`|| echo "no-op"`
|
|
42
|
+
].join(" "),
|
|
43
|
+
dir: monorepoRoot,
|
|
44
|
+
triggers: [monorepoRoot]
|
|
45
|
+
}) };
|
|
46
|
+
}
|
|
47
|
+
function ensureGitignore(gitignorePath) {
|
|
48
|
+
const content = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, "utf-8") : "";
|
|
49
|
+
if (content.includes(".git-infrakit-pulumi-guard")) return;
|
|
50
|
+
const newline = content.length > 0 && !content.endsWith("\n") ? "\n" : "";
|
|
51
|
+
fs.appendFileSync(gitignorePath, `${newline}${GUARD_DIR}\n`);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
55
|
+
export { GUARD_DIR, ensureGitignore, gitGuard };
|
|
56
|
+
//# sourceMappingURL=git-guard.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-guard.mjs","names":[],"sources":["../src/git-guard.ts"],"sourcesContent":["import * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport * as command from \"@pulumi/command\";\n\nexport const GUARD_DIR = \".git-infrakit-pulumi-guard\";\n\ninterface GitGuardResult {\n\thide: command.local.Command;\n}\n\nexport function gitGuard(monorepoRoot: string): GitGuardResult {\n\tconst gitPath = path.join(monorepoRoot, \".git\");\n\tconst guardPath = path.join(monorepoRoot, GUARD_DIR);\n\tconst gitignorePath = path.join(monorepoRoot, \".gitignore\");\n\n\tensureGitignore(gitignorePath);\n\n\tfunction restore(): void {\n\t\ttry {\n\t\t\tif (fs.existsSync(guardPath)) {\n\t\t\t\tif (fs.existsSync(gitPath)) {\n\t\t\t\t\tfs.rmSync(gitPath, { recursive: true, force: true });\n\t\t\t\t}\n\n\t\t\t\tfs.renameSync(guardPath, gitPath);\n\t\t\t}\n\t\t} catch {\n\t\t\tconsole.error(\n\t\t\t\t`[git-guard] Failed to restore .git. Run manually: rm -rf ${gitPath} && mv ${guardPath} ${gitPath}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tprocess.on(\"exit\", restore);\n\n\tprocess.on(\"SIGINT\", () => {\n\t\trestore();\n\t\tprocess.exit(0);\n\t});\n\n\tprocess.on(\"SIGTERM\", () => {\n\t\trestore();\n\t\tprocess.exit(0);\n\t});\n\n\tconst hide = new command.local.Command(\"git-guard-hide\", {\n\t\tcreate: [\n\t\t\t`test -d .git && test ! -d ${GUARD_DIR}`,\n\t\t\t`&& mv .git ${GUARD_DIR}`,\n\t\t\t`&& git init --quiet`,\n\t\t\t`&& cp ${GUARD_DIR}/index .git/index`,\n\t\t\t`&& echo \"hidden\"`,\n\t\t\t`|| echo \"no-op\"`,\n\t\t].join(\" \"),\n\t\tdir: monorepoRoot,\n\t\ttriggers: [monorepoRoot],\n\t});\n\n\treturn { hide };\n}\n\nexport function ensureGitignore(gitignorePath: string): void {\n\tconst content = fs.existsSync(gitignorePath)\n\t\t? fs.readFileSync(gitignorePath, \"utf-8\")\n\t\t: \"\";\n\n\tif (content.includes(GUARD_DIR)) {\n\t\treturn;\n\t}\n\n\tconst newline = content.length > 0 && !content.endsWith(\"\\n\") ? \"\\n\" : \"\";\n\n\tfs.appendFileSync(gitignorePath, `${newline}${GUARD_DIR}\\n`);\n}\n"],"mappings":";;;;;;AAIA,MAAa,YAAY;AAMzB,SAAgB,SAAS,cAAsC;CAC9D,MAAM,UAAU,KAAK,KAAK,cAAc,MAAM;CAC9C,MAAM,YAAY,KAAK,KAAK,cAAc,SAAS;CAGnD,gBAFsB,KAAK,KAAK,cAAc,YAElB,CAAC;CAE7B,SAAS,UAAgB;EACxB,IAAI;GACH,IAAI,GAAG,WAAW,SAAS,GAAG;IAC7B,IAAI,GAAG,WAAW,OAAO,GACxB,GAAG,OAAO,SAAS;KAAE,WAAW;KAAM,OAAO;IAAK,CAAC;IAGpD,GAAG,WAAW,WAAW,OAAO;GACjC;EACD,QAAQ;GACP,QAAQ,MACP,4DAA4D,QAAQ,SAAS,UAAU,GAAG,SAC3F;EACD;CACD;CAEA,QAAQ,GAAG,QAAQ,OAAO;CAE1B,QAAQ,GAAG,gBAAgB;EAC1B,QAAQ;EACR,QAAQ,KAAK,CAAC;CACf,CAAC;CAED,QAAQ,GAAG,iBAAiB;EAC3B,QAAQ;EACR,QAAQ,KAAK,CAAC;CACf,CAAC;CAeD,OAAO,EAAE,UAbQ,QAAQ,MAAM,QAAQ,kBAAkB;EACxD,QAAQ;GACP,6BAA6B;GAC7B,cAAc;GACd;GACA,SAAS,UAAU;GACnB;GACA;EACD,EAAE,KAAK,GAAG;EACV,KAAK;EACL,UAAU,CAAC,YAAY;CACxB,CAEY,EAAE;AACf;AAEA,SAAgB,gBAAgB,eAA6B;CAC5D,MAAM,UAAU,GAAG,WAAW,aAAa,IACxC,GAAG,aAAa,eAAe,OAAO,IACtC;CAEH,IAAI,QAAQ,qCAAkB,GAC7B;CAGD,MAAM,UAAU,QAAQ,SAAS,KAAK,CAAC,QAAQ,SAAS,IAAI,IAAI,OAAO;CAEvE,GAAG,eAAe,eAAe,GAAG,UAAU,UAAU,GAAG;AAC5D"}
|
package/dist/hash.cjs
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('./chunk-BVYJZCqc.cjs');
|
|
3
|
+
let node_fs = require("node:fs");
|
|
4
|
+
node_fs = require_chunk.__toESM(node_fs, 1);
|
|
5
|
+
let node_path = require("node:path");
|
|
6
|
+
node_path = require_chunk.__toESM(node_path, 1);
|
|
7
|
+
let node_crypto = require("node:crypto");
|
|
8
|
+
node_crypto = require_chunk.__toESM(node_crypto, 1);
|
|
9
|
+
|
|
10
|
+
//#region src/hash.ts
|
|
11
|
+
const DEFAULT_IGNORE = new Set([
|
|
12
|
+
"node_modules",
|
|
13
|
+
"dist",
|
|
14
|
+
".turbo",
|
|
15
|
+
".next",
|
|
16
|
+
".git",
|
|
17
|
+
".vercel"
|
|
18
|
+
]);
|
|
19
|
+
function hashDirectory(dirPath, options) {
|
|
20
|
+
const ignore = options?.ignore ?? DEFAULT_IGNORE;
|
|
21
|
+
const hash = node_crypto.createHash("sha256");
|
|
22
|
+
function walk(currentPath) {
|
|
23
|
+
const entries = node_fs.readdirSync(currentPath, { withFileTypes: true });
|
|
24
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
25
|
+
if (ignore.has(entry.name)) continue;
|
|
26
|
+
const fullPath = node_path.join(currentPath, entry.name);
|
|
27
|
+
if (entry.isDirectory()) walk(fullPath);
|
|
28
|
+
else if (entry.isFile()) {
|
|
29
|
+
hash.update(entry.name);
|
|
30
|
+
hash.update(node_fs.readFileSync(fullPath));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
walk(dirPath);
|
|
35
|
+
return hash.digest("hex");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
//#endregion
|
|
39
|
+
exports.hashDirectory = hashDirectory;
|
|
40
|
+
//# sourceMappingURL=hash.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.cjs","names":["crypto","fs","path"],"sources":["../src/hash.ts"],"sourcesContent":["import * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nconst DEFAULT_IGNORE = new Set([\n\t\"node_modules\",\n\t\"dist\",\n\t\".turbo\",\n\t\".next\",\n\t\".git\",\n\t\".vercel\",\n]);\n\ninterface HashOptions {\n\tignore?: Set<string>;\n}\n\nexport function hashDirectory(dirPath: string, options?: HashOptions): string {\n\tconst ignore = options?.ignore ?? DEFAULT_IGNORE;\n\tconst hash = crypto.createHash(\"sha256\");\n\n\tfunction walk(currentPath: string) {\n\t\tconst entries = fs.readdirSync(currentPath, { withFileTypes: true });\n\n\t\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tif (ignore.has(entry.name)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = path.join(currentPath, entry.name);\n\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\twalk(fullPath);\n\t\t\t} else if (entry.isFile()) {\n\t\t\t\thash.update(entry.name);\n\t\t\t\thash.update(fs.readFileSync(fullPath));\n\t\t\t}\n\t\t}\n\t}\n\n\twalk(dirPath);\n\n\treturn hash.digest(\"hex\");\n}\n"],"mappings":";;;;;;;;;;AAIA,MAAM,iBAAiB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAMD,SAAgB,cAAc,SAAiB,SAA+B;CAC7E,MAAM,SAAS,SAAS,UAAU;CAClC,MAAM,OAAOA,YAAO,WAAW,QAAQ;CAEvC,SAAS,KAAK,aAAqB;EAClC,MAAM,UAAUC,QAAG,YAAY,aAAa,EAAE,eAAe,KAAK,CAAC;EAEnE,KAAK,MAAM,SAAS,QAAQ,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC,GAAG;GACzE,IAAI,OAAO,IAAI,MAAM,IAAI,GACxB;GAGD,MAAM,WAAWC,UAAK,KAAK,aAAa,MAAM,IAAI;GAElD,IAAI,MAAM,YAAY,GACrB,KAAK,QAAQ;QACP,IAAI,MAAM,OAAO,GAAG;IAC1B,KAAK,OAAO,MAAM,IAAI;IACtB,KAAK,OAAOD,QAAG,aAAa,QAAQ,CAAC;GACtC;EACD;CACD;CAEA,KAAK,OAAO;CAEZ,OAAO,KAAK,OAAO,KAAK;AACzB"}
|
package/dist/hash.d.cts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-OPjESj5l.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/hash.d.ts
|
|
4
|
+
interface HashOptions {
|
|
5
|
+
ignore?: Set<string>;
|
|
6
|
+
}
|
|
7
|
+
declare function hashDirectory(dirPath: string, options?: HashOptions): string;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { hashDirectory };
|
|
10
|
+
//# sourceMappingURL=hash.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.cts","names":[],"sources":["../src/hash.ts"],"mappings":";;;UAaU,WAAA;EACT,MAAA,GAAS,GAAG;AAAA;AAAA,iBAGG,aAAA,CAAc,OAAA,UAAiB,OAAA,GAAU,WAAW"}
|
package/dist/hash.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-OPjESj5l.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/hash.d.ts
|
|
4
|
+
interface HashOptions {
|
|
5
|
+
ignore?: Set<string>;
|
|
6
|
+
}
|
|
7
|
+
declare function hashDirectory(dirPath: string, options?: HashOptions): string;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { hashDirectory };
|
|
10
|
+
//# sourceMappingURL=hash.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.d.mts","names":[],"sources":["../src/hash.ts"],"mappings":";;;UAaU,WAAA;EACT,MAAA,GAAS,GAAG;AAAA;AAAA,iBAGG,aAAA,CAAc,OAAA,UAAiB,OAAA,GAAU,WAAW"}
|
package/dist/hash.mjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { t as __name } from "./chunk-OPjESj5l.mjs";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as path from "node:path";
|
|
4
|
+
import * as crypto from "node:crypto";
|
|
5
|
+
|
|
6
|
+
//#region src/hash.ts
|
|
7
|
+
const DEFAULT_IGNORE = new Set([
|
|
8
|
+
"node_modules",
|
|
9
|
+
"dist",
|
|
10
|
+
".turbo",
|
|
11
|
+
".next",
|
|
12
|
+
".git",
|
|
13
|
+
".vercel"
|
|
14
|
+
]);
|
|
15
|
+
function hashDirectory(dirPath, options) {
|
|
16
|
+
const ignore = options?.ignore ?? DEFAULT_IGNORE;
|
|
17
|
+
const hash = crypto.createHash("sha256");
|
|
18
|
+
function walk(currentPath) {
|
|
19
|
+
const entries = fs.readdirSync(currentPath, { withFileTypes: true });
|
|
20
|
+
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
21
|
+
if (ignore.has(entry.name)) continue;
|
|
22
|
+
const fullPath = path.join(currentPath, entry.name);
|
|
23
|
+
if (entry.isDirectory()) walk(fullPath);
|
|
24
|
+
else if (entry.isFile()) {
|
|
25
|
+
hash.update(entry.name);
|
|
26
|
+
hash.update(fs.readFileSync(fullPath));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
walk(dirPath);
|
|
31
|
+
return hash.digest("hex");
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
//#endregion
|
|
35
|
+
export { hashDirectory };
|
|
36
|
+
//# sourceMappingURL=hash.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hash.mjs","names":[],"sources":["../src/hash.ts"],"sourcesContent":["import * as crypto from \"node:crypto\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\n\nconst DEFAULT_IGNORE = new Set([\n\t\"node_modules\",\n\t\"dist\",\n\t\".turbo\",\n\t\".next\",\n\t\".git\",\n\t\".vercel\",\n]);\n\ninterface HashOptions {\n\tignore?: Set<string>;\n}\n\nexport function hashDirectory(dirPath: string, options?: HashOptions): string {\n\tconst ignore = options?.ignore ?? DEFAULT_IGNORE;\n\tconst hash = crypto.createHash(\"sha256\");\n\n\tfunction walk(currentPath: string) {\n\t\tconst entries = fs.readdirSync(currentPath, { withFileTypes: true });\n\n\t\tfor (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {\n\t\t\tif (ignore.has(entry.name)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst fullPath = path.join(currentPath, entry.name);\n\n\t\t\tif (entry.isDirectory()) {\n\t\t\t\twalk(fullPath);\n\t\t\t} else if (entry.isFile()) {\n\t\t\t\thash.update(entry.name);\n\t\t\t\thash.update(fs.readFileSync(fullPath));\n\t\t\t}\n\t\t}\n\t}\n\n\twalk(dirPath);\n\n\treturn hash.digest(\"hex\");\n}\n"],"mappings":";;;;;;AAIA,MAAM,iBAAiB,IAAI,IAAI;CAC9B;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;AAMD,SAAgB,cAAc,SAAiB,SAA+B;CAC7E,MAAM,SAAS,SAAS,UAAU;CAClC,MAAM,OAAO,OAAO,WAAW,QAAQ;CAEvC,SAAS,KAAK,aAAqB;EAClC,MAAM,UAAU,GAAG,YAAY,aAAa,EAAE,eAAe,KAAK,CAAC;EAEnE,KAAK,MAAM,SAAS,QAAQ,MAAM,GAAG,MAAM,EAAE,KAAK,cAAc,EAAE,IAAI,CAAC,GAAG;GACzE,IAAI,OAAO,IAAI,MAAM,IAAI,GACxB;GAGD,MAAM,WAAW,KAAK,KAAK,aAAa,MAAM,IAAI;GAElD,IAAI,MAAM,YAAY,GACrB,KAAK,QAAQ;QACP,IAAI,MAAM,OAAO,GAAG;IAC1B,KAAK,OAAO,MAAM,IAAI;IACtB,KAAK,OAAO,GAAG,aAAa,QAAQ,CAAC;GACtC;EACD;CACD;CAEA,KAAK,OAAO;CAEZ,OAAO,KAAK,OAAO,KAAK;AACzB"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('../chunk-BVYJZCqc.cjs');
|
|
3
|
+
const require_neon_client = require('./client.cjs');
|
|
4
|
+
let _pulumi_pulumi = require("@pulumi/pulumi");
|
|
5
|
+
_pulumi_pulumi = require_chunk.__toESM(_pulumi_pulumi, 1);
|
|
6
|
+
|
|
7
|
+
//#region src/neon/branch.ts
|
|
8
|
+
/**
|
|
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
|
+
*/
|
|
16
|
+
async function findBranchByName(client, projectId, name) {
|
|
17
|
+
return (await client.get(`/projects/${projectId}/branches`)).branches.find((b) => b.name === name)?.id;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Dynamic provider implementing CRUD for Neon branches.
|
|
21
|
+
*
|
|
22
|
+
* Uses adopt-or-create on `create()`: finds an existing branch by name
|
|
23
|
+
* before creating a new one, making `pulumi up` idempotent from zero.
|
|
24
|
+
*/
|
|
25
|
+
var NeonBranchProvider = class {
|
|
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
|
+
*/
|
|
32
|
+
async create(inputs) {
|
|
33
|
+
const client = new require_neon_client.NeonClient(inputs.apiKey);
|
|
34
|
+
let branchId = await findBranchByName(client, inputs.projectId, inputs.name);
|
|
35
|
+
if (branchId) _pulumi_pulumi.log.info(`Adopting existing Neon branch "${inputs.name}" (${branchId})`);
|
|
36
|
+
else branchId = (await client.post(`/projects/${inputs.projectId}/branches`, { branch: { name: inputs.name } })).branch.id;
|
|
37
|
+
return {
|
|
38
|
+
id: branchId,
|
|
39
|
+
outs: inputs
|
|
40
|
+
};
|
|
41
|
+
}
|
|
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
|
+
async read(id, props) {
|
|
51
|
+
const result = await new require_neon_client.NeonClient(props.apiKey).get(`/projects/${props.projectId}/branches/${id}`);
|
|
52
|
+
return {
|
|
53
|
+
id: result.branch.id,
|
|
54
|
+
props: {
|
|
55
|
+
...props,
|
|
56
|
+
name: result.branch.name
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}
|
|
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
|
+
async delete(id, props) {
|
|
67
|
+
const client = new require_neon_client.NeonClient(props.apiKey);
|
|
68
|
+
try {
|
|
69
|
+
await client.delete(`/projects/${props.projectId}/branches/${id}`);
|
|
70
|
+
} catch {
|
|
71
|
+
_pulumi_pulumi.log.warn(`Failed to delete Neon branch (may already be deleted)`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Compares old and new inputs to detect changes.
|
|
76
|
+
* Changing `projectId` triggers replacement.
|
|
77
|
+
*/
|
|
78
|
+
async diff(_id, olds, news) {
|
|
79
|
+
const replaces = [];
|
|
80
|
+
if (olds.projectId !== news.projectId) replaces.push("projectId");
|
|
81
|
+
return {
|
|
82
|
+
changes: replaces.length > 0 || olds.name !== news.name,
|
|
83
|
+
replaces,
|
|
84
|
+
deleteBeforeReplace: true
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
/**
|
|
89
|
+
* Manages a Neon branch with adopt-or-create semantics.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```typescript
|
|
93
|
+
* const branch = new NeonBranch("neon-branch-production", {
|
|
94
|
+
* apiKey: config.requireSecret("neonApiKey"),
|
|
95
|
+
* projectId: "quiet-forest-69719462",
|
|
96
|
+
* name: "production",
|
|
97
|
+
* });
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
var NeonBranch = class extends _pulumi_pulumi.dynamic.Resource {
|
|
101
|
+
/**
|
|
102
|
+
* @param name Pulumi resource name
|
|
103
|
+
* @param args Branch configuration inputs
|
|
104
|
+
* @param opts Standard Pulumi resource options
|
|
105
|
+
*/
|
|
106
|
+
constructor(name, args, opts) {
|
|
107
|
+
super(new NeonBranchProvider(), name, { ...args }, opts);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
//#endregion
|
|
112
|
+
exports.NeonBranch = NeonBranch;
|
|
113
|
+
//# sourceMappingURL=branch.cjs.map
|
|
@@ -0,0 +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 *\n * @param client Authenticated Neon API client\n * @param projectId Neon project ID\n * @param name Exact branch name to match\n * @returns The branch ID if found, `undefined` otherwise\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, making `pulumi up` idempotent from zero.\n */\nclass NeonBranchProvider implements pulumi.dynamic.ResourceProvider {\n\t/**\n\t * Creates or adopts a Neon branch by name.\n\t *\n\t * @param inputs Resolved branch configuration\n\t * @returns The Neon branch ID as the resource ID\n\t */\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\t/**\n\t * Reads current state for `pulumi refresh`.\n\t *\n\t * @param id Current Neon branch ID\n\t * @param props Last known persisted state\n\t * @returns Refreshed resource ID and properties\n\t * @throws {Error} If the branch no longer exists\n\t */\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\t/**\n\t * Deletes the Neon branch. Silently succeeds if already deleted.\n\t *\n\t * @param id Neon branch ID to delete\n\t * @param props Last known persisted state\n\t */\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\t/**\n\t * Compares old and new inputs to detect changes.\n\t * Changing `projectId` triggers replacement.\n\t */\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/**\n * Manages a Neon branch with adopt-or-create semantics.\n *\n * @example\n * ```typescript\n * const branch = new NeonBranch(\"neon-branch-production\", {\n * apiKey: config.requireSecret(\"neonApiKey\"),\n * projectId: \"quiet-forest-69719462\",\n * name: \"production\",\n * });\n * ```\n */\nexport class NeonBranch extends pulumi.dynamic.Resource {\n\t/**\n\t * @param name Pulumi resource name\n\t * @param args Branch configuration inputs\n\t * @param opts Standard Pulumi resource options\n\t */\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\t/** Neon API key. */\n\t\t\tapiKey: pulumi.Input<string>;\n\n\t\t\t/** Neon project ID. */\n\t\t\tprojectId: pulumi.Input<string>;\n\n\t\t\t/** Branch display name. */\n\t\t\tname: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(new NeonBranchProvider(), name, { ...args }, opts);\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoDA,eAAe,iBACd,QACA,WACA,MAC8B;CAO9B,QAFc,MAJO,OAAO,IAC3B,aAAa,UAAU,UACxB,GAEqB,SAAS,MAAM,MAAM,EAAE,SAAS,IAE1C,GAAG;AACf;;;;;;;AAQA,IAAM,qBAAN,MAAoE;;;;;;;CAOnE,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;;;;;;;;;CAUA,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;;;;;;;CAQA,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;;;;;CAMA,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;;;;;;;;;;;;;AAcA,IAAa,aAAb,cAAgCC,eAAO,QAAQ,SAAS;;;;;;CAMvD,YACC,MACA,MAUA,MACC;EACD,MAAM,IAAI,mBAAmB,GAAG,MAAM,EAAE,GAAG,KAAK,GAAG,IAAI;CACxD;AACD"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as __name } from "../chunk-OPjESj5l.cjs";
|
|
2
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
3
|
+
|
|
4
|
+
//#region src/neon/branch.d.ts
|
|
5
|
+
/** Resolved inputs for the Neon branch dynamic provider. */
|
|
6
|
+
interface NeonBranchInputs {
|
|
7
|
+
/** Neon API key. */
|
|
8
|
+
apiKey: string;
|
|
9
|
+
/** Neon project ID (e.g. `"quiet-forest-69719462"`). */
|
|
10
|
+
projectId: string;
|
|
11
|
+
/** Branch display name (e.g. `"production"`, `"development"`). */
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Manages a Neon branch with adopt-or-create semantics.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const branch = new NeonBranch("neon-branch-production", {
|
|
20
|
+
* apiKey: config.requireSecret("neonApiKey"),
|
|
21
|
+
* projectId: "quiet-forest-69719462",
|
|
22
|
+
* name: "production",
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare class NeonBranch extends pulumi.dynamic.Resource {
|
|
27
|
+
/**
|
|
28
|
+
* @param name Pulumi resource name
|
|
29
|
+
* @param args Branch configuration inputs
|
|
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);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { NeonBranch, NeonBranchInputs };
|
|
40
|
+
//# sourceMappingURL=branch.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch.d.cts","names":[],"sources":["../../src/neon/branch.ts"],"mappings":";;;;;UAIiB,gBAAA;;EAEhB,MAAA;EAFgC;EAKhC,SAAA;EALgC;EAQhC,IAAA;AAAA;;;AAAI;AAuKL;;;;;;;;;cAAa,UAAA,SAAmB,MAAA,CAAO,OAAA,CAAQ,QAAA;EAAf;;;;;cAO9B,IAAA,UACA,IAAA;IAES,oBAAR,MAAA,EAAQ,MAAA,CAAO,KAAA,UAGf;IAAA,SAAA,EAAW,MAAA,CAAO,KAAA,UAAA;IAGlB,IAAA,EAAM,MAAA,CAAO,KAAA;EAAA,GAEd,IAAA,GAAO,MAAA,CAAO,qBAAA;AAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as __name } from "../chunk-OPjESj5l.mjs";
|
|
2
|
+
import * as pulumi from "@pulumi/pulumi";
|
|
3
|
+
|
|
4
|
+
//#region src/neon/branch.d.ts
|
|
5
|
+
/** Resolved inputs for the Neon branch dynamic provider. */
|
|
6
|
+
interface NeonBranchInputs {
|
|
7
|
+
/** Neon API key. */
|
|
8
|
+
apiKey: string;
|
|
9
|
+
/** Neon project ID (e.g. `"quiet-forest-69719462"`). */
|
|
10
|
+
projectId: string;
|
|
11
|
+
/** Branch display name (e.g. `"production"`, `"development"`). */
|
|
12
|
+
name: string;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Manages a Neon branch with adopt-or-create semantics.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const branch = new NeonBranch("neon-branch-production", {
|
|
20
|
+
* apiKey: config.requireSecret("neonApiKey"),
|
|
21
|
+
* projectId: "quiet-forest-69719462",
|
|
22
|
+
* name: "production",
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
declare class NeonBranch extends pulumi.dynamic.Resource {
|
|
27
|
+
/**
|
|
28
|
+
* @param name Pulumi resource name
|
|
29
|
+
* @param args Branch configuration inputs
|
|
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);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { NeonBranch, NeonBranchInputs };
|
|
40
|
+
//# sourceMappingURL=branch.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"branch.d.mts","names":[],"sources":["../../src/neon/branch.ts"],"mappings":";;;;;UAIiB,gBAAA;;EAEhB,MAAA;EAFgC;EAKhC,SAAA;EALgC;EAQhC,IAAA;AAAA;;;AAAI;AAuKL;;;;;;;;;cAAa,UAAA,SAAmB,MAAA,CAAO,OAAA,CAAQ,QAAA;EAAf;;;;;cAO9B,IAAA,UACA,IAAA;IAES,oBAAR,MAAA,EAAQ,MAAA,CAAO,KAAA,UAGf;IAAA,SAAA,EAAW,MAAA,CAAO,KAAA,UAAA;IAGlB,IAAA,EAAM,MAAA,CAAO,KAAA;EAAA,GAEd,IAAA,GAAO,MAAA,CAAO,qBAAA;AAAA"}
|