@dads-framework/spicedb-access 0.0.0-stage → 0.3.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/LICENSE.md +21 -0
- package/README.md +85 -2
- package/bin/dads-import-spicedb.mjs +156 -0
- package/dist/authz-journal/index.d.ts +3 -0
- package/dist/authz-journal/index.d.ts.map +1 -0
- package/dist/authz-journal/index.js +3 -0
- package/dist/authz-journal/index.js.map +1 -0
- package/dist/authz-journal/migration-journal.access.d.ts +11 -0
- package/dist/authz-journal/migration-journal.access.d.ts.map +1 -0
- package/dist/authz-journal/migration-journal.access.js +16 -0
- package/dist/authz-journal/migration-journal.access.js.map +1 -0
- package/dist/authz-journal/migration-version.access.d.ts +7 -0
- package/dist/authz-journal/migration-version.access.d.ts.map +1 -0
- package/dist/authz-journal/migration-version.access.js +11 -0
- package/dist/authz-journal/migration-version.access.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +43 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/access/check-all.d.ts +8 -0
- package/dist/lib/access/check-all.d.ts.map +1 -0
- package/dist/lib/access/check-all.js +11 -0
- package/dist/lib/access/check-all.js.map +1 -0
- package/dist/lib/access/guarded-authorization.d.ts +71 -0
- package/dist/lib/access/guarded-authorization.d.ts.map +1 -0
- package/dist/lib/access/guarded-authorization.js +163 -0
- package/dist/lib/access/guarded-authorization.js.map +1 -0
- package/dist/lib/access/list-only-visible.d.ts +23 -0
- package/dist/lib/access/list-only-visible.d.ts.map +1 -0
- package/dist/lib/access/list-only-visible.js +21 -0
- package/dist/lib/access/list-only-visible.js.map +1 -0
- package/dist/lib/access/logic/spice-db-empty-schema.d.ts +3 -0
- package/dist/lib/access/logic/spice-db-empty-schema.d.ts.map +1 -0
- package/dist/lib/access/logic/spice-db-empty-schema.js +17 -0
- package/dist/lib/access/logic/spice-db-empty-schema.js.map +1 -0
- package/dist/lib/access/logic/spice-db-security.d.ts +4 -0
- package/dist/lib/access/logic/spice-db-security.d.ts.map +1 -0
- package/dist/lib/access/logic/spice-db-security.js +10 -0
- package/dist/lib/access/logic/spice-db-security.js.map +1 -0
- package/dist/lib/access/logic/spice-db-write-retry.d.ts +22 -0
- package/dist/lib/access/logic/spice-db-write-retry.d.ts.map +1 -0
- package/dist/lib/access/logic/spice-db-write-retry.js +36 -0
- package/dist/lib/access/logic/spice-db-write-retry.js.map +1 -0
- package/dist/lib/access/missing-ownership-tuples.d.ts +19 -0
- package/dist/lib/access/missing-ownership-tuples.d.ts.map +1 -0
- package/dist/lib/access/missing-ownership-tuples.js +12 -0
- package/dist/lib/access/missing-ownership-tuples.js.map +1 -0
- package/dist/lib/access/newest-written-token.d.ts +37 -0
- package/dist/lib/access/newest-written-token.d.ts.map +1 -0
- package/dist/lib/access/newest-written-token.js +56 -0
- package/dist/lib/access/newest-written-token.js.map +1 -0
- package/dist/lib/access/one-write-at-a-time.d.ts +14 -0
- package/dist/lib/access/one-write-at-a-time.d.ts.map +1 -0
- package/dist/lib/access/one-write-at-a-time.js +18 -0
- package/dist/lib/access/one-write-at-a-time.js.map +1 -0
- package/dist/lib/access/spice-db-authorization.d.ts +102 -0
- package/dist/lib/access/spice-db-authorization.d.ts.map +1 -0
- package/dist/lib/access/spice-db-authorization.js +286 -0
- package/dist/lib/access/spice-db-authorization.js.map +1 -0
- package/dist/lib/access/spice-db-clients.d.ts +19 -0
- package/dist/lib/access/spice-db-clients.d.ts.map +1 -0
- package/dist/lib/access/spice-db-clients.js +25 -0
- package/dist/lib/access/spice-db-clients.js.map +1 -0
- package/dist/lib/access/spice-db-consistency.d.ts +24 -0
- package/dist/lib/access/spice-db-consistency.d.ts.map +1 -0
- package/dist/lib/access/spice-db-consistency.js +46 -0
- package/dist/lib/access/spice-db-consistency.js.map +1 -0
- package/dist/lib/access/spice-db-permission-checks.d.ts +21 -0
- package/dist/lib/access/spice-db-permission-checks.d.ts.map +1 -0
- package/dist/lib/access/spice-db-permission-checks.js +104 -0
- package/dist/lib/access/spice-db-permission-checks.js.map +1 -0
- package/dist/lib/access/spice-db-relationship-read.d.ts +5 -0
- package/dist/lib/access/spice-db-relationship-read.d.ts.map +1 -0
- package/dist/lib/access/spice-db-relationship-read.js +23 -0
- package/dist/lib/access/spice-db-relationship-read.js.map +1 -0
- package/dist/lib/access/spice-db-write-deadline.d.ts +23 -0
- package/dist/lib/access/spice-db-write-deadline.d.ts.map +1 -0
- package/dist/lib/access/spice-db-write-deadline.js +41 -0
- package/dist/lib/access/spice-db-write-deadline.js.map +1 -0
- package/dist/lib/access/tallied-authorization.d.ts +31 -0
- package/dist/lib/access/tallied-authorization.d.ts.map +1 -0
- package/dist/lib/access/tallied-authorization.js +62 -0
- package/dist/lib/access/tallied-authorization.js.map +1 -0
- package/dist/lib/access/testing/acting-company-fixture.d.ts +46 -0
- package/dist/lib/access/testing/acting-company-fixture.d.ts.map +1 -0
- package/dist/lib/access/testing/acting-company-fixture.js +74 -0
- package/dist/lib/access/testing/acting-company-fixture.js.map +1 -0
- package/dist/lib/access-changes/access-change.ids.d.ts +5 -0
- package/dist/lib/access-changes/access-change.ids.d.ts.map +1 -0
- package/dist/lib/access-changes/access-change.ids.js +4 -0
- package/dist/lib/access-changes/access-change.ids.js.map +1 -0
- package/dist/lib/access-changes/apply-after-commit.d.ts +25 -0
- package/dist/lib/access-changes/apply-after-commit.d.ts.map +1 -0
- package/dist/lib/access-changes/apply-after-commit.js +93 -0
- package/dist/lib/access-changes/apply-after-commit.js.map +1 -0
- package/dist/lib/access-changes/apply.d.ts +60 -0
- package/dist/lib/access-changes/apply.d.ts.map +1 -0
- package/dist/lib/access-changes/apply.js +139 -0
- package/dist/lib/access-changes/apply.js.map +1 -0
- package/dist/lib/access-changes/claim.d.ts +79 -0
- package/dist/lib/access-changes/claim.d.ts.map +1 -0
- package/dist/lib/access-changes/claim.js +3 -0
- package/dist/lib/access-changes/claim.js.map +1 -0
- package/dist/lib/access-changes/complete.d.ts +38 -0
- package/dist/lib/access-changes/complete.d.ts.map +1 -0
- package/dist/lib/access-changes/complete.js +128 -0
- package/dist/lib/access-changes/complete.js.map +1 -0
- package/dist/lib/access-changes/completion-status.d.ts +21 -0
- package/dist/lib/access-changes/completion-status.d.ts.map +1 -0
- package/dist/lib/access-changes/completion-status.js +7 -0
- package/dist/lib/access-changes/completion-status.js.map +1 -0
- package/dist/lib/access-changes/enqueue.d.ts +14 -0
- package/dist/lib/access-changes/enqueue.d.ts.map +1 -0
- package/dist/lib/access-changes/enqueue.js +10 -0
- package/dist/lib/access-changes/enqueue.js.map +1 -0
- package/dist/lib/access-changes/logic/claim-rules.d.ts +49 -0
- package/dist/lib/access-changes/logic/claim-rules.d.ts.map +1 -0
- package/dist/lib/access-changes/logic/claim-rules.js +50 -0
- package/dist/lib/access-changes/logic/claim-rules.js.map +1 -0
- package/dist/lib/access-changes/postgres/access-changes.tables.d.ts +342 -0
- package/dist/lib/access-changes/postgres/access-changes.tables.d.ts.map +1 -0
- package/dist/lib/access-changes/postgres/access-changes.tables.js +36 -0
- package/dist/lib/access-changes/postgres/access-changes.tables.js.map +1 -0
- package/dist/lib/access-changes/postgres/claim.d.ts +43 -0
- package/dist/lib/access-changes/postgres/claim.d.ts.map +1 -0
- package/dist/lib/access-changes/postgres/claim.js +134 -0
- package/dist/lib/access-changes/postgres/claim.js.map +1 -0
- package/dist/lib/access-changes/postgres/completion-status.d.ts +27 -0
- package/dist/lib/access-changes/postgres/completion-status.d.ts.map +1 -0
- package/dist/lib/access-changes/postgres/completion-status.js +71 -0
- package/dist/lib/access-changes/postgres/completion-status.js.map +1 -0
- package/dist/lib/access-changes/postgres/enqueue.d.ts +30 -0
- package/dist/lib/access-changes/postgres/enqueue.d.ts.map +1 -0
- package/dist/lib/access-changes/postgres/enqueue.js +92 -0
- package/dist/lib/access-changes/postgres/enqueue.js.map +1 -0
- package/dist/lib/access-changes/postgres/migrations/20260828163001_authorization_outbox.migration.d.ts +4 -0
- package/dist/lib/access-changes/postgres/migrations/20260828163001_authorization_outbox.migration.d.ts.map +1 -0
- package/dist/lib/access-changes/postgres/migrations/20260828163001_authorization_outbox.migration.js +43 -0
- package/dist/lib/access-changes/postgres/migrations/20260828163001_authorization_outbox.migration.js.map +1 -0
- package/dist/lib/access-changes/postgres/owner-lock.d.ts +85 -0
- package/dist/lib/access-changes/postgres/owner-lock.d.ts.map +1 -0
- package/dist/lib/access-changes/postgres/owner-lock.js +217 -0
- package/dist/lib/access-changes/postgres/owner-lock.js.map +1 -0
- package/dist/lib/access-changes/postgres/requeue-failed.d.ts +17 -0
- package/dist/lib/access-changes/postgres/requeue-failed.d.ts.map +1 -0
- package/dist/lib/access-changes/postgres/requeue-failed.js +25 -0
- package/dist/lib/access-changes/postgres/requeue-failed.js.map +1 -0
- package/dist/lib/access-changes/revoke.d.ts +104 -0
- package/dist/lib/access-changes/revoke.d.ts.map +1 -0
- package/dist/lib/access-changes/revoke.js +48 -0
- package/dist/lib/access-changes/revoke.js.map +1 -0
- package/dist/lib/access-changes/synced-row-relationships.d.ts +56 -0
- package/dist/lib/access-changes/synced-row-relationships.d.ts.map +1 -0
- package/dist/lib/access-changes/synced-row-relationships.js +114 -0
- package/dist/lib/access-changes/synced-row-relationships.js.map +1 -0
- package/dist/lib/catalog-sizes/audit-catalog-sizes.job.d.ts +41 -0
- package/dist/lib/catalog-sizes/audit-catalog-sizes.job.d.ts.map +1 -0
- package/dist/lib/catalog-sizes/audit-catalog-sizes.job.js +79 -0
- package/dist/lib/catalog-sizes/audit-catalog-sizes.job.js.map +1 -0
- package/dist/lib/catalog-sizes/catalog-size-reader.d.ts +15 -0
- package/dist/lib/catalog-sizes/catalog-size-reader.d.ts.map +1 -0
- package/dist/lib/catalog-sizes/catalog-size-reader.js +41 -0
- package/dist/lib/catalog-sizes/catalog-size-reader.js.map +1 -0
- package/dist/lib/catalog-sizes/catalog-tables.d.ts +38 -0
- package/dist/lib/catalog-sizes/catalog-tables.d.ts.map +1 -0
- package/dist/lib/catalog-sizes/catalog-tables.js +52 -0
- package/dist/lib/catalog-sizes/catalog-tables.js.map +1 -0
- package/dist/lib/schema-migrate/clone-spice-db-datastore.d.ts +9 -0
- package/dist/lib/schema-migrate/clone-spice-db-datastore.d.ts.map +1 -0
- package/dist/lib/schema-migrate/clone-spice-db-datastore.js +47 -0
- package/dist/lib/schema-migrate/clone-spice-db-datastore.js.map +1 -0
- package/dist/lib/schema-migrate/parse-authorization-schema-migration-environment.d.ts +31 -0
- package/dist/lib/schema-migrate/parse-authorization-schema-migration-environment.d.ts.map +1 -0
- package/dist/lib/schema-migrate/parse-authorization-schema-migration-environment.js +26 -0
- package/dist/lib/schema-migrate/parse-authorization-schema-migration-environment.js.map +1 -0
- package/dist/lib/scoped-lists/keep-permitted.d.ts +24 -0
- package/dist/lib/scoped-lists/keep-permitted.d.ts.map +1 -0
- package/dist/lib/scoped-lists/keep-permitted.js +31 -0
- package/dist/lib/scoped-lists/keep-permitted.js.map +1 -0
- package/dist/lib/scoped-lists/scope-predicate.d.ts +18 -0
- package/dist/lib/scoped-lists/scope-predicate.d.ts.map +1 -0
- package/dist/lib/scoped-lists/scope-predicate.js +96 -0
- package/dist/lib/scoped-lists/scope-predicate.js.map +1 -0
- package/dist/lib/scoped-lists/scope-sql-bindings.d.ts +64 -0
- package/dist/lib/scoped-lists/scope-sql-bindings.d.ts.map +1 -0
- package/dist/lib/scoped-lists/scope-sql-bindings.js +45 -0
- package/dist/lib/scoped-lists/scope-sql-bindings.js.map +1 -0
- package/dist/lib/scoped-lists/testing/scoped-list-fixture.d.ts +369 -0
- package/dist/lib/scoped-lists/testing/scoped-list-fixture.d.ts.map +1 -0
- package/dist/lib/scoped-lists/testing/scoped-list-fixture.js +148 -0
- package/dist/lib/scoped-lists/testing/scoped-list-fixture.js.map +1 -0
- package/dist/migration/definition-changes.d.mts +28 -0
- package/dist/migration/definition-changes.d.mts.map +1 -0
- package/dist/migration/definition-changes.mjs +298 -0
- package/dist/migration/definition-changes.mjs.map +1 -0
- package/dist/migration/index.d.ts +15 -0
- package/dist/migration/index.d.ts.map +1 -0
- package/dist/migration/index.js +14 -0
- package/dist/migration/index.js.map +1 -0
- package/dist/migration/lib/access-migrations/assert-access-migrations-up-to-date.d.ts +26 -0
- package/dist/migration/lib/access-migrations/assert-access-migrations-up-to-date.d.ts.map +1 -0
- package/dist/migration/lib/access-migrations/assert-access-migrations-up-to-date.js +58 -0
- package/dist/migration/lib/access-migrations/assert-access-migrations-up-to-date.js.map +1 -0
- package/dist/migration/lib/access-migrations/define-access-migration.d.ts +51 -0
- package/dist/migration/lib/access-migrations/define-access-migration.d.ts.map +1 -0
- package/dist/migration/lib/access-migrations/define-access-migration.js +65 -0
- package/dist/migration/lib/access-migrations/define-access-migration.js.map +1 -0
- package/dist/migration/lib/access-migrations/diff-access-models-format.d.ts +12 -0
- package/dist/migration/lib/access-migrations/diff-access-models-format.d.ts.map +1 -0
- package/dist/migration/lib/access-migrations/diff-access-models-format.js +81 -0
- package/dist/migration/lib/access-migrations/diff-access-models-format.js.map +1 -0
- package/dist/migration/lib/access-migrations/diff-access-models.d.ts +79 -0
- package/dist/migration/lib/access-migrations/diff-access-models.d.ts.map +1 -0
- package/dist/migration/lib/access-migrations/diff-access-models.js +197 -0
- package/dist/migration/lib/access-migrations/diff-access-models.js.map +1 -0
- package/dist/migration/lib/access-migrations/index.d.ts +8 -0
- package/dist/migration/lib/access-migrations/index.d.ts.map +1 -0
- package/dist/migration/lib/access-migrations/index.js +8 -0
- package/dist/migration/lib/access-migrations/index.js.map +1 -0
- package/dist/migration/lib/access-migrations/run-postgres-access-migrations.d.ts +17 -0
- package/dist/migration/lib/access-migrations/run-postgres-access-migrations.d.ts.map +1 -0
- package/dist/migration/lib/access-migrations/run-postgres-access-migrations.js +105 -0
- package/dist/migration/lib/access-migrations/run-postgres-access-migrations.js.map +1 -0
- package/dist/migration/lib/access-migrations/run-spicedb-access-migrations.d.ts +21 -0
- package/dist/migration/lib/access-migrations/run-spicedb-access-migrations.d.ts.map +1 -0
- package/dist/migration/lib/access-migrations/run-spicedb-access-migrations.js +64 -0
- package/dist/migration/lib/access-migrations/run-spicedb-access-migrations.js.map +1 -0
- package/dist/migration/lib/access-migrations/run-sqlite-access-migrations.d.ts +18 -0
- package/dist/migration/lib/access-migrations/run-sqlite-access-migrations.d.ts.map +1 -0
- package/dist/migration/lib/access-migrations/run-sqlite-access-migrations.js +102 -0
- package/dist/migration/lib/access-migrations/run-sqlite-access-migrations.js.map +1 -0
- package/dist/migration/lib/access-migrations/sql-migration-types.d.ts +52 -0
- package/dist/migration/lib/access-migrations/sql-migration-types.d.ts.map +1 -0
- package/dist/migration/lib/access-migrations/sql-migration-types.js +57 -0
- package/dist/migration/lib/access-migrations/sql-migration-types.js.map +1 -0
- package/dist/migration/lib/journal/authorization-change-files.d.ts +7 -0
- package/dist/migration/lib/journal/authorization-change-files.d.ts.map +1 -0
- package/dist/migration/lib/journal/authorization-change-files.js +94 -0
- package/dist/migration/lib/journal/authorization-change-files.js.map +1 -0
- package/dist/migration/lib/journal/journal-entry.d.ts +47 -0
- package/dist/migration/lib/journal/journal-entry.d.ts.map +1 -0
- package/dist/migration/lib/journal/journal-entry.js +2 -0
- package/dist/migration/lib/journal/journal-entry.js.map +1 -0
- package/dist/migration/lib/journal/load-authorization-changes.d.ts +9 -0
- package/dist/migration/lib/journal/load-authorization-changes.d.ts.map +1 -0
- package/dist/migration/lib/journal/load-authorization-changes.js +32 -0
- package/dist/migration/lib/journal/load-authorization-changes.js.map +1 -0
- package/dist/migration/lib/journal/load-journal.d.ts +21 -0
- package/dist/migration/lib/journal/load-journal.d.ts.map +1 -0
- package/dist/migration/lib/journal/load-journal.js +73 -0
- package/dist/migration/lib/journal/load-journal.js.map +1 -0
- package/dist/migration/lib/journal/read-authorization-migration-status.d.ts +10 -0
- package/dist/migration/lib/journal/read-authorization-migration-status.d.ts.map +1 -0
- package/dist/migration/lib/journal/read-authorization-migration-status.js +69 -0
- package/dist/migration/lib/journal/read-authorization-migration-status.js.map +1 -0
- package/dist/migration/lib/logic/authorization-change-history.d.ts +22 -0
- package/dist/migration/lib/logic/authorization-change-history.d.ts.map +1 -0
- package/dist/migration/lib/logic/authorization-change-history.js +106 -0
- package/dist/migration/lib/logic/authorization-change-history.js.map +1 -0
- package/dist/migration/lib/logic/classify-schema-diff.d.ts +26 -0
- package/dist/migration/lib/logic/classify-schema-diff.d.ts.map +1 -0
- package/dist/migration/lib/logic/classify-schema-diff.js +106 -0
- package/dist/migration/lib/logic/classify-schema-diff.js.map +1 -0
- package/dist/migration/lib/postgres-to-spicedb/authzed-target-adapter.d.ts +62 -0
- package/dist/migration/lib/postgres-to-spicedb/authzed-target-adapter.d.ts.map +1 -0
- package/dist/migration/lib/postgres-to-spicedb/authzed-target-adapter.js +63 -0
- package/dist/migration/lib/postgres-to-spicedb/authzed-target-adapter.js.map +1 -0
- package/dist/migration/lib/postgres-to-spicedb/column-relation-outbox-triggers.d.ts +45 -0
- package/dist/migration/lib/postgres-to-spicedb/column-relation-outbox-triggers.d.ts.map +1 -0
- package/dist/migration/lib/postgres-to-spicedb/column-relation-outbox-triggers.js +140 -0
- package/dist/migration/lib/postgres-to-spicedb/column-relation-outbox-triggers.js.map +1 -0
- package/dist/migration/lib/postgres-to-spicedb/index.d.ts +4 -0
- package/dist/migration/lib/postgres-to-spicedb/index.d.ts.map +1 -0
- package/dist/migration/lib/postgres-to-spicedb/index.js +4 -0
- package/dist/migration/lib/postgres-to-spicedb/index.js.map +1 -0
- package/dist/migration/lib/postgres-to-spicedb/migrate-postgres-to-spicedb.d.ts +47 -0
- package/dist/migration/lib/postgres-to-spicedb/migrate-postgres-to-spicedb.d.ts.map +1 -0
- package/dist/migration/lib/postgres-to-spicedb/migrate-postgres-to-spicedb.js +201 -0
- package/dist/migration/lib/postgres-to-spicedb/migrate-postgres-to-spicedb.js.map +1 -0
- package/dist/migration/lib/run-authorization-changes.d.ts +5 -0
- package/dist/migration/lib/run-authorization-changes.d.ts.map +1 -0
- package/dist/migration/lib/run-authorization-changes.js +165 -0
- package/dist/migration/lib/run-authorization-changes.js.map +1 -0
- package/dist/migration/lib/run-authorization-migrations.d.ts +47 -0
- package/dist/migration/lib/run-authorization-migrations.d.ts.map +1 -0
- package/dist/migration/lib/run-authorization-migrations.js +210 -0
- package/dist/migration/lib/run-authorization-migrations.js.map +1 -0
- package/dist/migration/lib/scaffold/build-migration-bridge-schema.d.ts +7 -0
- package/dist/migration/lib/scaffold/build-migration-bridge-schema.d.ts.map +1 -0
- package/dist/migration/lib/scaffold/build-migration-bridge-schema.js +83 -0
- package/dist/migration/lib/scaffold/build-migration-bridge-schema.js.map +1 -0
- package/dist/migration/lib/scaffold/renumber-migration.d.ts +69 -0
- package/dist/migration/lib/scaffold/renumber-migration.d.ts.map +1 -0
- package/dist/migration/lib/scaffold/renumber-migration.js +176 -0
- package/dist/migration/lib/scaffold/renumber-migration.js.map +1 -0
- package/dist/migration/lib/scaffold/scaffold-authorization-change.d.ts +19 -0
- package/dist/migration/lib/scaffold/scaffold-authorization-change.d.ts.map +1 -0
- package/dist/migration/lib/scaffold/scaffold-authorization-change.js +48 -0
- package/dist/migration/lib/scaffold/scaffold-authorization-change.js.map +1 -0
- package/dist/migration/lib/scaffold/scaffold-migration.d.ts +32 -0
- package/dist/migration/lib/scaffold/scaffold-migration.d.ts.map +1 -0
- package/dist/migration/lib/scaffold/scaffold-migration.js +95 -0
- package/dist/migration/lib/scaffold/scaffold-migration.js.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/access-model-from-ir.d.ts +8 -0
- package/dist/migration/lib/spicedb-to-postgres/access-model-from-ir.d.ts.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/access-model-from-ir.js +10 -0
- package/dist/migration/lib/spicedb-to-postgres/access-model-from-ir.js.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/authzed-client-adapter.d.ts +94 -0
- package/dist/migration/lib/spicedb-to-postgres/authzed-client-adapter.d.ts.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/authzed-client-adapter.js +101 -0
- package/dist/migration/lib/spicedb-to-postgres/authzed-client-adapter.js.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/cli-args.d.ts +30 -0
- package/dist/migration/lib/spicedb-to-postgres/cli-args.d.ts.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/cli-args.js +217 -0
- package/dist/migration/lib/spicedb-to-postgres/cli-args.js.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/cli-format.d.ts +16 -0
- package/dist/migration/lib/spicedb-to-postgres/cli-format.d.ts.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/cli-format.js +79 -0
- package/dist/migration/lib/spicedb-to-postgres/cli-format.js.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/cli.d.ts +47 -0
- package/dist/migration/lib/spicedb-to-postgres/cli.d.ts.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/cli.js +169 -0
- package/dist/migration/lib/spicedb-to-postgres/cli.js.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/index.d.ts +8 -0
- package/dist/migration/lib/spicedb-to-postgres/index.d.ts.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/index.js +8 -0
- package/dist/migration/lib/spicedb-to-postgres/index.js.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/migrate-spicedb-to-postgres.d.ts +36 -0
- package/dist/migration/lib/spicedb-to-postgres/migrate-spicedb-to-postgres.d.ts.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/migrate-spicedb-to-postgres.js +129 -0
- package/dist/migration/lib/spicedb-to-postgres/migrate-spicedb-to-postgres.js.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/postgres-relationship-ddl.d.ts +13 -0
- package/dist/migration/lib/spicedb-to-postgres/postgres-relationship-ddl.d.ts.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/postgres-relationship-ddl.js +60 -0
- package/dist/migration/lib/spicedb-to-postgres/postgres-relationship-ddl.js.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/verify-parity.d.ts +51 -0
- package/dist/migration/lib/spicedb-to-postgres/verify-parity.d.ts.map +1 -0
- package/dist/migration/lib/spicedb-to-postgres/verify-parity.js +194 -0
- package/dist/migration/lib/spicedb-to-postgres/verify-parity.js.map +1 -0
- package/dist/migration/testing/fake-schema-store.d.ts +31 -0
- package/dist/migration/testing/fake-schema-store.d.ts.map +1 -0
- package/dist/migration/testing/fake-schema-store.js +81 -0
- package/dist/migration/testing/fake-schema-store.js.map +1 -0
- package/dist/spicedb-access.tsbuildinfo +1 -0
- package/dist/testing/create-shared-test-spice-db.d.ts +4 -0
- package/dist/testing/create-shared-test-spice-db.d.ts.map +1 -0
- package/dist/testing/create-shared-test-spice-db.js +9 -0
- package/dist/testing/create-shared-test-spice-db.js.map +1 -0
- package/dist/testing/fake-apply-after-commit.d.ts +29 -0
- package/dist/testing/fake-apply-after-commit.d.ts.map +1 -0
- package/dist/testing/fake-apply-after-commit.js +50 -0
- package/dist/testing/fake-apply-after-commit.js.map +1 -0
- package/dist/testing/fake-claim.d.ts +50 -0
- package/dist/testing/fake-claim.d.ts.map +1 -0
- package/dist/testing/fake-claim.js +188 -0
- package/dist/testing/fake-claim.js.map +1 -0
- package/dist/testing/fake-enqueue.d.ts +37 -0
- package/dist/testing/fake-enqueue.d.ts.map +1 -0
- package/dist/testing/fake-enqueue.js +86 -0
- package/dist/testing/fake-enqueue.js.map +1 -0
- package/dist/testing/in-memory-owner-lock.d.ts +7 -0
- package/dist/testing/in-memory-owner-lock.d.ts.map +1 -0
- package/dist/testing/in-memory-owner-lock.js +25 -0
- package/dist/testing/in-memory-owner-lock.js.map +1 -0
- package/dist/testing/index.d.ts +11 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +11 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/prove-scope-matches-lookup.d.ts +22 -0
- package/dist/testing/prove-scope-matches-lookup.d.ts.map +1 -0
- package/dist/testing/prove-scope-matches-lookup.js +71 -0
- package/dist/testing/prove-scope-matches-lookup.js.map +1 -0
- package/dist/testing/start-test-spice-db.d.ts +31 -0
- package/dist/testing/start-test-spice-db.d.ts.map +1 -0
- package/dist/testing/start-test-spice-db.js +73 -0
- package/dist/testing/start-test-spice-db.js.map +1 -0
- package/dist/testing/tuned-spice-db-benchmark.d.ts +22 -0
- package/dist/testing/tuned-spice-db-benchmark.d.ts.map +1 -0
- package/dist/testing/tuned-spice-db-benchmark.js +150 -0
- package/dist/testing/tuned-spice-db-benchmark.js.map +1 -0
- package/package.json +73 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type Result } from "@dads-framework/core/errors";
|
|
2
|
+
import type { Authorization } from "@dads-framework/access/runtime";
|
|
3
|
+
import type { ClaimAccessChanges } from "./claim.js";
|
|
4
|
+
import type { OwnerLock } from "@dads-framework/access/runtime";
|
|
5
|
+
export type ApplyAccessChangesReport = {
|
|
6
|
+
readonly claimed: number;
|
|
7
|
+
readonly projected: number;
|
|
8
|
+
readonly failed: number;
|
|
9
|
+
};
|
|
10
|
+
export type ApplyAccessChangesInput = {
|
|
11
|
+
readonly batchSize?: number;
|
|
12
|
+
readonly workerId: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Carries claimed facts from Postgres into SpiceDB — the outbox's only reader,
|
|
16
|
+
* and the reason a producer never has to call the graph itself.
|
|
17
|
+
*
|
|
18
|
+
* **Idempotency is the contract here, not a hope.** Delivery is at-least-once
|
|
19
|
+
* by design: a crashed worker's lease expires and its rows come back, so the
|
|
20
|
+
* same batch can be applied twice. That is safe because both operations are
|
|
21
|
+
* naturally idempotent — SpiceDB's relationship write uses TOUCH semantics, so
|
|
22
|
+
* writing an existing tuple changes nothing, and deleting an absent tuple is a
|
|
23
|
+
* no-op. The projector therefore never needs to ask what it already did.
|
|
24
|
+
*
|
|
25
|
+
* Each row settles on its own. One fact that cannot be projected must not
|
|
26
|
+
* strand the rest of the batch, because the rest are somebody's access.
|
|
27
|
+
*/
|
|
28
|
+
export declare class ApplyAccessChanges {
|
|
29
|
+
private readonly store;
|
|
30
|
+
private readonly authorization;
|
|
31
|
+
private readonly now;
|
|
32
|
+
private readonly coordinator;
|
|
33
|
+
private readonly leaseMs;
|
|
34
|
+
private readonly maxAttempts;
|
|
35
|
+
constructor(store: ClaimAccessChanges, authorization: Authorization, now: () => Date, coordinator: OwnerLock, leaseMs?: number, maxAttempts?: number);
|
|
36
|
+
execute(input: ApplyAccessChangesInput): Promise<Result<ApplyAccessChangesReport>>;
|
|
37
|
+
/**
|
|
38
|
+
* Project exactly the named facts — the immediate dispatch a create runs
|
|
39
|
+
* once its transaction has committed.
|
|
40
|
+
*
|
|
41
|
+
* It is the same claim/apply/settle path as `execute`, narrowed by key, so
|
|
42
|
+
* the producer still never touches claim or settle itself. A key already
|
|
43
|
+
* projected, or held by a live worker, is not claimed and therefore not
|
|
44
|
+
* re-applied.
|
|
45
|
+
*/
|
|
46
|
+
applyKeys(input: {
|
|
47
|
+
readonly idempotencyKeys: readonly string[];
|
|
48
|
+
readonly workerId: string;
|
|
49
|
+
}): Promise<Result<ApplyAccessChangesReport>>;
|
|
50
|
+
/**
|
|
51
|
+
* Of the named facts, the ones another worker is projecting right now:
|
|
52
|
+
* still PENDING under a live lease. It claims nothing, so a caller waiting
|
|
53
|
+
* on its own facts never takes them from the worker that holds them.
|
|
54
|
+
*/
|
|
55
|
+
keysHeldByLiveClaims(idempotencyKeys: readonly string[]): Promise<readonly string[]>;
|
|
56
|
+
private settle;
|
|
57
|
+
/** True when the fact reached the graph; false when it was recorded failed. */
|
|
58
|
+
private apply;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=apply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/lib/access-changes/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,MAAM,EAAE,MAAM,6BAA6B,CAA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AC,CAS5C;IAED;;;;OAIG;IACG,oBAAoB,CACxB,eAAe,EAAE,SAAS,MAAM,EAAE,GACjC,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAK5B;YAEa,MAAM;IAgCpB,+EAA+E;YACjE,KAAK;CAgCpB"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { ok } from "@dads-framework/core/errors";
|
|
2
|
+
import {} from "./claim.js";
|
|
3
|
+
import { DEFAULT_LEASE_MS, DEFAULT_MAX_ATTEMPTS, leaseCutoff, outcomeAfterFailure, summarizeError, } from "./logic/claim-rules.js";
|
|
4
|
+
/**
|
|
5
|
+
* Carries claimed facts from Postgres into SpiceDB — the outbox's only reader,
|
|
6
|
+
* and the reason a producer never has to call the graph itself.
|
|
7
|
+
*
|
|
8
|
+
* **Idempotency is the contract here, not a hope.** Delivery is at-least-once
|
|
9
|
+
* by design: a crashed worker's lease expires and its rows come back, so the
|
|
10
|
+
* same batch can be applied twice. That is safe because both operations are
|
|
11
|
+
* naturally idempotent — SpiceDB's relationship write uses TOUCH semantics, so
|
|
12
|
+
* writing an existing tuple changes nothing, and deleting an absent tuple is a
|
|
13
|
+
* no-op. The projector therefore never needs to ask what it already did.
|
|
14
|
+
*
|
|
15
|
+
* Each row settles on its own. One fact that cannot be projected must not
|
|
16
|
+
* strand the rest of the batch, because the rest are somebody's access.
|
|
17
|
+
*/
|
|
18
|
+
export class ApplyAccessChanges {
|
|
19
|
+
store;
|
|
20
|
+
authorization;
|
|
21
|
+
now;
|
|
22
|
+
coordinator;
|
|
23
|
+
leaseMs;
|
|
24
|
+
maxAttempts;
|
|
25
|
+
constructor(store, authorization, now, coordinator, leaseMs = DEFAULT_LEASE_MS, maxAttempts = DEFAULT_MAX_ATTEMPTS) {
|
|
26
|
+
this.store = store;
|
|
27
|
+
this.authorization = authorization;
|
|
28
|
+
this.now = now;
|
|
29
|
+
this.coordinator = coordinator;
|
|
30
|
+
this.leaseMs = leaseMs;
|
|
31
|
+
this.maxAttempts = maxAttempts;
|
|
32
|
+
}
|
|
33
|
+
async execute(input) {
|
|
34
|
+
const at = this.now();
|
|
35
|
+
const claimed = await this.store.claim({
|
|
36
|
+
batchSize: input.batchSize ?? 50,
|
|
37
|
+
workerId: input.workerId,
|
|
38
|
+
now: at,
|
|
39
|
+
leaseCutoff: leaseCutoff(at, this.leaseMs),
|
|
40
|
+
});
|
|
41
|
+
return this.settle(claimed, input.workerId);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Project exactly the named facts — the immediate dispatch a create runs
|
|
45
|
+
* once its transaction has committed.
|
|
46
|
+
*
|
|
47
|
+
* It is the same claim/apply/settle path as `execute`, narrowed by key, so
|
|
48
|
+
* the producer still never touches claim or settle itself. A key already
|
|
49
|
+
* projected, or held by a live worker, is not claimed and therefore not
|
|
50
|
+
* re-applied.
|
|
51
|
+
*/
|
|
52
|
+
async applyKeys(input) {
|
|
53
|
+
const at = this.now();
|
|
54
|
+
const claimed = await this.store.claimByKeys({
|
|
55
|
+
idempotencyKeys: input.idempotencyKeys,
|
|
56
|
+
workerId: input.workerId,
|
|
57
|
+
now: at,
|
|
58
|
+
leaseCutoff: leaseCutoff(at, this.leaseMs),
|
|
59
|
+
});
|
|
60
|
+
return this.settle(claimed, input.workerId);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Of the named facts, the ones another worker is projecting right now:
|
|
64
|
+
* still PENDING under a live lease. It claims nothing, so a caller waiting
|
|
65
|
+
* on its own facts never takes them from the worker that holds them.
|
|
66
|
+
*/
|
|
67
|
+
async keysHeldByLiveClaims(idempotencyKeys) {
|
|
68
|
+
return this.store.heldByLiveClaim({
|
|
69
|
+
idempotencyKeys,
|
|
70
|
+
leaseCutoff: leaseCutoff(this.now(), this.leaseMs),
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
async settle(claimed, workerId) {
|
|
74
|
+
let projected = 0;
|
|
75
|
+
let failed = 0;
|
|
76
|
+
for (const row of claimed) {
|
|
77
|
+
const settleRow = async () => {
|
|
78
|
+
const owned = await this.store.isClaimOwned(row.id, workerId);
|
|
79
|
+
if (!owned)
|
|
80
|
+
return "SUPERSEDED";
|
|
81
|
+
const applied = await this.apply(row, workerId);
|
|
82
|
+
if (applied === "APPLIED") {
|
|
83
|
+
const settled = await this.store.markProjected([row.id], this.now(), workerId);
|
|
84
|
+
return settled ? "PROJECTED" : "OWNERSHIP_LOST";
|
|
85
|
+
}
|
|
86
|
+
return applied;
|
|
87
|
+
};
|
|
88
|
+
const outcome = row.ownerPartitionId === null
|
|
89
|
+
? await settleRow()
|
|
90
|
+
: await this.coordinator.run(row.ownerPartitionId, settleRow);
|
|
91
|
+
if (outcome === "PROJECTED")
|
|
92
|
+
projected += 1;
|
|
93
|
+
if (outcome === "FAILED")
|
|
94
|
+
failed += 1;
|
|
95
|
+
}
|
|
96
|
+
return ok({ claimed: claimed.length, projected, failed });
|
|
97
|
+
}
|
|
98
|
+
/** True when the fact reached the graph; false when it was recorded failed. */
|
|
99
|
+
async apply(row, workerId) {
|
|
100
|
+
try {
|
|
101
|
+
if (row.operation === "WRITE") {
|
|
102
|
+
await this.authorization.writeRelationships([toRelationship(row)]);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
await this.authorization.deleteRelationships({
|
|
106
|
+
resourceType: row.resourceType,
|
|
107
|
+
resourceId: row.resourceId,
|
|
108
|
+
relation: row.relation,
|
|
109
|
+
subject: {
|
|
110
|
+
type: row.subjectType,
|
|
111
|
+
id: row.subjectId,
|
|
112
|
+
...(row.subjectRelation === null
|
|
113
|
+
? {}
|
|
114
|
+
: { relation: row.subjectRelation }),
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
return "APPLIED";
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
const settled = await this.store.markFailed(row.id, outcomeAfterFailure(row.attempts, this.maxAttempts), summarizeError(error), workerId);
|
|
122
|
+
return settled ? "FAILED" : "OWNERSHIP_LOST";
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function toRelationship(row) {
|
|
127
|
+
return {
|
|
128
|
+
resource: { type: row.resourceType, id: row.resourceId },
|
|
129
|
+
relation: row.relation,
|
|
130
|
+
subject: {
|
|
131
|
+
type: row.subjectType,
|
|
132
|
+
id: row.subjectId,
|
|
133
|
+
...(row.subjectRelation === null
|
|
134
|
+
? {}
|
|
135
|
+
: { relation: row.subjectRelation }),
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/lib/access-changes/apply.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAe,MAAM,6BAA6B,CAAC;AAO9D,OAAO,EAAyB,MAAM,YAAY,CAAC;AACnD,OAAO,EACL,gBAAgB,EAChB,oBAAoB,EACpB,WAAW,EACX,mBAAmB,EACnB,cAAc,GACf,MAAM,wBAAwB,CAAC;AAchC;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,kBAAkB;IAEV,KAAK;IACL,aAAa;IACb,GAAG;IACH,WAAW;IACX,OAAO;IACP,WAAW;IAN9B,YACmB,KAAyB,EACzB,aAA4B,EAC5B,GAAe,EACf,WAAsB,EACtB,OAAO,GAAW,gBAAgB,EAClC,WAAW,GAAW,oBAAoB;qBAL1C,KAAK;6BACL,aAAa;mBACb,GAAG;2BACH,WAAW;uBACX,OAAO;2BACP,WAAW;IAC3B,CAAC;IAEJ,KAAK,CAAC,OAAO,CACX,KAA8B;QAE9B,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;YACrC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,EAAE;YAChC,QAAQ,EAAE,KAAK,CAA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./access-change.ids.js";
|
|
2
|
+
import type { authorizationOutbox } from "./postgres/access-changes.tables.js";
|
|
3
|
+
/**
|
|
4
|
+
* The projector's side of the outbox: claim work, report what happened.
|
|
5
|
+
*
|
|
6
|
+
* Separate from `EnqueueAccessChanges` on purpose. Producers only ever append,
|
|
7
|
+
* inside someone else's transaction; the projector only ever claims and
|
|
8
|
+
* settles, in its own. Keeping them apart means a domain writer cannot reach a
|
|
9
|
+
* method that marks facts projected, and the projector cannot enqueue.
|
|
10
|
+
*/
|
|
11
|
+
/** One claimed fact, flattened out of storage and ready to apply. */
|
|
12
|
+
export type ClaimedOutboxRow = Readonly<Pick<typeof authorizationOutbox.$inferSelect, "id" | "idempotencyKey" | "operation" | "resourceType" | "resourceId" | "relation" | "subjectType" | "subjectId" | "subjectRelation" | "ownerPartitionId" | "attempts">>;
|
|
13
|
+
export type OutboxClaim = {
|
|
14
|
+
readonly batchSize: number;
|
|
15
|
+
readonly workerId: string;
|
|
16
|
+
readonly now: Date;
|
|
17
|
+
/** Rows locked at or before this instant are stealable (a dead worker's). */
|
|
18
|
+
readonly leaseCutoff: Date;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A claim narrowed to facts the caller already knows the keys of — the
|
|
22
|
+
* immediate dispatch that runs right after a create commits.
|
|
23
|
+
*
|
|
24
|
+
* Scoped rather than a general drain on purpose: a request must project the
|
|
25
|
+
* facts IT caused and nothing else. A full-queue drain inside a request would
|
|
26
|
+
* make one user's create latency depend on the size of everybody's backlog,
|
|
27
|
+
* and would let a poison row anywhere in the queue take the request down with
|
|
28
|
+
* it. Same lease rules, same exclusion, narrower window.
|
|
29
|
+
*/
|
|
30
|
+
export type OutboxKeyClaim = {
|
|
31
|
+
readonly idempotencyKeys: readonly string[];
|
|
32
|
+
readonly workerId: string;
|
|
33
|
+
readonly now: Date;
|
|
34
|
+
readonly leaseCutoff: Date;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Named facts to look up without claiming them: which are still PENDING under
|
|
38
|
+
* a live lease (locked after `leaseCutoff`), so another worker is projecting
|
|
39
|
+
* them right now.
|
|
40
|
+
*/
|
|
41
|
+
export type OutboxHeldKeysQuery = {
|
|
42
|
+
readonly idempotencyKeys: readonly string[];
|
|
43
|
+
readonly leaseCutoff: Date;
|
|
44
|
+
};
|
|
45
|
+
export type OutboxCounts = {
|
|
46
|
+
readonly pending: number;
|
|
47
|
+
readonly failed: number;
|
|
48
|
+
};
|
|
49
|
+
export declare abstract class ClaimAccessChanges {
|
|
50
|
+
/**
|
|
51
|
+
* Take up to `batchSize` rows, stamping them with this worker. Must be
|
|
52
|
+
* atomic per row — two workers running at once may never receive the same
|
|
53
|
+
* fact — which is why the adapter claims with `FOR UPDATE SKIP LOCKED` and
|
|
54
|
+
* this seam offers no read-then-write alternative.
|
|
55
|
+
*/
|
|
56
|
+
abstract claim(claim: OutboxClaim): Promise<readonly ClaimedOutboxRow[]>;
|
|
57
|
+
/**
|
|
58
|
+
* The same atomic take, restricted to named facts. A key whose row is
|
|
59
|
+
* already PROJECTED, or is held by a live worker, is simply not returned —
|
|
60
|
+
* so a dispatch that races the background projector does nothing rather
|
|
61
|
+
* than projecting twice.
|
|
62
|
+
*/
|
|
63
|
+
abstract claimByKeys(claim: OutboxKeyClaim): Promise<readonly ClaimedOutboxRow[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Of the named facts, the keys still PENDING and held under a live lease by
|
|
66
|
+
* any worker. A read only: it claims nothing, takes no row lock and never
|
|
67
|
+
* waits, so a caller can watch another worker's claim without stealing it.
|
|
68
|
+
*/
|
|
69
|
+
abstract heldByLiveClaim(query: OutboxHeldKeysQuery): Promise<readonly string[]>;
|
|
70
|
+
abstract isClaimOwned(id: AccessChangeId, workerId: string): Promise<boolean>;
|
|
71
|
+
abstract markProjected(ids: readonly AccessChangeId[], at: Date, workerId: string): Promise<boolean>;
|
|
72
|
+
abstract markFailed(id: AccessChangeId, outcome: {
|
|
73
|
+
readonly status: "PENDING" | "FAILED";
|
|
74
|
+
readonly attempts: number;
|
|
75
|
+
}, lastError: string, workerId: string): Promise<boolean>;
|
|
76
|
+
/** What the reconcile operation reports: is the projector telling the truth? */
|
|
77
|
+
abstract counts(): Promise<OutboxCounts>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=claim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim.d.ts","sourceRoot":"","sources":["../../../src/lib/access-changes/claim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAE/E;;;;;;;GAOG;AAEH,qEAAqE;AACrE,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CACrC,IAAI,CACF,OAAO,mBAAmB,CAAC,YAAY,EACrC,IAAI,GACJ,gBAAgB,GAChB,WAAW,GACX,cAAc,GACd,YAAY,GACZ,UAAU,GACV,aAAa,GACb,WAAW,GACX,iBAAiB,GACjB,kBAAkB,GAClB,UAAU,CACb,CACF,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;IAC5C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;CAC5B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAA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@@
|
|
|
1
|
+
{"version":3,"file":"claim.js","sourceRoot":"","sources":["../../../src/lib/access-changes/claim.ts"],"names":[],"mappings":"AAsEA,MAAM,OAAgB,kBAAkB;CA0CvC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { type Result } from "@dads-framework/core/errors";
|
|
2
|
+
import type { ApplyAccessChanges } from "./apply.js";
|
|
3
|
+
import type { AccessChangeCompletionStatusReader, RetryFailedAccessChanges } from "./completion-status.js";
|
|
4
|
+
import type { OwnerLock } from "@dads-framework/access/runtime";
|
|
5
|
+
export type CompleteAccessChangesInput = {
|
|
6
|
+
readonly ownerPartitionIds: readonly string[];
|
|
7
|
+
/** Starts another attempt budget only for the previously exhausted facts. */
|
|
8
|
+
readonly retryFailed?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Finish only these facts inside the named partitions. A request that must
|
|
11
|
+
* not answer before its own facts land names them, so another caller's
|
|
12
|
+
* backlog in the same partition is neither applied inside the request nor
|
|
13
|
+
* able to fail it. Omitted, every unfinished fact in the partitions counts;
|
|
14
|
+
* an empty list has nothing to finish.
|
|
15
|
+
*/
|
|
16
|
+
readonly idempotencyKeys?: readonly string[];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Returns success only after the named partitions — or, when the caller names
|
|
20
|
+
* facts, those facts within them — have nothing unfinished. Callers must
|
|
21
|
+
* release every lifecycle lease before invoking completion.
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class CompleteAccessChanges {
|
|
24
|
+
abstract complete(input: CompleteAccessChangesInput): Promise<Result<void>>;
|
|
25
|
+
}
|
|
26
|
+
type CompletionDependencies = {
|
|
27
|
+
readonly statusReader: AccessChangeCompletionStatusReader;
|
|
28
|
+
readonly retry: RetryFailedAccessChanges;
|
|
29
|
+
readonly projector: Pick<ApplyAccessChanges, "applyKeys">;
|
|
30
|
+
readonly ownerLock: OwnerLock;
|
|
31
|
+
readonly createWorkerId?: () => string;
|
|
32
|
+
readonly now?: () => number;
|
|
33
|
+
readonly delay?: (milliseconds: number) => Promise<void>;
|
|
34
|
+
};
|
|
35
|
+
/** Creates strict completion without changing best-effort inline dispatch. */
|
|
36
|
+
export declare function createCompleteAccessChanges(dependencies: CompletionDependencies): CompleteAccessChanges;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=complete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../src/lib/access-changes/complete.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,KAAK,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAE,kBAAkB,EAA4B,MAAM,YAAY,CAAC;AAC/E,OAAO,KAAK,EACV,kCAAkC,EAClC,wBAAwB,EAEzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAEhE,MAAM,MAAM,0BAA0B,GAAG;IACvC,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9C,6EAA6E;IAC7E,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C,CAAC;AAEF;;;;GAIG;AACH,8BAAsB,qBAAqB;IACzC,QAAQ,CAAC,QAAQ,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;CAC7E;AAWD,KAAK,sBAAsB,GAAG;IAC5B,QAAQ,CAAC,YAAY,EAAE,kCAAkC,CAAC;IAC1D,QAAQ,CAAC,KAAK,EAAE,wBAAwB,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,CAAC;IAC1D,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,MAAM,CAAC;IACvC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D,CAAC;AAqGF,8EAA8E;AAC9E,wBAAgB,2BAA2B,CACzC,YAAY,EAAE,sBAAsB,GACnC,qBAAqB,CAEvB"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { setTimeout as sleep } from "node:timers/promises";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { conflict, err, ok } from "@dads-framework/core/errors";
|
|
4
|
+
/**
|
|
5
|
+
* Returns success only after the named partitions — or, when the caller names
|
|
6
|
+
* facts, those facts within them — have nothing unfinished. Callers must
|
|
7
|
+
* release every lifecycle lease before invoking completion.
|
|
8
|
+
*/
|
|
9
|
+
export class CompleteAccessChanges {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* How long completion waits for facts another live worker has claimed. Two
|
|
13
|
+
* requests for one customer overlap routinely — Entra provisions in parallel —
|
|
14
|
+
* and the other worker settles its claim in milliseconds, so refusing at once
|
|
15
|
+
* turned ordinary overlap into a 409. Bounded well inside the request timeout.
|
|
16
|
+
*/
|
|
17
|
+
const OTHER_WORKER_WAIT_MS = 5_000;
|
|
18
|
+
const OTHER_WORKER_POLL_MS = 25;
|
|
19
|
+
class CompleteAccessChangesLive extends CompleteAccessChanges {
|
|
20
|
+
dependencies;
|
|
21
|
+
constructor(dependencies) {
|
|
22
|
+
super();
|
|
23
|
+
this.dependencies = dependencies;
|
|
24
|
+
}
|
|
25
|
+
async complete(input) {
|
|
26
|
+
const ownerPartitionIds = [...new Set(input.ownerPartitionIds)].sort();
|
|
27
|
+
if (hasNothingToFinish(ownerPartitionIds, input.idempotencyKeys)) {
|
|
28
|
+
return ok(undefined);
|
|
29
|
+
}
|
|
30
|
+
const named = namedFacts(input.idempotencyKeys);
|
|
31
|
+
try {
|
|
32
|
+
const unfinished = await this.readUnfinished(ownerPartitionIds, named);
|
|
33
|
+
if (input.retryFailed === true) {
|
|
34
|
+
await this.retryFailed(ownerPartitionIds, unfinished);
|
|
35
|
+
}
|
|
36
|
+
return await this.finish(ownerPartitionIds, named, unfinished);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return incomplete();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Project what this worker can claim, then wait out facts another live
|
|
44
|
+
* worker holds. A refused projection or an exhausted fact ends it at once:
|
|
45
|
+
* nobody else is about to settle those.
|
|
46
|
+
*/
|
|
47
|
+
async finish(ownerPartitionIds, named, firstUnfinished) {
|
|
48
|
+
const now = this.dependencies.now ?? Date.now;
|
|
49
|
+
const delay = this.dependencies.delay ?? sleep;
|
|
50
|
+
const deadline = now() + OTHER_WORKER_WAIT_MS;
|
|
51
|
+
let unfinished = firstUnfinished;
|
|
52
|
+
for (;;) {
|
|
53
|
+
const report = await this.project(unfinished);
|
|
54
|
+
if (report === null)
|
|
55
|
+
return incomplete();
|
|
56
|
+
const remaining = await this.readUnfinished(ownerPartitionIds, named);
|
|
57
|
+
if (remaining.length === 0)
|
|
58
|
+
return ok(undefined);
|
|
59
|
+
if (!heldByAnotherWorker(unfinished, report))
|
|
60
|
+
return incomplete();
|
|
61
|
+
if (remaining.some((fact) => fact.status === "FAILED")) {
|
|
62
|
+
return incomplete();
|
|
63
|
+
}
|
|
64
|
+
if (now() >= deadline)
|
|
65
|
+
return incomplete();
|
|
66
|
+
await delay(OTHER_WORKER_POLL_MS);
|
|
67
|
+
unfinished = remaining;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** Null only when the projector refused facts it was handed. */
|
|
71
|
+
async project(unfinished) {
|
|
72
|
+
if (unfinished.length === 0)
|
|
73
|
+
return { claimed: 0, projected: 0, failed: 0 };
|
|
74
|
+
const projected = await this.dependencies.projector.applyKeys({
|
|
75
|
+
idempotencyKeys: unfinished.map((fact) => fact.idempotencyKey),
|
|
76
|
+
workerId: this.dependencies.createWorkerId?.() ?? randomUUID(),
|
|
77
|
+
});
|
|
78
|
+
return projected.ok ? projected.value : null;
|
|
79
|
+
}
|
|
80
|
+
/** The partitions' unfinished facts, narrowed to the named ones when given. */
|
|
81
|
+
async readUnfinished(ownerPartitionIds, named) {
|
|
82
|
+
const unfinished = await this.dependencies.statusReader.readUnfinished({
|
|
83
|
+
ownerPartitionIds,
|
|
84
|
+
});
|
|
85
|
+
if (named === null)
|
|
86
|
+
return unfinished;
|
|
87
|
+
return unfinished.filter((fact) => named.has(fact.idempotencyKey));
|
|
88
|
+
}
|
|
89
|
+
async retryFailed(ownerPartitionIds, unfinished) {
|
|
90
|
+
for (const ownerPartitionId of ownerPartitionIds) {
|
|
91
|
+
const idempotencyKeys = unfinished
|
|
92
|
+
.filter((fact) => fact.ownerPartitionId === ownerPartitionId &&
|
|
93
|
+
fact.status === "FAILED")
|
|
94
|
+
.map((fact) => fact.idempotencyKey);
|
|
95
|
+
if (idempotencyKeys.length === 0)
|
|
96
|
+
continue;
|
|
97
|
+
await this.dependencies.ownerLock.run(ownerPartitionId, (lease) => this.dependencies.retry.retryFailed({
|
|
98
|
+
ownerPartitionId,
|
|
99
|
+
idempotencyKeys,
|
|
100
|
+
lease,
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
/** Creates strict completion without changing best-effort inline dispatch. */
|
|
106
|
+
export function createCompleteAccessChanges(dependencies) {
|
|
107
|
+
return new CompleteAccessChangesLive(dependencies);
|
|
108
|
+
}
|
|
109
|
+
/** No partitions, or the caller named an empty list of facts. */
|
|
110
|
+
function hasNothingToFinish(ownerPartitionIds, idempotencyKeys) {
|
|
111
|
+
return ownerPartitionIds.length === 0 || idempotencyKeys?.length === 0;
|
|
112
|
+
}
|
|
113
|
+
/** The caller's named facts, or null when every unfinished fact counts. */
|
|
114
|
+
function namedFacts(idempotencyKeys) {
|
|
115
|
+
return idempotencyKeys === undefined ? null : new Set(idempotencyKeys);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Some PENDING fact went unclaimed and nothing failed: another live worker
|
|
119
|
+
* holds it. A FAILED fact is never claimable, so it does not count.
|
|
120
|
+
*/
|
|
121
|
+
function heldByAnotherWorker(unfinished, report) {
|
|
122
|
+
const pending = unfinished.filter((fact) => fact.status === "PENDING");
|
|
123
|
+
return report.failed === 0 && report.claimed < pending.length;
|
|
124
|
+
}
|
|
125
|
+
function incomplete() {
|
|
126
|
+
return err(conflict("AUTHORIZATION_ACCESS_CHANGES_INCOMPLETE", "Access changes are not yet enforced; retry provisioning", { retryable: true }));
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=complete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complete.js","sourceRoot":"","sources":["../../../src/lib/access-changes/complete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,EAAe,MAAM,6BAA6B,CAAC;AAuB7E;;;;GAIG;AACH,MAAM,OAAgB,qBAAqB;CAE1C;AAED;;;;;GAKG;AACH,MAAM,oBAAoB,GAAG,KAAK,CAAC;AACnC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAYhC,MAAM,yBAA0B,SAAQ,qBAAqB;IAC9B,YAAY;IAAzC,YAA6B,YAAoC;QAC/D,KAAK,EAAE,CAAC;4BADmB,YAAY;IAEzC,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,KAAiC;QAC9C,MAAM,iBAAiB,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,IAAI,EA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C,CAAC;AACzE,CAAC;AAED;;;GAGG;AACH,SAAS,mBAAmB,CAC1B,UAA6C,EAC7C,MAAgC;IAEhC,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;IACvE,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;AAChE,CAAC;AAED,SAAS,UAAU;IACjB,OAAO,GAAG,CACR,QAAQ,CACN,yCAAyC,EACzC,yDAAyD,EACzD,EAAE,SAAS,EAAE,IAAI,EAAE,CACpB,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { OwnerLockLease } from "@dads-framework/access/runtime";
|
|
2
|
+
export type UnfinishedAccessChange = {
|
|
3
|
+
readonly idempotencyKey: string;
|
|
4
|
+
readonly ownerPartitionId: string;
|
|
5
|
+
readonly status: "PENDING" | "FAILED";
|
|
6
|
+
};
|
|
7
|
+
/** Reads unfinished facts only within the caller's explicit owner partitions. */
|
|
8
|
+
export declare abstract class AccessChangeCompletionStatusReader {
|
|
9
|
+
abstract readUnfinished(input: {
|
|
10
|
+
readonly ownerPartitionIds: readonly string[];
|
|
11
|
+
}): Promise<readonly UnfinishedAccessChange[]>;
|
|
12
|
+
}
|
|
13
|
+
/** Explicitly reopens named exhausted facts under their owner's live lease. */
|
|
14
|
+
export declare abstract class RetryFailedAccessChanges {
|
|
15
|
+
abstract retryFailed(input: {
|
|
16
|
+
readonly ownerPartitionId: string;
|
|
17
|
+
readonly idempotencyKeys: readonly string[];
|
|
18
|
+
readonly lease: OwnerLockLease;
|
|
19
|
+
}): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=completion-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion-status.d.ts","sourceRoot":"","sources":["../../../src/lib/access-changes/completion-status.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAAG;IACnC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,QAAQ,CAAC;CACvC,CAAC;AAEF,iFAAiF;AACjF,8BAAsB,kCAAkC;IACtD,QAAQ,CAAC,cAAc,CAAC,KAAK,EAAE;QAC7B,QAAQ,CAAC,iBAAiB,EAAE,SAAS,MAAM,EAAE,CAAC;KAC/C,GAAG,OAAO,CAAC,SAAS,sBAAsB,EAAE,CAAC,CAAC;CAChD;AAED,+EAA+E;AAC/E,8BAAsB,wBAAwB;IAC5C,QAAQ,CAAC,WAAW,CAAC,KAAK,EAAE;QAC1B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;QAClC,QAAQ,CAAC,eAAe,EAAE,SAAS,MAAM,EAAE,CAAC;QAC5C,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;KAChC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Reads unfinished facts only within the caller's explicit owner partitions. */
|
|
2
|
+
export class AccessChangeCompletionStatusReader {
|
|
3
|
+
}
|
|
4
|
+
/** Explicitly reopens named exhausted facts under their owner's live lease. */
|
|
5
|
+
export class RetryFailedAccessChanges {
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=completion-status.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion-status.js","sourceRoot":"","sources":["../../../src/lib/access-changes/completion-status.ts"],"names":[],"mappings":"AAQA,iFAAiF;AACjF,MAAM,OAAgB,kCAAkC;CAIvD;AAED,+EAA+E;AAC/E,MAAM,OAAgB,wBAAwB;CAM7C"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { EnqueueAccessChanges as AccessChangesEnqueuer } from "@dads-framework/access/runtime";
|
|
2
|
+
import type { DrizzleHandle } from "@dads-framework/postgres";
|
|
3
|
+
export { accessChangesToWrite, OUTBOX_OPERATION_VALUES, outboxKeyForRelationship, type AccessChange, type OutboxOperation, } from "@dads-framework/access/runtime";
|
|
4
|
+
export declare const OUTBOX_STATUS_VALUES: readonly ["PENDING", "PROJECTED", "FAILED", "SUPERSEDED"];
|
|
5
|
+
export type OutboxStatus = (typeof OUTBOX_STATUS_VALUES)[number];
|
|
6
|
+
/**
|
|
7
|
+
* The caller's open transaction handle. The outbox uses insert and update.
|
|
8
|
+
* Same-database authorization additionally requires execute on a real
|
|
9
|
+
* transaction. Other writers and test doubles can still use the narrow port.
|
|
10
|
+
*/
|
|
11
|
+
export type OutboxTx = Pick<DrizzleHandle, "insert" | "update"> & Partial<Pick<DrizzleHandle, "execute">>;
|
|
12
|
+
export type EnqueueAccessChanges = AccessChangesEnqueuer<OutboxTx>;
|
|
13
|
+
export declare const EnqueueAccessChanges: abstract new () => AccessChangesEnqueuer<OutboxTx>;
|
|
14
|
+
//# sourceMappingURL=enqueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enqueue.d.ts","sourceRoot":"","sources":["../../../src/lib/access-changes/enqueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAC/F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,EACxB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,MAAM,gCAAgC,CAAC;AAExC,eAAO,MAAM,oBAAoB,YAC/B,SAAS,EACT,WAAW,EACX,QAAQ,EACR,YAAY,CACJ,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,GAAG,QAAQ,CAAC,GAC7D,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;AAE1C,MAAM,MAAM,oBAAoB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;AACnE,eAAO,MAAM,oBAAoB,oDAAkC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { EnqueueAccessChanges as AccessChangesEnqueuer } from "@dads-framework/access/runtime";
|
|
2
|
+
export { accessChangesToWrite, OUTBOX_OPERATION_VALUES, outboxKeyForRelationship, } from "@dads-framework/access/runtime";
|
|
3
|
+
export const OUTBOX_STATUS_VALUES = [
|
|
4
|
+
"PENDING",
|
|
5
|
+
"PROJECTED",
|
|
6
|
+
"FAILED",
|
|
7
|
+
"SUPERSEDED",
|
|
8
|
+
];
|
|
9
|
+
export const EnqueueAccessChanges = AccessChangesEnqueuer;
|
|
10
|
+
//# sourceMappingURL=enqueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enqueue.js","sourceRoot":"","sources":["../../../src/lib/access-changes/enqueue.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAG/F,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,wBAAwB,GAGzB,MAAM,gCAAgC,CAAC;AAExC,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,SAAS;IACT,WAAW;IACX,QAAQ;IACR,YAAY;CACJ,CAAC;AAaX,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAA+B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { OutboxStatus } from "../enqueue.js";
|
|
2
|
+
/**
|
|
3
|
+
* The projector's decisions, with no database and no clock of their own.
|
|
4
|
+
*
|
|
5
|
+
* Claiming itself must happen in SQL — only the database can hand one row to
|
|
6
|
+
* exactly one worker — so what lives here is the two judgements that surround
|
|
7
|
+
* it: which rows a claim is ALLOWED to take, expressed as the cutoff its WHERE
|
|
8
|
+
* compares against, and what becomes of a row whose projection just failed.
|
|
9
|
+
* Both are the kind of arithmetic that is wrong in production and untestable
|
|
10
|
+
* there.
|
|
11
|
+
*/
|
|
12
|
+
/** How long a worker may hold a claimed row before another may steal it. */
|
|
13
|
+
export declare const DEFAULT_LEASE_MS = 60000;
|
|
14
|
+
/**
|
|
15
|
+
* Give up after this many failures and leave the row for a human. The count is
|
|
16
|
+
* deliberately small: a fact that has failed five times is not going to
|
|
17
|
+
* succeed on the sixth, and a row retried forever is a queue that never drains
|
|
18
|
+
* and an alert nobody sees.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_MAX_ATTEMPTS = 5;
|
|
21
|
+
/**
|
|
22
|
+
* A row locked at or before this instant has an expired lease and may be
|
|
23
|
+
* re-claimed. This is what stops a crashed worker parking a fact forever: the
|
|
24
|
+
* worker is gone, its lock is stale, and the next run takes the row back.
|
|
25
|
+
*/
|
|
26
|
+
export declare function leaseCutoff(now: Date, leaseMs?: number): Date;
|
|
27
|
+
/**
|
|
28
|
+
* A failure settles a row as retryable or spent — never as PROJECTED, which is
|
|
29
|
+
* why the type is narrower than `OutboxStatus`.
|
|
30
|
+
*/
|
|
31
|
+
export type FailureOutcome = {
|
|
32
|
+
readonly status: Extract<OutboxStatus, "PENDING" | "FAILED">;
|
|
33
|
+
readonly attempts: number;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* What a failed projection does to its row. Below the limit it goes back to
|
|
37
|
+
* PENDING with its lock released, so the next run picks it up; at the limit it
|
|
38
|
+
* becomes FAILED and stays visible, because a fact that cannot be projected is
|
|
39
|
+
* a human's problem and a silent drop would be a permission that quietly never
|
|
40
|
+
* arrived.
|
|
41
|
+
*/
|
|
42
|
+
export declare function outcomeAfterFailure(attemptsBefore: number, maxAttempts?: number): FailureOutcome;
|
|
43
|
+
/**
|
|
44
|
+
* Trim an adapter's error to something a `last_error` column and a human can
|
|
45
|
+
* both hold. Never widened into structured diagnostics: this column exists to
|
|
46
|
+
* say what went wrong at a glance, and the projector's logs hold the rest.
|
|
47
|
+
*/
|
|
48
|
+
export declare function summarizeError(error: unknown, maxLength?: number): string;
|
|
49
|
+
//# sourceMappingURL=claim-rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-rules.d.ts","sourceRoot":"","sources":["../../../../src/lib/access-changes/logic/claim-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD;;;;;;;;;GASG;AAEH,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,QAAS,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;;;GAIG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,IAAI,EACT,OAAO,GAAE,MAAyB,GACjC,IAAI,CAEN;AAED;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,SAAS,GAAG,QAAQ,CAAC,CAAC;IAC7D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,MAAM,EACtB,WAAW,GAAE,MAA6B,GACzC,cAAc,CAGhB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,SAAM,GAAG,MAAM,CAKtE"}
|