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
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: registry
|
|
3
|
+
description: Read and write the FastKV config registry efficiently — key layout, namespace=signer semantics, integrity, and composing published runtimes into the local authored config. Use when publishing configs, composing another runtime's UI/host/api/plugins, or debugging why a published config doesn't resolve.
|
|
4
|
+
metadata:
|
|
5
|
+
sources: "packages/everything-dev/src/fastkv.ts,packages/everything-dev/src/publish.ts,packages/everything-dev/src/near-signer.ts,packages/everything-dev/src/registry-use.ts,packages/everything-dev/src/plugin.ts"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# FastKV Registry — Efficient Read & Write
|
|
9
|
+
|
|
10
|
+
## The one law: namespace = transaction signer
|
|
11
|
+
|
|
12
|
+
FastKV (`__fastdata_kv` on `dev.everything.near` mainnet / `dev.allthethings.testnet` testnet) has **no ACL** — anyone can write any key. Access control lives entirely in the **read indexing**: entries resolve at `/v0/latest/<contract>/<predecessor_id>/<key>`, where `predecessor_id` is the account that **signed** the write.
|
|
13
|
+
|
|
14
|
+
Consequences:
|
|
15
|
+
|
|
16
|
+
- A config published at `bos://<account>/<gateway>` is visible **only if signed by `<account>` itself** (FCAK or wallet/NEP-366 delegate).
|
|
17
|
+
- A relayer signing its own transaction writes to the *relayer's* namespace — invisible at the publisher's bos:// URL. There is no "sign on behalf of" without the publisher's key (direct FCAK or NEP-366 delegate).
|
|
18
|
+
- Reads cannot be poisoned by third parties; a leaked FCAK can only pollute its own account's namespace.
|
|
19
|
+
- Every read response carries `predecessor_id`, `block_height`, `block_timestamp`, and the entry `key` — on-chain provenance for free.
|
|
20
|
+
|
|
21
|
+
## Key layout
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
apps/<account>/<gateway>/bos.config.json # a published runtime config
|
|
25
|
+
nostr/<account> # (contextual.near) NEAR↔nostr identity binding
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Read URL (plain HTTP, no auth):
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
https://kv.main.fastnear.com/v0/latest/dev.everything.near/<account>/apps%2F<account>%2F<gateway>%2Fbos.config.json
|
|
32
|
+
https://kv.test.fastnear.com/... # testnet
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Or in code: `fetchBosConfigFromFastKv("bos://<account>/<gateway>")` from `everything-dev/fastkv`.
|
|
36
|
+
|
|
37
|
+
## Writing (bos publish)
|
|
38
|
+
|
|
39
|
+
`bos publish [--deploy]` signs the registry transaction **in-process** via near-kit — no near-cli-rs, no external binary:
|
|
40
|
+
|
|
41
|
+
1. Key resolution: explicit key → `NEAR_PRIVATE_KEY` / `BOS_NEAR_PRIVATE_KEY` env → `~/.near-credentials/<network>/<account>.json` (near-cli-rs compatible, via `FileKeyStore`) → near-cli-rs OS keychain (`sign-with-keychain`, interactive terminals only).
|
|
42
|
+
2. The transaction is a function call on the namespace contract (`__fastdata_kv`) with `{ "apps/<account>/<gateway>/bos.config.json": "<config json>" }`, gas `300 Tgas`, deposit `0`.
|
|
43
|
+
3. Publishes are **skipped** when FastKV already holds an identical config (`isConfigAlreadyPublished`) — free no-op detection before spending gas.
|
|
44
|
+
4. `waitForPublishedConfig` re-reads the registry until the published value matches (confirmation, ~120s timeout).
|
|
45
|
+
|
|
46
|
+
Mint the scoped signing key with `bos key generate` (function-call key restricted to `__fastdata_kv` with an allowance — the allowance bounds leak damage).
|
|
47
|
+
|
|
48
|
+
## Reading / composing another runtime (bos registry use)
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
bos registry use v1.citynode.near/citynode.app --sections app.ui,app.host --dry-run
|
|
52
|
+
bos registry use v1.citynode.near/citynode.app --sections app.ui,plugins.apps
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Composable sections: `app.ui`, `app.host`, `app.api`, `app.auth`, `plugins.<key>` — taken verbatim (production URL + integrity) from the published config.
|
|
56
|
+
- Everything else in the local authored config (account, domain, extends, other sections) is preserved.
|
|
57
|
+
- `--dry-run` previews; after writing, run `bos types gen` to refresh generated types.
|
|
58
|
+
|
|
59
|
+
`extends` (inherit a whole runtime lineage) vs `registry use` (attach specific sections): extends merges the parent's config at resolution time; registry use copies concrete sections into your own config — pick extends for inheritance, registry use for à-la-carte composition.
|
|
60
|
+
|
|
61
|
+
## Common mistakes
|
|
62
|
+
|
|
63
|
+
- **Config "missing" after publishing with the wrong key** — the write landed under the signing account's namespace, not the config's `account`. Sign with the account named in the authored config.
|
|
64
|
+
- **Editing the committed authored config URLs and expecting runtime changes** — the runtime source of truth is FastKV; the repo copy is the publish *input*.
|
|
65
|
+
- **Expecting near-cli-rs for publish** — signing is in-process; near-cli-rs is only needed for `bos key generate` (interactive keychain) and account management.
|
|
66
|
+
|
|
67
|
+
## The tasks you will actually be given
|
|
68
|
+
|
|
69
|
+
**"Attach a section from another runtime."** `bos registry use <account>/<gateway> --sections app.ui,plugins.apps --dry-run` first, then the real run, then `bos types gen` to refresh generated types.
|
|
70
|
+
|
|
71
|
+
**"Debug: my publish isn't visible."** Fetch the exact read URL (`https://kv.main.fastnear.com/v0/latest/dev.everything.near/<account>/apps%2F<account>%2F<gateway>%2Fbos.config.json`) and compare the response's `predecessor_id` to the account you signed with.
|
|
72
|
+
|
|
73
|
+
**"Publish without double-spending gas."** Just run `bos publish` — `isConfigAlreadyPublished` skips identical configs before signing, and `waitForPublishedConfig` confirms the read-back (~120s timeout).
|
|
74
|
+
|
|
75
|
+
## What comes back when it refuses
|
|
76
|
+
|
|
77
|
+
| word | do |
|
|
78
|
+
|---|---|
|
|
79
|
+
| read 404 / config "missing" right after publish | the write landed under the signer's namespace, not the config's `account` — sign with the account named in the authored config (`bos key generate` FCAK, or the wallet/delegate) |
|
|
80
|
+
| publish errors before signing | preflight failed — key resolution or registry URL; check `NEAR_PRIVATE_KEY` / `BOS_NEAR_PRIVATE_KEY` / `~/.near-credentials/<network>/<account>.json` |
|
|
81
|
+
| `waitForPublishedConfig` timeout | the read-back didn't match within ~120s — fetch the URL by hand; if `predecessor_id` is wrong, the wrong key signed |
|
|
82
|
+
| relayer-signed publish invisible | a relayer signing its own tx writes to the *relayer's* namespace — there is no sign-on-behalf; use the publisher's FCAK or a NEP-366 delegate |
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: super-app
|
|
3
3
|
description: Build shared-host, shared-API super apps with tenant-specific UI composition. Use when setting up a base runtime plus custom tenant apps, configuring fixed-core multi-tenancy, reasoning about extends-based runtime lineage, or deciding what tenants can override today.
|
|
4
4
|
metadata:
|
|
5
|
-
sources: "host/src/services/tenant-runtime.ts,host/src/program.ts,host/src/services/federation.server.ts,packages/everything-dev/src/config.ts"
|
|
5
|
+
sources: "host/src/services/tenant-runtime.ts,host/src/services/binding-resolver.ts,host/src/program.ts,host/src/services/federation.server.ts,packages/everything-dev/src/config.ts"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Super Apps
|
|
@@ -64,7 +64,7 @@ bos publish --deploy
|
|
|
64
64
|
|
|
65
65
|
### 3. Create a descendant runtime that extends the base runtime
|
|
66
66
|
|
|
67
|
-
Child runtime
|
|
67
|
+
Child runtime authored config:
|
|
68
68
|
|
|
69
69
|
```json
|
|
70
70
|
{
|
|
@@ -87,20 +87,13 @@ This runtime is still a lineage child because it extends the parent, but it is a
|
|
|
87
87
|
|
|
88
88
|
You can also override existing plugin UIs and sidebar entries for tenant-specific navigation.
|
|
89
89
|
|
|
90
|
-
## Host
|
|
90
|
+
## Host Resolution For Tenant Mode
|
|
91
91
|
|
|
92
|
-
The shared host
|
|
92
|
+
The shared host resolves tenant permissions from the API, not env vars. It fetches the tenant bindings map from the API's `GET /tenants/bindings` endpoint (cached for 30s) and applies DB-backed per-tenant permissions:
|
|
93
93
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
ALLOW_UNTRUSTED_SSR=false
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Meaning:
|
|
101
|
-
- `ALLOW_OVERRIDE` controls which tenant config sections can affect request-scoped composition. Format: comma-separated list (e.g., `ui,plugins.*`) where `plugins.*` is a glob matching all plugin overrides
|
|
102
|
-
- `TENANT_WHITELIST` controls which tenants may use SSR
|
|
103
|
-
- `ALLOW_UNTRUSTED_SSR=true` allows SSR for any valid tenant with SSR config
|
|
94
|
+
- `allow_ui_overrides` controls whether the tenant `ui` override can affect request-scoped composition
|
|
95
|
+
- `allow_backend_overrides` controls whether tenant plugin UI overrides (`plugins.<id>.ui`, `plugins.<id>.sidebar`) are applied
|
|
96
|
+
- `allow_ssr` controls whether the tenant may use SSR
|
|
104
97
|
|
|
105
98
|
## Resolution Rules
|
|
106
99
|
|
|
@@ -141,7 +134,7 @@ If tenant overrides are not applying as expected:
|
|
|
141
134
|
1. **Verify the tenant config exists in FastKV**: The config must be published to `{tenantAccount}/bos/gateways/{gateway}/bos.config.json`
|
|
142
135
|
2. **Check extends chain**: The tenant config must extend the base runtime via its `extends` field
|
|
143
136
|
3. **Check host logs**: Run `cat .bos/logs/host.log` and look for tenant resolution messages — the host logs which runtime config it resolved for each request
|
|
144
|
-
4. **Check
|
|
137
|
+
4. **Check tenant permissions**: the tenant record must have the relevant allow flag set in the database (e.g., `allow_ui_overrides` for a `ui` override, `allow_backend_overrides` for plugin UI overrides)
|
|
145
138
|
5. **Verify integrity**: If tenant remote URLs have integrity hashes, the host validates them — mismatches cause rejection
|
|
146
139
|
6. **Missing tenant config**: If the tenant config is not found in FastKV, the host silently serves the base runtime config without tenant overrides — no error is surfaced to the browser
|
|
147
140
|
|
|
@@ -175,3 +168,20 @@ After publishing config changes that affect the base host runtime, restart the h
|
|
|
175
168
|
- Use `everything-dev#extends-config` for deep-merge and resolved-config semantics.
|
|
176
169
|
- Use `everything-dev#publish-sync` for publish and deploy steps.
|
|
177
170
|
- Use this `super-app` skill when the question is specifically about the shared-host, shared-API multi-tenant architecture.
|
|
171
|
+
|
|
172
|
+
## The tasks you will actually be given
|
|
173
|
+
|
|
174
|
+
**"Set up a shared-host tenant."** Base: `bos init --overrides ui,api,host` then `bos publish --deploy`. Child: authored config with `extends` + its own `account`/`domain`, override `app.ui` only, publish it; register the tenant row with the right allow flags in the DB.
|
|
175
|
+
|
|
176
|
+
**"Tenant overrides are not applying."** Walk the checklist in order: config exists in FastKV → extends the base runtime → tenant record allow flags set → host logs (`cat .bos/logs/host.log`) → integrity hashes on the tenant remotes valid.
|
|
177
|
+
|
|
178
|
+
**"This tenant needs SSR."** Set `allow_ssr` on the tenant record — the host's BindingResolver reads permissions from `GET /tenants/bindings` (cached 30s); without the flag the tenant falls back to client rendering.
|
|
179
|
+
|
|
180
|
+
## What comes back when it refuses
|
|
181
|
+
|
|
182
|
+
| word | do |
|
|
183
|
+
|---|---|
|
|
184
|
+
| tenant config missing in FastKV | the host silently serves the base runtime — no error surfaces to the browser; verify the published path and the signer namespace |
|
|
185
|
+
| `Tenant resolution is unavailable: the API plugin failed to load` | the BindingResolver can't reach `/api/tenants/bindings` — check `GET /api/_health` and the startup plugin-load errors, republish the API |
|
|
186
|
+
| integrity rejection of a tenant remote | HTML/SSR requests block immediately, assets fall back — redeploy the tenant bundle and republish so the SRI matches |
|
|
187
|
+
| overrides still stale after publishing | the host boots one base snapshot and caches tenant configs — restart the host (or wait out the cache TTL) |
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: talk-to-the-app
|
|
3
|
+
description: Work a running everything.dev app over its API without cloning it — MCP tools, REST/OpenAPI, oRPC RPC, plugin RPC, API-key authentication, and discovery endpoints. Use when an agent needs to read or write app data (registry, proposals, votes, auth session, AI chat) over HTTP, choose between MCP/REST/RPC surfaces, or debug authentication and refused calls.
|
|
4
|
+
metadata:
|
|
5
|
+
sources: "host/src/routes/api.ts,host/src/services/mcp.ts,ui/public/skill.md,plugins/registry/src/contract.ts,plugins/proposals/src/contract.ts,plugins/votes/src/contract.ts,plugins/ai/src/contract.ts,api/src/contract.ts"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Talk to the app
|
|
9
|
+
|
|
10
|
+
You act against a **running everything.dev instance** — no clone, no build.
|
|
11
|
+
Every operation in the app's API is reachable four ways; they differ only in
|
|
12
|
+
transport. The data is identical.
|
|
13
|
+
|
|
14
|
+
## Read this page, then choose a surface
|
|
15
|
+
|
|
16
|
+
| The task in front of you | Use |
|
|
17
|
+
|---|---|
|
|
18
|
+
| An MCP client (Claude, Cursor, …) drives the whole API | [MCP](#mcp) |
|
|
19
|
+
| A script or curl one-off — GET/POST against documented paths | [REST](#rest-openapi) |
|
|
20
|
+
| A typed JSON-RPC call by procedure name | [oRPC RPC](#orpc-rpc) |
|
|
21
|
+
| Anything else: rate limits, auth failures, which surface failed | this file |
|
|
22
|
+
|
|
23
|
+
**Load the skill for the task in front of you; do not load them all.**
|
|
24
|
+
|
|
25
|
+
## Facts every call relies on
|
|
26
|
+
|
|
27
|
+
| | local dev | production |
|
|
28
|
+
|---|---|---|
|
|
29
|
+
| API base | `http://localhost:3001` | the app's origin (`/api/*` is same-origin) |
|
|
30
|
+
| REST path | `<api-base>/api/<path>` | `<origin>/api/<path>` |
|
|
31
|
+
| oRPC RPC | `<api-base>/api/rpc/...` | `<origin>/api/rpc/...` |
|
|
32
|
+
| MCP | `POST <api-base>/api/mcp` | `POST <origin>/api/mcp` |
|
|
33
|
+
| Auth header | `x-api-key: api_...` | same |
|
|
34
|
+
|
|
35
|
+
There is no network parameter anywhere — the origin is the choice.
|
|
36
|
+
|
|
37
|
+
## Authentication
|
|
38
|
+
|
|
39
|
+
All API operations require authentication. Use an **API key**:
|
|
40
|
+
|
|
41
|
+
1. Sign in with your NEAR wallet (SIWN) at the app.
|
|
42
|
+
2. Navigate to **Settings → API Keys** at `/settings/api-keys`.
|
|
43
|
+
3. Create a new key — the full secret (`api_...`) is shown once, copy it immediately.
|
|
44
|
+
4. Pass it on every request:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
x-api-key: api_your_key_here
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The header works for `/api/*` (REST), `/api/rpc/*` (oRPC RPC), and `/api/mcp`
|
|
51
|
+
(MCP). Keys carry optional permissions; a call outside them refuses with 403.
|
|
52
|
+
|
|
53
|
+
## MCP
|
|
54
|
+
|
|
55
|
+
Streamable HTTP, stateless — no session ID required:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
POST /api/mcp
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Connect your MCP client to `<origin>/api/mcp`. Tools are auto-generated from
|
|
62
|
+
the API's OpenAPI spec, so every API operation — including auth, relay, and
|
|
63
|
+
API-key management — appears as a typed tool. Discovery:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
GET /.well-known/mcp.json
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Returns the server name, endpoint URL, and auth scheme.
|
|
70
|
+
|
|
71
|
+
## REST / OpenAPI
|
|
72
|
+
|
|
73
|
+
- **API docs UI**: `GET /api` (Scalar reference)
|
|
74
|
+
- **OpenAPI spec**: `GET /api/spec.json`
|
|
75
|
+
- REST paths are the contract paths under `/api`:
|
|
76
|
+
|
|
77
|
+
| operation | path |
|
|
78
|
+
|---|---|
|
|
79
|
+
| health | `GET /api/ping` |
|
|
80
|
+
| published registry apps | `GET /api/v1/registry/apps` |
|
|
81
|
+
| one registry app | `GET /api/v1/registry/apps/{accountId}/{gatewayId}` |
|
|
82
|
+
| registry status | `GET /api/v1/registry/status` |
|
|
83
|
+
| proposals lifecycle | `POST /api/v1/proposals`, `.../approve`, `.../reject`, `.../reopen` |
|
|
84
|
+
| upvotes | `POST /api/v1/upvotes`, `GET /api/v1/upvotes/{entityId}/count` |
|
|
85
|
+
| AI chat | `POST /api/v1/chat` (streaming) |
|
|
86
|
+
|
|
87
|
+
## oRPC RPC
|
|
88
|
+
|
|
89
|
+
Typed JSON-RPC by procedure name, one mount per plugin:
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
POST /api/rpc/{plugin}/{procedure}
|
|
93
|
+
Content-Type: application/json
|
|
94
|
+
|
|
95
|
+
["input-or-array"]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
- `POST /api/rpc/ping` — the API shell (mounted at the root)
|
|
99
|
+
- `POST /api/rpc/registry/listRegistryApps` — registry plugin
|
|
100
|
+
- `POST /api/rpc/auth/getSession` — auth plugin (special-cased mount)
|
|
101
|
+
- AI chat streaming lives at `POST /api/rpc/ai/chat`
|
|
102
|
+
|
|
103
|
+
## The tasks you will actually be given
|
|
104
|
+
|
|
105
|
+
**"What can this app do?"** Read `GET /api/spec.json` — it is the full typed
|
|
106
|
+
surface, and the MCP tools are generated from exactly it.
|
|
107
|
+
|
|
108
|
+
**"List the published apps."** `GET /api/v1/registry/apps` (or the
|
|
109
|
+
`listRegistryApps` MCP tool). Paginate with `limit`.
|
|
110
|
+
|
|
111
|
+
**"Check my identity / session."** `POST /api/rpc/auth/getSession` with the key.
|
|
112
|
+
An empty session means the key's owner has no active browser session — keys
|
|
113
|
+
identify the user, they do not create sessions.
|
|
114
|
+
|
|
115
|
+
**"Vote on / read the voting feed."** Counts and reads via
|
|
116
|
+
`/api/v1/upvotes/*`; casting needs the session of a signed-in user or a key
|
|
117
|
+
with write permission.
|
|
118
|
+
|
|
119
|
+
## Rules to work by
|
|
120
|
+
|
|
121
|
+
- **Read before writing.** `GET /api/spec.json` first; every write route names
|
|
122
|
+
its auth requirement in the spec.
|
|
123
|
+
- **A key is not a session.** `x-api-key` identifies an owner; sign-in flows
|
|
124
|
+
(`better-near-auth#client`) create sessions. Use the key for agent work.
|
|
125
|
+
- **One failed call is information.** See below before retrying.
|
|
126
|
+
|
|
127
|
+
## What comes back when it refuses
|
|
128
|
+
|
|
129
|
+
| status | do |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `401` | no or bad key — re-read `/settings/api-keys`; check the `x-api-key` header reached the request |
|
|
132
|
+
| `403` | the key lacks permission — the owner edits the key's permissions; do not retry unchanged |
|
|
133
|
+
| `404` | wrong surface or path — re-check `/api/spec.json`; plugin RPC mounts are `/api/rpc/<pluginKey>` |
|
|
134
|
+
| `429` | rate limited — wait as the response says, then once more |
|
|
135
|
+
| `5xx` | repeat later; on a write it may have been made — read first to confirm |
|
|
136
|
+
|
|
137
|
+
A refused write changes nothing: verify by reading, then repeat only if
|
|
138
|
+
nothing is there.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: ui-integration
|
|
3
3
|
description: Route creation, API client usage, auth client, SSR hydration, sidebar system, and the @/app module surface. Use when adding new UI routes, fetching data from the API, implementing auth flows, or customizing sidebar navigation.
|
|
4
4
|
metadata:
|
|
5
|
-
sources: "ui/src/app.ts,ui/src/lib/api.ts,ui/src/lib/auth.ts,ui/src/router.tsx,ui/src/
|
|
5
|
+
sources: "ui/src/app.ts,ui/src/lib/api.ts,ui/src/lib/auth.ts,ui/src/router.tsx,ui/src/routes/__root.tsx,ui/src/routes/_authenticated.tsx"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# UI Integration
|
|
@@ -32,8 +32,8 @@ ui/src/routes/
|
|
|
32
32
|
|
|
33
33
|
- Files starting with `_` are **layout** routes (parent components with `<Outlet />`)
|
|
34
34
|
- Files starting with `_` followed by a path segment are **nested layouts**
|
|
35
|
-
- Regular files become path segments (e.g., `
|
|
36
|
-
- Directories create nested paths (e.g., `
|
|
35
|
+
- Regular files become path segments (e.g., `ui/src/routes/_public/about.tsx` → `/about`)
|
|
36
|
+
- Directories create nested paths (e.g., a `_dashboard/` directory nests its files beneath `/dashboard` inside the auth guard)
|
|
37
37
|
|
|
38
38
|
### Basic Route
|
|
39
39
|
|
|
@@ -116,7 +116,7 @@ These are SSR-safe — they accept an optional `RuntimeConfigInput` to work with
|
|
|
116
116
|
|
|
117
117
|
### Creation
|
|
118
118
|
|
|
119
|
-
The client is created once in
|
|
119
|
+
The client is created once in the client bootstrap and stored in the Router context:
|
|
120
120
|
|
|
121
121
|
```ts
|
|
122
122
|
const apiClient = createApiClient({
|
|
@@ -185,7 +185,7 @@ try {
|
|
|
185
185
|
|
|
186
186
|
### Creation
|
|
187
187
|
|
|
188
|
-
The auth client is also created once in
|
|
188
|
+
The auth client is also created once in the client bootstrap:
|
|
189
189
|
|
|
190
190
|
```ts
|
|
191
191
|
const authClient = createAuthClient(runtimeConfig);
|
|
@@ -271,7 +271,7 @@ Nest routes under `_layout/_authenticated/` to inherit this guard. Unauthenticat
|
|
|
271
271
|
|
|
272
272
|
## Sidebar System
|
|
273
273
|
|
|
274
|
-
Sidebar items are defined inline in `ui/src/
|
|
274
|
+
Sidebar items are defined inline in `ui/src/components/layout/nav-items.ts` as a `NAV_ITEMS` array:
|
|
275
275
|
|
|
276
276
|
```ts
|
|
277
277
|
import { Globe, Home } from "lucide-react";
|
|
@@ -308,16 +308,80 @@ Add items manually to the `sidebarItems` array. Available icons: any `lucide-rea
|
|
|
308
308
|
|
|
309
309
|
## SSR Architecture
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
The ui surface splits by ownership (ADR 0023): the app owns `router.tsx` (the
|
|
312
|
+
router factory — notFound/pending/error components and query timings) and
|
|
313
|
+
`app.ts`; the mechanical bootstrap files are generated `.gen` stubs
|
|
314
|
+
(`entry.gen.ts`, `hydrate.gen.tsx`, `router.server.gen.tsx`, `compose.gen.ts`,
|
|
315
|
+
`globals.gen.ts`), gitignored and regenerated by `bos dev`/`build`/`typecheck`
|
|
316
|
+
from the installed framework version. Never edit the generated files.
|
|
317
|
+
|
|
318
|
+
### Router Customization (`router.tsx` — yours)
|
|
319
|
+
|
|
320
|
+
The hydrated client router AND each SSR request's router mint through the
|
|
321
|
+
app's authored factory, so router policy is set in one place:
|
|
322
|
+
|
|
323
|
+
```tsx
|
|
324
|
+
// ui/src/router.tsx
|
|
325
|
+
export function createRouter(opts: CreateRouterOptions) {
|
|
326
|
+
return createCoreRouter<ApiClient, SessionData, typeof routeTree>({
|
|
327
|
+
...opts,
|
|
328
|
+
defaultRouteTree: routeTree,
|
|
329
|
+
// notFoundComponent, errorComponent, scrollRestoration, …
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export function createQueryClient(): QueryClient {
|
|
334
|
+
return new QueryClient({
|
|
335
|
+
defaultOptions: { queries: { staleTime: 5 * 60 * 1000, gcTime: 30 * 60 * 1000 } },
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Default components: set `defaultErrorComponent` / `defaultPendingComponent` /
|
|
341
|
+
`defaultNotFoundComponent` inside `createRouter` after the `...opts` spread —
|
|
342
|
+
your values win, and both client and SSR pick them up (SSR parity).
|
|
343
|
+
|
|
344
|
+
### App Overrides (`app.ts` — yours)
|
|
345
|
+
|
|
346
|
+
The generated stubs read two override exports from `app.ts` — customize the
|
|
347
|
+
values there, never in the stubs:
|
|
348
|
+
|
|
349
|
+
```ts
|
|
350
|
+
// ui/src/app.ts
|
|
351
|
+
import type { ApiConnectionErrorCopy } from "everything-dev/ui/api";
|
|
352
|
+
import type { LocaleOptions } from "everything-dev/ui/i18n";
|
|
353
|
+
import {
|
|
354
|
+
type AppLocale,
|
|
355
|
+
APP_LOCALES,
|
|
356
|
+
APP_LOCALE_COOKIE,
|
|
357
|
+
DEFAULT_APP_LOCALE,
|
|
358
|
+
} from "./i18n/catalogs";
|
|
359
|
+
|
|
360
|
+
export const appLocale: LocaleOptions<AppLocale> = {
|
|
361
|
+
locales: APP_LOCALES,
|
|
362
|
+
defaultLocale: DEFAULT_APP_LOCALE,
|
|
363
|
+
cookieName: APP_LOCALE_COOKIE,
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
export const apiConnectionError: ApiConnectionErrorCopy = () => ({
|
|
367
|
+
title: "…",
|
|
368
|
+
description: "…",
|
|
369
|
+
});
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
`appLocale` feeds SSR locale negotiation (cookie + Accept-Language);
|
|
373
|
+
`apiConnectionError` is the localized API connection-failure toast copy.
|
|
374
|
+
|
|
375
|
+
### Client Bootstrap (`hydrate.gen.tsx` — generated)
|
|
312
376
|
|
|
313
377
|
1. Reads `window.__RUNTIME_CONFIG__`
|
|
314
|
-
2.
|
|
315
|
-
3.
|
|
378
|
+
2. Composes the route tree from the compose payload (core + plugin manifests)
|
|
379
|
+
3. Mints the router and query client through the app's `router.tsx` factories
|
|
316
380
|
4. Hydrates React DOM into the HTML shell
|
|
317
381
|
|
|
318
|
-
### Server-Side (`router.server.tsx`)
|
|
382
|
+
### Server-Side (`router.server.gen.tsx` — generated)
|
|
319
383
|
|
|
320
|
-
1. Creates request-scoped
|
|
384
|
+
1. Creates request-scoped routers through the same app factory (SSR parity)
|
|
321
385
|
2. Creates per-request `apiClient` and `authClient`
|
|
322
386
|
3. Renders to stream via TanStack Router SSR's `createRequestHandler`
|
|
323
387
|
4. Host calls `loadRouterModule()` to dynamically load the SSR bundle
|
|
@@ -380,3 +444,21 @@ function Component() {
|
|
|
380
444
|
- Shared UI components: `ui/src/components/ui/` — semantic, reusable primitives
|
|
381
445
|
- Feature components: colocated with the route that uses them
|
|
382
446
|
- Exports from `ui/src/components/index.ts` for shared components
|
|
447
|
+
|
|
448
|
+
## The tasks you will actually be given
|
|
449
|
+
|
|
450
|
+
**"Add a page that lists data."** File under `ui/src/routes/` (nest under `_layout/_authenticated/` to inherit the guard) → `loader` calls `apiClient.<plugin>.<proc>(...)` from context → component reads `Route.useLoaderData()` → add the sidebar entry in `ui/src/components/layout/nav-items.ts`.
|
|
451
|
+
|
|
452
|
+
**"Add an auth-only page."** Nest under `_layout/_authenticated/` — the guard's `beforeLoad` already redirects to `/login?redirect=<path>`; return `{ auth: … }` from `beforeLoad` to type the context downstream.
|
|
453
|
+
|
|
454
|
+
**"Call the API in a component."** `const apiClient = useApiClient()` for one-shot calls; `const orpc = useOrpc()` when you want `useQuery`/`useMutation` caching.
|
|
455
|
+
|
|
456
|
+
## What comes back when it fails
|
|
457
|
+
|
|
458
|
+
| word | do |
|
|
459
|
+
|---|---|
|
|
460
|
+
| `ORPCError` with `code: "UNAUTHORIZED"` in the browser | the session middleware resolved nulls — check `authClient.getSession()`; if the guard should have caught it, verify the route actually nests under `_layout/_authenticated/` |
|
|
461
|
+
| `Route.` or `apiClient.<plugin>` has no types | generated types are stale — `pnpm run typecheck` (regenerates `api-types.gen.ts`) or restart `bos dev` |
|
|
462
|
+
| `TimeoutError` on `page.waitForURL` after a `<Link>` click (browser tests) | client-side nav never fires `load` — pass `{ waitUntil: "commit" }` |
|
|
463
|
+
| client-only value crashes SSR | wrap it: `useClientValue(() => getAppName(), "app")` from `@/hooks` |
|
|
464
|
+
| edits to `*.gen.*` files keep vanishing | they are generated stubs — change the source (`router.tsx`, `app.ts`, the contracts) instead |
|
package/dist/cli/db-studio.cjs
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
-
const require_db = require('../db.cjs');
|
|
3
|
-
let node_fs = require("node:fs");
|
|
4
|
-
let node_path = require("node:path");
|
|
5
|
-
let _clack_prompts = require("@clack/prompts");
|
|
6
|
-
_clack_prompts = require_runtime.__toESM(_clack_prompts, 1);
|
|
7
|
-
let node_child_process = require("node:child_process");
|
|
8
|
-
|
|
9
|
-
//#region src/cli/db-studio.ts
|
|
10
|
-
function resolvePluginDbInfo(pluginKey, runtimeConfig, projectDir) {
|
|
11
|
-
let source;
|
|
12
|
-
let section;
|
|
13
|
-
let secrets;
|
|
14
|
-
let localPath;
|
|
15
|
-
let key;
|
|
16
|
-
if (pluginKey === "api" && runtimeConfig.api) {
|
|
17
|
-
source = runtimeConfig.api.source;
|
|
18
|
-
section = "app.api";
|
|
19
|
-
secrets = runtimeConfig.api.secrets;
|
|
20
|
-
localPath = runtimeConfig.api.localPath;
|
|
21
|
-
key = "api";
|
|
22
|
-
} else if (pluginKey === "auth" && runtimeConfig.auth) {
|
|
23
|
-
source = runtimeConfig.auth.source;
|
|
24
|
-
section = "app.auth";
|
|
25
|
-
secrets = runtimeConfig.auth.secrets;
|
|
26
|
-
localPath = runtimeConfig.auth.localPath;
|
|
27
|
-
key = "auth";
|
|
28
|
-
} else if (runtimeConfig.plugins?.[pluginKey]) {
|
|
29
|
-
const plugin = runtimeConfig.plugins[pluginKey];
|
|
30
|
-
source = plugin.source;
|
|
31
|
-
section = "plugins";
|
|
32
|
-
secrets = plugin.secrets;
|
|
33
|
-
localPath = plugin.localPath;
|
|
34
|
-
key = pluginKey;
|
|
35
|
-
} else throw new Error(`Plugin "${pluginKey}" not found in app.api, app.auth, or plugins. Available: ${[
|
|
36
|
-
"api",
|
|
37
|
-
...runtimeConfig.auth ? ["auth"] : [],
|
|
38
|
-
...Object.keys(runtimeConfig.plugins ?? {})
|
|
39
|
-
].join(", ")}`);
|
|
40
|
-
const dbSecret = secrets?.find((s) => s.endsWith("_DATABASE_URL"));
|
|
41
|
-
if (!dbSecret) throw new Error(`Plugin "${pluginKey}" has no database secret (no secret ending in _DATABASE_URL). Secrets: ${(secrets ?? []).join(", ") || "none"}`);
|
|
42
|
-
const dbUrl = process.env[dbSecret];
|
|
43
|
-
if (!dbUrl) throw new Error(`.env missing ${dbSecret} for plugin "${pluginKey}". Add it to your .env file (see .env.example).`);
|
|
44
|
-
return {
|
|
45
|
-
key,
|
|
46
|
-
source: source ?? "remote",
|
|
47
|
-
section,
|
|
48
|
-
databaseSecret: dbSecret,
|
|
49
|
-
databaseUrl: dbUrl,
|
|
50
|
-
workspaceDir: localPath,
|
|
51
|
-
projectDir
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
async function runStudioLocal(info) {
|
|
55
|
-
const workspaceRoot = info.workspaceDir ? (0, node_path.resolve)(info.projectDir, info.workspaceDir) : (0, node_path.resolve)(info.projectDir, info.key);
|
|
56
|
-
const configPath = (0, node_path.join)(workspaceRoot, "drizzle.config.ts");
|
|
57
|
-
if (!(0, node_fs.existsSync)(configPath)) throw new Error(`No drizzle.config.ts found in ${workspaceRoot}. Run 'drizzle-kit init' first in the plugin workspace.`);
|
|
58
|
-
_clack_prompts.log.info(`Starting Drizzle Studio for ${info.key} (local)...`);
|
|
59
|
-
await spawnAsync("npx", [
|
|
60
|
-
"drizzle-kit",
|
|
61
|
-
"studio",
|
|
62
|
-
"--config",
|
|
63
|
-
configPath
|
|
64
|
-
], { cwd: workspaceRoot });
|
|
65
|
-
}
|
|
66
|
-
async function runStudioRemote(info) {
|
|
67
|
-
const dbDir = (0, node_path.resolve)(info.projectDir, ".bos", "db", info.key);
|
|
68
|
-
(0, node_fs.mkdirSync)(dbDir, { recursive: true });
|
|
69
|
-
const storage = require_db.getMigrationStorage(require_db.pluginMigrationSlug(info.key));
|
|
70
|
-
const journalSchema = storage.schema;
|
|
71
|
-
const journalTable = storage.table;
|
|
72
|
-
const configPath = (0, node_path.join)(dbDir, "drizzle.config.ts");
|
|
73
|
-
(0, node_fs.writeFileSync)(configPath, `import { defineConfig } from "drizzle-kit";
|
|
74
|
-
|
|
75
|
-
export default defineConfig({
|
|
76
|
-
schema: "./drizzle/schema.ts",
|
|
77
|
-
out: "./drizzle",
|
|
78
|
-
dialect: "postgresql",
|
|
79
|
-
dbCredentials: {
|
|
80
|
-
url: "${info.databaseUrl}",
|
|
81
|
-
},
|
|
82
|
-
migrations: {
|
|
83
|
-
schema: "${journalSchema}",
|
|
84
|
-
table: "${journalTable}",
|
|
85
|
-
},
|
|
86
|
-
verbose: true,
|
|
87
|
-
strict: true,
|
|
88
|
-
});
|
|
89
|
-
`);
|
|
90
|
-
_clack_prompts.log.info(`Introspecting database schema for ${info.key}...`);
|
|
91
|
-
try {
|
|
92
|
-
await spawnAsync("npx", [
|
|
93
|
-
"drizzle-kit",
|
|
94
|
-
"pull",
|
|
95
|
-
"--config",
|
|
96
|
-
configPath
|
|
97
|
-
], { cwd: dbDir });
|
|
98
|
-
} catch {
|
|
99
|
-
throw new Error(`Failed to introspect database for "${info.key}". Check that ${info.databaseSecret} is correct and the database is reachable.`);
|
|
100
|
-
}
|
|
101
|
-
_clack_prompts.log.info(`Starting Drizzle Studio for ${info.key}...`);
|
|
102
|
-
await spawnAsync("npx", [
|
|
103
|
-
"drizzle-kit",
|
|
104
|
-
"studio",
|
|
105
|
-
"--config",
|
|
106
|
-
configPath
|
|
107
|
-
], { cwd: dbDir });
|
|
108
|
-
}
|
|
109
|
-
function spawnAsync(cmd, args, options) {
|
|
110
|
-
return new Promise((resolvePromise, reject) => {
|
|
111
|
-
const child = (0, node_child_process.spawn)(cmd, args, {
|
|
112
|
-
cwd: options.cwd,
|
|
113
|
-
stdio: "inherit",
|
|
114
|
-
shell: true
|
|
115
|
-
});
|
|
116
|
-
child.on("error", (err) => {
|
|
117
|
-
if (err.code === "ENOENT") reject(/* @__PURE__ */ new Error(`"${cmd}" not found. Ensure it is installed (e.g. 'npm install -g drizzle-kit').`));
|
|
118
|
-
else reject(/* @__PURE__ */ new Error(`Failed to start ${cmd}: ${err.message}`));
|
|
119
|
-
});
|
|
120
|
-
child.on("exit", (code) => {
|
|
121
|
-
if (code === 0 || code === null) resolvePromise();
|
|
122
|
-
else reject(/* @__PURE__ */ new Error(`"${cmd}" exited with code ${code}`));
|
|
123
|
-
});
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
//#endregion
|
|
128
|
-
exports.resolvePluginDbInfo = resolvePluginDbInfo;
|
|
129
|
-
exports.runStudioLocal = runStudioLocal;
|
|
130
|
-
exports.runStudioRemote = runStudioRemote;
|
|
131
|
-
//# sourceMappingURL=db-studio.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"db-studio.cjs","names":["getMigrationStorage","pluginMigrationSlug"],"sources":["../../src/cli/db-studio.ts"],"sourcesContent":["import { spawn } from \"node:child_process\";\nimport { existsSync, mkdirSync, writeFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport * as p from \"@clack/prompts\";\nimport { getMigrationStorage, pluginMigrationSlug } from \"../db\";\nimport type { RuntimeConfig } from \"../types\";\n\nexport interface PluginDbInfo {\n key: string;\n source: \"local\" | \"remote\";\n section: \"app.api\" | \"app.auth\" | \"plugins\";\n databaseSecret: string;\n databaseUrl: string;\n workspaceDir?: string;\n projectDir: string;\n}\n\nexport function resolvePluginDbInfo(\n pluginKey: string,\n runtimeConfig: RuntimeConfig,\n projectDir: string,\n): PluginDbInfo {\n let source: \"local\" | \"remote\" | undefined;\n let section: PluginDbInfo[\"section\"];\n let secrets: string[] | undefined;\n let localPath: string | undefined;\n let key: string;\n\n if (pluginKey === \"api\" && runtimeConfig.api) {\n source = runtimeConfig.api.source;\n section = \"app.api\";\n secrets = runtimeConfig.api.secrets;\n localPath = runtimeConfig.api.localPath;\n key = \"api\";\n } else if (pluginKey === \"auth\" && runtimeConfig.auth) {\n source = runtimeConfig.auth.source;\n section = \"app.auth\";\n secrets = runtimeConfig.auth.secrets;\n localPath = runtimeConfig.auth.localPath;\n key = \"auth\";\n } else if (runtimeConfig.plugins?.[pluginKey]) {\n const plugin = runtimeConfig.plugins[pluginKey];\n source = plugin.source;\n section = \"plugins\";\n secrets = plugin.secrets;\n localPath = plugin.localPath;\n key = pluginKey;\n } else {\n throw new Error(\n `Plugin \"${pluginKey}\" not found in app.api, app.auth, or plugins. ` +\n `Available: ${[\n \"api\",\n ...(runtimeConfig.auth ? [\"auth\"] : []),\n ...Object.keys(runtimeConfig.plugins ?? {}),\n ].join(\", \")}`,\n );\n }\n\n const dbSecret = secrets?.find((s) => s.endsWith(\"_DATABASE_URL\"));\n if (!dbSecret) {\n throw new Error(\n `Plugin \"${pluginKey}\" has no database secret (no secret ending in _DATABASE_URL). ` +\n `Secrets: ${(secrets ?? []).join(\", \") || \"none\"}`,\n );\n }\n\n const dbUrl = process.env[dbSecret];\n if (!dbUrl) {\n throw new Error(\n `.env missing ${dbSecret} for plugin \"${pluginKey}\". ` +\n `Add it to your .env file (see .env.example).`,\n );\n }\n\n return {\n key,\n source: source ?? \"remote\",\n section,\n databaseSecret: dbSecret,\n databaseUrl: dbUrl,\n workspaceDir: localPath,\n projectDir,\n };\n}\n\nexport async function runStudioLocal(info: PluginDbInfo): Promise<void> {\n const workspaceRoot = info.workspaceDir\n ? resolve(info.projectDir, info.workspaceDir)\n : resolve(info.projectDir, info.key);\n const configPath = join(workspaceRoot, \"drizzle.config.ts\");\n\n if (!existsSync(configPath)) {\n throw new Error(\n `No drizzle.config.ts found in ${workspaceRoot}. ` +\n `Run 'drizzle-kit init' first in the plugin workspace.`,\n );\n }\n\n p.log.info(`Starting Drizzle Studio for ${info.key} (local)...`);\n\n await spawnAsync(\"npx\", [\"drizzle-kit\", \"studio\", \"--config\", configPath], {\n cwd: workspaceRoot,\n });\n}\n\nexport async function runStudioRemote(info: PluginDbInfo): Promise<void> {\n const dbDir = resolve(info.projectDir, \".bos\", \"db\", info.key);\n\n mkdirSync(dbDir, { recursive: true });\n\n const storage = getMigrationStorage(pluginMigrationSlug(info.key));\n const journalSchema = storage.schema;\n const journalTable = storage.table;\n\n const configPath = join(dbDir, \"drizzle.config.ts\");\n const configContent = `import { defineConfig } from \"drizzle-kit\";\n\nexport default defineConfig({\n schema: \"./drizzle/schema.ts\",\n out: \"./drizzle\",\n dialect: \"postgresql\",\n dbCredentials: {\n url: \"${info.databaseUrl}\",\n },\n migrations: {\n schema: \"${journalSchema}\",\n table: \"${journalTable}\",\n },\n verbose: true,\n strict: true,\n});\n`;\n\n writeFileSync(configPath, configContent);\n\n p.log.info(`Introspecting database schema for ${info.key}...`);\n try {\n await spawnAsync(\"npx\", [\"drizzle-kit\", \"pull\", \"--config\", configPath], {\n cwd: dbDir,\n });\n } catch {\n throw new Error(\n `Failed to introspect database for \"${info.key}\". ` +\n `Check that ${info.databaseSecret} is correct and the database is reachable.`,\n );\n }\n\n p.log.info(`Starting Drizzle Studio for ${info.key}...`);\n await spawnAsync(\"npx\", [\"drizzle-kit\", \"studio\", \"--config\", configPath], {\n cwd: dbDir,\n });\n}\n\nfunction spawnAsync(cmd: string, args: string[], options: { cwd: string }): Promise<void> {\n return new Promise((resolvePromise, reject) => {\n const child = spawn(cmd, args, {\n cwd: options.cwd,\n stdio: \"inherit\",\n shell: true,\n });\n\n child.on(\"error\", (err) => {\n if ((err as NodeJS.ErrnoException).code === \"ENOENT\") {\n reject(\n new Error(\n `\"${cmd}\" not found. Ensure it is installed (e.g. 'npm install -g drizzle-kit').`,\n ),\n );\n } else {\n reject(new Error(`Failed to start ${cmd}: ${err.message}`));\n }\n });\n\n child.on(\"exit\", (code) => {\n if (code === 0 || code === null) {\n resolvePromise();\n } else {\n reject(new Error(`\"${cmd}\" exited with code ${code}`));\n }\n });\n });\n}\n"],"mappings":";;;;;;;;;AAiBA,SAAgB,oBACd,WACA,eACA,YACc;CACd,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CAEJ,IAAI,cAAc,SAAS,cAAc,KAAK;EAC5C,SAAS,cAAc,IAAI;EAC3B,UAAU;EACV,UAAU,cAAc,IAAI;EAC5B,YAAY,cAAc,IAAI;EAC9B,MAAM;CACR,OAAO,IAAI,cAAc,UAAU,cAAc,MAAM;EACrD,SAAS,cAAc,KAAK;EAC5B,UAAU;EACV,UAAU,cAAc,KAAK;EAC7B,YAAY,cAAc,KAAK;EAC/B,MAAM;CACR,OAAO,IAAI,cAAc,UAAU,YAAY;EAC7C,MAAM,SAAS,cAAc,QAAQ;EACrC,SAAS,OAAO;EAChB,UAAU;EACV,UAAU,OAAO;EACjB,YAAY,OAAO;EACnB,MAAM;CACR,OACE,MAAM,IAAI,MACR,WAAW,UAAU,2DACL;EACZ;EACA,GAAI,cAAc,OAAO,CAAC,MAAM,IAAI,CAAC;EACrC,GAAG,OAAO,KAAK,cAAc,WAAW,CAAC,CAAC;CAC5C,CAAC,CAAC,KAAK,IAAI,GACf;CAGF,MAAM,WAAW,SAAS,MAAM,MAAM,EAAE,SAAS,eAAe,CAAC;CACjE,IAAI,CAAC,UACH,MAAM,IAAI,MACR,WAAW,UAAU,0EACN,WAAW,CAAC,EAAC,CAAE,KAAK,IAAI,KAAK,QAC9C;CAGF,MAAM,QAAQ,QAAQ,IAAI;CAC1B,IAAI,CAAC,OACH,MAAM,IAAI,MACR,gBAAgB,SAAS,eAAe,UAAU,gDAEpD;CAGF,OAAO;EACL;EACA,QAAQ,UAAU;EAClB;EACA,gBAAgB;EAChB,aAAa;EACb,cAAc;EACd;CACF;AACF;AAEA,eAAsB,eAAe,MAAmC;CACtE,MAAM,gBAAgB,KAAK,sCACf,KAAK,YAAY,KAAK,YAAY,2BAClC,KAAK,YAAY,KAAK,GAAG;CACrC,MAAM,iCAAkB,eAAe,mBAAmB;CAE1D,IAAI,yBAAY,UAAU,GACxB,MAAM,IAAI,MACR,iCAAiC,cAAc,wDAEjD;CAGF,eAAE,IAAI,KAAK,+BAA+B,KAAK,IAAI,YAAY;CAE/D,MAAM,WAAW,OAAO;EAAC;EAAe;EAAU;EAAY;CAAU,GAAG,EACzE,KAAK,cACP,CAAC;AACH;AAEA,eAAsB,gBAAgB,MAAmC;CACvE,MAAM,+BAAgB,KAAK,YAAY,QAAQ,MAAM,KAAK,GAAG;CAE7D,uBAAU,OAAO,EAAE,WAAW,KAAK,CAAC;CAEpC,MAAM,UAAUA,+BAAoBC,+BAAoB,KAAK,GAAG,CAAC;CACjE,MAAM,gBAAgB,QAAQ;CAC9B,MAAM,eAAe,QAAQ;CAE7B,MAAM,iCAAkB,OAAO,mBAAmB;CAmBlD,2BAAc,YAAY;;;;;;;YAXhB,KAAK,YAAY;;;eAGd,cAAc;cACf,aAAa;;;;;CAOc;CAEvC,eAAE,IAAI,KAAK,qCAAqC,KAAK,IAAI,IAAI;CAC7D,IAAI;EACF,MAAM,WAAW,OAAO;GAAC;GAAe;GAAQ;GAAY;EAAU,GAAG,EACvE,KAAK,MACP,CAAC;CACH,QAAQ;EACN,MAAM,IAAI,MACR,sCAAsC,KAAK,IAAI,gBAC/B,KAAK,eAAe,2CACtC;CACF;CAEA,eAAE,IAAI,KAAK,+BAA+B,KAAK,IAAI,IAAI;CACvD,MAAM,WAAW,OAAO;EAAC;EAAe;EAAU;EAAY;CAAU,GAAG,EACzE,KAAK,MACP,CAAC;AACH;AAEA,SAAS,WAAW,KAAa,MAAgB,SAAyC;CACxF,OAAO,IAAI,SAAS,gBAAgB,WAAW;EAC7C,MAAM,sCAAc,KAAK,MAAM;GAC7B,KAAK,QAAQ;GACb,OAAO;GACP,OAAO;EACT,CAAC;EAED,MAAM,GAAG,UAAU,QAAQ;GACzB,IAAK,IAA8B,SAAS,UAC1C,uBACE,IAAI,MACF,IAAI,IAAI,yEACV,CACF;QAEA,uBAAO,IAAI,MAAM,mBAAmB,IAAI,IAAI,IAAI,SAAS,CAAC;EAE9D,CAAC;EAED,MAAM,GAAG,SAAS,SAAS;GACzB,IAAI,SAAS,KAAK,SAAS,MACzB,eAAe;QAEf,uBAAO,IAAI,MAAM,IAAI,IAAI,qBAAqB,MAAM,CAAC;EAEzD,CAAC;CACH,CAAC;AACH"}
|