@geekmidas/cli 10.0.0-alpha.61 → 10.0.0-alpha.63
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 +2 -0
- package/dist/{HostingerProvider-DI_Pr2VE.mjs → HostingerProvider-DBBwpDjn.mjs} +2 -2
- package/dist/{HostingerProvider-DI_Pr2VE.mjs.map → HostingerProvider-DBBwpDjn.mjs.map} +1 -1
- package/dist/{HostingerProvider-CgDaD8VR.cjs → HostingerProvider-mJ7YruxH.cjs} +2 -2
- package/dist/{HostingerProvider-CgDaD8VR.cjs.map → HostingerProvider-mJ7YruxH.cjs.map} +1 -1
- package/dist/{LegacyStateStore-JbBVFp_2.cjs → LegacyStateStore-CP7SZwTP.cjs} +2 -2
- package/dist/{LegacyStateStore-JbBVFp_2.cjs.map → LegacyStateStore-CP7SZwTP.cjs.map} +1 -1
- package/dist/{LegacyStateStore-C7vFAxbu.mjs → LegacyStateStore-Q3GmKOdw.mjs} +2 -2
- package/dist/{LegacyStateStore-C7vFAxbu.mjs.map → LegacyStateStore-Q3GmKOdw.mjs.map} +1 -1
- package/dist/{LocalStateStore-DfUwQsL8.mjs → LocalStateStore-BGIXcrvX.mjs} +2 -2
- package/dist/{LocalStateStore-DfUwQsL8.mjs.map → LocalStateStore-BGIXcrvX.mjs.map} +1 -1
- package/dist/{LocalStateStore-DHj_-CQB.cjs → LocalStateStore-sS8mvLeq.cjs} +2 -2
- package/dist/{LocalStateStore-DHj_-CQB.cjs.map → LocalStateStore-sS8mvLeq.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs → OpenApiTsGenerator-CjHWFRDd.cjs} +2 -2
- package/dist/{OpenApiTsGenerator-BSrgw7B0.cjs.map → OpenApiTsGenerator-CjHWFRDd.cjs.map} +1 -1
- package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs → OpenApiTsGenerator-CnAwhGxi.mjs} +2 -2
- package/dist/{OpenApiTsGenerator-q5B0z8Xg.mjs.map → OpenApiTsGenerator-CnAwhGxi.mjs.map} +1 -1
- package/dist/{S3StateStore-xqnpUrzy.cjs → S3StateStore-6jqITH2F.cjs} +2 -2
- package/dist/{S3StateStore-xqnpUrzy.cjs.map → S3StateStore-6jqITH2F.cjs.map} +1 -1
- package/dist/{S3StateStore-Dq6hHtzY.mjs → S3StateStore-D7l_lWJ3.mjs} +2 -2
- package/dist/{S3StateStore-Dq6hHtzY.mjs.map → S3StateStore-D7l_lWJ3.mjs.map} +1 -1
- package/dist/{SSMStateStore-5dBRwVlJ.cjs → SSMStateStore-B__F7IJa.cjs} +2 -2
- package/dist/{SSMStateStore-5dBRwVlJ.cjs.map → SSMStateStore-B__F7IJa.cjs.map} +1 -1
- package/dist/{SSMStateStore-SUmvAbLi.mjs → SSMStateStore-CAQDVpoc.mjs} +2 -2
- package/dist/{SSMStateStore-SUmvAbLi.mjs.map → SSMStateStore-CAQDVpoc.mjs.map} +1 -1
- package/dist/{bundler-DXATpO1T.cjs → bundler-DLfOn0ls.cjs} +3 -3
- package/dist/{bundler-DXATpO1T.cjs.map → bundler-DLfOn0ls.cjs.map} +1 -1
- package/dist/{bundler-B5VsKW-_.mjs → bundler-DyWI41Iy.mjs} +2 -2
- package/dist/{bundler-B5VsKW-_.mjs.map → bundler-DyWI41Iy.mjs.map} +1 -1
- package/dist/{cli-DQdrVkj2.cjs → cli-D-ZM-X2s.cjs} +12 -16
- package/dist/cli-D-ZM-X2s.cjs.map +1 -0
- package/dist/{cli-DEA_J3Sa.mjs → cli-PkVF28LM.mjs} +10 -14
- package/dist/cli-PkVF28LM.mjs.map +1 -0
- package/dist/{config-DXnkCEq0.cjs → config-BEJYKd4s.cjs} +132 -18
- package/dist/config-BEJYKd4s.cjs.map +1 -0
- package/dist/config-C2BUosLm.d.mts +256 -0
- package/dist/config-C2BUosLm.d.mts.map +1 -0
- package/dist/config-CemHVcIr.d.cts +256 -0
- package/dist/config-CemHVcIr.d.cts.map +1 -0
- package/dist/{config-C5-EEdmr.mjs → config-LKKCVCnC.mjs} +109 -19
- package/dist/config-LKKCVCnC.mjs.map +1 -0
- package/dist/config.cjs +6 -2
- package/dist/config.d.cts +4 -211
- package/dist/config.d.mts +4 -211
- package/dist/config.mjs +3 -3
- 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 +174 -13
- package/dist/deploy/public.cjs.map +1 -0
- package/dist/deploy/public.d.cts +200 -292
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +200 -292
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +136 -3
- package/dist/deploy/public.mjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.cjs +54 -0
- package/dist/deploy/sniffer-envparser-worker.cjs.map +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.cts +1 -0
- package/dist/deploy/sniffer-envparser-worker.d.mts +1 -0
- package/dist/deploy/sniffer-envparser-worker.mjs +55 -0
- package/dist/deploy/sniffer-envparser-worker.mjs.map +1 -0
- package/dist/{deploy-BbJdgQ2b.cjs → deploy-ABBI0lf1.cjs} +169 -561
- package/dist/deploy-ABBI0lf1.cjs.map +1 -0
- package/dist/deploy-BiMrP9i7.cjs +140 -0
- package/dist/deploy-BiMrP9i7.cjs.map +1 -0
- package/dist/{deploy-BJcLmVTc.mjs → deploy-CG8bfFij.mjs} +152 -532
- package/dist/deploy-CG8bfFij.mjs.map +1 -0
- package/dist/deploy-CGW-QY9D.mjs +135 -0
- package/dist/deploy-CGW-QY9D.mjs.map +1 -0
- package/dist/discover-B6yPpvRV.d.mts +99 -0
- package/dist/discover-B6yPpvRV.d.mts.map +1 -0
- package/dist/discover-B_IkPukx.d.cts +99 -0
- package/dist/discover-B_IkPukx.d.cts.map +1 -0
- package/dist/discover-BaT6bpnA.mjs +614 -0
- package/dist/discover-BaT6bpnA.mjs.map +1 -0
- package/dist/discover-C_6COHEv.cjs +729 -0
- package/dist/discover-C_6COHEv.cjs.map +1 -0
- package/dist/dokploy-CwdmlyQL.mjs +32 -0
- package/dist/dokploy-CwdmlyQL.mjs.map +1 -0
- package/dist/dokploy-QJxMhxdf.cjs +32 -0
- package/dist/dokploy-QJxMhxdf.cjs.map +1 -0
- package/dist/{encryption-DaA9gRXr.mjs → encryption-CbQG_ayW.mjs} +4 -4
- package/dist/{encryption-DaA9gRXr.mjs.map → encryption-CbQG_ayW.mjs.map} +1 -1
- package/dist/{encryption-ojzUo7-z.cjs → encryption-DXw3jj0c.cjs} +4 -4
- package/dist/{encryption-ojzUo7-z.cjs.map → encryption-DXw3jj0c.cjs.map} +1 -1
- package/dist/fakes-C9RiT6XG.mjs.map +1 -1
- package/dist/fakes-zW-jNAbQ.cjs.map +1 -1
- package/dist/{github-Cq57poPj.cjs → github-BH_mETav.cjs} +3 -3
- package/dist/{github-Cq57poPj.cjs.map → github-BH_mETav.cjs.map} +1 -1
- package/dist/{github-DmCj2u95.mjs → github-ciwbIwVa.mjs} +3 -3
- package/dist/{github-DmCj2u95.mjs.map → github-ciwbIwVa.mjs.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 +60 -52
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +57 -49
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-BScRpCEx.cjs → migrate-6oa9y_f2.cjs} +5 -5
- package/dist/{migrate-BScRpCEx.cjs.map → migrate-6oa9y_f2.cjs.map} +1 -1
- package/dist/{migrate-5_J5JySj.mjs → migrate-ImBKTBcW.mjs} +5 -5
- package/dist/{migrate-5_J5JySj.mjs.map → migrate-ImBKTBcW.mjs.map} +1 -1
- package/dist/openapi.cjs +3 -3
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +3 -3
- package/dist/{ready-XlNx-Gbo.cjs → ready-BiG0rt4h.cjs} +3 -3
- package/dist/{ready-XlNx-Gbo.cjs.map → ready-BiG0rt4h.cjs.map} +1 -1
- package/dist/{ready-DQIy21W5.mjs → ready-Bpdnn2ON.mjs} +3 -3
- package/dist/{ready-DQIy21W5.mjs.map → ready-Bpdnn2ON.mjs.map} +1 -1
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.d.cts +4 -77
- package/dist/reconcile/public.d.cts.map +1 -1
- package/dist/reconcile/public.d.mts +4 -77
- package/dist/reconcile/public.d.mts.map +1 -1
- package/dist/reconcile/public.mjs +1 -1
- package/dist/resolve-B1T0hUaR.mjs +170 -0
- package/dist/resolve-B1T0hUaR.mjs.map +1 -0
- package/dist/resolve-xytBTtG4.cjs +217 -0
- package/dist/resolve-xytBTtG4.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/sandbox/config-worker.cjs +43 -0
- package/dist/sandbox/config-worker.cjs.map +1 -0
- package/dist/sandbox/config-worker.d.cts +1 -0
- package/dist/sandbox/config-worker.d.mts +1 -0
- package/dist/sandbox/config-worker.mjs +44 -0
- package/dist/sandbox/config-worker.mjs.map +1 -0
- package/dist/sandbox/discover-worker.cjs +44 -0
- package/dist/sandbox/discover-worker.cjs.map +1 -0
- package/dist/sandbox/discover-worker.d.cts +1 -0
- package/dist/sandbox/discover-worker.d.mts +1 -0
- package/dist/sandbox/discover-worker.mjs +45 -0
- package/dist/sandbox/discover-worker.mjs.map +1 -0
- package/dist/sandbox-M8UnLhXE.d.cts +126 -0
- package/dist/sandbox-M8UnLhXE.d.cts.map +1 -0
- package/dist/sandbox-M8UnLhXE.d.mts +126 -0
- package/dist/sandbox-M8UnLhXE.d.mts.map +1 -0
- package/dist/{workspace-Bp1xVaOz.mjs → schemas-Ckm_aBnF.cjs} +264 -969
- package/dist/schemas-Ckm_aBnF.cjs.map +1 -0
- package/dist/{workspace-B64Xk1Mb.cjs → schemas-D2LCF689.mjs} +195 -1155
- package/dist/schemas-D2LCF689.mjs.map +1 -0
- package/dist/{sniffer-CQmJnNJM.cjs → sniffer-D_SYc_pO.cjs} +379 -214
- package/dist/sniffer-D_SYc_pO.cjs.map +1 -0
- package/dist/{sniffer-bdleks5l.mjs → sniffer-aO_-s5vq.mjs} +346 -211
- package/dist/sniffer-aO_-s5vq.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-D0f1u0LG.cjs +576 -0
- package/dist/terminal-D0f1u0LG.cjs.map +1 -0
- package/dist/terminal-gMxAo9Dj.mjs +517 -0
- package/dist/terminal-gMxAo9Dj.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 +2 -2
- package/dist/vitest.mjs +2 -2
- package/dist/workerRuntime-BXfhbe13.cjs +108 -0
- package/dist/workerRuntime-BXfhbe13.cjs.map +1 -0
- package/dist/workerRuntime-CsOyBRx2.mjs +79 -0
- package/dist/workerRuntime-CsOyBRx2.mjs.map +1 -0
- 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-Dh7rr7l4.mjs +1024 -0
- package/dist/workspace-Dh7rr7l4.mjs.map +1 -0
- package/dist/workspace-Kl4NG9IH.cjs +1196 -0
- package/dist/workspace-Kl4NG9IH.cjs.map +1 -0
- package/package.json +23 -13
- package/dist/cli-DEA_J3Sa.mjs.map +0 -1
- package/dist/cli-DQdrVkj2.cjs.map +0 -1
- package/dist/config-C5-EEdmr.mjs.map +0 -1
- package/dist/config-DXnkCEq0.cjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/deploy-BJcLmVTc.mjs.map +0 -1
- package/dist/deploy-BbJdgQ2b.cjs.map +0 -1
- package/dist/discover-Bc-4eA_p.cjs +0 -299
- package/dist/discover-Bc-4eA_p.cjs.map +0 -1
- package/dist/discover-FrYvzkeC.mjs +0 -262
- package/dist/discover-FrYvzkeC.mjs.map +0 -1
- package/dist/sniffer-CQmJnNJM.cjs.map +0 -1
- package/dist/sniffer-bdleks5l.mjs.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
|
@@ -1,4 +1,51 @@
|
|
|
1
1
|
import { ConstructManifest } from "@geekmidas/manifest";
|
|
2
|
+
//#region src/deploy/identity.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* Who a deploy is, on a target it shares with other workspaces.
|
|
5
|
+
*
|
|
6
|
+
* A Dokploy server is one flat namespace of projects, images and Docker
|
|
7
|
+
* service names. Deploys used to identify everything they made by the
|
|
8
|
+
* workspace name alone, so two workspaces called `shop` — or `Shop` and
|
|
9
|
+
* `shop` — deploying to one server landed in the same project, pushed over
|
|
10
|
+
* each other's images and redeployed each other's applications. A
|
|
11
|
+
* `DeployIdentity` is what a deploy names and claims its resources by instead.
|
|
12
|
+
*/
|
|
13
|
+
interface DeployIdentity {
|
|
14
|
+
/**
|
|
15
|
+
* Whose deploy this is — an organisation, a team, a repository. Two
|
|
16
|
+
* workspaces with the same name are told apart by it. Defaults to the
|
|
17
|
+
* kebab-cased workspace name; set `deploy.namespace` to choose one.
|
|
18
|
+
*/
|
|
19
|
+
readonly namespace: string;
|
|
20
|
+
/** The workspace name as the target spells it: lowercase, `[a-z0-9-]`. */
|
|
21
|
+
readonly project: string;
|
|
22
|
+
readonly stage: string;
|
|
23
|
+
/**
|
|
24
|
+
* `<namespace>/<project>`: what a Dokploy project is claimed by.
|
|
25
|
+
*
|
|
26
|
+
* The stage is not part of it because one Dokploy project holds every stage
|
|
27
|
+
* of a workspace, each as an environment — the key has to be the same from
|
|
28
|
+
* every stage that deploys into it.
|
|
29
|
+
*/
|
|
30
|
+
readonly key: string;
|
|
31
|
+
/**
|
|
32
|
+
* The prefix every name on the target carries: the project alone in the
|
|
33
|
+
* default namespace, `<namespace>-<project>` in any other.
|
|
34
|
+
*
|
|
35
|
+
* The default adds nothing so that a workspace that never set a namespace
|
|
36
|
+
* keeps the names it was already deployed under — a Postgres is found by
|
|
37
|
+
* its name, and a new name would be a new, empty database.
|
|
38
|
+
*/
|
|
39
|
+
readonly scope: string;
|
|
40
|
+
}
|
|
41
|
+
/** What an identity is derived from: a workspace's name and namespace. */
|
|
42
|
+
interface IdentitySource {
|
|
43
|
+
name: string;
|
|
44
|
+
deploy?: {
|
|
45
|
+
namespace?: string;
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
declare function deployIdentity(workspace: IdentitySource, stage: string): DeployIdentity;
|
|
2
49
|
//#endregion
|
|
3
50
|
//#region src/secrets/types.d.ts
|
|
4
51
|
/** Credentials for a specific service */
|
|
@@ -356,6 +403,545 @@ interface CustomStateConfig {
|
|
|
356
403
|
* State configuration types.
|
|
357
404
|
*/
|
|
358
405
|
type StateConfig = LocalStateConfig | SSMStateConfig | S3StateConfig | CustomStateConfig;
|
|
406
|
+
//#endregion
|
|
407
|
+
//#region src/deploy/credentials.d.ts
|
|
408
|
+
/**
|
|
409
|
+
* How a deploy gets the credentials it acts with.
|
|
410
|
+
*
|
|
411
|
+
* `deploy()` never prompts and never reads a terminal: it asks a
|
|
412
|
+
* `CredentialProvider` and, when the provider has nothing, stops with
|
|
413
|
+
* `MissingCredential` naming what it needed and how to supply it. Whether to
|
|
414
|
+
* ask a person, read a vault or fail is the caller's decision — `gkm deploy`
|
|
415
|
+
* prompts at a terminal and stores what was typed; a CI job sets the
|
|
416
|
+
* environment; a host passes its own provider.
|
|
417
|
+
*/
|
|
418
|
+
/**
|
|
419
|
+
* What each kind of credential is asked for with, and what it is.
|
|
420
|
+
*
|
|
421
|
+
* A target that needs a kind the CLI does not know declares it by augmenting
|
|
422
|
+
* this interface, and lists it in its `credentials`:
|
|
423
|
+
*
|
|
424
|
+
* ```ts
|
|
425
|
+
* declare module '@geekmidas/cli/target' {
|
|
426
|
+
* interface CredentialKinds {
|
|
427
|
+
* fly: { request: { org: string }; value: { token: string } };
|
|
428
|
+
* }
|
|
429
|
+
* }
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
432
|
+
interface CredentialKinds {
|
|
433
|
+
/** The Dokploy API a stage deploys through. */
|
|
434
|
+
dokploy: {
|
|
435
|
+
/** `deploy.dokploy.endpoint`, when the config names one. */
|
|
436
|
+
request: {
|
|
437
|
+
endpoint?: string;
|
|
438
|
+
};
|
|
439
|
+
value: {
|
|
440
|
+
endpoint: string;
|
|
441
|
+
token: string;
|
|
442
|
+
};
|
|
443
|
+
};
|
|
444
|
+
/**
|
|
445
|
+
* A container registry login, for Dokploy to pull with. Asked for only when
|
|
446
|
+
* Dokploy has no registry for `deploy.dokploy.registry` and one has to be
|
|
447
|
+
* created.
|
|
448
|
+
*/
|
|
449
|
+
registry: {
|
|
450
|
+
/** `deploy.dokploy.registry`. */
|
|
451
|
+
request: {
|
|
452
|
+
url: string;
|
|
453
|
+
};
|
|
454
|
+
value: {
|
|
455
|
+
username: string;
|
|
456
|
+
password: string;
|
|
457
|
+
};
|
|
458
|
+
};
|
|
459
|
+
}
|
|
460
|
+
type CredentialKind = keyof CredentialKinds;
|
|
461
|
+
/** What a deploy asks a provider for. */
|
|
462
|
+
type CredentialRequest<K extends CredentialKind = CredentialKind> = { [P in K]: {
|
|
463
|
+
kind: P;
|
|
464
|
+
} & CredentialKinds[P]['request']; }[K];
|
|
465
|
+
/** What a provider answers with. */
|
|
466
|
+
type Credential<K extends CredentialKind> = CredentialKinds[K]['value'];
|
|
467
|
+
interface CredentialProvider {
|
|
468
|
+
/**
|
|
469
|
+
* The credential `request` asks for, or `undefined` when this provider has
|
|
470
|
+
* none — the deploy then raises {@link MissingCredential}.
|
|
471
|
+
*/
|
|
472
|
+
get<K extends CredentialKind>(request: CredentialRequest<K>, options?: {
|
|
473
|
+
signal?: AbortSignal;
|
|
474
|
+
}): Promise<Credential<K> | undefined>;
|
|
475
|
+
}
|
|
476
|
+
/** A deploy needed a credential, and its provider had none. */
|
|
477
|
+
declare class MissingCredential extends Error {
|
|
478
|
+
readonly kind: CredentialKind;
|
|
479
|
+
/** What it was for: the Dokploy endpoint or the registry URL. */
|
|
480
|
+
readonly target: string | undefined;
|
|
481
|
+
/** How to supply it. */
|
|
482
|
+
readonly howToProvide: string;
|
|
483
|
+
constructor(kind: CredentialKind,
|
|
484
|
+
/** What it was for: the Dokploy endpoint or the registry URL. */
|
|
485
|
+
target: string | undefined,
|
|
486
|
+
/** How to supply it. */
|
|
487
|
+
howToProvide?: string);
|
|
488
|
+
}
|
|
489
|
+
/** Whatever was asked for, from the first provider that has it. */
|
|
490
|
+
declare function chainCredentials(...providers: CredentialProvider[]): CredentialProvider;
|
|
491
|
+
interface StoredCredentialsOptions {
|
|
492
|
+
/** Where to read the variables from. Defaults to `process.env`. */
|
|
493
|
+
env?: NodeJS.ProcessEnv;
|
|
494
|
+
/**
|
|
495
|
+
* The CLI's home, whose `credentials.json` holds stored logins. Defaults
|
|
496
|
+
* to `GKM_HOME`, else `~/.gkm`.
|
|
497
|
+
*/
|
|
498
|
+
home?: string;
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Credentials from the environment, then from what `gkm login` stored. What
|
|
502
|
+
* `deploy()` uses when it is handed no provider.
|
|
503
|
+
*
|
|
504
|
+
* - Dokploy: `DOKPLOY_API_TOKEN` / `DOKPLOY_ENDPOINT`, each falling back to
|
|
505
|
+
* the stored login, and the endpoint finally to `deploy.dokploy.endpoint`.
|
|
506
|
+
* Each half is read on its own: a token is a secret and belongs in the
|
|
507
|
+
* environment, an endpoint is configuration and belongs in the config.
|
|
508
|
+
* - Registry: `DOCKER_REGISTRY_USERNAME` / `DOCKER_REGISTRY_PASSWORD`.
|
|
509
|
+
*/
|
|
510
|
+
declare function storedCredentials(options?: StoredCredentialsOptions): CredentialProvider;
|
|
511
|
+
//#endregion
|
|
512
|
+
//#region src/deploy/types.d.ts
|
|
513
|
+
/** Result for a single app deployment in workspace mode */
|
|
514
|
+
interface AppDeployResult {
|
|
515
|
+
/** App name */
|
|
516
|
+
appName: string;
|
|
517
|
+
/** App type */
|
|
518
|
+
type: 'backend' | 'web' | 'mobile';
|
|
519
|
+
/** Whether deployment succeeded */
|
|
520
|
+
success: boolean;
|
|
521
|
+
/** Dokploy application ID */
|
|
522
|
+
applicationId?: string;
|
|
523
|
+
/** Docker image reference */
|
|
524
|
+
imageRef?: string;
|
|
525
|
+
/** The registry's digest for the image, `sha256:…`, once pushed */
|
|
526
|
+
digest?: string;
|
|
527
|
+
/** Deployment URL */
|
|
528
|
+
url?: string;
|
|
529
|
+
/** Error message if failed */
|
|
530
|
+
error?: string;
|
|
531
|
+
}
|
|
532
|
+
/** Result from workspace deployment */
|
|
533
|
+
interface WorkspaceDeployResult {
|
|
534
|
+
/** Results for each app */
|
|
535
|
+
apps: AppDeployResult[];
|
|
536
|
+
/** Dokploy project ID */
|
|
537
|
+
projectId: string;
|
|
538
|
+
/** Total number of successful deployments */
|
|
539
|
+
successCount: number;
|
|
540
|
+
/** Total number of failed deployments */
|
|
541
|
+
failedCount: number;
|
|
542
|
+
}
|
|
543
|
+
/**
|
|
544
|
+
* What a deploy did — or, for a dry run, would do. Plain JSON, so it can be
|
|
545
|
+
* written out as is (`gkm deploy --json` ends with it).
|
|
546
|
+
*/
|
|
547
|
+
interface DeployResult extends WorkspaceDeployResult {
|
|
548
|
+
stage: string;
|
|
549
|
+
/** `<namespace>/<project>`. */
|
|
550
|
+
identity: string;
|
|
551
|
+
/** The image tag every app was built with. */
|
|
552
|
+
tag: string;
|
|
553
|
+
/** Whether this was a dry run: nothing was created, built or pushed. */
|
|
554
|
+
dryRun: boolean;
|
|
555
|
+
/** Dokploy's environment for the stage; empty when a dry run would create it. */
|
|
556
|
+
environmentId: string;
|
|
557
|
+
/** Apps left out, and why — a mobile app, another deploy target. */
|
|
558
|
+
skipped: {
|
|
559
|
+
app: string;
|
|
560
|
+
reason: string;
|
|
561
|
+
}[];
|
|
562
|
+
/** Each deployed app's public URL. */
|
|
563
|
+
urls: Record<string, string>;
|
|
564
|
+
/**
|
|
565
|
+
* Every resource the run touched, in order: what it applied, or for a dry
|
|
566
|
+
* run, what it would.
|
|
567
|
+
*/
|
|
568
|
+
changes: ResourceChange[];
|
|
569
|
+
}
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/deploy/events.d.ts
|
|
572
|
+
/**
|
|
573
|
+
* The stretch of a deploy an event belongs to.
|
|
574
|
+
*
|
|
575
|
+
* - `validate`: the config, the target, the stage, the apps, the lock, the
|
|
576
|
+
* stage's secrets and what each app reads from its environment
|
|
577
|
+
* - `plan`: a dry run's lookups — what would be created and what reused
|
|
578
|
+
* - `provision`: what the apps run on — for Dokploy the project, environment
|
|
579
|
+
* and registry — and the declared constructs
|
|
580
|
+
* - `build`: each app's artifact, built without changing anything live
|
|
581
|
+
* - `release`: the artifacts put live. Dokploy builds and pushes each image
|
|
582
|
+
* here, beside its application, because a site's build args are resolved
|
|
583
|
+
* per app
|
|
584
|
+
* - `verify`: what was released answers — for Dokploy, DNS records and its
|
|
585
|
+
* domain validation
|
|
586
|
+
* - `rollback`: the previous release restored, after `release` or `verify`
|
|
587
|
+
* failed, on a target that can
|
|
588
|
+
*/
|
|
589
|
+
type DeployPhase = 'validate' | 'plan' | 'provision' | 'build' | 'release' | 'verify' | 'rollback';
|
|
590
|
+
/** An error, as an event carries it. */
|
|
591
|
+
interface DeployEventError {
|
|
592
|
+
/** The error's class name — `MissingCredential`, `StateLocked`. */
|
|
593
|
+
name: string;
|
|
594
|
+
message: string;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* How a resource came to be used:
|
|
598
|
+
* - `recorded`: the id the stage's state holds still resolves
|
|
599
|
+
* - `resumed`: a run that died after creating it is picked up
|
|
600
|
+
* - `found`: it existed and was looked up
|
|
601
|
+
* - `created`: this run created it
|
|
602
|
+
*/
|
|
603
|
+
type ResourceVia = 'recorded' | 'resumed' | 'found' | 'created';
|
|
604
|
+
/** One resource a deploy touches, planned or applied. */
|
|
605
|
+
interface ResourceChange {
|
|
606
|
+
/** `<type>:<name>`, unique within the stage — `application:api`. */
|
|
607
|
+
key: string;
|
|
608
|
+
/** `project`, `environment`, `registry`, `application`, `domain`, `image`, or a construct's kind. */
|
|
609
|
+
resourceType: string;
|
|
610
|
+
/**
|
|
611
|
+
* For a plan: whether the run would create it, reuse what exists, or
|
|
612
|
+
* ensure it (look it up, and create it if missing). For an applied change:
|
|
613
|
+
* what was done.
|
|
614
|
+
*/
|
|
615
|
+
action: 'create' | 'reuse' | 'ensure' | 'build';
|
|
616
|
+
/** The target's id, once there is one. */
|
|
617
|
+
id?: string;
|
|
618
|
+
}
|
|
619
|
+
type DeployEvent = {
|
|
620
|
+
type: 'deploy.started';
|
|
621
|
+
stage: string;
|
|
622
|
+
/** The target the run deploys through, by the name it was given. */
|
|
623
|
+
target: string;
|
|
624
|
+
/** `<namespace>/<project>`. */
|
|
625
|
+
identity: string;
|
|
626
|
+
tag: string;
|
|
627
|
+
/** The apps this run deploys, in order. */
|
|
628
|
+
apps: string[];
|
|
629
|
+
dryRun: boolean;
|
|
630
|
+
} | {
|
|
631
|
+
type: 'phase.started';
|
|
632
|
+
phase: DeployPhase;
|
|
633
|
+
} | {
|
|
634
|
+
type: 'phase.finished';
|
|
635
|
+
phase: DeployPhase;
|
|
636
|
+
} |
|
|
637
|
+
/** A phase threw; `deploy.failed` follows (after a rollback, if any). */
|
|
638
|
+
{
|
|
639
|
+
type: 'phase.failed';
|
|
640
|
+
phase: DeployPhase;
|
|
641
|
+
error: DeployEventError;
|
|
642
|
+
} |
|
|
643
|
+
/**
|
|
644
|
+
* A progress line, exactly as `gkm deploy` prints it — leading newline and
|
|
645
|
+
* indentation included, so a terminal renderer prints `message` as is.
|
|
646
|
+
*/
|
|
647
|
+
{
|
|
648
|
+
type: 'log';
|
|
649
|
+
level: 'info' | 'warn' | 'error';
|
|
650
|
+
message: string;
|
|
651
|
+
} | {
|
|
652
|
+
type: 'app.skipped';
|
|
653
|
+
app: string;
|
|
654
|
+
reason: string;
|
|
655
|
+
} | ({
|
|
656
|
+
type: 'resource.planned';
|
|
657
|
+
} & ResourceChange) | ({
|
|
658
|
+
type: 'resource.applied';
|
|
659
|
+
via: ResourceVia;
|
|
660
|
+
} & ResourceChange & {
|
|
661
|
+
id: string;
|
|
662
|
+
}) | {
|
|
663
|
+
type: 'artifact.built';
|
|
664
|
+
app: string;
|
|
665
|
+
imageRef: string;
|
|
666
|
+
/** The registry's digest, `sha256:…`, once pushed. */
|
|
667
|
+
digest?: string;
|
|
668
|
+
} | {
|
|
669
|
+
type: 'app.deployed';
|
|
670
|
+
app: string;
|
|
671
|
+
applicationId: string;
|
|
672
|
+
imageRef: string;
|
|
673
|
+
url: string;
|
|
674
|
+
} | {
|
|
675
|
+
type: 'app.failed';
|
|
676
|
+
app: string;
|
|
677
|
+
error: DeployEventError;
|
|
678
|
+
} |
|
|
679
|
+
/** One check of whether a released app answers. */
|
|
680
|
+
{
|
|
681
|
+
type: 'health.checked';
|
|
682
|
+
app: string;
|
|
683
|
+
/** What was asked: a URL, or the target's own status check. */
|
|
684
|
+
url: string;
|
|
685
|
+
healthy: boolean;
|
|
686
|
+
/** The HTTP status, when the check was a request. */
|
|
687
|
+
status?: number;
|
|
688
|
+
/** 1 for the first check of the app in this run. */
|
|
689
|
+
attempt: number;
|
|
690
|
+
} | {
|
|
691
|
+
type: 'deploy.finished';
|
|
692
|
+
result: DeployResult;
|
|
693
|
+
} | {
|
|
694
|
+
type: 'deploy.failed';
|
|
695
|
+
error: DeployEventError;
|
|
696
|
+
};
|
|
697
|
+
/** Every `type` a deploy event can have. */
|
|
698
|
+
type DeployEventType = DeployEvent['type'];
|
|
699
|
+
//#endregion
|
|
700
|
+
//#region src/target/types.d.ts
|
|
701
|
+
/**
|
|
702
|
+
* Which family of defaults a target's deploys belong to.
|
|
703
|
+
*
|
|
704
|
+
* - `server`: the target runs containers the project controls, so a cache can
|
|
705
|
+
* live in the database and events go through pg-boss.
|
|
706
|
+
* - `aws`: the target runs on managed AWS services, so the defaults are
|
|
707
|
+
* Upstash, S3 and SNS/SQS.
|
|
708
|
+
*
|
|
709
|
+
* `gkm dev` and `gkm build` choose backends by it, which is why a target from
|
|
710
|
+
* a package declares it in its `package.json` too: they read it without
|
|
711
|
+
* importing the target.
|
|
712
|
+
*/
|
|
713
|
+
type DeployRuntime = 'server' | 'aws';
|
|
714
|
+
/** What a target can do, beyond the phases every target has. */
|
|
715
|
+
interface DeployTargetCapabilities {
|
|
716
|
+
/**
|
|
717
|
+
* Whether `rollback` restores the previous release. When it does, a failed
|
|
718
|
+
* `release` or `verify` is rolled back before the deploy reports failure.
|
|
719
|
+
*/
|
|
720
|
+
rollback: boolean;
|
|
721
|
+
/**
|
|
722
|
+
* Who applies database migrations: the target, as part of `release`, or
|
|
723
|
+
* the app itself when it starts.
|
|
724
|
+
*/
|
|
725
|
+
migrations: 'target' | 'app';
|
|
726
|
+
/**
|
|
727
|
+
* Whether the target builds container images — and so needs Docker where
|
|
728
|
+
* the deploy runs, and a registry to push to.
|
|
729
|
+
*/
|
|
730
|
+
images: boolean;
|
|
731
|
+
}
|
|
732
|
+
/** A failed validation of a target's options, issue by issue. */
|
|
733
|
+
interface TargetOptionsIssue {
|
|
734
|
+
readonly message: string;
|
|
735
|
+
readonly path?: ReadonlyArray<PropertyKey | {
|
|
736
|
+
readonly key: PropertyKey;
|
|
737
|
+
}>;
|
|
738
|
+
}
|
|
739
|
+
type TargetOptionsResult<Output> = {
|
|
740
|
+
readonly value: Output;
|
|
741
|
+
readonly issues?: undefined;
|
|
742
|
+
} | {
|
|
743
|
+
readonly issues: ReadonlyArray<TargetOptionsIssue>;
|
|
744
|
+
};
|
|
745
|
+
/**
|
|
746
|
+
* The schema a target's options are validated with: any Standard Schema —
|
|
747
|
+
* a Zod, Valibot or ArkType schema is one.
|
|
748
|
+
*
|
|
749
|
+
* The interface is the Standard Schema spec's own, copied as the spec asks,
|
|
750
|
+
* so a target's types do not depend on a package the CLI does not ship.
|
|
751
|
+
*/
|
|
752
|
+
interface TargetOptionsSchema<Output = unknown> {
|
|
753
|
+
readonly '~standard': {
|
|
754
|
+
readonly version: 1;
|
|
755
|
+
readonly vendor: string;
|
|
756
|
+
readonly validate: (value: unknown) => TargetOptionsResult<Output> | Promise<TargetOptionsResult<Output>>;
|
|
757
|
+
readonly types?: {
|
|
758
|
+
readonly input: unknown;
|
|
759
|
+
readonly output: Output;
|
|
760
|
+
} | undefined;
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* The stage's secrets, as a target reads and writes them.
|
|
765
|
+
*
|
|
766
|
+
* Every secret value read through here is masked: a progress line that
|
|
767
|
+
* would print one prints `***` instead, in the terminal and in the events.
|
|
768
|
+
*/
|
|
769
|
+
interface DeploySecrets {
|
|
770
|
+
/** Which kind of store holds them — `'file'`, `'ssm'`, or a custom one's. */
|
|
771
|
+
readonly store: string;
|
|
772
|
+
/** The stage's secrets, or null when it has none yet. */
|
|
773
|
+
read(): Promise<StageSecrets | null>;
|
|
774
|
+
/** Replace the stage's secrets. */
|
|
775
|
+
write(secrets: StageSecrets): Promise<void>;
|
|
776
|
+
/** Mask `value` in everything this run prints or emits from now on. */
|
|
777
|
+
mask(value: string): void;
|
|
778
|
+
}
|
|
779
|
+
/** Where a target's progress lines go: `log` events of the run. */
|
|
780
|
+
interface DeployTargetLogger {
|
|
781
|
+
info(message: string): void;
|
|
782
|
+
warn(message: string): void;
|
|
783
|
+
error(message: string): void;
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* The events a target reports. The run's own — `deploy.*` and `phase.*` —
|
|
787
|
+
* are the CLI's, which emits them around each phase it calls.
|
|
788
|
+
*/
|
|
789
|
+
type TargetEvent = Exclude<DeployEvent, {
|
|
790
|
+
type: 'deploy.started' | 'deploy.finished' | 'deploy.failed' | 'phase.started' | 'phase.finished' | 'phase.failed';
|
|
791
|
+
}>;
|
|
792
|
+
/** Everything a phase is handed. The same object for every phase of a run. */
|
|
793
|
+
interface DeployPhaseContext<Options = undefined> {
|
|
794
|
+
/** The name the target was resolved by — `deploy.default`, `--target`. */
|
|
795
|
+
readonly target: string;
|
|
796
|
+
/**
|
|
797
|
+
* The workspace root. Never `process.cwd()`: a host deploys projects
|
|
798
|
+
* that are not where it runs.
|
|
799
|
+
*/
|
|
800
|
+
readonly cwd: string;
|
|
801
|
+
readonly stage: string;
|
|
802
|
+
/** The image tag, or whatever version label the target releases under. */
|
|
803
|
+
readonly tag: string;
|
|
804
|
+
/**
|
|
805
|
+
* The apps this target deploys, in dependency order: those asked for that
|
|
806
|
+
* deploy here. Apps that deploy elsewhere are already in `skipped`.
|
|
807
|
+
*/
|
|
808
|
+
readonly apps: readonly string[];
|
|
809
|
+
/** The apps the run leaves out, and why. */
|
|
810
|
+
readonly skipped: readonly {
|
|
811
|
+
app: string;
|
|
812
|
+
reason: string;
|
|
813
|
+
}[];
|
|
814
|
+
/** Who the deploy is, for naming and claiming what it creates. */
|
|
815
|
+
readonly identity: DeployIdentity;
|
|
816
|
+
/** The workspace, with its apps derived from the manifest. */
|
|
817
|
+
readonly workspace: NormalizedWorkspace;
|
|
818
|
+
/** What the workspace declares. */
|
|
819
|
+
readonly manifest: ConstructManifest;
|
|
820
|
+
/** The target's options, as its `options` schema parsed them. */
|
|
821
|
+
readonly options: Options;
|
|
822
|
+
/**
|
|
823
|
+
* Look everything up and report what would happen — as `resource.planned`
|
|
824
|
+
* events — without changing anything. Only `validate` and `plan` run.
|
|
825
|
+
*/
|
|
826
|
+
readonly dryRun: boolean;
|
|
827
|
+
/** Where every credential comes from. Nothing prompts. */
|
|
828
|
+
readonly credentials: CredentialProvider;
|
|
829
|
+
/**
|
|
830
|
+
* The stage's deploy state. A real run holds the stage's lock for every
|
|
831
|
+
* phase; a dry run holds none and must write nothing.
|
|
832
|
+
*/
|
|
833
|
+
readonly state: StateStore;
|
|
834
|
+
readonly secrets: DeploySecrets;
|
|
835
|
+
readonly logger: DeployTargetLogger;
|
|
836
|
+
/** Fires when the run is stopped; every phase stops what it is doing. */
|
|
837
|
+
readonly signal: AbortSignal;
|
|
838
|
+
/**
|
|
839
|
+
* Where the output of what a phase spawns goes: the host's terminal, its
|
|
840
|
+
* stderr (so stdout carries only events), or nowhere.
|
|
841
|
+
*/
|
|
842
|
+
readonly childOutput: 'inherit' | 'stderr' | 'ignore';
|
|
843
|
+
/** Report progress. */
|
|
844
|
+
emit(event: TargetEvent): void;
|
|
845
|
+
/** Leave an app out of this run, with the reason a person will read. */
|
|
846
|
+
skip(app: string, reason: string): void;
|
|
847
|
+
/**
|
|
848
|
+
* What a resource is called on the target: scoped by the stage and the
|
|
849
|
+
* identity exactly as the constructs are — `name('api')` is
|
|
850
|
+
* `production-shop-api`. Two workspaces, or two stages, never share one.
|
|
851
|
+
*/
|
|
852
|
+
name(resource: string): string;
|
|
853
|
+
}
|
|
854
|
+
/** Why `rollback` was called: the phase that failed, and its error. */
|
|
855
|
+
interface DeployFailure {
|
|
856
|
+
readonly phase: 'release' | 'verify';
|
|
857
|
+
readonly error: unknown;
|
|
858
|
+
}
|
|
859
|
+
/**
|
|
860
|
+
* A deploy target.
|
|
861
|
+
*
|
|
862
|
+
* The CLI calls the phases in order — `validate`, then `plan` for a dry run,
|
|
863
|
+
* or `provision → build → release → verify` for a real one — emitting
|
|
864
|
+
* `phase.started`/`phase.finished` around each. Every phase must be safe to
|
|
865
|
+
* run again: a deploy stopped part way is finished by deploying again, so a
|
|
866
|
+
* phase finds what an earlier run made (through `state`) before making it.
|
|
867
|
+
*
|
|
868
|
+
* `Run` is whatever the target carries from one phase to the next within a
|
|
869
|
+
* run — `validate` makes it, every later phase is handed it.
|
|
870
|
+
*
|
|
871
|
+
* ```ts
|
|
872
|
+
* import { defineTarget } from '@geekmidas/cli/target';
|
|
873
|
+
* import { z } from 'zod';
|
|
874
|
+
*
|
|
875
|
+
* export default defineTarget({
|
|
876
|
+
* name: 'fly',
|
|
877
|
+
* runtime: 'server',
|
|
878
|
+
* capabilities: { rollback: true, migrations: 'target', images: true },
|
|
879
|
+
* options: z.object({ org: z.string(), region: z.string().default('ams') }),
|
|
880
|
+
* async validate(ctx) {
|
|
881
|
+
* return { org: ctx.options.org, region: ctx.options.region };
|
|
882
|
+
* },
|
|
883
|
+
* async plan(ctx, run) { … },
|
|
884
|
+
* async release(ctx, run) { … },
|
|
885
|
+
* async rollback(ctx, run, failure) { … },
|
|
886
|
+
* result(ctx, run) { … },
|
|
887
|
+
* });
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
890
|
+
interface DeployTarget<Options = undefined, Run = unknown> {
|
|
891
|
+
/** The target's own name, for messages. Config refers to it by its key. */
|
|
892
|
+
readonly name: string;
|
|
893
|
+
readonly runtime: DeployRuntime;
|
|
894
|
+
readonly capabilities: DeployTargetCapabilities;
|
|
895
|
+
/**
|
|
896
|
+
* What `deploy.targets` may pass it — `[package, options]` — validated
|
|
897
|
+
* before any phase runs. Without one, the target takes no options.
|
|
898
|
+
*/
|
|
899
|
+
readonly options?: TargetOptionsSchema<Options>;
|
|
900
|
+
/**
|
|
901
|
+
* The kinds of credential it asks the run's `CredentialProvider` for, so a
|
|
902
|
+
* host or `gkm login` can collect them up front.
|
|
903
|
+
*/
|
|
904
|
+
readonly credentials?: readonly CredentialKind[];
|
|
905
|
+
/**
|
|
906
|
+
* Everything the deploy needs, checked before anything changes: the
|
|
907
|
+
* config, the apps, credentials, the stage's secrets.
|
|
908
|
+
*/
|
|
909
|
+
validate(ctx: DeployPhaseContext<Options>): Promise<Run>;
|
|
910
|
+
/** A dry run: emit `resource.planned` for what a real run would do. */
|
|
911
|
+
plan(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
|
|
912
|
+
/** Create or find what the apps run on, and what they declare. */
|
|
913
|
+
provision?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
|
|
914
|
+
/** Build each app's artifact (`artifact.built`), changing nothing live. */
|
|
915
|
+
build?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
|
|
916
|
+
/** Put the built artifacts live (`app.deployed`). */
|
|
917
|
+
release(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
|
|
918
|
+
/** Check what was released answers (`health.checked`). */
|
|
919
|
+
verify?(ctx: DeployPhaseContext<Options>, run: Run): Promise<void>;
|
|
920
|
+
/**
|
|
921
|
+
* Restore the previous release, after `release` or `verify` failed. Called
|
|
922
|
+
* only when `capabilities.rollback` is true.
|
|
923
|
+
*/
|
|
924
|
+
rollback?(ctx: DeployPhaseContext<Options>, run: Run, failure: DeployFailure): Promise<void>;
|
|
925
|
+
/** What the run did, once its last phase has finished. */
|
|
926
|
+
result(ctx: DeployPhaseContext<Options>, run: Run): DeployResult | Promise<DeployResult>;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* A target of any options and run state — what the CLI holds once a target
|
|
930
|
+
* is resolved, its types left behind in the config that named it. The phases
|
|
931
|
+
* are methods, so their parameters are compared bivariantly and every
|
|
932
|
+
* `DeployTarget<O, R>` is one.
|
|
933
|
+
*/
|
|
934
|
+
type AnyDeployTarget = DeployTarget<unknown, unknown>;
|
|
935
|
+
/** A target's options type, from the target. */
|
|
936
|
+
type TargetOptions<T> = T extends DeployTarget<infer O, infer _Run> ? O : never;
|
|
937
|
+
/**
|
|
938
|
+
* One `deploy.targets` entry:
|
|
939
|
+
*
|
|
940
|
+
* - `'@acme/gkm-target'` — a package, its default export the target
|
|
941
|
+
* - a target object, from `defineTarget` or a package's factory
|
|
942
|
+
* - `['@acme/gkm-target', { region: 'ams' }]` — either, with options
|
|
943
|
+
*/
|
|
944
|
+
type DeployTargetEntry = string | AnyDeployTarget | readonly [string | AnyDeployTarget, unknown];
|
|
359
945
|
declare namespace json_schema_d_exports {
|
|
360
946
|
export { ArraySchema, BaseSchema, BooleanSchema, IntegerSchema, JSONSchema, NullSchema, NumberSchema, ObjectSchema, Schema$1 as Schema, SchemaType, StringSchema, _JSONSchema };
|
|
361
947
|
}
|
|
@@ -4747,17 +5333,18 @@ declare const FrameworkSchema: ZodUnion<readonly [ZodEnum<{
|
|
|
4747
5333
|
*/
|
|
4748
5334
|
type Framework = output$1<typeof FrameworkSchema>;
|
|
4749
5335
|
/**
|
|
4750
|
-
*
|
|
5336
|
+
* The built-in targets a config may name: `dokploy`, deployed by
|
|
5337
|
+
* `gkm deploy`, and `sst`, deployed by `sst deploy` from the manifest
|
|
5338
|
+
* `gkm build` writes.
|
|
4751
5339
|
*/
|
|
4752
|
-
declare const SUPPORTED_DEPLOY_TARGETS:
|
|
5340
|
+
declare const SUPPORTED_DEPLOY_TARGETS: string[];
|
|
5341
|
+
/** Built-in names reserved for targets that do not exist yet. */
|
|
5342
|
+
declare const PHASE_2_DEPLOY_TARGETS: string[];
|
|
4753
5343
|
/**
|
|
4754
|
-
*
|
|
5344
|
+
* Whether a config may name `target`: a usable built-in, or one of its own
|
|
5345
|
+
* `deploy.targets`.
|
|
4755
5346
|
*/
|
|
4756
|
-
declare
|
|
4757
|
-
/**
|
|
4758
|
-
* Check if a deploy target is supported.
|
|
4759
|
-
*/
|
|
4760
|
-
declare function isDeployTargetSupported(target: string): boolean;
|
|
5347
|
+
declare function isDeployTargetSupported(target: string, targets?: Record<string, unknown>): boolean;
|
|
4761
5348
|
/**
|
|
4762
5349
|
* Check if a deploy target is planned for Phase 2.
|
|
4763
5350
|
*/
|
|
@@ -4939,12 +5526,7 @@ declare const WorkspaceConfigSchema: ZodObject<{
|
|
|
4939
5526
|
path: ZodString;
|
|
4940
5527
|
port: ZodNumber;
|
|
4941
5528
|
dependencies: ZodOptional<ZodArray<ZodString>>;
|
|
4942
|
-
deploy: ZodOptional<
|
|
4943
|
-
cloudflare: "cloudflare";
|
|
4944
|
-
dokploy: "dokploy";
|
|
4945
|
-
sst: "sst";
|
|
4946
|
-
vercel: "vercel";
|
|
4947
|
-
}>>;
|
|
5529
|
+
deploy: ZodOptional<ZodString>;
|
|
4948
5530
|
constructs: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
|
|
4949
5531
|
routes: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
|
|
4950
5532
|
functions: ZodOptional<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>;
|
|
@@ -5006,12 +5588,8 @@ declare const WorkspaceConfigSchema: ZodObject<{
|
|
|
5006
5588
|
}, $strip>>;
|
|
5007
5589
|
}, $strip>>;
|
|
5008
5590
|
deploy: ZodOptional<ZodObject<{
|
|
5009
|
-
default: ZodOptional<
|
|
5010
|
-
|
|
5011
|
-
dokploy: "dokploy";
|
|
5012
|
-
sst: "sst";
|
|
5013
|
-
vercel: "vercel";
|
|
5014
|
-
}>>;
|
|
5591
|
+
default: ZodOptional<ZodString>;
|
|
5592
|
+
targets: ZodOptional<ZodRecord<ZodString, ZodUnion<readonly [ZodString, ZodCustom<unknown, unknown>, ZodTuple<[ZodUnion<readonly [ZodString, ZodCustom<unknown, unknown>]>, ZodUnknown], null>]>>>;
|
|
5015
5593
|
namespace: ZodOptional<ZodString>;
|
|
5016
5594
|
domains: ZodOptional<ZodRecord<ZodString, ZodString>>;
|
|
5017
5595
|
dokploy: ZodOptional<ZodObject<{
|
|
@@ -5328,21 +5906,16 @@ declare function formatValidationErrors(error: ZodError): string;
|
|
|
5328
5906
|
//#endregion
|
|
5329
5907
|
//#region src/workspace/types.d.ts
|
|
5330
5908
|
/**
|
|
5331
|
-
*
|
|
5332
|
-
*
|
|
5333
|
-
* Specifies where the app will be deployed.
|
|
5909
|
+
* Where a stage — or one app — deploys, by target name: a built-in
|
|
5910
|
+
* (`dokploy`; `sst`, deployed by SST itself) or a key of `deploy.targets`.
|
|
5334
5911
|
*
|
|
5335
5912
|
* @example
|
|
5336
5913
|
* ```ts
|
|
5337
|
-
* // Currently supported
|
|
5338
5914
|
* deploy: 'dokploy'
|
|
5339
|
-
*
|
|
5340
|
-
* // Future support (not yet implemented)
|
|
5341
|
-
* deploy: 'vercel'
|
|
5342
|
-
* deploy: 'cloudflare'
|
|
5915
|
+
* deploy: 'acme' // deploy: { targets: { acme: '@acme/gkm-target' } }
|
|
5343
5916
|
* ```
|
|
5344
5917
|
*/
|
|
5345
|
-
type
|
|
5918
|
+
type DeployTargetName = 'dokploy' | 'sst' | (string & {});
|
|
5346
5919
|
/**
|
|
5347
5920
|
* Each deployed stage's base domain — `deploy.domains`.
|
|
5348
5921
|
*
|
|
@@ -5460,7 +6033,24 @@ interface DokployWorkspaceConfig {
|
|
|
5460
6033
|
*/
|
|
5461
6034
|
interface DeployConfig {
|
|
5462
6035
|
/** Default deploy target for all apps (default: 'dokploy') */
|
|
5463
|
-
default?:
|
|
6036
|
+
default?: DeployTargetName;
|
|
6037
|
+
/**
|
|
6038
|
+
* Targets that do not ship with the CLI, by the name `default` (or an
|
|
6039
|
+
* app's `deploy`) uses: a package whose default export is the target, a
|
|
6040
|
+
* target object, or either with its options.
|
|
6041
|
+
*
|
|
6042
|
+
* ```ts
|
|
6043
|
+
* targets: {
|
|
6044
|
+
* acme: '@acme/gkm-target',
|
|
6045
|
+
* fly: ['@acme/gkm-fly', { org: 'acme' }],
|
|
6046
|
+
* local: defineTarget({ … }),
|
|
6047
|
+
* }
|
|
6048
|
+
* ```
|
|
6049
|
+
*
|
|
6050
|
+
* A package is never guessed from a name: it is installed and listed here.
|
|
6051
|
+
* A built-in's name cannot be taken.
|
|
6052
|
+
*/
|
|
6053
|
+
targets?: Record<string, DeployTargetEntry>;
|
|
5464
6054
|
/**
|
|
5465
6055
|
* Whose deploy this is, on a target shared with other workspaces — an
|
|
5466
6056
|
* organisation or a team, lowercase `[a-z0-9-]`. Two workspaces with the
|
|
@@ -5653,7 +6243,7 @@ interface AppConfigBase {
|
|
|
5653
6243
|
* Overrides `deploy.default` for this specific app.
|
|
5654
6244
|
* @example 'dokploy', 'vercel'
|
|
5655
6245
|
*/
|
|
5656
|
-
deploy?:
|
|
6246
|
+
deploy?: DeployTargetName;
|
|
5657
6247
|
/**
|
|
5658
6248
|
* Constructs glob pattern — one glob, every kind.
|
|
5659
6249
|
*
|
|
@@ -6104,7 +6694,7 @@ interface NormalizedAppConfig extends Omit<AppConfigBase, 'type'> {
|
|
|
6104
6694
|
/** Resolved dependencies array (empty array if none) */
|
|
6105
6695
|
dependencies: string[];
|
|
6106
6696
|
/** Resolved deploy target (app.deploy > deploy.default > 'dokploy') */
|
|
6107
|
-
resolvedDeployTarget:
|
|
6697
|
+
resolvedDeployTarget: DeployTargetName;
|
|
6108
6698
|
/** Entry file path for non-gkm apps */
|
|
6109
6699
|
entry?: string;
|
|
6110
6700
|
/** Framework for the app */
|
|
@@ -6407,5 +6997,5 @@ interface GkmConfig {
|
|
|
6407
6997
|
deploy?: DeployConfig;
|
|
6408
6998
|
}
|
|
6409
6999
|
//#endregion
|
|
6410
|
-
export { PHASE_2_DEPLOY_TARGETS as A,
|
|
6411
|
-
//# sourceMappingURL=types-
|
|
7000
|
+
export { DeployEventError as $, PHASE_2_DEPLOY_TARGETS as A, DeployFailure as B, WorkspaceConfig as C, Framework as D, BackendFramework as E, isDeployTargetSupported as F, DeployTargetCapabilities as G, DeployRuntime as H, isPhase2DeployTarget as I, TargetEvent as J, DeployTargetEntry as K, safeValidateWorkspaceConfig as L, WorkspaceConfigSchema as M, formatValidationErrors as N, FrontendFramework as O, getDeployTargetError as P, DeployEvent as Q, validateWorkspaceConfig as R, SharedConfig as S, isWorkspaceConfig as T, DeploySecrets as U, DeployPhaseContext as V, DeployTarget as W, TargetOptionsIssue as X, TargetOptions as Y, TargetOptionsSchema as Z, LoadedConfig as _, StateVersionConflict as _t, Routes as a, DeployResult as at, NormalizedWorkspace as b, deployIdentity as bt, AppInput as c, CredentialKinds as ct, DeployConfig as d, MissingCredential as dt, DeployEventType as et, DeployTargetName as f, StoredCredentialsOptions as ft, InferredWorkspaceConfig as g, StateStore as gt, InferAppNames as h, StateLocked as ht, OpenApiConfig as i, AppDeployResult as it, SUPPORTED_DEPLOY_TARGETS as j, MobileFramework as k, AppsRecord as l, CredentialProvider as lt, DokployWorkspaceConfig as m, storedCredentials as mt, EmailBackend as n, ResourceChange as nt, AppConfig as o, Credential as ot, DevConfig as p, chainCredentials as pt, DeployTargetLogger as q, GkmConfig as r, ResourceVia as rt, AppConfigInput as s, CredentialKind as st, CacheBackend as t, DeployPhase as tt, ConstrainedApps as u, CredentialRequest as ut, ModelsConfig as v, StageSecrets as vt, WorkspaceInput as w, SecretsConfig as x, NormalizedAppConfig as y, DeployIdentity as yt, AnyDeployTarget as z };
|
|
7001
|
+
//# sourceMappingURL=types-CfLKGfC_.d.mts.map
|