@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.
@@ -51,3 +51,523 @@ Runtime name for the class.
51
51
  #### Overrides
52
52
 
53
53
  `EngineCore.CLASS_NAME`
54
+
55
+ ***
56
+
57
+ ### LOGGING\_COMPONENT\_TYPE\_NAME
58
+
59
+ > `readonly` `static` **LOGGING\_COMPONENT\_TYPE\_NAME**: `string`
60
+
61
+ Name for the engine logger component, used for direct console logging.
62
+
63
+ #### Inherited from
64
+
65
+ `EngineCore.LOGGING_COMPONENT_TYPE_NAME`
66
+
67
+ ***
68
+
69
+ ### LOGGING\_CONNECTOR\_TYPE\_NAME
70
+
71
+ > `readonly` `static` **LOGGING\_CONNECTOR\_TYPE\_NAME**: `string`
72
+
73
+ Name for the engine logger connector, used for direct console logging.
74
+
75
+ #### Inherited from
76
+
77
+ `EngineCore.LOGGING_CONNECTOR_TYPE_NAME`
78
+
79
+ ***
80
+
81
+ ### \_context
82
+
83
+ > `protected` **\_context**: `IEngineCoreContext`\<`C`, `S`\>
84
+
85
+ The core context.
86
+
87
+ #### Inherited from
88
+
89
+ `EngineCore._context`
90
+
91
+ ***
92
+
93
+ ### \_contextIdKeys
94
+
95
+ > `protected` `readonly` **\_contextIdKeys**: `string`[]
96
+
97
+ The context ID keys.
98
+
99
+ #### Inherited from
100
+
101
+ `EngineCore._contextIdKeys`
102
+
103
+ ***
104
+
105
+ ### \_contextIds?
106
+
107
+ > `protected` `optional` **\_contextIds**: `IContextIds`
108
+
109
+ The context IDs.
110
+
111
+ #### Inherited from
112
+
113
+ `EngineCore._contextIds`
114
+
115
+ ## Methods
116
+
117
+ ### addTypeInitialiser()
118
+
119
+ > **addTypeInitialiser**(`type`, `module`, `method`): `void`
120
+
121
+ Add a type initialiser.
122
+
123
+ #### Parameters
124
+
125
+ ##### type
126
+
127
+ `string`
128
+
129
+ The type to add the initialiser for.
130
+
131
+ ##### module
132
+
133
+ `string`
134
+
135
+ The name of the module which contains the initialiser method.
136
+
137
+ ##### method
138
+
139
+ `string`
140
+
141
+ The name of the method to call.
142
+
143
+ #### Returns
144
+
145
+ `void`
146
+
147
+ #### Inherited from
148
+
149
+ `EngineCore.addTypeInitialiser`
150
+
151
+ ***
152
+
153
+ ### getTypeConfig()
154
+
155
+ > **getTypeConfig**(`type`): `undefined` \| `IEngineCoreTypeConfig`[]
156
+
157
+ Get the type config for a specific type.
158
+
159
+ #### Parameters
160
+
161
+ ##### type
162
+
163
+ `string`
164
+
165
+ The type to get the config for.
166
+
167
+ #### Returns
168
+
169
+ `undefined` \| `IEngineCoreTypeConfig`[]
170
+
171
+ The type config or undefined if not found.
172
+
173
+ #### Inherited from
174
+
175
+ `EngineCore.getTypeConfig`
176
+
177
+ ***
178
+
179
+ ### addContextIdKey()
180
+
181
+ > **addContextIdKey**(`key`): `void`
182
+
183
+ Add a context ID key to the engine.
184
+
185
+ #### Parameters
186
+
187
+ ##### key
188
+
189
+ `string`
190
+
191
+ The context ID key.
192
+
193
+ #### Returns
194
+
195
+ `void`
196
+
197
+ #### Inherited from
198
+
199
+ `EngineCore.addContextIdKey`
200
+
201
+ ***
202
+
203
+ ### getContextIdKeys()
204
+
205
+ > **getContextIdKeys**(): `string`[]
206
+
207
+ Get the context ID keys for the engine.
208
+
209
+ #### Returns
210
+
211
+ `string`[]
212
+
213
+ The context IDs keys.
214
+
215
+ #### Inherited from
216
+
217
+ `EngineCore.getContextIdKeys`
218
+
219
+ ***
220
+
221
+ ### addContextId()
222
+
223
+ > **addContextId**(`key`, `value`): `void`
224
+
225
+ Add a context ID to the engine.
226
+
227
+ #### Parameters
228
+
229
+ ##### key
230
+
231
+ `string`
232
+
233
+ The context ID key.
234
+
235
+ ##### value
236
+
237
+ `string`
238
+
239
+ The context ID value.
240
+
241
+ #### Returns
242
+
243
+ `void`
244
+
245
+ #### Inherited from
246
+
247
+ `EngineCore.addContextId`
248
+
249
+ ***
250
+
251
+ ### getContextIds()
252
+
253
+ > **getContextIds**(): `undefined` \| `IContextIds`
254
+
255
+ Get the context IDs for the engine.
256
+
257
+ #### Returns
258
+
259
+ `undefined` \| `IContextIds`
260
+
261
+ The context IDs or undefined if none are set.
262
+
263
+ #### Inherited from
264
+
265
+ `EngineCore.getContextIds`
266
+
267
+ ***
268
+
269
+ ### start()
270
+
271
+ > **start**(): `Promise`\<`boolean`\>
272
+
273
+ Start the engine core.
274
+
275
+ #### Returns
276
+
277
+ `Promise`\<`boolean`\>
278
+
279
+ True if the start was successful.
280
+
281
+ #### Inherited from
282
+
283
+ `EngineCore.start`
284
+
285
+ ***
286
+
287
+ ### stop()
288
+
289
+ > **stop**(): `Promise`\<`void`\>
290
+
291
+ Stop the engine core.
292
+
293
+ #### Returns
294
+
295
+ `Promise`\<`void`\>
296
+
297
+ Nothing.
298
+
299
+ #### Inherited from
300
+
301
+ `EngineCore.stop`
302
+
303
+ ***
304
+
305
+ ### isStarted()
306
+
307
+ > **isStarted**(): `boolean`
308
+
309
+ Is the engine started.
310
+
311
+ #### Returns
312
+
313
+ `boolean`
314
+
315
+ True if the engine is started.
316
+
317
+ #### Inherited from
318
+
319
+ `EngineCore.isStarted`
320
+
321
+ ***
322
+
323
+ ### isPrimary()
324
+
325
+ > **isPrimary**(): `boolean`
326
+
327
+ Is this the primary engine instance.
328
+
329
+ #### Returns
330
+
331
+ `boolean`
332
+
333
+ True if the engine is the primary instance.
334
+
335
+ #### Inherited from
336
+
337
+ `EngineCore.isPrimary`
338
+
339
+ ***
340
+
341
+ ### isClone()
342
+
343
+ > **isClone**(): `boolean`
344
+
345
+ Is this engine instance a clone.
346
+
347
+ #### Returns
348
+
349
+ `boolean`
350
+
351
+ True if the engine instance is a clone.
352
+
353
+ #### Inherited from
354
+
355
+ `EngineCore.isClone`
356
+
357
+ ***
358
+
359
+ ### logInfo()
360
+
361
+ > **logInfo**(`message`): `Promise`\<`void`\>
362
+
363
+ Log info.
364
+
365
+ #### Parameters
366
+
367
+ ##### message
368
+
369
+ `string`
370
+
371
+ The message to log.
372
+
373
+ #### Returns
374
+
375
+ `Promise`\<`void`\>
376
+
377
+ #### Inherited from
378
+
379
+ `EngineCore.logInfo`
380
+
381
+ ***
382
+
383
+ ### logError()
384
+
385
+ > **logError**(`error`): `Promise`\<`void`\>
386
+
387
+ Log error.
388
+
389
+ #### Parameters
390
+
391
+ ##### error
392
+
393
+ `IError`
394
+
395
+ The error to log.
396
+
397
+ #### Returns
398
+
399
+ `Promise`\<`void`\>
400
+
401
+ #### Inherited from
402
+
403
+ `EngineCore.logError`
404
+
405
+ ***
406
+
407
+ ### getConfig()
408
+
409
+ > **getConfig**(): `C`
410
+
411
+ Get the config for the engine.
412
+
413
+ #### Returns
414
+
415
+ `C`
416
+
417
+ The config for the engine.
418
+
419
+ #### Inherited from
420
+
421
+ `EngineCore.getConfig`
422
+
423
+ ***
424
+
425
+ ### getState()
426
+
427
+ > **getState**(): `S`
428
+
429
+ Get the state of the engine.
430
+
431
+ #### Returns
432
+
433
+ `S`
434
+
435
+ The state of the engine.
436
+
437
+ #### Inherited from
438
+
439
+ `EngineCore.getState`
440
+
441
+ ***
442
+
443
+ ### getRegisteredInstances()
444
+
445
+ > **getRegisteredInstances**(): `object`
446
+
447
+ Get all the registered instances.
448
+
449
+ #### Returns
450
+
451
+ `object`
452
+
453
+ The registered instances.
454
+
455
+ #### Inherited from
456
+
457
+ `EngineCore.getRegisteredInstances`
458
+
459
+ ***
460
+
461
+ ### getRegisteredInstanceType()
462
+
463
+ > **getRegisteredInstanceType**(`componentConnectorType`, `features?`): `string`
464
+
465
+ Get the registered instance type for the component/connector.
466
+
467
+ #### Parameters
468
+
469
+ ##### componentConnectorType
470
+
471
+ `string`
472
+
473
+ The type of the component/connector.
474
+
475
+ ##### features?
476
+
477
+ `string`[]
478
+
479
+ The requested features of the component, if not specified the default entry will be retrieved.
480
+
481
+ #### Returns
482
+
483
+ `string`
484
+
485
+ The instance type matching the criteria if one is registered.
486
+
487
+ #### Throws
488
+
489
+ If a matching instance was not found.
490
+
491
+ #### Inherited from
492
+
493
+ `EngineCore.getRegisteredInstanceType`
494
+
495
+ ***
496
+
497
+ ### getRegisteredInstanceTypeOptional()
498
+
499
+ > **getRegisteredInstanceTypeOptional**(`componentConnectorType`, `features?`): `undefined` \| `string`
500
+
501
+ Get the registered instance type for the component/connector if it exists.
502
+
503
+ #### Parameters
504
+
505
+ ##### componentConnectorType
506
+
507
+ `string`
508
+
509
+ The type of the component/connector.
510
+
511
+ ##### features?
512
+
513
+ `string`[]
514
+
515
+ The requested features of the component, if not specified the default entry will be retrieved.
516
+
517
+ #### Returns
518
+
519
+ `undefined` \| `string`
520
+
521
+ The instance type matching the criteria if one is registered.
522
+
523
+ #### Inherited from
524
+
525
+ `EngineCore.getRegisteredInstanceTypeOptional`
526
+
527
+ ***
528
+
529
+ ### getCloneData()
530
+
531
+ > **getCloneData**(): `IEngineCoreClone`\<`C`, `S`\>
532
+
533
+ Get the data required to create a clone of the engine.
534
+
535
+ #### Returns
536
+
537
+ `IEngineCoreClone`\<`C`, `S`\>
538
+
539
+ The clone data.
540
+
541
+ #### Inherited from
542
+
543
+ `EngineCore.getCloneData`
544
+
545
+ ***
546
+
547
+ ### populateClone()
548
+
549
+ > **populateClone**(`cloneData`, `silent?`): `void`
550
+
551
+ Populate the engine from the clone data.
552
+
553
+ #### Parameters
554
+
555
+ ##### cloneData
556
+
557
+ `IEngineCoreClone`\<`C`, `S`\>
558
+
559
+ The clone data to populate from.
560
+
561
+ ##### silent?
562
+
563
+ `boolean`
564
+
565
+ Should the clone be silent.
566
+
567
+ #### Returns
568
+
569
+ `void`
570
+
571
+ #### Inherited from
572
+
573
+ `EngineCore.populateClone`
@@ -24,7 +24,7 @@ Runtime name for the class.
24
24
 
