@decaf-ts/core 0.13.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/lib/cjs/auth/constants.js.map +1 -0
- package/lib/cjs/auth/decorators.js.map +1 -0
- package/lib/cjs/auth/index.js.map +1 -0
- package/lib/cjs/fs/FilesystemAdapter.js.map +1 -0
- package/lib/cjs/fs/FsDispatch.js.map +1 -0
- package/lib/cjs/fs/helpers.js.map +1 -0
- package/lib/cjs/fs/index.js.map +1 -0
- package/lib/cjs/fs/indexStore.js.map +1 -0
- package/lib/cjs/fs/locks/FilesystemLock.js.map +1 -0
- package/lib/cjs/fs/locks/FilesystemMultiLock.js.map +1 -0
- package/lib/{fs → cjs/fs}/types.js.map +1 -1
- package/lib/cjs/identity/decorators.js.map +1 -0
- package/lib/cjs/identity/index.js.map +1 -0
- package/lib/{index.cjs → cjs/index.cjs} +1 -1
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/interfaces/ContextuallyLogged.js.map +1 -0
- package/lib/cjs/interfaces/ErrorParser.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/Executor.js.map +1 -1
- package/lib/cjs/interfaces/Observable.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/Observer.js.map +1 -1
- package/lib/cjs/interfaces/Paginatable.js.map +1 -0
- package/lib/{interfaces → cjs/interfaces}/Queriable.js.map +1 -1
- package/lib/cjs/interfaces/RawExecutor.js.map +1 -0
- package/lib/cjs/interfaces/SequenceOptions.js.map +1 -0
- package/lib/cjs/interfaces/index.js.map +1 -0
- package/lib/cjs/migrations/Migration.js.map +1 -0
- package/lib/cjs/migrations/MigrationService.js.map +1 -0
- package/lib/cjs/migrations/MigrationTaskBuilder.js.map +1 -0
- package/lib/cjs/migrations/MigrationTasks.js.map +1 -0
- package/lib/cjs/migrations/MigrationVersioning.js.map +1 -0
- package/lib/cjs/migrations/SemverMigrationVersioning.js.map +1 -0
- package/lib/cjs/migrations/StandardMigrationVersioning.js.map +1 -0
- package/lib/cjs/migrations/constants.js.map +1 -0
- package/lib/cjs/migrations/decorators.js.map +1 -0
- package/lib/cjs/migrations/index.js.map +1 -0
- package/lib/{persistence → cjs/migrations}/types.js.map +1 -1
- package/lib/cjs/model/BaseModel.js.map +1 -0
- package/lib/cjs/model/SequenceModel.js.map +1 -0
- package/lib/cjs/model/construction.js.map +1 -0
- package/lib/cjs/model/decorators.js.map +1 -0
- package/lib/cjs/model/index.js.map +1 -0
- package/lib/cjs/model/indexing.js.map +1 -0
- package/lib/{model → cjs/model}/types.js.map +1 -1
- package/lib/cjs/overrides/Metadata.js.map +1 -0
- package/lib/cjs/overrides/Model.js.map +1 -0
- package/lib/cjs/overrides/ModelBuilder.js.map +1 -0
- package/lib/cjs/overrides/index.js.map +1 -0
- package/lib/cjs/overrides/injectables.js.map +1 -0
- package/lib/cjs/overrides/overrides.js.map +1 -0
- package/lib/{persistence → cjs/persistence}/Adapter.cjs +12 -4
- package/lib/cjs/persistence/Adapter.js.map +1 -0
- package/lib/cjs/persistence/Context.js.map +1 -0
- package/lib/cjs/persistence/ContextLock.js.map +1 -0
- package/lib/cjs/persistence/Dispatch.js.map +1 -0
- package/lib/cjs/persistence/ObserverHandler.js.map +1 -0
- package/lib/cjs/persistence/Sequence.js.map +1 -0
- package/lib/cjs/persistence/constants.js.map +1 -0
- package/lib/cjs/persistence/decorators.js.map +1 -0
- package/lib/cjs/persistence/errors.js.map +1 -0
- package/lib/cjs/persistence/event-filters.js.map +1 -0
- package/lib/cjs/persistence/generators.js.map +1 -0
- package/lib/cjs/persistence/index.js.map +1 -0
- package/lib/cjs/persistence/transactions.js.map +1 -0
- package/lib/cjs/persistence/types.js.map +1 -0
- package/lib/cjs/query/Condition.js.map +1 -0
- package/lib/cjs/query/MethodQueryBuilder.js.map +1 -0
- package/lib/cjs/query/Paginator.js.map +1 -0
- package/lib/cjs/query/Statement.js.map +1 -0
- package/lib/cjs/query/constants.js.map +1 -0
- package/lib/cjs/query/decorators.js.map +1 -0
- package/lib/cjs/query/errors.js.map +1 -0
- package/lib/cjs/query/index.js.map +1 -0
- package/lib/{query → cjs/query}/options.js.map +1 -1
- package/lib/{query → cjs/query}/selectors.js.map +1 -1
- package/lib/cjs/query/types.js.map +1 -0
- package/lib/cjs/query/utils.js.map +1 -0
- package/lib/cjs/ram/RamAdapter.js.map +1 -0
- package/lib/cjs/ram/RamPaginator.js.map +1 -0
- package/lib/cjs/ram/RamStatement.js.map +1 -0
- package/lib/cjs/ram/constants.js.map +1 -0
- package/lib/cjs/ram/handlers.js.map +1 -0
- package/lib/cjs/ram/index.js.map +1 -0
- package/lib/{tasks → cjs/ram}/types.js.map +1 -1
- package/lib/{repository → cjs/repository}/Repository.cjs +10 -2
- package/lib/cjs/repository/Repository.js.map +1 -0
- package/lib/cjs/repository/constants.js.map +1 -0
- package/lib/cjs/repository/decorators.js.map +1 -0
- package/lib/cjs/repository/errors.js.map +1 -0
- package/lib/cjs/repository/index.js.map +1 -0
- package/lib/cjs/repository/injectables.js.map +1 -0
- package/lib/cjs/repository/types.js.map +1 -0
- package/lib/cjs/repository/utils.js.map +1 -0
- package/lib/cjs/services/ModelService.js.map +1 -0
- package/lib/cjs/services/PersistenceService.js.map +1 -0
- package/lib/cjs/services/index.js.map +1 -0
- package/lib/cjs/services/services.js.map +1 -0
- package/lib/cjs/tasks/CleanUpTask.js.map +1 -0
- package/lib/cjs/tasks/TaskContext.js.map +1 -0
- package/lib/cjs/tasks/TaskEngine.js.map +1 -0
- package/lib/cjs/tasks/TaskErrors.js.map +1 -0
- package/lib/cjs/tasks/TaskEventBus.js.map +1 -0
- package/lib/cjs/tasks/TaskEventService.js.map +1 -0
- package/lib/cjs/tasks/TaskHandler.js.map +1 -0
- package/lib/cjs/tasks/TaskHandlerRegistry.js.map +1 -0
- package/lib/cjs/tasks/TaskService.js.map +1 -0
- package/lib/cjs/tasks/TaskStateChangeError.js.map +1 -0
- package/lib/cjs/tasks/TaskTracker.js.map +1 -0
- package/lib/cjs/tasks/builder.js.map +1 -0
- package/lib/cjs/tasks/constants.js.map +1 -0
- package/lib/cjs/tasks/decorators.js.map +1 -0
- package/lib/cjs/tasks/index.js.map +1 -0
- package/lib/cjs/tasks/logging.js.map +1 -0
- package/lib/cjs/tasks/models/TaskBackoffModel.js.map +1 -0
- package/lib/cjs/tasks/models/TaskErrorModel.js.map +1 -0
- package/lib/cjs/tasks/models/TaskEventModel.js.map +1 -0
- package/lib/cjs/tasks/models/TaskIOSerializer.js.map +1 -0
- package/lib/cjs/tasks/models/TaskLogEntryModel.js.map +1 -0
- package/lib/cjs/tasks/models/TaskModel.js.map +1 -0
- package/lib/cjs/tasks/models/TaskStepResultModel.js.map +1 -0
- package/lib/cjs/tasks/models/TaskStepSpecModel.js.map +1 -0
- package/lib/cjs/tasks/models/index.js.map +1 -0
- package/lib/{ram → cjs/tasks}/types.js.map +1 -1
- package/lib/cjs/tasks/utils.js.map +1 -0
- package/lib/cjs/utils/ContextualLoggedClass.js.map +1 -0
- package/lib/cjs/utils/decorators.js.map +1 -0
- package/lib/cjs/utils/errors.js.map +1 -0
- package/lib/cjs/utils/index.js.map +1 -0
- package/lib/cjs/utils/throttling.js.map +1 -0
- package/lib/cjs/utils/types.js.map +1 -0
- package/lib/cjs/utils/utils.js.map +1 -0
- package/lib/cjs/workers/TaskEngine.js.map +1 -0
- package/lib/cjs/workers/WorkThreadEnvironment.js.map +1 -0
- package/lib/cjs/workers/index.js.map +1 -0
- package/lib/{workers → cjs/workers}/messages.js.map +1 -1
- package/lib/{migrations → cjs/workers}/types.js.map +1 -1
- package/lib/cjs/workers/workerThread.js.map +1 -0
- package/lib/esm/index.js +1 -1
- package/lib/esm/persistence/Adapter.js +12 -4
- package/lib/esm/persistence/Adapter.js.map +1 -1
- package/lib/esm/repository/Repository.js +10 -2
- package/lib/esm/repository/Repository.js.map +1 -1
- package/lib/{esm → types}/index.d.ts +1 -1
- package/lib/{esm → types}/persistence/transactions.d.ts +1 -1
- package/lib/{repository → types/repository}/Repository.d.ts +1 -1
- package/lib/{services → types/services}/ModelService.d.ts +2 -2
- package/lib/{esm → types}/tasks/TaskService.d.ts +2 -2
- package/package.json +26 -20
- package/lib/auth/constants.js.map +0 -1
- package/lib/auth/decorators.js.map +0 -1
- package/lib/auth/index.js.map +0 -1
- package/lib/esm/auth/constants.d.ts +0 -5
- package/lib/esm/auth/decorators.d.ts +0 -5
- package/lib/esm/auth/index.d.ts +0 -2
- package/lib/esm/repository/Repository.d.ts +0 -501
- package/lib/esm/services/ModelService.d.ts +0 -45
- package/lib/fs/FilesystemAdapter.d.ts +0 -70
- package/lib/fs/FilesystemAdapter.js.map +0 -1
- package/lib/fs/FsDispatch.d.ts +0 -7
- package/lib/fs/FsDispatch.js.map +0 -1
- package/lib/fs/helpers.d.ts +0 -17
- package/lib/fs/helpers.js.map +0 -1
- package/lib/fs/index.d.ts +0 -4
- package/lib/fs/index.js.map +0 -1
- package/lib/fs/indexStore.d.ts +0 -28
- package/lib/fs/indexStore.js.map +0 -1
- package/lib/fs/locks/FilesystemLock.d.ts +0 -13
- package/lib/fs/locks/FilesystemLock.js.map +0 -1
- package/lib/fs/locks/FilesystemMultiLock.d.ts +0 -8
- package/lib/fs/locks/FilesystemMultiLock.js.map +0 -1
- package/lib/fs/types.d.ts +0 -40
- package/lib/identity/decorators.d.ts +0 -72
- package/lib/identity/decorators.js.map +0 -1
- package/lib/identity/index.d.ts +0 -6
- package/lib/identity/index.js.map +0 -1
- package/lib/index.d.ts +0 -33
- package/lib/index.js.map +0 -1
- package/lib/interfaces/ContextuallyLogged.d.ts +0 -8
- package/lib/interfaces/ContextuallyLogged.js.map +0 -1
- package/lib/interfaces/ErrorParser.d.ts +0 -16
- package/lib/interfaces/ErrorParser.js.map +0 -1
- package/lib/interfaces/Executor.d.ts +0 -16
- package/lib/interfaces/Observable.d.ts +0 -33
- package/lib/interfaces/Observable.js.map +0 -1
- package/lib/interfaces/Observer.d.ts +0 -15
- package/lib/interfaces/Paginatable.d.ts +0 -20
- package/lib/interfaces/Paginatable.js.map +0 -1
- package/lib/interfaces/Queriable.d.ts +0 -47
- package/lib/interfaces/RawExecutor.d.ts +0 -28
- package/lib/interfaces/RawExecutor.js.map +0 -1
- package/lib/interfaces/SequenceOptions.d.ts +0 -79
- package/lib/interfaces/SequenceOptions.js.map +0 -1
- package/lib/interfaces/index.d.ts +0 -12
- package/lib/interfaces/index.js.map +0 -1
- package/lib/migrations/Migration.d.ts +0 -19
- package/lib/migrations/Migration.js.map +0 -1
- package/lib/migrations/MigrationService.d.ts +0 -63
- package/lib/migrations/MigrationService.js.map +0 -1
- package/lib/migrations/MigrationTaskBuilder.d.ts +0 -10
- package/lib/migrations/MigrationTaskBuilder.js.map +0 -1
- package/lib/migrations/MigrationTasks.d.ts +0 -9
- package/lib/migrations/MigrationTasks.js.map +0 -1
- package/lib/migrations/MigrationVersioning.d.ts +0 -7
- package/lib/migrations/MigrationVersioning.js.map +0 -1
- package/lib/migrations/SemverMigrationVersioning.d.ts +0 -10
- package/lib/migrations/SemverMigrationVersioning.js.map +0 -1
- package/lib/migrations/StandardMigrationVersioning.d.ts +0 -12
- package/lib/migrations/StandardMigrationVersioning.js.map +0 -1
- package/lib/migrations/constants.d.ts +0 -2
- package/lib/migrations/constants.js.map +0 -1
- package/lib/migrations/decorators.d.ts +0 -12
- package/lib/migrations/decorators.js.map +0 -1
- package/lib/migrations/index.d.ts +0 -14
- package/lib/migrations/index.js.map +0 -1
- package/lib/migrations/types.d.ts +0 -46
- package/lib/model/BaseModel.d.ts +0 -37
- package/lib/model/BaseModel.js.map +0 -1
- package/lib/model/SequenceModel.d.ts +0 -32
- package/lib/model/SequenceModel.js.map +0 -1
- package/lib/model/construction.d.ts +0 -455
- package/lib/model/construction.js.map +0 -1
- package/lib/model/decorators.d.ts +0 -237
- package/lib/model/decorators.js.map +0 -1
- package/lib/model/index.d.ts +0 -11
- package/lib/model/index.js.map +0 -1
- package/lib/model/indexing.d.ts +0 -20
- package/lib/model/indexing.js.map +0 -1
- package/lib/model/types.d.ts +0 -60
- package/lib/overrides/Metadata.d.ts +0 -22
- package/lib/overrides/Metadata.js.map +0 -1
- package/lib/overrides/Model.d.ts +0 -94
- package/lib/overrides/Model.js.map +0 -1
- package/lib/overrides/ModelBuilder.d.ts +0 -31
- package/lib/overrides/ModelBuilder.js.map +0 -1
- package/lib/overrides/index.d.ts +0 -10
- package/lib/overrides/index.js.map +0 -1
- package/lib/overrides/injectables.d.ts +0 -10
- package/lib/overrides/injectables.js.map +0 -1
- package/lib/overrides/overrides.d.ts +0 -1
- package/lib/overrides/overrides.js.map +0 -1
- package/lib/persistence/Adapter.d.ts +0 -469
- package/lib/persistence/Adapter.js.map +0 -1
- package/lib/persistence/Context.d.ts +0 -16
- package/lib/persistence/Context.js.map +0 -1
- package/lib/persistence/ContextLock.d.ts +0 -18
- package/lib/persistence/ContextLock.js.map +0 -1
- package/lib/persistence/Dispatch.d.ts +0 -128
- package/lib/persistence/Dispatch.js.map +0 -1
- package/lib/persistence/ObserverHandler.d.ts +0 -111
- package/lib/persistence/ObserverHandler.js.map +0 -1
- package/lib/persistence/Sequence.d.ts +0 -126
- package/lib/persistence/Sequence.js.map +0 -1
- package/lib/persistence/constants.d.ts +0 -74
- package/lib/persistence/constants.js.map +0 -1
- package/lib/persistence/decorators.d.ts +0 -28
- package/lib/persistence/decorators.js.map +0 -1
- package/lib/persistence/errors.d.ts +0 -33
- package/lib/persistence/errors.js.map +0 -1
- package/lib/persistence/event-filters.d.ts +0 -20
- package/lib/persistence/event-filters.js.map +0 -1
- package/lib/persistence/generators.d.ts +0 -14
- package/lib/persistence/generators.js.map +0 -1
- package/lib/persistence/index.d.ts +0 -18
- package/lib/persistence/index.js.map +0 -1
- package/lib/persistence/transactions.d.ts +0 -4
- package/lib/persistence/transactions.js.map +0 -1
- package/lib/persistence/types.d.ts +0 -86
- package/lib/query/Condition.d.ts +0 -131
- package/lib/query/Condition.js.map +0 -1
- package/lib/query/MethodQueryBuilder.d.ts +0 -185
- package/lib/query/MethodQueryBuilder.js.map +0 -1
- package/lib/query/Paginator.d.ts +0 -105
- package/lib/query/Paginator.js.map +0 -1
- package/lib/query/Statement.d.ts +0 -136
- package/lib/query/Statement.js.map +0 -1
- package/lib/query/constants.d.ts +0 -69
- package/lib/query/constants.js.map +0 -1
- package/lib/query/decorators.d.ts +0 -8
- package/lib/query/decorators.js.map +0 -1
- package/lib/query/errors.d.ts +0 -21
- package/lib/query/errors.js.map +0 -1
- package/lib/query/index.d.ts +0 -16
- package/lib/query/index.js.map +0 -1
- package/lib/query/options.d.ts +0 -393
- package/lib/query/selectors.d.ts +0 -39
- package/lib/query/types.d.ts +0 -158
- package/lib/query/types.js.map +0 -1
- package/lib/query/utils.d.ts +0 -40
- package/lib/query/utils.js.map +0 -1
- package/lib/ram/RamAdapter.d.ts +0 -341
- package/lib/ram/RamAdapter.js.map +0 -1
- package/lib/ram/RamPaginator.d.ts +0 -54
- package/lib/ram/RamPaginator.js.map +0 -1
- package/lib/ram/RamStatement.d.ts +0 -92
- package/lib/ram/RamStatement.js.map +0 -1
- package/lib/ram/constants.d.ts +0 -8
- package/lib/ram/constants.js.map +0 -1
- package/lib/ram/handlers.d.ts +0 -24
- package/lib/ram/handlers.js.map +0 -1
- package/lib/ram/index.d.ts +0 -6
- package/lib/ram/index.js.map +0 -1
- package/lib/ram/types.d.ts +0 -50
- package/lib/repository/Repository.js.map +0 -1
- package/lib/repository/constants.d.ts +0 -36
- package/lib/repository/constants.js.map +0 -1
- package/lib/repository/decorators.d.ts +0 -30
- package/lib/repository/decorators.js.map +0 -1
- package/lib/repository/errors.d.ts +0 -19
- package/lib/repository/errors.js.map +0 -1
- package/lib/repository/index.d.ts +0 -12
- package/lib/repository/index.js.map +0 -1
- package/lib/repository/injectables.d.ts +0 -95
- package/lib/repository/injectables.js.map +0 -1
- package/lib/repository/types.d.ts +0 -28
- package/lib/repository/types.js.map +0 -1
- package/lib/repository/utils.d.ts +0 -36
- package/lib/repository/utils.js.map +0 -1
- package/lib/services/ModelService.js.map +0 -1
- package/lib/services/PersistenceService.d.ts +0 -17
- package/lib/services/PersistenceService.js.map +0 -1
- package/lib/services/index.d.ts +0 -8
- package/lib/services/index.js.map +0 -1
- package/lib/services/services.d.ts +0 -96
- package/lib/services/services.js.map +0 -1
- package/lib/tasks/CleanUpTask.d.ts +0 -15
- package/lib/tasks/CleanUpTask.js.map +0 -1
- package/lib/tasks/TaskContext.d.ts +0 -30
- package/lib/tasks/TaskContext.js.map +0 -1
- package/lib/tasks/TaskEngine.d.ts +0 -97
- package/lib/tasks/TaskEngine.js.map +0 -1
- package/lib/tasks/TaskErrors.d.ts +0 -65
- package/lib/tasks/TaskErrors.js.map +0 -1
- package/lib/tasks/TaskEventBus.d.ts +0 -17
- package/lib/tasks/TaskEventBus.js.map +0 -1
- package/lib/tasks/TaskEventService.d.ts +0 -7
- package/lib/tasks/TaskEventService.js.map +0 -1
- package/lib/tasks/TaskHandler.d.ts +0 -12
- package/lib/tasks/TaskHandler.js.map +0 -1
- package/lib/tasks/TaskHandlerRegistry.d.ts +0 -8
- package/lib/tasks/TaskHandlerRegistry.js.map +0 -1
- package/lib/tasks/TaskService.d.ts +0 -65
- package/lib/tasks/TaskService.js.map +0 -1
- package/lib/tasks/TaskStateChangeError.d.ts +0 -11
- package/lib/tasks/TaskStateChangeError.js.map +0 -1
- package/lib/tasks/TaskTracker.d.ts +0 -47
- package/lib/tasks/TaskTracker.js.map +0 -1
- package/lib/tasks/builder.d.ts +0 -72
- package/lib/tasks/builder.js.map +0 -1
- package/lib/tasks/constants.d.ts +0 -31
- package/lib/tasks/constants.js.map +0 -1
- package/lib/tasks/decorators.d.ts +0 -4
- package/lib/tasks/decorators.js.map +0 -1
- package/lib/tasks/index.d.ts +0 -22
- package/lib/tasks/index.js.map +0 -1
- package/lib/tasks/logging.d.ts +0 -31
- package/lib/tasks/logging.js.map +0 -1
- package/lib/tasks/models/TaskBackoffModel.d.ts +0 -9
- package/lib/tasks/models/TaskBackoffModel.js.map +0 -1
- package/lib/tasks/models/TaskErrorModel.d.ts +0 -8
- package/lib/tasks/models/TaskErrorModel.js.map +0 -1
- package/lib/tasks/models/TaskEventModel.d.ts +0 -11
- package/lib/tasks/models/TaskEventModel.js.map +0 -1
- package/lib/tasks/models/TaskIOSerializer.d.ts +0 -33
- package/lib/tasks/models/TaskIOSerializer.js.map +0 -1
- package/lib/tasks/models/TaskLogEntryModel.d.ts +0 -10
- package/lib/tasks/models/TaskLogEntryModel.js.map +0 -1
- package/lib/tasks/models/TaskModel.d.ts +0 -43
- package/lib/tasks/models/TaskModel.js.map +0 -1
- package/lib/tasks/models/TaskStepResultModel.d.ts +0 -9
- package/lib/tasks/models/TaskStepResultModel.js.map +0 -1
- package/lib/tasks/models/TaskStepSpecModel.d.ts +0 -9
- package/lib/tasks/models/TaskStepSpecModel.js.map +0 -1
- package/lib/tasks/models/index.d.ts +0 -8
- package/lib/tasks/models/index.js.map +0 -1
- package/lib/tasks/types.d.ts +0 -71
- package/lib/tasks/utils.d.ts +0 -5
- package/lib/tasks/utils.js.map +0 -1
- package/lib/utils/ContextualLoggedClass.d.ts +0 -37
- package/lib/utils/ContextualLoggedClass.js.map +0 -1
- package/lib/utils/decorators.d.ts +0 -27
- package/lib/utils/decorators.js.map +0 -1
- package/lib/utils/errors.d.ts +0 -56
- package/lib/utils/errors.js.map +0 -1
- package/lib/utils/index.d.ts +0 -11
- package/lib/utils/index.js.map +0 -1
- package/lib/utils/throttling.d.ts +0 -9
- package/lib/utils/throttling.js.map +0 -1
- package/lib/utils/types.d.ts +0 -23
- package/lib/utils/types.js.map +0 -1
- package/lib/utils/utils.d.ts +0 -22
- package/lib/utils/utils.js.map +0 -1
- package/lib/workers/TaskEngine.d.ts +0 -40
- package/lib/workers/TaskEngine.js.map +0 -1
- package/lib/workers/WorkThreadEnvironment.d.ts +0 -35
- package/lib/workers/WorkThreadEnvironment.js.map +0 -1
- package/lib/workers/index.d.ts +0 -4
- package/lib/workers/index.js.map +0 -1
- package/lib/workers/messages.d.ts +0 -69
- package/lib/workers/types.d.ts +0 -41
- package/lib/workers/types.js.map +0 -1
- package/lib/workers/workerThread.d.ts +0 -1
- package/lib/workers/workerThread.js.map +0 -1
- /package/lib/{auth → cjs/auth}/constants.cjs +0 -0
- /package/lib/{auth → cjs/auth}/decorators.cjs +0 -0
- /package/lib/{auth → cjs/auth}/index.cjs +0 -0
- /package/lib/{fs → cjs/fs}/FilesystemAdapter.cjs +0 -0
- /package/lib/{fs → cjs/fs}/FsDispatch.cjs +0 -0
- /package/lib/{fs → cjs/fs}/helpers.cjs +0 -0
- /package/lib/{fs → cjs/fs}/index.cjs +0 -0
- /package/lib/{fs → cjs/fs}/indexStore.cjs +0 -0
- /package/lib/{fs → cjs/fs}/locks/FilesystemLock.cjs +0 -0
- /package/lib/{fs → cjs/fs}/locks/FilesystemMultiLock.cjs +0 -0
- /package/lib/{fs → cjs/fs}/types.cjs +0 -0
- /package/lib/{identity → cjs/identity}/decorators.cjs +0 -0
- /package/lib/{identity → cjs/identity}/index.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/ContextuallyLogged.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/ErrorParser.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/Executor.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/Observable.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/Observer.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/Paginatable.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/Queriable.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/RawExecutor.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/SequenceOptions.cjs +0 -0
- /package/lib/{interfaces → cjs/interfaces}/index.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/Migration.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/MigrationService.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/MigrationTaskBuilder.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/MigrationTasks.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/MigrationVersioning.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/SemverMigrationVersioning.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/StandardMigrationVersioning.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/constants.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/decorators.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/index.cjs +0 -0
- /package/lib/{migrations → cjs/migrations}/types.cjs +0 -0
- /package/lib/{model → cjs/model}/BaseModel.cjs +0 -0
- /package/lib/{model → cjs/model}/SequenceModel.cjs +0 -0
- /package/lib/{model → cjs/model}/construction.cjs +0 -0
- /package/lib/{model → cjs/model}/decorators.cjs +0 -0
- /package/lib/{model → cjs/model}/index.cjs +0 -0
- /package/lib/{model → cjs/model}/indexing.cjs +0 -0
- /package/lib/{model → cjs/model}/types.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/Metadata.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/Model.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/ModelBuilder.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/index.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/injectables.cjs +0 -0
- /package/lib/{overrides → cjs/overrides}/overrides.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/Context.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/ContextLock.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/Dispatch.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/ObserverHandler.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/Sequence.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/constants.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/decorators.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/errors.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/event-filters.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/generators.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/index.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/transactions.cjs +0 -0
- /package/lib/{persistence → cjs/persistence}/types.cjs +0 -0
- /package/lib/{query → cjs/query}/Condition.cjs +0 -0
- /package/lib/{query → cjs/query}/MethodQueryBuilder.cjs +0 -0
- /package/lib/{query → cjs/query}/Paginator.cjs +0 -0
- /package/lib/{query → cjs/query}/Statement.cjs +0 -0
- /package/lib/{query → cjs/query}/constants.cjs +0 -0
- /package/lib/{query → cjs/query}/decorators.cjs +0 -0
- /package/lib/{query → cjs/query}/errors.cjs +0 -0
- /package/lib/{query → cjs/query}/index.cjs +0 -0
- /package/lib/{query → cjs/query}/options.cjs +0 -0
- /package/lib/{query → cjs/query}/selectors.cjs +0 -0
- /package/lib/{query → cjs/query}/types.cjs +0 -0
- /package/lib/{query → cjs/query}/utils.cjs +0 -0
- /package/lib/{ram → cjs/ram}/RamAdapter.cjs +0 -0
- /package/lib/{ram → cjs/ram}/RamPaginator.cjs +0 -0
- /package/lib/{ram → cjs/ram}/RamStatement.cjs +0 -0
- /package/lib/{ram → cjs/ram}/constants.cjs +0 -0
- /package/lib/{ram → cjs/ram}/handlers.cjs +0 -0
- /package/lib/{ram → cjs/ram}/index.cjs +0 -0
- /package/lib/{ram → cjs/ram}/types.cjs +0 -0
- /package/lib/{repository → cjs/repository}/constants.cjs +0 -0
- /package/lib/{repository → cjs/repository}/decorators.cjs +0 -0
- /package/lib/{repository → cjs/repository}/errors.cjs +0 -0
- /package/lib/{repository → cjs/repository}/index.cjs +0 -0
- /package/lib/{repository → cjs/repository}/injectables.cjs +0 -0
- /package/lib/{repository → cjs/repository}/types.cjs +0 -0
- /package/lib/{repository → cjs/repository}/utils.cjs +0 -0
- /package/lib/{services → cjs/services}/ModelService.cjs +0 -0
- /package/lib/{services → cjs/services}/PersistenceService.cjs +0 -0
- /package/lib/{services → cjs/services}/index.cjs +0 -0
- /package/lib/{services → cjs/services}/services.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/CleanUpTask.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskContext.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskEngine.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskErrors.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskEventBus.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskEventService.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskHandler.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskHandlerRegistry.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskService.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskStateChangeError.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/TaskTracker.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/builder.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/constants.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/decorators.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/index.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/logging.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/models/TaskBackoffModel.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/models/TaskErrorModel.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/models/TaskEventModel.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/models/TaskIOSerializer.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/models/TaskLogEntryModel.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/models/TaskModel.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/models/TaskStepResultModel.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/models/TaskStepSpecModel.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/models/index.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/types.cjs +0 -0
- /package/lib/{tasks → cjs/tasks}/utils.cjs +0 -0
- /package/lib/{utils → cjs/utils}/ContextualLoggedClass.cjs +0 -0
- /package/lib/{utils → cjs/utils}/decorators.cjs +0 -0
- /package/lib/{utils → cjs/utils}/errors.cjs +0 -0
- /package/lib/{utils → cjs/utils}/index.cjs +0 -0
- /package/lib/{utils → cjs/utils}/throttling.cjs +0 -0
- /package/lib/{utils → cjs/utils}/types.cjs +0 -0
- /package/lib/{utils → cjs/utils}/utils.cjs +0 -0
- /package/lib/{workers → cjs/workers}/TaskEngine.cjs +0 -0
- /package/lib/{workers → cjs/workers}/WorkThreadEnvironment.cjs +0 -0
- /package/lib/{workers → cjs/workers}/index.cjs +0 -0
- /package/lib/{workers → cjs/workers}/messages.cjs +0 -0
- /package/lib/{workers → cjs/workers}/types.cjs +0 -0
- /package/lib/{workers → cjs/workers}/workerThread.cjs +0 -0
- /package/lib/{auth → types/auth}/constants.d.ts +0 -0
- /package/lib/{auth → types/auth}/decorators.d.ts +0 -0
- /package/lib/{auth → types/auth}/index.d.ts +0 -0
- /package/lib/{esm → types}/fs/FilesystemAdapter.d.ts +0 -0
- /package/lib/{esm → types}/fs/FsDispatch.d.ts +0 -0
- /package/lib/{esm → types}/fs/helpers.d.ts +0 -0
- /package/lib/{esm → types}/fs/index.d.ts +0 -0
- /package/lib/{esm → types}/fs/indexStore.d.ts +0 -0
- /package/lib/{esm → types}/fs/locks/FilesystemLock.d.ts +0 -0
- /package/lib/{esm → types}/fs/locks/FilesystemMultiLock.d.ts +0 -0
- /package/lib/{esm → types}/fs/types.d.ts +0 -0
- /package/lib/{esm → types}/identity/decorators.d.ts +0 -0
- /package/lib/{esm → types}/identity/index.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/ContextuallyLogged.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/ErrorParser.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/Executor.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/Observable.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/Observer.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/Paginatable.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/Queriable.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/RawExecutor.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/SequenceOptions.d.ts +0 -0
- /package/lib/{esm → types}/interfaces/index.d.ts +0 -0
- /package/lib/{esm → types}/migrations/Migration.d.ts +0 -0
- /package/lib/{esm → types}/migrations/MigrationService.d.ts +0 -0
- /package/lib/{esm → types}/migrations/MigrationTaskBuilder.d.ts +0 -0
- /package/lib/{esm → types}/migrations/MigrationTasks.d.ts +0 -0
- /package/lib/{esm → types}/migrations/MigrationVersioning.d.ts +0 -0
- /package/lib/{esm → types}/migrations/SemverMigrationVersioning.d.ts +0 -0
- /package/lib/{esm → types}/migrations/StandardMigrationVersioning.d.ts +0 -0
- /package/lib/{esm → types}/migrations/constants.d.ts +0 -0
- /package/lib/{esm → types}/migrations/decorators.d.ts +0 -0
- /package/lib/{esm → types}/migrations/index.d.ts +0 -0
- /package/lib/{esm → types}/migrations/types.d.ts +0 -0
- /package/lib/{esm → types}/model/BaseModel.d.ts +0 -0
- /package/lib/{esm → types}/model/SequenceModel.d.ts +0 -0
- /package/lib/{esm → types}/model/construction.d.ts +0 -0
- /package/lib/{esm → types}/model/decorators.d.ts +0 -0
- /package/lib/{esm → types}/model/index.d.ts +0 -0
- /package/lib/{esm → types}/model/indexing.d.ts +0 -0
- /package/lib/{esm → types}/model/types.d.ts +0 -0
- /package/lib/{esm → types}/overrides/Metadata.d.ts +0 -0
- /package/lib/{esm → types}/overrides/Model.d.ts +0 -0
- /package/lib/{esm → types}/overrides/ModelBuilder.d.ts +0 -0
- /package/lib/{esm → types}/overrides/index.d.ts +0 -0
- /package/lib/{esm → types}/overrides/injectables.d.ts +0 -0
- /package/lib/{esm → types}/overrides/overrides.d.ts +0 -0
- /package/lib/{esm → types}/persistence/Adapter.d.ts +0 -0
- /package/lib/{esm → types}/persistence/Context.d.ts +0 -0
- /package/lib/{esm → types}/persistence/ContextLock.d.ts +0 -0
- /package/lib/{esm → types}/persistence/Dispatch.d.ts +0 -0
- /package/lib/{esm → types}/persistence/ObserverHandler.d.ts +0 -0
- /package/lib/{esm → types}/persistence/Sequence.d.ts +0 -0
- /package/lib/{esm → types}/persistence/constants.d.ts +0 -0
- /package/lib/{esm → types}/persistence/decorators.d.ts +0 -0
- /package/lib/{esm → types}/persistence/errors.d.ts +0 -0
- /package/lib/{esm → types}/persistence/event-filters.d.ts +0 -0
- /package/lib/{esm → types}/persistence/generators.d.ts +0 -0
- /package/lib/{esm → types}/persistence/index.d.ts +0 -0
- /package/lib/{esm → types}/persistence/types.d.ts +0 -0
- /package/lib/{esm → types}/query/Condition.d.ts +0 -0
- /package/lib/{esm → types}/query/MethodQueryBuilder.d.ts +0 -0
- /package/lib/{esm → types}/query/Paginator.d.ts +0 -0
- /package/lib/{esm → types}/query/Statement.d.ts +0 -0
- /package/lib/{esm → types}/query/constants.d.ts +0 -0
- /package/lib/{esm → types}/query/decorators.d.ts +0 -0
- /package/lib/{esm → types}/query/errors.d.ts +0 -0
- /package/lib/{esm → types}/query/index.d.ts +0 -0
- /package/lib/{esm → types}/query/options.d.ts +0 -0
- /package/lib/{esm → types}/query/selectors.d.ts +0 -0
- /package/lib/{esm → types}/query/types.d.ts +0 -0
- /package/lib/{esm → types}/query/utils.d.ts +0 -0
- /package/lib/{esm → types}/ram/RamAdapter.d.ts +0 -0
- /package/lib/{esm → types}/ram/RamPaginator.d.ts +0 -0
- /package/lib/{esm → types}/ram/RamStatement.d.ts +0 -0
- /package/lib/{esm → types}/ram/constants.d.ts +0 -0
- /package/lib/{esm → types}/ram/handlers.d.ts +0 -0
- /package/lib/{esm → types}/ram/index.d.ts +0 -0
- /package/lib/{esm → types}/ram/types.d.ts +0 -0
- /package/lib/{esm → types}/repository/constants.d.ts +0 -0
- /package/lib/{esm → types}/repository/decorators.d.ts +0 -0
- /package/lib/{esm → types}/repository/errors.d.ts +0 -0
- /package/lib/{esm → types}/repository/index.d.ts +0 -0
- /package/lib/{esm → types}/repository/injectables.d.ts +0 -0
- /package/lib/{esm → types}/repository/types.d.ts +0 -0
- /package/lib/{esm → types}/repository/utils.d.ts +0 -0
- /package/lib/{esm → types}/services/PersistenceService.d.ts +0 -0
- /package/lib/{esm → types}/services/index.d.ts +0 -0
- /package/lib/{esm → types}/services/services.d.ts +0 -0
- /package/lib/{esm → types}/tasks/CleanUpTask.d.ts +0 -0
- /package/lib/{esm → types}/tasks/TaskContext.d.ts +0 -0
- /package/lib/{esm → types}/tasks/TaskEngine.d.ts +0 -0
- /package/lib/{esm → types}/tasks/TaskErrors.d.ts +0 -0
- /package/lib/{esm → types}/tasks/TaskEventBus.d.ts +0 -0
- /package/lib/{esm → types}/tasks/TaskEventService.d.ts +0 -0
- /package/lib/{esm → types}/tasks/TaskHandler.d.ts +0 -0
- /package/lib/{esm → types}/tasks/TaskHandlerRegistry.d.ts +0 -0
- /package/lib/{esm → types}/tasks/TaskStateChangeError.d.ts +0 -0
- /package/lib/{esm → types}/tasks/TaskTracker.d.ts +0 -0
- /package/lib/{esm → types}/tasks/builder.d.ts +0 -0
- /package/lib/{esm → types}/tasks/constants.d.ts +0 -0
- /package/lib/{esm → types}/tasks/decorators.d.ts +0 -0
- /package/lib/{esm → types}/tasks/index.d.ts +0 -0
- /package/lib/{esm → types}/tasks/logging.d.ts +0 -0
- /package/lib/{esm → types}/tasks/models/TaskBackoffModel.d.ts +0 -0
- /package/lib/{esm → types}/tasks/models/TaskErrorModel.d.ts +0 -0
- /package/lib/{esm → types}/tasks/models/TaskEventModel.d.ts +0 -0
- /package/lib/{esm → types}/tasks/models/TaskIOSerializer.d.ts +0 -0
- /package/lib/{esm → types}/tasks/models/TaskLogEntryModel.d.ts +0 -0
- /package/lib/{esm → types}/tasks/models/TaskModel.d.ts +0 -0
- /package/lib/{esm → types}/tasks/models/TaskStepResultModel.d.ts +0 -0
- /package/lib/{esm → types}/tasks/models/TaskStepSpecModel.d.ts +0 -0
- /package/lib/{esm → types}/tasks/models/index.d.ts +0 -0
- /package/lib/{esm → types}/tasks/types.d.ts +0 -0
- /package/lib/{esm → types}/tasks/utils.d.ts +0 -0
- /package/lib/{esm → types}/utils/ContextualLoggedClass.d.ts +0 -0
- /package/lib/{esm → types}/utils/decorators.d.ts +0 -0
- /package/lib/{esm → types}/utils/errors.d.ts +0 -0
- /package/lib/{esm → types}/utils/index.d.ts +0 -0
- /package/lib/{esm → types}/utils/throttling.d.ts +0 -0
- /package/lib/{esm → types}/utils/types.d.ts +0 -0
- /package/lib/{esm → types}/utils/utils.d.ts +0 -0
- /package/lib/{esm → types}/workers/TaskEngine.d.ts +0 -0
- /package/lib/{esm → types}/workers/WorkThreadEnvironment.d.ts +0 -0
- /package/lib/{esm → types}/workers/index.d.ts +0 -0
- /package/lib/{esm → types}/workers/messages.d.ts +0 -0
- /package/lib/{esm → types}/workers/types.d.ts +0 -0
- /package/lib/{esm → types}/workers/workerThread.d.ts +0 -0
|
@@ -1,501 +0,0 @@
|
|
|
1
|
-
import { IRepository, Repository as Rep, PrimaryKeyType } from "@decaf-ts/db-decorators";
|
|
2
|
-
import { Logger } from "@decaf-ts/logging";
|
|
3
|
-
import { ContextualArgs, ContextualizedArgs, MaybeContextualArg, MethodOrOperation } from "../utils/ContextualLoggedClass";
|
|
4
|
-
import { Adapter } from "../persistence/Adapter";
|
|
5
|
-
import { ObserverHandler } from "../persistence/ObserverHandler";
|
|
6
|
-
import type { DirectionLimitOffset, QueryOptions } from "../query/types";
|
|
7
|
-
import { SelectSelector } from "../query/selectors";
|
|
8
|
-
import { CountWhereOption, WhereOption } from "../query/options";
|
|
9
|
-
import { Condition } from "../query/Condition";
|
|
10
|
-
import { Queriable } from "../interfaces/Queriable";
|
|
11
|
-
import { SequenceOptions } from "../interfaces/SequenceOptions";
|
|
12
|
-
import { OrderDirection } from "./constants";
|
|
13
|
-
import type { AllOperationKeys, ContextOf, EventIds, FlagsOf, InferredAdapterConfig, ObserverFilter, PersistenceObservable, PersistenceObserver } from "../persistence/types";
|
|
14
|
-
import type { Observer } from "../interfaces/Observer";
|
|
15
|
-
import { Constructor } from "@decaf-ts/decoration";
|
|
16
|
-
import { Model } from "@decaf-ts/decorator-validation";
|
|
17
|
-
import { SerializedPage } from "../query/Paginator";
|
|
18
|
-
/**
|
|
19
|
-
* @description Type alias for Repository class with simplified generic parameters.
|
|
20
|
-
* @summary Provides a more concise way to reference the Repository class with its generic parameters.
|
|
21
|
-
* @template M - The model type that extends Model.
|
|
22
|
-
* @template F - The repository flags type.
|
|
23
|
-
* @template C - The context type.
|
|
24
|
-
* @template Q - The query type.
|
|
25
|
-
* @template A - The adapter type.
|
|
26
|
-
* @typedef Repo
|
|
27
|
-
* @memberOf module:core
|
|
28
|
-
*/
|
|
29
|
-
export type Repo<M extends Model<boolean>> = Repository<M, any>;
|
|
30
|
-
/**
|
|
31
|
-
* @description Core repository implementation for database operations on models on a table by table way.
|
|
32
|
-
* @summary Provides CRUD operations, querying capabilities, and observer pattern implementation for model persistence.
|
|
33
|
-
* @template M - The model type that extends Model.
|
|
34
|
-
* @template Q - The query type used by the adapter.
|
|
35
|
-
* @template A - The adapter type for database operations.
|
|
36
|
-
* @template F - The repository flags type.
|
|
37
|
-
* @template C - The context type for operations.
|
|
38
|
-
* @param {A} [adapter] - Optional adapter instance for database operations.
|
|
39
|
-
* @param {Constructor<M>} [clazz] - Optional constructor for the model class.
|
|
40
|
-
* @param {...any[]} [args] - Additional arguments for repository initialization.
|
|
41
|
-
* @class Repository
|
|
42
|
-
* @example
|
|
43
|
-
* // Creating a repository for User model
|
|
44
|
-
* const userRepo = Repository.forModel(User);
|
|
45
|
-
*
|
|
46
|
-
* // Using the repository for CRUD operations
|
|
47
|
-
* const user = await userRepo.create(new User({ name: 'John' }));
|
|
48
|
-
* const retrievedUser = await userRepo.read(user.id);
|
|
49
|
-
* user.name = 'Jane';
|
|
50
|
-
* await userRepo.update(user);
|
|
51
|
-
* await userRepo.delete(user.id);
|
|
52
|
-
*
|
|
53
|
-
* // Querying with conditions
|
|
54
|
-
* const users = await userRepo
|
|
55
|
-
* .select()
|
|
56
|
-
* .where({ name: 'Jane' })
|
|
57
|
-
* .orderBy('createdAt', OrderDirection.DSC)
|
|
58
|
-
* .limit(10)
|
|
59
|
-
* .execute();
|
|
60
|
-
* @mermaid
|
|
61
|
-
* sequenceDiagram
|
|
62
|
-
* participant C as Client Code
|
|
63
|
-
* participant R as Repository
|
|
64
|
-
* participant A as Adapter
|
|
65
|
-
* participant DB as Database
|
|
66
|
-
* participant O as Observers
|
|
67
|
-
*
|
|
68
|
-
* C->>+R: create(model)
|
|
69
|
-
* R->>R: createPrefix(model)
|
|
70
|
-
* R->>+A: prepare(model)
|
|
71
|
-
* A-->>-R: prepared data
|
|
72
|
-
* R->>+A: create(table, id, record)
|
|
73
|
-
* A->>+DB: Insert Operation
|
|
74
|
-
* DB-->>-A: Result
|
|
75
|
-
* A-->>-R: record
|
|
76
|
-
* R->>+A: revert(record)
|
|
77
|
-
* A-->>-R: model instance
|
|
78
|
-
* R->>R: createSuffix(model)
|
|
79
|
-
* R->>+O: updateObservers(table, CREATE, id)
|
|
80
|
-
* O-->>-R: Notification complete
|
|
81
|
-
* R-->>-C: created model
|
|
82
|
-
*/
|
|
83
|
-
export declare class Repository<M extends Model<boolean>, A extends Adapter<any, any, any, any>> extends Rep<M, ContextOf<A>> implements PersistenceObservable<ContextOf<A>>, PersistenceObserver<ContextOf<A>>, Queriable<M>, IRepository<M, ContextOf<A>> {
|
|
84
|
-
private static _cache;
|
|
85
|
-
protected observers: Observer[];
|
|
86
|
-
protected observerHandler?: ObserverHandler;
|
|
87
|
-
private readonly _adapter;
|
|
88
|
-
private _tableName;
|
|
89
|
-
protected _overrides: Partial<FlagsOf<ContextOf<A>>>;
|
|
90
|
-
private logger;
|
|
91
|
-
/**
|
|
92
|
-
* @description Logger instance for this repository.
|
|
93
|
-
* @summary Provides access to the logger for this repository instance.
|
|
94
|
-
* @return {Logger} The logger instance.
|
|
95
|
-
*/
|
|
96
|
-
get log(): Logger;
|
|
97
|
-
/**
|
|
98
|
-
* @description Adapter for database operations.
|
|
99
|
-
* @summary Provides access to the adapter instance for this repository.
|
|
100
|
-
* @template A - The adapter type.
|
|
101
|
-
* @return {A} The adapter instance.
|
|
102
|
-
* @throws {InternalError} If no adapter is found.
|
|
103
|
-
*/
|
|
104
|
-
protected get adapter(): A;
|
|
105
|
-
/**
|
|
106
|
-
* @description Table name for this repository's model.
|
|
107
|
-
* @summary Gets the database table name associated with this repository's model.
|
|
108
|
-
* @return {string} The table name.
|
|
109
|
-
*/
|
|
110
|
-
protected get tableName(): string;
|
|
111
|
-
/**
|
|
112
|
-
* @description Primary key properties for this repository's model.
|
|
113
|
-
* @summary Gets the sequence options containing primary key information.
|
|
114
|
-
* @return {SequenceOptions} The primary key properties.
|
|
115
|
-
* @deprecated for Model.sequenceFor(class)
|
|
116
|
-
*/
|
|
117
|
-
protected get pkProps(): SequenceOptions;
|
|
118
|
-
get filters(): Record<"onlyOnCreate" | "onlyOnUpdate" | "onlyOnDelete" | "onlyOnTransactional" | "onlyOnSingle" | "onlyOnBulk", ObserverFilter>;
|
|
119
|
-
constructor(adapter?: A, clazz?: Constructor<M>, force?: boolean, ...args: any[]);
|
|
120
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
|
|
121
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
|
|
122
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
|
|
123
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<ContextOf<A>>>): Promise<ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>>;
|
|
124
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<A>, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<ContextOf<A>>>): ContextualizedArgs<ContextOf<A>, ARGS, METHOD extends string ? true : false>;
|
|
125
|
-
/**
|
|
126
|
-
* @description Creates a proxy with overridden repository flags.
|
|
127
|
-
* @summary Returns a proxy of this repository with the specified flags overridden.
|
|
128
|
-
* @param {Partial<F>} flags - The flags to override.
|
|
129
|
-
* @return {Repository} A proxy of this repository with overridden flags.
|
|
130
|
-
*/
|
|
131
|
-
override(flags: Partial<FlagsOf<ContextOf<A>>>): this;
|
|
132
|
-
/**
|
|
133
|
-
* @description Creates a new instance of the Repository class with a specific adapter and arguments.
|
|
134
|
-
*
|
|
135
|
-
* @template A - The type of the adapter.
|
|
136
|
-
* @template Q - The type of the query builder.
|
|
137
|
-
* @template F - The type of the filter.
|
|
138
|
-
* @template C - The type of the context.
|
|
139
|
-
*
|
|
140
|
-
* @param {Partial<InferredAdapterConfig<A>>} conf - adapter configurations to override.
|
|
141
|
-
* @param [args] - Additional arguments to be passed to the new instance.
|
|
142
|
-
*
|
|
143
|
-
* @return A new instance of the Repository class with the specified adapter and arguments.
|
|
144
|
-
*/
|
|
145
|
-
for(conf: Partial<InferredAdapterConfig<A>>, ...args: any[]): this;
|
|
146
|
-
/**
|
|
147
|
-
* @description Creates a new observer handler.
|
|
148
|
-
* @summary Factory method for creating an observer handler instance.
|
|
149
|
-
* @return {ObserverHandler} A new observer handler instance.
|
|
150
|
-
*/
|
|
151
|
-
protected ObserverHandler(): ObserverHandler;
|
|
152
|
-
/**
|
|
153
|
-
* @description Prepares a model for creation.
|
|
154
|
-
* @summary Validates the model and prepares it for creation in the database.
|
|
155
|
-
* @template M - The model type.
|
|
156
|
-
* @param {M} model - The model to create.
|
|
157
|
-
* @param {...any[]} args - Additional arguments.
|
|
158
|
-
* @return The prepared model and context arguments.
|
|
159
|
-
* @throws {ValidationError} If the model fails validation.
|
|
160
|
-
*/
|
|
161
|
-
protected createPrefix(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<[M, ...any[], ContextOf<A>]>;
|
|
162
|
-
/**
|
|
163
|
-
* @description Creates a model in the database.
|
|
164
|
-
* @summary Persists a model instance to the database.
|
|
165
|
-
* @param {M} model - The model to create.
|
|
166
|
-
* @param {...any[]} args - Additional arguments.
|
|
167
|
-
* @return {Promise<M>} The created model with updated properties.
|
|
168
|
-
*/
|
|
169
|
-
create(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
|
|
170
|
-
/**
|
|
171
|
-
* @description Creates multiple models in the database.
|
|
172
|
-
* @summary Persists multiple model instances to the database in a batch operation.
|
|
173
|
-
* @param {M[]} models - The models to create.
|
|
174
|
-
* @param {...any[]} args - Additional arguments.
|
|
175
|
-
* @return {Promise<M[]>} The created models with updated properties.
|
|
176
|
-
*/
|
|
177
|
-
createAll(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
|
|
178
|
-
/**
|
|
179
|
-
* @description Prepares multiple models for creation.
|
|
180
|
-
* @summary Validates multiple models and prepares them for creation in the database.
|
|
181
|
-
* @param {M[]} models - The models to create.
|
|
182
|
-
* @param {...any[]} args - Additional arguments.
|
|
183
|
-
* @return The prepared models and context arguments.
|
|
184
|
-
* @throws {ValidationError} If any model fails validation.
|
|
185
|
-
*/
|
|
186
|
-
protected createAllPrefix(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<[M[], ...any[], ContextOf<A>]>;
|
|
187
|
-
/**
|
|
188
|
-
* @description Prepares for reading a model by ID.
|
|
189
|
-
* @summary Prepares the context and enforces decorators before reading a model.
|
|
190
|
-
* @param {string} key - The primary key of the model to read.
|
|
191
|
-
* @param {...any[]} args - Additional arguments.
|
|
192
|
-
* @return The key and context arguments.
|
|
193
|
-
*/
|
|
194
|
-
protected readPrefix(key: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<A>>): Promise<[PrimaryKeyType, ...any[], ContextOf<A>]>;
|
|
195
|
-
/**
|
|
196
|
-
* @description Reads a model from the database by ID.
|
|
197
|
-
* @summary Retrieves a model instance from the database using its primary key.
|
|
198
|
-
* @param {PrimaryKeyType} id - The primary key of the model to read.
|
|
199
|
-
* @param {...any[]} args - Additional arguments.
|
|
200
|
-
* @return {Promise<M>} The retrieved model instance.
|
|
201
|
-
*/
|
|
202
|
-
read(id: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
|
|
203
|
-
/**
|
|
204
|
-
* @description Prepares for reading multiple models by IDs.
|
|
205
|
-
* @summary Prepares the context and enforces decorators before reading multiple models.
|
|
206
|
-
* @param {string[]|number[]} keys - The primary keys of the models to read.
|
|
207
|
-
* @param {...any[]} args - Additional arguments.
|
|
208
|
-
* @return The keys and context arguments.
|
|
209
|
-
*/
|
|
210
|
-
protected readAllPrefix(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<[PrimaryKeyType[], ...any[], ContextOf<A>]>;
|
|
211
|
-
/**
|
|
212
|
-
* @description Reads multiple models from the database by IDs.
|
|
213
|
-
* @summary Retrieves multiple model instances from the database using their primary keys.
|
|
214
|
-
* @param {string[]|number[]} keys - The primary keys of the models to read.
|
|
215
|
-
* @param {...any[]} args - Additional arguments.
|
|
216
|
-
* @return {Promise<M[]>} The retrieved model instances.
|
|
217
|
-
*/
|
|
218
|
-
readAll(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
|
|
219
|
-
/**
|
|
220
|
-
* @description Updates a model in the database.
|
|
221
|
-
* @summary Persists changes to an existing model instance in the database.
|
|
222
|
-
* @param {M} model - The model to update.
|
|
223
|
-
* @param {...any[]} args - Additional arguments.
|
|
224
|
-
* @return {Promise<M>} The updated model with refreshed properties.
|
|
225
|
-
*/
|
|
226
|
-
update(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
|
|
227
|
-
/**
|
|
228
|
-
* @description Prepares a model for update.
|
|
229
|
-
* @summary Validates the model and prepares it for update in the database.
|
|
230
|
-
* @param {M} model - The model to update.
|
|
231
|
-
* @param {...any[]} args - Additional arguments.
|
|
232
|
-
* @return The prepared model and context arguments.
|
|
233
|
-
* @throws {InternalError} If the model has no primary key value.
|
|
234
|
-
* @throws {ValidationError} If the model fails validation.
|
|
235
|
-
*/
|
|
236
|
-
protected updatePrefix(model: M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<[M, ...args: any[], ContextOf<A>, M | undefined]>;
|
|
237
|
-
/**
|
|
238
|
-
* @description Updates multiple models in the database.
|
|
239
|
-
* @summary Persists changes to multiple existing model instances in the database in a batch operation.
|
|
240
|
-
* @param {M[]} models - The models to update.
|
|
241
|
-
* @param {...any[]} args - Additional arguments.
|
|
242
|
-
* @return {Promise<M[]>} The updated models with refreshed properties.
|
|
243
|
-
*/
|
|
244
|
-
updateAll(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
|
|
245
|
-
/**
|
|
246
|
-
* @description Prepares multiple models for update.
|
|
247
|
-
* @summary Validates multiple models and prepares them for update in the database.
|
|
248
|
-
* @param {M[]} models - The models to update.
|
|
249
|
-
* @param {...any[]} args - Additional arguments.
|
|
250
|
-
* @return {Promise<any[]>} The prepared models and context arguments.
|
|
251
|
-
* @throws {InternalError} If any model has no primary key value.
|
|
252
|
-
* @throws {ValidationError} If any model fails validation.
|
|
253
|
-
*/
|
|
254
|
-
protected updateAllPrefix(models: M[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<[M[], ...args: any[], ContextOf<A>, M[] | undefined]>;
|
|
255
|
-
/**
|
|
256
|
-
* @description Prepares for deleting a model by ID.
|
|
257
|
-
* @summary Prepares the context and enforces decorators before deleting a model.
|
|
258
|
-
* @param {any} key - The primary key of the model to delete.
|
|
259
|
-
* @param {...any[]} args - Additional arguments.
|
|
260
|
-
* @return The key and context arguments.
|
|
261
|
-
*/
|
|
262
|
-
protected deletePrefix(key: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<A>>): Promise<[PrimaryKeyType, ...any[], ContextOf<A>]>;
|
|
263
|
-
/**
|
|
264
|
-
* @description Deletes a model from the database by ID.
|
|
265
|
-
* @summary Removes a model instance from the database using its primary key.
|
|
266
|
-
* @param {string|number|bigint} id - The primary key of the model to delete.
|
|
267
|
-
* @param {...any[]} args - Additional arguments.
|
|
268
|
-
* @return {Promise<M>} The deleted model instance.
|
|
269
|
-
*/
|
|
270
|
-
delete(id: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
|
|
271
|
-
/**
|
|
272
|
-
* @description Prepares for deleting multiple models by IDs.
|
|
273
|
-
* @summary Prepares the context and enforces decorators before deleting multiple models.
|
|
274
|
-
* @param {string[]|number[]} keys - The primary keys of the models to delete.
|
|
275
|
-
* @param {...any[]} args - Additional arguments.
|
|
276
|
-
* @return The keys and context arguments.
|
|
277
|
-
*/
|
|
278
|
-
protected deleteAllPrefix(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<[PrimaryKeyType[], ...any[], ContextOf<A>]>;
|
|
279
|
-
/**
|
|
280
|
-
* @description Deletes multiple models from the database by IDs.
|
|
281
|
-
* @summary Removes multiple model instances from the database using their primary keys.
|
|
282
|
-
* @param {string[]|number[]} keys - The primary keys of the models to delete.
|
|
283
|
-
* @param {...any[]} args - Additional arguments.
|
|
284
|
-
* @return {Promise<M[]>} The deleted model instances.
|
|
285
|
-
*/
|
|
286
|
-
deleteAll(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
|
|
287
|
-
/**
|
|
288
|
-
* @description Creates a select query without specifying fields.
|
|
289
|
-
* @summary Starts building a query that will return all fields of the model.
|
|
290
|
-
* @template S - The array type of select selectors.
|
|
291
|
-
* @return A query builder for the model.
|
|
292
|
-
*/
|
|
293
|
-
select<S extends readonly SelectSelector<M>[]>(): WhereOption<M, M[]>;
|
|
294
|
-
/**
|
|
295
|
-
* @description Creates a select query with specific fields.
|
|
296
|
-
* @summary Starts building a query that will return only the specified fields of the model.
|
|
297
|
-
* @template S - The array type of select selectors.
|
|
298
|
-
* @param selector - The fields to select.
|
|
299
|
-
* @return A query builder for the selected fields.
|
|
300
|
-
*/
|
|
301
|
-
select<S extends readonly SelectSelector<M>[]>(selector: readonly [...S]): WhereOption<M, Pick<M, S[number]>[]>;
|
|
302
|
-
/**
|
|
303
|
-
* @description Creates a count query
|
|
304
|
-
* @summary Starts building a query that will count records
|
|
305
|
-
* @template S - The select selector type
|
|
306
|
-
* @param {S} [selector] - Optional field to count (counts all if not specified)
|
|
307
|
-
* @return A count query builder with distinct() available
|
|
308
|
-
*/
|
|
309
|
-
count<S extends SelectSelector<M>>(selector?: S): CountWhereOption<M>;
|
|
310
|
-
/**
|
|
311
|
-
* @description Creates a min query
|
|
312
|
-
* @summary Starts building a query that will find the minimum value
|
|
313
|
-
* @template S - The select selector type
|
|
314
|
-
* @param {S} selector - Field to find minimum value of
|
|
315
|
-
* @return A min query builder
|
|
316
|
-
*/
|
|
317
|
-
min<S extends SelectSelector<M>>(selector: S): WhereOption<M, M[S]>;
|
|
318
|
-
/**
|
|
319
|
-
* @description Creates a max query
|
|
320
|
-
* @summary Starts building a query that will find the maximum value
|
|
321
|
-
* @template S - The select selector type
|
|
322
|
-
* @param {S} selector - Field to find maximum value of
|
|
323
|
-
* @return A max query builder
|
|
324
|
-
*/
|
|
325
|
-
max<S extends SelectSelector<M>>(selector: S): WhereOption<M, M[S]>;
|
|
326
|
-
/**
|
|
327
|
-
* @description Creates a sum query
|
|
328
|
-
* @summary Starts building a query that will sum values
|
|
329
|
-
* @template S - The select selector type
|
|
330
|
-
* @param {S} selector - Field to sum
|
|
331
|
-
* @return A sum query builder
|
|
332
|
-
*/
|
|
333
|
-
sum<S extends SelectSelector<M>>(selector: S): WhereOption<M, number>;
|
|
334
|
-
/**
|
|
335
|
-
* @description Creates an average query
|
|
336
|
-
* @summary Starts building a query that will compute the average value
|
|
337
|
-
* @template S - The select selector type
|
|
338
|
-
* @param {S} selector - Field to average
|
|
339
|
-
* @return An average query builder
|
|
340
|
-
*/
|
|
341
|
-
avg<S extends SelectSelector<M>>(selector: S): WhereOption<M, number>;
|
|
342
|
-
/**
|
|
343
|
-
* @description Creates a distinct query
|
|
344
|
-
* @summary Starts building a query that will find distinct values
|
|
345
|
-
* @template S - The select selector type
|
|
346
|
-
* @param {S} selector - Field to find distinct values of
|
|
347
|
-
* @return A distinct query builder
|
|
348
|
-
*/
|
|
349
|
-
distinct<S extends SelectSelector<M>>(selector: S): WhereOption<M, M[S][]>;
|
|
350
|
-
/**
|
|
351
|
-
* @description Executes a query with the specified conditions and options.
|
|
352
|
-
* @summary Provides a simplified way to query the database with common query parameters.
|
|
353
|
-
* @param {Condition<M>} condition - The condition to filter records.
|
|
354
|
-
* @param orderBy - The field to order results by.
|
|
355
|
-
* @param {OrderDirection} [order=OrderDirection.ASC] - The sort direction.
|
|
356
|
-
* @param {number} [limit] - Optional maximum number of results to return.
|
|
357
|
-
* @param {number} [skip] - Optional number of results to skip.
|
|
358
|
-
* @return {Promise<M[]>} The query results as model instances.
|
|
359
|
-
*/
|
|
360
|
-
query(condition: Condition<M>, orderBy: keyof M, order?: OrderDirection, limit?: number, skip?: number, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
|
|
361
|
-
listBy(key: keyof M, order: OrderDirection, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
|
|
362
|
-
paginateBy(key: keyof M, order: OrderDirection, ref?: Omit<DirectionLimitOffset, "direction">, ...args: MaybeContextualArg<ContextOf<A>>): Promise<SerializedPage<M>>;
|
|
363
|
-
find(value: string, order?: OrderDirection, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
|
|
364
|
-
page(value: string, direction?: OrderDirection, ref?: Omit<DirectionLimitOffset, "direction">, ...args: MaybeContextualArg<ContextOf<A>>): Promise<SerializedPage<M>>;
|
|
365
|
-
findOneBy(key: keyof M, value: any, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M>;
|
|
366
|
-
findBy(key: keyof M, value: any, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[]>;
|
|
367
|
-
findByPaginate(key: keyof M, value: any, ref?: DirectionLimitOffset, ...args: MaybeContextualArg<ContextOf<A>>): Promise<SerializedPage<M>>;
|
|
368
|
-
/**
|
|
369
|
-
* @description Counts records, optionally filtered by a key value
|
|
370
|
-
* @summary Returns the count of records matching the optional key condition
|
|
371
|
-
* @param {string} key - The field to count (optional, counts all if not specified)
|
|
372
|
-
* @param {...any[]} args - Additional arguments including context
|
|
373
|
-
* @return {Promise<number>} The count of matching records
|
|
374
|
-
*/
|
|
375
|
-
countOf(key?: keyof M, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
|
|
376
|
-
/**
|
|
377
|
-
* @description Finds the maximum value of a field
|
|
378
|
-
* @summary Returns the maximum value for the specified field across all records
|
|
379
|
-
* @param {string} key - The field to find the maximum value of
|
|
380
|
-
* @param {...any[]} args - Additional arguments including context
|
|
381
|
-
* @return {Promise<any>} The maximum value
|
|
382
|
-
*/
|
|
383
|
-
maxOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[K]>;
|
|
384
|
-
/**
|
|
385
|
-
* @description Finds the minimum value of a field
|
|
386
|
-
* @summary Returns the minimum value for the specified field across all records
|
|
387
|
-
* @param {string} key - The field to find the minimum value of
|
|
388
|
-
* @param {...any[]} args - Additional arguments including context
|
|
389
|
-
* @return {Promise<any>} The minimum value
|
|
390
|
-
*/
|
|
391
|
-
minOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[K]>;
|
|
392
|
-
/**
|
|
393
|
-
* @description Calculates the average value of a field
|
|
394
|
-
* @summary Returns the average value for the specified numeric field across all records
|
|
395
|
-
* @param {string} key - The field to calculate the average of
|
|
396
|
-
* @param {...any[]} args - Additional arguments including context
|
|
397
|
-
* @return {Promise<number>} The average value
|
|
398
|
-
*/
|
|
399
|
-
avgOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
|
|
400
|
-
/**
|
|
401
|
-
* @description Calculates the sum of a field
|
|
402
|
-
* @summary Returns the sum of values for the specified numeric field across all records
|
|
403
|
-
* @param {string} key - The field to sum
|
|
404
|
-
* @param {...any[]} args - Additional arguments including context
|
|
405
|
-
* @return {Promise<number>} The sum
|
|
406
|
-
*/
|
|
407
|
-
sumOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<number>;
|
|
408
|
-
/**
|
|
409
|
-
* @description Finds distinct values of a field
|
|
410
|
-
* @summary Returns an array of unique values for the specified field
|
|
411
|
-
* @param {string} key - The field to get distinct values of
|
|
412
|
-
* @param {...any[]} args - Additional arguments including context
|
|
413
|
-
* @return {Promise<any[]>} An array of distinct values
|
|
414
|
-
*/
|
|
415
|
-
distinctOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<M[K][]>;
|
|
416
|
-
/**
|
|
417
|
-
* @description Groups records by a field
|
|
418
|
-
* @summary Returns records grouped by the specified field
|
|
419
|
-
* @param {string} key - The field to group by
|
|
420
|
-
* @param {...any[]} args - Additional arguments including context
|
|
421
|
-
* @return {Promise<Record<string, M[]>>} Records grouped by the field value
|
|
422
|
-
*/
|
|
423
|
-
groupOf<K extends keyof M>(key: K, ...args: MaybeContextualArg<ContextOf<A>>): Promise<Record<string, M[]>>;
|
|
424
|
-
statement(name: string, ...args: MaybeContextualArg<ContextOf<A>>): Promise<any>;
|
|
425
|
-
private getDefaultQueryAttributes;
|
|
426
|
-
private buildDefaultStartsWithCondition;
|
|
427
|
-
attr(prop: keyof M): import("../query/options").AttributeOption<M>;
|
|
428
|
-
/**
|
|
429
|
-
* @description Registers an observer for this repository.
|
|
430
|
-
* @summary Adds an observer that will be notified of changes to models in this repository.
|
|
431
|
-
* @param {Observer} observer - The observer to register.
|
|
432
|
-
* @param {ObserverFilter} [filter] - Optional filter to limit which events the observer receives.
|
|
433
|
-
* @return {void}
|
|
434
|
-
* @see {Observable#observe}
|
|
435
|
-
*/
|
|
436
|
-
observe(observer: Observer, filter?: ObserverFilter): () => void;
|
|
437
|
-
/**
|
|
438
|
-
* @description Unregisters an observer from this repository.
|
|
439
|
-
* @summary Removes an observer so it will no longer receive notifications of changes.
|
|
440
|
-
* @param {Observer} observer - The observer to unregister.
|
|
441
|
-
* @return {void}
|
|
442
|
-
* @throws {InternalError} If the observer handler is not initialized.
|
|
443
|
-
* @see {Observable#unObserve}
|
|
444
|
-
*/
|
|
445
|
-
unObserve(observer: Observer): void;
|
|
446
|
-
/**
|
|
447
|
-
* @description Notifies all observers of an event.
|
|
448
|
-
* @summary Updates all registered observers with information about a database event.
|
|
449
|
-
* @param {string} table - The table name where the event occurred.
|
|
450
|
-
* @param {OperationKeys|BulkCrudOperationKeys|string} event - The type of event that occurred.
|
|
451
|
-
* @param {EventIds} id - The ID or IDs of the affected records.
|
|
452
|
-
* @param {...any[]} args - Additional arguments.
|
|
453
|
-
* @return {Promise<void>} A promise that resolves when all observers have been notified.
|
|
454
|
-
* @throws {InternalError} If the observer handler is not initialized.
|
|
455
|
-
*/
|
|
456
|
-
updateObservers(table: Constructor<M> | string, event: AllOperationKeys, id: EventIds, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
|
|
457
|
-
/**
|
|
458
|
-
* @description Alias for updateObservers.
|
|
459
|
-
* @summary Notifies all observers of an event (alias for updateObservers).
|
|
460
|
-
* @param {string} table - The table name where the event occurred.
|
|
461
|
-
* @param {OperationKeys|BulkCrudOperationKeys|string} event - The type of event that occurred.
|
|
462
|
-
* @param {EventIds} id - The ID or IDs of the affected records.
|
|
463
|
-
* @param {...any[]} args - Additional arguments.
|
|
464
|
-
* @return {Promise<void>} A promise that resolves when all observers have been notified.
|
|
465
|
-
*/
|
|
466
|
-
refresh(table: Constructor<M> | string, event: AllOperationKeys, id: EventIds, ...args: ContextualArgs<ContextOf<A>>): Promise<void>;
|
|
467
|
-
/**
|
|
468
|
-
* @description Creates or retrieves a repository for a model.
|
|
469
|
-
* @summary Factory method that returns a repository instance for the specified model.
|
|
470
|
-
* @template M - The model type that extends Model.
|
|
471
|
-
* @template R - The repository type that extends Repo<M>.
|
|
472
|
-
* @param {Constructor<M>} model - The model constructor.
|
|
473
|
-
* @param {string} [alias] - Optional default adapter flavour if not specified on the model.
|
|
474
|
-
* @param {...any[]} [args] - Additional arguments to pass to the repository constructor.
|
|
475
|
-
* @return {R} A repository instance for the model.
|
|
476
|
-
* @throws {InternalError} If no adapter is registered for the flavour.
|
|
477
|
-
*/
|
|
478
|
-
static forModel<M extends Model, R extends Repo<M>>(model: Constructor<M>, alias?: string, ...args: any[]): R;
|
|
479
|
-
/**
|
|
480
|
-
* @description Retrieves a repository for a model from the cache.
|
|
481
|
-
* @summary Gets a repository constructor or instance for the specified model from the internal cache.
|
|
482
|
-
* @template M - The model type that extends Model.
|
|
483
|
-
* @param {Constructor<M>} model - The model constructor.
|
|
484
|
-
* @param {string} [alias] - The adapter alias.
|
|
485
|
-
* @return {Constructor<Repo<M>> | Repo<M>} The repository constructor or instance.
|
|
486
|
-
* @throws {InternalError} If no repository is registered for the model.
|
|
487
|
-
*/
|
|
488
|
-
private static get;
|
|
489
|
-
/**
|
|
490
|
-
* @description Registers a repository for a model.
|
|
491
|
-
* @summary Associates a repository constructor or instance with a model in the internal cache.
|
|
492
|
-
* @template M - The model type that extends Model.
|
|
493
|
-
* @param {Constructor<M>} model - The model constructor.
|
|
494
|
-
* @param {Constructor<Repo<M>> | Repo<M>} repo - The repository constructor or instance.
|
|
495
|
-
* @param {string} [alias] the adapter alias/flavour.
|
|
496
|
-
* @throws {InternalError} If a repository is already registered for the model.
|
|
497
|
-
*/
|
|
498
|
-
static register<M extends Model>(model: Constructor<M>, repo: Constructor<Repo<M>> | Repo<M>, alias?: string, force?: boolean): void;
|
|
499
|
-
static statements<R extends Repository<any, any>, K extends keyof R>(repo: Constructor<R> | R, method?: K): undefined | (K extends keyof R ? boolean : (keyof R)[]);
|
|
500
|
-
static queries<R extends Repository<any, any>, K extends keyof R>(repo: Constructor<R> | R, method?: K): undefined | (K extends keyof R ? QueryOptions : Record<keyof R, QueryOptions>);
|
|
501
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { type Constructor } from "@decaf-ts/decoration";
|
|
2
|
-
import { Model, type ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
3
|
-
import { type Repo } from "../repository/Repository";
|
|
4
|
-
import { Service } from "./services";
|
|
5
|
-
import type { AllOperationKeys, ContextOf, EventIds, ObserverFilter, PersistenceObservable, PersistenceObserver } from "../persistence/types";
|
|
6
|
-
import { type IRepository, type PrimaryKeyType } from "@decaf-ts/db-decorators";
|
|
7
|
-
import type { ContextualArgs, ContextualizedArgs, MaybeContextualArg, MethodOrOperation } from "../utils/ContextualLoggedClass";
|
|
8
|
-
import { OrderDirection } from "../repository/constants";
|
|
9
|
-
import { type DirectionLimitOffset } from "../query/types";
|
|
10
|
-
import { type Observer } from "../interfaces";
|
|
11
|
-
import { SelectSelector, WhereOption } from "../query/index";
|
|
12
|
-
export type ArrayMode = "one" | "many";
|
|
13
|
-
export declare class ModelService<M extends Model<boolean>, R extends Repo<M> = Repo<M>> extends Service implements IRepository<M, ContextOf<R>>, PersistenceObservable<ContextOf<R>>, PersistenceObserver<ContextOf<R>> {
|
|
14
|
-
private readonly clazz;
|
|
15
|
-
protected _repository: R;
|
|
16
|
-
get class(): Constructor<M>;
|
|
17
|
-
get repo(): R;
|
|
18
|
-
constructor(clazz: Constructor<M>, name?: string);
|
|
19
|
-
static getService<M extends Model<boolean>, S extends ModelService<M>>(name: string | symbol | Constructor<M>): S;
|
|
20
|
-
create(model: M, ...args: MaybeContextualArg<ContextOf<R>>): Promise<M>;
|
|
21
|
-
createAll(models: M[], ...args: MaybeContextualArg<ContextOf<R>>): Promise<M[]>;
|
|
22
|
-
delete(key: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<R>>): Promise<M>;
|
|
23
|
-
deleteAll(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<R>>): Promise<M[]>;
|
|
24
|
-
read(key: PrimaryKeyType, ...args: MaybeContextualArg<ContextOf<R>>): Promise<M>;
|
|
25
|
-
readAll(keys: PrimaryKeyType[], ...args: MaybeContextualArg<ContextOf<R>>): Promise<M[]>;
|
|
26
|
-
query<M, R extends ArrayMode = "one">(methodName: string, ...args: unknown[]): Promise<R extends "one" ? M : M[]>;
|
|
27
|
-
update(model: M, ...args: MaybeContextualArg<ContextOf<R>>): Promise<M>;
|
|
28
|
-
updateAll(models: M[], ...args: any[]): Promise<M[]>;
|
|
29
|
-
select<S extends readonly SelectSelector<M>[]>(): WhereOption<M, M[]>;
|
|
30
|
-
select<S extends readonly SelectSelector<M>[]>(selector: readonly [...S]): WhereOption<M, Pick<M, S[number]>[]>;
|
|
31
|
-
listBy(key: keyof M, order: OrderDirection, ...args: MaybeContextualArg<ContextOf<R>>): Promise<M[]>;
|
|
32
|
-
paginateBy(key: keyof M, order: OrderDirection, ref: Omit<DirectionLimitOffset, "direction">, ...args: MaybeContextualArg<ContextOf<R>>): Promise<import("../query/Paginator").SerializedPage<M>>;
|
|
33
|
-
findOneBy(key: keyof M, value: any, ...args: MaybeContextualArg<ContextOf<R>>): Promise<M>;
|
|
34
|
-
findBy(key: keyof M, value: any, ...args: MaybeContextualArg<ContextOf<R>>): Promise<M[]>;
|
|
35
|
-
findByPaginate(key: keyof M, value: any, ref: DirectionLimitOffset, ...args: MaybeContextualArg<ContextOf<R>>): Promise<import("../query/Paginator").SerializedPage<M>>;
|
|
36
|
-
statement(name: string, ...args: MaybeContextualArg<ContextOf<R>>): Promise<any>;
|
|
37
|
-
static forModel<M extends Model<boolean>, S extends ModelService<M>>(this: new (model: ModelConstructor<M>) => S, model: ModelConstructor<M>, alias?: string | symbol): S;
|
|
38
|
-
refresh(table: Constructor<M>, event: AllOperationKeys, id: EventIds, ...args: ContextualArgs<ContextOf<R>>): Promise<void>;
|
|
39
|
-
observe(observer: Observer, filter?: ObserverFilter): () => void;
|
|
40
|
-
unObserve(observer: Observer): void;
|
|
41
|
-
updateObservers(model: Constructor, operation: AllOperationKeys, ids: EventIds, ...args: ContextualArgs<ContextOf<R>>): Promise<void>;
|
|
42
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<this["repo"]>, ARGS>, operation: METHOD): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
|
|
43
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<this["repo"]>, ARGS>, operation: METHOD, allowCreate: false): ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>;
|
|
44
|
-
protected logCtx<ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<ContextOf<this["repo"]>, ARGS>, operation: METHOD, allowCreate: true): Promise<ContextualizedArgs<ContextOf<this["repo"]>, ARGS, METHOD extends string ? true : false>>;
|
|
45
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { promises as defaultFs } from "node:fs";
|
|
2
|
-
import { Constructor } from "@decaf-ts/decoration";
|
|
3
|
-
import { Model } from "@decaf-ts/decorator-validation";
|
|
4
|
-
import { PrimaryKeyType } from "@decaf-ts/db-decorators";
|
|
5
|
-
import { Dispatch } from "../persistence/Dispatch";
|
|
6
|
-
import { ContextualArgs, MaybeContextualArg } from "../utils/ContextualLoggedClass";
|
|
7
|
-
import { RamAdapter } from "../ram";
|
|
8
|
-
import type { RamContext, RawRamQuery } from "../ram/types";
|
|
9
|
-
import type { FilesystemConfig } from "./types";
|
|
10
|
-
export declare class FilesystemAdapter extends RamAdapter {
|
|
11
|
-
private readonly rootDir;
|
|
12
|
-
private readonly dbPath;
|
|
13
|
-
private readonly fs;
|
|
14
|
-
private readonly jsonSpacing?;
|
|
15
|
-
private readonly onHydrated?;
|
|
16
|
-
private readonly indexStore;
|
|
17
|
-
private readonly pkColumnCache;
|
|
18
|
-
private readonly indexDescriptorCache;
|
|
19
|
-
private readonly tableWatchers;
|
|
20
|
-
private rootWatcher?;
|
|
21
|
-
private watching;
|
|
22
|
-
private ready;
|
|
23
|
-
private readonly watchDebounceMs;
|
|
24
|
-
private readonly watchEnabled;
|
|
25
|
-
private readonly pendingObserverRefresh;
|
|
26
|
-
constructor(conf?: FilesystemConfig, alias?: string);
|
|
27
|
-
initialize(...args: MaybeContextualArg<any>): Promise<void>;
|
|
28
|
-
getFs(): typeof defaultFs;
|
|
29
|
-
getStoragePath(): string;
|
|
30
|
-
getTablePath(tableName: string): string;
|
|
31
|
-
getIndexesPath(tableName: string): string;
|
|
32
|
-
protected Dispatch(): Dispatch<FilesystemAdapter>;
|
|
33
|
-
private initializeFromDisk;
|
|
34
|
-
ensureWatching(): Promise<void>;
|
|
35
|
-
stopWatching(): void;
|
|
36
|
-
private ensureReady;
|
|
37
|
-
private startRootWatcher;
|
|
38
|
-
private handleRootEvent;
|
|
39
|
-
private normalizeFilename;
|
|
40
|
-
private scheduleObserverRefresh;
|
|
41
|
-
private flushObserverRefresh;
|
|
42
|
-
private clearPendingObserverRefresh;
|
|
43
|
-
private watchTable;
|
|
44
|
-
private unwatchTable;
|
|
45
|
-
private handleTableEvent;
|
|
46
|
-
private removeRecordFromMap;
|
|
47
|
-
private applyRecord;
|
|
48
|
-
private hydrateTable;
|
|
49
|
-
private directoryExists;
|
|
50
|
-
private tablePath;
|
|
51
|
-
private recordPath;
|
|
52
|
-
private indexesPath;
|
|
53
|
-
private writeRecord;
|
|
54
|
-
private removeRecord;
|
|
55
|
-
private syncIndexesForWrite;
|
|
56
|
-
private removeIndexesForRecord;
|
|
57
|
-
private getIndexDescriptors;
|
|
58
|
-
private collectIndexMetadata;
|
|
59
|
-
private asIndexMetadata;
|
|
60
|
-
private buildColumns;
|
|
61
|
-
private columnNameOrFallback;
|
|
62
|
-
private getPkColumn;
|
|
63
|
-
private buildIndexSource;
|
|
64
|
-
create<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, model: Record<string, any>, ...args: ContextualArgs<RamContext>): Promise<Record<string, any>>;
|
|
65
|
-
read<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, ...args: ContextualArgs<RamContext>): Promise<Record<string, any>>;
|
|
66
|
-
update<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, model: Record<string, any>, ...args: ContextualArgs<RamContext>): Promise<Record<string, any>>;
|
|
67
|
-
delete<M extends Model>(clazz: Constructor<M>, id: PrimaryKeyType, ...args: ContextualArgs<RamContext>): Promise<Record<string, any>>;
|
|
68
|
-
raw<R, D extends boolean>(rawInput: RawRamQuery<any>, docsOnly?: D, ...args: ContextualArgs<RamContext>): Promise<import("..").RawResult<R, D>>;
|
|
69
|
-
static decoration(): void;
|
|
70
|
-
}
|