@cosmicdrift/kumiko-framework 1.0.0 → 2.0.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/README.md +9 -38
- package/package.json +21 -2
- package/src/__tests__/anonymous-access.integration.test.ts +185 -0
- package/src/__tests__/consumer-cli.integration.test.ts +172 -0
- package/src/__tests__/entity-permalink-open.integration.test.ts +94 -0
- package/src/__tests__/full-stack.integration.test.ts +1 -1
- package/src/__tests__/schema-cli-temporal-polyfill.test.ts +48 -0
- package/src/__tests__/schema-cli.integration.test.ts +50 -0
- package/src/__tests__/store-table.integration.test.ts +93 -0
- package/src/api/__tests__/api.test.ts +373 -0
- package/src/api/__tests__/auth-middleware-anonymous-access-boot.test.ts +40 -0
- package/src/api/__tests__/auth-routes-cookie.test.ts +17 -1
- package/src/api/__tests__/auth-routes-invalid-body-invite.test.ts +253 -0
- package/src/api/__tests__/auth-routes-mfa-preauth-confirm.test.ts +222 -0
- package/src/api/__tests__/auth-routes-mfa-preauth-enable-start.test.ts +249 -0
- package/src/api/__tests__/auth-routes-mfa-verify.test.ts +202 -0
- package/src/api/__tests__/auth-routes-trusted-proxy.test.ts +135 -0
- package/src/api/__tests__/batch.integration.test.ts +101 -11
- package/src/api/__tests__/csrf-constants-sync.test.ts +20 -0
- package/src/api/__tests__/dispatcher-live.integration.test.ts +74 -0
- package/src/api/__tests__/jwt.test.ts +200 -1
- package/src/api/__tests__/login-rate-limiter-sweep.test.ts +50 -0
- package/src/api/__tests__/pat-scope.test.ts +36 -0
- package/src/api/__tests__/pii-leak-guard.integration.test.ts +103 -0
- package/src/api/__tests__/redis-login-rate-limiter.integration.test.ts +138 -0
- package/src/api/__tests__/request-id-middleware.test.ts +51 -0
- package/src/api/__tests__/server-boot-guards.test.ts +71 -0
- package/src/api/__tests__/server-jwt-ttl.test.ts +58 -0
- package/src/api/__tests__/sse-broker.test.ts +57 -0
- package/src/api/__tests__/sse-route.test.ts +4 -0
- package/src/api/api-constants.ts +11 -0
- package/src/api/auth-middleware.ts +248 -40
- package/src/api/auth-routes.ts +576 -95
- package/src/api/index.ts +13 -4
- package/src/api/jwt.ts +170 -11
- package/src/api/pat-scope.ts +14 -0
- package/src/api/pii-leak-guard.ts +47 -0
- package/src/api/request-context.ts +3 -0
- package/src/api/request-id-middleware.ts +2 -0
- package/src/api/routes.ts +169 -2
- package/src/api/server.ts +112 -16
- package/src/api/sse-broker.ts +39 -0
- package/src/bun-db/__tests__/PATTERN.md +0 -1
- package/src/bun-db/__tests__/coerce-row-temporal.test.ts +41 -0
- package/src/bun-db/__tests__/select-many-retry.test.ts +79 -0
- package/src/bun-db/__tests__/write-brand.test.ts +21 -0
- package/src/bun-db/connection.ts +3 -3
- package/src/bun-db/index.ts +2 -0
- package/src/bun-db/query.ts +105 -32
- package/src/consumer-cli.ts +134 -0
- package/src/crypto/__tests__/blind-index.test.ts +130 -0
- package/src/crypto/__tests__/event-pii.test.ts +161 -0
- package/src/crypto/__tests__/kek-rotation.integration.test.ts +180 -0
- package/src/crypto/__tests__/kms-adapter-contract.ts +134 -0
- package/src/crypto/__tests__/kms-adapter.contract.test.ts +4 -0
- package/src/crypto/__tests__/pg-kms-adapter.integration.test.ts +117 -0
- package/src/crypto/__tests__/pii-field-encryption.test.ts +376 -0
- package/src/crypto/__tests__/request-kms-cache.test.ts +74 -0
- package/src/crypto/__tests__/subject-resolver.test.ts +108 -0
- package/src/crypto/blind-index.ts +118 -0
- package/src/crypto/event-pii.ts +70 -0
- package/src/crypto/in-memory-kms-adapter.ts +50 -0
- package/src/crypto/index.ts +67 -0
- package/src/crypto/kms-adapter.ts +2 -0
- package/src/crypto/pg-kms-adapter.ts +295 -0
- package/src/crypto/pii-field-encryption.ts +248 -0
- package/src/crypto/request-kms-cache.ts +38 -0
- package/src/crypto/subject-resolver.ts +91 -0
- package/src/db/__tests__/assert-no-unreachable-live-rows.integration.test.ts +191 -0
- package/src/db/__tests__/blind-index.integration.test.ts +248 -0
- package/src/db/__tests__/build-filter-where.test.ts +34 -0
- package/src/db/__tests__/collect-table-metas.test.ts +10 -10
- package/src/db/__tests__/config-seed.integration.test.ts +13 -5
- package/src/db/__tests__/dialect-instant.test.ts +1 -4
- package/src/db/__tests__/entity-field-encryption.test.ts +7 -7
- package/src/db/__tests__/entity-table-meta-source.test.ts +50 -0
- package/src/db/__tests__/event-store-executor-context.pii-roundtrip.test.ts +67 -0
- package/src/db/__tests__/event-store-executor-write-verbs.integration.test.ts +402 -0
- package/src/db/__tests__/event-store-executor.integration.test.ts +299 -29
- package/src/db/__tests__/feature-table-sources.test.ts +34 -0
- package/src/db/__tests__/implicit-projection-equivalence.integration.test.ts +118 -39
- package/src/db/__tests__/instant-to-driver-temporal.test.ts +21 -0
- package/src/db/__tests__/located-timestamp.test.ts +19 -0
- package/src/db/__tests__/migrate-generator.test.ts +21 -0
- package/src/db/__tests__/migrate-runner.test.ts +61 -0
- package/src/db/__tests__/number-field-fractional.integration.test.ts +58 -0
- package/src/db/__tests__/rebuild-marker.test.ts +13 -3
- package/src/db/__tests__/replay-migration-sql.test.ts +384 -0
- package/src/db/__tests__/schema-inspection.test.ts +7 -0
- package/src/db/__tests__/schema-migration.integration.test.ts +1 -1
- package/src/db/__tests__/table-builder-meta-lockstep.test.ts +39 -0
- package/src/db/__tests__/tenant-db-where-merge.test.ts +49 -3
- package/src/db/__tests__/tenant-db.integration.test.ts +6 -2
- package/src/db/api.ts +2 -2
- package/src/db/apply-entity-event.ts +18 -14
- package/src/db/blind-index-cleanup.ts +55 -0
- package/src/db/bun-provider.ts +2 -2
- package/src/db/collect-table-metas.ts +6 -7
- package/src/db/config-seed.ts +9 -9
- package/src/db/connection.ts +7 -12
- package/src/db/cursor.ts +1 -18
- package/src/db/dialect.ts +20 -26
- package/src/db/entity-field-encryption.ts +81 -24
- package/src/db/entity-table-meta-types.ts +2 -0
- package/src/db/entity-table-meta.ts +63 -90
- package/src/db/event-store-executor-context.ts +404 -0
- package/src/db/event-store-executor-read.ts +275 -0
- package/src/db/event-store-executor-write.ts +644 -0
- package/src/db/event-store-executor.ts +28 -1155
- package/src/db/feature-table-sources.ts +6 -5
- package/src/db/index.ts +20 -3
- package/src/db/located-timestamp.ts +4 -0
- package/src/db/migrate-generator.ts +39 -6
- package/src/db/migrate-runner.ts +107 -11
- package/src/db/pg-error.ts +9 -1
- package/src/db/postgres-provider.ts +2 -2
- package/src/db/queries/__tests__/event-store-idempotency-index.integration.test.ts +80 -0
- package/src/db/queries/backfill-pii.ts +277 -0
- package/src/db/queries/ddl.ts +45 -0
- package/src/db/queries/event-consumer.ts +35 -2
- package/src/db/queries/event-store.ts +126 -19
- package/src/db/queries/projection-rebuild.ts +22 -8
- package/src/db/queries/shadow-swap.ts +183 -0
- package/src/db/queries/test-stack.ts +4 -30
- package/src/db/query-api.ts +1 -0
- package/src/db/query.ts +1 -0
- package/src/db/rebuild-marker.ts +18 -2
- package/src/db/reference-data.ts +2 -3
- package/src/db/replay-migration-sql.ts +257 -0
- package/src/db/schema-inspection.ts +1 -1
- package/src/db/table-builder.ts +102 -71
- package/src/db/tenant-db.ts +15 -53
- package/src/engine/__tests__/boot-validator-action-wiring.test.ts +242 -0
- package/src/engine/__tests__/boot-validator-boot-check.test.ts +99 -0
- package/src/engine/__tests__/boot-validator-dashboard.test.ts +237 -0
- package/src/engine/__tests__/boot-validator-entity-list.test.ts +104 -0
- package/src/engine/__tests__/boot-validator-gdpr-storage.test.ts +7 -69
- package/src/engine/__tests__/boot-validator-i18n-keys.test.ts +26 -5
- package/src/engine/__tests__/boot-validator-located-timestamps.test.ts +3 -19
- package/src/engine/__tests__/boot-validator-pii-retention.test.ts +246 -4
- package/src/engine/__tests__/boot-validator.test.ts +219 -15
- package/src/engine/__tests__/build-app-schema.test.ts +82 -0
- package/src/engine/__tests__/build-config-feature-schema.test.ts +125 -0
- package/src/engine/__tests__/build-target.test.ts +3 -11
- package/src/engine/__tests__/codemod-pipeline.test.ts +152 -21
- package/src/engine/__tests__/config-helpers.test.ts +16 -0
- package/src/engine/__tests__/define-feature-entity-mapping.test.ts +6 -0
- package/src/engine/__tests__/define-roles.test.ts +21 -0
- package/src/engine/__tests__/engine.test.ts +163 -1
- package/src/engine/__tests__/entity-handlers.test.ts +80 -0
- package/src/engine/__tests__/event-migration-declarative.test.ts +65 -0
- package/src/engine/__tests__/event-type-map-augmentation.test.ts +24 -0
- package/src/engine/__tests__/extend-entity-projection.test.ts +123 -0
- package/src/engine/__tests__/factories-time.test.ts +2 -66
- package/src/engine/__tests__/feature-crud-shorthand.test.ts +28 -0
- package/src/engine/__tests__/feature-manifest.test.ts +31 -1
- package/src/engine/__tests__/field-access.test.ts +23 -1
- package/src/engine/__tests__/hook-phases.test.ts +5 -5
- package/src/engine/__tests__/membership-roles.test.ts +4 -10
- package/src/engine/__tests__/nav.test.ts +86 -1
- package/src/engine/__tests__/pipeline-engine.test.ts +9 -9
- package/src/engine/__tests__/pipeline-handler.integration.test.ts +18 -18
- package/src/engine/__tests__/pipeline-observability.integration.test.ts +2 -2
- package/src/engine/__tests__/pipeline-performance.integration.test.ts +3 -3
- package/src/engine/__tests__/pipeline-sub-pipelines.test.ts +9 -9
- package/src/engine/__tests__/post-query-hook.test.ts +7 -7
- package/src/engine/__tests__/registrar-object-form.test.ts +141 -0
- package/src/engine/__tests__/registry.test.ts +144 -0
- package/src/engine/__tests__/schema-builder.test.ts +18 -0
- package/src/engine/__tests__/screen.test.ts +147 -1
- package/src/engine/__tests__/soft-delete-cleanup.test.ts +3 -0
- package/src/engine/__tests__/store-table.test.ts +229 -0
- package/src/engine/__tests__/tier-resolver-extension.test.ts +19 -1
- package/src/engine/__tests__/{visual-tree-patterns.test.ts → tree-actions-patterns.test.ts} +7 -95
- package/src/engine/__tests__/validate-projection-allowlist.test.ts +15 -15
- package/src/engine/boot-validator/__tests__/config-deps.test.ts +92 -0
- package/src/engine/boot-validator/action-wiring.ts +149 -0
- package/src/engine/boot-validator/boot-check.ts +21 -0
- package/src/engine/boot-validator/config-deps.ts +40 -4
- package/src/engine/boot-validator/entity-handler.ts +20 -21
- package/src/engine/boot-validator/entity-list-screens.ts +88 -0
- package/src/engine/boot-validator/gdpr-storage.ts +0 -20
- package/src/engine/boot-validator/i18n-keys.ts +58 -4
- package/src/engine/boot-validator/index.ts +33 -12
- package/src/engine/boot-validator/nav.ts +125 -0
- package/src/engine/boot-validator/pii-retention.ts +95 -10
- package/src/engine/boot-validator/{screens-nav.ts → screens.ts} +214 -191
- package/src/engine/boot-validator/workspaces.ts +68 -0
- package/src/engine/build-app-schema.ts +16 -0
- package/src/engine/build-config-feature-schema.ts +44 -7
- package/src/engine/codemod/pipeline-codemod.ts +5 -5
- package/src/engine/config-helpers.ts +15 -0
- package/src/engine/constants.ts +32 -6
- package/src/engine/create-app.ts +11 -0
- package/src/engine/define-feature.ts +95 -947
- package/src/engine/define-handler.ts +28 -94
- package/src/engine/define-workflow.ts +1 -1
- package/src/engine/effective-features.ts +12 -2
- package/src/engine/entity-handlers.ts +76 -11
- package/src/engine/extensions/tenant-data.ts +19 -0
- package/src/engine/extensions/user-data.ts +29 -2
- package/src/engine/factories.ts +8 -49
- package/src/engine/feature-ast/__tests__/canonical-form.test.ts +26 -29
- package/src/engine/feature-ast/__tests__/fixtures/cross-file-registrar/feature.ts +9 -0
- package/src/engine/feature-ast/__tests__/fixtures/cross-file-registrar/screens.ts +4 -0
- package/src/engine/feature-ast/__tests__/parse-happy-path.test.ts +1 -2
- package/src/engine/feature-ast/__tests__/parse-real-features.test.ts +18 -8
- package/src/engine/feature-ast/__tests__/parse.test.ts +1640 -160
- package/src/engine/feature-ast/__tests__/patch.test.ts +206 -12
- package/src/engine/feature-ast/__tests__/patcher.test.ts +20 -23
- package/src/engine/feature-ast/__tests__/render-roundtrip.test.ts +380 -5
- package/src/engine/feature-ast/extractors/events.ts +322 -0
- package/src/engine/feature-ast/extractors/handlers.ts +234 -0
- package/src/engine/feature-ast/extractors/hooks.ts +243 -0
- package/src/engine/feature-ast/extractors/index.ts +34 -31
- package/src/engine/feature-ast/extractors/jobs-routes.ts +221 -0
- package/src/engine/feature-ast/extractors/projections-screens.ts +269 -0
- package/src/engine/feature-ast/extractors/round1.ts +3 -3
- package/src/engine/feature-ast/extractors/round5.ts +3 -3
- package/src/engine/feature-ast/extractors/round6.ts +2 -36
- package/src/engine/feature-ast/extractors/shared.ts +64 -6
- package/src/engine/feature-ast/index.ts +2 -4
- package/src/engine/feature-ast/parse.ts +130 -23
- package/src/engine/feature-ast/patch.ts +39 -50
- package/src/engine/feature-ast/patcher.ts +37 -38
- package/src/engine/feature-ast/patterns.ts +50 -62
- package/src/engine/feature-ast/render.ts +67 -44
- package/src/engine/feature-builder-state.ts +168 -0
- package/src/engine/feature-config-events-jobs.ts +403 -0
- package/src/engine/feature-entity-handlers.ts +208 -0
- package/src/engine/feature-manifest.ts +2 -1
- package/src/engine/feature-ui-extensions.ts +500 -0
- package/src/engine/field-access.ts +13 -2
- package/src/engine/field-helpers.ts +31 -0
- package/src/engine/handler-helpers.ts +26 -0
- package/src/engine/hook-helpers.ts +16 -0
- package/src/engine/index.ts +23 -7
- package/src/engine/membership-roles.ts +13 -0
- package/src/engine/object-form.ts +27 -0
- package/src/engine/ownership.ts +26 -79
- package/src/engine/pattern-library/__tests__/library.test.ts +7 -20
- package/src/engine/pattern-library/library.ts +44 -1152
- package/src/engine/pattern-library/mixed-schemas.ts +450 -0
- package/src/engine/pattern-library/opaque-schemas.ts +124 -0
- package/src/engine/pattern-library/shared-fields.ts +75 -0
- package/src/engine/pattern-library/static-schemas.ts +456 -0
- package/src/engine/pipeline.ts +6 -11
- package/src/engine/registry-facade.ts +362 -0
- package/src/engine/registry-ingest.ts +478 -0
- package/src/engine/registry-state.ts +388 -0
- package/src/engine/registry-validate.ts +642 -0
- package/src/engine/registry.ts +78 -1658
- package/src/engine/run-pipeline.ts +1 -1
- package/src/engine/schema-builder.ts +1 -0
- package/src/engine/screen-helpers.ts +54 -0
- package/src/engine/soft-delete-cleanup.ts +6 -2
- package/src/engine/steps/__tests__/duration-utils.test.ts +20 -0
- package/src/engine/steps/_duration-utils.ts +2 -0
- package/src/engine/steps/unsafe-projection-upsert.ts +1 -4
- package/src/engine/tier-resolver-extension.ts +3 -2
- package/src/engine/types/config.ts +2 -482
- package/src/engine/types/define-handler.ts +2 -0
- package/src/engine/types/entity-handlers.ts +2 -0
- package/src/engine/types/event-type-map.ts +1 -37
- package/src/engine/types/feature.ts +2 -972
- package/src/engine/types/fields.ts +2 -675
- package/src/engine/types/handlers.ts +2 -774
- package/src/engine/types/hooks.ts +2 -184
- package/src/engine/types/http-route.ts +1 -54
- package/src/engine/types/identifiers.ts +1 -47
- package/src/engine/types/index.ts +86 -40
- package/src/engine/types/nav.ts +2 -63
- package/src/engine/types/ownership.ts +2 -0
- package/src/engine/types/projection.ts +2 -138
- package/src/engine/types/relations.ts +1 -51
- package/src/engine/types/screen.ts +2 -574
- package/src/engine/types/step.ts +2 -334
- package/src/engine/types/target-ref.ts +1 -21
- package/src/engine/types/tree-node.ts +1 -132
- package/src/engine/types/workspace.ts +2 -49
- package/src/engine/validate-projection-allowlist.ts +6 -6
- package/src/entrypoint/__tests__/entrypoint-job-wiring.integration.test.ts +120 -1
- package/src/entrypoint/index.ts +49 -6
- package/src/errors/classes.ts +22 -1
- package/src/errors/field-issue.ts +0 -3
- package/src/errors/index.ts +1 -1
- package/src/errors/write-error-info.ts +10 -22
- package/src/es-ops/README.md +1 -1
- package/src/es-ops/__tests__/runner.integration.test.ts +74 -0
- package/src/es-ops/context.ts +4 -2
- package/src/es-ops/types.ts +8 -1
- package/src/event-store/__tests__/admin-api.integration.test.ts +27 -1
- package/src/event-store/__tests__/backfill-pii.integration.test.ts +279 -0
- package/src/event-store/__tests__/event-store.integration.test.ts +201 -0
- package/src/event-store/__tests__/row-to-stored-event.test.ts +2 -2
- package/src/event-store/__tests__/snapshot.integration.test.ts +86 -0
- package/src/event-store/__tests__/unscoped-stream-primitives.guard.test.ts +58 -0
- package/src/event-store/__tests__/upcaster.integration.test.ts +77 -45
- package/src/event-store/admin-api.ts +11 -4
- package/src/event-store/errors.ts +2 -35
- package/src/event-store/event-store.ts +64 -78
- package/src/event-store/events-schema.ts +11 -13
- package/src/event-store/index.ts +18 -3
- package/src/event-store/rebuild-dead-letter.ts +111 -0
- package/src/event-store/snapshot.ts +63 -40
- package/src/event-store/types.ts +2 -0
- package/src/files/__tests__/build-storage-key.test.ts +28 -0
- package/src/files/__tests__/file-ref-entity.test.ts +8 -0
- package/src/files/__tests__/files.integration.test.ts +24 -0
- package/src/files/__tests__/in-memory-provider.contract.test.ts +4 -0
- package/src/files/__tests__/local-provider.test.ts +31 -0
- package/src/files/__tests__/provider-resolver.test.ts +70 -0
- package/src/files/__tests__/write-stream.test.ts +13 -0
- package/src/files/file-handle.ts +2 -19
- package/src/files/file-ref-entity.ts +2 -2
- package/src/files/file-routes.ts +13 -0
- package/src/files/index.ts +1 -1
- package/src/files/local-provider.ts +27 -8
- package/src/files/provider-resolver.ts +31 -20
- package/src/files/types.ts +13 -55
- package/src/i18n/__tests__/required-surface-keys.test.ts +17 -0
- package/src/i18n/required-surface-keys.ts +120 -1
- package/src/jobs/__tests__/job-queue-depth.integration.test.ts +82 -0
- package/src/jobs/__tests__/jobs.integration.test.ts +329 -3
- package/src/jobs/job-runner.ts +82 -12
- package/src/logging/types.ts +1 -7
- package/src/migrations/pending-rebuilds.ts +1 -1
- package/src/observability/__tests__/observability.integration.test.ts +4 -1
- package/src/observability/__tests__/recording-tracer.test.ts +6 -4
- package/src/observability/index.ts +2 -0
- package/src/observability/noop-provider.ts +0 -9
- package/src/observability/recording-tracer.ts +0 -12
- package/src/observability/standard-metrics.ts +64 -2
- package/src/observability/types/index.ts +1 -29
- package/src/observability/types/metric.ts +1 -56
- package/src/observability/types/provider.ts +1 -32
- package/src/observability/types/span.ts +1 -64
- package/src/pipeline/__tests__/ctx-bridge.integration.test.ts +2 -2
- package/src/pipeline/__tests__/dispatcher.test.ts +366 -1
- package/src/pipeline/__tests__/event-consumer-state.integration.test.ts +31 -0
- package/src/pipeline/__tests__/event-dispatcher-delivery-max-attempts.test.ts +126 -0
- package/src/pipeline/__tests__/event-dispatcher-rearm.integration.test.ts +263 -0
- package/src/pipeline/__tests__/event-dispatcher.integration.test.ts +10 -0
- package/src/pipeline/__tests__/job-trigger-consumer.integration.test.ts +106 -0
- package/src/pipeline/__tests__/lifecycle-pipeline.test.ts +308 -77
- package/src/pipeline/__tests__/load-aggregate-query.integration.test.ts +16 -8
- package/src/pipeline/__tests__/post-query-hook.integration.test.ts +3 -3
- package/src/pipeline/__tests__/projection-rebuild.integration.test.ts +80 -2
- package/src/pipeline/__tests__/rebuild-poison-quarantine.integration.test.ts +274 -0
- package/src/pipeline/__tests__/try-append-event.integration.test.ts +166 -0
- package/src/pipeline/dispatch-batch.ts +187 -0
- package/src/pipeline/dispatch-query.ts +165 -0
- package/src/pipeline/dispatch-shared.ts +826 -0
- package/src/pipeline/dispatch-stream.ts +90 -0
- package/src/pipeline/dispatch-write.ts +451 -0
- package/src/pipeline/dispatcher-utils.ts +1 -1
- package/src/pipeline/dispatcher.ts +44 -1372
- package/src/pipeline/entity-cache.ts +2 -33
- package/src/pipeline/event-consumer-state.ts +30 -2
- package/src/pipeline/event-dispatcher-admin.ts +293 -0
- package/src/pipeline/event-dispatcher-delivery.ts +305 -0
- package/src/pipeline/event-dispatcher.ts +85 -542
- package/src/pipeline/index.ts +2 -0
- package/src/pipeline/msp-rebuild.ts +42 -3
- package/src/pipeline/multi-stream-apply-context.ts +4 -42
- package/src/pipeline/projection-rebuild.ts +105 -3
- package/src/pipeline/system-hooks.ts +144 -1
- package/src/rate-limit/__tests__/resolver.integration.test.ts +18 -0
- package/src/rate-limit/resolver.ts +16 -32
- package/src/schema-cli.ts +76 -16
- package/src/search/__tests__/meilisearch-adapter.integration.test.ts +207 -185
- package/src/search/__tests__/meilisearch-ids.test.ts +30 -0
- package/src/search/__tests__/reindex-entity.integration.test.ts +144 -0
- package/src/search/index.ts +6 -0
- package/src/search/meilisearch-adapter.ts +13 -12
- package/src/search/reindex-entity.ts +177 -0
- package/src/search/types.ts +1 -39
- package/src/secrets/__tests__/contains-secret.test.ts +34 -0
- package/src/secrets/__tests__/envelope-cipher.test.ts +59 -0
- package/src/secrets/__tests__/envelope.test.ts +1 -1
- package/src/secrets/dek-cache.ts +26 -5
- package/src/secrets/envelope-cipher.ts +53 -0
- package/src/secrets/envelope.ts +5 -3
- package/src/secrets/index.ts +13 -1
- package/src/secrets/stored-envelope.ts +46 -0
- package/src/secrets/types.ts +2 -162
- package/src/stack/__tests__/event-collector.test.ts +42 -0
- package/src/stack/__tests__/setup-test-stack-jobs.integration.test.ts +125 -0
- package/src/stack/db.ts +2 -1
- package/src/stack/push-entity-projection-tables.ts +4 -3
- package/src/stack/redis.ts +8 -0
- package/src/stack/request-helper.ts +38 -2
- package/src/stack/table-helpers.ts +6 -4
- package/src/stack/test-stack.ts +249 -131
- package/src/testing/__tests__/late-bound.test.ts +32 -0
- package/src/testing/__tests__/wait-for.test.ts +59 -0
- package/src/testing/boot-validator-fixture.ts +121 -0
- package/src/testing/e2e-generator.ts +8 -0
- package/src/testing/file-provider-contract.ts +104 -0
- package/src/testing/handler-context.ts +3 -1
- package/src/testing/index.ts +5 -0
- package/src/testing/late-bound.ts +5 -3
- package/src/testing/mutable-master-key-provider.ts +29 -3
- package/src/testing/wait-for.ts +3 -0
- package/src/testing/without-ambient-temporal.ts +14 -0
- package/src/time/__tests__/tz-dateline.test.ts +8 -10
- package/src/time/geo-tz.ts +1 -32
- package/src/time/index.ts +1 -0
- package/src/time/legacy-date.ts +18 -0
- package/src/time/polyfill.ts +21 -38
- package/src/time/tz-context.ts +44 -85
- package/src/ui-types/app-schema.ts +12 -0
- package/src/ui-types/index.ts +20 -7
- package/src/utils/__tests__/safe-json-temporal.test.ts +18 -0
- package/src/utils/safe-json.ts +13 -1
- package/src/__tests__/raw-table.integration.test.ts +0 -116
- package/src/bun-db/__tests__/bun-test-stack.ts +0 -6
- package/src/db/__tests__/encryption.test.ts +0 -39
- package/src/db/encryption.ts +0 -39
- package/src/db/row-helpers.ts +0 -4
- package/src/engine/__tests__/raw-table.test.ts +0 -150
- package/src/engine/__tests__/unmanaged-table.test.ts +0 -127
- package/src/engine/feature-ast/__tests__/visual-tree-parse.test.ts +0 -184
- package/src/engine/feature-ast/extractors/round4.ts +0 -1366
|
@@ -1,184 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { EntityId } from "./identifiers";
|
|
4
|
-
|
|
5
|
-
// --- Validation ---
|
|
6
|
-
|
|
7
|
-
export type ValidationError = {
|
|
8
|
-
readonly field: string;
|
|
9
|
-
readonly error: string;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type ValidationHookFn = (
|
|
13
|
-
data: Readonly<Record<string, unknown>>,
|
|
14
|
-
) => readonly ValidationError[] | null;
|
|
15
|
-
|
|
16
|
-
// --- Save/Delete Context (what hooks receive) ---
|
|
17
|
-
|
|
18
|
-
export type SaveContext = {
|
|
19
|
-
readonly kind: "save";
|
|
20
|
-
readonly id: EntityId;
|
|
21
|
-
readonly data: Readonly<Record<string, unknown>>;
|
|
22
|
-
readonly changes: Readonly<Record<string, unknown>>;
|
|
23
|
-
readonly previous: Readonly<Record<string, unknown>>;
|
|
24
|
-
readonly isNew: boolean;
|
|
25
|
-
readonly entityName?: string | undefined;
|
|
26
|
-
// The event that produced this save. Populated by the event-store-executor;
|
|
27
|
-
// the pipeline uses it to drive projections inside the same transaction.
|
|
28
|
-
// Optional because hand-crafted SaveContexts (tests, custom executors) may
|
|
29
|
-
// not have an event — projections just skip in that case.
|
|
30
|
-
readonly event?: StoredEvent | undefined;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type DeleteContext = {
|
|
34
|
-
readonly kind: "delete";
|
|
35
|
-
readonly id: EntityId;
|
|
36
|
-
readonly data: Readonly<Record<string, unknown>>;
|
|
37
|
-
readonly entityName?: string | undefined;
|
|
38
|
-
// See SaveContext.event — same semantics.
|
|
39
|
-
readonly event?: StoredEvent | undefined;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export type LifecycleResult = SaveContext | DeleteContext;
|
|
43
|
-
|
|
44
|
-
// --- Lifecycle Hooks ---
|
|
45
|
-
|
|
46
|
-
export type PreSaveHookFn = (
|
|
47
|
-
changes: Record<string, unknown>,
|
|
48
|
-
context: AppContext & {
|
|
49
|
-
readonly previous: Readonly<Record<string, unknown>>;
|
|
50
|
-
readonly isNew: boolean;
|
|
51
|
-
},
|
|
52
|
-
) => Promise<Record<string, unknown>>;
|
|
53
|
-
|
|
54
|
-
export type PostSaveHookFn = (result: SaveContext, context: AppContext) => Promise<void>;
|
|
55
|
-
|
|
56
|
-
// Batch-variant: called once at the end of a dispatcher batch with every
|
|
57
|
-
// successful SaveContext. The per-save PostSaveHookFn still fires for
|
|
58
|
-
// side-effects that need per-entity semantics (SSE); PostSaveBatch exists
|
|
59
|
-
// for adapters that can amortise work across the whole batch (e.g. search
|
|
60
|
-
// index batch-writes, bulk webhook fanout).
|
|
61
|
-
export type PostSaveBatchHookFn = (
|
|
62
|
-
results: readonly SaveContext[],
|
|
63
|
-
context: AppContext,
|
|
64
|
-
) => Promise<void>;
|
|
65
|
-
|
|
66
|
-
export type PreDeleteHookFn = (payload: DeleteContext, context: AppContext) => Promise<void>;
|
|
67
|
-
|
|
68
|
-
export type PostDeleteHookFn = (payload: DeleteContext, context: AppContext) => Promise<void>;
|
|
69
|
-
|
|
70
|
-
export type PostDeleteBatchHookFn = (
|
|
71
|
-
payloads: readonly DeleteContext[],
|
|
72
|
-
context: AppContext,
|
|
73
|
-
) => Promise<void>;
|
|
74
|
-
|
|
75
|
-
export type PreQueryHookFn = (
|
|
76
|
-
payload: Record<string, unknown>,
|
|
77
|
-
context: AppContext,
|
|
78
|
-
) => Promise<Record<string, unknown>>;
|
|
79
|
-
|
|
80
|
-
// postQuery — fires after query-handler-execute, before field-access-read-filter.
|
|
81
|
-
// Hook receives normalized rows + entityName + can mutate rows (e.g., merge
|
|
82
|
-
// custom-fields, add computed-counts, attach related-data). Mutation result
|
|
83
|
-
// replaces original rows. Hook is responsible for its own field-access-logic
|
|
84
|
-
// on added fields (field-access-filter only knows entity's stammfields).
|
|
85
|
-
export type PostQueryHookFn = (
|
|
86
|
-
result: {
|
|
87
|
-
// undefined for standalone queries (no-colon handler names like
|
|
88
|
-
// "ns:dashboard") — those have no backing entity, but handler-keyed
|
|
89
|
-
// postQuery hooks still fire on them.
|
|
90
|
-
readonly entityName: string | undefined;
|
|
91
|
-
readonly rows: ReadonlyArray<Record<string, unknown>>;
|
|
92
|
-
},
|
|
93
|
-
context: AppContext,
|
|
94
|
-
) => Promise<{ rows: ReadonlyArray<Record<string, unknown>> }>;
|
|
95
|
-
|
|
96
|
-
export type LifecycleHookFn =
|
|
97
|
-
| PreSaveHookFn
|
|
98
|
-
| PostSaveHookFn
|
|
99
|
-
| PreDeleteHookFn
|
|
100
|
-
| PostDeleteHookFn
|
|
101
|
-
| PreQueryHookFn
|
|
102
|
-
| PostQueryHookFn;
|
|
103
|
-
|
|
104
|
-
// --- Hook Phases ---
|
|
105
|
-
//
|
|
106
|
-
// inTransaction: Hook runs inside the DB transaction. Failures roll back
|
|
107
|
-
// the entire write. Use for: DB-based side-effects (counter updates,
|
|
108
|
-
// dependent entity writes).
|
|
109
|
-
//
|
|
110
|
-
// afterCommit (default): Hook runs after the transaction commits. Failures
|
|
111
|
-
// are logged but don't affect the write. Use for: external systems
|
|
112
|
-
// (SSE broadcast, search index, email, webhooks).
|
|
113
|
-
|
|
114
|
-
export const HookPhases = {
|
|
115
|
-
inTransaction: "inTransaction",
|
|
116
|
-
afterCommit: "afterCommit",
|
|
117
|
-
} as const;
|
|
118
|
-
|
|
119
|
-
export type HookPhase = (typeof HookPhases)[keyof typeof HookPhases];
|
|
120
|
-
|
|
121
|
-
// Owner-tag shared across every hook structure. The lifecycle pipeline uses
|
|
122
|
-
// it to skip hooks whose owning feature is globally disabled:
|
|
123
|
-
// - A concrete feature name like "orders" → subject to the feature-toggle
|
|
124
|
-
// filter (skipped when "orders" is disabled).
|
|
125
|
-
// - "*" (star) → invariant plumbing, never filtered. Reserved for
|
|
126
|
-
// extension-provided hooks and framework-internal hooks that belong to
|
|
127
|
-
// the pipeline itself, not a feature.
|
|
128
|
-
// - Omitted (undefined) → treated as "*". Supports tests that hand-build
|
|
129
|
-
// HookMap objects without caring about ownership.
|
|
130
|
-
export type HookOwner = { readonly featureName?: string };
|
|
131
|
-
|
|
132
|
-
export type PhasedHook<TFn> = {
|
|
133
|
-
readonly fn: TFn;
|
|
134
|
-
readonly phase: HookPhase;
|
|
135
|
-
} & HookOwner;
|
|
136
|
-
|
|
137
|
-
// Flat (non-phased) hook — preSave, preQuery. Same owner contract, no
|
|
138
|
-
// phase semantics because these hooks run exactly once per handler pass
|
|
139
|
-
// before/around the DB transaction.
|
|
140
|
-
export type OwnedFn<TFn> = {
|
|
141
|
-
readonly fn: TFn;
|
|
142
|
-
} & HookOwner;
|
|
143
|
-
|
|
144
|
-
// --- Hook Maps ---
|
|
145
|
-
|
|
146
|
-
// Slots are optional: defineFeature materializes every slot, but hand-built
|
|
147
|
-
// FeatureDefinitions at system boundaries (test fixtures, partial boots —
|
|
148
|
-
// see registry.test.ts "slot robustness") legitimately omit them, and the
|
|
149
|
-
// registry merge paths tolerate undefined. The type mirrors that contract.
|
|
150
|
-
export type HookMap = {
|
|
151
|
-
readonly validation?: Readonly<Record<string, ValidationHookFn>>;
|
|
152
|
-
readonly preSave?: Readonly<Record<string, readonly OwnedFn<PreSaveHookFn>[]>>;
|
|
153
|
-
readonly postSave?: Readonly<Record<string, readonly PhasedHook<PostSaveHookFn>[]>>;
|
|
154
|
-
readonly preDelete?: Readonly<Record<string, readonly PhasedHook<PreDeleteHookFn>[]>>;
|
|
155
|
-
readonly postDelete?: Readonly<Record<string, readonly PhasedHook<PostDeleteHookFn>[]>>;
|
|
156
|
-
readonly preQuery?: Readonly<Record<string, readonly OwnedFn<PreQueryHookFn>[]>>;
|
|
157
|
-
readonly postQuery?: Readonly<Record<string, readonly OwnedFn<PostQueryHookFn>[]>>;
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
export type EntityHookMap = {
|
|
161
|
-
readonly postSave?: Readonly<Record<string, readonly PhasedHook<PostSaveHookFn>[]>>;
|
|
162
|
-
readonly preDelete?: Readonly<Record<string, readonly PhasedHook<PreDeleteHookFn>[]>>;
|
|
163
|
-
readonly postDelete?: Readonly<Record<string, readonly PhasedHook<PostDeleteHookFn>[]>>;
|
|
164
|
-
readonly postQuery?: Readonly<Record<string, readonly OwnedFn<PostQueryHookFn>[]>>;
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
// Search-Payload-Extension (F3) — contributor function that adds flat
|
|
168
|
-
// fields to an entity's search-document. Fires synchronously during
|
|
169
|
-
// buildSearchDocument (in `system-hooks.ts`), receives current entity
|
|
170
|
-
// state, returns extra fields to merge into the search-index payload.
|
|
171
|
-
//
|
|
172
|
-
// Use-cases: custom-fields-bundle (merge customFields-jsonb-keys flat
|
|
173
|
-
// into index), tags-bundle (project tags-array as searchable), computed-
|
|
174
|
-
// fields (denormalize related-counts).
|
|
175
|
-
//
|
|
176
|
-
// IMPORTANT: contributor must be deterministic per (entityName, entityId,
|
|
177
|
-
// state). Async-allowed for future-proofing but discouraged — the
|
|
178
|
-
// indexing path runs once per entity-write, sync extension is
|
|
179
|
-
// near-zero-cost.
|
|
180
|
-
export type SearchPayloadContributorFn = (args: {
|
|
181
|
-
readonly entityName: string;
|
|
182
|
-
readonly entityId: EntityId;
|
|
183
|
-
readonly state: Record<string, unknown>;
|
|
184
|
-
}) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
|
1
|
+
// Legacy path — re-exported for callers still importing this module directly.
|
|
2
|
+
export type * from "@cosmicdrift/kumiko-types/hooks";
|
|
@@ -1,54 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// der /api/write|query|batch-Pipeline. Use-Case: RSS/Atom-Feeds, OpenAPI-
|
|
3
|
-
// Specs, OG-Image-Generators, Webhook-Receiver — alles wo der Feature-
|
|
4
|
-
// Author das Wire-Format selbst kontrolliert.
|
|
5
|
-
//
|
|
6
|
-
// Pattern symmetrisch zu r.queryHandler / r.writeHandler: Definition als
|
|
7
|
-
// Teil des Features (nicht des App-Bootstrapping). Phase-3 Multi-Tenant
|
|
8
|
-
// wird trivial weil tenant-context via host-resolution greift.
|
|
9
|
-
//
|
|
10
|
-
// Escape-hatch bleibt: runProdApp.extraRoutes für hand-rolled Routes die
|
|
11
|
-
// nichts mit einem Feature zu tun haben (z.B. plattform-spezifische
|
|
12
|
-
// Static-Serving-Logic).
|
|
13
|
-
|
|
14
|
-
import type { Context } from "hono";
|
|
15
|
-
|
|
16
|
-
/** Subset von HTTP-Methoden den wir aktiv unterstützen. Hono spricht
|
|
17
|
-
* alle, aber das hier sind die einzigen die ein Feature-Author
|
|
18
|
-
* realistisch deklariert. */
|
|
19
|
-
export type HttpRouteMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
20
|
-
|
|
21
|
-
/** Dependencies die der Handler vom Framework bekommt. App-Author kann
|
|
22
|
-
* die App selbst aufrufen (`deps.app.fetch(...)` für intern-call) oder
|
|
23
|
-
* direkt per dispatcher Daten ziehen. Db/Redis sind die rohen Connections
|
|
24
|
-
* — wer Tenant-Scope braucht muss durch dispatcher.query gehen.
|
|
25
|
-
*
|
|
26
|
-
* Hono-typing: `Context<any, any>` weil das Hono-Type-Param-Setup nur
|
|
27
|
-
* intern relevant ist. Concrete Hono-app wird im Boot-Path zugewiesen. */
|
|
28
|
-
export type HttpRouteHandlerDeps = {
|
|
29
|
-
/** Die Hono-app — Handler kann via app.fetch(...) interne Routes
|
|
30
|
-
* ansprechen (z.B. /api/query mit der vollen Auth-/Anonymous-Chain). */
|
|
31
|
-
// biome-ignore lint/suspicious/noExplicitAny: Hono's generic-Param ist im Framework-Boundary unsichtbar
|
|
32
|
-
readonly app: import("hono").Hono<any, any>;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type HttpRouteHandler = (
|
|
36
|
-
// biome-ignore lint/suspicious/noExplicitAny: Hono Context-Generics sind im Framework-Boundary unsichtbar
|
|
37
|
-
c: Context<any, any>,
|
|
38
|
-
deps: HttpRouteHandlerDeps,
|
|
39
|
-
) => Response | Promise<Response>;
|
|
40
|
-
|
|
41
|
-
export type HttpRouteDefinition = {
|
|
42
|
-
/** HTTP-Methode — bei Hono-Mount via app.{get,post,...}(path). */
|
|
43
|
-
readonly method: HttpRouteMethod;
|
|
44
|
-
/** URL-Pfad (Hono-Pattern, z.B. "/feed.xml" oder "/og/:tenantId.png"). */
|
|
45
|
-
readonly path: string;
|
|
46
|
-
/** Wenn true, bypasses die /api/*-Auth-Middleware. Default false —
|
|
47
|
-
* Routes liegen außerhalb /api/* und sehen die Auth-Middleware
|
|
48
|
-
* ohnehin nicht; das Flag ist semantisch (= "diese Route ist
|
|
49
|
-
* bewusst öffentlich") für Boot-Validator + Doku. */
|
|
50
|
-
readonly anonymous?: boolean;
|
|
51
|
-
/** Hono-Handler. Bekommt Hono-Context + Framework-Deps; returnt
|
|
52
|
-
* Response (sync oder async). */
|
|
53
|
-
readonly handler: HttpRouteHandler;
|
|
54
|
-
};
|
|
1
|
+
export type * from "@cosmicdrift/kumiko-types/http-route";
|
|
@@ -1,47 +1 @@
|
|
|
1
|
-
|
|
2
|
-
// travels through the framework. One declaration per concept so future
|
|
3
|
-
// representation changes (branded types, UUID validation, opaque wrappers)
|
|
4
|
-
// land in a single place.
|
|
5
|
-
|
|
6
|
-
// Tenant identifier — UUID string today. May become branded/opaque later
|
|
7
|
-
// without touching call sites.
|
|
8
|
-
export type TenantId = string;
|
|
9
|
-
|
|
10
|
-
// Lowercase UUID (any RFC-4122 variant). Strict enough to keep client-
|
|
11
|
-
// supplied junk (e.g. SQL fragments, path-traversal probes) out of the
|
|
12
|
-
// pipeline; loose enough that v4 / v7 / nil all match. Any caller that
|
|
13
|
-
// already holds a TenantId from a trusted source (JWT payload, server
|
|
14
|
-
// config) skips this — the helper is for **untrusted input** crossing
|
|
15
|
-
// the system boundary.
|
|
16
|
-
const TENANT_ID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
17
|
-
|
|
18
|
-
// Validates a candidate string against the tenantId format and returns it
|
|
19
|
-
// as a TenantId, or `null` when it doesn't match. Use at every system
|
|
20
|
-
// boundary that admits untrusted input (HTTP headers, cookies, query
|
|
21
|
-
// params). Returning null instead of throwing keeps the caller in charge
|
|
22
|
-
// of the rejection shape — middleware returns 400, batch jobs may filter
|
|
23
|
-
// + log, and unit tests don't need a try/catch.
|
|
24
|
-
export function parseTenantId(value: unknown): TenantId | null {
|
|
25
|
-
if (typeof value !== "string") return null;
|
|
26
|
-
if (!TENANT_ID_REGEX.test(value)) return null;
|
|
27
|
-
return value;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// "System-scope" tenant marker: handlers carry this tenantId when the event
|
|
31
|
-
// doesn't belong to any particular tenant (reference data, cross-tenant
|
|
32
|
-
// jobs, global config). The concrete UUID is a valid v4 (not all-zeroes —
|
|
33
|
-
// Postgres' UUID type rejects invalid variants), chosen to be easy to
|
|
34
|
-
// eyeball in logs. Central constant so call sites don't re-type the string
|
|
35
|
-
// and the isSystemTenant() check stays in sync.
|
|
36
|
-
export const SYSTEM_TENANT_ID: TenantId = "00000000-0000-4000-8000-000000000000";
|
|
37
|
-
|
|
38
|
-
export function isSystemTenant(tenantId: TenantId | null | undefined): boolean {
|
|
39
|
-
return !tenantId || tenantId === SYSTEM_TENANT_ID;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// Primary-key identifier for any entity row. Two shapes coexist because of
|
|
43
|
-
// the entity-def `idType` switch: classic CRUD entities keep `serial` (number),
|
|
44
|
-
// while tenant + ES aggregates run on `uuid` (string). Call sites that pass
|
|
45
|
-
// the id through to the DB layer stay agnostic; only code that formats ids
|
|
46
|
-
// for URLs, logs, or cache keys needs `String(id)` — JS coerces both safely.
|
|
47
|
-
export type EntityId = number | string;
|
|
1
|
+
export * from "@cosmicdrift/kumiko-types/identifiers";
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
// Barrel: re-exports all types from
|
|
2
|
-
//
|
|
3
|
-
// are defined ONLY in constants.ts — re-exported here for backwards compatibility.
|
|
1
|
+
// Barrel: re-exports all types from @cosmicdrift/kumiko-types, plus the
|
|
2
|
+
// runtime helpers below that stay framework-side.
|
|
4
3
|
|
|
5
|
-
// Re-export types that were duplicated in types.ts but are canonical in constants.ts
|
|
6
|
-
export type {
|
|
7
|
-
ConcurrencyMode,
|
|
8
|
-
ConfigScope,
|
|
9
|
-
LifecycleHookType,
|
|
10
|
-
OnDeleteStrategy,
|
|
11
|
-
} from "../constants";
|
|
12
4
|
export type {
|
|
13
5
|
ConfigAccessor,
|
|
14
6
|
ConfigAccessorFactory,
|
|
@@ -53,32 +45,45 @@ export type {
|
|
|
53
45
|
TranslationKeys,
|
|
54
46
|
TranslationsDef,
|
|
55
47
|
UiExtensionDef,
|
|
56
|
-
} from "
|
|
48
|
+
} from "@cosmicdrift/kumiko-types/config";
|
|
49
|
+
export type {
|
|
50
|
+
QueryHandlerDefinition,
|
|
51
|
+
StreamHandlerDefinition,
|
|
52
|
+
WriteHandlerDefinition,
|
|
53
|
+
WriteHandlerInput,
|
|
54
|
+
} from "@cosmicdrift/kumiko-types/define-handler";
|
|
55
|
+
export type {
|
|
56
|
+
EntityCrudRegistrar,
|
|
57
|
+
EntityCrudVerb,
|
|
58
|
+
EntityHandlerOptions,
|
|
59
|
+
EntityQueryHandlerOptions,
|
|
60
|
+
RegisterEntityCrudOptions,
|
|
61
|
+
} from "@cosmicdrift/kumiko-types/entity-handlers";
|
|
57
62
|
// Cross-Feature Compile-Time-Type-Map — features extend per declare-module.
|
|
58
63
|
export type {
|
|
59
64
|
KumikoEntityTypeMap,
|
|
60
65
|
KumikoEventTypeMap,
|
|
61
66
|
KumikoHandlerPayloadMap,
|
|
62
67
|
KumikoHandlerResultMap,
|
|
63
|
-
} from "
|
|
68
|
+
} from "@cosmicdrift/kumiko-types/event-type-map";
|
|
64
69
|
export type {
|
|
70
|
+
BootCheckContext,
|
|
71
|
+
BootCheckFn,
|
|
65
72
|
FeatureDefinition,
|
|
66
73
|
FeatureMetricDef,
|
|
67
74
|
FeatureMetricType,
|
|
68
75
|
FeatureRegistrar,
|
|
69
76
|
MetricOptions,
|
|
70
|
-
RawTableDef,
|
|
71
|
-
RawTableEntry,
|
|
72
|
-
RawTableOptions,
|
|
73
77
|
Registry,
|
|
74
78
|
SecretKeyDefinition,
|
|
75
79
|
SecretKeyHandle,
|
|
76
80
|
SecretOptions,
|
|
81
|
+
StoreTableDef,
|
|
82
|
+
StoreTableEntry,
|
|
83
|
+
StoreTableOptions,
|
|
77
84
|
UiHintOption,
|
|
78
85
|
UiHints,
|
|
79
|
-
|
|
80
|
-
UnmanagedTableEntry,
|
|
81
|
-
} from "./feature";
|
|
86
|
+
} from "@cosmicdrift/kumiko-types/feature";
|
|
82
87
|
export type {
|
|
83
88
|
AnyFileFieldDef,
|
|
84
89
|
BigIntFieldDef,
|
|
@@ -116,8 +121,7 @@ export type {
|
|
|
116
121
|
TimestampFieldDef,
|
|
117
122
|
TransitionMap,
|
|
118
123
|
TzFieldDef,
|
|
119
|
-
} from "
|
|
120
|
-
export { DEFAULT_CURRENCIES, isFileField } from "./fields";
|
|
124
|
+
} from "@cosmicdrift/kumiko-types/fields";
|
|
121
125
|
export type {
|
|
122
126
|
AccessRule,
|
|
123
127
|
AggregateStreamHandle,
|
|
@@ -132,9 +136,11 @@ export type {
|
|
|
132
136
|
ClaimKeyHandle,
|
|
133
137
|
ClaimKeyJsType,
|
|
134
138
|
ClaimKeyType,
|
|
139
|
+
DeclarativeEventMigration,
|
|
135
140
|
EntityRef,
|
|
136
141
|
EventDef,
|
|
137
142
|
EventMigrationDef,
|
|
143
|
+
EventPiiFields,
|
|
138
144
|
EventUpcastCtx,
|
|
139
145
|
EventUpcastFn,
|
|
140
146
|
FetchForWritingArgs,
|
|
@@ -154,13 +160,16 @@ export type {
|
|
|
154
160
|
RateLimitOption,
|
|
155
161
|
RateLimitPer,
|
|
156
162
|
SessionUser,
|
|
163
|
+
StreamHandlerDef,
|
|
164
|
+
StreamHandlerFn,
|
|
165
|
+
TryAppendEventFn,
|
|
166
|
+
TryAppendEventResult,
|
|
157
167
|
UnsafeAppendEventFn,
|
|
158
168
|
WriteEvent,
|
|
159
169
|
WriteHandlerDef,
|
|
160
170
|
WriteHandlerFn,
|
|
161
171
|
WriteResult,
|
|
162
|
-
} from "
|
|
163
|
-
export { resolveName, withResponseData } from "./handlers";
|
|
172
|
+
} from "@cosmicdrift/kumiko-types/handlers";
|
|
164
173
|
export type {
|
|
165
174
|
DeleteContext,
|
|
166
175
|
EntityHookMap,
|
|
@@ -183,19 +192,34 @@ export type {
|
|
|
183
192
|
SearchPayloadContributorFn,
|
|
184
193
|
ValidationError,
|
|
185
194
|
ValidationHookFn,
|
|
186
|
-
} from "
|
|
187
|
-
export { HookPhases } from "./hooks";
|
|
195
|
+
} from "@cosmicdrift/kumiko-types/hooks";
|
|
188
196
|
export type {
|
|
189
197
|
HttpRouteDefinition,
|
|
190
198
|
HttpRouteHandler,
|
|
191
199
|
HttpRouteHandlerDeps,
|
|
192
200
|
HttpRouteMethod,
|
|
193
|
-
} from "
|
|
201
|
+
} from "@cosmicdrift/kumiko-types/http-route";
|
|
194
202
|
// Domain-identifier type aliases — see identifiers.ts for rationale.
|
|
195
|
-
export type { EntityId, TenantId } from "
|
|
196
|
-
export {
|
|
197
|
-
|
|
203
|
+
export type { EntityId, TenantId } from "@cosmicdrift/kumiko-types/identifiers";
|
|
204
|
+
export {
|
|
205
|
+
isSystemTenant,
|
|
206
|
+
parseTenantId,
|
|
207
|
+
SYSTEM_TENANT_ID,
|
|
208
|
+
} from "@cosmicdrift/kumiko-types/identifiers";
|
|
209
|
+
export type { NavDefinition } from "@cosmicdrift/kumiko-types/nav";
|
|
210
|
+
export type {
|
|
211
|
+
FromRule,
|
|
212
|
+
FromRuleKind,
|
|
213
|
+
OwnershipClause,
|
|
214
|
+
OwnershipMap,
|
|
215
|
+
OwnershipRef,
|
|
216
|
+
OwnershipRule,
|
|
217
|
+
SqlFragment,
|
|
218
|
+
WhereRule,
|
|
219
|
+
WhereRuleContext,
|
|
220
|
+
} from "@cosmicdrift/kumiko-types/ownership";
|
|
198
221
|
export type {
|
|
222
|
+
EntityProjectionExtension,
|
|
199
223
|
MspErrorMode,
|
|
200
224
|
MspErrorPolicy,
|
|
201
225
|
MultiStreamApplyFn,
|
|
@@ -203,19 +227,29 @@ export type {
|
|
|
203
227
|
ProjectionDefinition,
|
|
204
228
|
ProjectionTable,
|
|
205
229
|
SingleStreamApplyFn,
|
|
206
|
-
} from "
|
|
230
|
+
} from "@cosmicdrift/kumiko-types/projection";
|
|
207
231
|
export type {
|
|
208
232
|
BelongsToRelation,
|
|
209
233
|
EntityRelations,
|
|
210
234
|
HasManyRelation,
|
|
211
235
|
ManyToManyRelation,
|
|
212
236
|
RelationDefinition,
|
|
213
|
-
} from "
|
|
237
|
+
} from "@cosmicdrift/kumiko-types/relations";
|
|
214
238
|
export type {
|
|
215
239
|
ActionFormScreenDefinition,
|
|
216
240
|
ConfigEditScreenDefinition,
|
|
217
241
|
CustomScreenDefinition,
|
|
218
242
|
CustomScreenRoute,
|
|
243
|
+
DashboardChartPanel,
|
|
244
|
+
DashboardCustomPanel,
|
|
245
|
+
DashboardFeedPanel,
|
|
246
|
+
DashboardFilterDefinition,
|
|
247
|
+
DashboardListPanel,
|
|
248
|
+
DashboardPanelDefinition,
|
|
249
|
+
DashboardProgressListPanel,
|
|
250
|
+
DashboardScreenDefinition,
|
|
251
|
+
DashboardStatGroupPanel,
|
|
252
|
+
DashboardStatPanel,
|
|
219
253
|
EditExtensionSection,
|
|
220
254
|
EditFieldSpec,
|
|
221
255
|
EditFieldsSection,
|
|
@@ -229,6 +263,8 @@ export type {
|
|
|
229
263
|
FormatSpec,
|
|
230
264
|
ListColumnSpec,
|
|
231
265
|
PlatformComponent,
|
|
266
|
+
ProjectionDetailScreenDefinition,
|
|
267
|
+
ProjectionListScreenDefinition,
|
|
232
268
|
RowAction,
|
|
233
269
|
RowActionNavigate,
|
|
234
270
|
RowActionWriteHandler,
|
|
@@ -237,14 +273,8 @@ export type {
|
|
|
237
273
|
ScreenFilterOp,
|
|
238
274
|
ScreenSlots,
|
|
239
275
|
ToolbarAction,
|
|
240
|
-
} from "
|
|
241
|
-
export {
|
|
242
|
-
isExtensionEditSection,
|
|
243
|
-
isFormatSpec,
|
|
244
|
-
normalizeEditField,
|
|
245
|
-
normalizeListColumn,
|
|
246
|
-
} from "./screen";
|
|
247
|
-
export type { TargetRef } from "./target-ref";
|
|
276
|
+
} from "@cosmicdrift/kumiko-types/screen";
|
|
277
|
+
export type { TargetRef } from "@cosmicdrift/kumiko-types/target-ref";
|
|
248
278
|
export type {
|
|
249
279
|
Subscribe,
|
|
250
280
|
TreeAction,
|
|
@@ -253,5 +283,21 @@ export type {
|
|
|
253
283
|
TreeChildrenSubscribe,
|
|
254
284
|
TreeNode,
|
|
255
285
|
TreeNodeState,
|
|
256
|
-
} from "
|
|
257
|
-
export type { WorkspaceDefinition } from "
|
|
286
|
+
} from "@cosmicdrift/kumiko-types/tree-node";
|
|
287
|
+
export type { WorkspaceDefinition } from "@cosmicdrift/kumiko-types/workspace";
|
|
288
|
+
// Re-export types that were duplicated in types.ts but are canonical in constants.ts
|
|
289
|
+
export type {
|
|
290
|
+
ConcurrencyMode,
|
|
291
|
+
ConfigScope,
|
|
292
|
+
LifecycleHookType,
|
|
293
|
+
OnDeleteStrategy,
|
|
294
|
+
} from "../constants";
|
|
295
|
+
export { DEFAULT_CURRENCIES, isFileField } from "../field-helpers";
|
|
296
|
+
export { resolveName, withResponseData } from "../handler-helpers";
|
|
297
|
+
export { HookPhases } from "../hook-helpers";
|
|
298
|
+
export {
|
|
299
|
+
isExtensionEditSection,
|
|
300
|
+
isFormatSpec,
|
|
301
|
+
normalizeEditField,
|
|
302
|
+
normalizeListColumn,
|
|
303
|
+
} from "../screen-helpers";
|
package/src/engine/types/nav.ts
CHANGED
|
@@ -1,63 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import type { TreeAction } from "./tree-node";
|
|
4
|
-
|
|
5
|
-
// Nav entry declaration. Every feature that wants to appear in the app's
|
|
6
|
-
// navigation tree registers one or more entries via r.nav(). The engine
|
|
7
|
-
// keeps the list flat — ui-core's resolveNavigation assembles the parent/
|
|
8
|
-
// child tree at render time, so changes (toggles, access-gating) don't
|
|
9
|
-
// require re-indexing a tree shape server-side.
|
|
10
|
-
//
|
|
11
|
-
// Cross-feature references are allowed: `screen` may point at any
|
|
12
|
-
// registered screen QN, `parent` at any registered nav QN. The boot
|
|
13
|
-
// validator checks both references exist + rejects parent cycles.
|
|
14
|
-
export type NavDefinition = {
|
|
15
|
-
// Feature author writes the feature-local short id ("catalog"); the
|
|
16
|
-
// registry overwrites `id` with the qualified name ("shop:nav:catalog")
|
|
17
|
-
// in its stored copy. Callers of `registry.getNav(qn)` /
|
|
18
|
-
// `getTopLevelNavs()` / `getNavsByParent(...)` always see the qualified
|
|
19
|
-
// id — no parallel reverse index needed. `feature.navs[shortId]` on the
|
|
20
|
-
// unregistered FeatureDefinition keeps the short form.
|
|
21
|
-
readonly id: string;
|
|
22
|
-
// i18n translation key. Resolved at render time by the renderer's
|
|
23
|
-
// useTranslation hook; engine keeps it opaque.
|
|
24
|
-
readonly label: string;
|
|
25
|
-
// Icon key — whatever the icon registry of the active renderer understands.
|
|
26
|
-
// Engine doesn't validate; unknown icons surface as a missing icon on screen,
|
|
27
|
-
// not a boot failure.
|
|
28
|
-
readonly icon?: string;
|
|
29
|
-
// Qualified name of a parent nav entry ("<feature>:nav:<id>"). Omit for
|
|
30
|
-
// top-level entries. Boot-validator rejects cycles + dangling refs.
|
|
31
|
-
readonly parent?: string;
|
|
32
|
-
// Sort weight within the parent's children (lower = earlier). Ties are
|
|
33
|
-
// broken by registration order — features registered later appear lower.
|
|
34
|
-
readonly order?: number;
|
|
35
|
-
// Qualified name of the screen this entry navigates to
|
|
36
|
-
// ("<feature>:screen:<id>"). Omit for pure grouping entries (a parent-only
|
|
37
|
-
// nav node that renders a sub-tree but has no target screen itself).
|
|
38
|
-
readonly screen?: string;
|
|
39
|
-
// Polymorphes Klick-Ziel (öffnet die EditorPanel-Maske via Target-
|
|
40
|
-
// Resolver) — Alternative zu `screen`. Ein Knoten trägt screen XOR
|
|
41
|
-
// target; der Renderer dispatcht das target statt einen Route-Link zu
|
|
42
|
-
// rendern. Gespiegelt aus dem alten Visual-Tree (TreeNode.target).
|
|
43
|
-
readonly target?: TargetRef;
|
|
44
|
-
// Hover-Actions rechts in der Zeile (VS-Code-Pattern) — erst bei Hover
|
|
45
|
-
// sichtbar. Reihenfolge wie deklariert.
|
|
46
|
-
readonly actions?: readonly TreeAction[];
|
|
47
|
-
// „+"-Affordance am Knoten. Klick dispatcht createAction.target; der
|
|
48
|
-
// Provider weiß was „leer befüllen" für ihn heißt (neuer Page-Slug etc.).
|
|
49
|
-
readonly createAction?: TreeAction;
|
|
50
|
-
// Children kommen zur Laufzeit aus einem registrierten nav-provider
|
|
51
|
-
// (lazy beim Ausklappen, SSE-live via treeEntities), keyed auf diese
|
|
52
|
-
// Nav-QN. Macht den Knoten expandable auch ohne statische children.
|
|
53
|
-
readonly provider?: boolean;
|
|
54
|
-
// Role / openToAll gate. The nav resolver hides entries the user can't
|
|
55
|
-
// reach; leave unset to always show (engine stays un-opinionated about
|
|
56
|
-
// who sees what — apps that need default-deny can set { roles: [] }).
|
|
57
|
-
readonly access?: AccessRule;
|
|
58
|
-
// Workspace QNs this entry self-assigns to. Merged at boot with any
|
|
59
|
-
// r.workspace({ nav: [...] }) explicit lists. Omit to leave workspace
|
|
60
|
-
// membership decided solely by the workspace's nav list (or both empty
|
|
61
|
-
// → entry belongs to no workspace).
|
|
62
|
-
readonly workspaces?: readonly string[];
|
|
63
|
-
};
|
|
1
|
+
// Legacy path — re-exported for callers still importing this module directly.
|
|
2
|
+
export type * from "@cosmicdrift/kumiko-types/nav";
|