@geekmidas/cli 9.0.2 → 10.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -122
- package/dist/{CachedStateProvider-BdX7klRc.cjs → CachedStateProvider-BLo7zv7S.cjs} +1 -1
- package/dist/CachedStateProvider-BxoAm-B2.mjs +3 -0
- package/dist/{CachedStateProvider-klLWZXWF.cjs → CachedStateProvider-CqPdW7CB.cjs} +1 -1
- package/dist/{CachedStateProvider-klLWZXWF.cjs.map → CachedStateProvider-CqPdW7CB.cjs.map} +1 -1
- package/dist/{CachedStateProvider-CzyFct42.mjs → CachedStateProvider-DTniehMP.mjs} +1 -1
- package/dist/{CachedStateProvider-CzyFct42.mjs.map → CachedStateProvider-DTniehMP.mjs.map} +1 -1
- package/dist/{HostingerProvider-B2ZYz7Yc.mjs → HostingerProvider-Cft7lEYr.mjs} +4 -3
- package/dist/HostingerProvider-Cft7lEYr.mjs.map +1 -0
- package/dist/{HostingerProvider-CrHfsgz9.cjs → HostingerProvider-h3EbEp-Z.cjs} +4 -3
- package/dist/HostingerProvider-h3EbEp-Z.cjs.map +1 -0
- package/dist/{LocalStateProvider-CP49rjzt.mjs → LocalStateProvider-Bn6tS-oL.mjs} +1 -1
- package/dist/{LocalStateProvider-CP49rjzt.mjs.map → LocalStateProvider-Bn6tS-oL.mjs.map} +1 -1
- package/dist/{LocalStateProvider-CalzNfNA.cjs → LocalStateProvider-Db9SEjyH.cjs} +1 -1
- package/dist/{LocalStateProvider-CalzNfNA.cjs.map → LocalStateProvider-Db9SEjyH.cjs.map} +1 -1
- package/dist/{Route53Provider-tlgBzrRQ.mjs → Route53Provider-RdpUDJQk.mjs} +1 -1
- package/dist/{Route53Provider-tlgBzrRQ.mjs.map → Route53Provider-RdpUDJQk.mjs.map} +1 -1
- package/dist/{Route53Provider-DwgXiLxt.cjs → Route53Provider-di2fMM5N.cjs} +1 -1
- package/dist/{Route53Provider-DwgXiLxt.cjs.map → Route53Provider-di2fMM5N.cjs.map} +1 -1
- package/dist/{SSMStateProvider-BlrTiV5m.mjs → SSMStateProvider-BRt2py-A.mjs} +1 -1
- package/dist/{SSMStateProvider-BlrTiV5m.mjs.map → SSMStateProvider-BRt2py-A.mjs.map} +1 -1
- package/dist/{SSMStateProvider-Bt6r8CTL.cjs → SSMStateProvider-DyX8s9HI.cjs} +1 -1
- package/dist/{SSMStateProvider-Bt6r8CTL.cjs.map → SSMStateProvider-DyX8s9HI.cjs.map} +1 -1
- package/dist/{backup-provisioner-Xunq-p_8.mjs → backup-provisioner-Bgj5Vi_L.mjs} +2 -2
- package/dist/{backup-provisioner-Xunq-p_8.mjs.map → backup-provisioner-Bgj5Vi_L.mjs.map} +1 -1
- package/dist/{backup-provisioner-B3HBN-2k.cjs → backup-provisioner-BrsHwYG0.cjs} +2 -2
- package/dist/{backup-provisioner-B3HBN-2k.cjs.map → backup-provisioner-BrsHwYG0.cjs.map} +1 -1
- package/dist/{bundler-Dufq3uvI.cjs → bundler-BY1OmV1e.cjs} +44 -14
- package/dist/bundler-BY1OmV1e.cjs.map +1 -0
- package/dist/{bundler-DkA4qzUD.mjs → bundler-Be8Zg4Wd.mjs} +45 -15
- package/dist/bundler-Be8Zg4Wd.mjs.map +1 -0
- package/dist/config-D8o6I_7Z.mjs +469 -0
- package/dist/config-D8o6I_7Z.mjs.map +1 -0
- package/dist/config-DbPE1KXF.cjs +535 -0
- package/dist/config-DbPE1KXF.cjs.map +1 -0
- package/dist/config.cjs +3 -2
- package/dist/config.d.cts +2 -2
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +3 -2
- package/dist/{credentials-s1kLcIzK.mjs → credentials-B5zRHdAl.mjs} +21 -6
- package/dist/credentials-B5zRHdAl.mjs.map +1 -0
- package/dist/{credentials-C8DWtnMY.cjs → credentials-BapzjyV5.cjs} +26 -5
- package/dist/credentials-BapzjyV5.cjs.map +1 -0
- package/dist/credentials-Dh0Q6HzY.mjs +2548 -0
- package/dist/credentials-Dh0Q6HzY.mjs.map +1 -0
- package/dist/credentials-K961ThG3.cjs +2680 -0
- package/dist/credentials-K961ThG3.cjs.map +1 -0
- package/dist/deploy/sniffer-routes-worker.cjs +6 -2
- package/dist/deploy/sniffer-routes-worker.cjs.map +1 -1
- package/dist/deploy/sniffer-routes-worker.mjs +6 -2
- package/dist/deploy/sniffer-routes-worker.mjs.map +1 -1
- package/dist/discover-CAlFgYec.mjs +229 -0
- package/dist/discover-CAlFgYec.mjs.map +1 -0
- package/dist/discover-DTmFeloL.cjs +271 -0
- package/dist/discover-DTmFeloL.cjs.map +1 -0
- package/dist/dokploy-api-BS2xnJLZ.mjs +3 -0
- package/dist/{dokploy-api-CqOIKHme.cjs → dokploy-api-BsVH0y_s.cjs} +141 -32
- package/dist/dokploy-api-BsVH0y_s.cjs.map +1 -0
- package/dist/dokploy-api-BuxDRo3l.cjs +3 -0
- package/dist/{dokploy-api-sfZFlWuE.mjs → dokploy-api-aTFPz7_4.mjs} +141 -32
- package/dist/dokploy-api-aTFPz7_4.mjs.map +1 -0
- package/dist/emit-CbcRolsa.cjs +236 -0
- package/dist/emit-CbcRolsa.cjs.map +1 -0
- package/dist/emit-CiZS_5Ub.mjs +206 -0
- package/dist/emit-CiZS_5Ub.mjs.map +1 -0
- package/dist/{encryption-MfXAiFTm.cjs → encryption-C6jaU0hE.cjs} +1 -1
- package/dist/{encryption-MfXAiFTm.cjs.map → encryption-C6jaU0hE.cjs.map} +1 -1
- package/dist/{encryption-BVS7Vmzs.cjs → encryption-CHzzeR8a.cjs} +1 -1
- package/dist/encryption-CQUncu7v.mjs +3 -0
- package/dist/{encryption-CO5Q4Bhf.mjs → encryption-D-abyhZx.mjs} +1 -1
- package/dist/{encryption-CO5Q4Bhf.mjs.map → encryption-D-abyhZx.mjs.map} +1 -1
- package/dist/fullstack-secrets-C-GGohke.cjs +111 -0
- package/dist/fullstack-secrets-C-GGohke.cjs.map +1 -0
- package/dist/fullstack-secrets-D1o9-G5l.mjs +87 -0
- package/dist/fullstack-secrets-D1o9-G5l.mjs.map +1 -0
- package/dist/{fullstack-secrets-BYzi6Hwl.cjs → generator-CNzBw7g5.cjs} +1 -114
- package/dist/generator-CNzBw7g5.cjs.map +1 -0
- package/dist/{fullstack-secrets-l8s3II_H.mjs → generator-VE2JrFlY.mjs} +2 -85
- package/dist/generator-VE2JrFlY.mjs.map +1 -0
- package/dist/index-BThUzEIp.d.mts +175 -0
- package/dist/index-BThUzEIp.d.mts.map +1 -0
- package/dist/index-CHB4tSzX.d.cts +175 -0
- package/dist/index-CHB4tSzX.d.cts.map +1 -0
- package/dist/index.cjs +2530 -1810
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2506 -1786
- package/dist/index.mjs.map +1 -1
- package/dist/{openapi-Cfwi0fqF.mjs → openapi-CgpMWMmM.mjs} +174 -95
- package/dist/openapi-CgpMWMmM.mjs.map +1 -0
- package/dist/{openapi-BzNOC7_i.cjs → openapi-CljONd_M.cjs} +175 -108
- package/dist/openapi-CljONd_M.cjs.map +1 -0
- package/dist/{openapi-react-query-C4iIvpPf.mjs → openapi-react-query-Byltvm_7.mjs} +2 -2
- package/dist/openapi-react-query-Byltvm_7.mjs.map +1 -0
- package/dist/{openapi-react-query-CYWik72n.cjs → openapi-react-query-CmJ1xDbn.cjs} +2 -2
- package/dist/openapi-react-query-CmJ1xDbn.cjs.map +1 -0
- package/dist/openapi-react-query.cjs +1 -1
- package/dist/openapi-react-query.mjs +1 -1
- package/dist/openapi.cjs +4 -3
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.mts +1 -1
- package/dist/openapi.mjs +4 -3
- package/dist/reconcile/public.cjs +9 -0
- package/dist/reconcile/public.d.cts +125 -0
- package/dist/reconcile/public.d.cts.map +1 -0
- package/dist/reconcile/public.d.mts +125 -0
- package/dist/reconcile/public.d.mts.map +1 -0
- package/dist/reconcile/public.mjs +4 -0
- package/dist/{reconcile-B2FoJE0a.mjs → reconcile-CFs8C_1a.mjs} +5 -4
- package/dist/reconcile-CFs8C_1a.mjs.map +1 -0
- package/dist/{reconcile-BzqKJ2Rt.cjs → reconcile-D0pimNiy.cjs} +5 -4
- package/dist/reconcile-D0pimNiy.cjs.map +1 -0
- package/dist/setup-CJiQM2pX.cjs +473 -0
- package/dist/setup-CJiQM2pX.cjs.map +1 -0
- package/dist/setup-DMtU3p41.cjs +11 -0
- package/dist/setup-DOsYueeQ.mjs +443 -0
- package/dist/setup-DOsYueeQ.mjs.map +1 -0
- package/dist/setup-DSutDAlt.mjs +11 -0
- package/dist/{storage-B1wvztiJ.cjs → storage-BJmzYxt8.cjs} +1 -1
- package/dist/{storage-B1wvztiJ.cjs.map → storage-BJmzYxt8.cjs.map} +1 -1
- package/dist/{storage-DOEtT2Hr.cjs → storage-BM9hGpgv.cjs} +1 -1
- package/dist/{storage-dbb9RyBl.mjs → storage-Bi24WfoW.mjs} +1 -1
- package/dist/{storage-dbb9RyBl.mjs.map → storage-Bi24WfoW.mjs.map} +1 -1
- package/dist/{storage-Cs4WBsc4.mjs → storage-CYlGwWTj.mjs} +1 -1
- package/dist/{sync-CSooqRQ8.mjs → sync-CmEuNZsB.mjs} +2 -2
- package/dist/{sync-CSooqRQ8.mjs.map → sync-CmEuNZsB.mjs.map} +1 -1
- package/dist/sync-D306yOWu.cjs +4 -0
- package/dist/{sync-o_CtEbvR.cjs → sync-SizaChmC.cjs} +2 -2
- package/dist/{sync-o_CtEbvR.cjs.map → sync-SizaChmC.cjs.map} +1 -1
- package/dist/{sync-B5UHXwRM.mjs → sync-hOqAWHR6.mjs} +1 -1
- package/dist/{index-Bw548Bta.d.mts → types-C-arnQ1r.d.mts} +590 -143
- package/dist/types-C-arnQ1r.d.mts.map +1 -0
- package/dist/{index-DTpkeFb8.d.cts → types-abJQuk7m.d.cts} +590 -143
- package/dist/types-abJQuk7m.d.cts.map +1 -0
- package/dist/workspace/index.cjs +5 -1
- package/dist/workspace/index.d.cts +3 -3
- package/dist/workspace/index.d.mts +3 -3
- package/dist/workspace/index.mjs +2 -2
- package/dist/{workspace-D-37Ylqo.mjs → workspace-7FqprxuJ.mjs} +117 -30
- package/dist/workspace-7FqprxuJ.mjs.map +1 -0
- package/dist/workspace-8acupeaI.cjs +9 -0
- package/dist/{workspace-CQTT7HJQ.cjs → workspace-XvqO9jIv.cjs} +139 -28
- package/dist/workspace-XvqO9jIv.cjs.map +1 -0
- package/dist/workspace-yP5AHnrn.mjs +8 -0
- package/package.json +26 -9
- package/CHANGELOG.md +0 -650
- package/FUNCTION_CRON_SUPPORT.md +0 -266
- package/dist/CachedStateProvider-GcGziXh1.mjs +0 -3
- package/dist/HostingerProvider-B2ZYz7Yc.mjs.map +0 -1
- package/dist/HostingerProvider-CrHfsgz9.cjs.map +0 -1
- package/dist/bundler-DkA4qzUD.mjs.map +0 -1
- package/dist/bundler-Dufq3uvI.cjs.map +0 -1
- package/dist/config-Bbu1JKvf.mjs +0 -211
- package/dist/config-Bbu1JKvf.mjs.map +0 -1
- package/dist/config-DujV8DbR.cjs +0 -253
- package/dist/config-DujV8DbR.cjs.map +0 -1
- package/dist/credentials-C8DWtnMY.cjs.map +0 -1
- package/dist/credentials-s1kLcIzK.mjs.map +0 -1
- package/dist/dokploy-api-BPYkG-ZZ.cjs +0 -3
- package/dist/dokploy-api-BiSzWM4v.mjs +0 -3
- package/dist/dokploy-api-CqOIKHme.cjs.map +0 -1
- package/dist/dokploy-api-sfZFlWuE.mjs.map +0 -1
- package/dist/encryption-Bd_m4q3g.mjs +0 -3
- package/dist/fullstack-secrets-BYzi6Hwl.cjs.map +0 -1
- package/dist/fullstack-secrets-l8s3II_H.mjs.map +0 -1
- package/dist/index-Bw548Bta.d.mts.map +0 -1
- package/dist/index-DTpkeFb8.d.cts.map +0 -1
- package/dist/openapi-BzNOC7_i.cjs.map +0 -1
- package/dist/openapi-Cfwi0fqF.mjs.map +0 -1
- package/dist/openapi-react-query-C4iIvpPf.mjs.map +0 -1
- package/dist/openapi-react-query-CYWik72n.cjs.map +0 -1
- package/dist/reconcile-B2FoJE0a.mjs.map +0 -1
- package/dist/reconcile-BzqKJ2Rt.cjs.map +0 -1
- package/dist/setup-DDXUXzzl.mjs +0 -765
- package/dist/setup-DDXUXzzl.mjs.map +0 -1
- package/dist/setup-DLwhfyt-.cjs +0 -8
- package/dist/setup-Dh-B7YTX.mjs +0 -8
- package/dist/setup-WZ-xqAQO.cjs +0 -849
- package/dist/setup-WZ-xqAQO.cjs.map +0 -1
- package/dist/sync-BLA94rgC.cjs +0 -4
- package/dist/types-B3GQUg3k.d.mts +0 -280
- package/dist/types-B3GQUg3k.d.mts.map +0 -1
- package/dist/types-BWQDiooe.d.cts +0 -280
- package/dist/types-BWQDiooe.d.cts.map +0 -1
- package/dist/workspace-CQTT7HJQ.cjs.map +0 -1
- package/dist/workspace-D-37Ylqo.mjs.map +0 -1
- package/docs/OPENAPI_TYPESCRIPT_DESIGN.md +0 -408
- package/docs/dev-server-resilience-design.md +0 -189
- package/docs/manifest-refactor-design.md +0 -287
- package/examples/cron-example.ts +0 -45
- package/examples/env.ts +0 -33
- package/examples/function-example.ts +0 -40
- package/examples/gkm.config.json +0 -22
- package/examples/gkm.config.ts +0 -14
- package/examples/gkm.minimal.config.json +0 -7
- package/examples/gkm.production.config.json +0 -27
- package/examples/logger.ts +0 -10
- package/scripts/sync-versions.ts +0 -108
- package/src/__tests__/EndpointGenerator.hooks.spec.ts +0 -204
- package/src/__tests__/config.spec.ts +0 -422
- package/src/__tests__/loadEnvFiles.spec.ts +0 -131
- package/src/__tests__/normalizeHooksConfig.spec.ts +0 -63
- package/src/__tests__/openapi-react-query.spec.ts +0 -506
- package/src/__tests__/openapi.spec.ts +0 -625
- package/src/__tests__/test-helpers.ts +0 -181
- package/src/auth/__tests__/credentials.spec.ts +0 -331
- package/src/auth/__tests__/index.spec.ts +0 -237
- package/src/auth/credentials.ts +0 -286
- package/src/auth/index.ts +0 -233
- package/src/build/__tests__/bundler.spec.ts +0 -446
- package/src/build/__tests__/endpoint-analyzer.spec.ts +0 -623
- package/src/build/__tests__/handler-templates.spec.ts +0 -1287
- package/src/build/__tests__/index-new.spec.ts +0 -550
- package/src/build/__tests__/manifests.spec.ts +0 -583
- package/src/build/__tests__/partitions.spec.ts +0 -110
- package/src/build/__tests__/workspace-build.spec.ts +0 -215
- package/src/build/bundler.ts +0 -256
- package/src/build/endpoint-analyzer.ts +0 -236
- package/src/build/handler-templates.ts +0 -1253
- package/src/build/index.ts +0 -616
- package/src/build/manifests.ts +0 -285
- package/src/build/partitions.ts +0 -58
- package/src/build/providerResolver.ts +0 -184
- package/src/build/types.ts +0 -104
- package/src/config.ts +0 -330
- package/src/credentials/__tests__/fullDockerPorts.spec.ts +0 -144
- package/src/credentials/__tests__/helpers.ts +0 -112
- package/src/credentials/__tests__/prepareEntryCredentials.spec.ts +0 -125
- package/src/credentials/__tests__/readonlyDockerPorts.spec.ts +0 -190
- package/src/credentials/__tests__/workspaceCredentials.spec.ts +0 -209
- package/src/credentials/index.ts +0 -843
- package/src/debug.ts +0 -68
- package/src/deploy/CachedStateProvider.ts +0 -86
- package/src/deploy/LocalStateProvider.ts +0 -57
- package/src/deploy/SSMStateProvider.ts +0 -117
- package/src/deploy/StateProvider.ts +0 -175
- package/src/deploy/__tests__/CachedStateProvider.spec.ts +0 -235
- package/src/deploy/__tests__/HostingerProvider.spec.ts +0 -347
- package/src/deploy/__tests__/LocalStateProvider.spec.ts +0 -130
- package/src/deploy/__tests__/Route53Provider.spec.ts +0 -425
- package/src/deploy/__tests__/SSMStateProvider.spec.ts +0 -201
- package/src/deploy/__tests__/__fixtures__/entry-apps/async-entry.ts +0 -24
- package/src/deploy/__tests__/__fixtures__/entry-apps/nested-config-entry.ts +0 -24
- package/src/deploy/__tests__/__fixtures__/entry-apps/no-env-entry.ts +0 -12
- package/src/deploy/__tests__/__fixtures__/entry-apps/simple-entry.ts +0 -14
- package/src/deploy/__tests__/__fixtures__/entry-apps/throwing-entry.ts +0 -16
- package/src/deploy/__tests__/__fixtures__/env-parsers/non-function-export.ts +0 -10
- package/src/deploy/__tests__/__fixtures__/env-parsers/optional-env-parser.ts +0 -21
- package/src/deploy/__tests__/__fixtures__/env-parsers/parseable-env-parser.ts +0 -18
- package/src/deploy/__tests__/__fixtures__/env-parsers/throwing-env-parser.ts +0 -16
- package/src/deploy/__tests__/__fixtures__/env-parsers/valid-env-parser.ts +0 -16
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/auth.ts +0 -16
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/health.ts +0 -13
- package/src/deploy/__tests__/__fixtures__/route-apps/endpoints/users.ts +0 -15
- package/src/deploy/__tests__/__fixtures__/route-apps/services.ts +0 -55
- package/src/deploy/__tests__/backup-provisioner.spec.ts +0 -428
- package/src/deploy/__tests__/createDnsProvider.spec.ts +0 -195
- package/src/deploy/__tests__/createStateProvider.spec.ts +0 -126
- package/src/deploy/__tests__/dns-orchestration.spec.ts +0 -192
- package/src/deploy/__tests__/dns-verification.spec.ts +0 -229
- package/src/deploy/__tests__/docker.spec.ts +0 -149
- package/src/deploy/__tests__/dokploy-api.spec.ts +0 -697
- package/src/deploy/__tests__/dokploy.spec.ts +0 -435
- package/src/deploy/__tests__/domain.spec.ts +0 -235
- package/src/deploy/__tests__/env-resolver.spec.ts +0 -903
- package/src/deploy/__tests__/index.spec.ts +0 -1091
- package/src/deploy/__tests__/init.spec.ts +0 -793
- package/src/deploy/__tests__/secrets.spec.ts +0 -303
- package/src/deploy/__tests__/sniffer.spec.ts +0 -838
- package/src/deploy/__tests__/state-e2e.spec.ts +0 -387
- package/src/deploy/__tests__/state.spec.ts +0 -876
- package/src/deploy/__tests__/undeploy.spec.ts +0 -758
- package/src/deploy/backup-provisioner.ts +0 -316
- package/src/deploy/dns/DnsProvider.ts +0 -201
- package/src/deploy/dns/HostingerProvider.ts +0 -174
- package/src/deploy/dns/Route53Provider.ts +0 -340
- package/src/deploy/dns/hostinger-api.ts +0 -261
- package/src/deploy/dns/index.ts +0 -627
- package/src/deploy/docker.ts +0 -260
- package/src/deploy/dokploy-api.ts +0 -1101
- package/src/deploy/dokploy.ts +0 -177
- package/src/deploy/domain.ts +0 -134
- package/src/deploy/env-resolver.ts +0 -305
- package/src/deploy/index.ts +0 -2094
- package/src/deploy/init.ts +0 -427
- package/src/deploy/secrets.ts +0 -187
- package/src/deploy/sniffer-envkit-patch.ts +0 -61
- package/src/deploy/sniffer-hooks.ts +0 -57
- package/src/deploy/sniffer-loader.ts +0 -28
- package/src/deploy/sniffer-routes-worker.ts +0 -104
- package/src/deploy/sniffer-worker.ts +0 -75
- package/src/deploy/sniffer.ts +0 -578
- package/src/deploy/state-commands.ts +0 -274
- package/src/deploy/state.ts +0 -482
- package/src/deploy/types.ts +0 -102
- package/src/deploy/undeploy.ts +0 -407
- package/src/dev/__tests__/entry-integration.spec.ts +0 -347
- package/src/dev/__tests__/entry.spec.ts +0 -144
- package/src/dev/__tests__/index.spec.ts +0 -2084
- package/src/dev/index.ts +0 -1649
- package/src/docker/__tests__/compose.spec.ts +0 -1142
- package/src/docker/__tests__/templates.spec.ts +0 -694
- package/src/docker/compose.ts +0 -808
- package/src/docker/index.ts +0 -523
- package/src/docker/templates.ts +0 -1067
- package/src/exec/index.ts +0 -118
- package/src/generators/CronGenerator.ts +0 -105
- package/src/generators/EndpointGenerator.ts +0 -954
- package/src/generators/FunctionGenerator.ts +0 -117
- package/src/generators/Generator.ts +0 -147
- package/src/generators/OpenApiTsGenerator.ts +0 -821
- package/src/generators/QueueGenerator.ts +0 -245
- package/src/generators/SubscriberGenerator.ts +0 -282
- package/src/generators/TopicGenerator.ts +0 -45
- package/src/generators/__tests__/CronGenerator.spec.ts +0 -445
- package/src/generators/__tests__/EndpointGenerator.spec.ts +0 -544
- package/src/generators/__tests__/FunctionGenerator.spec.ts +0 -256
- package/src/generators/__tests__/Generator.bustCache.spec.ts +0 -72
- package/src/generators/__tests__/OpenApiTsGenerator.registry.spec.ts +0 -98
- package/src/generators/__tests__/OpenApiTsGenerator.responseType.spec.ts +0 -56
- package/src/generators/__tests__/QueueGenerator.spec.ts +0 -141
- package/src/generators/__tests__/SubscriberGenerator.spec.ts +0 -410
- package/src/generators/index.ts +0 -11
- package/src/index.ts +0 -972
- package/src/init/__tests__/generators.spec.ts +0 -1070
- package/src/init/__tests__/init.spec.ts +0 -577
- package/src/init/__tests__/utils.spec.ts +0 -104
- package/src/init/generators/auth.ts +0 -225
- package/src/init/generators/config.ts +0 -316
- package/src/init/generators/docker.ts +0 -388
- package/src/init/generators/env.ts +0 -62
- package/src/init/generators/index.ts +0 -6
- package/src/init/generators/mobile-expo.ts +0 -576
- package/src/init/generators/models.ts +0 -153
- package/src/init/generators/monorepo.ts +0 -475
- package/src/init/generators/package.ts +0 -95
- package/src/init/generators/source.ts +0 -15
- package/src/init/generators/test.ts +0 -178
- package/src/init/generators/ui.ts +0 -1473
- package/src/init/generators/web-tanstack.ts +0 -348
- package/src/init/generators/web.ts +0 -363
- package/src/init/index.ts +0 -542
- package/src/init/templates/api.ts +0 -404
- package/src/init/templates/index.ts +0 -342
- package/src/init/templates/minimal.ts +0 -207
- package/src/init/templates/serverless.ts +0 -148
- package/src/init/templates/worker.ts +0 -216
- package/src/init/utils.ts +0 -197
- package/src/init/versions.ts +0 -52
- package/src/openapi-react-query.ts +0 -288
- package/src/openapi.ts +0 -259
- package/src/secrets/__tests__/encryption.spec.ts +0 -226
- package/src/secrets/__tests__/generator.spec.ts +0 -575
- package/src/secrets/__tests__/index.spec.ts +0 -91
- package/src/secrets/__tests__/reconcile.spec.ts +0 -123
- package/src/secrets/__tests__/storage.spec.ts +0 -645
- package/src/secrets/encryption.ts +0 -91
- package/src/secrets/generator.ts +0 -329
- package/src/secrets/index.ts +0 -417
- package/src/secrets/keystore.ts +0 -144
- package/src/secrets/reconcile.ts +0 -53
- package/src/secrets/storage.ts +0 -337
- package/src/secrets/sync.ts +0 -136
- package/src/secrets/types.ts +0 -70
- package/src/setup/__tests__/auto-setup.spec.ts +0 -147
- package/src/setup/__tests__/reconcile-secrets.spec.ts +0 -439
- package/src/setup/fullstack-secrets.ts +0 -140
- package/src/setup/index.ts +0 -411
- package/src/test/__tests__/__fixtures__/workspace.ts +0 -104
- package/src/test/__tests__/api.spec.ts +0 -199
- package/src/test/__tests__/auth.spec.ts +0 -162
- package/src/test/__tests__/index.spec.ts +0 -502
- package/src/test/__tests__/web.spec.ts +0 -210
- package/src/test/index.ts +0 -198
- package/src/types.ts +0 -363
- package/src/upgrade/__tests__/index.spec.ts +0 -354
- package/src/upgrade/index.ts +0 -253
- package/src/workspace/__tests__/client-generator.spec.ts +0 -326
- package/src/workspace/__tests__/index.spec.ts +0 -766
- package/src/workspace/__tests__/publicEnv.spec.ts +0 -64
- package/src/workspace/__tests__/schema.spec.ts +0 -737
- package/src/workspace/__tests__/type-inference.spec.ts +0 -251
- package/src/workspace/client-generator.ts +0 -109
- package/src/workspace/index.ts +0 -433
- package/src/workspace/publicEnv.ts +0 -57
- package/src/workspace/schema.ts +0 -861
- package/src/workspace/types.ts +0 -943
- package/tsconfig.json +0 -9
- package/tsdown.config.ts +0 -22
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
-
const node_path = require_chunk.__toESM(require("node:path"));
|
|
3
|
-
const node_fs_promises = require_chunk.__toESM(require("node:fs/promises"));
|
|
4
2
|
const node_crypto = require_chunk.__toESM(require("node:crypto"));
|
|
5
3
|
|
|
6
4
|
//#region src/secrets/generator.ts
|
|
@@ -251,87 +249,6 @@ function rotateServicePassword(secrets, service) {
|
|
|
251
249
|
};
|
|
252
250
|
}
|
|
253
251
|
|
|
254
|
-
//#endregion
|
|
255
|
-
//#region src/setup/fullstack-secrets.ts
|
|
256
|
-
/**
|
|
257
|
-
* Generate a secure random password for database users.
|
|
258
|
-
* Uses a combination of timestamp and random bytes for uniqueness.
|
|
259
|
-
*/
|
|
260
|
-
function generateDbPassword() {
|
|
261
|
-
return `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`;
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Generate database URL for an app.
|
|
265
|
-
* All apps connect to the same database, but use different users/schemas.
|
|
266
|
-
*/
|
|
267
|
-
function generateDbUrl(appName, password, projectName, host = "localhost", port = 5432) {
|
|
268
|
-
const userName = appName.replace(/-/g, "_");
|
|
269
|
-
const dbName = `${projectName.replace(/-/g, "_")}_dev`;
|
|
270
|
-
return `postgresql://${userName}:${password}@${host}:${port}/${dbName}`;
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Generate fullstack-aware custom secrets for a workspace.
|
|
274
|
-
*
|
|
275
|
-
* Generates:
|
|
276
|
-
* - Common secrets: NODE_ENV, PORT, LOG_LEVEL, JWT_SECRET
|
|
277
|
-
* - Per-app database passwords and URLs for backend apps with db service
|
|
278
|
-
* - Better-auth secrets for apps using the better-auth framework
|
|
279
|
-
*/
|
|
280
|
-
function generateFullstackCustomSecrets(workspace) {
|
|
281
|
-
const hasDb = !!workspace.services.db;
|
|
282
|
-
const customs = {
|
|
283
|
-
NODE_ENV: "development",
|
|
284
|
-
PORT: "3000",
|
|
285
|
-
LOG_LEVEL: "debug",
|
|
286
|
-
JWT_SECRET: `dev-${Date.now()}-${Math.random().toString(36).slice(2)}`
|
|
287
|
-
};
|
|
288
|
-
if (!hasDb) return customs;
|
|
289
|
-
const frontendPorts = [];
|
|
290
|
-
for (const [appName, appConfig] of Object.entries(workspace.apps)) {
|
|
291
|
-
if (appConfig.type === "web") {
|
|
292
|
-
frontendPorts.push(appConfig.port);
|
|
293
|
-
const upperName$1 = appName.toUpperCase();
|
|
294
|
-
customs[`${upperName$1}_URL`] = `http://localhost:${appConfig.port}`;
|
|
295
|
-
continue;
|
|
296
|
-
}
|
|
297
|
-
if (appConfig.type === "mobile") continue;
|
|
298
|
-
const password = generateDbPassword();
|
|
299
|
-
const upperName = appName.toUpperCase();
|
|
300
|
-
customs[`${upperName}_DATABASE_URL`] = generateDbUrl(appName, password, workspace.name);
|
|
301
|
-
customs[`${upperName}_DB_PASSWORD`] = password;
|
|
302
|
-
if (appConfig.framework === "better-auth") {
|
|
303
|
-
customs.AUTH_PORT = String(appConfig.port);
|
|
304
|
-
customs.AUTH_URL = `http://localhost:${appConfig.port}`;
|
|
305
|
-
customs.BETTER_AUTH_SECRET = `better-auth-${Date.now()}-${generateSecurePassword(16)}`;
|
|
306
|
-
customs.BETTER_AUTH_URL = `http://localhost:${appConfig.port}`;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
if (customs.BETTER_AUTH_SECRET) {
|
|
310
|
-
const allPorts = Object.values(workspace.apps).map((a) => a.port);
|
|
311
|
-
customs.BETTER_AUTH_TRUSTED_ORIGINS = allPorts.map((p) => `http://localhost:${p}`).join(",");
|
|
312
|
-
}
|
|
313
|
-
return customs;
|
|
314
|
-
}
|
|
315
|
-
/**
|
|
316
|
-
* Extract *_DB_PASSWORD keys from secrets and write docker/.env.
|
|
317
|
-
*
|
|
318
|
-
* The docker/.env file contains database passwords that the PostgreSQL
|
|
319
|
-
* init script reads to create per-app database users.
|
|
320
|
-
*/
|
|
321
|
-
async function writeDockerEnvFromSecrets(secrets, workspaceRoot) {
|
|
322
|
-
const dbPasswordEntries = Object.entries(secrets.custom).filter(([key]) => key.endsWith("_DB_PASSWORD"));
|
|
323
|
-
if (secrets.services.pgboss && !dbPasswordEntries.some(([key]) => key === "PGBOSS_DB_PASSWORD")) dbPasswordEntries.push(["PGBOSS_DB_PASSWORD", secrets.services.pgboss.password]);
|
|
324
|
-
if (dbPasswordEntries.length === 0) return;
|
|
325
|
-
const envContent = `# Auto-generated docker environment file
|
|
326
|
-
# Contains database passwords for docker-compose postgres init
|
|
327
|
-
# This file is gitignored - do not commit to version control
|
|
328
|
-
${dbPasswordEntries.map(([key, value]) => `${key}=${value}`).join("\n")}
|
|
329
|
-
`;
|
|
330
|
-
const envPath = (0, node_path.join)(workspaceRoot, "docker", ".env");
|
|
331
|
-
await (0, node_fs_promises.mkdir)((0, node_path.dirname)(envPath), { recursive: true });
|
|
332
|
-
await (0, node_fs_promises.writeFile)(envPath, envContent);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
252
|
//#endregion
|
|
336
253
|
Object.defineProperty(exports, 'createStageSecrets', {
|
|
337
254
|
enumerable: true,
|
|
@@ -345,30 +262,6 @@ Object.defineProperty(exports, 'generateConnectionUrls', {
|
|
|
345
262
|
return generateConnectionUrls;
|
|
346
263
|
}
|
|
347
264
|
});
|
|
348
|
-
Object.defineProperty(exports, 'generateDbPassword', {
|
|
349
|
-
enumerable: true,
|
|
350
|
-
get: function () {
|
|
351
|
-
return generateDbPassword;
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
Object.defineProperty(exports, 'generateDbUrl', {
|
|
355
|
-
enumerable: true,
|
|
356
|
-
get: function () {
|
|
357
|
-
return generateDbUrl;
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
Object.defineProperty(exports, 'generateFullstackCustomSecrets', {
|
|
361
|
-
enumerable: true,
|
|
362
|
-
get: function () {
|
|
363
|
-
return generateFullstackCustomSecrets;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
Object.defineProperty(exports, 'generateLocalStackCredentials', {
|
|
367
|
-
enumerable: true,
|
|
368
|
-
get: function () {
|
|
369
|
-
return generateLocalStackCredentials;
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
265
|
Object.defineProperty(exports, 'generatePgBossUrl', {
|
|
373
266
|
enumerable: true,
|
|
374
267
|
get: function () {
|
|
@@ -393,10 +286,4 @@ Object.defineProperty(exports, 'rotateServicePassword', {
|
|
|
393
286
|
return rotateServicePassword;
|
|
394
287
|
}
|
|
395
288
|
});
|
|
396
|
-
|
|
397
|
-
enumerable: true,
|
|
398
|
-
get: function () {
|
|
399
|
-
return writeDockerEnvFromSecrets;
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
//# sourceMappingURL=fullstack-secrets-BYzi6Hwl.cjs.map
|
|
289
|
+
//# sourceMappingURL=generator-CNzBw7g5.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-CNzBw7g5.cjs","names":["SERVICE_DEFAULTS: Record<\n\tComposeServiceName,\n\tOmit<ServiceCredentials, 'password'>\n>","PGBOSS_DEFAULTS: Omit<ServiceCredentials, 'password'>","service: ComposeServiceName","services: ComposeServiceName[]","result: StageSecrets['services']","creds: ServiceCredentials","eventsBackend: EventsBackend","services: StageSecrets['services']","eventsBackend?: EventsBackend","urls: StageSecrets['urls']","stage: string","options?: { projectName?: string; eventsBackend?: EventsBackend }","secrets: StageSecrets","newCreds: ServiceCredentials"],"sources":["../src/secrets/generator.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\nimport type { ComposeServiceName, EventsBackend } from '../types';\nimport type { ServiceCredentials, StageSecrets } from './types';\n\n/**\n * Generate a secure random password using URL-safe base64 characters.\n * @param length Password length (default: 32)\n */\nexport function generateSecurePassword(length = 32): string {\n\treturn randomBytes(Math.ceil((length * 3) / 4))\n\t\t.toString('base64url')\n\t\t.slice(0, length);\n}\n\n/** Default service configurations (localhost for local dev via Docker port mapping) */\nconst SERVICE_DEFAULTS: Record<\n\tComposeServiceName,\n\tOmit<ServiceCredentials, 'password'>\n> = {\n\tpostgres: {\n\t\thost: 'localhost',\n\t\tport: 5432,\n\t\tusername: 'app',\n\t\tdatabase: 'app',\n\t},\n\tredis: {\n\t\thost: 'localhost',\n\t\tport: 6379,\n\t\tusername: 'default',\n\t},\n\trabbitmq: {\n\t\thost: 'localhost',\n\t\tport: 5672,\n\t\tusername: 'app',\n\t\tvhost: '/',\n\t},\n\tminio: {\n\t\thost: 'localhost',\n\t\tport: 9000,\n\t\tusername: 'app',\n\t\tbucket: 'app',\n\t},\n\tmailpit: {\n\t\thost: 'localhost',\n\t\tport: 1025,\n\t\tusername: 'app',\n\t},\n\tlocalstack: {\n\t\thost: 'localhost',\n\t\tport: 4566,\n\t\tusername: 'localstack',\n\t\tregion: 'us-east-1',\n\t},\n};\n\n/** Default credentials for pgboss (not a Docker service, reuses postgres) */\nconst PGBOSS_DEFAULTS: Omit<ServiceCredentials, 'password'> = {\n\thost: 'localhost',\n\tport: 5432,\n\tusername: 'pgboss',\n\tdatabase: 'app',\n};\n\n/**\n * Generate credentials for a specific service.\n */\nexport function generateServiceCredentials(\n\tservice: ComposeServiceName,\n): ServiceCredentials {\n\tconst defaults = SERVICE_DEFAULTS[service];\n\treturn {\n\t\t...defaults,\n\t\tpassword: generateSecurePassword(),\n\t};\n}\n\n/**\n * Generate credentials for multiple services.\n */\nexport function generateServicesCredentials(\n\tservices: ComposeServiceName[],\n): StageSecrets['services'] {\n\tconst result: StageSecrets['services'] = {};\n\n\tfor (const service of services) {\n\t\tresult[service] = generateServiceCredentials(service);\n\t}\n\n\treturn result;\n}\n\n/**\n * Generate connection URL for PostgreSQL.\n */\nexport function generatePostgresUrl(creds: ServiceCredentials): string {\n\tconst { username, password, host, port, database } = creds;\n\treturn `postgresql://${username}:${encodeURIComponent(password)}@${host}:${port}/${database}`;\n}\n\n/**\n * Generate connection URL for Redis.\n */\nexport function generateRedisUrl(creds: ServiceCredentials): string {\n\tconst { password, host, port } = creds;\n\treturn `redis://:${encodeURIComponent(password)}@${host}:${port}`;\n}\n\n/**\n * Generate connection URL for RabbitMQ.\n */\nexport function generateRabbitmqUrl(creds: ServiceCredentials): string {\n\tconst { username, password, host, port, vhost } = creds;\n\tconst encodedVhost = encodeURIComponent(vhost ?? '/');\n\treturn `amqp://${username}:${encodeURIComponent(password)}@${host}:${port}/${encodedVhost}`;\n}\n\n/**\n * Generate endpoint URL for MinIO (S3-compatible).\n */\nexport function generateMinioEndpoint(creds: ServiceCredentials): string {\n\tconst { host, port } = creds;\n\treturn `http://${host}:${port}`;\n}\n\n/**\n * Generate a LocalStack-compatible access key ID.\n * Must start with 'LSIA' prefix and be at least 20 characters.\n * @see https://docs.localstack.cloud/aws/capabilities/config/credentials/\n */\nexport function generateLocalStackAccessKeyId(): string {\n\tconst suffix = randomBytes(12).toString('base64url').slice(0, 16);\n\treturn `LSIA${suffix}`;\n}\n\n/**\n * Generate connection URL for pg-boss (uses PostgreSQL protocol).\n * Format: pgboss://user:pass@host:port/db?schema=pgboss\n */\nexport function generatePgBossUrl(creds: ServiceCredentials): string {\n\tconst { username, password, host, port, database } = creds;\n\treturn `pgboss://${username}:${encodeURIComponent(password)}@${host}:${port}/${database}?schema=pgboss`;\n}\n\n/**\n * Generate event connection strings based on the events backend.\n */\nexport function generateEventConnectionStrings(\n\teventsBackend: EventsBackend,\n\tservices: StageSecrets['services'],\n): { publisher: string; subscriber: string } {\n\tswitch (eventsBackend) {\n\t\tcase 'pgboss': {\n\t\t\tconst creds = services.pgboss;\n\t\t\tif (!creds) {\n\t\t\t\tthrow new Error('pgboss credentials required for pgboss events');\n\t\t\t}\n\t\t\tconst url = generatePgBossUrl(creds);\n\t\t\treturn { publisher: url, subscriber: url };\n\t\t}\n\t\tcase 'sns': {\n\t\t\tconst creds = services.localstack;\n\t\t\tif (!creds) {\n\t\t\t\tthrow new Error('localstack credentials required for sns events');\n\t\t\t}\n\t\t\tconst endpoint = `http://${creds.host}:${creds.port}`;\n\t\t\tconst region = creds.region ?? 'us-east-1';\n\t\t\tconst accessKeyId = creds.accessKeyId ?? creds.username;\n\t\t\tconst secretKey = encodeURIComponent(creds.password);\n\t\t\treturn {\n\t\t\t\tpublisher: `sns://${accessKeyId}:${secretKey}@${creds.host}:${creds.port}?region=${region}&endpoint=${encodeURIComponent(endpoint)}`,\n\t\t\t\tsubscriber: `sqs://${accessKeyId}:${secretKey}@${creds.host}:${creds.port}?region=${region}&endpoint=${encodeURIComponent(endpoint)}`,\n\t\t\t};\n\t\t}\n\t\tcase 'rabbitmq': {\n\t\t\tconst creds = services.rabbitmq;\n\t\t\tif (!creds) {\n\t\t\t\tthrow new Error('rabbitmq credentials required for rabbitmq events');\n\t\t\t}\n\t\t\tconst url = generateRabbitmqUrl(creds);\n\t\t\treturn { publisher: url, subscriber: url };\n\t\t}\n\t}\n}\n\n/**\n * Generate connection URLs from service credentials.\n */\nexport function generateConnectionUrls(\n\tservices: StageSecrets['services'],\n\teventsBackend?: EventsBackend,\n): StageSecrets['urls'] {\n\tconst urls: StageSecrets['urls'] = {};\n\n\tif (services.postgres) {\n\t\turls.DATABASE_URL = generatePostgresUrl(services.postgres);\n\t}\n\n\tif (services.redis) {\n\t\turls.REDIS_URL = generateRedisUrl(services.redis);\n\t}\n\n\tif (services.rabbitmq) {\n\t\turls.RABBITMQ_URL = generateRabbitmqUrl(services.rabbitmq);\n\t}\n\n\tif (services.minio) {\n\t\turls.STORAGE_ENDPOINT = generateMinioEndpoint(services.minio);\n\t}\n\n\tif (eventsBackend) {\n\t\tconst eventUrls = generateEventConnectionStrings(eventsBackend, services);\n\t\turls.EVENT_PUBLISHER_CONNECTION_STRING = eventUrls.publisher;\n\t\turls.EVENT_SUBSCRIBER_CONNECTION_STRING = eventUrls.subscriber;\n\t} else if (services.pgboss) {\n\t\t// Default to pgboss when credentials exist but no explicit events backend\n\t\tconst pgbossUrl = generatePgBossUrl(services.pgboss);\n\t\turls.EVENT_PUBLISHER_CONNECTION_STRING = pgbossUrl;\n\t\turls.EVENT_SUBSCRIBER_CONNECTION_STRING = pgbossUrl;\n\t}\n\n\tif (services.mailpit) {\n\t\turls.SMTP_HOST = services.mailpit.host;\n\t\turls.SMTP_PORT = String(services.mailpit.port);\n\t}\n\n\treturn urls;\n}\n\n/**\n * Generate LocalStack service credentials with LSIA-prefixed access key.\n */\nexport function generateLocalStackCredentials(): ServiceCredentials {\n\tconst defaults = SERVICE_DEFAULTS.localstack;\n\treturn {\n\t\t...defaults,\n\t\tpassword: generateSecurePassword(),\n\t\taccessKeyId: generateLocalStackAccessKeyId(),\n\t};\n}\n\n/**\n * Create a new StageSecrets object with generated credentials.\n * @param stage - The deployment stage (e.g., 'development', 'production')\n * @param services - List of services to generate credentials for\n * @param options - Optional configuration\n * @param options.projectName - Project name used to derive the database name (e.g., 'myapp' → 'myapp_dev')\n * @param options.eventsBackend - Event backend type (pgboss, sns, rabbitmq)\n */\nexport function createStageSecrets(\n\tstage: string,\n\tservices: ComposeServiceName[],\n\toptions?: { projectName?: string; eventsBackend?: EventsBackend },\n): StageSecrets {\n\tconst now = new Date().toISOString();\n\tconst serviceCredentials = generateServicesCredentials(services);\n\n\t// Override service defaults with project-derived names if provided\n\tif (options?.projectName) {\n\t\tif (serviceCredentials.postgres) {\n\t\t\tserviceCredentials.postgres.database = `${options.projectName.replace(/-/g, '_')}_dev`;\n\t\t}\n\t\tif (serviceCredentials.minio) {\n\t\t\tserviceCredentials.minio.bucket = options.projectName;\n\t\t\tserviceCredentials.minio.username = options.projectName;\n\t\t}\n\t}\n\n\t// Always create pgboss credentials when postgres is available.\n\t// pgboss reuses postgres host/port/database but with a dedicated user,\n\t// so subscribers work out of the box without explicit events config.\n\tif (serviceCredentials.postgres && !serviceCredentials.pgboss) {\n\t\tserviceCredentials.pgboss = {\n\t\t\t...PGBOSS_DEFAULTS,\n\t\t\tpassword: generateSecurePassword(),\n\t\t\thost: serviceCredentials.postgres.host,\n\t\t\tport: serviceCredentials.postgres.port,\n\t\t\tdatabase: serviceCredentials.postgres.database,\n\t\t};\n\t}\n\n\t// Generate event-specific credentials\n\tconst eventsBackend = options?.eventsBackend;\n\tif (eventsBackend === 'sns') {\n\t\t// LocalStack credentials with LSIA-prefixed access key\n\t\tserviceCredentials.localstack = generateLocalStackCredentials();\n\t}\n\n\tconst urls = generateConnectionUrls(serviceCredentials, eventsBackend);\n\n\treturn {\n\t\tstage,\n\t\tcreatedAt: now,\n\t\tupdatedAt: now,\n\t\teventsBackend,\n\t\tservices: serviceCredentials,\n\t\turls,\n\t\tcustom: {},\n\t};\n}\n\n/**\n * Rotate password for a specific service.\n */\nexport function rotateServicePassword(\n\tsecrets: StageSecrets,\n\tservice: ComposeServiceName,\n): StageSecrets {\n\tconst currentCreds = secrets.services[service];\n\tif (!currentCreds) {\n\t\tthrow new Error(`Service \"${service}\" not configured in secrets`);\n\t}\n\n\tconst newCreds: ServiceCredentials = {\n\t\t...currentCreds,\n\t\tpassword: generateSecurePassword(),\n\t};\n\n\tconst newServices = {\n\t\t...secrets.services,\n\t\t[service]: newCreds,\n\t};\n\n\treturn {\n\t\t...secrets,\n\t\tupdatedAt: new Date().toISOString(),\n\t\tservices: newServices,\n\t\turls: generateConnectionUrls(newServices, secrets.eventsBackend),\n\t};\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,uBAAuB,SAAS,IAAY;AAC3D,QAAO,6BAAY,KAAK,KAAM,SAAS,IAAK,EAAE,CAAC,CAC7C,SAAS,YAAY,CACrB,MAAM,GAAG,OAAO;AAClB;;AAGD,MAAMA,mBAGF;CACH,UAAU;EACT,MAAM;EACN,MAAM;EACN,UAAU;EACV,UAAU;CACV;CACD,OAAO;EACN,MAAM;EACN,MAAM;EACN,UAAU;CACV;CACD,UAAU;EACT,MAAM;EACN,MAAM;EACN,UAAU;EACV,OAAO;CACP;CACD,OAAO;EACN,MAAM;EACN,MAAM;EACN,UAAU;EACV,QAAQ;CACR;CACD,SAAS;EACR,MAAM;EACN,MAAM;EACN,UAAU;CACV;CACD,YAAY;EACX,MAAM;EACN,MAAM;EACN,UAAU;EACV,QAAQ;CACR;AACD;;AAGD,MAAMC,kBAAwD;CAC7D,MAAM;CACN,MAAM;CACN,UAAU;CACV,UAAU;AACV;;;;AAKD,SAAgB,2BACfC,SACqB;CACrB,MAAM,WAAW,iBAAiB;AAClC,QAAO;EACN,GAAG;EACH,UAAU,wBAAwB;CAClC;AACD;;;;AAKD,SAAgB,4BACfC,UAC2B;CAC3B,MAAMC,SAAmC,CAAE;AAE3C,MAAK,MAAM,WAAW,SACrB,QAAO,WAAW,2BAA2B,QAAQ;AAGtD,QAAO;AACP;;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+1,3 @@
|
|
|
1
|
-
import { dirname, join } from "node:path";
|
|
2
|
-
import { mkdir, writeFile } from "node:fs/promises";
|
|
3
1
|
import { randomBytes } from "node:crypto";
|
|
4
2
|
|
|
5
3
|
//#region src/secrets/generator.ts
|
|
@@ -251,86 +249,5 @@ function rotateServicePassword(secrets, service) {
|
|
|
251
249
|
}
|
|
252
250
|
|
|
253
251
|
//#endregion
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
* Generate a secure random password for database users.
|
|
257
|
-
* Uses a combination of timestamp and random bytes for uniqueness.
|
|
258
|
-
*/
|
|
259
|
-
function generateDbPassword() {
|
|
260
|
-
return `${Date.now().toString(36)}${Math.random().toString(36).slice(2)}${Math.random().toString(36).slice(2)}`;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Generate database URL for an app.
|
|
264
|
-
* All apps connect to the same database, but use different users/schemas.
|
|
265
|
-
*/
|
|
266
|
-
function generateDbUrl(appName, password, projectName, host = "localhost", port = 5432) {
|
|
267
|
-
const userName = appName.replace(/-/g, "_");
|
|
268
|
-
const dbName = `${projectName.replace(/-/g, "_")}_dev`;
|
|
269
|
-
return `postgresql://${userName}:${password}@${host}:${port}/${dbName}`;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Generate fullstack-aware custom secrets for a workspace.
|
|
273
|
-
*
|
|
274
|
-
* Generates:
|
|
275
|
-
* - Common secrets: NODE_ENV, PORT, LOG_LEVEL, JWT_SECRET
|
|
276
|
-
* - Per-app database passwords and URLs for backend apps with db service
|
|
277
|
-
* - Better-auth secrets for apps using the better-auth framework
|
|
278
|
-
*/
|
|
279
|
-
function generateFullstackCustomSecrets(workspace) {
|
|
280
|
-
const hasDb = !!workspace.services.db;
|
|
281
|
-
const customs = {
|
|
282
|
-
NODE_ENV: "development",
|
|
283
|
-
PORT: "3000",
|
|
284
|
-
LOG_LEVEL: "debug",
|
|
285
|
-
JWT_SECRET: `dev-${Date.now()}-${Math.random().toString(36).slice(2)}`
|
|
286
|
-
};
|
|
287
|
-
if (!hasDb) return customs;
|
|
288
|
-
const frontendPorts = [];
|
|
289
|
-
for (const [appName, appConfig] of Object.entries(workspace.apps)) {
|
|
290
|
-
if (appConfig.type === "web") {
|
|
291
|
-
frontendPorts.push(appConfig.port);
|
|
292
|
-
const upperName$1 = appName.toUpperCase();
|
|
293
|
-
customs[`${upperName$1}_URL`] = `http://localhost:${appConfig.port}`;
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
296
|
-
if (appConfig.type === "mobile") continue;
|
|
297
|
-
const password = generateDbPassword();
|
|
298
|
-
const upperName = appName.toUpperCase();
|
|
299
|
-
customs[`${upperName}_DATABASE_URL`] = generateDbUrl(appName, password, workspace.name);
|
|
300
|
-
customs[`${upperName}_DB_PASSWORD`] = password;
|
|
301
|
-
if (appConfig.framework === "better-auth") {
|
|
302
|
-
customs.AUTH_PORT = String(appConfig.port);
|
|
303
|
-
customs.AUTH_URL = `http://localhost:${appConfig.port}`;
|
|
304
|
-
customs.BETTER_AUTH_SECRET = `better-auth-${Date.now()}-${generateSecurePassword(16)}`;
|
|
305
|
-
customs.BETTER_AUTH_URL = `http://localhost:${appConfig.port}`;
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
if (customs.BETTER_AUTH_SECRET) {
|
|
309
|
-
const allPorts = Object.values(workspace.apps).map((a) => a.port);
|
|
310
|
-
customs.BETTER_AUTH_TRUSTED_ORIGINS = allPorts.map((p) => `http://localhost:${p}`).join(",");
|
|
311
|
-
}
|
|
312
|
-
return customs;
|
|
313
|
-
}
|
|
314
|
-
/**
|
|
315
|
-
* Extract *_DB_PASSWORD keys from secrets and write docker/.env.
|
|
316
|
-
*
|
|
317
|
-
* The docker/.env file contains database passwords that the PostgreSQL
|
|
318
|
-
* init script reads to create per-app database users.
|
|
319
|
-
*/
|
|
320
|
-
async function writeDockerEnvFromSecrets(secrets, workspaceRoot) {
|
|
321
|
-
const dbPasswordEntries = Object.entries(secrets.custom).filter(([key]) => key.endsWith("_DB_PASSWORD"));
|
|
322
|
-
if (secrets.services.pgboss && !dbPasswordEntries.some(([key]) => key === "PGBOSS_DB_PASSWORD")) dbPasswordEntries.push(["PGBOSS_DB_PASSWORD", secrets.services.pgboss.password]);
|
|
323
|
-
if (dbPasswordEntries.length === 0) return;
|
|
324
|
-
const envContent = `# Auto-generated docker environment file
|
|
325
|
-
# Contains database passwords for docker-compose postgres init
|
|
326
|
-
# This file is gitignored - do not commit to version control
|
|
327
|
-
${dbPasswordEntries.map(([key, value]) => `${key}=${value}`).join("\n")}
|
|
328
|
-
`;
|
|
329
|
-
const envPath = join(workspaceRoot, "docker", ".env");
|
|
330
|
-
await mkdir(dirname(envPath), { recursive: true });
|
|
331
|
-
await writeFile(envPath, envContent);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
//#endregion
|
|
335
|
-
export { createStageSecrets, generateConnectionUrls, generateDbPassword, generateDbUrl, generateFullstackCustomSecrets, generateLocalStackCredentials, generatePgBossUrl, generateSecurePassword, generateServiceCredentials, rotateServicePassword, writeDockerEnvFromSecrets };
|
|
336
|
-
//# sourceMappingURL=fullstack-secrets-l8s3II_H.mjs.map
|
|
252
|
+
export { createStageSecrets, generateConnectionUrls, generatePgBossUrl, generateSecurePassword, generateServiceCredentials, rotateServicePassword };
|
|
253
|
+
//# sourceMappingURL=generator-VE2JrFlY.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator-VE2JrFlY.mjs","names":["SERVICE_DEFAULTS: Record<\n\tComposeServiceName,\n\tOmit<ServiceCredentials, 'password'>\n>","PGBOSS_DEFAULTS: Omit<ServiceCredentials, 'password'>","service: ComposeServiceName","services: ComposeServiceName[]","result: StageSecrets['services']","creds: ServiceCredentials","eventsBackend: EventsBackend","services: StageSecrets['services']","eventsBackend?: EventsBackend","urls: StageSecrets['urls']","stage: string","options?: { projectName?: string; eventsBackend?: EventsBackend }","secrets: StageSecrets","newCreds: ServiceCredentials"],"sources":["../src/secrets/generator.ts"],"sourcesContent":["import { randomBytes } from 'node:crypto';\nimport type { ComposeServiceName, EventsBackend } from '../types';\nimport type { ServiceCredentials, StageSecrets } from './types';\n\n/**\n * Generate a secure random password using URL-safe base64 characters.\n * @param length Password length (default: 32)\n */\nexport function generateSecurePassword(length = 32): string {\n\treturn randomBytes(Math.ceil((length * 3) / 4))\n\t\t.toString('base64url')\n\t\t.slice(0, length);\n}\n\n/** Default service configurations (localhost for local dev via Docker port mapping) */\nconst SERVICE_DEFAULTS: Record<\n\tComposeServiceName,\n\tOmit<ServiceCredentials, 'password'>\n> = {\n\tpostgres: {\n\t\thost: 'localhost',\n\t\tport: 5432,\n\t\tusername: 'app',\n\t\tdatabase: 'app',\n\t},\n\tredis: {\n\t\thost: 'localhost',\n\t\tport: 6379,\n\t\tusername: 'default',\n\t},\n\trabbitmq: {\n\t\thost: 'localhost',\n\t\tport: 5672,\n\t\tusername: 'app',\n\t\tvhost: '/',\n\t},\n\tminio: {\n\t\thost: 'localhost',\n\t\tport: 9000,\n\t\tusername: 'app',\n\t\tbucket: 'app',\n\t},\n\tmailpit: {\n\t\thost: 'localhost',\n\t\tport: 1025,\n\t\tusername: 'app',\n\t},\n\tlocalstack: {\n\t\thost: 'localhost',\n\t\tport: 4566,\n\t\tusername: 'localstack',\n\t\tregion: 'us-east-1',\n\t},\n};\n\n/** Default credentials for pgboss (not a Docker service, reuses postgres) */\nconst PGBOSS_DEFAULTS: Omit<ServiceCredentials, 'password'> = {\n\thost: 'localhost',\n\tport: 5432,\n\tusername: 'pgboss',\n\tdatabase: 'app',\n};\n\n/**\n * Generate credentials for a specific service.\n */\nexport function generateServiceCredentials(\n\tservice: ComposeServiceName,\n): ServiceCredentials {\n\tconst defaults = SERVICE_DEFAULTS[service];\n\treturn {\n\t\t...defaults,\n\t\tpassword: generateSecurePassword(),\n\t};\n}\n\n/**\n * Generate credentials for multiple services.\n */\nexport function generateServicesCredentials(\n\tservices: ComposeServiceName[],\n): StageSecrets['services'] {\n\tconst result: StageSecrets['services'] = {};\n\n\tfor (const service of services) {\n\t\tresult[service] = generateServiceCredentials(service);\n\t}\n\n\treturn result;\n}\n\n/**\n * Generate connection URL for PostgreSQL.\n */\nexport function generatePostgresUrl(creds: ServiceCredentials): string {\n\tconst { username, password, host, port, database } = creds;\n\treturn `postgresql://${username}:${encodeURIComponent(password)}@${host}:${port}/${database}`;\n}\n\n/**\n * Generate connection URL for Redis.\n */\nexport function generateRedisUrl(creds: ServiceCredentials): string {\n\tconst { password, host, port } = creds;\n\treturn `redis://:${encodeURIComponent(password)}@${host}:${port}`;\n}\n\n/**\n * Generate connection URL for RabbitMQ.\n */\nexport function generateRabbitmqUrl(creds: ServiceCredentials): string {\n\tconst { username, password, host, port, vhost } = creds;\n\tconst encodedVhost = encodeURIComponent(vhost ?? '/');\n\treturn `amqp://${username}:${encodeURIComponent(password)}@${host}:${port}/${encodedVhost}`;\n}\n\n/**\n * Generate endpoint URL for MinIO (S3-compatible).\n */\nexport function generateMinioEndpoint(creds: ServiceCredentials): string {\n\tconst { host, port } = creds;\n\treturn `http://${host}:${port}`;\n}\n\n/**\n * Generate a LocalStack-compatible access key ID.\n * Must start with 'LSIA' prefix and be at least 20 characters.\n * @see https://docs.localstack.cloud/aws/capabilities/config/credentials/\n */\nexport function generateLocalStackAccessKeyId(): string {\n\tconst suffix = randomBytes(12).toString('base64url').slice(0, 16);\n\treturn `LSIA${suffix}`;\n}\n\n/**\n * Generate connection URL for pg-boss (uses PostgreSQL protocol).\n * Format: pgboss://user:pass@host:port/db?schema=pgboss\n */\nexport function generatePgBossUrl(creds: ServiceCredentials): string {\n\tconst { username, password, host, port, database } = creds;\n\treturn `pgboss://${username}:${encodeURIComponent(password)}@${host}:${port}/${database}?schema=pgboss`;\n}\n\n/**\n * Generate event connection strings based on the events backend.\n */\nexport function generateEventConnectionStrings(\n\teventsBackend: EventsBackend,\n\tservices: StageSecrets['services'],\n): { publisher: string; subscriber: string } {\n\tswitch (eventsBackend) {\n\t\tcase 'pgboss': {\n\t\t\tconst creds = services.pgboss;\n\t\t\tif (!creds) {\n\t\t\t\tthrow new Error('pgboss credentials required for pgboss events');\n\t\t\t}\n\t\t\tconst url = generatePgBossUrl(creds);\n\t\t\treturn { publisher: url, subscriber: url };\n\t\t}\n\t\tcase 'sns': {\n\t\t\tconst creds = services.localstack;\n\t\t\tif (!creds) {\n\t\t\t\tthrow new Error('localstack credentials required for sns events');\n\t\t\t}\n\t\t\tconst endpoint = `http://${creds.host}:${creds.port}`;\n\t\t\tconst region = creds.region ?? 'us-east-1';\n\t\t\tconst accessKeyId = creds.accessKeyId ?? creds.username;\n\t\t\tconst secretKey = encodeURIComponent(creds.password);\n\t\t\treturn {\n\t\t\t\tpublisher: `sns://${accessKeyId}:${secretKey}@${creds.host}:${creds.port}?region=${region}&endpoint=${encodeURIComponent(endpoint)}`,\n\t\t\t\tsubscriber: `sqs://${accessKeyId}:${secretKey}@${creds.host}:${creds.port}?region=${region}&endpoint=${encodeURIComponent(endpoint)}`,\n\t\t\t};\n\t\t}\n\t\tcase 'rabbitmq': {\n\t\t\tconst creds = services.rabbitmq;\n\t\t\tif (!creds) {\n\t\t\t\tthrow new Error('rabbitmq credentials required for rabbitmq events');\n\t\t\t}\n\t\t\tconst url = generateRabbitmqUrl(creds);\n\t\t\treturn { publisher: url, subscriber: url };\n\t\t}\n\t}\n}\n\n/**\n * Generate connection URLs from service credentials.\n */\nexport function generateConnectionUrls(\n\tservices: StageSecrets['services'],\n\teventsBackend?: EventsBackend,\n): StageSecrets['urls'] {\n\tconst urls: StageSecrets['urls'] = {};\n\n\tif (services.postgres) {\n\t\turls.DATABASE_URL = generatePostgresUrl(services.postgres);\n\t}\n\n\tif (services.redis) {\n\t\turls.REDIS_URL = generateRedisUrl(services.redis);\n\t}\n\n\tif (services.rabbitmq) {\n\t\turls.RABBITMQ_URL = generateRabbitmqUrl(services.rabbitmq);\n\t}\n\n\tif (services.minio) {\n\t\turls.STORAGE_ENDPOINT = generateMinioEndpoint(services.minio);\n\t}\n\n\tif (eventsBackend) {\n\t\tconst eventUrls = generateEventConnectionStrings(eventsBackend, services);\n\t\turls.EVENT_PUBLISHER_CONNECTION_STRING = eventUrls.publisher;\n\t\turls.EVENT_SUBSCRIBER_CONNECTION_STRING = eventUrls.subscriber;\n\t} else if (services.pgboss) {\n\t\t// Default to pgboss when credentials exist but no explicit events backend\n\t\tconst pgbossUrl = generatePgBossUrl(services.pgboss);\n\t\turls.EVENT_PUBLISHER_CONNECTION_STRING = pgbossUrl;\n\t\turls.EVENT_SUBSCRIBER_CONNECTION_STRING = pgbossUrl;\n\t}\n\n\tif (services.mailpit) {\n\t\turls.SMTP_HOST = services.mailpit.host;\n\t\turls.SMTP_PORT = String(services.mailpit.port);\n\t}\n\n\treturn urls;\n}\n\n/**\n * Generate LocalStack service credentials with LSIA-prefixed access key.\n */\nexport function generateLocalStackCredentials(): ServiceCredentials {\n\tconst defaults = SERVICE_DEFAULTS.localstack;\n\treturn {\n\t\t...defaults,\n\t\tpassword: generateSecurePassword(),\n\t\taccessKeyId: generateLocalStackAccessKeyId(),\n\t};\n}\n\n/**\n * Create a new StageSecrets object with generated credentials.\n * @param stage - The deployment stage (e.g., 'development', 'production')\n * @param services - List of services to generate credentials for\n * @param options - Optional configuration\n * @param options.projectName - Project name used to derive the database name (e.g., 'myapp' → 'myapp_dev')\n * @param options.eventsBackend - Event backend type (pgboss, sns, rabbitmq)\n */\nexport function createStageSecrets(\n\tstage: string,\n\tservices: ComposeServiceName[],\n\toptions?: { projectName?: string; eventsBackend?: EventsBackend },\n): StageSecrets {\n\tconst now = new Date().toISOString();\n\tconst serviceCredentials = generateServicesCredentials(services);\n\n\t// Override service defaults with project-derived names if provided\n\tif (options?.projectName) {\n\t\tif (serviceCredentials.postgres) {\n\t\t\tserviceCredentials.postgres.database = `${options.projectName.replace(/-/g, '_')}_dev`;\n\t\t}\n\t\tif (serviceCredentials.minio) {\n\t\t\tserviceCredentials.minio.bucket = options.projectName;\n\t\t\tserviceCredentials.minio.username = options.projectName;\n\t\t}\n\t}\n\n\t// Always create pgboss credentials when postgres is available.\n\t// pgboss reuses postgres host/port/database but with a dedicated user,\n\t// so subscribers work out of the box without explicit events config.\n\tif (serviceCredentials.postgres && !serviceCredentials.pgboss) {\n\t\tserviceCredentials.pgboss = {\n\t\t\t...PGBOSS_DEFAULTS,\n\t\t\tpassword: generateSecurePassword(),\n\t\t\thost: serviceCredentials.postgres.host,\n\t\t\tport: serviceCredentials.postgres.port,\n\t\t\tdatabase: serviceCredentials.postgres.database,\n\t\t};\n\t}\n\n\t// Generate event-specific credentials\n\tconst eventsBackend = options?.eventsBackend;\n\tif (eventsBackend === 'sns') {\n\t\t// LocalStack credentials with LSIA-prefixed access key\n\t\tserviceCredentials.localstack = generateLocalStackCredentials();\n\t}\n\n\tconst urls = generateConnectionUrls(serviceCredentials, eventsBackend);\n\n\treturn {\n\t\tstage,\n\t\tcreatedAt: now,\n\t\tupdatedAt: now,\n\t\teventsBackend,\n\t\tservices: serviceCredentials,\n\t\turls,\n\t\tcustom: {},\n\t};\n}\n\n/**\n * Rotate password for a specific service.\n */\nexport function rotateServicePassword(\n\tsecrets: StageSecrets,\n\tservice: ComposeServiceName,\n): StageSecrets {\n\tconst currentCreds = secrets.services[service];\n\tif (!currentCreds) {\n\t\tthrow new Error(`Service \"${service}\" not configured in secrets`);\n\t}\n\n\tconst newCreds: ServiceCredentials = {\n\t\t...currentCreds,\n\t\tpassword: generateSecurePassword(),\n\t};\n\n\tconst newServices = {\n\t\t...secrets.services,\n\t\t[service]: newCreds,\n\t};\n\n\treturn {\n\t\t...secrets,\n\t\tupdatedAt: new Date().toISOString(),\n\t\tservices: newServices,\n\t\turls: generateConnectionUrls(newServices, secrets.eventsBackend),\n\t};\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,uBAAuB,SAAS,IAAY;AAC3D,QAAO,YAAY,KAAK,KAAM,SAAS,IAAK,EAAE,CAAC,CAC7C,SAAS,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,aAAa,mBAAmB,OACtD,oBAAmB,SAAS;EAC3B,GAAG;EACH,UAAU,wBAAwB;EAClC,MAAM,mBAAmB,SAAS;EAClC,MAAM,mBAAmB,SAAS;EAClC,UAAU,mBAAmB,SAAS;CACtC;CAIF,MAAM,gBAAgB,SAAS;AAC/B,KAAI,kBAAkB,MAErB,oBAAmB,aAAa,+BAA+B;CAGhE,MAAM,OAAO,uBAAuB,oBAAoB,cAAc;AAEtE,QAAO;EACN;EACA,WAAW;EACX,WAAW;EACX;EACA,UAAU;EACV;EACA,QAAQ,CAAE;CACV;AACD;;;;AAKD,SAAgB,sBACfC,SACAV,SACe;CACf,MAAM,eAAe,QAAQ,SAAS;AACtC,MAAK,aACJ,OAAM,IAAI,OAAO,WAAW,QAAQ;CAGrC,MAAMW,WAA+B;EACpC,GAAG;EACH,UAAU,wBAAwB;CAClC;CAED,MAAM,cAAc;EACnB,GAAG,QAAQ;GACV,UAAU;CACX;AAED,QAAO;EACN,GAAG;EACH,WAAW,qBAAI,QAAO,aAAa;EACnC,UAAU;EACV,MAAM,uBAAuB,aAAa,QAAQ,cAAc;CAChE;AACD"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { AppsRecord, Framework, GkmConfig, InferredWorkspaceConfig, LoadedConfig, NormalizedWorkspace, Routes, WorkspaceConfig, WorkspaceInput } from "./types-C-arnQ1r.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/workspace/publicEnv.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* All public env-var prefixes the toolbox understands.
|
|
7
|
+
*
|
|
8
|
+
* Used when resolving incoming var names back to a dependency
|
|
9
|
+
* (e.g. `VITE_AUTH_URL` → `auth`). A var matching any of these
|
|
10
|
+
* is considered safe to inline into a client bundle.
|
|
11
|
+
*/
|
|
12
|
+
declare const PUBLIC_ENV_PREFIXES: readonly ["NEXT_PUBLIC_", "VITE_", "EXPO_PUBLIC_"];
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the public env-var prefix that a frontend framework's bundler
|
|
15
|
+
* inlines into client code at build time:
|
|
16
|
+
*
|
|
17
|
+
* - `nextjs` → `NEXT_PUBLIC_`
|
|
18
|
+
* - `vite` → `VITE_`
|
|
19
|
+
* - `tanstack-start` → `VITE_` (uses Vite under the hood)
|
|
20
|
+
* - `expo` → `EXPO_PUBLIC_`
|
|
21
|
+
* - `remix` → `''` (Remix exposes via loaders, no prefix convention)
|
|
22
|
+
*
|
|
23
|
+
* For backend frameworks or unspecified, falls back to `NEXT_PUBLIC_` to
|
|
24
|
+
* preserve the historical default. Backend apps never read these vars
|
|
25
|
+
* from a bundle, so the prefix only affects scaffolding/symmetry.
|
|
26
|
+
*/
|
|
27
|
+
declare function getPublicEnvPrefix(framework?: Framework): string;
|
|
28
|
+
/**
|
|
29
|
+
* Strip a known public prefix from a var name.
|
|
30
|
+
* Returns the un-prefixed name, or `null` if no prefix matched.
|
|
31
|
+
*/
|
|
32
|
+
declare function stripPublicPrefix(name: string): string | null;
|
|
33
|
+
//# sourceMappingURL=publicEnv.d.ts.map
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/workspace/index.d.ts
|
|
37
|
+
/**
|
|
38
|
+
* Define workspace configuration with full TypeScript support and type inference.
|
|
39
|
+
*
|
|
40
|
+
* Uses `const` type parameter to infer literal app names, providing:
|
|
41
|
+
* - Autocomplete for app names in dependencies
|
|
42
|
+
* - Type errors for invalid dependency references
|
|
43
|
+
* - Full type inference for the returned config
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* // gkm.config.ts
|
|
48
|
+
* import { defineWorkspace } from '@geekmidas/cli';
|
|
49
|
+
*
|
|
50
|
+
* export default defineWorkspace({
|
|
51
|
+
* name: 'my-saas',
|
|
52
|
+
* apps: {
|
|
53
|
+
* api: {
|
|
54
|
+
* type: 'backend',
|
|
55
|
+
* path: 'apps/api',
|
|
56
|
+
* port: 3000,
|
|
57
|
+
* routes: './src/endpoints/**\/*.ts',
|
|
58
|
+
* envParser: './src/config/env',
|
|
59
|
+
* logger: './src/logger',
|
|
60
|
+
* },
|
|
61
|
+
* web: {
|
|
62
|
+
* type: 'web',
|
|
63
|
+
* framework: 'nextjs',
|
|
64
|
+
* path: 'apps/web',
|
|
65
|
+
* port: 3001,
|
|
66
|
+
* dependencies: ['api'], // <- autocomplete shows 'api' | 'web'
|
|
67
|
+
* },
|
|
68
|
+
* },
|
|
69
|
+
* services: {
|
|
70
|
+
* db: true,
|
|
71
|
+
* cache: true,
|
|
72
|
+
* },
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* // config.apps.api <- full type inference
|
|
76
|
+
* // config.apps.foo <- TypeScript error
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
declare function defineWorkspace<const TApps extends AppsRecord>(config: WorkspaceInput<TApps>): InferredWorkspaceConfig<TApps>;
|
|
80
|
+
/**
|
|
81
|
+
* Normalize a workspace configuration with resolved defaults.
|
|
82
|
+
*/
|
|
83
|
+
declare function normalizeWorkspace(config: WorkspaceConfig, cwd: string): NormalizedWorkspace;
|
|
84
|
+
/**
|
|
85
|
+
* Wrap a single-app GkmConfig as a workspace.
|
|
86
|
+
* This allows existing single-app configs to work seamlessly.
|
|
87
|
+
*/
|
|
88
|
+
declare function wrapSingleAppAsWorkspace(config: GkmConfig, cwd: string): NormalizedWorkspace;
|
|
89
|
+
/**
|
|
90
|
+
* Process a loaded configuration (either single-app or workspace).
|
|
91
|
+
* Returns a normalized workspace in both cases.
|
|
92
|
+
*/
|
|
93
|
+
declare function processConfig(config: GkmConfig | WorkspaceConfig, cwd: string): LoadedConfig;
|
|
94
|
+
/**
|
|
95
|
+
* The workspace's own constructs globs, absolute.
|
|
96
|
+
*
|
|
97
|
+
* Infrastructure two apps share is a fact about the product, and declaring it
|
|
98
|
+
* inside one of them makes moving that app a change to the other's database.
|
|
99
|
+
*/
|
|
100
|
+
declare function workspaceConstructGlobs(workspace: NormalizedWorkspace): string[];
|
|
101
|
+
/**
|
|
102
|
+
* Every constructs glob an app can see, absolute.
|
|
103
|
+
*
|
|
104
|
+
* The workspace's own first, then the app's. Absolute because the app builds
|
|
105
|
+
* from its own directory while the workspace's constructs live above it —
|
|
106
|
+
* a relative glob resolved from the app would look for the product's
|
|
107
|
+
* infrastructure inside one of its consumers and find nothing.
|
|
108
|
+
*
|
|
109
|
+
* Additive, not overriding: an app that declares its own constructs still sees
|
|
110
|
+
* the ones the workspace declared for everybody.
|
|
111
|
+
*/
|
|
112
|
+
declare function appConstructGlobs(workspace: NormalizedWorkspace, appName: string): string[];
|
|
113
|
+
/**
|
|
114
|
+
* Every constructs glob in the workspace: its own, plus each app's.
|
|
115
|
+
*
|
|
116
|
+
* One list, so what a deploy provisions and what an app's entry point
|
|
117
|
+
* registers drivers for are read off the same globs.
|
|
118
|
+
*/
|
|
119
|
+
declare function allConstructGlobs(workspace: NormalizedWorkspace): string[];
|
|
120
|
+
/** A `Routes` in any of its accepted shapes, as a flat list of patterns. */
|
|
121
|
+
declare function constructPatterns(routes: Routes | undefined): string[];
|
|
122
|
+
/**
|
|
123
|
+
* Get the GkmConfig for a specific app in a workspace.
|
|
124
|
+
* Useful for running existing single-app commands on a specific app.
|
|
125
|
+
*/
|
|
126
|
+
declare function getAppGkmConfig(workspace: NormalizedWorkspace, appName: string): GkmConfig | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Get topologically sorted app names based on dependencies.
|
|
129
|
+
* Apps with no dependencies come first, then apps that depend on them.
|
|
130
|
+
*/
|
|
131
|
+
declare function getAppBuildOrder(workspace: NormalizedWorkspace): string[];
|
|
132
|
+
/**
|
|
133
|
+
* Generate environment variables for app dependencies.
|
|
134
|
+
*
|
|
135
|
+
* Each dependency gets the un-prefixed `{DEP}_URL` (for server-side use) and,
|
|
136
|
+
* when the consuming app's framework supports a public-var prefix, also the
|
|
137
|
+
* prefixed form (e.g. `NEXT_PUBLIC_{DEP}_URL` for Next.js, `VITE_{DEP}_URL`
|
|
138
|
+
* for Vite/TanStack Start). The prefixed form is what gets bundled into the
|
|
139
|
+
* client at build time.
|
|
140
|
+
*/
|
|
141
|
+
declare function getDependencyEnvVars(workspace: NormalizedWorkspace, appName: string, urlPrefix?: string): Record<string, string>;
|
|
142
|
+
/**
|
|
143
|
+
* Resolve the Dokploy endpoint for a specific stage.
|
|
144
|
+
*
|
|
145
|
+
* Uses per-stage endpoint from `endpoints` if available,
|
|
146
|
+
* otherwise falls back to the global `endpoint`.
|
|
147
|
+
*
|
|
148
|
+
* @param dokployConfig - Dokploy workspace configuration
|
|
149
|
+
* @param stage - Deployment stage (e.g., 'development', 'production')
|
|
150
|
+
* @returns The endpoint URL for the stage, or undefined if not configured
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* // With per-stage endpoints
|
|
155
|
+
* const config = {
|
|
156
|
+
* endpoints: {
|
|
157
|
+
* development: 'https://dev.dokploy.example.com:3000',
|
|
158
|
+
* production: 'https://prod.dokploy.example.com:3000',
|
|
159
|
+
* },
|
|
160
|
+
* };
|
|
161
|
+
* getEndpointForStage(config, 'production'); // => 'https://prod.dokploy.example.com:3000'
|
|
162
|
+
*
|
|
163
|
+
* // With single endpoint
|
|
164
|
+
* const config = { endpoint: 'https://dokploy.example.com:3000' };
|
|
165
|
+
* getEndpointForStage(config, 'production'); // => 'https://dokploy.example.com:3000'
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
declare function getEndpointForStage(dokployConfig: {
|
|
169
|
+
endpoint?: string;
|
|
170
|
+
endpoints?: Record<string, string>;
|
|
171
|
+
} | undefined, stage: string): string | undefined;
|
|
172
|
+
//# sourceMappingURL=index.d.ts.map
|
|
173
|
+
//#endregion
|
|
174
|
+
export { PUBLIC_ENV_PREFIXES, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getEndpointForStage, getPublicEnvPrefix, normalizeWorkspace, processConfig, stripPublicPrefix, workspaceConstructGlobs, wrapSingleAppAsWorkspace };
|
|
175
|
+
//# sourceMappingURL=index-BThUzEIp.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-BThUzEIp.d.mts","names":[],"sources":["../src/workspace/publicEnv.ts","../src/workspace/index.ts"],"sourcesContent":[],"mappings":";;;;;;AASA;AAoBA;AAoBA;;;cAxCa;AC0Hb;;;;;;;AAE0B;AA8B1B;;;;AAGsB;AA8CtB;AAAwC,iBDvLxB,kBAAA,CCuLwB,SAAA,CAAA,EDvLO,SCuLP,CAAA,EAAA,MAAA;;;AAGlB;AA6EtB;AAA6B,iBDnPb,iBAAA,CCmPa,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,IAAA;;;;;;;;AAjK7B;;;;;;;AAE0B;AA8B1B;;;;AAGsB;AA8CtB;;;;AAGsB;AA6EtB;;;;;AAGe;AA6Bf;AAmBA;AAwBA;AAaA;AAiBA;;;;AAGY;AAuCZ;AAmCA;;;;AAIS;AAgDO,iBA3YA,eA6YqB,CAAA,oBA7Ye,UA6YT,CAAA,CAAA,MAAA,EA5YlC,cA4YkC,CA5YnB,KA4YmB,CAAA,CAAA,EA3YxC,uBA2YwC,CA3YhB,KA2YgB,CAAA;;;;iBA7W3B,kBAAA,SACP,+BAEN;;;;;iBA8Ca,wBAAA,SACP,yBAEN;;;;;iBA6Ea,aAAA,SACP,YAAY,+BAElB;;;;;;;iBA6Ba,uBAAA,YACJ;;;;;;;;;;;;iBAkBI,iBAAA,YACJ;;;;;;;iBAuBI,iBAAA,YAA6B;;iBAa7B,iBAAA,SAA0B;;;;;iBAiB1B,eAAA,YACJ,uCAET;;;;;iBAuCa,gBAAA,YAA4B;;;;;;;;;;iBAmC5B,oBAAA,YACJ,2DAGT;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgDa,mBAAA;;cAEqB"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { AppsRecord, Framework, GkmConfig, InferredWorkspaceConfig, LoadedConfig, NormalizedWorkspace, Routes, WorkspaceConfig, WorkspaceInput } from "./types-abJQuk7m.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/workspace/publicEnv.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* All public env-var prefixes the toolbox understands.
|
|
7
|
+
*
|
|
8
|
+
* Used when resolving incoming var names back to a dependency
|
|
9
|
+
* (e.g. `VITE_AUTH_URL` → `auth`). A var matching any of these
|
|
10
|
+
* is considered safe to inline into a client bundle.
|
|
11
|
+
*/
|
|
12
|
+
declare const PUBLIC_ENV_PREFIXES: readonly ["NEXT_PUBLIC_", "VITE_", "EXPO_PUBLIC_"];
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the public env-var prefix that a frontend framework's bundler
|
|
15
|
+
* inlines into client code at build time:
|
|
16
|
+
*
|
|
17
|
+
* - `nextjs` → `NEXT_PUBLIC_`
|
|
18
|
+
* - `vite` → `VITE_`
|
|
19
|
+
* - `tanstack-start` → `VITE_` (uses Vite under the hood)
|
|
20
|
+
* - `expo` → `EXPO_PUBLIC_`
|
|
21
|
+
* - `remix` → `''` (Remix exposes via loaders, no prefix convention)
|
|
22
|
+
*
|
|
23
|
+
* For backend frameworks or unspecified, falls back to `NEXT_PUBLIC_` to
|
|
24
|
+
* preserve the historical default. Backend apps never read these vars
|
|
25
|
+
* from a bundle, so the prefix only affects scaffolding/symmetry.
|
|
26
|
+
*/
|
|
27
|
+
declare function getPublicEnvPrefix(framework?: Framework): string;
|
|
28
|
+
/**
|
|
29
|
+
* Strip a known public prefix from a var name.
|
|
30
|
+
* Returns the un-prefixed name, or `null` if no prefix matched.
|
|
31
|
+
*/
|
|
32
|
+
declare function stripPublicPrefix(name: string): string | null;
|
|
33
|
+
//# sourceMappingURL=publicEnv.d.ts.map
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
//#region src/workspace/index.d.ts
|
|
37
|
+
/**
|
|
38
|
+
* Define workspace configuration with full TypeScript support and type inference.
|
|
39
|
+
*
|
|
40
|
+
* Uses `const` type parameter to infer literal app names, providing:
|
|
41
|
+
* - Autocomplete for app names in dependencies
|
|
42
|
+
* - Type errors for invalid dependency references
|
|
43
|
+
* - Full type inference for the returned config
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* // gkm.config.ts
|
|
48
|
+
* import { defineWorkspace } from '@geekmidas/cli';
|
|
49
|
+
*
|
|
50
|
+
* export default defineWorkspace({
|
|
51
|
+
* name: 'my-saas',
|
|
52
|
+
* apps: {
|
|
53
|
+
* api: {
|
|
54
|
+
* type: 'backend',
|
|
55
|
+
* path: 'apps/api',
|
|
56
|
+
* port: 3000,
|
|
57
|
+
* routes: './src/endpoints/**\/*.ts',
|
|
58
|
+
* envParser: './src/config/env',
|
|
59
|
+
* logger: './src/logger',
|
|
60
|
+
* },
|
|
61
|
+
* web: {
|
|
62
|
+
* type: 'web',
|
|
63
|
+
* framework: 'nextjs',
|
|
64
|
+
* path: 'apps/web',
|
|
65
|
+
* port: 3001,
|
|
66
|
+
* dependencies: ['api'], // <- autocomplete shows 'api' | 'web'
|
|
67
|
+
* },
|
|
68
|
+
* },
|
|
69
|
+
* services: {
|
|
70
|
+
* db: true,
|
|
71
|
+
* cache: true,
|
|
72
|
+
* },
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* // config.apps.api <- full type inference
|
|
76
|
+
* // config.apps.foo <- TypeScript error
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
declare function defineWorkspace<const TApps extends AppsRecord>(config: WorkspaceInput<TApps>): InferredWorkspaceConfig<TApps>;
|
|
80
|
+
/**
|
|
81
|
+
* Normalize a workspace configuration with resolved defaults.
|
|
82
|
+
*/
|
|
83
|
+
declare function normalizeWorkspace(config: WorkspaceConfig, cwd: string): NormalizedWorkspace;
|
|
84
|
+
/**
|
|
85
|
+
* Wrap a single-app GkmConfig as a workspace.
|
|
86
|
+
* This allows existing single-app configs to work seamlessly.
|
|
87
|
+
*/
|
|
88
|
+
declare function wrapSingleAppAsWorkspace(config: GkmConfig, cwd: string): NormalizedWorkspace;
|
|
89
|
+
/**
|
|
90
|
+
* Process a loaded configuration (either single-app or workspace).
|
|
91
|
+
* Returns a normalized workspace in both cases.
|
|
92
|
+
*/
|
|
93
|
+
declare function processConfig(config: GkmConfig | WorkspaceConfig, cwd: string): LoadedConfig;
|
|
94
|
+
/**
|
|
95
|
+
* The workspace's own constructs globs, absolute.
|
|
96
|
+
*
|
|
97
|
+
* Infrastructure two apps share is a fact about the product, and declaring it
|
|
98
|
+
* inside one of them makes moving that app a change to the other's database.
|
|
99
|
+
*/
|
|
100
|
+
declare function workspaceConstructGlobs(workspace: NormalizedWorkspace): string[];
|
|
101
|
+
/**
|
|
102
|
+
* Every constructs glob an app can see, absolute.
|
|
103
|
+
*
|
|
104
|
+
* The workspace's own first, then the app's. Absolute because the app builds
|
|
105
|
+
* from its own directory while the workspace's constructs live above it —
|
|
106
|
+
* a relative glob resolved from the app would look for the product's
|
|
107
|
+
* infrastructure inside one of its consumers and find nothing.
|
|
108
|
+
*
|
|
109
|
+
* Additive, not overriding: an app that declares its own constructs still sees
|
|
110
|
+
* the ones the workspace declared for everybody.
|
|
111
|
+
*/
|
|
112
|
+
declare function appConstructGlobs(workspace: NormalizedWorkspace, appName: string): string[];
|
|
113
|
+
/**
|
|
114
|
+
* Every constructs glob in the workspace: its own, plus each app's.
|
|
115
|
+
*
|
|
116
|
+
* One list, so what a deploy provisions and what an app's entry point
|
|
117
|
+
* registers drivers for are read off the same globs.
|
|
118
|
+
*/
|
|
119
|
+
declare function allConstructGlobs(workspace: NormalizedWorkspace): string[];
|
|
120
|
+
/** A `Routes` in any of its accepted shapes, as a flat list of patterns. */
|
|
121
|
+
declare function constructPatterns(routes: Routes | undefined): string[];
|
|
122
|
+
/**
|
|
123
|
+
* Get the GkmConfig for a specific app in a workspace.
|
|
124
|
+
* Useful for running existing single-app commands on a specific app.
|
|
125
|
+
*/
|
|
126
|
+
declare function getAppGkmConfig(workspace: NormalizedWorkspace, appName: string): GkmConfig | undefined;
|
|
127
|
+
/**
|
|
128
|
+
* Get topologically sorted app names based on dependencies.
|
|
129
|
+
* Apps with no dependencies come first, then apps that depend on them.
|
|
130
|
+
*/
|
|
131
|
+
declare function getAppBuildOrder(workspace: NormalizedWorkspace): string[];
|
|
132
|
+
/**
|
|
133
|
+
* Generate environment variables for app dependencies.
|
|
134
|
+
*
|
|
135
|
+
* Each dependency gets the un-prefixed `{DEP}_URL` (for server-side use) and,
|
|
136
|
+
* when the consuming app's framework supports a public-var prefix, also the
|
|
137
|
+
* prefixed form (e.g. `NEXT_PUBLIC_{DEP}_URL` for Next.js, `VITE_{DEP}_URL`
|
|
138
|
+
* for Vite/TanStack Start). The prefixed form is what gets bundled into the
|
|
139
|
+
* client at build time.
|
|
140
|
+
*/
|
|
141
|
+
declare function getDependencyEnvVars(workspace: NormalizedWorkspace, appName: string, urlPrefix?: string): Record<string, string>;
|
|
142
|
+
/**
|
|
143
|
+
* Resolve the Dokploy endpoint for a specific stage.
|
|
144
|
+
*
|
|
145
|
+
* Uses per-stage endpoint from `endpoints` if available,
|
|
146
|
+
* otherwise falls back to the global `endpoint`.
|
|
147
|
+
*
|
|
148
|
+
* @param dokployConfig - Dokploy workspace configuration
|
|
149
|
+
* @param stage - Deployment stage (e.g., 'development', 'production')
|
|
150
|
+
* @returns The endpoint URL for the stage, or undefined if not configured
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```ts
|
|
154
|
+
* // With per-stage endpoints
|
|
155
|
+
* const config = {
|
|
156
|
+
* endpoints: {
|
|
157
|
+
* development: 'https://dev.dokploy.example.com:3000',
|
|
158
|
+
* production: 'https://prod.dokploy.example.com:3000',
|
|
159
|
+
* },
|
|
160
|
+
* };
|
|
161
|
+
* getEndpointForStage(config, 'production'); // => 'https://prod.dokploy.example.com:3000'
|
|
162
|
+
*
|
|
163
|
+
* // With single endpoint
|
|
164
|
+
* const config = { endpoint: 'https://dokploy.example.com:3000' };
|
|
165
|
+
* getEndpointForStage(config, 'production'); // => 'https://dokploy.example.com:3000'
|
|
166
|
+
* ```
|
|
167
|
+
*/
|
|
168
|
+
declare function getEndpointForStage(dokployConfig: {
|
|
169
|
+
endpoint?: string;
|
|
170
|
+
endpoints?: Record<string, string>;
|
|
171
|
+
} | undefined, stage: string): string | undefined;
|
|
172
|
+
//# sourceMappingURL=index.d.ts.map
|
|
173
|
+
//#endregion
|
|
174
|
+
export { PUBLIC_ENV_PREFIXES, allConstructGlobs, appConstructGlobs, constructPatterns, defineWorkspace, getAppBuildOrder, getAppGkmConfig, getDependencyEnvVars, getEndpointForStage, getPublicEnvPrefix, normalizeWorkspace, processConfig, stripPublicPrefix, workspaceConstructGlobs, wrapSingleAppAsWorkspace };
|
|
175
|
+
//# sourceMappingURL=index-CHB4tSzX.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-CHB4tSzX.d.cts","names":[],"sources":["../src/workspace/publicEnv.ts","../src/workspace/index.ts"],"sourcesContent":[],"mappings":";;;;;;AASA;AAoBA;AAoBA;;;cAxCa;AC0Hb;;;;;;;AAE0B;AA8B1B;;;;AAGsB;AA8CtB;AAAwC,iBDvLxB,kBAAA,CCuLwB,SAAA,CAAA,EDvLO,SCuLP,CAAA,EAAA,MAAA;;;AAGlB;AA6EtB;AAA6B,iBDnPb,iBAAA,CCmPa,IAAA,EAAA,MAAA,CAAA,EAAA,MAAA,GAAA,IAAA;;;;;;;;AAjK7B;;;;;;;AAE0B;AA8B1B;;;;AAGsB;AA8CtB;;;;AAGsB;AA6EtB;;;;;AAGe;AA6Bf;AAmBA;AAwBA;AAaA;AAiBA;;;;AAGY;AAuCZ;AAmCA;;;;AAIS;AAgDO,iBA3YA,eA6YqB,CAAA,oBA7Ye,UA6YT,CAAA,CAAA,MAAA,EA5YlC,cA4YkC,CA5YnB,KA4YmB,CAAA,CAAA,EA3YxC,uBA2YwC,CA3YhB,KA2YgB,CAAA;;;;iBA7W3B,kBAAA,SACP,+BAEN;;;;;iBA8Ca,wBAAA,SACP,yBAEN;;;;;iBA6Ea,aAAA,SACP,YAAY,+BAElB;;;;;;;iBA6Ba,uBAAA,YACJ;;;;;;;;;;;;iBAkBI,iBAAA,YACJ;;;;;;;iBAuBI,iBAAA,YAA6B;;iBAa7B,iBAAA,SAA0B;;;;;iBAiB1B,eAAA,YACJ,uCAET;;;;;iBAuCa,gBAAA,YAA4B;;;;;;;;;;iBAmC5B,oBAAA,YACJ,2DAGT;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAgDa,mBAAA;;cAEqB"}
|