everything-dev 1.53.2 → 2.0.0-rc.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 +2 -11
- package/dist/_virtual/_rolldown/runtime.cjs +17 -2
- package/dist/_virtual/_rolldown/runtime.mjs +36 -0
- package/dist/api/auth-middleware.cjs +161 -0
- package/dist/api/auth-middleware.cjs.map +1 -0
- package/dist/api/auth-middleware.d.cts +69 -0
- package/dist/api/auth-middleware.d.mts +69 -0
- package/dist/api/auth-middleware.mjs +160 -0
- package/dist/api/auth-middleware.mjs.map +1 -0
- package/dist/api-contract.cjs +250 -62
- package/dist/api-contract.cjs.map +1 -1
- package/dist/api-contract.mjs +246 -65
- package/dist/api-contract.mjs.map +1 -1
- package/dist/app.cjs +99 -26
- package/dist/app.cjs.map +1 -1
- package/dist/app.d.cts +3 -0
- package/dist/app.d.mts +3 -0
- package/dist/app.mjs +100 -27
- package/dist/app.mjs.map +1 -1
- package/dist/auth-login.cjs +163 -0
- package/dist/auth-login.cjs.map +1 -0
- package/dist/auth-login.mjs +162 -0
- package/dist/auth-login.mjs.map +1 -0
- package/dist/auth-session.cjs +64 -0
- package/dist/auth-session.cjs.map +1 -0
- package/dist/auth-session.mjs +58 -0
- package/dist/auth-session.mjs.map +1 -0
- package/dist/auth-types-gen.cjs +0 -1
- package/dist/auth-types-gen.cjs.map +1 -1
- package/dist/build.cjs +37 -173
- package/dist/build.cjs.map +1 -1
- package/dist/build.mjs +37 -171
- package/dist/build.mjs.map +1 -1
- package/dist/bundle-cache.cjs +74 -0
- package/dist/bundle-cache.cjs.map +1 -0
- package/dist/bundle-cache.d.cts +27 -0
- package/dist/bundle-cache.d.mts +27 -0
- package/dist/bundle-cache.mjs +68 -0
- package/dist/bundle-cache.mjs.map +1 -0
- package/dist/bundle-fs-resolve.cjs +209 -0
- package/dist/bundle-fs-resolve.cjs.map +1 -0
- package/dist/bundle-fs-resolve.d.cts +76 -0
- package/dist/bundle-fs-resolve.d.mts +76 -0
- package/dist/bundle-fs-resolve.mjs +202 -0
- package/dist/bundle-fs-resolve.mjs.map +1 -0
- package/dist/cdn-deploy.cjs +126 -0
- package/dist/cdn-deploy.cjs.map +1 -0
- package/dist/cdn-deploy.mjs +124 -0
- package/dist/cdn-deploy.mjs.map +1 -0
- package/dist/cli/db-doctor.cjs +19 -19
- package/dist/cli/db-doctor.cjs.map +1 -1
- package/dist/cli/db-doctor.mjs +18 -18
- package/dist/cli/db-doctor.mjs.map +1 -1
- package/dist/cli/db-repair.cjs +9 -32
- package/dist/cli/db-repair.cjs.map +1 -1
- package/dist/cli/db-repair.mjs +9 -32
- package/dist/cli/db-repair.mjs.map +1 -1
- package/dist/cli/framework-version.cjs +7 -3
- package/dist/cli/framework-version.cjs.map +1 -1
- package/dist/cli/framework-version.mjs +7 -3
- package/dist/cli/framework-version.mjs.map +1 -1
- package/dist/cli/infra.cjs +159 -251
- package/dist/cli/infra.cjs.map +1 -1
- package/dist/cli/infra.mjs +154 -242
- package/dist/cli/infra.mjs.map +1 -1
- package/dist/cli/init.cjs +627 -199
- package/dist/cli/init.cjs.map +1 -1
- package/dist/cli/init.d.cts +61 -8
- package/dist/cli/init.d.mts +61 -8
- package/dist/cli/init.mjs +616 -197
- package/dist/cli/init.mjs.map +1 -1
- package/dist/cli/parse.cjs +8 -7
- package/dist/cli/parse.cjs.map +1 -1
- package/dist/cli/parse.mjs +9 -7
- package/dist/cli/parse.mjs.map +1 -1
- package/dist/cli/prompts.cjs +14 -1
- package/dist/cli/prompts.cjs.map +1 -1
- package/dist/cli/prompts.mjs +14 -1
- package/dist/cli/prompts.mjs.map +1 -1
- package/dist/cli/prune.cjs +220 -0
- package/dist/cli/prune.cjs.map +1 -0
- package/dist/cli/prune.mjs +220 -0
- package/dist/cli/prune.mjs.map +1 -0
- package/dist/cli/snapshot.cjs +2 -1
- package/dist/cli/snapshot.cjs.map +1 -1
- package/dist/cli/snapshot.mjs +2 -1
- package/dist/cli/snapshot.mjs.map +1 -1
- package/dist/cli/status.cjs +5 -4
- package/dist/cli/status.cjs.map +1 -1
- package/dist/cli/status.mjs +6 -5
- package/dist/cli/status.mjs.map +1 -1
- package/dist/cli/sync.cjs +156 -58
- package/dist/cli/sync.cjs.map +1 -1
- package/dist/cli/sync.mjs +158 -63
- package/dist/cli/sync.mjs.map +1 -1
- package/dist/cli/timing.cjs +0 -1
- package/dist/cli/timing.cjs.map +1 -1
- package/dist/cli/upgrade.cjs +95 -69
- package/dist/cli/upgrade.cjs.map +1 -1
- package/dist/cli/upgrade.mjs +97 -72
- package/dist/cli/upgrade.mjs.map +1 -1
- package/dist/cli/utils/helpers.cjs.map +1 -1
- package/dist/cli.cjs +320 -72
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.mjs +316 -68
- package/dist/cli.mjs.map +1 -1
- package/dist/code-artifacts.cjs +76 -8
- package/dist/code-artifacts.cjs.map +1 -1
- package/dist/code-artifacts.mjs +76 -10
- package/dist/code-artifacts.mjs.map +1 -1
- package/dist/commands/build.cjs +65 -0
- package/dist/commands/build.cjs.map +1 -0
- package/dist/commands/build.mjs +65 -0
- package/dist/commands/build.mjs.map +1 -0
- package/dist/commands/config.cjs +77 -0
- package/dist/commands/config.cjs.map +1 -0
- package/dist/commands/config.d.cts +8 -0
- package/dist/commands/config.d.mts +8 -0
- package/dist/commands/config.mjs +74 -0
- package/dist/commands/config.mjs.map +1 -0
- package/dist/commands/db.cjs +107 -0
- package/dist/commands/db.cjs.map +1 -0
- package/dist/commands/db.mjs +107 -0
- package/dist/commands/db.mjs.map +1 -0
- package/dist/commands/deploy.cjs +336 -0
- package/dist/commands/deploy.cjs.map +1 -0
- package/dist/commands/deploy.mjs +334 -0
- package/dist/commands/deploy.mjs.map +1 -0
- package/dist/commands/dev.cjs +75 -0
- package/dist/commands/dev.cjs.map +1 -0
- package/dist/commands/dev.mjs +73 -0
- package/dist/commands/dev.mjs.map +1 -0
- package/dist/commands/init.cjs +234 -0
- package/dist/commands/init.cjs.map +1 -0
- package/dist/commands/init.mjs +231 -0
- package/dist/commands/init.mjs.map +1 -0
- package/dist/commands/keys.cjs +255 -0
- package/dist/commands/keys.cjs.map +1 -0
- package/dist/commands/keys.mjs +253 -0
- package/dist/commands/keys.mjs.map +1 -0
- package/dist/commands/ops.cjs +199 -0
- package/dist/commands/ops.cjs.map +1 -0
- package/dist/commands/ops.mjs +197 -0
- package/dist/commands/ops.mjs.map +1 -0
- package/dist/commands/plugins.cjs +211 -0
- package/dist/commands/plugins.cjs.map +1 -0
- package/dist/commands/plugins.mjs +211 -0
- package/dist/commands/plugins.mjs.map +1 -0
- package/dist/commands/shared.cjs +8 -0
- package/dist/commands/shared.cjs.map +1 -0
- package/dist/commands/shared.d.cts +6 -0
- package/dist/commands/shared.d.mts +6 -0
- package/dist/commands/shared.mjs +8 -0
- package/dist/commands/shared.mjs.map +1 -0
- package/dist/commands/upgrade.cjs +325 -0
- package/dist/commands/upgrade.cjs.map +1 -0
- package/dist/commands/upgrade.mjs +323 -0
- package/dist/commands/upgrade.mjs.map +1 -0
- package/dist/components/dev-render.cjs +340 -0
- package/dist/components/dev-render.cjs.map +1 -0
- package/dist/components/dev-render.mjs +332 -0
- package/dist/components/dev-render.mjs.map +1 -0
- package/dist/config.cjs +460 -221
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +491 -48
- package/dist/config.d.mts +491 -48
- package/dist/config.mjs +439 -212
- package/dist/config.mjs.map +1 -1
- package/dist/contract.cjs +327 -50
- package/dist/contract.cjs.map +1 -1
- package/dist/contract.d.cts +1951 -1062
- package/dist/contract.d.mts +1951 -1062
- package/dist/contract.meta.cjs +107 -12
- package/dist/contract.meta.cjs.map +1 -1
- package/dist/contract.meta.d.cts +166 -8
- package/dist/contract.meta.d.mts +166 -8
- package/dist/contract.meta.mjs +107 -11
- package/dist/contract.meta.mjs.map +1 -1
- package/dist/contract.mjs +580 -327
- package/dist/contract.mjs.map +1 -1
- package/dist/dag.cjs +5 -3
- package/dist/dag.cjs.map +1 -1
- package/dist/dag.mjs +6 -3
- package/dist/dag.mjs.map +1 -1
- package/dist/db/binding.cjs +80 -0
- package/dist/db/binding.cjs.map +1 -0
- package/dist/db/binding.d.cts +39 -0
- package/dist/db/binding.d.mts +39 -0
- package/dist/db/binding.mjs +78 -0
- package/dist/db/binding.mjs.map +1 -0
- package/dist/db/bindings.cjs +78 -0
- package/dist/db/bindings.cjs.map +1 -0
- package/dist/db/bindings.d.cts +34 -0
- package/dist/db/bindings.d.mts +34 -0
- package/dist/db/bindings.mjs +76 -0
- package/dist/db/bindings.mjs.map +1 -0
- package/dist/db/core.cjs +204 -0
- package/dist/db/core.cjs.map +1 -0
- package/dist/db/core.d.cts +69 -0
- package/dist/db/core.d.mts +69 -0
- package/dist/db/core.mjs +192 -0
- package/dist/db/core.mjs.map +1 -0
- package/dist/db/driver.cjs +167 -0
- package/dist/db/driver.cjs.map +1 -0
- package/dist/db/driver.d.cts +50 -0
- package/dist/db/driver.d.mts +50 -0
- package/dist/db/driver.mjs +165 -0
- package/dist/db/driver.mjs.map +1 -0
- package/dist/db/drizzle-kit.cjs +177 -0
- package/dist/db/drizzle-kit.cjs.map +1 -0
- package/dist/db/drizzle-kit.d.cts +25 -0
- package/dist/db/drizzle-kit.d.mts +25 -0
- package/dist/db/drizzle-kit.mjs +175 -0
- package/dist/db/drizzle-kit.mjs.map +1 -0
- package/dist/db/errors.cjs +27 -0
- package/dist/db/errors.cjs.map +1 -0
- package/dist/db/errors.d.cts +16 -0
- package/dist/db/errors.d.mts +16 -0
- package/dist/db/errors.mjs +26 -0
- package/dist/db/errors.mjs.map +1 -0
- package/dist/db/identity.cjs +55 -0
- package/dist/db/identity.cjs.map +1 -0
- package/dist/db/identity.d.cts +40 -0
- package/dist/db/identity.d.mts +40 -0
- package/dist/db/identity.mjs +53 -0
- package/dist/db/identity.mjs.map +1 -0
- package/dist/db/index.cjs +43 -0
- package/dist/db/index.d.cts +9 -0
- package/dist/db/index.d.mts +9 -0
- package/dist/db/index.mjs +10 -0
- package/dist/db/run-migrations.cjs +343 -0
- package/dist/db/run-migrations.cjs.map +1 -0
- package/dist/db/run-migrations.d.cts +87 -0
- package/dist/db/run-migrations.d.mts +87 -0
- package/dist/db/run-migrations.mjs +341 -0
- package/dist/db/run-migrations.mjs.map +1 -0
- package/dist/delegate-signer.cjs +85 -0
- package/dist/delegate-signer.cjs.map +1 -0
- package/dist/delegate-signer.mjs +84 -0
- package/dist/delegate-signer.mjs.map +1 -0
- package/dist/deploy-diff.cjs +119 -0
- package/dist/deploy-diff.cjs.map +1 -0
- package/dist/deploy-diff.mjs +109 -0
- package/dist/deploy-diff.mjs.map +1 -0
- package/dist/descriptor/constructors.cjs +49 -0
- package/dist/descriptor/constructors.cjs.map +1 -0
- package/dist/descriptor/constructors.d.cts +27 -0
- package/dist/descriptor/constructors.d.mts +27 -0
- package/dist/descriptor/constructors.mjs +45 -0
- package/dist/descriptor/constructors.mjs.map +1 -0
- package/dist/descriptor/index.cjs +24 -0
- package/dist/descriptor/index.d.cts +5 -0
- package/dist/descriptor/index.d.mts +5 -0
- package/dist/descriptor/index.mjs +6 -0
- package/dist/descriptor/resolve.cjs +258 -0
- package/dist/descriptor/resolve.cjs.map +1 -0
- package/dist/descriptor/resolve.d.cts +50 -0
- package/dist/descriptor/resolve.d.mts +50 -0
- package/dist/descriptor/resolve.mjs +252 -0
- package/dist/descriptor/resolve.mjs.map +1 -0
- package/dist/descriptor/schema.cjs +109 -0
- package/dist/descriptor/schema.cjs.map +1 -0
- package/dist/descriptor/schema.d.cts +217 -0
- package/dist/descriptor/schema.d.mts +217 -0
- package/dist/descriptor/schema.mjs +102 -0
- package/dist/descriptor/schema.mjs.map +1 -0
- package/dist/descriptor/serialize.cjs +45 -0
- package/dist/descriptor/serialize.cjs.map +1 -0
- package/dist/descriptor/serialize.d.cts +7 -0
- package/dist/descriptor/serialize.d.mts +7 -0
- package/dist/descriptor/serialize.mjs +45 -0
- package/dist/descriptor/serialize.mjs.map +1 -0
- package/dist/dev-log-pipeline.cjs +273 -0
- package/dist/dev-log-pipeline.cjs.map +1 -0
- package/dist/dev-log-pipeline.mjs +267 -0
- package/dist/dev-log-pipeline.mjs.map +1 -0
- package/dist/dev-logs.cjs +39 -8
- package/dist/dev-logs.cjs.map +1 -1
- package/dist/dev-logs.mjs +37 -9
- package/dist/dev-logs.mjs.map +1 -1
- package/dist/dev-program.cjs +405 -0
- package/dist/dev-program.cjs.map +1 -0
- package/dist/dev-program.d.cts +10 -0
- package/dist/dev-program.d.mts +10 -0
- package/dist/dev-program.mjs +395 -0
- package/dist/dev-program.mjs.map +1 -0
- package/dist/dev-session-data.d.cts +27 -0
- package/dist/dev-session-data.d.mts +27 -0
- package/dist/dev-session.cjs +178 -105
- package/dist/dev-session.cjs.map +1 -1
- package/dist/dev-session.mjs +180 -105
- package/dist/dev-session.mjs.map +1 -1
- package/dist/env/process-env.cjs +16 -0
- package/dist/env/process-env.cjs.map +1 -0
- package/dist/env/process-env.mjs +13 -0
- package/dist/env/process-env.mjs.map +1 -0
- package/dist/env/project-env.cjs +144 -0
- package/dist/env/project-env.cjs.map +1 -0
- package/dist/env/project-env.d.cts +1 -0
- package/dist/env/project-env.d.mts +1 -0
- package/dist/env/project-env.mjs +132 -0
- package/dist/env/project-env.mjs.map +1 -0
- package/dist/fastkv.cjs +59 -12
- package/dist/fastkv.cjs.map +1 -1
- package/dist/fastkv.d.cts +42 -6
- package/dist/fastkv.d.mts +42 -6
- package/dist/fastkv.mjs +58 -13
- package/dist/fastkv.mjs.map +1 -1
- package/dist/fingerprint.cjs +57 -0
- package/dist/fingerprint.cjs.map +1 -0
- package/dist/fingerprint.d.cts +14 -0
- package/dist/fingerprint.d.mts +14 -0
- package/dist/fingerprint.mjs +55 -0
- package/dist/fingerprint.mjs.map +1 -0
- package/dist/http-client.cjs +17 -17
- package/dist/http-client.cjs.map +1 -1
- package/dist/http-client.mjs +17 -17
- package/dist/http-client.mjs.map +1 -1
- package/dist/image-deploy.cjs +186 -0
- package/dist/image-deploy.cjs.map +1 -0
- package/dist/image-deploy.mjs +182 -0
- package/dist/image-deploy.mjs.map +1 -0
- package/dist/index.cjs +66 -18
- package/dist/index.d.cts +8 -7
- package/dist/index.d.mts +8 -7
- package/dist/index.mjs +6 -5
- package/dist/infra/docker.cjs +77 -0
- package/dist/infra/docker.cjs.map +1 -0
- package/dist/infra/docker.d.cts +10 -0
- package/dist/infra/docker.d.mts +10 -0
- package/dist/infra/docker.mjs +69 -0
- package/dist/infra/docker.mjs.map +1 -0
- package/dist/infra/materializer.cjs +74 -0
- package/dist/infra/materializer.cjs.map +1 -0
- package/dist/infra/materializer.mjs +70 -0
- package/dist/infra/materializer.mjs.map +1 -0
- package/dist/infra/planner.cjs +135 -103
- package/dist/infra/planner.cjs.map +1 -1
- package/dist/infra/planner.mjs +137 -104
- package/dist/infra/planner.mjs.map +1 -1
- package/dist/infra/port-ownership.cjs +57 -0
- package/dist/infra/port-ownership.cjs.map +1 -0
- package/dist/infra/port-ownership.mjs +57 -0
- package/dist/infra/port-ownership.mjs.map +1 -0
- package/dist/infra/preflight.cjs +45 -33
- package/dist/infra/preflight.cjs.map +1 -1
- package/dist/infra/preflight.d.cts +1 -0
- package/dist/infra/preflight.d.mts +1 -0
- package/dist/infra/preflight.mjs +46 -34
- package/dist/infra/preflight.mjs.map +1 -1
- package/dist/infra/types.cjs.map +1 -1
- package/dist/infra/types.d.cts +2 -0
- package/dist/infra/types.d.mts +2 -0
- package/dist/infra/types.mjs.map +1 -1
- package/dist/integrity.cjs +50 -61
- package/dist/integrity.cjs.map +1 -1
- package/dist/integrity.d.cts +16 -10
- package/dist/integrity.d.mts +16 -10
- package/dist/integrity.mjs +50 -59
- package/dist/integrity.mjs.map +1 -1
- package/dist/internal/manifest-normalizer.cjs +8 -2
- package/dist/internal/manifest-normalizer.cjs.map +1 -1
- package/dist/internal/manifest-normalizer.mjs +9 -3
- package/dist/internal/manifest-normalizer.mjs.map +1 -1
- package/dist/merge.cjs +19 -1
- package/dist/merge.cjs.map +1 -1
- package/dist/merge.d.cts +1 -1
- package/dist/merge.d.mts +1 -1
- package/dist/merge.mjs +19 -2
- package/dist/merge.mjs.map +1 -1
- package/dist/mf.cjs +190 -3
- package/dist/mf.cjs.map +1 -1
- package/dist/mf.d.cts +24 -2
- package/dist/mf.d.mts +24 -2
- package/dist/mf.mjs +189 -4
- package/dist/mf.mjs.map +1 -1
- package/dist/near-cli.cjs +59 -91
- package/dist/near-cli.cjs.map +1 -1
- package/dist/near-cli.mjs +58 -90
- package/dist/near-cli.mjs.map +1 -1
- package/dist/near-signer.cjs +73 -0
- package/dist/near-signer.cjs.map +1 -0
- package/dist/near-signer.mjs +70 -0
- package/dist/near-signer.mjs.map +1 -0
- package/dist/network.cjs +0 -1
- package/dist/network.cjs.map +1 -1
- package/dist/orchestrator.cjs +256 -87
- package/dist/orchestrator.cjs.map +1 -1
- package/dist/orchestrator.mjs +248 -87
- package/dist/orchestrator.mjs.map +1 -1
- package/dist/platform-deploy.cjs +81 -0
- package/dist/platform-deploy.cjs.map +1 -0
- package/dist/platform-deploy.mjs +80 -0
- package/dist/platform-deploy.mjs.map +1 -0
- package/dist/plugin.cjs +54 -1389
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +6 -896
- package/dist/plugin.d.mts +6 -896
- package/dist/plugin.mjs +53 -1387
- package/dist/plugin.mjs.map +1 -1
- package/dist/process-kill.cjs +44 -0
- package/dist/process-kill.cjs.map +1 -0
- package/dist/process-kill.mjs +43 -0
- package/dist/process-kill.mjs.map +1 -0
- package/dist/process-registry.cjs +64 -9
- package/dist/process-registry.cjs.map +1 -1
- package/dist/process-registry.mjs +61 -10
- package/dist/process-registry.mjs.map +1 -1
- package/dist/progress.cjs +45 -0
- package/dist/progress.cjs.map +1 -0
- package/dist/progress.d.cts +13 -0
- package/dist/progress.d.mts +13 -0
- package/dist/progress.mjs +42 -0
- package/dist/progress.mjs.map +1 -0
- package/dist/publish.cjs +513 -79
- package/dist/publish.cjs.map +1 -1
- package/dist/publish.mjs +515 -82
- package/dist/publish.mjs.map +1 -1
- package/dist/registry-use.cjs +41 -0
- package/dist/registry-use.cjs.map +1 -0
- package/dist/registry-use.mjs +40 -0
- package/dist/registry-use.mjs.map +1 -0
- package/dist/resolution/session.cjs +335 -0
- package/dist/resolution/session.cjs.map +1 -0
- package/dist/resolution/session.d.cts +105 -0
- package/dist/resolution/session.d.mts +105 -0
- package/dist/resolution/session.mjs +331 -0
- package/dist/resolution/session.mjs.map +1 -0
- package/dist/rollback.cjs +131 -0
- package/dist/rollback.cjs.map +1 -0
- package/dist/rollback.mjs +128 -0
- package/dist/rollback.mjs.map +1 -0
- package/dist/sdk.cjs +7 -7
- package/dist/sdk.d.cts +3 -3
- package/dist/sdk.d.mts +3 -3
- package/dist/sdk.mjs +2 -2
- package/dist/service-descriptor.cjs +67 -34
- package/dist/service-descriptor.cjs.map +1 -1
- package/dist/service-descriptor.d.cts +4 -1
- package/dist/service-descriptor.d.mts +3 -0
- package/dist/service-descriptor.mjs +63 -35
- package/dist/service-descriptor.mjs.map +1 -1
- package/dist/shared-deps.cjs +17 -16
- package/dist/shared-deps.cjs.map +1 -1
- package/dist/shared-deps.mjs +17 -16
- package/dist/shared-deps.mjs.map +1 -1
- package/dist/start-config-source.cjs +24 -0
- package/dist/start-config-source.cjs.map +1 -0
- package/dist/start-config-source.d.cts +29 -0
- package/dist/start-config-source.d.mts +29 -0
- package/dist/start-config-source.mjs +22 -0
- package/dist/start-config-source.mjs.map +1 -0
- package/dist/storage-upload.cjs +145 -0
- package/dist/storage-upload.cjs.map +1 -0
- package/dist/storage-upload.mjs +143 -0
- package/dist/storage-upload.mjs.map +1 -0
- package/dist/types.cjs +126 -20
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +867 -585
- package/dist/types.d.mts +867 -585
- package/dist/types.mjs +307 -208
- package/dist/types.mjs.map +1 -1
- package/dist/ui/api.cjs +105 -0
- package/dist/ui/api.cjs.map +1 -0
- package/dist/ui/api.d.cts +31 -0
- package/dist/ui/api.d.mts +31 -0
- package/dist/ui/api.mjs +99 -0
- package/dist/ui/api.mjs.map +1 -0
- package/dist/ui/auth-guards.cjs +50 -0
- package/dist/ui/auth-guards.cjs.map +1 -0
- package/dist/ui/auth-guards.d.cts +39 -0
- package/dist/ui/auth-guards.d.mts +39 -0
- package/dist/ui/auth-guards.mjs +48 -0
- package/dist/ui/auth-guards.mjs.map +1 -0
- package/dist/ui/auth.cjs +197 -0
- package/dist/ui/auth.cjs.map +1 -0
- package/dist/ui/auth.d.cts +56 -0
- package/dist/ui/auth.d.mts +56 -0
- package/dist/ui/auth.mjs +179 -0
- package/dist/ui/auth.mjs.map +1 -0
- package/dist/ui/entry.cjs +16 -0
- package/dist/ui/entry.cjs.map +1 -0
- package/dist/ui/entry.d.cts +12 -0
- package/dist/ui/entry.d.mts +12 -0
- package/dist/ui/entry.mjs +15 -0
- package/dist/ui/entry.mjs.map +1 -0
- package/dist/ui/head.cjs +14 -7
- package/dist/ui/head.cjs.map +1 -1
- package/dist/ui/head.mjs +15 -7
- package/dist/ui/head.mjs.map +1 -1
- package/dist/ui/hydrate.cjs +265 -0
- package/dist/ui/hydrate.cjs.map +1 -0
- package/dist/ui/hydrate.d.cts +48 -0
- package/dist/ui/hydrate.d.mts +48 -0
- package/dist/ui/hydrate.mjs +263 -0
- package/dist/ui/hydrate.mjs.map +1 -0
- package/dist/ui/i18n.cjs +153 -0
- package/dist/ui/i18n.cjs.map +1 -0
- package/dist/ui/i18n.d.cts +29 -0
- package/dist/ui/i18n.d.mts +29 -0
- package/dist/ui/i18n.mjs +140 -0
- package/dist/ui/i18n.mjs.map +1 -0
- package/dist/ui/index.cjs +19 -1
- package/dist/ui/index.d.cts +6 -3
- package/dist/ui/index.d.mts +6 -3
- package/dist/ui/index.mjs +5 -2
- package/dist/ui/locale.cjs +53 -0
- package/dist/ui/locale.cjs.map +1 -0
- package/dist/ui/locale.d.cts +18 -0
- package/dist/ui/locale.d.mts +18 -0
- package/dist/ui/locale.mjs +49 -0
- package/dist/ui/locale.mjs.map +1 -0
- package/dist/ui/manifest/index.cjs +25 -0
- package/dist/ui/manifest/index.cjs.map +1 -0
- package/dist/ui/manifest/index.d.cts +9 -0
- package/dist/ui/manifest/index.d.mts +9 -0
- package/dist/ui/manifest/index.mjs +13 -0
- package/dist/ui/manifest/index.mjs.map +1 -0
- package/dist/ui/manifest-generator.cjs +8 -0
- package/dist/ui/manifest-generator.d.cts +1 -0
- package/dist/ui/manifest-generator.d.mts +1 -0
- package/dist/ui/manifest-generator.mjs +3 -0
- package/dist/ui/message-catalogs.cjs +8 -0
- package/dist/ui/message-catalogs.cjs.map +1 -0
- package/dist/ui/message-catalogs.d.cts +5 -0
- package/dist/ui/message-catalogs.d.mts +5 -0
- package/dist/ui/message-catalogs.mjs +8 -0
- package/dist/ui/message-catalogs.mjs.map +1 -0
- package/dist/ui/metadata.cjs +0 -1
- package/dist/ui/metadata.cjs.map +1 -1
- package/dist/ui/metadata.d.cts +1 -1
- package/dist/ui/metadata.d.mts +1 -1
- package/dist/ui/plugin-path.cjs +37 -0
- package/dist/ui/plugin-path.cjs.map +1 -0
- package/dist/ui/plugin-path.d.cts +25 -0
- package/dist/ui/plugin-path.d.mts +25 -0
- package/dist/ui/plugin-path.mjs +35 -0
- package/dist/ui/plugin-path.mjs.map +1 -0
- package/dist/ui/router-client.cjs +61 -0
- package/dist/ui/router-client.cjs.map +1 -0
- package/dist/ui/router-client.d.cts +20 -0
- package/dist/ui/router-client.d.mts +20 -0
- package/dist/ui/router-client.mjs +60 -0
- package/dist/ui/router-client.mjs.map +1 -0
- package/dist/ui/router-defaults.cjs +48 -0
- package/dist/ui/router-defaults.cjs.map +1 -0
- package/dist/ui/router-defaults.d.cts +8 -0
- package/dist/ui/router-defaults.d.mts +8 -0
- package/dist/ui/router-defaults.mjs +45 -0
- package/dist/ui/router-defaults.mjs.map +1 -0
- package/dist/ui/router-error.cjs +70 -0
- package/dist/ui/router-error.cjs.map +1 -0
- package/dist/ui/router-error.d.cts +19 -0
- package/dist/ui/router-error.d.mts +19 -0
- package/dist/ui/router-error.mjs +69 -0
- package/dist/ui/router-error.mjs.map +1 -0
- package/dist/ui/router-server.cjs +153 -0
- package/dist/ui/router-server.cjs.map +1 -0
- package/dist/ui/router-server.d.cts +38 -0
- package/dist/ui/router-server.d.mts +38 -0
- package/dist/ui/router-server.mjs +152 -0
- package/dist/ui/router-server.mjs.map +1 -0
- package/dist/ui/router.cjs +4 -16
- package/dist/ui/router.cjs.map +1 -1
- package/dist/ui/router.mjs +4 -15
- package/dist/ui/router.mjs.map +1 -1
- package/dist/ui/runtime.cjs +5 -1
- package/dist/ui/runtime.cjs.map +1 -1
- package/dist/ui/runtime.d.cts +2 -1
- package/dist/ui/runtime.d.mts +2 -1
- package/dist/ui/runtime.mjs +5 -1
- package/dist/ui/runtime.mjs.map +1 -1
- package/dist/ui/slot.cjs +34 -0
- package/dist/ui/slot.cjs.map +1 -0
- package/dist/ui/slot.d.cts +43 -0
- package/dist/ui/slot.d.mts +43 -0
- package/dist/ui/slot.mjs +34 -0
- package/dist/ui/slot.mjs.map +1 -0
- package/dist/ui/tenant.cjs +300 -0
- package/dist/ui/tenant.cjs.map +1 -0
- package/dist/ui/tenant.d.cts +122 -0
- package/dist/ui/tenant.d.mts +122 -0
- package/dist/ui/tenant.mjs +279 -0
- package/dist/ui/tenant.mjs.map +1 -0
- package/dist/ui/types.d.cts +32 -2
- package/dist/ui/types.d.mts +32 -2
- package/dist/ui/version-check.cjs +47 -0
- package/dist/ui/version-check.cjs.map +1 -0
- package/dist/ui/version-check.d.cts +23 -0
- package/dist/ui/version-check.d.mts +23 -0
- package/dist/ui/version-check.mjs +46 -0
- package/dist/ui/version-check.mjs.map +1 -0
- package/dist/utils/banner.cjs +2 -2
- package/dist/utils/banner.cjs.map +1 -1
- package/dist/utils/banner.mjs +2 -2
- package/dist/utils/banner.mjs.map +1 -1
- package/dist/utils/linkify.cjs +1 -1
- package/dist/utils/linkify.cjs.map +1 -1
- package/dist/utils/linkify.mjs +1 -0
- package/dist/utils/linkify.mjs.map +1 -1
- package/dist/utils/run.cjs +6 -6
- package/dist/utils/run.cjs.map +1 -1
- package/dist/utils/run.mjs +6 -6
- package/dist/utils/run.mjs.map +1 -1
- package/dist/utils/save-config.cjs +12 -0
- package/dist/utils/save-config.cjs.map +1 -1
- package/dist/utils/save-config.mjs +12 -0
- package/dist/utils/save-config.mjs.map +1 -1
- package/dist/utils/snapshot-hash.cjs +10 -0
- package/dist/utils/snapshot-hash.cjs.map +1 -0
- package/dist/utils/snapshot-hash.mjs +10 -0
- package/dist/utils/snapshot-hash.mjs.map +1 -0
- package/dist/utils/string.cjs +0 -1
- package/dist/utils/string.cjs.map +1 -1
- package/dist/utils/theme.cjs +30 -12
- package/dist/utils/theme.cjs.map +1 -1
- package/dist/utils/theme.mjs +30 -11
- package/dist/utils/theme.mjs.map +1 -1
- package/dist/version-manifest-deploy.cjs +50 -0
- package/dist/version-manifest-deploy.cjs.map +1 -0
- package/dist/version-manifest-deploy.mjs +49 -0
- package/dist/version-manifest-deploy.mjs.map +1 -0
- package/dist/version-manifest-resolve.cjs +42 -0
- package/dist/version-manifest-resolve.cjs.map +1 -0
- package/dist/version-manifest-resolve.d.cts +38 -0
- package/dist/version-manifest-resolve.d.mts +38 -0
- package/dist/version-manifest-resolve.mjs +40 -0
- package/dist/version-manifest-resolve.mjs.map +1 -0
- package/dist/version-status.cjs +18 -0
- package/dist/version-status.cjs.map +1 -0
- package/dist/version-status.d.cts +22 -0
- package/dist/version-status.d.mts +22 -0
- package/dist/version-status.mjs +17 -0
- package/dist/version-status.mjs.map +1 -0
- package/dist/workspace-catalog.cjs +53 -0
- package/dist/workspace-catalog.cjs.map +1 -0
- package/dist/workspace-catalog.mjs +51 -0
- package/dist/workspace-catalog.mjs.map +1 -0
- package/dist/workspace.cjs +237 -0
- package/dist/workspace.cjs.map +1 -0
- package/dist/workspace.mjs +233 -0
- package/dist/workspace.mjs.map +1 -0
- package/package.json +179 -27
- package/skills/add-a-route/SKILL.md +132 -0
- package/skills/api-and-auth/SKILL.md +87 -21
- package/skills/api-and-auth/references/middleware.md +1 -1
- package/skills/cli-reference/SKILL.md +48 -21
- package/skills/code-style/SKILL.md +8 -0
- package/skills/dev-workflow/SKILL.md +50 -26
- package/skills/extends-config/SKILL.md +31 -19
- package/skills/init-upgrade/SKILL.md +29 -16
- package/skills/plugin-development/SKILL.md +46 -112
- package/skills/plugin-development/references/database.md +82 -0
- package/skills/plugin-development/references/request-context.md +67 -0
- package/skills/publish-sync/SKILL.md +99 -22
- package/skills/registry/SKILL.md +82 -0
- package/skills/super-app/SKILL.md +25 -15
- package/skills/talk-to-the-app/SKILL.md +138 -0
- package/skills/ui-integration/SKILL.md +93 -11
- package/dist/cli/db-studio.cjs +0 -131
- package/dist/cli/db-studio.cjs.map +0 -1
- package/dist/cli/db-studio.mjs +0 -127
- package/dist/cli/db-studio.mjs.map +0 -1
- package/dist/cli/init.d.cts.map +0 -1
- package/dist/cli/init.d.mts.map +0 -1
- package/dist/components/dev-view.cjs +0 -309
- package/dist/components/dev-view.cjs.map +0 -1
- package/dist/components/dev-view.mjs +0 -309
- package/dist/components/dev-view.mjs.map +0 -1
- package/dist/components/streaming-view.cjs +0 -134
- package/dist/components/streaming-view.cjs.map +0 -1
- package/dist/components/streaming-view.mjs +0 -132
- package/dist/components/streaming-view.mjs.map +0 -1
- package/dist/config.d.cts.map +0 -1
- package/dist/config.d.mts.map +0 -1
- package/dist/contract.d.cts.map +0 -1
- package/dist/contract.d.mts.map +0 -1
- package/dist/contract.meta.d.cts.map +0 -1
- package/dist/contract.meta.d.mts.map +0 -1
- package/dist/dag.d.cts.map +0 -1
- package/dist/dag.d.mts.map +0 -1
- package/dist/db.cjs +0 -81
- package/dist/db.cjs.map +0 -1
- package/dist/db.d.cts +0 -30
- package/dist/db.d.cts.map +0 -1
- package/dist/db.d.mts +0 -30
- package/dist/db.d.mts.map +0 -1
- package/dist/db.mjs +0 -75
- package/dist/db.mjs.map +0 -1
- package/dist/fastkv.d.cts.map +0 -1
- package/dist/fastkv.d.mts.map +0 -1
- package/dist/integrity.d.cts.map +0 -1
- package/dist/integrity.d.mts.map +0 -1
- package/dist/merge.d.cts.map +0 -1
- package/dist/merge.d.mts.map +0 -1
- package/dist/mf.d.cts.map +0 -1
- package/dist/mf.d.mts.map +0 -1
- package/dist/plugin.d.cts.map +0 -1
- package/dist/plugin.d.mts.map +0 -1
- package/dist/service-descriptor.d.cts.map +0 -1
- package/dist/service-descriptor.d.mts.map +0 -1
- package/dist/types.d.cts.map +0 -1
- package/dist/types.d.mts.map +0 -1
- package/dist/ui/head.d.cts.map +0 -1
- package/dist/ui/head.d.mts.map +0 -1
- package/dist/ui/metadata.d.cts.map +0 -1
- package/dist/ui/metadata.d.mts.map +0 -1
- package/dist/ui/router.d.cts.map +0 -1
- package/dist/ui/router.d.mts.map +0 -1
- package/dist/ui/runtime.d.cts.map +0 -1
- package/dist/ui/runtime.d.mts.map +0 -1
- package/dist/ui/types.d.cts.map +0 -1
- package/dist/ui/types.d.mts.map +0 -1
package/dist/infra/preflight.cjs
CHANGED
|
@@ -2,14 +2,22 @@ let effect = require("effect");
|
|
|
2
2
|
let node_net = require("node:net");
|
|
3
3
|
|
|
4
4
|
//#region src/infra/preflight.ts
|
|
5
|
+
var PreflightConnectionError = class extends effect.Data.TaggedError("PreflightConnectionError") {
|
|
6
|
+
get message() {
|
|
7
|
+
return `Postgres connection failed: ${this.cause instanceof Error ? this.cause.message : String(this.cause)}`;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const scheduleTimeout = (ms, fn) => setTimeout(fn, ms);
|
|
5
11
|
function parseLocalUrl(url) {
|
|
6
12
|
try {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const port = Number.parseInt(
|
|
11
|
-
if (Number.isNaN(port)) return
|
|
12
|
-
|
|
13
|
+
const parsed = new URL(url);
|
|
14
|
+
const host = parsed.hostname;
|
|
15
|
+
if (host !== "localhost" && host !== "127.0.0.1" && host !== "::1") return null;
|
|
16
|
+
const port = Number.parseInt(parsed.port, 10);
|
|
17
|
+
if (Number.isNaN(port)) return {
|
|
18
|
+
host,
|
|
19
|
+
port: parsed.protocol === "redis:" ? 6379 : 5432
|
|
20
|
+
};
|
|
13
21
|
return {
|
|
14
22
|
host,
|
|
15
23
|
port
|
|
@@ -19,15 +27,15 @@ function parseLocalUrl(url) {
|
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
29
|
function checkTcpReachable(host, port, timeoutMs = 2e3) {
|
|
22
|
-
return effect.Effect.
|
|
30
|
+
return effect.Effect.callback((resume) => {
|
|
23
31
|
const socket = (0, node_net.createConnection)({
|
|
24
32
|
host,
|
|
25
33
|
port
|
|
26
34
|
});
|
|
27
|
-
const timer =
|
|
35
|
+
const timer = scheduleTimeout(timeoutMs, () => {
|
|
28
36
|
socket.destroy();
|
|
29
37
|
resume(effect.Effect.succeed(false));
|
|
30
|
-
}
|
|
38
|
+
});
|
|
31
39
|
socket.once("connect", () => {
|
|
32
40
|
clearTimeout(timer);
|
|
33
41
|
socket.destroy();
|
|
@@ -43,26 +51,27 @@ function checkTcpReachable(host, port, timeoutMs = 2e3) {
|
|
|
43
51
|
function checkPgConnection(url) {
|
|
44
52
|
return effect.Effect.gen(function* () {
|
|
45
53
|
if (!(yield* checkTcpReachable(new URL(url).hostname, Number(new URL(url).port) || 5432, 4e3))) return false;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
return yield* effect.Effect.tryPromise({
|
|
55
|
+
try: async () => {
|
|
56
|
+
const { Pool } = await import("pg");
|
|
57
|
+
const pool = new Pool({
|
|
58
|
+
connectionString: url,
|
|
59
|
+
connectionTimeoutMillis: 3e3
|
|
60
|
+
});
|
|
61
|
+
try {
|
|
62
|
+
const client = await pool.connect();
|
|
63
|
+
try {
|
|
64
|
+
await client.query("SELECT 1");
|
|
65
|
+
return true;
|
|
66
|
+
} finally {
|
|
67
|
+
client.release();
|
|
68
|
+
}
|
|
69
|
+
} finally {
|
|
70
|
+
await pool.end().catch(() => {});
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
catch: (cause) => new PreflightConnectionError({ cause })
|
|
74
|
+
}).pipe(effect.Effect.orElseSucceed(() => false));
|
|
66
75
|
});
|
|
67
76
|
}
|
|
68
77
|
function preflightTargetsFromEnv(env) {
|
|
@@ -101,18 +110,20 @@ function preflightLocalInfra(env, overrides) {
|
|
|
101
110
|
if (target.kind === "postgres") {
|
|
102
111
|
if (yield* checkPgConnection(target.url)) return null;
|
|
103
112
|
const tcpOk = yield* checkTcpReachable(target.host, target.port);
|
|
104
|
-
const pluginContext = target.secret.
|
|
113
|
+
const pluginContext = target.secret === "API_DATABASE_URL" || target.secret === "AUTH_DATABASE_URL" ? " Run `docker compose up -d --wait` to start local Postgres." : ` The plugin for ${target.secret} runs inside the local host process, so this DB must be reachable. Run \`docker compose up -d --wait\` to start local Postgres.`;
|
|
105
114
|
if (tcpOk) return {
|
|
106
115
|
secret: target.secret,
|
|
107
116
|
host: target.host,
|
|
108
117
|
port: target.port,
|
|
109
|
-
error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}
|
|
118
|
+
error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}`,
|
|
119
|
+
tcpReachable: true
|
|
110
120
|
};
|
|
111
121
|
return {
|
|
112
122
|
secret: target.secret,
|
|
113
123
|
host: target.host,
|
|
114
124
|
port: target.port,
|
|
115
|
-
error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}
|
|
125
|
+
error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}`,
|
|
126
|
+
tcpReachable: false
|
|
116
127
|
};
|
|
117
128
|
}
|
|
118
129
|
if (yield* checkTcpReachable(target.host, target.port)) return null;
|
|
@@ -120,7 +131,8 @@ function preflightLocalInfra(env, overrides) {
|
|
|
120
131
|
secret: target.secret,
|
|
121
132
|
host: target.host,
|
|
122
133
|
port: target.port,
|
|
123
|
-
error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening
|
|
134
|
+
error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening`,
|
|
135
|
+
tcpReachable: false
|
|
124
136
|
};
|
|
125
137
|
}), { concurrency: "unbounded" }).pipe(effect.Effect.map((results) => results.filter((r) => r !== null)));
|
|
126
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.cjs","names":["Effect"],"sources":["../../src/infra/preflight.ts"],"sourcesContent":["import { createConnection } from \"node:net\";\nimport { Effect } from \"effect\";\n\nexport interface PreflightTarget {\n secret: string;\n host: string;\n port: number;\n kind: \"postgres\" | \"redis\";\n url: string;\n}\n\nexport interface PreflightFailure {\n secret: string;\n host: string;\n port: number;\n error: string;\n}\n\nfunction parseLocalUrl(url: string): { host: string; port: number } | null {\n try {\n const
|
|
1
|
+
{"version":3,"file":"preflight.cjs","names":["Data","Effect","createConnection"],"sources":["../../src/infra/preflight.ts"],"sourcesContent":["import { createConnection } from \"node:net\";\nimport { Data, Effect } from \"effect\";\n\nclass PreflightConnectionError extends Data.TaggedError(\"PreflightConnectionError\")<{\n readonly cause: unknown;\n}> {\n override get message() {\n return `Postgres connection failed: ${\n this.cause instanceof Error ? this.cause.message : String(this.cause)\n }`;\n }\n}\n\nconst scheduleTimeout = (ms: number, fn: () => void): ReturnType<typeof setTimeout> =>\n setTimeout(fn, ms);\n\nexport interface PreflightTarget {\n secret: string;\n host: string;\n port: number;\n kind: \"postgres\" | \"redis\";\n url: string;\n}\n\nexport interface PreflightFailure {\n secret: string;\n host: string;\n port: number;\n error: string;\n /** True when the target port accepted a TCP connection (so docker compose cannot fix this failure). */\n tcpReachable: boolean;\n}\n\nfunction parseLocalUrl(url: string): { host: string; port: number } | null {\n try {\n const parsed = new URL(url);\n const host = parsed.hostname;\n if (host !== \"localhost\" && host !== \"127.0.0.1\" && host !== \"::1\") return null;\n const port = Number.parseInt(parsed.port, 10);\n if (Number.isNaN(port)) {\n const fallback = parsed.protocol === \"redis:\" ? 6379 : 5432;\n return { host, port: fallback };\n }\n return { host, port };\n } catch {\n return null;\n }\n}\n\nfunction checkTcpReachable(host: string, port: number, timeoutMs = 2000): Effect.Effect<boolean> {\n return Effect.callback<boolean>((resume) => {\n const socket = createConnection({ host, port });\n const timer = scheduleTimeout(timeoutMs, () => {\n socket.destroy();\n resume(Effect.succeed(false));\n });\n\n socket.once(\"connect\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(true));\n });\n\n socket.once(\"error\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(false));\n });\n });\n}\n\nfunction checkPgConnection(url: string): Effect.Effect<boolean> {\n return Effect.gen(function* () {\n const reachable = yield* checkTcpReachable(\n new URL(url).hostname,\n Number(new URL(url).port) || 5432,\n 4000,\n );\n if (!reachable) return false;\n\n return yield* Effect.tryPromise({\n try: async () => {\n const { Pool } = await import(\"pg\");\n const pool = new Pool({ connectionString: url, connectionTimeoutMillis: 3000 });\n try {\n const client = await pool.connect();\n try {\n await client.query(\"SELECT 1\");\n return true;\n } finally {\n client.release();\n }\n } finally {\n await pool.end().catch(() => {});\n }\n },\n catch: (cause) => new PreflightConnectionError({ cause }),\n }).pipe(Effect.orElseSucceed(() => false));\n });\n}\n\nfunction preflightTargetsFromEnv(env: Record<string, string>): PreflightTarget[] {\n const targets: PreflightTarget[] = [];\n for (const [secret, value] of Object.entries(env)) {\n if (!value) continue;\n if (secret.endsWith(\"_DATABASE_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({\n secret,\n host: parsed.host,\n port: parsed.port,\n kind: \"postgres\",\n url: value,\n });\n }\n } else if (secret.endsWith(\"_REDIS_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({ secret, host: parsed.host, port: parsed.port, kind: \"redis\", url: value });\n }\n }\n }\n return targets;\n}\n\nexport function preflightLocalInfra(\n env: Record<string, string>,\n overrides?: Record<string, string>,\n): Effect.Effect<PreflightFailure[], never> {\n const merged = overrides ? { ...env, ...overrides } : env;\n const targets = preflightTargetsFromEnv(merged);\n if (targets.length === 0) return Effect.succeed([]);\n\n return Effect.forEach(\n targets,\n (target) =>\n Effect.gen(function* () {\n if (target.kind === \"postgres\") {\n const ok = yield* checkPgConnection(target.url);\n if (ok) return null;\n const tcpOk = yield* checkTcpReachable(target.host, target.port);\n const appDb =\n target.secret === \"API_DATABASE_URL\" || target.secret === \"AUTH_DATABASE_URL\";\n const pluginContext = appDb\n ? \" Run `docker compose up -d --wait` to start local Postgres.\"\n : ` The plugin for ${target.secret} runs inside the local host process, so this DB must be reachable. Run \\`docker compose up -d --wait\\` to start local Postgres.`;\n if (tcpOk) {\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}`,\n tcpReachable: true,\n } satisfies PreflightFailure;\n }\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}`,\n tcpReachable: false,\n } satisfies PreflightFailure;\n }\n\n const reachable = yield* checkTcpReachable(target.host, target.port);\n if (reachable) return null;\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening`,\n tcpReachable: false,\n } satisfies PreflightFailure;\n }),\n { concurrency: \"unbounded\" },\n ).pipe(Effect.map((results) => results.filter((r):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,CAAC,CAAC;CAElD,OAAOA,cAAO,QACZ,UACC,WACCA,cAAO,IAAI,aAAa;EACtB,IAAI,OAAO,SAAS,YAAY;GAE9B,IAAI,OADc,kBAAkB,OAAO,GAAG,GACtC,OAAO;GACf,MAAM,QAAQ,OAAO,kBAAkB,OAAO,MAAM,OAAO,IAAI;GAG/D,MAAM,gBADJ,OAAO,WAAW,sBAAsB,OAAO,WAAW,sBAExD,gEACA,mBAAmB,OAAO,OAAO;GACrC,IAAI,OACF,OAAO;IACL,QAAQ,OAAO;IACf,MAAM,OAAO;IACb,MAAM,OAAO;IACb,OAAO,GAAG,OAAO,OAAO,MAAM,OAAO,KAAK,GAAG,OAAO,KAAK,oFAAoF;IAC7I,cAAc;GAChB;GAEF,OAAO;IACL,QAAQ,OAAO;IACf,MAAM,OAAO;IACb,MAAM,OAAO;IACb,OAAO,GAAG,OAAO,OAAO,aAAa,OAAO,KAAK,GAAG,OAAO,KAAK,4BAA4B;IAC5F,cAAc;GAChB;EACF;EAGA,IAAI,OADqB,kBAAkB,OAAO,MAAM,OAAO,IAAI,GACpD,OAAO;EACtB,OAAO;GACL,QAAQ,OAAO;GACf,MAAM,OAAO;GACb,MAAM,OAAO;GACb,OAAO,GAAG,OAAO,OAAO,aAAa,OAAO,KAAK,GAAG,OAAO,KAAK;GAChE,cAAc;EAChB;CACF,CAAC,GACH,EAAE,aAAa,YAAY,CAC7B,CAAC,CAAC,KAAKA,cAAO,KAAK,YAAY,QAAQ,QAAQ,MAA6B,MAAM,IAAI,CAAC,CAAC;AAC1F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
package/dist/infra/preflight.mjs
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
1
|
+
import { Data, Effect } from "effect";
|
|
2
2
|
import { createConnection } from "node:net";
|
|
3
3
|
|
|
4
4
|
//#region src/infra/preflight.ts
|
|
5
|
+
var PreflightConnectionError = class extends Data.TaggedError("PreflightConnectionError") {
|
|
6
|
+
get message() {
|
|
7
|
+
return `Postgres connection failed: ${this.cause instanceof Error ? this.cause.message : String(this.cause)}`;
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
const scheduleTimeout = (ms, fn) => setTimeout(fn, ms);
|
|
5
11
|
function parseLocalUrl(url) {
|
|
6
12
|
try {
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const port = Number.parseInt(
|
|
11
|
-
if (Number.isNaN(port)) return
|
|
12
|
-
|
|
13
|
+
const parsed = new URL(url);
|
|
14
|
+
const host = parsed.hostname;
|
|
15
|
+
if (host !== "localhost" && host !== "127.0.0.1" && host !== "::1") return null;
|
|
16
|
+
const port = Number.parseInt(parsed.port, 10);
|
|
17
|
+
if (Number.isNaN(port)) return {
|
|
18
|
+
host,
|
|
19
|
+
port: parsed.protocol === "redis:" ? 6379 : 5432
|
|
20
|
+
};
|
|
13
21
|
return {
|
|
14
22
|
host,
|
|
15
23
|
port
|
|
@@ -19,15 +27,15 @@ function parseLocalUrl(url) {
|
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
29
|
function checkTcpReachable(host, port, timeoutMs = 2e3) {
|
|
22
|
-
return Effect.
|
|
30
|
+
return Effect.callback((resume) => {
|
|
23
31
|
const socket = createConnection({
|
|
24
32
|
host,
|
|
25
33
|
port
|
|
26
34
|
});
|
|
27
|
-
const timer =
|
|
35
|
+
const timer = scheduleTimeout(timeoutMs, () => {
|
|
28
36
|
socket.destroy();
|
|
29
37
|
resume(Effect.succeed(false));
|
|
30
|
-
}
|
|
38
|
+
});
|
|
31
39
|
socket.once("connect", () => {
|
|
32
40
|
clearTimeout(timer);
|
|
33
41
|
socket.destroy();
|
|
@@ -43,26 +51,27 @@ function checkTcpReachable(host, port, timeoutMs = 2e3) {
|
|
|
43
51
|
function checkPgConnection(url) {
|
|
44
52
|
return Effect.gen(function* () {
|
|
45
53
|
if (!(yield* checkTcpReachable(new URL(url).hostname, Number(new URL(url).port) || 5432, 4e3))) return false;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
return yield* Effect.tryPromise({
|
|
55
|
+
try: async () => {
|
|
56
|
+
const { Pool } = await import("pg");
|
|
57
|
+
const pool = new Pool({
|
|
58
|
+
connectionString: url,
|
|
59
|
+
connectionTimeoutMillis: 3e3
|
|
60
|
+
});
|
|
61
|
+
try {
|
|
62
|
+
const client = await pool.connect();
|
|
63
|
+
try {
|
|
64
|
+
await client.query("SELECT 1");
|
|
65
|
+
return true;
|
|
66
|
+
} finally {
|
|
67
|
+
client.release();
|
|
68
|
+
}
|
|
69
|
+
} finally {
|
|
70
|
+
await pool.end().catch(() => {});
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
catch: (cause) => new PreflightConnectionError({ cause })
|
|
74
|
+
}).pipe(Effect.orElseSucceed(() => false));
|
|
66
75
|
});
|
|
67
76
|
}
|
|
68
77
|
function preflightTargetsFromEnv(env) {
|
|
@@ -101,18 +110,20 @@ function preflightLocalInfra(env, overrides) {
|
|
|
101
110
|
if (target.kind === "postgres") {
|
|
102
111
|
if (yield* checkPgConnection(target.url)) return null;
|
|
103
112
|
const tcpOk = yield* checkTcpReachable(target.host, target.port);
|
|
104
|
-
const pluginContext = target.secret.
|
|
113
|
+
const pluginContext = target.secret === "API_DATABASE_URL" || target.secret === "AUTH_DATABASE_URL" ? " Run `docker compose up -d --wait` to start local Postgres." : ` The plugin for ${target.secret} runs inside the local host process, so this DB must be reachable. Run \`docker compose up -d --wait\` to start local Postgres.`;
|
|
105
114
|
if (tcpOk) return {
|
|
106
115
|
secret: target.secret,
|
|
107
116
|
host: target.host,
|
|
108
117
|
port: target.port,
|
|
109
|
-
error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}
|
|
118
|
+
error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}`,
|
|
119
|
+
tcpReachable: true
|
|
110
120
|
};
|
|
111
121
|
return {
|
|
112
122
|
secret: target.secret,
|
|
113
123
|
host: target.host,
|
|
114
124
|
port: target.port,
|
|
115
|
-
error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}
|
|
125
|
+
error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}`,
|
|
126
|
+
tcpReachable: false
|
|
116
127
|
};
|
|
117
128
|
}
|
|
118
129
|
if (yield* checkTcpReachable(target.host, target.port)) return null;
|
|
@@ -120,7 +131,8 @@ function preflightLocalInfra(env, overrides) {
|
|
|
120
131
|
secret: target.secret,
|
|
121
132
|
host: target.host,
|
|
122
133
|
port: target.port,
|
|
123
|
-
error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening
|
|
134
|
+
error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening`,
|
|
135
|
+
tcpReachable: false
|
|
124
136
|
};
|
|
125
137
|
}), { concurrency: "unbounded" }).pipe(Effect.map((results) => results.filter((r) => r !== null)));
|
|
126
138
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preflight.mjs","names":[],"sources":["../../src/infra/preflight.ts"],"sourcesContent":["import { createConnection } from \"node:net\";\nimport { Effect } from \"effect\";\n\nexport interface PreflightTarget {\n secret: string;\n host: string;\n port: number;\n kind: \"postgres\" | \"redis\";\n url: string;\n}\n\nexport interface PreflightFailure {\n secret: string;\n host: string;\n port: number;\n error: string;\n}\n\nfunction parseLocalUrl(url: string): { host: string; port: number } | null {\n try {\n const
|
|
1
|
+
{"version":3,"file":"preflight.mjs","names":[],"sources":["../../src/infra/preflight.ts"],"sourcesContent":["import { createConnection } from \"node:net\";\nimport { Data, Effect } from \"effect\";\n\nclass PreflightConnectionError extends Data.TaggedError(\"PreflightConnectionError\")<{\n readonly cause: unknown;\n}> {\n override get message() {\n return `Postgres connection failed: ${\n this.cause instanceof Error ? this.cause.message : String(this.cause)\n }`;\n }\n}\n\nconst scheduleTimeout = (ms: number, fn: () => void): ReturnType<typeof setTimeout> =>\n setTimeout(fn, ms);\n\nexport interface PreflightTarget {\n secret: string;\n host: string;\n port: number;\n kind: \"postgres\" | \"redis\";\n url: string;\n}\n\nexport interface PreflightFailure {\n secret: string;\n host: string;\n port: number;\n error: string;\n /** True when the target port accepted a TCP connection (so docker compose cannot fix this failure). */\n tcpReachable: boolean;\n}\n\nfunction parseLocalUrl(url: string): { host: string; port: number } | null {\n try {\n const parsed = new URL(url);\n const host = parsed.hostname;\n if (host !== \"localhost\" && host !== \"127.0.0.1\" && host !== \"::1\") return null;\n const port = Number.parseInt(parsed.port, 10);\n if (Number.isNaN(port)) {\n const fallback = parsed.protocol === \"redis:\" ? 6379 : 5432;\n return { host, port: fallback };\n }\n return { host, port };\n } catch {\n return null;\n }\n}\n\nfunction checkTcpReachable(host: string, port: number, timeoutMs = 2000): Effect.Effect<boolean> {\n return Effect.callback<boolean>((resume) => {\n const socket = createConnection({ host, port });\n const timer = scheduleTimeout(timeoutMs, () => {\n socket.destroy();\n resume(Effect.succeed(false));\n });\n\n socket.once(\"connect\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(true));\n });\n\n socket.once(\"error\", () => {\n clearTimeout(timer);\n socket.destroy();\n resume(Effect.succeed(false));\n });\n });\n}\n\nfunction checkPgConnection(url: string): Effect.Effect<boolean> {\n return Effect.gen(function* () {\n const reachable = yield* checkTcpReachable(\n new URL(url).hostname,\n Number(new URL(url).port) || 5432,\n 4000,\n );\n if (!reachable) return false;\n\n return yield* Effect.tryPromise({\n try: async () => {\n const { Pool } = await import(\"pg\");\n const pool = new Pool({ connectionString: url, connectionTimeoutMillis: 3000 });\n try {\n const client = await pool.connect();\n try {\n await client.query(\"SELECT 1\");\n return true;\n } finally {\n client.release();\n }\n } finally {\n await pool.end().catch(() => {});\n }\n },\n catch: (cause) => new PreflightConnectionError({ cause }),\n }).pipe(Effect.orElseSucceed(() => false));\n });\n}\n\nfunction preflightTargetsFromEnv(env: Record<string, string>): PreflightTarget[] {\n const targets: PreflightTarget[] = [];\n for (const [secret, value] of Object.entries(env)) {\n if (!value) continue;\n if (secret.endsWith(\"_DATABASE_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({\n secret,\n host: parsed.host,\n port: parsed.port,\n kind: \"postgres\",\n url: value,\n });\n }\n } else if (secret.endsWith(\"_REDIS_URL\")) {\n const parsed = parseLocalUrl(value);\n if (parsed) {\n targets.push({ secret, host: parsed.host, port: parsed.port, kind: \"redis\", url: value });\n }\n }\n }\n return targets;\n}\n\nexport function preflightLocalInfra(\n env: Record<string, string>,\n overrides?: Record<string, string>,\n): Effect.Effect<PreflightFailure[], never> {\n const merged = overrides ? { ...env, ...overrides } : env;\n const targets = preflightTargetsFromEnv(merged);\n if (targets.length === 0) return Effect.succeed([]);\n\n return Effect.forEach(\n targets,\n (target) =>\n Effect.gen(function* () {\n if (target.kind === \"postgres\") {\n const ok = yield* checkPgConnection(target.url);\n if (ok) return null;\n const tcpOk = yield* checkTcpReachable(target.host, target.port);\n const appDb =\n target.secret === \"API_DATABASE_URL\" || target.secret === \"AUTH_DATABASE_URL\";\n const pluginContext = appDb\n ? \" Run `docker compose up -d --wait` to start local Postgres.\"\n : ` The plugin for ${target.secret} runs inside the local host process, so this DB must be reachable. Run \\`docker compose up -d --wait\\` to start local Postgres.`;\n if (tcpOk) {\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} at ${target.host}:${target.port} is reachable but Postgres connection failed. Check credentials and database name.${pluginContext}`,\n tcpReachable: true,\n } satisfies PreflightFailure;\n }\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening.${pluginContext}`,\n tcpReachable: false,\n } satisfies PreflightFailure;\n }\n\n const reachable = yield* checkTcpReachable(target.host, target.port);\n if (reachable) return null;\n return {\n secret: target.secret,\n host: target.host,\n port: target.port,\n error: `${target.secret} points to ${target.host}:${target.port} but nothing is listening`,\n tcpReachable: false,\n } satisfies PreflightFailure;\n }),\n { concurrency: \"unbounded\" },\n ).pipe(Effect.map((results) => results.filter((r): r is PreflightFailure => r !== null)));\n}\n"],"mappings":";;;;AAGA,IAAM,2BAAN,cAAuC,KAAK,YAAY,0BAA0B,CAAC,CAEhF;CACD,IAAa,UAAU;EACrB,OAAO,+BACL,KAAK,iBAAiB,QAAQ,KAAK,MAAM,UAAU,OAAO,KAAK,KAAK;CAExE;AACF;AAEA,MAAM,mBAAmB,IAAY,OACnC,WAAW,IAAI,EAAE;AAmBnB,SAAS,cAAc,KAAoD;CACzE,IAAI;EACF,MAAM,SAAS,IAAI,IAAI,GAAG;EAC1B,MAAM,OAAO,OAAO;EACpB,IAAI,SAAS,eAAe,SAAS,eAAe,SAAS,OAAO,OAAO;EAC3E,MAAM,OAAO,OAAO,SAAS,OAAO,MAAM,EAAE;EAC5C,IAAI,OAAO,MAAM,IAAI,GAEnB,OAAO;GAAE;GAAM,MADE,OAAO,aAAa,WAAW,OAAO;EACzB;EAEhC,OAAO;GAAE;GAAM;EAAK;CACtB,QAAQ;EACN,OAAO;CACT;AACF;AAEA,SAAS,kBAAkB,MAAc,MAAc,YAAY,KAA8B;CAC/F,OAAO,OAAO,UAAmB,WAAW;EAC1C,MAAM,SAAS,iBAAiB;GAAE;GAAM;EAAK,CAAC;EAC9C,MAAM,QAAQ,gBAAgB,iBAAiB;GAC7C,OAAO,QAAQ;GACf,OAAO,OAAO,QAAQ,KAAK,CAAC;EAC9B,CAAC;EAED,OAAO,KAAK,iBAAiB;GAC3B,aAAa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,YAAY,QAAQ,QAAQ,MAA6B,MAAM,IAAI,CAAC,CAAC;AAC1F"}
|
package/dist/infra/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":["Data"],"sources":["../../src/infra/types.ts"],"sourcesContent":["import { Data } from \"effect\";\nimport type { AppOrchestrator } from \"../service-descriptor\";\nimport type { RuntimeConfig } from \"../types\";\n\nexport interface CliPorts {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n
|
|
1
|
+
{"version":3,"file":"types.cjs","names":["Data"],"sources":["../../src/infra/types.ts"],"sourcesContent":["import { Data } from \"effect\";\nimport type { AppOrchestrator } from \"../service-descriptor\";\nimport type { RuntimeConfig } from \"../types\";\n\nexport interface CliPorts {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n pluginsStart?: number;\n plugins?: Record<string, { api?: number; ui?: number }>;\n}\n\nexport interface ResolvedPorts {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n plugins: Record<string, { api?: number; ui?: number }>;\n}\n\nexport interface RuntimeLaunchSpec {\n port?: number;\n hostUrl?: string;\n corsOrigin?: string;\n trustedOrigins?: string[];\n env: Record<string, string>;\n runtimeConfig: RuntimeConfig;\n}\n\nexport interface ClaimRecord {\n resourceKey: string;\n pid: number;\n configDir: string;\n ports: Record<string, number>;\n startedAt: number;\n}\n\nexport interface InfraPlan {\n workspaceKey: string;\n cliPorts: CliPorts;\n resolvedPorts: ResolvedPorts;\n runtimeConfig: RuntimeConfig;\n launch: RuntimeLaunchSpec;\n description: string;\n serviceDescriptors: Map<string, ServiceDescriptorPlan>;\n envGenerated: Record<string, string>;\n claims: ClaimRecord[];\n orchestrator: AppOrchestrator;\n}\n\nexport interface ServiceDescriptorPlan {\n key: string;\n source: \"local\" | \"remote\";\n url: string;\n port?: number;\n localPath?: string;\n}\n\nexport interface DatabasePlan {\n secret: string;\n slug: string;\n port: number;\n dbName: string;\n url: string;\n}\n\nexport interface RedisPlan {\n secret: string;\n slug: string;\n port: number;\n url: string;\n}\n\nexport type InfraPhase =\n | \"resolve-config\"\n | \"allocate-services\"\n | \"allocate-databases\"\n | \"claim\"\n | \"materialize-env\"\n | \"launch\";\n\nexport class InfraError extends Data.TaggedError(\"InfraError\")<{\n phase: InfraPhase;\n message: string;\n cause?: unknown;\n}> {}\n\nexport interface InfraInput {\n configDir: string;\n bosConfig: RuntimeConfig;\n cli: {\n port?: number;\n apiPort?: number;\n authPort?: number;\n uiPort?: number;\n pluginPortStart?: number;\n plugins?: Record<string, { api?: number; ui?: number }>;\n ssr?: boolean;\n proxy?: boolean;\n hostSource?: \"local\" | \"remote\";\n uiSource?: \"local\" | \"remote\";\n apiSource?: \"local\" | \"remote\";\n authSource?: \"local\" | \"remote\";\n interactive?: boolean;\n };\n}\n"],"mappings":";;;AAkFA,IAAa,aAAb,cAAgCA,YAAK,YAAY,YAAY,CAAC,CAI3D,CAAC"}
|
package/dist/infra/types.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.mjs","names":[],"sources":["../../src/infra/types.ts"],"sourcesContent":["import { Data } from \"effect\";\nimport type { AppOrchestrator } from \"../service-descriptor\";\nimport type { RuntimeConfig } from \"../types\";\n\nexport interface CliPorts {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n
|
|
1
|
+
{"version":3,"file":"types.mjs","names":[],"sources":["../../src/infra/types.ts"],"sourcesContent":["import { Data } from \"effect\";\nimport type { AppOrchestrator } from \"../service-descriptor\";\nimport type { RuntimeConfig } from \"../types\";\n\nexport interface CliPorts {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n pluginsStart?: number;\n plugins?: Record<string, { api?: number; ui?: number }>;\n}\n\nexport interface ResolvedPorts {\n host?: number;\n api?: number;\n auth?: number;\n ui?: number;\n plugins: Record<string, { api?: number; ui?: number }>;\n}\n\nexport interface RuntimeLaunchSpec {\n port?: number;\n hostUrl?: string;\n corsOrigin?: string;\n trustedOrigins?: string[];\n env: Record<string, string>;\n runtimeConfig: RuntimeConfig;\n}\n\nexport interface ClaimRecord {\n resourceKey: string;\n pid: number;\n configDir: string;\n ports: Record<string, number>;\n startedAt: number;\n}\n\nexport interface InfraPlan {\n workspaceKey: string;\n cliPorts: CliPorts;\n resolvedPorts: ResolvedPorts;\n runtimeConfig: RuntimeConfig;\n launch: RuntimeLaunchSpec;\n description: string;\n serviceDescriptors: Map<string, ServiceDescriptorPlan>;\n envGenerated: Record<string, string>;\n claims: ClaimRecord[];\n orchestrator: AppOrchestrator;\n}\n\nexport interface ServiceDescriptorPlan {\n key: string;\n source: \"local\" | \"remote\";\n url: string;\n port?: number;\n localPath?: string;\n}\n\nexport interface DatabasePlan {\n secret: string;\n slug: string;\n port: number;\n dbName: string;\n url: string;\n}\n\nexport interface RedisPlan {\n secret: string;\n slug: string;\n port: number;\n url: string;\n}\n\nexport type InfraPhase =\n | \"resolve-config\"\n | \"allocate-services\"\n | \"allocate-databases\"\n | \"claim\"\n | \"materialize-env\"\n | \"launch\";\n\nexport class InfraError extends Data.TaggedError(\"InfraError\")<{\n phase: InfraPhase;\n message: string;\n cause?: unknown;\n}> {}\n\nexport interface InfraInput {\n configDir: string;\n bosConfig: RuntimeConfig;\n cli: {\n port?: number;\n apiPort?: number;\n authPort?: number;\n uiPort?: number;\n pluginPortStart?: number;\n plugins?: Record<string, { api?: number; ui?: number }>;\n ssr?: boolean;\n proxy?: boolean;\n hostSource?: \"local\" | \"remote\";\n uiSource?: \"local\" | \"remote\";\n apiSource?: \"local\" | \"remote\";\n authSource?: \"local\" | \"remote\";\n interactive?: boolean;\n };\n}\n"],"mappings":";;;AAkFA,IAAa,aAAb,cAAgC,KAAK,YAAY,YAAY,CAAC,CAI3D,CAAC"}
|
package/dist/integrity.cjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_http_client = require('./http-client.cjs');
|
|
3
3
|
const require_fastkv = require('./fastkv.cjs');
|
|
4
|
-
let
|
|
5
|
-
let node_path = require("node:path");
|
|
4
|
+
let effect = require("effect");
|
|
6
5
|
let node_crypto = require("node:crypto");
|
|
7
6
|
|
|
8
7
|
//#region src/integrity.ts
|
|
9
|
-
const DEFAULT_MAX_SRI_RESPONSE_BYTES =
|
|
8
|
+
const DEFAULT_MAX_SRI_RESPONSE_BYTES = 20971520;
|
|
10
9
|
function computeSriHash(content) {
|
|
11
10
|
return `sha384-${(0, node_crypto.createHash)("sha384").update(content).digest("base64")}`;
|
|
12
11
|
}
|
|
@@ -40,6 +39,15 @@ async function computeSriHashFromResponse(response, url, options) {
|
|
|
40
39
|
return `sha384-${hash.digest("base64")}`;
|
|
41
40
|
}
|
|
42
41
|
async function computeSriHashForUrl(url, options) {
|
|
42
|
+
const attempts = 3;
|
|
43
|
+
for (let attempt = 1; attempt < attempts; attempt++) {
|
|
44
|
+
const hash = await computeSriHashOnce(url, options);
|
|
45
|
+
if (hash) return hash;
|
|
46
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3 * attempt));
|
|
47
|
+
}
|
|
48
|
+
return computeSriHashOnce(url, options);
|
|
49
|
+
}
|
|
50
|
+
async function computeSriHashOnce(url, options) {
|
|
43
51
|
try {
|
|
44
52
|
const entryUrl = resolveSriTargetUrl(url, options);
|
|
45
53
|
const response = await require_http_client.fetchResponse(entryUrl, { timeout: "30 seconds" });
|
|
@@ -58,13 +66,18 @@ function resolveEntryUrl(url) {
|
|
|
58
66
|
if (url.endsWith("/mf-manifest.json")) return `${url.replace(/\/mf-manifest\.json$/, "")}/remoteEntry.js`;
|
|
59
67
|
return `${url.replace(/\/$/, "")}/remoteEntry.js`;
|
|
60
68
|
}
|
|
69
|
+
var SriVerificationError = class extends effect.Data.TaggedError("SriVerificationError") {
|
|
70
|
+
constructor(message) {
|
|
71
|
+
super({ detail: message });
|
|
72
|
+
}
|
|
73
|
+
get message() {
|
|
74
|
+
return this.detail;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
61
77
|
async function verifySriForUrl(url, expectedIntegrity, options) {
|
|
62
78
|
const entryUrl = resolveSriTargetUrl(url, options);
|
|
63
79
|
const response = await require_http_client.fetchResponse(entryUrl, { timeout: "30 seconds" });
|
|
64
|
-
if (!response.ok) {
|
|
65
|
-
console.warn(`[SRI] Failed to fetch ${entryUrl} for verification: ${response.status}`);
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
80
|
+
if (!response.ok) throw new SriVerificationError(`Failed to fetch ${entryUrl} for verification: ${response.status}`);
|
|
68
81
|
const computed = await computeSriHashFromResponse(response, entryUrl, options);
|
|
69
82
|
if (computed !== expectedIntegrity) throw new Error(`[SRI] Integrity check failed for ${entryUrl}\n Expected: ${expectedIntegrity}\n Computed: ${computed}`);
|
|
70
83
|
}
|
|
@@ -90,14 +103,32 @@ function extractIntegrityHashes(config) {
|
|
|
90
103
|
const hashes = /* @__PURE__ */ new Map();
|
|
91
104
|
const app = config.app;
|
|
92
105
|
const plugins = config.plugins;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
for (const [, entry] of Object.entries(plugins)) if (entry?.integrity && entry?.production) hashes.set(resolveEntryUrl(entry.production), entry.integrity);
|
|
106
|
+
for (const entry of [...Object.values(app ?? {}), ...Object.values(plugins ?? {})]) {
|
|
107
|
+
if (!entry) continue;
|
|
108
|
+
const slotHash = slotHashOf(entry);
|
|
109
|
+
if (slotHash) hashes.set(slotHash.key, slotHash.hash);
|
|
98
110
|
}
|
|
99
111
|
return hashes;
|
|
100
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* The integrity anchor a slot contributes to local↔chain attestation: pinned
|
|
115
|
+
* slots anchor at the pinned manifest document (the pin's SRI), unpinned
|
|
116
|
+
* slots at their fixed-name entry (the direct entry SRI).
|
|
117
|
+
*/
|
|
118
|
+
function slotHashOf(entry) {
|
|
119
|
+
const production = entry.production;
|
|
120
|
+
if (typeof production !== "string") return null;
|
|
121
|
+
const pin = entry.pin;
|
|
122
|
+
if (pin && typeof pin.manifest === "string" && typeof pin.integrity === "string") return {
|
|
123
|
+
key: `${production.replace(/\/$/, "")}/${pin.manifest.replace(/^\//, "")}`,
|
|
124
|
+
hash: pin.integrity
|
|
125
|
+
};
|
|
126
|
+
if (typeof entry.integrity === "string") return {
|
|
127
|
+
key: resolveEntryUrl(production),
|
|
128
|
+
hash: entry.integrity
|
|
129
|
+
};
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
101
132
|
async function verifyConfigAgainstChain(localConfig, bosUrl) {
|
|
102
133
|
const mismatches = [];
|
|
103
134
|
let chainConfig;
|
|
@@ -145,68 +176,26 @@ function deleteNestedPath(obj, dottedPath) {
|
|
|
145
176
|
}
|
|
146
177
|
delete current[keys[keys.length - 1]];
|
|
147
178
|
}
|
|
148
|
-
function reportDeployResult(opts) {
|
|
149
|
-
console.log(`[BOS_DEPLOY] url=${opts.url} urlField=${opts.urlField} integrityField=${opts.integrityField ?? ""} integrity=${opts.integrity ?? ""}`);
|
|
150
|
-
try {
|
|
151
|
-
const config = JSON.parse((0, node_fs.readFileSync)(opts.bosConfigPath, "utf8"));
|
|
152
|
-
setNestedPath(config, opts.urlField, opts.url);
|
|
153
|
-
if (opts.integrityField) if (opts.integrity) setNestedPath(config, opts.integrityField, opts.integrity);
|
|
154
|
-
else deleteNestedPath(config, opts.integrityField);
|
|
155
|
-
(0, node_fs.writeFileSync)(opts.bosConfigPath, `${JSON.stringify(config, null, 2)}\n`);
|
|
156
|
-
console.log(` ✅ Updated bos.config.json: ${opts.urlField}`);
|
|
157
|
-
if (opts.integrityField && opts.integrity) console.log(` ✅ Updated bos.config.json: ${opts.integrityField}`);
|
|
158
|
-
} catch (err) {
|
|
159
|
-
console.error(" ❌ Failed to update bos.config.json:", err.message);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
function parseDeployLines(output) {
|
|
163
|
-
const results = [];
|
|
164
|
-
for (const line of output.split("\n")) {
|
|
165
|
-
if (!line.includes("[BOS_DEPLOY]")) continue;
|
|
166
|
-
const urlMatch = line.match(/url=(\S+)/);
|
|
167
|
-
const urlFieldMatch = line.match(/urlField=(\S+)/);
|
|
168
|
-
if (!urlMatch || !urlFieldMatch) continue;
|
|
169
|
-
const integrityFieldMatch = line.match(/integrityField=(\S+)/);
|
|
170
|
-
const integrityMatch = line.match(/integrity=(\S+)/);
|
|
171
|
-
results.push({
|
|
172
|
-
url: urlMatch[1],
|
|
173
|
-
urlField: urlFieldMatch[1],
|
|
174
|
-
integrityField: integrityFieldMatch?.[1] || void 0,
|
|
175
|
-
integrity: integrityMatch?.[1] || void 0
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
return results;
|
|
179
|
-
}
|
|
180
179
|
function applyDeployResults(config, results) {
|
|
181
180
|
const merged = structuredClone(config);
|
|
182
181
|
for (const result of results) {
|
|
183
182
|
setNestedPath(merged, result.urlField, result.url);
|
|
184
|
-
if (result.integrityField)
|
|
185
|
-
|
|
183
|
+
if (result.integrityField) {
|
|
184
|
+
if (result.integrity) setNestedPath(merged, result.integrityField, result.integrity);
|
|
185
|
+
else deleteNestedPath(merged, result.integrityField);
|
|
186
|
+
}
|
|
187
|
+
if (result.valueField && result.value !== void 0 && result.value !== null) setNestedPath(merged, result.valueField, result.value);
|
|
188
|
+
for (const field of result.removeFields ?? []) deleteNestedPath(merged, field);
|
|
186
189
|
}
|
|
187
190
|
return merged;
|
|
188
191
|
}
|
|
189
|
-
function findPluginKey(bosConfigPath, pluginDir) {
|
|
190
|
-
const plugins = JSON.parse((0, node_fs.readFileSync)(bosConfigPath, "utf8")).plugins;
|
|
191
|
-
if (!plugins) return null;
|
|
192
|
-
const configRoot = (0, node_path.join)(bosConfigPath, "..");
|
|
193
|
-
const normalizedPluginDir = pluginDir.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
194
|
-
for (const [key, plugin] of Object.entries(plugins)) {
|
|
195
|
-
const dev = plugin?.development;
|
|
196
|
-
if (typeof dev !== "string" || !dev.startsWith("local:")) continue;
|
|
197
|
-
if ((0, node_path.join)(configRoot, dev.slice(6)).replace(/\\/g, "/").replace(/\/+$/, "") === normalizedPluginDir) return key;
|
|
198
|
-
}
|
|
199
|
-
return null;
|
|
200
|
-
}
|
|
201
192
|
|
|
202
193
|
//#endregion
|
|
203
194
|
exports.IntegrityRegistry = IntegrityRegistry;
|
|
195
|
+
exports.SriVerificationError = SriVerificationError;
|
|
204
196
|
exports.applyDeployResults = applyDeployResults;
|
|
205
197
|
exports.computeSriHash = computeSriHash;
|
|
206
198
|
exports.computeSriHashForUrl = computeSriHashForUrl;
|
|
207
|
-
exports.findPluginKey = findPluginKey;
|
|
208
|
-
exports.parseDeployLines = parseDeployLines;
|
|
209
|
-
exports.reportDeployResult = reportDeployResult;
|
|
210
199
|
exports.resolveEntryUrl = resolveEntryUrl;
|
|
211
200
|
exports.verifyConfigAgainstChain = verifyConfigAgainstChain;
|
|
212
201
|
exports.verifySriForUrl = verifySriForUrl;
|