@geekmidas/cli 10.0.0-alpha.71 → 10.0.0-alpha.73
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-DZZwHdDC.cjs → EndpointGenerator-CP6sBvQV.cjs} +7 -513
- package/dist/EndpointGenerator-CP6sBvQV.cjs.map +1 -0
- package/dist/{OpenApiTsGenerator-Bhr_XWWN.mjs → EndpointGenerator-DftalLYg.mjs} +6 -512
- 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-Bixm28fN.cjs +461 -0
- package/dist/SubscriberGenerator-Bixm28fN.cjs.map +1 -0
- package/dist/SubscriberGenerator-DZk_pKDh.mjs +432 -0
- package/dist/SubscriberGenerator-DZk_pKDh.mjs.map +1 -0
- package/dist/{add-XTLU19_E.mjs → add-BiPlBUq3.mjs} +4 -4
- package/dist/{add-XTLU19_E.mjs.map → add-BiPlBUq3.mjs.map} +1 -1
- package/dist/{add-DeC2Kyyv.cjs → add-C1ojB2Yy.cjs} +4 -4
- package/dist/{add-DeC2Kyyv.cjs.map → add-C1ojB2Yy.cjs.map} +1 -1
- package/dist/{bundler-CNTVLCCA.mjs → bundler-C2LZoLdP.mjs} +6 -6
- package/dist/bundler-C2LZoLdP.mjs.map +1 -0
- package/dist/{bundler-CEaR6Dpb.cjs → bundler-C35h0WKt.cjs} +6 -6
- package/dist/bundler-C35h0WKt.cjs.map +1 -0
- package/dist/{cli-D1arS0p1.mjs → cli-BfdfyTF6.mjs} +4 -4
- package/dist/{cli-D1arS0p1.mjs.map → cli-BfdfyTF6.mjs.map} +1 -1
- package/dist/{cli-MMgBrHx7.cjs → cli-DJVL2sL9.cjs} +4 -4
- package/dist/{cli-MMgBrHx7.cjs.map → cli-DJVL2sL9.cjs.map} +1 -1
- package/dist/{compose-T3hnnjKZ.mjs → compose-9II-0IsK.mjs} +221 -64
- package/dist/compose-9II-0IsK.mjs.map +1 -0
- package/dist/{compose-B-MME-4C.cjs → compose-CNnw8meq.cjs} +223 -66
- package/dist/compose-CNnw8meq.cjs.map +1 -0
- package/dist/{config-BN6iXvyR.d.mts → config-B8OR_TrO.d.mts} +3 -3
- package/dist/{config-BN6iXvyR.d.mts.map → config-B8OR_TrO.d.mts.map} +1 -1
- package/dist/{config-j9zBKaEG.d.cts → config-RLuR2o9A.d.cts} +3 -3
- package/dist/{config-j9zBKaEG.d.cts.map → config-RLuR2o9A.d.cts.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-CZE0m6jd.cjs → deploy-BitZLdnY.cjs} +12 -6
- package/dist/deploy-BitZLdnY.cjs.map +1 -0
- package/dist/{deploy-ClC53rc6.mjs → deploy-nmov4j0B.mjs} +12 -6
- package/dist/deploy-nmov4j0B.mjs.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-CZ1vZt21.mjs} +2 -2
- package/dist/{dokploy-D1UwQKm3.mjs.map → dokploy-CZ1vZt21.mjs.map} +1 -1
- package/dist/{dokploy-lwmH05zr.cjs → dokploy-Ce_VTytN.cjs} +2 -2
- package/dist/{dokploy-lwmH05zr.cjs.map → dokploy-Ce_VTytN.cjs.map} +1 -1
- package/dist/{encryption-D05sNwED.cjs → encryption-CDGRdcMr.cjs} +2 -2
- package/dist/{encryption-D05sNwED.cjs.map → encryption-CDGRdcMr.cjs.map} +1 -1
- package/dist/{encryption-DcrxWl1s.mjs → encryption-CmfPICSN.mjs} +2 -2
- package/dist/{encryption-DcrxWl1s.mjs.map → encryption-CmfPICSN.mjs.map} +1 -1
- package/dist/{engine-DmQS3XHX.mjs → engine-B37qBO5W.mjs} +117 -17
- package/dist/engine-B37qBO5W.mjs.map +1 -0
- package/dist/{engine-Cry1vwMz.cjs → engine-DL2-PW6m.cjs} +117 -17
- package/dist/engine-DL2-PW6m.cjs.map +1 -0
- package/dist/{github-BchWoiVx.cjs → github-C6qF8kHg.cjs} +2 -2
- package/dist/{github-BchWoiVx.cjs.map → github-C6qF8kHg.cjs.map} +1 -1
- package/dist/{github-CqYOP8cI.mjs → github-hjHHm7jM.mjs} +2 -2
- package/dist/{github-CqYOP8cI.mjs.map → github-hjHHm7jM.mjs.map} +1 -1
- package/dist/{index-DvoxuTqR.d.mts → index-DHyTqGG3.d.mts} +2 -2
- package/dist/{index-Bk3NY6DN.d.cts.map → index-DHyTqGG3.d.mts.map} +1 -1
- package/dist/{index-Bk3NY6DN.d.cts → index-Dg-UZ4Hm.d.cts} +2 -2
- package/dist/{index-DvoxuTqR.d.mts.map → index-Dg-UZ4Hm.d.cts.map} +1 -1
- package/dist/index.cjs +124 -448
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +118 -442
- package/dist/index.mjs.map +1 -1
- package/dist/{migrate-guck0NJK.mjs → migrate-CFFC3esE.mjs} +3 -3
- package/dist/{migrate-guck0NJK.mjs.map → migrate-CFFC3esE.mjs.map} +1 -1
- package/dist/{migrate-qKeGYq21.cjs → migrate-kA_j1TPK.cjs} +3 -3
- package/dist/{migrate-qKeGYq21.cjs.map → migrate-kA_j1TPK.cjs.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-Dp6arkI4.cjs → ready-BIuMw6wH.cjs} +66 -289
- package/dist/ready-BIuMw6wH.cjs.map +1 -0
- package/dist/{ready-xpoX11uu.mjs → ready-C0U0NYfB.mjs} +58 -281
- package/dist/ready-C0U0NYfB.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-CV4eQkDa.mjs} +3 -3
- package/dist/{resolve-BsXEXAUz.mjs.map → resolve-CV4eQkDa.mjs.map} +1 -1
- package/dist/{resolve-wEjEvbJ5.cjs → resolve-E5RfY0bm.cjs} +3 -3
- package/dist/{resolve-wEjEvbJ5.cjs.map → resolve-E5RfY0bm.cjs.map} +1 -1
- package/dist/{rollback-Bk91csFg.mjs → rollback-C-V-Rf4a.mjs} +4 -4
- package/dist/{rollback-Bk91csFg.mjs.map → rollback-C-V-Rf4a.mjs.map} +1 -1
- package/dist/{rollback-DmcU-efZ.cjs → rollback-QGwomD64.cjs} +4 -4
- package/dist/{rollback-DmcU-efZ.cjs.map → rollback-QGwomD64.cjs.map} +1 -1
- package/dist/{runtime-DHJhe4QI.d.mts → runtime-CWYLIeCU.d.mts} +2 -2
- package/dist/{runtime-CYAO4iZG.d.cts.map → runtime-CWYLIeCU.d.mts.map} +1 -1
- package/dist/{runtime-CYAO4iZG.d.cts → runtime-CmuQOT6A.d.cts} +2 -2
- package/dist/{runtime-DHJhe4QI.d.mts.map → runtime-CmuQOT6A.d.cts.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-DMjFPOhf.cjs} +942 -22
- package/dist/state-DMjFPOhf.cjs.map +1 -0
- package/dist/{state-BJFherj1.mjs → state-DtS2HEfi.mjs} +877 -17
- package/dist/state-DtS2HEfi.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-BLdCL4fB.d.mts} +17 -1
- package/dist/types-BLdCL4fB.d.mts.map +1 -0
- package/dist/{types-BD1jgA85.d.cts → types-DwCQCkC-.d.cts} +17 -1
- package/dist/types-DwCQCkC-.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-Bhr_XWWN.mjs.map +0 -1
- package/dist/OpenApiTsGenerator-DZZwHdDC.cjs.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-Dp6arkI4.cjs.map +0 -1
- package/dist/ready-xpoX11uu.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,21 +3,22 @@ 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-DMjFPOhf.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-Bixm28fN.cjs");
|
|
14
15
|
const require_appPorts = require("./appPorts-Cu79hJF6.cjs");
|
|
15
|
-
const require_ready = require("./ready-
|
|
16
|
+
const require_ready = require("./ready-BIuMw6wH.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-BitZLdnY.cjs");
|
|
19
|
+
const require_compose = require("./compose-CNnw8meq.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");
|
|
22
23
|
let node_path = require("node:path");
|
|
23
24
|
let commander = require("commander");
|
|
@@ -48,12 +49,10 @@ let http2 = require("http2");
|
|
|
48
49
|
let stream = require("stream");
|
|
49
50
|
let crypto = require("crypto");
|
|
50
51
|
crypto = require_rolldown_runtime.__toESM(crypto, 1);
|
|
51
|
-
let _geekmidas_constructs_crons = require("@geekmidas/constructs/crons");
|
|
52
52
|
let _geekmidas_constructs_functions = require("@geekmidas/constructs/functions");
|
|
53
|
-
let _geekmidas_constructs_queue = require("@geekmidas/constructs/queue");
|
|
54
53
|
let _geekmidas_constructs_topic = require("@geekmidas/constructs/topic");
|
|
55
54
|
//#region package.json
|
|
56
|
-
var version = "10.0.0-alpha.
|
|
55
|
+
var version = "10.0.0-alpha.73";
|
|
57
56
|
//#endregion
|
|
58
57
|
//#region src/prompt.ts
|
|
59
58
|
/**
|
|
@@ -136,7 +135,7 @@ const logger$8 = console;
|
|
|
136
135
|
* Validate Dokploy token by making a test API call
|
|
137
136
|
*/
|
|
138
137
|
async function validateDokployToken(endpoint, token) {
|
|
139
|
-
const { DokployApi } = await Promise.resolve().then(() => require("./sniffer-
|
|
138
|
+
const { DokployApi } = await Promise.resolve().then(() => require("./sniffer-C-T7dSMN.cjs")).then((n) => n.dokploy_api_exports);
|
|
140
139
|
return new DokployApi({
|
|
141
140
|
baseUrl: endpoint,
|
|
142
141
|
token
|
|
@@ -1680,6 +1679,7 @@ async function devCommand(options) {
|
|
|
1680
1679
|
target: "server",
|
|
1681
1680
|
enableOpenApi,
|
|
1682
1681
|
cacheBackend: require_state.cacheBackendFor(require_state.providerOf(workspace ?? config)),
|
|
1682
|
+
eventsBackend: require_state.eventsBackendFor(require_state.providerOf(workspace ?? config)),
|
|
1683
1683
|
telescope,
|
|
1684
1684
|
databaseApi: true,
|
|
1685
1685
|
hooks,
|
|
@@ -2041,9 +2041,9 @@ async function workspaceDevCommand(configured, options) {
|
|
|
2041
2041
|
for (const { id, port } of fakes) logger$5.log(`🎭 ${id} fake: http://localhost:${port}`);
|
|
2042
2042
|
logger$5.log(options.migrate || options.seed ? "🗄️ Migrating the databases" : "🗄️ Checking for pending migrations");
|
|
2043
2043
|
if (options.migrate || options.seed) {
|
|
2044
|
-
const { prepareDevDatabases } = await Promise.resolve().then(() => require("./migrate-
|
|
2044
|
+
const { prepareDevDatabases } = await Promise.resolve().then(() => require("./migrate-kA_j1TPK.cjs"));
|
|
2045
2045
|
await prepareDevDatabases(workspace, reconciled.env, { seed: !!options.seed });
|
|
2046
|
-
} else await Promise.resolve().then(() => require("./migrate-
|
|
2046
|
+
} else await Promise.resolve().then(() => require("./migrate-kA_j1TPK.cjs")).then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
|
|
2047
2047
|
logger$5.log(`⚠️ Could not check for pending migrations: ${error instanceof Error ? error.message : String(error)}`);
|
|
2048
2048
|
});
|
|
2049
2049
|
const appUrls = {};
|
|
@@ -2602,222 +2602,6 @@ var DevServer = class {
|
|
|
2602
2602
|
}
|
|
2603
2603
|
};
|
|
2604
2604
|
//#endregion
|
|
2605
|
-
//#region src/generators/CronGenerator.ts
|
|
2606
|
-
var CronGenerator = class extends require_discover.ConstructGenerator {
|
|
2607
|
-
async build(context, constructs, outputDir, options) {
|
|
2608
|
-
const target = options?.target ?? "aws";
|
|
2609
|
-
const logger = console;
|
|
2610
|
-
const cronInfos = [];
|
|
2611
|
-
if (target === "server") {
|
|
2612
|
-
await this.generateServerCronsFile(outputDir, constructs);
|
|
2613
|
-
logger.log(`Generated server crons file with ${constructs.length} crons`);
|
|
2614
|
-
return cronInfos;
|
|
2615
|
-
}
|
|
2616
|
-
if (constructs.length === 0) return cronInfos;
|
|
2617
|
-
const cronsDir = (0, node_path.join)(outputDir, "crons");
|
|
2618
|
-
await (0, node_fs_promises.mkdir)(cronsDir, { recursive: true });
|
|
2619
|
-
for (const { key, construct, path } of constructs) {
|
|
2620
|
-
const handlerFile = await this.generateCronHandler(cronsDir, path.relative, key, context, construct.owner);
|
|
2621
|
-
cronInfos.push({
|
|
2622
|
-
name: key,
|
|
2623
|
-
handler: (0, node_path.relative)(options?.root ?? process.cwd(), handlerFile).replace(/\.ts$/, ".handler"),
|
|
2624
|
-
schedule: construct.schedule || "rate(1 hour)",
|
|
2625
|
-
timeout: construct.timeout,
|
|
2626
|
-
memorySize: construct.memorySize,
|
|
2627
|
-
environment: await construct.getEnvironment({ markOptional: context.markOptional }),
|
|
2628
|
-
dependencies: construct.constructs
|
|
2629
|
-
});
|
|
2630
|
-
logger.log(`Generated cron handler: ${key}`);
|
|
2631
|
-
}
|
|
2632
|
-
return cronInfos;
|
|
2633
|
-
}
|
|
2634
|
-
isConstruct(value) {
|
|
2635
|
-
return _geekmidas_constructs_crons.Cron.isCron(value);
|
|
2636
|
-
}
|
|
2637
|
-
/**
|
|
2638
|
-
* The crons file a server entry imports.
|
|
2639
|
-
*
|
|
2640
|
-
* Shaped after `generateServerSubscribersFile`: one module, every cron, a
|
|
2641
|
-
* `setupCrons` the generated entry calls beside `setupSubscribers`.
|
|
2642
|
-
*
|
|
2643
|
-
* It picks its scheduler from what the process can reach. With a Postgres it
|
|
2644
|
-
* uses pg-boss, whose schedules live in the database — so a deployment
|
|
2645
|
-
* running four replicas fires each job once, which is the thing a timer in
|
|
2646
|
-
* every process gets wrong and does not report. With no database it falls
|
|
2647
|
-
* back to timers and says plainly that it is doing so.
|
|
2648
|
-
*/
|
|
2649
|
-
async generateServerCronsFile(outputDir, crons) {
|
|
2650
|
-
await (0, node_fs_promises.mkdir)(outputDir, { recursive: true });
|
|
2651
|
-
const cronsPath = (0, node_path.join)(outputDir, "crons.ts");
|
|
2652
|
-
const importsByFile = /* @__PURE__ */ new Map();
|
|
2653
|
-
for (const { path, key } of crons) {
|
|
2654
|
-
const importPath = (0, node_path.relative)((0, node_path.dirname)(cronsPath), path.relative).replace(/\.ts$/, ".js");
|
|
2655
|
-
if (!importsByFile.has(importPath)) importsByFile.set(importPath, []);
|
|
2656
|
-
importsByFile.get(importPath)?.push(key);
|
|
2657
|
-
}
|
|
2658
|
-
const content = `/**
|
|
2659
|
-
* Generated cron setup.
|
|
2660
|
-
*
|
|
2661
|
-
* Schedules every cron this app declares, in the process that serves it.
|
|
2662
|
-
*
|
|
2663
|
-
* The schedule lives in Postgres, through pg-boss, in the database the worker
|
|
2664
|
-
* named with \`.database(db)\`. That is what makes running several replicas
|
|
2665
|
-
* safe: each job fires once, where a timer in every process fires it once per
|
|
2666
|
-
* replica and reports nothing.
|
|
2667
|
-
*
|
|
2668
|
-
* No connection string appears here. The construct that owns the database is
|
|
2669
|
-
* the only thing that knows its key, and it is resolved through service
|
|
2670
|
-
* discovery like any other dependency.
|
|
2671
|
-
*/
|
|
2672
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2673
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2674
|
-
import { runCron, scheduleInProcess, toCronExpression } from '@geekmidas/constructs/crons';
|
|
2675
|
-
import { ServiceDiscovery } from '@geekmidas/services';
|
|
2676
|
-
${Array.from(importsByFile.entries()).map(([importPath, exports]) => `import { ${exports.join(", ")} } from '${importPath}';`).join("\n")}
|
|
2677
|
-
|
|
2678
|
-
const crons = [
|
|
2679
|
-
${crons.map(({ key }) => ` { name: '${key}', cron: ${key} }`).join(",\n")}
|
|
2680
|
-
];
|
|
2681
|
-
|
|
2682
|
-
type Stoppable = { stop: () => Promise<void> | void };
|
|
2683
|
-
const running: Stoppable[] = [];
|
|
2684
|
-
|
|
2685
|
-
export async function setupCrons(
|
|
2686
|
-
envParser: EnvironmentParser<any>,
|
|
2687
|
-
logger: Logger,
|
|
2688
|
-
): Promise<void> {
|
|
2689
|
-
if (crons.length === 0) {
|
|
2690
|
-
return;
|
|
2691
|
-
}
|
|
2692
|
-
|
|
2693
|
-
const serviceDiscovery = ServiceDiscovery.getInstance(envParser);
|
|
2694
|
-
|
|
2695
|
-
// Resolved once per cron rather than per firing: registering services on
|
|
2696
|
-
// every tick would reconnect a database every minute.
|
|
2697
|
-
const prepared = [];
|
|
2698
|
-
for (const { name, cron } of crons) {
|
|
2699
|
-
try {
|
|
2700
|
-
const schedule = toCronExpression(cron.schedule);
|
|
2701
|
-
const services = cron.services.length > 0
|
|
2702
|
-
? await serviceDiscovery.register(cron.services)
|
|
2703
|
-
: {};
|
|
2704
|
-
|
|
2705
|
-
prepared.push({ name, cron, schedule, services });
|
|
2706
|
-
} catch (error) {
|
|
2707
|
-
// An unrepresentable schedule is a build-time mistake, and failing the
|
|
2708
|
-
// process for it would take the HTTP server down with it.
|
|
2709
|
-
logger.error({ err: error, cron: name }, 'Cron has no runnable schedule, skipping');
|
|
2710
|
-
}
|
|
2711
|
-
}
|
|
2712
|
-
|
|
2713
|
-
const run = async (entry: (typeof prepared)[number]) => {
|
|
2714
|
-
try {
|
|
2715
|
-
// The cron's own function, the way its Lambda would run it — services,
|
|
2716
|
-
// the worker's database as \`db\`, its events. It used to call a
|
|
2717
|
-
// \`handler\` a Cron does not have, so every firing logged a failure.
|
|
2718
|
-
await runCron(entry.cron, serviceDiscovery);
|
|
2719
|
-
} catch (error) {
|
|
2720
|
-
logger.error({ err: error, cron: entry.name }, 'Cron failed');
|
|
2721
|
-
}
|
|
2722
|
-
};
|
|
2723
|
-
|
|
2724
|
-
// The app's one pg-boss: the events broker's, as the broker's role, in the
|
|
2725
|
-
// broker's schema. A server fires its own crons, and a process scheduling in
|
|
2726
|
-
// memory fires each job once per replica — so the schedule lives in
|
|
2727
|
-
// Postgres. It used to be a second pg-boss on the worker's database, as the
|
|
2728
|
-
// runtime role, which can neither create a schema nor use the broker's.
|
|
2729
|
-
const { url, devPid } = envParser
|
|
2730
|
-
.create((get) => ({
|
|
2731
|
-
url: get('EVENT_PUBLISHER_CONNECTION_STRING').string().optional(),
|
|
2732
|
-
// Set by \`gkm dev\` on the server it starts, and by nothing deployed.
|
|
2733
|
-
devPid: get('GKM_DEV_PID').string().optional(),
|
|
2734
|
-
}))
|
|
2735
|
-
.parse();
|
|
2736
|
-
|
|
2737
|
-
if (!url?.startsWith('pgboss://')) {
|
|
2738
|
-
// \`gkm dev\` on a target whose crons are infrastructure once deployed —
|
|
2739
|
-
// EventBridge rules on AWS — has no broker to keep a schedule in. It is one
|
|
2740
|
-
// process, so a timer fires each job once, which is all pg-boss is for
|
|
2741
|
-
// here. Only there: a deployed server firing by timer fires once per
|
|
2742
|
-
// replica, so outside dev this stays the error below.
|
|
2743
|
-
if (devPid) {
|
|
2744
|
-
for (const entry of prepared) {
|
|
2745
|
-
running.push(scheduleInProcess(entry.schedule, () => run(entry)));
|
|
2746
|
-
logger.info({ cron: entry.name, schedule: entry.schedule }, 'Cron scheduled in this process');
|
|
2747
|
-
}
|
|
2748
|
-
return;
|
|
2749
|
-
}
|
|
2750
|
-
|
|
2751
|
-
logger.error(
|
|
2752
|
-
{ crons: prepared.map(({ name }) => name) },
|
|
2753
|
-
'These crons have nowhere to keep their schedule. On a server they are ' +
|
|
2754
|
-
'scheduled through the pg-boss events broker ' +
|
|
2755
|
-
'(EVENT_PUBLISHER_CONNECTION_STRING), and ' +
|
|
2756
|
-
(url ? 'the broker configured is not pg-boss.' : 'none is configured.'),
|
|
2757
|
-
);
|
|
2758
|
-
return;
|
|
2759
|
-
}
|
|
2760
|
-
|
|
2761
|
-
const { PgBossConnection } = await import('@geekmidas/events/pgboss');
|
|
2762
|
-
const connection = await PgBossConnection.fromConnectionString(url);
|
|
2763
|
-
const boss = connection.instance!;
|
|
2764
|
-
|
|
2765
|
-
// What this app declares now. Anything else under the prefix belonged to a
|
|
2766
|
-
// cron since renamed or deleted, and would keep firing at a handler that has
|
|
2767
|
-
// gone.
|
|
2768
|
-
//
|
|
2769
|
-
// The prefix is \`cron.\` rather than \`cron:\`: pg-boss accepts
|
|
2770
|
-
// alphanumerics, underscores, hyphens, periods and slashes in a queue name,
|
|
2771
|
-
// and rejects a colon outright.
|
|
2772
|
-
const declared = new Set(prepared.map(({ name }) => \`cron.\${name}\`));
|
|
2773
|
-
for (const existing of await boss.getSchedules()) {
|
|
2774
|
-
if (existing.name.startsWith('cron.') && !declared.has(existing.name)) {
|
|
2775
|
-
await boss.unschedule(existing.name);
|
|
2776
|
-
logger.info({ cron: existing.name }, 'Removed a schedule nothing declares');
|
|
2777
|
-
}
|
|
2778
|
-
}
|
|
2779
|
-
|
|
2780
|
-
for (const entry of prepared) {
|
|
2781
|
-
const queue = \`cron.\${entry.name}\`;
|
|
2782
|
-
await boss.createQueue(queue);
|
|
2783
|
-
// UTC, so this agrees with the schedule a deploy target would have made.
|
|
2784
|
-
await boss.schedule(queue, entry.schedule, undefined, { tz: 'UTC' });
|
|
2785
|
-
await boss.work(queue, () => run(entry));
|
|
2786
|
-
|
|
2787
|
-
logger.info({ cron: entry.name, schedule: entry.schedule }, 'Cron scheduled');
|
|
2788
|
-
}
|
|
2789
|
-
|
|
2790
|
-
running.push({ stop: () => connection.close() });
|
|
2791
|
-
logger.info({ count: prepared.length }, 'Crons scheduled');
|
|
2792
|
-
}
|
|
2793
|
-
|
|
2794
|
-
export async function stopCrons(): Promise<void> {
|
|
2795
|
-
await Promise.all(running.map((r) => r.stop()));
|
|
2796
|
-
running.length = 0;
|
|
2797
|
-
}
|
|
2798
|
-
`;
|
|
2799
|
-
await (0, node_fs_promises.writeFile)(cronsPath, content);
|
|
2800
|
-
return cronsPath;
|
|
2801
|
-
}
|
|
2802
|
-
async generateCronHandler(outputDir, sourceFile, exportName, context, owner) {
|
|
2803
|
-
const handlerFileName = `${exportName}.ts`;
|
|
2804
|
-
const handlerPath = (0, node_path.join)(outputDir, handlerFileName);
|
|
2805
|
-
const importPath = (0, node_path.relative)((0, node_path.dirname)(handlerPath), sourceFile).replace(/\.ts$/, ".js");
|
|
2806
|
-
const runtime = require_OpenApiTsGenerator.runtimeFor(context, (0, node_path.dirname)(handlerPath), owner);
|
|
2807
|
-
const content = `import { AWSScheduledFunction } from '@geekmidas/constructs/aws';
|
|
2808
|
-
import { ${exportName} } from '${importPath}';
|
|
2809
|
-
${runtime.imports}
|
|
2810
|
-
${runtime.bindings}
|
|
2811
|
-
|
|
2812
|
-
const adapter = new AWSScheduledFunction(envParser, ${exportName});
|
|
2813
|
-
|
|
2814
|
-
export const handler = adapter.handler;
|
|
2815
|
-
`;
|
|
2816
|
-
await (0, node_fs_promises.writeFile)(handlerPath, content);
|
|
2817
|
-
return handlerPath;
|
|
2818
|
-
}
|
|
2819
|
-
};
|
|
2820
|
-
//#endregion
|
|
2821
2605
|
//#region src/generators/FunctionGenerator.ts
|
|
2822
2606
|
var FunctionGenerator = class extends require_discover.ConstructGenerator {
|
|
2823
2607
|
isConstruct(value) {
|
|
@@ -2848,12 +2632,13 @@ var FunctionGenerator = class extends require_discover.ConstructGenerator {
|
|
|
2848
2632
|
const handlerFileName = `${exportName}.ts`;
|
|
2849
2633
|
const handlerPath = (0, node_path.join)(outputDir, handlerFileName);
|
|
2850
2634
|
const importPath = (0, node_path.relative)((0, node_path.dirname)(handlerPath), sourceFile).replace(/\.ts$/, ".js");
|
|
2851
|
-
const runtime =
|
|
2635
|
+
const runtime = require_EndpointGenerator.runtimeFor(context, (0, node_path.dirname)(handlerPath), owner);
|
|
2852
2636
|
const content = `import { AWSLambdaFunction } from '@geekmidas/constructs/aws';
|
|
2853
2637
|
import { ${exportName} } from '${importPath}';
|
|
2854
2638
|
${runtime.imports}
|
|
2639
|
+
${context.storageDrivers?.imports ?? ""}
|
|
2855
2640
|
${runtime.bindings}
|
|
2856
|
-
|
|
2641
|
+
${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
|
|
2857
2642
|
const adapter = new AWSLambdaFunction(envParser, ${exportName});
|
|
2858
2643
|
|
|
2859
2644
|
export const handler = adapter.handler;
|
|
@@ -2863,177 +2648,6 @@ export const handler = adapter.handler;
|
|
|
2863
2648
|
}
|
|
2864
2649
|
};
|
|
2865
2650
|
//#endregion
|
|
2866
|
-
//#region src/generators/QueueGenerator.ts
|
|
2867
|
-
/**
|
|
2868
|
-
* Generates the runtime for queue consumers (`worker.queue(…)`).
|
|
2869
|
-
*
|
|
2870
|
-
* - **server** (`gkm dev`): a single `queues.ts` exposing `setupQueues()` that
|
|
2871
|
-
* polls each queue in-process, alongside the Hono server, through the queue's
|
|
2872
|
-
* own connection string — pg-boss by default, SQS on the AWS emulator.
|
|
2873
|
-
* - **aws-lambda**: one handler file per queue wrapping `AWSLambdaQueue`, backed
|
|
2874
|
-
* by an SQS event-source mapping.
|
|
2875
|
-
*/
|
|
2876
|
-
var QueueGenerator = class extends require_discover.ConstructGenerator {
|
|
2877
|
-
isConstruct(value) {
|
|
2878
|
-
return _geekmidas_constructs_queue.Queue.isQueue(value);
|
|
2879
|
-
}
|
|
2880
|
-
async build(context, constructs, outputDir, options) {
|
|
2881
|
-
const target = options?.target ?? "aws";
|
|
2882
|
-
const logger = console;
|
|
2883
|
-
const queueInfos = [];
|
|
2884
|
-
if (target === "server") {
|
|
2885
|
-
await this.generateServerQueuesFile(outputDir, constructs);
|
|
2886
|
-
logger.log(`Generated server queues file with ${constructs.length} queues (polling mode)`);
|
|
2887
|
-
return queueInfos;
|
|
2888
|
-
}
|
|
2889
|
-
if (constructs.length === 0) return queueInfos;
|
|
2890
|
-
const queuesDir = (0, node_path.join)(outputDir, "queues");
|
|
2891
|
-
await (0, node_fs_promises.mkdir)(queuesDir, { recursive: true });
|
|
2892
|
-
for (const { key, construct, path } of constructs) {
|
|
2893
|
-
const handlerFile = await this.generateQueueHandler(queuesDir, path.relative, key, context, construct.owner);
|
|
2894
|
-
queueInfos.push({
|
|
2895
|
-
name: construct.name,
|
|
2896
|
-
handler: (0, node_path.relative)(options?.root ?? process.cwd(), handlerFile).replace(/\.ts$/, ".handler"),
|
|
2897
|
-
batchSize: construct.batchSize,
|
|
2898
|
-
fifo: construct.fifo,
|
|
2899
|
-
timeout: construct.timeout,
|
|
2900
|
-
environment: await construct.getEnvironment({ markOptional: context.markOptional }),
|
|
2901
|
-
dependencies: construct.constructs
|
|
2902
|
-
});
|
|
2903
|
-
logger.log(`Generated queue handler: ${key}`);
|
|
2904
|
-
}
|
|
2905
|
-
return queueInfos;
|
|
2906
|
-
}
|
|
2907
|
-
async generateQueueHandler(outputDir, sourceFile, exportName, context, owner) {
|
|
2908
|
-
const handlerPath = (0, node_path.join)(outputDir, `${exportName}.ts`);
|
|
2909
|
-
const importPath = (0, node_path.relative)((0, node_path.dirname)(handlerPath), sourceFile).replace(/\.ts$/, ".js");
|
|
2910
|
-
const runtime = require_OpenApiTsGenerator.runtimeFor(context, (0, node_path.dirname)(handlerPath), owner);
|
|
2911
|
-
const content = `import { AWSLambdaQueue } from '@geekmidas/constructs/aws';
|
|
2912
|
-
import { ${exportName} } from '${importPath}';
|
|
2913
|
-
${runtime.imports}
|
|
2914
|
-
${runtime.bindings}
|
|
2915
|
-
|
|
2916
|
-
const adapter = new AWSLambdaQueue(envParser, ${exportName});
|
|
2917
|
-
|
|
2918
|
-
export const handler = adapter.handler;
|
|
2919
|
-
`;
|
|
2920
|
-
await (0, node_fs_promises.writeFile)(handlerPath, content);
|
|
2921
|
-
return handlerPath;
|
|
2922
|
-
}
|
|
2923
|
-
async generateServerQueuesFile(outputDir, queues) {
|
|
2924
|
-
await (0, node_fs_promises.mkdir)(outputDir, { recursive: true });
|
|
2925
|
-
const queuesPath = (0, node_path.join)(outputDir, "queues.ts");
|
|
2926
|
-
if (queues.length === 0) {
|
|
2927
|
-
await (0, node_fs_promises.writeFile)(queuesPath, `/**
|
|
2928
|
-
* Generated queues setup — this app declares none.
|
|
2929
|
-
*/
|
|
2930
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2931
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2932
|
-
|
|
2933
|
-
export async function setupQueues(
|
|
2934
|
-
_envParser: EnvironmentParser<any>,
|
|
2935
|
-
_logger: Logger,
|
|
2936
|
-
): Promise<void> {}
|
|
2937
|
-
`);
|
|
2938
|
-
return queuesPath;
|
|
2939
|
-
}
|
|
2940
|
-
const importsByFile = /* @__PURE__ */ new Map();
|
|
2941
|
-
for (const { path, key } of queues) {
|
|
2942
|
-
const importPath = (0, node_path.relative)((0, node_path.dirname)(queuesPath), path.relative).replace(/\.ts$/, ".js");
|
|
2943
|
-
if (!importsByFile.has(importPath)) importsByFile.set(importPath, []);
|
|
2944
|
-
importsByFile.get(importPath)?.push(key);
|
|
2945
|
-
}
|
|
2946
|
-
const content = `/**
|
|
2947
|
-
* Generated queue consumers setup.
|
|
2948
|
-
*
|
|
2949
|
-
* Each queue's one consumer polls its own queue, through the queue's own
|
|
2950
|
-
* connection string — the one its producers publish on. SQS cannot push, so
|
|
2951
|
-
* this is a poller on every transport: pg-boss locally by default, the SQS
|
|
2952
|
-
* queue on the AWS emulator.
|
|
2953
|
-
*
|
|
2954
|
-
* Deployed on Lambda, a queue's consumer is an SQS event source instead.
|
|
2955
|
-
*/
|
|
2956
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2957
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2958
|
-
import { EventConnectionFactory, Subscriber } from '@geekmidas/events';
|
|
2959
|
-
import type { EventConnection } from '@geekmidas/events';
|
|
2960
|
-
import { ServiceDiscovery } from '@geekmidas/services';
|
|
2961
|
-
${Array.from(importsByFile.entries()).map(([importPath, exports]) => `import { ${exports.join(", ")} } from '${importPath}';`).join("\n")}
|
|
2962
|
-
|
|
2963
|
-
const queues = [
|
|
2964
|
-
${queues.map(({ key, construct }) => ` { queue: ${key}, connectionKey: '${(0, _geekmidas_manifest.provideKey)(construct.id, "publisherConnectionString")}' },`).join("\n")}
|
|
2965
|
-
];
|
|
2966
|
-
|
|
2967
|
-
export async function setupQueues(
|
|
2968
|
-
envParser: EnvironmentParser<any>,
|
|
2969
|
-
logger: Logger,
|
|
2970
|
-
): Promise<void> {
|
|
2971
|
-
const serviceDiscovery = ServiceDiscovery.getInstance(envParser);
|
|
2972
|
-
const connections = new Map<string, EventConnection>();
|
|
2973
|
-
|
|
2974
|
-
for (const { queue, connectionKey } of queues) {
|
|
2975
|
-
const connectionString = process.env[connectionKey];
|
|
2976
|
-
if (!connectionString) {
|
|
2977
|
-
logger.error({ queue: queue.name, connectionKey }, 'No connection string for this queue');
|
|
2978
|
-
continue;
|
|
2979
|
-
}
|
|
2980
|
-
|
|
2981
|
-
try {
|
|
2982
|
-
let connection = connections.get(connectionString);
|
|
2983
|
-
if (!connection) {
|
|
2984
|
-
connection = await EventConnectionFactory.fromConnectionString(connectionString);
|
|
2985
|
-
connections.set(connectionString, connection);
|
|
2986
|
-
}
|
|
2987
|
-
const eventSubscriber = await Subscriber.fromConnection(connection);
|
|
2988
|
-
const services = queue.services.length > 0
|
|
2989
|
-
? await serviceDiscovery.register(queue.services)
|
|
2990
|
-
: {};
|
|
2991
|
-
// The queue's database — the worker's, or its own — handed over as \`db\`.
|
|
2992
|
-
const db = queue.databaseService
|
|
2993
|
-
? (await serviceDiscovery.register([queue.databaseService]))[
|
|
2994
|
-
queue.databaseService.serviceName
|
|
2995
|
-
]
|
|
2996
|
-
: undefined;
|
|
2997
|
-
|
|
2998
|
-
// A queue's messages carry one type — its own name.
|
|
2999
|
-
await eventSubscriber.subscribe([queue.name], async (message) => {
|
|
3000
|
-
try {
|
|
3001
|
-
const validation = await queue.messageSchema['~standard'].validate(message.payload);
|
|
3002
|
-
if (validation.issues) {
|
|
3003
|
-
logger.error({ issues: validation.issues, queue: queue.name }, 'Queue message failed validation');
|
|
3004
|
-
return;
|
|
3005
|
-
}
|
|
3006
|
-
|
|
3007
|
-
await queue.handler({
|
|
3008
|
-
messages: [validation.value],
|
|
3009
|
-
services: services,
|
|
3010
|
-
logger: queue.logger,
|
|
3011
|
-
db,
|
|
3012
|
-
} as any);
|
|
3013
|
-
} catch (error) {
|
|
3014
|
-
logger.error({ err: error, queue: queue.name }, 'Failed to process queue message');
|
|
3015
|
-
// Rethrown so the transport keeps the message for a retry.
|
|
3016
|
-
throw error;
|
|
3017
|
-
}
|
|
3018
|
-
});
|
|
3019
|
-
logger.info({ queue: queue.name }, 'Queue consumer started polling');
|
|
3020
|
-
} catch (error) {
|
|
3021
|
-
logger.error({ err: error, queue: queue.name }, 'Failed to set up queue consumer');
|
|
3022
|
-
}
|
|
3023
|
-
}
|
|
3024
|
-
|
|
3025
|
-
const shutdown = () => {
|
|
3026
|
-
for (const connection of connections.values()) void connection.close();
|
|
3027
|
-
};
|
|
3028
|
-
process.once('SIGTERM', shutdown);
|
|
3029
|
-
process.once('SIGINT', shutdown);
|
|
3030
|
-
}
|
|
3031
|
-
`;
|
|
3032
|
-
await (0, node_fs_promises.writeFile)(queuesPath, content);
|
|
3033
|
-
return queuesPath;
|
|
3034
|
-
}
|
|
3035
|
-
};
|
|
3036
|
-
//#endregion
|
|
3037
2651
|
//#region src/generators/TopicGenerator.ts
|
|
3038
2652
|
/**
|
|
3039
2653
|
* Discovers topics (`new Topic(…)`) into `manifest.topics`. A topic is a
|
|
@@ -3342,6 +2956,7 @@ function backendsOf(workspace) {
|
|
|
3342
2956
|
async function buildOneApp(input) {
|
|
3343
2957
|
const { config, options, workspace, appRoot, target } = input;
|
|
3344
2958
|
const cacheBackend = require_state.cacheBackendFor(require_state.providerOf(workspace));
|
|
2959
|
+
const eventsBackend = require_state.eventsBackendFor(require_state.providerOf(workspace));
|
|
3345
2960
|
const production = normalizeProductionConfig(options.production ?? false);
|
|
3346
2961
|
if (production) logger$4.log(`🏭 Building for PRODUCTION`);
|
|
3347
2962
|
logger$4.log(`Building for ${target}`);
|
|
@@ -3357,13 +2972,15 @@ async function buildOneApp(input) {
|
|
|
3357
2972
|
target,
|
|
3358
2973
|
enableOpenApi: options.enableOpenApi ?? false,
|
|
3359
2974
|
cacheBackend,
|
|
2975
|
+
eventsBackend,
|
|
3360
2976
|
production,
|
|
3361
2977
|
telescope,
|
|
3362
2978
|
hooks,
|
|
3363
2979
|
markOptional: options.markOptional ?? false,
|
|
3364
2980
|
skipBundle: options.skipBundle ?? false,
|
|
3365
2981
|
stage: options.stage,
|
|
3366
|
-
workspaceName: workspace.name
|
|
2982
|
+
workspaceName: workspace.name,
|
|
2983
|
+
workspace
|
|
3367
2984
|
});
|
|
3368
2985
|
}
|
|
3369
2986
|
/**
|
|
@@ -3402,14 +3019,16 @@ async function writeManifest(input) {
|
|
|
3402
3019
|
* dev did not, and failed on exactly the apps the build had learned to handle.
|
|
3403
3020
|
*/
|
|
3404
3021
|
async function buildApp(input) {
|
|
3405
|
-
const { config, workspaceRoot, appRoot, target, enableOpenApi, cacheBackend, production, telescope, databaseApi, hooks, bustCache = false } = input;
|
|
3022
|
+
const { config, workspaceRoot, appRoot, target, enableOpenApi, cacheBackend, eventsBackend, production, telescope, databaseApi, hooks, bustCache = false } = input;
|
|
3406
3023
|
const constructGlobs = config.constructs;
|
|
3407
3024
|
const constructSources = {};
|
|
3025
|
+
const background = {};
|
|
3408
3026
|
const declared = constructGlobs ? await require_discover.discover({
|
|
3409
3027
|
patterns: constructGlobs,
|
|
3410
3028
|
cwd: appRoot,
|
|
3411
3029
|
bustCache,
|
|
3412
|
-
sources: constructSources
|
|
3030
|
+
sources: constructSources,
|
|
3031
|
+
background
|
|
3413
3032
|
}) : {};
|
|
3414
3033
|
const selfServing = selfServingSurface({
|
|
3415
3034
|
declared,
|
|
@@ -3423,7 +3042,7 @@ async function buildApp(input) {
|
|
|
3423
3042
|
if (production?.bundle && !input.skipBundle) {
|
|
3424
3043
|
const outputDir = (0, node_path.join)(appRoot, ".gkm", "server");
|
|
3425
3044
|
const entryPoint = await writeSurfaceServer(outputDir, production);
|
|
3426
|
-
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-
|
|
3045
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-C35h0WKt.cjs"));
|
|
3427
3046
|
await bundleServer({
|
|
3428
3047
|
entryPoint,
|
|
3429
3048
|
outputDir: (0, node_path.join)(outputDir, "dist"),
|
|
@@ -3443,6 +3062,7 @@ async function buildApp(input) {
|
|
|
3443
3062
|
appRoot,
|
|
3444
3063
|
databaseApi
|
|
3445
3064
|
});
|
|
3065
|
+
const eventsBackends = require_ready.eventsBackendsIn(declared, eventsBackend);
|
|
3446
3066
|
const buildContext = {
|
|
3447
3067
|
...derived,
|
|
3448
3068
|
telescope,
|
|
@@ -3453,20 +3073,22 @@ async function buildApp(input) {
|
|
|
3453
3073
|
emailBackend: "ses",
|
|
3454
3074
|
storageDrivers: require_ready.driversFor({
|
|
3455
3075
|
appRoot,
|
|
3456
|
-
cache: require_ready.cacheBackendsIn(declared, cacheBackend)
|
|
3076
|
+
cache: require_ready.cacheBackendsIn(declared, cacheBackend),
|
|
3077
|
+
events: eventsBackends
|
|
3457
3078
|
}),
|
|
3079
|
+
eventsBackends,
|
|
3458
3080
|
markOptional: input.markOptional ?? false,
|
|
3459
|
-
...production && { telemetry:
|
|
3081
|
+
...production && { telemetry: require_EndpointGenerator.telemetryFor({
|
|
3460
3082
|
appRoot,
|
|
3461
3083
|
surfaceId: derived.surface?.id,
|
|
3462
3084
|
workspaceName: input.workspaceName
|
|
3463
3085
|
}) }
|
|
3464
3086
|
};
|
|
3465
|
-
const endpointGenerator = new
|
|
3087
|
+
const endpointGenerator = new require_EndpointGenerator.EndpointGenerator();
|
|
3466
3088
|
const functionGenerator = new FunctionGenerator();
|
|
3467
|
-
const cronGenerator = new CronGenerator();
|
|
3468
|
-
const subscriberGenerator = new
|
|
3469
|
-
const queueGenerator = new QueueGenerator();
|
|
3089
|
+
const cronGenerator = new require_state.CronGenerator();
|
|
3090
|
+
const subscriberGenerator = new require_SubscriberGenerator.SubscriberGenerator();
|
|
3091
|
+
const queueGenerator = new require_state.QueueGenerator();
|
|
3470
3092
|
const topicGenerator = new TopicGenerator();
|
|
3471
3093
|
const code = constructGlobs;
|
|
3472
3094
|
const [loadedEndpoints, allFunctions, allCrons, allSubscribers, allQueues, allTopics] = await Promise.all([
|
|
@@ -3501,6 +3123,19 @@ async function buildApp(input) {
|
|
|
3501
3123
|
if (left.length > 0) logger$4.log(`Serving ${derived.surface.id} only: leaving out ${left.join(", ")} — they run in a Worker's image`);
|
|
3502
3124
|
}
|
|
3503
3125
|
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);
|
|
3126
|
+
if (target === "server" && production?.enabled && input.workspace) {
|
|
3127
|
+
const appName = Object.entries(input.workspace.apps).find(([, app]) => (0, node_path.resolve)(input.workspace.root, app.path) === (0, node_path.resolve)(appRoot))?.[0];
|
|
3128
|
+
await buildWorkers({
|
|
3129
|
+
context: buildContext,
|
|
3130
|
+
workers: require_state.workerUnits(input.workspace, declared, background).filter((unit) => unit.app === appName),
|
|
3131
|
+
serverDir: (0, node_path.join)(appRoot, ".gkm", "server"),
|
|
3132
|
+
crons: allCrons,
|
|
3133
|
+
queues: allQueues,
|
|
3134
|
+
subscribers: allSubscribers,
|
|
3135
|
+
bundle: Boolean(production.bundle && !input.skipBundle),
|
|
3136
|
+
...input.stage ? { stage: input.stage } : {}
|
|
3137
|
+
});
|
|
3138
|
+
}
|
|
3504
3139
|
await require_openapi.generateOpenApi(allEndpoints.map(({ construct }) => construct), {
|
|
3505
3140
|
openapi: config.openapi,
|
|
3506
3141
|
root: workspaceRoot
|
|
@@ -3510,6 +3145,46 @@ async function buildApp(input) {
|
|
|
3510
3145
|
...buildContext.databaseApi ? { databaseApi: buildContext.databaseApi.path } : {}
|
|
3511
3146
|
};
|
|
3512
3147
|
}
|
|
3148
|
+
/**
|
|
3149
|
+
* Write each worker's entry — and, for an image, bundle it — from the
|
|
3150
|
+
* runnables built from that worker, and nothing built from another.
|
|
3151
|
+
*/
|
|
3152
|
+
async function buildWorkers(input) {
|
|
3153
|
+
const generator = new require_state.WorkerGenerator();
|
|
3154
|
+
for (const worker of input.workers) {
|
|
3155
|
+
const owned = (list) => list.filter(({ construct }) => construct.owner === worker.id);
|
|
3156
|
+
const crons = owned(input.crons);
|
|
3157
|
+
const queues = owned(input.queues);
|
|
3158
|
+
const subscribers = owned(input.subscribers);
|
|
3159
|
+
const entryPoint = await generator.build({
|
|
3160
|
+
context: input.context,
|
|
3161
|
+
workerId: worker.id,
|
|
3162
|
+
outputDir: require_state.workerEntryDir(input.serverDir, worker.id),
|
|
3163
|
+
crons,
|
|
3164
|
+
queues,
|
|
3165
|
+
subscribers
|
|
3166
|
+
});
|
|
3167
|
+
logger$4.log(`Generated worker ${worker.id}: ${crons.length} crons, ${queues.length} queues, ${subscribers.length} subscribers`);
|
|
3168
|
+
if (!input.bundle) continue;
|
|
3169
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-C35h0WKt.cjs"));
|
|
3170
|
+
const outfile = require_state.workerBundleName(worker.id);
|
|
3171
|
+
await bundleServer({
|
|
3172
|
+
entryPoint,
|
|
3173
|
+
outputDir: (0, node_path.join)(input.serverDir, "dist"),
|
|
3174
|
+
outfile,
|
|
3175
|
+
minify: input.context.production?.minify ?? false,
|
|
3176
|
+
sourcemap: false,
|
|
3177
|
+
external: input.context.production?.external ?? [],
|
|
3178
|
+
...input.stage ? { stage: input.stage } : {},
|
|
3179
|
+
constructs: [
|
|
3180
|
+
...crons,
|
|
3181
|
+
...queues,
|
|
3182
|
+
...subscribers
|
|
3183
|
+
].map((c) => c.construct)
|
|
3184
|
+
});
|
|
3185
|
+
logger$4.log(`✅ Bundle complete: .gkm/server/dist/${outfile}`);
|
|
3186
|
+
}
|
|
3187
|
+
}
|
|
3513
3188
|
async function buildForTarget(target, context, appRoot, workspaceRoot, endpointGenerator, functionGenerator, cronGenerator, subscriberGenerator, queueGenerator, topicGenerator, endpoints, functions, crons, subscribers, queues, topics, enableOpenApi, skipBundle, stage) {
|
|
3514
3189
|
const outputDir = (0, node_path.join)(appRoot, ".gkm", target);
|
|
3515
3190
|
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, {
|
|
@@ -3561,7 +3236,7 @@ async function buildForTarget(target, context, appRoot, workspaceRoot, endpointG
|
|
|
3561
3236
|
let masterKey;
|
|
3562
3237
|
if (context.production?.bundle && !skipBundle) {
|
|
3563
3238
|
logger$4.log(`\n📦 Bundling production server...`);
|
|
3564
|
-
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-
|
|
3239
|
+
const { bundleServer } = await Promise.resolve().then(() => require("./bundler-C35h0WKt.cjs"));
|
|
3565
3240
|
const allConstructs = [
|
|
3566
3241
|
...endpoints.map((e) => e.construct),
|
|
3567
3242
|
...functions.map((f) => f.construct),
|
|
@@ -5260,25 +4935,25 @@ function loadPackageJson() {
|
|
|
5260
4935
|
* Run: pnpm --filter @geekmidas/cli sync-versions
|
|
5261
4936
|
*/
|
|
5262
4937
|
const GEEKMIDAS_VERSIONS = {
|
|
5263
|
-
"@geekmidas/audit": "~10.0.0-alpha.
|
|
5264
|
-
"@geekmidas/auth": "~10.0.0-alpha.
|
|
5265
|
-
"@geekmidas/cache": "~10.0.0-alpha.
|
|
5266
|
-
"@geekmidas/client": "~10.0.0-alpha.
|
|
5267
|
-
"@geekmidas/cloud": "~10.0.0-alpha.
|
|
5268
|
-
"@geekmidas/constructs": "~10.0.0-alpha.
|
|
5269
|
-
"@geekmidas/db": "~10.0.0-alpha.
|
|
5270
|
-
"@geekmidas/emailkit": "~10.0.0-alpha.
|
|
5271
|
-
"@geekmidas/envkit": "~10.0.0-alpha.
|
|
5272
|
-
"@geekmidas/errors": "~10.0.0-alpha.
|
|
5273
|
-
"@geekmidas/events": "~10.0.0-alpha.
|
|
5274
|
-
"@geekmidas/logger": "~10.0.0-alpha.
|
|
5275
|
-
"@geekmidas/manifest": "~10.0.0-alpha.
|
|
5276
|
-
"@geekmidas/rate-limit": "~10.0.0-alpha.
|
|
5277
|
-
"@geekmidas/schema": "~10.0.0-alpha.
|
|
5278
|
-
"@geekmidas/services": "~10.0.0-alpha.
|
|
5279
|
-
"@geekmidas/storage": "~10.0.0-alpha.
|
|
5280
|
-
"@geekmidas/telescope": "~10.0.0-alpha.
|
|
5281
|
-
"@geekmidas/testkit": "~10.0.0-alpha.
|
|
4938
|
+
"@geekmidas/audit": "~10.0.0-alpha.73",
|
|
4939
|
+
"@geekmidas/auth": "~10.0.0-alpha.73",
|
|
4940
|
+
"@geekmidas/cache": "~10.0.0-alpha.73",
|
|
4941
|
+
"@geekmidas/client": "~10.0.0-alpha.73",
|
|
4942
|
+
"@geekmidas/cloud": "~10.0.0-alpha.73",
|
|
4943
|
+
"@geekmidas/constructs": "~10.0.0-alpha.73",
|
|
4944
|
+
"@geekmidas/db": "~10.0.0-alpha.73",
|
|
4945
|
+
"@geekmidas/emailkit": "~10.0.0-alpha.73",
|
|
4946
|
+
"@geekmidas/envkit": "~10.0.0-alpha.73",
|
|
4947
|
+
"@geekmidas/errors": "~10.0.0-alpha.73",
|
|
4948
|
+
"@geekmidas/events": "~10.0.0-alpha.73",
|
|
4949
|
+
"@geekmidas/logger": "~10.0.0-alpha.73",
|
|
4950
|
+
"@geekmidas/manifest": "~10.0.0-alpha.73",
|
|
4951
|
+
"@geekmidas/rate-limit": "~10.0.0-alpha.73",
|
|
4952
|
+
"@geekmidas/schema": "~10.0.0-alpha.73",
|
|
4953
|
+
"@geekmidas/services": "~10.0.0-alpha.73",
|
|
4954
|
+
"@geekmidas/storage": "~10.0.0-alpha.73",
|
|
4955
|
+
"@geekmidas/telescope": "~10.0.0-alpha.73",
|
|
4956
|
+
"@geekmidas/testkit": "~10.0.0-alpha.73",
|
|
5282
4957
|
"@geekmidas/cli": `~${loadPackageJson().version}`
|
|
5283
4958
|
};
|
|
5284
4959
|
//#endregion
|
|
@@ -10994,6 +10669,7 @@ async function testCommand(options = {}) {
|
|
|
10994
10669
|
targets: [workspace.root, ...Object.values(workspace.apps).map((app) => (0, node_path.isAbsolute)(app.path) ? app.path : (0, node_path.join)(workspace.root, app.path))],
|
|
10995
10670
|
patterns: require_state.constructGlobs(workspace),
|
|
10996
10671
|
cacheBackend: require_state.backendsOf(workspace).cache,
|
|
10672
|
+
eventsBackend: require_state.backendsOf(workspace).events,
|
|
10997
10673
|
stage: require_workspace.TEST_STAGE,
|
|
10998
10674
|
env: finalCredentials,
|
|
10999
10675
|
factories: (0, node_path.join)(workspace.root, workspace.test.factories ?? "test/factories")
|
|
@@ -11068,8 +10744,8 @@ function testDatabases(reconciled) {
|
|
|
11068
10744
|
* starts without the reference data the app needs.
|
|
11069
10745
|
*/
|
|
11070
10746
|
async function migrateTestStage(workspace, env) {
|
|
11071
|
-
const { migrateAndSeed } = await Promise.resolve().then(() => require("./migrate-
|
|
11072
|
-
const { discover } = await Promise.resolve().then(() => require("./discover-
|
|
10747
|
+
const { migrateAndSeed } = await Promise.resolve().then(() => require("./migrate-kA_j1TPK.cjs"));
|
|
10748
|
+
const { discover } = await Promise.resolve().then(() => require("./discover-D1It5r_h.cjs")).then((n) => n.discover_exports);
|
|
11073
10749
|
const sources = {};
|
|
11074
10750
|
const manifest = await discover({
|
|
11075
10751
|
patterns: require_state.constructGlobs(workspace),
|
|
@@ -11499,7 +11175,7 @@ program.command("migrate").description("Apply each database construct's migratio
|
|
|
11499
11175
|
try {
|
|
11500
11176
|
const globalOptions = program.opts();
|
|
11501
11177
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11502
|
-
const { migrateCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
11178
|
+
const { migrateCommand } = await Promise.resolve().then(() => require("./migrate-kA_j1TPK.cjs"));
|
|
11503
11179
|
await migrateCommand({
|
|
11504
11180
|
...options,
|
|
11505
11181
|
...construct ? { construct } : {}
|
|
@@ -11513,7 +11189,7 @@ program.command("seed").description("Migrate, then run each database construct's
|
|
|
11513
11189
|
try {
|
|
11514
11190
|
const globalOptions = program.opts();
|
|
11515
11191
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11516
|
-
const { seedCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
11192
|
+
const { seedCommand } = await Promise.resolve().then(() => require("./migrate-kA_j1TPK.cjs"));
|
|
11517
11193
|
await seedCommand({
|
|
11518
11194
|
...options,
|
|
11519
11195
|
...construct ? { construct } : {}
|
|
@@ -11527,7 +11203,7 @@ program.command("migration").description("Write a construct's next migration: an
|
|
|
11527
11203
|
try {
|
|
11528
11204
|
const globalOptions = program.opts();
|
|
11529
11205
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11530
|
-
const { migrationCommand } = await Promise.resolve().then(() => require("./migrate-
|
|
11206
|
+
const { migrationCommand } = await Promise.resolve().then(() => require("./migrate-kA_j1TPK.cjs"));
|
|
11531
11207
|
await migrationCommand({
|
|
11532
11208
|
construct,
|
|
11533
11209
|
...name ? { name } : {}
|
|
@@ -11621,7 +11297,7 @@ program.command("secrets:add").description("Build the keys a stage must be given
|
|
|
11621
11297
|
try {
|
|
11622
11298
|
const globalOptions = program.opts();
|
|
11623
11299
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11624
|
-
const { secretsAddCommand } = await Promise.resolve().then(() => require("./add-
|
|
11300
|
+
const { secretsAddCommand } = await Promise.resolve().then(() => require("./add-C1ojB2Yy.cjs"));
|
|
11625
11301
|
await secretsAddCommand(options);
|
|
11626
11302
|
} catch (error) {
|
|
11627
11303
|
console.error(formatError(error));
|
|
@@ -11632,7 +11308,7 @@ program.command("encryption:rotate").description("Add a new current key to an En
|
|
|
11632
11308
|
try {
|
|
11633
11309
|
const globalOptions = program.opts();
|
|
11634
11310
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11635
|
-
const { encryptionRotateCommand } = await Promise.resolve().then(() => require("./encryption-
|
|
11311
|
+
const { encryptionRotateCommand } = await Promise.resolve().then(() => require("./encryption-CDGRdcMr.cjs"));
|
|
11636
11312
|
await encryptionRotateCommand(construct, options);
|
|
11637
11313
|
} catch (error) {
|
|
11638
11314
|
console.error(formatError(error));
|
|
@@ -11643,7 +11319,7 @@ program.command("encryption:retire").description("Remove an old key from an Encr
|
|
|
11643
11319
|
try {
|
|
11644
11320
|
const globalOptions = program.opts();
|
|
11645
11321
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11646
|
-
const { encryptionRetireCommand } = await Promise.resolve().then(() => require("./encryption-
|
|
11322
|
+
const { encryptionRetireCommand } = await Promise.resolve().then(() => require("./encryption-CDGRdcMr.cjs"));
|
|
11647
11323
|
await encryptionRetireCommand(construct, key, options);
|
|
11648
11324
|
} catch (error) {
|
|
11649
11325
|
console.error(formatError(error));
|
|
@@ -11686,7 +11362,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
11686
11362
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11687
11363
|
const { loadWorkspaceConfig } = await Promise.resolve().then(() => require("./config.cjs"));
|
|
11688
11364
|
const { reconcileMissingSecrets } = await Promise.resolve().then(() => require("./reconcile-CuCQBa5-.cjs"));
|
|
11689
|
-
const { secretsStoreFor } = await Promise.resolve().then(() => require("./state-
|
|
11365
|
+
const { secretsStoreFor } = await Promise.resolve().then(() => require("./state-DMjFPOhf.cjs")).then((n) => n.store_exports);
|
|
11690
11366
|
const { workspace } = await loadWorkspaceConfig();
|
|
11691
11367
|
const stage = options.stage ?? workspace.stages.local;
|
|
11692
11368
|
const store = await secretsStoreFor(workspace, stage);
|
|
@@ -11695,7 +11371,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
11695
11371
|
console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
|
|
11696
11372
|
process.exit(1);
|
|
11697
11373
|
}
|
|
11698
|
-
const { derivedContainers } = await Promise.resolve().then(() => require("./state-
|
|
11374
|
+
const { derivedContainers } = await Promise.resolve().then(() => require("./state-DMjFPOhf.cjs")).then((n) => n.workspace_exports);
|
|
11699
11375
|
const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
|
|
11700
11376
|
if (!result) {
|
|
11701
11377
|
console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);
|
|
@@ -11710,7 +11386,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
11710
11386
|
}
|
|
11711
11387
|
});
|
|
11712
11388
|
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) => {
|
|
11713
|
-
const { deployCli } = await Promise.resolve().then(() => require("./cli-
|
|
11389
|
+
const { deployCli } = await Promise.resolve().then(() => require("./cli-DJVL2sL9.cjs"));
|
|
11714
11390
|
const globalOptions = program.opts();
|
|
11715
11391
|
const code = await deployCli({
|
|
11716
11392
|
cwd: (0, node_path.resolve)(globalOptions.cwd ?? process.cwd()),
|
|
@@ -11727,8 +11403,8 @@ program.command("deploy").description("Deploy a stage through its target").optio
|
|
|
11727
11403
|
});
|
|
11728
11404
|
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) => {
|
|
11729
11405
|
try {
|
|
11730
|
-
const { rollbackStage } = await Promise.resolve().then(() => require("./rollback-
|
|
11731
|
-
const { terminalCredentials } = await Promise.resolve().then(() => require("./terminal-
|
|
11406
|
+
const { rollbackStage } = await Promise.resolve().then(() => require("./rollback-QGwomD64.cjs")).then((n) => n.rollback_exports);
|
|
11407
|
+
const { terminalCredentials } = await Promise.resolve().then(() => require("./terminal-BL5E0xbR.cjs"));
|
|
11732
11408
|
const globalOptions = program.opts();
|
|
11733
11409
|
await rollbackStage({
|
|
11734
11410
|
cwd: (0, node_path.resolve)(globalOptions.cwd ?? process.cwd()),
|
|
@@ -11763,7 +11439,7 @@ program.command("deploy:github").description("Let GitHub Actions deploy a stage:
|
|
|
11763
11439
|
try {
|
|
11764
11440
|
const globalOptions = program.opts();
|
|
11765
11441
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11766
|
-
const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-
|
|
11442
|
+
const { deployGithubCommand } = await Promise.resolve().then(() => require("./github-C6qF8kHg.cjs"));
|
|
11767
11443
|
await deployGithubCommand(options);
|
|
11768
11444
|
} catch (error) {
|
|
11769
11445
|
console.error(formatError(error));
|