@quadnix/octo 0.0.20 → 0.0.21
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 +5 -0
- package/dist/app.type.js +6 -0
- package/dist/app.type.js.map +1 -1
- package/dist/decorators/action.decorator.d.ts +17 -0
- package/dist/decorators/action.decorator.js +23 -0
- package/dist/decorators/action.decorator.js.map +1 -1
- package/dist/decorators/anchor.decorator.d.ts +13 -0
- package/dist/decorators/anchor.decorator.js +13 -0
- package/dist/decorators/anchor.decorator.js.map +1 -1
- package/dist/decorators/container.d.ts +60 -0
- package/dist/decorators/container.js +63 -2
- package/dist/decorators/container.js.map +1 -1
- package/dist/decorators/enable-hook.decorator.d.ts +14 -0
- package/dist/decorators/enable-hook.decorator.js +14 -0
- package/dist/decorators/enable-hook.decorator.js.map +1 -1
- package/dist/decorators/event-source.decorator.d.ts +15 -0
- package/dist/decorators/event-source.decorator.js +15 -0
- package/dist/decorators/event-source.decorator.js.map +1 -1
- package/dist/decorators/factory.decorator.d.ts +30 -0
- package/dist/decorators/factory.decorator.js +30 -0
- package/dist/decorators/factory.decorator.js.map +1 -1
- package/dist/decorators/model.decorator.d.ts +13 -0
- package/dist/decorators/model.decorator.js +13 -0
- package/dist/decorators/model.decorator.js.map +1 -1
- package/dist/decorators/module.decorator.d.ts +52 -0
- package/dist/decorators/module.decorator.js +60 -1
- package/dist/decorators/module.decorator.js.map +1 -1
- package/dist/decorators/on-event.decorator.d.ts +17 -0
- package/dist/decorators/on-event.decorator.js +17 -0
- package/dist/decorators/on-event.decorator.js.map +1 -1
- package/dist/decorators/overlay.decorator.d.ts +13 -0
- package/dist/decorators/overlay.decorator.js +13 -0
- package/dist/decorators/overlay.decorator.js.map +1 -1
- package/dist/decorators/resource.decorator.d.ts +13 -0
- package/dist/decorators/resource.decorator.js +13 -0
- package/dist/decorators/resource.decorator.js.map +1 -1
- package/dist/decorators/test-container.d.ts +52 -0
- package/dist/decorators/test-container.js +54 -2
- package/dist/decorators/test-container.js.map +1 -1
- package/dist/decorators/validate.decorator.d.ts +9 -0
- package/dist/decorators/validate.decorator.js +23 -0
- package/dist/decorators/validate.decorator.js.map +1 -0
- package/dist/events/error.event.d.ts +30 -0
- package/dist/events/error.event.js +30 -0
- package/dist/events/error.event.js.map +1 -1
- package/dist/events/event.model.d.ts +27 -0
- package/dist/events/event.model.js +27 -3
- package/dist/events/event.model.js.map +1 -1
- package/dist/events/hook.event.d.ts +167 -0
- package/dist/events/hook.event.js +167 -0
- package/dist/events/hook.event.js.map +1 -1
- package/dist/events/module.event.d.ts +12 -0
- package/dist/events/module.event.js +12 -0
- package/dist/events/module.event.js.map +1 -1
- package/dist/events/registration.event.d.ts +90 -0
- package/dist/events/registration.event.js +90 -0
- package/dist/events/registration.event.js.map +1 -1
- package/dist/events/serialization.event.d.ts +61 -0
- package/dist/events/serialization.event.js +61 -0
- package/dist/events/serialization.event.js.map +1 -1
- package/dist/events/transaction.event.d.ts +41 -0
- package/dist/events/transaction.event.js +41 -0
- package/dist/events/transaction.event.js.map +1 -1
- package/dist/functions/dependency/dependency.js +1 -8
- package/dist/functions/dependency/dependency.js.map +1 -1
- package/dist/functions/diff/diff-metadata.d.ts +3 -0
- package/dist/functions/diff/diff-metadata.js +5 -10
- package/dist/functions/diff/diff-metadata.js.map +1 -1
- package/dist/functions/diff/diff.d.ts +3 -0
- package/dist/functions/diff/diff.js +3 -4
- package/dist/functions/diff/diff.js.map +1 -1
- package/dist/functions/diff/diff.utility.d.ts +32 -0
- package/dist/functions/diff/diff.utility.js +49 -0
- package/dist/functions/diff/diff.utility.js.map +1 -1
- package/dist/functions/hook/commit.hook.js +6 -3
- package/dist/functions/hook/commit.hook.js.map +1 -1
- package/dist/functions/hook/model-action.hook.js +6 -3
- package/dist/functions/hook/model-action.hook.js.map +1 -1
- package/dist/functions/hook/resource-action.hook.js +6 -3
- package/dist/functions/hook/resource-action.hook.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +4 -1
- package/dist/main.js +27 -15
- package/dist/main.js.map +1 -1
- package/dist/models/app/app.interface.d.ts +5 -0
- package/dist/models/app/app.model.d.ts +29 -0
- package/dist/models/app/app.model.js +40 -3
- package/dist/models/app/app.model.js.map +1 -1
- package/dist/models/deployment/deployment.interface.d.ts +5 -0
- package/dist/models/deployment/deployment.model.d.ts +15 -0
- package/dist/models/deployment/deployment.model.js +20 -3
- package/dist/models/deployment/deployment.model.js.map +1 -1
- package/dist/models/environment/environment.interface.d.ts +5 -0
- package/dist/models/environment/environment.model.d.ts +18 -0
- package/dist/models/environment/environment.model.js +33 -4
- package/dist/models/environment/environment.model.js.map +1 -1
- package/dist/models/execution/execution.interface.d.ts +5 -0
- package/dist/models/execution/execution.model.d.ts +23 -0
- package/dist/models/execution/execution.model.js +39 -2
- package/dist/models/execution/execution.model.js.map +1 -1
- package/dist/models/image/image.interface.d.ts +5 -0
- package/dist/models/image/image.model.d.ts +35 -0
- package/dist/models/image/image.model.js +25 -6
- package/dist/models/image/image.model.js.map +1 -1
- package/dist/models/model-action.interface.d.ts +21 -0
- package/dist/models/model.abstract.d.ts +265 -0
- package/dist/models/model.abstract.js +274 -5
- package/dist/models/model.abstract.js.map +1 -1
- package/dist/models/model.interface.d.ts +25 -0
- package/dist/models/pipeline/pipeline.interface.d.ts +5 -0
- package/dist/models/pipeline/pipeline.model.d.ts +15 -0
- package/dist/models/pipeline/pipeline.model.js +25 -4
- package/dist/models/pipeline/pipeline.model.js.map +1 -1
- package/dist/models/region/region.interface.d.ts +5 -0
- package/dist/models/region/region.model.d.ts +18 -0
- package/dist/models/region/region.model.js +29 -3
- package/dist/models/region/region.model.js.map +1 -1
- package/dist/models/server/server.interface.d.ts +5 -0
- package/dist/models/server/server.model.d.ts +17 -0
- package/dist/models/server/server.model.js +24 -3
- package/dist/models/server/server.model.js.map +1 -1
- package/dist/models/service/service.interface.d.ts +5 -0
- package/dist/models/service/service.model.d.ts +15 -0
- package/dist/models/service/service.model.js +19 -2
- package/dist/models/service/service.model.js.map +1 -1
- package/dist/models/subnet/subnet.interface.d.ts +5 -0
- package/dist/models/subnet/subnet.model.d.ts +48 -0
- package/dist/models/subnet/subnet.model.js +52 -7
- package/dist/models/subnet/subnet.model.js.map +1 -1
- package/dist/modules/module.container.d.ts +2 -0
- package/dist/modules/module.container.js +17 -8
- package/dist/modules/module.container.js.map +1 -1
- package/dist/modules/test-module.container.d.ts +2 -2
- package/dist/modules/test-module.container.js +10 -7
- package/dist/modules/test-module.container.js.map +1 -1
- package/dist/overlays/anchor.abstract.js +0 -3
- package/dist/overlays/anchor.abstract.js.map +1 -1
- package/dist/overlays/overlay-data.repository.js +0 -3
- package/dist/overlays/overlay-data.repository.js.map +1 -1
- package/dist/overlays/overlay.abstract.js +3 -3
- package/dist/overlays/overlay.abstract.js.map +1 -1
- package/dist/overlays/overlay.service.js +0 -2
- package/dist/overlays/overlay.service.js.map +1 -1
- package/dist/resources/resource-data.repository.js +6 -3
- package/dist/resources/resource-data.repository.js.map +1 -1
- package/dist/resources/resource.abstract.js +4 -4
- package/dist/resources/resource.abstract.js.map +1 -1
- package/dist/resources/shared-resource.abstract.js +4 -1
- package/dist/resources/shared-resource.abstract.js.map +1 -1
- package/dist/services/capture/capture.service.js +3 -2
- package/dist/services/capture/capture.service.js.map +1 -1
- package/dist/services/event/event.service.js +8 -5
- package/dist/services/event/event.service.js.map +1 -1
- package/dist/services/input/input.service.js +1 -3
- package/dist/services/input/input.service.js.map +1 -1
- package/dist/services/serialization/model/model-serialization.service.js +10 -4
- package/dist/services/serialization/model/model-serialization.service.js.map +1 -1
- package/dist/services/serialization/resource/resource-serialization.service.js +17 -4
- package/dist/services/serialization/resource/resource-serialization.service.js.map +1 -1
- package/dist/services/state-management/local.state-provider.js +0 -1
- package/dist/services/state-management/local.state-provider.js.map +1 -1
- package/dist/services/state-management/state-management.service.js +0 -2
- package/dist/services/state-management/state-management.service.js.map +1 -1
- package/dist/services/state-management/test.state-provider.js +3 -1
- package/dist/services/state-management/test.state-provider.js.map +1 -1
- package/dist/services/transaction/transaction.service.d.ts +4 -0
- package/dist/services/transaction/transaction.service.js +40 -8
- package/dist/services/transaction/transaction.service.js.map +1 -1
- package/dist/services/validation/validation.service.d.ts +19 -0
- package/dist/services/validation/validation.service.js +66 -0
- package/dist/services/validation/validation.service.js.map +1 -0
- package/dist/utilities/object/object.utility.js +1 -0
- package/dist/utilities/object/object.utility.js.map +1 -1
- package/dist/utilities/validation/validation.utility.d.ts +5 -0
- package/dist/utilities/validation/validation.utility.js +12 -0
- package/dist/utilities/validation/validation.utility.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,11 +1,72 @@
|
|
|
1
1
|
import { Event } from './event.model.js';
|
|
2
|
+
/**
|
|
3
|
+
* The SerializationEvent class is the superclass for all events in relation to serialization and deserialization.
|
|
4
|
+
*
|
|
5
|
+
* :::warning Warning
|
|
6
|
+
* It is not a good practice to create an event from this class directly,
|
|
7
|
+
* but should rather create one from one of the subclasses.
|
|
8
|
+
* This promotes a more accurate classification of events.
|
|
9
|
+
* :::
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const myEvent = new SerializationEvent();
|
|
14
|
+
* EventService.getInstance().emit(myEvent);
|
|
15
|
+
* ```
|
|
16
|
+
* @group Events
|
|
17
|
+
* @returns The Event instance.
|
|
18
|
+
*/
|
|
2
19
|
export declare class SerializationEvent extends Event<void> {
|
|
3
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* This event is emitted when models are deserialized from serialized output.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const myEvent = new ModelDeserializedEvent();
|
|
27
|
+
* EventService.getInstance().emit(myEvent);
|
|
28
|
+
* ```
|
|
29
|
+
* @group Events
|
|
30
|
+
* @returns The Event instance.
|
|
31
|
+
*/
|
|
4
32
|
export declare class ModelDeserializedEvent extends SerializationEvent {
|
|
5
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* This event is emitted when models are serialized to an output.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const myEvent = new ModelSerializedEvent();
|
|
40
|
+
* EventService.getInstance().emit(myEvent);
|
|
41
|
+
* ```
|
|
42
|
+
* @group Events
|
|
43
|
+
* @returns The Event instance.
|
|
44
|
+
*/
|
|
6
45
|
export declare class ModelSerializedEvent extends SerializationEvent {
|
|
7
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* This event is emitted when resources are deserialized from serialized output.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const myEvent = new ResourceDeserializedEvent();
|
|
53
|
+
* EventService.getInstance().emit(myEvent);
|
|
54
|
+
* ```
|
|
55
|
+
* @group Events
|
|
56
|
+
* @returns The Event instance.
|
|
57
|
+
*/
|
|
8
58
|
export declare class ResourceDeserializedEvent extends SerializationEvent {
|
|
9
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* This event is emitted when resources are serialized to an output.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const myEvent = new ResourceSerializedEvent();
|
|
66
|
+
* EventService.getInstance().emit(myEvent);
|
|
67
|
+
* ```
|
|
68
|
+
* @group Events
|
|
69
|
+
* @returns The Event instance.
|
|
70
|
+
*/
|
|
10
71
|
export declare class ResourceSerializedEvent extends SerializationEvent {
|
|
11
72
|
}
|
|
@@ -1,12 +1,73 @@
|
|
|
1
1
|
import { Event } from './event.model.js';
|
|
2
|
+
/**
|
|
3
|
+
* The SerializationEvent class is the superclass for all events in relation to serialization and deserialization.
|
|
4
|
+
*
|
|
5
|
+
* :::warning Warning
|
|
6
|
+
* It is not a good practice to create an event from this class directly,
|
|
7
|
+
* but should rather create one from one of the subclasses.
|
|
8
|
+
* This promotes a more accurate classification of events.
|
|
9
|
+
* :::
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const myEvent = new SerializationEvent();
|
|
14
|
+
* EventService.getInstance().emit(myEvent);
|
|
15
|
+
* ```
|
|
16
|
+
* @group Events
|
|
17
|
+
* @returns The Event instance.
|
|
18
|
+
*/
|
|
2
19
|
export class SerializationEvent extends Event {
|
|
3
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* This event is emitted when models are deserialized from serialized output.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const myEvent = new ModelDeserializedEvent();
|
|
27
|
+
* EventService.getInstance().emit(myEvent);
|
|
28
|
+
* ```
|
|
29
|
+
* @group Events
|
|
30
|
+
* @returns The Event instance.
|
|
31
|
+
*/
|
|
4
32
|
export class ModelDeserializedEvent extends SerializationEvent {
|
|
5
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* This event is emitted when models are serialized to an output.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* const myEvent = new ModelSerializedEvent();
|
|
40
|
+
* EventService.getInstance().emit(myEvent);
|
|
41
|
+
* ```
|
|
42
|
+
* @group Events
|
|
43
|
+
* @returns The Event instance.
|
|
44
|
+
*/
|
|
6
45
|
export class ModelSerializedEvent extends SerializationEvent {
|
|
7
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* This event is emitted when resources are deserialized from serialized output.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const myEvent = new ResourceDeserializedEvent();
|
|
53
|
+
* EventService.getInstance().emit(myEvent);
|
|
54
|
+
* ```
|
|
55
|
+
* @group Events
|
|
56
|
+
* @returns The Event instance.
|
|
57
|
+
*/
|
|
8
58
|
export class ResourceDeserializedEvent extends SerializationEvent {
|
|
9
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* This event is emitted when resources are serialized to an output.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* const myEvent = new ResourceSerializedEvent();
|
|
66
|
+
* EventService.getInstance().emit(myEvent);
|
|
67
|
+
* ```
|
|
68
|
+
* @group Events
|
|
69
|
+
* @returns The Event instance.
|
|
70
|
+
*/
|
|
10
71
|
export class ResourceSerializedEvent extends SerializationEvent {
|
|
11
72
|
}
|
|
12
73
|
//# sourceMappingURL=serialization.event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serialization.event.js","sourceRoot":"","sources":["../../src/events/serialization.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,OAAO,kBAAmB,SAAQ,KAAW;CAAG;AAEtD,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;CAAG;AAEjE,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;CAAG;AAE/D,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;CAAG;AAEpE,MAAM,OAAO,uBAAwB,SAAQ,kBAAkB;CAAG"}
|
|
1
|
+
{"version":3,"file":"serialization.event.js","sourceRoot":"","sources":["../../src/events/serialization.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,kBAAmB,SAAQ,KAAW;CAAG;AAEtD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;CAAG;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,oBAAqB,SAAQ,kBAAkB;CAAG;AAE/D;;;;;;;;;;GAUG;AACH,MAAM,OAAO,yBAA0B,SAAQ,kBAAkB;CAAG;AAEpE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,uBAAwB,SAAQ,kBAAkB;CAAG"}
|
|
@@ -1,7 +1,48 @@
|
|
|
1
1
|
import { Event } from './event.model.js';
|
|
2
|
+
/**
|
|
3
|
+
* The TransactionEvent class is the superclass for all events in relation to transactions.
|
|
4
|
+
* A transaction processes actions generated from model and resource diffs.
|
|
5
|
+
* Thus, the events are usually in relation with these actions.
|
|
6
|
+
*
|
|
7
|
+
* :::warning Warning
|
|
8
|
+
* It is not a good practice to create an event from this class directly,
|
|
9
|
+
* but should rather create one from one of the subclasses.
|
|
10
|
+
* This promotes a more accurate classification of events.
|
|
11
|
+
* :::
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const myEvent = new TransactionEvent('MyActionName');
|
|
16
|
+
* EventService.getInstance().emit(myEvent);
|
|
17
|
+
* ```
|
|
18
|
+
* @group Events
|
|
19
|
+
* @returns The Event instance.
|
|
20
|
+
*/
|
|
2
21
|
export declare class TransactionEvent extends Event<string> {
|
|
3
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* This event is emitted when a model action is done executing.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const myEvent = new ModelActionTransactionEvent('MyActionName');
|
|
29
|
+
* EventService.getInstance().emit(myEvent);
|
|
30
|
+
* ```
|
|
31
|
+
* @group Events
|
|
32
|
+
* @returns The Event instance.
|
|
33
|
+
*/
|
|
4
34
|
export declare class ModelActionTransactionEvent extends TransactionEvent {
|
|
5
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* This event is emitted when a resource action is done executing.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const myEvent = new ResourceActionTransactionEvent('MyActionName');
|
|
42
|
+
* EventService.getInstance().emit(myEvent);
|
|
43
|
+
* ```
|
|
44
|
+
* @group Events
|
|
45
|
+
* @returns The Event instance.
|
|
46
|
+
*/
|
|
6
47
|
export declare class ResourceActionTransactionEvent extends TransactionEvent {
|
|
7
48
|
}
|
|
@@ -1,8 +1,49 @@
|
|
|
1
1
|
import { Event } from './event.model.js';
|
|
2
|
+
/**
|
|
3
|
+
* The TransactionEvent class is the superclass for all events in relation to transactions.
|
|
4
|
+
* A transaction processes actions generated from model and resource diffs.
|
|
5
|
+
* Thus, the events are usually in relation with these actions.
|
|
6
|
+
*
|
|
7
|
+
* :::warning Warning
|
|
8
|
+
* It is not a good practice to create an event from this class directly,
|
|
9
|
+
* but should rather create one from one of the subclasses.
|
|
10
|
+
* This promotes a more accurate classification of events.
|
|
11
|
+
* :::
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const myEvent = new TransactionEvent('MyActionName');
|
|
16
|
+
* EventService.getInstance().emit(myEvent);
|
|
17
|
+
* ```
|
|
18
|
+
* @group Events
|
|
19
|
+
* @returns The Event instance.
|
|
20
|
+
*/
|
|
2
21
|
export class TransactionEvent extends Event {
|
|
3
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* This event is emitted when a model action is done executing.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const myEvent = new ModelActionTransactionEvent('MyActionName');
|
|
29
|
+
* EventService.getInstance().emit(myEvent);
|
|
30
|
+
* ```
|
|
31
|
+
* @group Events
|
|
32
|
+
* @returns The Event instance.
|
|
33
|
+
*/
|
|
4
34
|
export class ModelActionTransactionEvent extends TransactionEvent {
|
|
5
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* This event is emitted when a resource action is done executing.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const myEvent = new ResourceActionTransactionEvent('MyActionName');
|
|
42
|
+
* EventService.getInstance().emit(myEvent);
|
|
43
|
+
* ```
|
|
44
|
+
* @group Events
|
|
45
|
+
* @returns The Event instance.
|
|
46
|
+
*/
|
|
6
47
|
export class ResourceActionTransactionEvent extends TransactionEvent {
|
|
7
48
|
}
|
|
8
49
|
//# sourceMappingURL=transaction.event.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.event.js","sourceRoot":"","sources":["../../src/events/transaction.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,MAAM,OAAO,gBAAiB,SAAQ,KAAa;CAAG;AAEtD,MAAM,OAAO,2BAA4B,SAAQ,gBAAgB;CAAG;AAEpE,MAAM,OAAO,8BAA+B,SAAQ,gBAAgB;CAAG"}
|
|
1
|
+
{"version":3,"file":"transaction.event.js","sourceRoot":"","sources":["../../src/events/transaction.event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAa;CAAG;AAEtD;;;;;;;;;;GAUG;AACH,MAAM,OAAO,2BAA4B,SAAQ,gBAAgB;CAAG;AAEpE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,8BAA+B,SAAQ,gBAAgB;CAAG"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
class DependencyBehavior {
|
|
2
|
-
forAction;
|
|
3
|
-
onAction;
|
|
4
|
-
onField;
|
|
5
|
-
toField;
|
|
6
2
|
constructor(onField, onAction, toField, forAction) {
|
|
7
3
|
this.onField = onField;
|
|
8
4
|
this.onAction = onAction;
|
|
@@ -16,11 +12,8 @@ export var DependencyRelationship;
|
|
|
16
12
|
DependencyRelationship["PARENT"] = "parent";
|
|
17
13
|
})(DependencyRelationship || (DependencyRelationship = {}));
|
|
18
14
|
export class Dependency {
|
|
19
|
-
behaviors = [];
|
|
20
|
-
from;
|
|
21
|
-
relationship;
|
|
22
|
-
to;
|
|
23
15
|
constructor(from, to) {
|
|
16
|
+
this.behaviors = [];
|
|
24
17
|
this.from = from;
|
|
25
18
|
this.to = to;
|
|
26
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependency.js","sourceRoot":"","sources":["../../../src/functions/dependency/dependency.ts"],"names":[],"mappings":"AAGA,MAAM,kBAAkB;
|
|
1
|
+
{"version":3,"file":"dependency.js","sourceRoot":"","sources":["../../../src/functions/dependency/dependency.ts"],"names":[],"mappings":"AAGA,MAAM,kBAAkB;IAStB,YAAY,OAAe,EAAE,QAAoB,EAAE,OAAe,EAAE,SAAqB;QACvF,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF;AAED,MAAM,CAAN,IAAY,sBAGX;AAHD,WAAY,sBAAsB;IAChC,yCAAe,CAAA;IACf,2CAAiB,CAAA;AACnB,CAAC,EAHW,sBAAsB,KAAtB,sBAAsB,QAGjC;AAqBD,MAAM,OAAO,UAAU;IASrB,YAAY,IAAkB,EAAE,EAAgB;QAR/B,cAAS,GAAyB,EAAE,CAAC;QASpD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,CAAC;IAEO,gBAAgB,CAAC,OAAe,EAAE,QAAoB,EAAE,OAAe,EAAE,SAAqB;QACpG,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAC7B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,OAAO,KAAK,OAAO,IAAI,CAAC,CAAC,SAAS,KAAK,SAAS,CAC9G,CAAC;IACJ,CAAC;IAED,WAAW,CAAC,OAAe,EAAE,QAAoB,EAAE,OAAe,EAAE,SAAqB;QACvF,IAAI,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACxE,IAAI,CAAC,SAAS,CAAC,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E,CAAC,CAAC,OAAO;gBAClB,OAAO,EAAE,CAAC,CAAC,OAAO;aACnB,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,SAAS;YACT,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YAC5B,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC7B,CAAC,CAAC;oBACE,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;oBAClC,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,OAAO;oBAClC,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,IAAI;iBAC7B;gBACH,CAAC,CAAC,SAAS;YACb,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE;SACzB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,IAAkB,EAAE,EAAgB,EAAE,UAAuB;QAC1E,MAAM,aAAa,GAAG,IAAI,UAAU,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAE/C,UAAU,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;YACjC,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,IAAI,UAAU,CAAC,YAAY,EAAE,CAAC;YAC5B,aAAa,CAAC,YAAY,GAAG,EAAE,GAAG,UAAU,CAAC,YAAY,EAAE,CAAC;QAC9D,CAAC;QAED,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -14,6 +14,9 @@ export declare class DiffMetadata {
|
|
|
14
14
|
readonly inputs: ActionInputs;
|
|
15
15
|
readonly outputs: ActionOutputs;
|
|
16
16
|
constructor(diff: Diff, actions: IModelAction[] | IResourceAction[]);
|
|
17
|
+
/**
|
|
18
|
+
* Overrides JSON.serialize() to output a more succinct model of diff-metadata.
|
|
19
|
+
*/
|
|
17
20
|
toJSON(): ReturnType<Diff['toJSON']>;
|
|
18
21
|
updateInputs(inputs: ActionInputs): void;
|
|
19
22
|
updateOutputs(outputs: ActionOutputs): void;
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
export class DiffMetadata {
|
|
2
|
-
actions;
|
|
3
|
-
applied;
|
|
4
|
-
applyOrder;
|
|
5
|
-
diff;
|
|
6
|
-
action;
|
|
7
|
-
field;
|
|
8
|
-
model;
|
|
9
|
-
value;
|
|
10
|
-
inputs = {};
|
|
11
|
-
outputs = {};
|
|
12
2
|
constructor(diff, actions) {
|
|
3
|
+
this.inputs = {};
|
|
4
|
+
this.outputs = {};
|
|
13
5
|
if (!actions?.length) {
|
|
14
6
|
throw new Error('No matching action given for diff!');
|
|
15
7
|
}
|
|
@@ -22,6 +14,9 @@ export class DiffMetadata {
|
|
|
22
14
|
this.model = diff.model;
|
|
23
15
|
this.value = diff.value;
|
|
24
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Overrides JSON.serialize() to output a more succinct model of diff-metadata.
|
|
19
|
+
*/
|
|
25
20
|
toJSON() {
|
|
26
21
|
return this.diff.toJSON();
|
|
27
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff-metadata.js","sourceRoot":"","sources":["../../../src/functions/diff/diff-metadata.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,YAAY;
|
|
1
|
+
{"version":3,"file":"diff-metadata.js","sourceRoot":"","sources":["../../../src/functions/diff/diff-metadata.ts"],"names":[],"mappings":"AAKA,MAAM,OAAO,YAAY;IAcvB,YAAY,IAAU,EAAE,OAA2C;QAH1D,WAAM,GAAiB,EAAE,CAAC;QAC1B,YAAO,GAAkB,EAAE,CAAC;QAGnC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;QACxD,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC,CAAC;QAErB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAC1B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC;IAED,YAAY,CAAC,MAAoB;QAC/B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,CAAC;IAED,aAAa,CAAC,OAAsB;QAClC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CACF"}
|
|
@@ -11,5 +11,8 @@ export declare class Diff {
|
|
|
11
11
|
readonly model: UnknownModel;
|
|
12
12
|
readonly value: unknown;
|
|
13
13
|
constructor(model: Diff['model'], action: Diff['action'], field: Diff['field'], value: Diff['value']);
|
|
14
|
+
/**
|
|
15
|
+
* Overrides JSON.serialize() to output a more succinct model of diff.
|
|
16
|
+
*/
|
|
14
17
|
toJSON(): object;
|
|
15
18
|
}
|
|
@@ -8,16 +8,15 @@ export var DiffAction;
|
|
|
8
8
|
DiffAction["UPDATE"] = "update";
|
|
9
9
|
})(DiffAction || (DiffAction = {}));
|
|
10
10
|
export class Diff {
|
|
11
|
-
action;
|
|
12
|
-
field;
|
|
13
|
-
model;
|
|
14
|
-
value;
|
|
15
11
|
constructor(model, action, field, value) {
|
|
16
12
|
this.model = model;
|
|
17
13
|
this.action = action;
|
|
18
14
|
this.field = field;
|
|
19
15
|
this.value = value;
|
|
20
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Overrides JSON.serialize() to output a more succinct model of diff.
|
|
19
|
+
*/
|
|
21
20
|
toJSON() {
|
|
22
21
|
let model = this.model;
|
|
23
22
|
if (model instanceof AModel) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/functions/diff/diff.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAE5D,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;AACnB,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB;AAED,MAAM,OAAO,IAAI;
|
|
1
|
+
{"version":3,"file":"diff.js","sourceRoot":"","sources":["../../../src/functions/diff/diff.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAC;AAE5D,MAAM,CAAN,IAAY,UAKX;AALD,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,iCAAmB,CAAA;IACnB,+BAAiB,CAAA;AACnB,CAAC,EALW,UAAU,KAAV,UAAU,QAKrB;AAED,MAAM,OAAO,IAAI;IASf,YAAY,KAAoB,EAAE,MAAsB,EAAE,KAAoB,EAAE,KAAoB;QAClG,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,MAAM;QACJ,IAAI,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC;QAChC,IAAI,KAAK,YAAY,MAAM,EAAE,CAAC;YAC5B,KAAK,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;QAC7B,CAAC;QAED,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACvB,IAAI,KAAK,YAAY,MAAM,EAAE,CAAC;YAC5B,KAAK,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;QAC7B,CAAC;aAAM,IAAI,KAAK,YAAY,OAAO,EAAE,CAAC;YACpC,KAAK,GAAG,YAAY,KAAK,CAAC,QAAQ,EAAE,CAAC;QACvC,CAAC;QAED,OAAO;YACL,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK;YACL,KAAK;SACN,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -3,9 +3,41 @@ import { Diff } from './diff.js';
|
|
|
3
3
|
export declare class DiffUtility {
|
|
4
4
|
private static generateDeleteDiff;
|
|
5
5
|
static isObjectDeepEquals(x: object, y: object): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Generate a deep diff of an array of basic types from the previous model vs the latest model.
|
|
8
|
+
* @param a previous model.
|
|
9
|
+
* @param b latest model.
|
|
10
|
+
* @param field string representing the field parent uses to reference the array.
|
|
11
|
+
*/
|
|
6
12
|
static diffArray(a: UnknownModel, b: UnknownModel, field: string): Diff[];
|
|
13
|
+
/**
|
|
14
|
+
* Generate a deep diff of an array of objects from the previous model vs the latest model.
|
|
15
|
+
* @param a previous model.
|
|
16
|
+
* @param b latest model.
|
|
17
|
+
* @param field string representing the field parent uses to reference the array.
|
|
18
|
+
* @param compare function to check if two objects are equal.
|
|
19
|
+
*/
|
|
7
20
|
static diffArrayOfObjects(a: UnknownModel, b: UnknownModel, field: string, compare: (object1: any, object2: any) => boolean): Diff[];
|
|
21
|
+
/**
|
|
22
|
+
* Generate a deep diff of a map of basic types from the previous model vs the latest model.
|
|
23
|
+
* @param a previous model.
|
|
24
|
+
* @param b latest model.
|
|
25
|
+
* @param field string representing the field parent uses to reference the map.
|
|
26
|
+
*/
|
|
8
27
|
static diffMap(a: UnknownModel, b: UnknownModel, field: string): Diff[];
|
|
28
|
+
/**
|
|
29
|
+
* Generate a deep diff of an array of previous models vs latest models.
|
|
30
|
+
* The diff is generated recursively, i.e. all children of the model are included in the diff.
|
|
31
|
+
* @param a array of previous models.
|
|
32
|
+
* @param b array of latest models.
|
|
33
|
+
* @param field string representing the unique identifier of the model.
|
|
34
|
+
*/
|
|
9
35
|
static diffModels(a: UnknownModel[], b: UnknownModel[], field: string): Promise<Diff[]>;
|
|
36
|
+
/**
|
|
37
|
+
* Generate a deep diff of an object from the previous model vs the latest model.
|
|
38
|
+
* @param a previous model.
|
|
39
|
+
* @param b latest model.
|
|
40
|
+
* @param field string representing the field parent uses to reference the object.
|
|
41
|
+
*/
|
|
10
42
|
static diffObject(a: UnknownModel, b: UnknownModel, field: string): Diff[];
|
|
11
43
|
}
|
|
@@ -13,16 +13,25 @@ export class DiffUtility {
|
|
|
13
13
|
diff.push(new Diff(model, DiffAction.DELETE, field, model[field]));
|
|
14
14
|
return diff;
|
|
15
15
|
}
|
|
16
|
+
// Source: https://stackoverflow.com/a/32922084/1834562
|
|
16
17
|
static isObjectDeepEquals(x, y) {
|
|
17
18
|
const ok = Object.keys, tx = typeof x, ty = typeof y;
|
|
18
19
|
return x && y && tx === 'object' && tx === ty
|
|
19
20
|
? ok(x).length === ok(y).length && ok(x).every((key) => this.isObjectDeepEquals(x[key], y[key]))
|
|
20
21
|
: x === y;
|
|
21
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Generate a deep diff of an array of basic types from the previous model vs the latest model.
|
|
25
|
+
* @param a previous model.
|
|
26
|
+
* @param b latest model.
|
|
27
|
+
* @param field string representing the field parent uses to reference the array.
|
|
28
|
+
*/
|
|
22
29
|
static diffArray(a, b, field) {
|
|
23
30
|
const diff = [];
|
|
24
31
|
const aSet = new Set(a[field]);
|
|
25
32
|
const bSet = new Set(b[field]);
|
|
33
|
+
// Iterate elements of previous (a). If found in latest (b), consider it an UPDATE.
|
|
34
|
+
// If not found in latest (b), consider it a DELETE.
|
|
26
35
|
for (const element of aSet) {
|
|
27
36
|
if (bSet.has(element)) {
|
|
28
37
|
diff.push(new Diff(b, DiffAction.UPDATE, field, element));
|
|
@@ -31,6 +40,7 @@ export class DiffUtility {
|
|
|
31
40
|
diff.push(new Diff(a, DiffAction.DELETE, field, element));
|
|
32
41
|
}
|
|
33
42
|
}
|
|
43
|
+
// Iterate elements of latest (b). If not found in previous (a), consider it an ADD.
|
|
34
44
|
for (const element of bSet) {
|
|
35
45
|
if (!aSet.has(element)) {
|
|
36
46
|
diff.push(new Diff(b, DiffAction.ADD, field, element));
|
|
@@ -38,8 +48,17 @@ export class DiffUtility {
|
|
|
38
48
|
}
|
|
39
49
|
return diff;
|
|
40
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Generate a deep diff of an array of objects from the previous model vs the latest model.
|
|
53
|
+
* @param a previous model.
|
|
54
|
+
* @param b latest model.
|
|
55
|
+
* @param field string representing the field parent uses to reference the array.
|
|
56
|
+
* @param compare function to check if two objects are equal.
|
|
57
|
+
*/
|
|
41
58
|
static diffArrayOfObjects(a, b, field, compare) {
|
|
42
59
|
const diff = [];
|
|
60
|
+
// Iterate elements of previous (a). If found in latest (b), consider it an UPDATE.
|
|
61
|
+
// If not found in latest (b), consider it a DELETE.
|
|
43
62
|
for (const aObject of a[field]) {
|
|
44
63
|
if (b[field].some((bObject) => compare(aObject, bObject))) {
|
|
45
64
|
diff.push(new Diff(b, DiffAction.UPDATE, field, aObject));
|
|
@@ -48,6 +67,7 @@ export class DiffUtility {
|
|
|
48
67
|
diff.push(new Diff(a, DiffAction.DELETE, field, aObject));
|
|
49
68
|
}
|
|
50
69
|
}
|
|
70
|
+
// Iterate elements of latest (b). If not found in previous (a), consider it an ADD.
|
|
51
71
|
for (const bObject of b[field]) {
|
|
52
72
|
if (!a[field].some((aObject) => compare(aObject, bObject))) {
|
|
53
73
|
diff.push(new Diff(b, DiffAction.ADD, field, bObject));
|
|
@@ -55,8 +75,16 @@ export class DiffUtility {
|
|
|
55
75
|
}
|
|
56
76
|
return diff;
|
|
57
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Generate a deep diff of a map of basic types from the previous model vs the latest model.
|
|
80
|
+
* @param a previous model.
|
|
81
|
+
* @param b latest model.
|
|
82
|
+
* @param field string representing the field parent uses to reference the map.
|
|
83
|
+
*/
|
|
58
84
|
static diffMap(a, b, field) {
|
|
59
85
|
const diff = [];
|
|
86
|
+
// Iterate fields of previous (a). If found in latest (b), consider it an UPDATE.
|
|
87
|
+
// If not found in latest (b), consider it a DELETE.
|
|
60
88
|
for (const [key, value] of a[field]) {
|
|
61
89
|
if (b[field].has(key)) {
|
|
62
90
|
if (b[field].get(key) !== value) {
|
|
@@ -67,6 +95,7 @@ export class DiffUtility {
|
|
|
67
95
|
diff.push(new Diff(a, DiffAction.DELETE, field, { key, value }));
|
|
68
96
|
}
|
|
69
97
|
}
|
|
98
|
+
// Iterate fields of latest (b). If not found in previous (a), consider it an ADD.
|
|
70
99
|
for (const [key, value] of b[field]) {
|
|
71
100
|
if (!a[field].has(key)) {
|
|
72
101
|
diff.push(new Diff(b, DiffAction.ADD, field, { key, value }));
|
|
@@ -74,8 +103,17 @@ export class DiffUtility {
|
|
|
74
103
|
}
|
|
75
104
|
return diff;
|
|
76
105
|
}
|
|
106
|
+
/**
|
|
107
|
+
* Generate a deep diff of an array of previous models vs latest models.
|
|
108
|
+
* The diff is generated recursively, i.e. all children of the model are included in the diff.
|
|
109
|
+
* @param a array of previous models.
|
|
110
|
+
* @param b array of latest models.
|
|
111
|
+
* @param field string representing the unique identifier of the model.
|
|
112
|
+
*/
|
|
77
113
|
static async diffModels(a, b, field) {
|
|
78
114
|
const diff = [];
|
|
115
|
+
// Iterate fields of previous (a). If found in latest (b), get recursive diff of children of b vs a.
|
|
116
|
+
// If not found in latest (b), consider it a DELETE.
|
|
79
117
|
for (const x of a) {
|
|
80
118
|
const y = b.find((i) => i.getContext() === x.getContext());
|
|
81
119
|
if (y) {
|
|
@@ -86,6 +124,8 @@ export class DiffUtility {
|
|
|
86
124
|
diff.push(...DiffUtility.generateDeleteDiff(x, field));
|
|
87
125
|
}
|
|
88
126
|
}
|
|
127
|
+
// Iterate fields of latest (b). If not found in previous (a), consider it an ADD.
|
|
128
|
+
// Recursively add all children of b.
|
|
89
129
|
for (const y of b) {
|
|
90
130
|
if (!a.find((i) => i.getContext() === y.getContext())) {
|
|
91
131
|
const pDiff = await y.diff();
|
|
@@ -94,8 +134,16 @@ export class DiffUtility {
|
|
|
94
134
|
}
|
|
95
135
|
return diff;
|
|
96
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Generate a deep diff of an object from the previous model vs the latest model.
|
|
139
|
+
* @param a previous model.
|
|
140
|
+
* @param b latest model.
|
|
141
|
+
* @param field string representing the field parent uses to reference the object.
|
|
142
|
+
*/
|
|
97
143
|
static diffObject(a, b, field) {
|
|
98
144
|
const diff = [];
|
|
145
|
+
// Iterate fields of previous (a). If found in latest (b), consider it an UPDATE.
|
|
146
|
+
// If not found in latest (b), consider it a DELETE.
|
|
99
147
|
for (const [key, value] of Object.entries(a[field])) {
|
|
100
148
|
if (b[field].hasOwnProperty(key)) {
|
|
101
149
|
if (typeof b[field][key] === 'object') {
|
|
@@ -113,6 +161,7 @@ export class DiffUtility {
|
|
|
113
161
|
diff.push(new Diff(a, DiffAction.DELETE, field, { key, value }));
|
|
114
162
|
}
|
|
115
163
|
}
|
|
164
|
+
// Iterate fields of latest (b). If not found in previous (a), consider it an ADD.
|
|
116
165
|
for (const [key, value] of Object.entries(b[field])) {
|
|
117
166
|
if (!a[field].hasOwnProperty(key)) {
|
|
118
167
|
diff.push(new Diff(b, DiffAction.ADD, field, { key, value }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.utility.js","sourceRoot":"","sources":["../../../src/functions/diff/diff.utility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,OAAO,WAAW;IACd,MAAM,CAAC,kBAAkB,CAAC,KAAmB,EAAE,KAAa;QAClE,MAAM,IAAI,GAAW,EAAE,CAAC;QAExB,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9C,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC7C,MAAM,KAAK,GAAG,UAAU,CAAC,EAAE,CAAC;gBAC5B,MAAM,UAAU,GAAG,UAAU,CAAC,eAAe,EAAG,CAAC,OAAO,CAAC;gBACzD,IAAI,CAAC,IAAI,CAAC,GAAG,WAAW,CAAC,kBAAkB,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC;YAClE,CAAC;QACH,CAAC;QAED,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;
|
|
1
|
+
{"version":3,"file":"diff.utility.js","sourceRoot":"","sources":["../../../src/functions/diff/diff.utility.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,OAAO,WAAW;IACd,MAAM,CAAC,kBAAkB,CAAC,KAAmB,EAAE,KAAa;QAClE,MAAM,IAAI,GAAW,EAAE,CAAC;QAExB,MAAM,QAAQ,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;QACrC,KAAK,MAAM,SAAS,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,EA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N,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,KAAK,EAAE,CAAC;wBAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;oBAClF,CAAC;gBACH,CAAC;YACH,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;QAED,kFAAkF;QAClF,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACpD,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,cAAc,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YAChE,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CommitHookCallbackDoneEvent, PostCommitHookCallbackDoneEvent, PreCommitHookCallbackDoneEvent, } from '../../events/hook.event.js';
|
|
2
2
|
import { EventService } from '../../services/event/event.service.js';
|
|
3
3
|
export class CommitHook {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
constructor() {
|
|
5
|
+
this.postCommitHooks = [];
|
|
6
|
+
this.preCommitHooks = [];
|
|
7
|
+
}
|
|
7
8
|
collectHooks(registeredModules) {
|
|
8
9
|
for (const m of registeredModules) {
|
|
9
10
|
for (const { callback } of m.properties.postCommitHooks || []) {
|
|
@@ -21,6 +22,8 @@ export class CommitHook {
|
|
|
21
22
|
return this.instance;
|
|
22
23
|
}
|
|
23
24
|
registrar(descriptor) {
|
|
25
|
+
// `self` here references this class, vs `this` references the original method.
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
24
27
|
const self = this;
|
|
25
28
|
const originalMethod = descriptor.value;
|
|
26
29
|
descriptor.value = async function (...args) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commit.hook.js","sourceRoot":"","sources":["../../../src/functions/hook/commit.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAIrE,MAAM,OAAO,UAAU;
|
|
1
|
+
{"version":3,"file":"commit.hook.js","sourceRoot":"","sources":["../../../src/functions/hook/commit.hook.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,+BAA+B,EAC/B,8BAA8B,GAC/B,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAIrE,MAAM,OAAO,UAAU;IAAvB;QAGmB,oBAAe,GAAgC,EAAE,CAAC;QAClD,mBAAc,GAAgC,EAAE,CAAC;IAgDpE,CAAC;IA9CC,YAAY,CAAC,iBAA6C;QACxD,KAAK,MAAM,CAAC,IAAI,iBAAiB,EAAE,CAAC;YAClC,KAAK,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,eAAe,IAAI,EAAE,EAAE,CAAC;gBAC9D,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACtC,CAAC;YAED,KAAK,MAAM,EAAE,QAAQ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EAAE,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QAC5D,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
|
@@ -3,9 +3,10 @@ import { ModelActionHookCallbackDoneEvent, PostModelActionHookCallbackDoneEvent,
|
|
|
3
3
|
import { EventService } from '../../services/event/event.service.js';
|
|
4
4
|
import { InputService } from '../../services/input/input.service.js';
|
|
5
5
|
export class ModelActionHook {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
constructor() {
|
|
7
|
+
this.postModelActionHooks = {};
|
|
8
|
+
this.preModelActionHooks = {};
|
|
9
|
+
}
|
|
9
10
|
collectHooks(registeredModules) {
|
|
10
11
|
for (const m of registeredModules) {
|
|
11
12
|
for (const { ACTION_NAME, collectInput, handle } of m.properties.postModelActionHooks || []) {
|
|
@@ -29,6 +30,8 @@ export class ModelActionHook {
|
|
|
29
30
|
return this.instance;
|
|
30
31
|
}
|
|
31
32
|
registrar(modelAction) {
|
|
33
|
+
// `self` here references this class, vs `this` references the original method.
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
32
35
|
const self = this;
|
|
33
36
|
const originalHandleMethod = modelAction.handle;
|
|
34
37
|
modelAction.handle = async function (...args) {
|