25
25
  ### addCustomEntityStorage()
26
26
 
27
- > `static` **addCustomEntityStorage**\<`T`\>(`engineConfig`, `entityTypeName`, `entitySchema`, `restPath?`, `options?`): `void`
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
- ##### options?
63
+ ##### partitionContextIds?
64
64
 
65
- Additional options.
65
+ `string`[]
66
66
 
67
- ###### partitionPerUser?
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/engine",
3
- "version": "0.0.2-next.26",
3
+ "version": "0.0.2-next.27",
4
4
  "description": "Engine implementation.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,7 +13,22 @@
13
13
  "engines": {
14
14
  "node": ">=20.0.0"
15
15
  },
16
+ "scripts": {
17
+ "clean": "rimraf dist coverage docs/reference",
18
+ "build": "tspc",
19
+ "dev": "nodemon --watch src --ext ts --exec \"npm run build\"",
20
+ "test": "vitest --run --config ./vitest.config.ts --no-cache",
21
+ "test:build": "tspc -p ./tests/tsconfig.json --noEmit",
22
+ "validate-locales": "validate-locales",
23
+ "test:coverage": "vitest --run --coverage --config ./vitest.config.ts --no-cache",
24
+ "docs:clean": "rimraf docs/reference",
25
+ "docs:generate": "typedoc",
26
+ "docs": "npm run docs:clean && npm run docs:generate",
27
+ "dist": "npm run clean && npm run build && npm run validate-locales && npm run test:build && npm run test && npm run docs",
28
+ "dist:no-test": "npm run clean && npm run build && npm run test:build && npm run docs"
29
+ },
16
30
  "dependencies": {
31
+ "@twin.org/context": "next",
17
32
  "@twin.org/core": "next",
18
33
  "@twin.org/engine-core": "0.0.2-next.26",
19
34
  "@twin.org/engine-models": "0.0.2-next.26",
@@ -21,20 +36,33 @@
21
36
  "@twin.org/entity": "next",
22
37
  "@twin.org/nameof": "next"
23
38
  },
