@geekmidas/cli 10.0.0-alpha.79 → 10.0.0-alpha.80
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/{add-UFiIrlTj.mjs → add-CIxT-Iq6.mjs} +2 -2
- package/dist/{add-UFiIrlTj.mjs.map → add-CIxT-Iq6.mjs.map} +1 -1
- package/dist/{add-HF9POevk.cjs → add-DJ0VE-y-.cjs} +2 -2
- package/dist/{add-HF9POevk.cjs.map → add-DJ0VE-y-.cjs.map} +1 -1
- package/dist/{aws-Bja4zGSs.mjs → aws-B-6uEhgP.mjs} +8 -2
- package/dist/{aws-Bja4zGSs.mjs.map → aws-B-6uEhgP.mjs.map} +1 -1
- package/dist/{aws-CQAuluiu.cjs → aws-BTawF0F-.cjs} +19 -2
- package/dist/{aws-CQAuluiu.cjs.map → aws-BTawF0F-.cjs.map} +1 -1
- package/dist/{bundler-RAoSRuvp.cjs → bundler-BlbSLFLn.cjs} +3 -3
- package/dist/{bundler-RAoSRuvp.cjs.map → bundler-BlbSLFLn.cjs.map} +1 -1
- package/dist/{bundler-C45BuRdY.mjs → bundler-D4pl87A5.mjs} +3 -3
- package/dist/{bundler-C45BuRdY.mjs.map → bundler-D4pl87A5.mjs.map} +1 -1
- package/dist/{cli-gvc3urUl.mjs → cli-7aLfgIGt.mjs} +3 -3
- package/dist/{cli-gvc3urUl.mjs.map → cli-7aLfgIGt.mjs.map} +1 -1
- package/dist/{cli-C3hsEwLK.cjs → cli-BkNZBe_-.cjs} +3 -3
- package/dist/{cli-C3hsEwLK.cjs.map → cli-BkNZBe_-.cjs.map} +1 -1
- package/dist/{compose-CtUP07r3.cjs → compose-Bn4OJONR.cjs} +2 -2
- package/dist/{compose-CtUP07r3.cjs.map → compose-Bn4OJONR.cjs.map} +1 -1
- package/dist/{compose-C40Wk9m6.mjs → compose-n7K8H5j8.mjs} +2 -2
- package/dist/{compose-C40Wk9m6.mjs.map → compose-n7K8H5j8.mjs.map} +1 -1
- package/dist/deploy/public.cjs +5 -5
- package/dist/deploy/public.mjs +5 -5
- package/dist/{deploy-BjsZpUQ3.mjs → deploy-DK4Y6ev4.mjs} +3 -3
- package/dist/{deploy-BjsZpUQ3.mjs.map → deploy-DK4Y6ev4.mjs.map} +1 -1
- package/dist/{deploy-DPzauQsm.cjs → deploy-Ppnh8MHS.cjs} +3 -3
- package/dist/{deploy-DPzauQsm.cjs.map → deploy-Ppnh8MHS.cjs.map} +1 -1
- package/dist/{dokploy-BoH0DMyS.mjs → dokploy-Bjq05wkw.mjs} +2 -2
- package/dist/{dokploy-BoH0DMyS.mjs.map → dokploy-Bjq05wkw.mjs.map} +1 -1
- package/dist/{dokploy-Cj1EHd4Y.cjs → dokploy-CJvdoNc3.cjs} +2 -2
- package/dist/{dokploy-Cj1EHd4Y.cjs.map → dokploy-CJvdoNc3.cjs.map} +1 -1
- package/dist/{encryption-MeDrE-rZ.mjs → encryption-BrsOJFFz.mjs} +2 -2
- package/dist/{encryption-MeDrE-rZ.mjs.map → encryption-BrsOJFFz.mjs.map} +1 -1
- package/dist/{encryption-D2z16vsS.cjs → encryption-CAyR6D7B.cjs} +2 -2
- package/dist/{encryption-D2z16vsS.cjs.map → encryption-CAyR6D7B.cjs.map} +1 -1
- package/dist/{engine-C3T39eTO.cjs → engine-DzBZR5D0.cjs} +2 -2
- package/dist/{engine-C3T39eTO.cjs.map → engine-DzBZR5D0.cjs.map} +1 -1
- package/dist/{engine-B-Yq0yQu.mjs → engine-ba9CvjTo.mjs} +2 -2
- package/dist/{engine-B-Yq0yQu.mjs.map → engine-ba9CvjTo.mjs.map} +1 -1
- package/dist/github-BLjU59Ye.cjs +669 -0
- package/dist/github-BLjU59Ye.cjs.map +1 -0
- package/dist/github-CVdbVlT5.mjs +669 -0
- package/dist/github-CVdbVlT5.mjs.map +1 -0
- package/dist/index.cjs +41 -41
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +41 -41
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-CTqICj1B.cjs → migrate-DkB833Jj.cjs} +2 -2
- package/dist/{migrate-CTqICj1B.cjs.map → migrate-DkB833Jj.cjs.map} +1 -1
- package/dist/{migrate-A2CLFl9G.mjs → migrate-DlBgATa-.mjs} +2 -2
- package/dist/{migrate-A2CLFl9G.mjs.map → migrate-DlBgATa-.mjs.map} +1 -1
- package/dist/{migrate-DvIAITiG.cjs → migrate-iEdyEx4S.cjs} +2 -2
- package/dist/{migrate-DvIAITiG.cjs.map → migrate-iEdyEx4S.cjs.map} +1 -1
- package/dist/{migrate-DWUbYY5r.mjs → migrate-pfu4aYzX.mjs} +2 -2
- package/dist/{migrate-DWUbYY5r.mjs.map → migrate-pfu4aYzX.mjs.map} +1 -1
- package/dist/{resolve-DOXcAOcn.cjs → resolve-4_5N67Fk.cjs} +3 -3
- package/dist/{resolve-DOXcAOcn.cjs.map → resolve-4_5N67Fk.cjs.map} +1 -1
- package/dist/{resolve-CHwetPdo.mjs → resolve-CQPn66jr.mjs} +3 -3
- package/dist/{resolve-CHwetPdo.mjs.map → resolve-CQPn66jr.mjs.map} +1 -1
- package/dist/{rollback-Cq5s3WnD.mjs → rollback-C0cbdsM-.mjs} +3 -3
- package/dist/{rollback-Cq5s3WnD.mjs.map → rollback-C0cbdsM-.mjs.map} +1 -1
- package/dist/{rollback-DUoOaws3.cjs → rollback-CgYUPLbq.cjs} +3 -3
- package/dist/{rollback-DUoOaws3.cjs.map → rollback-CgYUPLbq.cjs.map} +1 -1
- package/dist/{secretsManager-Ti0oZwsS.mjs → secretsManager-Chs9VV2r.mjs} +8 -2
- package/dist/{secretsManager-Ti0oZwsS.mjs.map → secretsManager-Chs9VV2r.mjs.map} +1 -1
- package/dist/{secretsManager-DUXW3fQt.cjs → secretsManager-DcMlHnRC.cjs} +19 -2
- package/dist/{secretsManager-DUXW3fQt.cjs.map → secretsManager-DcMlHnRC.cjs.map} +1 -1
- package/dist/{seeds-DiXON7R8.mjs → seeds-BdkFpW0P.mjs} +5 -5
- package/dist/{seeds-DiXON7R8.mjs.map → seeds-BdkFpW0P.mjs.map} +1 -1
- package/dist/{seeds-qX13ubmO.cjs → seeds-ZljwYV_p.cjs} +5 -5
- package/dist/{seeds-qX13ubmO.cjs.map → seeds-ZljwYV_p.cjs.map} +1 -1
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.mjs +1 -1
- package/package.json +15 -15
- package/dist/github-B8dDa8xf.cjs +0 -213
- package/dist/github-B8dDa8xf.cjs.map +0 -1
- package/dist/github-Dyrjo0xd.mjs +0 -213
- package/dist/github-Dyrjo0xd.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollback-
|
|
1
|
+
{"version":3,"file":"rollback-C0cbdsM-.mjs","names":[],"sources":["../src/target/dokploy/rollback.ts"],"sourcesContent":["/**\n * `gkm deploy:rollback`: a stage's apps put back on the release before the\n * one they run, by hand — for a release that passed its checks and turned out\n * wrong anyway.\n *\n * One app by default, because an app is what usually broke: rolling the API\n * back over a site fix that shipped beside it undoes the fix too. `atomic`\n * rolls back every app that has a release to go back to, for apps that only\n * work together — an API and the site built against its newer contract.\n *\n * It restores images and nothing else. The environment an app runs with is\n * the stage's, resolved on every deploy, and migrations are forward-only: a\n * migration that the older code cannot run against is undone by a new\n * migration, never by a rollback.\n */\n\nimport { resolve } from 'node:path';\nimport { findWorkspaceRoot, loadWorkspaceConfig } from '../../config';\nimport {\n\ttype CredentialProvider,\n\tstoredCredentials,\n} from '../../deploy/credentials';\nimport { DeployJournal } from '../../deploy/journal';\nimport { createStateStore } from '../../deploy/StateStore';\nimport {\n\tcreateEmptyState,\n\ttype ReleasedImage,\n\trecordRollback,\n} from '../../deploy/state';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { type Sandbox, withSandbox } from '../../sandbox/sandbox';\nimport { assertDeployedStage } from '../../workspace/stages';\nimport { dokployApi, restoreImage, verifySettings } from './engine';\n\nexport interface RollbackInput {\n\t/** The project: the directory holding `gkm.config.ts`, or one inside it. */\n\tcwd: string;\n\tstage: string;\n\t/** The app to roll back. */\n\tapp?: string;\n\t/** Every app with an earlier release, instead of one. */\n\tatomic?: boolean;\n\t/** Defaults to the environment, then the logins `gkm login` stored. */\n\tcredentials?: CredentialProvider;\n\tsignal?: AbortSignal;\n\t/** Each progress line. Defaults to none. */\n\tlog?: (line: string) => void;\n\t/** Where the config is loaded. Defaults to a `LocalSandbox` on the project. */\n\tsandbox?: Sandbox;\n}\n\n/** One app rolled back. */\nexport interface RolledBack {\n\tapp: string;\n\tfrom: ReleasedImage;\n\tto: ReleasedImage;\n}\n\n/** Neither an app nor every app was asked for. */\nexport class RollbackNeedsApp extends Error {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** The apps that have a release to go back to. */\n\t\treadonly apps: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`Say what to roll back: --app <name> for one app (${apps.join(', ') || 'none has an earlier release'}), ` +\n\t\t\t\t`or --atomic for every app of \"${stage}\" together.`,\n\t\t);\n\t\tthis.name = 'RollbackNeedsApp';\n\t}\n}\n\n/** An app has no release before the one it runs. */\nexport class NothingToRollBack extends Error {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`\"${app}\" has no earlier release on \"${stage}\" to roll back to: it has been released once, ` +\n\t\t\t\t'or every earlier release was itself rolled back. Deploy the version you want instead.',\n\t\t);\n\t\tthis.name = 'NothingToRollBack';\n\t}\n}\n\n/** The stage was never deployed through Dokploy from this state. */\nexport class StageNeverDeployed extends Error {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`\"${stage}\" has no deploy state, so there is nothing to roll back. ` +\n\t\t\t\t'Check the stage name, and that `state` in gkm.config.ts points at the store the deploys write to.',\n\t\t);\n\t\tthis.name = 'StageNeverDeployed';\n\t}\n}\n\n/**\n * Roll a stage's app — or, `atomic`, all of them — back to its previous\n * release, holding the stage's lock as a deploy does.\n */\nexport async function rollbackStage(\n\tinput: RollbackInput,\n): Promise<RolledBack[]> {\n\tconst signal = input.signal ?? new AbortController().signal;\n\tconst log = input.log ?? (() => {});\n\tconst credentials = input.credentials ?? storedCredentials();\n\tconst sandbox =\n\t\tinput.sandbox ??\n\t\tnew LocalSandbox({ root: findWorkspaceRoot(resolve(input.cwd)) });\n\n\treturn withSandbox(sandbox, async () => {\n\t\tconst { workspace } = await loadWorkspaceConfig(resolve(input.cwd), {\n\t\t\tsandbox,\n\t\t});\n\t\tassertDeployedStage(workspace.stages, input.stage);\n\n\t\tconst store = await createStateStore({\n\t\t\tconfig: workspace.state,\n\t\t\tworkspaceRoot: workspace.root,\n\t\t\tworkspaceName: workspace.name,\n\t\t});\n\t\tif (!(await store.read(input.stage))) {\n\t\t\tthrow new StageNeverDeployed(input.stage);\n\t\t}\n\n\t\tconst lock = await store.lock(input.stage, { operation: 'rollback' });\n\t\ttry {\n\t\t\tconst journal = await DeployJournal.open(store, input.stage, () =>\n\t\t\t\tcreateEmptyState(input.stage, '', ''),\n\t\t\t);\n\t\t\tconst { state } = journal;\n\t\t\tconst releases = state.releases ?? {};\n\t\t\tconst restorable = Object.keys(releases).filter(\n\t\t\t\t(app) => releases[app]!.previous,\n\t\t\t);\n\n\t\t\tlet apps: string[];\n\t\t\tif (input.atomic) {\n\t\t\t\tapps = restorable;\n\t\t\t\tif (apps.length === 0) {\n\t\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t\t}\n\t\t\t} else if (input.app) {\n\t\t\t\tif (!releases[input.app]?.previous) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, input.app);\n\t\t\t\t}\n\t\t\t\tapps = [input.app];\n\t\t\t} else {\n\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t}\n\n\t\t\tconst { api } = await dokployApi(workspace, { credentials, signal });\n\t\t\tconst verify = verifySettings(workspace.deploy.dokploy?.verify);\n\t\t\tconst rolled: RolledBack[] = [];\n\n\t\t\tfor (const app of apps) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tconst { current, previous } = releases[app]!;\n\t\t\t\tconst applicationId = state.applications[app];\n\t\t\t\tif (!previous || !applicationId) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, app);\n\t\t\t\t}\n\n\t\t\t\tlog(`⏪ ${app}: ${current.ref} → ${previous.ref}`);\n\t\t\t\tawait restoreImage(api, {\n\t\t\t\t\tapplicationId,\n\t\t\t\t\timage: previous,\n\t\t\t\t\tregistryId: state.registryId,\n\t\t\t\t\tverify,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\trecordRollback(state, app, previous);\n\t\t\t\tawait journal.save();\n\t\t\t\tlog(` ✓ ${app} is running ${previous.ref}`);\n\t\t\t\trolled.push({ app, from: current, to: previous });\n\t\t\t}\n\n\t\t\treturn rolled;\n\t\t} finally {\n\t\t\tawait lock.release();\n\t\t}\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAa,mBAAb,cAAsC,MAAM;CAEjC;CAEA;CAHV,YACC,OAEA,MACC;EACD,MACC,oDAAoD,KAAK,KAAK,IAAI,KAAK,8BAA8B,mCACnE,MAAM,YACzC;EAPS,KAAA,QAAA;EAEA,KAAA,OAAA;EAMT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,oBAAb,cAAuC,MAAM;CAElC;CACA;CAFV,YACC,OACA,KACC;EACD,MACC,IAAI,IAAI,+BAA+B,MAAM,oIAE9C;EANS,KAAA,QAAA;EACA,KAAA,MAAA;EAMT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwC,MAAM;CACxB;CAArB,YAAY,OAAwB;EACnC,MACC,IAAI,MAAM,6JAEX;EAJoB,KAAA,QAAA;EAKpB,KAAK,OAAO;CACb;AACD;;;;;AAMA,eAAsB,cACrB,OACwB;CACxB,MAAM,SAAS,MAAM,UAAU,IAAI,gBAAgB,CAAC,CAAC;CACrD,MAAM,MAAM,MAA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,OAAO,SAAS,MAAM;GAC9D,MAAM,SAAuB,CAAC;GAE9B,KAAK,MAAM,OAAO,MAAM;IACvB,OAAO,eAAe;IACtB,MAAM,EAAE,SAAS,aAAa,SAAS;IACvC,MAAM,gBAAgB,MAAM,aAAa;IACzC,IAAI,CAAC,YAAY,CAAC,eACjB,MAAM,IAAI,kBAAkB,MAAM,OAAO,GAAG;IAG7C,IAAI,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK,SAAS,KAAK;IAChD,MAAM,aAAa,KAAK;KACvB;KACA,OAAO;KACP,YAAY,MAAM;KAClB;KACA;IACD,CAAC;IACD,eAAe,OAAO,KAAK,QAAQ;IACnC,MAAM,QAAQ,KAAK;IACnB,IAAI,QAAQ,IAAI,cAAc,SAAS,KAAK;IAC5C,OAAO,KAAK;KAAE;KAAK,MAAM;KAAS,IAAI;IAAS,CAAC;GACjD;GAEA,OAAO;EACR,UAAU;GACT,MAAM,KAAK,QAAQ;EACpB;CACD,CAAC;AACF"}
|
|
@@ -3,9 +3,9 @@ const require_credentials = require("./credentials-BVs7mrtw.cjs");
|
|
|
3
3
|
const require_sandbox = require("./sandbox-CL--ZDui.cjs");
|
|
4
4
|
const require_workspace = require("./workspace-Bp8FEkF-.cjs");
|
|
5
5
|
const require_config = require("./config.cjs");
|
|
6
|
-
const require_seeds = require("./seeds-
|
|
6
|
+
const require_seeds = require("./seeds-ZljwYV_p.cjs");
|
|
7
7
|
const require_sniffer = require("./sniffer-BjG-1mlD.cjs");
|
|
8
|
-
const require_engine = require("./engine-
|
|
8
|
+
const require_engine = require("./engine-DzBZR5D0.cjs");
|
|
9
9
|
let node_path = require("node:path");
|
|
10
10
|
//#region src/target/dokploy/rollback.ts
|
|
11
11
|
/**
|
|
@@ -158,4 +158,4 @@ Object.defineProperty(exports, "rollback_exports", {
|
|
|
158
158
|
}
|
|
159
159
|
});
|
|
160
160
|
|
|
161
|
-
//# sourceMappingURL=rollback-
|
|
161
|
+
//# sourceMappingURL=rollback-CgYUPLbq.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollback-
|
|
1
|
+
{"version":3,"file":"rollback-CgYUPLbq.cjs","names":["storedCredentials","LocalSandbox","findWorkspaceRoot","resolve","withSandbox","loadWorkspaceConfig","createStateStore","DeployJournal","createEmptyState","dokployApi","verifySettings","restoreImage"],"sources":["../src/target/dokploy/rollback.ts"],"sourcesContent":["/**\n * `gkm deploy:rollback`: a stage's apps put back on the release before the\n * one they run, by hand — for a release that passed its checks and turned out\n * wrong anyway.\n *\n * One app by default, because an app is what usually broke: rolling the API\n * back over a site fix that shipped beside it undoes the fix too. `atomic`\n * rolls back every app that has a release to go back to, for apps that only\n * work together — an API and the site built against its newer contract.\n *\n * It restores images and nothing else. The environment an app runs with is\n * the stage's, resolved on every deploy, and migrations are forward-only: a\n * migration that the older code cannot run against is undone by a new\n * migration, never by a rollback.\n */\n\nimport { resolve } from 'node:path';\nimport { findWorkspaceRoot, loadWorkspaceConfig } from '../../config';\nimport {\n\ttype CredentialProvider,\n\tstoredCredentials,\n} from '../../deploy/credentials';\nimport { DeployJournal } from '../../deploy/journal';\nimport { createStateStore } from '../../deploy/StateStore';\nimport {\n\tcreateEmptyState,\n\ttype ReleasedImage,\n\trecordRollback,\n} from '../../deploy/state';\nimport { LocalSandbox } from '../../sandbox/local';\nimport { type Sandbox, withSandbox } from '../../sandbox/sandbox';\nimport { assertDeployedStage } from '../../workspace/stages';\nimport { dokployApi, restoreImage, verifySettings } from './engine';\n\nexport interface RollbackInput {\n\t/** The project: the directory holding `gkm.config.ts`, or one inside it. */\n\tcwd: string;\n\tstage: string;\n\t/** The app to roll back. */\n\tapp?: string;\n\t/** Every app with an earlier release, instead of one. */\n\tatomic?: boolean;\n\t/** Defaults to the environment, then the logins `gkm login` stored. */\n\tcredentials?: CredentialProvider;\n\tsignal?: AbortSignal;\n\t/** Each progress line. Defaults to none. */\n\tlog?: (line: string) => void;\n\t/** Where the config is loaded. Defaults to a `LocalSandbox` on the project. */\n\tsandbox?: Sandbox;\n}\n\n/** One app rolled back. */\nexport interface RolledBack {\n\tapp: string;\n\tfrom: ReleasedImage;\n\tto: ReleasedImage;\n}\n\n/** Neither an app nor every app was asked for. */\nexport class RollbackNeedsApp extends Error {\n\tconstructor(\n\t\treadonly stage: string,\n\t\t/** The apps that have a release to go back to. */\n\t\treadonly apps: readonly string[],\n\t) {\n\t\tsuper(\n\t\t\t`Say what to roll back: --app <name> for one app (${apps.join(', ') || 'none has an earlier release'}), ` +\n\t\t\t\t`or --atomic for every app of \"${stage}\" together.`,\n\t\t);\n\t\tthis.name = 'RollbackNeedsApp';\n\t}\n}\n\n/** An app has no release before the one it runs. */\nexport class NothingToRollBack extends Error {\n\tconstructor(\n\t\treadonly stage: string,\n\t\treadonly app: string,\n\t) {\n\t\tsuper(\n\t\t\t`\"${app}\" has no earlier release on \"${stage}\" to roll back to: it has been released once, ` +\n\t\t\t\t'or every earlier release was itself rolled back. Deploy the version you want instead.',\n\t\t);\n\t\tthis.name = 'NothingToRollBack';\n\t}\n}\n\n/** The stage was never deployed through Dokploy from this state. */\nexport class StageNeverDeployed extends Error {\n\tconstructor(readonly stage: string) {\n\t\tsuper(\n\t\t\t`\"${stage}\" has no deploy state, so there is nothing to roll back. ` +\n\t\t\t\t'Check the stage name, and that `state` in gkm.config.ts points at the store the deploys write to.',\n\t\t);\n\t\tthis.name = 'StageNeverDeployed';\n\t}\n}\n\n/**\n * Roll a stage's app — or, `atomic`, all of them — back to its previous\n * release, holding the stage's lock as a deploy does.\n */\nexport async function rollbackStage(\n\tinput: RollbackInput,\n): Promise<RolledBack[]> {\n\tconst signal = input.signal ?? new AbortController().signal;\n\tconst log = input.log ?? (() => {});\n\tconst credentials = input.credentials ?? storedCredentials();\n\tconst sandbox =\n\t\tinput.sandbox ??\n\t\tnew LocalSandbox({ root: findWorkspaceRoot(resolve(input.cwd)) });\n\n\treturn withSandbox(sandbox, async () => {\n\t\tconst { workspace } = await loadWorkspaceConfig(resolve(input.cwd), {\n\t\t\tsandbox,\n\t\t});\n\t\tassertDeployedStage(workspace.stages, input.stage);\n\n\t\tconst store = await createStateStore({\n\t\t\tconfig: workspace.state,\n\t\t\tworkspaceRoot: workspace.root,\n\t\t\tworkspaceName: workspace.name,\n\t\t});\n\t\tif (!(await store.read(input.stage))) {\n\t\t\tthrow new StageNeverDeployed(input.stage);\n\t\t}\n\n\t\tconst lock = await store.lock(input.stage, { operation: 'rollback' });\n\t\ttry {\n\t\t\tconst journal = await DeployJournal.open(store, input.stage, () =>\n\t\t\t\tcreateEmptyState(input.stage, '', ''),\n\t\t\t);\n\t\t\tconst { state } = journal;\n\t\t\tconst releases = state.releases ?? {};\n\t\t\tconst restorable = Object.keys(releases).filter(\n\t\t\t\t(app) => releases[app]!.previous,\n\t\t\t);\n\n\t\t\tlet apps: string[];\n\t\t\tif (input.atomic) {\n\t\t\t\tapps = restorable;\n\t\t\t\tif (apps.length === 0) {\n\t\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t\t}\n\t\t\t} else if (input.app) {\n\t\t\t\tif (!releases[input.app]?.previous) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, input.app);\n\t\t\t\t}\n\t\t\t\tapps = [input.app];\n\t\t\t} else {\n\t\t\t\tthrow new RollbackNeedsApp(input.stage, restorable);\n\t\t\t}\n\n\t\t\tconst { api } = await dokployApi(workspace, { credentials, signal });\n\t\t\tconst verify = verifySettings(workspace.deploy.dokploy?.verify);\n\t\t\tconst rolled: RolledBack[] = [];\n\n\t\t\tfor (const app of apps) {\n\t\t\t\tsignal.throwIfAborted();\n\t\t\t\tconst { current, previous } = releases[app]!;\n\t\t\t\tconst applicationId = state.applications[app];\n\t\t\t\tif (!previous || !applicationId) {\n\t\t\t\t\tthrow new NothingToRollBack(input.stage, app);\n\t\t\t\t}\n\n\t\t\t\tlog(`⏪ ${app}: ${current.ref} → ${previous.ref}`);\n\t\t\t\tawait restoreImage(api, {\n\t\t\t\t\tapplicationId,\n\t\t\t\t\timage: previous,\n\t\t\t\t\tregistryId: state.registryId,\n\t\t\t\t\tverify,\n\t\t\t\t\tsignal,\n\t\t\t\t});\n\t\t\t\trecordRollback(state, app, previous);\n\t\t\t\tawait journal.save();\n\t\t\t\tlog(` ✓ ${app} is running ${previous.ref}`);\n\t\t\t\trolled.push({ app, from: current, to: previous });\n\t\t\t}\n\n\t\t\treturn rolled;\n\t\t} finally {\n\t\t\tawait lock.release();\n\t\t}\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAa,mBAAb,cAAsC,MAAM;CAEjC;CAEA;CAHV,YACC,OAEA,MACC;EACD,MACC,oDAAoD,KAAK,KAAK,IAAI,KAAK,8BAA8B,mCACnE,MAAM,YACzC;EAPS,KAAA,QAAA;EAEA,KAAA,OAAA;EAMT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,oBAAb,cAAuC,MAAM;CAElC;CACA;CAFV,YACC,OACA,KACC;EACD,MACC,IAAI,IAAI,+BAA+B,MAAM,oIAE9C;EANS,KAAA,QAAA;EACA,KAAA,MAAA;EAMT,KAAK,OAAO;CACb;AACD;;AAGA,IAAa,qBAAb,cAAwC,MAAM;CACxB;CAArB,YAAY,OAAwB;EACnC,MACC,IAAI,MAAM,6JAEX;EAJoB,KAAA,QAAA;EAKpB,KAAK,OAAO;CACb;AACD;;;;;AAMA,eAAsB,cACrB,OACwB;CACxB,MAAM,SAAS,MAAM,UAAU,IAAI,gBAAgB,CAAC,CAAC;CACrD,MAAM,MAAM,MAAM,cAAc,CAAC;CACjC,MAAM,cAAc,MAAM,eAAeA,oBAAAA,kBAAkB;CAC3D,MAAM,UACL,MAAM,WACN,IAAIC,oBAAAA,aAAa,EAAE,MAAMC,eAAAA,mBAAAA,GAAkBC,UAAAA,QAAAA,CAAQ,MAAM,GAAG,CAAC,EAAE,CAAC;CAEjE,OAAOC,gBAAAA,YAAY,SAAS,YAAY;EACvC,MAAM,E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AS,aAAa,SAAS;IACvC,MAAM,gBAAgB,MAAM,aAAa;IACzC,IAAI,CAAC,YAAY,CAAC,eACjB,MAAM,IAAI,kBAAkB,MAAM,OAAO,GAAG;IAG7C,IAAI,KAAK,IAAI,IAAI,QAAQ,IAAI,KAAK,SAAS,KAAK;IAChD,MAAMC,eAAAA,aAAa,KAAK;KACvB;KACA,OAAO;KACP,YAAY,MAAM;KAClB;KACA;IACD,CAAC;IACD,cAAA,eAAe,OAAO,KAAK,QAAQ;IACnC,MAAM,QAAQ,KAAK;IACnB,IAAI,QAAQ,IAAI,cAAc,SAAS,KAAK;IAC5C,OAAO,KAAK;KAAE;KAAK,MAAM;KAAS,IAAI;IAAS,CAAC;GACjD;GAEA,OAAO;EACR,UAAU;GACT,MAAM,KAAK,QAAQ;EACpB;CACD,CAAC;AACF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
1
2
|
import { n as serializeWithin, t as awsClientConfig } from "./awsStore-B529csle.mjs";
|
|
2
3
|
import { CreateSecretCommand, GetSecretValueCommand, PutSecretValueCommand, ResourceNotFoundException, SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
|
|
3
4
|
//#region src/secrets/secretsManager.ts
|
|
@@ -13,6 +14,11 @@ import { CreateSecretCommand, GetSecretValueCommand, PutSecretValueCommand, Reso
|
|
|
13
14
|
* Chosen over SSM for size (64 KB rather than 8 KB) and for Secrets Manager's
|
|
14
15
|
* own versioning, at a monthly price per secret.
|
|
15
16
|
*/
|
|
17
|
+
var secretsManager_exports = /* @__PURE__ */ __exportAll({
|
|
18
|
+
SECRETS_MANAGER_SECRET_LIMIT: () => SECRETS_MANAGER_SECRET_LIMIT,
|
|
19
|
+
SecretsManagerSecretsStore: () => SecretsManagerSecretsStore,
|
|
20
|
+
secretsManagerSecretName: () => secretsManagerSecretName
|
|
21
|
+
});
|
|
16
22
|
/** The most a Secrets Manager secret holds: 64 KB. */
|
|
17
23
|
const SECRETS_MANAGER_SECRET_LIMIT = 65536;
|
|
18
24
|
/** The secret a stage's secrets are kept in. */
|
|
@@ -65,6 +71,6 @@ var SecretsManagerSecretsStore = class {
|
|
|
65
71
|
}
|
|
66
72
|
};
|
|
67
73
|
//#endregion
|
|
68
|
-
export {
|
|
74
|
+
export { secretsManager_exports as n, secretsManagerSecretName as t };
|
|
69
75
|
|
|
70
|
-
//# sourceMappingURL=secretsManager-
|
|
76
|
+
//# sourceMappingURL=secretsManager-Chs9VV2r.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secretsManager-
|
|
1
|
+
{"version":3,"file":"secretsManager-Chs9VV2r.mjs","names":[],"sources":["../src/secrets/secretsManager.ts"],"sourcesContent":["/**\n * A stage's secrets in AWS Secrets Manager, in the stage's own AWS account.\n *\n * One secret per stage, `gkm/<project>/<stage>/secrets` — the SSM store's\n * parameter name without its leading `/` — holding the same JSON. It is\n * encrypted with the account's `aws/secretsmanager` key unless `kmsKeyId`\n * names another. Which account it is in is whichever credentials are active,\n * exactly as for the SSM store.\n *\n * Chosen over SSM for size (64 KB rather than 8 KB) and for Secrets Manager's\n * own versioning, at a monthly price per secret.\n */\n\nimport {\n\tCreateSecretCommand,\n\tGetSecretValueCommand,\n\tPutSecretValueCommand,\n\tResourceNotFoundException,\n\tSecretsManagerClient,\n} from '@aws-sdk/client-secrets-manager';\nimport {\n\ttype AwsStoreOptions,\n\tawsClientConfig,\n\tserializeWithin,\n} from './awsStore.js';\nimport type { SecretsStore } from './store.js';\nimport type { StageSecrets } from './types.js';\n\nexport interface SecretsManagerStoreOptions extends AwsStoreOptions {\n\t/** The KMS key a new secret is encrypted with; `aws/secretsmanager` if unset. */\n\tkmsKeyId?: string;\n}\n\n/** The most a Secrets Manager secret holds: 64 KB. */\nexport const SECRETS_MANAGER_SECRET_LIMIT = 64 * 1024;\n\n/** The secret a stage's secrets are kept in. */\nexport function secretsManagerSecretName(\n\tproject: string,\n\tstage: string,\n): string {\n\treturn `gkm/${project}/${stage}/secrets`;\n}\n\nexport class SecretsManagerSecretsStore implements SecretsStore {\n\treadonly name = 'secrets-manager';\n\n\tprivate client?: SecretsManagerClient;\n\n\tconstructor(private readonly options: SecretsManagerStoreOptions) {}\n\n\tprivate async secretsManager(): Promise<SecretsManagerClient> {\n\t\tif (this.client) return this.client;\n\t\tthis.client = new SecretsManagerClient(await awsClientConfig(this.options));\n\t\treturn this.client;\n\t}\n\n\tprivate secretName(stage: string): string {\n\t\treturn secretsManagerSecretName(this.options.project, stage);\n\t}\n\n\tasync read(stage: string): Promise<StageSecrets | null> {\n\t\tconst client = await this.secretsManager();\n\n\t\ttry {\n\t\t\tconst { SecretString } = await client.send(\n\t\t\t\tnew GetSecretValueCommand({ SecretId: this.secretName(stage) }),\n\t\t\t);\n\t\t\treturn SecretString ? (JSON.parse(SecretString) as StageSecrets) : null;\n\t\t} catch (error) {\n\t\t\tif (error instanceof ResourceNotFoundException) return null;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync write(stage: string, secrets: StageSecrets): Promise<void> {\n\t\tconst value = serializeWithin(\n\t\t\tstage,\n\t\t\tthis.name,\n\t\t\tsecrets,\n\t\t\tSECRETS_MANAGER_SECRET_LIMIT,\n\t\t);\n\t\tconst client = await this.secretsManager();\n\t\tconst name = this.secretName(stage);\n\n\t\ttry {\n\t\t\tawait client.send(\n\t\t\t\tnew PutSecretValueCommand({ SecretId: name, SecretString: value }),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof ResourceNotFoundException)) throw error;\n\t\t\t// The stage's first write: the secret does not exist yet.\n\t\t\tawait client.send(\n\t\t\t\tnew CreateSecretCommand({\n\t\t\t\t\tName: name,\n\t\t\t\t\tSecretString: value,\n\t\t\t\t\tDescription: `gkm secrets for ${this.options.project}/${stage}`,\n\t\t\t\t\t...(this.options.kmsKeyId ? { KmsKeyId: this.options.kmsKeyId } : {}),\n\t\t\t\t}),\n\t\t\t);\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QAAQ,SAAS,IAAI,CAAC;GACpE,CAAC,CACF;EACD;CACD;AACD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
1
2
|
const require_awsStore = require("./awsStore-7VmS_cZR.cjs");
|
|
2
3
|
let _aws_sdk_client_secrets_manager = require("@aws-sdk/client-secrets-manager");
|
|
3
4
|
//#region src/secrets/secretsManager.ts
|
|
@@ -13,6 +14,11 @@ let _aws_sdk_client_secrets_manager = require("@aws-sdk/client-secrets-manager")
|
|
|
13
14
|
* Chosen over SSM for size (64 KB rather than 8 KB) and for Secrets Manager's
|
|
14
15
|
* own versioning, at a monthly price per secret.
|
|
15
16
|
*/
|
|
17
|
+
var secretsManager_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
18
|
+
SECRETS_MANAGER_SECRET_LIMIT: () => SECRETS_MANAGER_SECRET_LIMIT,
|
|
19
|
+
SecretsManagerSecretsStore: () => SecretsManagerSecretsStore,
|
|
20
|
+
secretsManagerSecretName: () => secretsManagerSecretName
|
|
21
|
+
});
|
|
16
22
|
/** The most a Secrets Manager secret holds: 64 KB. */
|
|
17
23
|
const SECRETS_MANAGER_SECRET_LIMIT = 65536;
|
|
18
24
|
/** The secret a stage's secrets are kept in. */
|
|
@@ -65,6 +71,17 @@ var SecretsManagerSecretsStore = class {
|
|
|
65
71
|
}
|
|
66
72
|
};
|
|
67
73
|
//#endregion
|
|
68
|
-
exports
|
|
74
|
+
Object.defineProperty(exports, "secretsManagerSecretName", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: function() {
|
|
77
|
+
return secretsManagerSecretName;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
Object.defineProperty(exports, "secretsManager_exports", {
|
|
81
|
+
enumerable: true,
|
|
82
|
+
get: function() {
|
|
83
|
+
return secretsManager_exports;
|
|
84
|
+
}
|
|
85
|
+
});
|
|
69
86
|
|
|
70
|
-
//# sourceMappingURL=secretsManager-
|
|
87
|
+
//# sourceMappingURL=secretsManager-DcMlHnRC.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secretsManager-
|
|
1
|
+
{"version":3,"file":"secretsManager-DcMlHnRC.cjs","names":["SecretsManagerClient","awsClientConfig","GetSecretValueCommand","ResourceNotFoundException","serializeWithin","PutSecretValueCommand","CreateSecretCommand"],"sources":["../src/secrets/secretsManager.ts"],"sourcesContent":["/**\n * A stage's secrets in AWS Secrets Manager, in the stage's own AWS account.\n *\n * One secret per stage, `gkm/<project>/<stage>/secrets` — the SSM store's\n * parameter name without its leading `/` — holding the same JSON. It is\n * encrypted with the account's `aws/secretsmanager` key unless `kmsKeyId`\n * names another. Which account it is in is whichever credentials are active,\n * exactly as for the SSM store.\n *\n * Chosen over SSM for size (64 KB rather than 8 KB) and for Secrets Manager's\n * own versioning, at a monthly price per secret.\n */\n\nimport {\n\tCreateSecretCommand,\n\tGetSecretValueCommand,\n\tPutSecretValueCommand,\n\tResourceNotFoundException,\n\tSecretsManagerClient,\n} from '@aws-sdk/client-secrets-manager';\nimport {\n\ttype AwsStoreOptions,\n\tawsClientConfig,\n\tserializeWithin,\n} from './awsStore.js';\nimport type { SecretsStore } from './store.js';\nimport type { StageSecrets } from './types.js';\n\nexport interface SecretsManagerStoreOptions extends AwsStoreOptions {\n\t/** The KMS key a new secret is encrypted with; `aws/secretsmanager` if unset. */\n\tkmsKeyId?: string;\n}\n\n/** The most a Secrets Manager secret holds: 64 KB. */\nexport const SECRETS_MANAGER_SECRET_LIMIT = 64 * 1024;\n\n/** The secret a stage's secrets are kept in. */\nexport function secretsManagerSecretName(\n\tproject: string,\n\tstage: string,\n): string {\n\treturn `gkm/${project}/${stage}/secrets`;\n}\n\nexport class SecretsManagerSecretsStore implements SecretsStore {\n\treadonly name = 'secrets-manager';\n\n\tprivate client?: SecretsManagerClient;\n\n\tconstructor(private readonly options: SecretsManagerStoreOptions) {}\n\n\tprivate async secretsManager(): Promise<SecretsManagerClient> {\n\t\tif (this.client) return this.client;\n\t\tthis.client = new SecretsManagerClient(await awsClientConfig(this.options));\n\t\treturn this.client;\n\t}\n\n\tprivate secretName(stage: string): string {\n\t\treturn secretsManagerSecretName(this.options.project, stage);\n\t}\n\n\tasync read(stage: string): Promise<StageSecrets | null> {\n\t\tconst client = await this.secretsManager();\n\n\t\ttry {\n\t\t\tconst { SecretString } = await client.send(\n\t\t\t\tnew GetSecretValueCommand({ SecretId: this.secretName(stage) }),\n\t\t\t);\n\t\t\treturn SecretString ? (JSON.parse(SecretString) as StageSecrets) : null;\n\t\t} catch (error) {\n\t\t\tif (error instanceof ResourceNotFoundException) return null;\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync write(stage: string, secrets: StageSecrets): Promise<void> {\n\t\tconst value = serializeWithin(\n\t\t\tstage,\n\t\t\tthis.name,\n\t\t\tsecrets,\n\t\t\tSECRETS_MANAGER_SECRET_LIMIT,\n\t\t);\n\t\tconst client = await this.secretsManager();\n\t\tconst name = this.secretName(stage);\n\n\t\ttry {\n\t\t\tawait client.send(\n\t\t\t\tnew PutSecretValueCommand({ SecretId: name, SecretString: value }),\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tif (!(error instanceof ResourceNotFoundException)) throw error;\n\t\t\t// The stage's first write: the secret does not exist yet.\n\t\t\tawait client.send(\n\t\t\t\tnew CreateSecretCommand({\n\t\t\t\t\tName: name,\n\t\t\t\t\tSecretString: value,\n\t\t\t\t\tDescription: `gkm secrets for ${this.options.project}/${stage}`,\n\t\t\t\t\t...(this.options.kmsKeyId ? { KmsKeyId: this.options.kmsKeyId } : {}),\n\t\t\t\t}),\n\t\t\t);\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAa,+BAA+B;;AAG5C,SAAgB,yBACf,SACA,OACS;CACT,OAAO,OAAO,QAAQ,GAAG,MAAM;AAChC;AAEA,IAAa,6BAAb,MAAgE;CAKlC;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gP.mjs";
|
|
|
5
5
|
import { O as TEST_STAGE, R as UnknownSecretsStoreProvider, h as getPublicEnvPrefix, m as PUBLIC_ENV_PREFIXES, n as allConstructGlobs } from "./workspace-BBdqmkch.mjs";
|
|
6
6
|
import { ConfigNotFound, NotInAnApp, loadWorkspaceAppInfo, loadWorkspaceConfig } from "./config.mjs";
|
|
7
7
|
import { n as runtimeFor, r as generateTelemetryModule } from "./EndpointGenerator-DftalLYg.mjs";
|
|
8
|
-
import { c as runtimeOf } from "./resolve-
|
|
8
|
+
import { c as runtimeOf } from "./resolve-CQPn66jr.mjs";
|
|
9
9
|
import { a as DEFAULT_STORAGE, i as DEFAULT_EVENTS$1, n as readFakes, o as holdsEveryCache, r as DEFAULT_CACHE, t as SubscriberGenerator } from "./SubscriberGenerator-5looQ3gB.mjs";
|
|
10
10
|
import { basename, dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
11
11
|
import { constants, existsSync, readFileSync } from "node:fs";
|
|
@@ -548,7 +548,7 @@ async function storeFromConfig(workspace, config, options = {}) {
|
|
|
548
548
|
const profile = options.profile ? { profile: options.profile } : {};
|
|
549
549
|
switch (config.provider) {
|
|
550
550
|
case "ssm": {
|
|
551
|
-
const { AwsSecretsStore } = await import("./aws-
|
|
551
|
+
const { AwsSecretsStore } = await import("./aws-B-6uEhgP.mjs").then((n) => n.t);
|
|
552
552
|
return new AwsSecretsStore({
|
|
553
553
|
project: workspace.name,
|
|
554
554
|
region: config.region,
|
|
@@ -557,7 +557,7 @@ async function storeFromConfig(workspace, config, options = {}) {
|
|
|
557
557
|
}
|
|
558
558
|
case "secrets-manager": {
|
|
559
559
|
const { kmsKeyId } = config;
|
|
560
|
-
const { SecretsManagerSecretsStore } = await import("./secretsManager-
|
|
560
|
+
const { SecretsManagerSecretsStore } = await import("./secretsManager-Chs9VV2r.mjs").then((n) => n.n);
|
|
561
561
|
return new SecretsManagerSecretsStore({
|
|
562
562
|
project: workspace.name,
|
|
563
563
|
region: config.region,
|
|
@@ -4861,7 +4861,7 @@ export async function setupCrons(
|
|
|
4861
4861
|
// The cron's own function, the way its Lambda would run it — services,
|
|
4862
4862
|
// the worker's database as \`db\`, its events. It used to call a
|
|
4863
4863
|
// \`handler\` a Cron does not have, so every firing logged a failure.
|
|
4864
|
-
await runCron(entry.cron, serviceDiscovery);
|
|
4864
|
+
await runCron(entry.cron, serviceDiscovery, entry.name);
|
|
4865
4865
|
} catch (error) {
|
|
4866
4866
|
logger.error({ err: error, cron: entry.name }, 'Cron failed');
|
|
4867
4867
|
}
|
|
@@ -6637,4 +6637,4 @@ function reportPlannedSeeds(planned, log) {
|
|
|
6637
6637
|
//#endregion
|
|
6638
6638
|
export { constructGlobs as $, getKeyPath as $t, isOtlpDestination as A, imageBuildCredentials as At, manifestServiceDeclarations as B, primaryPortKey as Bt, ensureDockerignore as C, hostFor as Ct, NoDomainForStage as D, WORKER_PORT as Dt, validateImageRef as E, TURBO_VERSION as Et, STORAGE_KEY_PAIR as F, storageBackendFor as Ft, workerUnits as G, loadEnvFiles as Gt, reportDevServices as H, createEntryWrapper as Ht, UnknownDevService as I, DEFAULT_IMAGES as It, workerEntryDir as J, isRemoteStore as Jt, WorkerGenerator as K, loadSecretsForApp as Kt, assertExternalServices as L, describeServices as Lt, DEV_SERVICES as M, cacheBackendFor as Mt, DevServicesNeedServerTarget as N, eventsBackendFor as Nt, isMainFrontendApp as O, detectPackageManager as Ot, ExternalServicesNotConfigured as P, providerOf as Pt, backendsOf as Q, FileSecretsStore as Qt, devServicesUsed as R, fakeKey as Rt, dockerCommand as S, resourceName as St, workerDockerfileOf as T, imageLayout as Tt, requiredStageKeys as U, findAvailablePort as Ut, parseDevServices as V, createCredentialsPreload as Vt, suppliedOnly as W, isPortAvailable as Wt, CronGenerator as X, storeFromConfig as Xt, QueueGenerator as Y, secretsStoreFor as Yt, FAKE_ENV as Z, store_exports as Zt, DeployJournal as _, networkEnv as _t, createEmptyState as a, imageName as an, applyBuckets as at, DockerPushFailed as b, localRolePassword as bt, isDnsVerified as c, markerOf as cn, bucketPolicies as ct, setApplicationId as d, initStageSecrets as dn, quoteIdentifier as dt, keystoreProject as en, derivedContainers as et, setBackupState as f, maskPassword as fn, composeFor as ft, setPostgresBackupId as g, dockerfileOf as gt, setGeneratedSecret as h, withCustomSecret as hn, appEnvKeys as ht, assertNoStaleSecrets as i, deployIdentity as in, forgetState as it, otelEnv as j, isImageBuild as jt, resolveHost as k, findBuildRoot as kt, recordRelease as l, ownershipMarker as ln, postgresDatabaseNames as lt, setDnsVerification as m, toEmbeddableSecrets as mn, pgClient as mt, reportDatabaseRuns as n, readKey as nn, workspace_exports as nt, getBackupState as o, imageRef as on, applyPolicies as ot, setDnsRecord as p, storage_exports as pn, bucketClient as pt, workerBundleName as q, prepareEntryCredentials as qt, reportPlannedSeeds as r, applicationName as rn, LOCAL_CA_PATH as rt, getGeneratedSecret as s, isOwnedBy as sn, applyPostgres as st, DeploySeedsFailed as t, projectKey as tn, reconcileWorkspace as tt, recordRollback as u, projectName as un, postgresStatements as ut, withGeneratedSecrets as v, workerEnvKeys as vt, workerDockerfile as w, composeBuildPaths as wt, appDockerfile as x, planFor as xt, DockerBuildFailed as y, envFor as yt, externalServices as z, portKeys as zt };
|
|
6639
6639
|
|
|
6640
|
-
//# sourceMappingURL=seeds-
|
|
6640
|
+
//# sourceMappingURL=seeds-BdkFpW0P.mjs.map
|