@geekmidas/cli 10.0.0-alpha.60 → 10.0.0-alpha.62
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/{HostingerProvider-DgzKa_Tj.mjs → HostingerProvider-B92qH4dC.mjs} +2 -2
- package/dist/{HostingerProvider-DgzKa_Tj.mjs.map → HostingerProvider-B92qH4dC.mjs.map} +1 -1
- package/dist/{HostingerProvider-BTZd2u0f.cjs → HostingerProvider-DyD1Hin8.cjs} +2 -2
- package/dist/{HostingerProvider-BTZd2u0f.cjs.map → HostingerProvider-DyD1Hin8.cjs.map} +1 -1
- package/dist/{LegacyStateStore-CToa2hga.mjs → LegacyStateStore-A8d2GdT7.mjs} +2 -2
- package/dist/{LegacyStateStore-CToa2hga.mjs.map → LegacyStateStore-A8d2GdT7.mjs.map} +1 -1
- package/dist/{LegacyStateStore-CidlPT0N.cjs → LegacyStateStore-UHJEBLdn.cjs} +2 -2
- package/dist/{LegacyStateStore-CidlPT0N.cjs.map → LegacyStateStore-UHJEBLdn.cjs.map} +1 -1
- package/dist/{LocalStateStore-BFLiOocU.mjs → LocalStateStore-B51rnfgn.mjs} +2 -2
- package/dist/{LocalStateStore-BFLiOocU.mjs.map → LocalStateStore-B51rnfgn.mjs.map} +1 -1
- package/dist/{LocalStateStore-Dpuqka1N.cjs → LocalStateStore-COW3Ldwa.cjs} +2 -2
- package/dist/{LocalStateStore-Dpuqka1N.cjs.map → LocalStateStore-COW3Ldwa.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-BTuUumsV.cjs → OpenApiTsGenerator-BSrgw7B0.cjs} +31 -2
- package/dist/OpenApiTsGenerator-BSrgw7B0.cjs.map +1 -0
- package/dist/{OpenApiTsGenerator-CvVr1Ilz.mjs → OpenApiTsGenerator-q5B0z8Xg.mjs} +31 -2
- package/dist/OpenApiTsGenerator-q5B0z8Xg.mjs.map +1 -0
- package/dist/{S3StateStore-aaGkjcxO.mjs → S3StateStore-CJewPhgz.mjs} +2 -2
- package/dist/{S3StateStore-aaGkjcxO.mjs.map → S3StateStore-CJewPhgz.mjs.map} +1 -1
- package/dist/{S3StateStore-cnm813Xn.cjs → S3StateStore-WUJGdRNL.cjs} +2 -2
- package/dist/{S3StateStore-cnm813Xn.cjs.map → S3StateStore-WUJGdRNL.cjs.map} +1 -1
- package/dist/{SSMStateStore-DwaGprVX.cjs → SSMStateStore-Zejt42V8.cjs} +2 -2
- package/dist/{SSMStateStore-DwaGprVX.cjs.map → SSMStateStore-Zejt42V8.cjs.map} +1 -1
- package/dist/{SSMStateStore-BllaJKGo.mjs → SSMStateStore-iK5UKp9d.mjs} +2 -2
- package/dist/{SSMStateStore-BllaJKGo.mjs.map → SSMStateStore-iK5UKp9d.mjs.map} +1 -1
- package/dist/{bundler-CzXZPSBJ.cjs → bundler-CfH9frOS.cjs} +2 -2
- package/dist/{bundler-CzXZPSBJ.cjs.map → bundler-CfH9frOS.cjs.map} +1 -1
- package/dist/{bundler-DJVR4QlW.mjs → bundler-DN5r4x5b.mjs} +2 -2
- package/dist/{bundler-DJVR4QlW.mjs.map → bundler-DN5r4x5b.mjs.map} +1 -1
- package/dist/{cli-D_qTl20Z.cjs → cli-DOAUp80L.cjs} +12 -16
- package/dist/cli-DOAUp80L.cjs.map +1 -0
- package/dist/{cli-DzR1hpum.mjs → cli-DYwxmfsW.mjs} +10 -14
- package/dist/cli-DYwxmfsW.mjs.map +1 -0
- package/dist/{config-DXnkCEq0.cjs → config-BYh9S0cZ.cjs} +2 -2
- package/dist/config-BYh9S0cZ.cjs.map +1 -0
- package/dist/{config-C5-EEdmr.mjs → config-Bf4-bROQ.mjs} +2 -2
- package/dist/config-Bf4-bROQ.mjs.map +1 -0
- package/dist/config.cjs +2 -2
- package/dist/config.d.cts +2 -2
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +2 -2
- package/dist/define-CHBIEc5j.mjs +94 -0
- package/dist/define-CHBIEc5j.mjs.map +1 -0
- package/dist/define-Cv_QvDrg.cjs +141 -0
- package/dist/define-Cv_QvDrg.cjs.map +1 -0
- package/dist/deploy/public.cjs +28 -13
- package/dist/deploy/public.d.cts +38 -315
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +38 -315
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +8 -3
- package/dist/{deploy-D6Q09OkA.mjs → deploy-B7jvUORo.mjs} +155 -682
- package/dist/deploy-B7jvUORo.mjs.map +1 -0
- package/dist/deploy-Cg9fae7a.mjs +133 -0
- package/dist/deploy-Cg9fae7a.mjs.map +1 -0
- package/dist/deploy-D8Qr-Xto.cjs +138 -0
- package/dist/deploy-D8Qr-Xto.cjs.map +1 -0
- package/dist/{deploy-0fBVeWO-.cjs → deploy-DSaCYvcO.cjs} +182 -727
- package/dist/deploy-DSaCYvcO.cjs.map +1 -0
- package/dist/dokploy-CD9PY-3D.mjs +32 -0
- package/dist/dokploy-CD9PY-3D.mjs.map +1 -0
- package/dist/dokploy-Ey2foJLv.cjs +32 -0
- package/dist/dokploy-Ey2foJLv.cjs.map +1 -0
- package/dist/{encryption-aDA2AzVx.mjs → encryption-CVwvGbsL.mjs} +4 -4
- package/dist/{encryption-aDA2AzVx.mjs.map → encryption-CVwvGbsL.mjs.map} +1 -1
- package/dist/{encryption-CML4UaPi.cjs → encryption-ChBk3hTj.cjs} +4 -4
- package/dist/{encryption-CML4UaPi.cjs.map → encryption-ChBk3hTj.cjs.map} +1 -1
- package/dist/{github-DmCj2u95.mjs → github-BCB3_LBX.mjs} +3 -3
- package/dist/{github-DmCj2u95.mjs.map → github-BCB3_LBX.mjs.map} +1 -1
- package/dist/{github-Cq57poPj.cjs → github-OUgPDlqg.cjs} +3 -3
- package/dist/{github-Cq57poPj.cjs.map → github-OUgPDlqg.cjs.map} +1 -1
- package/dist/{index-UiWCaGzU.d.cts → index-BtXDZQuF.d.cts} +2 -2
- package/dist/{index-Da1-oa9W.d.mts.map → index-BtXDZQuF.d.cts.map} +1 -1
- package/dist/{index-Da1-oa9W.d.mts → index-DrKzpHl-.d.mts} +2 -2
- package/dist/{index-UiWCaGzU.d.cts.map → index-DrKzpHl-.d.mts.map} +1 -1
- package/dist/index.cjs +1728 -146
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1719 -153
- package/dist/index.mjs.map +1 -1
- package/dist/migrate-BoHMqdCu.mjs +265 -0
- package/dist/migrate-BoHMqdCu.mjs.map +1 -0
- package/dist/migrate-dnaFMvOm.cjs +270 -0
- package/dist/migrate-dnaFMvOm.cjs.map +1 -0
- package/dist/openapi.cjs +2 -2
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +2 -2
- package/dist/{ready-CIHpnUc5.mjs → ready-DQIy21W5.mjs} +2 -2
- package/dist/{ready-CIHpnUc5.mjs.map → ready-DQIy21W5.mjs.map} +1 -1
- package/dist/{ready-CCLIAkwR.cjs → ready-XlNx-Gbo.cjs} +2 -2
- package/dist/{ready-CCLIAkwR.cjs.map → ready-XlNx-Gbo.cjs.map} +1 -1
- package/dist/reconcile/public.d.cts +1 -1
- package/dist/reconcile/public.d.mts +1 -1
- package/dist/resolve-CFCIkm7m.mjs +170 -0
- package/dist/resolve-CFCIkm7m.mjs.map +1 -0
- package/dist/resolve-wbv66HjD.cjs +217 -0
- package/dist/resolve-wbv66HjD.cjs.map +1 -0
- package/dist/runtime-CMwtq0AL.cjs +163 -0
- package/dist/runtime-CMwtq0AL.cjs.map +1 -0
- package/dist/runtime-CXPlkZzs.d.mts +90 -0
- package/dist/runtime-CXPlkZzs.d.mts.map +1 -0
- package/dist/runtime-DbakJS8u.mjs +134 -0
- package/dist/runtime-DbakJS8u.mjs.map +1 -0
- package/dist/runtime-Dn_n-29S.d.cts +90 -0
- package/dist/runtime-Dn_n-29S.d.cts.map +1 -0
- package/dist/{sniffer-DIv12ncU.cjs → sniffer-BsfPa-GA.cjs} +2581 -2170
- package/dist/sniffer-BsfPa-GA.cjs.map +1 -0
- package/dist/{sniffer-BM8fpCas.mjs → sniffer-DHE2Nafd.mjs} +2428 -2185
- package/dist/sniffer-DHE2Nafd.mjs.map +1 -0
- package/dist/target/public.cjs +15 -0
- package/dist/target/public.d.cts +28 -0
- package/dist/target/public.d.cts.map +1 -0
- package/dist/target/public.d.mts +28 -0
- package/dist/target/public.d.mts.map +1 -0
- package/dist/target/public.mjs +4 -0
- package/dist/terminal-6oL0vANs.cjs +576 -0
- package/dist/terminal-6oL0vANs.cjs.map +1 -0
- package/dist/terminal-ByZNjuig.mjs +517 -0
- package/dist/terminal-ByZNjuig.mjs.map +1 -0
- package/dist/{types-efNLu9xu.d.cts → types-CfLKGfC_.d.mts} +624 -34
- package/dist/types-CfLKGfC_.d.mts.map +1 -0
- package/dist/{types-Bp1mVxG0.d.mts → types-DIA7Li-J.d.cts} +626 -34
- package/dist/types-DIA7Li-J.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 +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +1 -1
- package/dist/{workspace-B64Xk1Mb.cjs → workspace-B6zQO6RY.cjs} +229 -23
- package/dist/workspace-B6zQO6RY.cjs.map +1 -0
- package/dist/{workspace-Bp1xVaOz.mjs → workspace-BFe57es7.mjs} +229 -23
- package/dist/workspace-BFe57es7.mjs.map +1 -0
- package/package.json +23 -13
- package/dist/OpenApiTsGenerator-BTuUumsV.cjs.map +0 -1
- package/dist/OpenApiTsGenerator-CvVr1Ilz.mjs.map +0 -1
- package/dist/cli-D_qTl20Z.cjs.map +0 -1
- package/dist/cli-DzR1hpum.mjs.map +0 -1
- package/dist/config-C5-EEdmr.mjs.map +0 -1
- package/dist/config-DXnkCEq0.cjs.map +0 -1
- package/dist/deploy-0fBVeWO-.cjs.map +0 -1
- package/dist/deploy-D6Q09OkA.mjs.map +0 -1
- package/dist/migrate-BTqIflwc.cjs +0 -743
- package/dist/migrate-BTqIflwc.cjs.map +0 -1
- package/dist/migrate-B_6KofUo.mjs +0 -736
- package/dist/migrate-B_6KofUo.mjs.map +0 -1
- package/dist/sniffer-BM8fpCas.mjs.map +0 -1
- package/dist/sniffer-DIv12ncU.cjs.map +0 -1
- package/dist/types-Bp1mVxG0.d.mts.map +0 -1
- package/dist/types-efNLu9xu.d.cts.map +0 -1
- package/dist/workspace-B64Xk1Mb.cjs.map +0 -1
- package/dist/workspace-Bp1xVaOz.mjs.map +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_define = require("../define-Cv_QvDrg.cjs");
|
|
3
|
+
const require_runtime = require("../runtime-CMwtq0AL.cjs");
|
|
4
|
+
const require_resolve = require("../resolve-wbv66HjD.cjs");
|
|
5
|
+
exports.DeployTargetNotYetSupported = require_define.DeployTargetNotYetSupported;
|
|
6
|
+
exports.InvalidTargetOptions = require_resolve.InvalidTargetOptions;
|
|
7
|
+
exports.ProviderRemoved = require_resolve.ProviderRemoved;
|
|
8
|
+
exports.TargetEntryInvalid = require_resolve.TargetEntryInvalid;
|
|
9
|
+
exports.TargetPackageInvalid = require_resolve.TargetPackageInvalid;
|
|
10
|
+
exports.TargetPackageNotFound = require_runtime.TargetPackageNotFound;
|
|
11
|
+
exports.TargetRuntimeMismatch = require_resolve.TargetRuntimeMismatch;
|
|
12
|
+
exports.TargetRuntimeUndeclared = require_runtime.TargetRuntimeUndeclared;
|
|
13
|
+
exports.UnknownDeployTarget = require_define.UnknownDeployTarget;
|
|
14
|
+
exports.defineTarget = require_define.defineTarget;
|
|
15
|
+
exports.isDeployTarget = require_define.isDeployTarget;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { $ as DeployEventError, B as DeployFailure, G as DeployTargetCapabilities, H as DeployRuntime, J as TargetEvent, K as DeployTargetEntry, Q as DeployEvent, U as DeploySecrets, V as DeployPhaseContext, W as DeployTarget, X as TargetOptionsIssue, Y as TargetOptions, Z as TargetOptionsSchema, at as DeployResult, ct as CredentialKinds, et as DeployEventType, gt as StateStore, it as AppDeployResult, lt as CredentialProvider, nt as ResourceChange, ot as Credential, q as DeployTargetLogger, rt as ResourceVia, st as CredentialKind, tt as DeployPhase, ut as CredentialRequest, vt as StageSecrets, yt as DeployIdentity, z as AnyDeployTarget } from "../types-DIA7Li-J.cjs";
|
|
2
|
+
import { a as TargetRuntimeMismatch, c as DeployTargetNotYetSupported, i as TargetPackageInvalid, l as UnknownDeployTarget, n as InvalidTargetOptions, o as ProviderRemoved, r as TargetEntryInvalid, s as TargetPackageNotFound, t as TargetRuntimeUndeclared } from "../runtime-Dn_n-29S.cjs";
|
|
3
|
+
//#region src/target/define.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A deploy target, typed from what it is written with: the options from its
|
|
6
|
+
* `options` schema, the run state from what `validate` returns. Nothing
|
|
7
|
+
* happens at runtime — it returns the target as given.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* export default defineTarget({
|
|
11
|
+
* name: 'fly',
|
|
12
|
+
* runtime: 'server',
|
|
13
|
+
* capabilities: { rollback: true, migrations: 'target', images: true },
|
|
14
|
+
* options: z.object({ org: z.string() }),
|
|
15
|
+
* async validate(ctx) {
|
|
16
|
+
* return { org: ctx.options.org }; // ctx.options: { org: string }
|
|
17
|
+
* },
|
|
18
|
+
* async release(ctx, run) { … }, // run: { org: string }
|
|
19
|
+
* …
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function defineTarget<Options = undefined, Run = void>(target: DeployTarget<Options, Run>): DeployTarget<Options, Run>;
|
|
24
|
+
/** Whether `value` has the shape of a target. */
|
|
25
|
+
export declare function isDeployTarget(value: unknown): value is AnyDeployTarget;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type AnyDeployTarget, type AppDeployResult, type Credential, type CredentialKind, type CredentialKinds, type CredentialProvider, type CredentialRequest, type DeployEvent, type DeployEventError, type DeployEventType, type DeployFailure, type DeployIdentity, type DeployPhase, type DeployPhaseContext, type DeployResult, type DeployRuntime, type DeploySecrets, type DeployTarget, type DeployTargetCapabilities, type DeployTargetEntry, type DeployTargetLogger, DeployTargetNotYetSupported, InvalidTargetOptions, ProviderRemoved, type ResourceChange, type ResourceVia, type StageSecrets, type StateStore, TargetEntryInvalid, type TargetEvent, type TargetOptions, type TargetOptionsIssue, type TargetOptionsSchema, TargetPackageInvalid, TargetPackageNotFound, TargetRuntimeMismatch, TargetRuntimeUndeclared, UnknownDeployTarget };
|
|
28
|
+
//# sourceMappingURL=public.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.cts","names":[],"sources":["../../src/target/define.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;wBAqBgB,aAAa,qBAAqB,YACjD,QAAQ,aAAa,SAAS,OAC5B,aAAa,SAAS;;wBAKT,eAAe,iBAAiB,SAAS"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { $ as DeployEventError, B as DeployFailure, G as DeployTargetCapabilities, H as DeployRuntime, J as TargetEvent, K as DeployTargetEntry, Q as DeployEvent, U as DeploySecrets, V as DeployPhaseContext, W as DeployTarget, X as TargetOptionsIssue, Y as TargetOptions, Z as TargetOptionsSchema, at as DeployResult, ct as CredentialKinds, et as DeployEventType, gt as StateStore, it as AppDeployResult, lt as CredentialProvider, nt as ResourceChange, ot as Credential, q as DeployTargetLogger, rt as ResourceVia, st as CredentialKind, tt as DeployPhase, ut as CredentialRequest, vt as StageSecrets, yt as DeployIdentity, z as AnyDeployTarget } from "../types-CfLKGfC_.mjs";
|
|
2
|
+
import { a as TargetRuntimeMismatch, c as DeployTargetNotYetSupported, i as TargetPackageInvalid, l as UnknownDeployTarget, n as InvalidTargetOptions, o as ProviderRemoved, r as TargetEntryInvalid, s as TargetPackageNotFound, t as TargetRuntimeUndeclared } from "../runtime-CXPlkZzs.mjs";
|
|
3
|
+
//#region src/target/define.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* A deploy target, typed from what it is written with: the options from its
|
|
6
|
+
* `options` schema, the run state from what `validate` returns. Nothing
|
|
7
|
+
* happens at runtime — it returns the target as given.
|
|
8
|
+
*
|
|
9
|
+
* ```ts
|
|
10
|
+
* export default defineTarget({
|
|
11
|
+
* name: 'fly',
|
|
12
|
+
* runtime: 'server',
|
|
13
|
+
* capabilities: { rollback: true, migrations: 'target', images: true },
|
|
14
|
+
* options: z.object({ org: z.string() }),
|
|
15
|
+
* async validate(ctx) {
|
|
16
|
+
* return { org: ctx.options.org }; // ctx.options: { org: string }
|
|
17
|
+
* },
|
|
18
|
+
* async release(ctx, run) { … }, // run: { org: string }
|
|
19
|
+
* …
|
|
20
|
+
* });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function defineTarget<Options = undefined, Run = void>(target: DeployTarget<Options, Run>): DeployTarget<Options, Run>;
|
|
24
|
+
/** Whether `value` has the shape of a target. */
|
|
25
|
+
export declare function isDeployTarget(value: unknown): value is AnyDeployTarget;
|
|
26
|
+
//#endregion
|
|
27
|
+
export { type AnyDeployTarget, type AppDeployResult, type Credential, type CredentialKind, type CredentialKinds, type CredentialProvider, type CredentialRequest, type DeployEvent, type DeployEventError, type DeployEventType, type DeployFailure, type DeployIdentity, type DeployPhase, type DeployPhaseContext, type DeployResult, type DeployRuntime, type DeploySecrets, type DeployTarget, type DeployTargetCapabilities, type DeployTargetEntry, type DeployTargetLogger, DeployTargetNotYetSupported, InvalidTargetOptions, ProviderRemoved, type ResourceChange, type ResourceVia, type StageSecrets, type StateStore, TargetEntryInvalid, type TargetEvent, type TargetOptions, type TargetOptionsIssue, type TargetOptionsSchema, TargetPackageInvalid, TargetPackageNotFound, TargetRuntimeMismatch, TargetRuntimeUndeclared, UnknownDeployTarget };
|
|
28
|
+
//# sourceMappingURL=public.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public.d.mts","names":[],"sources":["../../src/target/define.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;wBAqBgB,aAAa,qBAAqB,YACjD,QAAQ,aAAa,SAAS,OAC5B,aAAa,SAAS;;wBAKT,eAAe,iBAAiB,SAAS"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { a as UnknownDeployTarget, i as DeployTargetNotYetSupported, n as isDeployTarget, t as defineTarget } from "../define-CHBIEc5j.mjs";
|
|
2
|
+
import { i as TargetPackageNotFound, t as TargetRuntimeUndeclared } from "../runtime-DbakJS8u.mjs";
|
|
3
|
+
import { i as TargetRuntimeMismatch, n as TargetEntryInvalid, r as TargetPackageInvalid, s as ProviderRemoved, t as InvalidTargetOptions } from "../resolve-CFCIkm7m.mjs";
|
|
4
|
+
export { DeployTargetNotYetSupported, InvalidTargetOptions, ProviderRemoved, TargetEntryInvalid, TargetPackageInvalid, TargetPackageNotFound, TargetRuntimeMismatch, TargetRuntimeUndeclared, UnknownDeployTarget, defineTarget, isDeployTarget };
|
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
const require_sniffer = require("./sniffer-BsfPa-GA.cjs");
|
|
2
|
+
const require_discover = require("./discover-Bc-4eA_p.cjs");
|
|
3
|
+
const require_config = require("./config-BYh9S0cZ.cjs");
|
|
4
|
+
const require_workspace = require("./workspace-B6zQO6RY.cjs");
|
|
5
|
+
const require_define = require("./define-Cv_QvDrg.cjs");
|
|
6
|
+
const require_store = require("./store-KvNQwYaB.cjs");
|
|
7
|
+
const require_resolve = require("./resolve-wbv66HjD.cjs");
|
|
8
|
+
//#region src/deploy/credentials.ts
|
|
9
|
+
/**
|
|
10
|
+
* How a deploy gets the credentials it acts with.
|
|
11
|
+
*
|
|
12
|
+
* `deploy()` never prompts and never reads a terminal: it asks a
|
|
13
|
+
* `CredentialProvider` and, when the provider has nothing, stops with
|
|
14
|
+
* `MissingCredential` naming what it needed and how to supply it. Whether to
|
|
15
|
+
* ask a person, read a vault or fail is the caller's decision — `gkm deploy`
|
|
16
|
+
* prompts at a terminal and stores what was typed; a CI job sets the
|
|
17
|
+
* environment; a host passes its own provider.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* How to supply each kind the CLI knows, for the error that says it is
|
|
21
|
+
* missing. A target's own kinds are its to explain.
|
|
22
|
+
*/
|
|
23
|
+
const HOW_TO_PROVIDE = {
|
|
24
|
+
dokploy: "Set DOKPLOY_API_TOKEN (and DOKPLOY_ENDPOINT, or deploy.dokploy.endpoint in gkm.config.ts), run `gkm login --provider dokploy`, or pass them through the deploy's CredentialProvider.",
|
|
25
|
+
registry: "Add the registry in Dokploy (Settings → Docker Registry) and set deploy.dokploy.registryId, set DOCKER_REGISTRY_USERNAME and DOCKER_REGISTRY_PASSWORD, or run `gkm deploy` at a terminal to be asked for them."
|
|
26
|
+
};
|
|
27
|
+
/** A deploy needed a credential, and its provider had none. */
|
|
28
|
+
var MissingCredential = class extends Error {
|
|
29
|
+
kind;
|
|
30
|
+
target;
|
|
31
|
+
howToProvide;
|
|
32
|
+
constructor(kind, target, howToProvide = HOW_TO_PROVIDE[kind] ?? "Pass it through the deploy's CredentialProvider.") {
|
|
33
|
+
const what = kind === "dokploy" ? `No Dokploy credentials${target ? ` for ${target}` : ""}.` : kind === "registry" ? `Dokploy has no registry for ${target ?? "the configured registry"}, and there are no credentials to create one with.` : `No "${String(kind)}" credentials${target ? ` for ${target}` : ""}.`;
|
|
34
|
+
super(`${what} ${howToProvide}`);
|
|
35
|
+
this.kind = kind;
|
|
36
|
+
this.target = target;
|
|
37
|
+
this.howToProvide = howToProvide;
|
|
38
|
+
this.name = "MissingCredential";
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
/** Whatever was asked for, from the first provider that has it. */
|
|
42
|
+
function chainCredentials(...providers) {
|
|
43
|
+
return { async get(request, options) {
|
|
44
|
+
for (const provider of providers) {
|
|
45
|
+
const found = await provider.get(request, options);
|
|
46
|
+
if (found) return found;
|
|
47
|
+
}
|
|
48
|
+
} };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Credentials from the environment, then from what `gkm login` stored. What
|
|
52
|
+
* `deploy()` uses when it is handed no provider.
|
|
53
|
+
*
|
|
54
|
+
* - Dokploy: `DOKPLOY_API_TOKEN` / `DOKPLOY_ENDPOINT`, each falling back to
|
|
55
|
+
* the stored login, and the endpoint finally to `deploy.dokploy.endpoint`.
|
|
56
|
+
* Each half is read on its own: a token is a secret and belongs in the
|
|
57
|
+
* environment, an endpoint is configuration and belongs in the config.
|
|
58
|
+
* - Registry: `DOCKER_REGISTRY_USERNAME` / `DOCKER_REGISTRY_PASSWORD`.
|
|
59
|
+
*/
|
|
60
|
+
function storedCredentials(options = {}) {
|
|
61
|
+
const env = options.env ?? process.env;
|
|
62
|
+
return { async get(asked) {
|
|
63
|
+
const request = asked;
|
|
64
|
+
switch (request.kind) {
|
|
65
|
+
case "dokploy": {
|
|
66
|
+
const stored = (await require_sniffer.readCredentials(options.home ? { home: options.home } : void 0)).dokploy;
|
|
67
|
+
const token = env.DOKPLOY_API_TOKEN ?? stored?.token;
|
|
68
|
+
const endpoint = env.DOKPLOY_ENDPOINT ?? stored?.endpoint ?? request.endpoint;
|
|
69
|
+
if (!token || !endpoint) return void 0;
|
|
70
|
+
return {
|
|
71
|
+
endpoint: endpoint.replace(/\/$/, ""),
|
|
72
|
+
token
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
case "registry": {
|
|
76
|
+
const username = env.DOCKER_REGISTRY_USERNAME;
|
|
77
|
+
const password = env.DOCKER_REGISTRY_PASSWORD;
|
|
78
|
+
if (!username || !password) return void 0;
|
|
79
|
+
return {
|
|
80
|
+
username,
|
|
81
|
+
password
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
} };
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/target/secrets.ts
|
|
89
|
+
/**
|
|
90
|
+
* A stage's secrets as a target sees them: read and written through the
|
|
91
|
+
* stage's own store, and masked in everything the run prints once read.
|
|
92
|
+
*/
|
|
93
|
+
/**
|
|
94
|
+
* Shorter values are left alone: what a progress line legitimately prints —
|
|
95
|
+
* a port, a stage, an app name — would otherwise come out as `***` wherever
|
|
96
|
+
* a secret happened to share it.
|
|
97
|
+
*/
|
|
98
|
+
const SHORTEST_MASKED = 6;
|
|
99
|
+
/** The values a run must never print, and the rewrite that keeps it so. */
|
|
100
|
+
var Redactor = class {
|
|
101
|
+
values = /* @__PURE__ */ new Set();
|
|
102
|
+
add(value) {
|
|
103
|
+
if (value && value.length >= SHORTEST_MASKED) this.values.add(value);
|
|
104
|
+
}
|
|
105
|
+
/** `text` with every masked value replaced by `***`, longest first. */
|
|
106
|
+
redact(text) {
|
|
107
|
+
if (this.values.size === 0) return text;
|
|
108
|
+
let out = text;
|
|
109
|
+
const longestFirst = [...this.values].sort((a, b) => b.length - a.length);
|
|
110
|
+
for (const value of longestFirst) out = out.replaceAll(value, "***");
|
|
111
|
+
return out;
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
/** Every value in `secrets` that is a secret rather than a label. */
|
|
115
|
+
function secretValues(secrets) {
|
|
116
|
+
return [
|
|
117
|
+
secrets.seed,
|
|
118
|
+
...Object.values(secrets.custom ?? {}),
|
|
119
|
+
...Object.values(secrets.urls ?? {}),
|
|
120
|
+
...Object.values(secrets.services ?? {}).map((service) => service?.password)
|
|
121
|
+
].filter((value) => typeof value === "string");
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The stage's secrets through the store `secrets.store` names for it. Opening
|
|
125
|
+
* one builds a client and makes no request, so a target that never reads them
|
|
126
|
+
* costs nothing.
|
|
127
|
+
*/
|
|
128
|
+
async function deploySecrets(workspace, stage, redactor, options = {}) {
|
|
129
|
+
const store = await require_store.secretsStoreFor(workspace, stage, options);
|
|
130
|
+
const mask = (secrets) => {
|
|
131
|
+
for (const value of secretValues(secrets)) redactor.add(value);
|
|
132
|
+
};
|
|
133
|
+
return {
|
|
134
|
+
store: store.name,
|
|
135
|
+
async read() {
|
|
136
|
+
const secrets = await store.read(stage);
|
|
137
|
+
if (secrets) mask(secrets);
|
|
138
|
+
return secrets;
|
|
139
|
+
},
|
|
140
|
+
async write(secrets) {
|
|
141
|
+
mask(secrets);
|
|
142
|
+
await store.write(stage, secrets);
|
|
143
|
+
},
|
|
144
|
+
mask: (value) => redactor.add(value)
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
//#endregion
|
|
148
|
+
//#region src/deploy/events.ts
|
|
149
|
+
/** An error as an event carries it: its name and message, nothing else. */
|
|
150
|
+
function eventError(error) {
|
|
151
|
+
if (error instanceof Error) return {
|
|
152
|
+
name: error.name,
|
|
153
|
+
message: error.message
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
name: "Error",
|
|
157
|
+
message: String(error)
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
//#endregion
|
|
161
|
+
//#region src/deploy/orchestrate.ts
|
|
162
|
+
/**
|
|
163
|
+
* The run around a target: what every deploy does whatever it deploys
|
|
164
|
+
* through.
|
|
165
|
+
*
|
|
166
|
+
* It loads the workspace, resolves the target, works out the apps and the
|
|
167
|
+
* identity, takes the stage's lock, and calls the target's phases in order,
|
|
168
|
+
* reporting each as it starts, finishes or fails. Everything that is about
|
|
169
|
+
* *where* the stage goes is the target's.
|
|
170
|
+
*/
|
|
171
|
+
/** Apps were asked for by name that the workspace does not have. */
|
|
172
|
+
var UnknownDeployApps = class extends Error {
|
|
173
|
+
apps;
|
|
174
|
+
available;
|
|
175
|
+
constructor(apps, available) {
|
|
176
|
+
super(`Unknown apps: ${apps.join(", ")}\nAvailable apps: ${available.join(", ")}`);
|
|
177
|
+
this.apps = apps;
|
|
178
|
+
this.available = available;
|
|
179
|
+
this.name = "UnknownDeployApps";
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
/** Every app asked for deploys through some other target. */
|
|
183
|
+
var NoDeployableApps = class extends Error {
|
|
184
|
+
stage;
|
|
185
|
+
target;
|
|
186
|
+
constructor(stage, target) {
|
|
187
|
+
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.`);
|
|
188
|
+
this.stage = stage;
|
|
189
|
+
this.target = target;
|
|
190
|
+
this.name = "NoDeployableApps";
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
/** A failed rollback, after the failure that called for it. */
|
|
194
|
+
var RollbackFailed = class extends Error {
|
|
195
|
+
target;
|
|
196
|
+
failure;
|
|
197
|
+
constructor(target, failure, cause) {
|
|
198
|
+
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 });
|
|
199
|
+
this.target = target;
|
|
200
|
+
this.failure = failure;
|
|
201
|
+
this.name = "RollbackFailed";
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
/**
|
|
205
|
+
* Generate image tag from stage and timestamp
|
|
206
|
+
*/
|
|
207
|
+
function generateTag(stage) {
|
|
208
|
+
return `${stage}-${(/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-").slice(0, 19)}`;
|
|
209
|
+
}
|
|
210
|
+
/** Why an app that deploys through another target is left out. */
|
|
211
|
+
function elsewhere(target, stage) {
|
|
212
|
+
const instead = require_define.builtinTarget(target)?.instead?.(stage);
|
|
213
|
+
if (target === "sst" && instead) return `it deploys with SST — ${instead}`;
|
|
214
|
+
return `it deploys through "${target}" — run \`gkm deploy --target ${target} --stage ${stage}\``;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Deploy a workspace's stage through its target.
|
|
218
|
+
*
|
|
219
|
+
* The engine under `deploy()` and `gkm deploy`. It never prompts and never
|
|
220
|
+
* exits: credentials come from `ctx.credentials`, progress goes to
|
|
221
|
+
* `ctx.emit` and to `output`, and every failure is thrown.
|
|
222
|
+
*
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
async function runDeploy(source, request, ctx) {
|
|
226
|
+
const { stage } = request;
|
|
227
|
+
const redactor = ctx.redactor ?? new Redactor();
|
|
228
|
+
const emit = (event) => ctx.emit(event.type === "log" ? {
|
|
229
|
+
...event,
|
|
230
|
+
message: redactor.redact(event.message)
|
|
231
|
+
} : event);
|
|
232
|
+
/** Run one phase between its events. */
|
|
233
|
+
const phase = async (name, body) => {
|
|
234
|
+
ctx.signal?.throwIfAborted();
|
|
235
|
+
emit({
|
|
236
|
+
type: "phase.started",
|
|
237
|
+
phase: name
|
|
238
|
+
});
|
|
239
|
+
try {
|
|
240
|
+
const value = await body();
|
|
241
|
+
emit({
|
|
242
|
+
type: "phase.finished",
|
|
243
|
+
phase: name
|
|
244
|
+
});
|
|
245
|
+
return value;
|
|
246
|
+
} catch (error) {
|
|
247
|
+
emit({
|
|
248
|
+
type: "phase.failed",
|
|
249
|
+
phase: name,
|
|
250
|
+
error: eventError(error)
|
|
251
|
+
});
|
|
252
|
+
throw error;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
ctx.signal?.throwIfAborted();
|
|
256
|
+
emit({
|
|
257
|
+
type: "phase.started",
|
|
258
|
+
phase: "validate"
|
|
259
|
+
});
|
|
260
|
+
let prepared;
|
|
261
|
+
try {
|
|
262
|
+
prepared = await prepare(source, request, ctx, emit, redactor);
|
|
263
|
+
} catch (error) {
|
|
264
|
+
emit({
|
|
265
|
+
type: "phase.failed",
|
|
266
|
+
phase: "validate",
|
|
267
|
+
error: eventError(error)
|
|
268
|
+
});
|
|
269
|
+
throw error;
|
|
270
|
+
}
|
|
271
|
+
const { resolved, phaseCtx, store } = prepared;
|
|
272
|
+
const { target } = resolved;
|
|
273
|
+
if (ctx.dryRun) {
|
|
274
|
+
const run = await validate(target, phaseCtx, emit);
|
|
275
|
+
await phase("plan", () => target.plan(phaseCtx, run));
|
|
276
|
+
return target.result(phaseCtx, run);
|
|
277
|
+
}
|
|
278
|
+
let lock;
|
|
279
|
+
try {
|
|
280
|
+
lock = await store.lock(stage, { operation: "deploy" });
|
|
281
|
+
} catch (error) {
|
|
282
|
+
emit({
|
|
283
|
+
type: "phase.failed",
|
|
284
|
+
phase: "validate",
|
|
285
|
+
error: eventError(error)
|
|
286
|
+
});
|
|
287
|
+
throw error;
|
|
288
|
+
}
|
|
289
|
+
try {
|
|
290
|
+
const run = await validate(target, phaseCtx, emit);
|
|
291
|
+
if (target.provision) await phase("provision", () => target.provision(phaseCtx, run));
|
|
292
|
+
if (target.build) await phase("build", () => target.build(phaseCtx, run));
|
|
293
|
+
let releasing = "release";
|
|
294
|
+
try {
|
|
295
|
+
await phase("release", () => target.release(phaseCtx, run));
|
|
296
|
+
releasing = "verify";
|
|
297
|
+
if (target.verify) await phase("verify", () => target.verify(phaseCtx, run));
|
|
298
|
+
} catch (error) {
|
|
299
|
+
if (ctx.signal?.aborted || !target.capabilities.rollback) throw error;
|
|
300
|
+
if (!target.rollback) throw error;
|
|
301
|
+
try {
|
|
302
|
+
await phase("rollback", () => target.rollback(phaseCtx, run, {
|
|
303
|
+
phase: releasing,
|
|
304
|
+
error
|
|
305
|
+
}));
|
|
306
|
+
} catch (rollbackError) {
|
|
307
|
+
throw new RollbackFailed(resolved.name, error, rollbackError);
|
|
308
|
+
}
|
|
309
|
+
throw error;
|
|
310
|
+
}
|
|
311
|
+
return await target.result(phaseCtx, run);
|
|
312
|
+
} finally {
|
|
313
|
+
await lock.release();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/** `validate`, then the run's `deploy.started`, inside the validate phase. */
|
|
317
|
+
async function validate(target, phaseCtx, emit) {
|
|
318
|
+
try {
|
|
319
|
+
const run = await target.validate(phaseCtx);
|
|
320
|
+
const skipped = new Set(phaseCtx.skipped.map((s) => s.app));
|
|
321
|
+
emit({
|
|
322
|
+
type: "deploy.started",
|
|
323
|
+
stage: phaseCtx.stage,
|
|
324
|
+
target: phaseCtx.target,
|
|
325
|
+
identity: phaseCtx.identity.key,
|
|
326
|
+
tag: phaseCtx.tag,
|
|
327
|
+
apps: phaseCtx.apps.filter((app) => !skipped.has(app)),
|
|
328
|
+
dryRun: phaseCtx.dryRun
|
|
329
|
+
});
|
|
330
|
+
emit({
|
|
331
|
+
type: "phase.finished",
|
|
332
|
+
phase: "validate"
|
|
333
|
+
});
|
|
334
|
+
return run;
|
|
335
|
+
} catch (error) {
|
|
336
|
+
emit({
|
|
337
|
+
type: "phase.failed",
|
|
338
|
+
phase: "validate",
|
|
339
|
+
error: eventError(error)
|
|
340
|
+
});
|
|
341
|
+
throw error;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
/** Everything the phases are handed, worked out before the first of them. */
|
|
345
|
+
async function prepare(source, request, ctx, emit, redactor) {
|
|
346
|
+
const { stage } = request;
|
|
347
|
+
const configured = typeof source === "function" ? await source() : source;
|
|
348
|
+
const targetName = request.target ?? configured.deploy?.default ?? "dokploy";
|
|
349
|
+
const resolved = await require_resolve.resolveTarget(targetName, {
|
|
350
|
+
workspace: configured,
|
|
351
|
+
stage,
|
|
352
|
+
...ctx.targets ? { host: ctx.targets } : {}
|
|
353
|
+
});
|
|
354
|
+
const options = await require_resolve.parseTargetOptions(resolved);
|
|
355
|
+
const manifest = await require_discover.discover({
|
|
356
|
+
patterns: require_sniffer.constructGlobs(configured),
|
|
357
|
+
cwd: configured.root
|
|
358
|
+
});
|
|
359
|
+
const units = require_config.derivedApps(manifest, configured);
|
|
360
|
+
const workspace = Object.keys(units).length > 0 ? {
|
|
361
|
+
...configured,
|
|
362
|
+
apps: units
|
|
363
|
+
} : configured;
|
|
364
|
+
const identity = require_store.deployIdentity(workspace, stage);
|
|
365
|
+
const tag = request.tag ?? generateTag(stage);
|
|
366
|
+
const buildOrder = require_workspace.getAppBuildOrder(workspace);
|
|
367
|
+
let selected = buildOrder;
|
|
368
|
+
if (request.apps && request.apps.length > 0) {
|
|
369
|
+
const unknown = request.apps.filter((name) => !workspace.apps[name]);
|
|
370
|
+
if (unknown.length > 0) throw new UnknownDeployApps(unknown, Object.keys(workspace.apps));
|
|
371
|
+
selected = buildOrder.filter((name) => request.apps.includes(name));
|
|
372
|
+
}
|
|
373
|
+
const skipped = [];
|
|
374
|
+
const skip = (app, reason) => {
|
|
375
|
+
skipped.push({
|
|
376
|
+
app,
|
|
377
|
+
reason
|
|
378
|
+
});
|
|
379
|
+
emit({
|
|
380
|
+
type: "app.skipped",
|
|
381
|
+
app,
|
|
382
|
+
reason
|
|
383
|
+
});
|
|
384
|
+
};
|
|
385
|
+
const byDefault = configured.deploy?.default ?? "dokploy";
|
|
386
|
+
const apps = selected.filter((name) => {
|
|
387
|
+
const own = workspace.apps[name].resolvedDeployTarget;
|
|
388
|
+
const deploysThrough = own === byDefault ? targetName : own;
|
|
389
|
+
if (deploysThrough === targetName) return true;
|
|
390
|
+
skip(name, elsewhere(deploysThrough, stage));
|
|
391
|
+
return false;
|
|
392
|
+
});
|
|
393
|
+
if (apps.length === 0) throw new NoDeployableApps(stage, targetName);
|
|
394
|
+
const store = await require_sniffer.createStateStore({
|
|
395
|
+
config: workspace.state,
|
|
396
|
+
workspaceRoot: workspace.root,
|
|
397
|
+
workspaceName: workspace.name
|
|
398
|
+
});
|
|
399
|
+
const secrets = await deploySecrets(workspace, stage, redactor, { ...ctx.home ? { home: ctx.home } : {} });
|
|
400
|
+
const line = (level) => (message) => emit({
|
|
401
|
+
type: "log",
|
|
402
|
+
level,
|
|
403
|
+
message
|
|
404
|
+
});
|
|
405
|
+
const logger = {
|
|
406
|
+
info: line("info"),
|
|
407
|
+
warn: line("warn"),
|
|
408
|
+
error: line("error")
|
|
409
|
+
};
|
|
410
|
+
return {
|
|
411
|
+
resolved,
|
|
412
|
+
phaseCtx: {
|
|
413
|
+
target: targetName,
|
|
414
|
+
cwd: workspace.root,
|
|
415
|
+
stage,
|
|
416
|
+
tag,
|
|
417
|
+
apps,
|
|
418
|
+
skipped,
|
|
419
|
+
identity,
|
|
420
|
+
workspace,
|
|
421
|
+
manifest,
|
|
422
|
+
options,
|
|
423
|
+
dryRun: ctx.dryRun,
|
|
424
|
+
credentials: ctx.credentials,
|
|
425
|
+
state: store,
|
|
426
|
+
secrets,
|
|
427
|
+
logger,
|
|
428
|
+
signal: ctx.signal ?? new AbortController().signal,
|
|
429
|
+
childOutput: ctx.childOutput ?? "inherit",
|
|
430
|
+
emit,
|
|
431
|
+
skip,
|
|
432
|
+
name: (resource) => require_store.applicationName(identity, resource)
|
|
433
|
+
},
|
|
434
|
+
store
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
//#endregion
|
|
438
|
+
//#region src/deploy/terminal.ts
|
|
439
|
+
/**
|
|
440
|
+
* The credentials `gkm deploy` can ask a person for. CLI layer only.
|
|
441
|
+
*
|
|
442
|
+
* `deploy()` asks its `CredentialProvider` and stops with `MissingCredential`
|
|
443
|
+
* when the answer is nothing. At a terminal, `gkm deploy` would rather ask:
|
|
444
|
+
* this provider reads the environment and the stored login first, and only
|
|
445
|
+
* when both are empty prompts — and stores a Dokploy login it validated, so
|
|
446
|
+
* the next deploy does not ask again. With no terminal it answers nothing, and
|
|
447
|
+
* the deploy says what was missing instead of waiting on a prompt nobody sees.
|
|
448
|
+
*/
|
|
449
|
+
const logger = require_discover.output;
|
|
450
|
+
/** What answers a deploy prompt without a terminal. */
|
|
451
|
+
const INSTEAD = "Please configure manually.";
|
|
452
|
+
/** The Dokploy URL typed at the prompt is not a URL. */
|
|
453
|
+
var DokployEndpointInvalid = class extends Error {
|
|
454
|
+
endpoint;
|
|
455
|
+
constructor(endpoint) {
|
|
456
|
+
super("Invalid URL format");
|
|
457
|
+
this.endpoint = endpoint;
|
|
458
|
+
this.name = "DokployEndpointInvalid";
|
|
459
|
+
}
|
|
460
|
+
};
|
|
461
|
+
/** Dokploy refused the token typed at the prompt; nothing was stored. */
|
|
462
|
+
var DokployTokenRejected = class extends Error {
|
|
463
|
+
endpoint;
|
|
464
|
+
constructor(endpoint) {
|
|
465
|
+
super("Invalid credentials. Please check your token.");
|
|
466
|
+
this.endpoint = endpoint;
|
|
467
|
+
this.name = "DokployTokenRejected";
|
|
468
|
+
}
|
|
469
|
+
};
|
|
470
|
+
/** Asks the person at the terminal for what nothing else supplied. */
|
|
471
|
+
function asking() {
|
|
472
|
+
return { async get(asked) {
|
|
473
|
+
if (!require_sniffer.canPrompt()) return void 0;
|
|
474
|
+
const request = asked;
|
|
475
|
+
if (request.kind === "dokploy") {
|
|
476
|
+
logger.log("\n📋 Dokploy credentials not found. Let's set them up.");
|
|
477
|
+
const endpoint = (await require_sniffer.prompt("Dokploy URL (e.g., https://dokploy.example.com): ", { instead: INSTEAD })).replace(/\/$/, "");
|
|
478
|
+
try {
|
|
479
|
+
new URL(endpoint);
|
|
480
|
+
} catch {
|
|
481
|
+
throw new DokployEndpointInvalid(endpoint);
|
|
482
|
+
}
|
|
483
|
+
logger.log(`\nGenerate a token at: ${endpoint}/settings/profile\n`);
|
|
484
|
+
const token = await require_sniffer.prompt("API Token: ", {
|
|
485
|
+
hidden: true,
|
|
486
|
+
instead: INSTEAD
|
|
487
|
+
});
|
|
488
|
+
logger.log("\nValidating credentials...");
|
|
489
|
+
if (!await require_sniffer.validateDokployToken(endpoint, token)) throw new DokployTokenRejected(endpoint);
|
|
490
|
+
await require_sniffer.storeDokployCredentials(token, endpoint);
|
|
491
|
+
logger.log("✓ Credentials saved");
|
|
492
|
+
return {
|
|
493
|
+
endpoint,
|
|
494
|
+
token
|
|
495
|
+
};
|
|
496
|
+
}
|
|
497
|
+
logger.log(` Dokploy has no registry for ${request.url}. Let's create one.`);
|
|
498
|
+
return {
|
|
499
|
+
username: await require_sniffer.prompt("Registry username: ", { instead: INSTEAD }),
|
|
500
|
+
password: await require_sniffer.prompt("Registry password/token: ", {
|
|
501
|
+
hidden: true,
|
|
502
|
+
instead: INSTEAD
|
|
503
|
+
})
|
|
504
|
+
};
|
|
505
|
+
} };
|
|
506
|
+
}
|
|
507
|
+
/**
|
|
508
|
+
* The environment, then the stored login, then — at a terminal — the person
|
|
509
|
+
* running the command.
|
|
510
|
+
*/
|
|
511
|
+
function terminalCredentials(base = storedCredentials()) {
|
|
512
|
+
return chainCredentials(base, asking());
|
|
513
|
+
}
|
|
514
|
+
//#endregion
|
|
515
|
+
Object.defineProperty(exports, "MissingCredential", {
|
|
516
|
+
enumerable: true,
|
|
517
|
+
get: function() {
|
|
518
|
+
return MissingCredential;
|
|
519
|
+
}
|
|
520
|
+
});
|
|
521
|
+
Object.defineProperty(exports, "NoDeployableApps", {
|
|
522
|
+
enumerable: true,
|
|
523
|
+
get: function() {
|
|
524
|
+
return NoDeployableApps;
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
Object.defineProperty(exports, "Redactor", {
|
|
528
|
+
enumerable: true,
|
|
529
|
+
get: function() {
|
|
530
|
+
return Redactor;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
Object.defineProperty(exports, "RollbackFailed", {
|
|
534
|
+
enumerable: true,
|
|
535
|
+
get: function() {
|
|
536
|
+
return RollbackFailed;
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
Object.defineProperty(exports, "UnknownDeployApps", {
|
|
540
|
+
enumerable: true,
|
|
541
|
+
get: function() {
|
|
542
|
+
return UnknownDeployApps;
|
|
543
|
+
}
|
|
544
|
+
});
|
|
545
|
+
Object.defineProperty(exports, "chainCredentials", {
|
|
546
|
+
enumerable: true,
|
|
547
|
+
get: function() {
|
|
548
|
+
return chainCredentials;
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
Object.defineProperty(exports, "eventError", {
|
|
552
|
+
enumerable: true,
|
|
553
|
+
get: function() {
|
|
554
|
+
return eventError;
|
|
555
|
+
}
|
|
556
|
+
});
|
|
557
|
+
Object.defineProperty(exports, "runDeploy", {
|
|
558
|
+
enumerable: true,
|
|
559
|
+
get: function() {
|
|
560
|
+
return runDeploy;
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
Object.defineProperty(exports, "storedCredentials", {
|
|
564
|
+
enumerable: true,
|
|
565
|
+
get: function() {
|
|
566
|
+
return storedCredentials;
|
|
567
|
+
}
|
|
568
|
+
});
|
|
569
|
+
Object.defineProperty(exports, "terminalCredentials", {
|
|
570
|
+
enumerable: true,
|
|
571
|
+
get: function() {
|
|
572
|
+
return terminalCredentials;
|
|
573
|
+
}
|
|
574
|
+
});
|
|
575
|
+
|
|
576
|
+
//# sourceMappingURL=terminal-6oL0vANs.cjs.map
|