@cosmicdrift/kumiko-framework 0.413.0 → 0.414.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/AGENTS.md +5 -2
- package/agents/api/framework-db.md +14 -3
- package/agents/api/framework-engine.md +64 -13
- package/agents/api/framework-event-store.md +14 -0
- package/agents/api/framework-ui-types.md +149 -21
- package/agents/api/renderer-web.md +93 -9
- package/agents/api/testing-helpers.md +3 -2
- package/agents/api/testing-stack.md +3 -0
- package/agents/api/types.md +205 -14
- package/agents/api.md +7 -7
- package/agents/boot-rules.md +63 -9
- package/agents/examples/api-docs.md +2 -6
- package/agents/examples/auth-mfa.md +57 -10
- package/agents/examples/chat-channels.md +2 -0
- package/agents/examples/currencies-global.md +1 -0
- package/agents/examples/env-composition.md +7 -11
- package/agents/examples/helpdesk.md +15 -8
- package/agents/examples/managed-pages.md +90 -1
- package/agents/examples/pwa-shell.md +210 -0
- package/agents/examples/rate-limiting.md +3 -3
- package/agents/examples/record-detail-layout.md +1537 -67
- package/agents/examples/workflow-engine.md +16 -12
- package/agents/examples.md +1 -0
- package/agents/features-index.md +4 -2
- package/agents/features.md +22 -7
- package/agents/widgets.md +19 -1
- package/dist/api/api-constants.d.ts +1 -0
- package/dist/api/api-constants.js +4 -0
- package/dist/api/auth-middleware.js +4 -3
- package/dist/api/auth-routes-shared.js +2 -1
- package/dist/api/entity-read-access.d.ts +1 -0
- package/dist/api/entity-read-access.js +18 -0
- package/dist/api/export/export-route.d.ts +6 -1
- package/dist/api/export/export-route.js +27 -1
- package/dist/api/export/export-rows.js +19 -3
- package/dist/api/routes.d.ts +2 -0
- package/dist/api/routes.js +9 -1
- package/dist/api/server-extra-routes.js +2 -1
- package/dist/api/server-feature-http-routes.d.ts +9 -0
- package/dist/api/server-feature-http-routes.js +109 -0
- package/dist/api/server-middleware.js +2 -19
- package/dist/api/server-pat-rate-limit-guard.d.ts +3 -0
- package/dist/api/server-pat-rate-limit-guard.js +19 -0
- package/dist/api/server-rate-limit-wiring.d.ts +10 -0
- package/dist/api/server-rate-limit-wiring.js +37 -0
- package/dist/api/server-routes.d.ts +4 -12
- package/dist/api/server-routes.js +12 -171
- package/dist/api/server-schema-route.d.ts +3 -0
- package/dist/api/server-schema-route.js +58 -0
- package/dist/api/server-wiring.js +2 -37
- package/dist/api/server.js +3 -1
- package/dist/compliance/override-schema.js +5 -5
- package/dist/compliance/sub-processors.js +10 -1
- package/dist/crypto/index.d.ts +1 -1
- package/dist/crypto/index.js +1 -1
- package/dist/crypto/pii-field-encryption.d.ts +2 -0
- package/dist/crypto/pii-field-encryption.js +16 -1
- package/dist/db/apply-entity-event.js +4 -0
- package/dist/db/bun-sql-connection-codes.d.ts +1 -0
- package/dist/db/bun-sql-connection-codes.js +7 -0
- package/dist/db/collect-table-metas.js +4 -1
- package/dist/db/config-seed.js +1 -1
- package/dist/db/derived-field-sql.js +15 -13
- package/dist/db/derived-related-sql.d.ts +2 -2
- package/dist/db/derived-related-sql.js +4 -2
- package/dist/db/dialect.d.ts +3 -0
- package/dist/db/dialect.js +1 -3
- package/dist/db/driver-row-coercion.js +2 -2
- package/dist/db/driver-value-preparation.js +1 -1
- package/dist/db/eagerload.js +15 -12
- package/dist/db/entity-table-meta.d.ts +2 -0
- package/dist/db/entity-table-meta.js +7 -0
- package/dist/db/event-store-executor-context.js +13 -8
- package/dist/db/event-store-executor-read-aggregate-currencies.js +2 -2
- package/dist/db/event-store-executor-read-aggregate.js +2 -2
- package/dist/db/event-store-executor-read-filter.d.ts +4 -0
- package/dist/db/event-store-executor-read-filter.js +28 -11
- package/dist/db/event-store-executor-read-search.d.ts +1 -0
- package/dist/db/event-store-executor-read-search.js +6 -6
- package/dist/db/event-store-executor-read-sort.js +3 -3
- package/dist/db/event-store-executor-read-where.js +14 -5
- package/dist/db/event-store-executor-read.js +7 -7
- package/dist/db/event-store-executor-write.js +50 -95
- package/dist/db/executor-managed-tables.js +4 -1
- package/dist/db/index.d.ts +4 -2
- package/dist/db/index.js +4 -2
- package/dist/db/known-table-names.d.ts +1 -0
- package/dist/db/known-table-names.js +7 -5
- package/dist/db/list-aggregate-labels.d.ts +1 -0
- package/dist/db/list-aggregate-labels.js +9 -1
- package/dist/db/migrate-generator.js +23 -4
- package/dist/db/migrate-rls-diff.d.ts +1 -0
- package/dist/db/migrate-rls-diff.js +15 -1
- package/dist/db/migrate-runner.js +2 -2
- package/dist/db/money.d.ts +1 -1
- package/dist/db/money.js +1 -4
- package/dist/db/parent-ref-clause.d.ts +6 -2
- package/dist/db/parent-ref-clause.js +76 -23
- package/dist/db/parent-ref-global-hosts.d.ts +20 -0
- package/dist/db/parent-ref-global-hosts.js +47 -0
- package/dist/db/production-schema-command-hint.d.ts +1 -0
- package/dist/db/production-schema-command-hint.js +3 -0
- package/dist/db/queries/backfill-pii.js +55 -29
- package/dist/db/queries/ddl.js +13 -2
- package/dist/db/queries/event-store-open-streams.d.ts +15 -0
- package/dist/db/queries/event-store-open-streams.js +33 -0
- package/dist/db/queries/event-store-payload-scrub.d.ts +5 -0
- package/dist/db/queries/event-store-payload-scrub.js +11 -0
- package/dist/db/queries/event-store.js +0 -1
- package/dist/db/queries/raw-sql.js +0 -1
- package/dist/db/queries/rebuild-rls-guard.d.ts +2 -1
- package/dist/db/queries/rebuild-rls-guard.js +24 -11
- package/dist/db/queries/rls-boot-catalog.d.ts +1 -0
- package/dist/db/queries/rls-boot-catalog.js +13 -8
- package/dist/db/queries/rls-shape.d.ts +2 -1
- package/dist/db/queries/rls-shape.js +10 -0
- package/dist/db/queries/session-advisory-lock.js +2 -1
- package/dist/db/queries/test-stack.js +7 -7
- package/dist/db/query.js +16 -11
- package/dist/db/rebuild-marker.js +11 -2
- package/dist/db/render-rls-ddl.d.ts +2 -0
- package/dist/db/render-rls-ddl.js +16 -11
- package/dist/db/replay-migration-sql.js +1 -1
- package/dist/db/row-level-security-boot-check.js +18 -5
- package/dist/db/row-level-security-connection.js +25 -12
- package/dist/db/row-level-security-scope.d.ts +2 -1
- package/dist/db/row-level-security-scope.js +9 -5
- package/dist/db/sql-identifier.d.ts +1 -0
- package/dist/db/sql-identifier.js +3 -0
- package/dist/db/system-tenant-read-db.d.ts +5 -0
- package/dist/db/system-tenant-read-db.js +28 -0
- package/dist/db/table-builder.d.ts +3 -1
- package/dist/db/table-builder.js +18 -8
- package/dist/db/table-info.d.ts +1 -2
- package/dist/db/table-introspection.d.ts +3 -0
- package/dist/db/table-introspection.js +6 -0
- package/dist/db/table-push.d.ts +1 -0
- package/dist/db/table-push.js +7 -1
- package/dist/db/tenant-db-runner.d.ts +3 -0
- package/dist/db/tenant-db-runner.js +19 -1
- package/dist/db/transaction-serialization.d.ts +1 -0
- package/dist/db/transaction-serialization.js +20 -3
- package/dist/db/where-clause.js +11 -2
- package/dist/db/write-ownership-failures.d.ts +25 -0
- package/dist/db/write-ownership-failures.js +82 -0
- package/dist/engine/boot-validator/boot-check.js +7 -1
- package/dist/engine/boot-validator/boot-phases-app.js +5 -5
- package/dist/engine/boot-validator/boot-phases.js +3 -2
- package/dist/engine/boot-validator/boot-rules.d.ts +293 -26
- package/dist/engine/boot-validator/boot-rules.js +4 -0
- package/dist/engine/boot-validator/bundled-lists-table.js +2 -2
- package/dist/engine/boot-validator/card-meta-overflow.js +1 -0
- package/dist/engine/boot-validator/config-deps.d.ts +0 -1
- package/dist/engine/boot-validator/config-deps.js +0 -28
- package/dist/engine/boot-validator/config-key-rules.d.ts +0 -15
- package/dist/engine/boot-validator/config-key-rules.js +0 -15
- package/dist/engine/boot-validator/dashboard-screen-target.d.ts +22 -0
- package/dist/engine/boot-validator/dashboard-screen-target.js +20 -0
- package/dist/engine/boot-validator/dashboard-stat-navigate.d.ts +1 -0
- package/dist/engine/boot-validator/dashboard-stat-navigate.js +25 -17
- package/dist/engine/boot-validator/definition-webhook-events-rules.d.ts +5 -0
- package/dist/engine/boot-validator/definition-webhook-events-rules.js +5 -0
- package/dist/engine/boot-validator/derived-sql-fields.js +1 -2
- package/dist/engine/boot-validator/entity-declaration-rules.d.ts +5 -0
- package/dist/engine/boot-validator/entity-declaration-rules.js +5 -0
- package/dist/engine/boot-validator/entity-list-screens.d.ts +1 -0
- package/dist/engine/boot-validator/entity-list-screens.js +33 -6
- package/dist/engine/boot-validator/entity-structure-rules.d.ts +5 -0
- package/dist/engine/boot-validator/entity-structure-rules.js +5 -0
- package/dist/engine/boot-validator/list-column-layout.js +10 -6
- package/dist/engine/boot-validator/list-row-guidance-rules.d.ts +67 -0
- package/dist/engine/boot-validator/list-row-guidance-rules.js +67 -0
- package/dist/engine/boot-validator/list-row-guidance.d.ts +20 -0
- package/dist/engine/boot-validator/list-row-guidance.js +129 -0
- package/dist/engine/boot-validator/list-sort-summary-rules.d.ts +42 -0
- package/dist/engine/boot-validator/list-sort-summary-rules.js +42 -0
- package/dist/engine/boot-validator/list-sort-summary.d.ts +5 -0
- package/dist/engine/boot-validator/list-sort-summary.js +149 -0
- package/dist/engine/boot-validator/list-table-options.js +15 -1
- package/dist/engine/boot-validator/list-table-rules.d.ts +10 -5
- package/dist/engine/boot-validator/list-table-rules.js +10 -5
- package/dist/engine/boot-validator/list-toolbar-options.d.ts +10 -0
- package/dist/engine/boot-validator/list-toolbar-options.js +31 -0
- package/dist/engine/boot-validator/named-filter-rules.d.ts +32 -2
- package/dist/engine/boot-validator/named-filter-rules.js +32 -2
- package/dist/engine/boot-validator/ownership.js +10 -1
- package/dist/engine/boot-validator/parent-ref.js +87 -50
- package/dist/engine/boot-validator/projection-list-screens.d.ts +1 -0
- package/dist/engine/boot-validator/projection-list-screens.js +31 -1
- package/dist/engine/boot-validator/query-output-columns.js +62 -9
- package/dist/engine/boot-validator/query-output-guidance.d.ts +7 -0
- package/dist/engine/boot-validator/query-output-guidance.js +39 -0
- package/dist/engine/boot-validator/query-refs.js +24 -1
- package/dist/engine/boot-validator/row-decoration.d.ts +11 -0
- package/dist/engine/boot-validator/row-decoration.js +16 -0
- package/dist/engine/boot-validator/screens-dashboard-links.d.ts +10 -0
- package/dist/engine/boot-validator/screens-dashboard-links.js +36 -0
- package/dist/engine/boot-validator/screens-dashboard-narrow.d.ts +4 -0
- package/dist/engine/boot-validator/screens-dashboard-narrow.js +211 -0
- package/dist/engine/boot-validator/screens-dashboard-rules.d.ts +84 -4
- package/dist/engine/boot-validator/screens-dashboard-rules.js +84 -4
- package/dist/engine/boot-validator/screens-dashboard.js +29 -7
- package/dist/engine/boot-validator/screens-kind-entity-list.js +32 -27
- package/dist/engine/boot-validator/screens-kind-projection-detail-guidance.d.ts +3 -0
- package/dist/engine/boot-validator/screens-kind-projection-detail-guidance.js +46 -0
- package/dist/engine/boot-validator/screens-kind-projection-detail-rules.d.ts +20 -0
- package/dist/engine/boot-validator/screens-kind-projection-detail-rules.js +20 -0
- package/dist/engine/boot-validator/screens-kind-projection-detail.js +2 -0
- package/dist/engine/boot-validator/screens-kind-projection-list.js +4 -0
- package/dist/engine/boot-validator/screens-kind-rules.d.ts +25 -0
- package/dist/engine/boot-validator/screens-kind-rules.js +25 -0
- package/dist/engine/boot-validator/screens-lists.d.ts +8 -2
- package/dist/engine/boot-validator/screens-lists.js +19 -3
- package/dist/engine/boot-validator/screens.js +1 -1
- package/dist/engine/boot-validator/sort-nulls.d.ts +2 -0
- package/dist/engine/boot-validator/sort-nulls.js +15 -0
- package/dist/engine/boot-validator/zod-shape.d.ts +2 -1
- package/dist/engine/boot-validator/zod-shape.js +19 -1
- package/dist/engine/build-app-schema.js +4 -0
- package/dist/engine/config-helpers.d.ts +1 -2
- package/dist/engine/config-helpers.js +6 -7
- package/dist/engine/define-feature.js +1 -0
- package/dist/engine/define-handler.d.ts +1 -0
- package/dist/engine/define-handler.js +4 -2
- package/dist/engine/definition-violations.js +2 -2
- package/dist/engine/entity-handlers.js +3 -8
- package/dist/engine/entity-list-runtime-options.js +9 -8
- package/dist/engine/factories.d.ts +2 -0
- package/dist/engine/feature-config-events-jobs.js +1 -0
- package/dist/engine/feature-entity-handlers.js +5 -2
- package/dist/engine/field-access.d.ts +1 -1
- package/dist/engine/field-access.js +7 -10
- package/dist/engine/find-entity.js +3 -3
- package/dist/engine/form-derivations.js +3 -3
- package/dist/engine/index.d.ts +3 -3
- package/dist/engine/index.js +2 -2
- package/dist/engine/named-filter-roles.d.ts +3 -0
- package/dist/engine/named-filter-roles.js +23 -0
- package/dist/engine/pipeline.js +0 -1
- package/dist/engine/project-app-schema-for-roles.js +17 -2
- package/dist/engine/qualified-name.js +0 -1
- package/dist/engine/registry-facade.js +1 -2
- package/dist/engine/registry-state.d.ts +1 -1
- package/dist/engine/registry-state.js +5 -2
- package/dist/engine/registry-validate.d.ts +1 -0
- package/dist/engine/registry-validate.js +9 -1
- package/dist/engine/registry.js +2 -1
- package/dist/engine/resolve-named-list-filters.js +5 -2
- package/dist/engine/schema-builder.js +6 -10
- package/dist/engine/screen-helpers.d.ts +12 -0
- package/dist/engine/screen-helpers.js +17 -1
- package/dist/engine/soft-delete-cleanup.js +5 -8
- package/dist/engine/state-machine.js +0 -1
- package/dist/engine/steps/_database-clock.d.ts +2 -0
- package/dist/engine/steps/_database-clock.js +6 -0
- package/dist/engine/steps/compute.js +1 -1
- package/dist/engine/steps/retry.js +5 -1
- package/dist/engine/steps/return.js +0 -1
- package/dist/engine/steps/wait-for-event.js +2 -1
- package/dist/engine/steps/wait.js +2 -1
- package/dist/engine/system-user.d.ts +2 -2
- package/dist/engine/system-user.js +2 -2
- package/dist/engine/types/handlers.d.ts +1 -1
- package/dist/engine/types/handlers.js +1 -1
- package/dist/engine/types/screen.d.ts +1 -1
- package/dist/engine/types/screen.js +1 -1
- package/dist/engine/webhook-contracts.d.ts +2 -3
- package/dist/engine/webhook-contracts.js +2 -25
- package/dist/engine/webhook-events.js +48 -29
- package/dist/engine/webhook-payload-strictness.d.ts +7 -0
- package/dist/engine/webhook-payload-strictness.js +53 -0
- package/dist/env/_zod-introspect.d.ts +1 -0
- package/dist/env/dry-run.d.ts +1 -1
- package/dist/env/dry-run.js +1 -1
- package/dist/env/field-meta.d.ts +4 -0
- package/dist/env/field-meta.js +67 -0
- package/dist/env/field-rules.d.ts +9 -0
- package/dist/env/field-rules.js +46 -0
- package/dist/env/index.d.ts +3 -3
- package/dist/env/index.js +16 -71
- package/dist/env/internals.d.ts +3 -0
- package/dist/env/internals.js +1 -2
- package/dist/env/required-env.d.ts +3 -1
- package/dist/env/required-env.js +5 -2
- package/dist/errors/serialize.js +2 -2
- package/dist/errors/write-error-info.js +0 -2
- package/dist/es-ops/operations-schema.js +18 -7
- package/dist/event-store/admin-api.js +3 -3
- package/dist/event-store/event-store.js +0 -3
- package/dist/event-store/index.d.ts +1 -0
- package/dist/event-store/index.js +1 -0
- package/dist/event-store/transfer.js +1 -1
- package/dist/files/assert-file-refs-belong-to-tenant.d.ts +2 -1
- package/dist/files/assert-file-refs-belong-to-tenant.js +15 -13
- package/dist/files/bind-pending-file-refs.d.ts +3 -1
- package/dist/files/bind-pending-file-refs.js +54 -27
- package/dist/files/copy-pending-file-refs-to-tenant.js +7 -3
- package/dist/files/create-file-ref.d.ts +4 -1
- package/dist/files/create-file-ref.js +14 -3
- package/dist/files/default-file-guard.js +4 -1
- package/dist/files/feature.js +1 -0
- package/dist/files/file-claim.d.ts +6 -0
- package/dist/files/file-claim.js +17 -0
- package/dist/files/file-field-slots.d.ts +2 -0
- package/dist/files/file-field-slots.js +28 -0
- package/dist/files/file-ref-entity.d.ts +3 -0
- package/dist/files/file-ref-entity.js +2 -0
- package/dist/files/file-ref-table.d.ts +3 -0
- package/dist/files/file-routes.d.ts +4 -1
- package/dist/files/file-routes.js +80 -16
- package/dist/files/in-memory-provider.d.ts +1 -1
- package/dist/files/in-memory-provider.js +2 -1
- package/dist/files/index.d.ts +1 -1
- package/dist/files/index.js +1 -1
- package/dist/files/invalid-file-ref-error.d.ts +2 -0
- package/dist/files/invalid-file-ref-error.js +15 -0
- package/dist/files/local-provider.js +9 -2
- package/dist/files/provider-resolver.js +1 -1
- package/dist/files/rebind-file-ref.d.ts +3 -2
- package/dist/files/rebind-file-ref.js +24 -18
- package/dist/files/resolve-file-handles.d.ts +13 -0
- package/dist/files/resolve-file-handles.js +57 -0
- package/dist/files/storage-tracking.d.ts +1 -1
- package/dist/files/storage-tracking.js +5 -2
- package/dist/files/sweep-stale-pending-file-refs.js +10 -4
- package/dist/files/types.d.ts +4 -0
- package/dist/files/types.js +10 -0
- package/dist/files/upload-field-resolution.d.ts +1 -0
- package/dist/files/upload-field-resolution.js +16 -2
- package/dist/files/upload-ledger.js +1 -1
- package/dist/i18n/required-surface-guidance-keys.d.ts +3 -0
- package/dist/i18n/required-surface-guidance-keys.js +9 -0
- package/dist/i18n/required-surface-keys.js +19 -4
- package/dist/internal/boot-rule-table-expectations.d.ts +2 -0
- package/dist/internal/boot-rule-table-expectations.js +29 -0
- package/dist/internal/row-level-security.d.ts +1 -0
- package/dist/internal/row-level-security.js +1 -0
- package/dist/internal/testing.d.ts +1 -0
- package/dist/internal/testing.js +1 -0
- package/dist/jobs/index.d.ts +1 -0
- package/dist/jobs/index.js +1 -0
- package/dist/jobs/job-load-events.d.ts +10 -0
- package/dist/jobs/job-load-events.js +12 -0
- package/dist/jobs/job-runner-context.js +6 -158
- package/dist/jobs/job-runner-dispatch.d.ts +7 -0
- package/dist/jobs/job-runner-dispatch.js +57 -0
- package/dist/jobs/job-runner-event-triggers.js +18 -9
- package/dist/jobs/job-runner-execution.js +2 -2
- package/dist/jobs/job-runner-facets.d.ts +48 -0
- package/dist/jobs/job-runner-facets.js +156 -0
- package/dist/jobs/job-runner-gates.js +24 -12
- package/dist/jobs/job-runner-helpers.d.ts +5 -1
- package/dist/jobs/job-runner-helpers.js +18 -3
- package/dist/jobs/job-runner-scope.d.ts +1 -0
- package/dist/jobs/job-runner-scope.js +2 -0
- package/dist/jobs/job-runner-tenant-cap-lock.d.ts +2 -0
- package/dist/jobs/job-runner-tenant-cap-lock.js +30 -0
- package/dist/jobs/job-runner.js +31 -70
- package/dist/jobs/obliterate-job-queues.d.ts +6 -0
- package/dist/jobs/obliterate-job-queues.js +23 -0
- package/dist/lifecycle/lifecycle.js +1 -1
- package/dist/migrations/event-header-scrub.d.ts +11 -0
- package/dist/migrations/event-header-scrub.js +33 -0
- package/dist/migrations/event-payload-scrub.d.ts +1 -1
- package/dist/migrations/event-payload-scrub.js +36 -4
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.js +2 -0
- package/dist/migrations/kumiko-drift.d.ts +5 -2
- package/dist/migrations/kumiko-drift.js +51 -14
- package/dist/migrations/pending-rebuilds.js +4 -5
- package/dist/observability/sensitive-filter.js +0 -12
- package/dist/pipeline/aggregate-type-removal.js +17 -4
- package/dist/pipeline/context-services.d.ts +2 -0
- package/dist/pipeline/context-services.js +5 -2
- package/dist/pipeline/dispatch-batch.js +4 -3
- package/dist/pipeline/dispatch-context-helpers.d.ts +11 -0
- package/dist/pipeline/dispatch-context-helpers.js +58 -0
- package/dist/pipeline/dispatch-nested-write.d.ts +7 -0
- package/dist/pipeline/dispatch-nested-write.js +119 -0
- package/dist/pipeline/dispatch-query.js +10 -3
- package/dist/pipeline/dispatch-scope.js +4 -3
- package/dist/pipeline/dispatch-shared.d.ts +2 -6
- package/dist/pipeline/dispatch-shared.js +6 -38
- package/dist/pipeline/dispatch-write.d.ts +0 -1
- package/dist/pipeline/dispatch-write.js +3 -302
- package/dist/pipeline/dispatcher-utils.js +6 -0
- package/dist/pipeline/effective-system-scope.d.ts +3 -0
- package/dist/pipeline/effective-system-scope.js +22 -0
- package/dist/pipeline/event-dispatcher-delivery.d.ts +1 -0
- package/dist/pipeline/event-dispatcher-delivery.js +17 -9
- package/dist/pipeline/event-dispatcher.d.ts +4 -1
- package/dist/pipeline/event-dispatcher.js +6 -7
- package/dist/pipeline/handler-context-auth.d.ts +3 -2
- package/dist/pipeline/handler-context-auth.js +3 -4
- package/dist/pipeline/handler-context-db.js +11 -4
- package/dist/pipeline/handler-context-dispatch.js +2 -2
- package/dist/pipeline/handler-context-events.d.ts +8 -3
- package/dist/pipeline/handler-context-events.js +20 -65
- package/dist/pipeline/handler-context-member-resolution.js +16 -8
- package/dist/pipeline/handler-context-notify.d.ts +1 -0
- package/dist/pipeline/handler-context-notify.js +2 -0
- package/dist/pipeline/handler-context-phase-denials.js +3 -2
- package/dist/pipeline/handler-context-projection.d.ts +3 -0
- package/dist/pipeline/handler-context-projection.js +39 -0
- package/dist/pipeline/handler-context-scope.d.ts +1 -1
- package/dist/pipeline/handler-context-scope.js +14 -2
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.js +1 -1
- package/dist/pipeline/lifecycle-pipeline.d.ts +1 -0
- package/dist/pipeline/lifecycle-pipeline.js +7 -4
- package/dist/pipeline/member-reader.js +4 -2
- package/dist/pipeline/msp-rebuild.js +1 -1
- package/dist/pipeline/nested-write-parent-guard.d.ts +5 -0
- package/dist/pipeline/nested-write-parent-guard.js +81 -0
- package/dist/pipeline/projection-rebuild.d.ts +2 -0
- package/dist/pipeline/projection-rebuild.js +16 -7
- package/dist/pipeline/projection-state.js +4 -6
- package/dist/pipeline/system-hooks.js +36 -6
- package/dist/pipeline/write-result-masking.js +31 -3
- package/dist/pipeline/write-transition-guard.d.ts +7 -0
- package/dist/pipeline/write-transition-guard.js +95 -0
- package/dist/schema-cli/shared.d.ts +2 -0
- package/dist/schema-cli/shared.js +4 -2
- package/dist/schema-cli/validate-command.js +43 -28
- package/dist/search/meilisearch-adapter.js +14 -9
- package/dist/search/reindex-entity.d.ts +2 -0
- package/dist/search/reindex-entity.js +32 -4
- package/dist/search/reindex-tenants-search.js +20 -4
- package/dist/time/tz-context.js +1 -1
- package/dist/ui-types/card-column-roles.d.ts +4 -0
- package/dist/ui-types/card-column-roles.js +6 -3
- package/dist/ui-types/index.d.ts +2 -2
- package/dist/ui-types/index.js +1 -1
- package/dist/utils/ids.js +0 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +1 -0
- package/dist/utils/return-path-limit.d.ts +1 -0
- package/dist/utils/return-path-limit.js +1 -0
- package/package.json +5 -3
- package/presets/biome-app.json +39 -21
- package/presets/biome-plugins/admin-api.grit +10 -0
- package/presets/biome-plugins/error-reasons.grit +53 -0
- package/presets/biome-plugins/es-literal-writes-tests.grit +18 -0
- package/presets/biome-plugins/es-literal-writes.grit +22 -0
- package/presets/biome-plugins/i18n-locale-terminology-de.grit +15 -0
- package/presets/biome-plugins/i18n-locale-terminology-romance.grit +10 -0
- package/presets/biome-plugins/no-create-test-dispatcher.grit +5 -0
- package/presets/biome-plugins/no-css-properties-type.grit +7 -0
- package/presets/biome-plugins/no-date-api.grit +9 -0
- package/presets/biome-plugins/no-direct-fetch.grit +16 -0
- package/presets/biome-plugins/no-direct-fs.grit +16 -0
- package/presets/biome-plugins/no-external-font-cdn-css.grit +9 -0
- package/presets/biome-plugins/no-external-font-cdn.grit +12 -0
- package/presets/biome-plugins/no-raw-hooks.grit +10 -0
- package/presets/biome-plugins/no-same-folder-barrel-import.grit +11 -0
- package/presets/biome-plugins/no-screen-container-classes.grit +7 -0
- package/presets/biome-plugins/no-skipped-or-retried-tests.grit +34 -0
- package/presets/biome-plugins/no-temporal-polyfill-require.grit +10 -0
- package/presets/biome-plugins/raw-html-in-web.grit +40 -0
- package/presets/biome-plugins/raw-ui-in-app.grit +142 -0
- package/presets/biome-plugins/restricted-event-store-symbols.grit +18 -0
- package/presets/biome-plugins/test-title.grit +20 -0
- package/presets/biome-plugins/unsafe-json-parse.grit +6 -0
- package/presets/biome-rules.json +465 -0
- package/src/changes.json +309 -0
- package/dist/engine/minor-units.d.ts +0 -2
- package/dist/engine/minor-units.js +0 -8
package/AGENTS.md
CHANGED
|
@@ -210,8 +210,11 @@ produces code that compiles and then fails in production.
|
|
|
210
210
|
handler: `r.crud`, the `defineEntity*Handler` helpers, the executor from
|
|
211
211
|
`createEntityExecutor`, or `emitEvent` / `ctx.events.append`. The query
|
|
212
212
|
helpers and `ctx.db` throw `AccessDeniedError` on such a write, also
|
|
213
|
-
through `ctx.db.unsafeRaw()`. Test seeds
|
|
214
|
-
|
|
213
|
+
through `ctx.db.unsafeRaw()`. Test seeds on an entity table use
|
|
214
|
+
`seedRowViaEventStore` / `seedRowsViaEventStore` from
|
|
215
|
+
`@cosmicdrift/kumiko-testing/helpers`; `seedRow` is for tables without
|
|
216
|
+
event sourcing and throws on an entity table unless the test passes
|
|
217
|
+
`{ projectionOnly: "<why>" }`.
|
|
215
218
|
- Never store a value that can be computed. Derive it in a query or a
|
|
216
219
|
projection.
|
|
217
220
|
- Never hand-write SQL for reads that an executor `list` or `detail` covers.
|
|
@@ -68,7 +68,7 @@ function entityTableFromRegistry(registry: Registry, entityName: string, entity:
|
|
|
68
68
|
function enumerateFeatureTableSources(feature: FeatureDefinition): FeatureTableSource[];
|
|
69
69
|
function executeRawQuery<T = Record<string, unknown>>(db: AnyDb, sqlText: string, params?: unknown[]): Promise<T[]>; // Escape hatch for caller-built SQL that may write (or lock).
|
|
70
70
|
function extractPgError(e: unknown): PgErrorInfo | null;
|
|
71
|
-
function extractTableInfo(table:
|
|
71
|
+
function extractTableInfo(table: unknown): TableInfo;
|
|
72
72
|
function extractTableName(table: unknown, context?): string; // Reads the `kumiko:schema:Name` symbol from a table object.
|
|
73
73
|
function fetchOne<TRow = AnyRow>(db: AnyDb, table: TableLike, where: WhereObject): Promise<TRow | undefined>;
|
|
74
74
|
function generateMigration(input: GenerateMigrationInput): GenerateMigrationOutput;
|
|
@@ -100,6 +100,7 @@ function insertOne<TRow = AnyRow>(db: ExecutorManagedWriteCapability, table: Ent
|
|
|
100
100
|
function instant(name: string, opts?: { precision?: 0 | 1 | 2 | 3 | 4 | 5 | 6; }): ColumnBuilder<Temporal.Instant>;
|
|
101
101
|
function instantToTimestamptzParam(instant: Temporal.Instant): string;
|
|
102
102
|
function integer(name: string): ColumnBuilder<number>;
|
|
103
|
+
function isSchemaTable(value: unknown): value is SchemaTable; // True for tables built by table(): all three identity slots are present and well-formed.
|
|
103
104
|
function isTimestamptzType(pgType: string | undefined): boolean;
|
|
104
105
|
function isUndefinedTable(e: unknown): boolean;
|
|
105
106
|
function isUniqueViolation(e: unknown): boolean;
|
|
@@ -108,9 +109,11 @@ function knownTablesOf(features: FeatureDefinition[]): KnownTables;
|
|
|
108
109
|
function listEventTenantIds(db: AnyDb): Promise<string[]>;
|
|
109
110
|
function loadSnapshotJson(path: string): Snapshot | null;
|
|
110
111
|
function nullBlindIndexesForSubject(db: DbRunner, features: ReadonlyMap<string, FeatureDefinition>, subjectKey: string): Promise<void>;
|
|
112
|
+
function outsideRowLevelSecurityScope<T>(fn: () => T): T;
|
|
111
113
|
function outsideTransactionPoolOptionsFromEnv(env?: Readonly<Record<string, string | undefined>>): DbConnectionOptions;
|
|
112
|
-
function physicalColumnName(table:
|
|
114
|
+
function physicalColumnName(table: SchemaTable, field: string): string;
|
|
113
115
|
function primaryKey(opts: { columns: ColumnHandle[]; name?: string; }): PrimaryKeyDescriptor;
|
|
116
|
+
function queryDatabaseNow(runner: AnyDb): Promise<Date>;
|
|
114
117
|
function readDatabaseNow(db: TenantDb): Promise<Date>; // Postgres clock; inside a transaction `now()` is the transaction start, so repeated reads agree.
|
|
115
118
|
function recordEventsOwnedExclusivelyByTenant(db: DbRunner, aggregateType: string, aggregateId: string, tenantId: string): Promise<boolean>;
|
|
116
119
|
function recordRowExistsInTenant(db: DbRunner, features: ReadonlyMap<string, FeatureDefinition>, entityName: string, recordId: string, tenantId: string): Promise<boolean>;
|
|
@@ -137,6 +140,11 @@ function serial(name: string): ColumnBuilder<number>;
|
|
|
137
140
|
function serverTimeoutOptionsFromEnv(env?: Readonly<Record<string, string | undefined>>): DbConnectionOptions;
|
|
138
141
|
function sql(strings: TemplateStringsArray, ...values: unknown[]): SqlExpression;
|
|
139
142
|
function subjectRowExistsInTenant(db: DbRunner, features: ReadonlyMap<string, FeatureDefinition>, subjectId: string, tenantId: string): Promise<boolean>;
|
|
143
|
+
function table<TCols extends ColumnMap>(tableName: `read_${string}`, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): SchemaTable;
|
|
144
|
+
function table<TCols extends ColumnMap>(tableName: string, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): WritableSchemaTable;
|
|
145
|
+
function table<TCols extends ColumnMap>(tableName: `read_${string}`, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): SchemaTable;
|
|
146
|
+
function table<TCols extends ColumnMap>(tableName: string, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): WritableSchemaTable;
|
|
147
|
+
function table<TCols extends ColumnMap>(tableName: `read_${string}`, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): SchemaTable;
|
|
140
148
|
function table<TCols extends ColumnMap>(tableName: string, cols: TCols, optsFn?: (t: { [K in keyof TCols]: ColumnHandle; }) => Record<string, IndexOrPk> | ReadonlyArray<IndexOrPk>): WritableSchemaTable;
|
|
141
149
|
function tableExists(db: DbConnection | DbTx, fullyQualifiedName: string): Promise<boolean>;
|
|
142
150
|
function text(name: string): ColumnBuilder<string>;
|
|
@@ -172,6 +180,7 @@ function writeSnapshotJson(path: string, snapshot: Snapshot): void;
|
|
|
172
180
|
## Constants
|
|
173
181
|
|
|
174
182
|
```ts
|
|
183
|
+
const BUN_SQL_CONNECTION_ERROR_CODES: string[];
|
|
175
184
|
const DEFAULT_OUTSIDE_TRANSACTION_POOL_MAX: 3;
|
|
176
185
|
const ROW_LEVEL_SECURITY_MODES: ["off", "on"];
|
|
177
186
|
const WritePurposes: { retention: "retention"; erasure: "erasure"; };
|
|
@@ -202,11 +211,12 @@ type EntityTableMeta = {
|
|
|
202
211
|
source: "managed" | "unmanaged";
|
|
203
212
|
piiSubjectFields?: string[];
|
|
204
213
|
tenancy?: "global";
|
|
214
|
+
systemRowsReadable?: true;
|
|
205
215
|
};
|
|
206
216
|
type EventStoreExecutor<Row extends Record<string, unknown> = Record<string, unknown>> = {
|
|
207
217
|
create: (payload: Record<string, unknown>, user: SessionUser, db: TenantDb, options?: StreamTenantOption & { preSave?: PreSaveRunner; }) => Promise<WriteResult<SaveContext>>;
|
|
208
218
|
update: (payload: { id: EntityId; version?: number | undefined; changes: Record<string, unknown>; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & LockGuardOption & ParentVisibilityGateOption & { skipOptimisticLock?: boolean; ski…;
|
|
209
|
-
delete: (payload: { id: EntityId; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & LockGuardOption & ParentVisibilityGateOption) => Promise<WriteResult<
|
|
219
|
+
delete: (payload: { id: EntityId; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & LockGuardOption & ParentVisibilityGateOption & { expect?: Readonly<Record<string, string | number | boolean | null>>; }) => Promise<WriteResult<De…;
|
|
210
220
|
forget: (payload: { id: EntityId; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & ParentVisibilityGateOption) => Promise<WriteResult<DeleteContext>>;
|
|
211
221
|
restore: (payload: { id: EntityId; }, user: SessionUser, db: TenantDb, options?: StreamTenantOption & ParentVisibilityGateOption) => Promise<WriteResult<SaveContext>>;
|
|
212
222
|
list: (payload: { cursor?: string | undefined; limit?: number | undefined; search?: string | undefined; sort?: string | undefined; sortDirection?: "asc" | "desc" | undefined; offset?: number | undefined; totalCount?: boolean | undefined; filter?…;
|
|
@@ -221,6 +231,7 @@ type JsonTextMatch = {
|
|
|
221
231
|
};
|
|
222
232
|
type KnownTables = {
|
|
223
233
|
has: (tableName: string) => boolean;
|
|
234
|
+
readsSystemRows: (tableName: string) => boolean;
|
|
224
235
|
};
|
|
225
236
|
type MoneyRead = { // Shape of a single rehydrated money field — {amount major, currency, amountScaled exact integer value in MINOR_UNIT_SCALE units}.
|
|
226
237
|
amount: number;
|
|
@@ -35,7 +35,7 @@ function createDecimalField<R extends true | false = false>(config: { precision:
|
|
|
35
35
|
function createDerivedField(spec: DerivedFieldDef): DerivedFieldDef; // Read-time computed field for `EntityDefinition.derivedFields` (NOT `fields`), never persisted.
|
|
36
36
|
function createEmbeddedField(schema: EmbeddedFieldDef["schema"], overrides?: Partial<Omit<EmbeddedFieldDef, "type" | "schema" | keyof ResolvedPiiFlags>> & PersonalAnnotationsNoFind): EmbeddedFieldDef;
|
|
37
37
|
function createEmbeddedListField(schema: EmbeddedFieldDef["schema"], overrides?: Partial<Omit<EmbeddedFieldDef, "type" | "schema" | "multiple" | keyof ResolvedPiiFlags>> & PersonalAnnotationsNoFind): EmbeddedFieldDef & { multiple: true; };
|
|
38
|
-
function createEntity<const F, const T extends EntityTenancy = "tenant">(def: { table?: string; fields: F; description?: string; softDelete?: boolean; systemStream?: boolean; webhookEvents?: boolean; eventVersion?: number; eventMigrations?: EntityDefinition["eventMigrations"]; searchWeight?: number; defaultCurrency?: string; transitions?: Readonly<Record<string, Readonly<Record<string, string[]>>>>; lockedWhen?: EntityDefinition["lockedWhen"]; indexes?: EntityIndexDef[]; idType?: "serial" | "uuid"; access?: EntityDefinition["access"]; parentRef?: EntityDefinition["parentRef"]; readGate?: EntityDefinition["readGate"]; retention?: RetentionDef; derivedFields?: EntityDefinition["derivedFields"]; namedFilters?: EntityDefinition["namedFilters"]; tenancy?: T; transferable?: boolean; attachedFileAccess?: EntityDefinition["attachedFileAccess"]; }): F extends FieldsMap ? EntityDefinition<F, T> : never;
|
|
38
|
+
function createEntity<const F, const T extends EntityTenancy = "tenant">(def: { table?: string; fields: F; description?: string; softDelete?: boolean; systemStream?: boolean; systemRowsReadable?: boolean; webhookEvents?: boolean; eventVersion?: number; eventMigrations?: EntityDefinition["eventMigrations"]; searchWeight?: number; defaultCurrency?: string; transitions?: Readonly<Record<string, Readonly<Record<string, string[]>>>>; lockedWhen?: EntityDefinition["lockedWhen"]; indexes?: EntityIndexDef[]; idType?: "serial" | "uuid"; access?: EntityDefinition["access"]; parentRef?: EntityDefinition["parentRef"]; readGate?: EntityDefinition["readGate"]; retention?: RetentionDef; derivedFields?: EntityDefinition["derivedFields"]; namedFilters?: EntityDefinition["namedFilters"]; tenancy?: T; transferable?: boolean; attachedFileAccess?: EntityDefinition["attachedFileAccess"]; }): F extends FieldsMap ? EntityDefinition<F, T> : never;
|
|
39
39
|
function createEntityExecutor<E extends EntityDefinition>(entityName: string, entity: E): { table: EntityTable; executor: EventStoreExecutor<EntityRow<E>>; };
|
|
40
40
|
function createFileField(overrides?: Partial<Omit<FileFieldDef, "type" | keyof ResolvedPiiFlags>> & PersonalAnnotationsNoFind): FileFieldDef;
|
|
41
41
|
function createFilesField(overrides?: Partial<Omit<FilesFieldDef, "type" | keyof ResolvedPiiFlags>> & PersonalAnnotationsNoFind): FilesFieldDef;
|
|
@@ -117,6 +117,7 @@ function isTenantDataExtensionHooks(o: unknown): o is TenantDataExtensionHooks;
|
|
|
117
117
|
function isTenantResourceExtensionHooks(o: unknown): o is TenantResourceExtensionHooks;
|
|
118
118
|
function isTierResolverPlugin(v: unknown): v is TierResolverPlugin; // Narrows a registration's untyped `options` bag to the tier-resolver plugin shape — the only thing every implementation must provide is the `build` factory.
|
|
119
119
|
function isToggleableFeature(feature: FeatureDefinition): feature is FeatureDefinition & { toggleableDefault: boolean; };
|
|
120
|
+
function isUnchangedValue(a: unknown, b: unknown): boolean;
|
|
120
121
|
function isUuid(value: unknown): value is string;
|
|
121
122
|
function isValidQn(value: string): boolean;
|
|
122
123
|
function maskWriteOnlyFields<T extends Readonly<Record<string, unknown>>>(entity: EntityDefinition, row: T): T;
|
|
@@ -146,6 +147,7 @@ function resolveEntityTransferAdjacency(entities: ReadonlyMap<string, EntityDefi
|
|
|
146
147
|
function resolveNamedListFilters(ctx: HandlerContext, user: SessionUser, entityName: string, name: string): Promise<NamedListFilterCondition[]>;
|
|
147
148
|
function runPipeline<TPayload, TData, TMap extends object = KumikoEventTypeMap>(pipelineDef: PipelineDef<TPayload, TData>, event: WriteEvent<TPayload>, handlerCtx: HandlerContext<TMap>, workflow?: PipelineCtx["workflow"], resumeFrom?: number): Promise<WriteResult<TData>>;
|
|
148
149
|
function runStepList<TPayload, TMap extends object = KumikoEventTypeMap>(steps: StepInstance[], event: WriteEvent<TPayload>, handlerCtx: HandlerContext<TMap>, stepsAcc: Record<string, unknown>, scopeAcc: Record<string, unknown>, workflow?: PipelineCtx["workflow"], resumeFrom?: number): Promise<StepListOutcome>; // Walk a step-list.
|
|
150
|
+
function screenShortId(ref: string): string;
|
|
149
151
|
function sectionFieldSpecs(section: FieldsOrGroupsSection): EditFieldSpec[];
|
|
150
152
|
function selectablePluginIds(registry: Pick<Registry, "getExtensionUsages">, extensionName: string): string[];
|
|
151
153
|
function serializeManifest(manifest: FeatureManifest): string;
|
|
@@ -223,6 +225,7 @@ const SYSTEM_USER_ID: "00000000-0000-0000-0000-000000000000";
|
|
|
223
225
|
const TENANT_CURRENCY_CONFIG_KEY: "tenant-settings:config:currency"; // Qualified config key a `{ kind: "tenant" }` MoneyCurrencySource resolves against — the tenant-settings bundle's per-tenant currency.
|
|
224
226
|
const TENANT_MEMBERSHIPS_QUERY: "tenant:query:memberships";
|
|
225
227
|
const TENANT_TIER_RESOLVER_EXT: "tenantTierResolver"; // Extension name under which a tier-resolver plugin must be registered in the registry.
|
|
228
|
+
const WEBHOOK_ENTITY_VERBS: WebhookEntityVerb[];
|
|
226
229
|
const WORKFLOW_AGGREGATE_TYPE: "workflow-run";
|
|
227
230
|
const WORKFLOW_RESUMED_TYPE: "kumiko:system:workflow.step.resumed";
|
|
228
231
|
const WORKFLOW_RETRY_SCHEDULED_TYPE: "kumiko:system:workflow.retry.scheduled";
|
|
@@ -232,7 +235,7 @@ const WORKFLOW_RUN_STARTED_TYPE: "kumiko:system:workflow.run-started";
|
|
|
232
235
|
const WORKFLOW_SYSTEM_EVENT_DEFS: ReadonlyMap<string, EventDef>;
|
|
233
236
|
const WORKFLOW_WAITING_FOR_EVENT_TYPE: "kumiko:system:workflow.step.waiting-for-event";
|
|
234
237
|
const WORKFLOW_WAITING_TYPE: "kumiko:system:workflow.step.waiting";
|
|
235
|
-
const access: { all; admin; systemAdmin; system; privileged;
|
|
238
|
+
const access: { all; admin; systemAdmin; system; privileged; builtinUserRoles; anonymous; roles; withSystem };
|
|
236
239
|
const entityListSchema;
|
|
237
240
|
const templateVariable: { text; link; richText; money; date; percent; images; list };
|
|
238
241
|
```
|
|
@@ -314,7 +317,7 @@ type AppContext = SharedContextFields & {
|
|
|
314
317
|
systemUser?: SessionUser;
|
|
315
318
|
log?: Logger;
|
|
316
319
|
triggeredBy?: { id: string; tenantId: TenantId; } | null;
|
|
317
|
-
triggerName?: string; // For job-handler calls triggered by an
|
|
320
|
+
triggerName?: string; // For job-handler calls triggered by an `on` entry (`r.job` with `trigger: { on: ...
|
|
318
321
|
geoTzProvider?: GeoTzProvider; // Optional Geo→zone adapter.
|
|
319
322
|
clock?: Clock; // Overrides the system clock behind ctx.tz in handlers and jobs; tests inject a fixed time.
|
|
320
323
|
_tenantId?: TenantId; // Tenant of the current pipeline call.
|
|
@@ -428,7 +431,6 @@ type ConfigKeyDefinition<T extends ConfigKeyType = ConfigKeyType> = {
|
|
|
428
431
|
};
|
|
429
432
|
computed?: ConfigComputedFn<T>;
|
|
430
433
|
validate?: ConfigValidateFn<T>;
|
|
431
|
-
allowPerRequest?: boolean;
|
|
432
434
|
required?: boolean;
|
|
433
435
|
env?: string;
|
|
434
436
|
inheritedToTenant?: boolean;
|
|
@@ -478,10 +480,11 @@ type ContentCollectionDefinition = {
|
|
|
478
480
|
actions?: TreeAction[];
|
|
479
481
|
};
|
|
480
482
|
};
|
|
481
|
-
type DashboardCustomPanel = {
|
|
483
|
+
type DashboardCustomPanel = DashboardPanelNarrow & {
|
|
482
484
|
kind: "custom";
|
|
483
485
|
id: string;
|
|
484
486
|
component: PlatformComponent;
|
|
487
|
+
span?: DashboardPanelSpan; // Grid width like the other panels; default is the full row.
|
|
485
488
|
params?: Readonly<Record<string, unknown>>; // Static author values laid over the screen's filterParams, like `DashboardPanelQueryOptions.params`; the panel wins on a name clash.
|
|
486
489
|
};
|
|
487
490
|
type DashboardI18nText = { // Text a query handler can send untranslated: the renderer translates it.
|
|
@@ -496,6 +499,16 @@ type DeleteContext = {
|
|
|
496
499
|
event: StoredEvent;
|
|
497
500
|
lockGuardBypassed?: boolean | undefined;
|
|
498
501
|
};
|
|
502
|
+
type DeliveryAttemptLogEntry = {
|
|
503
|
+
notificationType: string;
|
|
504
|
+
channel: string;
|
|
505
|
+
recipientAddress: string | null;
|
|
506
|
+
status: NotifyDeliveryStatus;
|
|
507
|
+
error: DeliveryErrorCode | null;
|
|
508
|
+
priority: NotifyPriority;
|
|
509
|
+
};
|
|
510
|
+
type DeliveryAttemptLogFactory = (user: SessionUser, tenantId: TenantId, deliveryDb?: DbConnection) => DeliveryAttemptLogFn;
|
|
511
|
+
type DeliveryAttemptLogFn = (entry: DeliveryAttemptLogEntry) => Promise<void>;
|
|
499
512
|
type DeliveryErrorCode = DeliveryFailureCode | DeliverySkipReason | `http_${number}`;
|
|
500
513
|
type DeliveryFailureCode = (typeof DELIVERY_FAILURE_CODES)[number];
|
|
501
514
|
type DeliverySkipReason = (typeof DELIVERY_SKIP_REASONS)[number];
|
|
@@ -567,6 +580,7 @@ type EntityDefinition<F extends FieldsMap = FieldsMap, T extends EntityTenancy =
|
|
|
567
580
|
softDelete?: boolean;
|
|
568
581
|
tenancy?: T; // "tenant" (default): auto-filtered by every db accessor.
|
|
569
582
|
systemStream?: boolean; // This aggregate's event stream lives on SYSTEM_TENANT_ID rather than the creator's tenant.
|
|
583
|
+
systemRowsReadable?: boolean; // Tenant sessions may read this entity's SYSTEM_TENANT_ID rows (shared templates, config defaults, catalogs).
|
|
570
584
|
webhookEvents?: boolean; // Lets token scopes release `<entity>.created/.updated/.deleted` as webhook events.
|
|
571
585
|
eventVersion?: number; // Schema version stamped on every lifecycle event (default 1, integer 1..999).
|
|
572
586
|
eventMigrations?: EntityEventMigration[]; // One step per version, fromVersion → fromVersion+1.
|
|
@@ -604,6 +618,7 @@ type EntityEditScreenDefinition = {
|
|
|
604
618
|
writeExcludedFields?: EntityWriteExcludedFields; // Derived by buildAppSchema from the entity's create/update write handlers (`excludeFields`): create hides these fields, update shows them read-only.
|
|
605
619
|
entity: string;
|
|
606
620
|
recordTitleField?: string; // Entity field whose value names the loaded record in the header breadcrumb (edit mode only).
|
|
621
|
+
focus?: boolean; // Focused shell while the record is open: the app header actions leave the shell header, and on phones a top bar with the record title, a back arrow to the parent list and the page-header overflow menu replaces it.
|
|
607
622
|
titleTemplate?: string; // Screen title (i18n key) with `{field}` placeholders filled from the current form values, so the title follows what the user types (create wizard: "Add {make} {model}").
|
|
608
623
|
readOnly?: FieldCondition; // Shows a saved record read-only while the condition holds for the loaded record (not for unsaved form values): all fields disabled, no save, discard or delete button; record `actions` stay.
|
|
609
624
|
layout: EditLayout;
|
|
@@ -635,8 +650,9 @@ type EntityListScreenDefinition = {
|
|
|
635
650
|
createUnavailable?: boolean; // Set by the role projection when `createScreen` is not reachable for the role: the renderer then shows no create button instead of falling back to the entity's edit screen.
|
|
636
651
|
allowCreate?: boolean; // `false` hides this list's "+ New" button (and the empty-state create CTA) while the entity's edit screen keeps its create branch for other entry points, e.g. a prefilled action.
|
|
637
652
|
columns: ListColumnSpec[];
|
|
653
|
+
rowToneField?: string; // Row field holding a SelectOptionTone; the row is toned like relatedList `rowTone`, other values leave it untoned.
|
|
654
|
+
rowDecoration?: ListRowDecoration; // Computed row fields from an app query, readable by `rowToneField`, column `hint`, `linkScreenField`/`linkParamsField` and rowAction `visible`/`params`/`payload`; a column may name a decoration field.
|
|
638
655
|
rowRenderer?: PlatformComponent;
|
|
639
|
-
cardRenderer?: PlatformComponent;
|
|
640
656
|
rowActions?: RowAction[]; // Per-row actions, rendered as an actions column on the right.
|
|
641
657
|
rowActionMode?: RowActionMode; // Layout of the row-action column — see `RowActionMode`.
|
|
642
658
|
bulkActions?: ListBulkAction[]; // Bulk actions over checkbox-selected rows, each pointing at a writeHandler row action.
|
|
@@ -647,11 +663,18 @@ type EntityListScreenDefinition = {
|
|
|
647
663
|
pageSize?: number;
|
|
648
664
|
table?: ListTableOptions; // Opt-in table behaviour: remembered state, reset, column picker, density.
|
|
649
665
|
defaultSort?: ListSortSpec;
|
|
666
|
+
sortOptions?: ListSortOption[]; // Choices of the "Sorted by" select in the toolbar (and the narrow-width sort control) instead of one entry per column; every field must be sortable.
|
|
650
667
|
defaultFilters?: Readonly<Record<string, string[] | boolean>>; // Initial facet selection, per filterable field: option values (string facets) or a boolean.
|
|
651
668
|
facets?: Readonly<Record<string, EntityListFacetConfig | false>>; // Per-facet display options for the entity's `filterable` fields, keyed by field name.
|
|
652
669
|
namedFilters?: NamedListFilterRef[]; // Named work-queue rules offered on this list: ids declared in `EntityDefinition.namedFilters`, `label` an i18n key.
|
|
670
|
+
namedFilterFacet?: NamedFilterFacetOptions; // Presentation of `namedFilters` in the toolbar; needs `namedFilters`.
|
|
653
671
|
emptyState?: ListEmptyStateSpec; // Replaces the default empty-list title/hint; the create button stays when the list can create.
|
|
654
672
|
createLabel?: string; // i18n key for the primary create button label (default `kumiko.actions.create`).
|
|
673
|
+
createPlacement?: "header" | "toolbar"; // "toolbar": from `sm` up the create button ends the filter row instead of standing in the header.
|
|
674
|
+
toolbarSort?: true; // From `sm` up, a "Sorted by" select in the filter row (same options as the narrow sort control); column headers stay sortable.
|
|
675
|
+
narrowFacets?: ListNarrowFacets; // "pills": below `sm` the select facets render as rounded pill triggers with a stronger border; from `sm` up unchanged.
|
|
676
|
+
toolbarActionsPlacement?: "header" | "toolbar"; // "toolbar": from `md` up the `toolbarActions` end the filter row, after the "Sorted by" select and the create button, instead of standing in the page header.
|
|
677
|
+
itemNounKey?: string; // i18n key of the plural noun for the list size in the phone sort line (`{count}` pluralised).
|
|
655
678
|
searchPlaceholder?: string; // i18n key for the search field placeholder (default `kumiko.list.search-placeholder`).
|
|
656
679
|
searchable?: boolean;
|
|
657
680
|
slots?: ScreenSlots;
|
|
@@ -874,6 +897,7 @@ interface FieldFormatRegistry {
|
|
|
874
897
|
}; // List cell: FileRef id (or id array) as a thumbnail.
|
|
875
898
|
file: {
|
|
876
899
|
previewOpenByDefault?: boolean;
|
|
900
|
+
viewInDrawer?: boolean;
|
|
877
901
|
}; // FileRef id (or id array) as a download link with the file name.
|
|
878
902
|
}
|
|
879
903
|
type HandlerAuth = {
|
|
@@ -918,7 +942,7 @@ type HandlerEvents<TMap extends object = KumikoEventTypeMap> = { // Event-store
|
|
|
918
942
|
unsafeAppend: UnsafeAppendEventFn; // Untyped append (`payload: unknown`) with the same runtime as `append`.
|
|
919
943
|
tryAppend: TryAppendEventFn; // Optimistic append: runs in a savepoint and returns a version conflict as a result instead of throwing, so the handler can continue after losing a race on the same aggregate stream.
|
|
920
944
|
fetchForWriting: (args: FetchForWritingArgs) => Promise<AggregateStreamHandle>;
|
|
921
|
-
load: (aggregateId: string, options?: { asOf?: Temporal.Instant; atVersion?: never; } | { atVersion?: number; asOf?: never; }) => Promise<StoredEvent[]>;
|
|
945
|
+
load: (aggregateId: string, options?: { asOf?: Temporal.Instant; atVersion?: never; includeArchived?: boolean; } | { atVersion?: number; asOf?: never; includeArchived?: boolean; }) => Promise<StoredEvent[]>;
|
|
922
946
|
archive: (aggregateId: string, args: { aggregateType: string; reason?: string; }) => Promise<void>;
|
|
923
947
|
restore: (aggregateId: string) => Promise<void>;
|
|
924
948
|
isArchived: (aggregateId: string) => Promise<boolean>;
|
|
@@ -949,7 +973,6 @@ type JobContext = {
|
|
|
949
973
|
dispatch: JobDispatch;
|
|
950
974
|
triggerName?: string;
|
|
951
975
|
triggerEvent?: JobTriggerEvent;
|
|
952
|
-
_tenantId?: TenantId;
|
|
953
976
|
config?: ConfigAccessor;
|
|
954
977
|
notify?: NotifyFn;
|
|
955
978
|
services: ContextServices;
|
|
@@ -974,13 +997,14 @@ type JobDefinition = {
|
|
|
974
997
|
runOnBoot?: boolean | undefined;
|
|
975
998
|
bootGate?: boolean | undefined;
|
|
976
999
|
perTenant?: boolean | undefined;
|
|
1000
|
+
includeSystemTenant?: boolean | undefined;
|
|
977
1001
|
runIn?: JobRunIn | undefined;
|
|
978
1002
|
escapeHatch?: EscapeHatchDeclaration | undefined;
|
|
979
1003
|
tenantVisibleFailure?: { messageKey: string; subjectFields?: string[] | undefined; } | undefined;
|
|
980
1004
|
tenantVisibleRun?: { subjectFields?: string[] | undefined; } | undefined;
|
|
981
1005
|
};
|
|
982
1006
|
type JobDispatch = Pick<HandlerDispatch, "write" | "writeAs" | "queryAs" | "queryAsMember">;
|
|
983
|
-
type JobEvents = Pick<HandlerEvents, "append">;
|
|
1007
|
+
type JobEvents = Pick<HandlerEvents, "append" | "load">;
|
|
984
1008
|
type JobHandlerFn = (payload: Record<string, unknown>, context: JobContext) => Promise<void | JobDeferral>;
|
|
985
1009
|
type JobObservability = Pick<HandlerObservability, "log" | "metricsFor" | "meter">;
|
|
986
1010
|
type JobTrigger =
|
|
@@ -1023,15 +1047,20 @@ type ListColumnSpec =
|
|
|
1023
1047
|
refEntity?: string; // Marks this column as a reference lookup instead of a plain value — for projectionList/relatedList columns, which have no `EntityDefinition` to carry a real `reference` field type.
|
|
1024
1048
|
refLabelField?: string; // Row field on the referenced entity shown as the label (default "id").
|
|
1025
1049
|
sortable?: boolean; // Marks this column as sortable via a clickable header — for relatedList columns, which have no `EntityDefinition` field to carry `sortable` on.
|
|
1026
|
-
valueType?: "number" | "decimal" | "bigInt" | "money"; // Value type of a relatedList column, which has no `EntityDefinition` field to derive it from.
|
|
1050
|
+
valueType?: "number" | "decimal" | "bigInt" | "money"; // Value type of a projectionList or relatedList column, which has no `EntityDefinition` field to derive it from.
|
|
1051
|
+
emptyPlaceholder?: false; // `false` leaves an empty cell blank instead of drawing the "—" placeholder.
|
|
1027
1052
|
hideOnNarrow?: boolean; // Leaves the column out of the compact card layout used below the `md` breakpoint (tables keep it).
|
|
1053
|
+
showOnNarrowOnly?: true; // Counterpart of `hideOnNarrow`: the column shows only in the compact card layout and not in the table.
|
|
1028
1054
|
hidden?: boolean; // Start state for the column picker: the column begins hidden and the user can show it.
|
|
1029
1055
|
pinned?: ListColumnPin; // Start pin for the column: it sticks to this edge while the table scrolls horizontally.
|
|
1030
1056
|
width?: number; // Start width in px.
|
|
1031
1057
|
minWidth?: number; // Smallest width in px the user can resize to.
|
|
1032
|
-
display?: ListColumnDisplay; //
|
|
1058
|
+
display?: ListColumnDisplay; // One of "bar" | "badge" | "datetime" | "button".
|
|
1033
1059
|
badgeToneField?: string; // Row field naming the badge tone; only with `display: "badge"`.
|
|
1060
|
+
badgeDot?: false; // `false` draws the badge pill without its leading dot; only with `display: "badge"`.
|
|
1034
1061
|
linkScreenField?: string; // Row field holding a screen QN (`<feature>:screen:<id>`): the cell links to that screen when the row sets it and the user may open it.
|
|
1062
|
+
linkParamsField?: string; // Row field holding a params object for the linkScreenField target: `entityId` opens that record, the other keys become search params (e.g. actionForm prefill).
|
|
1063
|
+
hint?: ListColumnHint; // "To do" cell: the column's field holds a sentence, shown emphasized in the row tone; an empty value shows `emptyLabel`.
|
|
1035
1064
|
}
|
|
1036
1065
|
;
|
|
1037
1066
|
type ListFacetSpec =
|
|
@@ -1073,6 +1102,7 @@ type ListTableOptions = { // Opt-in table behaviour of a list.
|
|
|
1073
1102
|
resizing?: boolean; // Switches the table to table-layout fixed; the user drags or uses the arrow keys on the header edge to resize.
|
|
1074
1103
|
keyboardNavigation?: boolean; // Rows become one tab stop; ArrowUp/ArrowDown move, Home/End jump, Enter runs the row click.
|
|
1075
1104
|
compactHeader?: boolean; // Renders the header row smaller (12px) and semibold.
|
|
1105
|
+
frame?: ListTableFrame; // "card": from `sm` up the table, summary row and pager sit in one bordered, rounded card (toolbar and description stay above it); below `sm` the cards of the card layout are bordered, rounded cards with a gap.
|
|
1076
1106
|
density?: {
|
|
1077
1107
|
default?: ListTableDensity; // Row density on first visit.
|
|
1078
1108
|
userChoice?: boolean; // Shows the density choice in the view menu and remembers it per session.
|
|
@@ -1080,6 +1110,7 @@ type ListTableOptions = { // Opt-in table behaviour of a list.
|
|
|
1080
1110
|
export?: ListTableExportOptions; // Shows an export button; the server reads the whole filtered list (not just the visible page).
|
|
1081
1111
|
grouping?: ListTableGrouping; // Server-side grouping: group headers with count and the `totals` measures over all matching rows; each open group loads its own rows.
|
|
1082
1112
|
totals?: ListTableTotal[]; // Footer row under the rows, computed by the server over all rows matching the current filters and search.
|
|
1113
|
+
summaryRow?: ListTableSummaryRow; // One line under the rows (above `totals`), computed by a query of your own: "label value · label value"; an item without `label` shows its value alone.
|
|
1083
1114
|
};
|
|
1084
1115
|
type ManifestConfigKey = {
|
|
1085
1116
|
key: string;
|
|
@@ -1336,6 +1367,7 @@ type ProjectionDetailScreenDefinition = {
|
|
|
1336
1367
|
fallback?: ScreenFallback; // Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice).
|
|
1337
1368
|
query: string;
|
|
1338
1369
|
recordTitleField?: string; // Query output field whose value titles the page header (breadcrumb) when no `header` is set.
|
|
1370
|
+
focus?: boolean; // Focused shell while the record is open: the app header actions leave the shell header, and on phones a top bar with the record title, a back arrow to the parent list and the page-header overflow menu replaces it.
|
|
1339
1371
|
idParam?: string; // Query-payload key for the row-id.
|
|
1340
1372
|
singleton?: boolean; // The server determines the shown row from the caller's session/context instead of a row id in the path — a self-service screen ("my profile", "my data") that has no row to link to (unlike `EntityEditScreenDefinition.
|
|
1341
1373
|
live?: boolean; // Refetches the record and its relatedList sections when their entity changes (live SSE), for a screen that shows work a background job is still doing.
|
|
@@ -1344,6 +1376,14 @@ type ProjectionDetailScreenDefinition = {
|
|
|
1344
1376
|
header?: RecordHeaderSpec; // Record header above the layout — title/subtitle/status name columns in the query row (not literals).
|
|
1345
1377
|
metrics?: MetricSpec[]; // Metric band above the layout — column names in the query row, each with its own i18n `label`.
|
|
1346
1378
|
metricsStyle?: "band" | "tiles"; // "tiles" draws the metrics as the dashboard KPI tiles (StatCard) instead of the plain band.
|
|
1379
|
+
metricsPlacement?: {
|
|
1380
|
+
narrow?: "after-guidance";
|
|
1381
|
+
}; // `narrow: "after-guidance"` moves the metrics below the summary, banner and steps on screens under md, ahead of the tabs.
|
|
1382
|
+
breadcrumb?: RecordBreadcrumbSpec; // Path above the header (query column holding items).
|
|
1383
|
+
summary?: RecordSummarySpec; // One emphasized sentence below the header.
|
|
1384
|
+
banner?: RecordBannerSpec; // Notice below the summary.
|
|
1385
|
+
steps?: RecordStepsSpec; // "Next steps" panel.
|
|
1386
|
+
progress?: RecordProgressSpec; // Process chains the record is part of, drawn as step bars between the banner and the steps panel.
|
|
1347
1387
|
listScreenId?: string; // Parent list screen (short id) for a "back" navigation.
|
|
1348
1388
|
slots?: ScreenSlots;
|
|
1349
1389
|
access?: AccessRule;
|
|
@@ -1365,18 +1405,24 @@ type ProjectionListScreenDefinition = {
|
|
|
1365
1405
|
fallback?: ScreenFallback; // Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice).
|
|
1366
1406
|
query: string;
|
|
1367
1407
|
columns: ListColumnSpec[];
|
|
1408
|
+
rowToneField?: string; // Row field holding a SelectOptionTone; the row is toned like relatedList `rowTone`, other values leave it untoned.
|
|
1409
|
+
rowDecoration?: ListRowDecoration; // Computed row fields from an app query, merged into the query rows; see `ListRowDecoration`.
|
|
1368
1410
|
rowRenderer?: PlatformComponent;
|
|
1369
|
-
cardRenderer?: PlatformComponent;
|
|
1370
1411
|
rowActions?: RowAction[];
|
|
1371
1412
|
rowActionMode?: RowActionMode; // Layout of the row-action column — see `RowActionMode`.
|
|
1372
1413
|
bulkActions?: ListBulkAction[]; // Bulk actions over checkbox-selected rows, each pointing at a writeHandler row action.
|
|
1373
1414
|
toolbarActions?: ToolbarAction[];
|
|
1415
|
+
toolbarActionsPlacement?: "header" | "toolbar"; // "toolbar": from `md` up the `toolbarActions` end the filter row, after the "Sorted by" select, instead of standing in the page header.
|
|
1416
|
+
toolbarSort?: true; // From `sm` up, a "Sorted by" select in the filter row (same options as the narrow sort control); column headers stay sortable.
|
|
1417
|
+
narrowFacets?: ListNarrowFacets; // "pills": below `sm` the select facets render as rounded pill triggers with a stronger border; from `sm` up unchanged.
|
|
1374
1418
|
pagination?: ListPaginationMode;
|
|
1375
1419
|
pageSize?: number;
|
|
1376
1420
|
table?: ListTableOptions; // Opt-in table behaviour: remembered state, reset, column picker, density.
|
|
1377
1421
|
defaultSort?: ListSortSpec;
|
|
1422
|
+
sortOptions?: ListSortOption[]; // Choices of the "Sorted by" select in the toolbar (and the narrow-width sort control) instead of one entry per column; every field must be sortable.
|
|
1378
1423
|
emptyState?: ListEmptyStateSpec; // Replaces the default empty-list title/hint; the create button stays when the list can create.
|
|
1379
1424
|
createLabel?: string; // i18n key for the primary create button label (default `kumiko.actions.create`).
|
|
1425
|
+
itemNounKey?: string; // i18n key of the plural noun for the list size in the phone sort line ('{count}' pluralised, e.g. "contract"/"contracts").
|
|
1380
1426
|
searchPlaceholder?: string; // i18n key for the search field placeholder (default `kumiko.list.search-placeholder`).
|
|
1381
1427
|
searchable?: boolean;
|
|
1382
1428
|
sortable?: boolean; // Derived by buildAppSchema from the query handler's Zod schema (`sort` param present).
|
|
@@ -1384,6 +1430,7 @@ type ProjectionListScreenDefinition = {
|
|
|
1384
1430
|
filter?: ScreenFilter; // Server-side filter, fixed on the screen — see `ScreenFilter` doc above (entityList).
|
|
1385
1431
|
facets?: ListFacetSpec[]; // User-toggleable facet dropdowns — see `ListFacetSpec` doc.
|
|
1386
1432
|
namedFilters?: NamedListFilterRef[]; // Named work-queue rules the bound query understands: its Zod schema must have a `namedFilter` key (boot-checked) and is sent the selected id in every list and count query.
|
|
1433
|
+
namedFilterFacet?: NamedFilterFacetOptions; // Presentation of `namedFilters` in the toolbar; needs `namedFilters`.
|
|
1387
1434
|
slots?: ScreenSlots;
|
|
1388
1435
|
access?: AccessRule;
|
|
1389
1436
|
};
|
|
@@ -1556,6 +1603,7 @@ type SaveContext = {
|
|
|
1556
1603
|
isNew: boolean;
|
|
1557
1604
|
entityName?: string | undefined;
|
|
1558
1605
|
event: StoredEvent;
|
|
1606
|
+
claimedFileRefIds?: string[] | undefined;
|
|
1559
1607
|
};
|
|
1560
1608
|
type ScreenDefinition = EntityListScreenDefinition | ProjectionListScreenDefinition | ProjectionDetailScreenDefinition | DashboardScreenDefinition | EntityEditScreenDefinition | ActionFormScreenDefinition | ConfigEditScreenDefinition | SecretsEditScreenDefinition | SecretMintScreenDefinition | CustomScreenDefinition;
|
|
1561
1609
|
type SecretKeyDefinition = {
|
|
@@ -1570,6 +1618,7 @@ type SecretKeyDefinition = {
|
|
|
1570
1618
|
};
|
|
1571
1619
|
scope: "tenant";
|
|
1572
1620
|
required?: boolean;
|
|
1621
|
+
requiredWhenConfigSet?: string;
|
|
1573
1622
|
writeRoles?: string[];
|
|
1574
1623
|
valueSchema?: ZodType<string>;
|
|
1575
1624
|
};
|
|
@@ -1707,6 +1756,7 @@ type TierResolverPlugin = { // Plugin shape for the tier-resolver extension.
|
|
|
1707
1756
|
};
|
|
1708
1757
|
type ToggleReader = (featureName: string) => boolean | undefined;
|
|
1709
1758
|
type ToolbarAction = ({ kind: "navigate"; id: string; label: string; screen: string; tab?: string; style?: "primary" | "secondary" | "danger"; } | { kind: "writeHandler"; id: string; label: string; handler: string; payload?: Record<string, unknown>; confirm?: string; confirmLabel?: string; style?: "primary" | "secondary" | "danger"; } | { kind: "drawer"; id: string; label: string; screen: string; style?: "primary" | "secondary" | "danger"; title?: string; subtitle?: string; }) & {
|
|
1759
|
+
icon?: IconKey; // Icon of the button, in every list (entityList, projectionList, relatedList).
|
|
1710
1760
|
visibleWhen?: DashboardPanelVisibility; // Shown only while the query's `field` equals `eq` (live, empty payload).
|
|
1711
1761
|
};
|
|
1712
1762
|
type TransferAdjacency = ReadonlyMap<string, TransferEdge[]>; // Outgoing edges per type: keyed by the type an edge hangs off, so the mover can ask "what hangs off the rows I just moved" for any type it reaches, at any depth, as often as it reaches it.
|
|
@@ -1845,6 +1895,7 @@ type WriteHandlerDef = {
|
|
|
1845
1895
|
name: string;
|
|
1846
1896
|
schema: ZodType;
|
|
1847
1897
|
handler: WriteHandlerFn;
|
|
1898
|
+
[ENTITY_CONVENTION_WRITE_BRAND]?: true; // Set only by defineEntityWriteHandler, which wires the parent-ref visibility gate.
|
|
1848
1899
|
access: AccessRule;
|
|
1849
1900
|
description?: string;
|
|
1850
1901
|
agent?: AgentHandlerHints;
|
|
@@ -1867,7 +1918,7 @@ type WriteHandlerDefinition<TName extends string = string, TSchema extends ZodTy
|
|
|
1867
1918
|
access: AccessRule;
|
|
1868
1919
|
description?: string;
|
|
1869
1920
|
agent?: AgentHandlerHints;
|
|
1870
|
-
excludedFields?: string[]; // Set by the entity convention create/update handlers;
|
|
1921
|
+
excludedFields?: string[]; // Set by the entity convention create/update handlers; a hand-written handler may declare it for its form, its own schema still decides what it accepts.
|
|
1871
1922
|
unsafeSkipTransitionGuard?: boolean;
|
|
1872
1923
|
rateLimit?: RateLimitDeclaration;
|
|
1873
1924
|
additionalRateLimits?: PayloadRateLimitOption[];
|
|
@@ -28,6 +28,7 @@ function isStreamArchived(db: DbRunner, tenantId: TenantId, aggregateId: string)
|
|
|
28
28
|
function loadAggregate(db: DbRunner, aggregateId: string, tenantId: TenantId, options?: { includeArchived?: boolean; aggregateType?: string; atVersion?: number; }): Promise<StoredEvent[]>;
|
|
29
29
|
function makeUpcastCtx(db: DbRunner, tenantId: TenantId): EventUpcastCtx;
|
|
30
30
|
function runSeedWritesAt<T>(createdAt: Temporal.Instant, fn: () => Promise<T>): Promise<T>; // Runs `fn` so that every event appended inside it (through the normal write path: handlers, validation, projections) is stored with `createdAt` instead of the database `now()`.
|
|
31
|
+
function selectOpenStreamsStartedBefore(db: DbRunner, args: OpenStreamsArgs): Promise<OpenStream[]>;
|
|
31
32
|
function streamAllEventsByType(db: DbRunner, aggregateType: string, batchSize?, signal?: AbortSignal): AsyncIterable<StoredEvent>;
|
|
32
33
|
function transferAggregateStreams(db: DbRunner, args: TransferAggregateStreamsArgs): Promise<number>;
|
|
33
34
|
function upcastStoredEvent(event: StoredEvent, upcasters: EventUpcasters, ctx: EventUpcastCtx): Promise<StoredEvent>;
|
|
@@ -83,6 +84,19 @@ type EventMetadata = {
|
|
|
83
84
|
handler?: string;
|
|
84
85
|
writeOrigin?: WriteOrigin;
|
|
85
86
|
};
|
|
87
|
+
type OpenStream = {
|
|
88
|
+
id: string;
|
|
89
|
+
tenantId: string;
|
|
90
|
+
aggregateId: string;
|
|
91
|
+
};
|
|
92
|
+
type OpenStreamsArgs = {
|
|
93
|
+
aggregateType: string;
|
|
94
|
+
startedType: string;
|
|
95
|
+
closingTypes: string[];
|
|
96
|
+
startedBeforeIso: string;
|
|
97
|
+
limit: number;
|
|
98
|
+
afterId?: string;
|
|
99
|
+
};
|
|
86
100
|
type StoredEvent<TPayload = Record<string, unknown>> = {
|
|
87
101
|
id: string;
|
|
88
102
|
aggregateId: string;
|