@twin.org/engine 0.0.2-next.26 → 0.0.2-next.27
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/index.d.ts +2 -2
- package/dist/types/utils/engineConfigHelper.d.ts +2 -5
- package/docs/reference/classes/Engine.md +520 -0
- package/docs/reference/classes/EngineConfigHelper.md +4 -8
- package/package.json +35 -7
- package/dist/cjs/index.cjs +0 -340
- package/dist/esm/index.mjs +0 -337
package/dist/cjs/index.cjs
DELETED
|
@@ -1,340 +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
|
-
var coreTypeInitialisers = [
|
|
9
|
-
{
|
|
10
|
-
type: "loggingConnector",
|
|
11
|
-
module: "@twin.org/engine-types",
|
|
12
|
-
method: "initialiseLoggingConnector"
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
type: "loggingComponent",
|
|
16
|
-
module: "@twin.org/engine-types",
|
|
17
|
-
method: "initialiseLoggingComponent"
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
type: "backgroundTaskConnector",
|
|
21
|
-
module: "@twin.org/engine-types",
|
|
22
|
-
method: "initialiseBackgroundTaskConnector"
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: "taskSchedulerComponent",
|
|
26
|
-
module: "@twin.org/engine-types",
|
|
27
|
-
method: "initialiseTaskSchedulerComponent"
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
type: "eventBusConnector",
|
|
31
|
-
module: "@twin.org/engine-types",
|
|
32
|
-
method: "initialiseEventBusConnector"
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
type: "eventBusComponent",
|
|
36
|
-
module: "@twin.org/engine-types",
|
|
37
|
-
method: "initialiseEventBusComponent"
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
type: "telemetryConnector",
|
|
41
|
-
module: "@twin.org/engine-types",
|
|
42
|
-
method: "initialiseTelemetryConnector"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
type: "telemetryComponent",
|
|
46
|
-
module: "@twin.org/engine-types",
|
|
47
|
-
method: "initialiseTelemetryComponent"
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
type: "messagingEmailConnector",
|
|
51
|
-
module: "@twin.org/engine-types",
|
|
52
|
-
method: "initialiseMessagingEmailConnector"
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: "messagingSmsConnector",
|
|
56
|
-
module: "@twin.org/engine-types",
|
|
57
|
-
method: "initialiseMessagingSmsConnector"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
type: "messagingPushNotificationConnector",
|
|
61
|
-
module: "@twin.org/engine-types",
|
|
62
|
-
method: "initialiseMessagingPushNotificationConnector"
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
type: "messagingAdminComponent",
|
|
66
|
-
module: "@twin.org/engine-types",
|
|
67
|
-
method: "initialiseMessagingAdminComponent"
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
type: "messagingComponent",
|
|
71
|
-
module: "@twin.org/engine-types",
|
|
72
|
-
method: "initialiseMessagingComponent"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
type: "entityStorageComponent",
|
|
76
|
-
module: "@twin.org/engine-types",
|
|
77
|
-
method: "initialiseEntityStorageComponent"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: "vaultConnector",
|
|
81
|
-
module: "@twin.org/engine-types",
|
|
82
|
-
method: "initialiseVaultConnector"
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: "blobStorageConnector",
|
|
86
|
-
module: "@twin.org/engine-types",
|
|
87
|
-
method: "initialiseBlobStorageConnector"
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
type: "blobStorageComponent",
|
|
91
|
-
module: "@twin.org/engine-types",
|
|
92
|
-
method: "initialiseBlobStorageComponent"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
type: "verifiableStorageConnector",
|
|
96
|
-
module: "@twin.org/engine-types",
|
|
97
|
-
method: "initialiseVerifiableStorageConnector"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
type: "verifiableStorageComponent",
|
|
101
|
-
module: "@twin.org/engine-types",
|
|
102
|
-
method: "initialiseVerifiableStorageComponent"
|
|
103
|
-
},
|
|
104
|
-
{
|
|
105
|
-
type: "faucetConnector",
|
|
106
|
-
module: "@twin.org/engine-types",
|
|
107
|
-
method: "initialiseFaucetConnector"
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
type: "walletConnector",
|
|
111
|
-
module: "@twin.org/engine-types",
|
|
112
|
-
method: "initialiseWalletConnector"
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
type: "identityConnector",
|
|
116
|
-
module: "@twin.org/engine-types",
|
|
117
|
-
method: "initialiseIdentityConnector"
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
type: "identityComponent",
|
|
121
|
-
module: "@twin.org/engine-types",
|
|
122
|
-
method: "initialiseIdentityComponent"
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
type: "identityResolverConnector",
|
|
126
|
-
module: "@twin.org/engine-types",
|
|
127
|
-
method: "initialiseIdentityResolverConnector"
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
type: "identityResolverComponent",
|
|
131
|
-
module: "@twin.org/engine-types",
|
|
132
|
-
method: "initialiseIdentityResolverComponent"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
type: "identityProfileConnector",
|
|
136
|
-
module: "@twin.org/engine-types",
|
|
137
|
-
method: "initialiseIdentityProfileConnector"
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
type: "identityProfileComponent",
|
|
141
|
-
module: "@twin.org/engine-types",
|
|
142
|
-
method: "initialiseIdentityProfileComponent"
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
type: "nftConnector",
|
|
146
|
-
module: "@twin.org/engine-types",
|
|
147
|
-
method: "initialiseNftConnector"
|
|
148
|
-
},
|
|
149
|
-
{
|
|
150
|
-
type: "nftComponent",
|
|
151
|
-
module: "@twin.org/engine-types",
|
|
152
|
-
method: "initialiseNftComponent"
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
type: "immutableProofComponent",
|
|
156
|
-
module: "@twin.org/engine-types",
|
|
157
|
-
method: "initialiseImmutableProofComponent"
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
type: "attestationConnector",
|
|
161
|
-
module: "@twin.org/engine-types",
|
|
162
|
-
method: "initialiseAttestationConnector"
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
type: "attestationComponent",
|
|
166
|
-
module: "@twin.org/engine-types",
|
|
167
|
-
method: "initialiseAttestationComponent"
|
|
168
|
-
},
|
|
169
|
-
{
|
|
170
|
-
type: "auditableItemGraphComponent",
|
|
171
|
-
module: "@twin.org/engine-types",
|
|
172
|
-
method: "initialiseAuditableItemGraphComponent"
|
|
173
|
-
},
|
|
174
|
-
{
|
|
175
|
-
type: "auditableItemStreamComponent",
|
|
176
|
-
module: "@twin.org/engine-types",
|
|
177
|
-
method: "initialiseAuditableItemStreamComponent"
|
|
178
|
-
},
|
|
179
|
-
{
|
|
180
|
-
type: "dataConverterConnector",
|
|
181
|
-
module: "@twin.org/engine-types",
|
|
182
|
-
method: "initialiseDataConverterConnector"
|
|
183
|
-
},
|
|
184
|
-
{
|
|
185
|
-
type: "dataExtractorConnector",
|
|
186
|
-
module: "@twin.org/engine-types",
|
|
187
|
-
method: "initialiseDataExtractorConnector"
|
|
188
|
-
},
|
|
189
|
-
{
|
|
190
|
-
type: "dataProcessingComponent",
|
|
191
|
-
module: "@twin.org/engine-types",
|
|
192
|
-
method: "initialiseDataProcessingComponent"
|
|
193
|
-
},
|
|
194
|
-
{
|
|
195
|
-
type: "documentManagementComponent",
|
|
196
|
-
module: "@twin.org/engine-types",
|
|
197
|
-
method: "initialiseDocumentManagementComponent"
|
|
198
|
-
},
|
|
199
|
-
{
|
|
200
|
-
type: "authenticationGeneratorComponent",
|
|
201
|
-
module: "@twin.org/engine-types",
|
|
202
|
-
method: "initialiseAuthenticationGeneratorComponent"
|
|
203
|
-
},
|
|
204
|
-
{
|
|
205
|
-
type: "rightsManagementPapComponent",
|
|
206
|
-
module: "@twin.org/engine-types",
|
|
207
|
-
method: "initialiseRightsManagementPapComponent"
|
|
208
|
-
},
|
|
209
|
-
{
|
|
210
|
-
type: "rightsManagementPmpComponent",
|
|
211
|
-
module: "@twin.org/engine-types",
|
|
212
|
-
method: "initialiseRightsManagementPmpComponent"
|
|
213
|
-
},
|
|
214
|
-
{
|
|
215
|
-
type: "rightsManagementPxpComponent",
|
|
216
|
-
module: "@twin.org/engine-types",
|
|
217
|
-
method: "initialiseRightsManagementPxpComponent"
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
type: "rightsManagementPipComponent",
|
|
221
|
-
module: "@twin.org/engine-types",
|
|
222
|
-
method: "initialiseRightsManagementPipComponent"
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
type: "rightsManagementPdpComponent",
|
|
226
|
-
module: "@twin.org/engine-types",
|
|
227
|
-
method: "initialiseRightsManagementPdpComponent"
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
type: "rightsManagementPepComponent",
|
|
231
|
-
module: "@twin.org/engine-types",
|
|
232
|
-
method: "initialiseRightsManagementPepComponent"
|
|
233
|
-
},
|
|
234
|
-
{
|
|
235
|
-
type: "rightsManagementPnapComponent",
|
|
236
|
-
module: "@twin.org/engine-types",
|
|
237
|
-
method: "initialiseRightsManagementPnapComponent"
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
type: "rightsManagementPnpComponent",
|
|
241
|
-
module: "@twin.org/engine-types",
|
|
242
|
-
method: "initialiseRightsManagementPnpComponent"
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
type: "rightsManagementDapComponent",
|
|
246
|
-
module: "@twin.org/engine-types",
|
|
247
|
-
method: "initialiseRightsManagementDapComponent"
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
type: "rightsManagementDarpComponent",
|
|
251
|
-
module: "@twin.org/engine-types",
|
|
252
|
-
method: "initialiseRightsManagementDarpComponent"
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
type: "synchronisedStorageComponent",
|
|
256
|
-
module: "@twin.org/engine-types",
|
|
257
|
-
method: "initialiseSynchronisedStorageComponent"
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
type: "federatedCatalogueComponent",
|
|
261
|
-
module: "@twin.org/engine-types",
|
|
262
|
-
method: "initialiseFederatedCatalogueComponent"
|
|
263
|
-
},
|
|
264
|
-
{
|
|
265
|
-
type: "dataSpaceConnectorComponent",
|
|
266
|
-
module: "@twin.org/engine-types",
|
|
267
|
-
method: "initialiseDataSpaceConnectorComponent"
|
|
268
|
-
}
|
|
269
|
-
];
|
|
270
|
-
|
|
271
|
-
// Copyright 2024 IOTA Stiftung.
|
|
272
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
273
|
-
/**
|
|
274
|
-
* The engine with built in types.
|
|
275
|
-
*/
|
|
276
|
-
class Engine extends engineCore.EngineCore {
|
|
277
|
-
/**
|
|
278
|
-
* Runtime name for the class.
|
|
279
|
-
*/
|
|
280
|
-
static CLASS_NAME = "Engine";
|
|
281
|
-
/**
|
|
282
|
-
* Create a new instance of Engine.
|
|
283
|
-
* @param options The options for the engine.
|
|
284
|
-
*/
|
|
285
|
-
constructor(options) {
|
|
286
|
-
super(options);
|
|
287
|
-
this.addCoreTypeInitialisers();
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Add the core type initializers.
|
|
291
|
-
* @internal
|
|
292
|
-
*/
|
|
293
|
-
addCoreTypeInitialisers() {
|
|
294
|
-
for (const initializer of coreTypeInitialisers) {
|
|
295
|
-
this.addTypeInitialiser(initializer.type, initializer.module, initializer.method);
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
// Copyright 2024 IOTA Stiftung.
|
|
301
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
302
|
-
/**
|
|
303
|
-
* Helper methods for engine config.
|
|
304
|
-
*/
|
|
305
|
-
class EngineConfigHelper {
|
|
306
|
-
/**
|
|
307
|
-
* Runtime name for the class.
|
|
308
|
-
*/
|
|
309
|
-
static CLASS_NAME = "EngineConfigHelper";
|
|
310
|
-
/**
|
|
311
|
-
* Add a custom entity storage to the engine configuration.
|
|
312
|
-
* @param engineConfig The engine configuration.
|
|
313
|
-
* @param entityTypeName The entity type name.
|
|
314
|
-
* @param entitySchema The entity schema.
|
|
315
|
-
* @param restPath The rest path to serve the entity storage from, leave undefined for no endpoints.
|
|
316
|
-
* @param options Additional options.
|
|
317
|
-
* @param options.partitionPerUser Whether to partition the user identity in the data, defaults to false.
|
|
318
|
-
*/
|
|
319
|
-
static addCustomEntityStorage(engineConfig, entityTypeName, entitySchema, restPath, options) {
|
|
320
|
-
core.Guards.object(EngineConfigHelper.CLASS_NAME, "engineConfig", engineConfig);
|
|
321
|
-
core.Guards.stringValue(EngineConfigHelper.CLASS_NAME, "entityTypeName", entityTypeName);
|
|
322
|
-
core.Guards.object(EngineConfigHelper.CLASS_NAME, "entitySchema", entitySchema);
|
|
323
|
-
engineConfig.types.entityStorageComponent ??= [];
|
|
324
|
-
entity.EntitySchemaFactory.register(entityTypeName, () => entitySchema);
|
|
325
|
-
engineConfig.types.entityStorageComponent.push({
|
|
326
|
-
type: engineTypes.EntityStorageComponentType.Service,
|
|
327
|
-
options: {
|
|
328
|
-
entityStorageType: entityTypeName,
|
|
329
|
-
config: {
|
|
330
|
-
partitionPerUser: options?.partitionPerUser
|
|
331
|
-
}
|
|
332
|
-
},
|
|
333
|
-
overrideInstanceType: core.StringHelper.kebabCase(entityTypeName),
|
|
334
|
-
restPath: core.Is.stringValue(restPath) ? restPath : undefined
|
|
335
|
-
});
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
exports.Engine = Engine;
|
|
340
|
-
exports.EngineConfigHelper = EngineConfigHelper;
|
package/dist/esm/index.mjs
DELETED
|
@@ -1,337 +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
|
-
var coreTypeInitialisers = [
|
|
7
|
-
{
|
|
8
|
-
type: "loggingConnector",
|
|
9
|
-
module: "@twin.org/engine-types",
|
|
10
|
-
method: "initialiseLoggingConnector"
|
|
11
|
-
},
|
|
12
|
-
{
|
|
13
|
-
type: "loggingComponent",
|
|
14
|
-
module: "@twin.org/engine-types",
|
|
15
|
-
method: "initialiseLoggingComponent"
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
type: "backgroundTaskConnector",
|
|
19
|
-
module: "@twin.org/engine-types",
|
|
20
|
-
method: "initialiseBackgroundTaskConnector"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
type: "taskSchedulerComponent",
|
|
24
|
-
module: "@twin.org/engine-types",
|
|
25
|
-
method: "initialiseTaskSchedulerComponent"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: "eventBusConnector",
|
|
29
|
-
module: "@twin.org/engine-types",
|
|
30
|
-
method: "initialiseEventBusConnector"
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
type: "eventBusComponent",
|
|
34
|
-
module: "@twin.org/engine-types",
|
|
35
|
-
method: "initialiseEventBusComponent"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
type: "telemetryConnector",
|
|
39
|
-
module: "@twin.org/engine-types",
|
|
40
|
-
method: "initialiseTelemetryConnector"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: "telemetryComponent",
|
|
44
|
-
module: "@twin.org/engine-types",
|
|
45
|
-
method: "initialiseTelemetryComponent"
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
type: "messagingEmailConnector",
|
|
49
|
-
module: "@twin.org/engine-types",
|
|
50
|
-
method: "initialiseMessagingEmailConnector"
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
type: "messagingSmsConnector",
|
|
54
|
-
module: "@twin.org/engine-types",
|
|
55
|
-
method: "initialiseMessagingSmsConnector"
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
type: "messagingPushNotificationConnector",
|
|
59
|
-
module: "@twin.org/engine-types",
|
|
60
|
-
method: "initialiseMessagingPushNotificationConnector"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
type: "messagingAdminComponent",
|
|
64
|
-
module: "@twin.org/engine-types",
|
|
65
|
-
method: "initialiseMessagingAdminComponent"
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
type: "messagingComponent",
|
|
69
|
-
module: "@twin.org/engine-types",
|
|
70
|
-
method: "initialiseMessagingComponent"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
type: "entityStorageComponent",
|
|
74
|
-
module: "@twin.org/engine-types",
|
|
75
|
-
method: "initialiseEntityStorageComponent"
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
type: "vaultConnector",
|
|
79
|
-
module: "@twin.org/engine-types",
|
|
80
|
-
method: "initialiseVaultConnector"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
type: "blobStorageConnector",
|
|
84
|
-
module: "@twin.org/engine-types",
|
|
85
|
-
method: "initialiseBlobStorageConnector"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
type: "blobStorageComponent",
|
|
89
|
-
module: "@twin.org/engine-types",
|
|
90
|
-
method: "initialiseBlobStorageComponent"
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
type: "verifiableStorageConnector",
|
|
94
|
-
module: "@twin.org/engine-types",
|
|
95
|
-
method: "initialiseVerifiableStorageConnector"
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
type: "verifiableStorageComponent",
|
|
99
|
-
module: "@twin.org/engine-types",
|
|
100
|
-
method: "initialiseVerifiableStorageComponent"
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
type: "faucetConnector",
|
|
104
|
-
module: "@twin.org/engine-types",
|
|
105
|
-
method: "initialiseFaucetConnector"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
type: "walletConnector",
|
|
109
|
-
module: "@twin.org/engine-types",
|
|
110
|
-
method: "initialiseWalletConnector"
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
type: "identityConnector",
|
|
114
|
-
module: "@twin.org/engine-types",
|
|
115
|
-
method: "initialiseIdentityConnector"
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
type: "identityComponent",
|
|
119
|
-
module: "@twin.org/engine-types",
|
|
120
|
-
method: "initialiseIdentityComponent"
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
type: "identityResolverConnector",
|
|
124
|
-
module: "@twin.org/engine-types",
|
|
125
|
-
method: "initialiseIdentityResolverConnector"
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
type: "identityResolverComponent",
|
|
129
|
-
module: "@twin.org/engine-types",
|
|
130
|
-
method: "initialiseIdentityResolverComponent"
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
type: "identityProfileConnector",
|
|
134
|
-
module: "@twin.org/engine-types",
|
|
135
|
-
method: "initialiseIdentityProfileConnector"
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
type: "identityProfileComponent",
|
|
139
|
-
module: "@twin.org/engine-types",
|
|
140
|
-
method: "initialiseIdentityProfileComponent"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
type: "nftConnector",
|
|
144
|
-
module: "@twin.org/engine-types",
|
|
145
|
-
method: "initialiseNftConnector"
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
type: "nftComponent",
|
|
149
|
-
module: "@twin.org/engine-types",
|
|
150
|
-
method: "initialiseNftComponent"
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
type: "immutableProofComponent",
|
|
154
|
-
module: "@twin.org/engine-types",
|
|
155
|
-
method: "initialiseImmutableProofComponent"
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
type: "attestationConnector",
|
|
159
|
-
module: "@twin.org/engine-types",
|
|
160
|
-
method: "initialiseAttestationConnector"
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
type: "attestationComponent",
|
|
164
|
-
module: "@twin.org/engine-types",
|
|
165
|
-
method: "initialiseAttestationComponent"
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
type: "auditableItemGraphComponent",
|
|
169
|
-
module: "@twin.org/engine-types",
|
|
170
|
-
method: "initialiseAuditableItemGraphComponent"
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
type: "auditableItemStreamComponent",
|
|
174
|
-
module: "@twin.org/engine-types",
|
|
175
|
-
method: "initialiseAuditableItemStreamComponent"
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
type: "dataConverterConnector",
|
|
179
|
-
module: "@twin.org/engine-types",
|
|
180
|
-
method: "initialiseDataConverterConnector"
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
type: "dataExtractorConnector",
|
|
184
|
-
module: "@twin.org/engine-types",
|
|
185
|
-
method: "initialiseDataExtractorConnector"
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
type: "dataProcessingComponent",
|
|
189
|
-
module: "@twin.org/engine-types",
|
|
190
|
-
method: "initialiseDataProcessingComponent"
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
type: "documentManagementComponent",
|
|
194
|
-
module: "@twin.org/engine-types",
|
|
195
|
-
method: "initialiseDocumentManagementComponent"
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
type: "authenticationGeneratorComponent",
|
|
199
|
-
module: "@twin.org/engine-types",
|
|
200
|
-
method: "initialiseAuthenticationGeneratorComponent"
|
|
201
|
-
},
|
|
202
|
-
{
|
|
203
|
-
type: "rightsManagementPapComponent",
|
|
204
|
-
module: "@twin.org/engine-types",
|
|
205
|
-
method: "initialiseRightsManagementPapComponent"
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
type: "rightsManagementPmpComponent",
|
|
209
|
-
module: "@twin.org/engine-types",
|
|
210
|
-
method: "initialiseRightsManagementPmpComponent"
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
type: "rightsManagementPxpComponent",
|
|
214
|
-
module: "@twin.org/engine-types",
|
|
215
|
-
method: "initialiseRightsManagementPxpComponent"
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
type: "rightsManagementPipComponent",
|
|
219
|
-
module: "@twin.org/engine-types",
|
|
220
|
-
method: "initialiseRightsManagementPipComponent"
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
type: "rightsManagementPdpComponent",
|
|
224
|
-
module: "@twin.org/engine-types",
|
|
225
|
-
method: "initialiseRightsManagementPdpComponent"
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
type: "rightsManagementPepComponent",
|
|
229
|
-
module: "@twin.org/engine-types",
|
|
230
|
-
method: "initialiseRightsManagementPepComponent"
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
type: "rightsManagementPnapComponent",
|
|
234
|
-
module: "@twin.org/engine-types",
|
|
235
|
-
method: "initialiseRightsManagementPnapComponent"
|
|
236
|
-
},
|
|
237
|
-
{
|
|
238
|
-
type: "rightsManagementPnpComponent",
|
|
239
|
-
module: "@twin.org/engine-types",
|
|
240
|
-
method: "initialiseRightsManagementPnpComponent"
|
|
241
|
-
},
|
|
242
|
-
{
|
|
243
|
-
type: "rightsManagementDapComponent",
|
|
244
|
-
module: "@twin.org/engine-types",
|
|
245
|
-
method: "initialiseRightsManagementDapComponent"
|
|
246
|
-
},
|
|
247
|
-
{
|
|
248
|
-
type: "rightsManagementDarpComponent",
|
|
249
|
-
module: "@twin.org/engine-types",
|
|
250
|
-
method: "initialiseRightsManagementDarpComponent"
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
type: "synchronisedStorageComponent",
|
|
254
|
-
module: "@twin.org/engine-types",
|
|
255
|
-
method: "initialiseSynchronisedStorageComponent"
|
|
256
|
-
},
|
|
257
|
-
{
|
|
258
|
-
type: "federatedCatalogueComponent",
|
|
259
|
-
module: "@twin.org/engine-types",
|
|
260
|
-
method: "initialiseFederatedCatalogueComponent"
|
|
261
|
-
},
|
|
262
|
-
{
|
|
263
|
-
type: "dataSpaceConnectorComponent",
|
|
264
|
-
module: "@twin.org/engine-types",
|
|
265
|
-
method: "initialiseDataSpaceConnectorComponent"
|
|
266
|
-
}
|
|
267
|
-
];
|
|
268
|
-
|
|
269
|
-
// Copyright 2024 IOTA Stiftung.
|
|
270
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
271
|
-
/**
|
|
272
|
-
* The engine with built in types.
|
|
273
|
-
*/
|
|
274
|
-
class Engine extends EngineCore {
|
|
275
|
-
/**
|
|
276
|
-
* Runtime name for the class.
|
|
277
|
-
*/
|
|
278
|
-
static CLASS_NAME = "Engine";
|
|
279
|
-
/**
|
|
280
|
-
* Create a new instance of Engine.
|
|
281
|
-
* @param options The options for the engine.
|
|
282
|
-
*/
|
|
283
|
-
constructor(options) {
|
|
284
|
-
super(options);
|
|
285
|
-
this.addCoreTypeInitialisers();
|
|
286
|
-
}
|
|
287
|
-
/**
|
|
288
|
-
* Add the core type initializers.
|
|
289
|
-
* @internal
|
|
290
|
-
*/
|
|
291
|
-
addCoreTypeInitialisers() {
|
|
292
|
-
for (const initializer of coreTypeInitialisers) {
|
|
293
|
-
this.addTypeInitialiser(initializer.type, initializer.module, initializer.method);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
// Copyright 2024 IOTA Stiftung.
|
|
299
|
-
// SPDX-License-Identifier: Apache-2.0.
|
|
300
|
-
/**
|
|
301
|
-
* Helper methods for engine config.
|
|
302
|
-
*/
|
|
303
|
-
class EngineConfigHelper {
|
|
304
|
-
/**
|
|
305
|
-
* Runtime name for the class.
|
|
306
|
-
*/
|
|
307
|
-
static CLASS_NAME = "EngineConfigHelper";
|
|
308
|
-
/**
|
|
309
|
-
* Add a custom entity storage to the engine configuration.
|
|
310
|
-
* @param engineConfig The engine configuration.
|
|
311
|
-
* @param entityTypeName The entity type name.
|
|
312
|
-
* @param entitySchema The entity schema.
|
|
313
|
-
* @param restPath The rest path to serve the entity storage from, leave undefined for no endpoints.
|
|
314
|
-
* @param options Additional options.
|
|
315
|
-
* @param options.partitionPerUser Whether to partition the user identity in the data, defaults to false.
|
|
316
|
-
*/
|
|
317
|
-
static addCustomEntityStorage(engineConfig, entityTypeName, entitySchema, restPath, options) {
|
|
318
|
-
Guards.object(EngineConfigHelper.CLASS_NAME, "engineConfig", engineConfig);
|
|
319
|
-
Guards.stringValue(EngineConfigHelper.CLASS_NAME, "entityTypeName", entityTypeName);
|
|
320
|
-
Guards.object(EngineConfigHelper.CLASS_NAME, "entitySchema", entitySchema);
|
|
321
|
-
engineConfig.types.entityStorageComponent ??= [];
|
|
322
|
-
EntitySchemaFactory.register(entityTypeName, () => entitySchema);
|
|
323
|
-
engineConfig.types.entityStorageComponent.push({
|
|
324
|
-
type: EntityStorageComponentType.Service,
|
|
325
|
-
options: {
|
|
326
|
-
entityStorageType: entityTypeName,
|
|
327
|
-
config: {
|
|
328
|
-
partitionPerUser: options?.partitionPerUser
|
|
329
|
-
}
|
|
330
|
-
},
|
|
331
|
-
overrideInstanceType: StringHelper.kebabCase(entityTypeName),
|
|
332
|
-
restPath: Is.stringValue(restPath) ? restPath : undefined
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
export { Engine, EngineConfigHelper };
|