@geekmidas/cli 10.0.0-alpha.72 → 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-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-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 +113 -468
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +107 -462
- 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-B-7LayMF.cjs → ready-BIuMw6wH.cjs} +9 -297
- package/dist/ready-BIuMw6wH.cjs.map +1 -0
- package/dist/{ready-ULc5BTOb.mjs → ready-C0U0NYfB.mjs} +6 -288
- 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-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.map +0 -1
- 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.mjs
CHANGED
|
@@ -2,21 +2,22 @@
|
|
|
2
2
|
import { n as __require, t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
3
3
|
import { r as DEFAULT_TIMEOUT_MS, t as CommandFailed } from "./run-BJLIerMM.mjs";
|
|
4
4
|
import { c as getDokployCredentials, f as removeDokployCredentials, i as LocalSandbox, l as getDokployRegistryId, m as storeHostingerToken, p as storeDokployCredentials, s as getCredentialsPath, u as getDokployToken } from "./credentials-pAtB70k3.mjs";
|
|
5
|
-
import { l as withOwningTsconfigJsx, r as discover, u as ConstructGenerator } from "./discover-
|
|
5
|
+
import { l as withOwningTsconfigJsx, r as discover, u as ConstructGenerator } from "./discover-BPelzeGW.mjs";
|
|
6
6
|
import { t as appKey } from "./derive-B4vDpzgP.mjs";
|
|
7
7
|
import { A as deployedProblems, D as InvalidStages, O as TEST_STAGE, c as getAppGkmConfig, j as stageProblems, n as allConstructGlobs, s as getAppBuildOrder } from "./workspace-C7NqCsQF.mjs";
|
|
8
8
|
import { ConfigNotFound, NotABackendApp, NotInAnApp, loadAppConfig, loadConfig, loadWorkspaceConfig, loadWorkspaceSettings, parseModuleConfig } from "./config.mjs";
|
|
9
|
-
import { At as findAvailablePort,
|
|
10
|
-
import { i as telemetryFor, n as
|
|
11
|
-
import { g as createStateStore, n as sniffAppEnvironment, o as DokployApi } from "./sniffer-
|
|
9
|
+
import { $ as constructGlobs, At as eventsBackendFor, Bt as findAvailablePort, Ft as fakeKey, G as keyFingerprint, H as workerUnits, Ht as loadEnvFiles, J as workerEntryDir, Jt as FileSecretsStore, K as WorkerGenerator, Kt as secretsStoreFor, Lt as primaryPortKey, Pt as describeServices, Q as backendsOf$1, R as parseDevServices, Rt as createCredentialsPreload, Ut as loadSecretsForApp, Vt as isPortAvailable, Wt as prepareEntryCredentials, X as CronGenerator, Y as QueueGenerator, Yt as getKeyPath, Z as FAKE_ENV, Zt as projectKey, cn as maskPassword, dn as withCustomSecret, dt as quoteIdentifier, en as deployIdentity, et as derivedContainers, it as forgetState, jt as providerOf, kt as cacheBackendFor, lt as postgresDatabaseNames, mt as pgClient, q as workerBundleName, rt as LOCAL_CA_PATH, tt as reconcileWorkspace, un as toEmbeddableSecrets, y as dockerCommand, zt as createEntryWrapper } from "./state-DtS2HEfi.mjs";
|
|
10
|
+
import { i as telemetryFor, n as runtimeFor, t as EndpointGenerator } from "./EndpointGenerator-DftalLYg.mjs";
|
|
11
|
+
import { g as createStateStore, n as sniffAppEnvironment, o as DokployApi } from "./sniffer-BFmdZpZ2.mjs";
|
|
12
12
|
import { generateOpenApi, openapiCommand, resolveOpenApiConfig } from "./openapi.mjs";
|
|
13
|
+
import { t as SubscriberGenerator } from "./SubscriberGenerator-DZk_pKDh.mjs";
|
|
13
14
|
import { a as describeHolder, i as assignAppPorts, o as holderOf, r as appTag, s as withAppPorts, t as APP_TAG_ENV } from "./appPorts-C9z9Pzn9.mjs";
|
|
14
|
-
import { a as writeTestHarness, c as
|
|
15
|
+
import { a as writeTestHarness, c as eventsBackendsIn, i as TEST_MANIFEST_ENV, n as TEST_READY_FILE, o as cacheBackendsIn, s as driversFor, t as TEST_READY_ENV } from "./ready-C0U0NYfB.mjs";
|
|
15
16
|
import { n as withCompute, r as withRoutes, t as manifestModule } from "./emit-C1e8qD08.mjs";
|
|
16
|
-
import { t as deploy$1 } from "./deploy-
|
|
17
|
-
import { a as stackDir, i as composeProject, o as dockerCompose, r as stackOverrideFile, t as composeTarget } from "./compose-
|
|
18
|
-
import { o as loadCredentialSchemas, t as CredentialsInvalid } from "./credentialSchemas-
|
|
19
|
-
import { t as LocalStateStore } from "./LocalStateStore-
|
|
17
|
+
import { t as deploy$1 } from "./deploy-nmov4j0B.mjs";
|
|
18
|
+
import { a as stackDir, i as composeProject, o as dockerCompose, r as stackOverrideFile, t as composeTarget } from "./compose-9II-0IsK.mjs";
|
|
19
|
+
import { o as loadCredentialSchemas, t as CredentialsInvalid } from "./credentialSchemas-BJqRJNK4.mjs";
|
|
20
|
+
import { t as LocalStateStore } from "./LocalStateStore-CNjgkRk4.mjs";
|
|
20
21
|
import { a as getExecCommand, c as validateProjectName, i as findWorkspaceRoot, n as detectPackageManager$1, o as getInstallCommand, r as findWorkspacePackages, s as getRunCommand, t as checkDirectoryExists } from "./utils-D_fxUqvU.mjs";
|
|
21
22
|
import { createRequire } from "node:module";
|
|
22
23
|
import { basename, dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -42,12 +43,10 @@ import { createServer as createServer$2 } from "http";
|
|
|
42
43
|
import { Http2ServerRequest } from "http2";
|
|
43
44
|
import { Readable as Readable$1 } from "stream";
|
|
44
45
|
import crypto from "crypto";
|
|
45
|
-
import { Cron } from "@geekmidas/constructs/crons";
|
|
46
46
|
import { Function } from "@geekmidas/constructs/functions";
|
|
47
|
-
import { Queue } from "@geekmidas/constructs/queue";
|
|
48
47
|
import { Topic } from "@geekmidas/constructs/topic";
|
|
49
48
|
//#region package.json
|
|
50
|
-
var version = "10.0.0-alpha.
|
|
49
|
+
var version = "10.0.0-alpha.73";
|
|
51
50
|
//#endregion
|
|
52
51
|
//#region src/prompt.ts
|
|
53
52
|
/**
|
|
@@ -130,7 +129,7 @@ const logger$8 = console;
|
|
|
130
129
|
* Validate Dokploy token by making a test API call
|
|
131
130
|
*/
|
|
132
131
|
async function validateDokployToken(endpoint, token) {
|
|
133
|
-
const { DokployApi } = await import("./sniffer-
|
|
132
|
+
const { DokployApi } = await import("./sniffer-BFmdZpZ2.mjs").then((n) => n.c);
|
|
134
133
|
return new DokployApi({
|
|
135
134
|
baseUrl: endpoint,
|
|
136
135
|
token
|
|
@@ -2036,9 +2035,9 @@ async function workspaceDevCommand(configured, options) {
|
|
|
2036
2035
|
for (const { id, port } of fakes) logger$5.log(`🎭 ${id} fake: http://localhost:${port}`);
|
|
2037
2036
|
logger$5.log(options.migrate || options.seed ? "🗄️ Migrating the databases" : "🗄️ Checking for pending migrations");
|
|
2038
2037
|
if (options.migrate || options.seed) {
|
|
2039
|
-
const { prepareDevDatabases } = await import("./migrate-
|
|
2038
|
+
const { prepareDevDatabases } = await import("./migrate-CFFC3esE.mjs");
|
|
2040
2039
|
await prepareDevDatabases(workspace, reconciled.env, { seed: !!options.seed });
|
|
2041
|
-
} else await import("./migrate-
|
|
2040
|
+
} else await import("./migrate-CFFC3esE.mjs").then(({ reportPendingMigrations }) => reportPendingMigrations(workspace, reconciled.env)).catch((error) => {
|
|
2042
2041
|
logger$5.log(`⚠️ Could not check for pending migrations: ${error instanceof Error ? error.message : String(error)}`);
|
|
2043
2042
|
});
|
|
2044
2043
|
const appUrls = {};
|
|
@@ -2597,244 +2596,6 @@ var DevServer = class {
|
|
|
2597
2596
|
}
|
|
2598
2597
|
};
|
|
2599
2598
|
//#endregion
|
|
2600
|
-
//#region src/generators/CronGenerator.ts
|
|
2601
|
-
var CronGenerator = class extends ConstructGenerator {
|
|
2602
|
-
async build(context, constructs, outputDir, options) {
|
|
2603
|
-
const target = options?.target ?? "aws";
|
|
2604
|
-
const logger = console;
|
|
2605
|
-
const cronInfos = [];
|
|
2606
|
-
if (target === "server") {
|
|
2607
|
-
await this.generateServerCronsFile(outputDir, constructs);
|
|
2608
|
-
logger.log(`Generated server crons file with ${constructs.length} crons`);
|
|
2609
|
-
return cronInfos;
|
|
2610
|
-
}
|
|
2611
|
-
if (constructs.length === 0) return cronInfos;
|
|
2612
|
-
const cronsDir = join(outputDir, "crons");
|
|
2613
|
-
await mkdir(cronsDir, { recursive: true });
|
|
2614
|
-
for (const { key, construct, path } of constructs) {
|
|
2615
|
-
const handlerFile = await this.generateCronHandler(cronsDir, path.relative, key, context, construct.owner);
|
|
2616
|
-
cronInfos.push({
|
|
2617
|
-
name: key,
|
|
2618
|
-
handler: relative(options?.root ?? process.cwd(), handlerFile).replace(/\.ts$/, ".handler"),
|
|
2619
|
-
schedule: construct.schedule || "rate(1 hour)",
|
|
2620
|
-
timeout: construct.timeout,
|
|
2621
|
-
memorySize: construct.memorySize,
|
|
2622
|
-
environment: await construct.getEnvironment({ markOptional: context.markOptional }),
|
|
2623
|
-
dependencies: construct.constructs
|
|
2624
|
-
});
|
|
2625
|
-
logger.log(`Generated cron handler: ${key}`);
|
|
2626
|
-
}
|
|
2627
|
-
return cronInfos;
|
|
2628
|
-
}
|
|
2629
|
-
isConstruct(value) {
|
|
2630
|
-
return Cron.isCron(value);
|
|
2631
|
-
}
|
|
2632
|
-
/**
|
|
2633
|
-
* The crons file a server entry imports.
|
|
2634
|
-
*
|
|
2635
|
-
* Shaped after `generateServerSubscribersFile`: one module, every cron, a
|
|
2636
|
-
* `setupCrons` the generated entry calls beside `setupSubscribers`.
|
|
2637
|
-
*
|
|
2638
|
-
* It picks its scheduler from what the process can reach. With a Postgres it
|
|
2639
|
-
* uses pg-boss, whose schedules live in the database — so a deployment
|
|
2640
|
-
* running four replicas fires each job once, which is the thing a timer in
|
|
2641
|
-
* every process gets wrong and does not report. With no database it falls
|
|
2642
|
-
* back to timers and says plainly that it is doing so.
|
|
2643
|
-
*/
|
|
2644
|
-
async generateServerCronsFile(outputDir, crons) {
|
|
2645
|
-
await mkdir(outputDir, { recursive: true });
|
|
2646
|
-
const cronsPath = join(outputDir, "crons.ts");
|
|
2647
|
-
if (crons.length === 0) {
|
|
2648
|
-
await writeFile(cronsPath, `/**
|
|
2649
|
-
* Generated cron setup — this app declares none.
|
|
2650
|
-
*/
|
|
2651
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2652
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2653
|
-
|
|
2654
|
-
export async function setupCrons(
|
|
2655
|
-
_envParser: EnvironmentParser<any>,
|
|
2656
|
-
_logger: Logger,
|
|
2657
|
-
): Promise<void> {}
|
|
2658
|
-
|
|
2659
|
-
export async function stopCrons(): Promise<void> {}
|
|
2660
|
-
`);
|
|
2661
|
-
return cronsPath;
|
|
2662
|
-
}
|
|
2663
|
-
const importsByFile = /* @__PURE__ */ new Map();
|
|
2664
|
-
for (const { path, key } of crons) {
|
|
2665
|
-
const importPath = relative(dirname(cronsPath), path.relative).replace(/\.ts$/, ".js");
|
|
2666
|
-
if (!importsByFile.has(importPath)) importsByFile.set(importPath, []);
|
|
2667
|
-
importsByFile.get(importPath)?.push(key);
|
|
2668
|
-
}
|
|
2669
|
-
const content = `/**
|
|
2670
|
-
* Generated cron setup.
|
|
2671
|
-
*
|
|
2672
|
-
* Schedules every cron this app declares, in the process that serves it.
|
|
2673
|
-
*
|
|
2674
|
-
* The schedule lives in Postgres, through pg-boss, in the database the worker
|
|
2675
|
-
* named with \`.database(db)\`. That is what makes running several replicas
|
|
2676
|
-
* safe: each job fires once, where a timer in every process fires it once per
|
|
2677
|
-
* replica and reports nothing.
|
|
2678
|
-
*
|
|
2679
|
-
* No connection string appears here. The construct that owns the database is
|
|
2680
|
-
* the only thing that knows its key, and it is resolved through service
|
|
2681
|
-
* discovery like any other dependency.
|
|
2682
|
-
*/
|
|
2683
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2684
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2685
|
-
import { runCron, scheduleInProcess, toCronExpression } from '@geekmidas/constructs/crons';
|
|
2686
|
-
import { ServiceDiscovery } from '@geekmidas/services';
|
|
2687
|
-
${Array.from(importsByFile.entries()).map(([importPath, exports]) => `import { ${exports.join(", ")} } from '${importPath}';`).join("\n")}
|
|
2688
|
-
|
|
2689
|
-
const crons = [
|
|
2690
|
-
${crons.map(({ key }) => ` { name: '${key}', cron: ${key} }`).join(",\n")}
|
|
2691
|
-
];
|
|
2692
|
-
|
|
2693
|
-
type Stoppable = { stop: () => Promise<void> | void };
|
|
2694
|
-
const running: Stoppable[] = [];
|
|
2695
|
-
|
|
2696
|
-
export async function setupCrons(
|
|
2697
|
-
envParser: EnvironmentParser<any>,
|
|
2698
|
-
logger: Logger,
|
|
2699
|
-
): Promise<void> {
|
|
2700
|
-
if (crons.length === 0) {
|
|
2701
|
-
return;
|
|
2702
|
-
}
|
|
2703
|
-
|
|
2704
|
-
const serviceDiscovery = ServiceDiscovery.getInstance(envParser);
|
|
2705
|
-
|
|
2706
|
-
// Resolved once per cron rather than per firing: registering services on
|
|
2707
|
-
// every tick would reconnect a database every minute.
|
|
2708
|
-
const prepared = [];
|
|
2709
|
-
for (const { name, cron } of crons) {
|
|
2710
|
-
try {
|
|
2711
|
-
const schedule = toCronExpression(cron.schedule);
|
|
2712
|
-
const services = cron.services.length > 0
|
|
2713
|
-
? await serviceDiscovery.register(cron.services)
|
|
2714
|
-
: {};
|
|
2715
|
-
|
|
2716
|
-
prepared.push({ name, cron, schedule, services });
|
|
2717
|
-
} catch (error) {
|
|
2718
|
-
// An unrepresentable schedule is a build-time mistake, and failing the
|
|
2719
|
-
// process for it would take the HTTP server down with it.
|
|
2720
|
-
logger.error({ err: error, cron: name }, 'Cron has no runnable schedule, skipping');
|
|
2721
|
-
}
|
|
2722
|
-
}
|
|
2723
|
-
|
|
2724
|
-
const run = async (entry: (typeof prepared)[number]) => {
|
|
2725
|
-
try {
|
|
2726
|
-
// The cron's own function, the way its Lambda would run it — services,
|
|
2727
|
-
// the worker's database as \`db\`, its events. It used to call a
|
|
2728
|
-
// \`handler\` a Cron does not have, so every firing logged a failure.
|
|
2729
|
-
await runCron(entry.cron, serviceDiscovery);
|
|
2730
|
-
} catch (error) {
|
|
2731
|
-
logger.error({ err: error, cron: entry.name }, 'Cron failed');
|
|
2732
|
-
}
|
|
2733
|
-
};
|
|
2734
|
-
|
|
2735
|
-
// The app's one pg-boss: the events broker's, as the broker's role, in the
|
|
2736
|
-
// broker's schema. A server fires its own crons, and a process scheduling in
|
|
2737
|
-
// memory fires each job once per replica — so the schedule lives in
|
|
2738
|
-
// Postgres. It used to be a second pg-boss on the worker's database, as the
|
|
2739
|
-
// runtime role, which can neither create a schema nor use the broker's.
|
|
2740
|
-
const { url, devPid } = envParser
|
|
2741
|
-
.create((get) => ({
|
|
2742
|
-
url: get('EVENT_PUBLISHER_CONNECTION_STRING').string().optional(),
|
|
2743
|
-
// Set by \`gkm dev\` on the server it starts, and by nothing deployed.
|
|
2744
|
-
devPid: get('GKM_DEV_PID').string().optional(),
|
|
2745
|
-
}))
|
|
2746
|
-
.parse();
|
|
2747
|
-
|
|
2748
|
-
if (!url?.startsWith('pgboss://')) {
|
|
2749
|
-
// \`gkm dev\` on a target whose crons are infrastructure once deployed —
|
|
2750
|
-
// EventBridge rules on AWS — has no broker to keep a schedule in. It is one
|
|
2751
|
-
// process, so a timer fires each job once, which is all pg-boss is for
|
|
2752
|
-
// here. Only there: a deployed server firing by timer fires once per
|
|
2753
|
-
// replica, so outside dev this stays the error below.
|
|
2754
|
-
if (devPid) {
|
|
2755
|
-
for (const entry of prepared) {
|
|
2756
|
-
running.push(scheduleInProcess(entry.schedule, () => run(entry)));
|
|
2757
|
-
logger.info({ cron: entry.name, schedule: entry.schedule }, 'Cron scheduled in this process');
|
|
2758
|
-
}
|
|
2759
|
-
return;
|
|
2760
|
-
}
|
|
2761
|
-
|
|
2762
|
-
logger.error(
|
|
2763
|
-
{ crons: prepared.map(({ name }) => name) },
|
|
2764
|
-
'These crons have nowhere to keep their schedule. On a server they are ' +
|
|
2765
|
-
'scheduled through the pg-boss events broker ' +
|
|
2766
|
-
'(EVENT_PUBLISHER_CONNECTION_STRING), and ' +
|
|
2767
|
-
(url ? 'the broker configured is not pg-boss.' : 'none is configured.'),
|
|
2768
|
-
);
|
|
2769
|
-
return;
|
|
2770
|
-
}
|
|
2771
|
-
|
|
2772
|
-
// Through the registered pg-boss driver, which the entry registers for a
|
|
2773
|
-
// server whose broker is pg-boss. Naming \`@geekmidas/events/pgboss\` here
|
|
2774
|
-
// made every bundle with a cron resolve pg-boss, whatever its broker.
|
|
2775
|
-
const { EventConnectionFactory } = await import('@geekmidas/events');
|
|
2776
|
-
const connection = (await EventConnectionFactory.fromConnectionString(
|
|
2777
|
-
url,
|
|
2778
|
-
)) as import('@geekmidas/events').EventConnection & { instance?: any };
|
|
2779
|
-
const boss = connection.instance!;
|
|
2780
|
-
|
|
2781
|
-
// What this app declares now. Anything else under the prefix belonged to a
|
|
2782
|
-
// cron since renamed or deleted, and would keep firing at a handler that has
|
|
2783
|
-
// gone.
|
|
2784
|
-
//
|
|
2785
|
-
// The prefix is \`cron.\` rather than \`cron:\`: pg-boss accepts
|
|
2786
|
-
// alphanumerics, underscores, hyphens, periods and slashes in a queue name,
|
|
2787
|
-
// and rejects a colon outright.
|
|
2788
|
-
const declared = new Set(prepared.map(({ name }) => \`cron.\${name}\`));
|
|
2789
|
-
for (const existing of await boss.getSchedules()) {
|
|
2790
|
-
if (existing.name.startsWith('cron.') && !declared.has(existing.name)) {
|
|
2791
|
-
await boss.unschedule(existing.name);
|
|
2792
|
-
logger.info({ cron: existing.name }, 'Removed a schedule nothing declares');
|
|
2793
|
-
}
|
|
2794
|
-
}
|
|
2795
|
-
|
|
2796
|
-
for (const entry of prepared) {
|
|
2797
|
-
const queue = \`cron.\${entry.name}\`;
|
|
2798
|
-
await boss.createQueue(queue);
|
|
2799
|
-
// UTC, so this agrees with the schedule a deploy target would have made.
|
|
2800
|
-
await boss.schedule(queue, entry.schedule, undefined, { tz: 'UTC' });
|
|
2801
|
-
await boss.work(queue, () => run(entry));
|
|
2802
|
-
|
|
2803
|
-
logger.info({ cron: entry.name, schedule: entry.schedule }, 'Cron scheduled');
|
|
2804
|
-
}
|
|
2805
|
-
|
|
2806
|
-
running.push({ stop: () => connection.close() });
|
|
2807
|
-
logger.info({ count: prepared.length }, 'Crons scheduled');
|
|
2808
|
-
}
|
|
2809
|
-
|
|
2810
|
-
export async function stopCrons(): Promise<void> {
|
|
2811
|
-
await Promise.all(running.map((r) => r.stop()));
|
|
2812
|
-
running.length = 0;
|
|
2813
|
-
}
|
|
2814
|
-
`;
|
|
2815
|
-
await writeFile(cronsPath, content);
|
|
2816
|
-
return cronsPath;
|
|
2817
|
-
}
|
|
2818
|
-
async generateCronHandler(outputDir, sourceFile, exportName, context, owner) {
|
|
2819
|
-
const handlerFileName = `${exportName}.ts`;
|
|
2820
|
-
const handlerPath = join(outputDir, handlerFileName);
|
|
2821
|
-
const importPath = relative(dirname(handlerPath), sourceFile).replace(/\.ts$/, ".js");
|
|
2822
|
-
const runtime = runtimeFor(context, dirname(handlerPath), owner);
|
|
2823
|
-
const content = `import { AWSScheduledFunction } from '@geekmidas/constructs/aws';
|
|
2824
|
-
import { ${exportName} } from '${importPath}';
|
|
2825
|
-
${runtime.imports}
|
|
2826
|
-
${context.storageDrivers?.imports ?? ""}
|
|
2827
|
-
${runtime.bindings}
|
|
2828
|
-
${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
|
|
2829
|
-
const adapter = new AWSScheduledFunction(envParser, ${exportName});
|
|
2830
|
-
|
|
2831
|
-
export const handler = adapter.handler;
|
|
2832
|
-
`;
|
|
2833
|
-
await writeFile(handlerPath, content);
|
|
2834
|
-
return handlerPath;
|
|
2835
|
-
}
|
|
2836
|
-
};
|
|
2837
|
-
//#endregion
|
|
2838
2599
|
//#region src/generators/FunctionGenerator.ts
|
|
2839
2600
|
var FunctionGenerator = class extends ConstructGenerator {
|
|
2840
2601
|
isConstruct(value) {
|
|
@@ -2881,178 +2642,6 @@ export const handler = adapter.handler;
|
|
|
2881
2642
|
}
|
|
2882
2643
|
};
|
|
2883
2644
|
//#endregion
|
|
2884
|
-
//#region src/generators/QueueGenerator.ts
|
|
2885
|
-
/**
|
|
2886
|
-
* Generates the runtime for queue consumers (`worker.queue(…)`).
|
|
2887
|
-
*
|
|
2888
|
-
* - **server** (`gkm dev`): a single `queues.ts` exposing `setupQueues()` that
|
|
2889
|
-
* polls each queue in-process, alongside the Hono server, through the queue's
|
|
2890
|
-
* own connection string — pg-boss by default, SQS on the AWS emulator.
|
|
2891
|
-
* - **aws-lambda**: one handler file per queue wrapping `AWSLambdaQueue`, backed
|
|
2892
|
-
* by an SQS event-source mapping.
|
|
2893
|
-
*/
|
|
2894
|
-
var QueueGenerator = class extends ConstructGenerator {
|
|
2895
|
-
isConstruct(value) {
|
|
2896
|
-
return Queue.isQueue(value);
|
|
2897
|
-
}
|
|
2898
|
-
async build(context, constructs, outputDir, options) {
|
|
2899
|
-
const target = options?.target ?? "aws";
|
|
2900
|
-
const logger = console;
|
|
2901
|
-
const queueInfos = [];
|
|
2902
|
-
if (target === "server") {
|
|
2903
|
-
await this.generateServerQueuesFile(outputDir, constructs);
|
|
2904
|
-
logger.log(`Generated server queues file with ${constructs.length} queues (polling mode)`);
|
|
2905
|
-
return queueInfos;
|
|
2906
|
-
}
|
|
2907
|
-
if (constructs.length === 0) return queueInfos;
|
|
2908
|
-
const queuesDir = join(outputDir, "queues");
|
|
2909
|
-
await mkdir(queuesDir, { recursive: true });
|
|
2910
|
-
for (const { key, construct, path } of constructs) {
|
|
2911
|
-
const handlerFile = await this.generateQueueHandler(queuesDir, path.relative, key, context, construct.owner);
|
|
2912
|
-
queueInfos.push({
|
|
2913
|
-
name: construct.name,
|
|
2914
|
-
handler: relative(options?.root ?? process.cwd(), handlerFile).replace(/\.ts$/, ".handler"),
|
|
2915
|
-
batchSize: construct.batchSize,
|
|
2916
|
-
fifo: construct.fifo,
|
|
2917
|
-
timeout: construct.timeout,
|
|
2918
|
-
environment: await construct.getEnvironment({ markOptional: context.markOptional }),
|
|
2919
|
-
dependencies: construct.constructs
|
|
2920
|
-
});
|
|
2921
|
-
logger.log(`Generated queue handler: ${key}`);
|
|
2922
|
-
}
|
|
2923
|
-
return queueInfos;
|
|
2924
|
-
}
|
|
2925
|
-
async generateQueueHandler(outputDir, sourceFile, exportName, context, owner) {
|
|
2926
|
-
const handlerPath = join(outputDir, `${exportName}.ts`);
|
|
2927
|
-
const importPath = relative(dirname(handlerPath), sourceFile).replace(/\.ts$/, ".js");
|
|
2928
|
-
const runtime = runtimeFor(context, dirname(handlerPath), owner);
|
|
2929
|
-
const content = `import { AWSLambdaQueue } from '@geekmidas/constructs/aws';
|
|
2930
|
-
import { ${exportName} } from '${importPath}';
|
|
2931
|
-
${runtime.imports}
|
|
2932
|
-
${context.storageDrivers?.imports ?? ""}
|
|
2933
|
-
${runtime.bindings}
|
|
2934
|
-
${context.storageDrivers?.setup ? `\n// The handler registers the drivers its target needs.\n${context.storageDrivers.setup}\n` : ""}
|
|
2935
|
-
const adapter = new AWSLambdaQueue(envParser, ${exportName});
|
|
2936
|
-
|
|
2937
|
-
export const handler = adapter.handler;
|
|
2938
|
-
`;
|
|
2939
|
-
await writeFile(handlerPath, content);
|
|
2940
|
-
return handlerPath;
|
|
2941
|
-
}
|
|
2942
|
-
async generateServerQueuesFile(outputDir, queues) {
|
|
2943
|
-
await mkdir(outputDir, { recursive: true });
|
|
2944
|
-
const queuesPath = join(outputDir, "queues.ts");
|
|
2945
|
-
if (queues.length === 0) {
|
|
2946
|
-
await writeFile(queuesPath, `/**
|
|
2947
|
-
* Generated queues setup — this app declares none.
|
|
2948
|
-
*/
|
|
2949
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2950
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2951
|
-
|
|
2952
|
-
export async function setupQueues(
|
|
2953
|
-
_envParser: EnvironmentParser<any>,
|
|
2954
|
-
_logger: Logger,
|
|
2955
|
-
): Promise<void> {}
|
|
2956
|
-
`);
|
|
2957
|
-
return queuesPath;
|
|
2958
|
-
}
|
|
2959
|
-
const importsByFile = /* @__PURE__ */ new Map();
|
|
2960
|
-
for (const { path, key } of queues) {
|
|
2961
|
-
const importPath = relative(dirname(queuesPath), path.relative).replace(/\.ts$/, ".js");
|
|
2962
|
-
if (!importsByFile.has(importPath)) importsByFile.set(importPath, []);
|
|
2963
|
-
importsByFile.get(importPath)?.push(key);
|
|
2964
|
-
}
|
|
2965
|
-
const content = `/**
|
|
2966
|
-
* Generated queue consumers setup.
|
|
2967
|
-
*
|
|
2968
|
-
* Each queue's one consumer polls its own queue, through the queue's own
|
|
2969
|
-
* connection string — the one its producers publish on. SQS cannot push, so
|
|
2970
|
-
* this is a poller on every transport: pg-boss locally by default, the SQS
|
|
2971
|
-
* queue on the AWS emulator.
|
|
2972
|
-
*
|
|
2973
|
-
* Deployed on Lambda, a queue's consumer is an SQS event source instead.
|
|
2974
|
-
*/
|
|
2975
|
-
import type { EnvironmentParser } from '@geekmidas/envkit';
|
|
2976
|
-
import type { Logger } from '@geekmidas/logger';
|
|
2977
|
-
import { EventConnectionFactory, Subscriber } from '@geekmidas/events';
|
|
2978
|
-
import type { EventConnection } from '@geekmidas/events';
|
|
2979
|
-
import { ServiceDiscovery } from '@geekmidas/services';
|
|
2980
|
-
${Array.from(importsByFile.entries()).map(([importPath, exports]) => `import { ${exports.join(", ")} } from '${importPath}';`).join("\n")}
|
|
2981
|
-
|
|
2982
|
-
const queues = [
|
|
2983
|
-
${queues.map(({ key, construct }) => ` { queue: ${key}, connectionKey: '${provideKey(construct.id, "publisherConnectionString")}' },`).join("\n")}
|
|
2984
|
-
];
|
|
2985
|
-
|
|
2986
|
-
export async function setupQueues(
|
|
2987
|
-
envParser: EnvironmentParser<any>,
|
|
2988
|
-
logger: Logger,
|
|
2989
|
-
): Promise<void> {
|
|
2990
|
-
const serviceDiscovery = ServiceDiscovery.getInstance(envParser);
|
|
2991
|
-
const connections = new Map<string, EventConnection>();
|
|
2992
|
-
|
|
2993
|
-
for (const { queue, connectionKey } of queues) {
|
|
2994
|
-
const connectionString = process.env[connectionKey];
|
|
2995
|
-
if (!connectionString) {
|
|
2996
|
-
logger.error({ queue: queue.name, connectionKey }, 'No connection string for this queue');
|
|
2997
|
-
continue;
|
|
2998
|
-
}
|
|
2999
|
-
|
|
3000
|
-
try {
|
|
3001
|
-
let connection = connections.get(connectionString);
|
|
3002
|
-
if (!connection) {
|
|
3003
|
-
connection = await EventConnectionFactory.fromConnectionString(connectionString);
|
|
3004
|
-
connections.set(connectionString, connection);
|
|
3005
|
-
}
|
|
3006
|
-
const eventSubscriber = await Subscriber.fromConnection(connection);
|
|
3007
|
-
const services = queue.services.length > 0
|
|
3008
|
-
? await serviceDiscovery.register(queue.services)
|
|
3009
|
-
: {};
|
|
3010
|
-
// The queue's database — the worker's, or its own — handed over as \`db\`.
|
|
3011
|
-
const db = queue.databaseService
|
|
3012
|
-
? (await serviceDiscovery.register([queue.databaseService]))[
|
|
3013
|
-
queue.databaseService.serviceName
|
|
3014
|
-
]
|
|
3015
|
-
: undefined;
|
|
3016
|
-
|
|
3017
|
-
// A queue's messages carry one type — its own name.
|
|
3018
|
-
await eventSubscriber.subscribe([queue.name], async (message) => {
|
|
3019
|
-
try {
|
|
3020
|
-
const validation = await queue.messageSchema['~standard'].validate(message.payload);
|
|
3021
|
-
if (validation.issues) {
|
|
3022
|
-
logger.error({ issues: validation.issues, queue: queue.name }, 'Queue message failed validation');
|
|
3023
|
-
return;
|
|
3024
|
-
}
|
|
3025
|
-
|
|
3026
|
-
await queue.handler({
|
|
3027
|
-
messages: [validation.value],
|
|
3028
|
-
services: services,
|
|
3029
|
-
logger: queue.logger,
|
|
3030
|
-
db,
|
|
3031
|
-
} as any);
|
|
3032
|
-
} catch (error) {
|
|
3033
|
-
logger.error({ err: error, queue: queue.name }, 'Failed to process queue message');
|
|
3034
|
-
// Rethrown so the transport keeps the message for a retry.
|
|
3035
|
-
throw error;
|
|
3036
|
-
}
|
|
3037
|
-
});
|
|
3038
|
-
logger.info({ queue: queue.name }, 'Queue consumer started polling');
|
|
3039
|
-
} catch (error) {
|
|
3040
|
-
logger.error({ err: error, queue: queue.name }, 'Failed to set up queue consumer');
|
|
3041
|
-
}
|
|
3042
|
-
}
|
|
3043
|
-
|
|
3044
|
-
const shutdown = () => {
|
|
3045
|
-
for (const connection of connections.values()) void connection.close();
|
|
3046
|
-
};
|
|
3047
|
-
process.once('SIGTERM', shutdown);
|
|
3048
|
-
process.once('SIGINT', shutdown);
|
|
3049
|
-
}
|
|
3050
|
-
`;
|
|
3051
|
-
await writeFile(queuesPath, content);
|
|
3052
|
-
return queuesPath;
|
|
3053
|
-
}
|
|
3054
|
-
};
|
|
3055
|
-
//#endregion
|
|
3056
2645
|
//#region src/generators/TopicGenerator.ts
|
|
3057
2646
|
/**
|
|
3058
2647
|
* Discovers topics (`new Topic(…)`) into `manifest.topics`. A topic is a
|
|
@@ -3384,7 +2973,8 @@ async function buildOneApp(input) {
|
|
|
3384
2973
|
markOptional: options.markOptional ?? false,
|
|
3385
2974
|
skipBundle: options.skipBundle ?? false,
|
|
3386
2975
|
stage: options.stage,
|
|
3387
|
-
workspaceName: workspace.name
|
|
2976
|
+
workspaceName: workspace.name,
|
|
2977
|
+
workspace
|
|
3388
2978
|
});
|
|
3389
2979
|
}
|
|
3390
2980
|
/**
|
|
@@ -3426,11 +3016,13 @@ async function buildApp(input) {
|
|
|
3426
3016
|
const { config, workspaceRoot, appRoot, target, enableOpenApi, cacheBackend, eventsBackend, production, telescope, databaseApi, hooks, bustCache = false } = input;
|
|
3427
3017
|
const constructGlobs = config.constructs;
|
|
3428
3018
|
const constructSources = {};
|
|
3019
|
+
const background = {};
|
|
3429
3020
|
const declared = constructGlobs ? await discover({
|
|
3430
3021
|
patterns: constructGlobs,
|
|
3431
3022
|
cwd: appRoot,
|
|
3432
3023
|
bustCache,
|
|
3433
|
-
sources: constructSources
|
|
3024
|
+
sources: constructSources,
|
|
3025
|
+
background
|
|
3434
3026
|
}) : {};
|
|
3435
3027
|
const selfServing = selfServingSurface({
|
|
3436
3028
|
declared,
|
|
@@ -3444,7 +3036,7 @@ async function buildApp(input) {
|
|
|
3444
3036
|
if (production?.bundle && !input.skipBundle) {
|
|
3445
3037
|
const outputDir = join(appRoot, ".gkm", "server");
|
|
3446
3038
|
const entryPoint = await writeSurfaceServer(outputDir, production);
|
|
3447
|
-
const { bundleServer } = await import("./bundler-
|
|
3039
|
+
const { bundleServer } = await import("./bundler-C2LZoLdP.mjs");
|
|
3448
3040
|
await bundleServer({
|
|
3449
3041
|
entryPoint,
|
|
3450
3042
|
outputDir: join(outputDir, "dist"),
|
|
@@ -3525,6 +3117,19 @@ async function buildApp(input) {
|
|
|
3525
3117
|
if (left.length > 0) logger$4.log(`Serving ${derived.surface.id} only: leaving out ${left.join(", ")} — they run in a Worker's image`);
|
|
3526
3118
|
}
|
|
3527
3119
|
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);
|
|
3120
|
+
if (target === "server" && production?.enabled && input.workspace) {
|
|
3121
|
+
const appName = Object.entries(input.workspace.apps).find(([, app]) => resolve(input.workspace.root, app.path) === resolve(appRoot))?.[0];
|
|
3122
|
+
await buildWorkers({
|
|
3123
|
+
context: buildContext,
|
|
3124
|
+
workers: workerUnits(input.workspace, declared, background).filter((unit) => unit.app === appName),
|
|
3125
|
+
serverDir: join(appRoot, ".gkm", "server"),
|
|
3126
|
+
crons: allCrons,
|
|
3127
|
+
queues: allQueues,
|
|
3128
|
+
subscribers: allSubscribers,
|
|
3129
|
+
bundle: Boolean(production.bundle && !input.skipBundle),
|
|
3130
|
+
...input.stage ? { stage: input.stage } : {}
|
|
3131
|
+
});
|
|
3132
|
+
}
|
|
3528
3133
|
await generateOpenApi(allEndpoints.map(({ construct }) => construct), {
|
|
3529
3134
|
openapi: config.openapi,
|
|
3530
3135
|
root: workspaceRoot
|
|
@@ -3534,6 +3139,46 @@ async function buildApp(input) {
|
|
|
3534
3139
|
...buildContext.databaseApi ? { databaseApi: buildContext.databaseApi.path } : {}
|
|
3535
3140
|
};
|
|
3536
3141
|
}
|
|
3142
|
+
/**
|
|
3143
|
+
* Write each worker's entry — and, for an image, bundle it — from the
|
|
3144
|
+
* runnables built from that worker, and nothing built from another.
|
|
3145
|
+
*/
|
|
3146
|
+
async function buildWorkers(input) {
|
|
3147
|
+
const generator = new WorkerGenerator();
|
|
3148
|
+
for (const worker of input.workers) {
|
|
3149
|
+
const owned = (list) => list.filter(({ construct }) => construct.owner === worker.id);
|
|
3150
|
+
const crons = owned(input.crons);
|
|
3151
|
+
const queues = owned(input.queues);
|
|
3152
|
+
const subscribers = owned(input.subscribers);
|
|
3153
|
+
const entryPoint = await generator.build({
|
|
3154
|
+
context: input.context,
|
|
3155
|
+
workerId: worker.id,
|
|
3156
|
+
outputDir: workerEntryDir(input.serverDir, worker.id),
|
|
3157
|
+
crons,
|
|
3158
|
+
queues,
|
|
3159
|
+
subscribers
|
|
3160
|
+
});
|
|
3161
|
+
logger$4.log(`Generated worker ${worker.id}: ${crons.length} crons, ${queues.length} queues, ${subscribers.length} subscribers`);
|
|
3162
|
+
if (!input.bundle) continue;
|
|
3163
|
+
const { bundleServer } = await import("./bundler-C2LZoLdP.mjs");
|
|
3164
|
+
const outfile = workerBundleName(worker.id);
|
|
3165
|
+
await bundleServer({
|
|
3166
|
+
entryPoint,
|
|
3167
|
+
outputDir: join(input.serverDir, "dist"),
|
|
3168
|
+
outfile,
|
|
3169
|
+
minify: input.context.production?.minify ?? false,
|
|
3170
|
+
sourcemap: false,
|
|
3171
|
+
external: input.context.production?.external ?? [],
|
|
3172
|
+
...input.stage ? { stage: input.stage } : {},
|
|
3173
|
+
constructs: [
|
|
3174
|
+
...crons,
|
|
3175
|
+
...queues,
|
|
3176
|
+
...subscribers
|
|
3177
|
+
].map((c) => c.construct)
|
|
3178
|
+
});
|
|
3179
|
+
logger$4.log(`✅ Bundle complete: .gkm/server/dist/${outfile}`);
|
|
3180
|
+
}
|
|
3181
|
+
}
|
|
3537
3182
|
async function buildForTarget(target, context, appRoot, workspaceRoot, endpointGenerator, functionGenerator, cronGenerator, subscriberGenerator, queueGenerator, topicGenerator, endpoints, functions, crons, subscribers, queues, topics, enableOpenApi, skipBundle, stage) {
|
|
3538
3183
|
const outputDir = join(appRoot, ".gkm", target);
|
|
3539
3184
|
await Promise.all([...SUPERSEDED_OUTPUT.map((dir) => join(appRoot, ".gkm", dir)), ...appRoot === workspaceRoot ? [] : [join(appRoot, ".gkm", "manifest")]].map((dir) => rm(dir, {
|
|
@@ -3585,7 +3230,7 @@ async function buildForTarget(target, context, appRoot, workspaceRoot, endpointG
|
|
|
3585
3230
|
let masterKey;
|
|
3586
3231
|
if (context.production?.bundle && !skipBundle) {
|
|
3587
3232
|
logger$4.log(`\n📦 Bundling production server...`);
|
|
3588
|
-
const { bundleServer } = await import("./bundler-
|
|
3233
|
+
const { bundleServer } = await import("./bundler-C2LZoLdP.mjs");
|
|
3589
3234
|
const allConstructs = [
|
|
3590
3235
|
...endpoints.map((e) => e.construct),
|
|
3591
3236
|
...functions.map((f) => f.construct),
|
|
@@ -5284,25 +4929,25 @@ function loadPackageJson() {
|
|
|
5284
4929
|
* Run: pnpm --filter @geekmidas/cli sync-versions
|
|
5285
4930
|
*/
|
|
5286
4931
|
const GEEKMIDAS_VERSIONS = {
|
|
5287
|
-
"@geekmidas/audit": "~10.0.0-alpha.
|
|
5288
|
-
"@geekmidas/auth": "~10.0.0-alpha.
|
|
5289
|
-
"@geekmidas/cache": "~10.0.0-alpha.
|
|
5290
|
-
"@geekmidas/client": "~10.0.0-alpha.
|
|
5291
|
-
"@geekmidas/cloud": "~10.0.0-alpha.
|
|
5292
|
-
"@geekmidas/constructs": "~10.0.0-alpha.
|
|
5293
|
-
"@geekmidas/db": "~10.0.0-alpha.
|
|
5294
|
-
"@geekmidas/emailkit": "~10.0.0-alpha.
|
|
5295
|
-
"@geekmidas/envkit": "~10.0.0-alpha.
|
|
5296
|
-
"@geekmidas/errors": "~10.0.0-alpha.
|
|
5297
|
-
"@geekmidas/events": "~10.0.0-alpha.
|
|
5298
|
-
"@geekmidas/logger": "~10.0.0-alpha.
|
|
5299
|
-
"@geekmidas/manifest": "~10.0.0-alpha.
|
|
5300
|
-
"@geekmidas/rate-limit": "~10.0.0-alpha.
|
|
5301
|
-
"@geekmidas/schema": "~10.0.0-alpha.
|
|
5302
|
-
"@geekmidas/services": "~10.0.0-alpha.
|
|
5303
|
-
"@geekmidas/storage": "~10.0.0-alpha.
|
|
5304
|
-
"@geekmidas/telescope": "~10.0.0-alpha.
|
|
5305
|
-
"@geekmidas/testkit": "~10.0.0-alpha.
|
|
4932
|
+
"@geekmidas/audit": "~10.0.0-alpha.73",
|
|
4933
|
+
"@geekmidas/auth": "~10.0.0-alpha.73",
|
|
4934
|
+
"@geekmidas/cache": "~10.0.0-alpha.73",
|
|
4935
|
+
"@geekmidas/client": "~10.0.0-alpha.73",
|
|
4936
|
+
"@geekmidas/cloud": "~10.0.0-alpha.73",
|
|
4937
|
+
"@geekmidas/constructs": "~10.0.0-alpha.73",
|
|
4938
|
+
"@geekmidas/db": "~10.0.0-alpha.73",
|
|
4939
|
+
"@geekmidas/emailkit": "~10.0.0-alpha.73",
|
|
4940
|
+
"@geekmidas/envkit": "~10.0.0-alpha.73",
|
|
4941
|
+
"@geekmidas/errors": "~10.0.0-alpha.73",
|
|
4942
|
+
"@geekmidas/events": "~10.0.0-alpha.73",
|
|
4943
|
+
"@geekmidas/logger": "~10.0.0-alpha.73",
|
|
4944
|
+
"@geekmidas/manifest": "~10.0.0-alpha.73",
|
|
4945
|
+
"@geekmidas/rate-limit": "~10.0.0-alpha.73",
|
|
4946
|
+
"@geekmidas/schema": "~10.0.0-alpha.73",
|
|
4947
|
+
"@geekmidas/services": "~10.0.0-alpha.73",
|
|
4948
|
+
"@geekmidas/storage": "~10.0.0-alpha.73",
|
|
4949
|
+
"@geekmidas/telescope": "~10.0.0-alpha.73",
|
|
4950
|
+
"@geekmidas/testkit": "~10.0.0-alpha.73",
|
|
5306
4951
|
"@geekmidas/cli": `~${loadPackageJson().version}`
|
|
5307
4952
|
};
|
|
5308
4953
|
//#endregion
|
|
@@ -11093,8 +10738,8 @@ function testDatabases(reconciled) {
|
|
|
11093
10738
|
* starts without the reference data the app needs.
|
|
11094
10739
|
*/
|
|
11095
10740
|
async function migrateTestStage(workspace, env) {
|
|
11096
|
-
const { migrateAndSeed } = await import("./migrate-
|
|
11097
|
-
const { discover } = await import("./discover-
|
|
10741
|
+
const { migrateAndSeed } = await import("./migrate-CFFC3esE.mjs");
|
|
10742
|
+
const { discover } = await import("./discover-BPelzeGW.mjs").then((n) => n.i);
|
|
11098
10743
|
const sources = {};
|
|
11099
10744
|
const manifest = await discover({
|
|
11100
10745
|
patterns: constructGlobs(workspace),
|
|
@@ -11524,7 +11169,7 @@ program.command("migrate").description("Apply each database construct's migratio
|
|
|
11524
11169
|
try {
|
|
11525
11170
|
const globalOptions = program.opts();
|
|
11526
11171
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11527
|
-
const { migrateCommand } = await import("./migrate-
|
|
11172
|
+
const { migrateCommand } = await import("./migrate-CFFC3esE.mjs");
|
|
11528
11173
|
await migrateCommand({
|
|
11529
11174
|
...options,
|
|
11530
11175
|
...construct ? { construct } : {}
|
|
@@ -11538,7 +11183,7 @@ program.command("seed").description("Migrate, then run each database construct's
|
|
|
11538
11183
|
try {
|
|
11539
11184
|
const globalOptions = program.opts();
|
|
11540
11185
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11541
|
-
const { seedCommand } = await import("./migrate-
|
|
11186
|
+
const { seedCommand } = await import("./migrate-CFFC3esE.mjs");
|
|
11542
11187
|
await seedCommand({
|
|
11543
11188
|
...options,
|
|
11544
11189
|
...construct ? { construct } : {}
|
|
@@ -11552,7 +11197,7 @@ program.command("migration").description("Write a construct's next migration: an
|
|
|
11552
11197
|
try {
|
|
11553
11198
|
const globalOptions = program.opts();
|
|
11554
11199
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11555
|
-
const { migrationCommand } = await import("./migrate-
|
|
11200
|
+
const { migrationCommand } = await import("./migrate-CFFC3esE.mjs");
|
|
11556
11201
|
await migrationCommand({
|
|
11557
11202
|
construct,
|
|
11558
11203
|
...name ? { name } : {}
|
|
@@ -11646,7 +11291,7 @@ program.command("secrets:add").description("Build the keys a stage must be given
|
|
|
11646
11291
|
try {
|
|
11647
11292
|
const globalOptions = program.opts();
|
|
11648
11293
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11649
|
-
const { secretsAddCommand } = await import("./add-
|
|
11294
|
+
const { secretsAddCommand } = await import("./add-BiPlBUq3.mjs");
|
|
11650
11295
|
await secretsAddCommand(options);
|
|
11651
11296
|
} catch (error) {
|
|
11652
11297
|
console.error(formatError(error));
|
|
@@ -11657,7 +11302,7 @@ program.command("encryption:rotate").description("Add a new current key to an En
|
|
|
11657
11302
|
try {
|
|
11658
11303
|
const globalOptions = program.opts();
|
|
11659
11304
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11660
|
-
const { encryptionRotateCommand } = await import("./encryption-
|
|
11305
|
+
const { encryptionRotateCommand } = await import("./encryption-CmfPICSN.mjs");
|
|
11661
11306
|
await encryptionRotateCommand(construct, options);
|
|
11662
11307
|
} catch (error) {
|
|
11663
11308
|
console.error(formatError(error));
|
|
@@ -11668,7 +11313,7 @@ program.command("encryption:retire").description("Remove an old key from an Encr
|
|
|
11668
11313
|
try {
|
|
11669
11314
|
const globalOptions = program.opts();
|
|
11670
11315
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11671
|
-
const { encryptionRetireCommand } = await import("./encryption-
|
|
11316
|
+
const { encryptionRetireCommand } = await import("./encryption-CmfPICSN.mjs");
|
|
11672
11317
|
await encryptionRetireCommand(construct, key, options);
|
|
11673
11318
|
} catch (error) {
|
|
11674
11319
|
console.error(formatError(error));
|
|
@@ -11711,7 +11356,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
11711
11356
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11712
11357
|
const { loadWorkspaceConfig } = await import("./config.mjs");
|
|
11713
11358
|
const { reconcileMissingSecrets } = await import("./reconcile--I7V4Klj.mjs");
|
|
11714
|
-
const { secretsStoreFor } = await import("./state-
|
|
11359
|
+
const { secretsStoreFor } = await import("./state-DtS2HEfi.mjs").then((n) => n.qt);
|
|
11715
11360
|
const { workspace } = await loadWorkspaceConfig();
|
|
11716
11361
|
const stage = options.stage ?? workspace.stages.local;
|
|
11717
11362
|
const store = await secretsStoreFor(workspace, stage);
|
|
@@ -11720,7 +11365,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
11720
11365
|
console.error(`No secrets found for stage "${stage}". Run "gkm secrets:init --stage ${stage}" first.`);
|
|
11721
11366
|
process.exit(1);
|
|
11722
11367
|
}
|
|
11723
|
-
const { derivedContainers } = await import("./state-
|
|
11368
|
+
const { derivedContainers } = await import("./state-DtS2HEfi.mjs").then((n) => n.nt);
|
|
11724
11369
|
const result = reconcileMissingSecrets(secrets, workspace, await derivedContainers(workspace, stage));
|
|
11725
11370
|
if (!result) {
|
|
11726
11371
|
console.log(`\n✓ Secrets for stage "${stage}" are up-to-date`);
|
|
@@ -11735,7 +11380,7 @@ program.command("secrets:reconcile").description("Backfill missing custom secret
|
|
|
11735
11380
|
}
|
|
11736
11381
|
});
|
|
11737
11382
|
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) => {
|
|
11738
|
-
const { deployCli } = await import("./cli-
|
|
11383
|
+
const { deployCli } = await import("./cli-BfdfyTF6.mjs");
|
|
11739
11384
|
const globalOptions = program.opts();
|
|
11740
11385
|
const code = await deployCli({
|
|
11741
11386
|
cwd: resolve(globalOptions.cwd ?? process.cwd()),
|
|
@@ -11752,8 +11397,8 @@ program.command("deploy").description("Deploy a stage through its target").optio
|
|
|
11752
11397
|
});
|
|
11753
11398
|
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) => {
|
|
11754
11399
|
try {
|
|
11755
|
-
const { rollbackStage } = await import("./rollback-
|
|
11756
|
-
const { terminalCredentials } = await import("./terminal-
|
|
11400
|
+
const { rollbackStage } = await import("./rollback-C-V-Rf4a.mjs").then((n) => n.a);
|
|
11401
|
+
const { terminalCredentials } = await import("./terminal-BdvrmkaC.mjs");
|
|
11757
11402
|
const globalOptions = program.opts();
|
|
11758
11403
|
await rollbackStage({
|
|
11759
11404
|
cwd: resolve(globalOptions.cwd ?? process.cwd()),
|
|
@@ -11788,7 +11433,7 @@ program.command("deploy:github").description("Let GitHub Actions deploy a stage:
|
|
|
11788
11433
|
try {
|
|
11789
11434
|
const globalOptions = program.opts();
|
|
11790
11435
|
if (globalOptions.cwd) process.chdir(globalOptions.cwd);
|
|
11791
|
-
const { deployGithubCommand } = await import("./github-
|
|
11436
|
+
const { deployGithubCommand } = await import("./github-hjHHm7jM.mjs");
|
|
11792
11437
|
await deployGithubCommand(options);
|
|
11793
11438
|
} catch (error) {
|
|
11794
11439
|
console.error(formatError(error));
|