@powerhousedao/reactor 6.0.0-dev.9 → 6.0.0-dev.90
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/dist/src/admin/document-integrity-service.d.ts +17 -0
- package/dist/src/admin/document-integrity-service.d.ts.map +1 -0
- package/dist/src/admin/types.d.ts +30 -0
- package/dist/src/admin/types.d.ts.map +1 -0
- package/dist/src/cache/collection-membership-cache.d.ts +14 -0
- package/dist/src/cache/collection-membership-cache.d.ts.map +1 -0
- package/dist/src/cache/document-meta-cache.d.ts +1 -0
- package/dist/src/cache/document-meta-cache.d.ts.map +1 -1
- package/dist/src/cache/kysely-operation-index.d.ts +11 -2
- package/dist/src/cache/kysely-operation-index.d.ts.map +1 -1
- package/dist/src/cache/kysely-write-cache.d.ts +10 -2
- package/dist/src/cache/kysely-write-cache.d.ts.map +1 -1
- package/dist/src/cache/operation-index-types.d.ts +16 -2
- package/dist/src/cache/operation-index-types.d.ts.map +1 -1
- package/dist/src/cache/write/interfaces.d.ts +7 -2
- package/dist/src/cache/write/interfaces.d.ts.map +1 -1
- package/dist/src/client/reactor-client.d.ts +13 -10
- package/dist/src/client/reactor-client.d.ts.map +1 -1
- package/dist/src/client/types.d.ts +25 -6
- package/dist/src/client/types.d.ts.map +1 -1
- package/dist/src/core/reactor-builder.d.ts +23 -10
- package/dist/src/core/reactor-builder.d.ts.map +1 -1
- package/dist/src/core/reactor-client-builder.d.ts +8 -4
- package/dist/src/core/reactor-client-builder.d.ts.map +1 -1
- package/dist/src/core/reactor.d.ts +20 -80
- package/dist/src/core/reactor.d.ts.map +1 -1
- package/dist/src/core/types.d.ts +64 -28
- package/dist/src/core/types.d.ts.map +1 -1
- package/dist/src/core/utils.d.ts +39 -3
- package/dist/src/core/utils.d.ts.map +1 -1
- package/dist/src/events/types.d.ts +35 -10
- package/dist/src/events/types.d.ts.map +1 -1
- package/dist/src/executor/document-action-handler.d.ts +30 -0
- package/dist/src/executor/document-action-handler.d.ts.map +1 -0
- package/dist/src/executor/execution-scope.d.ts +44 -0
- package/dist/src/executor/execution-scope.d.ts.map +1 -0
- package/dist/src/executor/signature-verifier.d.ts +9 -0
- package/dist/src/executor/signature-verifier.d.ts.map +1 -0
- package/dist/src/executor/simple-job-executor-manager.d.ts +6 -1
- package/dist/src/executor/simple-job-executor-manager.d.ts.map +1 -1
- package/dist/src/executor/simple-job-executor.d.ts +8 -46
- package/dist/src/executor/simple-job-executor.d.ts.map +1 -1
- package/dist/src/executor/types.d.ts +1 -3
- package/dist/src/executor/types.d.ts.map +1 -1
- package/dist/src/executor/util.d.ts +12 -2
- package/dist/src/executor/util.d.ts.map +1 -1
- package/dist/src/index.d.ts +13 -9
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +20501 -61
- package/dist/src/job-tracker/in-memory-job-tracker.d.ts +4 -3
- package/dist/src/job-tracker/in-memory-job-tracker.d.ts.map +1 -1
- package/dist/src/job-tracker/interfaces.d.ts +3 -1
- package/dist/src/job-tracker/interfaces.d.ts.map +1 -1
- package/dist/src/logging/console.d.ts +1 -22
- package/dist/src/logging/console.d.ts.map +1 -1
- package/dist/src/logging/types.d.ts +1 -11
- package/dist/src/logging/types.d.ts.map +1 -1
- package/dist/src/processors/index.d.ts +0 -1
- package/dist/src/processors/index.d.ts.map +1 -1
- package/dist/src/processors/processor-manager.d.ts +19 -6
- package/dist/src/processors/processor-manager.d.ts.map +1 -1
- package/dist/src/processors/utils.d.ts +3 -2
- package/dist/src/processors/utils.d.ts.map +1 -1
- package/dist/src/queue/job-execution-handle.d.ts +3 -0
- package/dist/src/queue/job-execution-handle.d.ts.map +1 -1
- package/dist/src/queue/queue.d.ts +30 -1
- package/dist/src/queue/queue.d.ts.map +1 -1
- package/dist/src/queue/types.d.ts +4 -3
- package/dist/src/queue/types.d.ts.map +1 -1
- package/dist/src/read-models/base-read-model.d.ts +11 -9
- package/dist/src/read-models/base-read-model.d.ts.map +1 -1
- package/dist/src/read-models/coordinator.d.ts +2 -2
- package/dist/src/read-models/coordinator.d.ts.map +1 -1
- package/dist/src/read-models/document-view.d.ts +7 -4
- package/dist/src/read-models/document-view.d.ts.map +1 -1
- package/dist/src/read-models/interfaces.d.ts +1 -1
- package/dist/src/read-models/interfaces.d.ts.map +1 -1
- package/dist/src/read-models/types.d.ts +16 -0
- package/dist/src/read-models/types.d.ts.map +1 -1
- package/dist/src/registry/document-model-resolver.d.ts +29 -0
- package/dist/src/registry/document-model-resolver.d.ts.map +1 -0
- package/dist/src/registry/implementation.d.ts +4 -0
- package/dist/src/registry/implementation.d.ts.map +1 -1
- package/dist/src/registry/index.d.ts +3 -1
- package/dist/src/registry/index.d.ts.map +1 -1
- package/dist/src/registry/interfaces.d.ts +8 -0
- package/dist/src/registry/interfaces.d.ts.map +1 -1
- package/dist/src/shared/awaiter.d.ts +2 -2
- package/dist/src/shared/awaiter.d.ts.map +1 -1
- package/dist/src/shared/collect-all-pages.d.ts +7 -0
- package/dist/src/shared/collect-all-pages.d.ts.map +1 -0
- package/dist/src/shared/drive-url.d.ts +15 -0
- package/dist/src/shared/drive-url.d.ts.map +1 -0
- package/dist/src/shared/errors.d.ts +9 -0
- package/dist/src/shared/errors.d.ts.map +1 -1
- package/dist/src/shared/factories.d.ts +6 -2
- package/dist/src/shared/factories.d.ts.map +1 -1
- package/dist/src/shared/types.d.ts +32 -6
- package/dist/src/shared/types.d.ts.map +1 -1
- package/dist/src/signer/passthrough-signer.d.ts +1 -1
- package/dist/src/signer/passthrough-signer.d.ts.map +1 -1
- package/dist/src/storage/interfaces.d.ts +252 -124
- package/dist/src/storage/interfaces.d.ts.map +1 -1
- package/dist/src/storage/kysely/document-indexer.d.ts +17 -18
- package/dist/src/storage/kysely/document-indexer.d.ts.map +1 -1
- package/dist/src/storage/kysely/keyframe-store.d.ts +10 -1
- package/dist/src/storage/kysely/keyframe-store.d.ts.map +1 -1
- package/dist/src/storage/kysely/store.d.ts +9 -4
- package/dist/src/storage/kysely/store.d.ts.map +1 -1
- package/dist/src/storage/kysely/sync-cursor-storage.d.ts +1 -1
- package/dist/src/storage/kysely/sync-cursor-storage.d.ts.map +1 -1
- package/dist/src/storage/kysely/sync-dead-letter-storage.d.ts +17 -0
- package/dist/src/storage/kysely/sync-dead-letter-storage.d.ts.map +1 -0
- package/dist/src/storage/kysely/types.d.ts +22 -0
- package/dist/src/storage/kysely/types.d.ts.map +1 -1
- package/dist/src/storage/migrations/011_add_cursor_type_column.d.ts +3 -0
- package/dist/src/storage/migrations/011_add_cursor_type_column.d.ts.map +1 -0
- package/dist/src/storage/migrations/012_add_source_remote_column.d.ts +3 -0
- package/dist/src/storage/migrations/012_add_source_remote_column.d.ts.map +1 -0
- package/dist/src/storage/migrations/013_create_sync_dead_letters_table.d.ts +3 -0
- package/dist/src/storage/migrations/013_create_sync_dead_letters_table.d.ts.map +1 -0
- package/dist/src/storage/migrations/014_create_processor_cursor_table.d.ts +3 -0
- package/dist/src/storage/migrations/014_create_processor_cursor_table.d.ts.map +1 -0
- package/dist/src/storage/migrations/migrator.d.ts.map +1 -1
- package/dist/src/subs/default-error-handler.d.ts.map +1 -1
- package/dist/src/subs/subscription-notification-read-model.d.ts +3 -2
- package/dist/src/subs/subscription-notification-read-model.d.ts.map +1 -1
- package/dist/src/sync/batch-aggregator.d.ts +25 -0
- package/dist/src/sync/batch-aggregator.d.ts.map +1 -0
- package/dist/src/sync/buffered-mailbox.d.ts +36 -0
- package/dist/src/sync/buffered-mailbox.d.ts.map +1 -0
- package/dist/src/sync/channels/gql-req-channel.d.ts +121 -0
- package/dist/src/sync/channels/gql-req-channel.d.ts.map +1 -0
- package/dist/src/sync/channels/gql-request-channel-factory.d.ts +32 -0
- package/dist/src/sync/channels/gql-request-channel-factory.d.ts.map +1 -0
- package/dist/src/sync/channels/gql-res-channel.d.ts +31 -0
- package/dist/src/sync/channels/gql-res-channel.d.ts.map +1 -0
- package/dist/src/sync/channels/gql-response-channel-factory.d.ts +13 -0
- package/dist/src/sync/channels/gql-response-channel-factory.d.ts.map +1 -0
- package/dist/src/sync/channels/index.d.ts +6 -4
- package/dist/src/sync/channels/index.d.ts.map +1 -1
- package/dist/src/sync/channels/interval-poll-timer.d.ts +40 -0
- package/dist/src/sync/channels/interval-poll-timer.d.ts.map +1 -0
- package/dist/src/sync/channels/poll-timer.d.ts +14 -0
- package/dist/src/sync/channels/poll-timer.d.ts.map +1 -0
- package/dist/src/sync/channels/utils.d.ts +15 -1
- package/dist/src/sync/channels/utils.d.ts.map +1 -1
- package/dist/src/sync/index.d.ts +11 -7
- package/dist/src/sync/index.d.ts.map +1 -1
- package/dist/src/sync/interfaces.d.ts +42 -19
- package/dist/src/sync/interfaces.d.ts.map +1 -1
- package/dist/src/sync/mailbox.d.ts +51 -12
- package/dist/src/sync/mailbox.d.ts.map +1 -1
- package/dist/src/sync/sync-awaiter.d.ts +34 -0
- package/dist/src/sync/sync-awaiter.d.ts.map +1 -0
- package/dist/src/sync/sync-builder.d.ts +5 -1
- package/dist/src/sync/sync-builder.d.ts.map +1 -1
- package/dist/src/sync/sync-manager.d.ts +22 -8
- package/dist/src/sync/sync-manager.d.ts.map +1 -1
- package/dist/src/sync/sync-operation.d.ts +4 -2
- package/dist/src/sync/sync-operation.d.ts.map +1 -1
- package/dist/src/sync/sync-status-tracker.d.ts +31 -0
- package/dist/src/sync/sync-status-tracker.d.ts.map +1 -0
- package/dist/src/sync/types.d.ts +107 -2
- package/dist/src/sync/types.d.ts.map +1 -1
- package/dist/src/sync/utils.d.ts +37 -2
- package/dist/src/sync/utils.d.ts.map +1 -1
- package/dist/src/utils/reshuffle.d.ts +22 -5
- package/dist/src/utils/reshuffle.d.ts.map +1 -1
- package/package.json +24 -20
- package/dist/src/actions/index.js +0 -76
- package/dist/src/actions/index.js.map +0 -1
- package/dist/src/cache/buffer/ring-buffer.js +0 -69
- package/dist/src/cache/buffer/ring-buffer.js.map +0 -1
- package/dist/src/cache/document-meta-cache-types.js +0 -2
- package/dist/src/cache/document-meta-cache-types.js.map +0 -1
- package/dist/src/cache/document-meta-cache.js +0 -128
- package/dist/src/cache/document-meta-cache.js.map +0 -1
- package/dist/src/cache/index.js +0 -2
- package/dist/src/cache/index.js.map +0 -1
- package/dist/src/cache/kysely-operation-index.js +0 -250
- package/dist/src/cache/kysely-operation-index.js.map +0 -1
- package/dist/src/cache/kysely-write-cache.js +0 -388
- package/dist/src/cache/kysely-write-cache.js.map +0 -1
- package/dist/src/cache/lru/lru-tracker.js +0 -96
- package/dist/src/cache/lru/lru-tracker.js.map +0 -1
- package/dist/src/cache/operation-index-types.js +0 -4
- package/dist/src/cache/operation-index-types.js.map +0 -1
- package/dist/src/cache/write/interfaces.js +0 -2
- package/dist/src/cache/write/interfaces.js.map +0 -1
- package/dist/src/cache/write-cache-types.js +0 -2
- package/dist/src/cache/write-cache-types.js.map +0 -1
- package/dist/src/client/reactor-client.js +0 -406
- package/dist/src/client/reactor-client.js.map +0 -1
- package/dist/src/client/types.js +0 -14
- package/dist/src/client/types.js.map +0 -1
- package/dist/src/core/reactor-builder.js +0 -231
- package/dist/src/core/reactor-builder.js.map +0 -1
- package/dist/src/core/reactor-client-builder.js +0 -123
- package/dist/src/core/reactor-client-builder.js.map +0 -1
- package/dist/src/core/reactor.js +0 -981
- package/dist/src/core/reactor.js.map +0 -1
- package/dist/src/core/types.js +0 -2
- package/dist/src/core/types.js.map +0 -1
- package/dist/src/core/utils.js +0 -171
- package/dist/src/core/utils.js.map +0 -1
- package/dist/src/events/event-bus.js +0 -53
- package/dist/src/events/event-bus.js.map +0 -1
- package/dist/src/events/interfaces.js +0 -2
- package/dist/src/events/interfaces.js.map +0 -1
- package/dist/src/events/types.js +0 -28
- package/dist/src/events/types.js.map +0 -1
- package/dist/src/executor/interfaces.js +0 -2
- package/dist/src/executor/interfaces.js.map +0 -1
- package/dist/src/executor/simple-job-executor-manager.js +0 -233
- package/dist/src/executor/simple-job-executor-manager.js.map +0 -1
- package/dist/src/executor/simple-job-executor.js +0 -898
- package/dist/src/executor/simple-job-executor.js.map +0 -1
- package/dist/src/executor/types.js +0 -11
- package/dist/src/executor/types.js.map +0 -1
- package/dist/src/executor/util.js +0 -184
- package/dist/src/executor/util.js.map +0 -1
- package/dist/src/index.js.map +0 -1
- package/dist/src/job-tracker/in-memory-job-tracker.js +0 -112
- package/dist/src/job-tracker/in-memory-job-tracker.js.map +0 -1
- package/dist/src/job-tracker/index.js +0 -2
- package/dist/src/job-tracker/index.js.map +0 -1
- package/dist/src/job-tracker/interfaces.js +0 -2
- package/dist/src/job-tracker/interfaces.js.map +0 -1
- package/dist/src/logging/console.js +0 -108
- package/dist/src/logging/console.js.map +0 -1
- package/dist/src/logging/types.js +0 -2
- package/dist/src/logging/types.js.map +0 -1
- package/dist/src/processors/index.js +0 -2
- package/dist/src/processors/index.js.map +0 -1
- package/dist/src/processors/processor-manager.js +0 -165
- package/dist/src/processors/processor-manager.js.map +0 -1
- package/dist/src/processors/types.d.ts +0 -63
- package/dist/src/processors/types.d.ts.map +0 -1
- package/dist/src/processors/types.js +0 -2
- package/dist/src/processors/types.js.map +0 -1
- package/dist/src/processors/utils.js +0 -58
- package/dist/src/processors/utils.js.map +0 -1
- package/dist/src/queue/interfaces.js +0 -2
- package/dist/src/queue/interfaces.js.map +0 -1
- package/dist/src/queue/job-execution-handle.js +0 -62
- package/dist/src/queue/job-execution-handle.js.map +0 -1
- package/dist/src/queue/queue.js +0 -384
- package/dist/src/queue/queue.js.map +0 -1
- package/dist/src/queue/types.js +0 -19
- package/dist/src/queue/types.js.map +0 -1
- package/dist/src/read-models/base-read-model.js +0 -143
- package/dist/src/read-models/base-read-model.js.map +0 -1
- package/dist/src/read-models/coordinator.js +0 -72
- package/dist/src/read-models/coordinator.js.map +0 -1
- package/dist/src/read-models/document-view.js +0 -375
- package/dist/src/read-models/document-view.js.map +0 -1
- package/dist/src/read-models/interfaces.js +0 -2
- package/dist/src/read-models/interfaces.js.map +0 -1
- package/dist/src/read-models/types.js +0 -2
- package/dist/src/read-models/types.js.map +0 -1
- package/dist/src/registry/implementation.js +0 -216
- package/dist/src/registry/implementation.js.map +0 -1
- package/dist/src/registry/index.js +0 -2
- package/dist/src/registry/index.js.map +0 -1
- package/dist/src/registry/interfaces.js +0 -2
- package/dist/src/registry/interfaces.js.map +0 -1
- package/dist/src/shared/awaiter.js +0 -123
- package/dist/src/shared/awaiter.js.map +0 -1
- package/dist/src/shared/consistency-tracker.js +0 -123
- package/dist/src/shared/consistency-tracker.js.map +0 -1
- package/dist/src/shared/errors.js +0 -75
- package/dist/src/shared/errors.js.map +0 -1
- package/dist/src/shared/factories.js +0 -33
- package/dist/src/shared/factories.js.map +0 -1
- package/dist/src/shared/types.js +0 -38
- package/dist/src/shared/types.js.map +0 -1
- package/dist/src/shared/utils.js +0 -8
- package/dist/src/shared/utils.js.map +0 -1
- package/dist/src/signer/passthrough-signer.js +0 -19
- package/dist/src/signer/passthrough-signer.js.map +0 -1
- package/dist/src/signer/types.js +0 -2
- package/dist/src/signer/types.js.map +0 -1
- package/dist/src/storage/consistency-aware-legacy-storage.d.ts +0 -33
- package/dist/src/storage/consistency-aware-legacy-storage.d.ts.map +0 -1
- package/dist/src/storage/consistency-aware-legacy-storage.js +0 -65
- package/dist/src/storage/consistency-aware-legacy-storage.js.map +0 -1
- package/dist/src/storage/index.js +0 -3
- package/dist/src/storage/index.js.map +0 -1
- package/dist/src/storage/interfaces.js +0 -19
- package/dist/src/storage/interfaces.js.map +0 -1
- package/dist/src/storage/kysely/document-indexer.js +0 -350
- package/dist/src/storage/kysely/document-indexer.js.map +0 -1
- package/dist/src/storage/kysely/keyframe-store.js +0 -64
- package/dist/src/storage/kysely/keyframe-store.js.map +0 -1
- package/dist/src/storage/kysely/store.js +0 -233
- package/dist/src/storage/kysely/store.js.map +0 -1
- package/dist/src/storage/kysely/sync-cursor-storage.js +0 -93
- package/dist/src/storage/kysely/sync-cursor-storage.js.map +0 -1
- package/dist/src/storage/kysely/sync-remote-storage.js +0 -133
- package/dist/src/storage/kysely/sync-remote-storage.js.map +0 -1
- package/dist/src/storage/kysely/types.js +0 -2
- package/dist/src/storage/kysely/types.js.map +0 -1
- package/dist/src/storage/migrations/001_create_operation_table.js +0 -41
- package/dist/src/storage/migrations/001_create_operation_table.js.map +0 -1
- package/dist/src/storage/migrations/002_create_keyframe_table.js +0 -27
- package/dist/src/storage/migrations/002_create_keyframe_table.js.map +0 -1
- package/dist/src/storage/migrations/003_create_document_table.js +0 -10
- package/dist/src/storage/migrations/003_create_document_table.js.map +0 -1
- package/dist/src/storage/migrations/004_create_document_relationship_table.js +0 -35
- package/dist/src/storage/migrations/004_create_document_relationship_table.js.map +0 -1
- package/dist/src/storage/migrations/005_create_indexer_state_table.js +0 -10
- package/dist/src/storage/migrations/005_create_indexer_state_table.js.map +0 -1
- package/dist/src/storage/migrations/006_create_document_snapshot_table.js +0 -49
- package/dist/src/storage/migrations/006_create_document_snapshot_table.js.map +0 -1
- package/dist/src/storage/migrations/007_create_slug_mapping_table.js +0 -24
- package/dist/src/storage/migrations/007_create_slug_mapping_table.js.map +0 -1
- package/dist/src/storage/migrations/008_create_view_state_table.js +0 -10
- package/dist/src/storage/migrations/008_create_view_state_table.js.map +0 -1
- package/dist/src/storage/migrations/009_create_operation_index_tables.js +0 -50
- package/dist/src/storage/migrations/009_create_operation_index_tables.js.map +0 -1
- package/dist/src/storage/migrations/010_create_sync_tables.js +0 -43
- package/dist/src/storage/migrations/010_create_sync_tables.js.map +0 -1
- package/dist/src/storage/migrations/index.js +0 -3
- package/dist/src/storage/migrations/index.js.map +0 -1
- package/dist/src/storage/migrations/migrator.js +0 -78
- package/dist/src/storage/migrations/migrator.js.map +0 -1
- package/dist/src/storage/migrations/run-migrations.js +0 -58
- package/dist/src/storage/migrations/run-migrations.js.map +0 -1
- package/dist/src/storage/migrations/types.js +0 -2
- package/dist/src/storage/migrations/types.js.map +0 -1
- package/dist/src/storage/txn.js +0 -42
- package/dist/src/storage/txn.js.map +0 -1
- package/dist/src/subs/default-error-handler.js +0 -27
- package/dist/src/subs/default-error-handler.js.map +0 -1
- package/dist/src/subs/react-subscription-manager.js +0 -185
- package/dist/src/subs/react-subscription-manager.js.map +0 -1
- package/dist/src/subs/subscription-notification-read-model.js +0 -62
- package/dist/src/subs/subscription-notification-read-model.js.map +0 -1
- package/dist/src/subs/types.js +0 -2
- package/dist/src/subs/types.js.map +0 -1
- package/dist/src/sync/channels/composite-channel-factory.d.ts +0 -30
- package/dist/src/sync/channels/composite-channel-factory.d.ts.map +0 -1
- package/dist/src/sync/channels/composite-channel-factory.js +0 -87
- package/dist/src/sync/channels/composite-channel-factory.js.map +0 -1
- package/dist/src/sync/channels/gql-channel-factory.d.ts +0 -25
- package/dist/src/sync/channels/gql-channel-factory.d.ts.map +0 -1
- package/dist/src/sync/channels/gql-channel-factory.js +0 -76
- package/dist/src/sync/channels/gql-channel-factory.js.map +0 -1
- package/dist/src/sync/channels/gql-channel.d.ts +0 -118
- package/dist/src/sync/channels/gql-channel.d.ts.map +0 -1
- package/dist/src/sync/channels/gql-channel.js +0 -423
- package/dist/src/sync/channels/gql-channel.js.map +0 -1
- package/dist/src/sync/channels/index.js +0 -6
- package/dist/src/sync/channels/index.js.map +0 -1
- package/dist/src/sync/channels/polling-channel.d.ts +0 -39
- package/dist/src/sync/channels/polling-channel.d.ts.map +0 -1
- package/dist/src/sync/channels/polling-channel.js +0 -72
- package/dist/src/sync/channels/polling-channel.js.map +0 -1
- package/dist/src/sync/channels/utils.js +0 -96
- package/dist/src/sync/channels/utils.js.map +0 -1
- package/dist/src/sync/errors.js +0 -17
- package/dist/src/sync/errors.js.map +0 -1
- package/dist/src/sync/index.js +0 -9
- package/dist/src/sync/index.js.map +0 -1
- package/dist/src/sync/interfaces.js +0 -2
- package/dist/src/sync/interfaces.js.map +0 -1
- package/dist/src/sync/mailbox.js +0 -59
- package/dist/src/sync/mailbox.js.map +0 -1
- package/dist/src/sync/sync-builder.js +0 -39
- package/dist/src/sync/sync-builder.js.map +0 -1
- package/dist/src/sync/sync-manager.js +0 -266
- package/dist/src/sync/sync-manager.js.map +0 -1
- package/dist/src/sync/sync-operation.js +0 -63
- package/dist/src/sync/sync-operation.js.map +0 -1
- package/dist/src/sync/types.js +0 -16
- package/dist/src/sync/types.js.map +0 -1
- package/dist/src/sync/utils.js +0 -78
- package/dist/src/sync/utils.js.map +0 -1
- package/dist/src/utils/reshuffle.js +0 -47
- package/dist/src/utils/reshuffle.js.map +0 -1
|
@@ -1,116 +1,56 @@
|
|
|
1
|
-
import type { ILogger } from "#logging/types.js";
|
|
2
|
-
import type { BaseDocumentDriveServer } from "document-drive";
|
|
3
1
|
import type { Action, DocumentModelModule, ISigner, Operation, PHDocument } from "document-model";
|
|
2
|
+
import type { IEventBus } from "../events/interfaces.js";
|
|
3
|
+
import type { IJobExecutorManager } from "../executor/interfaces.js";
|
|
4
4
|
import type { IJobTracker } from "../job-tracker/interfaces.js";
|
|
5
|
+
import type { ILogger } from "../logging/types.js";
|
|
5
6
|
import type { IQueue } from "../queue/interfaces.js";
|
|
6
7
|
import type { IReadModelCoordinator } from "../read-models/interfaces.js";
|
|
8
|
+
import type { IDocumentModelRegistry } from "../registry/interfaces.js";
|
|
7
9
|
import type { ConsistencyToken, JobInfo, PagedResults, PagingOptions, SearchFilter, ShutdownStatus, ViewFilter } from "../shared/types.js";
|
|
8
|
-
import type {
|
|
9
|
-
import type { BatchExecutionRequest, BatchExecutionResult, IReactor, ReactorFeatures } from "./types.js";
|
|
10
|
+
import type { IDocumentIndexer, IDocumentView, IOperationStore, OperationFilter } from "../storage/interfaces.js";
|
|
11
|
+
import type { BatchExecutionRequest, BatchExecutionResult, BatchLoadRequest, BatchLoadResult, IReactor, ReactorFeatures } from "./types.js";
|
|
10
12
|
/**
|
|
11
13
|
* This class implements the IReactor interface and serves as the main entry point
|
|
12
14
|
* for the new Reactor architecture.
|
|
13
15
|
*/
|
|
14
16
|
export declare class Reactor implements IReactor {
|
|
15
17
|
private logger;
|
|
16
|
-
private
|
|
17
|
-
private documentStorage;
|
|
18
|
+
private documentModelRegistry;
|
|
18
19
|
private shutdownStatus;
|
|
19
20
|
private setShutdown;
|
|
21
|
+
private setCompleted;
|
|
20
22
|
private queue;
|
|
21
23
|
private jobTracker;
|
|
22
24
|
private readModelCoordinator;
|
|
23
25
|
private features;
|
|
24
26
|
private documentView;
|
|
25
|
-
private
|
|
27
|
+
private documentIndexer;
|
|
26
28
|
private operationStore;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
*/
|
|
29
|
+
private eventBus;
|
|
30
|
+
private executorManager;
|
|
31
|
+
constructor(logger: ILogger, documentModelRegistry: IDocumentModelRegistry, queue: IQueue, jobTracker: IJobTracker, readModelCoordinator: IReadModelCoordinator, features: ReactorFeatures, documentView: IDocumentView, documentIndexer: IDocumentIndexer, operationStore: IOperationStore, eventBus: IEventBus, executorManager: IJobExecutorManager);
|
|
31
32
|
kill(): ShutdownStatus;
|
|
32
|
-
/**
|
|
33
|
-
* Retrieves a list of document model specifications
|
|
34
|
-
*/
|
|
35
33
|
getDocumentModels(namespace?: string, paging?: PagingOptions, signal?: AbortSignal): Promise<PagedResults<DocumentModelModule>>;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}>;
|
|
43
|
-
/**
|
|
44
|
-
* Retrieves a specific PHDocument by slug
|
|
45
|
-
*/
|
|
46
|
-
getBySlug<TDocument extends PHDocument>(slug: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<{
|
|
47
|
-
document: TDocument;
|
|
48
|
-
childIds: string[];
|
|
49
|
-
}>;
|
|
50
|
-
/**
|
|
51
|
-
* Retrieves a specific PHDocument by identifier (either id or slug)
|
|
52
|
-
*/
|
|
53
|
-
getByIdOrSlug<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<{
|
|
54
|
-
document: TDocument;
|
|
55
|
-
childIds: string[];
|
|
56
|
-
}>;
|
|
57
|
-
/**
|
|
58
|
-
* Retrieves the operations for a document
|
|
59
|
-
*/
|
|
60
|
-
getOperations(documentId: string, view?: ViewFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<Record<string, PagedResults<Operation>>>;
|
|
61
|
-
/**
|
|
62
|
-
* Filters documents by criteria and returns a list of them
|
|
63
|
-
*/
|
|
34
|
+
get<TDocument extends PHDocument>(id: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
35
|
+
getBySlug<TDocument extends PHDocument>(slug: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
36
|
+
getByIdOrSlug<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
37
|
+
getChildren(documentId: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
38
|
+
getParents(childId: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
39
|
+
getOperations(documentId: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<Record<string, PagedResults<Operation>>>;
|
|
64
40
|
find(search: SearchFilter, view?: ViewFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<PagedResults<PHDocument>>;
|
|
65
|
-
/**
|
|
66
|
-
* Creates a document
|
|
67
|
-
*/
|
|
68
41
|
create(document: PHDocument, signer?: ISigner, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
69
|
-
/**
|
|
70
|
-
* Deletes a document
|
|
71
|
-
*/
|
|
72
42
|
deleteDocument(id: string, signer?: ISigner, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
73
|
-
/**
|
|
74
|
-
* Applies a list of actions to a document
|
|
75
|
-
*/
|
|
76
43
|
execute(docId: string, branch: string, actions: Action[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
77
|
-
/**
|
|
78
|
-
* Imports pre-existing operations that were produced by another reactor.
|
|
79
|
-
* This function may cause a reshuffle, which will generate additional
|
|
80
|
-
* operations.
|
|
81
|
-
*/
|
|
82
44
|
load(docId: string, branch: string, operations: Operation[], signal?: AbortSignal, meta?: Record<string, unknown>): Promise<JobInfo>;
|
|
83
|
-
/**
|
|
84
|
-
* Applies multiple mutations across documents with dependency management
|
|
85
|
-
*/
|
|
86
45
|
executeBatch(request: BatchExecutionRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchExecutionResult>;
|
|
87
|
-
|
|
88
|
-
* Adds multiple documents as children to another
|
|
89
|
-
*/
|
|
46
|
+
loadBatch(request: BatchLoadRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchLoadResult>;
|
|
90
47
|
addChildren(parentId: string, documentIds: string[], branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
|
|
91
|
-
/**
|
|
92
|
-
* Removes multiple documents as children from another
|
|
93
|
-
*/
|
|
94
48
|
removeChildren(parentId: string, documentIds: string[], branch?: string, signer?: ISigner, signal?: AbortSignal): Promise<JobInfo>;
|
|
95
|
-
/**
|
|
96
|
-
* Retrieves the status of a job
|
|
97
|
-
*/
|
|
98
49
|
getJobStatus(jobId: string, signal?: AbortSignal): Promise<JobInfo>;
|
|
99
|
-
/**
|
|
100
|
-
* Finds documents by their IDs
|
|
101
|
-
*/
|
|
102
50
|
private findByIds;
|
|
103
|
-
/**
|
|
104
|
-
* Finds documents by their slugs
|
|
105
|
-
*/
|
|
106
51
|
private findBySlugs;
|
|
107
|
-
/**
|
|
108
|
-
* Finds documents by parent ID
|
|
109
|
-
*/
|
|
110
52
|
private findByParentId;
|
|
111
|
-
/**
|
|
112
|
-
* Finds documents by type
|
|
113
|
-
*/
|
|
114
53
|
private findByType;
|
|
54
|
+
private emitJobPending;
|
|
115
55
|
}
|
|
116
56
|
//# sourceMappingURL=reactor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactor.d.ts","sourceRoot":"","sources":["../../../src/core/reactor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"reactor.d.ts","sourceRoot":"","sources":["../../../src/core/reactor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,MAAM,EAEN,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,UAAU,EACX,MAAM,gBAAgB,CAAC;AASxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAMzD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,KAAK,EACV,gBAAgB,EAChB,OAAO,EAEP,YAAY,EACZ,aAAa,EACb,YAAY,EACZ,cAAc,EACd,UAAU,EACX,MAAM,oBAAoB,CAAC;AAG5B,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,eAAe,EACf,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EACf,QAAQ,EACR,eAAe,EAChB,MAAM,YAAY,CAAC;AAgBpB;;;GAGG;AACH,qBAAa,OAAQ,YAAW,QAAQ;IACtC,OAAO,CAAC,MAAM,CAAU;IACxB,OAAO,CAAC,qBAA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AAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;YA6BrD,SAAS;YA8BT,WAAW;YAmBX,cAAc;YAqBd,UAAU;IAkBxB,OAAO,CAAC,cAAc;CASvB"}
|
package/dist/src/core/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { BaseDocumentDriveServer, IDocumentOperationStorage, IDocumentStorage } from "document-drive";
|
|
2
1
|
import type { Action, DocumentModelModule, ISigner, Operation, PHDocument } from "document-model";
|
|
3
2
|
import type { Kysely } from "kysely";
|
|
3
|
+
import type { IProcessorManager } from "@powerhousedao/shared/processors";
|
|
4
4
|
import type { IOperationIndex } from "../cache/operation-index-types.js";
|
|
5
5
|
import type { IWriteCache } from "../cache/write/interfaces.js";
|
|
6
|
+
import type { ReactorClient } from "../client/reactor-client.js";
|
|
6
7
|
import type { IEventBus } from "../events/interfaces.js";
|
|
7
8
|
import type { IJobExecutorManager } from "../executor/interfaces.js";
|
|
8
9
|
import type { IJobTracker } from "../job-tracker/interfaces.js";
|
|
@@ -10,16 +11,13 @@ import type { IQueue } from "../queue/interfaces.js";
|
|
|
10
11
|
import type { IReadModelCoordinator } from "../read-models/interfaces.js";
|
|
11
12
|
import type { DocumentViewDatabase } from "../read-models/types.js";
|
|
12
13
|
import type { IDocumentModelRegistry } from "../registry/interfaces.js";
|
|
14
|
+
import type { IJobAwaiter } from "../shared/awaiter.js";
|
|
13
15
|
import type { IConsistencyTracker } from "../shared/consistency-tracker.js";
|
|
14
16
|
import type { ConsistencyToken, JobInfo, PagedResults, PagingOptions, SearchFilter, ShutdownStatus, ViewFilter } from "../shared/types.js";
|
|
15
|
-
import type {
|
|
16
|
-
import type { ReactorSubscriptionManager } from "../subs/react-subscription-manager.js";
|
|
17
|
-
import type { IDocumentIndexer, IDocumentView, IKeyframeStore, IOperationStore, ISyncCursorStorage, ISyncRemoteStorage } from "../storage/interfaces.js";
|
|
17
|
+
import type { IDocumentIndexer, IDocumentView, IKeyframeStore, IOperationStore, ISyncCursorStorage, ISyncDeadLetterStorage, ISyncRemoteStorage, OperationFilter } from "../storage/interfaces.js";
|
|
18
18
|
import type { DocumentIndexerDatabase, Database as StorageDatabase } from "../storage/kysely/types.js";
|
|
19
19
|
import type { IReactorSubscriptionManager } from "../subs/types.js";
|
|
20
20
|
import type { IChannelFactory, ISyncManager } from "../sync/interfaces.js";
|
|
21
|
-
import type { ReactorClient } from "../client/reactor-client.js";
|
|
22
|
-
import type { IProcessorManager } from "../processors/types.js";
|
|
23
21
|
/**
|
|
24
22
|
* A single mutation job within a batch request.
|
|
25
23
|
*/
|
|
@@ -43,6 +41,29 @@ export type BatchExecutionRequest = {
|
|
|
43
41
|
export type BatchExecutionResult = {
|
|
44
42
|
jobs: Record<string, JobInfo>;
|
|
45
43
|
};
|
|
44
|
+
/**
|
|
45
|
+
* A single load job within a batch request.
|
|
46
|
+
*/
|
|
47
|
+
export type LoadJobPlan = {
|
|
48
|
+
key: string;
|
|
49
|
+
documentId: string;
|
|
50
|
+
scope: string;
|
|
51
|
+
branch: string;
|
|
52
|
+
operations: Operation[];
|
|
53
|
+
dependsOn: string[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Request for batch load operation.
|
|
57
|
+
*/
|
|
58
|
+
export type BatchLoadRequest = {
|
|
59
|
+
jobs: LoadJobPlan[];
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Result from batch load operation.
|
|
63
|
+
*/
|
|
64
|
+
export type BatchLoadResult = {
|
|
65
|
+
jobs: Record<string, JobInfo>;
|
|
66
|
+
};
|
|
46
67
|
/**
|
|
47
68
|
* The main Reactor interface that serves as a facade for document operations.
|
|
48
69
|
* This interface provides a unified API for document management, including
|
|
@@ -69,12 +90,9 @@ export interface IReactor {
|
|
|
69
90
|
* @param view - Optional filter containing branch and scopes information
|
|
70
91
|
* @param consistencyToken - Optional token for read-after-write consistency
|
|
71
92
|
* @param signal - Optional abort signal to cancel the request
|
|
72
|
-
* @returns The up-to-date PHDocument
|
|
93
|
+
* @returns The up-to-date PHDocument
|
|
73
94
|
*/
|
|
74
|
-
get<TDocument extends PHDocument>(id: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<
|
|
75
|
-
document: TDocument;
|
|
76
|
-
childIds: string[];
|
|
77
|
-
}>;
|
|
95
|
+
get<TDocument extends PHDocument>(id: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
78
96
|
/**
|
|
79
97
|
* Retrieves a specific PHDocument by slug
|
|
80
98
|
*
|
|
@@ -84,10 +102,7 @@ export interface IReactor {
|
|
|
84
102
|
* @param signal - Optional abort signal to cancel the request
|
|
85
103
|
* @returns The up-to-date PHDocument with scopes and list of child document ids
|
|
86
104
|
*/
|
|
87
|
-
getBySlug<TDocument extends PHDocument>(slug: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<
|
|
88
|
-
document: TDocument;
|
|
89
|
-
childIds: string[];
|
|
90
|
-
}>;
|
|
105
|
+
getBySlug<TDocument extends PHDocument>(slug: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
91
106
|
/**
|
|
92
107
|
* Retrieves a specific PHDocument by identifier (either id or slug).
|
|
93
108
|
* Throws an error if the identifier matches both an id and a slug that refer to different documents.
|
|
@@ -99,21 +114,37 @@ export interface IReactor {
|
|
|
99
114
|
* @returns The up-to-date PHDocument with scopes and list of child document ids
|
|
100
115
|
* @throws {Error} If identifier matches both an ID and slug referring to different documents
|
|
101
116
|
*/
|
|
102
|
-
getByIdOrSlug<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
117
|
+
getByIdOrSlug<TDocument extends PHDocument>(identifier: string, view?: ViewFilter, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<TDocument>;
|
|
118
|
+
/**
|
|
119
|
+
* Retrieves the children of a document
|
|
120
|
+
*
|
|
121
|
+
* @param parentId - The parent document id
|
|
122
|
+
* @param consistencyToken - Optional token for read-after-write consistency
|
|
123
|
+
* @param signal - Optional abort signal to cancel the request
|
|
124
|
+
* @returns The list of child document ids
|
|
125
|
+
*/
|
|
126
|
+
getChildren(parentId: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
127
|
+
/**
|
|
128
|
+
* Retrieves the parents of a document
|
|
129
|
+
*
|
|
130
|
+
* @param childId - The child document id
|
|
131
|
+
* @param consistencyToken - Optional token for read-after-write consistency
|
|
132
|
+
* @param signal - Optional abort signal to cancel the request
|
|
133
|
+
* @returns The list of parent document ids
|
|
134
|
+
*/
|
|
135
|
+
getParents(childId: string, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<string[]>;
|
|
106
136
|
/**
|
|
107
137
|
* Retrieves the operations for a document
|
|
108
138
|
*
|
|
109
139
|
* @param documentId - The document id
|
|
110
140
|
* @param view - Optional filter containing branch and scopes information
|
|
141
|
+
* @param filter - Optional filter for actionTypes, timestamps, and revision
|
|
111
142
|
* @param paging - Optional pagination options
|
|
112
143
|
* @param consistencyToken - Optional token for read-after-write consistency
|
|
113
144
|
* @param signal - Optional abort signal to cancel the request
|
|
114
145
|
* @returns The list of operations
|
|
115
146
|
*/
|
|
116
|
-
getOperations(documentId: string, view?: ViewFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<Record<string, PagedResults<Operation>>>;
|
|
147
|
+
getOperations(documentId: string, view?: ViewFilter, filter?: OperationFilter, paging?: PagingOptions, consistencyToken?: ConsistencyToken, signal?: AbortSignal): Promise<Record<string, PagedResults<Operation>>>;
|
|
117
148
|
/**
|
|
118
149
|
* Filters documents by criteria and returns a list of them
|
|
119
150
|
*
|
|
@@ -176,6 +207,15 @@ export interface IReactor {
|
|
|
176
207
|
* @returns Map of job keys to job information
|
|
177
208
|
*/
|
|
178
209
|
executeBatch(request: BatchExecutionRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchExecutionResult>;
|
|
210
|
+
/**
|
|
211
|
+
* Loads multiple batches of pre-existing operations across documents with dependency management.
|
|
212
|
+
*
|
|
213
|
+
* @param request - Batch load request containing jobs with dependencies
|
|
214
|
+
* @param signal - Optional abort signal to cancel the request
|
|
215
|
+
* @param meta - Optional metadata that flows through the job lifecycle
|
|
216
|
+
* @returns Map of job keys to job information
|
|
217
|
+
*/
|
|
218
|
+
loadBatch(request: BatchLoadRequest, signal?: AbortSignal, meta?: Record<string, unknown>): Promise<BatchLoadResult>;
|
|
179
219
|
/**
|
|
180
220
|
* Adds multiple documents as children to another
|
|
181
221
|
*
|
|
@@ -210,11 +250,7 @@ export interface IReactor {
|
|
|
210
250
|
* Feature flags for reactor configuration
|
|
211
251
|
*/
|
|
212
252
|
export type ReactorFeatures = {
|
|
213
|
-
|
|
214
|
-
legacyStorageEnabled?: boolean;
|
|
215
|
-
};
|
|
216
|
-
export type ExecutorConfig = {
|
|
217
|
-
count: number;
|
|
253
|
+
[key: string]: boolean;
|
|
218
254
|
};
|
|
219
255
|
/**
|
|
220
256
|
* Combined database type that includes all schemas
|
|
@@ -226,6 +262,7 @@ export type Database = StorageDatabase & DocumentViewDatabase & DocumentIndexerD
|
|
|
226
262
|
export interface SyncModule {
|
|
227
263
|
remoteStorage: ISyncRemoteStorage;
|
|
228
264
|
cursorStorage: ISyncCursorStorage;
|
|
265
|
+
deadLetterStorage: ISyncDeadLetterStorage;
|
|
229
266
|
channelFactory: IChannelFactory;
|
|
230
267
|
syncManager: ISyncManager;
|
|
231
268
|
}
|
|
@@ -235,8 +272,6 @@ export interface SyncModule {
|
|
|
235
272
|
* testing, or integration scenarios.
|
|
236
273
|
*/
|
|
237
274
|
export interface ReactorModule {
|
|
238
|
-
driveServer: BaseDocumentDriveServer;
|
|
239
|
-
storage: IDocumentStorage & IDocumentOperationStorage;
|
|
240
275
|
eventBus: IEventBus;
|
|
241
276
|
documentModelRegistry: IDocumentModelRegistry;
|
|
242
277
|
queue: IQueue;
|
|
@@ -252,7 +287,7 @@ export interface ReactorModule {
|
|
|
252
287
|
documentIndexer: IDocumentIndexer;
|
|
253
288
|
documentIndexerConsistencyTracker: IConsistencyTracker;
|
|
254
289
|
readModelCoordinator: IReadModelCoordinator;
|
|
255
|
-
subscriptionManager:
|
|
290
|
+
subscriptionManager: IReactorSubscriptionManager;
|
|
256
291
|
processorManager: IProcessorManager;
|
|
257
292
|
processorManagerConsistencyTracker: IConsistencyTracker;
|
|
258
293
|
syncModule: SyncModule | undefined;
|
|
@@ -268,6 +303,7 @@ export interface ReactorClientModule {
|
|
|
268
303
|
reactor: IReactor;
|
|
269
304
|
eventBus: IEventBus;
|
|
270
305
|
documentIndexer: IDocumentIndexer;
|
|
306
|
+
documentView: IDocumentView;
|
|
271
307
|
signer: ISigner;
|
|
272
308
|
subscriptionManager: IReactorSubscriptionManager;
|
|
273
309
|
jobAwaiter: IJobAwaiter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,mBAAmB,EACnB,OAAO,EACP,SAAS,EACT,UAAU,EACX,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,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IAC3B,cAAc,EAAE,eAAe,CAAC;IAChC,aAAa,EAAE,cAAc,CAAC;IAC9B,UAAU,EAAE,WAAW,CAAC;IACxB,cAAc,EAAE,eAAe,CAAC;IAChC,YAAY,EAAE,aAAa,CAAC;IAC5B,8BAA8B,EAAE,mBAAmB,CAAC;IACpD,eAAe,EAAE,gBAAgB,CAAC;IAClC,iCAAiC,EAAE,mBAAmB,CAAC;IACvD,oBAAoB,EAAE,qBAAqB,CAAC;IAC5C,mBAAmB,EAAE,2BAA2B,CAAC;IACjD,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,kCAAkC,EAAE,mBAAmB,CAAC;IACxD,UAAU,EAAE,UAAU,GAAG,SAAS,CAAC;IACnC,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,QAAQ,CAAC;IAClB,QAAQ,EAAE,SAAS,CAAC;IACpB,eAAe,EAAE,gBAAgB,CAAC;IAClC,YAAY,EAAE,aAAa,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,mBAAmB,EAAE,2BAA2B,CAAC;IACjD,UAAU,EAAE,WAAW,CAAC;IACxB,aAAa,EAAE,aAAa,GAAG,SAAS,CAAC;CAC1C"}
|
package/dist/src/core/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Action, ISigner, Operation, PHDocument } from "document-model";
|
|
2
|
-
import type { ErrorInfo, PagedResults } from "../shared/types.js";
|
|
2
|
+
import type { ErrorInfo, JobMeta, PagedResults } from "../shared/types.js";
|
|
3
3
|
/**
|
|
4
4
|
* Represents a minimal job plan for validation purposes
|
|
5
5
|
*/
|
|
@@ -8,6 +8,14 @@ export type JobPlanForValidation = {
|
|
|
8
8
|
actions: Action[];
|
|
9
9
|
dependsOn: string[];
|
|
10
10
|
};
|
|
11
|
+
/**
|
|
12
|
+
* Represents a minimal load job plan for validation purposes
|
|
13
|
+
*/
|
|
14
|
+
export type LoadJobPlanForValidation = {
|
|
15
|
+
key: string;
|
|
16
|
+
operations: Operation[];
|
|
17
|
+
dependsOn: string[];
|
|
18
|
+
};
|
|
11
19
|
/**
|
|
12
20
|
* Represents a job plan with scope information for action validation
|
|
13
21
|
*/
|
|
@@ -16,6 +24,14 @@ export type JobPlanWithScope = {
|
|
|
16
24
|
scope: string;
|
|
17
25
|
actions: Action[];
|
|
18
26
|
};
|
|
27
|
+
/**
|
|
28
|
+
* Represents a load job plan with scope information for operation validation
|
|
29
|
+
*/
|
|
30
|
+
export type LoadJobPlanWithScope = {
|
|
31
|
+
key: string;
|
|
32
|
+
scope: string;
|
|
33
|
+
operations: Operation[];
|
|
34
|
+
};
|
|
19
35
|
/**
|
|
20
36
|
* Represents a job plan with dependencies for topological sorting
|
|
21
37
|
*/
|
|
@@ -23,14 +39,27 @@ export type JobPlanForSorting = {
|
|
|
23
39
|
key: string;
|
|
24
40
|
dependsOn: string[];
|
|
25
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Validates structural properties shared by all batch requests:
|
|
44
|
+
* duplicate keys, missing dependencies, and dependency cycles.
|
|
45
|
+
*/
|
|
46
|
+
export declare function validateBatchStructure(jobs: JobPlanForSorting[]): void;
|
|
26
47
|
/**
|
|
27
48
|
* Validates a batch mutation request for common errors
|
|
28
49
|
*/
|
|
29
50
|
export declare function validateBatchRequest(jobs: JobPlanForValidation[]): void;
|
|
51
|
+
/**
|
|
52
|
+
* Validates a batch load request for common errors
|
|
53
|
+
*/
|
|
54
|
+
export declare function validateBatchLoadRequest(jobs: LoadJobPlanForValidation[]): void;
|
|
30
55
|
/**
|
|
31
56
|
* Validates that all actions in a job match the declared scope
|
|
32
57
|
*/
|
|
33
58
|
export declare function validateActionScopes(job: JobPlanWithScope): void;
|
|
59
|
+
/**
|
|
60
|
+
* Validates that all operations in a job match the declared scope
|
|
61
|
+
*/
|
|
62
|
+
export declare function validateOperationScopes(job: LoadJobPlanWithScope): void;
|
|
34
63
|
/**
|
|
35
64
|
* Performs topological sort on jobs based on dependencies
|
|
36
65
|
*/
|
|
@@ -47,13 +76,20 @@ export declare function filterByType(results: PagedResults<PHDocument>, type: st
|
|
|
47
76
|
* Validates that all operations share the same scope.
|
|
48
77
|
* Throws an error if any operation has a different scope.
|
|
49
78
|
*/
|
|
50
|
-
export declare function
|
|
79
|
+
export declare function getSharedOperationScope(operations: Operation[]): string;
|
|
80
|
+
/**
|
|
81
|
+
* Validates that all actions share the same scope.
|
|
82
|
+
* Throws an error if any action has a different scope.
|
|
83
|
+
*/
|
|
84
|
+
export declare function getSharedActionScope(actions: Action[]): string;
|
|
51
85
|
/**
|
|
52
|
-
* Signs an action with the provided signer
|
|
86
|
+
* Signs an action with the provided signer.
|
|
87
|
+
* If the action already has valid signatures, it is returned unchanged.
|
|
53
88
|
*/
|
|
54
89
|
export declare const signAction: (action: Action, signer: ISigner, signal?: AbortSignal) => Promise<Action>;
|
|
55
90
|
/**
|
|
56
91
|
* Signs multiple actions with the provided signer
|
|
57
92
|
*/
|
|
58
93
|
export declare const signActions: (actions: Action[], signer: ISigner, signal?: AbortSignal) => Promise<Action[]>;
|
|
94
|
+
export declare function buildSingleJobMeta(jobId: string, callerMeta?: Record<string, unknown>): JobMeta;
|
|
59
95
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EAEX,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/core/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,OAAO,EACP,SAAS,EACT,UAAU,EAEX,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,SAAS,EAAE,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eAAe,CAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAoBnE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAW5D;AAED;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC,EACjC,IAAI,EAAE,MAAM,GACX,YAAY,CAAC,UAAU,CAAC,CAoB1B;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,MAAM,CAgBvE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAe9D;AAED;;;GAGG;AACH,eAAO,MAAM,UAAU,GACrB,QAAQ,MAAM,EACd,QAAQ,OAAO,EACf,SAAS,WAAW,KACnB,OAAO,CAAC,MAAM,CA0BhB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,SAAS,MAAM,EAAE,EACjB,QAAQ,OAAO,EACf,SAAS,WAAW,KACnB,OAAO,CAAC,MAAM,EAAE,CAIlB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAET"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { OperationWithContext } from "
|
|
1
|
+
import type { OperationWithContext } from "@powerhousedao/shared/document-model";
|
|
2
|
+
import type { Job } from "../queue/types.js";
|
|
3
|
+
import type { JobMeta } from "../shared/types.js";
|
|
2
4
|
/**
|
|
3
5
|
* Describes a function to unsubscribe from an event.
|
|
4
6
|
*/
|
|
@@ -23,25 +25,47 @@ export declare class EventBusAggregateError extends Error {
|
|
|
23
25
|
constructor(errors: unknown[]);
|
|
24
26
|
}
|
|
25
27
|
/**
|
|
26
|
-
* Event types for
|
|
28
|
+
* Event types for reactor lifecycle events.
|
|
27
29
|
*/
|
|
28
|
-
export declare const
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
30
|
+
export declare const ReactorEventTypes: {
|
|
31
|
+
readonly JOB_PENDING: 10001;
|
|
32
|
+
readonly JOB_RUNNING: 10002;
|
|
33
|
+
readonly JOB_WRITE_READY: 10003;
|
|
34
|
+
readonly JOB_READ_READY: 10004;
|
|
35
|
+
readonly JOB_FAILED: 10005;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Event emitted when a job is registered and waiting to be executed.
|
|
39
|
+
*/
|
|
40
|
+
export type JobPendingEvent = {
|
|
41
|
+
jobId: string;
|
|
42
|
+
jobMeta: JobMeta;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Event emitted when a job starts executing.
|
|
46
|
+
*/
|
|
47
|
+
export type JobRunningEvent = {
|
|
48
|
+
jobId: string;
|
|
49
|
+
jobMeta: JobMeta;
|
|
32
50
|
};
|
|
33
51
|
/**
|
|
34
52
|
* Event emitted when operations are written to IOperationStore.
|
|
35
53
|
* Contains the operations directly to avoid round-trip queries.
|
|
36
54
|
*/
|
|
37
|
-
export type
|
|
55
|
+
export type JobWriteReadyEvent = {
|
|
38
56
|
jobId: string;
|
|
39
57
|
operations: OperationWithContext[];
|
|
40
|
-
jobMeta
|
|
58
|
+
jobMeta: JobMeta;
|
|
59
|
+
/**
|
|
60
|
+
* Maps documentId to the collection IDs it belongs to.
|
|
61
|
+
* Used by SyncManager to route operations only to remotes
|
|
62
|
+
* whose collection contains the document.
|
|
63
|
+
*/
|
|
64
|
+
collectionMemberships?: Record<string, string[]>;
|
|
41
65
|
};
|
|
42
66
|
/**
|
|
43
67
|
* Event emitted after all read models have finished processing operations.
|
|
44
|
-
* This event fires after
|
|
68
|
+
* This event fires after JOB_WRITE_READY and guarantees that:
|
|
45
69
|
* - All read models (DocumentView, DocumentIndexer, etc.) have indexed the operations
|
|
46
70
|
* - All consistency trackers have been updated with the new operation indices
|
|
47
71
|
* - Queries without consistency tokens will now see the updated data
|
|
@@ -51,7 +75,7 @@ export type OperationWrittenEvent = {
|
|
|
51
75
|
* - Observability (measuring read model latency)
|
|
52
76
|
* - Event-driven workflows (triggering downstream processes)
|
|
53
77
|
*/
|
|
54
|
-
export type
|
|
78
|
+
export type JobReadReadyEvent = {
|
|
55
79
|
jobId: string;
|
|
56
80
|
operations: OperationWithContext[];
|
|
57
81
|
};
|
|
@@ -63,5 +87,6 @@ export type OperationsReadyEvent = {
|
|
|
63
87
|
export type JobFailedEvent = {
|
|
64
88
|
jobId: string;
|
|
65
89
|
error: Error;
|
|
90
|
+
job?: Job;
|
|
66
91
|
};
|
|
67
92
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/events/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/events/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC;AAErC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE3E;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,SAAgB,MAAM,EAAE,GAAG,EAAE,CAAC;gBAElB,MAAM,EAAE,OAAO,EAAE;CAc9B;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;CAMpB,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,oBAAoB,EAAE,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAClD,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,oBAAoB,EAAE,CAAC;CACpC,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,CAAC,EAAE,GAAG,CAAC;CACX,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Action, Operation } from "document-model";
|
|
2
|
+
import type { IOperationIndexTxn } from "../cache/operation-index-types.js";
|
|
3
|
+
import type { ILogger } from "../logging/types.js";
|
|
4
|
+
import type { Job } from "../queue/types.js";
|
|
5
|
+
import type { IDocumentModelRegistry } from "../registry/interfaces.js";
|
|
6
|
+
import type { ExecutionStores } from "./execution-scope.js";
|
|
7
|
+
import type { JobResult } from "./types.js";
|
|
8
|
+
export declare class DocumentActionHandler {
|
|
9
|
+
private registry;
|
|
10
|
+
private logger;
|
|
11
|
+
constructor(registry: IDocumentModelRegistry, logger: ILogger);
|
|
12
|
+
execute(job: Job, action: Action, startTime: number, indexTxn: IOperationIndexTxn, stores: ExecutionStores, skip?: number, sourceRemote?: string): Promise<JobResult & {
|
|
13
|
+
operationsWithContext?: Array<{
|
|
14
|
+
operation: Operation;
|
|
15
|
+
context: {
|
|
16
|
+
documentId: string;
|
|
17
|
+
scope: string;
|
|
18
|
+
branch: string;
|
|
19
|
+
documentType: string;
|
|
20
|
+
};
|
|
21
|
+
}>;
|
|
22
|
+
}>;
|
|
23
|
+
private executeCreate;
|
|
24
|
+
private executeDelete;
|
|
25
|
+
private executeUpgrade;
|
|
26
|
+
private executeAddRelationship;
|
|
27
|
+
private executeRemoveRelationship;
|
|
28
|
+
private writeOperationToStore;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=document-action-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document-action-handler.d.ts","sourceRoot":"","sources":["../../../src/executor/document-action-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EAIN,SAAS,EAMV,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAExE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAY5C,qBAAa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ;IAChB,OAAO,CAAC,MAAM;gBADN,QAAQ,EAAE,sBAAsB,EAChC,MAAM,EAAE,OAAO;IAGnB,OAAO,CACX,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,kBAAkB,EAC5B,MAAM,EAAE,eAAe,EACvB,IAAI,GAAE,MAAU,EAChB,YAAY,GAAE,MAAW,GACxB,OAAO,CACR,SAAS,GAAG;QACV,qBAAqB,CAAC,EAAE,KAAK,CAAC;YAC5B,SAAS,EAAE,SAAS,CAAC;YACrB,OAAO,EAAE;gBACP,UAAU,EAAE,MAAM,CAAC;gBACnB,KAAK,EAAE,MAAM,CAAC;gBACd,MAAM,EAAE,MAAM,CAAC;gBACf,YAAY,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC,CAAC;KACJ,CACF;YA0Da,aAAa;YAuGb,aAAa;YA6Hb,cAAc;YAwKd,sBAAsB;YAqJtB,yBAAyB;YA2IzB,qBAAqB;CAyCpC"}
|