@twin.org/engine 0.0.2-next.9 → 0.0.3-next.2
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/es/data/coreTypeInitialisers.json +267 -0
- package/dist/es/engine.js +31 -0
- package/dist/es/engine.js.map +1 -0
- package/dist/es/index.js +5 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/utils/engineConfigHelper.js +40 -0
- package/dist/es/utils/engineConfigHelper.js.map +1 -0
- package/dist/types/engine.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/utils/engineConfigHelper.d.ts +2 -5
- package/docs/changelog.md +335 -0
- package/docs/reference/classes/Engine.md +5 -1
- package/docs/reference/classes/EngineConfigHelper.md +4 -8
- package/locales/en.json +1 -43
- package/package.json +22 -10
- package/dist/cjs/index.cjs +0 -121
- package/dist/esm/index.mjs +0 -118
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "loggingConnector",
|
|
4
|
+
"module": "@twin.org/engine-types",
|
|
5
|
+
"method": "initialiseLoggingConnector"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"type": "loggingComponent",
|
|
9
|
+
"module": "@twin.org/engine-types",
|
|
10
|
+
"method": "initialiseLoggingComponent"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "backgroundTaskConnector",
|
|
14
|
+
"module": "@twin.org/engine-types",
|
|
15
|
+
"method": "initialiseBackgroundTaskConnector"
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"type": "taskSchedulerComponent",
|
|
19
|
+
"module": "@twin.org/engine-types",
|
|
20
|
+
"method": "initialiseTaskSchedulerComponent"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"type": "eventBusConnector",
|
|
24
|
+
"module": "@twin.org/engine-types",
|
|
25
|
+
"method": "initialiseEventBusConnector"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"type": "eventBusComponent",
|
|
29
|
+
"module": "@twin.org/engine-types",
|
|
30
|
+
"method": "initialiseEventBusComponent"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"type": "telemetryConnector",
|
|
34
|
+
"module": "@twin.org/engine-types",
|
|
35
|
+
"method": "initialiseTelemetryConnector"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "telemetryComponent",
|
|
39
|
+
"module": "@twin.org/engine-types",
|
|
40
|
+
"method": "initialiseTelemetryComponent"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"type": "messagingEmailConnector",
|
|
44
|
+
"module": "@twin.org/engine-types",
|
|
45
|
+
"method": "initialiseMessagingEmailConnector"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "messagingSmsConnector",
|
|
49
|
+
"module": "@twin.org/engine-types",
|
|
50
|
+
"method": "initialiseMessagingSmsConnector"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"type": "messagingPushNotificationConnector",
|
|
54
|
+
"module": "@twin.org/engine-types",
|
|
55
|
+
"method": "initialiseMessagingPushNotificationConnector"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"type": "messagingAdminComponent",
|
|
59
|
+
"module": "@twin.org/engine-types",
|
|
60
|
+
"method": "initialiseMessagingAdminComponent"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"type": "messagingComponent",
|
|
64
|
+
"module": "@twin.org/engine-types",
|
|
65
|
+
"method": "initialiseMessagingComponent"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"type": "entityStorageComponent",
|
|
69
|
+
"module": "@twin.org/engine-types",
|
|
70
|
+
"method": "initialiseEntityStorageComponent"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "vaultConnector",
|
|
74
|
+
"module": "@twin.org/engine-types",
|
|
75
|
+
"method": "initialiseVaultConnector"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "blobStorageConnector",
|
|
79
|
+
"module": "@twin.org/engine-types",
|
|
80
|
+
"method": "initialiseBlobStorageConnector"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"type": "blobStorageComponent",
|
|
84
|
+
"module": "@twin.org/engine-types",
|
|
85
|
+
"method": "initialiseBlobStorageComponent"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"type": "verifiableStorageConnector",
|
|
89
|
+
"module": "@twin.org/engine-types",
|
|
90
|
+
"method": "initialiseVerifiableStorageConnector"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"type": "verifiableStorageComponent",
|
|
94
|
+
"module": "@twin.org/engine-types",
|
|
95
|
+
"method": "initialiseVerifiableStorageComponent"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"type": "faucetConnector",
|
|
99
|
+
"module": "@twin.org/engine-types",
|
|
100
|
+
"method": "initialiseFaucetConnector"
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"type": "walletConnector",
|
|
104
|
+
"module": "@twin.org/engine-types",
|
|
105
|
+
"method": "initialiseWalletConnector"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"type": "identityConnector",
|
|
109
|
+
"module": "@twin.org/engine-types",
|
|
110
|
+
"method": "initialiseIdentityConnector"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"type": "identityComponent",
|
|
114
|
+
"module": "@twin.org/engine-types",
|
|
115
|
+
"method": "initialiseIdentityComponent"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"type": "identityResolverConnector",
|
|
119
|
+
"module": "@twin.org/engine-types",
|
|
120
|
+
"method": "initialiseIdentityResolverConnector"
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"type": "identityResolverComponent",
|
|
124
|
+
"module": "@twin.org/engine-types",
|
|
125
|
+
"method": "initialiseIdentityResolverComponent"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"type": "identityProfileConnector",
|
|
129
|
+
"module": "@twin.org/engine-types",
|
|
130
|
+
"method": "initialiseIdentityProfileConnector"
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "identityProfileComponent",
|
|
134
|
+
"module": "@twin.org/engine-types",
|
|
135
|
+
"method": "initialiseIdentityProfileComponent"
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "nftConnector",
|
|
139
|
+
"module": "@twin.org/engine-types",
|
|
140
|
+
"method": "initialiseNftConnector"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"type": "nftComponent",
|
|
144
|
+
"module": "@twin.org/engine-types",
|
|
145
|
+
"method": "initialiseNftComponent"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"type": "immutableProofComponent",
|
|
149
|
+
"module": "@twin.org/engine-types",
|
|
150
|
+
"method": "initialiseImmutableProofComponent"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"type": "attestationConnector",
|
|
154
|
+
"module": "@twin.org/engine-types",
|
|
155
|
+
"method": "initialiseAttestationConnector"
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"type": "attestationComponent",
|
|
159
|
+
"module": "@twin.org/engine-types",
|
|
160
|
+
"method": "initialiseAttestationComponent"
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"type": "auditableItemGraphComponent",
|
|
164
|
+
"module": "@twin.org/engine-types",
|
|
165
|
+
"method": "initialiseAuditableItemGraphComponent"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"type": "auditableItemStreamComponent",
|
|
169
|
+
"module": "@twin.org/engine-types",
|
|
170
|
+
"method": "initialiseAuditableItemStreamComponent"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"type": "dataConverterConnector",
|
|
174
|
+
"module": "@twin.org/engine-types",
|
|
175
|
+
"method": "initialiseDataConverterConnector"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"type": "dataExtractorConnector",
|
|
179
|
+
"module": "@twin.org/engine-types",
|
|
180
|
+
"method": "initialiseDataExtractorConnector"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"type": "dataProcessingComponent",
|
|
184
|
+
"module": "@twin.org/engine-types",
|
|
185
|
+
"method": "initialiseDataProcessingComponent"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"type": "documentManagementComponent",
|
|
189
|
+
"module": "@twin.org/engine-types",
|
|
190
|
+
"method": "initialiseDocumentManagementComponent"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"type": "authenticationGeneratorComponent",
|
|
194
|
+
"module": "@twin.org/engine-types",
|
|
195
|
+
"method": "initialiseAuthenticationGeneratorComponent"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"type": "rightsManagementPapComponent",
|
|
199
|
+
"module": "@twin.org/engine-types",
|
|
200
|
+
"method": "initialiseRightsManagementPapComponent"
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"type": "rightsManagementPmpComponent",
|
|
204
|
+
"module": "@twin.org/engine-types",
|
|
205
|
+
"method": "initialiseRightsManagementPmpComponent"
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"type": "rightsManagementPxpComponent",
|
|
209
|
+
"module": "@twin.org/engine-types",
|
|
210
|
+
"method": "initialiseRightsManagementPxpComponent"
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"type": "rightsManagementPipComponent",
|
|
214
|
+
"module": "@twin.org/engine-types",
|
|
215
|
+
"method": "initialiseRightsManagementPipComponent"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"type": "rightsManagementPdpComponent",
|
|
219
|
+
"module": "@twin.org/engine-types",
|
|
220
|
+
"method": "initialiseRightsManagementPdpComponent"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"type": "rightsManagementPepComponent",
|
|
224
|
+
"module": "@twin.org/engine-types",
|
|
225
|
+
"method": "initialiseRightsManagementPepComponent"
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"type": "rightsManagementPnapComponent",
|
|
229
|
+
"module": "@twin.org/engine-types",
|
|
230
|
+
"method": "initialiseRightsManagementPnapComponent"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"type": "rightsManagementPnpComponent",
|
|
234
|
+
"module": "@twin.org/engine-types",
|
|
235
|
+
"method": "initialiseRightsManagementPnpComponent"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"type": "rightsManagementDapComponent",
|
|
239
|
+
"module": "@twin.org/engine-types",
|
|
240
|
+
"method": "initialiseRightsManagementDapComponent"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"type": "rightsManagementDarpComponent",
|
|
244
|
+
"module": "@twin.org/engine-types",
|
|
245
|
+
"method": "initialiseRightsManagementDarpComponent"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"type": "synchronisedStorageComponent",
|
|
249
|
+
"module": "@twin.org/engine-types",
|
|
250
|
+
"method": "initialiseSynchronisedStorageComponent"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"type": "federatedCatalogueComponent",
|
|
254
|
+
"module": "@twin.org/engine-types",
|
|
255
|
+
"method": "initialiseFederatedCatalogueComponent"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"type": "dataSpaceConnectorComponent",
|
|
259
|
+
"module": "@twin.org/engine-types",
|
|
260
|
+
"method": "initialiseDataSpaceConnectorComponent"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"type": "tenantAdminComponent",
|
|
264
|
+
"module": "@twin.org/engine-types",
|
|
265
|
+
"method": "initialiseTenantAdminComponent"
|
|
266
|
+
}
|
|
267
|
+
]
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { EngineCore } from "@twin.org/engine-core";
|
|
4
|
+
import coreTypeInitialisers from "./data/coreTypeInitialisers.json" with { type: "json" };
|
|
5
|
+
/**
|
|
6
|
+
* The engine with built in types.
|
|
7
|
+
*/
|
|
8
|
+
export class Engine extends EngineCore {
|
|
9
|
+
/**
|
|
10
|
+
* Runtime name for the class.
|
|
11
|
+
*/
|
|
12
|
+
static CLASS_NAME = "Engine";
|
|
13
|
+
/**
|
|
14
|
+
* Create a new instance of Engine.
|
|
15
|
+
* @param options The options for the engine.
|
|
16
|
+
*/
|
|
17
|
+
constructor(options) {
|
|
18
|
+
super(options);
|
|
19
|
+
this.addCoreTypeInitialisers();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Add the core type initializers.
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
addCoreTypeInitialisers() {
|
|
26
|
+
for (const initializer of coreTypeInitialisers) {
|
|
27
|
+
this.addTypeInitialiser(initializer.type, initializer.module, initializer.method);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/engine.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,UAAU,EAA2B,MAAM,uBAAuB,CAAC;AAI5E,OAAO,oBAAoB,MAAM,kCAAkC,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AAE1F;;GAEG;AACH,MAAM,OAAO,MAGX,SAAQ,UAAgB;IACzB;;OAEG;IACI,MAAM,CAAU,UAAU,YAA4B;IAE7D;;;OAGG;IACH,YAAY,OAAkC;QAC7C,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,uBAAuB,EAAE,CAAC;IAChC,CAAC;IAED;;;OAGG;IACK,uBAAuB;QAC9B,KAAK,MAAM,WAAW,IAAI,oBAAoB,EAAE,CAAC;YAChD,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;QACnF,CAAC;IACF,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { EngineCore, type IEngineCoreOptions } from \"@twin.org/engine-core\";\nimport type { IEngineState } from \"@twin.org/engine-models\";\nimport type { IEngineConfig } from \"@twin.org/engine-types\";\nimport { nameof } from \"@twin.org/nameof\";\nimport coreTypeInitialisers from \"./data/coreTypeInitialisers.json\" with { type: \"json\" };\n\n/**\n * The engine with built in types.\n */\nexport class Engine<\n\tC extends IEngineConfig = IEngineConfig,\n\tS extends IEngineState = IEngineState\n> extends EngineCore<C, S> {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<Engine>();\n\n\t/**\n\t * Create a new instance of Engine.\n\t * @param options The options for the engine.\n\t */\n\tconstructor(options?: IEngineCoreOptions<C, S>) {\n\t\tsuper(options);\n\n\t\tthis.addCoreTypeInitialisers();\n\t}\n\n\t/**\n\t * Add the core type initializers.\n\t * @internal\n\t */\n\tprivate addCoreTypeInitialisers(): void {\n\t\tfor (const initializer of coreTypeInitialisers) {\n\t\t\tthis.addTypeInitialiser(initializer.type, initializer.module, initializer.method);\n\t\t}\n\t}\n}\n"]}
|
package/dist/es/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nexport * from \"./engine.js\";\nexport * from \"./utils/engineConfigHelper.js\";\n"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright 2024 IOTA Stiftung.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0.
|
|
3
|
+
import { ContextIdKeys } from "@twin.org/context";
|
|
4
|
+
import { Guards, Is, StringHelper } from "@twin.org/core";
|
|
5
|
+
import { EntityStorageComponentType } from "@twin.org/engine-types";
|
|
6
|
+
import { EntitySchemaFactory } from "@twin.org/entity";
|
|
7
|
+
/**
|
|
8
|
+
* Helper methods for engine config.
|
|
9
|
+
*/
|
|
10
|
+
export class EngineConfigHelper {
|
|
11
|
+
/**
|
|
12
|
+
* Runtime name for the class.
|
|
13
|
+
*/
|
|
14
|
+
static CLASS_NAME = "EngineConfigHelper";
|
|
15
|
+
/**
|
|
16
|
+
* Add a custom entity storage to the engine configuration.
|
|
17
|
+
* @param engineConfig The engine configuration.
|
|
18
|
+
* @param entityTypeName The entity type name.
|
|
19
|
+
* @param entitySchema The entity schema.
|
|
20
|
+
* @param restPath The rest path to serve the entity storage from, leave undefined for no endpoints.
|
|
21
|
+
* @param partitionContextIds The context ids to use for partitioning.
|
|
22
|
+
*/
|
|
23
|
+
static addCustomEntityStorage(engineConfig, entityTypeName, entitySchema, restPath, partitionContextIds) {
|
|
24
|
+
Guards.object(EngineConfigHelper.CLASS_NAME, "engineConfig", engineConfig);
|
|
25
|
+
Guards.stringValue(EngineConfigHelper.CLASS_NAME, "entityTypeName", entityTypeName);
|
|
26
|
+
Guards.object(EngineConfigHelper.CLASS_NAME, "entitySchema", entitySchema);
|
|
27
|
+
engineConfig.types.entityStorageComponent ??= [];
|
|
28
|
+
EntitySchemaFactory.register(entityTypeName, () => entitySchema);
|
|
29
|
+
engineConfig.types.entityStorageComponent.push({
|
|
30
|
+
type: EntityStorageComponentType.Service,
|
|
31
|
+
options: {
|
|
32
|
+
entityStorageType: entityTypeName,
|
|
33
|
+
partitionContextIds: partitionContextIds ?? [ContextIdKeys.Node, ContextIdKeys.Tenant]
|
|
34
|
+
},
|
|
35
|
+
overrideInstanceType: StringHelper.kebabCase(entityTypeName),
|
|
36
|
+
restPath: Is.stringValue(restPath) ? restPath : undefined
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=engineConfigHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engineConfigHelper.js","sourceRoot":"","sources":["../../../src/utils/engineConfigHelper.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,0BAA0B,EAAsB,MAAM,wBAAwB,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAsB,MAAM,kBAAkB,CAAC;AAG3E;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAC9B;;OAEG;IACI,MAAM,CAAU,UAAU,wBAAwC;IAEzE;;;;;;;OAOG;IACI,MAAM,CAAC,sBAAsB,CACnC,YAA2B,EAC3B,cAAsB,EACtB,YAA8B,EAC9B,QAAiB,EACjB,mBAA8B;QAE9B,MAAM,CAAC,MAAM,CAAgB,kBAAkB,CAAC,UAAU,kBAAwB,YAAY,CAAC,CAAC;QAChG,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,UAAU,oBAA0B,cAAc,CAAC,CAAC;QAC1F,MAAM,CAAC,MAAM,CAAgB,kBAAkB,CAAC,UAAU,kBAAwB,YAAY,CAAC,CAAC;QAEhG,YAAY,CAAC,KAAK,CAAC,sBAAsB,KAAK,EAAE,CAAC;QAEjD,mBAAmB,CAAC,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC;QAEjE,YAAY,CAAC,KAAK,CAAC,sBAAsB,CAAC,IAAI,CAAC;YAC9C,IAAI,EAAE,0BAA0B,CAAC,OAAO;YACxC,OAAO,EAAE;gBACR,iBAAiB,EAAE,cAAc;gBACjC,mBAAmB,EAAE,mBAAmB,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC;aACtF;YACD,oBAAoB,EAAE,YAAY,CAAC,SAAS,CAAC,cAAc,CAAC;YAC5D,QAAQ,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;SACzD,CAAC,CAAC;IACJ,CAAC","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport { ContextIdKeys } from \"@twin.org/context\";\nimport { Guards, Is, StringHelper } from \"@twin.org/core\";\nimport { EntityStorageComponentType, type IEngineConfig } from \"@twin.org/engine-types\";\nimport { EntitySchemaFactory, type IEntitySchema } from \"@twin.org/entity\";\nimport { nameof } from \"@twin.org/nameof\";\n\n/**\n * Helper methods for engine config.\n */\nexport class EngineConfigHelper {\n\t/**\n\t * Runtime name for the class.\n\t */\n\tpublic static readonly CLASS_NAME: string = nameof<EngineConfigHelper>();\n\n\t/**\n\t * Add a custom entity storage to the engine configuration.\n\t * @param engineConfig The engine configuration.\n\t * @param entityTypeName The entity type name.\n\t * @param entitySchema The entity schema.\n\t * @param restPath The rest path to serve the entity storage from, leave undefined for no endpoints.\n\t * @param partitionContextIds The context ids to use for partitioning.\n\t */\n\tpublic static addCustomEntityStorage<T>(\n\t\tengineConfig: IEngineConfig,\n\t\tentityTypeName: string,\n\t\tentitySchema: IEntitySchema<T>,\n\t\trestPath?: string,\n\t\tpartitionContextIds?: string[]\n\t): void {\n\t\tGuards.object<IEngineConfig>(EngineConfigHelper.CLASS_NAME, nameof(engineConfig), engineConfig);\n\t\tGuards.stringValue(EngineConfigHelper.CLASS_NAME, nameof(entityTypeName), entityTypeName);\n\t\tGuards.object<IEntitySchema>(EngineConfigHelper.CLASS_NAME, nameof(entitySchema), entitySchema);\n\n\t\tengineConfig.types.entityStorageComponent ??= [];\n\n\t\tEntitySchemaFactory.register(entityTypeName, () => entitySchema);\n\n\t\tengineConfig.types.entityStorageComponent.push({\n\t\t\ttype: EntityStorageComponentType.Service,\n\t\t\toptions: {\n\t\t\t\tentityStorageType: entityTypeName,\n\t\t\t\tpartitionContextIds: partitionContextIds ?? [ContextIdKeys.Node, ContextIdKeys.Tenant]\n\t\t\t},\n\t\t\toverrideInstanceType: StringHelper.kebabCase(entityTypeName),\n\t\t\trestPath: Is.stringValue(restPath) ? restPath : undefined\n\t\t});\n\t}\n}\n"]}
|
package/dist/types/engine.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare class Engine<C extends IEngineConfig = IEngineConfig, S extends I
|
|
|
8
8
|
/**
|
|
9
9
|
* Runtime name for the class.
|
|
10
10
|
*/
|
|
11
|
-
readonly CLASS_NAME: string;
|
|
11
|
+
static readonly CLASS_NAME: string;
|
|
12
12
|
/**
|
|
13
13
|
* Create a new instance of Engine.
|
|
14
14
|
* @param options The options for the engine.
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from "./engine";
|
|
2
|
-
export * from "./utils/engineConfigHelper";
|
|
1
|
+
export * from "./engine.js";
|
|
2
|
+
export * from "./utils/engineConfigHelper.js";
|
|
@@ -14,10 +14,7 @@ export declare class EngineConfigHelper {
|
|
|
14
14
|
* @param entityTypeName The entity type name.
|
|
15
15
|
* @param entitySchema The entity schema.
|
|
16
16
|
* @param restPath The rest path to serve the entity storage from, leave undefined for no endpoints.
|
|
17
|
-
* @param
|
|
18
|
-
* @param options.partitionPerUser Whether to partition the user identity in the data, defaults to false.
|
|
17
|
+
* @param partitionContextIds The context ids to use for partitioning.
|
|
19
18
|
*/
|
|
20
|
-
static addCustomEntityStorage<T>(engineConfig: IEngineConfig, entityTypeName: string, entitySchema: IEntitySchema<T>, restPath?: string,
|
|
21
|
-
partitionPerUser?: boolean;
|
|
22
|
-
}): void;
|
|
19
|
+
static addCustomEntityStorage<T>(engineConfig: IEngineConfig, entityTypeName: string, entitySchema: IEntitySchema<T>, restPath?: string, partitionContextIds?: string[]): void;
|
|
23
20
|
}
|
package/docs/changelog.md
CHANGED
|
@@ -1,5 +1,340 @@
|
|
|
1
1
|
# @twin.org/engine - Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.3-next.2](https://github.com/twinfoundation/engine/compare/engine-v0.0.3-next.1...engine-v0.0.3-next.2) (2025-11-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Miscellaneous Chores
|
|
7
|
+
|
|
8
|
+
* **engine:** Synchronize repo versions
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/engine-core bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
16
|
+
* @twin.org/engine-models bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
17
|
+
* @twin.org/engine-types bumped from 0.0.3-next.1 to 0.0.3-next.2
|
|
18
|
+
|
|
19
|
+
## [0.0.3-next.1](https://github.com/twinfoundation/engine/compare/engine-v0.0.3-next.0...engine-v0.0.3-next.1) (2025-11-13)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
* add auth admin component ([201cd06](https://github.com/twinfoundation/engine/commit/201cd061be83afccb5a6b06856ffe7cf8db7d6b3))
|
|
25
|
+
* add context id features ([#51](https://github.com/twinfoundation/engine/issues/51)) ([eaef180](https://github.com/twinfoundation/engine/commit/eaef1807397a907bc7655ef1545a151a710ca2f1))
|
|
26
|
+
* add data space connector ([a824d99](https://github.com/twinfoundation/engine/commit/a824d9931faeaa8115e01f8e7545b802d0e7ac70))
|
|
27
|
+
* add default logging component for web server ([8ad94f0](https://github.com/twinfoundation/engine/commit/8ad94f0d2d9a5241a8854b1e59fb9a55ce310142))
|
|
28
|
+
* add engine type helper for config lookups ([a20a398](https://github.com/twinfoundation/engine/commit/a20a3987016c48351178ab8410bc05b0fba0f2c1))
|
|
29
|
+
* add federated catalogue ([1b15dd0](https://github.com/twinfoundation/engine/commit/1b15dd059a11446457651c411a73145fab37f025))
|
|
30
|
+
* add isPrimary and isClone methods ([a7c63e9](https://github.com/twinfoundation/engine/commit/a7c63e97f54c95b104cc81e66d3fa42c6607bdc1))
|
|
31
|
+
* add latest rights management components ([2d305c8](https://github.com/twinfoundation/engine/commit/2d305c8c85c77bb4f5694c76422db4a11efc1a40))
|
|
32
|
+
* add mimeTypeProcessors and disableNodeIdentity ([bb7e81e](https://github.com/twinfoundation/engine/commit/bb7e81e2036fe042068a5645ec59b22e20d33aad))
|
|
33
|
+
* add rest clients as components ([c6f956a](https://github.com/twinfoundation/engine/commit/c6f956afe4fc22cd552174539c92a109448dc242))
|
|
34
|
+
* add rights management modules ([e02cadc](https://github.com/twinfoundation/engine/commit/e02cadc840d242fe16a73ab41ba61376c7467e50))
|
|
35
|
+
* add rights management negotiation ([84ef46b](https://github.com/twinfoundation/engine/commit/84ef46bff110611a19512793425c8c873ee2a590))
|
|
36
|
+
* add synchronised storage support ([5142e34](https://github.com/twinfoundation/engine/commit/5142e3488f09195cf9f48a9c6c6d1014231a4c2c))
|
|
37
|
+
* add task scheduler ([0951107](https://github.com/twinfoundation/engine/commit/09511073ad042194a45206303f0ef31d8d6af5db))
|
|
38
|
+
* add validate-locales ([b92ea09](https://github.com/twinfoundation/engine/commit/b92ea09dbcfe35225271a51f24d231f59e2d363e))
|
|
39
|
+
* addCustomEntityStorage optional rest path ([55f42c5](https://github.com/twinfoundation/engine/commit/55f42c568945f010eb8883e27fb385d2c30eebff))
|
|
40
|
+
* eslint migration to flat config ([6b978da](https://github.com/twinfoundation/engine/commit/6b978daf777a615d7758b63c3df57d5a376f6dfb))
|
|
41
|
+
* gas station integration ([#17](https://github.com/twinfoundation/engine/issues/17)) ([a3f844a](https://github.com/twinfoundation/engine/commit/a3f844a7fc58c43b4d0700d8d4351062045e66e1))
|
|
42
|
+
* iota rebased release ([474d92b](https://github.com/twinfoundation/engine/commit/474d92b352f4ccc431a4f138afee2ee89824664d))
|
|
43
|
+
* maintain isDefault flag for registered instances ([2ac5bee](https://github.com/twinfoundation/engine/commit/2ac5bee094bef42b396cc82b0d18bb6aebe27352))
|
|
44
|
+
* modifying the engine to run the new services ([#10](https://github.com/twinfoundation/engine/issues/10)) ([6f7141f](https://github.com/twinfoundation/engine/commit/6f7141fe0a6d05c725066b274bcc18b5490e580b))
|
|
45
|
+
* move environment variable processing to node level ([2223c12](https://github.com/twinfoundation/engine/commit/2223c12f49f3d34051ecec9687351aa5dd094e54))
|
|
46
|
+
* override type initialisers with new registrations ([5b4ff56](https://github.com/twinfoundation/engine/commit/5b4ff561d06b6513c870a72bb20ba23c0653cfe8))
|
|
47
|
+
* simplify config building ([732c871](https://github.com/twinfoundation/engine/commit/732c871c5aca236759168f4bc15aeffd98a330a8))
|
|
48
|
+
* standardised engine logging naming ([0dbf857](https://github.com/twinfoundation/engine/commit/0dbf857587641f86ddf010143519d0e8333489ff))
|
|
49
|
+
* update dependencies ([97c9f64](https://github.com/twinfoundation/engine/commit/97c9f64b6ef096963bcc5de338a2a9e99bdc1a11))
|
|
50
|
+
* update framework core ([acc0f8d](https://github.com/twinfoundation/engine/commit/acc0f8d455a4b8ec47f1da643139fa0f07775fa6))
|
|
51
|
+
* update includeUserIdentity usage ([d34f597](https://github.com/twinfoundation/engine/commit/d34f597a61f9645a029411d2911bbda20ddc9eb9))
|
|
52
|
+
* update rights management and add authentication generators ([f728a1e](https://github.com/twinfoundation/engine/commit/f728a1efea15ada8d10cfbe17cafe7e2b252f527))
|
|
53
|
+
* update rights management config ([d447575](https://github.com/twinfoundation/engine/commit/d447575cd5cdf3cdf1fe92087e90188ec97516f5))
|
|
54
|
+
* update rights management dependencies ([14d06fb](https://github.com/twinfoundation/engine/commit/14d06fb6604ad04e4094da7b51b61a01a0280b8b))
|
|
55
|
+
* upgrade framework components ([efd52e8](https://github.com/twinfoundation/engine/commit/efd52e80564fff29c3897bfa09b6305b3a322812))
|
|
56
|
+
* use peer dependencies ([69dd744](https://github.com/twinfoundation/engine/commit/69dd7449010b8e6f5f35e7fad201ad4c1cab400c))
|
|
57
|
+
* use shared store mechanism ([#2](https://github.com/twinfoundation/engine/issues/2)) ([9eed8d7](https://github.com/twinfoundation/engine/commit/9eed8d7766388479b42f03e2542fe761f2156408))
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Bug Fixes
|
|
61
|
+
|
|
62
|
+
* blob storage encryption settings ([63ee879](https://github.com/twinfoundation/engine/commit/63ee87904d2be205d8fe2fa11b536790a0d22082))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Dependencies
|
|
66
|
+
|
|
67
|
+
* The following workspace dependencies were updated
|
|
68
|
+
* dependencies
|
|
69
|
+
* @twin.org/engine-core bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
70
|
+
* @twin.org/engine-models bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
71
|
+
* @twin.org/engine-types bumped from 0.0.3-next.0 to 0.0.3-next.1
|
|
72
|
+
|
|
73
|
+
## [0.0.2-next.26](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.25...engine-v0.0.2-next.26) (2025-10-09)
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
### Miscellaneous Chores
|
|
77
|
+
|
|
78
|
+
* **engine:** Synchronize repo versions
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Dependencies
|
|
82
|
+
|
|
83
|
+
* The following workspace dependencies were updated
|
|
84
|
+
* dependencies
|
|
85
|
+
* @twin.org/engine-core bumped from 0.0.2-next.25 to 0.0.2-next.26
|
|
86
|
+
* @twin.org/engine-models bumped from 0.0.2-next.25 to 0.0.2-next.26
|
|
87
|
+
* @twin.org/engine-types bumped from 0.0.2-next.25 to 0.0.2-next.26
|
|
88
|
+
|
|
89
|
+
## [0.0.2-next.25](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.24...engine-v0.0.2-next.25) (2025-10-09)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
### Features
|
|
93
|
+
|
|
94
|
+
* add validate-locales ([b92ea09](https://github.com/twinfoundation/engine/commit/b92ea09dbcfe35225271a51f24d231f59e2d363e))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### Dependencies
|
|
98
|
+
|
|
99
|
+
* The following workspace dependencies were updated
|
|
100
|
+
* dependencies
|
|
101
|
+
* @twin.org/engine-core bumped from 0.0.2-next.24 to 0.0.2-next.25
|
|
102
|
+
* @twin.org/engine-models bumped from 0.0.2-next.24 to 0.0.2-next.25
|
|
103
|
+
* @twin.org/engine-types bumped from 0.0.2-next.24 to 0.0.2-next.25
|
|
104
|
+
|
|
105
|
+
## [0.0.2-next.24](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.23...engine-v0.0.2-next.24) (2025-10-08)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### Features
|
|
109
|
+
|
|
110
|
+
* maintain isDefault flag for registered instances ([2ac5bee](https://github.com/twinfoundation/engine/commit/2ac5bee094bef42b396cc82b0d18bb6aebe27352))
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
### Dependencies
|
|
114
|
+
|
|
115
|
+
* The following workspace dependencies were updated
|
|
116
|
+
* dependencies
|
|
117
|
+
* @twin.org/engine-core bumped from 0.0.2-next.23 to 0.0.2-next.24
|
|
118
|
+
* @twin.org/engine-models bumped from 0.0.2-next.23 to 0.0.2-next.24
|
|
119
|
+
* @twin.org/engine-types bumped from 0.0.2-next.23 to 0.0.2-next.24
|
|
120
|
+
|
|
121
|
+
## [0.0.2-next.23](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.22...engine-v0.0.2-next.23) (2025-10-07)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
### Features
|
|
125
|
+
|
|
126
|
+
* override type initialisers with new registrations ([5b4ff56](https://github.com/twinfoundation/engine/commit/5b4ff561d06b6513c870a72bb20ba23c0653cfe8))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### Dependencies
|
|
130
|
+
|
|
131
|
+
* The following workspace dependencies were updated
|
|
132
|
+
* dependencies
|
|
133
|
+
* @twin.org/engine-core bumped from 0.0.2-next.22 to 0.0.2-next.23
|
|
134
|
+
* @twin.org/engine-models bumped from 0.0.2-next.22 to 0.0.2-next.23
|
|
135
|
+
* @twin.org/engine-types bumped from 0.0.2-next.22 to 0.0.2-next.23
|
|
136
|
+
|
|
137
|
+
## [0.0.2-next.22](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.21...engine-v0.0.2-next.22) (2025-10-07)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
### Miscellaneous Chores
|
|
141
|
+
|
|
142
|
+
* **engine:** Synchronize repo versions
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
### Dependencies
|
|
146
|
+
|
|
147
|
+
* The following workspace dependencies were updated
|
|
148
|
+
* dependencies
|
|
149
|
+
* @twin.org/engine-core bumped from 0.0.2-next.21 to 0.0.2-next.22
|
|
150
|
+
* @twin.org/engine-models bumped from 0.0.2-next.21 to 0.0.2-next.22
|
|
151
|
+
* @twin.org/engine-types bumped from 0.0.2-next.21 to 0.0.2-next.22
|
|
152
|
+
|
|
153
|
+
## [0.0.2-next.21](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.20...engine-v0.0.2-next.21) (2025-10-07)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
### Features
|
|
157
|
+
|
|
158
|
+
* use peer dependencies ([69dd744](https://github.com/twinfoundation/engine/commit/69dd7449010b8e6f5f35e7fad201ad4c1cab400c))
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### Dependencies
|
|
162
|
+
|
|
163
|
+
* The following workspace dependencies were updated
|
|
164
|
+
* dependencies
|
|
165
|
+
* @twin.org/engine-core bumped from 0.0.2-next.20 to 0.0.2-next.21
|
|
166
|
+
* @twin.org/engine-models bumped from 0.0.2-next.20 to 0.0.2-next.21
|
|
167
|
+
* @twin.org/engine-types bumped from 0.0.2-next.20 to 0.0.2-next.21
|
|
168
|
+
|
|
169
|
+
## [0.0.2-next.20](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.19...engine-v0.0.2-next.20) (2025-10-06)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
### Features
|
|
173
|
+
|
|
174
|
+
* standardised engine logging naming ([0dbf857](https://github.com/twinfoundation/engine/commit/0dbf857587641f86ddf010143519d0e8333489ff))
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
### Dependencies
|
|
178
|
+
|
|
179
|
+
* The following workspace dependencies were updated
|
|
180
|
+
* dependencies
|
|
181
|
+
* @twin.org/engine-core bumped from 0.0.2-next.19 to 0.0.2-next.20
|
|
182
|
+
* @twin.org/engine-models bumped from 0.0.2-next.19 to 0.0.2-next.20
|
|
183
|
+
* @twin.org/engine-types bumped from 0.0.2-next.19 to 0.0.2-next.20
|
|
184
|
+
|
|
185
|
+
## [0.0.2-next.19](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.18...engine-v0.0.2-next.19) (2025-10-02)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
### Features
|
|
189
|
+
|
|
190
|
+
* simplify config building ([732c871](https://github.com/twinfoundation/engine/commit/732c871c5aca236759168f4bc15aeffd98a330a8))
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
### Dependencies
|
|
194
|
+
|
|
195
|
+
* The following workspace dependencies were updated
|
|
196
|
+
* dependencies
|
|
197
|
+
* @twin.org/engine-core bumped from 0.0.2-next.18 to 0.0.2-next.19
|
|
198
|
+
* @twin.org/engine-models bumped from 0.0.2-next.18 to 0.0.2-next.19
|
|
199
|
+
* @twin.org/engine-types bumped from 0.0.2-next.18 to 0.0.2-next.19
|
|
200
|
+
|
|
201
|
+
## [0.0.2-next.18](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.17...engine-v0.0.2-next.18) (2025-09-29)
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
### Features
|
|
205
|
+
|
|
206
|
+
* upgrade framework components ([efd52e8](https://github.com/twinfoundation/engine/commit/efd52e80564fff29c3897bfa09b6305b3a322812))
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
### Dependencies
|
|
210
|
+
|
|
211
|
+
* The following workspace dependencies were updated
|
|
212
|
+
* dependencies
|
|
213
|
+
* @twin.org/engine-core bumped from 0.0.2-next.17 to 0.0.2-next.18
|
|
214
|
+
* @twin.org/engine-models bumped from 0.0.2-next.17 to 0.0.2-next.18
|
|
215
|
+
* @twin.org/engine-types bumped from 0.0.2-next.17 to 0.0.2-next.18
|
|
216
|
+
|
|
217
|
+
## [0.0.2-next.17](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.16...engine-v0.0.2-next.17) (2025-09-26)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
### Features
|
|
221
|
+
|
|
222
|
+
* add engine type helper for config lookups ([a20a398](https://github.com/twinfoundation/engine/commit/a20a3987016c48351178ab8410bc05b0fba0f2c1))
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
### Dependencies
|
|
226
|
+
|
|
227
|
+
* The following workspace dependencies were updated
|
|
228
|
+
* dependencies
|
|
229
|
+
* @twin.org/engine-core bumped from 0.0.2-next.16 to 0.0.2-next.17
|
|
230
|
+
* @twin.org/engine-models bumped from 0.0.2-next.16 to 0.0.2-next.17
|
|
231
|
+
* @twin.org/engine-types bumped from 0.0.2-next.16 to 0.0.2-next.17
|
|
232
|
+
|
|
233
|
+
## [0.0.2-next.16](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.15...engine-v0.0.2-next.16) (2025-09-25)
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
### Miscellaneous Chores
|
|
237
|
+
|
|
238
|
+
* **engine:** Synchronize repo versions
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
### Dependencies
|
|
242
|
+
|
|
243
|
+
* The following workspace dependencies were updated
|
|
244
|
+
* dependencies
|
|
245
|
+
* @twin.org/engine-core bumped from 0.0.2-next.15 to 0.0.2-next.16
|
|
246
|
+
* @twin.org/engine-types bumped from 0.0.2-next.15 to 0.0.2-next.16
|
|
247
|
+
|
|
248
|
+
## [0.0.2-next.15](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.14...engine-v0.0.2-next.15) (2025-09-24)
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
### Features
|
|
252
|
+
|
|
253
|
+
* update rights management and add authentication generators ([f728a1e](https://github.com/twinfoundation/engine/commit/f728a1efea15ada8d10cfbe17cafe7e2b252f527))
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
### Dependencies
|
|
257
|
+
|
|
258
|
+
* The following workspace dependencies were updated
|
|
259
|
+
* dependencies
|
|
260
|
+
* @twin.org/engine-core bumped from 0.0.2-next.14 to 0.0.2-next.15
|
|
261
|
+
* @twin.org/engine-types bumped from 0.0.2-next.14 to 0.0.2-next.15
|
|
262
|
+
|
|
263
|
+
## [0.0.2-next.14](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.13...engine-v0.0.2-next.14) (2025-09-19)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
### Features
|
|
267
|
+
|
|
268
|
+
* add latest rights management components ([2d305c8](https://github.com/twinfoundation/engine/commit/2d305c8c85c77bb4f5694c76422db4a11efc1a40))
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
### Dependencies
|
|
272
|
+
|
|
273
|
+
* The following workspace dependencies were updated
|
|
274
|
+
* dependencies
|
|
275
|
+
* @twin.org/engine-core bumped from 0.0.2-next.13 to 0.0.2-next.14
|
|
276
|
+
* @twin.org/engine-types bumped from 0.0.2-next.13 to 0.0.2-next.14
|
|
277
|
+
|
|
278
|
+
## [0.0.2-next.13](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.12...engine-v0.0.2-next.13) (2025-09-08)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
### Features
|
|
282
|
+
|
|
283
|
+
* update rights management dependencies ([14d06fb](https://github.com/twinfoundation/engine/commit/14d06fb6604ad04e4094da7b51b61a01a0280b8b))
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
### Dependencies
|
|
287
|
+
|
|
288
|
+
* The following workspace dependencies were updated
|
|
289
|
+
* dependencies
|
|
290
|
+
* @twin.org/engine-core bumped from 0.0.2-next.12 to 0.0.2-next.13
|
|
291
|
+
* @twin.org/engine-types bumped from 0.0.2-next.12 to 0.0.2-next.13
|
|
292
|
+
|
|
293
|
+
## [0.0.2-next.12](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.11...engine-v0.0.2-next.12) (2025-09-05)
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
### Features
|
|
297
|
+
|
|
298
|
+
* add rights management negotiation ([84ef46b](https://github.com/twinfoundation/engine/commit/84ef46bff110611a19512793425c8c873ee2a590))
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
### Dependencies
|
|
302
|
+
|
|
303
|
+
* The following workspace dependencies were updated
|
|
304
|
+
* dependencies
|
|
305
|
+
* @twin.org/engine-core bumped from 0.0.2-next.11 to 0.0.2-next.12
|
|
306
|
+
* @twin.org/engine-types bumped from 0.0.2-next.11 to 0.0.2-next.12
|
|
307
|
+
|
|
308
|
+
## [0.0.2-next.11](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.10...engine-v0.0.2-next.11) (2025-08-29)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
### Features
|
|
312
|
+
|
|
313
|
+
* eslint migration to flat config ([6b978da](https://github.com/twinfoundation/engine/commit/6b978daf777a615d7758b63c3df57d5a376f6dfb))
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
### Dependencies
|
|
317
|
+
|
|
318
|
+
* The following workspace dependencies were updated
|
|
319
|
+
* dependencies
|
|
320
|
+
* @twin.org/engine-core bumped from 0.0.2-next.10 to 0.0.2-next.11
|
|
321
|
+
* @twin.org/engine-types bumped from 0.0.2-next.10 to 0.0.2-next.11
|
|
322
|
+
|
|
323
|
+
## [0.0.2-next.10](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.9...engine-v0.0.2-next.10) (2025-08-26)
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
### Features
|
|
327
|
+
|
|
328
|
+
* add data space connector ([a824d99](https://github.com/twinfoundation/engine/commit/a824d9931faeaa8115e01f8e7545b802d0e7ac70))
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
### Dependencies
|
|
332
|
+
|
|
333
|
+
* The following workspace dependencies were updated
|
|
334
|
+
* dependencies
|
|
335
|
+
* @twin.org/engine-core bumped from 0.0.2-next.9 to 0.0.2-next.10
|
|
336
|
+
* @twin.org/engine-types bumped from 0.0.2-next.9 to 0.0.2-next.10
|
|
337
|
+
|
|
3
338
|
## [0.0.2-next.9](https://github.com/twinfoundation/engine/compare/engine-v0.0.2-next.8...engine-v0.0.2-next.9) (2025-08-25)
|
|
4
339
|
|
|
5
340
|
|
|
@@ -24,7 +24,7 @@ Runtime name for the class.
|
|
|
24
24
|
|
|
25
25
|
### addCustomEntityStorage()
|
|
26
26
|
|
|
27
|
-
> `static` **addCustomEntityStorage**\<`T`\>(`engineConfig`, `entityTypeName`, `entitySchema`, `restPath?`, `
|
|
27
|
+
> `static` **addCustomEntityStorage**\<`T`\>(`engineConfig`, `entityTypeName`, `entitySchema`, `restPath?`, `partitionContextIds?`): `void`
|
|
28
28
|
|
|
29
29
|
Add a custom entity storage to the engine configuration.
|
|
30
30
|
|
|
@@ -60,15 +60,11 @@ The entity schema.
|
|
|
60
60
|
|
|
61
61
|
The rest path to serve the entity storage from, leave undefined for no endpoints.
|
|
62
62
|
|
|
63
|
-
#####
|
|
63
|
+
##### partitionContextIds?
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
`string`[]
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
`boolean`
|
|
70
|
-
|
|
71
|
-
Whether to partition the user identity in the data, defaults to false.
|
|
67
|
+
The context ids to use for partitioning.
|
|
72
68
|
|
|
73
69
|
#### Returns
|
|
74
70
|
|
package/locales/en.json
CHANGED
|
@@ -1,43 +1 @@
|
|
|
1
|
-
{
|
|
2
|
-
"error": {
|
|
3
|
-
"engineCore": {
|
|
4
|
-
"connectorUnknownType": "Unknown connector type \"{type}\" specified for \"{connectorType}\"",
|
|
5
|
-
"componentUnknownType": "Unknown component type \"{type}\" specified for \"{componentType}\"",
|
|
6
|
-
"entityStorageCustomMissing": "Entity storage custom \"{typeCustom}\" missing for component \"{storageName}\"",
|
|
7
|
-
"entityStorageMissing": "Entity storage configuration missing for component \"{storageName}\"",
|
|
8
|
-
"bootstrapFailed": "Bootstrap failed for component \"{component}\", please check the logs for more information",
|
|
9
|
-
"componentStopFailed": "Failed to stop component \"{component}\"",
|
|
10
|
-
"moduleMethodFailed": "Failed to load method \"{method}\" from module \"{module}\""
|
|
11
|
-
},
|
|
12
|
-
"fileStateStorage": {
|
|
13
|
-
"failedLoading": "Failed to load file state storage from \"{filename}\"",
|
|
14
|
-
"failedSaving": "Failed to save file state storage to \"{filename}\""
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
"engineCore": {
|
|
18
|
-
"debuggingEnabled": "Debugging is enabled",
|
|
19
|
-
"starting": "Engine is starting",
|
|
20
|
-
"started": "Engine has started",
|
|
21
|
-
"stopping": "Engine is stopping",
|
|
22
|
-
"stopped": "Engine has stopped",
|
|
23
|
-
"configuring": "Configuring {element}",
|
|
24
|
-
"configuringEntityStorage": "Configuring {element} with name \"{storageName}\" using \"{storageType}\" connector",
|
|
25
|
-
"bootstrapStarted": "Bootstrap started",
|
|
26
|
-
"bootstrapComplete": "Bootstrap complete",
|
|
27
|
-
"bootstrapping": "Bootstrap {element}",
|
|
28
|
-
"componentsStarting": "Components are starting",
|
|
29
|
-
"componentsComplete": "Components have started",
|
|
30
|
-
"componentsStopping": "Components are stopping",
|
|
31
|
-
"componentsStopped": "Components have stopped",
|
|
32
|
-
"componentStarting": "Starting {element}",
|
|
33
|
-
"componentStopping": "Stopping {element}"
|
|
34
|
-
},
|
|
35
|
-
"fileStateStorage": {
|
|
36
|
-
"loading": "Loading state from file storage with filename \"{filename}\"",
|
|
37
|
-
"saving": "Saving state to file storage with filename \"{filename}\""
|
|
38
|
-
},
|
|
39
|
-
"memoryStateStorage": {
|
|
40
|
-
"loading": "Loading state from memory",
|
|
41
|
-
"saving": "Saving state to memory"
|
|
42
|
-
}
|
|
43
|
-
}
|
|
1
|
+
{}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/engine",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3-next.2",
|
|
4
4
|
"description": "Engine implementation.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,28 +14,40 @@
|
|
|
14
14
|
"node": ">=20.0.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
+
"@twin.org/context": "next",
|
|
17
18
|
"@twin.org/core": "next",
|
|
18
|
-
"@twin.org/engine-core": "0.0.
|
|
19
|
-
"@twin.org/engine-
|
|
19
|
+
"@twin.org/engine-core": "0.0.3-next.2",
|
|
20
|
+
"@twin.org/engine-models": "0.0.3-next.2",
|
|
21
|
+
"@twin.org/engine-types": "0.0.3-next.2",
|
|
20
22
|
"@twin.org/entity": "next",
|
|
21
23
|
"@twin.org/nameof": "next"
|
|
22
24
|
},
|
|
23
|
-
"main": "./dist/
|
|
24
|
-
"module": "./dist/esm/index.mjs",
|
|
25
|
+
"main": "./dist/es/index.js",
|
|
25
26
|
"types": "./dist/types/index.d.ts",
|
|
26
27
|
"exports": {
|
|
27
28
|
".": {
|
|
28
29
|
"types": "./dist/types/index.d.ts",
|
|
29
|
-
"
|
|
30
|
-
"
|
|
30
|
+
"import": "./dist/es/index.js",
|
|
31
|
+
"default": "./dist/es/index.js"
|
|
31
32
|
},
|
|
32
33
|
"./locales/*.json": "./locales/*.json"
|
|
33
34
|
},
|
|
34
35
|
"files": [
|
|
35
|
-
"dist/
|
|
36
|
-
"dist/esm",
|
|
36
|
+
"dist/es",
|
|
37
37
|
"dist/types",
|
|
38
38
|
"locales",
|
|
39
39
|
"docs"
|
|
40
|
-
]
|
|
40
|
+
],
|
|
41
|
+
"keywords": [
|
|
42
|
+
"twin",
|
|
43
|
+
"trade",
|
|
44
|
+
"iota",
|
|
45
|
+
"framework",
|
|
46
|
+
"blockchain",
|
|
47
|
+
"engine"
|
|
48
|
+
],
|
|
49
|
+
"bugs": {
|
|
50
|
+
"url": "git+https://github.com/twinfoundation/engine/issues"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://twindev.org"
|
|
41
53
|
}
|
package/dist/cjs/index.cjs
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var engineCore = require('@twin.org/engine-core');
|
|
4
|
-
var core = require('@twin.org/core');
|
|
5
|
-
var engineTypes = require('@twin.org/engine-types');
|
|
6
|
-
var entity = require('@twin.org/entity');
|
|
7
|
-
|
|
8
|
-
// Copyright 2024 IOTA Stiftung.
|
|
9
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
10
|
-
/**
|
|
11
|
-
* The engine with built in types.
|
|
12
|
-
*/
|
|
13
|
-
class Engine extends engineCore.EngineCore {
|
|
14
|
-
/**
|
|
15
|
-
* Runtime name for the class.
|
|
16
|
-
*/
|
|
17
|
-
CLASS_NAME = "Engine";
|
|
18
|
-
/**
|
|
19
|
-
* Create a new instance of Engine.
|
|
20
|
-
* @param options The options for the engine.
|
|
21
|
-
*/
|
|
22
|
-
constructor(options) {
|
|
23
|
-
super(options);
|
|
24
|
-
this.addCoreTypeInitialisers();
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Add the core type initializers.
|
|
28
|
-
* @internal
|
|
29
|
-
*/
|
|
30
|
-
addCoreTypeInitialisers() {
|
|
31
|
-
this.addTypeInitialiser("loggingConnector", this._context.config.types.loggingConnector, "@twin.org/engine-types", "initialiseLoggingConnector");
|
|
32
|
-
this.addTypeInitialiser("loggingComponent", this._context.config.types.loggingComponent, "@twin.org/engine-types", "initialiseLoggingComponent");
|
|
33
|
-
this.addTypeInitialiser("backgroundTaskConnector", this._context.config.types.backgroundTaskConnector, "@twin.org/engine-types", "initialiseBackgroundTaskConnector");
|
|
34
|
-
this.addTypeInitialiser("taskSchedulerComponent", this._context.config.types.taskSchedulerComponent, "@twin.org/engine-types", "initialiseTaskSchedulerComponent");
|
|
35
|
-
this.addTypeInitialiser("eventBusConnector", this._context.config.types.eventBusConnector, "@twin.org/engine-types", "initialiseEventBusConnector");
|
|
36
|
-
this.addTypeInitialiser("eventBusComponent", this._context.config.types.eventBusComponent, "@twin.org/engine-types", "initialiseEventBusComponent");
|
|
37
|
-
this.addTypeInitialiser("telemetryConnector", this._context.config.types.telemetryConnector, "@twin.org/engine-types", "initialiseTelemetryConnector");
|
|
38
|
-
this.addTypeInitialiser("telemetryComponent", this._context.config.types.telemetryComponent, "@twin.org/engine-types", "initialiseTelemetryComponent");
|
|
39
|
-
this.addTypeInitialiser("messagingEmailConnector", this._context.config.types.messagingEmailConnector, "@twin.org/engine-types", "initialiseMessagingEmailConnector");
|
|
40
|
-
this.addTypeInitialiser("messagingSmsConnector", this._context.config.types.messagingSmsConnector, "@twin.org/engine-types", "initialiseMessagingSmsConnector");
|
|
41
|
-
this.addTypeInitialiser("messagingPushNotificationConnector", this._context.config.types.messagingPushNotificationConnector, "@twin.org/engine-types", "initialiseMessagingPushNotificationConnector");
|
|
42
|
-
this.addTypeInitialiser("messagingComponent", this._context.config.types.messagingComponent, "@twin.org/engine-types", "initialiseMessagingComponent");
|
|
43
|
-
this.addTypeInitialiser("entityStorageComponent", this._context.config.types.entityStorageComponent, "@twin.org/engine-types", "initialiseEntityStorageComponent");
|
|
44
|
-
this.addTypeInitialiser("vaultConnector", this._context.config.types.vaultConnector, "@twin.org/engine-types", "initialiseVaultConnector");
|
|
45
|
-
this.addTypeInitialiser("blobStorageConnector", this._context.config.types.blobStorageConnector, "@twin.org/engine-types", "initialiseBlobStorageConnector");
|
|
46
|
-
this.addTypeInitialiser("blobStorageComponent", this._context.config.types.blobStorageComponent, "@twin.org/engine-types", "initialiseBlobStorageComponent");
|
|
47
|
-
this.addTypeInitialiser("verifiableStorageConnector", this._context.config.types.verifiableStorageConnector, "@twin.org/engine-types", "initialiseVerifiableStorageConnector");
|
|
48
|
-
this.addTypeInitialiser("verifiableStorageComponent", this._context.config.types.verifiableStorageComponent, "@twin.org/engine-types", "initialiseVerifiableStorageComponent");
|
|
49
|
-
this.addTypeInitialiser("walletConnector", this._context.config.types.walletConnector, "@twin.org/engine-types", "initialiseWalletStorage");
|
|
50
|
-
this.addTypeInitialiser("faucetConnector", this._context.config.types.faucetConnector, "@twin.org/engine-types", "initialiseFaucetConnector");
|
|
51
|
-
this.addTypeInitialiser("walletConnector", this._context.config.types.walletConnector, "@twin.org/engine-types", "initialiseWalletConnector");
|
|
52
|
-
this.addTypeInitialiser("identityConnector", this._context.config.types.identityConnector, "@twin.org/engine-types", "initialiseIdentityConnector");
|
|
53
|
-
this.addTypeInitialiser("identityComponent", this._context.config.types.identityComponent, "@twin.org/engine-types", "initialiseIdentityComponent");
|
|
54
|
-
this.addTypeInitialiser("identityResolverConnector", this._context.config.types.identityResolverConnector, "@twin.org/engine-types", "initialiseIdentityResolverConnector");
|
|
55
|
-
this.addTypeInitialiser("identityResolverComponent", this._context.config.types.identityResolverComponent, "@twin.org/engine-types", "initialiseIdentityResolverComponent");
|
|
56
|
-
this.addTypeInitialiser("identityProfileConnector", this._context.config.types.identityProfileConnector, "@twin.org/engine-types", "initialiseIdentityProfileConnector");
|
|
57
|
-
this.addTypeInitialiser("identityProfileComponent", this._context.config.types.identityProfileComponent, "@twin.org/engine-types", "initialiseIdentityProfileComponent");
|
|
58
|
-
this.addTypeInitialiser("nftConnector", this._context.config.types.nftConnector, "@twin.org/engine-types", "initialiseNftConnector");
|
|
59
|
-
this.addTypeInitialiser("nftComponent", this._context.config.types.nftComponent, "@twin.org/engine-types", "initialiseNftComponent");
|
|
60
|
-
this.addTypeInitialiser("immutableProofComponent", this._context.config.types.immutableProofComponent, "@twin.org/engine-types", "initialiseImmutableProofComponent");
|
|
61
|
-
this.addTypeInitialiser("attestationConnector", this._context.config.types.attestationConnector, "@twin.org/engine-types", "initialiseAttestationConnector");
|
|
62
|
-
this.addTypeInitialiser("attestationComponent", this._context.config.types.attestationComponent, "@twin.org/engine-types", "initialiseAttestationComponent");
|
|
63
|
-
this.addTypeInitialiser("auditableItemGraphComponent", this._context.config.types.auditableItemGraphComponent, "@twin.org/engine-types", "initialiseAuditableItemGraphComponent");
|
|
64
|
-
this.addTypeInitialiser("auditableItemStreamComponent", this._context.config.types.auditableItemStreamComponent, "@twin.org/engine-types", "initialiseAuditableItemStreamComponent");
|
|
65
|
-
this.addTypeInitialiser("dataConverterConnector", this._context.config.types.dataConverterConnector, "@twin.org/engine-types", "initialiseDataConverterConnector");
|
|
66
|
-
this.addTypeInitialiser("dataExtractorConnector", this._context.config.types.dataExtractorConnector, "@twin.org/engine-types", "initialiseDataExtractorConnector");
|
|
67
|
-
this.addTypeInitialiser("dataProcessingComponent", this._context.config.types.dataProcessingComponent, "@twin.org/engine-types", "initialiseDataProcessingComponent");
|
|
68
|
-
this.addTypeInitialiser("documentManagementComponent", this._context.config.types.documentManagementComponent, "@twin.org/engine-types", "initialiseDocumentManagementComponent");
|
|
69
|
-
this.addTypeInitialiser("rightsManagementPapComponent", this._context.config.types.rightsManagementPapComponent, "@twin.org/engine-types", "initialiseRightsManagementPapComponent");
|
|
70
|
-
this.addTypeInitialiser("rightsManagementPmpComponent", this._context.config.types.rightsManagementPmpComponent, "@twin.org/engine-types", "initialiseRightsManagementPmpComponent");
|
|
71
|
-
this.addTypeInitialiser("rightsManagementPxpComponent", this._context.config.types.rightsManagementPxpComponent, "@twin.org/engine-types", "initialiseRightsManagementPxpComponent");
|
|
72
|
-
this.addTypeInitialiser("rightsManagementPipComponent", this._context.config.types.rightsManagementPipComponent, "@twin.org/engine-types", "initialiseRightsManagementPipComponent");
|
|
73
|
-
this.addTypeInitialiser("rightsManagementPdpComponent", this._context.config.types.rightsManagementPdpComponent, "@twin.org/engine-types", "initialiseRightsManagementPdpComponent");
|
|
74
|
-
this.addTypeInitialiser("rightsManagementPepComponent", this._context.config.types.rightsManagementPepComponent, "@twin.org/engine-types", "initialiseRightsManagementPepComponent");
|
|
75
|
-
this.addTypeInitialiser("rightsManagementComponent", this._context.config.types.rightsManagementComponent, "@twin.org/engine-types", "initialiseRightsManagementComponent");
|
|
76
|
-
this.addTypeInitialiser("synchronisedStorageComponent", this._context.config.types.synchronisedStorageComponent, "@twin.org/engine-types", "initialiseSynchronisedStorageComponent");
|
|
77
|
-
this.addTypeInitialiser("federatedCatalogueComponent", this._context.config.types.federatedCatalogueComponent, "@twin.org/engine-types", "initialiseFederatedCatalogueComponent");
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Copyright 2024 IOTA Stiftung.
|
|
82
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
83
|
-
/**
|
|
84
|
-
* Helper methods for engine config.
|
|
85
|
-
*/
|
|
86
|
-
class EngineConfigHelper {
|
|
87
|
-
/**
|
|
88
|
-
* Runtime name for the class.
|
|
89
|
-
*/
|
|
90
|
-
static CLASS_NAME = "EngineConfigHelper";
|
|
91
|
-
/**
|
|
92
|
-
* Add a custom entity storage to the engine configuration.
|
|
93
|
-
* @param engineConfig The engine configuration.
|
|
94
|
-
* @param entityTypeName The entity type name.
|
|
95
|
-
* @param entitySchema The entity schema.
|
|
96
|
-
* @param restPath The rest path to serve the entity storage from, leave undefined for no endpoints.
|
|
97
|
-
* @param options Additional options.
|
|
98
|
-
* @param options.partitionPerUser Whether to partition the user identity in the data, defaults to false.
|
|
99
|
-
*/
|
|
100
|
-
static addCustomEntityStorage(engineConfig, entityTypeName, entitySchema, restPath, options) {
|
|
101
|
-
core.Guards.object(EngineConfigHelper.CLASS_NAME, "engineConfig", engineConfig);
|
|
102
|
-
core.Guards.stringValue(EngineConfigHelper.CLASS_NAME, "entityTypeName", entityTypeName);
|
|
103
|
-
core.Guards.object(EngineConfigHelper.CLASS_NAME, "entitySchema", entitySchema);
|
|
104
|
-
engineConfig.types.entityStorageComponent ??= [];
|
|
105
|
-
entity.EntitySchemaFactory.register(entityTypeName, () => entitySchema);
|
|
106
|
-
engineConfig.types.entityStorageComponent.push({
|
|
107
|
-
type: engineTypes.EntityStorageComponentType.Service,
|
|
108
|
-
options: {
|
|
109
|
-
entityStorageType: entityTypeName,
|
|
110
|
-
config: {
|
|
111
|
-
partitionPerUser: options?.partitionPerUser
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
overrideInstanceType: core.StringHelper.kebabCase(entityTypeName),
|
|
115
|
-
restPath: core.Is.stringValue(restPath) ? restPath : undefined
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
exports.Engine = Engine;
|
|
121
|
-
exports.EngineConfigHelper = EngineConfigHelper;
|
package/dist/esm/index.mjs
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { EngineCore } from '@twin.org/engine-core';
|
|
2
|
-
import { Guards, StringHelper, Is } from '@twin.org/core';
|
|
3
|
-
import { EntityStorageComponentType } from '@twin.org/engine-types';
|
|
4
|
-
import { EntitySchemaFactory } from '@twin.org/entity';
|
|
5
|
-
|
|
6
|
-
// Copyright 2024 IOTA Stiftung.
|
|
7
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
8
|
-
/**
|
|
9
|
-
* The engine with built in types.
|
|
10
|
-
*/
|
|
11
|
-
class Engine extends EngineCore {
|
|
12
|
-
/**
|
|
13
|
-
* Runtime name for the class.
|
|
14
|
-
*/
|
|
15
|
-
CLASS_NAME = "Engine";
|
|
16
|
-
/**
|
|
17
|
-
* Create a new instance of Engine.
|
|
18
|
-
* @param options The options for the engine.
|
|
19
|
-
*/
|
|
20
|
-
constructor(options) {
|
|
21
|
-
super(options);
|
|
22
|
-
this.addCoreTypeInitialisers();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Add the core type initializers.
|
|
26
|
-
* @internal
|
|
27
|
-
*/
|
|
28
|
-
addCoreTypeInitialisers() {
|
|
29
|
-
this.addTypeInitialiser("loggingConnector", this._context.config.types.loggingConnector, "@twin.org/engine-types", "initialiseLoggingConnector");
|
|
30
|
-
this.addTypeInitialiser("loggingComponent", this._context.config.types.loggingComponent, "@twin.org/engine-types", "initialiseLoggingComponent");
|
|
31
|
-
this.addTypeInitialiser("backgroundTaskConnector", this._context.config.types.backgroundTaskConnector, "@twin.org/engine-types", "initialiseBackgroundTaskConnector");
|
|
32
|
-
this.addTypeInitialiser("taskSchedulerComponent", this._context.config.types.taskSchedulerComponent, "@twin.org/engine-types", "initialiseTaskSchedulerComponent");
|
|
33
|
-
this.addTypeInitialiser("eventBusConnector", this._context.config.types.eventBusConnector, "@twin.org/engine-types", "initialiseEventBusConnector");
|
|
34
|
-
this.addTypeInitialiser("eventBusComponent", this._context.config.types.eventBusComponent, "@twin.org/engine-types", "initialiseEventBusComponent");
|
|
35
|
-
this.addTypeInitialiser("telemetryConnector", this._context.config.types.telemetryConnector, "@twin.org/engine-types", "initialiseTelemetryConnector");
|
|
36
|
-
this.addTypeInitialiser("telemetryComponent", this._context.config.types.telemetryComponent, "@twin.org/engine-types", "initialiseTelemetryComponent");
|
|
37
|
-
this.addTypeInitialiser("messagingEmailConnector", this._context.config.types.messagingEmailConnector, "@twin.org/engine-types", "initialiseMessagingEmailConnector");
|
|
38
|
-
this.addTypeInitialiser("messagingSmsConnector", this._context.config.types.messagingSmsConnector, "@twin.org/engine-types", "initialiseMessagingSmsConnector");
|
|
39
|
-
this.addTypeInitialiser("messagingPushNotificationConnector", this._context.config.types.messagingPushNotificationConnector, "@twin.org/engine-types", "initialiseMessagingPushNotificationConnector");
|
|
40
|
-
this.addTypeInitialiser("messagingComponent", this._context.config.types.messagingComponent, "@twin.org/engine-types", "initialiseMessagingComponent");
|
|
41
|
-
this.addTypeInitialiser("entityStorageComponent", this._context.config.types.entityStorageComponent, "@twin.org/engine-types", "initialiseEntityStorageComponent");
|
|
42
|
-
this.addTypeInitialiser("vaultConnector", this._context.config.types.vaultConnector, "@twin.org/engine-types", "initialiseVaultConnector");
|
|
43
|
-
this.addTypeInitialiser("blobStorageConnector", this._context.config.types.blobStorageConnector, "@twin.org/engine-types", "initialiseBlobStorageConnector");
|
|
44
|
-
this.addTypeInitialiser("blobStorageComponent", this._context.config.types.blobStorageComponent, "@twin.org/engine-types", "initialiseBlobStorageComponent");
|
|
45
|
-
this.addTypeInitialiser("verifiableStorageConnector", this._context.config.types.verifiableStorageConnector, "@twin.org/engine-types", "initialiseVerifiableStorageConnector");
|
|
46
|
-
this.addTypeInitialiser("verifiableStorageComponent", this._context.config.types.verifiableStorageComponent, "@twin.org/engine-types", "initialiseVerifiableStorageComponent");
|
|
47
|
-
this.addTypeInitialiser("walletConnector", this._context.config.types.walletConnector, "@twin.org/engine-types", "initialiseWalletStorage");
|
|
48
|
-
this.addTypeInitialiser("faucetConnector", this._context.config.types.faucetConnector, "@twin.org/engine-types", "initialiseFaucetConnector");
|
|
49
|
-
this.addTypeInitialiser("walletConnector", this._context.config.types.walletConnector, "@twin.org/engine-types", "initialiseWalletConnector");
|
|
50
|
-
this.addTypeInitialiser("identityConnector", this._context.config.types.identityConnector, "@twin.org/engine-types", "initialiseIdentityConnector");
|
|
51
|
-
this.addTypeInitialiser("identityComponent", this._context.config.types.identityComponent, "@twin.org/engine-types", "initialiseIdentityComponent");
|
|
52
|
-
this.addTypeInitialiser("identityResolverConnector", this._context.config.types.identityResolverConnector, "@twin.org/engine-types", "initialiseIdentityResolverConnector");
|
|
53
|
-
this.addTypeInitialiser("identityResolverComponent", this._context.config.types.identityResolverComponent, "@twin.org/engine-types", "initialiseIdentityResolverComponent");
|
|
54
|
-
this.addTypeInitialiser("identityProfileConnector", this._context.config.types.identityProfileConnector, "@twin.org/engine-types", "initialiseIdentityProfileConnector");
|
|
55
|
-
this.addTypeInitialiser("identityProfileComponent", this._context.config.types.identityProfileComponent, "@twin.org/engine-types", "initialiseIdentityProfileComponent");
|
|
56
|
-
this.addTypeInitialiser("nftConnector", this._context.config.types.nftConnector, "@twin.org/engine-types", "initialiseNftConnector");
|
|
57
|
-
this.addTypeInitialiser("nftComponent", this._context.config.types.nftComponent, "@twin.org/engine-types", "initialiseNftComponent");
|
|
58
|
-
this.addTypeInitialiser("immutableProofComponent", this._context.config.types.immutableProofComponent, "@twin.org/engine-types", "initialiseImmutableProofComponent");
|
|
59
|
-
this.addTypeInitialiser("attestationConnector", this._context.config.types.attestationConnector, "@twin.org/engine-types", "initialiseAttestationConnector");
|
|
60
|
-
this.addTypeInitialiser("attestationComponent", this._context.config.types.attestationComponent, "@twin.org/engine-types", "initialiseAttestationComponent");
|
|
61
|
-
this.addTypeInitialiser("auditableItemGraphComponent", this._context.config.types.auditableItemGraphComponent, "@twin.org/engine-types", "initialiseAuditableItemGraphComponent");
|
|
62
|
-
this.addTypeInitialiser("auditableItemStreamComponent", this._context.config.types.auditableItemStreamComponent, "@twin.org/engine-types", "initialiseAuditableItemStreamComponent");
|
|
63
|
-
this.addTypeInitialiser("dataConverterConnector", this._context.config.types.dataConverterConnector, "@twin.org/engine-types", "initialiseDataConverterConnector");
|
|
64
|
-
this.addTypeInitialiser("dataExtractorConnector", this._context.config.types.dataExtractorConnector, "@twin.org/engine-types", "initialiseDataExtractorConnector");
|
|
65
|
-
this.addTypeInitialiser("dataProcessingComponent", this._context.config.types.dataProcessingComponent, "@twin.org/engine-types", "initialiseDataProcessingComponent");
|
|
66
|
-
this.addTypeInitialiser("documentManagementComponent", this._context.config.types.documentManagementComponent, "@twin.org/engine-types", "initialiseDocumentManagementComponent");
|
|
67
|
-
this.addTypeInitialiser("rightsManagementPapComponent", this._context.config.types.rightsManagementPapComponent, "@twin.org/engine-types", "initialiseRightsManagementPapComponent");
|
|
68
|
-
this.addTypeInitialiser("rightsManagementPmpComponent", this._context.config.types.rightsManagementPmpComponent, "@twin.org/engine-types", "initialiseRightsManagementPmpComponent");
|
|
69
|
-
this.addTypeInitialiser("rightsManagementPxpComponent", this._context.config.types.rightsManagementPxpComponent, "@twin.org/engine-types", "initialiseRightsManagementPxpComponent");
|
|
70
|
-
this.addTypeInitialiser("rightsManagementPipComponent", this._context.config.types.rightsManagementPipComponent, "@twin.org/engine-types", "initialiseRightsManagementPipComponent");
|
|
71
|
-
this.addTypeInitialiser("rightsManagementPdpComponent", this._context.config.types.rightsManagementPdpComponent, "@twin.org/engine-types", "initialiseRightsManagementPdpComponent");
|
|
72
|
-
this.addTypeInitialiser("rightsManagementPepComponent", this._context.config.types.rightsManagementPepComponent, "@twin.org/engine-types", "initialiseRightsManagementPepComponent");
|
|
73
|
-
this.addTypeInitialiser("rightsManagementComponent", this._context.config.types.rightsManagementComponent, "@twin.org/engine-types", "initialiseRightsManagementComponent");
|
|
74
|
-
this.addTypeInitialiser("synchronisedStorageComponent", this._context.config.types.synchronisedStorageComponent, "@twin.org/engine-types", "initialiseSynchronisedStorageComponent");
|
|
75
|
-
this.addTypeInitialiser("federatedCatalogueComponent", this._context.config.types.federatedCatalogueComponent, "@twin.org/engine-types", "initialiseFederatedCatalogueComponent");
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
// Copyright 2024 IOTA Stiftung.
|
|
80
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
81
|
-
/**
|
|
82
|
-
* Helper methods for engine config.
|
|
83
|
-
*/
|
|
84
|
-
class EngineConfigHelper {
|
|
85
|
-
/**
|
|
86
|
-
* Runtime name for the class.
|
|
87
|
-
*/
|
|
88
|
-
static CLASS_NAME = "EngineConfigHelper";
|
|
89
|
-
/**
|
|
90
|
-
* Add a custom entity storage to the engine configuration.
|
|
91
|
-
* @param engineConfig The engine configuration.
|
|
92
|
-
* @param entityTypeName The entity type name.
|
|
93
|
-
* @param entitySchema The entity schema.
|
|
94
|
-
* @param restPath The rest path to serve the entity storage from, leave undefined for no endpoints.
|
|
95
|
-
* @param options Additional options.
|
|
96
|
-
* @param options.partitionPerUser Whether to partition the user identity in the data, defaults to false.
|
|
97
|
-
*/
|
|
98
|
-
static addCustomEntityStorage(engineConfig, entityTypeName, entitySchema, restPath, options) {
|
|
99
|
-
Guards.object(EngineConfigHelper.CLASS_NAME, "engineConfig", engineConfig);
|
|
100
|
-
Guards.stringValue(EngineConfigHelper.CLASS_NAME, "entityTypeName", entityTypeName);
|
|
101
|
-
Guards.object(EngineConfigHelper.CLASS_NAME, "entitySchema", entitySchema);
|
|
102
|
-
engineConfig.types.entityStorageComponent ??= [];
|
|
103
|
-
EntitySchemaFactory.register(entityTypeName, () => entitySchema);
|
|
104
|
-
engineConfig.types.entityStorageComponent.push({
|
|
105
|
-
type: EntityStorageComponentType.Service,
|
|
106
|
-
options: {
|
|
107
|
-
entityStorageType: entityTypeName,
|
|
108
|
-
config: {
|
|
109
|
-
partitionPerUser: options?.partitionPerUser
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
overrideInstanceType: StringHelper.kebabCase(entityTypeName),
|
|
113
|
-
restPath: Is.stringValue(restPath) ? restPath : undefined
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export { Engine, EngineConfigHelper };
|