@geekmidas/cli 10.0.0-alpha.65 → 10.0.0-alpha.67
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/README.md +123 -177
- package/dist/{HostingerProvider-x9gQTAGZ.mjs → HostingerProvider-D85ayzTi.mjs} +4 -4
- package/dist/HostingerProvider-D85ayzTi.mjs.map +1 -0
- package/dist/{HostingerProvider-Dlmbfass.cjs → HostingerProvider-dxkwynSs.cjs} +4 -4
- package/dist/HostingerProvider-dxkwynSs.cjs.map +1 -0
- package/dist/{LegacyStateStore-BGoo__sO.cjs → LegacyStateStore-BZiO9-Lw.cjs} +2 -2
- package/dist/{LegacyStateStore-BGoo__sO.cjs.map → LegacyStateStore-BZiO9-Lw.cjs.map} +1 -1
- package/dist/{LegacyStateStore-BUu1nQ5u.mjs → LegacyStateStore-C39UKwmf.mjs} +2 -2
- package/dist/{LegacyStateStore-BUu1nQ5u.mjs.map → LegacyStateStore-C39UKwmf.mjs.map} +1 -1
- package/dist/{LocalStateStore-93urXyQe.cjs → LocalStateStore-DHVsZLyF.cjs} +2 -2
- package/dist/{LocalStateStore-93urXyQe.cjs.map → LocalStateStore-DHVsZLyF.cjs.map} +1 -1
- package/dist/{LocalStateStore-BRhMQRuy.mjs → LocalStateStore-Dk3Wbvzk.mjs} +2 -2
- package/dist/{LocalStateStore-BRhMQRuy.mjs.map → LocalStateStore-Dk3Wbvzk.mjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-BWuDRHe9.cjs → OpenApiTsGenerator-B2zrdyP4.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-BWuDRHe9.cjs.map → OpenApiTsGenerator-B2zrdyP4.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-C6v-IeHt.mjs → OpenApiTsGenerator-BmUAcR7d.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-C6v-IeHt.mjs.map → OpenApiTsGenerator-BmUAcR7d.mjs.map} +1 -1
- package/dist/{Route53Provider-DVILBsvV.cjs → Route53Provider-Bllus2NR.cjs} +2 -2
- package/dist/Route53Provider-Bllus2NR.cjs.map +1 -0
- package/dist/{Route53Provider-Cvj40A8I.mjs → Route53Provider-QXxjkZO1.mjs} +2 -2
- package/dist/Route53Provider-QXxjkZO1.mjs.map +1 -0
- package/dist/{S3StateStore-F4dxw6kS.cjs → S3StateStore--4tYVMAL.cjs} +2 -2
- package/dist/{S3StateStore-F4dxw6kS.cjs.map → S3StateStore--4tYVMAL.cjs.map} +1 -1
- package/dist/{S3StateStore-pw1GhWwt.mjs → S3StateStore-B_ZF9eHt.mjs} +2 -2
- package/dist/{S3StateStore-pw1GhWwt.mjs.map → S3StateStore-B_ZF9eHt.mjs.map} +1 -1
- package/dist/{SSMStateStore-Bt9acuAF.cjs → SSMStateStore-ACZ8hRvZ.cjs} +2 -2
- package/dist/{SSMStateStore-Bt9acuAF.cjs.map → SSMStateStore-ACZ8hRvZ.cjs.map} +1 -1
- package/dist/{SSMStateStore-Dmj7zzFO.mjs → SSMStateStore-DjPuKqrm.mjs} +2 -2
- package/dist/{SSMStateStore-Dmj7zzFO.mjs.map → SSMStateStore-DjPuKqrm.mjs.map} +1 -1
- package/dist/{backup-provisioner-DIVCbfee.mjs → backup-provisioner-C8DnCmxK.mjs} +2 -2
- package/dist/backup-provisioner-C8DnCmxK.mjs.map +1 -0
- package/dist/{backup-provisioner-BmhIO_Yr.cjs → backup-provisioner-oDEsPj02.cjs} +2 -2
- package/dist/backup-provisioner-oDEsPj02.cjs.map +1 -0
- package/dist/{bundler-D_14JLZF.mjs → bundler-Bq3HaLOZ.mjs} +20 -5
- package/dist/bundler-Bq3HaLOZ.mjs.map +1 -0
- package/dist/{bundler-D6MlIfBT.cjs → bundler-pyLj-gS0.cjs} +20 -5
- package/dist/bundler-pyLj-gS0.cjs.map +1 -0
- package/dist/{cli-P56vvrDQ.mjs → cli-C2Tjbn27.mjs} +6 -5
- package/dist/cli-C2Tjbn27.mjs.map +1 -0
- package/dist/{cli-BfH1deAT.cjs → cli-DR7B2_fX.cjs} +6 -5
- package/dist/cli-DR7B2_fX.cjs.map +1 -0
- package/dist/{compose-391oEKj1.cjs → compose-5oNHAKNT.cjs} +137 -667
- package/dist/compose-5oNHAKNT.cjs.map +1 -0
- package/dist/{compose-DprE3ASm.mjs → compose-BjToENzG.mjs} +130 -569
- package/dist/compose-BjToENzG.mjs.map +1 -0
- package/dist/{config-V_X_BMpm.d.cts → config-4XFxX1al.d.cts} +3 -3
- package/dist/{config-BonvTW8p.d.mts.map → config-4XFxX1al.d.cts.map} +1 -1
- package/dist/{config-BonvTW8p.d.mts → config-UtKzhpFb.d.mts} +3 -3
- package/dist/{config-V_X_BMpm.d.cts.map → config-UtKzhpFb.d.mts.map} +1 -1
- package/dist/config.cjs +3 -3
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +3 -3
- package/dist/{credentials-Bzbg23n8.cjs → credentials-BVs7mrtw.cjs} +239 -3
- package/dist/credentials-BVs7mrtw.cjs.map +1 -0
- package/dist/{credentials-Dq1MnWQf.mjs → credentials-pAtB70k3.mjs} +223 -5
- package/dist/credentials-pAtB70k3.mjs.map +1 -0
- package/dist/databases-C2p5LGAp.cjs +419 -0
- package/dist/databases-C2p5LGAp.cjs.map +1 -0
- package/dist/databases-hUHTuwhx.mjs +346 -0
- package/dist/databases-hUHTuwhx.mjs.map +1 -0
- package/dist/deploy/public.cjs +37 -28
- package/dist/deploy/public.cjs.map +1 -1
- package/dist/deploy/public.d.cts +136 -19
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +136 -19
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +11 -11
- package/dist/deploy-BucRfbvX.cjs +511 -0
- package/dist/deploy-BucRfbvX.cjs.map +1 -0
- package/dist/deploy-DRAwTG72.mjs +488 -0
- package/dist/deploy-DRAwTG72.mjs.map +1 -0
- package/dist/{discover-LMrqsWSU.mjs → discover-BFoJWKGD.mjs} +4 -2
- package/dist/discover-BFoJWKGD.mjs.map +1 -0
- package/dist/{discover-DHdECueV.cjs → discover-OEfZ9OkA.cjs} +4 -2
- package/dist/discover-OEfZ9OkA.cjs.map +1 -0
- package/dist/dokploy-DIt1IZl1.mjs +38 -0
- package/dist/dokploy-DIt1IZl1.mjs.map +1 -0
- package/dist/dokploy-m345Zx02.cjs +38 -0
- package/dist/dokploy-m345Zx02.cjs.map +1 -0
- package/dist/{encryption-DF_hgIpl.mjs → encryption-Ccbahik7.mjs} +3 -5
- package/dist/{encryption-DF_hgIpl.mjs.map → encryption-Ccbahik7.mjs.map} +1 -1
- package/dist/{encryption-B1wJwgae.cjs → encryption-rZ3BghXy.cjs} +5 -7
- package/dist/{encryption-B1wJwgae.cjs.map → encryption-rZ3BghXy.cjs.map} +1 -1
- package/dist/{deploy-Cy8igpQF.cjs → engine-Cx_dvx9q.cjs} +1491 -1260
- package/dist/engine-Cx_dvx9q.cjs.map +1 -0
- package/dist/{deploy-CZ5nlpsu.mjs → engine-Gs0abjuj.mjs} +1450 -1261
- package/dist/engine-Gs0abjuj.mjs.map +1 -0
- package/dist/{github-B0YYE98x.mjs → github-CJANTYqi.mjs} +3 -3
- package/dist/{github-B0YYE98x.mjs.map → github-CJANTYqi.mjs.map} +1 -1
- package/dist/{github-CYcmTdFs.cjs → github-CrcGFkfD.cjs} +7 -7
- package/dist/{github-CYcmTdFs.cjs.map → github-CrcGFkfD.cjs.map} +1 -1
- package/dist/{index-DPUAGJaK.d.cts → index-CyApaHVe.d.cts} +2 -2
- package/dist/{index-DPUAGJaK.d.cts.map → index-CyApaHVe.d.cts.map} +1 -1
- package/dist/{index-DwKD_8lt.d.mts → index-DD1FfUHh.d.mts} +2 -2
- package/dist/{index-DwKD_8lt.d.mts.map → index-DD1FfUHh.d.mts.map} +1 -1
- package/dist/index.cjs +285 -91
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +258 -68
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-q4pPAXtO.cjs → migrate-CQdSpttI.cjs} +16 -16
- package/dist/{migrate-q4pPAXtO.cjs.map → migrate-CQdSpttI.cjs.map} +1 -1
- package/dist/{migrate-B2qL5wj4.mjs → migrate-DCVo5gLS.mjs} +6 -6
- package/dist/{migrate-B2qL5wj4.mjs.map → migrate-DCVo5gLS.mjs.map} +1 -1
- package/dist/openapi.cjs +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +1 -1
- package/dist/provider-B3Sv_a74.cjs +173 -0
- package/dist/provider-B3Sv_a74.cjs.map +1 -0
- package/dist/provider-D7rQzzzf.mjs +138 -0
- package/dist/provider-D7rQzzzf.mjs.map +1 -0
- package/dist/{ready-bQfu9GES.mjs → ready-2s3-CndS.mjs} +3 -3
- package/dist/{ready-bQfu9GES.mjs.map → ready-2s3-CndS.mjs.map} +1 -1
- package/dist/{ready-brEhh68f.cjs → ready-B6uHr4sm.cjs} +3 -3
- package/dist/{ready-brEhh68f.cjs.map → ready-B6uHr4sm.cjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/{resolve-N_i4XNd-.cjs → resolve-BexmDcsN.cjs} +4 -4
- package/dist/{resolve-N_i4XNd-.cjs.map → resolve-BexmDcsN.cjs.map} +1 -1
- package/dist/{resolve-DLkIXTct.mjs → resolve-DhZgtvZe.mjs} +4 -4
- package/dist/{resolve-DLkIXTct.mjs.map → resolve-DhZgtvZe.mjs.map} +1 -1
- package/dist/rollback-BnY7KuG_.cjs +161 -0
- package/dist/rollback-BnY7KuG_.cjs.map +1 -0
- package/dist/rollback-m4Yeym5x.mjs +132 -0
- package/dist/rollback-m4Yeym5x.mjs.map +1 -0
- package/dist/run-BJLIerMM.mjs +133 -0
- package/dist/run-BJLIerMM.mjs.map +1 -0
- package/dist/run-fVZ-rLnc.cjs +174 -0
- package/dist/run-fVZ-rLnc.cjs.map +1 -0
- package/dist/{runtime-BnD7Nn96.d.cts → runtime-BRqFOvPM.d.cts} +2 -2
- package/dist/{runtime-BnD7Nn96.d.cts.map → runtime-BRqFOvPM.d.cts.map} +1 -1
- package/dist/{runtime-j-tmFL65.d.mts → runtime-CEk5n4VH.d.mts} +2 -2
- package/dist/{runtime-j-tmFL65.d.mts.map → runtime-CEk5n4VH.d.mts.map} +1 -1
- package/dist/sandbox/discover-worker.cjs +1 -1
- package/dist/sandbox/discover-worker.mjs +1 -1
- package/dist/sandbox/migrate-worker.cjs +61 -0
- package/dist/sandbox/migrate-worker.cjs.map +1 -0
- package/dist/sandbox/migrate-worker.d.cts +1 -0
- package/dist/sandbox/migrate-worker.d.mts +1 -0
- package/dist/sandbox/migrate-worker.mjs +62 -0
- package/dist/sandbox/migrate-worker.mjs.map +1 -0
- package/dist/{schemas-D2LCF689.mjs → schemas-Cfhtpdo0.mjs} +10 -2
- package/dist/{schemas-Ckm_aBnF.cjs.map → schemas-Cfhtpdo0.mjs.map} +1 -1
- package/dist/{schemas-Ckm_aBnF.cjs → schemas-RUlKHu27.cjs} +15 -1
- package/dist/{schemas-D2LCF689.mjs.map → schemas-RUlKHu27.cjs.map} +1 -1
- package/dist/{sniffer-BZ-OJO4Y.mjs → sniffer-BdFeLSmA.mjs} +97 -600
- package/dist/sniffer-BdFeLSmA.mjs.map +1 -0
- package/dist/{sniffer-BSwaL-dX.cjs → sniffer-D66HIvi9.cjs} +110 -674
- package/dist/sniffer-D66HIvi9.cjs.map +1 -0
- package/dist/{sst-B2HbrDR3.mjs → sst-DRi3H5TB.mjs} +3 -3
- package/dist/{sst-B2HbrDR3.mjs.map → sst-DRi3H5TB.mjs.map} +1 -1
- package/dist/{sst-DcfsVH6x.cjs → sst-hBrKouBy.cjs} +5 -5
- package/dist/{sst-DcfsVH6x.cjs.map → sst-hBrKouBy.cjs.map} +1 -1
- package/dist/{state-DF26e_lo.cjs → state-DgmM4EKq.cjs} +2787 -1890
- package/dist/state-DgmM4EKq.cjs.map +1 -0
- package/dist/{state-B8YwmUZU.mjs → state-DkUStoqJ.mjs} +2813 -2084
- package/dist/state-DkUStoqJ.mjs.map +1 -0
- package/dist/target/public.cjs +1 -1
- package/dist/target/public.d.cts +2 -2
- package/dist/target/public.d.mts +2 -2
- package/dist/target/public.mjs +1 -1
- package/dist/{terminal-CfbiYUbZ.mjs → terminal-C3cv-OQu.mjs} +5 -5
- package/dist/{terminal-CfbiYUbZ.mjs.map → terminal-C3cv-OQu.mjs.map} +1 -1
- package/dist/{terminal-Bs5E1oxm.cjs → terminal-DjzgLu6m.cjs} +12 -16
- package/dist/{terminal-Bs5E1oxm.cjs.map → terminal-DjzgLu6m.cjs.map} +1 -1
- package/dist/{types-ByMWkXKP.d.cts → types-CSw2w69a.d.mts} +68 -10
- package/dist/types-CSw2w69a.d.mts.map +1 -0
- package/dist/{types-BCzMWBb6.d.mts → types-D5WIxRDP.d.cts} +69 -9
- package/dist/types-D5WIxRDP.d.cts.map +1 -0
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.cjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-C06_pW4g.mjs → workspace-Be6uBhlF.mjs} +10 -3
- package/dist/workspace-Be6uBhlF.mjs.map +1 -0
- package/dist/{workspace-BewAHZIo.cjs → workspace-ON-bqiJz.cjs} +10 -3
- package/dist/workspace-ON-bqiJz.cjs.map +1 -0
- package/package.json +13 -13
- package/dist/HostingerProvider-Dlmbfass.cjs.map +0 -1
- package/dist/HostingerProvider-x9gQTAGZ.mjs.map +0 -1
- package/dist/Route53Provider-Cvj40A8I.mjs.map +0 -1
- package/dist/Route53Provider-DVILBsvV.cjs.map +0 -1
- package/dist/backup-provisioner-BmhIO_Yr.cjs.map +0 -1
- package/dist/backup-provisioner-DIVCbfee.mjs.map +0 -1
- package/dist/bundler-D6MlIfBT.cjs.map +0 -1
- package/dist/bundler-D_14JLZF.mjs.map +0 -1
- package/dist/cli-BfH1deAT.cjs.map +0 -1
- package/dist/cli-P56vvrDQ.mjs.map +0 -1
- package/dist/compose-391oEKj1.cjs.map +0 -1
- package/dist/compose-DprE3ASm.mjs.map +0 -1
- package/dist/credentials-Bzbg23n8.cjs.map +0 -1
- package/dist/credentials-Dq1MnWQf.mjs.map +0 -1
- package/dist/deploy-9MBG_QLd.mjs +0 -137
- package/dist/deploy-9MBG_QLd.mjs.map +0 -1
- package/dist/deploy-B80idPUZ.cjs +0 -142
- package/dist/deploy-B80idPUZ.cjs.map +0 -1
- package/dist/deploy-CZ5nlpsu.mjs.map +0 -1
- package/dist/deploy-Cy8igpQF.cjs.map +0 -1
- package/dist/discover-DHdECueV.cjs.map +0 -1
- package/dist/discover-LMrqsWSU.mjs.map +0 -1
- package/dist/dokploy-BdtBePjp.mjs +0 -32
- package/dist/dokploy-BdtBePjp.mjs.map +0 -1
- package/dist/dokploy-iFY8MY-L.cjs +0 -32
- package/dist/dokploy-iFY8MY-L.cjs.map +0 -1
- package/dist/local-BdH4XN0E.cjs +0 -409
- package/dist/local-BdH4XN0E.cjs.map +0 -1
- package/dist/local-CWR4Y_kW.mjs +0 -350
- package/dist/local-CWR4Y_kW.mjs.map +0 -1
- package/dist/sniffer-BSwaL-dX.cjs.map +0 -1
- package/dist/sniffer-BZ-OJO4Y.mjs.map +0 -1
- package/dist/state-B8YwmUZU.mjs.map +0 -1
- package/dist/state-DF26e_lo.cjs.map +0 -1
- package/dist/storage-BzaUxmqe.mjs +0 -124
- package/dist/storage-BzaUxmqe.mjs.map +0 -1
- package/dist/storage-CSGoC3bK.cjs +0 -152
- package/dist/storage-CSGoC3bK.cjs.map +0 -1
- package/dist/store-CJF1Tqkq.cjs +0 -510
- package/dist/store-CJF1Tqkq.cjs.map +0 -1
- package/dist/store-CLiHnqOY.mjs +0 -415
- package/dist/store-CLiHnqOY.mjs.map +0 -1
- package/dist/types-BCzMWBb6.d.mts.map +0 -1
- package/dist/types-ByMWkXKP.d.cts.map +0 -1
- package/dist/workspace-BewAHZIo.cjs.map +0 -1
- package/dist/workspace-C06_pW4g.mjs.map +0 -1
|
@@ -1,207 +1,13 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const require_discover = require("./discover-DHdECueV.cjs");
|
|
2
|
+
const require_credentials = require("./credentials-BVs7mrtw.cjs");
|
|
3
|
+
const require_discover = require("./discover-OEfZ9OkA.cjs");
|
|
5
4
|
const require_sandbox = require("./sandbox-CL--ZDui.cjs");
|
|
6
|
-
const
|
|
7
|
-
const require_define = require("./define-DzRz8FgH.cjs");
|
|
8
|
-
const require_workspace = require("./workspace-BewAHZIo.cjs");
|
|
9
|
-
const require_store = require("./store-CJF1Tqkq.cjs");
|
|
10
|
-
const require_state = require("./state-DF26e_lo.cjs");
|
|
11
|
-
const require_resolve = require("./resolve-N_i4XNd-.cjs");
|
|
5
|
+
const require_workspace = require("./workspace-ON-bqiJz.cjs");
|
|
12
6
|
let node_path = require("node:path");
|
|
13
|
-
let node_process = require("node:process");
|
|
14
|
-
let node_readline_promises = require("node:readline/promises");
|
|
15
|
-
node_readline_promises = require_rolldown_runtime.__toESM(node_readline_promises, 1);
|
|
16
7
|
let node_fs = require("node:fs");
|
|
17
8
|
let node_os = require("node:os");
|
|
18
9
|
let node_url = require("node:url");
|
|
19
10
|
let node_crypto = require("node:crypto");
|
|
20
|
-
//#region src/prompt.ts
|
|
21
|
-
/**
|
|
22
|
-
* Asking the person at the terminal.
|
|
23
|
-
*
|
|
24
|
-
* CLI layer only: a command's action may prompt, nothing it calls may. A
|
|
25
|
-
* library call (`deploy()`) that needs something it was not given raises a
|
|
26
|
-
* named error instead, and the command decides whether to ask.
|
|
27
|
-
*/
|
|
28
|
-
/** A prompt was needed with no terminal to ask at. */
|
|
29
|
-
var PromptNeedsTerminal = class extends Error {
|
|
30
|
-
question;
|
|
31
|
-
instead;
|
|
32
|
-
constructor(question, instead) {
|
|
33
|
-
super(`Interactive input required. ${instead}`);
|
|
34
|
-
this.question = question;
|
|
35
|
-
this.instead = instead;
|
|
36
|
-
this.name = "PromptNeedsTerminal";
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
/** Whether there is a person at a terminal to ask. */
|
|
40
|
-
function canPrompt() {
|
|
41
|
-
return process.stdin.isTTY === true;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Ask `message` and resolve with the line typed — without echoing it when
|
|
45
|
-
* `hidden`. Ctrl+C at a hidden prompt exits, as it would anywhere else in a
|
|
46
|
-
* terminal program: raw mode has taken the signal away from the shell.
|
|
47
|
-
*/
|
|
48
|
-
async function prompt(message, options) {
|
|
49
|
-
if (!canPrompt()) throw new PromptNeedsTerminal(message, options.instead);
|
|
50
|
-
if (options.hidden) {
|
|
51
|
-
process.stdout.write(message);
|
|
52
|
-
return new Promise((resolve, reject) => {
|
|
53
|
-
let value = "";
|
|
54
|
-
const cleanup = () => {
|
|
55
|
-
process.stdin.setRawMode(false);
|
|
56
|
-
process.stdin.pause();
|
|
57
|
-
process.stdin.removeListener("data", onData);
|
|
58
|
-
process.stdin.removeListener("error", onError);
|
|
59
|
-
};
|
|
60
|
-
const onError = (err) => {
|
|
61
|
-
cleanup();
|
|
62
|
-
reject(err);
|
|
63
|
-
};
|
|
64
|
-
const onData = (char) => {
|
|
65
|
-
const c = char.toString();
|
|
66
|
-
if (c === "\n" || c === "\r") {
|
|
67
|
-
cleanup();
|
|
68
|
-
process.stdout.write("\n");
|
|
69
|
-
resolve(value);
|
|
70
|
-
} else if (c === "") {
|
|
71
|
-
cleanup();
|
|
72
|
-
process.stdout.write("\n");
|
|
73
|
-
process.exit(1);
|
|
74
|
-
} else if (c === "" || c === "\b") {
|
|
75
|
-
if (value.length > 0) value = value.slice(0, -1);
|
|
76
|
-
} else value += c;
|
|
77
|
-
};
|
|
78
|
-
process.stdin.setRawMode(true);
|
|
79
|
-
process.stdin.resume();
|
|
80
|
-
process.stdin.on("data", onData);
|
|
81
|
-
process.stdin.on("error", onError);
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
const rl = node_readline_promises.createInterface({
|
|
85
|
-
input: node_process.stdin,
|
|
86
|
-
output: node_process.stdout
|
|
87
|
-
});
|
|
88
|
-
try {
|
|
89
|
-
return await rl.question(message);
|
|
90
|
-
} finally {
|
|
91
|
-
rl.close();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
//#endregion
|
|
95
|
-
//#region src/auth/index.ts
|
|
96
|
-
const logger = console;
|
|
97
|
-
/**
|
|
98
|
-
* Validate Dokploy token by making a test API call
|
|
99
|
-
*/
|
|
100
|
-
async function validateDokployToken(endpoint, token) {
|
|
101
|
-
const { DokployApi } = await Promise.resolve().then(() => dokploy_api_exports);
|
|
102
|
-
return new DokployApi({
|
|
103
|
-
baseUrl: endpoint,
|
|
104
|
-
token
|
|
105
|
-
}).validateToken();
|
|
106
|
-
}
|
|
107
|
-
/** What answers a login prompt without a terminal. */
|
|
108
|
-
const LOGIN_INSTEAD = "Please provide --token option.";
|
|
109
|
-
/**
|
|
110
|
-
* Login to a service
|
|
111
|
-
*/
|
|
112
|
-
async function loginCommand(options) {
|
|
113
|
-
const { provider, token: providedToken, endpoint: providedEndpoint } = options;
|
|
114
|
-
if (provider === "dokploy") {
|
|
115
|
-
logger.log("\n🔐 Logging in to Dokploy...\n");
|
|
116
|
-
let endpoint = providedEndpoint;
|
|
117
|
-
if (!endpoint) endpoint = await prompt("Dokploy URL (e.g., https://dokploy.example.com): ", { instead: LOGIN_INSTEAD });
|
|
118
|
-
endpoint = endpoint.replace(/\/$/, "");
|
|
119
|
-
try {
|
|
120
|
-
new URL(endpoint);
|
|
121
|
-
} catch {
|
|
122
|
-
logger.error("Invalid URL format");
|
|
123
|
-
process.exit(1);
|
|
124
|
-
}
|
|
125
|
-
let token = providedToken;
|
|
126
|
-
if (!token) {
|
|
127
|
-
logger.log(`\nGenerate a token at: ${endpoint}/settings/profile\n`);
|
|
128
|
-
token = await prompt("API Token: ", {
|
|
129
|
-
hidden: true,
|
|
130
|
-
instead: LOGIN_INSTEAD
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
if (!token) {
|
|
134
|
-
logger.error("Token is required");
|
|
135
|
-
process.exit(1);
|
|
136
|
-
}
|
|
137
|
-
logger.log("\nValidating credentials...");
|
|
138
|
-
if (!await validateDokployToken(endpoint, token)) {
|
|
139
|
-
logger.error("\n✗ Invalid credentials. Please check your token and try again.");
|
|
140
|
-
process.exit(1);
|
|
141
|
-
}
|
|
142
|
-
await require_credentials.storeDokployCredentials(token, endpoint);
|
|
143
|
-
logger.log("\n✓ Successfully logged in to Dokploy!");
|
|
144
|
-
logger.log(` Endpoint: ${endpoint}`);
|
|
145
|
-
logger.log(` Credentials stored in: ${require_credentials.getCredentialsPath()}`);
|
|
146
|
-
logger.log("\nYou can now use deploy commands without setting DOKPLOY_API_TOKEN.");
|
|
147
|
-
}
|
|
148
|
-
if (provider === "hostinger") {
|
|
149
|
-
logger.log("\n🔐 Logging in to Hostinger...\n");
|
|
150
|
-
let token = providedToken;
|
|
151
|
-
if (!token) {
|
|
152
|
-
logger.log("\nGenerate a token at: https://hpanel.hostinger.com/profile/api\n");
|
|
153
|
-
token = await prompt("API Token: ", {
|
|
154
|
-
hidden: true,
|
|
155
|
-
instead: LOGIN_INSTEAD
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
if (!token) {
|
|
159
|
-
logger.error("Token is required");
|
|
160
|
-
process.exit(1);
|
|
161
|
-
}
|
|
162
|
-
await require_credentials.storeHostingerToken(token);
|
|
163
|
-
logger.log("\n✓ Hostinger token stored.");
|
|
164
|
-
logger.log(` Credentials stored in: ${require_credentials.getCredentialsPath()}`);
|
|
165
|
-
logger.log(" Not validated here: every DNS endpoint is scoped to a domain, so the\n first deploy that touches DNS is where a bad token reports itself.");
|
|
166
|
-
logger.log("\nYou can now use it as a DNS provider without setting HOSTINGER_API_TOKEN.");
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Logout from a service
|
|
171
|
-
*/
|
|
172
|
-
async function logoutCommand(options) {
|
|
173
|
-
const { provider = "dokploy" } = options;
|
|
174
|
-
if (provider === "all") {
|
|
175
|
-
if (await require_credentials.removeDokployCredentials()) logger.log("\n✓ Logged out from all services");
|
|
176
|
-
else logger.log("\nNo stored credentials found");
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
if (provider === "dokploy") {
|
|
180
|
-
if (await require_credentials.removeDokployCredentials()) logger.log("\n✓ Logged out from Dokploy");
|
|
181
|
-
else logger.log("\nNo Dokploy credentials found");
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Show current login status
|
|
186
|
-
*/
|
|
187
|
-
async function whoamiCommand() {
|
|
188
|
-
logger.log("\n📋 Current credentials:\n");
|
|
189
|
-
const dokploy = await require_credentials.getDokployCredentials();
|
|
190
|
-
if (dokploy) {
|
|
191
|
-
logger.log(" Dokploy:");
|
|
192
|
-
logger.log(` Endpoint: ${dokploy.endpoint}`);
|
|
193
|
-
logger.log(` Token: ${maskToken(dokploy.token)}`);
|
|
194
|
-
} else logger.log(" Dokploy: Not logged in");
|
|
195
|
-
logger.log(`\n Credentials file: ${require_credentials.getCredentialsPath()}`);
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Mask a token for display
|
|
199
|
-
*/
|
|
200
|
-
function maskToken(token) {
|
|
201
|
-
if (token.length <= 8) return "****";
|
|
202
|
-
return `${token.slice(0, 4)}...${token.slice(-4)}`;
|
|
203
|
-
}
|
|
204
|
-
//#endregion
|
|
205
11
|
//#region src/workspace/client-generator.ts
|
|
206
12
|
/**
|
|
207
13
|
* Normalize routes to an array of patterns.
|
|
@@ -213,118 +19,6 @@ function normalizeRoutes(routes) {
|
|
|
213
19
|
return Array.isArray(routes) ? routes : [routes];
|
|
214
20
|
}
|
|
215
21
|
//#endregion
|
|
216
|
-
//#region src/secrets/encryption.ts
|
|
217
|
-
var encryption_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
218
|
-
encryptSecrets: () => encryptSecrets,
|
|
219
|
-
generateDefineOptions: () => generateDefineOptions,
|
|
220
|
-
keyFingerprint: () => keyFingerprint
|
|
221
|
-
});
|
|
222
|
-
/** AES-256-GCM configuration */
|
|
223
|
-
const ALGORITHM = "aes-256-gcm";
|
|
224
|
-
const KEY_LENGTH = 32;
|
|
225
|
-
const IV_LENGTH = 12;
|
|
226
|
-
/**
|
|
227
|
-
* Encrypt secrets for embedding in a bundle.
|
|
228
|
-
* Uses AES-256-GCM with a randomly generated ephemeral key.
|
|
229
|
-
*
|
|
230
|
-
* @param secrets - Key-value pairs to encrypt
|
|
231
|
-
* @returns Encrypted payload with ephemeral master key
|
|
232
|
-
*/
|
|
233
|
-
function encryptSecrets(secrets) {
|
|
234
|
-
const masterKey = (0, node_crypto.randomBytes)(KEY_LENGTH);
|
|
235
|
-
const iv = (0, node_crypto.randomBytes)(IV_LENGTH);
|
|
236
|
-
const plaintext = JSON.stringify(secrets);
|
|
237
|
-
const cipher = (0, node_crypto.createCipheriv)(ALGORITHM, masterKey, iv);
|
|
238
|
-
const ciphertext = Buffer.concat([cipher.update(plaintext, "utf-8"), cipher.final()]);
|
|
239
|
-
const authTag = cipher.getAuthTag();
|
|
240
|
-
return {
|
|
241
|
-
encrypted: Buffer.concat([ciphertext, authTag]).toString("base64"),
|
|
242
|
-
iv: iv.toString("hex"),
|
|
243
|
-
masterKey: masterKey.toString("hex")
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Generate the define options for tsdown/esbuild.
|
|
248
|
-
* These will be injected at build time.
|
|
249
|
-
*/
|
|
250
|
-
function generateDefineOptions(payload) {
|
|
251
|
-
return {
|
|
252
|
-
__GKM_ENCRYPTED_CREDENTIALS__: JSON.stringify(payload.encrypted),
|
|
253
|
-
__GKM_CREDENTIALS_IV__: JSON.stringify(payload.iv)
|
|
254
|
-
};
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* A short, one-way name for a master key: the first 8 hex characters of its
|
|
258
|
-
* SHA-256.
|
|
259
|
-
*
|
|
260
|
-
* Printed where the key itself used to be, so a person can tell which key a
|
|
261
|
-
* build used — and match it against the one they hold — without the output
|
|
262
|
-
* carrying a value that decrypts every secret of the stage.
|
|
263
|
-
*/
|
|
264
|
-
function keyFingerprint(masterKey) {
|
|
265
|
-
return (0, node_crypto.createHash)("sha256").update(masterKey).digest("hex").slice(0, 8);
|
|
266
|
-
}
|
|
267
|
-
//#endregion
|
|
268
|
-
//#region src/target/secrets.ts
|
|
269
|
-
/**
|
|
270
|
-
* A stage's secrets as a target sees them: read and written through the
|
|
271
|
-
* stage's own store, and masked in everything the run prints once read.
|
|
272
|
-
*/
|
|
273
|
-
/**
|
|
274
|
-
* Shorter values are left alone: what a progress line legitimately prints —
|
|
275
|
-
* a port, a stage, an app name — would otherwise come out as `***` wherever
|
|
276
|
-
* a secret happened to share it.
|
|
277
|
-
*/
|
|
278
|
-
const SHORTEST_MASKED = 6;
|
|
279
|
-
/** The values a run must never print, and the rewrite that keeps it so. */
|
|
280
|
-
var Redactor = class {
|
|
281
|
-
values = /* @__PURE__ */ new Set();
|
|
282
|
-
add(value) {
|
|
283
|
-
if (value && value.length >= SHORTEST_MASKED) this.values.add(value);
|
|
284
|
-
}
|
|
285
|
-
/** `text` with every masked value replaced by `***`, longest first. */
|
|
286
|
-
redact(text) {
|
|
287
|
-
if (this.values.size === 0) return text;
|
|
288
|
-
let out = text;
|
|
289
|
-
const longestFirst = [...this.values].sort((a, b) => b.length - a.length);
|
|
290
|
-
for (const value of longestFirst) out = out.replaceAll(value, "***");
|
|
291
|
-
return out;
|
|
292
|
-
}
|
|
293
|
-
};
|
|
294
|
-
/** Every value in `secrets` that is a secret rather than a label. */
|
|
295
|
-
function secretValues(secrets) {
|
|
296
|
-
return [
|
|
297
|
-
secrets.seed,
|
|
298
|
-
...Object.values(secrets.custom ?? {}),
|
|
299
|
-
...Object.values(secrets.urls ?? {}),
|
|
300
|
-
...Object.values(secrets.services ?? {}).map((service) => service?.password)
|
|
301
|
-
].filter((value) => typeof value === "string");
|
|
302
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* The stage's secrets through the store `secrets.store` names for it. Opening
|
|
305
|
-
* one builds a client and makes no request, so a target that never reads them
|
|
306
|
-
* costs nothing.
|
|
307
|
-
*/
|
|
308
|
-
async function deploySecrets(workspace, stage, redactor, options = {}) {
|
|
309
|
-
const store = await require_store.secretsStoreFor(workspace, stage, options);
|
|
310
|
-
const mask = (secrets) => {
|
|
311
|
-
for (const value of secretValues(secrets)) redactor.add(value);
|
|
312
|
-
};
|
|
313
|
-
return {
|
|
314
|
-
store: store.name,
|
|
315
|
-
async read() {
|
|
316
|
-
const secrets = await store.read(stage);
|
|
317
|
-
if (secrets) mask(secrets);
|
|
318
|
-
return secrets;
|
|
319
|
-
},
|
|
320
|
-
async write(secrets) {
|
|
321
|
-
mask(secrets);
|
|
322
|
-
await store.write(stage, secrets);
|
|
323
|
-
},
|
|
324
|
-
mask: (value) => redactor.add(value)
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
//#endregion
|
|
328
22
|
//#region src/deploy/events.ts
|
|
329
23
|
/** An error as an event carries it: its name and message, nothing else. */
|
|
330
24
|
function eventError(error) {
|
|
@@ -659,17 +353,17 @@ function isStateStore(value) {
|
|
|
659
353
|
async function createStateStore(options) {
|
|
660
354
|
const { config, workspaceRoot, workspaceName } = options;
|
|
661
355
|
if (!config || config.provider === "local") {
|
|
662
|
-
const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-
|
|
356
|
+
const { LocalStateStore } = await Promise.resolve().then(() => require("./LocalStateStore-DHVsZLyF.cjs")).then((n) => n.LocalStateStore_exports);
|
|
663
357
|
return new LocalStateStore(workspaceRoot);
|
|
664
358
|
}
|
|
665
359
|
if (isStateStore(config.provider)) return config.provider;
|
|
666
360
|
if (isStateProvider(config.provider)) {
|
|
667
|
-
const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-
|
|
361
|
+
const { LegacyStateStore } = await Promise.resolve().then(() => require("./LegacyStateStore-BZiO9-Lw.cjs"));
|
|
668
362
|
return new LegacyStateStore(config.provider, { warn: options.warn });
|
|
669
363
|
}
|
|
670
364
|
if (config.provider === "ssm") {
|
|
671
365
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("ssm");
|
|
672
|
-
const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-
|
|
366
|
+
const { SSMStateStore } = await Promise.resolve().then(() => require("./SSMStateStore-ACZ8hRvZ.cjs"));
|
|
673
367
|
const ssm = config;
|
|
674
368
|
return SSMStateStore.create({
|
|
675
369
|
workspaceName,
|
|
@@ -679,7 +373,7 @@ async function createStateStore(options) {
|
|
|
679
373
|
}
|
|
680
374
|
if (config.provider === "s3") {
|
|
681
375
|
if (!workspaceName) throw new StateStoreNeedsWorkspaceName("s3");
|
|
682
|
-
const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore
|
|
376
|
+
const { S3StateStore } = await Promise.resolve().then(() => require("./S3StateStore--4tYVMAL.cjs"));
|
|
683
377
|
const s3 = config;
|
|
684
378
|
return S3StateStore.create({
|
|
685
379
|
workspaceName,
|
|
@@ -692,293 +386,12 @@ async function createStateStore(options) {
|
|
|
692
386
|
throw new UnknownStateProvider(config);
|
|
693
387
|
}
|
|
694
388
|
//#endregion
|
|
695
|
-
//#region src/
|
|
696
|
-
/**
|
|
697
|
-
* The run around a target: what every deploy does whatever it deploys
|
|
698
|
-
* through.
|
|
699
|
-
*
|
|
700
|
-
* It loads the workspace, resolves the target, works out the apps and the
|
|
701
|
-
* identity, takes the stage's lock, and calls the target's phases in order,
|
|
702
|
-
* reporting each as it starts, finishes or fails. Everything that is about
|
|
703
|
-
* *where* the stage goes is the target's.
|
|
704
|
-
*/
|
|
705
|
-
/** Apps were asked for by name that the workspace does not have. */
|
|
706
|
-
var UnknownDeployApps = class extends Error {
|
|
707
|
-
apps;
|
|
708
|
-
available;
|
|
709
|
-
constructor(apps, available) {
|
|
710
|
-
super(`Unknown apps: ${apps.join(", ")}\nAvailable apps: ${available.join(", ")}`);
|
|
711
|
-
this.apps = apps;
|
|
712
|
-
this.available = available;
|
|
713
|
-
this.name = "UnknownDeployApps";
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
/** Every app asked for deploys through some other target. */
|
|
717
|
-
var NoDeployableApps = class extends Error {
|
|
718
|
-
stage;
|
|
719
|
-
target;
|
|
720
|
-
constructor(stage, target) {
|
|
721
|
-
super(`No apps to deploy through "${target}": every selected app deploys somewhere else. Pick the target with --target, or set each app's deploy in gkm.config.ts.`);
|
|
722
|
-
this.stage = stage;
|
|
723
|
-
this.target = target;
|
|
724
|
-
this.name = "NoDeployableApps";
|
|
725
|
-
}
|
|
726
|
-
};
|
|
727
|
-
/** A failed rollback, after the failure that called for it. */
|
|
728
|
-
var RollbackFailed = class extends Error {
|
|
729
|
-
target;
|
|
730
|
-
failure;
|
|
731
|
-
constructor(target, failure, cause) {
|
|
732
|
-
super(`Deploying through "${target}" failed, and so did rolling it back: ${cause instanceof Error ? cause.message : String(cause)}. The stage may be part-released; deploy again, or roll it back by hand. The first failure: ${failure instanceof Error ? failure.message : String(failure)}`, { cause });
|
|
733
|
-
this.target = target;
|
|
734
|
-
this.failure = failure;
|
|
735
|
-
this.name = "RollbackFailed";
|
|
736
|
-
}
|
|
737
|
-
};
|
|
738
|
-
/**
|
|
739
|
-
* Generate image tag from stage and timestamp
|
|
740
|
-
*/
|
|
741
|
-
function generateTag(stage) {
|
|
742
|
-
return `${stage}-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19)}`;
|
|
743
|
-
}
|
|
744
|
-
/** Why an app that deploys through another target is left out. */
|
|
745
|
-
function elsewhere(target, stage) {
|
|
746
|
-
const instead = require_define.builtinTarget(target)?.instead?.(stage);
|
|
747
|
-
if (instead) return `it deploys through "${target}" — ${instead}`;
|
|
748
|
-
return `it deploys through "${target}" — run \`gkm deploy --target ${target} --stage ${stage}\``;
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Deploy a workspace's stage through its target.
|
|
752
|
-
*
|
|
753
|
-
* The engine under `deploy()` and `gkm deploy`. It never prompts and never
|
|
754
|
-
* exits: credentials come from `ctx.credentials`, progress goes to
|
|
755
|
-
* `ctx.emit` and to `output`, and every failure is thrown.
|
|
756
|
-
*
|
|
757
|
-
* @internal
|
|
758
|
-
*/
|
|
759
|
-
async function runDeploy(source, request, ctx) {
|
|
760
|
-
const { stage } = request;
|
|
761
|
-
const redactor = ctx.redactor ?? new Redactor();
|
|
762
|
-
const emit = (event) => ctx.emit(event.type === "log" ? {
|
|
763
|
-
...event,
|
|
764
|
-
message: redactor.redact(event.message)
|
|
765
|
-
} : event);
|
|
766
|
-
/** Run one phase between its events. */
|
|
767
|
-
const phase = async (name, body) => {
|
|
768
|
-
ctx.signal?.throwIfAborted();
|
|
769
|
-
emit({
|
|
770
|
-
type: "phase.started",
|
|
771
|
-
phase: name
|
|
772
|
-
});
|
|
773
|
-
try {
|
|
774
|
-
const value = await body();
|
|
775
|
-
emit({
|
|
776
|
-
type: "phase.finished",
|
|
777
|
-
phase: name
|
|
778
|
-
});
|
|
779
|
-
return value;
|
|
780
|
-
} catch (error) {
|
|
781
|
-
emit({
|
|
782
|
-
type: "phase.failed",
|
|
783
|
-
phase: name,
|
|
784
|
-
error: eventError(error)
|
|
785
|
-
});
|
|
786
|
-
throw error;
|
|
787
|
-
}
|
|
788
|
-
};
|
|
789
|
-
ctx.signal?.throwIfAborted();
|
|
790
|
-
emit({
|
|
791
|
-
type: "phase.started",
|
|
792
|
-
phase: "validate"
|
|
793
|
-
});
|
|
794
|
-
let prepared;
|
|
795
|
-
try {
|
|
796
|
-
prepared = await prepare(source, request, ctx, emit, redactor);
|
|
797
|
-
} catch (error) {
|
|
798
|
-
emit({
|
|
799
|
-
type: "phase.failed",
|
|
800
|
-
phase: "validate",
|
|
801
|
-
error: eventError(error)
|
|
802
|
-
});
|
|
803
|
-
throw error;
|
|
804
|
-
}
|
|
805
|
-
const { resolved, phaseCtx, store } = prepared;
|
|
806
|
-
const { target } = resolved;
|
|
807
|
-
if (ctx.dryRun) {
|
|
808
|
-
const run = await validate(target, phaseCtx, emit);
|
|
809
|
-
await phase("plan", () => target.plan(phaseCtx, run));
|
|
810
|
-
return target.result(phaseCtx, run);
|
|
811
|
-
}
|
|
812
|
-
let lock;
|
|
813
|
-
try {
|
|
814
|
-
lock = await store.lock(stage, { operation: "deploy" });
|
|
815
|
-
} catch (error) {
|
|
816
|
-
emit({
|
|
817
|
-
type: "phase.failed",
|
|
818
|
-
phase: "validate",
|
|
819
|
-
error: eventError(error)
|
|
820
|
-
});
|
|
821
|
-
throw error;
|
|
822
|
-
}
|
|
823
|
-
try {
|
|
824
|
-
const run = await validate(target, phaseCtx, emit);
|
|
825
|
-
if (target.provision) await phase("provision", () => target.provision(phaseCtx, run));
|
|
826
|
-
if (target.build) await phase("build", () => target.build(phaseCtx, run));
|
|
827
|
-
let releasing = "release";
|
|
828
|
-
try {
|
|
829
|
-
await phase("release", () => target.release(phaseCtx, run));
|
|
830
|
-
releasing = "verify";
|
|
831
|
-
if (target.verify) await phase("verify", () => target.verify(phaseCtx, run));
|
|
832
|
-
} catch (error) {
|
|
833
|
-
if (ctx.signal?.aborted || !target.capabilities.rollback) throw error;
|
|
834
|
-
if (!target.rollback) throw error;
|
|
835
|
-
try {
|
|
836
|
-
await phase("rollback", () => target.rollback(phaseCtx, run, {
|
|
837
|
-
phase: releasing,
|
|
838
|
-
error
|
|
839
|
-
}));
|
|
840
|
-
} catch (rollbackError) {
|
|
841
|
-
throw new RollbackFailed(resolved.name, error, rollbackError);
|
|
842
|
-
}
|
|
843
|
-
throw error;
|
|
844
|
-
}
|
|
845
|
-
return await target.result(phaseCtx, run);
|
|
846
|
-
} finally {
|
|
847
|
-
await lock.release();
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
/** `validate`, then the run's `deploy.started`, inside the validate phase. */
|
|
851
|
-
async function validate(target, phaseCtx, emit) {
|
|
852
|
-
try {
|
|
853
|
-
const run = await target.validate(phaseCtx);
|
|
854
|
-
const skipped = new Set(phaseCtx.skipped.map((s) => s.app));
|
|
855
|
-
emit({
|
|
856
|
-
type: "deploy.started",
|
|
857
|
-
stage: phaseCtx.stage,
|
|
858
|
-
target: phaseCtx.target,
|
|
859
|
-
identity: phaseCtx.identity.key,
|
|
860
|
-
tag: phaseCtx.tag,
|
|
861
|
-
apps: phaseCtx.apps.filter((app) => !skipped.has(app)),
|
|
862
|
-
dryRun: phaseCtx.dryRun
|
|
863
|
-
});
|
|
864
|
-
emit({
|
|
865
|
-
type: "phase.finished",
|
|
866
|
-
phase: "validate"
|
|
867
|
-
});
|
|
868
|
-
return run;
|
|
869
|
-
} catch (error) {
|
|
870
|
-
emit({
|
|
871
|
-
type: "phase.failed",
|
|
872
|
-
phase: "validate",
|
|
873
|
-
error: eventError(error)
|
|
874
|
-
});
|
|
875
|
-
throw error;
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
/** Everything the phases are handed, worked out before the first of them. */
|
|
879
|
-
async function prepare(source, request, ctx, emit, redactor) {
|
|
880
|
-
const { stage } = request;
|
|
881
|
-
const configured = typeof source === "function" ? await source() : source;
|
|
882
|
-
const local = stage === configured.stages.local;
|
|
883
|
-
if (!local) require_workspace.assertDeployedStage(configured.stages, stage);
|
|
884
|
-
const targetName = request.target ?? configured.deploy?.default ?? "dokploy";
|
|
885
|
-
const resolved = await require_resolve.resolveTarget(targetName, {
|
|
886
|
-
workspace: configured,
|
|
887
|
-
stage,
|
|
888
|
-
...ctx.targets ? { host: ctx.targets } : {}
|
|
889
|
-
});
|
|
890
|
-
if (local && !resolved.target.capabilities.localStage) require_workspace.assertDeployedStage(configured.stages, stage);
|
|
891
|
-
const options = await require_resolve.parseTargetOptions(resolved);
|
|
892
|
-
const manifest = await require_discover.discover({
|
|
893
|
-
patterns: require_state.constructGlobs(configured),
|
|
894
|
-
cwd: configured.root
|
|
895
|
-
});
|
|
896
|
-
const units = require_derive.derivedApps(manifest, configured);
|
|
897
|
-
const workspace = Object.keys(units).length > 0 ? {
|
|
898
|
-
...configured,
|
|
899
|
-
apps: units
|
|
900
|
-
} : configured;
|
|
901
|
-
const identity = require_store.deployIdentity(workspace, stage);
|
|
902
|
-
const tag = request.tag ?? (resolved.target.tag ? await resolved.target.tag({
|
|
903
|
-
cwd: workspace.root,
|
|
904
|
-
stage
|
|
905
|
-
}) : generateTag(stage));
|
|
906
|
-
const buildOrder = require_workspace.getAppBuildOrder(workspace);
|
|
907
|
-
let selected = buildOrder;
|
|
908
|
-
if (request.apps && request.apps.length > 0) {
|
|
909
|
-
const unknown = request.apps.filter((name) => !workspace.apps[name]);
|
|
910
|
-
if (unknown.length > 0) throw new UnknownDeployApps(unknown, Object.keys(workspace.apps));
|
|
911
|
-
selected = buildOrder.filter((name) => request.apps.includes(name));
|
|
912
|
-
}
|
|
913
|
-
const skipped = [];
|
|
914
|
-
const skip = (app, reason) => {
|
|
915
|
-
skipped.push({
|
|
916
|
-
app,
|
|
917
|
-
reason
|
|
918
|
-
});
|
|
919
|
-
emit({
|
|
920
|
-
type: "app.skipped",
|
|
921
|
-
app,
|
|
922
|
-
reason
|
|
923
|
-
});
|
|
924
|
-
};
|
|
925
|
-
const byDefault = configured.deploy?.default ?? "dokploy";
|
|
926
|
-
const apps = selected.filter((name) => {
|
|
927
|
-
const own = workspace.apps[name].resolvedDeployTarget;
|
|
928
|
-
const deploysThrough = own === byDefault ? targetName : own;
|
|
929
|
-
if (deploysThrough === targetName) return true;
|
|
930
|
-
skip(name, elsewhere(deploysThrough, stage));
|
|
931
|
-
return false;
|
|
932
|
-
});
|
|
933
|
-
if (apps.length === 0) throw new NoDeployableApps(stage, targetName);
|
|
934
|
-
const store = await createStateStore({
|
|
935
|
-
config: workspace.state,
|
|
936
|
-
workspaceRoot: workspace.root,
|
|
937
|
-
workspaceName: workspace.name
|
|
938
|
-
});
|
|
939
|
-
const secrets = await deploySecrets(workspace, stage, redactor, { ...ctx.home ? { home: ctx.home } : {} });
|
|
940
|
-
const line = (level) => (message) => emit({
|
|
941
|
-
type: "log",
|
|
942
|
-
level,
|
|
943
|
-
message
|
|
944
|
-
});
|
|
945
|
-
const logger = {
|
|
946
|
-
info: line("info"),
|
|
947
|
-
warn: line("warn"),
|
|
948
|
-
error: line("error")
|
|
949
|
-
};
|
|
950
|
-
return {
|
|
951
|
-
resolved,
|
|
952
|
-
phaseCtx: {
|
|
953
|
-
target: targetName,
|
|
954
|
-
cwd: workspace.root,
|
|
955
|
-
stage,
|
|
956
|
-
tag,
|
|
957
|
-
tagGiven: request.tag !== void 0,
|
|
958
|
-
apps,
|
|
959
|
-
skipped,
|
|
960
|
-
identity,
|
|
961
|
-
workspace,
|
|
962
|
-
manifest,
|
|
963
|
-
options,
|
|
964
|
-
dryRun: ctx.dryRun,
|
|
965
|
-
credentials: ctx.credentials,
|
|
966
|
-
state: store,
|
|
967
|
-
secrets,
|
|
968
|
-
logger,
|
|
969
|
-
signal: ctx.signal ?? new AbortController().signal,
|
|
970
|
-
childOutput: ctx.childOutput ?? "inherit",
|
|
971
|
-
emit,
|
|
972
|
-
skip,
|
|
973
|
-
name: (resource) => require_store.applicationName(identity, resource)
|
|
974
|
-
},
|
|
975
|
-
store
|
|
976
|
-
};
|
|
977
|
-
}
|
|
978
|
-
//#endregion
|
|
979
|
-
//#region src/deploy/dokploy-api.ts
|
|
389
|
+
//#region src/target/dokploy/dokploy-api.ts
|
|
980
390
|
var dokploy_api_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
391
|
+
DEFAULT_DEPLOYMENT_TIMEOUT_MS: () => DEFAULT_DEPLOYMENT_TIMEOUT_MS,
|
|
981
392
|
DEFAULT_DOKPLOY_TIMEOUT_MS: () => DEFAULT_DOKPLOY_TIMEOUT_MS,
|
|
393
|
+
DeploymentFailed: () => DeploymentFailed,
|
|
394
|
+
DeploymentTimedOut: () => DeploymentTimedOut,
|
|
982
395
|
DokployApi: () => DokployApi,
|
|
983
396
|
DokployApiError: () => DokployApiError,
|
|
984
397
|
DokployRequestTimedOut: () => DokployRequestTimedOut
|
|
@@ -1025,6 +438,32 @@ function pause(ms, signal) {
|
|
|
1025
438
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1026
439
|
});
|
|
1027
440
|
}
|
|
441
|
+
/** How long a deployment may take to finish before a deploy gives up on it. */
|
|
442
|
+
const DEFAULT_DEPLOYMENT_TIMEOUT_MS = 6e5;
|
|
443
|
+
/** A deployment Dokploy ran and reported as failed. */
|
|
444
|
+
var DeploymentFailed = class extends Error {
|
|
445
|
+
applicationId;
|
|
446
|
+
deployment;
|
|
447
|
+
constructor(applicationId, deployment) {
|
|
448
|
+
super(`Dokploy's deployment ${deployment.deploymentId} of application ${applicationId} ended in "${deployment.status}"${deployment.errorMessage ? `: ${deployment.errorMessage}` : ""}. Its log in Dokploy says why — usually an image the server could not pull, or a container that exited on start.`);
|
|
449
|
+
this.applicationId = applicationId;
|
|
450
|
+
this.deployment = deployment;
|
|
451
|
+
this.name = "DeploymentFailed";
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
/** A deployment that had not finished when the deploy stopped waiting. */
|
|
455
|
+
var DeploymentTimedOut = class extends Error {
|
|
456
|
+
applicationId;
|
|
457
|
+
timeoutMs;
|
|
458
|
+
lastStatus;
|
|
459
|
+
constructor(applicationId, timeoutMs, lastStatus) {
|
|
460
|
+
super(`Application ${applicationId} did not finish deploying within ${Math.round(timeoutMs / 1e3)}s (${lastStatus ? `last status "${lastStatus}"` : "no deployment started"}). Check its deployment log in Dokploy, or raise deploy.dokploy.verify.deploymentTimeoutMs for an image that is slow to pull.`);
|
|
461
|
+
this.applicationId = applicationId;
|
|
462
|
+
this.timeoutMs = timeoutMs;
|
|
463
|
+
this.lastStatus = lastStatus;
|
|
464
|
+
this.name = "DeploymentTimedOut";
|
|
465
|
+
}
|
|
466
|
+
};
|
|
1028
467
|
var DokployApiError = class extends Error {
|
|
1029
468
|
status;
|
|
1030
469
|
statusText;
|
|
@@ -1332,6 +771,63 @@ var DokployApi = class {
|
|
|
1332
771
|
await this.post("application.deploy", { applicationId });
|
|
1333
772
|
}
|
|
1334
773
|
/**
|
|
774
|
+
* An application's deployments, newest first.
|
|
775
|
+
*
|
|
776
|
+
* Sorted here rather than trusted to arrive sorted: which deployment is
|
|
777
|
+
* the latest is the whole question `waitForDeployment` asks.
|
|
778
|
+
*/
|
|
779
|
+
async listDeployments(applicationId) {
|
|
780
|
+
return [...await this.get(`deployment.all?applicationId=${encodeURIComponent(applicationId)}`)].sort((a, b) => Date.parse(b.createdAt) - Date.parse(a.createdAt));
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* When the application's latest deployment was created, by Dokploy's own
|
|
784
|
+
* clock — what `waitForDeployment`'s `since` is measured against. Epoch
|
|
785
|
+
* when it has none.
|
|
786
|
+
*/
|
|
787
|
+
async latestDeploymentAt(applicationId) {
|
|
788
|
+
const [latest] = await this.listDeployments(applicationId);
|
|
789
|
+
return new Date(latest ? Date.parse(latest.createdAt) : 0);
|
|
790
|
+
}
|
|
791
|
+
/**
|
|
792
|
+
* Wait for the deployment `application.deploy` queued to finish.
|
|
793
|
+
*
|
|
794
|
+
* `application.deploy` only queues one: it answers before the image is
|
|
795
|
+
* pulled, let alone running, so a deploy that stopped there reported
|
|
796
|
+
* success for containers that had not started. This polls the latest
|
|
797
|
+
* deployment created after `since` — Dokploy's clock, from
|
|
798
|
+
* `latestDeploymentAt` before deploying, so a laptop's skew cannot pick an
|
|
799
|
+
* older one — and the application's own status, backing off from
|
|
800
|
+
* `intervalMs` to `maxIntervalMs`.
|
|
801
|
+
*
|
|
802
|
+
* @throws {DeploymentFailed} when the deployment ends in `error` or is
|
|
803
|
+
* cancelled, or the application reports `error` once it has finished.
|
|
804
|
+
* @throws {DeploymentTimedOut} when it has not finished within `timeoutMs`.
|
|
805
|
+
*/
|
|
806
|
+
async waitForDeployment(applicationId, options) {
|
|
807
|
+
const { since, timeoutMs = DEFAULT_DEPLOYMENT_TIMEOUT_MS, signal, intervalMs = 2e3, maxIntervalMs = 15e3 } = options;
|
|
808
|
+
const after = since.getTime();
|
|
809
|
+
const deadline = Date.now() + timeoutMs;
|
|
810
|
+
let interval = intervalMs;
|
|
811
|
+
let last;
|
|
812
|
+
while (true) {
|
|
813
|
+
signal?.throwIfAborted();
|
|
814
|
+
const deployment = (await this.listDeployments(applicationId)).find((d) => Date.parse(d.createdAt) > after);
|
|
815
|
+
last = deployment ?? last;
|
|
816
|
+
if (deployment) {
|
|
817
|
+
if (deployment.status === "error" || deployment.status === "cancelled") throw new DeploymentFailed(applicationId, deployment);
|
|
818
|
+
if (deployment.status === "done") {
|
|
819
|
+
const { applicationStatus } = await this.get(`application.one?applicationId=${encodeURIComponent(applicationId)}`);
|
|
820
|
+
if (applicationStatus === "error") throw new DeploymentFailed(applicationId, deployment);
|
|
821
|
+
if (applicationStatus !== "running") return deployment;
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
const left = deadline - Date.now();
|
|
825
|
+
if (left <= 0) throw new DeploymentTimedOut(applicationId, timeoutMs, last?.status);
|
|
826
|
+
await pause(Math.min(interval, left), signal);
|
|
827
|
+
interval = Math.min(interval * 2, maxIntervalMs);
|
|
828
|
+
}
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
1335
831
|
* Delete an application
|
|
1336
832
|
*/
|
|
1337
833
|
async deleteApplication(applicationId) {
|
|
@@ -1793,7 +1289,7 @@ function resolveSnifferFile(baseName) {
|
|
|
1793
1289
|
* comes back as the error the caller reports.
|
|
1794
1290
|
*/
|
|
1795
1291
|
async function runSniffer(run, workspacePath, cwd, nodeArgs) {
|
|
1796
|
-
const sandbox = run.sandbox ?? require_sandbox.activeSandbox() ?? new
|
|
1292
|
+
const sandbox = run.sandbox ?? require_sandbox.activeSandbox() ?? new require_credentials.LocalSandbox({ root: (0, node_path.resolve)(workspacePath) });
|
|
1797
1293
|
try {
|
|
1798
1294
|
const result = await sandbox.exec("node", nodeArgs, {
|
|
1799
1295
|
cwd,
|
|
@@ -2064,40 +1560,40 @@ async function sniffAllApps(apps, workspacePath, options = {}) {
|
|
|
2064
1560
|
return results;
|
|
2065
1561
|
}
|
|
2066
1562
|
//#endregion
|
|
2067
|
-
Object.defineProperty(exports, "
|
|
1563
|
+
Object.defineProperty(exports, "DEFAULT_DEPLOYMENT_TIMEOUT_MS", {
|
|
2068
1564
|
enumerable: true,
|
|
2069
1565
|
get: function() {
|
|
2070
|
-
return
|
|
1566
|
+
return DEFAULT_DEPLOYMENT_TIMEOUT_MS;
|
|
2071
1567
|
}
|
|
2072
1568
|
});
|
|
2073
|
-
Object.defineProperty(exports, "
|
|
1569
|
+
Object.defineProperty(exports, "DeploymentFailed", {
|
|
2074
1570
|
enumerable: true,
|
|
2075
1571
|
get: function() {
|
|
2076
|
-
return
|
|
1572
|
+
return DeploymentFailed;
|
|
2077
1573
|
}
|
|
2078
1574
|
});
|
|
2079
|
-
Object.defineProperty(exports, "
|
|
1575
|
+
Object.defineProperty(exports, "DeploymentTimedOut", {
|
|
2080
1576
|
enumerable: true,
|
|
2081
1577
|
get: function() {
|
|
2082
|
-
return
|
|
1578
|
+
return DeploymentTimedOut;
|
|
2083
1579
|
}
|
|
2084
1580
|
});
|
|
2085
|
-
Object.defineProperty(exports, "
|
|
1581
|
+
Object.defineProperty(exports, "DocumentStateStore", {
|
|
2086
1582
|
enumerable: true,
|
|
2087
1583
|
get: function() {
|
|
2088
|
-
return
|
|
1584
|
+
return DocumentStateStore;
|
|
2089
1585
|
}
|
|
2090
1586
|
});
|
|
2091
|
-
Object.defineProperty(exports, "
|
|
1587
|
+
Object.defineProperty(exports, "DokployApi", {
|
|
2092
1588
|
enumerable: true,
|
|
2093
1589
|
get: function() {
|
|
2094
|
-
return
|
|
1590
|
+
return DokployApi;
|
|
2095
1591
|
}
|
|
2096
1592
|
});
|
|
2097
|
-
Object.defineProperty(exports, "
|
|
1593
|
+
Object.defineProperty(exports, "DokployApiError", {
|
|
2098
1594
|
enumerable: true,
|
|
2099
1595
|
get: function() {
|
|
2100
|
-
return
|
|
1596
|
+
return DokployApiError;
|
|
2101
1597
|
}
|
|
2102
1598
|
});
|
|
2103
1599
|
Object.defineProperty(exports, "StageStateMissing", {
|
|
@@ -2130,18 +1626,6 @@ Object.defineProperty(exports, "StateVersionConflict", {
|
|
|
2130
1626
|
return StateVersionConflict;
|
|
2131
1627
|
}
|
|
2132
1628
|
});
|
|
2133
|
-
Object.defineProperty(exports, "UnknownDeployApps", {
|
|
2134
|
-
enumerable: true,
|
|
2135
|
-
get: function() {
|
|
2136
|
-
return UnknownDeployApps;
|
|
2137
|
-
}
|
|
2138
|
-
});
|
|
2139
|
-
Object.defineProperty(exports, "canPrompt", {
|
|
2140
|
-
enumerable: true,
|
|
2141
|
-
get: function() {
|
|
2142
|
-
return canPrompt;
|
|
2143
|
-
}
|
|
2144
|
-
});
|
|
2145
1629
|
Object.defineProperty(exports, "contentVersion", {
|
|
2146
1630
|
enumerable: true,
|
|
2147
1631
|
get: function() {
|
|
@@ -2154,16 +1638,10 @@ Object.defineProperty(exports, "createStateStore", {
|
|
|
2154
1638
|
return createStateStore;
|
|
2155
1639
|
}
|
|
2156
1640
|
});
|
|
2157
|
-
Object.defineProperty(exports, "
|
|
1641
|
+
Object.defineProperty(exports, "dokploy_api_exports", {
|
|
2158
1642
|
enumerable: true,
|
|
2159
1643
|
get: function() {
|
|
2160
|
-
return
|
|
2161
|
-
}
|
|
2162
|
-
});
|
|
2163
|
-
Object.defineProperty(exports, "encryption_exports", {
|
|
2164
|
-
enumerable: true,
|
|
2165
|
-
get: function() {
|
|
2166
|
-
return encryption_exports;
|
|
1644
|
+
return dokploy_api_exports;
|
|
2167
1645
|
}
|
|
2168
1646
|
});
|
|
2169
1647
|
Object.defineProperty(exports, "eventError", {
|
|
@@ -2172,42 +1650,12 @@ Object.defineProperty(exports, "eventError", {
|
|
|
2172
1650
|
return eventError;
|
|
2173
1651
|
}
|
|
2174
1652
|
});
|
|
2175
|
-
Object.defineProperty(exports, "keyFingerprint", {
|
|
2176
|
-
enumerable: true,
|
|
2177
|
-
get: function() {
|
|
2178
|
-
return keyFingerprint;
|
|
2179
|
-
}
|
|
2180
|
-
});
|
|
2181
|
-
Object.defineProperty(exports, "loginCommand", {
|
|
2182
|
-
enumerable: true,
|
|
2183
|
-
get: function() {
|
|
2184
|
-
return loginCommand;
|
|
2185
|
-
}
|
|
2186
|
-
});
|
|
2187
|
-
Object.defineProperty(exports, "logoutCommand", {
|
|
2188
|
-
enumerable: true,
|
|
2189
|
-
get: function() {
|
|
2190
|
-
return logoutCommand;
|
|
2191
|
-
}
|
|
2192
|
-
});
|
|
2193
1653
|
Object.defineProperty(exports, "newLockHolder", {
|
|
2194
1654
|
enumerable: true,
|
|
2195
1655
|
get: function() {
|
|
2196
1656
|
return newLockHolder;
|
|
2197
1657
|
}
|
|
2198
1658
|
});
|
|
2199
|
-
Object.defineProperty(exports, "prompt", {
|
|
2200
|
-
enumerable: true,
|
|
2201
|
-
get: function() {
|
|
2202
|
-
return prompt;
|
|
2203
|
-
}
|
|
2204
|
-
});
|
|
2205
|
-
Object.defineProperty(exports, "runDeploy", {
|
|
2206
|
-
enumerable: true,
|
|
2207
|
-
get: function() {
|
|
2208
|
-
return runDeploy;
|
|
2209
|
-
}
|
|
2210
|
-
});
|
|
2211
1659
|
Object.defineProperty(exports, "sniffAllApps", {
|
|
2212
1660
|
enumerable: true,
|
|
2213
1661
|
get: function() {
|
|
@@ -2220,17 +1668,5 @@ Object.defineProperty(exports, "sniffAppEnvironment", {
|
|
|
2220
1668
|
return sniffAppEnvironment;
|
|
2221
1669
|
}
|
|
2222
1670
|
});
|
|
2223
|
-
Object.defineProperty(exports, "validateDokployToken", {
|
|
2224
|
-
enumerable: true,
|
|
2225
|
-
get: function() {
|
|
2226
|
-
return validateDokployToken;
|
|
2227
|
-
}
|
|
2228
|
-
});
|
|
2229
|
-
Object.defineProperty(exports, "whoamiCommand", {
|
|
2230
|
-
enumerable: true,
|
|
2231
|
-
get: function() {
|
|
2232
|
-
return whoamiCommand;
|
|
2233
|
-
}
|
|
2234
|
-
});
|
|
2235
1671
|
|
|
2236
|
-
//# sourceMappingURL=sniffer-
|
|
1672
|
+
//# sourceMappingURL=sniffer-D66HIvi9.cjs.map
|