workerstack 0.1.0-beta.0
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/CHANGELOG.md +13 -0
- package/LICENSE +21 -0
- package/README.md +138 -0
- package/dist/access.d.ts +131 -0
- package/dist/access.d.ts.map +1 -0
- package/dist/access.js +333 -0
- package/dist/access.js.map +1 -0
- package/dist/api/builder.d.ts +457 -0
- package/dist/api/builder.d.ts.map +1 -0
- package/dist/api/builder.js +45 -0
- package/dist/api/builder.js.map +1 -0
- package/dist/api/catalog.d.ts +8 -0
- package/dist/api/catalog.d.ts.map +1 -0
- package/dist/api/catalog.js +56 -0
- package/dist/api/catalog.js.map +1 -0
- package/dist/api/context.d.ts +47 -0
- package/dist/api/context.d.ts.map +1 -0
- package/dist/api/context.js +40 -0
- package/dist/api/context.js.map +1 -0
- package/dist/api/crud-router.d.ts +476 -0
- package/dist/api/crud-router.d.ts.map +1 -0
- package/dist/api/crud-router.js +354 -0
- package/dist/api/crud-router.js.map +1 -0
- package/dist/api/list-input-schema.d.ts +37 -0
- package/dist/api/list-input-schema.d.ts.map +1 -0
- package/dist/api/list-input-schema.js +63 -0
- package/dist/api/list-input-schema.js.map +1 -0
- package/dist/api/list-spec.d.ts +44 -0
- package/dist/api/list-spec.d.ts.map +1 -0
- package/dist/api/list-spec.js +49 -0
- package/dist/api/list-spec.js.map +1 -0
- package/dist/api/live-view.d.ts +14 -0
- package/dist/api/live-view.d.ts.map +1 -0
- package/dist/api/live-view.js +42 -0
- package/dist/api/live-view.js.map +1 -0
- package/dist/api/live-window.d.ts +40 -0
- package/dist/api/live-window.d.ts.map +1 -0
- package/dist/api/live-window.js +93 -0
- package/dist/api/live-window.js.map +1 -0
- package/dist/api/openapi.d.ts +6 -0
- package/dist/api/openapi.d.ts.map +1 -0
- package/dist/api/openapi.js +146 -0
- package/dist/api/openapi.js.map +1 -0
- package/dist/api/realtime-router.d.ts +94 -0
- package/dist/api/realtime-router.d.ts.map +1 -0
- package/dist/api/realtime-router.js +45 -0
- package/dist/api/realtime-router.js.map +1 -0
- package/dist/api/registry.d.ts +30 -0
- package/dist/api/registry.d.ts.map +1 -0
- package/dist/api/registry.js +236 -0
- package/dist/api/registry.js.map +1 -0
- package/dist/api/router.d.ts +15 -0
- package/dist/api/router.d.ts.map +1 -0
- package/dist/api/router.js +32 -0
- package/dist/api/router.js.map +1 -0
- package/dist/api/storage-router.d.ts +349 -0
- package/dist/api/storage-router.d.ts.map +1 -0
- package/dist/api/storage-router.js +155 -0
- package/dist/api/storage-router.js.map +1 -0
- package/dist/api/types.d.ts +55 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +2 -0
- package/dist/api/types.js.map +1 -0
- package/dist/auth-password.d.ts +27 -0
- package/dist/auth-password.d.ts.map +1 -0
- package/dist/auth-password.js +60 -0
- package/dist/auth-password.js.map +1 -0
- package/dist/auth.d.ts +59 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +146 -0
- package/dist/auth.js.map +1 -0
- package/dist/backend-internals.d.ts +35 -0
- package/dist/backend-internals.d.ts.map +1 -0
- package/dist/backend-internals.js +2 -0
- package/dist/backend-internals.js.map +1 -0
- package/dist/backend.d.ts +63 -0
- package/dist/backend.d.ts.map +1 -0
- package/dist/backend.js +59 -0
- package/dist/backend.js.map +1 -0
- package/dist/blueprint-generator.d.ts +21 -0
- package/dist/blueprint-generator.d.ts.map +1 -0
- package/dist/blueprint-generator.js +199 -0
- package/dist/blueprint-generator.js.map +1 -0
- package/dist/blueprint.d.ts +99 -0
- package/dist/blueprint.d.ts.map +1 -0
- package/dist/blueprint.js +257 -0
- package/dist/blueprint.js.map +1 -0
- package/dist/cli-skills.d.ts +16 -0
- package/dist/cli-skills.d.ts.map +1 -0
- package/dist/cli-skills.js +108 -0
- package/dist/cli-skills.js.map +1 -0
- package/dist/cli.d.ts +18 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +205 -0
- package/dist/cli.js.map +1 -0
- package/dist/client/client.d.ts +53 -0
- package/dist/client/client.d.ts.map +1 -0
- package/dist/client/client.js +111 -0
- package/dist/client/client.js.map +1 -0
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +4 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/live-view.d.ts +49 -0
- package/dist/client/live-view.d.ts.map +1 -0
- package/dist/client/live-view.js +184 -0
- package/dist/client/live-view.js.map +1 -0
- package/dist/client/react.d.ts +4 -0
- package/dist/client/react.d.ts.map +1 -0
- package/dist/client/react.js +6 -0
- package/dist/client/react.js.map +1 -0
- package/dist/client/realtime.d.ts +54 -0
- package/dist/client/realtime.d.ts.map +1 -0
- package/dist/client/realtime.js +105 -0
- package/dist/client/realtime.js.map +1 -0
- package/dist/client/rest.d.ts +2 -0
- package/dist/client/rest.d.ts.map +1 -0
- package/dist/client/rest.js +2 -0
- package/dist/client/rest.js.map +1 -0
- package/dist/client/rpc-client.d.ts +38 -0
- package/dist/client/rpc-client.d.ts.map +1 -0
- package/dist/client/rpc-client.js +59 -0
- package/dist/client/rpc-client.js.map +1 -0
- package/dist/client/solid.d.ts +7 -0
- package/dist/client/solid.d.ts.map +1 -0
- package/dist/client/solid.js +21 -0
- package/dist/client/solid.js.map +1 -0
- package/dist/client/svelte.d.ts +6 -0
- package/dist/client/svelte.d.ts.map +1 -0
- package/dist/client/svelte.js +9 -0
- package/dist/client/svelte.js.map +1 -0
- package/dist/client/vue.d.ts +5 -0
- package/dist/client/vue.d.ts.map +1 -0
- package/dist/client/vue.js +11 -0
- package/dist/client/vue.js.map +1 -0
- package/dist/codegen.d.ts +36 -0
- package/dist/codegen.d.ts.map +1 -0
- package/dist/codegen.js +235 -0
- package/dist/codegen.js.map +1 -0
- package/dist/config.d.ts +129 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +75 -0
- package/dist/config.js.map +1 -0
- package/dist/cron.d.ts +4 -0
- package/dist/cron.d.ts.map +1 -0
- package/dist/cron.js +3 -0
- package/dist/cron.js.map +1 -0
- package/dist/crud-operations.d.ts +43 -0
- package/dist/crud-operations.d.ts.map +1 -0
- package/dist/crud-operations.js +249 -0
- package/dist/crud-operations.js.map +1 -0
- package/dist/database/adapter.d.ts +26 -0
- package/dist/database/adapter.d.ts.map +1 -0
- package/dist/database/adapter.js +2 -0
- package/dist/database/adapter.js.map +1 -0
- package/dist/database/libsql.d.ts +3 -0
- package/dist/database/libsql.d.ts.map +1 -0
- package/dist/database/libsql.js +39 -0
- package/dist/database/libsql.js.map +1 -0
- package/dist/db.d.ts +15 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +8 -0
- package/dist/db.js.map +1 -0
- package/dist/dev/binaries.d.ts +22 -0
- package/dist/dev/binaries.d.ts.map +1 -0
- package/dist/dev/binaries.js +119 -0
- package/dist/dev/binaries.js.map +1 -0
- package/dist/dev/env.d.ts +11 -0
- package/dist/dev/env.d.ts.map +1 -0
- package/dist/dev/env.js +71 -0
- package/dist/dev/env.js.map +1 -0
- package/dist/dev/index.d.ts +39 -0
- package/dist/dev/index.d.ts.map +1 -0
- package/dist/dev/index.js +273 -0
- package/dist/dev/index.js.map +1 -0
- package/dist/dev/processes.d.ts +37 -0
- package/dist/dev/processes.d.ts.map +1 -0
- package/dist/dev/processes.js +104 -0
- package/dist/dev/processes.js.map +1 -0
- package/dist/dev/push.d.ts +2 -0
- package/dist/dev/push.d.ts.map +1 -0
- package/dist/dev/push.js +30 -0
- package/dist/dev/push.js.map +1 -0
- package/dist/dialect.d.ts +17 -0
- package/dist/dialect.d.ts.map +1 -0
- package/dist/dialect.js +12 -0
- package/dist/dialect.js.map +1 -0
- package/dist/email/smtp.d.ts +20 -0
- package/dist/email/smtp.d.ts.map +1 -0
- package/dist/email/smtp.js +31 -0
- package/dist/email/smtp.js.map +1 -0
- package/dist/email.d.ts +26 -0
- package/dist/email.d.ts.map +1 -0
- package/dist/email.js +2 -0
- package/dist/email.js.map +1 -0
- package/dist/env-probe.d.ts +9 -0
- package/dist/env-probe.d.ts.map +1 -0
- package/dist/env-probe.js +72 -0
- package/dist/env-probe.js.map +1 -0
- package/dist/env.d.ts +62 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +86 -0
- package/dist/env.js.map +1 -0
- package/dist/errors.d.ts +153 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +106 -0
- package/dist/errors.js.map +1 -0
- package/dist/handler.d.ts +11 -0
- package/dist/handler.d.ts.map +1 -0
- package/dist/handler.js +21 -0
- package/dist/handler.js.map +1 -0
- package/dist/hosted-contract.d.ts +11 -0
- package/dist/hosted-contract.d.ts.map +1 -0
- package/dist/hosted-contract.js +50 -0
- package/dist/hosted-contract.js.map +1 -0
- package/dist/idempotency.d.ts +17 -0
- package/dist/idempotency.d.ts.map +1 -0
- package/dist/idempotency.js +65 -0
- package/dist/idempotency.js.map +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/inspect.d.ts +15 -0
- package/dist/inspect.d.ts.map +1 -0
- package/dist/inspect.js +44 -0
- package/dist/inspect.js.map +1 -0
- package/dist/internal-tables.d.ts +1767 -0
- package/dist/internal-tables.d.ts.map +1 -0
- package/dist/internal-tables.js +114 -0
- package/dist/internal-tables.js.map +1 -0
- package/dist/jobs/cron.d.ts +15 -0
- package/dist/jobs/cron.d.ts.map +1 -0
- package/dist/jobs/cron.js +74 -0
- package/dist/jobs/cron.js.map +1 -0
- package/dist/jobs/define.d.ts +186 -0
- package/dist/jobs/define.d.ts.map +1 -0
- package/dist/jobs/define.js +99 -0
- package/dist/jobs/define.js.map +1 -0
- package/dist/jobs/index.d.ts +9 -0
- package/dist/jobs/index.d.ts.map +1 -0
- package/dist/jobs/index.js +7 -0
- package/dist/jobs/index.js.map +1 -0
- package/dist/jobs/queue.d.ts +13 -0
- package/dist/jobs/queue.d.ts.map +1 -0
- package/dist/jobs/queue.js +71 -0
- package/dist/jobs/queue.js.map +1 -0
- package/dist/jobs/slots.d.ts +30 -0
- package/dist/jobs/slots.d.ts.map +1 -0
- package/dist/jobs/slots.js +53 -0
- package/dist/jobs/slots.js.map +1 -0
- package/dist/jobs/worker.d.ts +45 -0
- package/dist/jobs/worker.d.ts.map +1 -0
- package/dist/jobs/worker.js +605 -0
- package/dist/jobs/worker.js.map +1 -0
- package/dist/lifecycle.d.ts +10 -0
- package/dist/lifecycle.d.ts.map +1 -0
- package/dist/lifecycle.js +37 -0
- package/dist/lifecycle.js.map +1 -0
- package/dist/list-query.d.ts +62 -0
- package/dist/list-query.d.ts.map +1 -0
- package/dist/list-query.js +190 -0
- package/dist/list-query.js.map +1 -0
- package/dist/live/apply.d.ts +13 -0
- package/dist/live/apply.d.ts.map +1 -0
- package/dist/live/apply.js +32 -0
- package/dist/live/apply.js.map +1 -0
- package/dist/live/index.d.ts +48 -0
- package/dist/live/index.d.ts.map +1 -0
- package/dist/live/index.js +108 -0
- package/dist/live/index.js.map +1 -0
- package/dist/live/protocol.d.ts +47 -0
- package/dist/live/protocol.d.ts.map +1 -0
- package/dist/live/protocol.js +12 -0
- package/dist/live/protocol.js.map +1 -0
- package/dist/live/sse.d.ts +22 -0
- package/dist/live/sse.d.ts.map +1 -0
- package/dist/live/sse.js +41 -0
- package/dist/live/sse.js.map +1 -0
- package/dist/logging.d.ts +8 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +6 -0
- package/dist/logging.js.map +1 -0
- package/dist/manifest-diff.d.ts +6 -0
- package/dist/manifest-diff.d.ts.map +1 -0
- package/dist/manifest-diff.js +42 -0
- package/dist/manifest-diff.js.map +1 -0
- package/dist/manifest.d.ts +87 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +237 -0
- package/dist/manifest.js.map +1 -0
- package/dist/messaging/email.d.ts +16 -0
- package/dist/messaging/email.d.ts.map +1 -0
- package/dist/messaging/email.js +8 -0
- package/dist/messaging/email.js.map +1 -0
- package/dist/messaging/index.d.ts +8 -0
- package/dist/messaging/index.d.ts.map +1 -0
- package/dist/messaging/index.js +4 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/messaging/journal.d.ts +4 -0
- package/dist/messaging/journal.d.ts.map +1 -0
- package/dist/messaging/journal.js +19 -0
- package/dist/messaging/journal.js.map +1 -0
- package/dist/messaging/runtime.d.ts +16 -0
- package/dist/messaging/runtime.d.ts.map +1 -0
- package/dist/messaging/runtime.js +213 -0
- package/dist/messaging/runtime.js.map +1 -0
- package/dist/messaging/standalone.d.ts +27 -0
- package/dist/messaging/standalone.d.ts.map +1 -0
- package/dist/messaging/standalone.js +18 -0
- package/dist/messaging/standalone.js.map +1 -0
- package/dist/messaging/telegram.d.ts +16 -0
- package/dist/messaging/telegram.d.ts.map +1 -0
- package/dist/messaging/telegram.js +5 -0
- package/dist/messaging/telegram.js.map +1 -0
- package/dist/messaging/types.d.ts +22 -0
- package/dist/messaging/types.d.ts.map +1 -0
- package/dist/messaging/types.js +17 -0
- package/dist/messaging/types.js.map +1 -0
- package/dist/platform.d.ts +25 -0
- package/dist/platform.d.ts.map +1 -0
- package/dist/platform.js +24 -0
- package/dist/platform.js.map +1 -0
- package/dist/provision-internals.d.ts +23 -0
- package/dist/provision-internals.d.ts.map +1 -0
- package/dist/provision-internals.js +7 -0
- package/dist/provision-internals.js.map +1 -0
- package/dist/provision-runtime.d.ts +6 -0
- package/dist/provision-runtime.d.ts.map +1 -0
- package/dist/provision-runtime.js +41 -0
- package/dist/provision-runtime.js.map +1 -0
- package/dist/provision-schema.d.ts +16 -0
- package/dist/provision-schema.d.ts.map +1 -0
- package/dist/provision-schema.js +59 -0
- package/dist/provision-schema.js.map +1 -0
- package/dist/provision.d.ts +8 -0
- package/dist/provision.d.ts.map +1 -0
- package/dist/provision.js +16 -0
- package/dist/provision.js.map +1 -0
- package/dist/query/api.d.ts +10 -0
- package/dist/query/api.d.ts.map +1 -0
- package/dist/query/api.js +7 -0
- package/dist/query/api.js.map +1 -0
- package/dist/query/client.d.ts +28 -0
- package/dist/query/client.d.ts.map +1 -0
- package/dist/query/client.js +87 -0
- package/dist/query/client.js.map +1 -0
- package/dist/query/fetch.d.ts +3 -0
- package/dist/query/fetch.d.ts.map +1 -0
- package/dist/query/fetch.js +4 -0
- package/dist/query/fetch.js.map +1 -0
- package/dist/query/index.d.ts +8 -0
- package/dist/query/index.d.ts.map +1 -0
- package/dist/query/index.js +4 -0
- package/dist/query/index.js.map +1 -0
- package/dist/query/infer.d.ts +25 -0
- package/dist/query/infer.d.ts.map +1 -0
- package/dist/query/infer.js +2 -0
- package/dist/query/infer.js.map +1 -0
- package/dist/query/react.d.ts +3 -0
- package/dist/query/react.d.ts.map +1 -0
- package/dist/query/react.js +2 -0
- package/dist/query/react.js.map +1 -0
- package/dist/query/realtime-flush.d.ts +26 -0
- package/dist/query/realtime-flush.d.ts.map +1 -0
- package/dist/query/realtime-flush.js +45 -0
- package/dist/query/realtime-flush.js.map +1 -0
- package/dist/query/realtime-stream.d.ts +3 -0
- package/dist/query/realtime-stream.d.ts.map +1 -0
- package/dist/query/realtime-stream.js +3 -0
- package/dist/query/realtime-stream.js.map +1 -0
- package/dist/query/realtime.d.ts +88 -0
- package/dist/query/realtime.d.ts.map +1 -0
- package/dist/query/realtime.js +255 -0
- package/dist/query/realtime.js.map +1 -0
- package/dist/rate-limit.d.ts +8 -0
- package/dist/rate-limit.d.ts.map +1 -0
- package/dist/rate-limit.js +46 -0
- package/dist/rate-limit.js.map +1 -0
- package/dist/readiness-probes.d.ts +4 -0
- package/dist/readiness-probes.d.ts.map +1 -0
- package/dist/readiness-probes.js +23 -0
- package/dist/readiness-probes.js.map +1 -0
- package/dist/readiness.d.ts +39 -0
- package/dist/readiness.d.ts.map +1 -0
- package/dist/readiness.js +72 -0
- package/dist/readiness.js.map +1 -0
- package/dist/realtime/facade.d.ts +20 -0
- package/dist/realtime/facade.d.ts.map +1 -0
- package/dist/realtime/facade.js +37 -0
- package/dist/realtime/facade.js.map +1 -0
- package/dist/realtime/filter.d.ts +42 -0
- package/dist/realtime/filter.d.ts.map +1 -0
- package/dist/realtime/filter.js +86 -0
- package/dist/realtime/filter.js.map +1 -0
- package/dist/realtime/heartbeat.d.ts +20 -0
- package/dist/realtime/heartbeat.d.ts.map +1 -0
- package/dist/realtime/heartbeat.js +64 -0
- package/dist/realtime/heartbeat.js.map +1 -0
- package/dist/realtime/publisher.d.ts +19 -0
- package/dist/realtime/publisher.d.ts.map +1 -0
- package/dist/realtime/publisher.js +8 -0
- package/dist/realtime/publisher.js.map +1 -0
- package/dist/runtime.d.ts +141 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +463 -0
- package/dist/runtime.js.map +1 -0
- package/dist/schema-export.d.ts +2 -0
- package/dist/schema-export.d.ts.map +1 -0
- package/dist/schema-export.js +2 -0
- package/dist/schema-export.js.map +1 -0
- package/dist/scope.d.ts +4 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +13 -0
- package/dist/scope.js.map +1 -0
- package/dist/standard-schema.d.ts +13 -0
- package/dist/standard-schema.d.ts.map +1 -0
- package/dist/standard-schema.js +34 -0
- package/dist/standard-schema.js.map +1 -0
- package/dist/start/auth-client.d.ts +11 -0
- package/dist/start/auth-client.d.ts.map +1 -0
- package/dist/start/auth-client.js +15 -0
- package/dist/start/auth-client.js.map +1 -0
- package/dist/start/create-start-worker.d.ts +16 -0
- package/dist/start/create-start-worker.d.ts.map +1 -0
- package/dist/start/create-start-worker.js +24 -0
- package/dist/start/create-start-worker.js.map +1 -0
- package/dist/start/index.d.ts +66 -0
- package/dist/start/index.d.ts.map +1 -0
- package/dist/start/index.js +49 -0
- package/dist/start/index.js.map +1 -0
- package/dist/start/isomorphic-fetch.d.ts +22 -0
- package/dist/start/isomorphic-fetch.d.ts.map +1 -0
- package/dist/start/isomorphic-fetch.js +49 -0
- package/dist/start/isomorphic-fetch.js.map +1 -0
- package/dist/start/server-entry.d.ts +7 -0
- package/dist/start/server-entry.d.ts.map +1 -0
- package/dist/start/server-entry.js +8 -0
- package/dist/start/server-entry.js.map +1 -0
- package/dist/storage/background.d.ts +3 -0
- package/dist/storage/background.d.ts.map +1 -0
- package/dist/storage/background.js +3 -0
- package/dist/storage/background.js.map +1 -0
- package/dist/storage/buckets.d.ts +78 -0
- package/dist/storage/buckets.d.ts.map +1 -0
- package/dist/storage/buckets.js +177 -0
- package/dist/storage/buckets.js.map +1 -0
- package/dist/storage/delete.d.ts +8 -0
- package/dist/storage/delete.d.ts.map +1 -0
- package/dist/storage/delete.js +10 -0
- package/dist/storage/delete.js.map +1 -0
- package/dist/storage/file-meta.d.ts +37 -0
- package/dist/storage/file-meta.d.ts.map +1 -0
- package/dist/storage/file-meta.js +166 -0
- package/dist/storage/file-meta.js.map +1 -0
- package/dist/storage/index.d.ts +28 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +5 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/local.d.ts +15 -0
- package/dist/storage/local.d.ts.map +1 -0
- package/dist/storage/local.js +56 -0
- package/dist/storage/local.js.map +1 -0
- package/dist/storage/operations.d.ts +54 -0
- package/dist/storage/operations.d.ts.map +1 -0
- package/dist/storage/operations.js +212 -0
- package/dist/storage/operations.js.map +1 -0
- package/dist/storage/registry.d.ts +11 -0
- package/dist/storage/registry.d.ts.map +1 -0
- package/dist/storage/registry.js +23 -0
- package/dist/storage/registry.js.map +1 -0
- package/dist/storage/s3.d.ts +35 -0
- package/dist/storage/s3.d.ts.map +1 -0
- package/dist/storage/s3.js +125 -0
- package/dist/storage/s3.js.map +1 -0
- package/dist/storage/sigv4.d.ts +24 -0
- package/dist/storage/sigv4.d.ts.map +1 -0
- package/dist/storage/sigv4.js +107 -0
- package/dist/storage/sigv4.js.map +1 -0
- package/dist/storage/sweep.d.ts +9 -0
- package/dist/storage/sweep.d.ts.map +1 -0
- package/dist/storage/sweep.js +17 -0
- package/dist/storage/sweep.js.map +1 -0
- package/dist/sync/collection.d.ts +106 -0
- package/dist/sync/collection.d.ts.map +1 -0
- package/dist/sync/collection.js +258 -0
- package/dist/sync/collection.js.map +1 -0
- package/dist/sync/index.d.ts +8 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +4 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/realtime-sync.d.ts +31 -0
- package/dist/sync/realtime-sync.d.ts.map +1 -0
- package/dist/sync/realtime-sync.js +46 -0
- package/dist/sync/realtime-sync.js.map +1 -0
- package/dist/sync/sync-client.d.ts +28 -0
- package/dist/sync/sync-client.d.ts.map +1 -0
- package/dist/sync/sync-client.js +52 -0
- package/dist/sync/sync-client.js.map +1 -0
- package/dist/sync/update-queue.d.ts +27 -0
- package/dist/sync/update-queue.d.ts.map +1 -0
- package/dist/sync/update-queue.js +66 -0
- package/dist/sync/update-queue.js.map +1 -0
- package/dist/testing/auth.d.ts +85 -0
- package/dist/testing/auth.d.ts.map +1 -0
- package/dist/testing/auth.js +140 -0
- package/dist/testing/auth.js.map +1 -0
- package/dist/testing/client.d.ts +6 -0
- package/dist/testing/client.d.ts.map +1 -0
- package/dist/testing/client.js +9 -0
- package/dist/testing/client.js.map +1 -0
- package/dist/testing/database.d.ts +6 -0
- package/dist/testing/database.d.ts.map +1 -0
- package/dist/testing/database.js +8 -0
- package/dist/testing/database.js.map +1 -0
- package/dist/testing/email.d.ts +15 -0
- package/dist/testing/email.d.ts.map +1 -0
- package/dist/testing/email.js +32 -0
- package/dist/testing/email.js.map +1 -0
- package/dist/testing/fixture.d.ts +51 -0
- package/dist/testing/fixture.d.ts.map +1 -0
- package/dist/testing/fixture.js +177 -0
- package/dist/testing/fixture.js.map +1 -0
- package/dist/testing/jobs.d.ts +40 -0
- package/dist/testing/jobs.d.ts.map +1 -0
- package/dist/testing/jobs.js +76 -0
- package/dist/testing/jobs.js.map +1 -0
- package/dist/testing/logs.d.ts +18 -0
- package/dist/testing/logs.d.ts.map +1 -0
- package/dist/testing/logs.js +53 -0
- package/dist/testing/logs.js.map +1 -0
- package/dist/testing/messaging.d.ts +21 -0
- package/dist/testing/messaging.d.ts.map +1 -0
- package/dist/testing/messaging.js +34 -0
- package/dist/testing/messaging.js.map +1 -0
- package/dist/testing/storage.d.ts +7 -0
- package/dist/testing/storage.d.ts.map +1 -0
- package/dist/testing/storage.js +29 -0
- package/dist/testing/storage.js.map +1 -0
- package/dist/testing/workers-fakes.d.ts +17 -0
- package/dist/testing/workers-fakes.d.ts.map +1 -0
- package/dist/testing/workers-fakes.js +98 -0
- package/dist/testing/workers-fakes.js.map +1 -0
- package/dist/testing.d.ts +12 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +5 -0
- package/dist/testing.js.map +1 -0
- package/dist/typeid.d.ts +46 -0
- package/dist/typeid.d.ts.map +1 -0
- package/dist/typeid.js +130 -0
- package/dist/typeid.js.map +1 -0
- package/dist/vite.d.ts +26 -0
- package/dist/vite.d.ts.map +1 -0
- package/dist/vite.js +100 -0
- package/dist/vite.js.map +1 -0
- package/dist/worker-plan.d.ts +37 -0
- package/dist/worker-plan.d.ts.map +1 -0
- package/dist/worker-plan.js +63 -0
- package/dist/worker-plan.js.map +1 -0
- package/dist/workers/app.d.ts +19 -0
- package/dist/workers/app.d.ts.map +1 -0
- package/dist/workers/app.js +56 -0
- package/dist/workers/app.js.map +1 -0
- package/dist/workers/entry.d.ts +7 -0
- package/dist/workers/entry.d.ts.map +1 -0
- package/dist/workers/entry.js +8 -0
- package/dist/workers/entry.js.map +1 -0
- package/dist/workers/index.d.ts +23 -0
- package/dist/workers/index.d.ts.map +1 -0
- package/dist/workers/index.js +39 -0
- package/dist/workers/index.js.map +1 -0
- package/dist/workers/r2.d.ts +24 -0
- package/dist/workers/r2.d.ts.map +1 -0
- package/dist/workers/r2.js +76 -0
- package/dist/workers/r2.js.map +1 -0
- package/dist/workers/rate-limiter.d.ts +9 -0
- package/dist/workers/rate-limiter.d.ts.map +1 -0
- package/dist/workers/rate-limiter.js +22 -0
- package/dist/workers/rate-limiter.js.map +1 -0
- package/dist/workers/realtime-hub.d.ts +20 -0
- package/dist/workers/realtime-hub.d.ts.map +1 -0
- package/dist/workers/realtime-hub.js +117 -0
- package/dist/workers/realtime-hub.js.map +1 -0
- package/dist/workers/registry.d.ts +13 -0
- package/dist/workers/registry.d.ts.map +1 -0
- package/dist/workers/registry.js +19 -0
- package/dist/workers/registry.js.map +1 -0
- package/dist/workers/scheduler.d.ts +13 -0
- package/dist/workers/scheduler.d.ts.map +1 -0
- package/dist/workers/scheduler.js +71 -0
- package/dist/workers/scheduler.js.map +1 -0
- package/dist/workers/types.d.ts +55 -0
- package/dist/workers/types.d.ts.map +1 -0
- package/dist/workers/types.js +4 -0
- package/dist/workers/types.js.map +1 -0
- package/dist/workers/wrangler.d.ts +62 -0
- package/dist/workers/wrangler.d.ts.map +1 -0
- package/dist/workers/wrangler.js +90 -0
- package/dist/workers/wrangler.js.map +1 -0
- package/package.json +286 -0
- package/skills/creating-workerstack-apps/SKILL.md +45 -0
- package/skills/creating-workerstack-apps/agents/openai.yaml +4 -0
- package/skills/creating-workerstack-apps/references/application-structure.md +219 -0
- package/skills/creating-workerstack-apps/references/runtime-integrations.md +96 -0
- package/skills/creating-workerstack-apps/references/verification.md +29 -0
package/package.json
ADDED
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "workerstack",
|
|
3
|
+
"version": "0.1.0-beta.0",
|
|
4
|
+
"description": "Full-stack framework for Cloudflare Workers: one blueprint declares the API, auth, storage, jobs, cron, and realtime, and SSR with TanStack Start runs next to them.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"backend",
|
|
7
|
+
"better-auth",
|
|
8
|
+
"cloudflare",
|
|
9
|
+
"workers",
|
|
10
|
+
"durable-objects",
|
|
11
|
+
"drizzle",
|
|
12
|
+
"orpc",
|
|
13
|
+
"realtime",
|
|
14
|
+
"tanstack-start",
|
|
15
|
+
"typesafe"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/kirill-dev-pro/workerstack#readme",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/kirill-dev-pro/workerstack.git",
|
|
22
|
+
"directory": "packages/workerstack"
|
|
23
|
+
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"workerstack": "./dist/cli.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"skills",
|
|
30
|
+
"CHANGELOG.md",
|
|
31
|
+
"README.md",
|
|
32
|
+
"LICENSE"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
35
|
+
"main": "./dist/index.js",
|
|
36
|
+
"module": "./dist/index.js",
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"exports": {
|
|
39
|
+
".": {
|
|
40
|
+
"types": "./dist/index.d.ts",
|
|
41
|
+
"default": "./dist/index.js"
|
|
42
|
+
},
|
|
43
|
+
"./access": {
|
|
44
|
+
"types": "./dist/access.d.ts",
|
|
45
|
+
"default": "./dist/access.js"
|
|
46
|
+
},
|
|
47
|
+
"./codegen": {
|
|
48
|
+
"types": "./dist/codegen.d.ts",
|
|
49
|
+
"default": "./dist/codegen.js"
|
|
50
|
+
},
|
|
51
|
+
"./libsql": {
|
|
52
|
+
"types": "./dist/database/libsql.d.ts",
|
|
53
|
+
"default": "./dist/database/libsql.js"
|
|
54
|
+
},
|
|
55
|
+
"./live": {
|
|
56
|
+
"types": "./dist/live/index.d.ts",
|
|
57
|
+
"default": "./dist/live/index.js"
|
|
58
|
+
},
|
|
59
|
+
"./provision": {
|
|
60
|
+
"types": "./dist/provision.d.ts",
|
|
61
|
+
"default": "./dist/provision.js"
|
|
62
|
+
},
|
|
63
|
+
"./provision-schema": {
|
|
64
|
+
"types": "./dist/provision-schema.d.ts",
|
|
65
|
+
"default": "./dist/provision-schema.js"
|
|
66
|
+
},
|
|
67
|
+
"./testing": {
|
|
68
|
+
"types": "./dist/testing.d.ts",
|
|
69
|
+
"default": "./dist/testing.js"
|
|
70
|
+
},
|
|
71
|
+
"./workers": {
|
|
72
|
+
"types": "./dist/workers/index.d.ts",
|
|
73
|
+
"default": "./dist/workers/index.js"
|
|
74
|
+
},
|
|
75
|
+
"./vite": {
|
|
76
|
+
"types": "./dist/vite.d.ts",
|
|
77
|
+
"default": "./dist/vite.js"
|
|
78
|
+
},
|
|
79
|
+
"./schema": {
|
|
80
|
+
"types": "./dist/schema-export.d.ts",
|
|
81
|
+
"default": "./dist/schema-export.js"
|
|
82
|
+
},
|
|
83
|
+
"./typeid": {
|
|
84
|
+
"types": "./dist/typeid.d.ts",
|
|
85
|
+
"default": "./dist/typeid.js"
|
|
86
|
+
},
|
|
87
|
+
"./env": {
|
|
88
|
+
"types": "./dist/env.d.ts",
|
|
89
|
+
"default": "./dist/env.js"
|
|
90
|
+
},
|
|
91
|
+
"./blueprint": {
|
|
92
|
+
"types": "./dist/blueprint.d.ts",
|
|
93
|
+
"default": "./dist/blueprint.js"
|
|
94
|
+
},
|
|
95
|
+
"./cron": {
|
|
96
|
+
"types": "./dist/cron.d.ts",
|
|
97
|
+
"default": "./dist/cron.js"
|
|
98
|
+
},
|
|
99
|
+
"./email-smtp": {
|
|
100
|
+
"types": "./dist/email/smtp.d.ts",
|
|
101
|
+
"default": "./dist/email/smtp.js"
|
|
102
|
+
},
|
|
103
|
+
"./messaging": {
|
|
104
|
+
"types": "./dist/messaging/index.d.ts",
|
|
105
|
+
"default": "./dist/messaging/index.js"
|
|
106
|
+
},
|
|
107
|
+
"./api": {
|
|
108
|
+
"types": "./dist/api/types.d.ts",
|
|
109
|
+
"default": "./dist/api/types.js"
|
|
110
|
+
},
|
|
111
|
+
"./client": {
|
|
112
|
+
"types": "./dist/client/index.d.ts",
|
|
113
|
+
"default": "./dist/client/index.js"
|
|
114
|
+
},
|
|
115
|
+
"./client-rest": {
|
|
116
|
+
"types": "./dist/client/rest.d.ts",
|
|
117
|
+
"default": "./dist/client/rest.js"
|
|
118
|
+
},
|
|
119
|
+
"./client-react": {
|
|
120
|
+
"types": "./dist/client/react.d.ts",
|
|
121
|
+
"default": "./dist/client/react.js"
|
|
122
|
+
},
|
|
123
|
+
"./client-solid": {
|
|
124
|
+
"types": "./dist/client/solid.d.ts",
|
|
125
|
+
"default": "./dist/client/solid.js"
|
|
126
|
+
},
|
|
127
|
+
"./client-svelte": {
|
|
128
|
+
"types": "./dist/client/svelte.d.ts",
|
|
129
|
+
"default": "./dist/client/svelte.js"
|
|
130
|
+
},
|
|
131
|
+
"./client-vue": {
|
|
132
|
+
"types": "./dist/client/vue.d.ts",
|
|
133
|
+
"default": "./dist/client/vue.js"
|
|
134
|
+
},
|
|
135
|
+
"./query": {
|
|
136
|
+
"types": "./dist/query/index.d.ts",
|
|
137
|
+
"default": "./dist/query/index.js"
|
|
138
|
+
},
|
|
139
|
+
"./query-react": {
|
|
140
|
+
"types": "./dist/query/react.d.ts",
|
|
141
|
+
"default": "./dist/query/react.js"
|
|
142
|
+
},
|
|
143
|
+
"./sync": {
|
|
144
|
+
"types": "./dist/sync/index.d.ts",
|
|
145
|
+
"default": "./dist/sync/index.js"
|
|
146
|
+
},
|
|
147
|
+
"./start": {
|
|
148
|
+
"types": "./dist/start/index.d.ts",
|
|
149
|
+
"default": "./dist/start/index.js"
|
|
150
|
+
},
|
|
151
|
+
"./start/worker": {
|
|
152
|
+
"types": "./dist/start/create-start-worker.d.ts",
|
|
153
|
+
"default": "./dist/start/create-start-worker.js"
|
|
154
|
+
},
|
|
155
|
+
"./start/server-entry": {
|
|
156
|
+
"types": "./dist/start/server-entry.d.ts",
|
|
157
|
+
"default": "./dist/start/server-entry.js"
|
|
158
|
+
},
|
|
159
|
+
"./workers/entry": {
|
|
160
|
+
"types": "./dist/workers/entry.d.ts",
|
|
161
|
+
"default": "./dist/workers/entry.js"
|
|
162
|
+
},
|
|
163
|
+
"./start-auth": {
|
|
164
|
+
"types": "./dist/start/auth-client.d.ts",
|
|
165
|
+
"default": "./dist/start/auth-client.js"
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"scripts": {
|
|
169
|
+
"build": "bun ../../scripts/build-package.ts workerstack",
|
|
170
|
+
"db:migrate": "drizzle-kit migrate",
|
|
171
|
+
"db:push": "drizzle-kit push",
|
|
172
|
+
"prepack": "bun run build",
|
|
173
|
+
"test": "bun test --parallel --timeout=30000",
|
|
174
|
+
"typecheck": "tsc --noEmit"
|
|
175
|
+
},
|
|
176
|
+
"dependencies": {
|
|
177
|
+
"@noble/hashes": "^2.3.0",
|
|
178
|
+
"@standard-schema/spec": "1.1.0",
|
|
179
|
+
"@standardserver/core": "0.7.1",
|
|
180
|
+
"esbuild": "^0.28.2",
|
|
181
|
+
"valibot": "1.4.2",
|
|
182
|
+
"yaml": "^2.9.0"
|
|
183
|
+
},
|
|
184
|
+
"devDependencies": {
|
|
185
|
+
"@libsql/client": ">=0.14.0",
|
|
186
|
+
"@orpc/client": "2.0.0-beta.37",
|
|
187
|
+
"@orpc/json-schema": "2.0.0-beta.37",
|
|
188
|
+
"@orpc/openapi": "2.0.0-beta.37",
|
|
189
|
+
"@orpc/publisher": "2.0.0-beta.37",
|
|
190
|
+
"@orpc/server": "2.0.0-beta.37",
|
|
191
|
+
"@orpc/tanstack-query": "2.0.0-beta.37",
|
|
192
|
+
"@orpc/valibot": "2.0.0-beta.37",
|
|
193
|
+
"@standardserver/core": "0.7.1",
|
|
194
|
+
"@tanstack/db": "0.6.16",
|
|
195
|
+
"@tanstack/query-core": "^5.101.1",
|
|
196
|
+
"@tanstack/query-db-collection": "1.1.0",
|
|
197
|
+
"@tanstack/react-query": "^5.101.1",
|
|
198
|
+
"@tanstack/react-start": "^1.168.26",
|
|
199
|
+
"@types/nodemailer": "^6",
|
|
200
|
+
"@types/react": "^19.0.0",
|
|
201
|
+
"better-auth": "^1.7.6",
|
|
202
|
+
"drizzle-kit": "^0.30.0",
|
|
203
|
+
"drizzle-orm": "^0.45.0",
|
|
204
|
+
"drizzle-valibot": "0.4.2",
|
|
205
|
+
"react": "^19.0.0",
|
|
206
|
+
"solid-js": "2.0.0-rc.0",
|
|
207
|
+
"typescript": "^5.8.0",
|
|
208
|
+
"vue": "^3.5.0"
|
|
209
|
+
},
|
|
210
|
+
"peerDependencies": {
|
|
211
|
+
"@cloudflare/vite-plugin": "^1.62.0",
|
|
212
|
+
"@libsql/client": ">=0.14.0",
|
|
213
|
+
"@orpc/client": "2.0.0-beta.37",
|
|
214
|
+
"@orpc/json-schema": "2.0.0-beta.37",
|
|
215
|
+
"@orpc/openapi": "2.0.0-beta.37",
|
|
216
|
+
"@orpc/publisher": "2.0.0-beta.37",
|
|
217
|
+
"@orpc/server": "2.0.0-beta.37",
|
|
218
|
+
"@orpc/tanstack-query": "2.0.0-beta.37",
|
|
219
|
+
"@orpc/valibot": "2.0.0-beta.37",
|
|
220
|
+
"@tanstack/db": "0.6.16",
|
|
221
|
+
"@tanstack/query-core": "^5.101.0",
|
|
222
|
+
"@tanstack/query-db-collection": "1.1.0",
|
|
223
|
+
"@tanstack/react-query": "^5.101.0",
|
|
224
|
+
"@tanstack/react-start": ">=1.0.0",
|
|
225
|
+
"better-auth": "^1.0.0",
|
|
226
|
+
"drizzle-kit": "^0.30.0",
|
|
227
|
+
"drizzle-orm": "^0.45.0",
|
|
228
|
+
"drizzle-valibot": "0.4.2",
|
|
229
|
+
"nodemailer": ">=6 <10",
|
|
230
|
+
"react": ">=18",
|
|
231
|
+
"solid-js": ">=2.0.0-rc.0",
|
|
232
|
+
"typescript": ">=5",
|
|
233
|
+
"vue": ">=3.5",
|
|
234
|
+
"wrangler": "^4.143.0"
|
|
235
|
+
},
|
|
236
|
+
"peerDependenciesMeta": {
|
|
237
|
+
"@cloudflare/vite-plugin": {
|
|
238
|
+
"optional": true
|
|
239
|
+
},
|
|
240
|
+
"@libsql/client": {
|
|
241
|
+
"optional": true
|
|
242
|
+
},
|
|
243
|
+
"@orpc/tanstack-query": {
|
|
244
|
+
"optional": true
|
|
245
|
+
},
|
|
246
|
+
"@tanstack/db": {
|
|
247
|
+
"optional": true
|
|
248
|
+
},
|
|
249
|
+
"@tanstack/query-core": {
|
|
250
|
+
"optional": true
|
|
251
|
+
},
|
|
252
|
+
"@tanstack/query-db-collection": {
|
|
253
|
+
"optional": true
|
|
254
|
+
},
|
|
255
|
+
"@tanstack/react-query": {
|
|
256
|
+
"optional": true
|
|
257
|
+
},
|
|
258
|
+
"@tanstack/react-start": {
|
|
259
|
+
"optional": true
|
|
260
|
+
},
|
|
261
|
+
"better-auth": {
|
|
262
|
+
"optional": true
|
|
263
|
+
},
|
|
264
|
+
"drizzle-kit": {
|
|
265
|
+
"optional": true
|
|
266
|
+
},
|
|
267
|
+
"nodemailer": {
|
|
268
|
+
"optional": true
|
|
269
|
+
},
|
|
270
|
+
"react": {
|
|
271
|
+
"optional": true
|
|
272
|
+
},
|
|
273
|
+
"solid-js": {
|
|
274
|
+
"optional": true
|
|
275
|
+
},
|
|
276
|
+
"typescript": {
|
|
277
|
+
"optional": true
|
|
278
|
+
},
|
|
279
|
+
"vue": {
|
|
280
|
+
"optional": true
|
|
281
|
+
},
|
|
282
|
+
"wrangler": {
|
|
283
|
+
"optional": true
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: creating-workerstack-apps
|
|
3
|
+
description: Use when working in a repository that depends on workerstack - starting or structuring the application, adding or changing oRPC procedures, bases, middleware, access rules, jobs, storage, or realtime, choosing a runtime integration, or preparing it for production.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Creating Workerstack Apps
|
|
7
|
+
|
|
8
|
+
## Workflow
|
|
9
|
+
|
|
10
|
+
1. Inspect the product brief and target runtime.
|
|
11
|
+
2. Choose the layout from the table below.
|
|
12
|
+
3. For a new app, use TanStack Start with `render: ssr` (the default); an SPA
|
|
13
|
+
sets `render: spa` in the blueprint. A 1.0 SaaS template is not available
|
|
14
|
+
yet: start from `examples/ssr-probe` (SSR) or `examples/todo-solid-native`
|
|
15
|
+
(SPA) in the workerstack repository.
|
|
16
|
+
4. Configure schema, access, auth, env, storage, jobs, realtime, and the oRPC API graph.
|
|
17
|
+
5. Mount the single `app.handler` integration.
|
|
18
|
+
6. Add committed migrations and a deployment blueprint before production.
|
|
19
|
+
7. Run the verification contract.
|
|
20
|
+
|
|
21
|
+
| Condition | Layout |
|
|
22
|
+
| --------------------------------------------------------------------------- | ----------------------------------------------------------------- |
|
|
23
|
+
| Small API with short configuration | `src/workerstack.ts` |
|
|
24
|
+
| Auth, access, jobs, env, or custom oRPC procedures need independent modules | `src/workerstack/` |
|
|
25
|
+
|
|
26
|
+
## Runtime decision recipe
|
|
27
|
+
|
|
28
|
+
Everything runs in one Cloudflare Worker: the API, jobs and cron (Scheduler
|
|
29
|
+
Durable Object), realtime (RealtimeHub), and, with `render: ssr`, the TanStack
|
|
30
|
+
Start pages. There is no separate API process. `workerstack()` in `vite.config`
|
|
31
|
+
wires the Worker entry; do not write `src/worker.ts` unless the app needs a
|
|
32
|
+
custom fetch handler. Loaders and server functions call the backend through
|
|
33
|
+
`workerstackStart<App>()` in the same isolate.
|
|
34
|
+
|
|
35
|
+
Code runs in a Worker isolate: no file system, no child processes, no native
|
|
36
|
+
modules, limited CPU per request. Anything that needs those (a headless
|
|
37
|
+
browser, native drivers, large files in memory) belongs outside the app.
|
|
38
|
+
|
|
39
|
+
Read [application structure](references/application-structure.md) before placing
|
|
40
|
+
the Workerstack entry, schemas, authorization, or configuration modules, and
|
|
41
|
+
before declaring procedures, bases, middleware, or errors.
|
|
42
|
+
Read [runtime integrations](references/runtime-integrations.md) before mounting
|
|
43
|
+
HTTP, adding a worker, or choosing a framework adapter. Read the
|
|
44
|
+
[verification contract](references/verification.md) after adding the app
|
|
45
|
+
scripts and again before handoff or deployment.
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
# Application structure
|
|
2
|
+
|
|
3
|
+
## Separate declaration from runtime
|
|
4
|
+
|
|
5
|
+
`src/workerstack/backend.ts` synchronously constructs and exports `backend =
|
|
6
|
+
workerstack({...})`. The declaration is one object; `database`, `storage`,
|
|
7
|
+
`messaging`, and `realtime` also accept a function of the validated
|
|
8
|
+
environment, and `auth` accepts a builder over `{ db, env }`. It is pure:
|
|
9
|
+
`backend.inspect({ env })` resolves it and returns a manifest without
|
|
10
|
+
connecting to infrastructure, and the blueprint imports this declaration
|
|
11
|
+
without starting the application.
|
|
12
|
+
|
|
13
|
+
`src/workerstack/index.ts` owns the production runtime: it imports `backend`,
|
|
14
|
+
calls `await backend.start()`, exports `app`, and calls `provision(app)` when the
|
|
15
|
+
application owns provisioning. Keep unrelated external side effects out of the
|
|
16
|
+
backend import graph.
|
|
17
|
+
|
|
18
|
+
Start a small API in `src/workerstack.ts`. Split a meaningful configuration
|
|
19
|
+
into `src/workerstack/` with `backend.ts`, `index.ts`, `schema/`, `access.ts`, `auth.ts`,
|
|
20
|
+
`env.ts`, `jobs/`, and `api/` as needed. The entry remains the one place that
|
|
21
|
+
starts the declared backend; do not create parallel app,
|
|
22
|
+
database, or auth instances.
|
|
23
|
+
|
|
24
|
+
## Aggregate the schema
|
|
25
|
+
|
|
26
|
+
Export every domain, Better Auth, plugin, and Workerstack internal table from
|
|
27
|
+
the schema object passed to `workerstack()`. Include
|
|
28
|
+
`export * from 'workerstack/schema'` so migrations include the internal tables.
|
|
29
|
+
Define Better Auth tables required by the selected auth flows and plugins; do
|
|
30
|
+
not assume a minimal auth configuration needs every optional provider table.
|
|
31
|
+
|
|
32
|
+
## Define authorization on the server
|
|
33
|
+
|
|
34
|
+
Use `defineAccess(schema, rules)` for generated CRUD. Give each exposed table
|
|
35
|
+
an explicit operation policy and set `ownerColumn` for owner rules. Keep auth,
|
|
36
|
+
internal, and administrative tables out of generated CRUD unless deliberately
|
|
37
|
+
exposing the supported `user` table.
|
|
38
|
+
|
|
39
|
+
Use `scope.read` and `scope.write` to enforce tenant columns on generated
|
|
40
|
+
lists, reads, and writes. For example, an organization-owned table can derive
|
|
41
|
+
`{ organizationId: ctx.session?.activeOrganizationId ?? '__none__' }`, keeping
|
|
42
|
+
users without an active organization outside tenant rows. Use protected oRPC
|
|
43
|
+
procedures built from `o.protected` when authorization depends on related rows
|
|
44
|
+
or roles; hiding a UI route is not authorization.
|
|
45
|
+
|
|
46
|
+
## Extend the one API graph
|
|
47
|
+
|
|
48
|
+
Declare the builder once at module scope with `defineApi({ schema, env })`. It
|
|
49
|
+
infers the schema and env types from the values, so no application writes
|
|
50
|
+
`WorkerstackApiBuilder<...>` by hand, and it reads nothing at runtime.
|
|
51
|
+
|
|
52
|
+
```ts
|
|
53
|
+
// src/workerstack/api/base.ts
|
|
54
|
+
export const o = defineApi({ schema, env: envSchema })
|
|
55
|
+
export const publicProcedure = o.public
|
|
56
|
+
export const protectedProcedure = o.protected
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Router modules are plain objects that import the base they need, and the entry
|
|
60
|
+
passes the finished router as `api`:
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
// src/workerstack/api/projects.ts
|
|
64
|
+
export const projectsRouter = {
|
|
65
|
+
stats: protectedProcedure.input(...).handler(...),
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// src/workerstack/api/index.ts
|
|
69
|
+
export const api = { projects: projectsRouter }
|
|
70
|
+
|
|
71
|
+
// backend.ts
|
|
72
|
+
workerstack({ schema, database, api })
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Do not write a router factory that receives a bag of procedures. That shape
|
|
76
|
+
only existed because `api` used to be a callback. The callback form,
|
|
77
|
+
`api: (o) => ({ ... })`, still works for a router that must be built from the
|
|
78
|
+
framework builder at configuration time.
|
|
79
|
+
|
|
80
|
+
Use `o.public`, `o.protected`, or `o.webhook`; add `.route(...)` only when a
|
|
81
|
+
stable HTTP projection is useful. Generated CRUD, custom procedures, files,
|
|
82
|
+
health, and `realtime.changes` remain in the same typed oRPC graph and client.
|
|
83
|
+
|
|
84
|
+
## Give a group of procedures its own base
|
|
85
|
+
|
|
86
|
+
A base is an oRPC builder, so `.use()` produces another one. Declare a rule
|
|
87
|
+
once instead of repeating it in every handler that depends on it:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
export const adminProcedure = o.protected.use(
|
|
91
|
+
async ({ context, next, errors }) => {
|
|
92
|
+
if (context.user.role !== 'admin') {
|
|
93
|
+
throw errors.FORBIDDEN({ message: 'Admin access required' })
|
|
94
|
+
}
|
|
95
|
+
return next()
|
|
96
|
+
},
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
`next({ context })` merges into the context and types it for everything
|
|
101
|
+
downstream, which is how an organization scope or a resolved tenant reaches
|
|
102
|
+
handlers without an argument.
|
|
103
|
+
|
|
104
|
+
## Instrument the whole graph, not one base
|
|
105
|
+
|
|
106
|
+
Workerstack builds the CRUD, storage, and realtime procedures itself, so they
|
|
107
|
+
never pass through a base the application declares. A middleware attached to
|
|
108
|
+
`o.protected` therefore measures the application's own procedures and leaves
|
|
109
|
+
the generated CRUD — usually the larger share of traffic — unmeasured.
|
|
110
|
+
|
|
111
|
+
Register cross-cutting middleware in the configuration instead:
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
const instrumentation = o.middleware(async ({ context, next, path }) => {
|
|
115
|
+
if (path[0] === 'realtime') return next()
|
|
116
|
+
const startedAt = performance.now()
|
|
117
|
+
try {
|
|
118
|
+
return await next()
|
|
119
|
+
} finally {
|
|
120
|
+
record(
|
|
121
|
+
path.join('.'),
|
|
122
|
+
performance.now() - startedAt,
|
|
123
|
+
context.peekSession()?.user?.id,
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
workerstack({
|
|
129
|
+
schema,
|
|
130
|
+
database,
|
|
131
|
+
middleware: [instrumentation],
|
|
132
|
+
api,
|
|
133
|
+
})
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Three rules apply to a graph-wide middleware. It runs before authentication, so
|
|
137
|
+
`context.user` does not exist there. Read the caller with
|
|
138
|
+
`context.peekSession()` after `await next()`, never `getSession()`: forcing the
|
|
139
|
+
session makes every request pay for authentication, including signed webhooks
|
|
140
|
+
that never needed it, and `peekSession()` is for observability only, never for
|
|
141
|
+
authorization. A realtime subscription is one long-lived call, so code after
|
|
142
|
+
`await next()` runs when the stream closes, not when it starts.
|
|
143
|
+
|
|
144
|
+
## Raise declared errors
|
|
145
|
+
|
|
146
|
+
Every procedure carries one error map: `BAD_REQUEST`, `UNAUTHORIZED`,
|
|
147
|
+
`FORBIDDEN`, `NOT_FOUND`, `CONFLICT`, `PAYLOAD_TOO_LARGE`,
|
|
148
|
+
`TOO_MANY_REQUESTS`. Inside a handler or middleware, raise from the `errors`
|
|
149
|
+
argument, with extra context in `data.details`:
|
|
150
|
+
|
|
151
|
+
```ts
|
|
152
|
+
throw errors.NOT_FOUND({ message: 'Project not found' })
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Code outside a handler — a service function or a job — has no `errors`
|
|
156
|
+
argument. Throw `WorkerstackError`, which the framework maps to the same typed
|
|
157
|
+
error. Do not construct `ORPCError` by hand anywhere.
|
|
158
|
+
|
|
159
|
+
## Give list endpoints the shared contract
|
|
160
|
+
|
|
161
|
+
`listSpec(table, options)` gives a procedure you write the same filter, sort,
|
|
162
|
+
cursor, and count contract the generated CRUD list uses. Apply both parts to
|
|
163
|
+
your own base, which is what preserves the row type to the client:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
const logsList = listSpec(appLogs, {
|
|
167
|
+
filterable: ['level'],
|
|
168
|
+
sortable: ['createdAt'],
|
|
169
|
+
})
|
|
170
|
+
logs: adminProcedure.input(logsList.input).handler(logsList.handler)
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
It reads no `access` configuration; the base procedure carries the policy.
|
|
174
|
+
|
|
175
|
+
## Type helpers that take the database
|
|
176
|
+
|
|
177
|
+
A service module cannot reach `typeof app.db` without an import cycle back to
|
|
178
|
+
the entry. Use `WorkerstackDb<typeof schema>` and `WorkerstackTx<typeof schema>`
|
|
179
|
+
instead of `any`.
|
|
180
|
+
|
|
181
|
+
## Keep the entry out of its own import graph
|
|
182
|
+
|
|
183
|
+
The api router and everything it imports are evaluated when the entry is
|
|
184
|
+
imported. A module in that graph that imports the app back — a bot client
|
|
185
|
+
reading `db`, a logger reading `app.env` — closes a cycle and breaks module
|
|
186
|
+
initialization. Load the app lazily in such a module.
|
|
187
|
+
|
|
188
|
+
## Keep credentials environment-owned
|
|
189
|
+
|
|
190
|
+
Declare validated server and browser-safe client variables in `env`. Server
|
|
191
|
+
variables must not use the `PUBLIC_` prefix; client variables must use it.
|
|
192
|
+
Use `app.env` (and `ctx.env`) rather than duplicating unchecked configuration.
|
|
193
|
+
Commit `.env.example` with names and safe placeholders only. Keep production
|
|
194
|
+
secrets, database URLs, storage credentials, and auth secrets in the runtime
|
|
195
|
+
environment.
|
|
196
|
+
|
|
197
|
+
Use local libSQL storage for development, and let a messaging channel without
|
|
198
|
+
credentials capture instead of sending; declare production adapters and
|
|
199
|
+
credentials through the declaration and the runtime environment rather than
|
|
200
|
+
hard-coding them.
|
|
201
|
+
|
|
202
|
+
## Publish direct writes
|
|
203
|
+
|
|
204
|
+
Generated CRUD publishes realtime changes automatically. For a write through
|
|
205
|
+
`app.db` or `ctx.db`, return the complete changed row, wait for its transaction
|
|
206
|
+
to commit, then publish it with the table object:
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
const [task] = await ctx.db
|
|
210
|
+
.update(schema.tasks)
|
|
211
|
+
.set({ status: 'done' })
|
|
212
|
+
.where(eq(schema.tasks.id, taskId))
|
|
213
|
+
.returning()
|
|
214
|
+
|
|
215
|
+
await ctx.realtime.publish(schema.tasks, 'update', task)
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Do not publish from inside an enclosing transaction. The complete row lets the
|
|
219
|
+
existing access filter evaluate owner and read-scope columns.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Runtime integrations
|
|
2
|
+
|
|
3
|
+
A Workerstack 1.0 app runs on the Workers runtime: Cloudflare in production,
|
|
4
|
+
celld on a VPS, and workerd under `workerstack dev`. The app does not write
|
|
5
|
+
Worker code. `app.handler` is still the single Web Standard
|
|
6
|
+
`Request -> Response` integration point, and a package Worker entry mounts it.
|
|
7
|
+
|
|
8
|
+
## App layout
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
src/workerstack.ts backend: schema, auth, access, storage, jobs, cron
|
|
12
|
+
src/api.ts the typed client
|
|
13
|
+
src/routes/... TanStack Start routes, loaders, server functions
|
|
14
|
+
vite.config.ts plugins: [workerstack(), viteReact()]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
// vite.config.ts
|
|
19
|
+
import viteReact from '@vitejs/plugin-react'
|
|
20
|
+
import { workerstack } from 'workerstack/vite'
|
|
21
|
+
import { defineConfig } from 'vite'
|
|
22
|
+
|
|
23
|
+
export default defineConfig({ plugins: [workerstack(), viteReact()] })
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
// src/api.ts — not src/client.ts, which is a reserved Start entry point
|
|
28
|
+
import { workerstackStart } from 'workerstack/start'
|
|
29
|
+
|
|
30
|
+
import type { App } from './workerstack'
|
|
31
|
+
|
|
32
|
+
export const { createQueryClient, createApi } = workerstackStart<App>()
|
|
33
|
+
export const queryClient = createQueryClient()
|
|
34
|
+
export const api = createApi(queryClient)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Import `App` as a type so the browser does not load server runtime code. The
|
|
38
|
+
same `api` works everywhere: in the browser it calls `/api` over HTTP; in SSR,
|
|
39
|
+
loaders, and server functions it calls the backend in the same isolate and
|
|
40
|
+
forwards the request's cookie, so access rules apply the same way. Do not add a
|
|
41
|
+
`/api/$` route, a `src/worker.ts`, or Durable Object exports.
|
|
42
|
+
|
|
43
|
+
Add `@cloudflare/vite-plugin` and `wrangler` as dev dependencies. The dev and
|
|
44
|
+
build scripts are `workerstack dev` and `workerstack build`.
|
|
45
|
+
|
|
46
|
+
## Render modes
|
|
47
|
+
|
|
48
|
+
`workerstack.blueprint.yaml` records `application.worker.render`:
|
|
49
|
+
|
|
50
|
+
- `ssr` (the default for a TanStack Start app): pages render on the server in
|
|
51
|
+
the Worker; `main` is `workerstack/start/server-entry`.
|
|
52
|
+
- `spa` (the default without `@tanstack/react-start`): the Worker serves the
|
|
53
|
+
API and the static client with an SPA fallback; `main` is
|
|
54
|
+
`workerstack/workers/entry`.
|
|
55
|
+
|
|
56
|
+
Change the mode by editing `render` in the blueprint; `workerstack dev` keeps
|
|
57
|
+
the value. Both modes build to `dist/server/index.js` and `dist/client`.
|
|
58
|
+
|
|
59
|
+
A custom entry is an escape hatch for extra Durable Objects, queues, or
|
|
60
|
+
routing. Create `src/server.ts`; the generator then writes
|
|
61
|
+
`main: src/server.ts`:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { createStartWorker } from 'workerstack/start/worker'
|
|
65
|
+
|
|
66
|
+
import { backend } from './workerstack'
|
|
67
|
+
|
|
68
|
+
const worker = createStartWorker(backend)
|
|
69
|
+
export const { Scheduler, RealtimeHub, RateLimiter } = worker.durableObjects
|
|
70
|
+
export default worker.handler
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Runtime constraints
|
|
74
|
+
|
|
75
|
+
- Web APIs plus `nodejs_compat` only: no `Bun.*`, no local disk, no raw TCP
|
|
76
|
+
(SMTP, Postgres). Use HTTP providers for email; the database is libsql.
|
|
77
|
+
- Files live in a bucket (R2), not on disk.
|
|
78
|
+
- Long or retryable work goes to jobs (`jobs: (j) => j.define(...)`); cron
|
|
79
|
+
schedules come from `j.cron()`. The platform runs them in the Scheduler
|
|
80
|
+
Durable Object; there is no worker process and no `runWorker()`. Queue
|
|
81
|
+
handlers are at-least-once, so make them idempotent.
|
|
82
|
+
- Realtime fans out through the RealtimeHub Durable Object; no Redis.
|
|
83
|
+
|
|
84
|
+
## Realtime and synced collections
|
|
85
|
+
|
|
86
|
+
Clients consume the typed `realtime.changes` async iterator. Idle HTTP streams
|
|
87
|
+
receive a transport-only `heartbeat` every five seconds; the Workerstack query
|
|
88
|
+
client filters it before cache callbacks and does not advance the Publisher
|
|
89
|
+
resume ID. Do not add an application polling loop or publish heartbeat events
|
|
90
|
+
through oRPC Publisher.
|
|
91
|
+
|
|
92
|
+
`workerstack/sync` reconciles successful mutations from the canonical row
|
|
93
|
+
returned by generated CRUD, without a follow-up list refetch. Realtime echoes
|
|
94
|
+
are idempotent, and reconnect performs the full refetch used to repair drift.
|
|
95
|
+
Keep custom replacement procedures compatible by returning the complete row,
|
|
96
|
+
including `id`.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Verification contract
|
|
2
|
+
|
|
3
|
+
Run these gates from the application root after changing dependencies,
|
|
4
|
+
configuration, or application code:
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
bun install
|
|
8
|
+
bun test
|
|
9
|
+
bun run typecheck
|
|
10
|
+
bun run build
|
|
11
|
+
bun run blueprint
|
|
12
|
+
bun run blueprint:check
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`bun run blueprint` generates the committed `workerstack.blueprint.yaml` from
|
|
16
|
+
the configured Workerstack entry. Set `package.json#workerstack.entry` when the
|
|
17
|
+
entry is not `src/workerstack.ts`. `bun run blueprint:check` must pass in CI so
|
|
18
|
+
the committed declaration matches the application. Commit only the blueprint:
|
|
19
|
+
`wrangler.json` is generated from it and git-ignored. `workerstack dev`
|
|
20
|
+
regenerates both on startup and on each change, and `workerstack build` fails
|
|
21
|
+
on a stale blueprint, then builds `dist/server` and `dist/client`.
|
|
22
|
+
|
|
23
|
+
Before production, generate and commit the Drizzle `migrations/` folder.
|
|
24
|
+
`provision(app)` from `workerstack/provision` only applies committed
|
|
25
|
+
migrations and never imports drizzle-kit. For the local schema-push loop, import
|
|
26
|
+
`provision` from `workerstack/provision-schema`; that development-only
|
|
27
|
+
entrypoint requires drizzle-kit. Keep the generated migrations, blueprint,
|
|
28
|
+
tests, worker entry, API mount, and deployment scripts under version control;
|
|
29
|
+
never commit secrets, databases, uploads, or build output.
|