@quadnix/octo 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.type.d.ts +236 -27
- package/dist/app.type.js +92 -1
- package/dist/app.type.js.map +1 -1
- package/dist/decorators/action.decorator.d.ts +4 -5
- package/dist/decorators/action.decorator.js +42 -41
- package/dist/decorators/action.decorator.js.map +1 -1
- package/dist/decorators/anchor.decorator.d.ts +2 -2
- package/dist/decorators/anchor.decorator.js +16 -11
- package/dist/decorators/anchor.decorator.js.map +1 -1
- package/dist/decorators/enable-hook.decorator.d.ts +5 -0
- package/dist/decorators/enable-hook.decorator.js +7 -2
- package/dist/decorators/enable-hook.decorator.js.map +1 -1
- package/dist/decorators/event-source.decorator.d.ts +5 -1
- package/dist/decorators/event-source.decorator.js +5 -1
- package/dist/decorators/event-source.decorator.js.map +1 -1
- package/dist/decorators/factory.decorator.d.ts +14 -2
- package/dist/decorators/factory.decorator.js +12 -3
- package/dist/decorators/factory.decorator.js.map +1 -1
- package/dist/decorators/model.decorator.d.ts +19 -5
- package/dist/decorators/model.decorator.js +40 -14
- package/dist/decorators/model.decorator.js.map +1 -1
- package/dist/decorators/module.decorator.d.ts +4 -75
- package/dist/decorators/module.decorator.js +18 -58
- package/dist/decorators/module.decorator.js.map +1 -1
- package/dist/decorators/on-event.decorator.d.ts +1 -1
- package/dist/decorators/on-event.decorator.js +1 -1
- package/dist/decorators/on-event.decorator.js.map +1 -1
- package/dist/decorators/overlay.decorator.d.ts +16 -6
- package/dist/decorators/overlay.decorator.js +36 -15
- package/dist/decorators/overlay.decorator.js.map +1 -1
- package/dist/decorators/resource.decorator.d.ts +17 -6
- package/dist/decorators/resource.decorator.js +37 -15
- package/dist/decorators/resource.decorator.js.map +1 -1
- package/dist/decorators/validate.decorator.d.ts +12 -4
- package/dist/decorators/validate.decorator.js +24 -2
- package/dist/decorators/validate.decorator.js.map +1 -1
- package/dist/errors/container.error.d.ts +20 -0
- package/dist/errors/container.error.js +29 -0
- package/dist/errors/container.error.js.map +1 -0
- package/dist/errors/index.d.ts +6 -0
- package/dist/errors/index.js +7 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/input.error.d.ts +49 -0
- package/dist/errors/input.error.js +59 -0
- package/dist/errors/input.error.js.map +1 -0
- package/dist/errors/module.error.d.ts +7 -0
- package/dist/errors/module.error.js +11 -0
- package/dist/errors/module.error.js.map +1 -0
- package/dist/errors/node.error.d.ts +63 -0
- package/dist/errors/node.error.js +87 -0
- package/dist/errors/node.error.js.map +1 -0
- package/dist/errors/schema.error.d.ts +7 -0
- package/dist/errors/schema.error.js +11 -0
- package/dist/errors/schema.error.js.map +1 -0
- package/dist/errors/transaction.error.d.ts +56 -0
- package/dist/errors/transaction.error.js +79 -0
- package/dist/errors/transaction.error.js.map +1 -0
- package/dist/events/action.event.d.ts +14 -0
- package/dist/events/action.event.js +12 -0
- package/dist/events/action.event.js.map +1 -0
- package/dist/events/event.model.d.ts +8 -12
- package/dist/events/event.model.js +7 -11
- package/dist/events/event.model.js.map +1 -1
- package/dist/events/hook/commit.hook.event.d.ts +28 -0
- package/dist/events/hook/commit.hook.event.js +29 -0
- package/dist/events/hook/commit.hook.event.js.map +1 -0
- package/dist/events/hook/hook.event.d.ts +10 -0
- package/dist/events/hook/hook.event.js +11 -0
- package/dist/events/hook/hook.event.js.map +1 -0
- package/dist/events/hook/index.d.ts +4 -0
- package/dist/events/hook/index.js +5 -0
- package/dist/events/hook/index.js.map +1 -0
- package/dist/events/hook/model.hook.event.d.ts +28 -0
- package/dist/events/hook/model.hook.event.js +29 -0
- package/dist/events/hook/model.hook.event.js.map +1 -0
- package/dist/events/hook/resource.hook.event.d.ts +28 -0
- package/dist/events/hook/resource.hook.event.js +29 -0
- package/dist/events/hook/resource.hook.event.js.map +1 -0
- package/dist/events/index.d.ts +7 -0
- package/dist/events/index.js +8 -0
- package/dist/events/index.js.map +1 -0
- package/dist/events/module.event.d.ts +3 -7
- package/dist/events/module.event.js +2 -6
- package/dist/events/module.event.js.map +1 -1
- package/dist/events/registration.event.d.ts +22 -57
- package/dist/events/registration.event.js +29 -70
- package/dist/events/registration.event.js.map +1 -1
- package/dist/events/serialization.event.d.ts +34 -41
- package/dist/events/serialization.event.js +59 -37
- package/dist/events/serialization.event.js.map +1 -1
- package/dist/events/transaction.event.d.ts +72 -29
- package/dist/events/transaction.event.js +63 -27
- package/dist/events/transaction.event.js.map +1 -1
- package/dist/functions/container/container.d.ts +56 -9
- package/dist/functions/container/container.js +108 -19
- package/dist/functions/container/container.js.map +1 -1
- package/dist/functions/container/test-container.d.ts +11 -13
- package/dist/functions/container/test-container.js +35 -38
- package/dist/functions/container/test-container.js.map +1 -1
- package/dist/functions/dependency/dependency.d.ts +9 -0
- package/dist/functions/dependency/dependency.js +10 -3
- package/dist/functions/dependency/dependency.js.map +1 -1
- package/dist/functions/diff/diff-metadata.d.ts +6 -5
- package/dist/functions/diff/diff-metadata.js +6 -2
- package/dist/functions/diff/diff-metadata.js.map +1 -1
- package/dist/functions/diff/diff.d.ts +16 -5
- package/dist/functions/diff/diff.js +11 -4
- package/dist/functions/diff/diff.js.map +1 -1
- package/dist/functions/diff/diff.utility.d.ts +5 -2
- package/dist/functions/diff/diff.utility.js +28 -4
- package/dist/functions/diff/diff.utility.js.map +1 -1
- package/dist/functions/hook/commit.hook.d.ts +17 -3
- package/dist/functions/hook/commit.hook.js +19 -16
- package/dist/functions/hook/commit.hook.js.map +1 -1
- package/dist/functions/hook/hook.interface.d.ts +10 -6
- package/dist/functions/hook/model-action.hook.d.ts +20 -5
- package/dist/functions/hook/model-action.hook.js +23 -39
- package/dist/functions/hook/model-action.hook.js.map +1 -1
- package/dist/functions/hook/resource-action.hook.d.ts +20 -5
- package/dist/functions/hook/resource-action.hook.js +21 -18
- package/dist/functions/hook/resource-action.hook.js.map +1 -1
- package/dist/functions/node/node-action.abstract.d.ts +10 -0
- package/dist/functions/node/node-action.abstract.js +23 -0
- package/dist/functions/node/node-action.abstract.js.map +1 -0
- package/dist/functions/node/node.abstract.d.ts +20 -9
- package/dist/functions/node/node.abstract.js +101 -32
- package/dist/functions/node/node.abstract.js.map +1 -1
- package/dist/functions/node/node.interface.d.ts +22 -18
- package/dist/functions/schema/schema.d.ts +21 -0
- package/dist/functions/schema/schema.js +55 -0
- package/dist/functions/schema/schema.js.map +1 -0
- package/dist/index.d.ts +31 -32
- package/dist/index.js +29 -12
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +32 -15
- package/dist/main.js +65 -50
- package/dist/main.js.map +1 -1
- package/dist/models/account/account.model.d.ts +26 -0
- package/dist/models/account/account.model.js +71 -0
- package/dist/models/account/account.model.js.map +1 -0
- package/dist/models/account/account.schema.d.ts +13 -0
- package/dist/models/account/account.schema.js +18 -0
- package/dist/models/account/account.schema.js.map +1 -0
- package/dist/models/app/app.model.d.ts +9 -14
- package/dist/models/app/app.model.js +27 -27
- package/dist/models/app/app.model.js.map +1 -1
- package/dist/models/app/app.schema.d.ts +6 -0
- package/dist/models/app/app.schema.js +24 -0
- package/dist/models/app/app.schema.js.map +1 -0
- package/dist/models/deployment/deployment.model.d.ts +9 -12
- package/dist/models/deployment/deployment.model.js +11 -11
- package/dist/models/deployment/deployment.model.js.map +1 -1
- package/dist/models/deployment/deployment.schema.d.ts +10 -0
- package/dist/models/deployment/deployment.schema.js +28 -0
- package/dist/models/deployment/deployment.schema.js.map +1 -0
- package/dist/models/environment/environment.model.d.ts +8 -14
- package/dist/models/environment/environment.model.js +10 -22
- package/dist/models/environment/environment.model.js.map +1 -1
- package/dist/models/environment/environment.schema.d.ts +16 -0
- package/dist/models/environment/environment.schema.js +41 -0
- package/dist/models/environment/environment.schema.js.map +1 -0
- package/dist/models/execution/execution.model.d.ts +9 -13
- package/dist/models/execution/execution.model.js +18 -25
- package/dist/models/execution/execution.model.js.map +1 -1
- package/dist/models/execution/execution.schema.d.ts +17 -0
- package/dist/models/execution/execution.schema.js +37 -0
- package/dist/models/execution/execution.schema.js.map +1 -0
- package/dist/models/filesystem/filesystem.model.d.ts +13 -0
- package/dist/models/filesystem/filesystem.model.js +46 -0
- package/dist/models/filesystem/filesystem.model.js.map +1 -0
- package/dist/models/filesystem/filesystem.schema.d.ts +6 -0
- package/dist/models/filesystem/filesystem.schema.js +24 -0
- package/dist/models/filesystem/filesystem.schema.js.map +1 -0
- package/dist/models/image/image.model.d.ts +10 -40
- package/dist/models/image/image.model.js +17 -27
- package/dist/models/image/image.model.js.map +1 -1
- package/dist/models/image/image.schema.d.ts +12 -0
- package/dist/models/image/image.schema.js +34 -0
- package/dist/models/image/image.schema.js.map +1 -0
- package/dist/models/model-action.interface.d.ts +5 -13
- package/dist/models/model.abstract.d.ts +28 -13
- package/dist/models/model.abstract.js +179 -13
- package/dist/models/model.abstract.js.map +1 -1
- package/dist/models/model.interface.d.ts +17 -6
- package/dist/models/pipeline/pipeline.model.d.ts +8 -7
- package/dist/models/pipeline/pipeline.model.js +10 -10
- package/dist/models/pipeline/pipeline.model.js.map +1 -1
- package/dist/models/pipeline/pipeline.schema.d.ts +7 -0
- package/dist/models/pipeline/pipeline.schema.js +25 -0
- package/dist/models/pipeline/pipeline.schema.js.map +1 -0
- package/dist/models/region/region.model.d.ts +11 -8
- package/dist/models/region/region.model.js +25 -12
- package/dist/models/region/region.model.js.map +1 -1
- package/dist/models/region/region.schema.d.ts +6 -0
- package/dist/models/region/region.schema.js +24 -0
- package/dist/models/region/region.schema.js.map +1 -0
- package/dist/models/server/server.model.d.ts +8 -10
- package/dist/models/server/server.model.js +13 -11
- package/dist/models/server/server.model.js.map +1 -1
- package/dist/models/server/server.schema.d.ts +9 -0
- package/dist/models/server/server.schema.js +27 -0
- package/dist/models/server/server.schema.js.map +1 -0
- package/dist/models/service/service.model.d.ts +7 -9
- package/dist/models/service/service.model.js +15 -13
- package/dist/models/service/service.model.js.map +1 -1
- package/dist/models/service/service.schema.d.ts +9 -0
- package/dist/models/service/service.schema.js +27 -0
- package/dist/models/service/service.schema.js.map +1 -0
- package/dist/models/subnet/subnet.model.d.ts +11 -33
- package/dist/models/subnet/subnet.model.js +14 -34
- package/dist/models/subnet/subnet.model.js.map +1 -1
- package/dist/models/subnet/subnet.schema.d.ts +38 -0
- package/dist/models/subnet/subnet.schema.js +53 -0
- package/dist/models/subnet/subnet.schema.js.map +1 -0
- package/dist/modules/module.abstract.d.ts +24 -0
- package/dist/modules/module.abstract.js +17 -0
- package/dist/modules/module.abstract.js.map +1 -0
- package/dist/modules/module.container.d.ts +38 -18
- package/dist/modules/module.container.js +140 -81
- package/dist/modules/module.container.js.map +1 -1
- package/dist/modules/module.interface.d.ts +18 -2
- package/dist/modules/test-module.container.d.ts +39 -15
- package/dist/modules/test-module.container.js +262 -26
- package/dist/modules/test-module.container.js.map +1 -1
- package/dist/overlays/anchor.abstract.d.ts +16 -8
- package/dist/overlays/anchor.abstract.js +4 -1
- package/dist/overlays/anchor.abstract.js.map +1 -1
- package/dist/overlays/anchor.interface.d.ts +8 -8
- package/dist/overlays/anchor.schema.d.ts +14 -0
- package/dist/overlays/anchor.schema.js +12 -0
- package/dist/overlays/anchor.schema.js.map +1 -0
- package/dist/overlays/overlay-data.repository.d.ts +9 -4
- package/dist/overlays/overlay-data.repository.js +20 -10
- package/dist/overlays/overlay-data.repository.js.map +1 -1
- package/dist/overlays/overlay.abstract.d.ts +15 -13
- package/dist/overlays/overlay.abstract.js +22 -8
- package/dist/overlays/overlay.abstract.js.map +1 -1
- package/dist/overlays/overlay.interface.d.ts +6 -7
- package/dist/overlays/overlay.schema.d.ts +11 -0
- package/dist/overlays/overlay.schema.js +12 -0
- package/dist/overlays/overlay.schema.js.map +1 -0
- package/dist/resources/resource-action.interface.d.ts +7 -3
- package/dist/resources/resource-data.repository.d.ts +8 -3
- package/dist/resources/resource-data.repository.js +64 -82
- package/dist/resources/resource-data.repository.js.map +1 -1
- package/dist/resources/resource.abstract.d.ts +53 -27
- package/dist/resources/resource.abstract.js +233 -57
- package/dist/resources/resource.abstract.js.map +1 -1
- package/dist/resources/resource.interface.d.ts +45 -8
- package/dist/resources/resource.schema.d.ts +17 -0
- package/dist/resources/resource.schema.js +14 -0
- package/dist/resources/resource.schema.js.map +1 -0
- package/dist/services/capture/capture.service.d.ts +12 -6
- package/dist/services/capture/capture.service.js +14 -5
- package/dist/services/capture/capture.service.js.map +1 -1
- package/dist/services/event/event.service.d.ts +8 -2
- package/dist/services/event/event.service.js +9 -2
- package/dist/services/event/event.service.js.map +1 -1
- package/dist/services/input/input.service.d.ts +68 -6
- package/dist/services/input/input.service.js +296 -14
- package/dist/services/input/input.service.js.map +1 -1
- package/dist/services/schema-translation/schema-translation.service.d.ts +19 -0
- package/dist/services/schema-translation/schema-translation.service.js +48 -0
- package/dist/services/schema-translation/schema-translation.service.js.map +1 -0
- package/dist/services/serialization/model/model-serialization.service.d.ts +7 -4
- package/dist/services/serialization/model/model-serialization.service.js +65 -33
- package/dist/services/serialization/model/model-serialization.service.js.map +1 -1
- package/dist/services/serialization/resource/resource-serialization.service.d.ts +7 -1
- package/dist/services/serialization/resource/resource-serialization.service.js +64 -80
- package/dist/services/serialization/resource/resource-serialization.service.js.map +1 -1
- package/dist/services/state-management/local.state-provider.d.ts +3 -1
- package/dist/services/state-management/local.state-provider.js +8 -7
- package/dist/services/state-management/local.state-provider.js.map +1 -1
- package/dist/services/state-management/state-management.service.d.ts +8 -3
- package/dist/services/state-management/state-management.service.js +25 -8
- package/dist/services/state-management/state-management.service.js.map +1 -1
- package/dist/services/state-management/state-provider.interface.d.ts +3 -1
- package/dist/services/state-management/test.state-provider.d.ts +3 -1
- package/dist/services/state-management/test.state-provider.js +5 -1
- package/dist/services/state-management/test.state-provider.js.map +1 -1
- package/dist/services/transaction/transaction.service.d.ts +22 -11
- package/dist/services/transaction/transaction.service.js +215 -66
- package/dist/services/transaction/transaction.service.js.map +1 -1
- package/dist/services/validation/validation.service.d.ts +8 -3
- package/dist/services/validation/validation.service.js +33 -12
- package/dist/services/validation/validation.service.js.map +1 -1
- package/dist/utilities/array/array.utility.d.ts +3 -0
- package/dist/utilities/array/array.utility.js +3 -0
- package/dist/utilities/array/array.utility.js.map +1 -1
- package/dist/utilities/cidr/cidr.utility.d.ts +3 -0
- package/dist/utilities/cidr/cidr.utility.js +3 -0
- package/dist/utilities/cidr/cidr.utility.js.map +1 -1
- package/dist/utilities/node/node.utility.d.ts +7 -0
- package/dist/utilities/node/node.utility.js +25 -0
- package/dist/utilities/node/node.utility.js.map +1 -0
- package/dist/utilities/object/object.utility.d.ts +6 -0
- package/dist/utilities/object/object.utility.js +36 -0
- package/dist/utilities/object/object.utility.js.map +1 -1
- package/dist/utilities/test-helpers/test-classes.d.ts +84 -0
- package/dist/utilities/test-helpers/test-classes.js +103 -0
- package/dist/utilities/test-helpers/test-classes.js.map +1 -0
- package/dist/utilities/test-helpers/test-models.d.ts +47 -0
- package/dist/utilities/test-helpers/test-models.js +230 -0
- package/dist/utilities/test-helpers/test-models.js.map +1 -0
- package/dist/utilities/test-helpers/test-overlays.d.ts +13 -0
- package/dist/utilities/test-helpers/test-overlays.js +56 -0
- package/dist/utilities/test-helpers/test-overlays.js.map +1 -0
- package/dist/utilities/test-helpers/test-resources.d.ts +31 -0
- package/dist/utilities/test-helpers/test-resources.js +171 -0
- package/dist/utilities/test-helpers/test-resources.js.map +1 -0
- package/dist/utilities/validation/validation.utility.d.ts +34 -3
- package/dist/utilities/validation/validation.utility.js +124 -2
- package/dist/utilities/validation/validation.utility.js.map +1 -1
- package/package.json +7 -7
- package/dist/events/error.event.d.ts +0 -35
- package/dist/events/error.event.js +0 -36
- package/dist/events/error.event.js.map +0 -1
- package/dist/events/hook.event.d.ts +0 -194
- package/dist/events/hook.event.js +0 -195
- package/dist/events/hook.event.js.map +0 -1
- package/dist/models/app/app.interface.d.ts +0 -9
- package/dist/models/app/app.interface.js +0 -2
- package/dist/models/app/app.interface.js.map +0 -1
- package/dist/models/deployment/deployment.interface.d.ts +0 -9
- package/dist/models/deployment/deployment.interface.js +0 -2
- package/dist/models/deployment/deployment.interface.js.map +0 -1
- package/dist/models/environment/environment.interface.d.ts +0 -12
- package/dist/models/environment/environment.interface.js +0 -2
- package/dist/models/environment/environment.interface.js.map +0 -1
- package/dist/models/execution/execution.interface.d.ts +0 -14
- package/dist/models/execution/execution.interface.js +0 -2
- package/dist/models/execution/execution.interface.js.map +0 -1
- package/dist/models/image/image.interface.d.ts +0 -12
- package/dist/models/image/image.interface.js +0 -2
- package/dist/models/image/image.interface.js.map +0 -1
- package/dist/models/pipeline/pipeline.interface.d.ts +0 -10
- package/dist/models/pipeline/pipeline.interface.js +0 -2
- package/dist/models/pipeline/pipeline.interface.js.map +0 -1
- package/dist/models/region/region.interface.d.ts +0 -9
- package/dist/models/region/region.interface.js +0 -2
- package/dist/models/region/region.interface.js.map +0 -1
- package/dist/models/server/server.interface.d.ts +0 -9
- package/dist/models/server/server.interface.js +0 -2
- package/dist/models/server/server.interface.js.map +0 -1
- package/dist/models/service/service.interface.d.ts +0 -9
- package/dist/models/service/service.interface.js +0 -2
- package/dist/models/service/service.interface.js.map +0 -1
- package/dist/models/subnet/subnet.interface.d.ts +0 -13
- package/dist/models/subnet/subnet.interface.js +0 -2
- package/dist/models/subnet/subnet.interface.js.map +0 -1
- package/dist/overlays/overlay.service.d.ts +0 -17
- package/dist/overlays/overlay.service.js +0 -41
- package/dist/overlays/overlay.service.js.map +0 -1
- package/dist/resources/shared-resource.abstract.d.ts +0 -13
- package/dist/resources/shared-resource.abstract.js +0 -47
- package/dist/resources/shared-resource.abstract.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-management.service.js","sourceRoot":"","sources":["../../../src/services/state-management/state-management.service.ts"],"names":[],"mappings":";;;;;;AACA,OAAO,EAAE,OAAO,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"state-management.service.js","sourceRoot":"","sources":["../../../src/services/state-management/state-management.service.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" resolution-mode="require"/>
|
|
2
1
|
import type { IStateProvider } from './state-provider.interface.js';
|
|
2
|
+
/**
|
|
3
|
+
* @group Services/State Management
|
|
4
|
+
*/
|
|
3
5
|
export declare class TestStateProvider implements IStateProvider {
|
|
4
6
|
private readonly localState;
|
|
5
7
|
getState(stateFileName: string): Promise<Buffer>;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { TransactionError } from '../../errors/index.js';
|
|
2
|
+
/**
|
|
3
|
+
* @group Services/State Management
|
|
4
|
+
*/
|
|
1
5
|
export class TestStateProvider {
|
|
2
6
|
constructor() {
|
|
3
7
|
this.localState = {};
|
|
4
8
|
}
|
|
5
9
|
async getState(stateFileName) {
|
|
6
10
|
if (!(stateFileName in this.localState)) {
|
|
7
|
-
throw new
|
|
11
|
+
throw new TransactionError('No state found!');
|
|
8
12
|
}
|
|
9
13
|
return this.localState[stateFileName];
|
|
10
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test.state-provider.js","sourceRoot":"","sources":["../../../src/services/state-management/test.state-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"test.state-provider.js","sourceRoot":"","sources":["../../../src/services/state-management/test.state-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAGzD;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QACmB,eAAU,GAA8B,EAAE,CAAC;IAY9D,CAAC;IAVC,KAAK,CAAC,QAAQ,CAAC,aAAqB;QAClC,IAAI,CAAC,CAAC,aAAa,IAAI,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;YACxC,MAAM,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;QAChD,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,aAAqB,EAAE,IAAY;QACjD,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import { type TransactionOptions } from '../../app.type.js';
|
|
1
|
+
import { type Constructable, type IUnknownModelAction, type IUnknownResourceAction, type TransactionOptions, type UnknownModel, type UnknownOverlay, type UnknownResource } from '../../app.type.js';
|
|
2
2
|
import { DiffMetadata } from '../../functions/diff/diff-metadata.js';
|
|
3
3
|
import { type Diff } from '../../functions/diff/diff.js';
|
|
4
|
-
import
|
|
4
|
+
import { ModuleContainer } from '../../modules/module.container.js';
|
|
5
5
|
import { OverlayDataRepository } from '../../overlays/overlay-data.repository.js';
|
|
6
|
-
import type { IResourceAction } from '../../resources/resource-action.interface.js';
|
|
7
6
|
import { ResourceDataRepository } from '../../resources/resource-data.repository.js';
|
|
8
7
|
import { CaptureService } from '../capture/capture.service.js';
|
|
8
|
+
import { EventService } from '../event/event.service.js';
|
|
9
9
|
import { InputService } from '../input/input.service.js';
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
10
13
|
export declare class TransactionService {
|
|
11
14
|
private readonly captureService;
|
|
15
|
+
private readonly eventService;
|
|
12
16
|
private readonly inputService;
|
|
17
|
+
private readonly moduleContainer;
|
|
13
18
|
private readonly overlayDataRepository;
|
|
14
19
|
private readonly resourceDataRepository;
|
|
15
|
-
private
|
|
16
|
-
private
|
|
17
|
-
private
|
|
18
|
-
constructor(captureService: CaptureService, inputService: InputService, overlayDataRepository: OverlayDataRepository, resourceDataRepository: ResourceDataRepository);
|
|
20
|
+
private modelActions;
|
|
21
|
+
private overlayActions;
|
|
22
|
+
private resourceActions;
|
|
23
|
+
constructor(captureService: CaptureService, eventService: EventService, inputService: InputService, moduleContainer: ModuleContainer, overlayDataRepository: OverlayDataRepository, resourceDataRepository: ResourceDataRepository);
|
|
19
24
|
private applyModels;
|
|
20
25
|
private applyResources;
|
|
26
|
+
private getDiffsOfSameNode;
|
|
21
27
|
private getDuplicateDiffs;
|
|
22
28
|
private getMatchingDiffs;
|
|
23
29
|
/**
|
|
@@ -26,11 +32,16 @@ export declare class TransactionService {
|
|
|
26
32
|
*/
|
|
27
33
|
private setApplyOrder;
|
|
28
34
|
beginTransaction(diffs: Diff[], { enableResourceCapture, yieldModelDiffs, yieldModelTransaction, yieldResourceDiffs, yieldResourceTransaction, }?: TransactionOptions): AsyncGenerator<DiffMetadata[][], DiffMetadata[][]>;
|
|
29
|
-
registerModelActions(actions:
|
|
30
|
-
registerOverlayActions(actions:
|
|
31
|
-
registerResourceActions(actions:
|
|
35
|
+
registerModelActions(forModel: Constructable<UnknownModel>, actions: IUnknownModelAction[]): void;
|
|
36
|
+
registerOverlayActions(forOverlay: Constructable<UnknownOverlay>, actions: IUnknownModelAction[]): void;
|
|
37
|
+
registerResourceActions(forResource: Constructable<UnknownResource>, actions: IUnknownResourceAction[]): void;
|
|
38
|
+
unregisterModelActions(forModel: Constructable<UnknownModel>): void;
|
|
39
|
+
unregisterOverlayActions(forOverlay: Constructable<UnknownOverlay>): void;
|
|
32
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* @internal
|
|
43
|
+
*/
|
|
33
44
|
export declare class TransactionServiceFactory {
|
|
34
45
|
private static instance;
|
|
35
|
-
static create(
|
|
46
|
+
static create(): Promise<TransactionService>;
|
|
36
47
|
}
|
|
@@ -8,23 +8,31 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
10
|
import { NodeType, } from '../../app.type.js';
|
|
11
|
-
import { Container } from '../../functions/container/container.js';
|
|
12
11
|
import { EventSource } from '../../decorators/event-source.decorator.js';
|
|
13
12
|
import { Factory } from '../../decorators/factory.decorator.js';
|
|
14
|
-
import {
|
|
15
|
-
import { ModelActionTransactionEvent,
|
|
13
|
+
import { InputNotFoundTransactionError, InputRegistrationError, ResourceActionExceptionTransactionError, ResourceActionTimeoutTransactionError, TransactionError, } from '../../errors/index.js';
|
|
14
|
+
import { ModelActionRegistrationEvent, ModelActionTransactionEvent, ModelDiffsTransactionEvent, ModelTransactionTransactionEvent, ResourceActionCompletedTransactionEvent, ResourceActionInitiatedTransactionEvent, ResourceActionRegistrationEvent, ResourceActionSummaryTransactionEvent, ResourceDiffsTransactionEvent, ResourceTransactionTransactionEvent, } from '../../events/index.js';
|
|
15
|
+
import { Container } from '../../functions/container/container.js';
|
|
16
16
|
import { DiffMetadata } from '../../functions/diff/diff-metadata.js';
|
|
17
17
|
import { DiffAction } from '../../functions/diff/diff.js';
|
|
18
|
+
import { DiffUtility } from '../../functions/diff/diff.utility.js';
|
|
19
|
+
import { ModuleContainer } from '../../modules/module.container.js';
|
|
18
20
|
import { OverlayDataRepository } from '../../overlays/overlay-data.repository.js';
|
|
21
|
+
import { AOverlay } from '../../overlays/overlay.abstract.js';
|
|
19
22
|
import { ResourceDataRepository } from '../../resources/resource-data.repository.js';
|
|
20
23
|
import { AResource } from '../../resources/resource.abstract.js';
|
|
21
24
|
import { CaptureService } from '../capture/capture.service.js';
|
|
22
25
|
import { EventService } from '../event/event.service.js';
|
|
23
26
|
import { InputService } from '../input/input.service.js';
|
|
27
|
+
/**
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
24
30
|
export class TransactionService {
|
|
25
|
-
constructor(captureService, inputService, overlayDataRepository, resourceDataRepository) {
|
|
31
|
+
constructor(captureService, eventService, inputService, moduleContainer, overlayDataRepository, resourceDataRepository) {
|
|
26
32
|
this.captureService = captureService;
|
|
33
|
+
this.eventService = eventService;
|
|
27
34
|
this.inputService = inputService;
|
|
35
|
+
this.moduleContainer = moduleContainer;
|
|
28
36
|
this.overlayDataRepository = overlayDataRepository;
|
|
29
37
|
this.resourceDataRepository = resourceDataRepository;
|
|
30
38
|
this.modelActions = [];
|
|
@@ -47,33 +55,80 @@ export class TransactionService {
|
|
|
47
55
|
// Only process the first diff, given all duplicate diffs are the same.
|
|
48
56
|
const diffToProcess = duplicateDiffs[0].diff;
|
|
49
57
|
for (const a of diff.actions) {
|
|
50
|
-
//
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
// Find moduleId.
|
|
59
|
+
let moduleId;
|
|
60
|
+
if (diff.node instanceof AOverlay) {
|
|
61
|
+
moduleId = this.inputService.getModuleIdFromOverlay(diff.node);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
moduleId = this.inputService.getModuleIdFromModel(diff.node);
|
|
65
|
+
}
|
|
66
|
+
// Resolve all keys of the module - inputs keys and nodes generated by the module keys.
|
|
67
|
+
const inputs = { inputs: {}, metadata: {}, models: {}, overlays: {}, resources: {} };
|
|
68
|
+
const inputKeys = this.moduleContainer.getModuleInstanceInputKeys(moduleId).map((i) => {
|
|
69
|
+
return `${moduleId}.input.${i}`;
|
|
58
70
|
});
|
|
71
|
+
const metadataKeys = this.inputService.getMetadataKeys(moduleId);
|
|
72
|
+
const nodeKeys = this.inputService.getAllNodeKeys(moduleId);
|
|
73
|
+
const allKeys = [...inputKeys, ...metadataKeys, ...nodeKeys];
|
|
74
|
+
for (const k of allKeys) {
|
|
75
|
+
const inputValue = this.inputService.resolve(k);
|
|
76
|
+
if (inputValue === undefined) {
|
|
77
|
+
throw new InputNotFoundTransactionError('No matching input found to process action!', a, diffToProcess, k);
|
|
78
|
+
}
|
|
79
|
+
const keyValue = k.split('.')[2];
|
|
80
|
+
if (k.startsWith(`${moduleId}.input`)) {
|
|
81
|
+
inputs.inputs[keyValue] = inputValue;
|
|
82
|
+
}
|
|
83
|
+
else if (k.startsWith(`${moduleId}.metadata`)) {
|
|
84
|
+
inputs.metadata[keyValue] = inputValue;
|
|
85
|
+
}
|
|
86
|
+
else if (k.startsWith(`${moduleId}.model`)) {
|
|
87
|
+
inputs.models[keyValue] = inputValue;
|
|
88
|
+
}
|
|
89
|
+
else if (k.startsWith(`${moduleId}.overlay`)) {
|
|
90
|
+
inputs.overlays[keyValue] = inputValue;
|
|
91
|
+
}
|
|
92
|
+
else if (k.startsWith(`${moduleId}.resource`)) {
|
|
93
|
+
inputs.resources[keyValue] = inputValue;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
59
96
|
// Apply all actions on the diff, then update diff metadata with inputs and outputs.
|
|
60
97
|
const outputs = await a.handle(diffToProcess, inputs, {});
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
98
|
+
for (const resource of Object.values(outputs)) {
|
|
99
|
+
let moduleId;
|
|
100
|
+
if (diffToProcess.node instanceof AOverlay) {
|
|
101
|
+
moduleId = this.inputService.getModuleIdFromOverlay(diffToProcess.node);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
moduleId = this.inputService.getModuleIdFromModel(diffToProcess.node);
|
|
105
|
+
}
|
|
106
|
+
// Set resource tags.
|
|
107
|
+
const resourceTags = this.inputService.resolve(`${moduleId}.tag.${resource.getContext()}`);
|
|
108
|
+
for (const [key, value] of Object.entries(resourceTags)) {
|
|
109
|
+
resource.tags[key] = value;
|
|
110
|
+
}
|
|
111
|
+
const previousResource = this.resourceDataRepository.getNewResourceByContext(resource.getContext());
|
|
112
|
+
if (previousResource) {
|
|
113
|
+
resource.merge(previousResource);
|
|
67
114
|
}
|
|
68
115
|
else {
|
|
69
116
|
this.resourceDataRepository.addNewResource(resource);
|
|
70
117
|
}
|
|
118
|
+
try {
|
|
119
|
+
this.inputService.registerResource(moduleId, resource);
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
if (!(error instanceof InputRegistrationError)) {
|
|
123
|
+
throw error;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
71
126
|
}
|
|
72
127
|
duplicateDiffs.forEach((d) => {
|
|
73
128
|
d.updateInputs(inputs);
|
|
74
129
|
d.updateOutputs(outputs);
|
|
75
130
|
});
|
|
76
|
-
|
|
131
|
+
this.eventService.emit(new ModelActionTransactionEvent(a.constructor.name));
|
|
77
132
|
}
|
|
78
133
|
// Include the diff to process in the list of diffs processed in the same level.
|
|
79
134
|
diffsProcessedInSameLevel.push(duplicateDiffs[0]);
|
|
@@ -103,28 +158,62 @@ export class TransactionService {
|
|
|
103
158
|
// Only process the first diff, given all duplicate diffs are the same.
|
|
104
159
|
const diffToProcess = duplicateDiffs[0].diff;
|
|
105
160
|
for (const a of diff.actions) {
|
|
161
|
+
this.eventService.emit(new ResourceActionInitiatedTransactionEvent(a.constructor.name, diff));
|
|
106
162
|
if (enableResourceCapture) {
|
|
107
|
-
const capture = this.captureService.getCapture(diff.node.
|
|
108
|
-
await a.mock(capture?.response
|
|
163
|
+
const capture = this.captureService.getCapture(diff.node.getContext());
|
|
164
|
+
await a.mock(diff, capture?.response || {});
|
|
109
165
|
await a.handle(diffToProcess);
|
|
110
166
|
}
|
|
111
167
|
else {
|
|
112
|
-
|
|
168
|
+
let actionTimeoutId;
|
|
169
|
+
try {
|
|
170
|
+
await Promise.race([
|
|
171
|
+
new Promise(async (resolve, reject) => {
|
|
172
|
+
try {
|
|
173
|
+
await a.handle(diffToProcess);
|
|
174
|
+
resolve();
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
reject(new ResourceActionExceptionTransactionError(error.message, error, diffToProcess, a.constructor.name));
|
|
178
|
+
}
|
|
179
|
+
}),
|
|
180
|
+
new Promise((_resolve, reject) => (actionTimeoutId = setTimeout(() => {
|
|
181
|
+
reject(new ResourceActionTimeoutTransactionError(`Resource action ${a.constructor.name} timed out after ${a.actionTimeoutInMs || 90000}ms!`, diffToProcess, a.constructor.name));
|
|
182
|
+
}, a.actionTimeoutInMs || 90000))),
|
|
183
|
+
]);
|
|
184
|
+
}
|
|
185
|
+
finally {
|
|
186
|
+
if (actionTimeoutId) {
|
|
187
|
+
clearTimeout(actionTimeoutId);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
113
190
|
}
|
|
114
191
|
// De-reference from actual resources.
|
|
115
|
-
const deReferenceResource = async (
|
|
116
|
-
return this.resourceDataRepository.
|
|
192
|
+
const deReferenceResource = async (context) => {
|
|
193
|
+
return this.resourceDataRepository.getActualResourceByContext(context);
|
|
117
194
|
};
|
|
118
195
|
// Incrementally apply diff inverse to the respective actual resource.
|
|
119
|
-
let actualResource = this.resourceDataRepository.
|
|
196
|
+
let actualResource = this.resourceDataRepository.getActualResourceByContext(diffToProcess.node.getContext());
|
|
120
197
|
if (!actualResource) {
|
|
121
198
|
actualResource = await AResource.cloneResource(diffToProcess.node, deReferenceResource);
|
|
122
199
|
this.resourceDataRepository.addActualResource(actualResource);
|
|
200
|
+
this.eventService.emit(new ResourceActionSummaryTransactionEvent(a.constructor.name, {
|
|
201
|
+
diff,
|
|
202
|
+
values: { current: actualResource.synth(), previous: {} },
|
|
203
|
+
}));
|
|
123
204
|
}
|
|
124
205
|
else {
|
|
206
|
+
const previousSynth = actualResource.synth();
|
|
125
207
|
await actualResource.diffInverse(diffToProcess, deReferenceResource);
|
|
208
|
+
this.eventService.emit(new ResourceActionSummaryTransactionEvent(a.constructor.name, {
|
|
209
|
+
diff,
|
|
210
|
+
values: {
|
|
211
|
+
current: actualResource.isMarkedDeleted() ? {} : actualResource.synth(),
|
|
212
|
+
previous: previousSynth,
|
|
213
|
+
},
|
|
214
|
+
}));
|
|
126
215
|
}
|
|
127
|
-
|
|
216
|
+
this.eventService.emit(new ResourceActionCompletedTransactionEvent(a.constructor.name, diff));
|
|
128
217
|
}
|
|
129
218
|
// Include the diff to process in the list of diffs processed in the same level.
|
|
130
219
|
diffsProcessedInSameLevel.push(duplicateDiffs[0]);
|
|
@@ -138,14 +227,19 @@ export class TransactionService {
|
|
|
138
227
|
}
|
|
139
228
|
return transaction;
|
|
140
229
|
}
|
|
230
|
+
getDiffsOfSameNode(diff, diffs, diffAction) {
|
|
231
|
+
return diffs.filter((d) => d.node.getContext() === diff.node.getContext() && d.action === diffAction);
|
|
232
|
+
}
|
|
141
233
|
getDuplicateDiffs(diff, diffs) {
|
|
142
234
|
return diffs.filter((d) => d.node.getContext() === diff.node.getContext() &&
|
|
143
235
|
d.field === diff.field &&
|
|
144
236
|
d.action === diff.action &&
|
|
145
|
-
d.value
|
|
237
|
+
DiffUtility.isObjectDeepEquals(d.value, diff.value));
|
|
146
238
|
}
|
|
147
239
|
getMatchingDiffs(diff, diffs) {
|
|
148
|
-
return diffs.filter((d) => d.node.getContext() === diff.node.getContext() &&
|
|
240
|
+
return diffs.filter((d) => d.node.getContext() === diff.node.getContext() &&
|
|
241
|
+
d.field === diff.field &&
|
|
242
|
+
DiffUtility.isObjectDeepEquals(d.value, diff.value));
|
|
149
243
|
}
|
|
150
244
|
/**
|
|
151
245
|
* Before assigning order to a diff, all its node's parent diffs must be processed.
|
|
@@ -154,7 +248,7 @@ export class TransactionService {
|
|
|
154
248
|
setApplyOrder(diff, diffs, seen = []) {
|
|
155
249
|
// Detect circular dependencies.
|
|
156
250
|
if (this.getDuplicateDiffs(diff, seen).length > 0) {
|
|
157
|
-
throw new
|
|
251
|
+
throw new TransactionError('Found circular dependencies!');
|
|
158
252
|
}
|
|
159
253
|
// Detect conflicting actions in transaction.
|
|
160
254
|
const matchingDiffs = this.getMatchingDiffs(diff, diffs);
|
|
@@ -162,10 +256,8 @@ export class TransactionService {
|
|
|
162
256
|
accumulator[currentValue.action] = true;
|
|
163
257
|
return accumulator;
|
|
164
258
|
}, {});
|
|
165
|
-
if (
|
|
166
|
-
(
|
|
167
|
-
(diffActions[DiffAction.DELETE] && diffActions[DiffAction.UPDATE])) {
|
|
168
|
-
throw new Error('Found conflicting actions in same transaction!');
|
|
259
|
+
if (diffActions[DiffAction.ADD] && diffActions[DiffAction.DELETE]) {
|
|
260
|
+
throw new TransactionError('Found conflicting actions in same transaction!');
|
|
169
261
|
}
|
|
170
262
|
// Skip processing diff that already has the applyOrder set.
|
|
171
263
|
if (diff.applyOrder >= 0) {
|
|
@@ -184,6 +276,22 @@ export class TransactionService {
|
|
|
184
276
|
dependencyApplyOrders.push(matchingParentDiff.applyOrder);
|
|
185
277
|
}
|
|
186
278
|
}
|
|
279
|
+
// Get diffs of same node.
|
|
280
|
+
// Process ADD before UPDATE, and UPDATE before DELETE.
|
|
281
|
+
if (diff.action === DiffAction.UPDATE) {
|
|
282
|
+
const diffsOfSameNodeWithAddAction = this.getDiffsOfSameNode(diff, diffs, DiffAction.ADD);
|
|
283
|
+
for (const sameNodeDiffWithAddAction of diffsOfSameNodeWithAddAction) {
|
|
284
|
+
this.setApplyOrder(sameNodeDiffWithAddAction, diffs, [...seen, diff]);
|
|
285
|
+
dependencyApplyOrders.push(sameNodeDiffWithAddAction.applyOrder);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
else if (diff.action === DiffAction.DELETE) {
|
|
289
|
+
const diffsOfSameNodeWithUpdateAction = this.getDiffsOfSameNode(diff, diffs, DiffAction.UPDATE);
|
|
290
|
+
for (const sameNodeDiffWithUpdateAction of diffsOfSameNodeWithUpdateAction) {
|
|
291
|
+
this.setApplyOrder(sameNodeDiffWithUpdateAction, diffs, [...seen, diff]);
|
|
292
|
+
dependencyApplyOrders.push(sameNodeDiffWithUpdateAction.applyOrder);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
187
295
|
diff.applyOrder = Math.max(...dependencyApplyOrders) + 1;
|
|
188
296
|
}
|
|
189
297
|
async *beginTransaction(diffs, { enableResourceCapture = false, yieldModelDiffs = false, yieldModelTransaction = false, yieldResourceDiffs = false, yieldResourceTransaction = false, } = {}) {
|
|
@@ -191,22 +299,24 @@ export class TransactionService {
|
|
|
191
299
|
diffs.push(...(await this.overlayDataRepository.diff()));
|
|
192
300
|
// Generate diff on models.
|
|
193
301
|
const modelDiffs = diffs.map((d) => {
|
|
194
|
-
if (d.node.NODE_TYPE === NodeType.OVERLAY) {
|
|
195
|
-
return new DiffMetadata(d, this.overlayActions.filter((a) => a.filter(d)));
|
|
302
|
+
if (d.node.constructor.NODE_TYPE === NodeType.OVERLAY) {
|
|
303
|
+
return new DiffMetadata(d, (this.overlayActions.find((a) => a.overlayClass === d.node.constructor)?.actions || []).filter((a) => a.filter(d)));
|
|
196
304
|
}
|
|
197
305
|
else {
|
|
198
|
-
return new DiffMetadata(d, this.modelActions.filter((a) => a.filter(d)));
|
|
306
|
+
return new DiffMetadata(d, (this.modelActions.find((a) => a.modelClass === d.node.constructor)?.actions || []).filter((a) => a.filter(d)));
|
|
199
307
|
}
|
|
200
308
|
});
|
|
201
309
|
// Set apply order on model diffs.
|
|
202
310
|
for (const diff of modelDiffs) {
|
|
203
311
|
this.setApplyOrder(diff, modelDiffs);
|
|
204
312
|
}
|
|
313
|
+
this.eventService.emit(new ModelDiffsTransactionEvent(undefined, [modelDiffs]));
|
|
205
314
|
if (yieldModelDiffs) {
|
|
206
315
|
yield [modelDiffs];
|
|
207
316
|
}
|
|
208
317
|
// Apply model diffs.
|
|
209
318
|
const modelTransaction = await this.applyModels(modelDiffs);
|
|
319
|
+
this.eventService.emit(new ModelTransactionTransactionEvent(undefined, modelTransaction));
|
|
210
320
|
if (yieldModelTransaction) {
|
|
211
321
|
yield modelTransaction;
|
|
212
322
|
}
|
|
@@ -220,7 +330,7 @@ export class TransactionService {
|
|
|
220
330
|
if (!dirtyDiffs.some((d) => d.node.getContext() === newDiff.node.getContext() &&
|
|
221
331
|
d.action === newDiff.action &&
|
|
222
332
|
d.field === newDiff.field &&
|
|
223
|
-
d.value
|
|
333
|
+
DiffUtility.isObjectDeepEquals(d.value, newDiff.value))) {
|
|
224
334
|
newDiffs.splice(i, 1);
|
|
225
335
|
}
|
|
226
336
|
}
|
|
@@ -232,22 +342,23 @@ export class TransactionService {
|
|
|
232
342
|
if (newDiffs.some((d) => d.node.getContext() === dirtyDiff.node.getContext() &&
|
|
233
343
|
d.action === dirtyDiff.action &&
|
|
234
344
|
d.field === dirtyDiff.field &&
|
|
235
|
-
d.value
|
|
345
|
+
DiffUtility.isObjectDeepEquals(d.value, dirtyDiff.value))) {
|
|
236
346
|
dirtyDiffs.splice(i, 1);
|
|
237
347
|
}
|
|
238
348
|
}
|
|
239
349
|
// Generate diff on resources.
|
|
240
|
-
const resourceDiffs = newDiffs.map((d) => new DiffMetadata(d, this.resourceActions.filter((a) => a.filter(d))));
|
|
350
|
+
const resourceDiffs = newDiffs.map((d) => new DiffMetadata(d, (this.resourceActions.find((a) => a.resourceClass === d.node.constructor)?.actions || []).filter((a) => a.filter(d))));
|
|
241
351
|
// Set apply order on resource diffs.
|
|
242
352
|
for (const diff of resourceDiffs) {
|
|
243
353
|
this.setApplyOrder(diff, resourceDiffs);
|
|
244
354
|
}
|
|
245
355
|
// Generate diff on dirty resources.
|
|
246
|
-
const dirtyResourceDiffs = dirtyDiffs.map((d) => new DiffMetadata(d, this.resourceActions.filter((a) => a.filter(d))));
|
|
356
|
+
const dirtyResourceDiffs = dirtyDiffs.map((d) => new DiffMetadata(d, (this.resourceActions.find((a) => a.resourceClass === d.node.constructor)?.actions || []).filter((a) => a.filter(d))));
|
|
247
357
|
// Set apply order on dirty resource diffs.
|
|
248
358
|
for (const diff of dirtyResourceDiffs) {
|
|
249
359
|
this.setApplyOrder(diff, dirtyResourceDiffs);
|
|
250
360
|
}
|
|
361
|
+
this.eventService.emit(new ResourceDiffsTransactionEvent(undefined, [[resourceDiffs], [dirtyResourceDiffs]]));
|
|
251
362
|
if (yieldResourceDiffs) {
|
|
252
363
|
yield [resourceDiffs, dirtyResourceDiffs];
|
|
253
364
|
}
|
|
@@ -259,65 +370,103 @@ export class TransactionService {
|
|
|
259
370
|
const dirtyResourceTransaction = await this.applyResources(dirtyResourceDiffs, {
|
|
260
371
|
enableResourceCapture,
|
|
261
372
|
});
|
|
373
|
+
this.eventService.emit(new ResourceTransactionTransactionEvent(undefined, [resourceTransaction, dirtyResourceTransaction]));
|
|
262
374
|
if (yieldResourceTransaction) {
|
|
263
375
|
yield [...resourceTransaction, ...dirtyResourceTransaction];
|
|
264
376
|
}
|
|
265
377
|
return modelTransaction;
|
|
266
378
|
}
|
|
267
|
-
registerModelActions(actions) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
379
|
+
registerModelActions(forModel, actions) {
|
|
380
|
+
const modelActions = this.modelActions.find((a) => a.modelClass === forModel);
|
|
381
|
+
if (!modelActions) {
|
|
382
|
+
this.modelActions.push({ actions: actions, modelClass: forModel });
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
for (const action of actions) {
|
|
386
|
+
if (modelActions.actions.find((a) => a.constructor.name === action.constructor.name)) {
|
|
387
|
+
throw new Error(`Action "${action.constructor.name}" already registered for model "${forModel.name}"!`);
|
|
388
|
+
}
|
|
389
|
+
modelActions.actions.push(action);
|
|
271
390
|
}
|
|
272
391
|
}
|
|
273
392
|
}
|
|
274
|
-
registerOverlayActions(actions) {
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
393
|
+
registerOverlayActions(forOverlay, actions) {
|
|
394
|
+
const overlayActions = this.overlayActions.find((a) => a.overlayClass === forOverlay);
|
|
395
|
+
if (!overlayActions) {
|
|
396
|
+
this.overlayActions.push({ actions: actions, overlayClass: forOverlay });
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
for (const action of actions) {
|
|
400
|
+
if (overlayActions.actions.find((a) => a.constructor.name === action.constructor.name)) {
|
|
401
|
+
throw new Error(`Action "${action.constructor.name}" already registered for overlay "${forOverlay.name}"!`);
|
|
402
|
+
}
|
|
403
|
+
overlayActions.actions.push(action);
|
|
278
404
|
}
|
|
279
405
|
}
|
|
280
406
|
}
|
|
281
|
-
registerResourceActions(actions) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
407
|
+
registerResourceActions(forResource, actions) {
|
|
408
|
+
const resourceActions = this.resourceActions.find((a) => a.resourceClass === forResource);
|
|
409
|
+
if (!resourceActions) {
|
|
410
|
+
this.resourceActions.push({ actions: actions, resourceClass: forResource });
|
|
411
|
+
}
|
|
412
|
+
else {
|
|
413
|
+
for (const action of actions) {
|
|
414
|
+
if (resourceActions.actions.find((a) => a.constructor.name === action.constructor.name)) {
|
|
415
|
+
throw new Error(`Action "${action.constructor.name}" already registered for resource "${forResource.name}"!`);
|
|
416
|
+
}
|
|
417
|
+
resourceActions.actions.push(action);
|
|
285
418
|
}
|
|
286
419
|
}
|
|
287
420
|
}
|
|
421
|
+
unregisterModelActions(forModel) {
|
|
422
|
+
const modelActions = this.modelActions.find((a) => a.modelClass === forModel);
|
|
423
|
+
if (!modelActions) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
modelActions.actions = [];
|
|
427
|
+
}
|
|
428
|
+
unregisterOverlayActions(forOverlay) {
|
|
429
|
+
const overlayActions = this.overlayActions.find((a) => a.overlayClass === forOverlay);
|
|
430
|
+
if (!overlayActions) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
overlayActions.actions = [];
|
|
434
|
+
}
|
|
288
435
|
}
|
|
289
436
|
__decorate([
|
|
290
437
|
EventSource(ModelActionRegistrationEvent),
|
|
291
438
|
__metadata("design:type", Function),
|
|
292
|
-
__metadata("design:paramtypes", [Array]),
|
|
439
|
+
__metadata("design:paramtypes", [Object, Array]),
|
|
293
440
|
__metadata("design:returntype", void 0)
|
|
294
441
|
], TransactionService.prototype, "registerModelActions", null);
|
|
295
442
|
__decorate([
|
|
296
443
|
EventSource(ModelActionRegistrationEvent),
|
|
297
444
|
__metadata("design:type", Function),
|
|
298
|
-
__metadata("design:paramtypes", [Array]),
|
|
445
|
+
__metadata("design:paramtypes", [Object, Array]),
|
|
299
446
|
__metadata("design:returntype", void 0)
|
|
300
447
|
], TransactionService.prototype, "registerOverlayActions", null);
|
|
301
448
|
__decorate([
|
|
302
449
|
EventSource(ResourceActionRegistrationEvent),
|
|
303
450
|
__metadata("design:type", Function),
|
|
304
|
-
__metadata("design:paramtypes", [Array]),
|
|
451
|
+
__metadata("design:paramtypes", [Object, Array]),
|
|
305
452
|
__metadata("design:returntype", void 0)
|
|
306
453
|
], TransactionService.prototype, "registerResourceActions", null);
|
|
454
|
+
/**
|
|
455
|
+
* @internal
|
|
456
|
+
*/
|
|
307
457
|
let TransactionServiceFactory = class TransactionServiceFactory {
|
|
308
|
-
static async create(
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
458
|
+
static async create() {
|
|
459
|
+
const container = Container.getInstance();
|
|
460
|
+
const [captureService, eventService, inputService, moduleContainer, overlayDataRepository, resourceDataRepository] = await Promise.all([
|
|
461
|
+
container.get(CaptureService),
|
|
462
|
+
container.get(EventService),
|
|
463
|
+
container.get(InputService),
|
|
464
|
+
container.get(ModuleContainer),
|
|
465
|
+
container.get(OverlayDataRepository),
|
|
466
|
+
container.get(ResourceDataRepository),
|
|
314
467
|
]);
|
|
315
468
|
if (!this.instance) {
|
|
316
|
-
this.instance = new TransactionService(captureService, inputService, overlayDataRepository, resourceDataRepository);
|
|
317
|
-
}
|
|
318
|
-
if (forceNew) {
|
|
319
|
-
const newInstance = new TransactionService(captureService, inputService, overlayDataRepository, resourceDataRepository);
|
|
320
|
-
Object.keys(this.instance).forEach((key) => (this.instance[key] = newInstance[key]));
|
|
469
|
+
this.instance = new TransactionService(captureService, eventService, inputService, moduleContainer, overlayDataRepository, resourceDataRepository);
|
|
321
470
|
}
|
|
322
471
|
return this.instance;
|
|
323
472
|
}
|