@async/db 0.2.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 +167 -0
- package/README.md +431 -0
- package/SPEC.md +1429 -0
- package/db.config.example.mjs +128 -0
- package/dist/cli/args.d.ts +8 -0
- package/dist/cli/args.js +16 -0
- package/dist/cli/commands/create.d.ts +3 -0
- package/dist/cli/commands/create.js +13 -0
- package/dist/cli/commands/doctor.d.ts +3 -0
- package/dist/cli/commands/doctor.js +31 -0
- package/dist/cli/commands/generate.d.ts +6 -0
- package/dist/cli/commands/generate.js +24 -0
- package/dist/cli/commands/operations.d.ts +12 -0
- package/dist/cli/commands/operations.js +61 -0
- package/dist/cli/commands/schema.d.ts +11 -0
- package/dist/cli/commands/schema.js +1086 -0
- package/dist/cli/commands/serve.d.ts +9 -0
- package/dist/cli/commands/serve.js +18 -0
- package/dist/cli/commands/sync.d.ts +3 -0
- package/dist/cli/commands/sync.js +11 -0
- package/dist/cli/commands/types.d.ts +7 -0
- package/dist/cli/commands/types.js +37 -0
- package/dist/cli/commands/viewer.d.ts +6 -0
- package/dist/cli/commands/viewer.js +29 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +108 -0
- package/dist/cli/output.d.ts +25 -0
- package/dist/cli/output.js +149 -0
- package/dist/cli/schema-prompt.d.ts +20 -0
- package/dist/cli/schema-prompt.js +66 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +3 -0
- package/dist/client-cache.d.ts +105 -0
- package/dist/client-cache.js +916 -0
- package/dist/client.d.ts +64 -0
- package/dist/client.js +405 -0
- package/dist/config-public.d.ts +1 -0
- package/dist/config-public.js +1 -0
- package/dist/config.d.ts +54 -0
- package/dist/config.js +2 -0
- package/dist/csv.d.ts +1 -0
- package/dist/csv.js +1 -0
- package/dist/db.d.ts +3 -0
- package/dist/db.js +3 -0
- package/dist/doctor.d.ts +1 -0
- package/dist/doctor.js +1 -0
- package/dist/errors.d.ts +1 -0
- package/dist/errors.js +1 -0
- package/dist/features/config/defaults.d.ts +98 -0
- package/dist/features/config/defaults.js +95 -0
- package/dist/features/config/load.d.ts +11 -0
- package/dist/features/config/load.js +265 -0
- package/dist/features/config/public.d.ts +17 -0
- package/dist/features/config/public.js +75 -0
- package/dist/features/doctor/duplicate-ids.d.ts +18 -0
- package/dist/features/doctor/duplicate-ids.js +79 -0
- package/dist/features/doctor/field-consistency.d.ts +17 -0
- package/dist/features/doctor/field-consistency.js +48 -0
- package/dist/features/doctor/index.d.ts +39 -0
- package/dist/features/doctor/index.js +177 -0
- package/dist/features/doctor/relations.d.ts +22 -0
- package/dist/features/doctor/relations.js +90 -0
- package/dist/features/doctor/schema-guidance.d.ts +35 -0
- package/dist/features/doctor/schema-guidance.js +184 -0
- package/dist/features/generate/registry.d.ts +14 -0
- package/dist/features/generate/registry.js +37 -0
- package/dist/features/http/registry.d.ts +46 -0
- package/dist/features/http/registry.js +86 -0
- package/dist/features/operations/index.d.ts +49 -0
- package/dist/features/operations/index.js +199 -0
- package/dist/features/operations/maps.d.ts +1 -0
- package/dist/features/operations/maps.js +10 -0
- package/dist/features/operations/readiness.d.ts +30 -0
- package/dist/features/operations/readiness.js +228 -0
- package/dist/features/operations/runtime.d.ts +57 -0
- package/dist/features/operations/runtime.js +288 -0
- package/dist/features/runtime/collection.d.ts +51 -0
- package/dist/features/runtime/collection.js +198 -0
- package/dist/features/runtime/db.d.ts +152 -0
- package/dist/features/runtime/db.js +824 -0
- package/dist/features/runtime/document.d.ts +43 -0
- package/dist/features/runtime/document.js +111 -0
- package/dist/features/runtime/fanout.d.ts +24 -0
- package/dist/features/runtime/fanout.js +77 -0
- package/dist/features/runtime/json-pointer.d.ts +5 -0
- package/dist/features/runtime/json-pointer.js +49 -0
- package/dist/features/runtime/scope-state.d.ts +44 -0
- package/dist/features/runtime/scope-state.js +185 -0
- package/dist/features/runtime/state.d.ts +1 -0
- package/dist/features/runtime/state.js +1 -0
- package/dist/features/schema/api.d.ts +107 -0
- package/dist/features/schema/api.js +460 -0
- package/dist/features/schema/builders.d.ts +86 -0
- package/dist/features/schema/builders.js +110 -0
- package/dist/features/schema/fields.d.ts +38 -0
- package/dist/features/schema/fields.js +296 -0
- package/dist/features/schema/generated.d.ts +29 -0
- package/dist/features/schema/generated.js +32 -0
- package/dist/features/schema/locator.d.ts +16 -0
- package/dist/features/schema/locator.js +135 -0
- package/dist/features/schema/manifest.d.ts +91 -0
- package/dist/features/schema/manifest.js +384 -0
- package/dist/features/schema/metadata.d.ts +30 -0
- package/dist/features/schema/metadata.js +75 -0
- package/dist/features/schema/project.d.ts +46 -0
- package/dist/features/schema/project.js +442 -0
- package/dist/features/schema/relations.d.ts +38 -0
- package/dist/features/schema/relations.js +109 -0
- package/dist/features/schema/resolvers.d.ts +36 -0
- package/dist/features/schema/resolvers.js +111 -0
- package/dist/features/schema/resource.d.ts +75 -0
- package/dist/features/schema/resource.js +253 -0
- package/dist/features/schema/source-definitions.d.ts +21 -0
- package/dist/features/schema/source-definitions.js +29 -0
- package/dist/features/schema/sources.d.ts +83 -0
- package/dist/features/schema/sources.js +689 -0
- package/dist/features/schema/standard-schema.d.ts +57 -0
- package/dist/features/schema/standard-schema.js +232 -0
- package/dist/features/schema/validation.d.ts +69 -0
- package/dist/features/schema/validation.js +434 -0
- package/dist/features/storage/events.d.ts +12 -0
- package/dist/features/storage/events.js +30 -0
- package/dist/features/storage/json.d.ts +112 -0
- package/dist/features/storage/json.js +239 -0
- package/dist/features/storage/memory.d.ts +30 -0
- package/dist/features/storage/memory.js +44 -0
- package/dist/features/storage/resource-json.d.ts +31 -0
- package/dist/features/storage/resource-json.js +76 -0
- package/dist/features/storage/runtime.d.ts +37 -0
- package/dist/features/storage/runtime.js +184 -0
- package/dist/features/storage/source-metadata.d.ts +20 -0
- package/dist/features/storage/source-metadata.js +25 -0
- package/dist/features/storage/source.d.ts +37 -0
- package/dist/features/storage/source.js +60 -0
- package/dist/features/storage/static.d.ts +29 -0
- package/dist/features/storage/static.js +42 -0
- package/dist/features/sync/defaults.d.ts +21 -0
- package/dist/features/sync/defaults.js +21 -0
- package/dist/features/sync/index.d.ts +35 -0
- package/dist/features/sync/index.js +85 -0
- package/dist/features/sync/mirror-state.d.ts +14 -0
- package/dist/features/sync/mirror-state.js +4 -0
- package/dist/features/sync/runtime-dirs.d.ts +5 -0
- package/dist/features/sync/runtime-dirs.js +9 -0
- package/dist/features/sync/source-writes.d.ts +15 -0
- package/dist/features/sync/source-writes.js +27 -0
- package/dist/features/sync/synthetic-seed.d.ts +26 -0
- package/dist/features/sync/synthetic-seed.js +83 -0
- package/dist/features/viewer/manifest.d.ts +148 -0
- package/dist/features/viewer/manifest.js +165 -0
- package/dist/fs-utils.d.ts +1 -0
- package/dist/fs-utils.js +1 -0
- package/dist/generate/hono/app.d.ts +6 -0
- package/dist/generate/hono/app.js +51 -0
- package/dist/generate/hono/graphql.d.ts +7 -0
- package/dist/generate/hono/graphql.js +53 -0
- package/dist/generate/hono/index.d.ts +55 -0
- package/dist/generate/hono/index.js +140 -0
- package/dist/generate/hono/package.d.ts +6 -0
- package/dist/generate/hono/package.js +44 -0
- package/dist/generate/hono/readme.d.ts +13 -0
- package/dist/generate/hono/readme.js +28 -0
- package/dist/generate/hono/repository.d.ts +1 -0
- package/dist/generate/hono/repository.js +27 -0
- package/dist/generate/hono/rest.d.ts +1 -0
- package/dist/generate/hono/rest.js +38 -0
- package/dist/generate/hono/schema.d.ts +13 -0
- package/dist/generate/hono/schema.js +18 -0
- package/dist/generate/hono/sqlite.d.ts +20 -0
- package/dist/generate/hono/sqlite.js +266 -0
- package/dist/generate/hono/validators.d.ts +1 -0
- package/dist/generate/hono/validators.js +141 -0
- package/dist/generate/hono.d.ts +1 -0
- package/dist/generate/hono.js +1 -0
- package/dist/graphql/execute.d.ts +14 -0
- package/dist/graphql/execute.js +719 -0
- package/dist/graphql/http.d.ts +15 -0
- package/dist/graphql/http.js +29 -0
- package/dist/graphql/index.d.ts +3 -0
- package/dist/graphql/index.js +3 -0
- package/dist/graphql/parser.d.ts +54 -0
- package/dist/graphql/parser.js +433 -0
- package/dist/hono.d.ts +77 -0
- package/dist/hono.js +1 -0
- package/dist/index.d.ts +1065 -0
- package/dist/index.js +14 -0
- package/dist/integrations/hono.d.ts +136 -0
- package/dist/integrations/hono.js +508 -0
- package/dist/integrations/kv.d.ts +69 -0
- package/dist/integrations/kv.js +69 -0
- package/dist/integrations/postgres.d.ts +52 -0
- package/dist/integrations/postgres.js +113 -0
- package/dist/integrations/sqlite.d.ts +112 -0
- package/dist/integrations/sqlite.js +489 -0
- package/dist/integrations/vite.d.ts +45 -0
- package/dist/integrations/vite.js +111 -0
- package/dist/json.d.ts +48 -0
- package/dist/json.js +1 -0
- package/dist/jsonc.d.ts +1 -0
- package/dist/jsonc.js +1 -0
- package/dist/kv.d.ts +24 -0
- package/dist/kv.js +1 -0
- package/dist/mock.d.ts +1 -0
- package/dist/mock.js +1 -0
- package/dist/names.d.ts +1 -0
- package/dist/names.js +1 -0
- package/dist/operations.d.ts +3 -0
- package/dist/operations.js +3 -0
- package/dist/postgres.d.ts +24 -0
- package/dist/postgres.js +1 -0
- package/dist/redis.d.ts +14 -0
- package/dist/redis.js +1 -0
- package/dist/rest/formats.d.ts +80 -0
- package/dist/rest/formats.js +318 -0
- package/dist/rest/handler.d.ts +111 -0
- package/dist/rest/handler.js +833 -0
- package/dist/rest/shape.d.ts +33 -0
- package/dist/rest/shape.js +218 -0
- package/dist/schema-builders.d.ts +1 -0
- package/dist/schema-builders.js +1 -0
- package/dist/schema-manifest.d.ts +1 -0
- package/dist/schema-manifest.js +1 -0
- package/dist/schema.d.ts +193 -0
- package/dist/schema.js +6 -0
- package/dist/server.d.ts +116 -0
- package/dist/server.js +601 -0
- package/dist/shared/csv.d.ts +8 -0
- package/dist/shared/csv.js +149 -0
- package/dist/shared/errors.d.ts +40 -0
- package/dist/shared/errors.js +55 -0
- package/dist/shared/fs-utils.d.ts +4 -0
- package/dist/shared/fs-utils.js +30 -0
- package/dist/shared/jsonc.d.ts +2 -0
- package/dist/shared/jsonc.js +99 -0
- package/dist/shared/mock.d.ts +40 -0
- package/dist/shared/mock.js +83 -0
- package/dist/shared/names.d.ts +28 -0
- package/dist/shared/names.js +127 -0
- package/dist/shared/operations.d.ts +32 -0
- package/dist/shared/operations.js +302 -0
- package/dist/sqlite.d.ts +24 -0
- package/dist/sqlite.js +1 -0
- package/dist/state.d.ts +1 -0
- package/dist/state.js +1 -0
- package/dist/sync.d.ts +1 -0
- package/dist/sync.js +1 -0
- package/dist/tracing.d.ts +95 -0
- package/dist/tracing.js +260 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.js +285 -0
- package/dist/viewer-manifest.d.ts +1 -0
- package/dist/viewer-manifest.js +1 -0
- package/dist/vite.d.ts +59 -0
- package/dist/vite.js +1 -0
- package/dist/web/json-viewer.d.ts +5 -0
- package/dist/web/json-viewer.js +176 -0
- package/dist/web/viewer.d.ts +12 -0
- package/dist/web/viewer.js +1015 -0
- package/docs/README.md +42 -0
- package/docs/architecture.md +112 -0
- package/docs/ci-and-release.md +177 -0
- package/docs/cms-storage-patterns.md +108 -0
- package/docs/concepts.md +141 -0
- package/docs/configuration.md +552 -0
- package/docs/fixtures-and-schemas.md +527 -0
- package/docs/fork-branch-workflows.md +108 -0
- package/docs/generated-files.md +174 -0
- package/docs/getting-started.md +165 -0
- package/docs/integrations.md +206 -0
- package/docs/json-production.md +120 -0
- package/docs/package-api.md +418 -0
- package/docs/prototype-to-production.md +378 -0
- package/docs/server-and-viewer.md +466 -0
- package/docs/store-graduation.md +120 -0
- package/docs/typescript-schema-sources.md +79 -0
- package/examples/advanced/README.md +55 -0
- package/examples/advanced/db/projects.schema.jsonc +44 -0
- package/examples/advanced/db/settings.jsonc +9 -0
- package/examples/advanced/db/users.json +23 -0
- package/examples/advanced/db/users.schema.mjs +31 -0
- package/examples/advanced/db.config.mjs +18 -0
- package/examples/advanced/example.json +5 -0
- package/examples/advanced/src/generated/db.types.d.ts +64 -0
- package/examples/basic/README.md +95 -0
- package/examples/basic/db/operations/get-user.jsonc +8 -0
- package/examples/basic/db/settings.json +7 -0
- package/examples/basic/db/users.schema.jsonc +36 -0
- package/examples/basic/db.config.mjs +68 -0
- package/examples/basic/example.json +5 -0
- package/examples/basic/src/generated/db.types.d.ts +39 -0
- package/examples/cms-json-publish/README.md +21 -0
- package/examples/cms-json-publish/db/navigation.json +7 -0
- package/examples/cms-json-publish/db/pages.json +18 -0
- package/examples/cms-json-publish/example.json +5 -0
- package/examples/cms-json-publish/src/cms.mjs +104 -0
- package/examples/computed-fields/README.md +93 -0
- package/examples/computed-fields/db/orders.schema.mjs +62 -0
- package/examples/computed-fields/db/posts.schema.mjs +59 -0
- package/examples/computed-fields/db/products.schema.mjs +39 -0
- package/examples/computed-fields/db/users.schema.mjs +43 -0
- package/examples/computed-fields/db.config.mjs +15 -0
- package/examples/computed-fields/example.json +5 -0
- package/examples/computed-fields/src/generated/db.types.d.ts +81 -0
- package/examples/content-collections/README.md +91 -0
- package/examples/content-collections/db/authors.json +12 -0
- package/examples/content-collections/db/authors.schema.mjs +20 -0
- package/examples/content-collections/db/blog/draft-roadmap.mdx +12 -0
- package/examples/content-collections/db/blog/index.schema.mjs +61 -0
- package/examples/content-collections/db/blog/launch-notes.mdx +15 -0
- package/examples/content-collections/db/docs/index.schema.mjs +32 -0
- package/examples/content-collections/db/docs/intro.mdx +11 -0
- package/examples/content-collections/db/docs/schema-workflow.mdx +10 -0
- package/examples/content-collections/db/site.schema.jsonc +21 -0
- package/examples/content-collections/db.config.mjs +26 -0
- package/examples/content-collections/example.json +5 -0
- package/examples/content-collections/src/content-preview.mjs +66 -0
- package/examples/content-collections/src/generated/db.types.d.ts +81 -0
- package/examples/csv/README.md +52 -0
- package/examples/csv/db/customers.csv +4 -0
- package/examples/csv/db.config.mjs +13 -0
- package/examples/csv/example.json +5 -0
- package/examples/data-first/README.md +54 -0
- package/examples/data-first/db/posts.json +16 -0
- package/examples/data-first/db/settings.json +8 -0
- package/examples/data-first/db/users.json +14 -0
- package/examples/data-first/db.config.mjs +13 -0
- package/examples/data-first/example.json +5 -0
- package/examples/diagnostics/README.md +55 -0
- package/examples/diagnostics/db/projects.schema.jsonc +27 -0
- package/examples/diagnostics/db/users.json +9 -0
- package/examples/diagnostics/db/users.schema.jsonc +23 -0
- package/examples/diagnostics/db.config.mjs +16 -0
- package/examples/diagnostics/example.json +5 -0
- package/examples/free-plan-upgrade/README.md +22 -0
- package/examples/free-plan-upgrade/db/appSettings.json +4 -0
- package/examples/free-plan-upgrade/db/projects.json +7 -0
- package/examples/free-plan-upgrade/example.json +5 -0
- package/examples/free-plan-upgrade/src/upgrade-tenant-to-paid.mjs +105 -0
- package/examples/hono-auth/README.md +74 -0
- package/examples/hono-auth/db/pages.schema.jsonc +44 -0
- package/examples/hono-auth/db/users.schema.jsonc +42 -0
- package/examples/hono-auth/db.config.mjs +17 -0
- package/examples/hono-auth/example.json +5 -0
- package/examples/hono-auth/package.json +14 -0
- package/examples/hono-auth/src/app.mjs +79 -0
- package/examples/hono-auth/src/server.mjs +13 -0
- package/examples/production-json/README.md +102 -0
- package/examples/production-json/db/appSettings.schema.jsonc +41 -0
- package/examples/production-json/db/featureFlags.schema.jsonc +84 -0
- package/examples/production-json/db/operations/get-control-plane.jsonc +6 -0
- package/examples/production-json/db/operations/get-feature-flag.jsonc +9 -0
- package/examples/production-json/db/operations/list-feature-flags.jsonc +8 -0
- package/examples/production-json/db/operations/read-public-settings.jsonc +8 -0
- package/examples/production-json/db.config.mjs +33 -0
- package/examples/production-json/example.json +5 -0
- package/examples/production-json/src/client-demo.mjs +28 -0
- package/examples/production-json/src/generated/db.types.d.ts +60 -0
- package/examples/relations/README.md +56 -0
- package/examples/relations/db/posts.schema.jsonc +46 -0
- package/examples/relations/db/users.schema.jsonc +34 -0
- package/examples/relations/db.config.mjs +13 -0
- package/examples/relations/example.json +5 -0
- package/examples/rest-client/README.md +54 -0
- package/examples/rest-client/db/settings.json +5 -0
- package/examples/rest-client/db/users.schema.jsonc +42 -0
- package/examples/rest-client/db.config.mjs +13 -0
- package/examples/rest-client/example.json +5 -0
- package/examples/rest-client/src/client-demo.mjs +24 -0
- package/examples/schema-first/README.md +55 -0
- package/examples/schema-first/db/auditEvents.schema.jsonc +24 -0
- package/examples/schema-first/db/settings.schema.jsonc +29 -0
- package/examples/schema-first/db/users.schema.jsonc +36 -0
- package/examples/schema-first/db.config.mjs +15 -0
- package/examples/schema-first/example.json +5 -0
- package/examples/schema-first/src/generated/db.types.d.ts +47 -0
- package/examples/schema-manifest/README.md +50 -0
- package/examples/schema-manifest/db/projects.schema.jsonc +48 -0
- package/examples/schema-manifest/db/users.schema.jsonc +35 -0
- package/examples/schema-manifest/db.config.mjs +41 -0
- package/examples/schema-manifest/example.json +5 -0
- package/examples/schema-manifest/src/generated/db.schema.json +130 -0
- package/examples/schema-manifest/src/generated/db.types.d.ts +50 -0
- package/examples/schema-ui/README.md +103 -0
- package/examples/schema-ui/db/pages.schema.jsonc +53 -0
- package/examples/schema-ui/db/users.schema.jsonc +30 -0
- package/examples/schema-ui/db.config.mjs +55 -0
- package/examples/schema-ui/example.json +5 -0
- package/examples/schema-ui/src/cms-ssr.mjs +276 -0
- package/examples/schema-ui/src/generated/db.schema.json +133 -0
- package/examples/schema-ui/src/generated/db.types.d.ts +46 -0
- package/examples/schema-ui/src/render-admin.mjs +175 -0
- package/examples/schema-ui/src/schema-ui-ssr-handler.mjs +149 -0
- package/examples/schema-ui/src/start-schema-ui-server.mjs +140 -0
- package/examples/standard-schema/README.md +55 -0
- package/examples/standard-schema/db/settings.schema.mjs +22 -0
- package/examples/standard-schema/db/users.schema.mjs +72 -0
- package/examples/standard-schema/example.json +5 -0
- package/package.json +108 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { defineConfig } from '@async/db/config';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
dbDir: './db',
|
|
6
|
+
outputs: {
|
|
7
|
+
stateDir: './.db',
|
|
8
|
+
types: './.db/types/index.d.ts',
|
|
9
|
+
committedTypes: './src/generated/db.types.d.ts',
|
|
10
|
+
operationRefs: './src/generated/db.operation-refs.json',
|
|
11
|
+
},
|
|
12
|
+
types: {
|
|
13
|
+
enabled: true,
|
|
14
|
+
emitComments: true,
|
|
15
|
+
},
|
|
16
|
+
schema: {
|
|
17
|
+
unknownFields: 'error',
|
|
18
|
+
},
|
|
19
|
+
operations: {
|
|
20
|
+
enabled: true,
|
|
21
|
+
acceptRefs: 'ref',
|
|
22
|
+
sourceDir: './db/operations',
|
|
23
|
+
},
|
|
24
|
+
server: {
|
|
25
|
+
expose: {
|
|
26
|
+
rest: 'registered-only',
|
|
27
|
+
graphql: false,
|
|
28
|
+
viewer: 'dev',
|
|
29
|
+
schema: 'dev',
|
|
30
|
+
manifest: 'dev',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import { createDbClient } from '@async/db/client';
|
|
3
|
+
|
|
4
|
+
const baseUrl = process.env.ASYNC_DB_URL ?? 'http://127.0.0.1:7331';
|
|
5
|
+
const refsUrl = new URL('./generated/db.operation-refs.json', import.meta.url);
|
|
6
|
+
const operationRefs = await readOperationRefs(refsUrl);
|
|
7
|
+
const client = createDbClient({ baseUrl });
|
|
8
|
+
|
|
9
|
+
const controlPlane = await client.query(operationRefs.operations.GetControlPlane.ref);
|
|
10
|
+
const billingFlag = await client.query(operationRefs.operations.GetFeatureFlag.ref, {
|
|
11
|
+
id: 'flag_billing_v2',
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
console.log(JSON.stringify({
|
|
15
|
+
controlPlane,
|
|
16
|
+
billingFlag,
|
|
17
|
+
}, null, 2));
|
|
18
|
+
|
|
19
|
+
async function readOperationRefs(url) {
|
|
20
|
+
try {
|
|
21
|
+
return JSON.parse(await readFile(url, 'utf8'));
|
|
22
|
+
} catch (error) {
|
|
23
|
+
if (error.code === 'ENOENT') {
|
|
24
|
+
throw new Error('Run `npm run db -- operations build --cwd ./examples/production-json` before running this demo.');
|
|
25
|
+
}
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// This file is generated by db. Do not edit by hand.
|
|
3
|
+
|
|
4
|
+
export type AppSettingsEnvironment = "development" | "staging" | "production";
|
|
5
|
+
|
|
6
|
+
export type FeatureFlagAudience =
|
|
7
|
+
| "everyone"
|
|
8
|
+
| "staff"
|
|
9
|
+
| "beta"
|
|
10
|
+
| "enterprise";
|
|
11
|
+
|
|
12
|
+
/** Small production settings that are safe to keep as reviewed JSON. */
|
|
13
|
+
export type AppSettings = {
|
|
14
|
+
/** Public product name shown by the app shell. */
|
|
15
|
+
appName: string;
|
|
16
|
+
/** Deployment lane this settings file belongs to. */
|
|
17
|
+
environment: AppSettingsEnvironment;
|
|
18
|
+
/** Whether the public app should show maintenance UI. */
|
|
19
|
+
maintenanceMode: boolean;
|
|
20
|
+
/** Fallback locale for unauthenticated visitors. */
|
|
21
|
+
defaultLocale: string;
|
|
22
|
+
/** Public support contact shown in product chrome. */
|
|
23
|
+
supportEmail: string;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/** Low-write production feature flags that control app behavior. */
|
|
27
|
+
export type FeatureFlag = {
|
|
28
|
+
/** Stable flag id used by operations and review notes. */
|
|
29
|
+
id: string;
|
|
30
|
+
/** Stable application flag key. */
|
|
31
|
+
key: string;
|
|
32
|
+
/** Global default before app-owned targeting runs. */
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
/** Coarse audience label consumed by the app policy layer. */
|
|
35
|
+
audience: FeatureFlagAudience;
|
|
36
|
+
/** Default rollout percentage for app-owned evaluation. */
|
|
37
|
+
rolloutPercent: number;
|
|
38
|
+
/** Human review note explaining the flag. */
|
|
39
|
+
description: string;
|
|
40
|
+
/** Team or person responsible for changing this flag. */
|
|
41
|
+
owner: string;
|
|
42
|
+
/** ISO timestamp for the last reviewed flag change. */
|
|
43
|
+
updatedAt: string;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type DbCollections = {
|
|
47
|
+
featureFlags: FeatureFlag;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export type DbDocuments = {
|
|
51
|
+
appSettings: AppSettings;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type DbTypes = {
|
|
55
|
+
collections: DbCollections;
|
|
56
|
+
documents: DbDocuments;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export type DbCollectionName = keyof DbCollections;
|
|
60
|
+
export type DbDocumentName = keyof DbDocuments;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# Relations Example
|
|
2
|
+
|
|
3
|
+
## What This Teaches
|
|
4
|
+
|
|
5
|
+
Use this when local fixtures need related records but you still want plain ids in JSON. It demonstrates to-one relation metadata, explicit REST `expand`, and nested `select`.
|
|
6
|
+
|
|
7
|
+
## Files To Inspect
|
|
8
|
+
|
|
9
|
+
- [db/users.schema.jsonc](./db/users.schema.jsonc): target collection.
|
|
10
|
+
- [db/posts.schema.jsonc](./db/posts.schema.jsonc): `authorId` declares a relation to `users.id`.
|
|
11
|
+
- [db.config.mjs](./db.config.mjs): default mirror setup using `defineConfig`.
|
|
12
|
+
|
|
13
|
+
## Run It
|
|
14
|
+
|
|
15
|
+
From the repository root, use the repo-internal CLI path:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run db -- sync --cwd ./examples/relations
|
|
19
|
+
npm run db -- serve --cwd ./examples/relations
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Open the viewer:
|
|
23
|
+
|
|
24
|
+
```txt
|
|
25
|
+
http://127.0.0.1:7331/__db
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Expected Result
|
|
29
|
+
|
|
30
|
+
The viewer lists `posts` and `users`. The posts schema shows an `author` relation derived from `authorId`.
|
|
31
|
+
|
|
32
|
+
## REST Request To Try
|
|
33
|
+
|
|
34
|
+
Leave `serve` running and run this from another terminal:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
curl 'http://127.0.0.1:7331/db/posts.json?expand=author&select=id,title,author.name'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Relation expansion is intentionally explicit and depth 1 in this version.
|
|
41
|
+
|
|
42
|
+
## Features To Notice
|
|
43
|
+
|
|
44
|
+
- [Relationship expansion](../../docs/server-and-viewer.md#relationship-expansion)
|
|
45
|
+
- [Nested `select` fields](../../docs/server-and-viewer.md#rest-routes)
|
|
46
|
+
- [Schema relation metadata](../../docs/fixtures-and-schemas.md#schema-files)
|
|
47
|
+
- [Fixture-like `.json` REST routes](../../docs/server-and-viewer.md#fixture-like-json-routes)
|
|
48
|
+
|
|
49
|
+
## Cleanup
|
|
50
|
+
|
|
51
|
+
Generated `.db/` output is ignored by git and can be removed whenever you want a fresh mirror.
|
|
52
|
+
|
|
53
|
+
## More Docs
|
|
54
|
+
|
|
55
|
+
- [Fixtures And Schemas](../../docs/fixtures-and-schemas.md)
|
|
56
|
+
- [Server And Viewer](../../docs/server-and-viewer.md)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"kind": "collection",
|
|
3
|
+
"idField": "id",
|
|
4
|
+
"fields": {
|
|
5
|
+
"id": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"required": true,
|
|
8
|
+
"description": "Stable post id."
|
|
9
|
+
},
|
|
10
|
+
"title": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"required": true,
|
|
13
|
+
"description": "Post title shown in lists."
|
|
14
|
+
},
|
|
15
|
+
"authorId": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"required": true,
|
|
18
|
+
"description": "User id for the author.",
|
|
19
|
+
"relation": {
|
|
20
|
+
"name": "author",
|
|
21
|
+
"to": "users",
|
|
22
|
+
"toField": "id",
|
|
23
|
+
"cardinality": "one"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"status": {
|
|
27
|
+
"type": "enum",
|
|
28
|
+
"values": ["draft", "published"],
|
|
29
|
+
"default": "draft"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"seed": [
|
|
33
|
+
{
|
|
34
|
+
"id": "p_1",
|
|
35
|
+
"title": "Analytical engines for local demos",
|
|
36
|
+
"authorId": "u_1",
|
|
37
|
+
"status": "published"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "p_2",
|
|
41
|
+
"title": "Orbital mechanics as fixture data",
|
|
42
|
+
"authorId": "u_2",
|
|
43
|
+
"status": "draft"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"kind": "collection",
|
|
3
|
+
"idField": "id",
|
|
4
|
+
"fields": {
|
|
5
|
+
"id": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"required": true,
|
|
8
|
+
"description": "Stable user id."
|
|
9
|
+
},
|
|
10
|
+
"name": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"required": true,
|
|
13
|
+
"description": "Display name shown beside authored content."
|
|
14
|
+
},
|
|
15
|
+
"email": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"required": true,
|
|
18
|
+
"unique": true,
|
|
19
|
+
"description": "Author email address."
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"seed": [
|
|
23
|
+
{
|
|
24
|
+
"id": "u_1",
|
|
25
|
+
"name": "Ada Lovelace",
|
|
26
|
+
"email": "ada@example.com"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "u_2",
|
|
30
|
+
"name": "Katherine Johnson",
|
|
31
|
+
"email": "katherine@example.com"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# REST Client Example
|
|
2
|
+
|
|
3
|
+
## What This Teaches
|
|
4
|
+
|
|
5
|
+
Use this when you want to call db from app or test code instead of typing `curl` commands. It demonstrates `createDbClient()`, direct REST calls, and a REST batch request.
|
|
6
|
+
|
|
7
|
+
## Files To Inspect
|
|
8
|
+
|
|
9
|
+
- [db/users.schema.jsonc](./db/users.schema.jsonc): schema-backed collection with defaults and unique email validation.
|
|
10
|
+
- [db/settings.json](./db/settings.json): singleton document inferred from data.
|
|
11
|
+
- [src/client-demo.mjs](./src/client-demo.mjs): tiny consumer script using `@async/db/client`.
|
|
12
|
+
|
|
13
|
+
## Run It
|
|
14
|
+
|
|
15
|
+
From the repository root, use the repo-internal CLI path:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run db -- sync --cwd ./examples/rest-client
|
|
19
|
+
npm run db -- serve --cwd ./examples/rest-client
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
In another terminal:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
ASYNC_DB_URL=http://127.0.0.1:7331 node ./examples/rest-client/src/client-demo.mjs
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Expected Result
|
|
29
|
+
|
|
30
|
+
`sync` writes generated schema, types, and runtime state under `examples/rest-client/.db/`. The demo script prints users from `/db/users.json`, settings from `/db/settings.json`, and a two-item batch result.
|
|
31
|
+
|
|
32
|
+
## REST Request To Try
|
|
33
|
+
|
|
34
|
+
Leave `serve` running and run this from another terminal:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
curl 'http://127.0.0.1:7331/db/users.json?select=id,name,email'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Features To Notice
|
|
41
|
+
|
|
42
|
+
- [HTTP client operations](../../docs/package-api.md#http-client)
|
|
43
|
+
- [Fixture-like `.json` REST routes](../../docs/server-and-viewer.md#fixture-like-json-routes)
|
|
44
|
+
- [REST batching](../../docs/server-and-viewer.md#rest-batching)
|
|
45
|
+
- [Schema-backed fixtures](../../docs/fixtures-and-schemas.md#schema-files)
|
|
46
|
+
|
|
47
|
+
## Cleanup
|
|
48
|
+
|
|
49
|
+
Generated `.db/` output is ignored by git and can be removed whenever you want a fresh mirror.
|
|
50
|
+
|
|
51
|
+
## More Docs
|
|
52
|
+
|
|
53
|
+
- [Package API](../../docs/package-api.md)
|
|
54
|
+
- [Server And Viewer](../../docs/server-and-viewer.md)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"kind": "collection",
|
|
3
|
+
"idField": "id",
|
|
4
|
+
"fields": {
|
|
5
|
+
"id": {
|
|
6
|
+
"type": "string",
|
|
7
|
+
"required": true,
|
|
8
|
+
"description": "Stable user id."
|
|
9
|
+
},
|
|
10
|
+
"name": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"required": true,
|
|
13
|
+
"description": "Display name shown in the app."
|
|
14
|
+
},
|
|
15
|
+
"email": {
|
|
16
|
+
"type": "string",
|
|
17
|
+
"required": true,
|
|
18
|
+
"unique": true,
|
|
19
|
+
"description": "Email address used for local sign-in."
|
|
20
|
+
},
|
|
21
|
+
"role": {
|
|
22
|
+
"type": "enum",
|
|
23
|
+
"values": ["admin", "user"],
|
|
24
|
+
"default": "user",
|
|
25
|
+
"description": "Local authorization role."
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"seed": [
|
|
29
|
+
{
|
|
30
|
+
"id": "u_1",
|
|
31
|
+
"name": "Ada Lovelace",
|
|
32
|
+
"email": "ada@example.com",
|
|
33
|
+
"role": "admin"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"id": "u_2",
|
|
37
|
+
"name": "Grace Hopper",
|
|
38
|
+
"email": "grace@example.com",
|
|
39
|
+
"role": "user"
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createDbClient } from '@async/db/client';
|
|
2
|
+
|
|
3
|
+
const baseUrl = process.env.ASYNC_DB_URL ?? 'http://127.0.0.1:7331';
|
|
4
|
+
const db = createDbClient({
|
|
5
|
+
baseUrl,
|
|
6
|
+
batching: true,
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
const users = await db.rest.get('/db/users.json', { batch: false });
|
|
10
|
+
const settings = await db.rest.get('/db/settings.json', { batch: false });
|
|
11
|
+
const batch = await db.rest.batch([
|
|
12
|
+
{ method: 'GET', path: '/db/users.json?select=id,name' },
|
|
13
|
+
{ method: 'GET', path: '/db/settings.json' },
|
|
14
|
+
]);
|
|
15
|
+
|
|
16
|
+
console.log(JSON.stringify({
|
|
17
|
+
baseUrl,
|
|
18
|
+
users: users.body,
|
|
19
|
+
settings: settings.body,
|
|
20
|
+
batch: batch.map((item) => ({
|
|
21
|
+
status: item.status,
|
|
22
|
+
body: item.body,
|
|
23
|
+
})),
|
|
24
|
+
}, null, 2));
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Schema-First Example
|
|
2
|
+
|
|
3
|
+
## What This Teaches
|
|
4
|
+
|
|
5
|
+
Use this when you know the local contract before you have real records. It defines resources with `.schema.jsonc`, including a type-only collection with no seed records.
|
|
6
|
+
|
|
7
|
+
## Files To Inspect
|
|
8
|
+
|
|
9
|
+
- [db/users.schema.jsonc](./db/users.schema.jsonc): collection with seed data.
|
|
10
|
+
- [db/settings.schema.jsonc](./db/settings.schema.jsonc): singleton document schema.
|
|
11
|
+
- [db/auditEvents.schema.jsonc](./db/auditEvents.schema.jsonc): schema-only collection with an empty runtime state.
|
|
12
|
+
- [src/generated/db.types.d.ts](./src/generated/db.types.d.ts): committed generated types.
|
|
13
|
+
|
|
14
|
+
## Run It
|
|
15
|
+
|
|
16
|
+
From the repository root, use the repo-internal CLI path:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm run db -- sync --cwd ./examples/schema-first
|
|
20
|
+
npm run db -- serve --cwd ./examples/schema-first
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Open the viewer:
|
|
24
|
+
|
|
25
|
+
```txt
|
|
26
|
+
http://127.0.0.1:7331/__db
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Expected Result
|
|
30
|
+
|
|
31
|
+
`sync` initializes empty runtime state for schema-only resources and writes committed generated types.
|
|
32
|
+
|
|
33
|
+
## REST Request To Try
|
|
34
|
+
|
|
35
|
+
Leave `serve` running and run this from another terminal:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
curl http://127.0.0.1:7331/db/audit-events.json
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Features To Notice
|
|
42
|
+
|
|
43
|
+
- [Schema-first resources](../../docs/concepts.md#schema-first)
|
|
44
|
+
- [Schema files](../../docs/fixtures-and-schemas.md#schema-files)
|
|
45
|
+
- [Generated types](../../docs/generated-files.md#generated-types)
|
|
46
|
+
- [Fixture-like `.json` REST routes](../../docs/server-and-viewer.md#fixture-like-json-routes)
|
|
47
|
+
|
|
48
|
+
## Cleanup
|
|
49
|
+
|
|
50
|
+
Generated `.db/` output is ignored by git and can be removed whenever you want a fresh mirror.
|
|
51
|
+
|
|
52
|
+
## More Docs
|
|
53
|
+
|
|
54
|
+
- [Concepts](../../docs/concepts.md)
|
|
55
|
+
- [Fixtures And Schemas](../../docs/fixtures-and-schemas.md)
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Audit events generated during local development.
|
|
3
|
+
"kind": "collection",
|
|
4
|
+
"idField": "id",
|
|
5
|
+
"fields": {
|
|
6
|
+
"id": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"required": true
|
|
9
|
+
},
|
|
10
|
+
"type": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"required": true
|
|
13
|
+
},
|
|
14
|
+
"createdAt": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"required": true
|
|
17
|
+
},
|
|
18
|
+
"payload": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"default": {}
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"seed": []
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"kind": "document",
|
|
3
|
+
"fields": {
|
|
4
|
+
"theme": {
|
|
5
|
+
"type": "string",
|
|
6
|
+
"default": "light"
|
|
7
|
+
},
|
|
8
|
+
"locale": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"default": "en-US"
|
|
11
|
+
},
|
|
12
|
+
"features": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"fields": {
|
|
15
|
+
"billing": {
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"default": false
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"seed": {
|
|
23
|
+
"theme": "light",
|
|
24
|
+
"locale": "en-US",
|
|
25
|
+
"features": {
|
|
26
|
+
"billing": false
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Users who can sign into the local test app.
|
|
3
|
+
"kind": "collection",
|
|
4
|
+
"idField": "id",
|
|
5
|
+
"fields": {
|
|
6
|
+
"id": {
|
|
7
|
+
"type": "string",
|
|
8
|
+
"required": true,
|
|
9
|
+
"description": "Stable user id."
|
|
10
|
+
},
|
|
11
|
+
"name": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"required": true,
|
|
14
|
+
"description": "Display name shown in the UI."
|
|
15
|
+
},
|
|
16
|
+
"email": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"required": true,
|
|
19
|
+
"description": "Unique email address."
|
|
20
|
+
},
|
|
21
|
+
"role": {
|
|
22
|
+
"type": "enum",
|
|
23
|
+
"values": ["admin", "user"],
|
|
24
|
+
"default": "user",
|
|
25
|
+
"description": "Local authorization role."
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"seed": [
|
|
29
|
+
{
|
|
30
|
+
"id": "u_1",
|
|
31
|
+
"name": "Ada Lovelace",
|
|
32
|
+
"email": "ada@example.com",
|
|
33
|
+
"role": "admin"
|
|
34
|
+
}
|
|
35
|
+
]
|
|
36
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// @ts-check
|
|
2
|
+
import { defineConfig } from '@async/db/config';
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
dbDir: './db',
|
|
6
|
+
outputs: {
|
|
7
|
+
stateDir: './.db',
|
|
8
|
+
types: './.db/types/index.d.ts',
|
|
9
|
+
committedTypes: './src/generated/db.types.d.ts',
|
|
10
|
+
},
|
|
11
|
+
types: {
|
|
12
|
+
enabled: true,
|
|
13
|
+
emitComments: true,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
// This file is generated by db. Do not edit by hand.
|
|
3
|
+
|
|
4
|
+
export type UserRole = "admin" | "user";
|
|
5
|
+
|
|
6
|
+
export type AuditEvent = {
|
|
7
|
+
id: string;
|
|
8
|
+
type: string;
|
|
9
|
+
createdAt: string;
|
|
10
|
+
payload?: Record<string, unknown>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type Settings = {
|
|
14
|
+
theme?: string;
|
|
15
|
+
locale?: string;
|
|
16
|
+
features?: {
|
|
17
|
+
billing?: boolean;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type User = {
|
|
22
|
+
/** Stable user id. */
|
|
23
|
+
id: string;
|
|
24
|
+
/** Display name shown in the UI. */
|
|
25
|
+
name: string;
|
|
26
|
+
/** Unique email address. */
|
|
27
|
+
email: string;
|
|
28
|
+
/** Local authorization role. */
|
|
29
|
+
role?: UserRole;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type DbCollections = {
|
|
33
|
+
auditEvents: AuditEvent;
|
|
34
|
+
users: User;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type DbDocuments = {
|
|
38
|
+
settings: Settings;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export type DbTypes = {
|
|
42
|
+
collections: DbCollections;
|
|
43
|
+
documents: DbDocuments;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export type DbCollectionName = keyof DbCollections;
|
|
47
|
+
export type DbDocumentName = keyof DbDocuments;
|