@decaf-ts/core 0.18.0 → 0.19.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/lib/cjs/auth/constants.cjs +2 -2
- package/lib/cjs/auth/constants.cjs.map +1 -0
- package/lib/cjs/auth/decorators.cjs +1 -0
- package/lib/cjs/auth/decorators.cjs.map +1 -0
- package/lib/cjs/auth/index.cjs +1 -0
- package/lib/cjs/auth/index.cjs.map +1 -0
- package/lib/cjs/fs/FilesystemAdapter.cjs +40 -39
- package/lib/cjs/fs/FilesystemAdapter.cjs.map +1 -0
- package/lib/cjs/fs/FsDispatch.cjs +3 -2
- package/lib/cjs/fs/FsDispatch.cjs.map +1 -0
- package/lib/cjs/fs/helpers.cjs +1 -0
- package/lib/cjs/fs/helpers.cjs.map +1 -0
- package/lib/cjs/fs/index.cjs +1 -0
- package/lib/cjs/fs/index.cjs.map +1 -0
- package/lib/cjs/fs/indexStore.cjs +8 -7
- package/lib/cjs/fs/indexStore.cjs.map +1 -0
- package/lib/cjs/fs/locks/FilesystemLock.cjs +3 -2
- package/lib/cjs/fs/locks/FilesystemLock.cjs.map +1 -0
- package/lib/cjs/fs/locks/FilesystemMultiLock.cjs +5 -4
- package/lib/cjs/fs/locks/FilesystemMultiLock.cjs.map +1 -0
- package/lib/cjs/fs/types.cjs +1 -0
- package/lib/cjs/fs/types.cjs.map +1 -0
- package/lib/cjs/identity/decorators.cjs +11 -10
- package/lib/cjs/identity/decorators.cjs.map +1 -0
- package/lib/cjs/identity/index.cjs +1 -0
- package/lib/cjs/identity/index.cjs.map +1 -0
- package/lib/cjs/index.cjs +4 -3
- package/lib/cjs/index.cjs.map +1 -0
- package/lib/cjs/interfaces/ContextuallyLogged.cjs +1 -0
- package/lib/cjs/interfaces/ContextuallyLogged.cjs.map +1 -0
- package/lib/cjs/interfaces/ErrorParser.cjs +1 -0
- package/lib/cjs/interfaces/ErrorParser.cjs.map +1 -0
- package/lib/cjs/interfaces/Executor.cjs +1 -0
- package/lib/cjs/interfaces/Executor.cjs.map +1 -0
- package/lib/cjs/interfaces/Observable.cjs +1 -0
- package/lib/cjs/interfaces/Observable.cjs.map +1 -0
- package/lib/cjs/interfaces/Observer.cjs +1 -0
- package/lib/cjs/interfaces/Observer.cjs.map +1 -0
- package/lib/cjs/interfaces/Paginatable.cjs +1 -0
- package/lib/cjs/interfaces/Paginatable.cjs.map +1 -0
- package/lib/cjs/interfaces/Queriable.cjs +1 -0
- package/lib/cjs/interfaces/Queriable.cjs.map +1 -0
- package/lib/cjs/interfaces/RawExecutor.cjs +1 -0
- package/lib/cjs/interfaces/RawExecutor.cjs.map +1 -0
- package/lib/cjs/interfaces/SequenceOptions.cjs +1 -0
- package/lib/cjs/interfaces/SequenceOptions.cjs.map +1 -0
- package/lib/cjs/interfaces/index.cjs +1 -0
- package/lib/cjs/interfaces/index.cjs.map +1 -0
- package/lib/cjs/migrations/Migration.cjs +16 -15
- package/lib/cjs/migrations/Migration.cjs.map +1 -0
- package/lib/cjs/migrations/MigrationService.cjs +38 -37
- package/lib/cjs/migrations/MigrationService.cjs.map +1 -0
- package/lib/cjs/migrations/MigrationTaskBuilder.cjs +3 -2
- package/lib/cjs/migrations/MigrationTaskBuilder.cjs.map +1 -0
- package/lib/cjs/migrations/MigrationTasks.cjs +22 -17
- package/lib/cjs/migrations/MigrationTasks.cjs.map +1 -0
- package/lib/cjs/migrations/MigrationVersioning.cjs +1 -0
- package/lib/cjs/migrations/MigrationVersioning.cjs.map +1 -0
- package/lib/cjs/migrations/SemverMigrationVersioning.cjs +1 -0
- package/lib/cjs/migrations/SemverMigrationVersioning.cjs.map +1 -0
- package/lib/cjs/migrations/StandardMigrationVersioning.cjs +1 -0
- package/lib/cjs/migrations/StandardMigrationVersioning.cjs.map +1 -0
- package/lib/cjs/migrations/constants.cjs +3 -2
- package/lib/cjs/migrations/constants.cjs.map +1 -0
- package/lib/cjs/migrations/decorators.cjs +10 -9
- package/lib/cjs/migrations/decorators.cjs.map +1 -0
- package/lib/cjs/migrations/index.cjs +6 -5
- package/lib/cjs/migrations/index.cjs.map +1 -0
- package/lib/cjs/migrations/types.cjs +1 -0
- package/lib/cjs/migrations/types.cjs.map +1 -0
- package/lib/cjs/model/BaseModel.cjs +14 -8
- package/lib/cjs/model/BaseModel.cjs.map +1 -0
- package/lib/cjs/model/SequenceModel.cjs +19 -13
- package/lib/cjs/model/SequenceModel.cjs.map +1 -0
- package/lib/cjs/model/construction.cjs +27 -26
- package/lib/cjs/model/construction.cjs.map +1 -0
- package/lib/cjs/model/decorators.cjs +48 -47
- package/lib/cjs/model/decorators.cjs.map +1 -0
- package/lib/cjs/model/index.cjs +1 -0
- package/lib/cjs/model/index.cjs.map +1 -0
- package/lib/cjs/model/indexing.cjs +6 -5
- package/lib/cjs/model/indexing.cjs.map +1 -0
- package/lib/cjs/model/types.cjs +1 -0
- package/lib/cjs/model/types.cjs.map +1 -0
- package/lib/cjs/overrides/Metadata.cjs +1 -0
- package/lib/cjs/overrides/Metadata.cjs.map +1 -0
- package/lib/cjs/overrides/Model.cjs +1 -0
- package/lib/cjs/overrides/Model.cjs.map +1 -0
- package/lib/cjs/overrides/ModelBuilder.cjs +1 -0
- package/lib/cjs/overrides/ModelBuilder.cjs.map +1 -0
- package/lib/cjs/overrides/index.cjs +1 -0
- package/lib/cjs/overrides/index.cjs.map +1 -0
- package/lib/cjs/overrides/injectables.cjs +1 -0
- package/lib/cjs/overrides/injectables.cjs.map +1 -0
- package/lib/cjs/overrides/overrides.cjs +22 -21
- package/lib/cjs/overrides/overrides.cjs.map +1 -0
- package/lib/cjs/persistence/Adapter.cjs +47 -41
- package/lib/cjs/persistence/Adapter.cjs.map +1 -0
- package/lib/cjs/persistence/Context.cjs +10 -7
- package/lib/cjs/persistence/Context.cjs.map +1 -0
- package/lib/cjs/persistence/ContextLock.cjs +1 -0
- package/lib/cjs/persistence/ContextLock.cjs.map +1 -0
- package/lib/cjs/persistence/Dispatch.cjs +15 -14
- package/lib/cjs/persistence/Dispatch.cjs.map +1 -0
- package/lib/cjs/persistence/ObserverHandler.cjs +3 -2
- package/lib/cjs/persistence/ObserverHandler.cjs.map +1 -0
- package/lib/cjs/persistence/Sequence.cjs +19 -18
- package/lib/cjs/persistence/Sequence.cjs.map +1 -0
- package/lib/cjs/persistence/constants.cjs +14 -21
- package/lib/cjs/persistence/constants.cjs.map +1 -0
- package/lib/cjs/persistence/decorators.cjs +6 -5
- package/lib/cjs/persistence/decorators.cjs.map +1 -0
- package/lib/cjs/persistence/errors.cjs +1 -0
- package/lib/cjs/persistence/errors.cjs.map +1 -0
- package/lib/cjs/persistence/event-filters.cjs +5 -4
- package/lib/cjs/persistence/event-filters.cjs.map +1 -0
- package/lib/cjs/persistence/generators.cjs +1 -0
- package/lib/cjs/persistence/generators.cjs.map +1 -0
- package/lib/cjs/persistence/index.cjs +1 -0
- package/lib/cjs/persistence/index.cjs.map +1 -0
- package/lib/cjs/persistence/transactions.cjs +9 -8
- package/lib/cjs/persistence/transactions.cjs.map +1 -0
- package/lib/cjs/persistence/types.cjs +1 -0
- package/lib/cjs/persistence/types.cjs.map +1 -0
- package/lib/cjs/query/Condition.cjs +173 -165
- package/lib/cjs/query/Condition.cjs.map +1 -0
- package/lib/cjs/query/MethodQueryBuilder.cjs +37 -34
- package/lib/cjs/query/MethodQueryBuilder.cjs.map +1 -0
- package/lib/cjs/query/Paginator.cjs +28 -27
- package/lib/cjs/query/Paginator.cjs.map +1 -0
- package/lib/cjs/query/Statement.cjs +90 -84
- package/lib/cjs/query/Statement.cjs.map +1 -0
- package/lib/cjs/query/constants.cjs +5 -21
- package/lib/cjs/query/constants.cjs.map +1 -0
- package/lib/cjs/query/decorators.cjs +16 -15
- package/lib/cjs/query/decorators.cjs.map +1 -0
- package/lib/cjs/query/errors.cjs +1 -0
- package/lib/cjs/query/errors.cjs.map +1 -0
- package/lib/cjs/query/index.cjs +1 -0
- package/lib/cjs/query/index.cjs.map +1 -0
- package/lib/cjs/query/options.cjs +1 -0
- package/lib/cjs/query/options.cjs.map +1 -0
- package/lib/cjs/query/selectors.cjs +1 -0
- package/lib/cjs/query/selectors.cjs.map +1 -0
- package/lib/cjs/query/types.cjs +2 -13
- package/lib/cjs/query/types.cjs.map +1 -0
- package/lib/cjs/query/utils.cjs +10 -9
- package/lib/cjs/query/utils.cjs.map +1 -0
- package/lib/cjs/ram/RamAdapter.cjs +21 -20
- package/lib/cjs/ram/RamAdapter.cjs.map +1 -0
- package/lib/cjs/ram/RamPaginator.cjs +3 -2
- package/lib/cjs/ram/RamPaginator.cjs.map +1 -0
- package/lib/cjs/ram/RamStatement.cjs +38 -37
- package/lib/cjs/ram/RamStatement.cjs.map +1 -0
- package/lib/cjs/ram/constants.cjs +1 -0
- package/lib/cjs/ram/constants.cjs.map +1 -0
- package/lib/cjs/ram/handlers.cjs +3 -2
- package/lib/cjs/ram/handlers.cjs.map +1 -0
- package/lib/cjs/ram/index.cjs +8 -7
- package/lib/cjs/ram/index.cjs.map +1 -0
- package/lib/cjs/ram/types.cjs +1 -0
- package/lib/cjs/ram/types.cjs.map +1 -0
- package/lib/cjs/repository/Repository.cjs +85 -79
- package/lib/cjs/repository/Repository.cjs.map +1 -0
- package/lib/cjs/repository/constants.cjs +5 -20
- package/lib/cjs/repository/constants.cjs.map +1 -0
- package/lib/cjs/repository/decorators.cjs +7 -6
- package/lib/cjs/repository/decorators.cjs.map +1 -0
- package/lib/cjs/repository/errors.cjs +1 -0
- package/lib/cjs/repository/errors.cjs.map +1 -0
- package/lib/cjs/repository/index.cjs +1 -0
- package/lib/cjs/repository/index.cjs.map +1 -0
- package/lib/cjs/repository/injectables.cjs +14 -13
- package/lib/cjs/repository/injectables.cjs.map +1 -0
- package/lib/cjs/repository/types.cjs +1 -0
- package/lib/cjs/repository/types.cjs.map +1 -0
- package/lib/cjs/repository/utils.cjs +3 -2
- package/lib/cjs/repository/utils.cjs.map +1 -0
- package/lib/cjs/services/ModelService.cjs +36 -30
- package/lib/cjs/services/ModelService.cjs.map +1 -0
- package/lib/cjs/services/PersistenceService.cjs +9 -8
- package/lib/cjs/services/PersistenceService.cjs.map +1 -0
- package/lib/cjs/services/index.cjs +1 -0
- package/lib/cjs/services/index.cjs.map +1 -0
- package/lib/cjs/services/services.cjs +37 -31
- package/lib/cjs/services/services.cjs.map +1 -0
- package/lib/cjs/tasks/CleanUpTask.cjs +30 -24
- package/lib/cjs/tasks/CleanUpTask.cjs.map +1 -0
- package/lib/cjs/tasks/TaskContext.cjs +16 -15
- package/lib/cjs/tasks/TaskContext.cjs.map +1 -0
- package/lib/cjs/tasks/TaskEngine.cjs +112 -111
- package/lib/cjs/tasks/TaskEngine.cjs.map +1 -0
- package/lib/cjs/tasks/TaskErrors.cjs +1 -0
- package/lib/cjs/tasks/TaskErrors.cjs.map +1 -0
- package/lib/cjs/tasks/TaskEventBus.cjs +7 -6
- package/lib/cjs/tasks/TaskEventBus.cjs.map +1 -0
- package/lib/cjs/tasks/TaskEventService.cjs +8 -7
- package/lib/cjs/tasks/TaskEventService.cjs.map +1 -0
- package/lib/cjs/tasks/TaskHandler.cjs +5 -4
- package/lib/cjs/tasks/TaskHandler.cjs.map +1 -0
- package/lib/cjs/tasks/TaskHandlerRegistry.cjs +1 -0
- package/lib/cjs/tasks/TaskHandlerRegistry.cjs.map +1 -0
- package/lib/cjs/tasks/TaskService.cjs +43 -37
- package/lib/cjs/tasks/TaskService.cjs.map +1 -0
- package/lib/cjs/tasks/TaskStateChangeError.cjs +1 -0
- package/lib/cjs/tasks/TaskStateChangeError.cjs.map +1 -0
- package/lib/cjs/tasks/TaskTracker.cjs +62 -61
- package/lib/cjs/tasks/TaskTracker.cjs.map +1 -0
- package/lib/cjs/tasks/builder.cjs +30 -24
- package/lib/cjs/tasks/builder.cjs.map +1 -0
- package/lib/cjs/tasks/constants.cjs +6 -10
- package/lib/cjs/tasks/constants.cjs.map +1 -0
- package/lib/cjs/tasks/decorators.cjs +5 -4
- package/lib/cjs/tasks/decorators.cjs.map +1 -0
- package/lib/cjs/tasks/index.cjs +6 -5
- package/lib/cjs/tasks/index.cjs.map +1 -0
- package/lib/cjs/tasks/logging.cjs +12 -11
- package/lib/cjs/tasks/logging.cjs.map +1 -0
- package/lib/cjs/tasks/models/TaskBackoffModel.cjs +16 -10
- package/lib/cjs/tasks/models/TaskBackoffModel.cjs.map +1 -0
- package/lib/cjs/tasks/models/TaskErrorModel.cjs +11 -5
- package/lib/cjs/tasks/models/TaskErrorModel.cjs.map +1 -0
- package/lib/cjs/tasks/models/TaskEventModel.cjs +29 -23
- package/lib/cjs/tasks/models/TaskEventModel.cjs.map +1 -0
- package/lib/cjs/tasks/models/TaskIOSerializer.cjs +4 -3
- package/lib/cjs/tasks/models/TaskIOSerializer.cjs.map +1 -0
- package/lib/cjs/tasks/models/TaskLogEntryModel.cjs +11 -5
- package/lib/cjs/tasks/models/TaskLogEntryModel.cjs.map +1 -0
- package/lib/cjs/tasks/models/TaskModel.cjs +72 -66
- package/lib/cjs/tasks/models/TaskModel.cjs.map +1 -0
- package/lib/cjs/tasks/models/TaskStepResultModel.cjs +14 -8
- package/lib/cjs/tasks/models/TaskStepResultModel.cjs.map +1 -0
- package/lib/cjs/tasks/models/TaskStepSpecModel.cjs +11 -5
- package/lib/cjs/tasks/models/TaskStepSpecModel.cjs.map +1 -0
- package/lib/cjs/tasks/models/index.cjs +1 -0
- package/lib/cjs/tasks/models/index.cjs.map +1 -0
- package/lib/cjs/tasks/types.cjs +1 -0
- package/lib/cjs/tasks/types.cjs.map +1 -0
- package/lib/cjs/tasks/utils.cjs +6 -5
- package/lib/cjs/tasks/utils.cjs.map +1 -0
- package/lib/cjs/utils/ContextualLoggedClass.cjs +5 -4
- package/lib/cjs/utils/ContextualLoggedClass.cjs.map +1 -0
- package/lib/cjs/utils/decorators.cjs +9 -8
- package/lib/cjs/utils/decorators.cjs.map +1 -0
- package/lib/cjs/utils/errors.cjs +1 -0
- package/lib/cjs/utils/errors.cjs.map +1 -0
- package/lib/cjs/utils/index.cjs +1 -0
- package/lib/cjs/utils/index.cjs.map +1 -0
- package/lib/cjs/utils/throttling.cjs +4 -3
- package/lib/cjs/utils/throttling.cjs.map +1 -0
- package/lib/cjs/utils/types.cjs +1 -0
- package/lib/cjs/utils/types.cjs.map +1 -0
- package/lib/cjs/utils/utils.cjs +3 -2
- package/lib/cjs/utils/utils.cjs.map +1 -0
- package/lib/cjs/workers/TaskEngine.cjs +30 -29
- package/lib/cjs/workers/TaskEngine.cjs.map +1 -0
- package/lib/cjs/workers/WorkThreadEnvironment.cjs +1 -0
- package/lib/cjs/workers/WorkThreadEnvironment.cjs.map +1 -0
- package/lib/cjs/workers/index.cjs +1 -0
- package/lib/cjs/workers/index.cjs.map +1 -0
- package/lib/cjs/workers/messages.cjs +1 -0
- package/lib/cjs/workers/messages.cjs.map +1 -0
- package/lib/cjs/workers/types.cjs +1 -0
- package/lib/cjs/workers/types.cjs.map +1 -0
- package/lib/cjs/workers/workerThread.cjs +18 -17
- package/lib/cjs/workers/workerThread.cjs.map +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/types/auth/constants.d.cts +5 -0
- package/lib/types/auth/constants.d.mts +5 -0
- package/lib/types/auth/decorators.d.cts +5 -0
- package/lib/types/auth/decorators.d.mts +5 -0
- package/lib/types/auth/index.d.cts +2 -0
- package/lib/types/auth/index.d.mts +2 -0
- package/lib/types/fs/FilesystemAdapter.d.cts +70 -0
- package/lib/types/fs/FilesystemAdapter.d.mts +70 -0
- package/lib/types/fs/FsDispatch.d.cts +7 -0
- package/lib/types/fs/FsDispatch.d.mts +7 -0
- package/lib/types/fs/helpers.d.cts +17 -0
- package/lib/types/fs/helpers.d.mts +17 -0
- package/lib/types/fs/index.d.cts +4 -0
- package/lib/types/fs/index.d.mts +4 -0
- package/lib/types/fs/indexStore.d.cts +28 -0
- package/lib/types/fs/indexStore.d.mts +28 -0
- package/lib/types/fs/locks/FilesystemLock.d.cts +13 -0
- package/lib/types/fs/locks/FilesystemLock.d.mts +13 -0
- package/lib/types/fs/locks/FilesystemMultiLock.d.cts +8 -0
- package/lib/types/fs/locks/FilesystemMultiLock.d.mts +8 -0
- package/lib/types/fs/types.d.cts +40 -0
- package/lib/types/fs/types.d.mts +40 -0
- package/lib/types/identity/decorators.d.cts +72 -0
- package/lib/types/identity/decorators.d.mts +72 -0
- package/lib/types/identity/index.d.cts +6 -0
- package/lib/types/identity/index.d.mts +6 -0
- package/lib/types/index.d.cts +34 -0
- package/lib/types/index.d.mts +34 -0
- package/lib/types/index.d.ts +1 -1
- package/lib/types/interfaces/ContextuallyLogged.d.cts +8 -0
- package/lib/types/interfaces/ContextuallyLogged.d.mts +8 -0
- package/lib/types/interfaces/ErrorParser.d.cts +16 -0
- package/lib/types/interfaces/ErrorParser.d.mts +16 -0
- package/lib/types/interfaces/Executor.d.cts +16 -0
- package/lib/types/interfaces/Executor.d.mts +16 -0
- package/lib/types/interfaces/Observable.d.cts +33 -0
- package/lib/types/interfaces/Observable.d.mts +33 -0
- package/lib/types/interfaces/Observer.d.cts +15 -0
- package/lib/types/interfaces/Observer.d.mts +15 -0
- package/lib/types/interfaces/Paginatable.d.cts +20 -0
- package/lib/types/interfaces/Paginatable.d.mts +20 -0
- package/lib/types/interfaces/Queriable.d.cts +47 -0
- package/lib/types/interfaces/Queriable.d.mts +47 -0
- package/lib/types/interfaces/RawExecutor.d.cts +28 -0
- package/lib/types/interfaces/RawExecutor.d.mts +28 -0
- package/lib/types/interfaces/SequenceOptions.d.cts +79 -0
- package/lib/types/interfaces/SequenceOptions.d.mts +79 -0
- package/lib/types/interfaces/index.d.cts +12 -0
- package/lib/types/interfaces/index.d.mts +12 -0
- package/lib/types/migrations/Migration.d.cts +19 -0
- package/lib/types/migrations/Migration.d.mts +19 -0
- package/lib/types/migrations/MigrationService.d.cts +63 -0
- package/lib/types/migrations/MigrationService.d.mts +63 -0
- package/lib/types/migrations/MigrationTaskBuilder.d.cts +10 -0
- package/lib/types/migrations/MigrationTaskBuilder.d.mts +10 -0
- package/lib/types/migrations/MigrationTasks.d.cts +9 -0
- package/lib/types/migrations/MigrationTasks.d.mts +9 -0
- package/lib/types/migrations/MigrationVersioning.d.cts +7 -0
- package/lib/types/migrations/MigrationVersioning.d.mts +7 -0
- package/lib/types/migrations/SemverMigrationVersioning.d.cts +10 -0
- package/lib/types/migrations/SemverMigrationVersioning.d.mts +10 -0
- package/lib/types/migrations/StandardMigrationVersioning.d.cts +12 -0
- package/lib/types/migrations/StandardMigrationVersioning.d.mts +12 -0
- package/lib/types/migrations/constants.d.cts +2 -0
- package/lib/types/migrations/constants.d.mts +2 -0
- package/lib/types/migrations/decorators.d.cts +12 -0
- package/lib/types/migrations/decorators.d.mts +12 -0
- package/lib/types/migrations/index.d.cts +15 -0
- package/lib/types/migrations/index.d.mts +15 -0
- package/lib/types/migrations/types.d.cts +46 -0
- package/lib/types/migrations/types.d.mts +46 -0
- package/lib/types/model/BaseModel.d.cts +37 -0
- package/lib/types/model/BaseModel.d.mts +37 -0
- package/lib/types/model/SequenceModel.d.cts +32 -0
- package/lib/types/model/SequenceModel.d.mts +32 -0
- package/lib/types/model/construction.d.cts +455 -0
- package/lib/types/model/construction.d.mts +455 -0
- package/lib/types/model/decorators.d.cts +237 -0
- package/lib/types/model/decorators.d.mts +237 -0
- package/lib/types/model/index.d.cts +11 -0
- package/lib/types/model/index.d.mts +11 -0
- package/lib/types/model/indexing.d.cts +20 -0
- package/lib/types/model/indexing.d.mts +20 -0
- package/lib/types/model/types.d.cts +60 -0
- package/lib/types/model/types.d.mts +60 -0
- package/lib/types/overrides/Metadata.d.cts +22 -0
- package/lib/types/overrides/Metadata.d.mts +22 -0
- package/lib/types/overrides/Model.d.cts +94 -0
- package/lib/types/overrides/Model.d.mts +94 -0
- package/lib/types/overrides/ModelBuilder.d.cts +31 -0
- package/lib/types/overrides/ModelBuilder.d.mts +31 -0
- package/lib/types/overrides/index.d.cts +11 -0
- package/lib/types/overrides/index.d.mts +11 -0
- package/lib/types/overrides/injectables.d.cts +10 -0
- package/lib/types/overrides/injectables.d.mts +10 -0
- package/lib/types/overrides/overrides.d.cts +1 -0
- package/lib/types/overrides/overrides.d.mts +1 -0
- package/lib/types/persistence/Adapter.d.cts +469 -0
- package/lib/types/persistence/Adapter.d.mts +469 -0
- package/lib/types/persistence/Context.d.cts +16 -0
- package/lib/types/persistence/Context.d.mts +16 -0
- package/lib/types/persistence/ContextLock.d.cts +18 -0
- package/lib/types/persistence/ContextLock.d.mts +18 -0
- package/lib/types/persistence/Dispatch.d.cts +128 -0
- package/lib/types/persistence/Dispatch.d.mts +128 -0
- package/lib/types/persistence/ObserverHandler.d.cts +111 -0
- package/lib/types/persistence/ObserverHandler.d.mts +111 -0
- package/lib/types/persistence/Sequence.d.cts +126 -0
- package/lib/types/persistence/Sequence.d.mts +126 -0
- package/lib/types/persistence/constants.d.cts +74 -0
- package/lib/types/persistence/constants.d.mts +74 -0
- package/lib/types/persistence/decorators.d.cts +28 -0
- package/lib/types/persistence/decorators.d.mts +28 -0
- package/lib/types/persistence/errors.d.cts +33 -0
- package/lib/types/persistence/errors.d.mts +33 -0
- package/lib/types/persistence/event-filters.d.cts +20 -0
- package/lib/types/persistence/event-filters.d.mts +20 -0
- package/lib/types/persistence/generators.d.cts +14 -0
- package/lib/types/persistence/generators.d.mts +14 -0
- package/lib/types/persistence/index.d.cts +18 -0
- package/lib/types/persistence/index.d.mts +18 -0
- package/lib/types/persistence/transactions.d.cts +4 -0
- package/lib/types/persistence/transactions.d.mts +4 -0
- package/lib/types/persistence/types.d.cts +86 -0
- package/lib/types/persistence/types.d.mts +86 -0
- package/lib/types/query/Condition.d.cts +131 -0
- package/lib/types/query/Condition.d.mts +131 -0
- package/lib/types/query/MethodQueryBuilder.d.cts +185 -0
- package/lib/types/query/MethodQueryBuilder.d.mts +185 -0
- package/lib/types/query/Paginator.d.cts +105 -0
- package/lib/types/query/Paginator.d.mts +105 -0
- package/lib/types/query/Statement.d.cts +136 -0
- package/lib/types/query/Statement.d.mts +136 -0
- package/lib/types/query/constants.d.cts +69 -0
- package/lib/types/query/constants.d.mts +69 -0
- package/lib/types/query/decorators.d.cts +8 -0
- package/lib/types/query/decorators.d.mts +8 -0
- package/lib/types/query/errors.d.cts +21 -0
- package/lib/types/query/errors.d.mts +21 -0
- package/lib/types/query/index.d.cts +16 -0
- package/lib/types/query/index.d.mts +16 -0
- package/lib/types/query/options.d.cts +393 -0
- package/lib/types/query/options.d.mts +393 -0
- package/lib/types/query/selectors.d.cts +39 -0
- package/lib/types/query/selectors.d.mts +39 -0
- package/lib/types/query/types.d.cts +158 -0
- package/lib/types/query/types.d.mts +158 -0
- package/lib/types/query/utils.d.cts +40 -0
- package/lib/types/query/utils.d.mts +40 -0
- package/lib/types/ram/RamAdapter.d.cts +341 -0
- package/lib/types/ram/RamAdapter.d.mts +341 -0
- package/lib/types/ram/RamPaginator.d.cts +54 -0
- package/lib/types/ram/RamPaginator.d.mts +54 -0
- package/lib/types/ram/RamStatement.d.cts +92 -0
- package/lib/types/ram/RamStatement.d.mts +92 -0
- package/lib/types/ram/constants.d.cts +8 -0
- package/lib/types/ram/constants.d.mts +8 -0
- package/lib/types/ram/handlers.d.cts +24 -0
- package/lib/types/ram/handlers.d.mts +24 -0
- package/lib/types/ram/index.d.cts +12 -0
- package/lib/types/ram/index.d.mts +12 -0
- package/lib/types/ram/types.d.cts +50 -0
- package/lib/types/ram/types.d.mts +50 -0
- package/lib/types/repository/Repository.d.cts +501 -0
- package/lib/types/repository/Repository.d.mts +501 -0
- package/lib/types/repository/constants.d.cts +36 -0
- package/lib/types/repository/constants.d.mts +36 -0
- package/lib/types/repository/decorators.d.cts +30 -0
- package/lib/types/repository/decorators.d.mts +30 -0
- package/lib/types/repository/errors.d.cts +19 -0
- package/lib/types/repository/errors.d.mts +19 -0
- package/lib/types/repository/index.d.cts +12 -0
- package/lib/types/repository/index.d.mts +12 -0
- package/lib/types/repository/injectables.d.cts +95 -0
- package/lib/types/repository/injectables.d.mts +95 -0
- package/lib/types/repository/types.d.cts +28 -0
- package/lib/types/repository/types.d.mts +28 -0
- package/lib/types/repository/utils.d.cts +36 -0
- package/lib/types/repository/utils.d.mts +36 -0
- package/lib/types/services/ModelService.d.cts +45 -0
- package/lib/types/services/ModelService.d.mts +45 -0
- package/lib/types/services/PersistenceService.d.cts +17 -0
- package/lib/types/services/PersistenceService.d.mts +17 -0
- package/lib/types/services/index.d.cts +8 -0
- package/lib/types/services/index.d.mts +8 -0
- package/lib/types/services/services.d.cts +96 -0
- package/lib/types/services/services.d.mts +96 -0
- package/lib/types/tasks/CleanUpTask.d.cts +15 -0
- package/lib/types/tasks/CleanUpTask.d.mts +15 -0
- package/lib/types/tasks/TaskContext.d.cts +30 -0
- package/lib/types/tasks/TaskContext.d.mts +30 -0
- package/lib/types/tasks/TaskEngine.d.cts +97 -0
- package/lib/types/tasks/TaskEngine.d.mts +97 -0
- package/lib/types/tasks/TaskErrors.d.cts +65 -0
- package/lib/types/tasks/TaskErrors.d.mts +65 -0
- package/lib/types/tasks/TaskEventBus.d.cts +17 -0
- package/lib/types/tasks/TaskEventBus.d.mts +17 -0
- package/lib/types/tasks/TaskEventService.d.cts +7 -0
- package/lib/types/tasks/TaskEventService.d.mts +7 -0
- package/lib/types/tasks/TaskHandler.d.cts +12 -0
- package/lib/types/tasks/TaskHandler.d.mts +12 -0
- package/lib/types/tasks/TaskHandlerRegistry.d.cts +8 -0
- package/lib/types/tasks/TaskHandlerRegistry.d.mts +8 -0
- package/lib/types/tasks/TaskService.d.cts +65 -0
- package/lib/types/tasks/TaskService.d.mts +65 -0
- package/lib/types/tasks/TaskStateChangeError.d.cts +11 -0
- package/lib/types/tasks/TaskStateChangeError.d.mts +11 -0
- package/lib/types/tasks/TaskTracker.d.cts +47 -0
- package/lib/types/tasks/TaskTracker.d.mts +47 -0
- package/lib/types/tasks/builder.d.cts +72 -0
- package/lib/types/tasks/builder.d.mts +72 -0
- package/lib/types/tasks/constants.d.cts +31 -0
- package/lib/types/tasks/constants.d.mts +31 -0
- package/lib/types/tasks/decorators.d.cts +4 -0
- package/lib/types/tasks/decorators.d.mts +4 -0
- package/lib/types/tasks/index.d.cts +23 -0
- package/lib/types/tasks/index.d.mts +23 -0
- package/lib/types/tasks/logging.d.cts +31 -0
- package/lib/types/tasks/logging.d.mts +31 -0
- package/lib/types/tasks/models/TaskBackoffModel.d.cts +9 -0
- package/lib/types/tasks/models/TaskBackoffModel.d.mts +9 -0
- package/lib/types/tasks/models/TaskErrorModel.d.cts +8 -0
- package/lib/types/tasks/models/TaskErrorModel.d.mts +8 -0
- package/lib/types/tasks/models/TaskEventModel.d.cts +11 -0
- package/lib/types/tasks/models/TaskEventModel.d.mts +11 -0
- package/lib/types/tasks/models/TaskIOSerializer.d.cts +33 -0
- package/lib/types/tasks/models/TaskIOSerializer.d.mts +33 -0
- package/lib/types/tasks/models/TaskLogEntryModel.d.cts +10 -0
- package/lib/types/tasks/models/TaskLogEntryModel.d.mts +10 -0
- package/lib/types/tasks/models/TaskModel.d.cts +43 -0
- package/lib/types/tasks/models/TaskModel.d.mts +43 -0
- package/lib/types/tasks/models/TaskStepResultModel.d.cts +9 -0
- package/lib/types/tasks/models/TaskStepResultModel.d.mts +9 -0
- package/lib/types/tasks/models/TaskStepSpecModel.d.cts +9 -0
- package/lib/types/tasks/models/TaskStepSpecModel.d.mts +9 -0
- package/lib/types/tasks/models/index.d.cts +8 -0
- package/lib/types/tasks/models/index.d.mts +8 -0
- package/lib/types/tasks/types.d.cts +71 -0
- package/lib/types/tasks/types.d.mts +71 -0
- package/lib/types/tasks/utils.d.cts +5 -0
- package/lib/types/tasks/utils.d.mts +5 -0
- package/lib/types/utils/ContextualLoggedClass.d.cts +37 -0
- package/lib/types/utils/ContextualLoggedClass.d.mts +37 -0
- package/lib/types/utils/decorators.d.cts +27 -0
- package/lib/types/utils/decorators.d.mts +27 -0
- package/lib/types/utils/errors.d.cts +56 -0
- package/lib/types/utils/errors.d.mts +56 -0
- package/lib/types/utils/index.d.cts +11 -0
- package/lib/types/utils/index.d.mts +11 -0
- package/lib/types/utils/throttling.d.cts +9 -0
- package/lib/types/utils/throttling.d.mts +9 -0
- package/lib/types/utils/types.d.cts +23 -0
- package/lib/types/utils/types.d.mts +23 -0
- package/lib/types/utils/utils.d.cts +22 -0
- package/lib/types/utils/utils.d.mts +22 -0
- package/lib/types/workers/TaskEngine.d.cts +40 -0
- package/lib/types/workers/TaskEngine.d.mts +40 -0
- package/lib/types/workers/WorkThreadEnvironment.d.cts +35 -0
- package/lib/types/workers/WorkThreadEnvironment.d.mts +35 -0
- package/lib/types/workers/index.d.cts +5 -0
- package/lib/types/workers/index.d.mts +5 -0
- package/lib/types/workers/messages.d.cts +69 -0
- package/lib/types/workers/messages.d.mts +69 -0
- package/lib/types/workers/types.d.cts +41 -0
- package/lib/types/workers/types.d.mts +41 -0
- package/lib/types/workers/workerThread.d.cts +1 -0
- package/lib/types/workers/workerThread.d.mts +1 -0
- package/package.json +4 -4
- package/lib/cjs/auth/constants.js.map +0 -1
- package/lib/cjs/auth/decorators.js.map +0 -1
- package/lib/cjs/auth/index.js.map +0 -1
- package/lib/cjs/fs/FilesystemAdapter.js.map +0 -1
- package/lib/cjs/fs/FsDispatch.js.map +0 -1
- package/lib/cjs/fs/helpers.js.map +0 -1
- package/lib/cjs/fs/index.js.map +0 -1
- package/lib/cjs/fs/indexStore.js.map +0 -1
- package/lib/cjs/fs/locks/FilesystemLock.js.map +0 -1
- package/lib/cjs/fs/locks/FilesystemMultiLock.js.map +0 -1
- package/lib/cjs/fs/types.js.map +0 -1
- package/lib/cjs/identity/decorators.js.map +0 -1
- package/lib/cjs/identity/index.js.map +0 -1
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/interfaces/ContextuallyLogged.js.map +0 -1
- package/lib/cjs/interfaces/ErrorParser.js.map +0 -1
- package/lib/cjs/interfaces/Executor.js.map +0 -1
- package/lib/cjs/interfaces/Observable.js.map +0 -1
- package/lib/cjs/interfaces/Observer.js.map +0 -1
- package/lib/cjs/interfaces/Paginatable.js.map +0 -1
- package/lib/cjs/interfaces/Queriable.js.map +0 -1
- package/lib/cjs/interfaces/RawExecutor.js.map +0 -1
- package/lib/cjs/interfaces/SequenceOptions.js.map +0 -1
- package/lib/cjs/interfaces/index.js.map +0 -1
- package/lib/cjs/migrations/Migration.js.map +0 -1
- package/lib/cjs/migrations/MigrationService.js.map +0 -1
- package/lib/cjs/migrations/MigrationTaskBuilder.js.map +0 -1
- package/lib/cjs/migrations/MigrationTasks.js.map +0 -1
- package/lib/cjs/migrations/MigrationVersioning.js.map +0 -1
- package/lib/cjs/migrations/SemverMigrationVersioning.js.map +0 -1
- package/lib/cjs/migrations/StandardMigrationVersioning.js.map +0 -1
- package/lib/cjs/migrations/constants.js.map +0 -1
- package/lib/cjs/migrations/decorators.js.map +0 -1
- package/lib/cjs/migrations/index.js.map +0 -1
- package/lib/cjs/migrations/types.js.map +0 -1
- package/lib/cjs/model/BaseModel.js.map +0 -1
- package/lib/cjs/model/SequenceModel.js.map +0 -1
- package/lib/cjs/model/construction.js.map +0 -1
- package/lib/cjs/model/decorators.js.map +0 -1
- package/lib/cjs/model/index.js.map +0 -1
- package/lib/cjs/model/indexing.js.map +0 -1
- package/lib/cjs/model/types.js.map +0 -1
- package/lib/cjs/overrides/Metadata.js.map +0 -1
- package/lib/cjs/overrides/Model.js.map +0 -1
- package/lib/cjs/overrides/ModelBuilder.js.map +0 -1
- package/lib/cjs/overrides/index.js.map +0 -1
- package/lib/cjs/overrides/injectables.js.map +0 -1
- package/lib/cjs/overrides/overrides.js.map +0 -1
- package/lib/cjs/persistence/Adapter.js.map +0 -1
- package/lib/cjs/persistence/Context.js.map +0 -1
- package/lib/cjs/persistence/ContextLock.js.map +0 -1
- package/lib/cjs/persistence/Dispatch.js.map +0 -1
- package/lib/cjs/persistence/ObserverHandler.js.map +0 -1
- package/lib/cjs/persistence/Sequence.js.map +0 -1
- package/lib/cjs/persistence/constants.js.map +0 -1
- package/lib/cjs/persistence/decorators.js.map +0 -1
- package/lib/cjs/persistence/errors.js.map +0 -1
- package/lib/cjs/persistence/event-filters.js.map +0 -1
- package/lib/cjs/persistence/generators.js.map +0 -1
- package/lib/cjs/persistence/index.js.map +0 -1
- package/lib/cjs/persistence/transactions.js.map +0 -1
- package/lib/cjs/persistence/types.js.map +0 -1
- package/lib/cjs/query/Condition.js.map +0 -1
- package/lib/cjs/query/MethodQueryBuilder.js.map +0 -1
- package/lib/cjs/query/Paginator.js.map +0 -1
- package/lib/cjs/query/Statement.js.map +0 -1
- package/lib/cjs/query/constants.js.map +0 -1
- package/lib/cjs/query/decorators.js.map +0 -1
- package/lib/cjs/query/errors.js.map +0 -1
- package/lib/cjs/query/index.js.map +0 -1
- package/lib/cjs/query/options.js.map +0 -1
- package/lib/cjs/query/selectors.js.map +0 -1
- package/lib/cjs/query/types.js.map +0 -1
- package/lib/cjs/query/utils.js.map +0 -1
- package/lib/cjs/ram/RamAdapter.js.map +0 -1
- package/lib/cjs/ram/RamPaginator.js.map +0 -1
- package/lib/cjs/ram/RamStatement.js.map +0 -1
- package/lib/cjs/ram/constants.js.map +0 -1
- package/lib/cjs/ram/handlers.js.map +0 -1
- package/lib/cjs/ram/index.js.map +0 -1
- package/lib/cjs/ram/types.js.map +0 -1
- package/lib/cjs/repository/Repository.js.map +0 -1
- package/lib/cjs/repository/constants.js.map +0 -1
- package/lib/cjs/repository/decorators.js.map +0 -1
- package/lib/cjs/repository/errors.js.map +0 -1
- package/lib/cjs/repository/index.js.map +0 -1
- package/lib/cjs/repository/injectables.js.map +0 -1
- package/lib/cjs/repository/types.js.map +0 -1
- package/lib/cjs/repository/utils.js.map +0 -1
- package/lib/cjs/services/ModelService.js.map +0 -1
- package/lib/cjs/services/PersistenceService.js.map +0 -1
- package/lib/cjs/services/index.js.map +0 -1
- package/lib/cjs/services/services.js.map +0 -1
- package/lib/cjs/tasks/CleanUpTask.js.map +0 -1
- package/lib/cjs/tasks/TaskContext.js.map +0 -1
- package/lib/cjs/tasks/TaskEngine.js.map +0 -1
- package/lib/cjs/tasks/TaskErrors.js.map +0 -1
- package/lib/cjs/tasks/TaskEventBus.js.map +0 -1
- package/lib/cjs/tasks/TaskEventService.js.map +0 -1
- package/lib/cjs/tasks/TaskHandler.js.map +0 -1
- package/lib/cjs/tasks/TaskHandlerRegistry.js.map +0 -1
- package/lib/cjs/tasks/TaskService.js.map +0 -1
- package/lib/cjs/tasks/TaskStateChangeError.js.map +0 -1
- package/lib/cjs/tasks/TaskTracker.js.map +0 -1
- package/lib/cjs/tasks/builder.js.map +0 -1
- package/lib/cjs/tasks/constants.js.map +0 -1
- package/lib/cjs/tasks/decorators.js.map +0 -1
- package/lib/cjs/tasks/index.js.map +0 -1
- package/lib/cjs/tasks/logging.js.map +0 -1
- package/lib/cjs/tasks/models/TaskBackoffModel.js.map +0 -1
- package/lib/cjs/tasks/models/TaskErrorModel.js.map +0 -1
- package/lib/cjs/tasks/models/TaskEventModel.js.map +0 -1
- package/lib/cjs/tasks/models/TaskIOSerializer.js.map +0 -1
- package/lib/cjs/tasks/models/TaskLogEntryModel.js.map +0 -1
- package/lib/cjs/tasks/models/TaskModel.js.map +0 -1
- package/lib/cjs/tasks/models/TaskStepResultModel.js.map +0 -1
- package/lib/cjs/tasks/models/TaskStepSpecModel.js.map +0 -1
- package/lib/cjs/tasks/models/index.js.map +0 -1
- package/lib/cjs/tasks/types.js.map +0 -1
- package/lib/cjs/tasks/utils.js.map +0 -1
- package/lib/cjs/utils/ContextualLoggedClass.js.map +0 -1
- package/lib/cjs/utils/decorators.js.map +0 -1
- package/lib/cjs/utils/errors.js.map +0 -1
- package/lib/cjs/utils/index.js.map +0 -1
- package/lib/cjs/utils/throttling.js.map +0 -1
- package/lib/cjs/utils/types.js.map +0 -1
- package/lib/cjs/utils/utils.js.map +0 -1
- package/lib/cjs/workers/TaskEngine.js.map +0 -1
- package/lib/cjs/workers/WorkThreadEnvironment.js.map +0 -1
- package/lib/cjs/workers/index.js.map +0 -1
- package/lib/cjs/workers/messages.js.map +0 -1
- package/lib/cjs/workers/types.js.map +0 -1
- package/lib/cjs/workers/workerThread.js.map +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
import { SequenceOptions, SequenceOptionsType } from "../interfaces/SequenceOptions.js";
|
|
3
|
+
import { Constructor } from "@decaf-ts/decoration";
|
|
4
|
+
import { ContextualizedArgs, ContextualLoggedClass, MaybeContextualArg, MethodOrOperation } from "../utils/ContextualLoggedClass.js";
|
|
5
|
+
import { Adapter } from "./Adapter.js";
|
|
6
|
+
import { Repo } from "../repository/Repository.js";
|
|
7
|
+
import { SequenceModel } from "../model/SequenceModel.js";
|
|
8
|
+
import { Context } from "./Context.js";
|
|
9
|
+
import { MultiLock } from "@decaf-ts/transactional-decorators";
|
|
10
|
+
import type { ContextOf, FlagsOf } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* @description Abstract base class for sequence generation
|
|
13
|
+
* @summary Provides a framework for generating sequential values (like primary keys) in the persistence layer.
|
|
14
|
+
* Implementations of this class handle the specifics of how sequences are stored and incremented in different
|
|
15
|
+
* database systems.
|
|
16
|
+
* @param {SequenceOptions} options - Configuration options for the sequence generator
|
|
17
|
+
* @class Sequence
|
|
18
|
+
* @example
|
|
19
|
+
* ```typescript
|
|
20
|
+
* // Example implementation for a specific database
|
|
21
|
+
* class PostgresSequence extends Sequence {
|
|
22
|
+
* constructor(options: SequenceOptions) {
|
|
23
|
+
* super(options);
|
|
24
|
+
* }
|
|
25
|
+
*
|
|
26
|
+
* async next(): Promise<number> {
|
|
27
|
+
* // Implementation to get next value from PostgreSQL sequence
|
|
28
|
+
* const result = await this.options.executor.raw(`SELECT nextval('${this.options.name}')`);
|
|
29
|
+
* return parseInt(result.rows[0].nextval);
|
|
30
|
+
* }
|
|
31
|
+
*
|
|
32
|
+
* async current(): Promise<number> {
|
|
33
|
+
* // Implementation to get current value from PostgreSQL sequence
|
|
34
|
+
* const result = await this.options.executor.raw(`SELECT currval('${this.options.name}')`);
|
|
35
|
+
* return parseInt(result.rows[0].currval);
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* async range(count: number): Promise<number[]> {
|
|
39
|
+
* // Implementation to get a range of values
|
|
40
|
+
* const values: number[] = [];
|
|
41
|
+
* for (let i = 0; i < count; i++) {
|
|
42
|
+
* values.push(await this.next());
|
|
43
|
+
* }
|
|
44
|
+
* return values;
|
|
45
|
+
* }
|
|
46
|
+
* }
|
|
47
|
+
*
|
|
48
|
+
* // Usage
|
|
49
|
+
* const sequence = new PostgresSequence({
|
|
50
|
+
* name: 'user_id_seq',
|
|
51
|
+
* executor: dbExecutor
|
|
52
|
+
* });
|
|
53
|
+
*
|
|
54
|
+
* const nextId = await sequence.next();
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export declare class Sequence<A extends Adapter<any, any, any, any> = Adapter<any, any, any, any>> extends ContextualLoggedClass<any> {
|
|
58
|
+
protected readonly options: SequenceOptions;
|
|
59
|
+
protected readonly adapter: A;
|
|
60
|
+
protected repo: Repo<SequenceModel>;
|
|
61
|
+
protected static readonly lock: MultiLock;
|
|
62
|
+
/**
|
|
63
|
+
* @description Creates a new sequence instance
|
|
64
|
+
* @summary Protected constructor that initializes the sequence with the provided options
|
|
65
|
+
*/
|
|
66
|
+
constructor(options: SequenceOptions, adapter: A, overrides?: Partial<FlagsOf<A>>);
|
|
67
|
+
/**
|
|
68
|
+
* @description Retrieves the current value of the sequence
|
|
69
|
+
* @summary Gets the current value of the sequence from storage. If the sequence
|
|
70
|
+
* doesn't exist yet, it returns the configured starting value.
|
|
71
|
+
* @return A promise that resolves to the current sequence value
|
|
72
|
+
*/
|
|
73
|
+
current(...args: MaybeContextualArg<any>): Promise<string | number | bigint>;
|
|
74
|
+
/**
|
|
75
|
+
* @description Increments the sequence value
|
|
76
|
+
* @summary Increases the current sequence value by the specified amount and persists
|
|
77
|
+
* the new value to storage. This method handles both numeric and BigInt sequence types.
|
|
78
|
+
* @param {string | number | bigint} current - The current value of the sequence
|
|
79
|
+
* @param {number} [count] - Optional amount to increment by, defaults to the sequence's incrementBy value
|
|
80
|
+
* @return A promise that resolves to the new sequence value after incrementing
|
|
81
|
+
*/
|
|
82
|
+
protected increment(count: number | undefined, context: Context<any>): Promise<string | number | bigint>;
|
|
83
|
+
/**
|
|
84
|
+
* @description Gets the next value in the sequence
|
|
85
|
+
* @summary Retrieves the current value of the sequence and increments it by the
|
|
86
|
+
* configured increment amount. This is the main method used to get a new sequential value.
|
|
87
|
+
* @return A promise that resolves to the next value in the sequence
|
|
88
|
+
*/
|
|
89
|
+
next(...argz: MaybeContextualArg<any>): Promise<number | string | bigint>;
|
|
90
|
+
/**
|
|
91
|
+
* @description Generates a range of sequential values
|
|
92
|
+
* @summary Retrieves a specified number of sequential values from the sequence.
|
|
93
|
+
* This is useful when you need to allocate multiple IDs at once.
|
|
94
|
+
* The method increments the sequence by the total amount needed and returns all values in the range.
|
|
95
|
+
* @param {number} count - The number of sequential values to generate
|
|
96
|
+
* @return A promise that resolves to an array of sequential values
|
|
97
|
+
*/
|
|
98
|
+
range(count: number, ...argz: MaybeContextualArg<any>): Promise<(number | string | bigint)[]>;
|
|
99
|
+
/**
|
|
100
|
+
* @description Ensures the sequence exists and is at least a given value
|
|
101
|
+
* @summary Upserts the sequence record to the provided value when missing, and optionally only when the
|
|
102
|
+
* provided value is greater than the persisted one. This is used by decorators that want to "seed" a
|
|
103
|
+
* sequence based on an existing model value (for example when overriding/bootstrapping sequences).
|
|
104
|
+
*/
|
|
105
|
+
ensureAtLeast(value: string | number | bigint, ...argz: MaybeContextualArg<any>): Promise<string | number | bigint>;
|
|
106
|
+
protected parse(value: string | number | bigint): string | number | bigint;
|
|
107
|
+
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<typeof this.adapter>, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<typeof this.adapter>, ARGS, METHOD extends string ? true : false>;
|
|
108
|
+
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<typeof this.adapter>, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<typeof this.adapter>, ARGS, METHOD extends string ? true : false>;
|
|
109
|
+
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<typeof this.adapter>, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<typeof this.adapter>, ARGS, METHOD extends string ? true : false>>;
|
|
110
|
+
/**
|
|
111
|
+
* @description Gets the primary key sequence name for a model
|
|
112
|
+
* @summary Utility method that returns the standardized sequence name for a model's primary key
|
|
113
|
+
* @template M - The model type
|
|
114
|
+
* @param {M|Constructor<M>} model - The model instance or constructor
|
|
115
|
+
* @return {string} The sequence name for the model's primary key
|
|
116
|
+
*/
|
|
117
|
+
static pk<M extends Model>(model: M | Constructor<M>): string;
|
|
118
|
+
/**
|
|
119
|
+
* @description Parses a sequence value to the appropriate type
|
|
120
|
+
* @summary Converts a sequence value to the specified type (Number or BigInt)
|
|
121
|
+
* @param {"Number"|"BigInt"|undefined} type - The target type to convert to
|
|
122
|
+
* @param {string|number|bigint} value - The value to convert
|
|
123
|
+
* @return {string|number|bigint} The converted value
|
|
124
|
+
*/
|
|
125
|
+
static parseValue(type: SequenceOptionsType, value: string | number | bigint): string | number | bigint;
|
|
126
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { BulkCrudOperationKeys, OperationKeys } from "@decaf-ts/db-decorators";
|
|
2
|
+
import { AdapterFlags, ContextFlags } from "./types.cjs";
|
|
3
|
+
import { PreparedStatementKeys } from "../query/constants.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* @description Persistence-related constant keys
|
|
6
|
+
* @summary Enum containing string constants used throughout the persistence layer for metadata, relations, and other persistence-related operations
|
|
7
|
+
* @enum {string}
|
|
8
|
+
* @readonly
|
|
9
|
+
* @memberOf module:core
|
|
10
|
+
*/
|
|
11
|
+
export declare enum PersistenceKeys {
|
|
12
|
+
PERSISTENCE = "persistence",
|
|
13
|
+
/** @description Key for index metadata */
|
|
14
|
+
INDEX = "index",
|
|
15
|
+
/** @description Key for sequence metadata */
|
|
16
|
+
SEQUENCE = "sequence",
|
|
17
|
+
/** @description Key for unique constraint metadata */
|
|
18
|
+
UNIQUE = "unique",
|
|
19
|
+
/** @description Key for adapter metadata */
|
|
20
|
+
ADAPTER = "adapter",
|
|
21
|
+
/** @description Template for injectable adapter names */
|
|
22
|
+
INJECTABLE = "decaf_{0}_adapter_for_{1}",
|
|
23
|
+
SERVICE = "service",
|
|
24
|
+
/** @description Key for table name metadata */
|
|
25
|
+
TABLE = "table",
|
|
26
|
+
/** @description Key for column name metadata */
|
|
27
|
+
COLUMN = "column",
|
|
28
|
+
/** @description Key for general metadata storage */
|
|
29
|
+
METADATA = "__metadata",
|
|
30
|
+
/** @description Key for created-by ownership metadata */
|
|
31
|
+
OWNERSHIP = "ownership",
|
|
32
|
+
/** @description Key for created-by ownership metadata */
|
|
33
|
+
CREATED_BY = "ownership.created-by",
|
|
34
|
+
/** @description Key for updated-by ownership metadata */
|
|
35
|
+
UPDATED_BY = "ownership.updated-by",
|
|
36
|
+
/** @description Key for relations metadata storage */
|
|
37
|
+
RELATIONS = "__relations",
|
|
38
|
+
/** @description Key for relations metadata storage */
|
|
39
|
+
RELATION = "relation",
|
|
40
|
+
/** @description Key for one-to-one relation metadata */
|
|
41
|
+
ONE_TO_ONE = "relation.one-to-one",
|
|
42
|
+
/** @description Key for one-to-many relation metadata */
|
|
43
|
+
ONE_TO_MANY = "relation.one-to-many",
|
|
44
|
+
/** @description Key for many-to-one relation metadata */
|
|
45
|
+
MANY_TO_ONE = "relation.many-to-one",
|
|
46
|
+
/** @description Key for many-to-one relation metadata */
|
|
47
|
+
MANY_TO_MANY = "relation.many-to-many",
|
|
48
|
+
/** @description Key for populate metadata */
|
|
49
|
+
POPULATE = "populate",
|
|
50
|
+
/** @description Key for populate metadata */
|
|
51
|
+
NO_VALIDATE = "no-validate",
|
|
52
|
+
/** @description Key for migration classes */
|
|
53
|
+
MIGRATION = "migration",
|
|
54
|
+
STATEMENT = "statement",
|
|
55
|
+
QUERY = "query",
|
|
56
|
+
UUID = "uuid",
|
|
57
|
+
TAG_FOR_DELETION = "tag_for_deletion",
|
|
58
|
+
INITIALIZATION = "initialization",
|
|
59
|
+
SHUTDOWN = "shutdown",
|
|
60
|
+
BY_KEY = "by-key",
|
|
61
|
+
AUTH = "auth",
|
|
62
|
+
AUTH_ROLE = "auth-role",
|
|
63
|
+
DECAF_ROUTE = "DecafRoute",
|
|
64
|
+
THROTTLE = "throttle",
|
|
65
|
+
PERSISTENT_VERSION = "persistent-version",
|
|
66
|
+
DEFAULT_QUERY_ATTR = "default-query-attr"
|
|
67
|
+
}
|
|
68
|
+
export declare const DefaultContextFlags: ContextFlags<any>;
|
|
69
|
+
export declare const DefaultAdapterFlags: AdapterFlags;
|
|
70
|
+
export declare const TransactionOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
71
|
+
export declare const NonTransactionOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
72
|
+
export declare const SelectOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
73
|
+
export declare const MultipleSelectOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
74
|
+
export declare const PaginationOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { BulkCrudOperationKeys, OperationKeys } from "@decaf-ts/db-decorators";
|
|
2
|
+
import { AdapterFlags, ContextFlags } from "./types.js";
|
|
3
|
+
import { PreparedStatementKeys } from "../query/constants.js";
|
|
4
|
+
/**
|
|
5
|
+
* @description Persistence-related constant keys
|
|
6
|
+
* @summary Enum containing string constants used throughout the persistence layer for metadata, relations, and other persistence-related operations
|
|
7
|
+
* @enum {string}
|
|
8
|
+
* @readonly
|
|
9
|
+
* @memberOf module:core
|
|
10
|
+
*/
|
|
11
|
+
export declare enum PersistenceKeys {
|
|
12
|
+
PERSISTENCE = "persistence",
|
|
13
|
+
/** @description Key for index metadata */
|
|
14
|
+
INDEX = "index",
|
|
15
|
+
/** @description Key for sequence metadata */
|
|
16
|
+
SEQUENCE = "sequence",
|
|
17
|
+
/** @description Key for unique constraint metadata */
|
|
18
|
+
UNIQUE = "unique",
|
|
19
|
+
/** @description Key for adapter metadata */
|
|
20
|
+
ADAPTER = "adapter",
|
|
21
|
+
/** @description Template for injectable adapter names */
|
|
22
|
+
INJECTABLE = "decaf_{0}_adapter_for_{1}",
|
|
23
|
+
SERVICE = "service",
|
|
24
|
+
/** @description Key for table name metadata */
|
|
25
|
+
TABLE = "table",
|
|
26
|
+
/** @description Key for column name metadata */
|
|
27
|
+
COLUMN = "column",
|
|
28
|
+
/** @description Key for general metadata storage */
|
|
29
|
+
METADATA = "__metadata",
|
|
30
|
+
/** @description Key for created-by ownership metadata */
|
|
31
|
+
OWNERSHIP = "ownership",
|
|
32
|
+
/** @description Key for created-by ownership metadata */
|
|
33
|
+
CREATED_BY = "ownership.created-by",
|
|
34
|
+
/** @description Key for updated-by ownership metadata */
|
|
35
|
+
UPDATED_BY = "ownership.updated-by",
|
|
36
|
+
/** @description Key for relations metadata storage */
|
|
37
|
+
RELATIONS = "__relations",
|
|
38
|
+
/** @description Key for relations metadata storage */
|
|
39
|
+
RELATION = "relation",
|
|
40
|
+
/** @description Key for one-to-one relation metadata */
|
|
41
|
+
ONE_TO_ONE = "relation.one-to-one",
|
|
42
|
+
/** @description Key for one-to-many relation metadata */
|
|
43
|
+
ONE_TO_MANY = "relation.one-to-many",
|
|
44
|
+
/** @description Key for many-to-one relation metadata */
|
|
45
|
+
MANY_TO_ONE = "relation.many-to-one",
|
|
46
|
+
/** @description Key for many-to-one relation metadata */
|
|
47
|
+
MANY_TO_MANY = "relation.many-to-many",
|
|
48
|
+
/** @description Key for populate metadata */
|
|
49
|
+
POPULATE = "populate",
|
|
50
|
+
/** @description Key for populate metadata */
|
|
51
|
+
NO_VALIDATE = "no-validate",
|
|
52
|
+
/** @description Key for migration classes */
|
|
53
|
+
MIGRATION = "migration",
|
|
54
|
+
STATEMENT = "statement",
|
|
55
|
+
QUERY = "query",
|
|
56
|
+
UUID = "uuid",
|
|
57
|
+
TAG_FOR_DELETION = "tag_for_deletion",
|
|
58
|
+
INITIALIZATION = "initialization",
|
|
59
|
+
SHUTDOWN = "shutdown",
|
|
60
|
+
BY_KEY = "by-key",
|
|
61
|
+
AUTH = "auth",
|
|
62
|
+
AUTH_ROLE = "auth-role",
|
|
63
|
+
DECAF_ROUTE = "DecafRoute",
|
|
64
|
+
THROTTLE = "throttle",
|
|
65
|
+
PERSISTENT_VERSION = "persistent-version",
|
|
66
|
+
DEFAULT_QUERY_ATTR = "default-query-attr"
|
|
67
|
+
}
|
|
68
|
+
export declare const DefaultContextFlags: ContextFlags<any>;
|
|
69
|
+
export declare const DefaultAdapterFlags: AdapterFlags;
|
|
70
|
+
export declare const TransactionOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
71
|
+
export declare const NonTransactionOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
72
|
+
export declare const SelectOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
73
|
+
export declare const MultipleSelectOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
74
|
+
export declare const PaginationOperationKeys: (string | OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys)[];
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
import { ContextOf } from "./types.cjs";
|
|
3
|
+
import { Repo } from "../repository/Repository.cjs";
|
|
4
|
+
import { ContextualArgs } from "../utils/ContextualLoggedClass.cjs";
|
|
5
|
+
/**
|
|
6
|
+
* @description Handler function that sets a timestamp property to the current timestamp.
|
|
7
|
+
* @summary Updates a model property with the current timestamp from the repository context.
|
|
8
|
+
* @template M - The model type extending Model
|
|
9
|
+
* @template R - The repository type extending IRepository
|
|
10
|
+
* @template V - The data type for the operation
|
|
11
|
+
* @template F - The repository flags type
|
|
12
|
+
* @template C - The context type
|
|
13
|
+
* @param {C} context - The repository context containing the current timestamp
|
|
14
|
+
* @param {V} data - The data being processed
|
|
15
|
+
* @param key - The property key to update
|
|
16
|
+
* @param {M} model - The model instance being updated
|
|
17
|
+
* @return {Promise<void>} A promise that resolves when the timestamp has been set
|
|
18
|
+
* @function uuidCreateUpdateHandler
|
|
19
|
+
*/
|
|
20
|
+
export declare function uuidCreateUpdateHandler<M extends Model<boolean>, R extends Repo<M>>(this: R, context: ContextOf<R>, data: UUIDMetadata, key: keyof M, model: M): Promise<void>;
|
|
21
|
+
export type UUIDMetadata = {
|
|
22
|
+
update: boolean;
|
|
23
|
+
seed?: string | (<M extends Model>(model: M, ...args: ContextualArgs<any>) => string);
|
|
24
|
+
args?: any[];
|
|
25
|
+
};
|
|
26
|
+
export declare function uuid(...args: any[]): (target: any, propertyKey?: any) => void;
|
|
27
|
+
export declare function uuid(update: boolean, ...args: any[]): (target: any, propertyKey?: any) => void;
|
|
28
|
+
export declare function uuid(seed: string | (<M extends Model>(model: M, ...args: ContextualArgs<any>) => string), ...args: any[]): (target: any, propertyKey?: any) => void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
2
|
+
import { ContextOf } from "./types.js";
|
|
3
|
+
import { Repo } from "../repository/Repository.js";
|
|
4
|
+
import { ContextualArgs } from "../utils/ContextualLoggedClass.js";
|
|
5
|
+
/**
|
|
6
|
+
* @description Handler function that sets a timestamp property to the current timestamp.
|
|
7
|
+
* @summary Updates a model property with the current timestamp from the repository context.
|
|
8
|
+
* @template M - The model type extending Model
|
|
9
|
+
* @template R - The repository type extending IRepository
|
|
10
|
+
* @template V - The data type for the operation
|
|
11
|
+
* @template F - The repository flags type
|
|
12
|
+
* @template C - The context type
|
|
13
|
+
* @param {C} context - The repository context containing the current timestamp
|
|
14
|
+
* @param {V} data - The data being processed
|
|
15
|
+
* @param key - The property key to update
|
|
16
|
+
* @param {M} model - The model instance being updated
|
|
17
|
+
* @return {Promise<void>} A promise that resolves when the timestamp has been set
|
|
18
|
+
* @function uuidCreateUpdateHandler
|
|
19
|
+
*/
|
|
20
|
+
export declare function uuidCreateUpdateHandler<M extends Model<boolean>, R extends Repo<M>>(this: R, context: ContextOf<R>, data: UUIDMetadata, key: keyof M, model: M): Promise<void>;
|
|
21
|
+
export type UUIDMetadata = {
|
|
22
|
+
update: boolean;
|
|
23
|
+
seed?: string | (<M extends Model>(model: M, ...args: ContextualArgs<any>) => string);
|
|
24
|
+
args?: any[];
|
|
25
|
+
};
|
|
26
|
+
export declare function uuid(...args: any[]): (target: any, propertyKey?: any) => void;
|
|
27
|
+
export declare function uuid(update: boolean, ...args: any[]): (target: any, propertyKey?: any) => void;
|
|
28
|
+
export declare function uuid(seed: string | (<M extends Model>(model: M, ...args: ContextualArgs<any>) => string), ...args: any[]): (target: any, propertyKey?: any) => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { InternalError } from "@decaf-ts/db-decorators";
|
|
2
|
+
/**
|
|
3
|
+
* @description Error thrown when an unsupported operation is attempted
|
|
4
|
+
* @summary This error is thrown when an operation is requested that is not supported by the current
|
|
5
|
+
* persistence adapter or configuration. It extends the BaseError class and sets a 500 status code.
|
|
6
|
+
* @param {string|Error} msg - The error message or an Error object to wrap
|
|
7
|
+
* @class UnsupportedError
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Throwing an UnsupportedError
|
|
11
|
+
* if (!adapter.supportsTransactions()) {
|
|
12
|
+
* throw new UnsupportedError('Transactions are not supported by this adapter');
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* // Catching an UnsupportedError
|
|
16
|
+
* try {
|
|
17
|
+
* await adapter.beginTransaction();
|
|
18
|
+
* } catch (error) {
|
|
19
|
+
* if (error instanceof UnsupportedError) {
|
|
20
|
+
* console.error('Operation not supported:', error.message);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class UnsupportedError extends InternalError {
|
|
26
|
+
constructor(msg: string | Error | unknown);
|
|
27
|
+
}
|
|
28
|
+
export declare class MigrationError extends InternalError {
|
|
29
|
+
constructor(msg: string | Error | unknown, name?: string);
|
|
30
|
+
}
|
|
31
|
+
export declare class MigrationRuleError extends MigrationError {
|
|
32
|
+
constructor(msg: string | Error | unknown);
|
|
33
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { InternalError } from "@decaf-ts/db-decorators";
|
|
2
|
+
/**
|
|
3
|
+
* @description Error thrown when an unsupported operation is attempted
|
|
4
|
+
* @summary This error is thrown when an operation is requested that is not supported by the current
|
|
5
|
+
* persistence adapter or configuration. It extends the BaseError class and sets a 500 status code.
|
|
6
|
+
* @param {string|Error} msg - The error message or an Error object to wrap
|
|
7
|
+
* @class UnsupportedError
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* // Throwing an UnsupportedError
|
|
11
|
+
* if (!adapter.supportsTransactions()) {
|
|
12
|
+
* throw new UnsupportedError('Transactions are not supported by this adapter');
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* // Catching an UnsupportedError
|
|
16
|
+
* try {
|
|
17
|
+
* await adapter.beginTransaction();
|
|
18
|
+
* } catch (error) {
|
|
19
|
+
* if (error instanceof UnsupportedError) {
|
|
20
|
+
* console.error('Operation not supported:', error.message);
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare class UnsupportedError extends InternalError {
|
|
26
|
+
constructor(msg: string | Error | unknown);
|
|
27
|
+
}
|
|
28
|
+
export declare class MigrationError extends InternalError {
|
|
29
|
+
constructor(msg: string | Error | unknown, name?: string);
|
|
30
|
+
}
|
|
31
|
+
export declare class MigrationRuleError extends MigrationError {
|
|
32
|
+
constructor(msg: string | Error | unknown);
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AllOperationKeys, ObserverFilter } from "./types.cjs";
|
|
2
|
+
import { Model, ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
3
|
+
import type { Repo } from "../repository/Repository.cjs";
|
|
4
|
+
export declare function onlyOnCreate(clazz: ModelConstructor<any>): ObserverFilter;
|
|
5
|
+
export declare function onlyOnUpdate(clazz: ModelConstructor<any>): ObserverFilter;
|
|
6
|
+
export declare function onlyOnDelete(clazz: ModelConstructor<any>): ObserverFilter;
|
|
7
|
+
export declare function onlyOnTransactional(clazz: ModelConstructor<any>): ObserverFilter;
|
|
8
|
+
export declare function onlyOnSingle(clazz: ModelConstructor<any>): ObserverFilter;
|
|
9
|
+
export declare function onlyOnBulk(clazz: ModelConstructor<any>): ObserverFilter;
|
|
10
|
+
export declare function onlyOnFilter(clazz: ModelConstructor<any>, ops: AllOperationKeys[]): ObserverFilter;
|
|
11
|
+
export type AvailableFilters = typeof DefaultRepositoryFilters;
|
|
12
|
+
export declare const DefaultRepositoryFilters: {
|
|
13
|
+
onlyOnCreate: typeof onlyOnCreate;
|
|
14
|
+
onlyOnUpdate: typeof onlyOnUpdate;
|
|
15
|
+
onlyOnDelete: typeof onlyOnDelete;
|
|
16
|
+
onlyOnTransactional: typeof onlyOnTransactional;
|
|
17
|
+
onlyOnSingle: typeof onlyOnSingle;
|
|
18
|
+
onlyOnBulk: typeof onlyOnBulk;
|
|
19
|
+
};
|
|
20
|
+
export declare function getFilters<M extends Model>(repo: Repo<M>): Record<keyof typeof DefaultRepositoryFilters, ObserverFilter>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AllOperationKeys, ObserverFilter } from "./types.js";
|
|
2
|
+
import { Model, ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
3
|
+
import type { Repo } from "../repository/Repository.js";
|
|
4
|
+
export declare function onlyOnCreate(clazz: ModelConstructor<any>): ObserverFilter;
|
|
5
|
+
export declare function onlyOnUpdate(clazz: ModelConstructor<any>): ObserverFilter;
|
|
6
|
+
export declare function onlyOnDelete(clazz: ModelConstructor<any>): ObserverFilter;
|
|
7
|
+
export declare function onlyOnTransactional(clazz: ModelConstructor<any>): ObserverFilter;
|
|
8
|
+
export declare function onlyOnSingle(clazz: ModelConstructor<any>): ObserverFilter;
|
|
9
|
+
export declare function onlyOnBulk(clazz: ModelConstructor<any>): ObserverFilter;
|
|
10
|
+
export declare function onlyOnFilter(clazz: ModelConstructor<any>, ops: AllOperationKeys[]): ObserverFilter;
|
|
11
|
+
export type AvailableFilters = typeof DefaultRepositoryFilters;
|
|
12
|
+
export declare const DefaultRepositoryFilters: {
|
|
13
|
+
onlyOnCreate: typeof onlyOnCreate;
|
|
14
|
+
onlyOnUpdate: typeof onlyOnUpdate;
|
|
15
|
+
onlyOnDelete: typeof onlyOnDelete;
|
|
16
|
+
onlyOnTransactional: typeof onlyOnTransactional;
|
|
17
|
+
onlyOnSingle: typeof onlyOnSingle;
|
|
18
|
+
onlyOnBulk: typeof onlyOnBulk;
|
|
19
|
+
};
|
|
20
|
+
export declare function getFilters<M extends Model>(repo: Repo<M>): Record<keyof typeof DefaultRepositoryFilters, ObserverFilter>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Generator<OUT extends string | number = string> {
|
|
2
|
+
generate(prev?: OUT): OUT | Promise<OUT>;
|
|
3
|
+
}
|
|
4
|
+
export declare class UUID implements Generator {
|
|
5
|
+
private static _instance;
|
|
6
|
+
generate(prev?: string): string | Promise<string>;
|
|
7
|
+
static get instance(): UUID;
|
|
8
|
+
}
|
|
9
|
+
export declare class Serial implements Generator {
|
|
10
|
+
private static _instance;
|
|
11
|
+
private count;
|
|
12
|
+
generate(prev?: string): string | Promise<string>;
|
|
13
|
+
static get instance(): Serial;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface Generator<OUT extends string | number = string> {
|
|
2
|
+
generate(prev?: OUT): OUT | Promise<OUT>;
|
|
3
|
+
}
|
|
4
|
+
export declare class UUID implements Generator {
|
|
5
|
+
private static _instance;
|
|
6
|
+
generate(prev?: string): string | Promise<string>;
|
|
7
|
+
static get instance(): UUID;
|
|
8
|
+
}
|
|
9
|
+
export declare class Serial implements Generator {
|
|
10
|
+
private static _instance;
|
|
11
|
+
private count;
|
|
12
|
+
generate(prev?: string): string | Promise<string>;
|
|
13
|
+
static get instance(): Serial;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Exports for the persistence module.
|
|
3
|
+
* @summary This file exports all the necessary components for the persistence functionality, including Dispatch, constants, and more.
|
|
4
|
+
* @module core/persistence
|
|
5
|
+
*/
|
|
6
|
+
export * from "./Dispatch.cjs";
|
|
7
|
+
export * from "./constants.cjs";
|
|
8
|
+
export * from "./Context.cjs";
|
|
9
|
+
export * from "./ContextLock.cjs";
|
|
10
|
+
export * from "./decorators.cjs";
|
|
11
|
+
export * from "./errors.cjs";
|
|
12
|
+
export * from "./generators.cjs";
|
|
13
|
+
export * from "./event-filters.cjs";
|
|
14
|
+
export * from "./ObserverHandler.cjs";
|
|
15
|
+
export * from "./Sequence.cjs";
|
|
16
|
+
export * from "./types.cjs";
|
|
17
|
+
export * from "./transactions.cjs";
|
|
18
|
+
export * from "./Adapter.cjs";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Exports for the persistence module.
|
|
3
|
+
* @summary This file exports all the necessary components for the persistence functionality, including Dispatch, constants, and more.
|
|
4
|
+
* @module core/persistence
|
|
5
|
+
*/
|
|
6
|
+
export * from "./Dispatch.js";
|
|
7
|
+
export * from "./constants.js";
|
|
8
|
+
export * from "./Context.js";
|
|
9
|
+
export * from "./ContextLock.js";
|
|
10
|
+
export * from "./decorators.js";
|
|
11
|
+
export * from "./errors.js";
|
|
12
|
+
export * from "./generators.js";
|
|
13
|
+
export * from "./event-filters.js";
|
|
14
|
+
export * from "./ObserverHandler.js";
|
|
15
|
+
export * from "./Sequence.js";
|
|
16
|
+
export * from "./types.js";
|
|
17
|
+
export * from "./transactions.js";
|
|
18
|
+
export * from "./Adapter.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Adapter } from "../persistence/Adapter.cjs";
|
|
2
|
+
import { ContextLock } from "../persistence/ContextLock.cjs";
|
|
3
|
+
export declare function getAdapterTransaction(obj: any, ...args: any[]): import(".").AdapterTransaction<Adapter<any, any, any, any>>;
|
|
4
|
+
export declare function getContextLock(obj: any, ...args: any[]): ContextLock;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Adapter } from "../persistence/Adapter.js";
|
|
2
|
+
import { ContextLock } from "../persistence/ContextLock.js";
|
|
3
|
+
export declare function getAdapterTransaction(obj: any, ...args: any[]): import(".").AdapterTransaction<Adapter<any, any, any, any>>;
|
|
4
|
+
export declare function getContextLock(obj: any, ...args: any[]): ContextLock;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { BulkCrudOperationKeys, LoggerOfFlags, OperationKeys, RepositoryFlags, ContextFlags as CtxFlags } from "@decaf-ts/db-decorators";
|
|
2
|
+
import { Adapter } from "./Adapter.cjs";
|
|
3
|
+
import { Observable, type Observer } from "../interfaces/index.cjs";
|
|
4
|
+
import { Logger } from "@decaf-ts/logging";
|
|
5
|
+
import { Constructor } from "@decaf-ts/decoration";
|
|
6
|
+
import { Model } from "@decaf-ts/decorator-validation";
|
|
7
|
+
import { ContextualArgs, ContextualLoggedClass } from "../utils/ContextualLoggedClass.cjs";
|
|
8
|
+
import { Context } from "./Context.cjs";
|
|
9
|
+
import { Repository } from "../repository/Repository.cjs";
|
|
10
|
+
import { PersistenceKeys } from "./constants.cjs";
|
|
11
|
+
import { PreparedStatementKeys } from "../query/constants.cjs";
|
|
12
|
+
import { ContextLock } from "./ContextLock.cjs";
|
|
13
|
+
export type FlagsOfContext<C extends Context<any>> = C extends Context<infer F> ? F : never;
|
|
14
|
+
export type LoggerOfContext<C extends Context<any>> = LoggerOfFlags<FlagsOfContext<C>>;
|
|
15
|
+
export type ContextOfRepository<R extends Repository<any, any>> = R extends Repository<any, infer A> ? ContextOf<A> : never;
|
|
16
|
+
export type FlagsOfRepository<R extends Repository<any, any>> = FlagsOfContext<ContextOfRepository<R>>;
|
|
17
|
+
export type LoggerOfRepository<R extends Repository<any, any>> = LoggerOfContext<ContextOfRepository<R>>;
|
|
18
|
+
export type ContextOf<OBJ extends Repository<any, any> | Adapter<any, any, any, any> | ContextualLoggedClass<any>> = OBJ extends Adapter<any, any, any, infer C> ? C : OBJ extends Repository<any, any> ? ContextOfRepository<OBJ> : OBJ extends ContextualLoggedClass<infer C> ? C : never;
|
|
19
|
+
export type ConfigOf<OBJ extends Adapter<any, any, any, any>> = OBJ extends Adapter<infer C, any, any, any> ? C : never;
|
|
20
|
+
export type LoggerOfAdapter<A extends Adapter<any, any, any, any>> = A extends Adapter<any, any, any, infer C> ? LoggerOfContext<C> : never;
|
|
21
|
+
export type FlagsOfAdapter<A extends Adapter<any, any, any, any>> = A extends Adapter<any, any, any, infer C> ? FlagsOfContext<C> : never;
|
|
22
|
+
export type LoggerOf<OBJ extends AdapterFlags<any> | Context<any> | Adapter<any, any, any> | Repository<any, any>> = OBJ extends AdapterFlags<any> ? LoggerOfFlags<OBJ> : OBJ extends Context<any> ? LoggerOfContext<OBJ> : OBJ extends Repository<any, any> ? LoggerOfRepository<OBJ> : OBJ extends Adapter<any, any, any> ? LoggerOfAdapter<OBJ> : Logger;
|
|
23
|
+
export type ConfOf<A extends Adapter<any, any, any, any>> = A extends Adapter<infer C, any, any> ? C : never;
|
|
24
|
+
export type FlagsOf<OBJ extends Repository<any, any> | Adapter<any, any, any, any> | Context<any>> = OBJ extends Context<any> ? FlagsOfContext<OBJ> : OBJ extends Repository<any, any> ? FlagsOfRepository<OBJ> : OBJ extends Adapter<any, any, any, any> ? FlagsOfAdapter<OBJ> : never;
|
|
25
|
+
export type PersistenceObservable<CONTEXT extends Context<any>> = Observable<[
|
|
26
|
+
Observer,
|
|
27
|
+
ObserverFilter?
|
|
28
|
+
], [
|
|
29
|
+
Constructor | string,
|
|
30
|
+
OperationKeys | BulkCrudOperationKeys | string,
|
|
31
|
+
EventIds,
|
|
32
|
+
...ContextualArgs<CONTEXT>
|
|
33
|
+
]>;
|
|
34
|
+
export type PersistenceObserver<CONTEXT extends Context<any>> = Observer<[
|
|
35
|
+
Constructor | string,
|
|
36
|
+
OperationKeys | BulkCrudOperationKeys | string,
|
|
37
|
+
EventIds,
|
|
38
|
+
...ContextualArgs<CONTEXT>
|
|
39
|
+
]>;
|
|
40
|
+
/**
|
|
41
|
+
* @description Type representing possible ID formats for database events
|
|
42
|
+
* @summary A union type that defines the possible formats for event identifiers in the persistence layer.
|
|
43
|
+
* These can be single values (string, number, bigint) or arrays of these types.
|
|
44
|
+
* @typedef {(string|number|bigint|string[]|number[]|bigint[])} EventIds
|
|
45
|
+
* @memberOf module:core
|
|
46
|
+
*/
|
|
47
|
+
export type EventIds = string | number | bigint | string[] | number[] | bigint[];
|
|
48
|
+
export type ObserverFilter = (table: Constructor | string, event: AllOperationKeys, id: EventIds, ...args: ContextualArgs<any>) => boolean;
|
|
49
|
+
export type InferredAdapterConfig<A> = A extends Adapter<infer CONF, any, any> ? CONF : never;
|
|
50
|
+
export interface AdapterDispatch<A extends Adapter<any, any, any, any>> extends PersistenceObservable<ContextOf<A>> {
|
|
51
|
+
close(...args: ContextualArgs<ContextOf<A>>): Promise<void>;
|
|
52
|
+
updateObservers<M extends Model>(table: Constructor<M> | string, event: OperationKeys | BulkCrudOperationKeys | string, id: EventIds, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
|
|
53
|
+
}
|
|
54
|
+
export type RepositoryFor<A extends Adapter<any, any, any, any>> = A extends Adapter<any, any, any, any> ? ReturnType<A["repository"]> : never;
|
|
55
|
+
export type PreparedModel = {
|
|
56
|
+
record: Record<string, any>;
|
|
57
|
+
id: string;
|
|
58
|
+
transient?: Record<string, any>;
|
|
59
|
+
};
|
|
60
|
+
export type ContextFlags<LOG extends Logger> = CtxFlags<LOG> & Pick<RepositoryFlags<LOG>, "operation" | "correlationId" | "ignoreDevSafeGuards" | "parentContext" | "childContexts"> & {
|
|
61
|
+
pending?: Record<string, string[]>;
|
|
62
|
+
transactionLock?: ContextLock;
|
|
63
|
+
};
|
|
64
|
+
export type AdapterFlags<LOG extends Logger = Logger> = RepositoryFlags<LOG> & ContextFlags<LOG> & {
|
|
65
|
+
allowGenerationOverride: boolean;
|
|
66
|
+
afterQueryHandlers: boolean;
|
|
67
|
+
enforceUpdateValidation: boolean;
|
|
68
|
+
allowRawStatements: boolean;
|
|
69
|
+
forcePrepareSimpleQueries: boolean;
|
|
70
|
+
forcePrepareComplexQueries: boolean;
|
|
71
|
+
cacheForPopulate: Record<string, any>;
|
|
72
|
+
preferFromCache: boolean;
|
|
73
|
+
noEmit: boolean;
|
|
74
|
+
noEmitSingle: boolean;
|
|
75
|
+
noEmitBulk: boolean;
|
|
76
|
+
breakOnSingleFailureInBulk: boolean;
|
|
77
|
+
observeFullResult: boolean;
|
|
78
|
+
paginateByBookmark: boolean;
|
|
79
|
+
dryRun: boolean;
|
|
80
|
+
lock?: ContextLock;
|
|
81
|
+
};
|
|
82
|
+
export type RawResult<R, D extends boolean> = D extends true ? R : {
|
|
83
|
+
data: R;
|
|
84
|
+
count?: number;
|
|
85
|
+
};
|
|
86
|
+
export type AllOperationKeys = OperationKeys | BulkCrudOperationKeys | PersistenceKeys | PreparedStatementKeys | string;
|