@decaf-ts/core 0.7.59 → 0.7.61
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/esm/identity/decorators.js +3 -3
- package/lib/esm/identity/decorators.js.map +1 -1
- package/lib/esm/index.d.ts +2 -2
- package/lib/esm/index.js +6 -3
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/migrations/Migration.d.ts +19 -0
- package/lib/esm/migrations/Migration.js +73 -0
- package/lib/esm/migrations/Migration.js.map +1 -0
- package/lib/esm/migrations/MigrationService.d.ts +25 -0
- package/lib/esm/migrations/MigrationService.js +206 -0
- package/lib/esm/migrations/MigrationService.js.map +1 -0
- package/lib/esm/migrations/constants.d.ts +2 -0
- package/lib/esm/migrations/constants.js +5 -0
- package/lib/esm/migrations/constants.js.map +1 -0
- package/lib/esm/migrations/decorators.d.ts +7 -0
- package/lib/esm/migrations/decorators.js +49 -0
- package/lib/esm/migrations/decorators.js.map +1 -0
- package/lib/esm/migrations/index.d.ts +5 -0
- package/lib/esm/migrations/index.js +6 -0
- package/lib/esm/migrations/index.js.map +1 -0
- package/lib/esm/migrations/types.d.ts +23 -0
- package/lib/esm/migrations/types.js +2 -0
- package/lib/esm/migrations/types.js.map +1 -0
- package/lib/esm/model/SequenceModel.js +1 -1
- package/lib/esm/model/SequenceModel.js.map +1 -1
- package/lib/esm/model/construction.js +4 -3
- package/lib/esm/model/construction.js.map +1 -1
- package/lib/esm/model/decorators.d.ts +0 -1
- package/lib/esm/model/decorators.js +3 -8
- package/lib/esm/model/decorators.js.map +1 -1
- package/lib/esm/overrides/Metadata.d.ts +6 -1
- package/lib/esm/overrides/Model.d.ts +0 -1
- package/lib/esm/overrides/index.d.ts +0 -1
- package/lib/esm/overrides/index.js +0 -1
- package/lib/esm/overrides/index.js.map +1 -1
- package/lib/esm/overrides/injectables.d.ts +1 -1
- package/lib/esm/overrides/overrides.js +17 -9
- package/lib/esm/overrides/overrides.js.map +1 -1
- package/lib/esm/persistence/Adapter.d.ts +11 -18
- package/lib/esm/persistence/Adapter.js +74 -54
- package/lib/esm/persistence/Adapter.js.map +1 -1
- package/lib/esm/persistence/Context.d.ts +3 -3
- package/lib/esm/persistence/Context.js +2 -2
- package/lib/esm/persistence/Context.js.map +1 -1
- package/lib/esm/persistence/Dispatch.d.ts +7 -3
- package/lib/esm/persistence/Dispatch.js +34 -13
- package/lib/esm/persistence/Dispatch.js.map +1 -1
- package/lib/esm/persistence/ObserverHandler.js +1 -1
- package/lib/esm/persistence/ObserverHandler.js.map +1 -1
- package/lib/esm/persistence/Sequence.d.ts +9 -5
- package/lib/esm/persistence/Sequence.js +19 -15
- package/lib/esm/persistence/Sequence.js.map +1 -1
- package/lib/esm/persistence/constants.d.ts +11 -1
- package/lib/esm/persistence/constants.js +26 -3
- package/lib/esm/persistence/constants.js.map +1 -1
- package/lib/esm/persistence/decorators.d.ts +24 -0
- package/lib/esm/persistence/decorators.js +50 -0
- package/lib/esm/persistence/decorators.js.map +1 -0
- package/lib/esm/persistence/errors.d.ts +3 -3
- package/lib/esm/persistence/errors.js.map +1 -1
- package/lib/esm/persistence/event-filters.d.ts +20 -0
- package/lib/esm/persistence/event-filters.js +60 -0
- package/lib/esm/persistence/event-filters.js.map +1 -0
- package/lib/esm/persistence/index.d.ts +1 -1
- package/lib/esm/persistence/index.js +1 -1
- package/lib/esm/persistence/index.js.map +1 -1
- package/lib/esm/persistence/types.d.ts +9 -6
- package/lib/esm/query/Paginator.d.ts +4 -4
- package/lib/esm/query/Paginator.js +17 -8
- package/lib/esm/query/Paginator.js.map +1 -1
- package/lib/esm/query/Statement.d.ts +6 -4
- package/lib/esm/query/Statement.js +24 -18
- package/lib/esm/query/Statement.js.map +1 -1
- package/lib/esm/query/selectors.d.ts +4 -1
- package/lib/esm/ram/RamAdapter.d.ts +6 -5
- package/lib/esm/ram/RamAdapter.js +20 -16
- package/lib/esm/ram/RamAdapter.js.map +1 -1
- package/lib/esm/ram/RamPaginator.d.ts +1 -1
- package/lib/esm/ram/RamPaginator.js +6 -2
- package/lib/esm/ram/RamPaginator.js.map +1 -1
- package/lib/esm/ram/types.d.ts +2 -0
- package/lib/esm/repository/Repository.d.ts +10 -8
- package/lib/esm/repository/Repository.js +107 -76
- package/lib/esm/repository/Repository.js.map +1 -1
- package/lib/esm/repository/decorators.d.ts +1 -1
- package/lib/esm/repository/decorators.js +1 -1
- package/lib/esm/repository/decorators.js.map +1 -1
- package/lib/esm/repository/injectables.d.ts +2 -1
- package/lib/esm/repository/injectables.js.map +1 -1
- package/lib/esm/services/ModelService.d.ts +42 -0
- package/lib/esm/services/ModelService.js +236 -0
- package/lib/esm/services/ModelService.js.map +1 -0
- package/lib/esm/services/PersistenceService.d.ts +16 -0
- package/lib/esm/services/PersistenceService.js +34 -0
- package/lib/esm/services/PersistenceService.js.map +1 -0
- package/lib/esm/services/index.d.ts +3 -0
- package/lib/esm/services/index.js +4 -0
- package/lib/esm/services/index.js.map +1 -0
- package/lib/esm/services/services.d.ts +93 -0
- package/lib/esm/services/services.js +241 -0
- package/lib/esm/services/services.js.map +1 -0
- package/lib/esm/tasks/TaskContext.d.ts +10 -0
- package/lib/esm/tasks/TaskContext.js +22 -0
- package/lib/esm/tasks/TaskContext.js.map +1 -0
- package/lib/esm/tasks/TaskEngine.d.ts +64 -0
- package/lib/esm/tasks/TaskEngine.js +341 -0
- package/lib/esm/tasks/TaskEngine.js.map +1 -0
- package/lib/esm/tasks/TaskEventBus.d.ts +6 -0
- package/lib/esm/tasks/TaskEventBus.js +14 -0
- package/lib/esm/tasks/TaskEventBus.js.map +1 -0
- package/lib/esm/tasks/TaskEventRepository.d.ts +10 -0
- package/lib/esm/tasks/TaskEventRepository.js +35 -0
- package/lib/esm/tasks/TaskEventRepository.js.map +1 -0
- package/lib/esm/tasks/TaskHandler.d.ts +11 -0
- package/lib/esm/tasks/TaskHandler.js +28 -0
- package/lib/esm/tasks/TaskHandler.js.map +1 -0
- package/lib/esm/tasks/TaskHandlerRegistry.d.ts +8 -0
- package/lib/esm/tasks/TaskHandlerRegistry.js +32 -0
- package/lib/esm/tasks/TaskHandlerRegistry.js.map +1 -0
- package/lib/esm/tasks/TaskService.d.ts +11 -0
- package/lib/esm/tasks/TaskService.js +25 -0
- package/lib/esm/tasks/TaskService.js.map +1 -0
- package/lib/esm/tasks/constants.d.ts +26 -0
- package/lib/esm/tasks/constants.js +32 -0
- package/lib/esm/tasks/constants.js.map +1 -0
- package/lib/esm/tasks/decorators.d.ts +4 -0
- package/lib/esm/tasks/decorators.js +20 -0
- package/lib/esm/tasks/decorators.js.map +1 -0
- package/lib/esm/tasks/index.d.ts +3 -0
- package/lib/esm/tasks/index.js +4 -0
- package/lib/esm/tasks/index.js.map +1 -0
- package/lib/esm/tasks/models/TaskBackoffModel.d.ts +10 -0
- package/lib/esm/tasks/models/TaskBackoffModel.js +47 -0
- package/lib/esm/tasks/models/TaskBackoffModel.js.map +1 -0
- package/lib/esm/tasks/models/TaskBaseModel.d.ts +14 -0
- package/lib/esm/tasks/models/TaskBaseModel.js +30 -0
- package/lib/esm/tasks/models/TaskBaseModel.js.map +1 -0
- package/lib/esm/tasks/models/TaskErrorModel.d.ts +9 -0
- package/lib/esm/tasks/models/TaskErrorModel.js +43 -0
- package/lib/esm/tasks/models/TaskErrorModel.js.map +1 -0
- package/lib/esm/tasks/models/TaskEventModel.d.ts +11 -0
- package/lib/esm/tasks/models/TaskEventModel.js +60 -0
- package/lib/esm/tasks/models/TaskEventModel.js.map +1 -0
- package/lib/esm/tasks/models/TaskLogEntryModel.d.ts +9 -0
- package/lib/esm/tasks/models/TaskLogEntryModel.js +41 -0
- package/lib/esm/tasks/models/TaskLogEntryModel.js.map +1 -0
- package/lib/esm/tasks/models/TaskModel.d.ts +28 -0
- package/lib/esm/tasks/models/TaskModel.js +114 -0
- package/lib/esm/tasks/models/TaskModel.js.map +1 -0
- package/lib/esm/tasks/models/TaskStepResultModel.d.ts +10 -0
- package/lib/esm/tasks/models/TaskStepResultModel.js +40 -0
- package/lib/esm/tasks/models/TaskStepResultModel.js.map +1 -0
- package/lib/esm/tasks/models/TaskStepSpecModel.d.ts +7 -0
- package/lib/esm/tasks/models/TaskStepSpecModel.js +32 -0
- package/lib/esm/tasks/models/TaskStepSpecModel.js.map +1 -0
- package/lib/esm/tasks/models/index.d.ts +1 -0
- package/lib/esm/tasks/models/index.js +2 -0
- package/lib/esm/tasks/models/index.js.map +1 -0
- package/lib/esm/tasks/types.d.ts +22 -0
- package/lib/esm/tasks/types.js +2 -0
- package/lib/esm/tasks/types.js.map +1 -0
- package/lib/esm/tasks/utils.d.ts +5 -0
- package/lib/esm/tasks/utils.js +24 -0
- package/lib/esm/tasks/utils.js.map +1 -0
- package/lib/esm/utils/ContextualLoggedClass.d.ts +28 -7
- package/lib/esm/utils/ContextualLoggedClass.js +100 -22
- package/lib/esm/utils/ContextualLoggedClass.js.map +1 -1
- package/lib/esm/utils/decorators.d.ts +4 -4
- package/lib/esm/utils/decorators.js +1 -1
- package/lib/esm/utils/decorators.js.map +1 -1
- package/lib/esm/utils/index.d.ts +0 -1
- package/lib/esm/utils/index.js +0 -1
- package/lib/esm/utils/index.js.map +1 -1
- package/lib/esm/utils/utils.d.ts +1 -0
- package/lib/esm/utils/utils.js +24 -0
- package/lib/esm/utils/utils.js.map +1 -1
- package/lib/identity/decorators.cjs +2 -2
- package/lib/identity/decorators.js.map +1 -1
- package/lib/index.cjs +6 -3
- package/lib/index.d.ts +2 -2
- package/lib/index.js.map +1 -1
- package/lib/migrations/Migration.cjs +77 -0
- package/lib/migrations/Migration.d.ts +19 -0
- package/lib/migrations/Migration.js.map +1 -0
- package/lib/migrations/MigrationService.cjs +210 -0
- package/lib/migrations/MigrationService.d.ts +25 -0
- package/lib/migrations/MigrationService.js.map +1 -0
- package/lib/migrations/constants.cjs +8 -0
- package/lib/migrations/constants.d.ts +2 -0
- package/lib/migrations/constants.js.map +1 -0
- package/lib/migrations/decorators.cjs +52 -0
- package/lib/migrations/decorators.d.ts +7 -0
- package/lib/migrations/decorators.js.map +1 -0
- package/lib/migrations/index.cjs +22 -0
- package/lib/migrations/index.d.ts +5 -0
- package/lib/migrations/index.js.map +1 -0
- package/lib/migrations/types.cjs +3 -0
- package/lib/migrations/types.d.ts +23 -0
- package/lib/migrations/types.js.map +1 -0
- package/lib/model/SequenceModel.cjs +1 -1
- package/lib/model/SequenceModel.js.map +1 -1
- package/lib/model/construction.cjs +4 -3
- package/lib/model/construction.js.map +1 -1
- package/lib/model/decorators.cjs +2 -8
- package/lib/model/decorators.d.ts +0 -1
- package/lib/model/decorators.js.map +1 -1
- package/lib/overrides/Metadata.d.ts +6 -1
- package/lib/overrides/Model.d.ts +0 -1
- package/lib/overrides/index.cjs +0 -1
- package/lib/overrides/index.d.ts +0 -1
- package/lib/overrides/index.js.map +1 -1
- package/lib/overrides/injectables.d.ts +1 -1
- package/lib/overrides/overrides.cjs +17 -9
- package/lib/overrides/overrides.js.map +1 -1
- package/lib/persistence/Adapter.cjs +72 -52
- package/lib/persistence/Adapter.d.ts +11 -18
- package/lib/persistence/Adapter.js.map +1 -1
- package/lib/persistence/Context.cjs +2 -2
- package/lib/persistence/Context.d.ts +3 -3
- package/lib/persistence/Context.js.map +1 -1
- package/lib/persistence/Dispatch.cjs +34 -13
- package/lib/persistence/Dispatch.d.ts +7 -3
- package/lib/persistence/Dispatch.js.map +1 -1
- package/lib/persistence/ObserverHandler.cjs +1 -1
- package/lib/persistence/ObserverHandler.js.map +1 -1
- package/lib/persistence/Sequence.cjs +19 -15
- package/lib/persistence/Sequence.d.ts +9 -5
- package/lib/persistence/Sequence.js.map +1 -1
- package/lib/persistence/constants.cjs +26 -3
- package/lib/persistence/constants.d.ts +11 -1
- package/lib/persistence/constants.js.map +1 -1
- package/lib/persistence/decorators.cjs +54 -0
- package/lib/persistence/decorators.d.ts +24 -0
- package/lib/persistence/decorators.js.map +1 -0
- package/lib/persistence/errors.d.ts +3 -3
- package/lib/persistence/errors.js.map +1 -1
- package/lib/persistence/event-filters.cjs +71 -0
- package/lib/persistence/event-filters.d.ts +20 -0
- package/lib/persistence/event-filters.js.map +1 -0
- package/lib/persistence/index.cjs +1 -1
- package/lib/persistence/index.d.ts +1 -1
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/types.d.ts +9 -6
- package/lib/query/Paginator.cjs +20 -11
- package/lib/query/Paginator.d.ts +4 -4
- package/lib/query/Paginator.js.map +1 -1
- package/lib/query/Statement.cjs +48 -42
- package/lib/query/Statement.d.ts +6 -4
- package/lib/query/Statement.js.map +1 -1
- package/lib/query/selectors.d.ts +4 -1
- package/lib/ram/RamAdapter.cjs +20 -16
- package/lib/ram/RamAdapter.d.ts +6 -5
- package/lib/ram/RamAdapter.js.map +1 -1
- package/lib/ram/RamPaginator.cjs +6 -2
- package/lib/ram/RamPaginator.d.ts +1 -1
- package/lib/ram/RamPaginator.js.map +1 -1
- package/lib/ram/types.d.ts +2 -0
- package/lib/repository/Repository.cjs +106 -75
- package/lib/repository/Repository.d.ts +10 -8
- package/lib/repository/Repository.js.map +1 -1
- package/lib/repository/decorators.d.ts +1 -1
- package/lib/repository/decorators.js.map +1 -1
- package/lib/repository/injectables.d.ts +2 -1
- package/lib/repository/injectables.js.map +1 -1
- package/lib/services/ModelService.cjs +240 -0
- package/lib/services/ModelService.d.ts +42 -0
- package/lib/services/ModelService.js.map +1 -0
- package/lib/services/PersistenceService.cjs +38 -0
- package/lib/services/PersistenceService.d.ts +16 -0
- package/lib/services/PersistenceService.js.map +1 -0
- package/lib/services/index.cjs +20 -0
- package/lib/services/index.d.ts +3 -0
- package/lib/services/index.js.map +1 -0
- package/lib/services/services.cjs +246 -0
- package/lib/services/services.d.ts +93 -0
- package/lib/services/services.js.map +1 -0
- package/lib/tasks/TaskContext.cjs +26 -0
- package/lib/tasks/TaskContext.d.ts +10 -0
- package/lib/tasks/TaskContext.js.map +1 -0
- package/lib/tasks/TaskEngine.cjs +345 -0
- package/lib/tasks/TaskEngine.d.ts +64 -0
- package/lib/tasks/TaskEngine.js.map +1 -0
- package/lib/tasks/TaskEventBus.cjs +18 -0
- package/lib/tasks/TaskEventBus.d.ts +6 -0
- package/lib/tasks/TaskEventBus.js.map +1 -0
- package/lib/tasks/TaskEventRepository.cjs +38 -0
- package/lib/tasks/TaskEventRepository.d.ts +10 -0
- package/lib/tasks/TaskEventRepository.js.map +1 -0
- package/lib/tasks/TaskHandler.cjs +32 -0
- package/lib/tasks/TaskHandler.d.ts +11 -0
- package/lib/tasks/TaskHandler.js.map +1 -0
- package/lib/tasks/TaskHandlerRegistry.cjs +36 -0
- package/lib/tasks/TaskHandlerRegistry.d.ts +8 -0
- package/lib/tasks/TaskHandlerRegistry.js.map +1 -0
- package/lib/tasks/TaskService.cjs +29 -0
- package/lib/tasks/TaskService.d.ts +11 -0
- package/lib/tasks/TaskService.js.map +1 -0
- package/lib/tasks/constants.cjs +35 -0
- package/lib/tasks/constants.d.ts +26 -0
- package/lib/tasks/constants.js.map +1 -0
- package/lib/tasks/decorators.cjs +23 -0
- package/lib/tasks/decorators.d.ts +4 -0
- package/lib/tasks/decorators.js.map +1 -0
- package/lib/tasks/index.cjs +20 -0
- package/lib/tasks/index.d.ts +3 -0
- package/lib/tasks/index.js.map +1 -0
- package/lib/tasks/models/TaskBackoffModel.cjs +50 -0
- package/lib/tasks/models/TaskBackoffModel.d.ts +10 -0
- package/lib/tasks/models/TaskBackoffModel.js.map +1 -0
- package/lib/tasks/models/TaskBaseModel.cjs +34 -0
- package/lib/tasks/models/TaskBaseModel.d.ts +14 -0
- package/lib/tasks/models/TaskBaseModel.js.map +1 -0
- package/lib/tasks/models/TaskErrorModel.cjs +46 -0
- package/lib/tasks/models/TaskErrorModel.d.ts +9 -0
- package/lib/tasks/models/TaskErrorModel.js.map +1 -0
- package/lib/tasks/models/TaskEventModel.cjs +63 -0
- package/lib/tasks/models/TaskEventModel.d.ts +11 -0
- package/lib/tasks/models/TaskEventModel.js.map +1 -0
- package/lib/tasks/models/TaskLogEntryModel.cjs +44 -0
- package/lib/tasks/models/TaskLogEntryModel.d.ts +9 -0
- package/lib/tasks/models/TaskLogEntryModel.js.map +1 -0
- package/lib/tasks/models/TaskModel.cjs +117 -0
- package/lib/tasks/models/TaskModel.d.ts +28 -0
- package/lib/tasks/models/TaskModel.js.map +1 -0
- package/lib/tasks/models/TaskStepResultModel.cjs +43 -0
- package/lib/tasks/models/TaskStepResultModel.d.ts +10 -0
- package/lib/tasks/models/TaskStepResultModel.js.map +1 -0
- package/lib/tasks/models/TaskStepSpecModel.cjs +35 -0
- package/lib/tasks/models/TaskStepSpecModel.d.ts +7 -0
- package/lib/tasks/models/TaskStepSpecModel.js.map +1 -0
- package/lib/tasks/models/index.cjs +18 -0
- package/lib/tasks/models/index.d.ts +1 -0
- package/lib/tasks/models/index.js.map +1 -0
- package/lib/tasks/types.cjs +3 -0
- package/lib/tasks/types.d.ts +22 -0
- package/lib/tasks/types.js.map +1 -0
- package/lib/tasks/utils.cjs +29 -0
- package/lib/tasks/utils.d.ts +5 -0
- package/lib/tasks/utils.js.map +1 -0
- package/lib/utils/ContextualLoggedClass.cjs +100 -21
- package/lib/utils/ContextualLoggedClass.d.ts +28 -7
- package/lib/utils/ContextualLoggedClass.js.map +1 -1
- package/lib/utils/decorators.cjs +2 -2
- package/lib/utils/decorators.d.ts +4 -4
- package/lib/utils/decorators.js.map +1 -1
- package/lib/utils/index.cjs +0 -1
- package/lib/utils/index.d.ts +0 -1
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/utils.cjs +25 -0
- package/lib/utils/utils.d.ts +1 -0
- package/lib/utils/utils.js.map +1 -1
- package/package.json +12 -2
- package/lib/esm/overrides/decoration.d.ts +0 -1
- package/lib/esm/overrides/decoration.js +0 -6
- package/lib/esm/overrides/decoration.js.map +0 -1
- package/lib/esm/persistence/migrations.d.ts +0 -21
- package/lib/esm/persistence/migrations.js +0 -103
- package/lib/esm/persistence/migrations.js.map +0 -1
- package/lib/esm/utils/Services.d.ts +0 -83
- package/lib/esm/utils/Services.js +0 -392
- package/lib/esm/utils/Services.js.map +0 -1
- package/lib/overrides/decoration.cjs +0 -8
- package/lib/overrides/decoration.d.ts +0 -1
- package/lib/overrides/decoration.js.map +0 -1
- package/lib/persistence/migrations.cjs +0 -109
- package/lib/persistence/migrations.d.ts +0 -21
- package/lib/persistence/migrations.js.map +0 -1
- package/lib/utils/Services.cjs +0 -398
- package/lib/utils/Services.d.ts +0 -83
- package/lib/utils/Services.js.map +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TaskModel = void 0;
|
|
13
|
+
const TaskBaseModel_1 = require("./TaskBaseModel.cjs");
|
|
14
|
+
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
15
|
+
const decorators_1 = require("./../../identity/decorators.cjs");
|
|
16
|
+
const constants_1 = require("./../constants.cjs");
|
|
17
|
+
const TaskErrorModel_1 = require("./TaskErrorModel.cjs");
|
|
18
|
+
const TaskBackoffModel_1 = require("./TaskBackoffModel.cjs");
|
|
19
|
+
const decoration_1 = require("@decaf-ts/decoration");
|
|
20
|
+
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
21
|
+
const decorators_2 = require("./../../model/decorators.cjs");
|
|
22
|
+
let TaskModel = class TaskModel extends TaskBaseModel_1.TaskBaseModel {
|
|
23
|
+
constructor(arg) {
|
|
24
|
+
super(arg);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
exports.TaskModel = TaskModel;
|
|
28
|
+
__decorate([
|
|
29
|
+
(0, decorators_1.pk)({ type: "uuid" }),
|
|
30
|
+
__metadata("design:type", String)
|
|
31
|
+
], TaskModel.prototype, "id", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
(0, decorator_validation_1.required)(),
|
|
34
|
+
(0, decorator_validation_1.option)(constants_1.TaskType),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], TaskModel.prototype, "type", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, decoration_1.prop)(),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], TaskModel.prototype, "name", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, decorator_validation_1.required)(),
|
|
43
|
+
(0, decorator_validation_1.type)(String),
|
|
44
|
+
(0, decorator_validation_1.option)(constants_1.TaskStatus),
|
|
45
|
+
__metadata("design:type", String)
|
|
46
|
+
], TaskModel.prototype, "status", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
(0, decoration_1.prop)(),
|
|
49
|
+
(0, db_decorators_1.serialize)(),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], TaskModel.prototype, "input", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, decoration_1.prop)(),
|
|
54
|
+
(0, db_decorators_1.serialize)(),
|
|
55
|
+
__metadata("design:type", Object)
|
|
56
|
+
], TaskModel.prototype, "output", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, decoration_1.prop)(),
|
|
59
|
+
(0, db_decorators_1.serialize)(),
|
|
60
|
+
__metadata("design:type", TaskErrorModel_1.TaskErrorModel)
|
|
61
|
+
], TaskModel.prototype, "error", void 0);
|
|
62
|
+
__decorate([
|
|
63
|
+
(0, decorator_validation_1.min)(0),
|
|
64
|
+
(0, decorator_validation_1.required)(),
|
|
65
|
+
__metadata("design:type", Number)
|
|
66
|
+
], TaskModel.prototype, "attempt", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
(0, decorator_validation_1.min)(1),
|
|
69
|
+
(0, decorator_validation_1.required)(),
|
|
70
|
+
__metadata("design:type", Number)
|
|
71
|
+
], TaskModel.prototype, "maxAttempts", void 0);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, decorator_validation_1.required)(),
|
|
74
|
+
(0, db_decorators_1.serialize)(),
|
|
75
|
+
(0, decoration_1.description)("backoff configuration"),
|
|
76
|
+
__metadata("design:type", TaskBackoffModel_1.TaskBackoffModel)
|
|
77
|
+
], TaskModel.prototype, "backoff", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, decorator_validation_1.date)(),
|
|
80
|
+
(0, decoration_1.description)("Next execution timestamp"),
|
|
81
|
+
__metadata("design:type", Date)
|
|
82
|
+
], TaskModel.prototype, "nextRunAt", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, decoration_1.prop)(),
|
|
85
|
+
(0, decoration_1.description)("Task lease owner identifier"),
|
|
86
|
+
__metadata("design:type", String)
|
|
87
|
+
], TaskModel.prototype, "leaseOwner", void 0);
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, decorator_validation_1.date)(),
|
|
90
|
+
(0, decoration_1.description)("Task lease expiration timestamp"),
|
|
91
|
+
__metadata("design:type", Date)
|
|
92
|
+
], TaskModel.prototype, "leaseExpiry", void 0);
|
|
93
|
+
__decorate([
|
|
94
|
+
(0, decoration_1.prop)(),
|
|
95
|
+
(0, db_decorators_1.serialize)(),
|
|
96
|
+
__metadata("design:type", Array)
|
|
97
|
+
], TaskModel.prototype, "steps", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
(0, decorator_validation_1.min)(0),
|
|
100
|
+
__metadata("design:type", Number)
|
|
101
|
+
], TaskModel.prototype, "currentStep", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, db_decorators_1.serialize)(),
|
|
104
|
+
(0, decoration_1.prop)(),
|
|
105
|
+
__metadata("design:type", Array)
|
|
106
|
+
], TaskModel.prototype, "stepResults", void 0);
|
|
107
|
+
__decorate([
|
|
108
|
+
(0, db_decorators_1.serialize)(),
|
|
109
|
+
(0, decoration_1.prop)(),
|
|
110
|
+
__metadata("design:type", Array)
|
|
111
|
+
], TaskModel.prototype, "logTail", void 0);
|
|
112
|
+
exports.TaskModel = TaskModel = __decorate([
|
|
113
|
+
(0, decorators_2.table)("tasks"),
|
|
114
|
+
(0, decorator_validation_1.model)(),
|
|
115
|
+
__metadata("design:paramtypes", [Object])
|
|
116
|
+
], TaskModel);
|
|
117
|
+
//# sourceMappingURL=TaskModel.js.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { TaskBaseModel } from "./TaskBaseModel";
|
|
2
|
+
import { type ModelArg } from "@decaf-ts/decorator-validation";
|
|
3
|
+
import { TaskStatus, TaskType } from "../constants";
|
|
4
|
+
import { TaskErrorModel } from "./TaskErrorModel";
|
|
5
|
+
import { TaskBackoffModel } from "./TaskBackoffModel";
|
|
6
|
+
import { TaskStepSpecModel } from "./TaskStepSpecModel";
|
|
7
|
+
import { TaskStepResultModel } from "./TaskStepResultModel";
|
|
8
|
+
import { TaskLogEntryModel } from "./TaskLogEntryModel";
|
|
9
|
+
export declare class TaskModel extends TaskBaseModel {
|
|
10
|
+
id: string;
|
|
11
|
+
type: TaskType;
|
|
12
|
+
name?: string;
|
|
13
|
+
status: TaskStatus;
|
|
14
|
+
input?: any;
|
|
15
|
+
output?: any;
|
|
16
|
+
error?: TaskErrorModel;
|
|
17
|
+
attempt: number;
|
|
18
|
+
maxAttempts: number;
|
|
19
|
+
backoff: TaskBackoffModel;
|
|
20
|
+
nextRunAt?: Date;
|
|
21
|
+
leaseOwner?: string;
|
|
22
|
+
leaseExpiry?: Date;
|
|
23
|
+
steps?: TaskStepSpecModel[];
|
|
24
|
+
currentStep?: number;
|
|
25
|
+
stepResults?: TaskStepResultModel[];
|
|
26
|
+
logTail?: TaskLogEntryModel[];
|
|
27
|
+
constructor(arg?: ModelArg<TaskModel>);
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskModel.js","sourceRoot":"","sources":["../../../src/tasks/models/TaskModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uDAAgD;AAChD,yEAQwC;AACxC,gEAA+C;AAC/C,kDAAoD;AACpD,yDAAkD;AAClD,6DAAsD;AAItD,qDAAyD;AACzD,2DAAoD;AACpD,6DAA+C;AAIxC,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,6BAAa;IA2E1C,YAAY,GAAyB;QACnC,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AA9EY,8BAAS;AAEpB;IADC,IAAA,eAAE,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;qCACT;AAKZ;IAFC,IAAA,+BAAQ,GAAE;IACV,IAAA,6BAAM,EAAC,oBAAQ,CAAC;;uCACD;AAGhB;IADC,IAAA,iBAAI,GAAE;;uCACO;AAMd;IAHC,IAAA,+BAAQ,GAAE;IACV,IAAA,2BAAI,EAAC,MAAM,CAAC;IACZ,IAAA,6BAAM,EAAC,sBAAU,CAAC;;yCACC;AAIpB;IAFC,IAAA,iBAAI,GAAE;IACN,IAAA,yBAAS,GAAE;;wCACA;AAIZ;IAFC,IAAA,iBAAI,GAAE;IACN,IAAA,yBAAS,GAAE;;yCACC;AAIb;IAFC,IAAA,iBAAI,GAAE;IACN,IAAA,yBAAS,GAAE;8BACJ,+BAAc;wCAAC;AAKvB;IAFC,IAAA,0BAAG,EAAC,CAAC,CAAC;IACN,IAAA,+BAAQ,GAAE;;0CACM;AAIjB;IAFC,IAAA,0BAAG,EAAC,CAAC,CAAC;IACN,IAAA,+BAAQ,GAAE;;8CACU;AAKrB;IAHC,IAAA,+BAAQ,GAAE;IACV,IAAA,yBAAS,GAAE;IACX,IAAA,wBAAW,EAAC,uBAAuB,CAAC;8BAC3B,mCAAgB;0CAAC;AAI3B;IAFC,IAAA,2BAAI,GAAE;IACN,IAAA,wBAAW,EAAC,0BAA0B,CAAC;8BAC5B,IAAI;4CAAC;AAKjB;IAFC,IAAA,iBAAI,GAAE;IACN,IAAA,wBAAW,EAAC,6BAA6B,CAAC;;6CACvB;AAIpB;IAFC,IAAA,2BAAI,GAAE;IACN,IAAA,wBAAW,EAAC,iCAAiC,CAAC;8BACjC,IAAI;8CAAC;AAKnB;IAFC,IAAA,iBAAI,GAAE;IACN,IAAA,yBAAS,GAAE;;wCACgB;AAG5B;IADC,IAAA,0BAAG,EAAC,CAAC,CAAC;;8CACc;AAIrB;IAFC,IAAA,yBAAS,GAAE;IACX,IAAA,iBAAI,GAAE;;8CAC6B;AAMpC;IAFC,IAAA,yBAAS,GAAE;IACX,IAAA,iBAAI,GAAE;;0CACuB;oBAzEnB,SAAS;IAFrB,IAAA,kBAAK,EAAC,OAAO,CAAC;IACd,IAAA,4BAAK,GAAE;;GACK,SAAS,CA8ErB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TaskStepResultModel = void 0;
|
|
13
|
+
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
14
|
+
const constants_1 = require("./../constants.cjs");
|
|
15
|
+
const TaskErrorModel_1 = require("./TaskErrorModel.cjs");
|
|
16
|
+
const TaskBaseModel_1 = require("./TaskBaseModel.cjs");
|
|
17
|
+
const decoration_1 = require("@decaf-ts/decoration");
|
|
18
|
+
let TaskStepResultModel = class TaskStepResultModel extends TaskBaseModel_1.TaskBaseModel {
|
|
19
|
+
constructor(arg) {
|
|
20
|
+
super(arg);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
exports.TaskStepResultModel = TaskStepResultModel;
|
|
24
|
+
__decorate([
|
|
25
|
+
(0, decorator_validation_1.required)(),
|
|
26
|
+
(0, decoration_1.description)("The status of a step"),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], TaskStepResultModel.prototype, "status", void 0);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, decoration_1.prop)(),
|
|
31
|
+
(0, decoration_1.description)("The result of a successful step"),
|
|
32
|
+
__metadata("design:type", Object)
|
|
33
|
+
], TaskStepResultModel.prototype, "output", void 0);
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, decoration_1.prop)(),
|
|
36
|
+
(0, decoration_1.description)("the error of a failed step"),
|
|
37
|
+
__metadata("design:type", TaskErrorModel_1.TaskErrorModel)
|
|
38
|
+
], TaskStepResultModel.prototype, "error", void 0);
|
|
39
|
+
exports.TaskStepResultModel = TaskStepResultModel = __decorate([
|
|
40
|
+
(0, decorator_validation_1.model)(),
|
|
41
|
+
__metadata("design:paramtypes", [Object])
|
|
42
|
+
], TaskStepResultModel);
|
|
43
|
+
//# sourceMappingURL=TaskStepResultModel.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ModelArg } from "@decaf-ts/decorator-validation";
|
|
2
|
+
import { TaskStatus } from "../constants";
|
|
3
|
+
import { TaskErrorModel } from "./TaskErrorModel";
|
|
4
|
+
import { TaskBaseModel } from "./TaskBaseModel";
|
|
5
|
+
export declare class TaskStepResultModel extends TaskBaseModel {
|
|
6
|
+
status: TaskStatus;
|
|
7
|
+
output?: any;
|
|
8
|
+
error?: TaskErrorModel;
|
|
9
|
+
constructor(arg?: ModelArg<TaskStepResultModel>);
|
|
10
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskStepResultModel.js","sourceRoot":"","sources":["../../../src/tasks/models/TaskStepResultModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAgF;AAChF,kDAA0C;AAC1C,yDAAkD;AAClD,uDAAgD;AAChD,qDAAyD;AAGlD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,6BAAa;IAapD,YAAY,GAAmC;QAC7C,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AAhBY,kDAAmB;AAG9B;IAFC,IAAA,+BAAQ,GAAE;IACV,IAAA,wBAAW,EAAC,sBAAsB,CAAC;;mDAChB;AAIpB;IAFC,IAAA,iBAAI,GAAE;IACN,IAAA,wBAAW,EAAC,iCAAiC,CAAC;;mDAClC;AAIb;IAFC,IAAA,iBAAI,GAAE;IACN,IAAA,wBAAW,EAAC,4BAA4B,CAAC;8BAClC,+BAAc;kDAAC;8BAXZ,mBAAmB;IAD/B,IAAA,4BAAK,GAAE;;GACK,mBAAmB,CAgB/B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TaskStepSpecModel = void 0;
|
|
13
|
+
const decorator_validation_1 = require("@decaf-ts/decorator-validation");
|
|
14
|
+
const TaskBaseModel_1 = require("./TaskBaseModel.cjs");
|
|
15
|
+
const decoration_1 = require("@decaf-ts/decoration");
|
|
16
|
+
let TaskStepSpecModel = class TaskStepSpecModel extends TaskBaseModel_1.TaskBaseModel {
|
|
17
|
+
constructor(arg) {
|
|
18
|
+
super(arg);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.TaskStepSpecModel = TaskStepSpecModel;
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, decorator_validation_1.required)(),
|
|
24
|
+
(0, decoration_1.description)("task handler type"),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], TaskStepSpecModel.prototype, "type", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, decoration_1.description)("optional task step input"),
|
|
29
|
+
__metadata("design:type", Object)
|
|
30
|
+
], TaskStepSpecModel.prototype, "input", void 0);
|
|
31
|
+
exports.TaskStepSpecModel = TaskStepSpecModel = __decorate([
|
|
32
|
+
(0, decorator_validation_1.model)(),
|
|
33
|
+
__metadata("design:paramtypes", [Object])
|
|
34
|
+
], TaskStepSpecModel);
|
|
35
|
+
//# sourceMappingURL=TaskStepSpecModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskStepSpecModel.js","sourceRoot":"","sources":["../../../src/tasks/models/TaskStepSpecModel.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yEAAgF;AAChF,uDAAgD;AAChD,qDAAmD;AAG5C,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,6BAAa;IAQlD,YAAY,GAAiC;QAC3C,KAAK,CAAC,GAAG,CAAC,CAAC;IACb,CAAC;CACF,CAAA;AAXY,8CAAiB;AAG5B;IAFC,IAAA,+BAAQ,GAAE;IACV,IAAA,wBAAW,EAAC,mBAAmB,CAAC;;+CACnB;AAGd;IADC,IAAA,wBAAW,EAAC,0BAA0B,CAAC;;gDAC5B;4BAND,iBAAiB;IAD7B,IAAA,4BAAK,GAAE;;GACK,iBAAiB,CAW7B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./TaskBackoffModel.cjs"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./TaskBackoffModel";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tasks/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yDAAmC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LogLevel } from "@decaf-ts/logging";
|
|
2
|
+
import { TaskContext } from "./TaskContext";
|
|
3
|
+
import { AdapterFlags } from "../persistence/index";
|
|
4
|
+
export interface ITaskHandler<I = any, O = any> {
|
|
5
|
+
type: string;
|
|
6
|
+
run(input: I, ctx: TaskContext): Promise<O>;
|
|
7
|
+
}
|
|
8
|
+
export interface ITaskContext extends AdapterFlags {
|
|
9
|
+
taskId: string;
|
|
10
|
+
attempt: number;
|
|
11
|
+
log: (level: LogLevel, msg: string, meta?: any) => Promise<void>;
|
|
12
|
+
progress: (data: any) => Promise<void>;
|
|
13
|
+
heartbeat: () => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export type TaskEngineOptions = {
|
|
16
|
+
workerId: string;
|
|
17
|
+
concurrency: number;
|
|
18
|
+
leaseMs: number;
|
|
19
|
+
pollMsIdle: number;
|
|
20
|
+
pollMsBusy: number;
|
|
21
|
+
logTailMax: number;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tasks/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.computeBackoffMs = computeBackoffMs;
|
|
4
|
+
exports.serializeError = serializeError;
|
|
5
|
+
exports.sleep = sleep;
|
|
6
|
+
const TaskErrorModel_1 = require("./models/TaskErrorModel.cjs");
|
|
7
|
+
const constants_1 = require("./constants.cjs");
|
|
8
|
+
function computeBackoffMs(attempt, cfg) {
|
|
9
|
+
const raw = cfg.strategy === constants_1.BackoffStrategy.FIXED
|
|
10
|
+
? cfg.baseMs
|
|
11
|
+
: cfg.baseMs * Math.pow(2, Math.max(0, attempt - 1));
|
|
12
|
+
const capped = Math.min(raw, cfg.maxMs);
|
|
13
|
+
if (cfg.jitter === constants_1.JitterStrategy.FULL) {
|
|
14
|
+
return Math.floor(Math.random() * capped);
|
|
15
|
+
}
|
|
16
|
+
return capped;
|
|
17
|
+
}
|
|
18
|
+
function serializeError(err) {
|
|
19
|
+
return new TaskErrorModel_1.TaskErrorModel({
|
|
20
|
+
message: err?.message ?? String(err),
|
|
21
|
+
stack: err?.stack,
|
|
22
|
+
code: err?.code,
|
|
23
|
+
details: err?.details,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function sleep(ms) {
|
|
27
|
+
return new Promise((r) => setTimeout(r, ms));
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TaskErrorModel } from "./models/TaskErrorModel";
|
|
2
|
+
import { TaskBackoffModel } from "./models/TaskBackoffModel";
|
|
3
|
+
export declare function computeBackoffMs(attempt: number, cfg: TaskBackoffModel): number;
|
|
4
|
+
export declare function serializeError(err: any): TaskErrorModel;
|
|
5
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/tasks/utils.ts"],"names":[],"mappings":";;AAIA,4CAeC;AAED,wCAOC;AAED,sBAEC;AAhCD,gEAAyD;AAEzD,+CAA8D;AAE9D,SAAgB,gBAAgB,CAC9B,OAAe,EACf,GAAqB;IAErB,MAAM,GAAG,GACP,GAAG,CAAC,QAAQ,KAAK,2BAAe,CAAC,KAAK;QACpC,CAAC,CAAC,GAAG,CAAC,MAAM;QACZ,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC;IAEzD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,CAAC;IAExC,IAAI,GAAG,CAAC,MAAM,KAAK,0BAAc,CAAC,IAAI,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,cAAc,CAAC,GAAQ;IACrC,OAAO,IAAI,+BAAc,CAAC;QACxB,OAAO,EAAE,GAAG,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC;QACpC,KAAK,EAAE,GAAG,EAAE,KAAK;QACjB,IAAI,EAAE,GAAG,EAAE,IAAI;QACf,OAAO,EAAE,GAAG,EAAE,OAAO;KACtB,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,KAAK,CAAC,EAAU;IAC9B,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,33 +1,112 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ContextualLoggedClass = void 0;
|
|
3
|
+
exports.AbsContextual = exports.ContextualLoggedClass = void 0;
|
|
4
4
|
const logging_1 = require("@decaf-ts/logging");
|
|
5
5
|
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
6
|
+
const Context_1 = require("./../persistence/Context.cjs");
|
|
6
7
|
class ContextualLoggedClass extends logging_1.LoggedClass {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
return ctx.logger.for(this);
|
|
8
|
+
logCtx(args, operation, allowCreate = false, overrides) {
|
|
9
|
+
return ContextualLoggedClass.logCtx.call(this, operation, overrides || {}, allowCreate, ...args.filter((e) => typeof e !== "undefined"));
|
|
10
10
|
}
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
static logFrom(obj, logger, ctx, method) {
|
|
12
|
+
const log = obj["context"]
|
|
13
|
+
? logger.clear().for(obj) // Reset for Contextuals
|
|
14
|
+
: logger.for(obj);
|
|
15
|
+
// const log = (
|
|
16
|
+
// (this as unknown as Contextual)["context"]
|
|
17
|
+
// ? ctx.logger.for(this as any)
|
|
18
|
+
// : ctx.logger.clear().for(this as any)
|
|
19
|
+
// ) as LoggerOf<CONTEXT>;
|
|
20
|
+
return (method ? log.for(method) : log);
|
|
13
21
|
}
|
|
14
|
-
static logCtx(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
throw new Error("here");
|
|
22
|
-
const log = (this
|
|
23
|
-
? ctx.logger.for(this).for(method)
|
|
24
|
-
: ctx.logger.clear().for(this).for(method));
|
|
25
|
-
return {
|
|
26
|
-
ctx: ctx,
|
|
27
|
-
log: method ? log.for(method) : log,
|
|
28
|
-
ctxArgs: [...args, ctx],
|
|
22
|
+
static logCtx(operation, overrides, allowCreate = false, ...args) {
|
|
23
|
+
const bootCtx = async function bootCtx(...args) {
|
|
24
|
+
if (!this)
|
|
25
|
+
throw new db_decorators_1.InternalError("No contextual provided");
|
|
26
|
+
if (!this["context"])
|
|
27
|
+
throw new db_decorators_1.InternalError("Invalid contextual provided");
|
|
28
|
+
return this.context(typeof operation === "string" ? operation : operation.name, overrides || {}, ...args);
|
|
29
29
|
};
|
|
30
|
+
const response = (obj, resp, op) => {
|
|
31
|
+
// resp.log = ContextualLoggedClass.logFrom(obj, resp.log, ctx, op) as any;
|
|
32
|
+
const baseLog = resp.log || logging_1.Logging.get();
|
|
33
|
+
resp.log = obj.context
|
|
34
|
+
? baseLog.clear().for(obj) // Reset for Contextuals
|
|
35
|
+
: baseLog.for(obj);
|
|
36
|
+
if (typeof op === "string") {
|
|
37
|
+
resp.for = (method) => {
|
|
38
|
+
return Object.assign(resp, { log: resp.log.for(method) });
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
resp.log = resp.log.for(op);
|
|
43
|
+
}
|
|
44
|
+
return resp;
|
|
45
|
+
};
|
|
46
|
+
let ctx = args.pop();
|
|
47
|
+
const hasContext = ctx instanceof Context_1.Context;
|
|
48
|
+
if (ctx && !hasContext) {
|
|
49
|
+
args.push(ctx);
|
|
50
|
+
ctx = undefined;
|
|
51
|
+
}
|
|
52
|
+
if (!allowCreate && !hasContext)
|
|
53
|
+
throw new db_decorators_1.InternalError("No context provided");
|
|
54
|
+
if (hasContext && !allowCreate) {
|
|
55
|
+
if (!ctx)
|
|
56
|
+
throw new db_decorators_1.InternalError("Missing context. should be impossible");
|
|
57
|
+
return response(this, {
|
|
58
|
+
log: ctx.logger,
|
|
59
|
+
ctx: ctx,
|
|
60
|
+
ctxArgs: [...args, ctx],
|
|
61
|
+
}, operation);
|
|
62
|
+
}
|
|
63
|
+
return bootCtx
|
|
64
|
+
.call(this, ...[...args, ctx].filter(Boolean))
|
|
65
|
+
.then((resp) => {
|
|
66
|
+
return response(this, {
|
|
67
|
+
log: resp.logger,
|
|
68
|
+
ctx: resp,
|
|
69
|
+
ctxArgs: [...args, resp],
|
|
70
|
+
}, operation);
|
|
71
|
+
});
|
|
30
72
|
}
|
|
31
73
|
}
|
|
32
74
|
exports.ContextualLoggedClass = ContextualLoggedClass;
|
|
75
|
+
class AbsContextual extends ContextualLoggedClass {
|
|
76
|
+
constructor() {
|
|
77
|
+
super();
|
|
78
|
+
/**
|
|
79
|
+
* @description The context constructor for this adapter
|
|
80
|
+
* @summary Reference to the context class constructor used by this adapter
|
|
81
|
+
*/
|
|
82
|
+
this._Context = (Context_1.Context);
|
|
83
|
+
}
|
|
84
|
+
get Context() {
|
|
85
|
+
return this._Context;
|
|
86
|
+
}
|
|
87
|
+
async context(operation, overrides, ...args) {
|
|
88
|
+
const log = this.log.for(this.context);
|
|
89
|
+
log.debug(`Creating new context for ${typeof operation === "string" ? operation : operation.name} operation with flag overrides: ${Object.keys(overrides)}`);
|
|
90
|
+
let ctx = args.pop();
|
|
91
|
+
if (!(ctx instanceof Context_1.Context)) {
|
|
92
|
+
args.push(ctx);
|
|
93
|
+
ctx = undefined;
|
|
94
|
+
}
|
|
95
|
+
// const operationName =
|
|
96
|
+
// typeof operation === "string" ? operation : operation.name;
|
|
97
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
98
|
+
const hasFlags = typeof this.flags === "function";
|
|
99
|
+
// const flags = hasFlags
|
|
100
|
+
// ? await (this as any).flags(
|
|
101
|
+
// operationName,
|
|
102
|
+
// overrides as Partial<FlagsOf<C>>,
|
|
103
|
+
// ...args
|
|
104
|
+
// )
|
|
105
|
+
// : (overrides as FlagsOf<C>);
|
|
106
|
+
if (ctx && !(ctx instanceof this.Context))
|
|
107
|
+
return new this.Context(ctx).accumulate(overrides);
|
|
108
|
+
return new this.Context().accumulate(overrides);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
exports.AbsContextual = AbsContextual;
|
|
33
112
|
//# sourceMappingURL=ContextualLoggedClass.js.map
|
|
@@ -1,16 +1,37 @@
|
|
|
1
|
-
import { LoggedClass } from "@decaf-ts/logging";
|
|
1
|
+
import { LoggedClass, Logger } from "@decaf-ts/logging";
|
|
2
|
+
import { BulkCrudOperationKeys, Contextual, OperationKeys } from "@decaf-ts/db-decorators";
|
|
2
3
|
import { Context } from "../persistence/Context";
|
|
3
|
-
import { LoggerOf } from "../persistence/
|
|
4
|
+
import { FlagsOf, LoggerOf } from "../persistence/types";
|
|
5
|
+
import type { Constructor } from "@decaf-ts/decoration";
|
|
6
|
+
import { PersistenceKeys } from "../persistence/index";
|
|
7
|
+
import { PreparedStatementKeys } from "../query/index";
|
|
4
8
|
export type ContextualArgs<C extends Context<any>, ARGS extends any[] = any[]> = [...ARGS, C];
|
|
9
|
+
export type MethodOrOperation = ((...args: any[]) => any) | string | OperationKeys | PersistenceKeys | BulkCrudOperationKeys | PreparedStatementKeys;
|
|
5
10
|
export type MaybeContextualArg<C extends Context<any>, ARGS extends any[] = any[]> = any[] | ContextualArgs<C, ARGS>;
|
|
6
|
-
export type ContextualizedArgs<C extends Context<any>, ARGS extends any[] = any[]> = {
|
|
11
|
+
export type ContextualizedArgs<C extends Context<any>, ARGS extends any[] = any[], EXTEND extends boolean = false> = EXTEND extends true ? {
|
|
12
|
+
ctx: C;
|
|
13
|
+
log: LoggerOf<C>;
|
|
14
|
+
ctxArgs: ContextualArgs<C, ARGS>;
|
|
15
|
+
for: (...any: any[]) => ContextualizedArgs<C, ARGS, false>;
|
|
16
|
+
} : {
|
|
7
17
|
ctx: C;
|
|
8
18
|
log: LoggerOf<C>;
|
|
9
19
|
ctxArgs: ContextualArgs<C, ARGS>;
|
|
10
20
|
};
|
|
11
21
|
export declare abstract class ContextualLoggedClass<C extends Context<any>> extends LoggedClass {
|
|
12
|
-
protected
|
|
13
|
-
protected logCtx<ARGS extends any[]>(args:
|
|
14
|
-
protected
|
|
15
|
-
|
|
22
|
+
protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
|
|
23
|
+
protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: false, overrides?: Partial<FlagsOf<CONTEXT>>): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
|
|
24
|
+
protected logCtx<CONTEXT extends Context<any> = C, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(args: MaybeContextualArg<CONTEXT, ARGS>, operation: METHOD, allowCreate: true, overrides?: Partial<FlagsOf<CONTEXT>>): Promise<ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>>;
|
|
25
|
+
static logFrom<CONTEXT extends Context<any>, A = any | Contextual<CONTEXT>, METHOD extends MethodOrOperation = MethodOrOperation>(obj: A, logger: LoggerOf<any>, ctx: CONTEXT, method?: METHOD | keyof A): Logger;
|
|
26
|
+
static logCtx<CONTEXT extends Context<any>, ARGS extends any[] = any[], METHOD extends MethodOrOperation = MethodOrOperation>(this: any, operation: METHOD, ...args: MaybeContextualArg<CONTEXT, ARGS>): ContextualizedArgs<CONTEXT, ARGS, METHOD extends string ? true : false>;
|
|
27
|
+
}
|
|
28
|
+
export declare abstract class AbsContextual<C extends Context<any>> extends ContextualLoggedClass<C> implements Contextual<C> {
|
|
29
|
+
protected constructor();
|
|
30
|
+
/**
|
|
31
|
+
* @description The context constructor for this adapter
|
|
32
|
+
* @summary Reference to the context class constructor used by this adapter
|
|
33
|
+
*/
|
|
34
|
+
private readonly _Context;
|
|
35
|
+
protected get Context(): Constructor<C>;
|
|
36
|
+
context(operation: ((...args: any[]) => any) | OperationKeys.CREATE | OperationKeys.READ | OperationKeys.UPDATE | OperationKeys.DELETE | string, overrides: Partial<FlagsOf<C>>, ...args: MaybeContextualArg<Context<any>, any[]>): Promise<C>;
|
|
16
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextualLoggedClass.js","sourceRoot":"","sources":["../../src/utils/ContextualLoggedClass.ts"],"names":[],"mappings":";;;AAAA,+
|
|
1
|
+
{"version":3,"file":"ContextualLoggedClass.js","sourceRoot":"","sources":["../../src/utils/ContextualLoggedClass.ts"],"names":[],"mappings":";;;AAAA,+CAAiE;AACjE,2DAKiC;AACjC,0DAAiD;AAyCjD,MAAsB,qBAEpB,SAAQ,qBAAW;IA+BT,MAAM,CAMd,IAAuC,EACvC,SAAiB,EACjB,cAAsB,KAAe,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IAAI,CAAC,CAAC,GAAG,YAAY,iBAAO,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACf,GAAG,GAAG,SAAS,CAAC;QAClB,CAAC;QAED,wBAAwB;QACxB,gEAAgE;QAChE,6DAA6D;QAC7D,MAAM,QAAQ,GAAG,OAAQ,IAAY,CAAC,KAAK,KAAK,UAAU,CAAC;QAC3D,yBAAyB;QACzB,iCAAiC;QACjC,uBAAuB;QACvB,0CAA0C;QAC1C,gBAAgB;QAChB,QAAQ;QACR,iCAAiC;QAEjC,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,YAAY,IAAI,CAAC,OAAO,CAAC;YACvC,OAAO,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,UAAU,CAAC,SAAS,CAAM,CAAC;QAC1D,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,SAAS,CAAM,CAAC;IACvD,CAAC;CACF;AAxDD,sCAwDC"}
|
package/lib/utils/decorators.cjs
CHANGED
|
@@ -4,7 +4,7 @@ exports.del = exports.update = exports.read = exports.create = void 0;
|
|
|
4
4
|
exports.service = service;
|
|
5
5
|
const decoration_1 = require("@decaf-ts/decoration");
|
|
6
6
|
const injectable_decorators_1 = require("@decaf-ts/injectable-decorators");
|
|
7
|
-
const
|
|
7
|
+
const constants_1 = require("./../persistence/constants.cjs");
|
|
8
8
|
const utils_1 = require("./utils.cjs");
|
|
9
9
|
const db_decorators_1 = require("@decaf-ts/db-decorators");
|
|
10
10
|
function OperationGuard(op) {
|
|
@@ -46,7 +46,7 @@ function service(key) {
|
|
|
46
46
|
decs.push((0, injectable_decorators_1.inject)(key));
|
|
47
47
|
}
|
|
48
48
|
else if (!descriptor && !prop) {
|
|
49
|
-
decoration_1.Metadata.set(
|
|
49
|
+
decoration_1.Metadata.set(constants_1.PersistenceKeys.SERVICE, key, target);
|
|
50
50
|
decs.push((0, injectable_decorators_1.injectable)(key, {
|
|
51
51
|
singleton: true,
|
|
52
52
|
callback: (inst) => Object.defineProperty(inst, "name", {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ModelConstructor } from "@decaf-ts/decorator-validation";
|
|
2
|
-
export declare const create: () => (target: any, _propertyKey
|
|
3
|
-
export declare const read: () => (target: any, _propertyKey
|
|
4
|
-
export declare const update: () => (target: any, _propertyKey
|
|
5
|
-
export declare const del: () => (target: any, _propertyKey
|
|
2
|
+
export declare const create: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
|
|
3
|
+
export declare const read: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
|
|
4
|
+
export declare const update: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
|
|
5
|
+
export declare const del: () => (target: any, _propertyKey?: any, descriptor?: any) => any;
|
|
6
6
|
export declare function service(key?: string | ModelConstructor<any>): (target: any, prop?: any, descriptor?: any) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/utils/decorators.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../src/utils/decorators.ts"],"names":[],"mappings":";;;AA+BA,0BAqCC;AApED,qDAAyE;AACzE,2EAAqE;AACrE,8DAA4D;AAG5D,uCAAmE;AACnE,2DAAwD;AAGxD,SAAS,cAAc,CAAC,EAAkB;IACxC,OAAO,UAAU,MAAW,EAAE,YAAkB,EAAE,UAAgB;QAChE,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC;QAClC,UAAU,CAAC,KAAK,GAAG,UAAU,GAAG,IAAW;YACzC,MAAM,WAAW,GAAI,IAA+B,CAAC,KAAK,CAAC;YAC3D,IAAI,WAAW,IAAI,IAAA,0BAAkB,EAAC,WAAW,EAAE,EAAE,CAAC,EAAE,CAAC;gBACvD,MAAM,IAAI,GAAG,WAAW,EAAE,IAAI,IAAI,OAAO,CAAC;gBAC1C,MAAM,IA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C;YACvD,IAAI,CAAC,IAAI,CAAC,IAAA,8BAAM,EAAC,GAAG,CAAC,CAAC,CAAC;QACzB,CAAC;aAAM,IAAI,CAAC,UAAU,IAAI,CAAC,IAAI,EAAE,CAAC;YAChC,qBAAQ,CAAC,GAAG,CAAC,2BAAe,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;YACnD,IAAI,CAAC,IAAI,CACP,IAAA,kCAAU,EAAC,GAAG,EAAE;gBACd,SAAS,EAAE,IAAI;gBACf,QAAQ,EAAE,CAAC,IAAS,EAAE,EAAE,CACtB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE;oBAClC,UAAU,EAAE,IAAI;oBAChB,YAAY,EAAE,KAAK;oBACnB,QAAQ,EAAE,KAAK;oBACf,KAAK,EAAE,GAAG;iBACX,CAAC;aACL,CAAC,CACH,CAAC;QACJ,CAAC;aAAM,IAAI,CAAC,UAAU,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,IAAA,8BAAM,EAAC,GAAG,CAAC,CAAC,CAAC;QACzB,CAAC;;YAAM,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;QAExE,qDAAqD;QACrD,OAAO,IAAA,kBAAK,EAAC,GAAG,IAAI,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;IAClD,CAAC,CAAC;AACJ,CAAC"}
|
package/lib/utils/index.cjs
CHANGED
|
@@ -17,6 +17,5 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./ContextualLoggedClass.cjs"), exports);
|
|
18
18
|
__exportStar(require("./decorators.cjs"), exports);
|
|
19
19
|
__exportStar(require("./errors.cjs"), exports);
|
|
20
|
-
__exportStar(require("./Services.cjs"), exports);
|
|
21
20
|
__exportStar(require("./utils.cjs"), exports);
|
|
22
21
|
//# sourceMappingURL=index.js.map
|
package/lib/utils/index.d.ts
CHANGED
package/lib/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAAwC;AACxC,mDAA6B;AAC7B,+CAAyB;AACzB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAAwC;AACxC,mDAA6B;AAC7B,+CAAyB;AACzB,8CAAwB"}
|