24
- "main": "./dist/cjs/index.cjs",
25
- "module": "./dist/esm/index.mjs",
39
+ "devDependencies": {
40
+ "@twin.org/nameof-transformer": "next",
41
+ "@twin.org/nameof-vitest-plugin": "next",
42
+ "@twin.org/validate-locales": "next",
43
+ "@twin.org/ts-to-openapi": "next",
44
+ "@vitest/coverage-v8": "3.2.4",
45
+ "copyfiles": "2.4.1",
46
+ "nodemon": "3.1.10",
47
+ "rimraf": "6.0.1",
48
+ "ts-patch": "3.3.0",
49
+ "typedoc": "0.28.13",
50
+ "typedoc-plugin-markdown": "4.9.0",
51
+ "typescript": "5.9.3",
52
+ "vitest": "3.2.4"
53
+ },
54
+ "main": "./dist/es/index.js",
26
55
  "types": "./dist/types/index.d.ts",
27
56
  "exports": {
28
57
  ".": {
29
58
  "types": "./dist/types/index.d.ts",
30
- "require": "./dist/cjs/index.cjs",
31
- "import": "./dist/esm/index.mjs"
59
+ "import": "./dist/es/index.js",
60
+ "default": "./dist/es/index.js"
32
61
  },
33
62
  "./locales/*.json": "./locales/*.json"
34
63
  },
35
64
  "files": [
36
- "dist/cjs",
37
- "dist/esm",
65
+ "dist/es",
38
66
  "dist/types",
39
67
  "locales",
40
68
  "docs"