@3sixty/engine 0.0.0-stage → 0.20.0-next.0

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.
@@ -0,0 +1,737 @@
1
+ # Class: Engine\<C, S\>
2
+
3
+ The engine with built in types.
4
+
5
+ ## Extends
6
+
7
+ - `EngineCore`\<`C`, `S`\>
8
+
9
+ ## Type Parameters
10
+
11
+ ### C
12
+
13
+ `C` *extends* `IEngineConfig` = `IEngineConfig`
14
+
15
+ ### S
16
+
17
+ `S` *extends* `IEngineState` = `IEngineState`
18
+
19
+ ## Constructors
20
+
21
+ ### Constructor
22
+
23
+ > **new Engine**\<`C`, `S`\>(`options?`): `Engine`\<`C`, `S`\>
24
+
25
+ Create a new instance of Engine.
26
+
27
+ #### Parameters
28
+
29
+ ##### options?
30
+
31
+ `IEngineCoreOptions`\<`C`, `S`\>
32
+
33
+ The options for the engine.
34
+
35
+ #### Returns
36
+
37
+ `Engine`\<`C`, `S`\>
38
+
39
+ #### Overrides
40
+
41
+ `EngineCore<C, S>.constructor`
42
+
43
+ ## Properties
44
+
45
+ ### CLASS\_NAME {#class_name}
46
+
47
+ > `readonly` `static` **CLASS\_NAME**: `string`
48
+
49
+ Runtime name for the class.
50
+
51
+ #### Overrides
52
+
53
+ `EngineCore.CLASS_NAME`
54
+
55
+ ***
56
+
57
+ ### LOGGING\_COMPONENT\_TYPE\_NAME {#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 {#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 {#_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 {#_contextidkeys}
94
+
95
+ > `protected` `readonly` **\_contextIdKeys**: `object`[]
96
+
97
+ The context ID keys.
98
+
99
+ #### key
100
+
101
+ > **key**: `string`
102
+
103
+ #### componentFeatures
104
+
105
+ > **componentFeatures**: `string`[]
106
+
107
+ #### Inherited from
108
+
109
+ `EngineCore._contextIdKeys`
110
+
111
+ ***
112
+
113
+ ### \_contextIds? {#_contextids}
114
+
115
+ > `protected` `optional` **\_contextIds?**: `IContextIds`
116
+
117
+ The context IDs.
118
+
119
+ #### Inherited from
120
+
121
+ `EngineCore._contextIds`
122
+
123
+ ## Methods
124
+
125
+ ### addTypeInitialiser() {#addtypeinitialiser}
126
+
127
+ > **addTypeInitialiser**(`type`, `module`, `method`): `void`
128
+
129
+ Add a type initialiser.
130
+
131
+ #### Parameters
132
+
133
+ ##### type
134
+
135
+ `string`
136
+
137
+ The type to add the initialiser for.
138
+
139
+ ##### module
140
+
141
+ `string`
142
+
143
+ The name of the module which contains the initialiser method.
144
+
145
+ ##### method
146
+
147
+ `string`
148
+
149
+ The name of the method to call.
150
+
151
+ #### Returns
152
+
153
+ `void`
154
+
155
+ #### Inherited from
156
+
157
+ `EngineCore.addTypeInitialiser`
158
+
159
+ ***
160
+
161
+ ### getTypeConfig() {#gettypeconfig}
162
+
163
+ > **getTypeConfig**(`type`): `IEngineCoreTypeConfig`[] \| `undefined`
164
+
165
+ Get the type config for a specific type.
166
+
167
+ #### Parameters
168
+
169
+ ##### type
170
+
171
+ `string`
172
+
173
+ The type to get the config for.
174
+
175
+ #### Returns
176
+
177
+ `IEngineCoreTypeConfig`[] \| `undefined`
178
+
179
+ The type config or undefined if not found.
180
+
181
+ #### Inherited from
182
+
183
+ `EngineCore.getTypeConfig`
184
+
185
+ ***
186
+
187
+ ### addContextIdKey() {#addcontextidkey}
188
+
189
+ > **addContextIdKey**(`key`, `componentFeatures`): `void`
190
+
191
+ Add a context ID key to the engine.
192
+
193
+ #### Parameters
194
+
195
+ ##### key
196
+
197
+ `string`
198
+
199
+ The context ID key.
200
+
201
+ ##### componentFeatures
202
+
203
+ `string`[]
204
+
205
+ The component features for the context ID handler.
206
+
207
+ #### Returns
208
+
209
+ `void`
210
+
211
+ #### Inherited from
212
+
213
+ `EngineCore.addContextIdKey`
214
+
215
+ ***
216
+
217
+ ### getContextIdKeys() {#getcontextidkeys}
218
+
219
+ > **getContextIdKeys**(): `string`[]
220
+
221
+ Get the context ID keys for the engine.
222
+
223
+ #### Returns
224
+
225
+ `string`[]
226
+
227
+ The context IDs keys.
228
+
229
+ #### Inherited from
230
+
231
+ `EngineCore.getContextIdKeys`
232
+
233
+ ***
234
+
235
+ ### addContextId() {#addcontextid}
236
+
237
+ > **addContextId**(`key`, `value`): `void`
238
+
239
+ Add a context ID to the engine.
240
+
241
+ #### Parameters
242
+
243
+ ##### key
244
+
245
+ `string`
246
+
247
+ The context ID key.
248
+
249
+ ##### value
250
+
251
+ `string`
252
+
253
+ The context ID value.
254
+
255
+ #### Returns
256
+
257
+ `void`
258
+
259
+ #### Inherited from
260
+
261
+ `EngineCore.addContextId`
262
+
263
+ ***
264
+
265
+ ### getContextIds() {#getcontextids}
266
+
267
+ > **getContextIds**(): `IContextIds` \| `undefined`
268
+
269
+ Get the context IDs for the engine.
270
+
271
+ #### Returns
272
+
273
+ `IContextIds` \| `undefined`
274
+
275
+ The context IDs or undefined if none are set.
276
+
277
+ #### Inherited from
278
+
279
+ `EngineCore.getContextIds`
280
+
281
+ ***
282
+
283
+ ### start() {#start}
284
+
285
+ > **start**(`skipComponentStart?`): `Promise`\<`void`\>
286
+
287
+ Start the engine core.
288
+
289
+ #### Parameters
290
+
291
+ ##### skipComponentStart?
292
+
293
+ `boolean`
294
+
295
+ Should the component start be skipped.
296
+
297
+ #### Returns
298
+
299
+ `Promise`\<`void`\>
300
+
301
+ A promise that resolves when the engine and all components have started.
302
+
303
+ #### Inherited from
304
+
305
+ `EngineCore.start`
306
+
307
+ ***
308
+
309
+ ### stop() {#stop}
310
+
311
+ > **stop**(): `Promise`\<`void`\>
312
+
313
+ Stop the engine core.
314
+
315
+ #### Returns
316
+
317
+ `Promise`\<`void`\>
318
+
319
+ A promise that resolves when all components have stopped and state has been saved.
320
+
321
+ #### Inherited from
322
+
323
+ `EngineCore.stop`
324
+
325
+ ***
326
+
327
+ ### isStarted() {#isstarted}
328
+
329
+ > **isStarted**(): `boolean`
330
+
331
+ Is the engine started.
332
+
333
+ #### Returns
334
+
335
+ `boolean`
336
+
337
+ True if the engine is started.
338
+
339
+ #### Inherited from
340
+
341
+ `EngineCore.isStarted`
342
+
343
+ ***
344
+
345
+ ### isPrimary() {#isprimary}
346
+
347
+ > **isPrimary**(): `boolean`
348
+
349
+ Is this the primary engine instance.
350
+
351
+ #### Returns
352
+
353
+ `boolean`
354
+
355
+ True if the engine is the primary instance.
356
+
357
+ #### Inherited from
358
+
359
+ `EngineCore.isPrimary`
360
+
361
+ ***
362
+
363
+ ### isClone() {#isclone}
364
+
365
+ > **isClone**(): `boolean`
366
+
367
+ Is this engine instance a clone.
368
+
369
+ #### Returns
370
+
371
+ `boolean`
372
+
373
+ True if the engine instance is a clone.
374
+
375
+ #### Inherited from
376
+
377
+ `EngineCore.isClone`
378
+
379
+ ***
380
+
381
+ ### logInfo() {#loginfo}
382
+
383
+ > **logInfo**(`message`): `Promise`\<`void`\>
384
+
385
+ Log info.
386
+
387
+ #### Parameters
388
+
389
+ ##### message
390
+
391
+ `string`
392
+
393
+ The message to log.
394
+
395
+ #### Returns
396
+
397
+ `Promise`\<`void`\>
398
+
399
+ A promise that resolves when the message has been logged.
400
+
401
+ #### Inherited from
402
+
403
+ `EngineCore.logInfo`
404
+
405
+ ***
406
+
407
+ ### logError() {#logerror}
408
+
409
+ > **logError**(`error`): `Promise`\<`void`\>
410
+
411
+ Log error.
412
+
413
+ #### Parameters
414
+
415
+ ##### error
416
+
417
+ `IError`
418
+
419
+ The error to log.
420
+
421
+ #### Returns
422
+
423
+ `Promise`\<`void`\>
424
+
425
+ A promise that resolves when the error has been logged.
426
+
427
+ #### Inherited from
428
+
429
+ `EngineCore.logError`
430
+
431
+ ***
432
+
433
+ ### getConfig() {#getconfig}
434
+
435
+ > **getConfig**(): `C`
436
+
437
+ Get the config for the engine.
438
+
439
+ #### Returns
440
+
441
+ `C`
442
+
443
+ The config for the engine.
444
+
445
+ #### Inherited from
446
+
447
+ `EngineCore.getConfig`
448
+
449
+ ***
450
+
451
+ ### getState() {#getstate}
452
+
453
+ > **getState**(): `S`
454
+
455
+ Get the state of the engine.
456
+
457
+ #### Returns
458
+
459
+ `S`
460
+
461
+ The state of the engine.
462
+
463
+ #### Inherited from
464
+
465
+ `EngineCore.getState`
466
+
467
+ ***
468
+
469
+ ### setStateDirty() {#setstatedirty}
470
+
471
+ > **setStateDirty**(): `void`
472
+
473
+ Set the state to dirty so it gets saved.
474
+
475
+ #### Returns
476
+
477
+ `void`
478
+
479
+ #### Inherited from
480
+
481
+ `EngineCore.setStateDirty`
482
+
483
+ ***
484
+
485
+ ### getRegisteredInstances() {#getregisteredinstances}
486
+
487
+ > **getRegisteredInstances**(): `object`
488
+
489
+ Get all the registered instances.
490
+
491
+ #### Returns
492
+
493
+ `object`
494
+
495
+ The registered instances.
496
+
497
+ #### Inherited from
498
+
499
+ `EngineCore.getRegisteredInstances`
500
+
501
+ ***
502
+
503
+ ### getRegisteredInstanceType() {#getregisteredinstancetype}
504
+
505
+ > **getRegisteredInstanceType**(`componentConnectorType`, `features?`): `string`
506
+
507
+ Get the registered instance type for the component/connector.
508
+
509
+ #### Parameters
510
+
511
+ ##### componentConnectorType
512
+
513
+ `string`
514
+
515
+ The type of the component/connector.
516
+
517
+ ##### features?
518
+
519
+ `string`[]
520
+
521
+ The requested features of the component, if not specified the default entry will be retrieved.
522
+
523
+ #### Returns
524
+
525
+ `string`
526
+
527
+ The instance type matching the criteria if one is registered.
528
+
529
+ #### Throws
530
+
531
+ If a matching instance was not found.
532
+
533
+ #### Inherited from
534
+
535
+ `EngineCore.getRegisteredInstanceType`
536
+
537
+ ***
538
+
539
+ ### getRegisteredInstanceTypeOptional() {#getregisteredinstancetypeoptional}
540
+
541
+ > **getRegisteredInstanceTypeOptional**(`componentConnectorType`, `features?`): `string` \| `undefined`
542
+
543
+ Get the registered instance type for the component/connector if it exists.
544
+
545
+ #### Parameters
546
+
547
+ ##### componentConnectorType
548
+
549
+ `string`
550
+
551
+ The type of the component/connector.
552
+
553
+ ##### features?
554
+
555
+ `string`[]
556
+
557
+ The requested features of the component, if not specified the default entry will be retrieved.
558
+
559
+ #### Returns
560
+
561
+ `string` \| `undefined`
562
+
563
+ The instance type matching the criteria if one is registered.
564
+
565
+ #### Inherited from
566
+
567
+ `EngineCore.getRegisteredInstanceTypeOptional`
568
+
569
+ ***
570
+
571
+ ### getRegisteredSilencedType() {#getregisteredsilencedtype}
572
+
573
+ > **getRegisteredSilencedType**(`componentType`, `componentName`): `string` \| `undefined`
574
+
575
+ Get the registered component type for the given component type, if not silenced.
576
+
577
+ #### Parameters
578
+
579
+ ##### componentType
580
+
581
+ `"logging"` \| `"telemetry"` \| `"tracing"`
582
+
583
+ The type of component to get the registered type for.
584
+
585
+ ##### componentName
586
+
587
+ `string`
588
+
589
+ The name of the component to get the type for.
590
+
591
+ #### Returns
592
+
593
+ `string` \| `undefined`
594
+
595
+ The component type name if one is registered and not silenced.
596
+
597
+ #### Inherited from
598
+
599
+ `EngineCore.getRegisteredSilencedType`
600
+
601
+ ***
602
+
603
+ ### getRegisteredComponents() {#getregisteredcomponents}
604
+
605
+ > **getRegisteredComponents**(): `Promise`\<`object`[]\>
606
+
607
+ Get the registered components.
608
+
609
+ #### Returns
610
+
611
+ `Promise`\<`object`[]\>
612
+
613
+ The registered components.
614
+
615
+ #### Inherited from
616
+
617
+ `EngineCore.getRegisteredComponents`
618
+
619
+ ***
620
+
621
+ ### addRegisteredComponent() {#addregisteredcomponent}
622
+
623
+ > **addRegisteredComponent**(`instanceType`, `component`): `Promise`\<`void`\>
624
+
625
+ Add a registered component to the engine.
626
+
627
+ #### Parameters
628
+
629
+ ##### instanceType
630
+
631
+ `string`
632
+
633
+ The instance type to register the component under.
634
+
635
+ ##### component
636
+
637
+ `IComponent`
638
+
639
+ The component to register.
640
+
641
+ #### Returns
642
+
643
+ `Promise`\<`void`\>
644
+
645
+ A promise that resolves when the component has been registered.
646
+
647
+ #### Inherited from
648
+
649
+ `EngineCore.addRegisteredComponent`
650
+
651
+ ***
652
+
653
+ ### getCloneData() {#getclonedata}
654
+
655
+ > **getCloneData**(): `IEngineCoreClone`\<`C`, `S`\>
656
+
657
+ Get the data required to create a clone of the engine.
658
+
659
+ #### Returns
660
+
661
+ `IEngineCoreClone`\<`C`, `S`\>
662
+
663
+ The clone data.
664
+
665
+ #### Inherited from
666
+
667
+ `EngineCore.getCloneData`
668
+
669
+ ***
670
+
671
+ ### populateClone() {#populateclone}
672
+
673
+ > **populateClone**(`cloneData`, `contextIds?`, `options?`): `void`
674
+
675
+ Populate the engine from the clone data.
676
+
677
+ #### Parameters
678
+
679
+ ##### cloneData
680
+
681
+ `IEngineCoreClone`\<`C`, `S`\>
682
+
683
+ The clone data to populate from.
684
+
685
+ ##### contextIds?
686
+
687
+ `IContextIds`
688
+
689
+ The context IDs to use for the clone.
690
+
691
+ ##### options?
692
+
693
+ `boolean` \| \{ `logLevel?`: `EngineLogLevel`; `types?`: `string`[]; `entityTypes?`: `string`[]; `facades?`: \{\[`factoryTypeName`: `string`\]: `IEngineFacadeConfig`[]; \}; \}
694
+
695
+ An optional object containing the log level, types and entity types to include.
696
+
697
+ `boolean`
698
+
699
+ ***
700
+
701
+ ###### Type Literal
702
+
703
+ \{ `logLevel?`: `EngineLogLevel`; `types?`: `string`[]; `entityTypes?`: `string`[]; `facades?`: \{\[`factoryTypeName`: `string`\]: `IEngineFacadeConfig`[]; \}; \}
704
+
705
+ An optional object containing the log level, types and entity types to include.
706
+
707
+ ###### logLevel?
708
+
709
+ `EngineLogLevel`
710
+
711
+ The log level for the clone, true maps to error level.
712
+
713
+ ###### types?
714
+
715
+ `string`[]
716
+
717
+ An optional allowlist of type keys to include; when omitted all types are cloned.
718
+
719
+ ###### entityTypes?
720
+
721
+ `string`[]
722
+
723
+ An optional allowlist of entity type names; when provided only those entity schemas and their associated storage components are cloned.
724
+
725
+ ###### facades?
726
+
727
+ \{\[`factoryTypeName`: `string`\]: `IEngineFacadeConfig`[]; \}
728
+
729
+ An optional override for the facades the clone activates.
730
+
731
+ #### Returns
732
+
733
+ `void`
734
+
735
+ #### Inherited from
736
+
737
+ `EngineCore.populateClone`