@infracraft/pulumi 1.17.1 → 1.17.2
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/commands/deploy.cjs +3 -3
- package/dist/commands/deploy.cjs.map +1 -1
- package/dist/commands/deploy.mjs +3 -3
- package/dist/commands/deploy.mjs.map +1 -1
- package/dist/fly/app.cjs.map +1 -1
- package/dist/fly/app.d.cts +1 -10
- package/dist/fly/app.d.cts.map +1 -1
- package/dist/fly/app.d.mts +1 -10
- package/dist/fly/app.d.mts.map +1 -1
- package/dist/fly/app.mjs.map +1 -1
- package/dist/fly/certificate.cjs.map +1 -1
- package/dist/fly/certificate.d.cts +1 -10
- package/dist/fly/certificate.d.cts.map +1 -1
- package/dist/fly/certificate.d.mts +1 -10
- package/dist/fly/certificate.d.mts.map +1 -1
- package/dist/fly/certificate.mjs.map +1 -1
- package/dist/fly/index.d.cts +2 -2
- package/dist/fly/index.d.mts +2 -2
- package/dist/fly/ip.cjs.map +1 -1
- package/dist/fly/ip.d.cts +1 -12
- package/dist/fly/ip.d.cts.map +1 -1
- package/dist/fly/ip.d.mts +1 -12
- package/dist/fly/ip.d.mts.map +1 -1
- package/dist/fly/ip.mjs.map +1 -1
- package/dist/fly/secret.cjs.map +1 -1
- package/dist/fly/secret.d.cts +1 -10
- package/dist/fly/secret.d.cts.map +1 -1
- package/dist/fly/secret.d.mts +1 -10
- package/dist/fly/secret.d.mts.map +1 -1
- package/dist/fly/secret.mjs.map +1 -1
- package/dist/fly/volume.cjs.map +1 -1
- package/dist/fly/volume.d.cts +1 -14
- package/dist/fly/volume.d.cts.map +1 -1
- package/dist/fly/volume.d.mts +1 -14
- package/dist/fly/volume.d.mts.map +1 -1
- package/dist/fly/volume.mjs.map +1 -1
- package/dist/neon/database.cjs.map +1 -1
- package/dist/neon/database.d.cts +1 -14
- package/dist/neon/database.d.cts.map +1 -1
- package/dist/neon/database.d.mts +1 -14
- package/dist/neon/database.d.mts.map +1 -1
- package/dist/neon/database.mjs.map +1 -1
- package/dist/neon/endpoint.cjs.map +1 -1
- package/dist/neon/endpoint.d.cts +1 -16
- package/dist/neon/endpoint.d.cts.map +1 -1
- package/dist/neon/endpoint.d.mts +1 -16
- package/dist/neon/endpoint.d.mts.map +1 -1
- package/dist/neon/endpoint.mjs.map +1 -1
- package/dist/neon/project.cjs.map +1 -1
- package/dist/neon/project.d.cts +1 -10
- package/dist/neon/project.d.cts.map +1 -1
- package/dist/neon/project.d.mts +1 -10
- package/dist/neon/project.d.mts.map +1 -1
- package/dist/neon/project.mjs.map +1 -1
- package/dist/railway/deployment-monitor.cjs.map +1 -1
- package/dist/railway/deployment-monitor.mjs.map +1 -1
- package/dist/railway/domain.cjs.map +1 -1
- package/dist/railway/domain.d.cts +1 -14
- package/dist/railway/domain.d.cts.map +1 -1
- package/dist/railway/domain.d.mts +1 -14
- package/dist/railway/domain.d.mts.map +1 -1
- package/dist/railway/domain.mjs.map +1 -1
- package/dist/railway/project.cjs.map +1 -1
- package/dist/railway/project.d.cts +1 -10
- package/dist/railway/project.d.cts.map +1 -1
- package/dist/railway/project.d.mts +1 -10
- package/dist/railway/project.d.mts.map +1 -1
- package/dist/railway/project.mjs.map +1 -1
- package/dist/railway/service.cjs.map +1 -1
- package/dist/railway/service.d.cts +1 -35
- package/dist/railway/service.d.cts.map +1 -1
- package/dist/railway/service.d.mts +1 -35
- package/dist/railway/service.d.mts.map +1 -1
- package/dist/railway/service.mjs.map +1 -1
- package/dist/railway/variable.cjs.map +1 -1
- package/dist/railway/variable.d.cts +1 -14
- package/dist/railway/variable.d.cts.map +1 -1
- package/dist/railway/variable.d.mts +1 -14
- package/dist/railway/variable.d.mts.map +1 -1
- package/dist/railway/variable.mjs.map +1 -1
- package/dist/sandbox-8xQPhxw7.mjs +127 -0
- package/dist/sandbox-8xQPhxw7.mjs.map +1 -0
- package/dist/sandbox-Bh7tQ1Jy.cjs +159 -0
- package/dist/sandbox-Bh7tQ1Jy.cjs.map +1 -0
- package/dist/sandbox.cjs +6 -130
- package/dist/sandbox.d.cts +8 -6
- package/dist/sandbox.d.cts.map +1 -1
- package/dist/sandbox.d.mts +8 -6
- package/dist/sandbox.d.mts.map +1 -1
- package/dist/sandbox.mjs +2 -123
- package/dist/vercel/variable.cjs.map +1 -1
- package/dist/vercel/variable.d.cts +1 -12
- package/dist/vercel/variable.d.cts.map +1 -1
- package/dist/vercel/variable.d.mts +1 -12
- package/dist/vercel/variable.d.mts.map +1 -1
- package/dist/vercel/variable.mjs.map +1 -1
- package/package.json +2 -1
- package/dist/sandbox.cjs.map +0 -1
- package/dist/sandbox.mjs.map +0 -1
package/dist/commands/deploy.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_chunk = require('../chunk-BVYJZCqc.cjs');
|
|
3
3
|
const require_git_guard = require('../git-guard.cjs');
|
|
4
|
-
const require_sandbox = require('../sandbox.cjs');
|
|
4
|
+
const require_sandbox = require('../sandbox-Bh7tQ1Jy.cjs');
|
|
5
5
|
let _pulumi_pulumi = require("@pulumi/pulumi");
|
|
6
6
|
_pulumi_pulumi = require_chunk.__toESM(_pulumi_pulumi, 1);
|
|
7
7
|
let _pulumi_command = require("@pulumi/command");
|
|
@@ -24,8 +24,8 @@ function createDeployCommand(args, opts) {
|
|
|
24
24
|
const sandbox = deps.some(require_sandbox.isDeploySandbox);
|
|
25
25
|
const gitGuard = deps.some(require_git_guard.isGitGuard);
|
|
26
26
|
if (gitGuard && !sandbox) throw new Error(`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`);
|
|
27
|
-
let mode =
|
|
28
|
-
if (sandbox) mode = gitGuard ?
|
|
27
|
+
let mode = require_sandbox.SandboxMode.NONE;
|
|
28
|
+
if (sandbox) mode = gitGuard ? require_sandbox.SandboxMode.STUB : require_sandbox.SandboxMode.ORIGINAL;
|
|
29
29
|
const env = _pulumi_pulumi.getStack();
|
|
30
30
|
const create = _pulumi_pulumi.output(args.cli).apply((cli) => require_sandbox.buildSandboxScript({
|
|
31
31
|
mode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.cjs","names":["isDeploySandbox","isGitGuard","pulumi","buildSandboxScript","command"],"sources":["../../src/commands/deploy.ts"],"sourcesContent":["// src/commands/deploy.ts\nimport * as command from \"@pulumi/command\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { isGitGuard } from \"../git-guard\";\nimport { buildSandboxScript, isDeploySandbox, SandboxMode } from \"../sandbox\";\n\nexport interface CreateDeployCommandArgs {\n\t/** Resource name; the child command is `<name>` and the sandbox dir uses it. */\n\tname: string;\n\t/** Fully-formed platform deploy command (may be an Output, e.g. Railway). */\n\tcli: pulumi.Input<string>;\n\t/** Redeploy triggers (source/env hashes). */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\t/** Upload-scoping excludes (applied only in stub mode). */\n\texcludePaths?: string[];\n\t/** Shell run in the working dir before `cli` (e.g. write railpack.json). */\n\tsetup?: string;\n\t/** Env passed to the command (secrets that survive preview; not the inlined ones). */\n\tenvironment?: Record<string, pulumi.Input<string>>;\n}\n\nexport interface CreateDeployCommandResult {\n\tcommand: command.local.Command;\n\t/** The deploy CLI's final stdout line (the production URL for Vercel/Fly). */\n\tdeploymentUrl: pulumi.Output<string>;\n}\n\n/** Reads a `dependsOn` opt into a flat array of resource instances. */\nexport function dependsOnList(\n\topts: pulumi.ComponentResourceOptions,\n): unknown[] {\n\tconst dep = opts.dependsOn;\n\n\tif (Array.isArray(dep)) {\n\t\treturn dep;\n\t}\n\n\treturn dep ? [dep] : [];\n}\n\n/**\n * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:\n * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.\n * The platform deploy resources call ONLY this; they never touch the sandbox.\n */\nexport function createDeployCommand(\n\targs: CreateDeployCommandArgs,\n\topts: pulumi.ComponentResourceOptions,\n): CreateDeployCommandResult {\n\tconst deps = dependsOnList(opts);\n\tconst sandbox = deps.some(isDeploySandbox);\n\tconst gitGuard = deps.some(isGitGuard);\n\n\tif (gitGuard && !sandbox) {\n\t\tthrow new Error(\n\t\t\t`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`,\n\t\t);\n\t}\n\n\tlet mode = SandboxMode.NONE;\n\n\tif (sandbox) {\n\t\tmode = gitGuard ? SandboxMode.STUB : SandboxMode.ORIGINAL;\n\t}\n\n\tconst env = pulumi.getStack();\n\n\tconst create = pulumi.output(args.cli).apply((cli) =>\n\t\tbuildSandboxScript({\n\t\t\tmode,\n\t\t\tappName: args.name,\n\t\t\tenv,\n\t\t\texcludePaths: args.excludePaths,\n\t\t\tsetup: args.setup,\n\t\t\tcli,\n\t\t}),\n\t);\n\n\tconst cmd = new command.local.Command(\n\t\targs.name,\n\t\t{ create, triggers: args.triggers, environment: args.environment },\n\t\topts,\n\t);\n\n\tconst deploymentUrl = cmd.stdout.apply(\n\t\t(out) => out.trim().split(\"\\n\").pop() ?? \"\",\n\t);\n\n\treturn { command: cmd, deploymentUrl };\n}\n"],"mappings":";;;;;;;;;;;AA6BA,SAAgB,cACf,MACY;CACZ,MAAM,MAAM,KAAK;CAEjB,IAAI,MAAM,QAAQ,GAAG,GACpB,OAAO;CAGR,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC;AACvB;;;;;;AAOA,SAAgB,oBACf,MACA,MAC4B;CAC5B,MAAM,OAAO,cAAc,IAAI;CAC/B,MAAM,UAAU,KAAK,KAAKA,+BAAe;CACzC,MAAM,WAAW,KAAK,KAAKC,4BAAU;CAErC,IAAI,YAAY,CAAC,SAChB,MAAM,IAAI,MACT,gBAAgB,KAAK,KAAK,8DAC3B;CAGD,IAAI;
|
|
1
|
+
{"version":3,"file":"deploy.cjs","names":["isDeploySandbox","isGitGuard","SandboxMode","pulumi","buildSandboxScript","command"],"sources":["../../src/commands/deploy.ts"],"sourcesContent":["// src/commands/deploy.ts\nimport * as command from \"@pulumi/command\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { isGitGuard } from \"../git-guard\";\nimport { buildSandboxScript, isDeploySandbox, SandboxMode } from \"../sandbox\";\n\nexport interface CreateDeployCommandArgs {\n\t/** Resource name; the child command is `<name>` and the sandbox dir uses it. */\n\tname: string;\n\t/** Fully-formed platform deploy command (may be an Output, e.g. Railway). */\n\tcli: pulumi.Input<string>;\n\t/** Redeploy triggers (source/env hashes). */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\t/** Upload-scoping excludes (applied only in stub mode). */\n\texcludePaths?: string[];\n\t/** Shell run in the working dir before `cli` (e.g. write railpack.json). */\n\tsetup?: string;\n\t/** Env passed to the command (secrets that survive preview; not the inlined ones). */\n\tenvironment?: Record<string, pulumi.Input<string>>;\n}\n\nexport interface CreateDeployCommandResult {\n\tcommand: command.local.Command;\n\t/** The deploy CLI's final stdout line (the production URL for Vercel/Fly). */\n\tdeploymentUrl: pulumi.Output<string>;\n}\n\n/** Reads a `dependsOn` opt into a flat array of resource instances. */\nexport function dependsOnList(\n\topts: pulumi.ComponentResourceOptions,\n): unknown[] {\n\tconst dep = opts.dependsOn;\n\n\tif (Array.isArray(dep)) {\n\t\treturn dep;\n\t}\n\n\treturn dep ? [dep] : [];\n}\n\n/**\n * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:\n * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.\n * The platform deploy resources call ONLY this; they never touch the sandbox.\n */\nexport function createDeployCommand(\n\targs: CreateDeployCommandArgs,\n\topts: pulumi.ComponentResourceOptions,\n): CreateDeployCommandResult {\n\tconst deps = dependsOnList(opts);\n\tconst sandbox = deps.some(isDeploySandbox);\n\tconst gitGuard = deps.some(isGitGuard);\n\n\tif (gitGuard && !sandbox) {\n\t\tthrow new Error(\n\t\t\t`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`,\n\t\t);\n\t}\n\n\tlet mode = SandboxMode.NONE;\n\n\tif (sandbox) {\n\t\tmode = gitGuard ? SandboxMode.STUB : SandboxMode.ORIGINAL;\n\t}\n\n\tconst env = pulumi.getStack();\n\n\tconst create = pulumi.output(args.cli).apply((cli) =>\n\t\tbuildSandboxScript({\n\t\t\tmode,\n\t\t\tappName: args.name,\n\t\t\tenv,\n\t\t\texcludePaths: args.excludePaths,\n\t\t\tsetup: args.setup,\n\t\t\tcli,\n\t\t}),\n\t);\n\n\tconst cmd = new command.local.Command(\n\t\targs.name,\n\t\t{ create, triggers: args.triggers, environment: args.environment },\n\t\topts,\n\t);\n\n\tconst deploymentUrl = cmd.stdout.apply(\n\t\t(out) => out.trim().split(\"\\n\").pop() ?? \"\",\n\t);\n\n\treturn { command: cmd, deploymentUrl };\n}\n"],"mappings":";;;;;;;;;;;AA6BA,SAAgB,cACf,MACY;CACZ,MAAM,MAAM,KAAK;CAEjB,IAAI,MAAM,QAAQ,GAAG,GACpB,OAAO;CAGR,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC;AACvB;;;;;;AAOA,SAAgB,oBACf,MACA,MAC4B;CAC5B,MAAM,OAAO,cAAc,IAAI;CAC/B,MAAM,UAAU,KAAK,KAAKA,+BAAe;CACzC,MAAM,WAAW,KAAK,KAAKC,4BAAU;CAErC,IAAI,YAAY,CAAC,SAChB,MAAM,IAAI,MACT,gBAAgB,KAAK,KAAK,8DAC3B;CAGD,IAAI,OAAOC,4BAAY;CAEvB,IAAI,SACH,OAAO,WAAWA,4BAAY,OAAOA,4BAAY;CAGlD,MAAM,MAAMC,eAAO,SAAS;CAE5B,MAAM,SAASA,eAAO,OAAO,KAAK,GAAG,EAAE,OAAO,QAC7CC,mCAAmB;EAClB;EACA,SAAS,KAAK;EACd;EACA,cAAc,KAAK;EACnB,OAAO,KAAK;EACZ;CACD,CAAC,CACF;CAEA,MAAM,MAAM,IAAIC,gBAAQ,MAAM,QAC7B,KAAK,MACL;EAAE;EAAQ,UAAU,KAAK;EAAU,aAAa,KAAK;CAAY,GACjE,IACD;CAMA,OAAO;EAAE,SAAS;EAAK,eAJD,IAAI,OAAO,OAC/B,QAAQ,IAAI,KAAK,EAAE,MAAM,IAAI,EAAE,IAAI,KAAK,EAGP;CAAE;AACtC"}
|
package/dist/commands/deploy.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as __name } from "../chunk-OPjESj5l.mjs";
|
|
2
2
|
import { isGitGuard } from "../git-guard.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { a as buildSandboxScript, n as isDeploySandbox, r as SandboxMode } from "../sandbox-8xQPhxw7.mjs";
|
|
4
4
|
import * as pulumi from "@pulumi/pulumi";
|
|
5
5
|
import * as command from "@pulumi/command";
|
|
6
6
|
|
|
@@ -21,8 +21,8 @@ function createDeployCommand(args, opts) {
|
|
|
21
21
|
const sandbox = deps.some(isDeploySandbox);
|
|
22
22
|
const gitGuard = deps.some(isGitGuard);
|
|
23
23
|
if (gitGuard && !sandbox) throw new Error(`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`);
|
|
24
|
-
let mode =
|
|
25
|
-
if (sandbox) mode = gitGuard ?
|
|
24
|
+
let mode = SandboxMode.NONE;
|
|
25
|
+
if (sandbox) mode = gitGuard ? SandboxMode.STUB : SandboxMode.ORIGINAL;
|
|
26
26
|
const env = pulumi.getStack();
|
|
27
27
|
const create = pulumi.output(args.cli).apply((cli) => buildSandboxScript({
|
|
28
28
|
mode,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.mjs","names":[],"sources":["../../src/commands/deploy.ts"],"sourcesContent":["// src/commands/deploy.ts\nimport * as command from \"@pulumi/command\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { isGitGuard } from \"../git-guard\";\nimport { buildSandboxScript, isDeploySandbox, SandboxMode } from \"../sandbox\";\n\nexport interface CreateDeployCommandArgs {\n\t/** Resource name; the child command is `<name>` and the sandbox dir uses it. */\n\tname: string;\n\t/** Fully-formed platform deploy command (may be an Output, e.g. Railway). */\n\tcli: pulumi.Input<string>;\n\t/** Redeploy triggers (source/env hashes). */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\t/** Upload-scoping excludes (applied only in stub mode). */\n\texcludePaths?: string[];\n\t/** Shell run in the working dir before `cli` (e.g. write railpack.json). */\n\tsetup?: string;\n\t/** Env passed to the command (secrets that survive preview; not the inlined ones). */\n\tenvironment?: Record<string, pulumi.Input<string>>;\n}\n\nexport interface CreateDeployCommandResult {\n\tcommand: command.local.Command;\n\t/** The deploy CLI's final stdout line (the production URL for Vercel/Fly). */\n\tdeploymentUrl: pulumi.Output<string>;\n}\n\n/** Reads a `dependsOn` opt into a flat array of resource instances. */\nexport function dependsOnList(\n\topts: pulumi.ComponentResourceOptions,\n): unknown[] {\n\tconst dep = opts.dependsOn;\n\n\tif (Array.isArray(dep)) {\n\t\treturn dep;\n\t}\n\n\treturn dep ? [dep] : [];\n}\n\n/**\n * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:\n * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.\n * The platform deploy resources call ONLY this; they never touch the sandbox.\n */\nexport function createDeployCommand(\n\targs: CreateDeployCommandArgs,\n\topts: pulumi.ComponentResourceOptions,\n): CreateDeployCommandResult {\n\tconst deps = dependsOnList(opts);\n\tconst sandbox = deps.some(isDeploySandbox);\n\tconst gitGuard = deps.some(isGitGuard);\n\n\tif (gitGuard && !sandbox) {\n\t\tthrow new Error(\n\t\t\t`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`,\n\t\t);\n\t}\n\n\tlet mode = SandboxMode.NONE;\n\n\tif (sandbox) {\n\t\tmode = gitGuard ? SandboxMode.STUB : SandboxMode.ORIGINAL;\n\t}\n\n\tconst env = pulumi.getStack();\n\n\tconst create = pulumi.output(args.cli).apply((cli) =>\n\t\tbuildSandboxScript({\n\t\t\tmode,\n\t\t\tappName: args.name,\n\t\t\tenv,\n\t\t\texcludePaths: args.excludePaths,\n\t\t\tsetup: args.setup,\n\t\t\tcli,\n\t\t}),\n\t);\n\n\tconst cmd = new command.local.Command(\n\t\targs.name,\n\t\t{ create, triggers: args.triggers, environment: args.environment },\n\t\topts,\n\t);\n\n\tconst deploymentUrl = cmd.stdout.apply(\n\t\t(out) => out.trim().split(\"\\n\").pop() ?? \"\",\n\t);\n\n\treturn { command: cmd, deploymentUrl };\n}\n"],"mappings":";;;;;;;;AA6BA,SAAgB,cACf,MACY;CACZ,MAAM,MAAM,KAAK;CAEjB,IAAI,MAAM,QAAQ,GAAG,GACpB,OAAO;CAGR,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC;AACvB;;;;;;AAOA,SAAgB,oBACf,MACA,MAC4B;CAC5B,MAAM,OAAO,cAAc,IAAI;CAC/B,MAAM,UAAU,KAAK,KAAK,eAAe;CACzC,MAAM,WAAW,KAAK,KAAK,UAAU;CAErC,IAAI,YAAY,CAAC,SAChB,MAAM,IAAI,MACT,gBAAgB,KAAK,KAAK,8DAC3B;CAGD,IAAI;
|
|
1
|
+
{"version":3,"file":"deploy.mjs","names":[],"sources":["../../src/commands/deploy.ts"],"sourcesContent":["// src/commands/deploy.ts\nimport * as command from \"@pulumi/command\";\nimport * as pulumi from \"@pulumi/pulumi\";\n\nimport { isGitGuard } from \"../git-guard\";\nimport { buildSandboxScript, isDeploySandbox, SandboxMode } from \"../sandbox\";\n\nexport interface CreateDeployCommandArgs {\n\t/** Resource name; the child command is `<name>` and the sandbox dir uses it. */\n\tname: string;\n\t/** Fully-formed platform deploy command (may be an Output, e.g. Railway). */\n\tcli: pulumi.Input<string>;\n\t/** Redeploy triggers (source/env hashes). */\n\ttriggers: pulumi.Input<pulumi.Input<string>[]>;\n\t/** Upload-scoping excludes (applied only in stub mode). */\n\texcludePaths?: string[];\n\t/** Shell run in the working dir before `cli` (e.g. write railpack.json). */\n\tsetup?: string;\n\t/** Env passed to the command (secrets that survive preview; not the inlined ones). */\n\tenvironment?: Record<string, pulumi.Input<string>>;\n}\n\nexport interface CreateDeployCommandResult {\n\tcommand: command.local.Command;\n\t/** The deploy CLI's final stdout line (the production URL for Vercel/Fly). */\n\tdeploymentUrl: pulumi.Output<string>;\n}\n\n/** Reads a `dependsOn` opt into a flat array of resource instances. */\nexport function dependsOnList(\n\topts: pulumi.ComponentResourceOptions,\n): unknown[] {\n\tconst dep = opts.dependsOn;\n\n\tif (Array.isArray(dep)) {\n\t\treturn dep;\n\t}\n\n\treturn dep ? [dep] : [];\n}\n\n/**\n * Builds a sandboxed deploy command. Inspects `opts.dependsOn` by brand:\n * a DeploySandbox → isolate; a GitGuard → stub `.git`; GitGuard alone → throw.\n * The platform deploy resources call ONLY this; they never touch the sandbox.\n */\nexport function createDeployCommand(\n\targs: CreateDeployCommandArgs,\n\topts: pulumi.ComponentResourceOptions,\n): CreateDeployCommandResult {\n\tconst deps = dependsOnList(opts);\n\tconst sandbox = deps.some(isDeploySandbox);\n\tconst gitGuard = deps.some(isGitGuard);\n\n\tif (gitGuard && !sandbox) {\n\t\tthrow new Error(\n\t\t\t`[infracraft] ${args.name}: GitGuard has no effect without a DeploySandbox in dependsOn`,\n\t\t);\n\t}\n\n\tlet mode = SandboxMode.NONE;\n\n\tif (sandbox) {\n\t\tmode = gitGuard ? SandboxMode.STUB : SandboxMode.ORIGINAL;\n\t}\n\n\tconst env = pulumi.getStack();\n\n\tconst create = pulumi.output(args.cli).apply((cli) =>\n\t\tbuildSandboxScript({\n\t\t\tmode,\n\t\t\tappName: args.name,\n\t\t\tenv,\n\t\t\texcludePaths: args.excludePaths,\n\t\t\tsetup: args.setup,\n\t\t\tcli,\n\t\t}),\n\t);\n\n\tconst cmd = new command.local.Command(\n\t\targs.name,\n\t\t{ create, triggers: args.triggers, environment: args.environment },\n\t\topts,\n\t);\n\n\tconst deploymentUrl = cmd.stdout.apply(\n\t\t(out) => out.trim().split(\"\\n\").pop() ?? \"\",\n\t);\n\n\treturn { command: cmd, deploymentUrl };\n}\n"],"mappings":";;;;;;;;AA6BA,SAAgB,cACf,MACY;CACZ,MAAM,MAAM,KAAK;CAEjB,IAAI,MAAM,QAAQ,GAAG,GACpB,OAAO;CAGR,OAAO,MAAM,CAAC,GAAG,IAAI,CAAC;AACvB;;;;;;AAOA,SAAgB,oBACf,MACA,MAC4B;CAC5B,MAAM,OAAO,cAAc,IAAI;CAC/B,MAAM,UAAU,KAAK,KAAK,eAAe;CACzC,MAAM,WAAW,KAAK,KAAK,UAAU;CAErC,IAAI,YAAY,CAAC,SAChB,MAAM,IAAI,MACT,gBAAgB,KAAK,KAAK,8DAC3B;CAGD,IAAI,OAAO,YAAY;CAEvB,IAAI,SACH,OAAO,WAAW,YAAY,OAAO,YAAY;CAGlD,MAAM,MAAM,OAAO,SAAS;CAE5B,MAAM,SAAS,OAAO,OAAO,KAAK,GAAG,EAAE,OAAO,QAC7C,mBAAmB;EAClB;EACA,SAAS,KAAK;EACd;EACA,cAAc,KAAK;EACnB,OAAO,KAAK;EACZ;CACD,CAAC,CACF;CAEA,MAAM,MAAM,IAAI,QAAQ,MAAM,QAC7B,KAAK,MACL;EAAE;EAAQ,UAAU,KAAK;EAAU,aAAa,KAAK;CAAY,GACjE,IACD;CAMA,OAAO;EAAE,SAAS;EAAK,eAJD,IAAI,OAAO,OAC/B,QAAQ,IAAI,KAAK,EAAE,MAAM,IAAI,EAAE,IAAI,KAAK,EAGP;CAAE;AACtC"}
|
package/dist/fly/app.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.cjs","names":["FlyClient","pulumi"],"sources":["../../src/fly/app.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/** Resolved inputs for the Fly app dynamic provider. */\
|
|
1
|
+
{"version":3,"file":"app.cjs","names":["FlyClient","pulumi"],"sources":["../../src/fly/app.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/** Resolved inputs for the Fly app dynamic provider. */\ninterface FlyAppInputs {\n\t/** Fly API token. */\n\ttoken: string;\n\n\t/** App name (globally unique). Used as the resource identifier. */\n\tname: string;\n\n\t/** Org slug used only when creating a new app. */\n\torganization?: string;\n}\n\n/** Persisted state for the Fly app. */\ninterface FlyAppOutputs extends FlyAppInputs {\n\t/** App identifier — equals the app name (all child paths key off the name). */\n\tappId: string;\n}\n\n/** Get-app response (only the fields we read). */\ninterface FlyAppResponse {\n\tid: string;\n\tname: string;\n}\n\n/**\n * Dynamic provider implementing adopt-or-create for Fly apps.\n *\n * `create()` does `GET /v1/apps/{name}`; if found it adopts, otherwise it\n * `POST /v1/apps`. `delete()` is a no-op — deleting a Fly app destroys\n * everything in it, so (like Railway/Neon/Vercel top-level resources) Pulumi\n * does not delete apps.\n */\nclass FlyAppResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(inputs: FlyAppInputs): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new FlyClient(inputs.token);\n\n\t\tconst existing = await client.tryGet<FlyAppResponse>(\n\t\t\t`/v1/apps/${inputs.name}`,\n\t\t);\n\n\t\tif (existing) {\n\t\t\tpulumi.log.info(`Adopting existing Fly app \"${inputs.name}\"`);\n\t\t} else {\n\t\t\tif (!inputs.organization) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`FlyApp \"${inputs.name}\": an organization is required to create a new app — set it on FlyProvider or FlyApp args`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpulumi.log.info(`Fly app \"${inputs.name}\" not found — creating...`);\n\n\t\t\tawait client.post(\"/v1/apps\", {\n\t\t\t\tapp_name: inputs.name,\n\t\t\t\torg_slug: inputs.organization,\n\t\t\t});\n\t\t}\n\n\t\tconst outs: FlyAppOutputs = { ...inputs, appId: inputs.name };\n\n\t\treturn { id: inputs.name, outs };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: FlyAppOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new FlyClient(props.token);\n\t\tconst app = await client.tryGet<FlyAppResponse>(`/v1/apps/${id}`);\n\n\t\tif (!app) {\n\t\t\tthrow new Error(`Fly app \"${id}\" not found during refresh`);\n\t\t}\n\n\t\treturn { id, props: { ...props, name: app.name, appId: app.name } };\n\t}\n\n\tasync update(\n\t\tid: string,\n\t\t_olds: FlyAppOutputs,\n\t\tnews: FlyAppInputs,\n\t): Promise<pulumi.dynamic.UpdateResult> {\n\t\treturn { outs: { ...news, appId: id } };\n\t}\n\n\tasync delete(): Promise<void> {\n\t\tpulumi.log.warn(\n\t\t\t\"Fly app deletion skipped — apps are not deleted by Pulumi (would destroy all contained resources)\",\n\t\t);\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: FlyAppOutputs,\n\t\tnews: FlyAppInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.name !== news.name) {\n\t\t\treplaces.push(\"name\");\n\t\t}\n\n\t\tif (olds.organization !== news.organization) {\n\t\t\treplaces.push(\"organization\");\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 FlyAppResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly appId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\ttoken: pulumi.Input<string>;\n\t\t\tname: pulumi.Input<string>;\n\t\t\torganization?: pulumi.Input<string | undefined>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew FlyAppResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, appId: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for FlyApp — replaces Pulumi's native `provider` field. */\ntype FlyAppOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\t/** Fly authentication context. */\n\tprovider: FlyProvider;\n};\n\n/** Args for FlyApp. */\nexport interface FlyAppArgs {\n\t/** App name (globally unique). Used for adoption lookup and as `.id`. */\n\tname: pulumi.Input<string>;\n\n\t/**\n\t * Org slug for app creation. Overrides `FlyProvider.organization`.\n\t * Ignored when the app already exists (adoption).\n\t */\n\torganization?: pulumi.Input<string>;\n}\n\n/**\n * Manages a Fly app with adopt-or-create semantics.\n *\n * @example\n * ```typescript\n * const app = new FlyApp(\"api\", { name: \"rby-api\" }, { provider });\n * ```\n */\nexport class FlyApp extends pulumi.ComponentResource {\n\t/** App identifier (equals the app name). */\n\tpublic readonly id: pulumi.Output<string>;\n\n\tconstructor(name: string, args: FlyAppArgs, opts: FlyAppOptions) {\n\t\tconst { provider, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:App\", name, {}, pulumiOpts);\n\n\t\tconst resource = new FlyAppResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\ttoken: provider.token,\n\t\t\t\tname: args.name,\n\t\t\t\torganization: args.organization ?? provider.organization,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.id = resource.appId;\n\n\t\tthis.registerOutputs({ id: this.id });\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;AAqCA,IAAM,yBAAN,MAAwE;CACvE,MAAM,OAAO,QAA4D;EACxE,MAAM,SAAS,IAAIA,6BAAU,OAAO,KAAK;EAMzC,IAAI,MAJmB,OAAO,OAC7B,YAAY,OAAO,MACpB,GAGC,eAAO,IAAI,KAAK,8BAA8B,OAAO,KAAK,EAAE;OACtD;GACN,IAAI,CAAC,OAAO,cACX,MAAM,IAAI,MACT,WAAW,OAAO,KAAK,0FACxB;GAGD,eAAO,IAAI,KAAK,YAAY,OAAO,KAAK,0BAA0B;GAElE,MAAM,OAAO,KA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MAAM,KAAK;GACX,cAAc,KAAK,gBAAgB,SAAS;EAC7C,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,KAAK,SAAS;EAEnB,KAAK,gBAAgB,EAAE,IAAI,KAAK,GAAG,CAAC;CACrC;AACD"}
|
package/dist/fly/app.d.cts
CHANGED
|
@@ -3,15 +3,6 @@ import { FlyProvider } from "./provider.cjs";
|
|
|
3
3
|
import * as pulumi from "@pulumi/pulumi";
|
|
4
4
|
|
|
5
5
|
//#region src/fly/app.d.ts
|
|
6
|
-
/** Resolved inputs for the Fly app dynamic provider. */
|
|
7
|
-
interface FlyAppInputs {
|
|
8
|
-
/** Fly API token. */
|
|
9
|
-
token: string;
|
|
10
|
-
/** App name (globally unique). Used as the resource identifier. */
|
|
11
|
-
name: string;
|
|
12
|
-
/** Org slug used only when creating a new app. */
|
|
13
|
-
organization?: string;
|
|
14
|
-
}
|
|
15
6
|
/** Options type for FlyApp — replaces Pulumi's native `provider` field. */
|
|
16
7
|
type FlyAppOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
|
|
17
8
|
/** Fly authentication context. */provider: FlyProvider;
|
|
@@ -40,5 +31,5 @@ declare class FlyApp extends pulumi.ComponentResource {
|
|
|
40
31
|
constructor(name: string, args: FlyAppArgs, opts: FlyAppOptions);
|
|
41
32
|
}
|
|
42
33
|
//#endregion
|
|
43
|
-
export { FlyApp, FlyAppArgs
|
|
34
|
+
export { FlyApp, FlyAppArgs };
|
|
44
35
|
//# sourceMappingURL=app.d.cts.map
|
package/dist/fly/app.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.cts","names":[],"sources":["../../src/fly/app.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"app.d.cts","names":[],"sources":["../../src/fly/app.ts"],"mappings":";;;;;;KA6IK,aAAA,GAAgB,IAAA,CAAK,MAAA,CAAO,wBAAA;oCAEhC,QAAA,EAAU,WAAA;AAAA;;UAIM,UAAA;EANI;EAQpB,IAAA,EAAM,MAAA,CAAO,KAAA;EANQ;;;;EAYrB,YAAA,GAAe,MAAA,CAAO,KAAK;AAAA;;;AAZN;AAItB;;;;;cAmBa,MAAA,SAAe,MAAA,CAAO,iBAAA;EAjBrB;EAAA,SAmBG,EAAA,EAAI,MAAA,CAAO,MAAA;cAEf,IAAA,UAAc,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,aAAA;AAAA"}
|
package/dist/fly/app.d.mts
CHANGED
|
@@ -3,15 +3,6 @@ import { FlyProvider } from "./provider.mjs";
|
|
|
3
3
|
import * as pulumi from "@pulumi/pulumi";
|
|
4
4
|
|
|
5
5
|
//#region src/fly/app.d.ts
|
|
6
|
-
/** Resolved inputs for the Fly app dynamic provider. */
|
|
7
|
-
interface FlyAppInputs {
|
|
8
|
-
/** Fly API token. */
|
|
9
|
-
token: string;
|
|
10
|
-
/** App name (globally unique). Used as the resource identifier. */
|
|
11
|
-
name: string;
|
|
12
|
-
/** Org slug used only when creating a new app. */
|
|
13
|
-
organization?: string;
|
|
14
|
-
}
|
|
15
6
|
/** Options type for FlyApp — replaces Pulumi's native `provider` field. */
|
|
16
7
|
type FlyAppOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
|
|
17
8
|
/** Fly authentication context. */provider: FlyProvider;
|
|
@@ -40,5 +31,5 @@ declare class FlyApp extends pulumi.ComponentResource {
|
|
|
40
31
|
constructor(name: string, args: FlyAppArgs, opts: FlyAppOptions);
|
|
41
32
|
}
|
|
42
33
|
//#endregion
|
|
43
|
-
export { FlyApp, FlyAppArgs
|
|
34
|
+
export { FlyApp, FlyAppArgs };
|
|
44
35
|
//# sourceMappingURL=app.d.mts.map
|
package/dist/fly/app.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.mts","names":[],"sources":["../../src/fly/app.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"app.d.mts","names":[],"sources":["../../src/fly/app.ts"],"mappings":";;;;;;KA6IK,aAAA,GAAgB,IAAA,CAAK,MAAA,CAAO,wBAAA;oCAEhC,QAAA,EAAU,WAAA;AAAA;;UAIM,UAAA;EANI;EAQpB,IAAA,EAAM,MAAA,CAAO,KAAA;EANQ;;;;EAYrB,YAAA,GAAe,MAAA,CAAO,KAAK;AAAA;;;AAZN;AAItB;;;;;cAmBa,MAAA,SAAe,MAAA,CAAO,iBAAA;EAjBrB;EAAA,SAmBG,EAAA,EAAI,MAAA,CAAO,MAAA;cAEf,IAAA,UAAc,IAAA,EAAM,UAAA,EAAY,IAAA,EAAM,aAAA;AAAA"}
|
package/dist/fly/app.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.mjs","names":[],"sources":["../../src/fly/app.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/** Resolved inputs for the Fly app dynamic provider. */\
|
|
1
|
+
{"version":3,"file":"app.mjs","names":[],"sources":["../../src/fly/app.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/** Resolved inputs for the Fly app dynamic provider. */\ninterface FlyAppInputs {\n\t/** Fly API token. */\n\ttoken: string;\n\n\t/** App name (globally unique). Used as the resource identifier. */\n\tname: string;\n\n\t/** Org slug used only when creating a new app. */\n\torganization?: string;\n}\n\n/** Persisted state for the Fly app. */\ninterface FlyAppOutputs extends FlyAppInputs {\n\t/** App identifier — equals the app name (all child paths key off the name). */\n\tappId: string;\n}\n\n/** Get-app response (only the fields we read). */\ninterface FlyAppResponse {\n\tid: string;\n\tname: string;\n}\n\n/**\n * Dynamic provider implementing adopt-or-create for Fly apps.\n *\n * `create()` does `GET /v1/apps/{name}`; if found it adopts, otherwise it\n * `POST /v1/apps`. `delete()` is a no-op — deleting a Fly app destroys\n * everything in it, so (like Railway/Neon/Vercel top-level resources) Pulumi\n * does not delete apps.\n */\nclass FlyAppResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(inputs: FlyAppInputs): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new FlyClient(inputs.token);\n\n\t\tconst existing = await client.tryGet<FlyAppResponse>(\n\t\t\t`/v1/apps/${inputs.name}`,\n\t\t);\n\n\t\tif (existing) {\n\t\t\tpulumi.log.info(`Adopting existing Fly app \"${inputs.name}\"`);\n\t\t} else {\n\t\t\tif (!inputs.organization) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`FlyApp \"${inputs.name}\": an organization is required to create a new app — set it on FlyProvider or FlyApp args`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tpulumi.log.info(`Fly app \"${inputs.name}\" not found — creating...`);\n\n\t\t\tawait client.post(\"/v1/apps\", {\n\t\t\t\tapp_name: inputs.name,\n\t\t\t\torg_slug: inputs.organization,\n\t\t\t});\n\t\t}\n\n\t\tconst outs: FlyAppOutputs = { ...inputs, appId: inputs.name };\n\n\t\treturn { id: inputs.name, outs };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: FlyAppOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new FlyClient(props.token);\n\t\tconst app = await client.tryGet<FlyAppResponse>(`/v1/apps/${id}`);\n\n\t\tif (!app) {\n\t\t\tthrow new Error(`Fly app \"${id}\" not found during refresh`);\n\t\t}\n\n\t\treturn { id, props: { ...props, name: app.name, appId: app.name } };\n\t}\n\n\tasync update(\n\t\tid: string,\n\t\t_olds: FlyAppOutputs,\n\t\tnews: FlyAppInputs,\n\t): Promise<pulumi.dynamic.UpdateResult> {\n\t\treturn { outs: { ...news, appId: id } };\n\t}\n\n\tasync delete(): Promise<void> {\n\t\tpulumi.log.warn(\n\t\t\t\"Fly app deletion skipped — apps are not deleted by Pulumi (would destroy all contained resources)\",\n\t\t);\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: FlyAppOutputs,\n\t\tnews: FlyAppInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.name !== news.name) {\n\t\t\treplaces.push(\"name\");\n\t\t}\n\n\t\tif (olds.organization !== news.organization) {\n\t\t\treplaces.push(\"organization\");\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 FlyAppResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly appId: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\ttoken: pulumi.Input<string>;\n\t\t\tname: pulumi.Input<string>;\n\t\t\torganization?: pulumi.Input<string | undefined>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew FlyAppResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, appId: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for FlyApp — replaces Pulumi's native `provider` field. */\ntype FlyAppOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\t/** Fly authentication context. */\n\tprovider: FlyProvider;\n};\n\n/** Args for FlyApp. */\nexport interface FlyAppArgs {\n\t/** App name (globally unique). Used for adoption lookup and as `.id`. */\n\tname: pulumi.Input<string>;\n\n\t/**\n\t * Org slug for app creation. Overrides `FlyProvider.organization`.\n\t * Ignored when the app already exists (adoption).\n\t */\n\torganization?: pulumi.Input<string>;\n}\n\n/**\n * Manages a Fly app with adopt-or-create semantics.\n *\n * @example\n * ```typescript\n * const app = new FlyApp(\"api\", { name: \"rby-api\" }, { provider });\n * ```\n */\nexport class FlyApp extends pulumi.ComponentResource {\n\t/** App identifier (equals the app name). */\n\tpublic readonly id: pulumi.Output<string>;\n\n\tconstructor(name: string, args: FlyAppArgs, opts: FlyAppOptions) {\n\t\tconst { provider, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:App\", name, {}, pulumiOpts);\n\n\t\tconst resource = new FlyAppResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\ttoken: provider.token,\n\t\t\t\tname: args.name,\n\t\t\t\torganization: args.organization ?? provider.organization,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.id = resource.appId;\n\n\t\tthis.registerOutputs({ id: this.id });\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAqCA,IAAM,yBAAN,MAAwE;CACvE,MAAM,OAAO,QAA4D;EACxE,MAAM,SAAS,IAAI,UAAU,OAAO,KAAK;EAMzC,IAAI,MAJmB,OAAO,OAC7B,YAAY,OAAO,MACpB,GAGC,OAAO,IAAI,KAAK,8BAA8B,OAAO,KAAK,EAAE;OACtD;GACN,IAAI,CAAC,OAAO,cACX,MAAM,IAAI,MACT,WAAW,OAAO,KAAK,0FACxB;GAGD,OAAO,IAAI,KAAK,YAAY,OAAO,KAAK,0BAA0B;GAElE,MAAM,OAAO,KAAK,YAAY;IAC7B,UAAU,OAAO;IACjB,UAAU,OAAO;GAClB,CAAC;EACF;EAEA,MAAM,OAAsB;GAAE,GAAG;GAAQ,OAAO,OAAO;EAAK;EAE5D,OAAO;GAAE,IAAI,OAAO;GAAM;EAAK;CAChC;CAEA,MAAM,KACL,IACA,OACqC;EAErC,MAAM,MAAM,MAAM,IADC,UAAU,MAAM,KACZ,EAAE,OAAuB,YAAY,IAAI;EAEhE,IAAI,CAAC,KACJ,MAAM,IAAI,MAAM,YAAY,GAAG,2BAA2B;EAG3D,OAAO;GAAE;GAAI,OAAO;IAAE,GAAG;IAAO,MAAM,IAAI;IAAM,OAAO,IAAI;GAAK;EAAE;CACnE;CAEA,MAAM,OACL,IACA,OACA,MACuC;EACvC,OAAO,EAAE,MAAM;GAAE,GAAG;GAAM,OAAO;EAAG,EAAE;CACvC;CAEA,MAAM,SAAwB;EAC7B,OAAO,IAAI,KACV,mGACD;CACD;CAEA,MAAM,KACL,KACA,MACA,MACqC;EACrC,MAAM,WAAqB,CAAC;EAE5B,IAAI,KAAK,SAAS,KAAK,MACtB,SAAS,KAAK,MAAM;EAGrB,IAAI,KAAK,iBAAiB,KAAK,cAC9B,SAAS,KAAK,cAAc;EAG7B,OAAO;GACN,SAAS,SAAS,SAAS;GAC3B;GACA,qBAAqB;EACtB;CACD;AACD;;AAGA,IAAM,iBAAN,cAA6B,OAAO,QAAQ,SAAS;CAGpD,YACC,MACA,MAKA,MACC;EACD,MACC,IAAI,uBAAuB,GAC3B,MACA;GAAE,GAAG;GAAM,OAAO;EAAU,GAC5B,IACD;CACD;AACD;;;;;;;;;AA4BA,IAAa,SAAb,cAA4B,OAAO,kBAAkB;CAIpD,YAAY,MAAc,MAAkB,MAAqB;EAChE,MAAM,EAAE,UAAU,GAAG,eAAe;EAEpC,MAAM,sBAAsB,MAAM,CAAC,GAAG,UAAU;EAEhD,MAAM,WAAW,IAAI,eACpB,GAAG,KAAK,YACR;GACC,OAAO,SAAS;GAChB,MAAM,KAAK;GACX,cAAc,KAAK,gBAAgB,SAAS;EAC7C,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,KAAK,SAAS;EAEnB,KAAK,gBAAgB,EAAE,IAAI,KAAK,GAAG,CAAC;CACrC;AACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"certificate.cjs","names":["FlyClient","pulumi"],"sources":["../../src/fly/certificate.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport type { FlyApp } from \"./app\";\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/** DNS records the consumer must create for certificate validation. */\nexport interface FlyDnsRequirements {\n\t/** ACME challenge CNAME record. */\n\tacme_challenge?: { name: string; target: string };\n\n\t/** `_fly-ownership` TXT record. */\n\townership?: { name: string; app_value: string };\n\n\t/** CNAME target for the hostname itself. */\n\tcname?: string;\n}\n\n/** Resolved inputs for the Fly certificate dynamic provider. */\
|
|
1
|
+
{"version":3,"file":"certificate.cjs","names":["FlyClient","pulumi"],"sources":["../../src/fly/certificate.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport type { FlyApp } from \"./app\";\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/** DNS records the consumer must create for certificate validation. */\nexport interface FlyDnsRequirements {\n\t/** ACME challenge CNAME record. */\n\tacme_challenge?: { name: string; target: string };\n\n\t/** `_fly-ownership` TXT record. */\n\townership?: { name: string; app_value: string };\n\n\t/** CNAME target for the hostname itself. */\n\tcname?: string;\n}\n\n/** Resolved inputs for the Fly certificate dynamic provider. */\ninterface FlyCertificateInputs {\n\t/** Fly API token. */\n\ttoken: string;\n\n\t/** App name the certificate belongs to. */\n\tappName: string;\n\n\t/** Hostname to issue an ACME certificate for. Used as the resource key. */\n\thostname: string;\n}\n\n/** Persisted state for the Fly certificate. */\ninterface FlyCertificateOutputs extends FlyCertificateInputs {\n\t/** Whether the certificate is fully provisioned (DNS correct). */\n\tconfigured: boolean;\n\n\t/** DNS records required for validation. */\n\tdnsRequirements: FlyDnsRequirements;\n}\n\n/** Certificate response (only the fields we read). */\ninterface FlyCertificateResponse {\n\thostname: string;\n\tconfigured: boolean;\n\tdns_requirements?: FlyDnsRequirements;\n}\n\n/**\n * Dynamic provider for Fly ACME (Let's Encrypt) certificates. `create()` checks\n * for an existing cert by hostname and adopts it, otherwise it requests one via\n * `POST /v1/apps/{app}/certificates/acme`. The Machines API returns no `id` —\n * the hostname is the resource key.\n */\nclass FlyCertificateResourceProvider\n\timplements pulumi.dynamic.ResourceProvider\n{\n\tasync create(\n\t\tinputs: FlyCertificateInputs,\n\t): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new FlyClient(inputs.token);\n\t\tconst path = `/v1/apps/${inputs.appName}/certificates/${encodeURIComponent(inputs.hostname)}`;\n\n\t\tlet cert = await client.tryGet<FlyCertificateResponse>(path);\n\n\t\tif (cert) {\n\t\t\tpulumi.log.info(`Adopting existing Fly certificate \"${inputs.hostname}\"`);\n\t\t} else {\n\t\t\tcert = await client.post<FlyCertificateResponse>(\n\t\t\t\t`/v1/apps/${inputs.appName}/certificates/acme`,\n\t\t\t\t{ hostname: inputs.hostname },\n\t\t\t);\n\t\t}\n\n\t\tconst outs: FlyCertificateOutputs = {\n\t\t\t...inputs,\n\t\t\tconfigured: cert.configured ?? false,\n\t\t\tdnsRequirements: cert.dns_requirements ?? {},\n\t\t};\n\n\t\treturn { id: inputs.hostname, outs };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: FlyCertificateOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new FlyClient(props.token);\n\n\t\tconst cert = await client.tryGet<FlyCertificateResponse>(\n\t\t\t`/v1/apps/${props.appName}/certificates/${encodeURIComponent(id)}`,\n\t\t);\n\n\t\tif (!cert) {\n\t\t\tthrow new Error(`Fly certificate \"${id}\" not found during refresh`);\n\t\t}\n\n\t\treturn {\n\t\t\tid,\n\t\t\tprops: {\n\t\t\t\t...props,\n\t\t\t\tconfigured: cert.configured ?? false,\n\t\t\t\tdnsRequirements: cert.dns_requirements ?? {},\n\t\t\t},\n\t\t};\n\t}\n\n\tasync update(\n\t\t_id: string,\n\t\t_olds: FlyCertificateOutputs,\n\t\tnews: FlyCertificateInputs,\n\t): Promise<pulumi.dynamic.UpdateResult> {\n\t\t// Hostname/app changes force replacement (see diff); nothing else is updatable.\n\t\treturn {\n\t\t\touts: { ...news, configured: false, dnsRequirements: {} },\n\t\t};\n\t}\n\n\tasync delete(id: string, props: FlyCertificateOutputs): Promise<void> {\n\t\tconst client = new FlyClient(props.token);\n\n\t\tawait client.delete(\n\t\t\t`/v1/apps/${props.appName}/certificates/${encodeURIComponent(id)}`,\n\t\t);\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: FlyCertificateOutputs,\n\t\tnews: FlyCertificateInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.appName !== news.appName) {\n\t\t\treplaces.push(\"appName\");\n\t\t}\n\n\t\tif (olds.hostname !== news.hostname) {\n\t\t\treplaces.push(\"hostname\");\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 FlyCertificateResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly configured: pulumi.Output<boolean>;\n\tpublic declare readonly dnsRequirements: pulumi.Output<FlyDnsRequirements>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\ttoken: pulumi.Input<string>;\n\t\t\tappName: pulumi.Input<string>;\n\t\t\thostname: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew FlyCertificateResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, configured: undefined, dnsRequirements: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for FlyCertificate. */\ntype FlyCertificateOptions = Omit<\n\tpulumi.ComponentResourceOptions,\n\t\"provider\"\n> & {\n\t/** Fly authentication context. */\n\tprovider: FlyProvider;\n\n\t/** App the certificate belongs to. */\n\tapp: FlyApp;\n};\n\n/** Args for FlyCertificate. */\nexport interface FlyCertificateArgs {\n\t/** Hostname to issue an ACME certificate for (e.g. `\"api.example.com\"`). */\n\thostname: pulumi.Input<string>;\n}\n\n/**\n * Manages a Fly ACME certificate for a custom hostname.\n *\n * Exposes `.configured` and `.dnsRequirements` so the consumer can wire up the\n * required DNS records.\n *\n * @example\n * ```typescript\n * const cert = new FlyCertificate(\"api-cert\", {\n * hostname: \"api.example.com\",\n * }, { provider, app });\n * ```\n */\nexport class FlyCertificate extends pulumi.ComponentResource {\n\t/** Certificate identifier (equals the hostname). */\n\tpublic readonly id: pulumi.Output<string>;\n\n\t/** Whether the certificate is fully provisioned. */\n\tpublic readonly configured: pulumi.Output<boolean>;\n\n\t/** DNS records required for validation. */\n\tpublic readonly dnsRequirements: pulumi.Output<FlyDnsRequirements>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: FlyCertificateArgs,\n\t\topts: FlyCertificateOptions,\n\t) {\n\t\tconst { provider, app, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:Certificate\", name, {}, pulumiOpts);\n\n\t\tconst resource = new FlyCertificateResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\ttoken: provider.token,\n\t\t\t\tappName: app.id,\n\t\t\t\thostname: args.hostname,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.id = pulumi.output(args.hostname);\n\t\tthis.configured = resource.configured;\n\t\tthis.dnsRequirements = resource.dnsRequirements;\n\n\t\tthis.registerOutputs({\n\t\t\tid: this.id,\n\t\t\tconfigured: this.configured,\n\t\t\tdnsRequirements: this.dnsRequirements,\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;AAoDA,IAAM,iCAAN,MAEA;CACC,MAAM,OACL,QACuC;EACvC,MAAM,SAAS,IAAIA,6BAAU,OAAO,KAAK;EACzC,MAAM,OAAO,YAAY,OAAO,QAAQ,gBAAgB,mBAAmB,OAAO,QAAQ;EAE1F,IAAI,OAAO,MAAM,OAAO,OAA+B,IAAI;EAE3D,IAAI,MACH,eAAO,IAAI,KAAK,sCAAsC,OAAO,SAAS,EAAE;OAExE,OAAO,MAAM,OAAO,KACnB,YAAY,OAAO,QAAQ,qBAC3B,EAAE,UAAU,OAAO,SAAS,CAC7B;EAGD,MAAM,OAA8B;GACnC,GAAG;GACH,YAAY,KAAK,cAAc;GAC/B,iBAAiB,KAAK,oBAAoB,CAAC;EAC5C;EAEA,OAAO;GAAE,IAAI,OAAO;GAAU;EAAK;CACpC;CAEA,MAAM,KACL,IACA,OACqC;EAG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;EAChB,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,KAAKA,eAAO,OAAO,KAAK,QAAQ;EACrC,KAAK,aAAa,SAAS;EAC3B,KAAK,kBAAkB,SAAS;EAEhC,KAAK,gBAAgB;GACpB,IAAI,KAAK;GACT,YAAY,KAAK;GACjB,iBAAiB,KAAK;EACvB,CAAC;CACF;AACD"}
|
|
@@ -19,15 +19,6 @@ interface FlyDnsRequirements {
|
|
|
19
19
|
/** CNAME target for the hostname itself. */
|
|
20
20
|
cname?: string;
|
|
21
21
|
}
|
|
22
|
-
/** Resolved inputs for the Fly certificate dynamic provider. */
|
|
23
|
-
interface FlyCertificateInputs {
|
|
24
|
-
/** Fly API token. */
|
|
25
|
-
token: string;
|
|
26
|
-
/** App name the certificate belongs to. */
|
|
27
|
-
appName: string;
|
|
28
|
-
/** Hostname to issue an ACME certificate for. Used as the resource key. */
|
|
29
|
-
hostname: string;
|
|
30
|
-
}
|
|
31
22
|
/** Options type for FlyCertificate. */
|
|
32
23
|
type FlyCertificateOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
|
|
33
24
|
/** Fly authentication context. */provider: FlyProvider; /** App the certificate belongs to. */
|
|
@@ -61,5 +52,5 @@ declare class FlyCertificate extends pulumi.ComponentResource {
|
|
|
61
52
|
constructor(name: string, args: FlyCertificateArgs, opts: FlyCertificateOptions);
|
|
62
53
|
}
|
|
63
54
|
//#endregion
|
|
64
|
-
export { FlyCertificate, FlyCertificateArgs,
|
|
55
|
+
export { FlyCertificate, FlyCertificateArgs, FlyDnsRequirements };
|
|
65
56
|
//# sourceMappingURL=certificate.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"certificate.d.cts","names":[],"sources":["../../src/fly/certificate.ts"],"mappings":";;;;;;;UAOiB,kBAAA;;EAEhB,cAAA;IAAmB,IAAA;IAAc,MAAA;EAAA;EAAjC;EAGA,SAAA;IAAc,IAAA;IAAc,SAAA;EAAA;EAAA;EAG5B,KAAA;AAAA;AAAK;AAAA,
|
|
1
|
+
{"version":3,"file":"certificate.d.cts","names":[],"sources":["../../src/fly/certificate.ts"],"mappings":";;;;;;;UAOiB,kBAAA;;EAEhB,cAAA;IAAmB,IAAA;IAAc,MAAA;EAAA;EAAjC;EAGA,SAAA;IAAc,IAAA;IAAc,SAAA;EAAA;EAAA;EAG5B,KAAA;AAAA;AAAK;AAAA,KA4JD,qBAAA,GAAwB,IAAA,CAC5B,MAAA,CAAO,wBAAA;EADkB,kCAKzB,QAAA,EAAU,WAAA,EAJV;EAOA,GAAA,EAAK,MAAA;AAAA;;UAIW,kBAAA;EAJL;EAMX,QAAA,EAAU,MAAA,CAAO,KAAK;AAAA;;;;;;;AANX;AAIZ;;;;;;cAkBa,cAAA,SAAuB,MAAA,CAAO,iBAAA;EAhBpB;EAAA,SAkBN,EAAA,EAAI,MAAA,CAAO,MAAA;EAFf;EAAA,SAKI,UAAA,EAAY,MAAA,CAAO,MAAA;;WAGnB,eAAA,EAAiB,MAAA,CAAO,MAAA,CAAO,kBAAA;cAG9C,IAAA,UACA,IAAA,EAAM,kBAAA,EACN,IAAA,EAAM,qBAAA;AAAA"}
|
|
@@ -19,15 +19,6 @@ interface FlyDnsRequirements {
|
|
|
19
19
|
/** CNAME target for the hostname itself. */
|
|
20
20
|
cname?: string;
|
|
21
21
|
}
|
|
22
|
-
/** Resolved inputs for the Fly certificate dynamic provider. */
|
|
23
|
-
interface FlyCertificateInputs {
|
|
24
|
-
/** Fly API token. */
|
|
25
|
-
token: string;
|
|
26
|
-
/** App name the certificate belongs to. */
|
|
27
|
-
appName: string;
|
|
28
|
-
/** Hostname to issue an ACME certificate for. Used as the resource key. */
|
|
29
|
-
hostname: string;
|
|
30
|
-
}
|
|
31
22
|
/** Options type for FlyCertificate. */
|
|
32
23
|
type FlyCertificateOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
|
|
33
24
|
/** Fly authentication context. */provider: FlyProvider; /** App the certificate belongs to. */
|
|
@@ -61,5 +52,5 @@ declare class FlyCertificate extends pulumi.ComponentResource {
|
|
|
61
52
|
constructor(name: string, args: FlyCertificateArgs, opts: FlyCertificateOptions);
|
|
62
53
|
}
|
|
63
54
|
//#endregion
|
|
64
|
-
export { FlyCertificate, FlyCertificateArgs,
|
|
55
|
+
export { FlyCertificate, FlyCertificateArgs, FlyDnsRequirements };
|
|
65
56
|
//# sourceMappingURL=certificate.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"certificate.d.mts","names":[],"sources":["../../src/fly/certificate.ts"],"mappings":";;;;;;;UAOiB,kBAAA;;EAEhB,cAAA;IAAmB,IAAA;IAAc,MAAA;EAAA;EAAjC;EAGA,SAAA;IAAc,IAAA;IAAc,SAAA;EAAA;EAAA;EAG5B,KAAA;AAAA;AAAK;AAAA,
|
|
1
|
+
{"version":3,"file":"certificate.d.mts","names":[],"sources":["../../src/fly/certificate.ts"],"mappings":";;;;;;;UAOiB,kBAAA;;EAEhB,cAAA;IAAmB,IAAA;IAAc,MAAA;EAAA;EAAjC;EAGA,SAAA;IAAc,IAAA;IAAc,SAAA;EAAA;EAAA;EAG5B,KAAA;AAAA;AAAK;AAAA,KA4JD,qBAAA,GAAwB,IAAA,CAC5B,MAAA,CAAO,wBAAA;EADkB,kCAKzB,QAAA,EAAU,WAAA,EAJV;EAOA,GAAA,EAAK,MAAA;AAAA;;UAIW,kBAAA;EAJL;EAMX,QAAA,EAAU,MAAA,CAAO,KAAK;AAAA;;;;;;;AANX;AAIZ;;;;;;cAkBa,cAAA,SAAuB,MAAA,CAAO,iBAAA;EAhBpB;EAAA,SAkBN,EAAA,EAAI,MAAA,CAAO,MAAA;EAFf;EAAA,SAKI,UAAA,EAAY,MAAA,CAAO,MAAA;;WAGnB,eAAA,EAAiB,MAAA,CAAO,MAAA,CAAO,kBAAA;cAG9C,IAAA,UACA,IAAA,EAAM,kBAAA,EACN,IAAA,EAAM,qBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"certificate.mjs","names":[],"sources":["../../src/fly/certificate.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport type { FlyApp } from \"./app\";\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/** DNS records the consumer must create for certificate validation. */\nexport interface FlyDnsRequirements {\n\t/** ACME challenge CNAME record. */\n\tacme_challenge?: { name: string; target: string };\n\n\t/** `_fly-ownership` TXT record. */\n\townership?: { name: string; app_value: string };\n\n\t/** CNAME target for the hostname itself. */\n\tcname?: string;\n}\n\n/** Resolved inputs for the Fly certificate dynamic provider. */\
|
|
1
|
+
{"version":3,"file":"certificate.mjs","names":[],"sources":["../../src/fly/certificate.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport type { FlyApp } from \"./app\";\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/** DNS records the consumer must create for certificate validation. */\nexport interface FlyDnsRequirements {\n\t/** ACME challenge CNAME record. */\n\tacme_challenge?: { name: string; target: string };\n\n\t/** `_fly-ownership` TXT record. */\n\townership?: { name: string; app_value: string };\n\n\t/** CNAME target for the hostname itself. */\n\tcname?: string;\n}\n\n/** Resolved inputs for the Fly certificate dynamic provider. */\ninterface FlyCertificateInputs {\n\t/** Fly API token. */\n\ttoken: string;\n\n\t/** App name the certificate belongs to. */\n\tappName: string;\n\n\t/** Hostname to issue an ACME certificate for. Used as the resource key. */\n\thostname: string;\n}\n\n/** Persisted state for the Fly certificate. */\ninterface FlyCertificateOutputs extends FlyCertificateInputs {\n\t/** Whether the certificate is fully provisioned (DNS correct). */\n\tconfigured: boolean;\n\n\t/** DNS records required for validation. */\n\tdnsRequirements: FlyDnsRequirements;\n}\n\n/** Certificate response (only the fields we read). */\ninterface FlyCertificateResponse {\n\thostname: string;\n\tconfigured: boolean;\n\tdns_requirements?: FlyDnsRequirements;\n}\n\n/**\n * Dynamic provider for Fly ACME (Let's Encrypt) certificates. `create()` checks\n * for an existing cert by hostname and adopts it, otherwise it requests one via\n * `POST /v1/apps/{app}/certificates/acme`. The Machines API returns no `id` —\n * the hostname is the resource key.\n */\nclass FlyCertificateResourceProvider\n\timplements pulumi.dynamic.ResourceProvider\n{\n\tasync create(\n\t\tinputs: FlyCertificateInputs,\n\t): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new FlyClient(inputs.token);\n\t\tconst path = `/v1/apps/${inputs.appName}/certificates/${encodeURIComponent(inputs.hostname)}`;\n\n\t\tlet cert = await client.tryGet<FlyCertificateResponse>(path);\n\n\t\tif (cert) {\n\t\t\tpulumi.log.info(`Adopting existing Fly certificate \"${inputs.hostname}\"`);\n\t\t} else {\n\t\t\tcert = await client.post<FlyCertificateResponse>(\n\t\t\t\t`/v1/apps/${inputs.appName}/certificates/acme`,\n\t\t\t\t{ hostname: inputs.hostname },\n\t\t\t);\n\t\t}\n\n\t\tconst outs: FlyCertificateOutputs = {\n\t\t\t...inputs,\n\t\t\tconfigured: cert.configured ?? false,\n\t\t\tdnsRequirements: cert.dns_requirements ?? {},\n\t\t};\n\n\t\treturn { id: inputs.hostname, outs };\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: FlyCertificateOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\tconst client = new FlyClient(props.token);\n\n\t\tconst cert = await client.tryGet<FlyCertificateResponse>(\n\t\t\t`/v1/apps/${props.appName}/certificates/${encodeURIComponent(id)}`,\n\t\t);\n\n\t\tif (!cert) {\n\t\t\tthrow new Error(`Fly certificate \"${id}\" not found during refresh`);\n\t\t}\n\n\t\treturn {\n\t\t\tid,\n\t\t\tprops: {\n\t\t\t\t...props,\n\t\t\t\tconfigured: cert.configured ?? false,\n\t\t\t\tdnsRequirements: cert.dns_requirements ?? {},\n\t\t\t},\n\t\t};\n\t}\n\n\tasync update(\n\t\t_id: string,\n\t\t_olds: FlyCertificateOutputs,\n\t\tnews: FlyCertificateInputs,\n\t): Promise<pulumi.dynamic.UpdateResult> {\n\t\t// Hostname/app changes force replacement (see diff); nothing else is updatable.\n\t\treturn {\n\t\t\touts: { ...news, configured: false, dnsRequirements: {} },\n\t\t};\n\t}\n\n\tasync delete(id: string, props: FlyCertificateOutputs): Promise<void> {\n\t\tconst client = new FlyClient(props.token);\n\n\t\tawait client.delete(\n\t\t\t`/v1/apps/${props.appName}/certificates/${encodeURIComponent(id)}`,\n\t\t);\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: FlyCertificateOutputs,\n\t\tnews: FlyCertificateInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.appName !== news.appName) {\n\t\t\treplaces.push(\"appName\");\n\t\t}\n\n\t\tif (olds.hostname !== news.hostname) {\n\t\t\treplaces.push(\"hostname\");\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 FlyCertificateResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly configured: pulumi.Output<boolean>;\n\tpublic declare readonly dnsRequirements: pulumi.Output<FlyDnsRequirements>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\ttoken: pulumi.Input<string>;\n\t\t\tappName: pulumi.Input<string>;\n\t\t\thostname: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew FlyCertificateResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, configured: undefined, dnsRequirements: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for FlyCertificate. */\ntype FlyCertificateOptions = Omit<\n\tpulumi.ComponentResourceOptions,\n\t\"provider\"\n> & {\n\t/** Fly authentication context. */\n\tprovider: FlyProvider;\n\n\t/** App the certificate belongs to. */\n\tapp: FlyApp;\n};\n\n/** Args for FlyCertificate. */\nexport interface FlyCertificateArgs {\n\t/** Hostname to issue an ACME certificate for (e.g. `\"api.example.com\"`). */\n\thostname: pulumi.Input<string>;\n}\n\n/**\n * Manages a Fly ACME certificate for a custom hostname.\n *\n * Exposes `.configured` and `.dnsRequirements` so the consumer can wire up the\n * required DNS records.\n *\n * @example\n * ```typescript\n * const cert = new FlyCertificate(\"api-cert\", {\n * hostname: \"api.example.com\",\n * }, { provider, app });\n * ```\n */\nexport class FlyCertificate extends pulumi.ComponentResource {\n\t/** Certificate identifier (equals the hostname). */\n\tpublic readonly id: pulumi.Output<string>;\n\n\t/** Whether the certificate is fully provisioned. */\n\tpublic readonly configured: pulumi.Output<boolean>;\n\n\t/** DNS records required for validation. */\n\tpublic readonly dnsRequirements: pulumi.Output<FlyDnsRequirements>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: FlyCertificateArgs,\n\t\topts: FlyCertificateOptions,\n\t) {\n\t\tconst { provider, app, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:Certificate\", name, {}, pulumiOpts);\n\n\t\tconst resource = new FlyCertificateResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\ttoken: provider.token,\n\t\t\t\tappName: app.id,\n\t\t\t\thostname: args.hostname,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.id = pulumi.output(args.hostname);\n\t\tthis.configured = resource.configured;\n\t\tthis.dnsRequirements = resource.dnsRequirements;\n\n\t\tthis.registerOutputs({\n\t\t\tid: this.id,\n\t\t\tconfigured: this.configured,\n\t\t\tdnsRequirements: this.dnsRequirements,\n\t\t});\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAoDA,IAAM,iCAAN,MAEA;CACC,MAAM,OACL,QACuC;EACvC,MAAM,SAAS,IAAI,UAAU,OAAO,KAAK;EACzC,MAAM,OAAO,YAAY,OAAO,QAAQ,gBAAgB,mBAAmB,OAAO,QAAQ;EAE1F,IAAI,OAAO,MAAM,OAA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;GAAE,GAAG;GAAM,YAAY;GAAW,iBAAiB;EAAU,GAC7D,IACD;CACD;AACD;;;;;;;;;;;;;;AAiCA,IAAa,iBAAb,cAAoC,OAAO,kBAAkB;CAU5D,YACC,MACA,MACA,MACC;EACD,MAAM,EAAE,UAAU,KAAK,GAAG,eAAe;EAEzC,MAAM,8BAA8B,MAAM,CAAC,GAAG,UAAU;EAExD,MAAM,WAAW,IAAI,uBACpB,GAAG,KAAK,YACR;GACC,OAAO,SAAS;GAChB,SAAS,IAAI;GACb,UAAU,KAAK;EAChB,GACA,EAAE,QAAQ,KAAK,CAChB;EAEA,KAAK,KAAK,OAAO,OAAO,KAAK,QAAQ;EACrC,KAAK,aAAa,SAAS;EAC3B,KAAK,kBAAkB,SAAS;EAEhC,KAAK,gBAAgB;GACpB,IAAI,KAAK;GACT,YAAY,KAAK;GACjB,iBAAiB,KAAK;EACvB,CAAC;CACF;AACD"}
|
package/dist/fly/index.d.cts
CHANGED
|
@@ -2,9 +2,9 @@ import { FlyProvider, FlyProviderArgs } from "./provider.cjs";
|
|
|
2
2
|
import { FlyApp, FlyAppArgs } from "./app.cjs";
|
|
3
3
|
import { FlyCertificate, FlyCertificateArgs, FlyDnsRequirements } from "./certificate.cjs";
|
|
4
4
|
import { FlyClient } from "./client.cjs";
|
|
5
|
-
import { FLY_REGIONS, FLY_VM_SIZES, FlyAutoStopMachines, FlyBuildConfig, FlyCheck, FlyCheckType, FlyConcurrency, FlyConcurrencyType, FlyCpuKind, FlyDeployConfig, FlyDeployStrategy, FlyHttpService, FlyMount, FlyPortHandler, FlyRegion, FlyRestartConfig, FlyRestartPolicy, FlyService, FlyServicePort, FlyServiceProtocol, FlyTomlConfig, FlyVm, FlyVmSize, generateFlyToml } from "./toml.cjs";
|
|
5
|
+
import { FLY_REGIONS, FLY_VM_SIZES, FlyAutoStopMachines, FlyBuildConfig, FlyCheck, FlyCheckType, FlyConcurrency, FlyConcurrencyType, FlyCpuCount, FlyCpuKind, FlyDeployConfig, FlyDeployStrategy, FlyHttpService, FlyMount, FlyPortHandler, FlyRegion, FlyRestartConfig, FlyRestartPolicy, FlyService, FlyServicePort, FlyServiceProtocol, FlyTomlConfig, FlyVm, FlyVmSize, generateFlyToml } from "./toml.cjs";
|
|
6
6
|
import { FlyDeploy, FlyDeployArgs } from "./deploy.cjs";
|
|
7
7
|
import { FlyIp, FlyIpArgs, FlyIpType } from "./ip.cjs";
|
|
8
8
|
import { FlySecret, FlySecretArgs } from "./secret.cjs";
|
|
9
9
|
import { FlyVolume, FlyVolumeArgs } from "./volume.cjs";
|
|
10
|
-
export { FLY_REGIONS, FLY_VM_SIZES, FlyApp, type FlyAppArgs, FlyAutoStopMachines, type FlyBuildConfig, FlyCertificate, type FlyCertificateArgs, type FlyCheck, FlyCheckType, FlyClient, type FlyConcurrency, FlyConcurrencyType, FlyCpuKind, FlyDeploy, type FlyDeployArgs, type FlyDeployConfig, FlyDeployStrategy, type FlyDnsRequirements, type FlyHttpService, FlyIp, type FlyIpArgs, FlyIpType, type FlyMount, FlyPortHandler, FlyProvider, type FlyProviderArgs, type FlyRegion, type FlyRestartConfig, FlyRestartPolicy, FlySecret, type FlySecretArgs, type FlyService, type FlyServicePort, FlyServiceProtocol, type FlyTomlConfig, type FlyVm, type FlyVmSize, FlyVolume, type FlyVolumeArgs, generateFlyToml };
|
|
10
|
+
export { FLY_REGIONS, FLY_VM_SIZES, FlyApp, type FlyAppArgs, FlyAutoStopMachines, type FlyBuildConfig, FlyCertificate, type FlyCertificateArgs, type FlyCheck, FlyCheckType, FlyClient, type FlyConcurrency, FlyConcurrencyType, type FlyCpuCount, FlyCpuKind, FlyDeploy, type FlyDeployArgs, type FlyDeployConfig, FlyDeployStrategy, type FlyDnsRequirements, type FlyHttpService, FlyIp, type FlyIpArgs, FlyIpType, type FlyMount, FlyPortHandler, FlyProvider, type FlyProviderArgs, type FlyRegion, type FlyRestartConfig, FlyRestartPolicy, FlySecret, type FlySecretArgs, type FlyService, type FlyServicePort, FlyServiceProtocol, type FlyTomlConfig, type FlyVm, type FlyVmSize, FlyVolume, type FlyVolumeArgs, generateFlyToml };
|
package/dist/fly/index.d.mts
CHANGED
|
@@ -2,9 +2,9 @@ import { FlyProvider, FlyProviderArgs } from "./provider.mjs";
|
|
|
2
2
|
import { FlyApp, FlyAppArgs } from "./app.mjs";
|
|
3
3
|
import { FlyCertificate, FlyCertificateArgs, FlyDnsRequirements } from "./certificate.mjs";
|
|
4
4
|
import { FlyClient } from "./client.mjs";
|
|
5
|
-
import { FLY_REGIONS, FLY_VM_SIZES, FlyAutoStopMachines, FlyBuildConfig, FlyCheck, FlyCheckType, FlyConcurrency, FlyConcurrencyType, FlyCpuKind, FlyDeployConfig, FlyDeployStrategy, FlyHttpService, FlyMount, FlyPortHandler, FlyRegion, FlyRestartConfig, FlyRestartPolicy, FlyService, FlyServicePort, FlyServiceProtocol, FlyTomlConfig, FlyVm, FlyVmSize, generateFlyToml } from "./toml.mjs";
|
|
5
|
+
import { FLY_REGIONS, FLY_VM_SIZES, FlyAutoStopMachines, FlyBuildConfig, FlyCheck, FlyCheckType, FlyConcurrency, FlyConcurrencyType, FlyCpuCount, FlyCpuKind, FlyDeployConfig, FlyDeployStrategy, FlyHttpService, FlyMount, FlyPortHandler, FlyRegion, FlyRestartConfig, FlyRestartPolicy, FlyService, FlyServicePort, FlyServiceProtocol, FlyTomlConfig, FlyVm, FlyVmSize, generateFlyToml } from "./toml.mjs";
|
|
6
6
|
import { FlyDeploy, FlyDeployArgs } from "./deploy.mjs";
|
|
7
7
|
import { FlyIp, FlyIpArgs, FlyIpType } from "./ip.mjs";
|
|
8
8
|
import { FlySecret, FlySecretArgs } from "./secret.mjs";
|
|
9
9
|
import { FlyVolume, FlyVolumeArgs } from "./volume.mjs";
|
|
10
|
-
export { FLY_REGIONS, FLY_VM_SIZES, FlyApp, type FlyAppArgs, FlyAutoStopMachines, type FlyBuildConfig, FlyCertificate, type FlyCertificateArgs, type FlyCheck, FlyCheckType, FlyClient, type FlyConcurrency, FlyConcurrencyType, FlyCpuKind, FlyDeploy, type FlyDeployArgs, type FlyDeployConfig, FlyDeployStrategy, type FlyDnsRequirements, type FlyHttpService, FlyIp, type FlyIpArgs, FlyIpType, type FlyMount, FlyPortHandler, FlyProvider, type FlyProviderArgs, type FlyRegion, type FlyRestartConfig, FlyRestartPolicy, FlySecret, type FlySecretArgs, type FlyService, type FlyServicePort, FlyServiceProtocol, type FlyTomlConfig, type FlyVm, type FlyVmSize, FlyVolume, type FlyVolumeArgs, generateFlyToml };
|
|
10
|
+
export { FLY_REGIONS, FLY_VM_SIZES, FlyApp, type FlyAppArgs, FlyAutoStopMachines, type FlyBuildConfig, FlyCertificate, type FlyCertificateArgs, type FlyCheck, FlyCheckType, FlyClient, type FlyConcurrency, FlyConcurrencyType, type FlyCpuCount, FlyCpuKind, FlyDeploy, type FlyDeployArgs, type FlyDeployConfig, FlyDeployStrategy, type FlyDnsRequirements, type FlyHttpService, FlyIp, type FlyIpArgs, FlyIpType, type FlyMount, FlyPortHandler, FlyProvider, type FlyProviderArgs, type FlyRegion, type FlyRestartConfig, FlyRestartPolicy, FlySecret, type FlySecretArgs, type FlyService, type FlyServicePort, FlyServiceProtocol, type FlyTomlConfig, type FlyVm, type FlyVmSize, FlyVolume, type FlyVolumeArgs, generateFlyToml };
|
package/dist/fly/ip.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ip.cjs","names":["FlyClient","pulumi"],"sources":["../../src/fly/ip.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport type { FlyApp } from \"./app\";\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/**\n * Fly IP address type. Enum keys UPPERCASE; values are Fly's GraphQL enum\n * literals (lowercase wire format).\n */\nexport enum FlyIpType {\n\tV4 = \"v4\",\n\tV6 = \"v6\",\n\tSHARED_V4 = \"shared_v4\",\n\tPRIVATE_V6 = \"private_v6\",\n}\n\n/** Resolved inputs for the Fly IP dynamic provider. */\
|
|
1
|
+
{"version":3,"file":"ip.cjs","names":["FlyClient","pulumi"],"sources":["../../src/fly/ip.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport type { FlyApp } from \"./app\";\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/**\n * Fly IP address type. Enum keys UPPERCASE; values are Fly's GraphQL enum\n * literals (lowercase wire format).\n */\nexport enum FlyIpType {\n\tV4 = \"v4\",\n\tV6 = \"v6\",\n\tSHARED_V4 = \"shared_v4\",\n\tPRIVATE_V6 = \"private_v6\",\n}\n\n/** Resolved inputs for the Fly IP dynamic provider. */\ninterface FlyIpInputs {\n\t/** Fly API token. */\n\ttoken: string;\n\n\t/** App name (used as GraphQL appId). */\n\tappName: string;\n\n\t/** IP address type. */\n\ttype: FlyIpType;\n\n\t/** Region (IATA code); omit for global. */\n\tregion?: string;\n}\n\n/** Persisted state for the Fly IP. */\ninterface FlyIpOutputs extends FlyIpInputs {\n\t/** Allocated IP address (also the `.id`). */\n\taddress: string;\n\n\t/** GraphQL node ID, when present (absent for `shared_v4`). */\n\tipAddressId?: string;\n}\n\nconst LIST_IPS = `\n\tquery ($appName: String!) {\n\t\tapp(name: $appName) {\n\t\t\tsharedIpAddress\n\t\t\tipAddresses {\n\t\t\t\tnodes { id address type region }\n\t\t\t}\n\t\t}\n\t}\n`;\n\nconst ALLOCATE_IP = `\n\tmutation ($input: AllocateIPAddressInput!) {\n\t\tallocateIpAddress(input: $input) {\n\t\t\tipAddress { id address type region }\n\t\t\tapp { sharedIpAddress }\n\t\t}\n\t}\n`;\n\nconst RELEASE_IP = `\n\tmutation ($input: ReleaseIPAddressInput!) {\n\t\treleaseIpAddress(input: $input) { clientMutationId }\n\t}\n`;\n\ninterface IpNode {\n\tid: string;\n\taddress: string;\n\ttype: string;\n\tregion: string | null;\n}\n\ninterface ListIpsResult {\n\tapp: {\n\t\tsharedIpAddress: string | null;\n\t\tipAddresses: { nodes: IpNode[] };\n\t};\n}\n\ninterface AllocateResult {\n\tallocateIpAddress: {\n\t\tipAddress: IpNode | null;\n\t\tapp: { sharedIpAddress: string | null };\n\t};\n}\n\n/**\n * Dynamic provider for Fly dedicated/shared IP allocation via the Fly GraphQL\n * API. `create()` queries existing IPs and adopts a matching one, otherwise it\n * allocates. `shared_v4` allocations return a null `ipAddress` in the payload —\n * the address is read from `app.sharedIpAddress`.\n */\nclass FlyIpResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(inputs: FlyIpInputs): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new FlyClient(inputs.token);\n\n\t\tconst existing = await this.findExisting(client, inputs);\n\n\t\tif (existing) {\n\t\t\tpulumi.log.info(\n\t\t\t\t`Adopting existing Fly ${inputs.type} IP \"${existing.address}\"`,\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tid: existing.address,\n\t\t\t\touts: {\n\t\t\t\t\t...inputs,\n\t\t\t\t\taddress: existing.address,\n\t\t\t\t\tipAddressId: existing.ipAddressId,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst result = await client.graphql<AllocateResult>(ALLOCATE_IP, {\n\t\t\tinput: {\n\t\t\t\tappId: inputs.appName,\n\t\t\t\ttype: inputs.type,\n\t\t\t\tregion: inputs.region,\n\t\t\t},\n\t\t});\n\n\t\tconst node = result.allocateIpAddress.ipAddress;\n\n\t\tconst address =\n\t\t\tinputs.type === FlyIpType.SHARED_V4\n\t\t\t\t? (result.allocateIpAddress.app.sharedIpAddress ?? \"\")\n\t\t\t\t: (node?.address ?? \"\");\n\n\t\tif (!address) {\n\t\t\tthrow new Error(\n\t\t\t\t`Fly IP allocation for app \"${inputs.appName}\" (${inputs.type}) returned no address`,\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tid: address,\n\t\t\touts: { ...inputs, address, ipAddressId: node?.id },\n\t\t};\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: FlyIpOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\treturn { id, props };\n\t}\n\n\tasync delete(_id: string, props: FlyIpOutputs): Promise<void> {\n\t\tconst client = new FlyClient(props.token);\n\n\t\tconst input: Record<string, string> = { appId: props.appName };\n\n\t\tif (props.ipAddressId) {\n\t\t\tinput.ipAddressId = props.ipAddressId;\n\t\t} else {\n\t\t\tinput.ip = props.address;\n\t\t}\n\n\t\tawait client.graphql(RELEASE_IP, { input });\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: FlyIpOutputs,\n\t\tnews: FlyIpInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.appName !== news.appName) {\n\t\t\treplaces.push(\"appName\");\n\t\t}\n\n\t\tif (olds.type !== news.type) {\n\t\t\treplaces.push(\"type\");\n\t\t}\n\n\t\tif (olds.region !== news.region) {\n\t\t\treplaces.push(\"region\");\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\tprivate async findExisting(\n\t\tclient: FlyClient,\n\t\tinputs: FlyIpInputs,\n\t): Promise<{ address: string; ipAddressId?: string } | null> {\n\t\tconst result = await client.graphql<ListIpsResult>(LIST_IPS, {\n\t\t\tappName: inputs.appName,\n\t\t});\n\n\t\tif (inputs.type === FlyIpType.SHARED_V4) {\n\t\t\tconst shared = result.app.sharedIpAddress;\n\n\t\t\treturn shared ? { address: shared } : null;\n\t\t}\n\n\t\tconst match = result.app.ipAddresses.nodes.find(\n\t\t\t(node) =>\n\t\t\t\tnode.type === inputs.type &&\n\t\t\t\t(inputs.region === undefined || node.region === inputs.region),\n\t\t);\n\n\t\treturn match ? { address: match.address, ipAddressId: match.id } : null;\n\t}\n}\n\n/** Internal dynamic resource — not part of the public API. */\nclass FlyIpResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly address: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\ttoken: pulumi.Input<string>;\n\t\t\tappName: pulumi.Input<string>;\n\t\t\ttype: pulumi.Input<FlyIpType>;\n\t\t\tregion?: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew FlyIpResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, address: undefined, ipAddressId: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for FlyIp. */\ntype FlyIpOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\t/** Fly authentication context. */\n\tprovider: FlyProvider;\n\n\t/** App the IP belongs to. */\n\tapp: FlyApp;\n};\n\n/** Args for FlyIp. */\nexport interface FlyIpArgs {\n\t/** IP address type. */\n\ttype: pulumi.Input<FlyIpType>;\n\n\t/** Region (IATA code); omit for a global address. */\n\tregion?: pulumi.Input<string>;\n}\n\n/**\n * Allocates a Fly IP address (dedicated or shared) via the Fly GraphQL API.\n *\n * @example\n * ```typescript\n * const ip = new FlyIp(\"api-ip\", { type: FlyIpType.SHARED_V4 }, { provider, app });\n * ```\n */\nexport class FlyIp extends pulumi.ComponentResource {\n\t/** Allocated IP address. */\n\tpublic readonly id: pulumi.Output<string>;\n\n\tconstructor(name: string, args: FlyIpArgs, opts: FlyIpOptions) {\n\t\tconst { provider, app, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:Ip\", name, {}, pulumiOpts);\n\n\t\tconst resource = new FlyIpResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\ttoken: provider.token,\n\t\t\t\tappName: app.id,\n\t\t\t\ttype: args.type,\n\t\t\t\tregion: args.region,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.id = resource.address;\n\n\t\tthis.registerOutputs({ id: this.id });\n\t}\n}\n"],"mappings":";;;;;;;;;;;AAUA,IAAY,YAAL;CACN;CACA;CACA;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d.cts
CHANGED
|
@@ -14,17 +14,6 @@ declare enum FlyIpType {
|
|
|
14
14
|
SHARED_V4 = "shared_v4",
|
|
15
15
|
PRIVATE_V6 = "private_v6"
|
|
16
16
|
}
|
|
17
|
-
/** Resolved inputs for the Fly IP dynamic provider. */
|
|
18
|
-
interface FlyIpInputs {
|
|
19
|
-
/** Fly API token. */
|
|
20
|
-
token: string;
|
|
21
|
-
/** App name (used as GraphQL appId). */
|
|
22
|
-
appName: string;
|
|
23
|
-
/** IP address type. */
|
|
24
|
-
type: FlyIpType;
|
|
25
|
-
/** Region (IATA code); omit for global. */
|
|
26
|
-
region?: string;
|
|
27
|
-
}
|
|
28
17
|
/** Options type for FlyIp. */
|
|
29
18
|
type FlyIpOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
|
|
30
19
|
/** Fly authentication context. */provider: FlyProvider; /** App the IP belongs to. */
|
|
@@ -51,5 +40,5 @@ declare class FlyIp extends pulumi.ComponentResource {
|
|
|
51
40
|
constructor(name: string, args: FlyIpArgs, opts: FlyIpOptions);
|
|
52
41
|
}
|
|
53
42
|
//#endregion
|
|
54
|
-
export { FlyIp, FlyIpArgs,
|
|
43
|
+
export { FlyIp, FlyIpArgs, FlyIpType };
|
|
55
44
|
//# sourceMappingURL=ip.d.cts.map
|
package/dist/fly/ip.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ip.d.cts","names":[],"sources":["../../src/fly/ip.ts"],"mappings":";;;;;;;;;AAUA;aAAY,SAAA;EACX,EAAA;EACA,EAAA;EACA,SAAA;EACA,UAAA;AAAA;;
|
|
1
|
+
{"version":3,"file":"ip.d.cts","names":[],"sources":["../../src/fly/ip.ts"],"mappings":";;;;;;;;;AAUA;aAAY,SAAA;EACX,EAAA;EACA,EAAA;EACA,SAAA;EACA,UAAA;AAAA;;KA+NI,YAAA,GAAe,IAAA,CAAK,MAAA,CAAO,wBAAA;EA/NrB,kCAiOV,QAAA,EAAU,WAAA,EAFM;EAKhB,GAAA,EAAK,MAAA;AAAA;;UAIW,SAAA;EAJX;EAML,IAAA,EAAM,MAAA,CAAO,KAAA,CAAM,SAAA;EANR;EASX,MAAA,GAAS,MAAA,CAAO,KAAA;AAAA;;;;;;;AATL;AAIZ;cAgBa,KAAA,SAAc,MAAA,CAAO,iBAAA;;WAEjB,EAAA,EAAI,MAAA,CAAO,MAAA;cAEf,IAAA,UAAc,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,YAAA;AAAA"}
|
package/dist/fly/ip.d.mts
CHANGED
|
@@ -14,17 +14,6 @@ declare enum FlyIpType {
|
|
|
14
14
|
SHARED_V4 = "shared_v4",
|
|
15
15
|
PRIVATE_V6 = "private_v6"
|
|
16
16
|
}
|
|
17
|
-
/** Resolved inputs for the Fly IP dynamic provider. */
|
|
18
|
-
interface FlyIpInputs {
|
|
19
|
-
/** Fly API token. */
|
|
20
|
-
token: string;
|
|
21
|
-
/** App name (used as GraphQL appId). */
|
|
22
|
-
appName: string;
|
|
23
|
-
/** IP address type. */
|
|
24
|
-
type: FlyIpType;
|
|
25
|
-
/** Region (IATA code); omit for global. */
|
|
26
|
-
region?: string;
|
|
27
|
-
}
|
|
28
17
|
/** Options type for FlyIp. */
|
|
29
18
|
type FlyIpOptions = Omit<pulumi.ComponentResourceOptions, "provider"> & {
|
|
30
19
|
/** Fly authentication context. */provider: FlyProvider; /** App the IP belongs to. */
|
|
@@ -51,5 +40,5 @@ declare class FlyIp extends pulumi.ComponentResource {
|
|
|
51
40
|
constructor(name: string, args: FlyIpArgs, opts: FlyIpOptions);
|
|
52
41
|
}
|
|
53
42
|
//#endregion
|
|
54
|
-
export { FlyIp, FlyIpArgs,
|
|
43
|
+
export { FlyIp, FlyIpArgs, FlyIpType };
|
|
55
44
|
//# sourceMappingURL=ip.d.mts.map
|
package/dist/fly/ip.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ip.d.mts","names":[],"sources":["../../src/fly/ip.ts"],"mappings":";;;;;;;;;AAUA;aAAY,SAAA;EACX,EAAA;EACA,EAAA;EACA,SAAA;EACA,UAAA;AAAA;;
|
|
1
|
+
{"version":3,"file":"ip.d.mts","names":[],"sources":["../../src/fly/ip.ts"],"mappings":";;;;;;;;;AAUA;aAAY,SAAA;EACX,EAAA;EACA,EAAA;EACA,SAAA;EACA,UAAA;AAAA;;KA+NI,YAAA,GAAe,IAAA,CAAK,MAAA,CAAO,wBAAA;EA/NrB,kCAiOV,QAAA,EAAU,WAAA,EAFM;EAKhB,GAAA,EAAK,MAAA;AAAA;;UAIW,SAAA;EAJX;EAML,IAAA,EAAM,MAAA,CAAO,KAAA,CAAM,SAAA;EANR;EASX,MAAA,GAAS,MAAA,CAAO,KAAA;AAAA;;;;;;;AATL;AAIZ;cAgBa,KAAA,SAAc,MAAA,CAAO,iBAAA;;WAEjB,EAAA,EAAI,MAAA,CAAO,MAAA;cAEf,IAAA,UAAc,IAAA,EAAM,SAAA,EAAW,IAAA,EAAM,YAAA;AAAA"}
|
package/dist/fly/ip.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ip.mjs","names":[],"sources":["../../src/fly/ip.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport type { FlyApp } from \"./app\";\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/**\n * Fly IP address type. Enum keys UPPERCASE; values are Fly's GraphQL enum\n * literals (lowercase wire format).\n */\nexport enum FlyIpType {\n\tV4 = \"v4\",\n\tV6 = \"v6\",\n\tSHARED_V4 = \"shared_v4\",\n\tPRIVATE_V6 = \"private_v6\",\n}\n\n/** Resolved inputs for the Fly IP dynamic provider. */\
|
|
1
|
+
{"version":3,"file":"ip.mjs","names":[],"sources":["../../src/fly/ip.ts"],"sourcesContent":["import * as pulumi from \"@pulumi/pulumi\";\n\nimport type { FlyApp } from \"./app\";\nimport { FlyClient } from \"./client\";\nimport type { FlyProvider } from \"./provider\";\n\n/**\n * Fly IP address type. Enum keys UPPERCASE; values are Fly's GraphQL enum\n * literals (lowercase wire format).\n */\nexport enum FlyIpType {\n\tV4 = \"v4\",\n\tV6 = \"v6\",\n\tSHARED_V4 = \"shared_v4\",\n\tPRIVATE_V6 = \"private_v6\",\n}\n\n/** Resolved inputs for the Fly IP dynamic provider. */\ninterface FlyIpInputs {\n\t/** Fly API token. */\n\ttoken: string;\n\n\t/** App name (used as GraphQL appId). */\n\tappName: string;\n\n\t/** IP address type. */\n\ttype: FlyIpType;\n\n\t/** Region (IATA code); omit for global. */\n\tregion?: string;\n}\n\n/** Persisted state for the Fly IP. */\ninterface FlyIpOutputs extends FlyIpInputs {\n\t/** Allocated IP address (also the `.id`). */\n\taddress: string;\n\n\t/** GraphQL node ID, when present (absent for `shared_v4`). */\n\tipAddressId?: string;\n}\n\nconst LIST_IPS = `\n\tquery ($appName: String!) {\n\t\tapp(name: $appName) {\n\t\t\tsharedIpAddress\n\t\t\tipAddresses {\n\t\t\t\tnodes { id address type region }\n\t\t\t}\n\t\t}\n\t}\n`;\n\nconst ALLOCATE_IP = `\n\tmutation ($input: AllocateIPAddressInput!) {\n\t\tallocateIpAddress(input: $input) {\n\t\t\tipAddress { id address type region }\n\t\t\tapp { sharedIpAddress }\n\t\t}\n\t}\n`;\n\nconst RELEASE_IP = `\n\tmutation ($input: ReleaseIPAddressInput!) {\n\t\treleaseIpAddress(input: $input) { clientMutationId }\n\t}\n`;\n\ninterface IpNode {\n\tid: string;\n\taddress: string;\n\ttype: string;\n\tregion: string | null;\n}\n\ninterface ListIpsResult {\n\tapp: {\n\t\tsharedIpAddress: string | null;\n\t\tipAddresses: { nodes: IpNode[] };\n\t};\n}\n\ninterface AllocateResult {\n\tallocateIpAddress: {\n\t\tipAddress: IpNode | null;\n\t\tapp: { sharedIpAddress: string | null };\n\t};\n}\n\n/**\n * Dynamic provider for Fly dedicated/shared IP allocation via the Fly GraphQL\n * API. `create()` queries existing IPs and adopts a matching one, otherwise it\n * allocates. `shared_v4` allocations return a null `ipAddress` in the payload —\n * the address is read from `app.sharedIpAddress`.\n */\nclass FlyIpResourceProvider implements pulumi.dynamic.ResourceProvider {\n\tasync create(inputs: FlyIpInputs): Promise<pulumi.dynamic.CreateResult> {\n\t\tconst client = new FlyClient(inputs.token);\n\n\t\tconst existing = await this.findExisting(client, inputs);\n\n\t\tif (existing) {\n\t\t\tpulumi.log.info(\n\t\t\t\t`Adopting existing Fly ${inputs.type} IP \"${existing.address}\"`,\n\t\t\t);\n\n\t\t\treturn {\n\t\t\t\tid: existing.address,\n\t\t\t\touts: {\n\t\t\t\t\t...inputs,\n\t\t\t\t\taddress: existing.address,\n\t\t\t\t\tipAddressId: existing.ipAddressId,\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst result = await client.graphql<AllocateResult>(ALLOCATE_IP, {\n\t\t\tinput: {\n\t\t\t\tappId: inputs.appName,\n\t\t\t\ttype: inputs.type,\n\t\t\t\tregion: inputs.region,\n\t\t\t},\n\t\t});\n\n\t\tconst node = result.allocateIpAddress.ipAddress;\n\n\t\tconst address =\n\t\t\tinputs.type === FlyIpType.SHARED_V4\n\t\t\t\t? (result.allocateIpAddress.app.sharedIpAddress ?? \"\")\n\t\t\t\t: (node?.address ?? \"\");\n\n\t\tif (!address) {\n\t\t\tthrow new Error(\n\t\t\t\t`Fly IP allocation for app \"${inputs.appName}\" (${inputs.type}) returned no address`,\n\t\t\t);\n\t\t}\n\n\t\treturn {\n\t\t\tid: address,\n\t\t\touts: { ...inputs, address, ipAddressId: node?.id },\n\t\t};\n\t}\n\n\tasync read(\n\t\tid: string,\n\t\tprops: FlyIpOutputs,\n\t): Promise<pulumi.dynamic.ReadResult> {\n\t\treturn { id, props };\n\t}\n\n\tasync delete(_id: string, props: FlyIpOutputs): Promise<void> {\n\t\tconst client = new FlyClient(props.token);\n\n\t\tconst input: Record<string, string> = { appId: props.appName };\n\n\t\tif (props.ipAddressId) {\n\t\t\tinput.ipAddressId = props.ipAddressId;\n\t\t} else {\n\t\t\tinput.ip = props.address;\n\t\t}\n\n\t\tawait client.graphql(RELEASE_IP, { input });\n\t}\n\n\tasync diff(\n\t\t_id: string,\n\t\tolds: FlyIpOutputs,\n\t\tnews: FlyIpInputs,\n\t): Promise<pulumi.dynamic.DiffResult> {\n\t\tconst replaces: string[] = [];\n\n\t\tif (olds.appName !== news.appName) {\n\t\t\treplaces.push(\"appName\");\n\t\t}\n\n\t\tif (olds.type !== news.type) {\n\t\t\treplaces.push(\"type\");\n\t\t}\n\n\t\tif (olds.region !== news.region) {\n\t\t\treplaces.push(\"region\");\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\tprivate async findExisting(\n\t\tclient: FlyClient,\n\t\tinputs: FlyIpInputs,\n\t): Promise<{ address: string; ipAddressId?: string } | null> {\n\t\tconst result = await client.graphql<ListIpsResult>(LIST_IPS, {\n\t\t\tappName: inputs.appName,\n\t\t});\n\n\t\tif (inputs.type === FlyIpType.SHARED_V4) {\n\t\t\tconst shared = result.app.sharedIpAddress;\n\n\t\t\treturn shared ? { address: shared } : null;\n\t\t}\n\n\t\tconst match = result.app.ipAddresses.nodes.find(\n\t\t\t(node) =>\n\t\t\t\tnode.type === inputs.type &&\n\t\t\t\t(inputs.region === undefined || node.region === inputs.region),\n\t\t);\n\n\t\treturn match ? { address: match.address, ipAddressId: match.id } : null;\n\t}\n}\n\n/** Internal dynamic resource — not part of the public API. */\nclass FlyIpResource extends pulumi.dynamic.Resource {\n\tpublic declare readonly address: pulumi.Output<string>;\n\n\tconstructor(\n\t\tname: string,\n\t\targs: {\n\t\t\ttoken: pulumi.Input<string>;\n\t\t\tappName: pulumi.Input<string>;\n\t\t\ttype: pulumi.Input<FlyIpType>;\n\t\t\tregion?: pulumi.Input<string>;\n\t\t},\n\t\topts?: pulumi.CustomResourceOptions,\n\t) {\n\t\tsuper(\n\t\t\tnew FlyIpResourceProvider(),\n\t\t\tname,\n\t\t\t{ ...args, address: undefined, ipAddressId: undefined },\n\t\t\topts,\n\t\t);\n\t}\n}\n\n/** Options type for FlyIp. */\ntype FlyIpOptions = Omit<pulumi.ComponentResourceOptions, \"provider\"> & {\n\t/** Fly authentication context. */\n\tprovider: FlyProvider;\n\n\t/** App the IP belongs to. */\n\tapp: FlyApp;\n};\n\n/** Args for FlyIp. */\nexport interface FlyIpArgs {\n\t/** IP address type. */\n\ttype: pulumi.Input<FlyIpType>;\n\n\t/** Region (IATA code); omit for a global address. */\n\tregion?: pulumi.Input<string>;\n}\n\n/**\n * Allocates a Fly IP address (dedicated or shared) via the Fly GraphQL API.\n *\n * @example\n * ```typescript\n * const ip = new FlyIp(\"api-ip\", { type: FlyIpType.SHARED_V4 }, { provider, app });\n * ```\n */\nexport class FlyIp extends pulumi.ComponentResource {\n\t/** Allocated IP address. */\n\tpublic readonly id: pulumi.Output<string>;\n\n\tconstructor(name: string, args: FlyIpArgs, opts: FlyIpOptions) {\n\t\tconst { provider, app, ...pulumiOpts } = opts;\n\n\t\tsuper(\"infracraft:fly:Ip\", name, {}, pulumiOpts);\n\n\t\tconst resource = new FlyIpResource(\n\t\t\t`${name}-resource`,\n\t\t\t{\n\t\t\t\ttoken: provider.token,\n\t\t\t\tappName: app.id,\n\t\t\t\ttype: args.type,\n\t\t\t\tregion: args.region,\n\t\t\t},\n\t\t\t{ parent: this },\n\t\t);\n\n\t\tthis.id = resource.address;\n\n\t\tthis.registerOutputs({ id: this.id });\n\t}\n}\n"],"mappings":";;;;;;;;;AAUA,IAAY,YAAL;CACN;CACA;CACA;CACA;;AACD;AA0BA,MAAM,WAAW;;;;;;;;;;AAWjB,MAAM,cAAc;;;;;;;;AASpB,MAAM,aAAa;;;;;;;;;;;AAiCnB,IAAM,wBAAN,MAAuE;CACtE,MAAM,OAAO,QAA2D;EACvE,MAAM,SAAS,IAAI,UAAU,OAAO,KAAK;EAEzC,M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