@quadnix/octo 0.0.20 → 0.0.22
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 +8 -1
- package/dist/app.type.js +13 -7
- package/dist/app.type.js.map +1 -1
- package/dist/decorators/action.decorator.d.ts +19 -2
- package/dist/decorators/action.decorator.js +28 -5
- package/dist/decorators/action.decorator.js.map +1 -1
- package/dist/decorators/anchor.decorator.d.ts +13 -0
- package/dist/decorators/anchor.decorator.js +14 -1
- package/dist/decorators/anchor.decorator.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 +54 -5
- package/dist/decorators/factory.decorator.js +56 -3
- package/dist/decorators/factory.decorator.js.map +1 -1
- package/dist/decorators/model.decorator.d.ts +13 -0
- package/dist/decorators/model.decorator.js +14 -1
- package/dist/decorators/model.decorator.js.map +1 -1
- package/dist/decorators/module.decorator.d.ts +61 -5
- package/dist/decorators/module.decorator.js +62 -3
- 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 +14 -1
- package/dist/decorators/overlay.decorator.js.map +1 -1
- package/dist/decorators/resource.decorator.d.ts +13 -0
- package/dist/decorators/resource.decorator.js +14 -1
- package/dist/decorators/resource.decorator.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/container/container.d.ts +53 -0
- package/dist/functions/container/container.js +102 -0
- package/dist/functions/container/container.js.map +1 -0
- package/dist/functions/container/test-container.d.ts +75 -0
- package/dist/functions/container/test-container.js +97 -0
- package/dist/functions/container/test-container.js.map +1 -0
- package/dist/functions/dependency/dependency.d.ts +6 -6
- 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 +5 -2
- package/dist/functions/diff/diff-metadata.js +6 -11
- package/dist/functions/diff/diff-metadata.js.map +1 -1
- package/dist/functions/diff/diff.d.ts +6 -3
- package/dist/functions/diff/diff.js +8 -13
- package/dist/functions/diff/diff.js.map +1 -1
- package/dist/functions/diff/diff.utility.d.ts +38 -6
- package/dist/functions/diff/diff.utility.js +55 -6
- 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 +7 -4
- 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/functions/node/node.abstract.d.ts +84 -0
- package/dist/functions/node/node.abstract.js +275 -0
- package/dist/functions/node/node.abstract.js.map +1 -0
- package/dist/functions/node/node.interface.d.ts +176 -0
- package/dist/functions/node/node.interface.js +2 -0
- package/dist/functions/node/node.interface.js.map +1 -0
- package/dist/index.d.ts +12 -12
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts +11 -10
- package/dist/main.js +76 -37
- 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 +30 -3
- package/dist/models/app/app.model.js +40 -6
- 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 +16 -3
- package/dist/models/deployment/deployment.model.js +20 -6
- 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 +19 -3
- package/dist/models/environment/environment.model.js +33 -8
- 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 +24 -3
- package/dist/models/execution/execution.model.js +40 -7
- 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 +36 -3
- package/dist/models/image/image.model.js +25 -9
- package/dist/models/image/image.model.js.map +1 -1
- package/dist/models/model-action.interface.d.ts +18 -1
- package/dist/models/model.abstract.d.ts +7 -42
- package/dist/models/model.abstract.js +24 -295
- package/dist/models/model.abstract.js.map +1 -1
- package/dist/models/model.interface.d.ts +51 -11
- package/dist/models/pipeline/pipeline.interface.d.ts +5 -0
- package/dist/models/pipeline/pipeline.model.d.ts +16 -3
- package/dist/models/pipeline/pipeline.model.js +25 -8
- 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 +19 -3
- package/dist/models/region/region.model.js +29 -6
- 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 +18 -3
- package/dist/models/server/server.model.js +24 -6
- 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 +16 -3
- package/dist/models/service/service.model.js +19 -6
- 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 +50 -3
- package/dist/models/subnet/subnet.model.js +58 -22
- package/dist/models/subnet/subnet.model.js.map +1 -1
- package/dist/modules/module.container.d.ts +4 -2
- 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 +4 -4
- package/dist/modules/test-module.container.js +18 -17
- 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.d.ts +2 -4
- package/dist/overlays/overlay-data.repository.js +8 -36
- package/dist/overlays/overlay-data.repository.js.map +1 -1
- package/dist/overlays/overlay.abstract.d.ts +6 -7
- package/dist/overlays/overlay.abstract.js +20 -42
- package/dist/overlays/overlay.abstract.js.map +1 -1
- package/dist/overlays/overlay.service.d.ts +0 -1
- package/dist/overlays/overlay.service.js +1 -7
- package/dist/overlays/overlay.service.js.map +1 -1
- package/dist/resources/resource-data.repository.d.ts +16 -6
- package/dist/resources/resource-data.repository.js +121 -18
- package/dist/resources/resource-data.repository.js.map +1 -1
- package/dist/resources/resource.abstract.d.ts +23 -6
- package/dist/resources/resource.abstract.js +147 -13
- package/dist/resources/resource.abstract.js.map +1 -1
- package/dist/resources/shared-resource.abstract.d.ts +2 -2
- package/dist/resources/shared-resource.abstract.js +5 -2
- package/dist/resources/shared-resource.abstract.js.map +1 -1
- package/dist/services/capture/capture.service.d.ts +1 -2
- package/dist/services/capture/capture.service.js +5 -4
- package/dist/services/capture/capture.service.js.map +1 -1
- package/dist/services/event/event.service.js +9 -6
- package/dist/services/event/event.service.js.map +1 -1
- package/dist/services/input/input.service.js +3 -5
- package/dist/services/input/input.service.js.map +1 -1
- package/dist/services/serialization/model/model-serialization.service.js +13 -14
- package/dist/services/serialization/model/model-serialization.service.js.map +1 -1
- package/dist/services/serialization/resource/resource-serialization.service.d.ts +4 -4
- package/dist/services/serialization/resource/resource-serialization.service.js +23 -13
- 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.d.ts +1 -1
- package/dist/services/state-management/state-management.service.js +6 -9
- 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 +5 -2
- package/dist/services/transaction/transaction.service.js +117 -87
- 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
- package/dist/decorators/container.d.ts +0 -24
- package/dist/decorators/container.js +0 -96
- package/dist/decorators/container.js.map +0 -1
- package/dist/decorators/test-container.d.ts +0 -27
- package/dist/decorators/test-container.js +0 -52
- package/dist/decorators/test-container.js.map +0 -1
|
@@ -8,42 +8,60 @@ 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
|
var Region_1;
|
|
11
|
+
import { strict as assert } from 'assert';
|
|
11
12
|
import { Model } from '../../decorators/model.decorator.js';
|
|
13
|
+
import { Validate } from '../../decorators/validate.decorator.js';
|
|
12
14
|
import { AModel } from '../model.abstract.js';
|
|
15
|
+
/**
|
|
16
|
+
* A Region model is a physical geographical area where the app can be deployed.
|
|
17
|
+
* Typically, for redundancy and low latency, an app is deployed in multiple regions.
|
|
18
|
+
* Therefore, it's common to have multiple region nodes under the app.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const region = new Region('us-east-1');
|
|
23
|
+
* ```
|
|
24
|
+
* @group Models
|
|
25
|
+
* @see Definition of [Default Models](/docs/fundamentals/models#default-models).
|
|
26
|
+
*/
|
|
13
27
|
let Region = Region_1 = class Region extends AModel {
|
|
14
|
-
MODEL_NAME = 'region';
|
|
15
|
-
regionId;
|
|
16
28
|
constructor(regionId) {
|
|
17
29
|
super();
|
|
30
|
+
this.NODE_NAME = 'region';
|
|
18
31
|
this.regionId = regionId;
|
|
19
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* To add an {@link Environment}.
|
|
35
|
+
*/
|
|
20
36
|
addEnvironment(environment) {
|
|
21
37
|
const childrenDependencies = this.getChildren('environment');
|
|
22
38
|
if (!childrenDependencies['environment'])
|
|
23
39
|
childrenDependencies['environment'] = [];
|
|
40
|
+
// Check for duplicates.
|
|
24
41
|
const environments = childrenDependencies['environment'].map((d) => d.to);
|
|
25
42
|
if (environments.find((e) => e.environmentName === environment.environmentName)) {
|
|
26
43
|
throw new Error('Environment already exists!');
|
|
27
44
|
}
|
|
28
45
|
this.addChild('regionId', environment, 'environmentName');
|
|
29
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* To add a {@link Subnet}.
|
|
49
|
+
*/
|
|
30
50
|
addSubnet(subnet) {
|
|
31
51
|
const childrenDependencies = this.getChildren('subnet');
|
|
32
52
|
if (!childrenDependencies['subnet'])
|
|
33
53
|
childrenDependencies['subnet'] = [];
|
|
54
|
+
// Check for duplicates.
|
|
34
55
|
const subnets = childrenDependencies['subnet'].map((d) => d.to);
|
|
35
56
|
if (subnets.find((z) => z.subnetId === subnet.subnetId)) {
|
|
36
57
|
throw new Error('Subnet already exists!');
|
|
37
58
|
}
|
|
38
59
|
this.addChild('regionId', subnet, 'subnetId');
|
|
39
60
|
}
|
|
40
|
-
async diffProperties() {
|
|
41
|
-
return [];
|
|
42
|
-
}
|
|
43
61
|
setContext() {
|
|
44
62
|
const parents = this.getParents();
|
|
45
63
|
const app = parents['app'][0].to;
|
|
46
|
-
return [`${this.
|
|
64
|
+
return [`${this.NODE_NAME}=${this.regionId}`, app.getContext()].join(',');
|
|
47
65
|
}
|
|
48
66
|
synth() {
|
|
49
67
|
return {
|
|
@@ -51,9 +69,14 @@ let Region = Region_1 = class Region extends AModel {
|
|
|
51
69
|
};
|
|
52
70
|
}
|
|
53
71
|
static async unSynth(region, deReferenceContext) {
|
|
72
|
+
assert(!!deReferenceContext);
|
|
54
73
|
return new Region_1(region.regionId);
|
|
55
74
|
}
|
|
56
75
|
};
|
|
76
|
+
__decorate([
|
|
77
|
+
Validate({ options: { maxLength: 32, minLength: 2, regex: /^[a-zA-Z][\w-]*[a-zA-Z0-9]$/ } }),
|
|
78
|
+
__metadata("design:type", String)
|
|
79
|
+
], Region.prototype, "regionId", void 0);
|
|
57
80
|
Region = Region_1 = __decorate([
|
|
58
81
|
Model(),
|
|
59
82
|
__metadata("design:paramtypes", [String])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"region.model.js","sourceRoot":"","sources":["../../../src/models/region/region.model.ts"],"names":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"region.model.js","sourceRoot":"","sources":["../../../src/models/region/region.model.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ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el } from '../../app.type.js';
|
|
2
|
-
import type { Diff } from '../../functions/diff/diff.js';
|
|
3
2
|
import { Deployment } from '../deployment/deployment.model.js';
|
|
4
3
|
import { AModel } from '../model.abstract.js';
|
|
5
4
|
import type { IServer } from './server.interface.js';
|
|
5
|
+
/**
|
|
6
|
+
* A Server model is a representation of the logical microservice.
|
|
7
|
+
* E.g. frontend, backend, database, payment-service, etc.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const server = new Server('backend');
|
|
12
|
+
* ```
|
|
13
|
+
* @group Models
|
|
14
|
+
* @see Definition of [Default Models](/docs/fundamentals/models#default-models).
|
|
15
|
+
*/
|
|
6
16
|
export declare class Server extends AModel<IServer, Server> {
|
|
7
|
-
readonly
|
|
17
|
+
readonly NODE_NAME: string;
|
|
18
|
+
/**
|
|
19
|
+
* The name of the server.
|
|
20
|
+
*/
|
|
8
21
|
readonly serverKey: string;
|
|
9
22
|
constructor(serverKey: string);
|
|
23
|
+
/**
|
|
24
|
+
* To add a {@link Deployment}.
|
|
25
|
+
*/
|
|
10
26
|
addDeployment(deployment: Deployment): void;
|
|
11
|
-
diffProperties(): Promise<Diff[]>;
|
|
12
27
|
setContext(): string;
|
|
13
28
|
synth(): IServer;
|
|
14
29
|
static unSynth(server: IServer, deReferenceContext: (context: string) => Promise<UnknownModel>): Promise<Server>;
|
|
@@ -8,32 +8,45 @@ 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
|
var Server_1;
|
|
11
|
+
import { strict as assert } from 'assert';
|
|
11
12
|
import { Model } from '../../decorators/model.decorator.js';
|
|
13
|
+
import { Validate } from '../../decorators/validate.decorator.js';
|
|
12
14
|
import { AModel } from '../model.abstract.js';
|
|
15
|
+
/**
|
|
16
|
+
* A Server model is a representation of the logical microservice.
|
|
17
|
+
* E.g. frontend, backend, database, payment-service, etc.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const server = new Server('backend');
|
|
22
|
+
* ```
|
|
23
|
+
* @group Models
|
|
24
|
+
* @see Definition of [Default Models](/docs/fundamentals/models#default-models).
|
|
25
|
+
*/
|
|
13
26
|
let Server = Server_1 = class Server extends AModel {
|
|
14
|
-
MODEL_NAME = 'server';
|
|
15
|
-
serverKey;
|
|
16
27
|
constructor(serverKey) {
|
|
17
28
|
super();
|
|
29
|
+
this.NODE_NAME = 'server';
|
|
18
30
|
this.serverKey = serverKey;
|
|
19
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* To add a {@link Deployment}.
|
|
34
|
+
*/
|
|
20
35
|
addDeployment(deployment) {
|
|
21
36
|
const childrenDependencies = this.getChildren('deployment');
|
|
22
37
|
if (!childrenDependencies['deployment'])
|
|
23
38
|
childrenDependencies['deployment'] = [];
|
|
39
|
+
// Check for duplicates.
|
|
24
40
|
const deployments = childrenDependencies['deployment'].map((d) => d.to);
|
|
25
41
|
if (deployments.find((d) => d.deploymentTag === deployment.deploymentTag)) {
|
|
26
42
|
throw new Error('Deployment already exists!');
|
|
27
43
|
}
|
|
28
44
|
this.addChild('serverKey', deployment, 'deploymentTag');
|
|
29
45
|
}
|
|
30
|
-
async diffProperties() {
|
|
31
|
-
return [];
|
|
32
|
-
}
|
|
33
46
|
setContext() {
|
|
34
47
|
const parents = this.getParents();
|
|
35
48
|
const app = parents['app'][0].to;
|
|
36
|
-
return [`${this.
|
|
49
|
+
return [`${this.NODE_NAME}=${this.serverKey}`, app.getContext()].join(',');
|
|
37
50
|
}
|
|
38
51
|
synth() {
|
|
39
52
|
return {
|
|
@@ -41,9 +54,14 @@ let Server = Server_1 = class Server extends AModel {
|
|
|
41
54
|
};
|
|
42
55
|
}
|
|
43
56
|
static async unSynth(server, deReferenceContext) {
|
|
57
|
+
assert(!!deReferenceContext);
|
|
44
58
|
return new Server_1(server.serverKey);
|
|
45
59
|
}
|
|
46
60
|
};
|
|
61
|
+
__decorate([
|
|
62
|
+
Validate({ options: { maxLength: 64, minLength: 2, regex: /^[a-zA-Z][\w-]*[a-zA-Z0-9]$/ } }),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], Server.prototype, "serverKey", void 0);
|
|
47
65
|
Server = Server_1 = __decorate([
|
|
48
66
|
Model(),
|
|
49
67
|
__metadata("design:paramtypes", [String])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.model.js","sourceRoot":"","sources":["../../../src/models/server/server.model.ts"],"names":[],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"server.model.js","sourceRoot":"","sources":["../../../src/models/server/server.model.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C;;;;;;;;;;GAUG;AAEI,IAAM,MAAM,cAAZ,MAAM,MAAO,SAAQ,MAAuB;IASjD,YAAY,SAAiB;QAC3B,KAAK,EAAE,CAAC;QATD,cAAS,GAAW,QAAQ,CAAC;QAUpC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,UAAsB;QAClC,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAC5D,IAAI,CAAC,oBAAoB,CAAC,YAAY,CAAC;YAAE,oBAAoB,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC;QAEjF,wBAAwB;QACxB,MAAM,WAAW,GAAG,oBAAoB,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QACxE,IAAI,WAAW,CAAC,IAAI,CAAC,CAAC,CAAa,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;YACtF,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;IAEQ,UAAU;QACjB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7E,CAAC;IAEQ,KAAK;QACZ,OAAO;YACL,SAAS,EAAE,IAAI,CAAC,SAAS;SAC1B,CAAC;IACJ,CAAC;IAED,MAAM,CAAU,KAAK,CAAC,OAAO,CAC3B,MAAe,EACf,kBAA8D;QAE9D,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC;QAE7B,OAAO,IAAI,QAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;CACF,CAAA;AA1CU;IADR,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,6BAA6B,EAAE,EAAE,CAAC;;yCAClE;AAPhB,MAAM;IADlB,KAAK,EAAE;;GACK,MAAM,CAiDlB"}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
|
-
import type { Diff } from '../../functions/diff/diff.js';
|
|
2
1
|
import { AModel } from '../model.abstract.js';
|
|
3
2
|
import type { IService } from './service.interface.js';
|
|
3
|
+
/**
|
|
4
|
+
* A Service model can be any third-party service that your application relies on.
|
|
5
|
+
* What separates them from Server is that Services are hosted and managed outside of your infrastructure.
|
|
6
|
+
* An external Redis server on the cloud, or a managed Kafka queue from AWS, are a few examples.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const service = new Service('MyService');
|
|
11
|
+
* ```
|
|
12
|
+
* @group Models
|
|
13
|
+
* @see Definition of [Default Models](/docs/fundamentals/models#default-models).
|
|
14
|
+
*/
|
|
4
15
|
export declare class Service extends AModel<IService, Service> {
|
|
5
|
-
readonly
|
|
16
|
+
readonly NODE_NAME: string;
|
|
17
|
+
/**
|
|
18
|
+
* The ID of the service.
|
|
19
|
+
*/
|
|
6
20
|
readonly serviceId: string;
|
|
7
21
|
constructor(serviceId: string);
|
|
8
|
-
diffProperties(previous: Service): Promise<Diff[]>;
|
|
9
22
|
setContext(): string;
|
|
10
23
|
synth(): IService;
|
|
11
24
|
}
|
|
@@ -8,26 +8,39 @@ 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 { Model } from '../../decorators/model.decorator.js';
|
|
11
|
+
import { Validate } from '../../decorators/validate.decorator.js';
|
|
11
12
|
import { AModel } from '../model.abstract.js';
|
|
13
|
+
/**
|
|
14
|
+
* A Service model can be any third-party service that your application relies on.
|
|
15
|
+
* What separates them from Server is that Services are hosted and managed outside of your infrastructure.
|
|
16
|
+
* An external Redis server on the cloud, or a managed Kafka queue from AWS, are a few examples.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* const service = new Service('MyService');
|
|
21
|
+
* ```
|
|
22
|
+
* @group Models
|
|
23
|
+
* @see Definition of [Default Models](/docs/fundamentals/models#default-models).
|
|
24
|
+
*/
|
|
12
25
|
let Service = class Service extends AModel {
|
|
13
|
-
MODEL_NAME = 'service';
|
|
14
|
-
serviceId;
|
|
15
26
|
constructor(serviceId) {
|
|
16
27
|
super();
|
|
28
|
+
this.NODE_NAME = 'service';
|
|
17
29
|
this.serviceId = serviceId;
|
|
18
30
|
}
|
|
19
|
-
async diffProperties(previous) {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
31
|
setContext() {
|
|
23
32
|
const parents = this.getParents();
|
|
24
33
|
const app = parents['app'][0].to;
|
|
25
|
-
return [`${this.
|
|
34
|
+
return [`${this.NODE_NAME}=${this.serviceId}`, app.getContext()].join(',');
|
|
26
35
|
}
|
|
27
36
|
synth() {
|
|
28
37
|
throw new Error('Method not implemented! Use subclass');
|
|
29
38
|
}
|
|
30
39
|
};
|
|
40
|
+
__decorate([
|
|
41
|
+
Validate({ options: { maxLength: 128, minLength: 2, regex: /^[a-zA-Z0-9][\w.-]*[a-zA-Z0-9]$/ } }),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], Service.prototype, "serviceId", void 0);
|
|
31
44
|
Service = __decorate([
|
|
32
45
|
Model(),
|
|
33
46
|
__metadata("design:paramtypes", [String])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.model.js","sourceRoot":"","sources":["../../../src/models/service/service.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;
|
|
1
|
+
{"version":3,"file":"service.model.js","sourceRoot":"","sources":["../../../src/models/service/service.model.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAG9C;;;;;;;;;;;GAWG;AAEI,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,MAAyB;IASpD,YAAY,SAAiB;QAC3B,KAAK,EAAE,CAAC;QATD,cAAS,GAAW,SAAS,CAAC;QAUrC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAEQ,UAAU;QACjB,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjC,OAAO,CAAC,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,SAAS,EAAE,EAAE,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7E,CAAC;IAEQ,KAAK;QACZ,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC1D,CAAC;CACF,CAAA;AAhBU;IADR,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,iCAAiC,EAAE,EAAE,CAAC;;0CACvE;AAPhB,OAAO;IADnB,KAAK,EAAE;;GACK,OAAO,CAuBnB"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import type { IModelReference } from '../model.interface.js';
|
|
2
2
|
import type { Subnet } from './subnet.model.js';
|
|
3
|
+
/**
|
|
4
|
+
* {@link Subnet} model interface.
|
|
5
|
+
*
|
|
6
|
+
* @group Model Interfaces
|
|
7
|
+
*/
|
|
3
8
|
export interface ISubnet {
|
|
4
9
|
options: Subnet['options'];
|
|
5
10
|
region: IModelReference;
|
|
@@ -1,25 +1,72 @@
|
|
|
1
1
|
import type { UnknownModel } from '../../app.type.js';
|
|
2
|
-
import { Diff } from '../../functions/diff/diff.js';
|
|
3
2
|
import { AModel } from '../model.abstract.js';
|
|
4
3
|
import { Region } from '../region/region.model.js';
|
|
5
4
|
import type { ISubnet } from './subnet.interface.js';
|
|
5
|
+
/**
|
|
6
|
+
* The type of subnet.
|
|
7
|
+
*/
|
|
6
8
|
export declare enum SubnetType {
|
|
9
|
+
/**
|
|
10
|
+
* A public subnet is open to the internet,
|
|
11
|
+
* i.e. an {@link Execution} within this subnet can be accessed from the internet.
|
|
12
|
+
* Other than access from the internet, any other access needs to be explicitly allowed.
|
|
13
|
+
*/
|
|
7
14
|
PUBLIC = "public",
|
|
15
|
+
/**
|
|
16
|
+
* A private subnet has limited access to anything outside of this subnet, including access from the internet.
|
|
17
|
+
* Access to this subnet needs to be explicitly allowed.
|
|
18
|
+
*/
|
|
8
19
|
PRIVATE = "private"
|
|
9
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* A Subnet model is the logical sub-division of the region, e.g. a public and a private subnet.
|
|
23
|
+
* A subnet is often used to isolate parts of your infrastructure with access gates in the front.
|
|
24
|
+
* - A subnet can only belong to one region, but a region can have multiple subnets.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const subnet = new Subnet(region, 'my-subnet');
|
|
29
|
+
* subnet.subnetType = SubnetType.PUBLIC;
|
|
30
|
+
* ```
|
|
31
|
+
* @group Models
|
|
32
|
+
* @see Definition of [Default Models](/docs/fundamentals/models#default-models).
|
|
33
|
+
*/
|
|
10
34
|
export declare class Subnet extends AModel<ISubnet, Subnet> {
|
|
11
|
-
readonly
|
|
35
|
+
readonly NODE_NAME: string;
|
|
12
36
|
private options;
|
|
37
|
+
/**
|
|
38
|
+
* The ID of the subnet.
|
|
39
|
+
* - Format is `{regionId}-{subnetName}`
|
|
40
|
+
*/
|
|
13
41
|
readonly subnetId: string;
|
|
42
|
+
/**
|
|
43
|
+
* The name of the subnet.
|
|
44
|
+
*/
|
|
14
45
|
readonly subnetName: string;
|
|
15
46
|
constructor(region: Region, name: string);
|
|
47
|
+
/**
|
|
48
|
+
* To block/disable intra-network communication within self.
|
|
49
|
+
* When this is set to `true`,
|
|
50
|
+
* any execution within this subnet will not be able to communicate with other executions within the same subnet.
|
|
51
|
+
*
|
|
52
|
+
* @defaultValue `false`
|
|
53
|
+
* @experimental
|
|
54
|
+
*/
|
|
16
55
|
get disableSubnetIntraNetwork(): boolean;
|
|
17
56
|
set disableSubnetIntraNetwork(disableSubnetIntraNetwork: boolean);
|
|
18
57
|
get subnetType(): SubnetType;
|
|
19
58
|
set subnetType(subnetType: SubnetType);
|
|
20
|
-
diffProperties(previous: Subnet): Promise<Diff[]>;
|
|
21
59
|
setContext(): string;
|
|
22
60
|
synth(): ISubnet;
|
|
23
61
|
static unSynth(subnet: ISubnet, deReferenceContext: (context: string) => Promise<UnknownModel>): Promise<Subnet>;
|
|
62
|
+
/**
|
|
63
|
+
* To update the networking rules of this subnet to allow or deny connectivity from another subnet.
|
|
64
|
+
* The networking rules are bi-directional,
|
|
65
|
+
* i.e. if subnet A can connect to subnet B, then subnet B can also connect to subnet A.
|
|
66
|
+
*
|
|
67
|
+
* @param subnet The other subnet.
|
|
68
|
+
* @param allowConnections Set to `true` to allow this and the other subnet to connect.
|
|
69
|
+
* Set to `false` to block this and the other subnet from connecting.
|
|
70
|
+
*/
|
|
24
71
|
updateNetworkingRules(subnet: Subnet, allowConnections: boolean): void;
|
|
25
72
|
}
|
|
@@ -9,27 +9,59 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
};
|
|
10
10
|
var Subnet_1;
|
|
11
11
|
import { Model } from '../../decorators/model.decorator.js';
|
|
12
|
-
import {
|
|
12
|
+
import { Validate } from '../../decorators/validate.decorator.js';
|
|
13
|
+
import { DiffAction } from '../../functions/diff/diff.js';
|
|
13
14
|
import { AModel } from '../model.abstract.js';
|
|
14
15
|
import { Region } from '../region/region.model.js';
|
|
16
|
+
/**
|
|
17
|
+
* The type of subnet.
|
|
18
|
+
*/
|
|
15
19
|
export var SubnetType;
|
|
16
20
|
(function (SubnetType) {
|
|
21
|
+
/**
|
|
22
|
+
* A public subnet is open to the internet,
|
|
23
|
+
* i.e. an {@link Execution} within this subnet can be accessed from the internet.
|
|
24
|
+
* Other than access from the internet, any other access needs to be explicitly allowed.
|
|
25
|
+
*/
|
|
17
26
|
SubnetType["PUBLIC"] = "public";
|
|
27
|
+
/**
|
|
28
|
+
* A private subnet has limited access to anything outside of this subnet, including access from the internet.
|
|
29
|
+
* Access to this subnet needs to be explicitly allowed.
|
|
30
|
+
*/
|
|
18
31
|
SubnetType["PRIVATE"] = "private";
|
|
19
32
|
})(SubnetType || (SubnetType = {}));
|
|
33
|
+
/**
|
|
34
|
+
* A Subnet model is the logical sub-division of the region, e.g. a public and a private subnet.
|
|
35
|
+
* A subnet is often used to isolate parts of your infrastructure with access gates in the front.
|
|
36
|
+
* - A subnet can only belong to one region, but a region can have multiple subnets.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const subnet = new Subnet(region, 'my-subnet');
|
|
41
|
+
* subnet.subnetType = SubnetType.PUBLIC;
|
|
42
|
+
* ```
|
|
43
|
+
* @group Models
|
|
44
|
+
* @see Definition of [Default Models](/docs/fundamentals/models#default-models).
|
|
45
|
+
*/
|
|
20
46
|
let Subnet = Subnet_1 = class Subnet extends AModel {
|
|
21
|
-
MODEL_NAME = 'subnet';
|
|
22
|
-
options = {
|
|
23
|
-
disableSubnetIntraNetwork: false,
|
|
24
|
-
subnetType: SubnetType.PRIVATE,
|
|
25
|
-
};
|
|
26
|
-
subnetId;
|
|
27
|
-
subnetName;
|
|
28
47
|
constructor(region, name) {
|
|
29
48
|
super();
|
|
49
|
+
this.NODE_NAME = 'subnet';
|
|
50
|
+
this.options = {
|
|
51
|
+
disableSubnetIntraNetwork: false,
|
|
52
|
+
subnetType: SubnetType.PRIVATE,
|
|
53
|
+
};
|
|
30
54
|
this.subnetId = region.regionId + '-' + name;
|
|
31
55
|
this.subnetName = name;
|
|
32
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* To block/disable intra-network communication within self.
|
|
59
|
+
* When this is set to `true`,
|
|
60
|
+
* any execution within this subnet will not be able to communicate with other executions within the same subnet.
|
|
61
|
+
*
|
|
62
|
+
* @defaultValue `false`
|
|
63
|
+
* @experimental
|
|
64
|
+
*/
|
|
33
65
|
get disableSubnetIntraNetwork() {
|
|
34
66
|
return this.options.disableSubnetIntraNetwork;
|
|
35
67
|
}
|
|
@@ -42,20 +74,10 @@ let Subnet = Subnet_1 = class Subnet extends AModel {
|
|
|
42
74
|
set subnetType(subnetType) {
|
|
43
75
|
this.options.subnetType = subnetType || SubnetType.PRIVATE;
|
|
44
76
|
}
|
|
45
|
-
async diffProperties(previous) {
|
|
46
|
-
const diffs = [];
|
|
47
|
-
if (previous.disableSubnetIntraNetwork !== this.disableSubnetIntraNetwork) {
|
|
48
|
-
diffs.push(new Diff(this, DiffAction.UPDATE, 'disableSubnetIntraNetwork', this.disableSubnetIntraNetwork));
|
|
49
|
-
}
|
|
50
|
-
if (previous.subnetType !== this.subnetType) {
|
|
51
|
-
throw new Error('Change of subnet type is not supported!');
|
|
52
|
-
}
|
|
53
|
-
return diffs;
|
|
54
|
-
}
|
|
55
77
|
setContext() {
|
|
56
78
|
const parents = this.getParents();
|
|
57
79
|
const region = parents['region'][0].to;
|
|
58
|
-
return [`${this.
|
|
80
|
+
return [`${this.NODE_NAME}=${this.subnetId}`, region.getContext()].join(',');
|
|
59
81
|
}
|
|
60
82
|
synth() {
|
|
61
83
|
const parents = this.getParents();
|
|
@@ -74,6 +96,15 @@ let Subnet = Subnet_1 = class Subnet extends AModel {
|
|
|
74
96
|
newSubnet.subnetType = subnet.options.subnetType;
|
|
75
97
|
return newSubnet;
|
|
76
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* To update the networking rules of this subnet to allow or deny connectivity from another subnet.
|
|
101
|
+
* The networking rules are bi-directional,
|
|
102
|
+
* i.e. if subnet A can connect to subnet B, then subnet B can also connect to subnet A.
|
|
103
|
+
*
|
|
104
|
+
* @param subnet The other subnet.
|
|
105
|
+
* @param allowConnections Set to `true` to allow this and the other subnet to connect.
|
|
106
|
+
* Set to `false` to block this and the other subnet from connecting.
|
|
107
|
+
*/
|
|
77
108
|
updateNetworkingRules(subnet, allowConnections) {
|
|
78
109
|
const siblingDependencies = this.getSiblings('subnet');
|
|
79
110
|
if (!siblingDependencies['subnet'])
|
|
@@ -81,15 +112,20 @@ let Subnet = Subnet_1 = class Subnet extends AModel {
|
|
|
81
112
|
const subnets = siblingDependencies['subnet'].map((d) => d.to);
|
|
82
113
|
if (allowConnections && !subnets.find((s) => s.subnetId === subnet.subnetId)) {
|
|
83
114
|
const { thisToThatDependency, thatToThisDependency } = this.addRelationship(subnet);
|
|
84
|
-
thisToThatDependency.addBehavior('
|
|
85
|
-
thisToThatDependency.addBehavior('
|
|
86
|
-
thatToThisDependency.addBehavior('
|
|
115
|
+
thisToThatDependency.addBehavior('sibling', DiffAction.ADD, 'subnetId', DiffAction.ADD);
|
|
116
|
+
thisToThatDependency.addBehavior('sibling', DiffAction.ADD, 'subnetId', DiffAction.UPDATE);
|
|
117
|
+
thatToThisDependency.addBehavior('sibling', DiffAction.ADD, 'subnetId', DiffAction.ADD);
|
|
118
|
+
thatToThisDependency.addBehavior('sibling', DiffAction.ADD, 'subnetId', DiffAction.UPDATE);
|
|
87
119
|
}
|
|
88
120
|
else if (!allowConnections && subnets.find((s) => s.subnetId === subnet.subnetId)) {
|
|
89
121
|
this.removeRelationship(subnet);
|
|
90
122
|
}
|
|
91
123
|
}
|
|
92
124
|
};
|
|
125
|
+
__decorate([
|
|
126
|
+
Validate({ options: { maxLength: 32, minLength: 2, regex: /^[a-zA-Z][\w-]*[a-zA-Z0-9]$/ } }),
|
|
127
|
+
__metadata("design:type", String)
|
|
128
|
+
], Subnet.prototype, "subnetName", void 0);
|
|
93
129
|
Subnet = Subnet_1 = __decorate([
|
|
94
130
|
Model(),
|
|
95
131
|
__metadata("design:paramtypes", [Region, String])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subnet.model.js","sourceRoot":"","sources":["../../../src/models/subnet/subnet.model.ts"],"names":[],"mappings":";;;;;;;;;;AACA,OAAO,EAAE,KAAK,EAAE,MAAM,q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KAAK,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC5F,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;IACH,CAAC;CACF,CAAA;AAxFU;IADR,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,6BAA6B,EAAE,EAAE,CAAC;;0CACjE;AAlBjB,MAAM;IADlB,KAAK,EAAE;qCAqBc,MAAM;GApBf,MAAM,CA0GlB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Constructable } from '../app.type.js';
|
|
2
|
-
import { type
|
|
2
|
+
import { type IModuleOptions } from '../decorators/module.decorator.js';
|
|
3
3
|
import { CommitHook } from '../functions/hook/commit.hook.js';
|
|
4
4
|
import { ModelActionHook } from '../functions/hook/model-action.hook.js';
|
|
5
5
|
import { ResourceActionHook } from '../functions/hook/resource-action.hook.js';
|
|
@@ -15,9 +15,11 @@ export declare class ModuleContainer {
|
|
|
15
15
|
getModuleMetadata(module: Constructable<IModule<unknown>> | string): ModuleContainer['modules'][0] | undefined;
|
|
16
16
|
getModuleMetadataIndex(module: Constructable<IModule<unknown>> | string): number;
|
|
17
17
|
getOutput<T>(module: Constructable<IModule<T>> | string): T | undefined;
|
|
18
|
-
|
|
18
|
+
load(module: Constructable<IModule<unknown>>): void;
|
|
19
|
+
register(module: Constructable<IModule<unknown>>, properties: IModuleOptions): void;
|
|
19
20
|
reset(): void;
|
|
20
21
|
private setApplyOrder;
|
|
22
|
+
unload(module: Constructable<IModule<unknown>>): void;
|
|
21
23
|
}
|
|
22
24
|
export declare class ModuleContainerFactory {
|
|
23
25
|
private static instance;
|
|
@@ -11,15 +11,12 @@ import { ModelActionHook } from '../functions/hook/model-action.hook.js';
|
|
|
11
11
|
import { ResourceActionHook } from '../functions/hook/resource-action.hook.js';
|
|
12
12
|
import { EventService } from '../services/event/event.service.js';
|
|
13
13
|
export class ModuleContainer {
|
|
14
|
-
commitHook;
|
|
15
|
-
modelActionHook;
|
|
16
|
-
resourceActionHook;
|
|
17
|
-
modules = [];
|
|
18
|
-
outputs = {};
|
|
19
14
|
constructor(commitHook, modelActionHook, resourceActionHook) {
|
|
20
15
|
this.commitHook = commitHook;
|
|
21
16
|
this.modelActionHook = modelActionHook;
|
|
22
17
|
this.resourceActionHook = resourceActionHook;
|
|
18
|
+
this.modules = [];
|
|
19
|
+
this.outputs = {};
|
|
23
20
|
}
|
|
24
21
|
async apply() {
|
|
25
22
|
for (const moduleMetadata of this.modules) {
|
|
@@ -43,6 +40,7 @@ export class ModuleContainer {
|
|
|
43
40
|
}, []);
|
|
44
41
|
for (const [i, { isArg, name }] of (properties.args || []).entries()) {
|
|
45
42
|
if (!isArg(args[i])) {
|
|
43
|
+
// eslint-disable-next-line max-len
|
|
46
44
|
const message = `Module "${module.name}" requires an argument at position [${i}] of type "${name}", but received "${typeof args[i]}"!`;
|
|
47
45
|
throw new Error(message);
|
|
48
46
|
}
|
|
@@ -68,9 +66,15 @@ export class ModuleContainer {
|
|
|
68
66
|
const name = typeof module === 'string' ? module : module.name;
|
|
69
67
|
return name in this.outputs ? this.outputs[name] : undefined;
|
|
70
68
|
}
|
|
69
|
+
load(module) {
|
|
70
|
+
const m = this.getModuleMetadata(module);
|
|
71
|
+
if (m) {
|
|
72
|
+
m.hidden = false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
71
75
|
register(module, properties) {
|
|
72
76
|
if (!this.modules.some((m) => m.module.name === module.name)) {
|
|
73
|
-
this.modules.push({ applied: false, applyOrder: -1, hidden:
|
|
77
|
+
this.modules.push({ applied: false, applyOrder: -1, hidden: true, module, properties });
|
|
74
78
|
}
|
|
75
79
|
}
|
|
76
80
|
reset() {
|
|
@@ -83,7 +87,7 @@ export class ModuleContainer {
|
|
|
83
87
|
this.modules.map((m) => {
|
|
84
88
|
m.applied = false;
|
|
85
89
|
m.applyOrder = -1;
|
|
86
|
-
m.hidden =
|
|
90
|
+
m.hidden = true;
|
|
87
91
|
});
|
|
88
92
|
}
|
|
89
93
|
setApplyOrder(moduleMetadata, seen = []) {
|
|
@@ -105,9 +109,14 @@ export class ModuleContainer {
|
|
|
105
109
|
}
|
|
106
110
|
moduleMetadata.applyOrder = Math.max(...parentModuleApplyOrders) + 1;
|
|
107
111
|
}
|
|
112
|
+
unload(module) {
|
|
113
|
+
const m = this.getModuleMetadata(module);
|
|
114
|
+
if (m) {
|
|
115
|
+
m.hidden = true;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
108
118
|
}
|
|
109
119
|
let ModuleContainerFactory = class ModuleContainerFactory {
|
|
110
|
-
static instance;
|
|
111
120
|
static async create() {
|
|
112
121
|
if (!this.instance) {
|
|
113
122
|
const commitHook = CommitHook.getInstance();
|