@geekmidas/cli 10.0.0-alpha.72 → 10.0.0-alpha.74
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/{OpenApiTsGenerator-BlP53kf2.cjs → EndpointGenerator-CP6sBvQV.cjs} +4 -510
- package/dist/EndpointGenerator-CP6sBvQV.cjs.map +1 -0
- package/dist/{OpenApiTsGenerator-Dv0gT2DL.mjs → EndpointGenerator-DftalLYg.mjs} +3 -509
- package/dist/EndpointGenerator-DftalLYg.mjs.map +1 -0
- package/dist/{LegacyStateStore-NSHEinQi.mjs → LegacyStateStore-DTo7z924.mjs} +2 -2
- package/dist/{LegacyStateStore-NSHEinQi.mjs.map → LegacyStateStore-DTo7z924.mjs.map} +1 -1
- package/dist/{LegacyStateStore-Dd5IwiyC.cjs → LegacyStateStore-D_78eaHM.cjs} +2 -2
- package/dist/{LegacyStateStore-Dd5IwiyC.cjs.map → LegacyStateStore-D_78eaHM.cjs.map} +1 -1
- package/dist/{LocalStateStore-DTylG4T4.cjs → LocalStateStore-BhrlQIXD.cjs} +2 -2
- package/dist/{LocalStateStore-DTylG4T4.cjs.map → LocalStateStore-BhrlQIXD.cjs.map} +1 -1
- package/dist/{LocalStateStore-DUoG2wA_.mjs → LocalStateStore-CNjgkRk4.mjs} +2 -2
- package/dist/{LocalStateStore-DUoG2wA_.mjs.map → LocalStateStore-CNjgkRk4.mjs.map} +1 -1
- package/dist/OpenApiTsGenerator-CKBCckKz.cjs +514 -0
- package/dist/OpenApiTsGenerator-CKBCckKz.cjs.map +1 -0
- package/dist/OpenApiTsGenerator-nu1r1NgB.mjs +509 -0
- package/dist/OpenApiTsGenerator-nu1r1NgB.mjs.map +1 -0
- package/dist/{S3StateStore-Dxob3PNA.mjs → S3StateStore-g2P7T_Mo.mjs} +2 -2
- package/dist/{S3StateStore-Dxob3PNA.mjs.map → S3StateStore-g2P7T_Mo.mjs.map} +1 -1
- package/dist/{S3StateStore-D7hrU-sy.cjs → S3StateStore-oCxRs6HM.cjs} +2 -2
- package/dist/{S3StateStore-D7hrU-sy.cjs.map → S3StateStore-oCxRs6HM.cjs.map} +1 -1
- package/dist/{SSMStateStore-Dvl4A8Up.mjs → SSMStateStore-CYenunmK.mjs} +2 -2
- package/dist/{SSMStateStore-Dvl4A8Up.mjs.map → SSMStateStore-CYenunmK.mjs.map} +1 -1
- package/dist/{SSMStateStore-DGIKJ4NN.cjs → SSMStateStore-DXp0m7XI.cjs} +2 -2
- package/dist/{SSMStateStore-DGIKJ4NN.cjs.map → SSMStateStore-DXp0m7XI.cjs.map} +1 -1
- package/dist/SubscriberGenerator-5looQ3gB.mjs +448 -0
- package/dist/SubscriberGenerator-5looQ3gB.mjs.map +1 -0
- package/dist/SubscriberGenerator-CajwOa5W.cjs +489 -0
- package/dist/SubscriberGenerator-CajwOa5W.cjs.map +1 -0
- package/dist/{add-XTLU19_E.mjs → add-BTH7WaH3.mjs} +4 -4
- package/dist/{add-XTLU19_E.mjs.map → add-BTH7WaH3.mjs.map} +1 -1
- package/dist/{add-DeC2Kyyv.cjs → add-Djrr12Xc.cjs} +4 -4
- package/dist/{add-DeC2Kyyv.cjs.map → add-Djrr12Xc.cjs.map} +1 -1
- package/dist/{bundler-CNTVLCCA.mjs → bundler-BUojOkof.mjs} +6 -6
- package/dist/bundler-BUojOkof.mjs.map +1 -0
- package/dist/{bundler-CEaR6Dpb.cjs → bundler-utHuESvL.cjs} +6 -6
- package/dist/bundler-utHuESvL.cjs.map +1 -0
- package/dist/{cli-MMgBrHx7.cjs → cli-Bx0sUzxH.cjs} +4 -4
- package/dist/{cli-MMgBrHx7.cjs.map → cli-Bx0sUzxH.cjs.map} +1 -1
- package/dist/{cli-D1arS0p1.mjs → cli-CyYceKTS.mjs} +4 -4
- package/dist/{cli-D1arS0p1.mjs.map → cli-CyYceKTS.mjs.map} +1 -1
- package/dist/{compose-T3hnnjKZ.mjs → compose-DZp8DJ0A.mjs} +419 -70
- package/dist/compose-DZp8DJ0A.mjs.map +1 -0
- package/dist/{compose-B-MME-4C.cjs → compose-iuw8wfHk.cjs} +420 -71
- package/dist/compose-iuw8wfHk.cjs.map +1 -0
- package/dist/{config-j9zBKaEG.d.cts → config-B38YWicj.d.cts} +3 -3
- package/dist/{config-BN6iXvyR.d.mts.map → config-B38YWicj.d.cts.map} +1 -1
- package/dist/{config-BN6iXvyR.d.mts → config-DA0kRTQe.d.mts} +3 -3
- package/dist/{config-j9zBKaEG.d.cts.map → config-DA0kRTQe.d.mts.map} +1 -1
- package/dist/config.cjs +4 -1
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +3 -3
- package/dist/config.d.mts +3 -3
- package/dist/config.mjs +4 -1
- package/dist/config.mjs.map +1 -1
- package/dist/{credentialSchemas-BmYxnEz_.mjs → credentialSchemas-BJqRJNK4.mjs} +2 -2
- package/dist/{credentialSchemas-BmYxnEz_.mjs.map → credentialSchemas-BJqRJNK4.mjs.map} +1 -1
- package/dist/{credentialSchemas-BcNL1N5R.cjs → credentialSchemas-DCR4Wd1W.cjs} +2 -2
- package/dist/{credentialSchemas-BcNL1N5R.cjs.map → credentialSchemas-DCR4Wd1W.cjs.map} +1 -1
- package/dist/deploy/public.cjs +7 -7
- package/dist/deploy/public.d.cts +4 -4
- package/dist/deploy/public.d.cts.map +1 -1
- package/dist/deploy/public.d.mts +4 -4
- package/dist/deploy/public.d.mts.map +1 -1
- package/dist/deploy/public.mjs +7 -7
- package/dist/deploy/sniffer-routes-worker.cjs +2 -2
- package/dist/deploy/sniffer-routes-worker.mjs +2 -2
- package/dist/{deploy-ClC53rc6.mjs → deploy-C17K7Imy.mjs} +12 -6
- package/dist/deploy-C17K7Imy.mjs.map +1 -0
- package/dist/{deploy-CZE0m6jd.cjs → deploy-eWorhvQp.cjs} +12 -6
- package/dist/deploy-eWorhvQp.cjs.map +1 -0
- package/dist/{discover-Buwf1z4P.mjs → discover-BPelzeGW.mjs} +21 -2
- package/dist/discover-BPelzeGW.mjs.map +1 -0
- package/dist/{discover-B_IkPukx.d.cts → discover-CU0paUyH.d.cts} +10 -1
- package/dist/discover-CU0paUyH.d.cts.map +1 -0
- package/dist/{discover-B4VjaFJk.cjs → discover-D1It5r_h.cjs} +21 -2
- package/dist/discover-D1It5r_h.cjs.map +1 -0
- package/dist/{discover-B6yPpvRV.d.mts → discover-DFiJxwfv.d.mts} +10 -1
- package/dist/discover-DFiJxwfv.d.mts.map +1 -0
- package/dist/{dokploy-D1UwQKm3.mjs → dokploy-DKa49Nqm.mjs} +2 -2
- package/dist/{dokploy-D1UwQKm3.mjs.map → dokploy-DKa49Nqm.mjs.map} +1 -1
- package/dist/{dokploy-lwmH05zr.cjs → dokploy-DKzcI-RL.cjs} +2 -2
- package/dist/{dokploy-lwmH05zr.cjs.map → dokploy-DKzcI-RL.cjs.map} +1 -1
- package/dist/drivers-BdvtCKc7.cjs +200 -0
- package/dist/drivers-BdvtCKc7.cjs.map +1 -0
- package/dist/drivers-Ch1rJitn.mjs +177 -0
- package/dist/drivers-Ch1rJitn.mjs.map +1 -0
- package/dist/{encryption-D05sNwED.cjs → encryption-DSkJdoyk.cjs} +2 -2
- package/dist/{encryption-D05sNwED.cjs.map → encryption-DSkJdoyk.cjs.map} +1 -1
- package/dist/{encryption-DcrxWl1s.mjs → encryption-sTMz3aWi.mjs} +2 -2
- package/dist/{encryption-DcrxWl1s.mjs.map → encryption-sTMz3aWi.mjs.map} +1 -1
- package/dist/{engine-DmQS3XHX.mjs → engine-B1b4I34Z.mjs} +117 -17
- package/dist/engine-B1b4I34Z.mjs.map +1 -0
- package/dist/{engine-Cry1vwMz.cjs → engine-Bh76sAHy.cjs} +117 -17
- package/dist/engine-Bh76sAHy.cjs.map +1 -0
- package/dist/{github-BchWoiVx.cjs → github-BvN3CfxM.cjs} +2 -2
- package/dist/{github-BchWoiVx.cjs.map → github-BvN3CfxM.cjs.map} +1 -1
- package/dist/{github-CqYOP8cI.mjs → github-C9ODoyZU.mjs} +2 -2
- package/dist/{github-CqYOP8cI.mjs.map → github-C9ODoyZU.mjs.map} +1 -1
- package/dist/{index-DvoxuTqR.d.mts → index-B-1lLGzy.d.mts} +2 -2
- package/dist/{index-Bk3NY6DN.d.cts.map → index-B-1lLGzy.d.mts.map} +1 -1
- package/dist/{index-Bk3NY6DN.d.cts → index-vMidfqhU.d.cts} +2 -2
- package/dist/{index-DvoxuTqR.d.mts.map → index-vMidfqhU.d.cts.map} +1 -1
- package/dist/index.cjs +130 -473
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +122 -465
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-qKeGYq21.cjs → migrate-B0FCZNkp.cjs} +3 -3
- package/dist/{migrate-qKeGYq21.cjs.map → migrate-B0FCZNkp.cjs.map} +1 -1
- package/dist/{migrate-guck0NJK.mjs → migrate-CTtJhGV9.mjs} +3 -3
- package/dist/{migrate-guck0NJK.mjs.map → migrate-CTtJhGV9.mjs.map} +1 -1
- package/dist/openapi.cjs +3 -2
- package/dist/openapi.cjs.map +1 -1
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +2 -1
- package/dist/openapi.mjs.map +1 -1
- package/dist/ready-BB9xS4S9.cjs +402 -0
- package/dist/ready-BB9xS4S9.cjs.map +1 -0
- package/dist/ready-ZZoNskrr.mjs +373 -0
- package/dist/ready-ZZoNskrr.mjs.map +1 -0
- package/dist/reconcile/public.cjs +1 -1
- package/dist/reconcile/public.d.cts +2 -2
- package/dist/reconcile/public.d.mts +2 -2
- package/dist/reconcile/public.mjs +1 -1
- package/dist/{resolve-BsXEXAUz.mjs → resolve-DSAXj_47.mjs} +3 -3
- package/dist/{resolve-BsXEXAUz.mjs.map → resolve-DSAXj_47.mjs.map} +1 -1
- package/dist/{resolve-wEjEvbJ5.cjs → resolve-D_BU-wKA.cjs} +3 -3
- package/dist/{resolve-wEjEvbJ5.cjs.map → resolve-D_BU-wKA.cjs.map} +1 -1
- package/dist/{rollback-Bk91csFg.mjs → rollback-CWYTUhfW.mjs} +4 -4
- package/dist/{rollback-Bk91csFg.mjs.map → rollback-CWYTUhfW.mjs.map} +1 -1
- package/dist/{rollback-DmcU-efZ.cjs → rollback-DJy3t696.cjs} +4 -4
- package/dist/{rollback-DmcU-efZ.cjs.map → rollback-DJy3t696.cjs.map} +1 -1
- package/dist/{runtime-DHJhe4QI.d.mts → runtime-BzZD5HHi.d.cts} +2 -2
- package/dist/{runtime-CYAO4iZG.d.cts.map → runtime-BzZD5HHi.d.cts.map} +1 -1
- package/dist/{runtime-CYAO4iZG.d.cts → runtime-Cm6J6L7n.d.mts} +2 -2
- package/dist/{runtime-DHJhe4QI.d.mts.map → runtime-Cm6J6L7n.d.mts.map} +1 -1
- package/dist/sandbox/credentials-worker.cjs +2 -2
- package/dist/sandbox/credentials-worker.mjs +2 -2
- package/dist/sandbox/discover-worker.cjs +6 -3
- package/dist/sandbox/discover-worker.cjs.map +1 -1
- package/dist/sandbox/discover-worker.mjs +6 -3
- package/dist/sandbox/discover-worker.mjs.map +1 -1
- package/dist/sandbox/migrate-worker.cjs +1 -1
- package/dist/sandbox/migrate-worker.mjs +1 -1
- package/dist/{sniffer-vAXsU_4G.mjs → sniffer-BFmdZpZ2.mjs} +6 -6
- package/dist/{sniffer-vAXsU_4G.mjs.map → sniffer-BFmdZpZ2.mjs.map} +1 -1
- package/dist/{sniffer-DpHpFZBD.cjs → sniffer-C-T7dSMN.cjs} +6 -6
- package/dist/{sniffer-DpHpFZBD.cjs.map → sniffer-C-T7dSMN.cjs.map} +1 -1
- package/dist/{state-CCuTJNRH.cjs → state-DCwRWyh-.cjs} +954 -29
- package/dist/state-DCwRWyh-.cjs.map +1 -0
- package/dist/{state-BJFherj1.mjs → state-DpkxSwzI.mjs} +889 -24
- package/dist/state-DpkxSwzI.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-CFO3xWoF.cjs → terminal-BL5E0xbR.cjs} +2 -2
- package/dist/{terminal-CFO3xWoF.cjs.map → terminal-BL5E0xbR.cjs.map} +1 -1
- package/dist/{terminal-C6TBo_SA.mjs → terminal-BdvrmkaC.mjs} +2 -2
- package/dist/{terminal-C6TBo_SA.mjs.map → terminal-BdvrmkaC.mjs.map} +1 -1
- package/dist/{types-DkG5WW8l.d.mts → types-Dp9lgx_S.d.mts} +22 -2
- package/dist/types-Dp9lgx_S.d.mts.map +1 -0
- package/dist/{types-BD1jgA85.d.cts → types-TzCChNrA.d.cts} +22 -2
- package/dist/types-TzCChNrA.d.cts.map +1 -0
- package/dist/vitest.cjs +1 -1
- package/dist/vitest.mjs +1 -1
- package/dist/workspace/index.d.cts +2 -2
- package/dist/workspace/index.d.mts +2 -2
- package/dist/workspace-C7NqCsQF.mjs.map +1 -1
- package/dist/workspace-vdrcRI-m.cjs.map +1 -1
- package/package.json +15 -15
- package/dist/OpenApiTsGenerator-BlP53kf2.cjs.map +0 -1
- package/dist/OpenApiTsGenerator-Dv0gT2DL.mjs.map +0 -1
- package/dist/bundler-CEaR6Dpb.cjs.map +0 -1
- package/dist/bundler-CNTVLCCA.mjs.map +0 -1
- package/dist/compose-B-MME-4C.cjs.map +0 -1
- package/dist/compose-T3hnnjKZ.mjs.map +0 -1
- package/dist/deploy-CZE0m6jd.cjs.map +0 -1
- package/dist/deploy-ClC53rc6.mjs.map +0 -1
- package/dist/discover-B4VjaFJk.cjs.map +0 -1
- package/dist/discover-B6yPpvRV.d.mts.map +0 -1
- package/dist/discover-B_IkPukx.d.cts.map +0 -1
- package/dist/discover-Buwf1z4P.mjs.map +0 -1
- package/dist/engine-Cry1vwMz.cjs.map +0 -1
- package/dist/engine-DmQS3XHX.mjs.map +0 -1
- package/dist/fakes-C9RiT6XG.mjs +0 -125
- package/dist/fakes-C9RiT6XG.mjs.map +0 -1
- package/dist/fakes-zW-jNAbQ.cjs +0 -148
- package/dist/fakes-zW-jNAbQ.cjs.map +0 -1
- package/dist/ready-B-7LayMF.cjs +0 -872
- package/dist/ready-B-7LayMF.cjs.map +0 -1
- package/dist/ready-ULc5BTOb.mjs +0 -819
- package/dist/ready-ULc5BTOb.mjs.map +0 -1
- package/dist/state-BJFherj1.mjs.map +0 -1
- package/dist/state-CCuTJNRH.cjs.map +0 -1
- package/dist/types-BD1jgA85.d.cts.map +0 -1
- package/dist/types-DkG5WW8l.d.mts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -3,22 +3,24 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const require_rolldown_runtime = require("./rolldown-runtime-C0BPl7ul.cjs");
|
|
4
4
|
const require_run = require("./run-fVZ-rLnc.cjs");
|
|
5
5
|
const require_credentials = require("./credentials-BVs7mrtw.cjs");
|
|
6
|
-
const require_discover = require("./discover-
|
|
6
|
+
const require_discover = require("./discover-D1It5r_h.cjs");
|
|
7
7
|
const require_derive = require("./derive-DAbo49sm.cjs");
|
|
8
8
|
const require_workspace = require("./workspace-vdrcRI-m.cjs");
|
|
9
9
|
const require_config = require("./config.cjs");
|
|
10
|
-
const require_state = require("./state-
|
|
11
|
-
const
|
|
12
|
-
const require_sniffer = require("./sniffer-
|
|
10
|
+
const require_state = require("./state-DCwRWyh-.cjs");
|
|
11
|
+
const require_EndpointGenerator = require("./EndpointGenerator-CP6sBvQV.cjs");
|
|
12
|
+
const require_sniffer = require("./sniffer-C-T7dSMN.cjs");
|
|
13
13
|
const require_openapi = require("./openapi.cjs");
|
|
14
|
+
const require_SubscriberGenerator = require("./SubscriberGenerator-CajwOa5W.cjs");
|
|
14
15
|
const require_appPorts = require("./appPorts-Cu79hJF6.cjs");
|
|
15
|
-
const
|
|
16
|
+
const require_drivers = require("./drivers-BdvtCKc7.cjs");
|
|
16
17
|
const require_emit = require("./emit-Dmc1nvdS.cjs");
|
|
17
|
-
const require_deploy = require("./deploy-
|
|
18
|
-
const require_compose = require("./compose-
|
|
19
|
-
const require_credentialSchemas = require("./credentialSchemas-
|
|
20
|
-
const require_LocalStateStore = require("./LocalStateStore-
|
|
18
|
+
const require_deploy = require("./deploy-eWorhvQp.cjs");
|
|
19
|
+
const require_compose = require("./compose-iuw8wfHk.cjs");
|
|
20
|
+
const require_credentialSchemas = require("./credentialSchemas-DCR4Wd1W.cjs");
|
|
21
|
+
const require_LocalStateStore = require("./LocalStateStore-BhrlQIXD.cjs");
|
|
21
22
|
const require_utils = require("./utils-D2Nk1Nv2.cjs");
|
|
23
|
+
const require_ready = require("./ready-BB9xS4S9.cjs");
|
|
22
24
|
let node_path = require("node:path");
|
|
23
25
|
let commander = require("commander");
|
|
24
26
|
let node_process = require("node:process");
|
|
@@ -48,12 +50,10 @@ let http2 = require("http2");
|
|
|
48
50
|
let stream = require("stream");
|
|
49
51
|
let crypto = require("crypto");
|
|
50
52
|
crypto = require_rolldown_runtime.__toESM(crypto, 1);
|
|
51
|
-
let _geekmidas_constructs_crons = require("@geekmidas/constructs/crons");
|
|
52
53
|
let _geekmidas_constructs_functions = require("@geekmidas/constructs/functions");
|
|
53
|
-
let _geekmidas_constructs_queue = require("@geekmidas/constructs/queue");
|
|
54
54
|
let _geekmidas_constructs_topic = require("@geekmidas/constructs/topic");
|
|
55
55
|
//#region package.json
|
|
56
|
-
var version = "10.0.0-alpha.
|
|
56
|
+
var version = "10.0.0-alpha.74";
|
|
57
57
|
//#endregion
|
|
58
58
|
//#region src/prompt.ts
|
|
59
59
|
/**
|
|
@@ -136,7 +136,7 @@ const logger$8 = console;
|
|
|
136
136
|
* Validate Dokploy token by making a test API call
|
|
137
137
|
*/
|
|
138
138
|
async function validateDokployToken(endpoint, token) {
|
|
139
|
-
const { DokployApi } = await Promise.resolve().then(() => require("./sniffer-
|
|
139
|
+
const { DokployApi } = await Promise.resolve().then(() => require("./sniffer-C-T7dSMN.cjs")).then((n) => n.dokploy_api_exports);
|
|
140
140
|
return new DokployApi({
|
|
141
141
|
baseUrl: endpoint,
|
|
142
142
|
token
|
|
@@ -2042,9 +2042,9 @@ async function workspaceDevCommand(configured, options) {
|
|
|
2042
2042
|
for (const { id, port } of fakes) logger$5.log(`🎭 ${id} fake: http://localhost:${port}`);
|
|
2043
2043
|
logger$5.log(options.migrate || options.seed ? "🗄️ Migrating the databases" : "🗄️ Checking for pending migrations");
|
|
2044
2044
|
if (options.migrate || options.seed) {
|
|
2045
|
-
const { prepareDevDatabases } = await Promise.resolve().then(() => require("./migrate-
|
|
2045
|
+
const { prepareDevDatabases } = await Promise.resolve().then(() => require("./migrate-B0FCZNkp.cjs"));
|
|
2046
2046
|
await prepareDevDatabases(workspace, reconciled.env, { seed: !!options.seed });
|
|
2047
|
-
} else await Promise.resolve().then(() => require("./migrate-
|
|
2047
|
+
} else await Promise.resolve().then(() => require("./migrate-B0FCZNkp.cjs")).then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
|
|
2048
2048
|
logger$5.log(`⚠️ Could not check for pending migrations: ${error instanceof Error ? error.message : String(error)}`);
|
|
2049
2049
|
});
|
|
2050
2050
|
const appUrls = {};
|
|
@@ -2603,244 +2603,6 @@ var DevServer = class {
|
|
|
2603
2603
|
}
|
|
2604
2604
|
};
|
|
2605
2605
|
//#endregion
|
|
2606
|
-
//#region src/generators/CronGenerator.ts
|
|
2607
|
-
var CronGenerator = class extends require_discover.ConstructGenerator {
|
|
2608
|
-
async build(context, constructs, outputDir, options) {
|
|
2609
|
-
const target = options?.target ?? "aws";
|
|
2610
|
-
const logger = console;
|
|
2611
|
-
const cronInfos = [];
|
|
2612
|
-
if (target === "server") {
|
|
2613
|
-
await this.generateServerCronsFile(outputDir, constructs);
|
|
2614
|
-
logger.log(`Generated server crons file with ${constructs.length} crons`);
|
|
2615
|
-
return cronInfos;
|
|
2616
|
-
}
|
|
2617
|
-
if (constructs.length === 0) return cronInfos;
|
|
2618
|
-
const cronsDir = (0, node_path.join)(outputDir, "crons");
|
|
2619
|
-
await (0, node_fs_promises.mkdir)(cronsDir, { recursive: true });
|
|
2620
|
-
for (const { key, construct, path } of constructs) {
|
|
2621
|
-
const handlerFile = await this.generateCronHandler(cronsDir, path.relative, key, context, construct.owner);
|
|
2622
|
-
cronInfos.push({
|
|
2623
|
-
name: key,
|
|
2624
|
-
handler: (0, node_path.relative)(options?.root ?? process.cwd(), handlerFile).replace(/\.ts$/, ".handler"),
|
|
2625
|
-
schedule: construct.schedule || "rate(1 hour)",
|
|
2626
|
-
timeout: construct.timeout,
|
|
2627
|
-
memorySize: construct.memorySize,
|
|
2628
|
-
environment: await construct.getEnvironment({ markOptional: context.markOptional }),
|
|
2629
|
-
dependencies: construct.constructs
|
|
2630
|
-
});
|
|
2631
|
-
logger.log(`Generated cron handler: ${key}`);
|
|
2632
|
-
}
|
|
2633
|
-
return cronInfos;
|
|
2634
|
-
}
|
|
2635
|
-
isConstruct(value) {
|
|
2636
|
-
return _geekmidas_constructs_crons.Cron.isCron(value);
|
|
2637
|
-
}
|
|
2638
|
-
/**
|
|
2639
|
-
* The crons file a server entry imports.
|
|
2640
|
-
*
|
|
2641
|
-
* Shaped after `generateServerSubscribersFile`: one module, every cron, a
|
|
2642
|
-
* `setupCrons` the generated entry calls beside `setupSubscribers`.
|
|
2643
|
-
*
|
|
2644
|
-
* It picks its scheduler from what the process can reach. With a Postgres it
|
|
2645
|
-
* uses pg-boss, whose schedules live in the database — so a deployment
|
|
2646
|
-
* running four replicas fires each job once, which is the thing a timer in
|
|
2647
|
-
* every process gets wrong and does not report. With no database it falls
|
|
2648
|
-
* back to timers and says plainly that it is doing so.
|
|
2649
|
-
*/
|
|
2650
|
-
async generateServerCronsFile(outputDir, crons) {
|
|
2651
|
-
await (0, node_fs_promises.mkdir)(outputDir, { recursive: true });
|
|
2652
|
-
const cronsPath = (0, node_path.join)(outputDir, "crons.ts");
|
|
2653
|
-
if (crons.length === 0) {
|
|
2654
|
-
await (0, node_fs_promises.writeFile)(cronsPath, `/**
|
|
2655
|
-
* Generated cron setup — this app declares none.
|
|
2656
|
-
*/
|
|
2657
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2658
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2659
|
-
|
|
2660
|
-
export async function setupCrons(
|
|
2661
|
-
_envParser: EnvironmentParser<any>,
|
|
2662
|
-
_logger: Logger,
|
|
2663
|
-
): Promise<void> {}
|
|
2664
|
-
|
|
2665
|
-
export async function stopCrons(): Promise<void> {}
|
|
2666
|
-
`);
|
|
2667
|
-
return cronsPath;
|
|
2668
|
-
}
|
|
2669
|
-
const importsByFile = /* @__PURE__ */ new Map();
|
|
2670
|
-
for (const { path, key } of crons) {
|
|
2671
|
-
const importPath = (0, node_path.relative)((0, node_path.dirname)(cronsPath), path.relative).replace(/\.ts$/, ".js");
|
|
2672
|
-
if (!importsByFile.has(importPath)) importsByFile.set(importPath, []);
|
|
2673
|
-
importsByFile.get(importPath)?.push(key);
|
|
2674
|
-
}
|
|
2675
|
-
const content = `/**
|
|
2676
|
-
* Generated cron setup.
|
|
2677
|
-
*
|
|
2678
|
-
* Schedules every cron this app declares, in the process that serves it.
|
|
2679
|
-
*
|
|
2680
|
-
* The schedule lives in Postgres, through pg-boss, in the database the worker
|
|
2681
|
-
* named with \`.database(db)\`. That is what makes running several replicas
|
|
2682
|
-
* safe: each job fires once, where a timer in every process fires it once per
|
|
2683
|
-
* replica and reports nothing.
|
|
2684
|
-
*
|
|
2685
|
-
* No connection string appears here. The construct that owns the database is
|
|
2686
|
-
* the only thing that knows its key, and it is resolved through service
|
|
2687
|
-
* discovery like any other dependency.
|
|
2688
|
-
*/
|
|
2689
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2690
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2691
|
-
import { runCron, scheduleInProcess, toCronExpression } from '@geekmidas/constructs/crons';
|
|
2692
|
-
import { ServiceDiscovery } from '@geekmidas/services';
|
|
2693
|
-
${Array.from(importsByFile.entries()).map(([importPath, exports]) => `import { ${exports.join(", ")} } from '${importPath}';`).join("\n")}
|
|
2694
|
-
|
|
2695
|
-
const crons = [
|
|
2696
|
-
${crons.map(({ key }) => ` { name: '${key}', cron: ${key} }`).join(",\n")}
|
|
2697
|
-
];
|
|
2698
|
-
|
|
2699
|
-
type Stoppable = { stop: () => Promise<void> | void };
|
|
2700
|
-
const running: Stoppable[] = [];
|
|
2701
|
-
|
|
2702
|
-
export async function setupCrons(
|
|
2703
|
-
envParser: EnvironmentParser<any>,
|
|
2704
|
-
logger: Logger,
|
|
2705
|
-
): Promise<void> {
|
|
2706
|
-
if (crons.length === 0) {
|
|
2707
|
-
return;
|
|
2708
|
-
}
|
|
2709
|
-
|
|
2710
|
-
const serviceDiscovery = ServiceDiscovery.getInstance(envParser);
|
|
2711
|
-
|
|
2712
|
-
// Resolved once per cron rather than per firing: registering services on
|
|
2713
|
-
// every tick would reconnect a database every minute.
|
|
2714
|
-
const prepared = [];
|
|
2715
|
-
for (const { name, cron } of crons) {
|
|
2716
|
-
try {
|
|
2717
|
-
const schedule = toCronExpression(cron.schedule);
|
|
2718
|
-
const services = cron.services.length > 0
|
|
2719
|
-
? await serviceDiscovery.register(cron.services)
|
|
2720
|
-
: {};
|
|
2721
|
-
|
|
2722
|
-
prepared.push({ name, cron, schedule, services });
|
|
2723
|
-
} catch (error) {
|
|
2724
|
-
// An unrepresentable schedule is a build-time mistake, and failing the
|
|
2725
|
-
// process for it would take the HTTP server down with it.
|
|
2726
|
-
logger.error({ err: error, cron: name }, 'Cron has no runnable schedule, skipping');
|
|
2727
|
-
}
|
|
2728
|
-
}
|
|
2729
|
-
|
|
2730
|
-
const run = async (entry: (typeof prepared)[number]) => {
|
|
2731
|
-
try {
|
|
2732
|
-
// The cron's own function, the way its Lambda would run it — services,
|
|
2733
|
-
// the worker's database as \`db\`, its events. It used to call a
|
|
2734
|
-
// \`handler\` a Cron does not have, so every firing logged a failure.
|
|
2735
|
-
await runCron(entry.cron, serviceDiscovery);
|
|
2736
|
-
} catch (error) {
|
|
2737
|
-
logger.error({ err: error, cron: entry.name }, 'Cron failed');
|
|
2738
|
-
}
|
|
2739
|
-
};
|
|
2740
|
-
|
|
2741
|
-
// The app's one pg-boss: the events broker's, as the broker's role, in the
|
|
2742
|
-
// broker's schema. A server fires its own crons, and a process scheduling in
|
|
2743
|
-
// memory fires each job once per replica — so the schedule lives in
|
|
2744
|
-
// Postgres. It used to be a second pg-boss on the worker's database, as the
|
|
2745
|
-
// runtime role, which can neither create a schema nor use the broker's.
|
|
2746
|
-
const { url, devPid } = envParser
|
|
2747
|
-
.create((get) => ({
|
|
2748
|
-
url: get('EVENT_PUBLISHER_CONNECTION_STRING').string().optional(),
|
|
2749
|
-
// Set by \`gkm dev\` on the server it starts, and by nothing deployed.
|
|
2750
|
-
devPid: get('GKM_DEV_PID').string().optional(),
|
|
2751
|
-
}))
|
|
2752
|
-
.parse();
|
|
2753
|
-
|
|
2754
|
-
if (!url?.startsWith('pgboss://')) {
|
|
2755
|
-
// \`gkm dev\` on a target whose crons are infrastructure once deployed —
|
|
2756
|
-
// EventBridge rules on AWS — has no broker to keep a schedule in. It is one
|
|
2757
|
-
// process, so a timer fires each job once, which is all pg-boss is for
|
|
2758
|
-
// here. Only there: a deployed server firing by timer fires once per
|
|
2759
|
-
// replica, so outside dev this stays the error below.
|
|
2760
|
-
if (devPid) {
|
|
2761
|
-
for (const entry of prepared) {
|
|
2762
|
-
running.push(scheduleInProcess(entry.schedule, () => run(entry)));
|
|
2763
|
-
logger.info({ cron: entry.name, schedule: entry.schedule }, 'Cron scheduled in this process');
|
|
2764
|
-
}
|
|
2765
|
-
return;
|
|
2766
|
-
}
|
|
2767
|
-
|
|
2768
|
-
logger.error(
|
|
2769
|
-
{ crons: prepared.map(({ name }) => name) },
|
|
2770
|
-
'These crons have nowhere to keep their schedule. On a server they are ' +
|
|
2771
|
-
'scheduled through the pg-boss events broker ' +
|
|
2772
|
-
'(EVENT_PUBLISHER_CONNECTION_STRING), and ' +
|
|
2773
|
-
(url ? 'the broker configured is not pg-boss.' : 'none is configured.'),
|
|
2774
|
-
);
|
|
2775
|
-
return;
|
|
2776
|
-
}
|
|
2777
|
-
|
|
2778
|
-
// Through the registered pg-boss driver, which the entry registers for a
|
|
2779
|
-
// server whose broker is pg-boss. Naming \`@geekmidas/events/pgboss\` here
|
|
2780
|
-
// made every bundle with a cron resolve pg-boss, whatever its broker.
|
|
2781
|
-
const { EventConnectionFactory } = await import('@geekmidas/events');
|
|
2782
|
-
const connection = (await EventConnectionFactory.fromConnectionString(
|
|
2783
|
-
url,
|
|
2784
|
-
)) as import('@geekmidas/events').EventConnection & { instance?: any };
|
|
2785
|
-
const boss = connection.instance!;
|
|
2786
|
-
|
|
2787
|
-
// What this app declares now. Anything else under the prefix belonged to a
|
|
2788
|
-
// cron since renamed or deleted, and would keep firing at a handler that has
|
|
2789
|
-
// gone.
|
|
2790
|
-
//
|
|
2791
|
-
// The prefix is \`cron.\` rather than \`cron:\`: pg-boss accepts
|
|
2792
|
-
// alphanumerics, underscores, hyphens, periods and slashes in a queue name,
|
|
2793
|
-
// and rejects a colon outright.
|
|
2794
|
-
const declared = new Set(prepared.map(({ name }) => \`cron.\${name}\`));
|
|
2795
|
-
for (const existing of await boss.getSchedules()) {
|
|
2796
|
-
if (existing.name.startsWith('cron.') && !declared.has(existing.name)) {
|
|
2797
|
-
await boss.unschedule(existing.name);
|
|
2798
|
-
logger.info({ cron: existing.name }, 'Removed a schedule nothing declares');
|
|
2799
|
-
}
|
|
2800
|
-
}
|
|
2801
|
-
|
|
2802
|
-
for (const entry of prepared) {
|
|
2803
|
-
const queue = \`cron.\${entry.name}\`;
|
|
2804
|
-
await boss.createQueue(queue);
|
|
2805
|
-
// UTC, so this agrees with the schedule a deploy target would have made.
|
|
2806
|
-
await boss.schedule(queue, entry.schedule, undefined, { tz: 'UTC' });
|
|
2807
|
-
await boss.work(queue, () => run(entry));
|
|
2808
|
-
|
|
2809
|
-
logger.info({ cron: entry.name, schedule: entry.schedule }, 'Cron scheduled');
|
|
2810
|
-
}
|
|
2811
|
-
|
|
2812
|
-
running.push({ stop: () => connection.close() });
|
|
2813
|
-
logger.info({ count: prepared.length }, 'Crons scheduled');
|
|
2814
|
-
}
|
|
2815
|
-
|
|
2816
|
-
export async function stopCrons(): Promise<void> {
|
|
2817
|
-
await Promise.all(running.map((r) => r.stop()));
|
|
2818
|
-
running.length = 0;
|
|
2819
|
-
}
|
|
2820
|
-
`;
|
|
2821
|
-
await (0, node_fs_promises.writeFile)(cronsPath, content);
|
|
2822
|
-
return cronsPath;
|
|
2823
|
-
}
|
|
2824
|
-
async generateCronHandler(outputDir, sourceFile, exportName, context, owner) {
|
|
2825
|
-
const handlerFileName = `${exportName}.ts`;
|
|
2826
|
-
const handlerPath = (0, node_path.join)(outputDir, handlerFileName);
|
|
2827
|
-
const importPath = (0, node_path.relative)((0, node_path.dirname)(handlerPath), sourceFile).replace(/\.ts$/, ".js");
|
|
2828
|
-
const runtime = require_OpenApiTsGenerator.runtimeFor(context, (0, node_path.dirname)(handlerPath), owner);
|
|
2829
|
-
const content = `import { AWSScheduledFunction } from '@geekmidas/constructs/aws';
|
|
2830
|
-
import { ${exportName} } from '${importPath}';
|
|
2831
|
-
${runtime.imports}
|
|
2832
|
-
${context.storageDrivers?.imports ?? ""}
|
|
2833
|
-
${runtime.bindings}
|
|
2834
|
-
${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
|
|
2835
|
-
const adapter = new AWSScheduledFunction(envParser, ${exportName});
|
|
2836
|
-
|
|
2837
|
-
export const handler = adapter.handler;
|
|
2838
|
-
`;
|
|
2839
|
-
await (0, node_fs_promises.writeFile)(handlerPath, content);
|
|
2840
|
-
return handlerPath;
|
|
2841
|
-
}
|
|
2842
|
-
};
|
|
2843
|
-
//#endregion
|
|
2844
2606
|
//#region src/generators/FunctionGenerator.ts
|
|
2845
2607
|
var FunctionGenerator = class extends require_discover.ConstructGenerator {
|
|
2846
2608
|
isConstruct(value) {
|
|
@@ -2871,7 +2633,7 @@ var FunctionGenerator = class extends require_discover.ConstructGenerator {
|
|
|
2871
2633
|
const handlerFileName = `${exportName}.ts`;
|
|
2872
2634
|
const handlerPath = (0, node_path.join)(outputDir, handlerFileName);
|
|
2873
2635
|
const importPath = (0, node_path.relative)((0, node_path.dirname)(handlerPath), sourceFile).replace(/\.ts$/, ".js");
|
|
2874
|
-
const runtime =
|
|
2636
|
+
const runtime = require_EndpointGenerator.runtimeFor(context, (0, node_path.dirname)(handlerPath), owner);
|
|
2875
2637
|
const content = `import { AWSLambdaFunction } from '@geekmidas/constructs/aws';
|
|
2876
2638
|
import { ${exportName} } from '${importPath}';
|
|
2877
2639
|
${runtime.imports}
|
|
@@ -2887,178 +2649,6 @@ export const handler = adapter.handler;
|
|
|
2887
2649
|
}
|
|
2888
2650
|
};
|
|
2889
2651
|
//#endregion
|
|
2890
|
-
//#region src/generators/QueueGenerator.ts
|
|
2891
|
-
/**
|
|
2892
|
-
* Generates the runtime for queue consumers (`worker.queue(…)`).
|
|
2893
|
-
*
|
|
2894
|
-
* - **server** (`gkm dev`): a single `queues.ts` exposing `setupQueues()` that
|
|
2895
|
-
* polls each queue in-process, alongside the Hono server, through the queue's
|
|
2896
|
-
* own connection string — pg-boss by default, SQS on the AWS emulator.
|
|
2897
|
-
* - **aws-lambda**: one handler file per queue wrapping `AWSLambdaQueue`, backed
|
|
2898
|
-
* by an SQS event-source mapping.
|
|
2899
|
-
*/
|
|
2900
|
-
var QueueGenerator = class extends require_discover.ConstructGenerator {
|
|
2901
|
-
isConstruct(value) {
|
|
2902
|
-
return _geekmidas_constructs_queue.Queue.isQueue(value);
|
|
2903
|
-
}
|
|
2904
|
-
async build(context, constructs, outputDir, options) {
|
|
2905
|
-
const target = options?.target ?? "aws";
|
|
2906
|
-
const logger = console;
|
|
2907
|
-
const queueInfos = [];
|
|
2908
|
-
if (target === "server") {
|
|
2909
|
-
await this.generateServerQueuesFile(outputDir, constructs);
|
|
2910
|
-
logger.log(`Generated server queues file with ${constructs.length} queues (polling mode)`);
|
|
2911
|
-
return queueInfos;
|
|
2912
|
-
}
|
|
2913
|
-
if (constructs.length === 0) return queueInfos;
|
|
2914
|
-
const queuesDir = (0, node_path.join)(outputDir, "queues");
|
|
2915
|
-
await (0, node_fs_promises.mkdir)(queuesDir, { recursive: true });
|
|
2916
|
-
for (const { key, construct, path } of constructs) {
|
|
2917
|
-
const handlerFile = await this.generateQueueHandler(queuesDir, path.relative, key, context, construct.owner);
|
|
2918
|
-
queueInfos.push({
|
|
2919
|
-
name: construct.name,
|
|
2920
|
-
handler: (0, node_path.relative)(options?.root ?? process.cwd(), handlerFile).replace(/\.ts$/, ".handler"),
|
|
2921
|
-
batchSize: construct.batchSize,
|
|
2922
|
-
fifo: construct.fifo,
|
|
2923
|
-
timeout: construct.timeout,
|
|
2924
|
-
environment: await construct.getEnvironment({ markOptional: context.markOptional }),
|
|
2925
|
-
dependencies: construct.constructs
|
|
2926
|
-
});
|
|
2927
|
-
logger.log(`Generated queue handler: ${key}`);
|
|
2928
|
-
}
|
|
2929
|
-
return queueInfos;
|
|
2930
|
-
}
|
|
2931
|
-
async generateQueueHandler(outputDir, sourceFile, exportName, context, owner) {
|
|
2932
|
-
const handlerPath = (0, node_path.join)(outputDir, `${exportName}.ts`);
|
|
2933
|
-
const importPath = (0, node_path.relative)((0, node_path.dirname)(handlerPath), sourceFile).replace(/\.ts$/, ".js");
|
|
2934
|
-
const runtime = require_OpenApiTsGenerator.runtimeFor(context, (0, node_path.dirname)(handlerPath), owner);
|
|
2935
|
-
const content = `import { AWSLambdaQueue } from '@geekmidas/constructs/aws';
|
|
2936
|
-
import { ${exportName} } from '${importPath}';
|
|
2937
|
-
${runtime.imports}
|
|
2938
|
-
${context.storageDrivers?.imports ?? ""}
|
|
2939
|
-
${runtime.bindings}
|
|
2940
|
-
${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
|
|
2941
|
-
const adapter = new AWSLambdaQueue(envParser, ${exportName});
|
|
2942
|
-
|
|
2943
|
-
export const handler = adapter.handler;
|
|
2944
|
-
`;
|
|
2945
|
-
await (0, node_fs_promises.writeFile)(handlerPath, content);
|
|
2946
|
-
return handlerPath;
|
|
2947
|
-
}
|
|
2948
|
-
async generateServerQueuesFile(outputDir, queues) {
|
|
2949
|
-
await (0, node_fs_promises.mkdir)(outputDir, { recursive: true });
|
|
2950
|
-
const queuesPath = (0, node_path.join)(outputDir, "queues.ts");
|
|
2951
|
-
if (queues.length === 0) {
|
|
2952
|
-
await (0, node_fs_promises.writeFile)(queuesPath, `/**
|
|
2953
|
-
* Generated queues setup — this app declares none.
|
|
2954
|
-
*/
|
|
2955
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2956
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2957
|
-
|
|
2958
|
-
export async function setupQueues(
|
|
2959
|
-
_envParser: EnvironmentParser<any>,
|
|
2960
|
-
_logger: Logger,
|
|
2961
|
-
): Promise<void> {}
|
|
2962
|
-
`);
|
|
2963
|
-
return queuesPath;
|
|
2964
|
-
}
|
|
2965
|
-
const importsByFile = /* @__PURE__ */ new Map();
|
|
2966
|
-
for (const { path, key } of queues) {
|
|
2967
|
-
const importPath = (0, node_path.relative)((0, node_path.dirname)(queuesPath), path.relative).replace(/\.ts$/, ".js");
|
|
2968
|
-
if (!importsByFile.has(importPath)) importsByFile.set(importPath, []);
|
|
2969
|
-
importsByFile.get(importPath)?.push(key);
|
|
2970
|
-
}
|
|
2971
|
-
const content = `/**
|
|
2972
|
-
* Generated queue consumers setup.
|
|
2973
|
-
*
|
|
2974
|
-
* Each queue's one consumer polls its own queue, through the queue's own
|
|
2975
|
-
* connection string — the one its producers publish on. SQS cannot push, so
|
|
2976
|
-
* this is a poller on every transport: pg-boss locally by default, the SQS
|
|
2977
|
-
* queue on the AWS emulator.
|
|
2978
|
-
*
|
|
2979
|
-
* Deployed on Lambda, a queue's consumer is an SQS event source instead.
|
|
2980
|
-
*/
|
|
2981
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2982
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2983
|
-
import { EventConnectionFactory, Subscriber } from '@geekmidas/events';
|
|
2984
|
-
import type { EventConnection } from '@geekmidas/events';
|
|
2985
|
-
import { ServiceDiscovery } from '@geekmidas/services';
|
|
2986
|
-
${Array.from(importsByFile.entries()).map(([importPath, exports]) => `import { ${exports.join(", ")} } from '${importPath}';`).join("\n")}
|
|
2987
|
-
|
|
2988
|
-
const queues = [
|
|
2989
|
-
${queues.map(({ key, construct }) => ` { queue: ${key}, connectionKey: '${(0, _geekmidas_manifest.provideKey)(construct.id, "publisherConnectionString")}' },`).join("\n")}
|
|
2990
|
-
];
|
|
2991
|
-
|
|
2992
|
-
export async function setupQueues(
|
|
2993
|
-
envParser: EnvironmentParser<any>,
|
|
2994
|
-
logger: Logger,
|
|
2995
|
-
): Promise<void> {
|
|
2996
|
-
const serviceDiscovery = ServiceDiscovery.getInstance(envParser);
|
|
2997
|
-
const connections = new Map<string, EventConnection>();
|
|
2998
|
-
|
|
2999
|
-
for (const { queue, connectionKey } of queues) {
|
|
3000
|
-
const connectionString = process.env[connectionKey];
|
|
3001
|
-
if (!connectionString) {
|
|
3002
|
-
logger.error({ queue: queue.name, connectionKey }, 'No connection string for this queue');
|
|
3003
|
-
continue;
|
|
3004
|
-
}
|
|
3005
|
-
|
|
3006
|
-
try {
|
|
3007
|
-
let connection = connections.get(connectionString);
|
|
3008
|
-
if (!connection) {
|
|
3009
|
-
connection = await EventConnectionFactory.fromConnectionString(connectionString);
|
|
3010
|
-
connections.set(connectionString, connection);
|
|
3011
|
-
}
|
|
3012
|
-
const eventSubscriber = await Subscriber.fromConnection(connection);
|
|
3013
|
-
const services = queue.services.length > 0
|
|
3014
|
-
? await serviceDiscovery.register(queue.services)
|
|
3015
|
-
: {};
|
|
3016
|
-
// The queue's database — the worker's, or its own — handed over as \`db\`.
|
|
3017
|
-
const db = queue.databaseService
|
|
3018
|
-
? (await serviceDiscovery.register([queue.databaseService]))[
|
|
3019
|
-
queue.databaseService.serviceName
|
|
3020
|
-
]
|
|
3021
|
-
: undefined;
|
|
3022
|
-
|
|
3023
|
-
// A queue's messages carry one type — its own name.
|
|
3024
|
-
await eventSubscriber.subscribe([queue.name], async (message) => {
|
|
3025
|
-
try {
|
|
3026
|
-
const validation = await queue.messageSchema['~standard'].validate(message.payload);
|
|
3027
|
-
if (validation.issues) {
|
|
3028
|
-
logger.error({ issues: validation.issues, queue: queue.name }, 'Queue message failed validation');
|
|
3029
|
-
return;
|
|
3030
|
-
}
|
|
3031
|
-
|
|
3032
|
-
await queue.handler({
|
|
3033
|
-
messages: [validation.value],
|
|
3034
|
-
services: services,
|
|
3035
|
-
logger: queue.logger,
|
|
3036
|
-
db,
|
|
3037
|
-
} as any);
|
|
3038
|
-
} catch (error) {
|
|
3039
|
-
logger.error({ err: error, queue: queue.name }, 'Failed to process queue message');
|
|
3040
|
-
// Rethrown so the transport keeps the message for a retry.
|
|
3041
|
-
throw error;
|
|
3042
|
-
}
|
|
3043
|
-
});
|
|
3044
|
-
logger.info({ queue: queue.name }, 'Queue consumer started polling');
|
|
3045
|
-
} catch (error) {
|
|
3046
|
-
logger.error({ err: error, queue: queue.name }, 'Failed to set up queue consumer');
|
|
3047
|
-
}
|
|
3048
|
-
}
|
|
3049
|
-
|
|
3050
|
-
const shutdown = () => {
|
|
3051
|
-
for (const connection of connections.values()) void connection.close();
|
|
3052
|
-
};
|
|
3053
|
-
process.once('SIGTERM', shutdown);
|
|
3054
|
-
process.once('SIGINT', shutdown);
|
|
3055
|
-
}
|
|
3056
|
-
`;
|
|
3057
|
-
await (0, node_fs_promises.writeFile)(queuesPath, content);
|
|
3058
|
-
return queuesPath;
|
|
3059
|
-
}
|
|
3060
|
-
};
|
|
3061
|
-
//#endregion
|
|
3062
2652
|
//#region src/generators/TopicGenerator.ts
|
|
3063
2653
|
/**
|
|
3064
2654
|
* Discovers topics (`new Topic(…)`) into `manifest.topics`. A topic is a
|
|
@@ -3314,6 +2904,15 @@ var UnknownBuildProvider = class extends Error {
|
|
|
3314
2904
|
this.name = "UnknownBuildProvider";
|
|
3315
2905
|
}
|
|
3316
2906
|
};
|
|
2907
|
+
/** `--cache` named something that is not a cache backend. */
|
|
2908
|
+
var UnknownCacheBackend = class extends Error {
|
|
2909
|
+
backend;
|
|
2910
|
+
constructor(backend) {
|
|
2911
|
+
super(`'${backend}' is not a cache backend. Pass --cache upstash, elasticache, db or redis, or leave it out to register the deploy target's.`);
|
|
2912
|
+
this.backend = backend;
|
|
2913
|
+
this.name = "UnknownCacheBackend";
|
|
2914
|
+
}
|
|
2915
|
+
};
|
|
3317
2916
|
async function buildCommand(options) {
|
|
3318
2917
|
const loadedConfig = await require_config.loadWorkspaceConfig();
|
|
3319
2918
|
if (loadedConfig.type === "workspace") {
|
|
@@ -3366,7 +2965,7 @@ function backendsOf(workspace) {
|
|
|
3366
2965
|
/** One app's build, from its config and the command's options. */
|
|
3367
2966
|
async function buildOneApp(input) {
|
|
3368
2967
|
const { config, options, workspace, appRoot, target } = input;
|
|
3369
|
-
const cacheBackend = require_state.cacheBackendFor(require_state.providerOf(workspace));
|
|
2968
|
+
const cacheBackend = options.cache ?? require_state.cacheBackendFor(require_state.providerOf(workspace));
|
|
3370
2969
|
const eventsBackend = require_state.eventsBackendFor(require_state.providerOf(workspace));
|
|
3371
2970
|
const production = normalizeProductionConfig(options.production ?? false);
|
|
3372
2971
|
if (production) logger$4.log(`🏭 Building for PRODUCTION`);
|
|
@@ -3390,7 +2989,8 @@ async function buildOneApp(input) {
|
|
|
3390
2989
|
markOptional: options.markOptional ?? false,
|
|
3391
2990
|
skipBundle: options.skipBundle ?? false,
|
|
3392
2991
|
stage: options.stage,
|
|
3393
|
-
workspaceName: workspace.name
|
|
2992
|
+
workspaceName: workspace.name,
|
|
2993
|
+
workspace
|
|
3394
2994
|
});
|
|
3395
2995
|
}
|
|
3396
2996
|
/**
|
|
@@ -3432,11 +3032,13 @@ async function buildApp(input) {
|
|
|
3432
3032
|
const { config, workspaceRoot, appRoot, target, enableOpenApi, cacheBackend, eventsBackend, production, telescope, databaseApi, hooks, bustCache = false } = input;
|
|
3433
3033
|
const constructGlobs = config.constructs;
|
|
3434
3034
|
const constructSources = {};
|
|
3035
|
+
const background = {};
|
|
3435
3036
|
const declared = constructGlobs ? await require_discover.discover({
|
|
3436
3037
|
patterns: constructGlobs,
|
|
3437
3038
|
cwd: appRoot,
|
|
3438
3039
|
bustCache,
|
|
3439
|
-
sources: constructSources
|
|
3040
|
+
sources: constructSources,
|
|
3041
|
+
background
|
|
3440
3042
|
}) : {};
|
|
3441
3043
|
const selfServing = selfServingSurface({
|
|
3442
3044
|
declared,
|
|
@@ -3450,7 +3052,7 @@ async function buildApp(input) {
|
|
|
3450
3052
|
if (production?.bundle && !input.skipBundle) {
|
|
3451
3053
|
const outputDir = (0, node_path.join)(appRoot, ".gkm", "server");
|
|
3452
3054
|
const entryPoint = await writeSurfaceServer(outputDir, production);
|
|
3453
|
-
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-
|
|
3055
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-utHuESvL.cjs"));
|
|
3454
3056
|
await bundleServer({
|
|
3455
3057
|
entryPoint,
|
|
3456
3058
|
outputDir: (0, node_path.join)(outputDir, "dist"),
|
|
@@ -3470,7 +3072,7 @@ async function buildApp(input) {
|
|
|
3470
3072
|
appRoot,
|
|
3471
3073
|
databaseApi
|
|
3472
3074
|
});
|
|
3473
|
-
const eventsBackends =
|
|
3075
|
+
const eventsBackends = require_drivers.eventsBackendsIn(declared, eventsBackend);
|
|
3474
3076
|
const buildContext = {
|
|
3475
3077
|
...derived,
|
|
3476
3078
|
telescope,
|
|
@@ -3479,24 +3081,24 @@ async function buildApp(input) {
|
|
|
3479
3081
|
constructGlobs,
|
|
3480
3082
|
cacheBackend,
|
|
3481
3083
|
emailBackend: "ses",
|
|
3482
|
-
storageDrivers:
|
|
3084
|
+
storageDrivers: require_drivers.driversFor({
|
|
3483
3085
|
appRoot,
|
|
3484
|
-
cache:
|
|
3086
|
+
cache: require_drivers.cacheBackendsIn(declared, cacheBackend),
|
|
3485
3087
|
events: eventsBackends
|
|
3486
3088
|
}),
|
|
3487
3089
|
eventsBackends,
|
|
3488
3090
|
markOptional: input.markOptional ?? false,
|
|
3489
|
-
...production && { telemetry:
|
|
3091
|
+
...production && { telemetry: require_EndpointGenerator.telemetryFor({
|
|
3490
3092
|
appRoot,
|
|
3491
3093
|
surfaceId: derived.surface?.id,
|
|
3492
3094
|
workspaceName: input.workspaceName
|
|
3493
3095
|
}) }
|
|
3494
3096
|
};
|
|
3495
|
-
const endpointGenerator = new
|
|
3097
|
+
const endpointGenerator = new require_EndpointGenerator.EndpointGenerator();
|
|
3496
3098
|
const functionGenerator = new FunctionGenerator();
|
|
3497
|
-
const cronGenerator = new CronGenerator();
|
|
3498
|
-
const subscriberGenerator = new
|
|
3499
|
-
const queueGenerator = new QueueGenerator();
|
|
3099
|
+
const cronGenerator = new require_state.CronGenerator();
|
|
3100
|
+
const subscriberGenerator = new require_SubscriberGenerator.SubscriberGenerator();
|
|
3101
|
+
const queueGenerator = new require_state.QueueGenerator();
|
|
3500
3102
|
const topicGenerator = new TopicGenerator();
|
|
3501
3103
|
const code = constructGlobs;
|
|
3502
3104
|
const [loadedEndpoints, allFunctions, allCrons, allSubscribers, allQueues, allTopics] = await Promise.all([
|
|
@@ -3531,6 +3133,19 @@ async function buildApp(input) {
|
|
|
3531
3133
|
if (left.length > 0) logger$4.log(`Serving ${derived.surface.id} only: leaving out ${left.join(", ")} — they run in a Worker's image`);
|
|
3532
3134
|
}
|
|
3533
3135
|
const result = await buildForTarget(target, buildContext, appRoot, workspaceRoot, endpointGenerator, functionGenerator, cronGenerator, subscriberGenerator, queueGenerator, topicGenerator, allEndpoints, allFunctions, allCrons, allSubscribers, allQueues, allTopics, enableOpenApi, input.skipBundle ?? false, input.stage);
|
|
3136
|
+
if (target === "server" && production?.enabled && input.workspace) {
|
|
3137
|
+
const appName = Object.entries(input.workspace.apps).find(([, app]) => (0, node_path.resolve)(input.workspace.root, app.path) === (0, node_path.resolve)(appRoot))?.[0];
|
|
3138
|
+
await buildWorkers({
|
|
3139
|
+
context: buildContext,
|
|
3140
|
+
workers: require_state.workerUnits(input.workspace, declared, background).filter((unit) => unit.app === appName),
|
|
3141
|
+
serverDir: (0, node_path.join)(appRoot, ".gkm", "server"),
|
|
3142
|
+
crons: allCrons,
|
|
3143
|
+
queues: allQueues,
|
|
3144
|
+
subscribers: allSubscribers,
|
|
3145
|
+
bundle: Boolean(production.bundle && !input.skipBundle),
|
|
3146
|
+
...input.stage ? { stage: input.stage } : {}
|
|
3147
|
+
});
|
|
3148
|
+
}
|
|
3534
3149
|
await require_openapi.generateOpenApi(allEndpoints.map(({ construct }) => construct), {
|
|
3535
3150
|
openapi: config.openapi,
|
|
3536
3151
|
root: workspaceRoot
|
|
@@ -3540,6 +3155,46 @@ async function buildApp(input) {
|
|
|
3540
3155
|
...buildContext.databaseApi ? { databaseApi: buildContext.databaseApi.path } : {}
|
|
3541
3156
|
};
|
|
3542
3157
|
}
|
|
3158
|
+
/**
|
|
3159
|
+
* Write each worker's entry — and, for an image, bundle it — from the
|
|
3160
|
+
* runnables built from that worker, and nothing built from another.
|
|
3161
|
+
*/
|
|
3162
|
+
async function buildWorkers(input) {
|
|
3163
|
+
const generator = new require_state.WorkerGenerator();
|
|
3164
|
+
for (const worker of input.workers) {
|
|
3165
|
+
const owned = (list) => list.filter(({ construct }) => construct.owner === worker.id);
|
|
3166
|
+
const crons = owned(input.crons);
|
|
3167
|
+
const queues = owned(input.queues);
|
|
3168
|
+
const subscribers = owned(input.subscribers);
|
|
3169
|
+
const entryPoint = await generator.build({
|
|
3170
|
+
context: input.context,
|
|
3171
|
+
workerId: worker.id,
|
|
3172
|
+
outputDir: require_state.workerEntryDir(input.serverDir, worker.id),
|
|
3173
|
+
crons,
|
|
3174
|
+
queues,
|
|
3175
|
+
subscribers
|
|
3176
|
+
});
|
|
3177
|
+
logger$4.log(`Generated worker ${worker.id}: ${crons.length} crons, ${queues.length} queues, ${subscribers.length} subscribers`);
|
|
3178
|
+
if (!input.bundle) continue;
|
|
3179
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-utHuESvL.cjs"));
|
|
3180
|
+
const outfile = require_state.workerBundleName(worker.id);
|
|
3181
|
+
await bundleServer({
|
|
3182
|
+
entryPoint,
|
|
3183
|
+
outputDir: (0, node_path.join)(input.serverDir, "dist"),
|
|
3184
|
+
outfile,
|
|
3185
|
+
minify: input.context.production?.minify ?? false,
|
|
3186
|
+
sourcemap: false,
|
|
3187
|
+
external: input.context.production?.external ?? [],
|
|
3188
|
+
...input.stage ? { stage: input.stage } : {},
|
|
3189
|
+
constructs: [
|
|
3190
|
+
...crons,
|
|
3191
|
+
...queues,
|
|
3192
|
+
...subscribers
|
|
3193
|
+
].map((c) => c.construct)
|
|
3194
|
+
});
|
|
3195
|
+
logger$4.log(`✅ Bundle complete: .gkm/server/dist/${outfile}`);
|
|
3196
|
+
}
|
|
3197
|
+
}
|
|
3543
3198
|
async function buildForTarget(target, context, appRoot, workspaceRoot, endpointGenerator, functionGenerator, cronGenerator, subscriberGenerator, queueGenerator, topicGenerator, endpoints, functions, crons, subscribers, queues, topics, enableOpenApi, skipBundle, stage) {
|
|
3544
3199
|
const outputDir = (0, node_path.join)(appRoot, ".gkm", target);
|
|
3545
3200
|
await Promise.all([...SUPERSEDED_OUTPUT.map((dir) => (0, node_path.join)(appRoot, ".gkm", dir)), ...appRoot === workspaceRoot ? [] : [(0, node_path.join)(appRoot, ".gkm", "manifest")]].map((dir) => (0, node_fs_promises.rm)(dir, {
|
|
@@ -3591,7 +3246,7 @@ async function buildForTarget(target, context, appRoot, workspaceRoot, endpointG
|
|
|
3591
3246
|
let masterKey;
|
|
3592
3247
|
if (context.production?.bundle && !skipBundle) {
|
|
3593
3248
|
logger$4.log(`\n📦 Bundling production server...`);
|
|
3594
|
-
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-
|
|
3249
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-utHuESvL.cjs"));
|
|
3595
3250
|
const allConstructs = [
|
|
3596
3251
|
...endpoints.map((e) => e.construct),
|
|
3597
3252
|
...functions.map((f) => f.construct),
|
|
@@ -5290,25 +4945,25 @@ function loadPackageJson() {
|
|
|
5290
4945
|
* Run: pnpm --filter @geekmidas/cli sync-versions
|
|
5291
4946
|
*/
|
|
5292
4947
|
const GEEKMIDAS_VERSIONS = {
|
|
5293
|
-
"@geekmidas/audit": "~10.0.0-alpha.
|
|
5294
|
-
"@geekmidas/auth": "~10.0.0-alpha.
|
|
5295
|
-
"@geekmidas/cache": "~10.0.0-alpha.
|
|
5296
|
-
"@geekmidas/client": "~10.0.0-alpha.
|
|
5297
|
-
"@geekmidas/cloud": "~10.0.0-alpha.
|
|
5298
|
-
"@geekmidas/constructs": "~10.0.0-alpha.
|
|
5299
|
-
"@geekmidas/db": "~10.0.0-alpha.
|
|
5300
|
-
"@geekmidas/emailkit": "~10.0.0-alpha.
|
|
5301
|
-
"@geekmidas/envkit": "~10.0.0-alpha.
|
|
5302
|
-
"@geekmidas/errors": "~10.0.0-alpha.
|
|
5303
|
-
"@geekmidas/events": "~10.0.0-alpha.
|
|
5304
|
-
"@geekmidas/logger": "~10.0.0-alpha.
|
|
5305
|
-
"@geekmidas/manifest": "~10.0.0-alpha.
|
|
5306
|
-
"@geekmidas/rate-limit": "~10.0.0-alpha.
|
|
5307
|
-
"@geekmidas/schema": "~10.0.0-alpha.
|
|
5308
|
-
"@geekmidas/services": "~10.0.0-alpha.
|
|
5309
|
-
"@geekmidas/storage": "~10.0.0-alpha.
|
|
5310
|
-
"@geekmidas/telescope": "~10.0.0-alpha.
|
|
5311
|
-
"@geekmidas/testkit": "~10.0.0-alpha.
|
|
4948
|
+
"@geekmidas/audit": "~10.0.0-alpha.74",
|
|
4949
|
+
"@geekmidas/auth": "~10.0.0-alpha.74",
|
|
4950
|
+
"@geekmidas/cache": "~10.0.0-alpha.74",
|
|
4951
|
+
"@geekmidas/client": "~10.0.0-alpha.74",
|
|
4952
|
+
"@geekmidas/cloud": "~10.0.0-alpha.74",
|
|
4953
|
+
"@geekmidas/constructs": "~10.0.0-alpha.74",
|
|
4954
|
+
"@geekmidas/db": "~10.0.0-alpha.74",
|
|
4955
|
+
"@geekmidas/emailkit": "~10.0.0-alpha.74",
|
|
4956
|
+
"@geekmidas/envkit": "~10.0.0-alpha.74",
|
|
4957
|
+
"@geekmidas/errors": "~10.0.0-alpha.74",
|
|
4958
|
+
"@geekmidas/events": "~10.0.0-alpha.74",
|
|
4959
|
+
"@geekmidas/logger": "~10.0.0-alpha.74",
|
|
4960
|
+
"@geekmidas/manifest": "~10.0.0-alpha.74",
|
|
4961
|
+
"@geekmidas/rate-limit": "~10.0.0-alpha.74",
|
|
4962
|
+
"@geekmidas/schema": "~10.0.0-alpha.74",
|
|
4963
|
+
"@geekmidas/services": "~10.0.0-alpha.74",
|
|
4964
|
+
"@geekmidas/storage": "~10.0.0-alpha.74",
|
|
4965
|
+
"@geekmidas/telescope": "~10.0.0-alpha.74",
|
|
4966
|
+
"@geekmidas/testkit": "~10.0.0-alpha.74",
|
|
5312
4967
|
"@geekmidas/cli": `~${loadPackageJson().version}`
|
|
5313
4968
|
};
|
|
5314
4969
|
//#endregion
|
|
@@ -11099,8 +10754,8 @@ function testDatabases(reconciled) {
|
|
|
11099
10754
|
* starts without the reference data the app needs.
|
|
11100
10755
|
*/
|
|
11101
10756
|
async function migrateTestStage(workspace, env) {
|
|
11102
|
-
const { migrateAndSeed } = await Promise.resolve().then(() => require("./migrate-
|
|
11103
|
-
const { discover } = await Promise.resolve().then(() => require("./discover-
|
|
10757
|
+
const { migrateAndSeed } = await Promise.resolve().then(() => require("./migrate-B0FCZNkp.cjs"));
|
|
10758
|
+
const { discover } = await Promise.resolve().then(() => require("./discover-D1It5r_h.cjs")).then((n) => n.discover_exports);
|
|
11104
10759
|
const sources = {};
|
|
11105
10760
|
const manifest = await discover({
|
|
11106
10761
|
patterns: require_state.constructGlobs(workspace),
|
|
@@ -11465,13 +11120,15 @@ program.command("setup").description("Reconcile declared constructs — containe
|
|
|
11465
11120
|
process.exit(1);
|
|
11466
11121
|
}
|
|
11467
11122
|
});
|
|
11468
|
-
program.command("build").description("Build handlers and the manifest from declared constructs").option("--provider <provider>", "Build for aws or server (default: where gkm.config.ts deploys)").option("--enable-openapi", "Enable OpenAPI documentation generation for server builds").option("--production", "Build for production (no dev tools, bundled output)").option("--skip-bundle", "Skip bundling step in production build").option("--stage <stage>", "Inject encrypted secrets for deployment stage").option("--mark-optional", "Suffix optional env vars with ? in manifest envVars field (e.g. PORT?)").action(async (options) => {
|
|
11123
|
+
program.command("build").description("Build handlers and the manifest from declared constructs").option("--provider <provider>", "Build for aws or server (default: where gkm.config.ts deploys)").option("--enable-openapi", "Enable OpenAPI documentation generation for server builds").option("--production", "Build for production (no dev tools, bundled output)").option("--skip-bundle", "Skip bundling step in production build").option("--stage <stage>", "Inject encrypted secrets for deployment stage").option("--mark-optional", "Suffix optional env vars with ? in manifest envVars field (e.g. PORT?)").addOption(new commander.Option("--cache <backend>", "Register the drivers for this cache backend rather than the target default").hideHelp()).action(async (options) => {
|
|
11469
11124
|
try {
|
|
11470
11125
|
const globalOptions = program.opts();
|
|
11471
11126
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11472
11127
|
if (options.provider !== void 0 && !isMainProvider(options.provider)) throw new UnknownBuildProvider(options.provider);
|
|
11128
|
+
if (options.cache !== void 0 && !require_SubscriberGenerator.isCacheBackend(options.cache)) throw new UnknownCacheBackend(options.cache);
|
|
11473
11129
|
await buildCommand({
|
|
11474
11130
|
...options.provider ? { provider: options.provider } : {},
|
|
11131
|
+
...options.cache ? { cache: options.cache } : {},
|
|
11475
11132
|
enableOpenApi: options.enableOpenapi || false,
|
|
11476
11133
|
production: options.production || false,
|
|
11477
11134
|
skipBundle: options.skipBundle || false,
|
|
@@ -11530,7 +11187,7 @@ program.command("migrate").description("Apply each database construct's migratio
|
|
|
11530
11187
|
try {
|
|
11531
11188
|
const globalOptions = program.opts();
|
|
11532
11189
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11533
|
-
const { migrateCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
11190
|
+
const { migrateCommand } = await Promise.resolve().then(() => require("./migrate-B0FCZNkp.cjs"));
|
|
11534
11191
|
await migrateCommand({
|
|
11535
11192
|
...options,
|
|
11536
11193
|
...construct ? { construct } : {}
|
|
@@ -11544,7 +11201,7 @@ program.command("seed").description("Migrate, then run each database construct's
|
|
|
11544
11201
|
try {
|
|
11545
11202
|
const globalOptions = program.opts();
|
|
11546
11203
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11547
|
-
const { seedCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
11204
|
+
const { seedCommand } = await Promise.resolve().then(() => require("./migrate-B0FCZNkp.cjs"));
|
|
11548
11205
|
await seedCommand({
|
|
11549
11206
|
...options,
|
|
11550
11207
|
...construct ? { construct } : {}
|
|
@@ -11558,7 +11215,7 @@ program.command("migration").description("Write a construct's next migration: an
|
|
|
11558
11215
|
try {
|
|
11559
11216
|
const globalOptions = program.opts();
|
|
11560
11217
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11561
|
-
const { migrationCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
11218
|
+
const { migrationCommand } = await Promise.resolve().then(() => require("./migrate-B0FCZNkp.cjs"));
|
|
11562
11219
|
await migrationCommand({
|
|
11563
11220
|
construct,
|
|
11564
11221
|
...name ? { name } : {}
|
|
@@ -11652,7 +11309,7 @@ program.command("secrets:add").description("Build the keys a stage must be given
|
|
|
11652
11309
|
try {
|
|
11653
11310
|
const globalOptions = program.opts();
|
|
11654
11311
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11655
|
-
const { secretsAddCommand } = await Promise.resolve().then(() => require("./add-
|
|
11312
|
+
const { secretsAddCommand } = await Promise.resolve().then(() => require("./add-Djrr12Xc.cjs"));
|
|
11656
11313
|
await secretsAddCommand(options);
|
|
11657
11314
|
} catch (error) {
|
|
11658
11315
|
console.error(formatError(error));
|
|
@@ -11663,7 +11320,7 @@ program.command("encryption:rotate").description("Add a new current key to an En
|
|
|
11663
11320
|
try {
|
|
11664
11321
|
const globalOptions = program.opts();
|
|
11665
11322
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11666
|
-
const { encryptionRotateCommand } = await Promise.resolve().then(() => require("./encryption-
|
|
11323
|
+
const { encryptionRotateCommand } = await Promise.resolve().then(() => require("./encryption-DSkJdoyk.cjs"));
|
|
11667
11324
|
await encryptionRotateCommand(construct, options);
|
|
11668
11325
|
} catch (error) {
|
|
11669
11326
|
console.error(formatError(error));
|
|
@@ -11674,7 +11331,7 @@ program.command("encryption:retire").description("Remove an old key from an Encr
|
|
|
11674
11331
|
try {
|
|
11675
11332
|
const globalOptions = program.opts();
|
|
11676
11333
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11677
|
-
const { encryptionRetireCommand } = await Promise.resolve().then(() => require("./encryption-
|
|
11334
|
+
const { encryptionRetireCommand } = await Promise.resolve().then(() => require("./encryption-DSkJdoyk.cjs"));
|
|
11678
11335
|
await encryptionRetireCommand(construct, key, options);
|
|
11679
11336
|
} catch (error) {
|
|
11680
11337
|
console.error(formatError(error));
|
|
@@ -11717,7 +11374,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
11717
11374
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11718
11375
|
const { loadWorkspaceConfig } = await Promise.resolve().then(() => require("./config.cjs"));
|
|
11719
11376
|
const { reconcileMissingSecrets } = await Promise.resolve().then(() => require("./reconcile-CuCQBa5-.cjs"));
|
|
11720
|
-
const { secretsStoreFor } = await Promise.resolve().then(() => require("./state-
|
|
11377
|
+
const { secretsStoreFor } = await Promise.resolve().then(() => require("./state-DCwRWyh-.cjs")).then((n) => n.store_exports);
|
|
11721
11378
|
const { workspace } = await loadWorkspaceConfig();
|
|
11722
11379
|
const stage = options.stage ?? workspace.stages.local;
|
|
11723
11380
|
const store = await secretsStoreFor(workspace, stage);
|
|
@@ -11726,7 +11383,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
11726
11383
|
console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
|
|
11727
11384
|
process.exit(1);
|
|
11728
11385
|
}
|
|
11729
|
-
const { derivedContainers } = await Promise.resolve().then(() => require("./state-
|
|
11386
|
+
const { derivedContainers } = await Promise.resolve().then(() => require("./state-DCwRWyh-.cjs")).then((n) => n.workspace_exports);
|
|
11730
11387
|
const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
|
|
11731
11388
|
if (!result) {
|
|
11732
11389
|
console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);
|
|
@@ -11741,7 +11398,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
11741
11398
|
}
|
|
11742
11399
|
});
|
|
11743
11400
|
program.command("deploy").description("Deploy a stage through its target").option("--target <name>", "Deploy target: dokploy, compose, sst, or one named in deploy.targets (default: deploy.default)").option("--provider <provider>", "[DEPRECATED] Use --target instead").requiredOption("--stage <stage>", "Deployment stage (e.g., production, staging)").option("--tag <tag>", "Image tag (default: stage-timestamp; compose: the commit). Compose pulls a given tag").option("--skip-push", "Skip pushing image to registry").option("--skip-build", "Skip build step (use existing build)").option("--json", "Write events as JSON lines instead of progress; never prompts").option("--dry-run", "Show what would be created or reused; change, build and push nothing").option("--atomic", "If the release fails, roll back every app it released, not only the failed ones").option("--allow-dev-services <list>", "Server targets: run MinIO and/or Mailpit (minio,mailpit) for mail and buckets the stage's secrets don't configure. Not production-grade").action(async (options) => {
|
|
11744
|
-
const { deployCli } = await Promise.resolve().then(() => require("./cli-
|
|
11401
|
+
const { deployCli } = await Promise.resolve().then(() => require("./cli-Bx0sUzxH.cjs"));
|
|
11745
11402
|
const globalOptions = program.opts();
|
|
11746
11403
|
const code = await deployCli({
|
|
11747
11404
|
cwd: (0, node_path.resolve)(globalOptions.cwd ?? process.cwd()),
|
|
@@ -11758,8 +11415,8 @@ program.command("deploy").description("Deploy a stage through its target").optio
|
|
|
11758
11415
|
});
|
|
11759
11416
|
program.command("deploy:rollback").description("Put a stage's app back on its previous release (Dokploy): one app with --app, every app with --atomic").requiredOption("--stage <stage>", "A deployed stage").option("--app <app>", "The app to roll back").option("--atomic", "Roll back every app that has an earlier release").action(async (options) => {
|
|
11760
11417
|
try {
|
|
11761
|
-
const { rollbackStage } = await Promise.resolve().then(() => require("./rollback-
|
|
11762
|
-
const { terminalCredentials } = await Promise.resolve().then(() => require("./terminal-
|
|
11418
|
+
const { rollbackStage } = await Promise.resolve().then(() => require("./rollback-DJy3t696.cjs")).then((n) => n.rollback_exports);
|
|
11419
|
+
const { terminalCredentials } = await Promise.resolve().then(() => require("./terminal-BL5E0xbR.cjs"));
|
|
11763
11420
|
const globalOptions = program.opts();
|
|
11764
11421
|
await rollbackStage({
|
|
11765
11422
|
cwd: (0, node_path.resolve)(globalOptions.cwd ?? process.cwd()),
|
|
@@ -11794,7 +11451,7 @@ program.command("deploy:github").description("Let GitHub Actions deploy a stage:
|
|
|
11794
11451
|
try {
|
|
11795
11452
|
const globalOptions = program.opts();
|
|
11796
11453
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11797
|
-
const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-
|
|
11454
|
+
const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-BvN3CfxM.cjs"));
|
|
11798
11455
|
await deployGithubCommand(options);
|
|
11799
11456
|
} catch (error) {
|
|
11800
11457
|
console.error(formatError(error));
|