@xylabs/creatable 5.0.83 → 5.0.86
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/README.md +732 -1222
- package/package.json +10 -10
package/README.md
CHANGED
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
17
17
|
|
|
18
|
+
|
|
19
|
+
|
|
18
20
|
## Reference
|
|
19
21
|
|
|
20
22
|
**@xylabs/creatable**
|
|
@@ -23,34 +25,42 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
23
25
|
|
|
24
26
|
## Classes
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
| Class | Description |
|
|
29
|
+
| ------ | ------ |
|
|
30
|
+
| [AbstractCreatable](#classes/AbstractCreatable) | Base class for objects that follow an asynchronous creation and lifecycle pattern. Instances must be created via the static `create` method rather than direct construction. Provides start/stop lifecycle management with status tracking and telemetry support. |
|
|
31
|
+
| [AbstractCreatableWithFactory](#classes/AbstractCreatableWithFactory) | Extends AbstractCreatable with a static `factory` method for creating pre-configured CreatableFactory instances. |
|
|
32
|
+
| [Factory](#classes/Factory) | A concrete factory that wraps a Creatable class with default parameters and labels. Instances are created by merging caller-provided params over the factory defaults. |
|
|
29
33
|
|
|
30
34
|
## Interfaces
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
| Interface | Description |
|
|
37
|
+
| ------ | ------ |
|
|
38
|
+
| [CreatableFactory](#interfaces/CreatableFactory) | A factory interface for creating instances of a Creatable with pre-configured parameters. Unlike the full Creatable, this only exposes the `create` method. |
|
|
39
|
+
| [Creatable](#interfaces/Creatable) | Static interface for classes that support asynchronous creation. Provides the `create`, `createHandler`, and `paramsHandler` static methods used to construct instances through the creatable lifecycle. |
|
|
40
|
+
| [CreatableWithFactory](#interfaces/CreatableWithFactory) | Extends Creatable with a `factory` method that produces pre-configured CreatableFactory instances. |
|
|
41
|
+
| [CreatableInstance](#interfaces/CreatableInstance) | Represents a created instance with a managed lifecycle (start/stop) and event emission. |
|
|
42
|
+
| [RequiredCreatableParams](#interfaces/RequiredCreatableParams) | The minimum required parameters for constructing a creatable. |
|
|
43
|
+
| [CreatableParams](#interfaces/CreatableParams) | Parameters for creating a creatable instance, combining required params with emitter params. |
|
|
44
|
+
| [CreatableStatusReporter](#interfaces/CreatableStatusReporter) | Reports status changes for a creatable, supporting progress tracking and error reporting. |
|
|
45
|
+
| [Labels](#interfaces/Labels) | Object used to represent labels identifying a resource. |
|
|
46
|
+
| [WithLabels](#interfaces/WithLabels) | Interface for objects that have labels. |
|
|
47
|
+
| [WithOptionalLabels](#interfaces/WithOptionalLabels) | Interface for objects that have labels. |
|
|
42
48
|
|
|
43
49
|
## Type Aliases
|
|
44
50
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
51
|
+
| Type Alias | Description |
|
|
52
|
+
| ------ | ------ |
|
|
53
|
+
| [CreatableName](#type-aliases/CreatableName) | A branded string type used as the name identifier for creatables. |
|
|
54
|
+
| [StandardCreatableStatus](#type-aliases/StandardCreatableStatus) | The standard lifecycle statuses a creatable can transition through. |
|
|
55
|
+
| [CreatableStatus](#type-aliases/CreatableStatus) | A creatable's status, optionally extended with additional custom status values. |
|
|
48
56
|
|
|
49
57
|
## Functions
|
|
50
58
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
| Function | Description |
|
|
60
|
+
| ------ | ------ |
|
|
61
|
+
| [creatable](#functions/creatable) | Class annotation to be used to decorate Modules which support an asynchronous creation pattern |
|
|
62
|
+
| [creatableFactory](#functions/creatableFactory) | Class annotation to be used to decorate Modules which support an asynchronous creation factory pattern |
|
|
63
|
+
| [hasAllLabels](#functions/hasAllLabels) | Returns true if the source object has all the labels from the required set |
|
|
54
64
|
|
|
55
65
|
### classes
|
|
56
66
|
|
|
@@ -74,31 +84,25 @@ Provides start/stop lifecycle management with status tracking and telemetry supp
|
|
|
74
84
|
|
|
75
85
|
## Type Parameters
|
|
76
86
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
`TParams` *extends* [`CreatableParams`](#../interfaces/CreatableParams)
|
|
80
|
-
|
|
81
|
-
### TEventData
|
|
82
|
-
|
|
83
|
-
`TEventData` *extends* `EventData` = `EventData`
|
|
87
|
+
| Type Parameter | Default type |
|
|
88
|
+
| ------ | ------ |
|
|
89
|
+
| `TParams` *extends* [`CreatableParams`](#../interfaces/CreatableParams) | [`CreatableParams`](#../interfaces/CreatableParams) |
|
|
90
|
+
| `TEventData` *extends* `EventData` | `EventData` |
|
|
84
91
|
|
|
85
92
|
## Constructors
|
|
86
93
|
|
|
87
94
|
### Constructor
|
|
88
95
|
|
|
89
96
|
```ts
|
|
90
|
-
new AbstractCreatable<TParams, TEventData>(key, params): AbstractCreatable<TParams, TEventData>;
|
|
97
|
+
new AbstractCreatable<TParams, TEventData>(key: unknown, params: Partial<TParams & RequiredCreatableParams>): AbstractCreatable<TParams, TEventData>;
|
|
91
98
|
```
|
|
92
99
|
|
|
93
100
|
### Parameters
|
|
94
101
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
`unknown`
|
|
98
|
-
|
|
99
|
-
#### params
|
|
100
|
-
|
|
101
|
-
`Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\>
|
|
102
|
+
| Parameter | Type |
|
|
103
|
+
| ------ | ------ |
|
|
104
|
+
| `key` | `unknown` |
|
|
105
|
+
| `params` | `Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\> |
|
|
102
106
|
|
|
103
107
|
### Returns
|
|
104
108
|
|
|
@@ -112,77 +116,14 @@ BaseEmitter<Partial<TParams & RequiredCreatableParams>, TEventData>.constructor
|
|
|
112
116
|
|
|
113
117
|
## Properties
|
|
114
118
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
```ts
|
|
124
|
-
BaseEmitter.defaultLogger
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
***
|
|
128
|
-
|
|
129
|
-
### globalInstances
|
|
130
|
-
|
|
131
|
-
```ts
|
|
132
|
-
readonly static globalInstances: Record<BaseClassName, WeakRef<Base>[]>;
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Inherited from
|
|
136
|
-
|
|
137
|
-
```ts
|
|
138
|
-
BaseEmitter.globalInstances
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
***
|
|
142
|
-
|
|
143
|
-
### globalInstancesCountHistory
|
|
144
|
-
|
|
145
|
-
```ts
|
|
146
|
-
readonly static globalInstancesCountHistory: Record<BaseClassName, number[]>;
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
### Inherited from
|
|
150
|
-
|
|
151
|
-
```ts
|
|
152
|
-
BaseEmitter.globalInstancesCountHistory
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
***
|
|
156
|
-
|
|
157
|
-
### defaultLogger?
|
|
158
|
-
|
|
159
|
-
```ts
|
|
160
|
-
optional defaultLogger: Logger;
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Optional default logger for this instance.
|
|
164
|
-
|
|
165
|
-
***
|
|
166
|
-
|
|
167
|
-
### \_startPromise
|
|
168
|
-
|
|
169
|
-
```ts
|
|
170
|
-
protected _startPromise: Promisable<boolean> | undefined;
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
***
|
|
174
|
-
|
|
175
|
-
### eventData
|
|
176
|
-
|
|
177
|
-
```ts
|
|
178
|
-
eventData: TEventData;
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Inherited from
|
|
182
|
-
|
|
183
|
-
```ts
|
|
184
|
-
BaseEmitter.eventData
|
|
185
|
-
```
|
|
119
|
+
| Property | Modifier | Type | Description | Inherited from |
|
|
120
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
121
|
+
| <a id="defaultlogger"></a> `defaultLogger?` | `static` | `Logger` | - | `BaseEmitter.defaultLogger` |
|
|
122
|
+
| <a id="globalinstances"></a> `globalInstances` | `readonly` | `Record`\<`BaseClassName`, `WeakRef`\<`Base`\>[]\> | - | `BaseEmitter.globalInstances` |
|
|
123
|
+
| <a id="globalinstancescounthistory"></a> `globalInstancesCountHistory` | `readonly` | `Record`\<`BaseClassName`, `number`[]\> | - | `BaseEmitter.globalInstancesCountHistory` |
|
|
124
|
+
| <a id="defaultlogger-1"></a> `defaultLogger?` | `public` | `Logger` | Optional default logger for this instance. | - |
|
|
125
|
+
| <a id="_startpromise"></a> `_startPromise` | `protected` | `Promisable`\<`boolean`\> \| `undefined` | - | - |
|
|
126
|
+
| <a id="eventdata"></a> `eventData` | `public` | `TEventData` | Type-level reference to the event data shape for external type queries. | `BaseEmitter.eventData` |
|
|
186
127
|
|
|
187
128
|
## Accessors
|
|
188
129
|
|
|
@@ -201,14 +142,14 @@ get static historyInterval(): number;
|
|
|
201
142
|
### Set Signature
|
|
202
143
|
|
|
203
144
|
```ts
|
|
204
|
-
set static historyInterval(value): void;
|
|
145
|
+
set static historyInterval(value: number): void;
|
|
205
146
|
```
|
|
206
147
|
|
|
207
148
|
#### Parameters
|
|
208
149
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
`number`
|
|
150
|
+
| Parameter | Type |
|
|
151
|
+
| ------ | ------ |
|
|
152
|
+
| `value` | `number` |
|
|
212
153
|
|
|
213
154
|
#### Returns
|
|
214
155
|
|
|
@@ -237,14 +178,14 @@ get static historyTime(): number;
|
|
|
237
178
|
### Set Signature
|
|
238
179
|
|
|
239
180
|
```ts
|
|
240
|
-
set static historyTime(value): void;
|
|
181
|
+
set static historyTime(value: number): void;
|
|
241
182
|
```
|
|
242
183
|
|
|
243
184
|
#### Parameters
|
|
244
185
|
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
`number`
|
|
186
|
+
| Parameter | Type |
|
|
187
|
+
| ------ | ------ |
|
|
188
|
+
| `value` | `number` |
|
|
248
189
|
|
|
249
190
|
#### Returns
|
|
250
191
|
|
|
@@ -273,14 +214,14 @@ get static maxGcFrequency(): number;
|
|
|
273
214
|
### Set Signature
|
|
274
215
|
|
|
275
216
|
```ts
|
|
276
|
-
set static maxGcFrequency(value): void;
|
|
217
|
+
set static maxGcFrequency(value: number): void;
|
|
277
218
|
```
|
|
278
219
|
|
|
279
220
|
#### Parameters
|
|
280
221
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
`number`
|
|
222
|
+
| Parameter | Type |
|
|
223
|
+
| ------ | ------ |
|
|
224
|
+
| `value` | `number` |
|
|
284
225
|
|
|
285
226
|
#### Returns
|
|
286
227
|
|
|
@@ -468,14 +409,14 @@ The status reporter used to broadcast lifecycle changes.
|
|
|
468
409
|
### Call Signature
|
|
469
410
|
|
|
470
411
|
```ts
|
|
471
|
-
static gc(force
|
|
412
|
+
static gc(force?: boolean): void;
|
|
472
413
|
```
|
|
473
414
|
|
|
474
415
|
#### Parameters
|
|
475
416
|
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
`boolean`
|
|
417
|
+
| Parameter | Type |
|
|
418
|
+
| ------ | ------ |
|
|
419
|
+
| `force?` | `boolean` |
|
|
479
420
|
|
|
480
421
|
#### Returns
|
|
481
422
|
|
|
@@ -490,14 +431,14 @@ BaseEmitter.gc
|
|
|
490
431
|
### Call Signature
|
|
491
432
|
|
|
492
433
|
```ts
|
|
493
|
-
static gc(className): void;
|
|
434
|
+
static gc(className: BaseClassName): void;
|
|
494
435
|
```
|
|
495
436
|
|
|
496
437
|
#### Parameters
|
|
497
438
|
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
`BaseClassName`
|
|
439
|
+
| Parameter | Type |
|
|
440
|
+
| ------ | ------ |
|
|
441
|
+
| `className` | `BaseClassName` |
|
|
501
442
|
|
|
502
443
|
#### Returns
|
|
503
444
|
|
|
@@ -514,14 +455,14 @@ BaseEmitter.gc
|
|
|
514
455
|
### instanceCount()
|
|
515
456
|
|
|
516
457
|
```ts
|
|
517
|
-
static instanceCount(className): number;
|
|
458
|
+
static instanceCount(className: BaseClassName): number;
|
|
518
459
|
```
|
|
519
460
|
|
|
520
461
|
### Parameters
|
|
521
462
|
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
`BaseClassName`
|
|
463
|
+
| Parameter | Type |
|
|
464
|
+
| ------ | ------ |
|
|
465
|
+
| `className` | `BaseClassName` |
|
|
525
466
|
|
|
526
467
|
### Returns
|
|
527
468
|
|
|
@@ -592,7 +533,7 @@ BaseEmitter.stopHistory
|
|
|
592
533
|
### create()
|
|
593
534
|
|
|
594
535
|
```ts
|
|
595
|
-
static create<T>(this
|
|
536
|
+
static create<T>(this: Creatable<T>, inParams?: Partial<T["params"]>): Promise<T>;
|
|
596
537
|
```
|
|
597
538
|
|
|
598
539
|
Asynchronously creates a new instance by processing params, constructing,
|
|
@@ -600,21 +541,16 @@ and running both static and instance createHandlers.
|
|
|
600
541
|
|
|
601
542
|
### Type Parameters
|
|
602
543
|
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
544
|
+
| Type Parameter |
|
|
545
|
+
| ------ |
|
|
546
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
606
547
|
|
|
607
548
|
### Parameters
|
|
608
549
|
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
612
|
-
|
|
613
|
-
#### inParams?
|
|
614
|
-
|
|
615
|
-
`Partial`\<`T`\[`"params"`\]\> = `{}`
|
|
616
|
-
|
|
617
|
-
Optional partial parameters to configure the instance
|
|
550
|
+
| Parameter | Type | Description |
|
|
551
|
+
| ------ | ------ | ------ |
|
|
552
|
+
| `this` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | - |
|
|
553
|
+
| `inParams` | `Partial`\<`T`\[`"params"`\]\> | Optional partial parameters to configure the instance |
|
|
618
554
|
|
|
619
555
|
### Returns
|
|
620
556
|
|
|
@@ -627,7 +563,7 @@ The fully initialized instance
|
|
|
627
563
|
### createHandler()
|
|
628
564
|
|
|
629
565
|
```ts
|
|
630
|
-
static createHandler<T>(this
|
|
566
|
+
static createHandler<T>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
631
567
|
```
|
|
632
568
|
|
|
633
569
|
Static hook called during creation to perform additional initialization.
|
|
@@ -635,21 +571,16 @@ Override in subclasses to customize post-construction setup.
|
|
|
635
571
|
|
|
636
572
|
### Type Parameters
|
|
637
573
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
574
|
+
| Type Parameter |
|
|
575
|
+
| ------ |
|
|
576
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
641
577
|
|
|
642
578
|
### Parameters
|
|
643
579
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
647
|
-
|
|
648
|
-
#### instance
|
|
649
|
-
|
|
650
|
-
`T`
|
|
651
|
-
|
|
652
|
-
The newly constructed instance
|
|
580
|
+
| Parameter | Type | Description |
|
|
581
|
+
| ------ | ------ | ------ |
|
|
582
|
+
| `this` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | - |
|
|
583
|
+
| `instance` | `T` | The newly constructed instance |
|
|
653
584
|
|
|
654
585
|
### Returns
|
|
655
586
|
|
|
@@ -662,7 +593,7 @@ The instance, potentially modified
|
|
|
662
593
|
### paramsHandler()
|
|
663
594
|
|
|
664
595
|
```ts
|
|
665
|
-
static paramsHandler<T>(this
|
|
596
|
+
static paramsHandler<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promisable<T["params"]>;
|
|
666
597
|
```
|
|
667
598
|
|
|
668
599
|
Static hook called during creation to validate and transform params.
|
|
@@ -670,21 +601,16 @@ Override in subclasses to add default values or validation.
|
|
|
670
601
|
|
|
671
602
|
### Type Parameters
|
|
672
603
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
604
|
+
| Type Parameter |
|
|
605
|
+
| ------ |
|
|
606
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
676
607
|
|
|
677
608
|
### Parameters
|
|
678
609
|
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
682
|
-
|
|
683
|
-
#### params?
|
|
684
|
-
|
|
685
|
-
`Partial`\<`T`\[`"params"`\]\> = `{}`
|
|
686
|
-
|
|
687
|
-
The raw partial params provided to `create`
|
|
610
|
+
| Parameter | Type | Description |
|
|
611
|
+
| ------ | ------ | ------ |
|
|
612
|
+
| `this` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | - |
|
|
613
|
+
| `params` | `Partial`\<`T`\[`"params"`\]\> | The raw partial params provided to `create` |
|
|
688
614
|
|
|
689
615
|
### Returns
|
|
690
616
|
|
|
@@ -711,7 +637,7 @@ Instance-level creation hook. Override in subclasses to perform setup after cons
|
|
|
711
637
|
### paramsValidator()
|
|
712
638
|
|
|
713
639
|
```ts
|
|
714
|
-
paramsValidator(params): TParams & RequiredCreatableParams<void>;
|
|
640
|
+
paramsValidator(params: Partial<TParams & RequiredCreatableParams>): TParams & RequiredCreatableParams<void>;
|
|
715
641
|
```
|
|
716
642
|
|
|
717
643
|
Validates and returns the merged params, ensuring required fields are present.
|
|
@@ -719,11 +645,9 @@ Override in subclasses to add custom validation logic.
|
|
|
719
645
|
|
|
720
646
|
### Parameters
|
|
721
647
|
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
`Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\>
|
|
725
|
-
|
|
726
|
-
The raw partial params to validate
|
|
648
|
+
| Parameter | Type | Description |
|
|
649
|
+
| ------ | ------ | ------ |
|
|
650
|
+
| `params` | `Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\> | The raw partial params to validate |
|
|
727
651
|
|
|
728
652
|
### Returns
|
|
729
653
|
|
|
@@ -736,30 +660,23 @@ The validated params
|
|
|
736
660
|
### span()
|
|
737
661
|
|
|
738
662
|
```ts
|
|
739
|
-
span<T>(name, fn): T;
|
|
663
|
+
span<T>(name: string, fn: () => T): T;
|
|
740
664
|
```
|
|
741
665
|
|
|
742
666
|
Executes a function within a telemetry span.
|
|
743
667
|
|
|
744
668
|
### Type Parameters
|
|
745
669
|
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
`T`
|
|
670
|
+
| Type Parameter |
|
|
671
|
+
| ------ |
|
|
672
|
+
| `T` |
|
|
749
673
|
|
|
750
674
|
### Parameters
|
|
751
675
|
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
`string`
|
|
755
|
-
|
|
756
|
-
The span name
|
|
757
|
-
|
|
758
|
-
#### fn
|
|
759
|
-
|
|
760
|
-
() => `T`
|
|
761
|
-
|
|
762
|
-
The function to execute within the span
|
|
676
|
+
| Parameter | Type | Description |
|
|
677
|
+
| ------ | ------ | ------ |
|
|
678
|
+
| `name` | `string` | The span name |
|
|
679
|
+
| `fn` | () => `T` | The function to execute within the span |
|
|
763
680
|
|
|
764
681
|
### Returns
|
|
765
682
|
|
|
@@ -771,38 +688,26 @@ The function to execute within the span
|
|
|
771
688
|
|
|
772
689
|
```ts
|
|
773
690
|
spanAsync<T>(
|
|
774
|
-
name,
|
|
775
|
-
fn
|
|
776
|
-
config
|
|
691
|
+
name: string,
|
|
692
|
+
fn: () => Promise<T>,
|
|
693
|
+
config?: SpanConfig): Promise<T>;
|
|
777
694
|
```
|
|
778
695
|
|
|
779
696
|
Executes an async function within a telemetry span.
|
|
780
697
|
|
|
781
698
|
### Type Parameters
|
|
782
699
|
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
`T`
|
|
700
|
+
| Type Parameter |
|
|
701
|
+
| ------ |
|
|
702
|
+
| `T` |
|
|
786
703
|
|
|
787
704
|
### Parameters
|
|
788
705
|
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
`string`
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
#### fn
|
|
796
|
-
|
|
797
|
-
() => `Promise`\<`T`\>
|
|
798
|
-
|
|
799
|
-
The async function to execute within the span
|
|
800
|
-
|
|
801
|
-
#### config?
|
|
802
|
-
|
|
803
|
-
`SpanConfig` = `{}`
|
|
804
|
-
|
|
805
|
-
Optional span configuration
|
|
706
|
+
| Parameter | Type | Description |
|
|
707
|
+
| ------ | ------ | ------ |
|
|
708
|
+
| `name` | `string` | The span name |
|
|
709
|
+
| `fn` | () => `Promise`\<`T`\> | The async function to execute within the span |
|
|
710
|
+
| `config` | `SpanConfig` | Optional span configuration |
|
|
806
711
|
|
|
807
712
|
### Returns
|
|
808
713
|
|
|
@@ -828,7 +733,7 @@ Thread-safe via mutex. Returns true if already started or started successfully.
|
|
|
828
733
|
### started()
|
|
829
734
|
|
|
830
735
|
```ts
|
|
831
|
-
started(notStartedAction
|
|
736
|
+
started(notStartedAction?: "error" | "throw" | "warn" | "log" | "none"): boolean;
|
|
832
737
|
```
|
|
833
738
|
|
|
834
739
|
Checks whether this instance is currently started.
|
|
@@ -836,11 +741,9 @@ Takes an action if not started, based on the notStartedAction parameter.
|
|
|
836
741
|
|
|
837
742
|
### Parameters
|
|
838
743
|
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
What to do if not started: 'error'/'throw' throws, 'warn'/'log' logs, 'none' is silent
|
|
842
|
-
|
|
843
|
-
`"error"` | `"throw"` | `"warn"` | `"log"` | `"none"`
|
|
744
|
+
| Parameter | Type | Default value | Description |
|
|
745
|
+
| ------ | ------ | ------ | ------ |
|
|
746
|
+
| `notStartedAction` | `"error"` \| `"throw"` \| `"warn"` \| `"log"` \| `"none"` | `'log'` | What to do if not started: 'error'/'throw' throws, 'warn'/'log' logs, 'none' is silent |
|
|
844
747
|
|
|
845
748
|
### Returns
|
|
846
749
|
|
|
@@ -853,24 +756,17 @@ True if started, false otherwise
|
|
|
853
756
|
### startedAsync()
|
|
854
757
|
|
|
855
758
|
```ts
|
|
856
|
-
startedAsync(notStartedAction
|
|
759
|
+
startedAsync(notStartedAction?: "error" | "throw" | "warn" | "log" | "none", tryStart?: boolean): Promise<boolean>;
|
|
857
760
|
```
|
|
858
761
|
|
|
859
762
|
Async version of `started` that can optionally auto-start the instance.
|
|
860
763
|
|
|
861
764
|
### Parameters
|
|
862
765
|
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
What to do if not started and auto-start is disabled
|
|
866
|
-
|
|
867
|
-
`"error"` | `"throw"` | `"warn"` | `"log"` | `"none"`
|
|
868
|
-
|
|
869
|
-
#### tryStart?
|
|
870
|
-
|
|
871
|
-
`boolean` = `true`
|
|
872
|
-
|
|
873
|
-
If true, attempts to start the instance automatically
|
|
766
|
+
| Parameter | Type | Default value | Description |
|
|
767
|
+
| ------ | ------ | ------ | ------ |
|
|
768
|
+
| `notStartedAction` | `"error"` \| `"throw"` \| `"warn"` \| `"log"` \| `"none"` | `'log'` | What to do if not started and auto-start is disabled |
|
|
769
|
+
| `tryStart` | `boolean` | `true` | If true, attempts to start the instance automatically |
|
|
874
770
|
|
|
875
771
|
### Returns
|
|
876
772
|
|
|
@@ -898,7 +794,7 @@ Thread-safe via mutex. Returns true if already stopped or stopped successfully.
|
|
|
898
794
|
### \_noOverride()
|
|
899
795
|
|
|
900
796
|
```ts
|
|
901
|
-
protected _noOverride(functionName
|
|
797
|
+
protected _noOverride(functionName?: string): void;
|
|
902
798
|
```
|
|
903
799
|
|
|
904
800
|
Asserts that the given function has not been overridden in a subclass.
|
|
@@ -906,9 +802,9 @@ Used to enforce the handler pattern (override `startHandler` not `start`).
|
|
|
906
802
|
|
|
907
803
|
### Parameters
|
|
908
804
|
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
`string`
|
|
805
|
+
| Parameter | Type |
|
|
806
|
+
| ------ | ------ |
|
|
807
|
+
| `functionName` | `string` |
|
|
912
808
|
|
|
913
809
|
### Returns
|
|
914
810
|
|
|
@@ -921,20 +817,17 @@ Used to enforce the handler pattern (override `startHandler` not `start`).
|
|
|
921
817
|
### Call Signature
|
|
922
818
|
|
|
923
819
|
```ts
|
|
924
|
-
protected setStatus(value, progress
|
|
820
|
+
protected setStatus(value: "creating" | "created" | "starting" | "started" | "stopping" | "stopped", progress?: number): void;
|
|
925
821
|
```
|
|
926
822
|
|
|
927
823
|
Sets the lifecycle status and reports it via the status reporter.
|
|
928
824
|
|
|
929
825
|
#### Parameters
|
|
930
826
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
`"creating"`
|
|
934
|
-
|
|
935
|
-
##### progress?
|
|
936
|
-
|
|
937
|
-
`number`
|
|
827
|
+
| Parameter | Type |
|
|
828
|
+
| ------ | ------ |
|
|
829
|
+
| `value` | `"creating"` \| `"created"` \| `"starting"` \| `"started"` \| `"stopping"` \| `"stopped"` |
|
|
830
|
+
| `progress?` | `number` |
|
|
938
831
|
|
|
939
832
|
#### Returns
|
|
940
833
|
|
|
@@ -943,20 +836,17 @@ Sets the lifecycle status and reports it via the status reporter.
|
|
|
943
836
|
### Call Signature
|
|
944
837
|
|
|
945
838
|
```ts
|
|
946
|
-
protected setStatus(value, error
|
|
839
|
+
protected setStatus(value: "error", error?: Error): void;
|
|
947
840
|
```
|
|
948
841
|
|
|
949
842
|
Sets the lifecycle status and reports it via the status reporter.
|
|
950
843
|
|
|
951
844
|
#### Parameters
|
|
952
845
|
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
`"error"`
|
|
956
|
-
|
|
957
|
-
##### error?
|
|
958
|
-
|
|
959
|
-
`Error`
|
|
846
|
+
| Parameter | Type |
|
|
847
|
+
| ------ | ------ |
|
|
848
|
+
| `value` | `"error"` |
|
|
849
|
+
| `error?` | `Error` |
|
|
960
850
|
|
|
961
851
|
#### Returns
|
|
962
852
|
|
|
@@ -995,19 +885,23 @@ Override in subclasses to define stop behavior. Throw an error on failure.
|
|
|
995
885
|
### clearListeners()
|
|
996
886
|
|
|
997
887
|
```ts
|
|
998
|
-
clearListeners(eventNames): this;
|
|
888
|
+
clearListeners(eventNames: keyof TEventData | keyof TEventData[]): this;
|
|
999
889
|
```
|
|
1000
890
|
|
|
1001
|
-
|
|
891
|
+
Removes all listeners for the specified event name(s).
|
|
1002
892
|
|
|
1003
|
-
|
|
893
|
+
### Parameters
|
|
1004
894
|
|
|
1005
|
-
|
|
895
|
+
| Parameter | Type | Description |
|
|
896
|
+
| ------ | ------ | ------ |
|
|
897
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] | One or more event names to clear listeners for. |
|
|
1006
898
|
|
|
1007
899
|
### Returns
|
|
1008
900
|
|
|
1009
901
|
`this`
|
|
1010
902
|
|
|
903
|
+
This instance for chaining.
|
|
904
|
+
|
|
1011
905
|
### Inherited from
|
|
1012
906
|
|
|
1013
907
|
```ts
|
|
@@ -1019,28 +913,24 @@ BaseEmitter.clearListeners
|
|
|
1019
913
|
### emit()
|
|
1020
914
|
|
|
1021
915
|
```ts
|
|
1022
|
-
emit<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
916
|
+
emit<TEventName, TEventArgs>(eventName: TEventName, eventArgs: TEventArgs): Promise<void>;
|
|
1023
917
|
```
|
|
1024
918
|
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
#### TEventName
|
|
1028
|
-
|
|
1029
|
-
`TEventName` *extends* `string` \| `number` \| `symbol` = keyof `TEventData`
|
|
919
|
+
Emits an event, invoking all registered listeners concurrently.
|
|
1030
920
|
|
|
1031
|
-
|
|
921
|
+
### Type Parameters
|
|
1032
922
|
|
|
1033
|
-
|
|
923
|
+
| Type Parameter | Default type |
|
|
924
|
+
| ------ | ------ |
|
|
925
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` | keyof `TEventData` |
|
|
926
|
+
| `TEventArgs` *extends* `EventArgs` | `TEventData`\[`TEventName`\] |
|
|
1034
927
|
|
|
1035
928
|
### Parameters
|
|
1036
929
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
`TEventName`
|
|
1040
|
-
|
|
1041
|
-
#### eventArgs
|
|
1042
|
-
|
|
1043
|
-
`TEventArgs`
|
|
930
|
+
| Parameter | Type | Description |
|
|
931
|
+
| ------ | ------ | ------ |
|
|
932
|
+
| `eventName` | `TEventName` | The event to emit. |
|
|
933
|
+
| `eventArgs` | `TEventArgs` | The data to pass to listeners. |
|
|
1044
934
|
|
|
1045
935
|
### Returns
|
|
1046
936
|
|
|
@@ -1057,28 +947,24 @@ BaseEmitter.emit
|
|
|
1057
947
|
### emitSerial()
|
|
1058
948
|
|
|
1059
949
|
```ts
|
|
1060
|
-
emitSerial<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
950
|
+
emitSerial<TEventName, TEventArgs>(eventName: TEventName, eventArgs: TEventArgs): Promise<void>;
|
|
1061
951
|
```
|
|
1062
952
|
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
#### TEventName
|
|
953
|
+
Emits an event, invoking all registered listeners sequentially in order.
|
|
1066
954
|
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
#### TEventArgs
|
|
955
|
+
### Type Parameters
|
|
1070
956
|
|
|
1071
|
-
|
|
957
|
+
| Type Parameter | Default type |
|
|
958
|
+
| ------ | ------ |
|
|
959
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` | keyof `TEventData` |
|
|
960
|
+
| `TEventArgs` *extends* `EventArgs` | `TEventData`\[`TEventName`\] |
|
|
1072
961
|
|
|
1073
962
|
### Parameters
|
|
1074
963
|
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
`TEventName`
|
|
1078
|
-
|
|
1079
|
-
#### eventArgs
|
|
1080
|
-
|
|
1081
|
-
`TEventArgs`
|
|
964
|
+
| Parameter | Type | Description |
|
|
965
|
+
| ------ | ------ | ------ |
|
|
966
|
+
| `eventName` | `TEventName` | The event to emit. |
|
|
967
|
+
| `eventArgs` | `TEventArgs` | The data to pass to listeners. |
|
|
1082
968
|
|
|
1083
969
|
### Returns
|
|
1084
970
|
|
|
@@ -1095,19 +981,23 @@ BaseEmitter.emitSerial
|
|
|
1095
981
|
### listenerCount()
|
|
1096
982
|
|
|
1097
983
|
```ts
|
|
1098
|
-
listenerCount(eventNames): number;
|
|
984
|
+
listenerCount(eventNames: keyof TEventData | keyof TEventData[]): number;
|
|
1099
985
|
```
|
|
1100
986
|
|
|
1101
|
-
|
|
987
|
+
Returns the total number of listeners registered for the specified event name(s).
|
|
1102
988
|
|
|
1103
|
-
|
|
989
|
+
### Parameters
|
|
1104
990
|
|
|
1105
|
-
|
|
991
|
+
| Parameter | Type | Description |
|
|
992
|
+
| ------ | ------ | ------ |
|
|
993
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] | One or more event names to count listeners for. |
|
|
1106
994
|
|
|
1107
995
|
### Returns
|
|
1108
996
|
|
|
1109
997
|
`number`
|
|
1110
998
|
|
|
999
|
+
The total listener count.
|
|
1000
|
+
|
|
1111
1001
|
### Inherited from
|
|
1112
1002
|
|
|
1113
1003
|
```ts
|
|
@@ -1119,24 +1009,23 @@ BaseEmitter.listenerCount
|
|
|
1119
1009
|
### off()
|
|
1120
1010
|
|
|
1121
1011
|
```ts
|
|
1122
|
-
off<TEventName>(eventNames, listener): void;
|
|
1012
|
+
off<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): void;
|
|
1123
1013
|
```
|
|
1124
1014
|
|
|
1125
|
-
|
|
1015
|
+
Removes a specific listener from the specified event name(s).
|
|
1126
1016
|
|
|
1127
|
-
|
|
1017
|
+
### Type Parameters
|
|
1128
1018
|
|
|
1129
|
-
|
|
1019
|
+
| Type Parameter |
|
|
1020
|
+
| ------ |
|
|
1021
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
1130
1022
|
|
|
1131
1023
|
### Parameters
|
|
1132
1024
|
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
`
|
|
1136
|
-
|
|
1137
|
-
#### listener
|
|
1138
|
-
|
|
1139
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
1025
|
+
| Parameter | Type | Description |
|
|
1026
|
+
| ------ | ------ | ------ |
|
|
1027
|
+
| `eventNames` | `TEventName` \| `TEventName`[] | One or more event names to unsubscribe from. |
|
|
1028
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> | The listener to remove. |
|
|
1140
1029
|
|
|
1141
1030
|
### Returns
|
|
1142
1031
|
|
|
@@ -1153,14 +1042,16 @@ BaseEmitter.off
|
|
|
1153
1042
|
### offAny()
|
|
1154
1043
|
|
|
1155
1044
|
```ts
|
|
1156
|
-
offAny(listener): void;
|
|
1045
|
+
offAny(listener: EventAnyListener): void;
|
|
1157
1046
|
```
|
|
1158
1047
|
|
|
1159
|
-
|
|
1048
|
+
Removes a wildcard listener that was receiving all events.
|
|
1160
1049
|
|
|
1161
|
-
|
|
1050
|
+
### Parameters
|
|
1162
1051
|
|
|
1163
|
-
|
|
1052
|
+
| Parameter | Type | Description |
|
|
1053
|
+
| ------ | ------ | ------ |
|
|
1054
|
+
| `listener` | `EventAnyListener` | The wildcard listener to remove. |
|
|
1164
1055
|
|
|
1165
1056
|
### Returns
|
|
1166
1057
|
|
|
@@ -1177,27 +1068,28 @@ BaseEmitter.offAny
|
|
|
1177
1068
|
### on()
|
|
1178
1069
|
|
|
1179
1070
|
```ts
|
|
1180
|
-
on<TEventName>(eventNames, listener): () => void;
|
|
1071
|
+
on<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): () => void;
|
|
1181
1072
|
```
|
|
1182
1073
|
|
|
1183
|
-
|
|
1074
|
+
Subscribes a listener to the specified event name(s).
|
|
1184
1075
|
|
|
1185
|
-
|
|
1076
|
+
### Type Parameters
|
|
1186
1077
|
|
|
1187
|
-
|
|
1078
|
+
| Type Parameter |
|
|
1079
|
+
| ------ |
|
|
1080
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
1188
1081
|
|
|
1189
1082
|
### Parameters
|
|
1190
1083
|
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
`
|
|
1194
|
-
|
|
1195
|
-
#### listener
|
|
1196
|
-
|
|
1197
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
1084
|
+
| Parameter | Type | Description |
|
|
1085
|
+
| ------ | ------ | ------ |
|
|
1086
|
+
| `eventNames` | `TEventName` \| `TEventName`[] | One or more event names to listen for. |
|
|
1087
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> | The callback to invoke when the event fires. |
|
|
1198
1088
|
|
|
1199
1089
|
### Returns
|
|
1200
1090
|
|
|
1091
|
+
An unsubscribe function.
|
|
1092
|
+
|
|
1201
1093
|
```ts
|
|
1202
1094
|
(): void;
|
|
1203
1095
|
```
|
|
@@ -1217,17 +1109,21 @@ BaseEmitter.on
|
|
|
1217
1109
|
### onAny()
|
|
1218
1110
|
|
|
1219
1111
|
```ts
|
|
1220
|
-
onAny(listener): () => void;
|
|
1112
|
+
onAny(listener: EventAnyListener): () => void;
|
|
1221
1113
|
```
|
|
1222
1114
|
|
|
1223
|
-
|
|
1115
|
+
Subscribes a wildcard listener that receives all events.
|
|
1224
1116
|
|
|
1225
|
-
|
|
1117
|
+
### Parameters
|
|
1226
1118
|
|
|
1227
|
-
|
|
1119
|
+
| Parameter | Type | Description |
|
|
1120
|
+
| ------ | ------ | ------ |
|
|
1121
|
+
| `listener` | `EventAnyListener` | The callback to invoke for any event. |
|
|
1228
1122
|
|
|
1229
1123
|
### Returns
|
|
1230
1124
|
|
|
1125
|
+
An unsubscribe function.
|
|
1126
|
+
|
|
1231
1127
|
```ts
|
|
1232
1128
|
(): void;
|
|
1233
1129
|
```
|
|
@@ -1247,27 +1143,28 @@ BaseEmitter.onAny
|
|
|
1247
1143
|
### once()
|
|
1248
1144
|
|
|
1249
1145
|
```ts
|
|
1250
|
-
once<TEventName>(eventName, listener): () => void;
|
|
1146
|
+
once<TEventName>(eventName: TEventName, listener: EventListener<TEventData[TEventName]>): () => void;
|
|
1251
1147
|
```
|
|
1252
1148
|
|
|
1253
|
-
|
|
1149
|
+
Subscribes a listener that will be invoked only once for the specified event, then automatically removed.
|
|
1254
1150
|
|
|
1255
|
-
|
|
1151
|
+
### Type Parameters
|
|
1256
1152
|
|
|
1257
|
-
|
|
1153
|
+
| Type Parameter |
|
|
1154
|
+
| ------ |
|
|
1155
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
1258
1156
|
|
|
1259
1157
|
### Parameters
|
|
1260
1158
|
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
`TEventName`
|
|
1264
|
-
|
|
1265
|
-
#### listener
|
|
1266
|
-
|
|
1267
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
1159
|
+
| Parameter | Type | Description |
|
|
1160
|
+
| ------ | ------ | ------ |
|
|
1161
|
+
| `eventName` | `TEventName` | The event to listen for. |
|
|
1162
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> | The callback to invoke once. |
|
|
1268
1163
|
|
|
1269
1164
|
### Returns
|
|
1270
1165
|
|
|
1166
|
+
An unsubscribe function.
|
|
1167
|
+
|
|
1271
1168
|
```ts
|
|
1272
1169
|
(): void;
|
|
1273
1170
|
```
|
|
@@ -1297,31 +1194,25 @@ pre-configured CreatableFactory instances.
|
|
|
1297
1194
|
|
|
1298
1195
|
## Type Parameters
|
|
1299
1196
|
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
`TParams` *extends* [`CreatableParams`](#../interfaces/CreatableParams)
|
|
1303
|
-
|
|
1304
|
-
### TEventData
|
|
1305
|
-
|
|
1306
|
-
`TEventData` *extends* `EventData` = `EventData`
|
|
1197
|
+
| Type Parameter | Default type |
|
|
1198
|
+
| ------ | ------ |
|
|
1199
|
+
| `TParams` *extends* [`CreatableParams`](#../interfaces/CreatableParams) | [`CreatableParams`](#../interfaces/CreatableParams) |
|
|
1200
|
+
| `TEventData` *extends* `EventData` | `EventData` |
|
|
1307
1201
|
|
|
1308
1202
|
## Constructors
|
|
1309
1203
|
|
|
1310
1204
|
### Constructor
|
|
1311
1205
|
|
|
1312
1206
|
```ts
|
|
1313
|
-
new AbstractCreatableWithFactory<TParams, TEventData>(key, params): AbstractCreatableWithFactory<TParams, TEventData>;
|
|
1207
|
+
new AbstractCreatableWithFactory<TParams, TEventData>(key: unknown, params: Partial<TParams & RequiredCreatableParams>): AbstractCreatableWithFactory<TParams, TEventData>;
|
|
1314
1208
|
```
|
|
1315
1209
|
|
|
1316
1210
|
### Parameters
|
|
1317
1211
|
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
`unknown`
|
|
1321
|
-
|
|
1322
|
-
#### params
|
|
1323
|
-
|
|
1324
|
-
`Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\>
|
|
1212
|
+
| Parameter | Type |
|
|
1213
|
+
| ------ | ------ |
|
|
1214
|
+
| `key` | `unknown` |
|
|
1215
|
+
| `params` | `Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\> |
|
|
1325
1216
|
|
|
1326
1217
|
### Returns
|
|
1327
1218
|
|
|
@@ -1333,77 +1224,14 @@ new AbstractCreatableWithFactory<TParams, TEventData>(key, params): AbstractCrea
|
|
|
1333
1224
|
|
|
1334
1225
|
## Properties
|
|
1335
1226
|
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
[`AbstractCreatable`](#AbstractCreatable).[`defaultLogger`](AbstractCreatable.md#defaultlogger)
|
|
1345
|
-
|
|
1346
|
-
***
|
|
1347
|
-
|
|
1348
|
-
### globalInstances
|
|
1349
|
-
|
|
1350
|
-
```ts
|
|
1351
|
-
readonly static globalInstances: Record<BaseClassName, WeakRef<Base>[]>;
|
|
1352
|
-
```
|
|
1353
|
-
|
|
1354
|
-
### Inherited from
|
|
1355
|
-
|
|
1356
|
-
[`AbstractCreatable`](#AbstractCreatable).[`globalInstances`](AbstractCreatable.md#globalinstances)
|
|
1357
|
-
|
|
1358
|
-
***
|
|
1359
|
-
|
|
1360
|
-
### globalInstancesCountHistory
|
|
1361
|
-
|
|
1362
|
-
```ts
|
|
1363
|
-
readonly static globalInstancesCountHistory: Record<BaseClassName, number[]>;
|
|
1364
|
-
```
|
|
1365
|
-
|
|
1366
|
-
### Inherited from
|
|
1367
|
-
|
|
1368
|
-
[`AbstractCreatable`](#AbstractCreatable).[`globalInstancesCountHistory`](AbstractCreatable.md#globalinstancescounthistory)
|
|
1369
|
-
|
|
1370
|
-
***
|
|
1371
|
-
|
|
1372
|
-
### defaultLogger?
|
|
1373
|
-
|
|
1374
|
-
```ts
|
|
1375
|
-
optional defaultLogger: Logger;
|
|
1376
|
-
```
|
|
1377
|
-
|
|
1378
|
-
Optional default logger for this instance.
|
|
1379
|
-
|
|
1380
|
-
### Inherited from
|
|
1381
|
-
|
|
1382
|
-
[`AbstractCreatable`](#AbstractCreatable).[`defaultLogger`](AbstractCreatable.md#defaultlogger-1)
|
|
1383
|
-
|
|
1384
|
-
***
|
|
1385
|
-
|
|
1386
|
-
### \_startPromise
|
|
1387
|
-
|
|
1388
|
-
```ts
|
|
1389
|
-
protected _startPromise: Promisable<boolean> | undefined;
|
|
1390
|
-
```
|
|
1391
|
-
|
|
1392
|
-
### Inherited from
|
|
1393
|
-
|
|
1394
|
-
[`AbstractCreatable`](#AbstractCreatable).[`_startPromise`](AbstractCreatable.md#_startpromise)
|
|
1395
|
-
|
|
1396
|
-
***
|
|
1397
|
-
|
|
1398
|
-
### eventData
|
|
1399
|
-
|
|
1400
|
-
```ts
|
|
1401
|
-
eventData: TEventData;
|
|
1402
|
-
```
|
|
1403
|
-
|
|
1404
|
-
### Inherited from
|
|
1405
|
-
|
|
1406
|
-
[`AbstractCreatable`](#AbstractCreatable).[`eventData`](AbstractCreatable.md#eventdata)
|
|
1227
|
+
| Property | Modifier | Type | Description | Inherited from |
|
|
1228
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
1229
|
+
| <a id="defaultlogger"></a> `defaultLogger?` | `static` | `Logger` | - | [`AbstractCreatable`](#AbstractCreatable).[`defaultLogger`](AbstractCreatable.md#defaultlogger) |
|
|
1230
|
+
| <a id="globalinstances"></a> `globalInstances` | `readonly` | `Record`\<`BaseClassName`, `WeakRef`\<`Base`\>[]\> | - | [`AbstractCreatable`](#AbstractCreatable).[`globalInstances`](AbstractCreatable.md#globalinstances) |
|
|
1231
|
+
| <a id="globalinstancescounthistory"></a> `globalInstancesCountHistory` | `readonly` | `Record`\<`BaseClassName`, `number`[]\> | - | [`AbstractCreatable`](#AbstractCreatable).[`globalInstancesCountHistory`](AbstractCreatable.md#globalinstancescounthistory) |
|
|
1232
|
+
| <a id="defaultlogger-1"></a> `defaultLogger?` | `public` | `Logger` | Optional default logger for this instance. | [`AbstractCreatable`](#AbstractCreatable).[`defaultLogger`](AbstractCreatable.md#defaultlogger-1) |
|
|
1233
|
+
| <a id="_startpromise"></a> `_startPromise` | `protected` | `Promisable`\<`boolean`\> \| `undefined` | - | [`AbstractCreatable`](#AbstractCreatable).[`_startPromise`](AbstractCreatable.md#_startpromise) |
|
|
1234
|
+
| <a id="eventdata"></a> `eventData` | `public` | `TEventData` | Type-level reference to the event data shape for external type queries. | [`AbstractCreatable`](#AbstractCreatable).[`eventData`](AbstractCreatable.md#eventdata) |
|
|
1407
1235
|
|
|
1408
1236
|
## Accessors
|
|
1409
1237
|
|
|
@@ -1422,14 +1250,14 @@ get static historyInterval(): number;
|
|
|
1422
1250
|
### Set Signature
|
|
1423
1251
|
|
|
1424
1252
|
```ts
|
|
1425
|
-
set static historyInterval(value): void;
|
|
1253
|
+
set static historyInterval(value: number): void;
|
|
1426
1254
|
```
|
|
1427
1255
|
|
|
1428
1256
|
#### Parameters
|
|
1429
1257
|
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
`number`
|
|
1258
|
+
| Parameter | Type |
|
|
1259
|
+
| ------ | ------ |
|
|
1260
|
+
| `value` | `number` |
|
|
1433
1261
|
|
|
1434
1262
|
#### Returns
|
|
1435
1263
|
|
|
@@ -1456,14 +1284,14 @@ get static historyTime(): number;
|
|
|
1456
1284
|
### Set Signature
|
|
1457
1285
|
|
|
1458
1286
|
```ts
|
|
1459
|
-
set static historyTime(value): void;
|
|
1287
|
+
set static historyTime(value: number): void;
|
|
1460
1288
|
```
|
|
1461
1289
|
|
|
1462
1290
|
#### Parameters
|
|
1463
1291
|
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
`number`
|
|
1292
|
+
| Parameter | Type |
|
|
1293
|
+
| ------ | ------ |
|
|
1294
|
+
| `value` | `number` |
|
|
1467
1295
|
|
|
1468
1296
|
#### Returns
|
|
1469
1297
|
|
|
@@ -1490,14 +1318,14 @@ get static maxGcFrequency(): number;
|
|
|
1490
1318
|
### Set Signature
|
|
1491
1319
|
|
|
1492
1320
|
```ts
|
|
1493
|
-
set static maxGcFrequency(value): void;
|
|
1321
|
+
set static maxGcFrequency(value: number): void;
|
|
1494
1322
|
```
|
|
1495
1323
|
|
|
1496
1324
|
#### Parameters
|
|
1497
1325
|
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
`number`
|
|
1326
|
+
| Parameter | Type |
|
|
1327
|
+
| ------ | ------ |
|
|
1328
|
+
| `value` | `number` |
|
|
1501
1329
|
|
|
1502
1330
|
#### Returns
|
|
1503
1331
|
|
|
@@ -1689,14 +1517,14 @@ The status reporter used to broadcast lifecycle changes.
|
|
|
1689
1517
|
### Call Signature
|
|
1690
1518
|
|
|
1691
1519
|
```ts
|
|
1692
|
-
static gc(force
|
|
1520
|
+
static gc(force?: boolean): void;
|
|
1693
1521
|
```
|
|
1694
1522
|
|
|
1695
1523
|
#### Parameters
|
|
1696
1524
|
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
`boolean`
|
|
1525
|
+
| Parameter | Type |
|
|
1526
|
+
| ------ | ------ |
|
|
1527
|
+
| `force?` | `boolean` |
|
|
1700
1528
|
|
|
1701
1529
|
#### Returns
|
|
1702
1530
|
|
|
@@ -1709,14 +1537,14 @@ static gc(force?): void;
|
|
|
1709
1537
|
### Call Signature
|
|
1710
1538
|
|
|
1711
1539
|
```ts
|
|
1712
|
-
static gc(className): void;
|
|
1540
|
+
static gc(className: BaseClassName): void;
|
|
1713
1541
|
```
|
|
1714
1542
|
|
|
1715
1543
|
#### Parameters
|
|
1716
1544
|
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
`BaseClassName`
|
|
1545
|
+
| Parameter | Type |
|
|
1546
|
+
| ------ | ------ |
|
|
1547
|
+
| `className` | `BaseClassName` |
|
|
1720
1548
|
|
|
1721
1549
|
#### Returns
|
|
1722
1550
|
|
|
@@ -1731,14 +1559,14 @@ static gc(className): void;
|
|
|
1731
1559
|
### instanceCount()
|
|
1732
1560
|
|
|
1733
1561
|
```ts
|
|
1734
|
-
static instanceCount(className): number;
|
|
1562
|
+
static instanceCount(className: BaseClassName): number;
|
|
1735
1563
|
```
|
|
1736
1564
|
|
|
1737
1565
|
### Parameters
|
|
1738
1566
|
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
`BaseClassName`
|
|
1567
|
+
| Parameter | Type |
|
|
1568
|
+
| ------ | ------ |
|
|
1569
|
+
| `className` | `BaseClassName` |
|
|
1742
1570
|
|
|
1743
1571
|
### Returns
|
|
1744
1572
|
|
|
@@ -1801,7 +1629,7 @@ static stopHistory(): void;
|
|
|
1801
1629
|
### create()
|
|
1802
1630
|
|
|
1803
1631
|
```ts
|
|
1804
|
-
static create<T>(this
|
|
1632
|
+
static create<T>(this: Creatable<T>, inParams?: Partial<T["params"]>): Promise<T>;
|
|
1805
1633
|
```
|
|
1806
1634
|
|
|
1807
1635
|
Asynchronously creates a new instance by processing params, constructing,
|
|
@@ -1809,21 +1637,16 @@ and running both static and instance createHandlers.
|
|
|
1809
1637
|
|
|
1810
1638
|
### Type Parameters
|
|
1811
1639
|
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
1640
|
+
| Type Parameter |
|
|
1641
|
+
| ------ |
|
|
1642
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
1815
1643
|
|
|
1816
1644
|
### Parameters
|
|
1817
1645
|
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
1821
|
-
|
|
1822
|
-
#### inParams?
|
|
1823
|
-
|
|
1824
|
-
`Partial`\<`T`\[`"params"`\]\> = `{}`
|
|
1825
|
-
|
|
1826
|
-
Optional partial parameters to configure the instance
|
|
1646
|
+
| Parameter | Type | Description |
|
|
1647
|
+
| ------ | ------ | ------ |
|
|
1648
|
+
| `this` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | - |
|
|
1649
|
+
| `inParams` | `Partial`\<`T`\[`"params"`\]\> | Optional partial parameters to configure the instance |
|
|
1827
1650
|
|
|
1828
1651
|
### Returns
|
|
1829
1652
|
|
|
@@ -1840,7 +1663,7 @@ The fully initialized instance
|
|
|
1840
1663
|
### createHandler()
|
|
1841
1664
|
|
|
1842
1665
|
```ts
|
|
1843
|
-
static createHandler<T>(this
|
|
1666
|
+
static createHandler<T>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
1844
1667
|
```
|
|
1845
1668
|
|
|
1846
1669
|
Static hook called during creation to perform additional initialization.
|
|
@@ -1848,21 +1671,16 @@ Override in subclasses to customize post-construction setup.
|
|
|
1848
1671
|
|
|
1849
1672
|
### Type Parameters
|
|
1850
1673
|
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
1674
|
+
| Type Parameter |
|
|
1675
|
+
| ------ |
|
|
1676
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
1854
1677
|
|
|
1855
1678
|
### Parameters
|
|
1856
1679
|
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
1860
|
-
|
|
1861
|
-
#### instance
|
|
1862
|
-
|
|
1863
|
-
`T`
|
|
1864
|
-
|
|
1865
|
-
The newly constructed instance
|
|
1680
|
+
| Parameter | Type | Description |
|
|
1681
|
+
| ------ | ------ | ------ |
|
|
1682
|
+
| `this` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | - |
|
|
1683
|
+
| `instance` | `T` | The newly constructed instance |
|
|
1866
1684
|
|
|
1867
1685
|
### Returns
|
|
1868
1686
|
|
|
@@ -1879,7 +1697,7 @@ The instance, potentially modified
|
|
|
1879
1697
|
### paramsHandler()
|
|
1880
1698
|
|
|
1881
1699
|
```ts
|
|
1882
|
-
static paramsHandler<T>(this
|
|
1700
|
+
static paramsHandler<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promisable<T["params"]>;
|
|
1883
1701
|
```
|
|
1884
1702
|
|
|
1885
1703
|
Static hook called during creation to validate and transform params.
|
|
@@ -1887,21 +1705,16 @@ Override in subclasses to add default values or validation.
|
|
|
1887
1705
|
|
|
1888
1706
|
### Type Parameters
|
|
1889
1707
|
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
1708
|
+
| Type Parameter |
|
|
1709
|
+
| ------ |
|
|
1710
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
1893
1711
|
|
|
1894
1712
|
### Parameters
|
|
1895
1713
|
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
1899
|
-
|
|
1900
|
-
#### params?
|
|
1901
|
-
|
|
1902
|
-
`Partial`\<`T`\[`"params"`\]\> = `{}`
|
|
1903
|
-
|
|
1904
|
-
The raw partial params provided to `create`
|
|
1714
|
+
| Parameter | Type | Description |
|
|
1715
|
+
| ------ | ------ | ------ |
|
|
1716
|
+
| `this` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | - |
|
|
1717
|
+
| `params` | `Partial`\<`T`\[`"params"`\]\> | The raw partial params provided to `create` |
|
|
1905
1718
|
|
|
1906
1719
|
### Returns
|
|
1907
1720
|
|
|
@@ -1936,7 +1749,7 @@ Instance-level creation hook. Override in subclasses to perform setup after cons
|
|
|
1936
1749
|
### paramsValidator()
|
|
1937
1750
|
|
|
1938
1751
|
```ts
|
|
1939
|
-
paramsValidator(params): TParams & RequiredCreatableParams<void>;
|
|
1752
|
+
paramsValidator(params: Partial<TParams & RequiredCreatableParams>): TParams & RequiredCreatableParams<void>;
|
|
1940
1753
|
```
|
|
1941
1754
|
|
|
1942
1755
|
Validates and returns the merged params, ensuring required fields are present.
|
|
@@ -1944,11 +1757,9 @@ Override in subclasses to add custom validation logic.
|
|
|
1944
1757
|
|
|
1945
1758
|
### Parameters
|
|
1946
1759
|
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
`Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\>
|
|
1950
|
-
|
|
1951
|
-
The raw partial params to validate
|
|
1760
|
+
| Parameter | Type | Description |
|
|
1761
|
+
| ------ | ------ | ------ |
|
|
1762
|
+
| `params` | `Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\> | The raw partial params to validate |
|
|
1952
1763
|
|
|
1953
1764
|
### Returns
|
|
1954
1765
|
|
|
@@ -1965,38 +1776,31 @@ The validated params
|
|
|
1965
1776
|
### span()
|
|
1966
1777
|
|
|
1967
1778
|
```ts
|
|
1968
|
-
span<T>(name, fn): T;
|
|
1779
|
+
span<T>(name: string, fn: () => T): T;
|
|
1969
1780
|
```
|
|
1970
1781
|
|
|
1971
1782
|
Executes a function within a telemetry span.
|
|
1972
1783
|
|
|
1973
1784
|
### Type Parameters
|
|
1974
1785
|
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
`T`
|
|
1786
|
+
| Type Parameter |
|
|
1787
|
+
| ------ |
|
|
1788
|
+
| `T` |
|
|
1978
1789
|
|
|
1979
1790
|
### Parameters
|
|
1980
1791
|
|
|
1981
|
-
|
|
1792
|
+
| Parameter | Type | Description |
|
|
1793
|
+
| ------ | ------ | ------ |
|
|
1794
|
+
| `name` | `string` | The span name |
|
|
1795
|
+
| `fn` | () => `T` | The function to execute within the span |
|
|
1982
1796
|
|
|
1983
|
-
|
|
1797
|
+
### Returns
|
|
1984
1798
|
|
|
1985
|
-
|
|
1799
|
+
`T`
|
|
1986
1800
|
|
|
1987
|
-
|
|
1801
|
+
### Inherited from
|
|
1988
1802
|
|
|
1989
|
-
()
|
|
1990
|
-
|
|
1991
|
-
The function to execute within the span
|
|
1992
|
-
|
|
1993
|
-
### Returns
|
|
1994
|
-
|
|
1995
|
-
`T`
|
|
1996
|
-
|
|
1997
|
-
### Inherited from
|
|
1998
|
-
|
|
1999
|
-
[`AbstractCreatable`](#AbstractCreatable).[`span`](AbstractCreatable.md#span)
|
|
1803
|
+
[`AbstractCreatable`](#AbstractCreatable).[`span`](AbstractCreatable.md#span)
|
|
2000
1804
|
|
|
2001
1805
|
***
|
|
2002
1806
|
|
|
@@ -2004,38 +1808,26 @@ The function to execute within the span
|
|
|
2004
1808
|
|
|
2005
1809
|
```ts
|
|
2006
1810
|
spanAsync<T>(
|
|
2007
|
-
name,
|
|
2008
|
-
fn
|
|
2009
|
-
config
|
|
1811
|
+
name: string,
|
|
1812
|
+
fn: () => Promise<T>,
|
|
1813
|
+
config?: SpanConfig): Promise<T>;
|
|
2010
1814
|
```
|
|
2011
1815
|
|
|
2012
1816
|
Executes an async function within a telemetry span.
|
|
2013
1817
|
|
|
2014
1818
|
### Type Parameters
|
|
2015
1819
|
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
`T`
|
|
1820
|
+
| Type Parameter |
|
|
1821
|
+
| ------ |
|
|
1822
|
+
| `T` |
|
|
2019
1823
|
|
|
2020
1824
|
### Parameters
|
|
2021
1825
|
|
|
2022
|
-
|
|
2023
|
-
|
|
2024
|
-
`string`
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
#### fn
|
|
2029
|
-
|
|
2030
|
-
() => `Promise`\<`T`\>
|
|
2031
|
-
|
|
2032
|
-
The async function to execute within the span
|
|
2033
|
-
|
|
2034
|
-
#### config?
|
|
2035
|
-
|
|
2036
|
-
`SpanConfig` = `{}`
|
|
2037
|
-
|
|
2038
|
-
Optional span configuration
|
|
1826
|
+
| Parameter | Type | Description |
|
|
1827
|
+
| ------ | ------ | ------ |
|
|
1828
|
+
| `name` | `string` | The span name |
|
|
1829
|
+
| `fn` | () => `Promise`\<`T`\> | The async function to execute within the span |
|
|
1830
|
+
| `config` | `SpanConfig` | Optional span configuration |
|
|
2039
1831
|
|
|
2040
1832
|
### Returns
|
|
2041
1833
|
|
|
@@ -2069,7 +1861,7 @@ Thread-safe via mutex. Returns true if already started or started successfully.
|
|
|
2069
1861
|
### started()
|
|
2070
1862
|
|
|
2071
1863
|
```ts
|
|
2072
|
-
started(notStartedAction
|
|
1864
|
+
started(notStartedAction?: "error" | "throw" | "warn" | "log" | "none"): boolean;
|
|
2073
1865
|
```
|
|
2074
1866
|
|
|
2075
1867
|
Checks whether this instance is currently started.
|
|
@@ -2077,11 +1869,9 @@ Takes an action if not started, based on the notStartedAction parameter.
|
|
|
2077
1869
|
|
|
2078
1870
|
### Parameters
|
|
2079
1871
|
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
What to do if not started: 'error'/'throw' throws, 'warn'/'log' logs, 'none' is silent
|
|
2083
|
-
|
|
2084
|
-
`"error"` | `"throw"` | `"warn"` | `"log"` | `"none"`
|
|
1872
|
+
| Parameter | Type | Default value | Description |
|
|
1873
|
+
| ------ | ------ | ------ | ------ |
|
|
1874
|
+
| `notStartedAction` | `"error"` \| `"throw"` \| `"warn"` \| `"log"` \| `"none"` | `'log'` | What to do if not started: 'error'/'throw' throws, 'warn'/'log' logs, 'none' is silent |
|
|
2085
1875
|
|
|
2086
1876
|
### Returns
|
|
2087
1877
|
|
|
@@ -2098,24 +1888,17 @@ True if started, false otherwise
|
|
|
2098
1888
|
### startedAsync()
|
|
2099
1889
|
|
|
2100
1890
|
```ts
|
|
2101
|
-
startedAsync(notStartedAction
|
|
1891
|
+
startedAsync(notStartedAction?: "error" | "throw" | "warn" | "log" | "none", tryStart?: boolean): Promise<boolean>;
|
|
2102
1892
|
```
|
|
2103
1893
|
|
|
2104
1894
|
Async version of `started` that can optionally auto-start the instance.
|
|
2105
1895
|
|
|
2106
1896
|
### Parameters
|
|
2107
1897
|
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
What to do if not started and auto-start is disabled
|
|
2111
|
-
|
|
2112
|
-
`"error"` | `"throw"` | `"warn"` | `"log"` | `"none"`
|
|
2113
|
-
|
|
2114
|
-
#### tryStart?
|
|
2115
|
-
|
|
2116
|
-
`boolean` = `true`
|
|
2117
|
-
|
|
2118
|
-
If true, attempts to start the instance automatically
|
|
1898
|
+
| Parameter | Type | Default value | Description |
|
|
1899
|
+
| ------ | ------ | ------ | ------ |
|
|
1900
|
+
| `notStartedAction` | `"error"` \| `"throw"` \| `"warn"` \| `"log"` \| `"none"` | `'log'` | What to do if not started and auto-start is disabled |
|
|
1901
|
+
| `tryStart` | `boolean` | `true` | If true, attempts to start the instance automatically |
|
|
2119
1902
|
|
|
2120
1903
|
### Returns
|
|
2121
1904
|
|
|
@@ -2151,7 +1934,7 @@ Thread-safe via mutex. Returns true if already stopped or stopped successfully.
|
|
|
2151
1934
|
### \_noOverride()
|
|
2152
1935
|
|
|
2153
1936
|
```ts
|
|
2154
|
-
protected _noOverride(functionName
|
|
1937
|
+
protected _noOverride(functionName?: string): void;
|
|
2155
1938
|
```
|
|
2156
1939
|
|
|
2157
1940
|
Asserts that the given function has not been overridden in a subclass.
|
|
@@ -2159,9 +1942,9 @@ Used to enforce the handler pattern (override `startHandler` not `start`).
|
|
|
2159
1942
|
|
|
2160
1943
|
### Parameters
|
|
2161
1944
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
`string`
|
|
1945
|
+
| Parameter | Type |
|
|
1946
|
+
| ------ | ------ |
|
|
1947
|
+
| `functionName` | `string` |
|
|
2165
1948
|
|
|
2166
1949
|
### Returns
|
|
2167
1950
|
|
|
@@ -2178,20 +1961,17 @@ Used to enforce the handler pattern (override `startHandler` not `start`).
|
|
|
2178
1961
|
### Call Signature
|
|
2179
1962
|
|
|
2180
1963
|
```ts
|
|
2181
|
-
protected setStatus(value, progress
|
|
1964
|
+
protected setStatus(value: "creating" | "created" | "starting" | "started" | "stopping" | "stopped", progress?: number): void;
|
|
2182
1965
|
```
|
|
2183
1966
|
|
|
2184
1967
|
Sets the lifecycle status and reports it via the status reporter.
|
|
2185
1968
|
|
|
2186
1969
|
#### Parameters
|
|
2187
1970
|
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
`"creating"`
|
|
2191
|
-
|
|
2192
|
-
##### progress?
|
|
2193
|
-
|
|
2194
|
-
`number`
|
|
1971
|
+
| Parameter | Type |
|
|
1972
|
+
| ------ | ------ |
|
|
1973
|
+
| `value` | `"creating"` \| `"created"` \| `"starting"` \| `"started"` \| `"stopping"` \| `"stopped"` |
|
|
1974
|
+
| `progress?` | `number` |
|
|
2195
1975
|
|
|
2196
1976
|
#### Returns
|
|
2197
1977
|
|
|
@@ -2204,20 +1984,17 @@ Sets the lifecycle status and reports it via the status reporter.
|
|
|
2204
1984
|
### Call Signature
|
|
2205
1985
|
|
|
2206
1986
|
```ts
|
|
2207
|
-
protected setStatus(value, error
|
|
1987
|
+
protected setStatus(value: "error", error?: Error): void;
|
|
2208
1988
|
```
|
|
2209
1989
|
|
|
2210
1990
|
Sets the lifecycle status and reports it via the status reporter.
|
|
2211
1991
|
|
|
2212
1992
|
#### Parameters
|
|
2213
1993
|
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
`"error"`
|
|
2217
|
-
|
|
2218
|
-
##### error?
|
|
2219
|
-
|
|
2220
|
-
`Error`
|
|
1994
|
+
| Parameter | Type |
|
|
1995
|
+
| ------ | ------ |
|
|
1996
|
+
| `value` | `"error"` |
|
|
1997
|
+
| `error?` | `Error` |
|
|
2221
1998
|
|
|
2222
1999
|
#### Returns
|
|
2223
2000
|
|
|
@@ -2269,36 +2046,26 @@ Override in subclasses to define stop behavior. Throw an error on failure.
|
|
|
2269
2046
|
|
|
2270
2047
|
```ts
|
|
2271
2048
|
static factory<T>(
|
|
2272
|
-
this
|
|
2273
|
-
params
|
|
2274
|
-
labels
|
|
2049
|
+
this: Creatable<T>,
|
|
2050
|
+
params?: Partial<T["params"]>,
|
|
2051
|
+
labels?: Labels): CreatableFactory<T>;
|
|
2275
2052
|
```
|
|
2276
2053
|
|
|
2277
2054
|
Creates a factory that produces instances of this class with pre-configured params and labels.
|
|
2278
2055
|
|
|
2279
2056
|
### Type Parameters
|
|
2280
2057
|
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
2058
|
+
| Type Parameter |
|
|
2059
|
+
| ------ |
|
|
2060
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
2284
2061
|
|
|
2285
2062
|
### Parameters
|
|
2286
2063
|
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2294
|
-
|
|
2295
|
-
Default parameters for instances created by the factory
|
|
2296
|
-
|
|
2297
|
-
#### labels?
|
|
2298
|
-
|
|
2299
|
-
[`Labels`](#../interfaces/Labels)
|
|
2300
|
-
|
|
2301
|
-
Labels to assign to created instances
|
|
2064
|
+
| Parameter | Type | Description |
|
|
2065
|
+
| ------ | ------ | ------ |
|
|
2066
|
+
| `this` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | - |
|
|
2067
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> | Default parameters for instances created by the factory |
|
|
2068
|
+
| `labels?` | [`Labels`](#../interfaces/Labels) | Labels to assign to created instances |
|
|
2302
2069
|
|
|
2303
2070
|
### Returns
|
|
2304
2071
|
|
|
@@ -2309,19 +2076,23 @@ Labels to assign to created instances
|
|
|
2309
2076
|
### clearListeners()
|
|
2310
2077
|
|
|
2311
2078
|
```ts
|
|
2312
|
-
clearListeners(eventNames): this;
|
|
2079
|
+
clearListeners(eventNames: keyof TEventData | keyof TEventData[]): this;
|
|
2313
2080
|
```
|
|
2314
2081
|
|
|
2315
|
-
|
|
2082
|
+
Removes all listeners for the specified event name(s).
|
|
2316
2083
|
|
|
2317
|
-
|
|
2084
|
+
### Parameters
|
|
2318
2085
|
|
|
2319
|
-
|
|
2086
|
+
| Parameter | Type | Description |
|
|
2087
|
+
| ------ | ------ | ------ |
|
|
2088
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] | One or more event names to clear listeners for. |
|
|
2320
2089
|
|
|
2321
2090
|
### Returns
|
|
2322
2091
|
|
|
2323
2092
|
`this`
|
|
2324
2093
|
|
|
2094
|
+
This instance for chaining.
|
|
2095
|
+
|
|
2325
2096
|
### Inherited from
|
|
2326
2097
|
|
|
2327
2098
|
[`AbstractCreatable`](#AbstractCreatable).[`clearListeners`](AbstractCreatable.md#clearlisteners)
|
|
@@ -2331,28 +2102,24 @@ keyof `TEventData` | keyof `TEventData`[]
|
|
|
2331
2102
|
### emit()
|
|
2332
2103
|
|
|
2333
2104
|
```ts
|
|
2334
|
-
emit<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
2105
|
+
emit<TEventName, TEventArgs>(eventName: TEventName, eventArgs: TEventArgs): Promise<void>;
|
|
2335
2106
|
```
|
|
2336
2107
|
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
#### TEventName
|
|
2340
|
-
|
|
2341
|
-
`TEventName` *extends* `string` \| `number` \| `symbol` = keyof `TEventData`
|
|
2108
|
+
Emits an event, invoking all registered listeners concurrently.
|
|
2342
2109
|
|
|
2343
|
-
|
|
2110
|
+
### Type Parameters
|
|
2344
2111
|
|
|
2345
|
-
|
|
2112
|
+
| Type Parameter | Default type |
|
|
2113
|
+
| ------ | ------ |
|
|
2114
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` | keyof `TEventData` |
|
|
2115
|
+
| `TEventArgs` *extends* `EventArgs` | `TEventData`\[`TEventName`\] |
|
|
2346
2116
|
|
|
2347
2117
|
### Parameters
|
|
2348
2118
|
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
`TEventName`
|
|
2352
|
-
|
|
2353
|
-
#### eventArgs
|
|
2354
|
-
|
|
2355
|
-
`TEventArgs`
|
|
2119
|
+
| Parameter | Type | Description |
|
|
2120
|
+
| ------ | ------ | ------ |
|
|
2121
|
+
| `eventName` | `TEventName` | The event to emit. |
|
|
2122
|
+
| `eventArgs` | `TEventArgs` | The data to pass to listeners. |
|
|
2356
2123
|
|
|
2357
2124
|
### Returns
|
|
2358
2125
|
|
|
@@ -2367,28 +2134,24 @@ emit<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
|
2367
2134
|
### emitSerial()
|
|
2368
2135
|
|
|
2369
2136
|
```ts
|
|
2370
|
-
emitSerial<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
2137
|
+
emitSerial<TEventName, TEventArgs>(eventName: TEventName, eventArgs: TEventArgs): Promise<void>;
|
|
2371
2138
|
```
|
|
2372
2139
|
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
#### TEventName
|
|
2376
|
-
|
|
2377
|
-
`TEventName` *extends* `string` \| `number` \| `symbol` = keyof `TEventData`
|
|
2140
|
+
Emits an event, invoking all registered listeners sequentially in order.
|
|
2378
2141
|
|
|
2379
|
-
|
|
2142
|
+
### Type Parameters
|
|
2380
2143
|
|
|
2381
|
-
|
|
2144
|
+
| Type Parameter | Default type |
|
|
2145
|
+
| ------ | ------ |
|
|
2146
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` | keyof `TEventData` |
|
|
2147
|
+
| `TEventArgs` *extends* `EventArgs` | `TEventData`\[`TEventName`\] |
|
|
2382
2148
|
|
|
2383
2149
|
### Parameters
|
|
2384
2150
|
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
`TEventName`
|
|
2388
|
-
|
|
2389
|
-
#### eventArgs
|
|
2390
|
-
|
|
2391
|
-
`TEventArgs`
|
|
2151
|
+
| Parameter | Type | Description |
|
|
2152
|
+
| ------ | ------ | ------ |
|
|
2153
|
+
| `eventName` | `TEventName` | The event to emit. |
|
|
2154
|
+
| `eventArgs` | `TEventArgs` | The data to pass to listeners. |
|
|
2392
2155
|
|
|
2393
2156
|
### Returns
|
|
2394
2157
|
|
|
@@ -2403,19 +2166,23 @@ emitSerial<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
|
2403
2166
|
### listenerCount()
|
|
2404
2167
|
|
|
2405
2168
|
```ts
|
|
2406
|
-
listenerCount(eventNames): number;
|
|
2169
|
+
listenerCount(eventNames: keyof TEventData | keyof TEventData[]): number;
|
|
2407
2170
|
```
|
|
2408
2171
|
|
|
2409
|
-
|
|
2172
|
+
Returns the total number of listeners registered for the specified event name(s).
|
|
2410
2173
|
|
|
2411
|
-
|
|
2174
|
+
### Parameters
|
|
2412
2175
|
|
|
2413
|
-
|
|
2176
|
+
| Parameter | Type | Description |
|
|
2177
|
+
| ------ | ------ | ------ |
|
|
2178
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] | One or more event names to count listeners for. |
|
|
2414
2179
|
|
|
2415
2180
|
### Returns
|
|
2416
2181
|
|
|
2417
2182
|
`number`
|
|
2418
2183
|
|
|
2184
|
+
The total listener count.
|
|
2185
|
+
|
|
2419
2186
|
### Inherited from
|
|
2420
2187
|
|
|
2421
2188
|
[`AbstractCreatable`](#AbstractCreatable).[`listenerCount`](AbstractCreatable.md#listenercount)
|
|
@@ -2425,24 +2192,23 @@ keyof `TEventData` | keyof `TEventData`[]
|
|
|
2425
2192
|
### off()
|
|
2426
2193
|
|
|
2427
2194
|
```ts
|
|
2428
|
-
off<TEventName>(eventNames, listener): void;
|
|
2195
|
+
off<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): void;
|
|
2429
2196
|
```
|
|
2430
2197
|
|
|
2431
|
-
|
|
2198
|
+
Removes a specific listener from the specified event name(s).
|
|
2432
2199
|
|
|
2433
|
-
|
|
2200
|
+
### Type Parameters
|
|
2434
2201
|
|
|
2435
|
-
|
|
2202
|
+
| Type Parameter |
|
|
2203
|
+
| ------ |
|
|
2204
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
2436
2205
|
|
|
2437
2206
|
### Parameters
|
|
2438
2207
|
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
`
|
|
2442
|
-
|
|
2443
|
-
#### listener
|
|
2444
|
-
|
|
2445
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2208
|
+
| Parameter | Type | Description |
|
|
2209
|
+
| ------ | ------ | ------ |
|
|
2210
|
+
| `eventNames` | `TEventName` \| `TEventName`[] | One or more event names to unsubscribe from. |
|
|
2211
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> | The listener to remove. |
|
|
2446
2212
|
|
|
2447
2213
|
### Returns
|
|
2448
2214
|
|
|
@@ -2457,14 +2223,16 @@ off<TEventName>(eventNames, listener): void;
|
|
|
2457
2223
|
### offAny()
|
|
2458
2224
|
|
|
2459
2225
|
```ts
|
|
2460
|
-
offAny(listener): void;
|
|
2226
|
+
offAny(listener: EventAnyListener): void;
|
|
2461
2227
|
```
|
|
2462
2228
|
|
|
2463
|
-
|
|
2229
|
+
Removes a wildcard listener that was receiving all events.
|
|
2464
2230
|
|
|
2465
|
-
|
|
2231
|
+
### Parameters
|
|
2466
2232
|
|
|
2467
|
-
|
|
2233
|
+
| Parameter | Type | Description |
|
|
2234
|
+
| ------ | ------ | ------ |
|
|
2235
|
+
| `listener` | `EventAnyListener` | The wildcard listener to remove. |
|
|
2468
2236
|
|
|
2469
2237
|
### Returns
|
|
2470
2238
|
|
|
@@ -2479,27 +2247,28 @@ offAny(listener): void;
|
|
|
2479
2247
|
### on()
|
|
2480
2248
|
|
|
2481
2249
|
```ts
|
|
2482
|
-
on<TEventName>(eventNames, listener): () => void;
|
|
2250
|
+
on<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): () => void;
|
|
2483
2251
|
```
|
|
2484
2252
|
|
|
2485
|
-
|
|
2253
|
+
Subscribes a listener to the specified event name(s).
|
|
2486
2254
|
|
|
2487
|
-
|
|
2255
|
+
### Type Parameters
|
|
2488
2256
|
|
|
2489
|
-
|
|
2257
|
+
| Type Parameter |
|
|
2258
|
+
| ------ |
|
|
2259
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
2490
2260
|
|
|
2491
2261
|
### Parameters
|
|
2492
2262
|
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
`
|
|
2496
|
-
|
|
2497
|
-
#### listener
|
|
2498
|
-
|
|
2499
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2263
|
+
| Parameter | Type | Description |
|
|
2264
|
+
| ------ | ------ | ------ |
|
|
2265
|
+
| `eventNames` | `TEventName` \| `TEventName`[] | One or more event names to listen for. |
|
|
2266
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> | The callback to invoke when the event fires. |
|
|
2500
2267
|
|
|
2501
2268
|
### Returns
|
|
2502
2269
|
|
|
2270
|
+
An unsubscribe function.
|
|
2271
|
+
|
|
2503
2272
|
```ts
|
|
2504
2273
|
(): void;
|
|
2505
2274
|
```
|
|
@@ -2517,17 +2286,21 @@ on<TEventName>(eventNames, listener): () => void;
|
|
|
2517
2286
|
### onAny()
|
|
2518
2287
|
|
|
2519
2288
|
```ts
|
|
2520
|
-
onAny(listener): () => void;
|
|
2289
|
+
onAny(listener: EventAnyListener): () => void;
|
|
2521
2290
|
```
|
|
2522
2291
|
|
|
2523
|
-
|
|
2292
|
+
Subscribes a wildcard listener that receives all events.
|
|
2524
2293
|
|
|
2525
|
-
|
|
2294
|
+
### Parameters
|
|
2526
2295
|
|
|
2527
|
-
|
|
2296
|
+
| Parameter | Type | Description |
|
|
2297
|
+
| ------ | ------ | ------ |
|
|
2298
|
+
| `listener` | `EventAnyListener` | The callback to invoke for any event. |
|
|
2528
2299
|
|
|
2529
2300
|
### Returns
|
|
2530
2301
|
|
|
2302
|
+
An unsubscribe function.
|
|
2303
|
+
|
|
2531
2304
|
```ts
|
|
2532
2305
|
(): void;
|
|
2533
2306
|
```
|
|
@@ -2545,27 +2318,28 @@ onAny(listener): () => void;
|
|
|
2545
2318
|
### once()
|
|
2546
2319
|
|
|
2547
2320
|
```ts
|
|
2548
|
-
once<TEventName>(eventName, listener): () => void;
|
|
2321
|
+
once<TEventName>(eventName: TEventName, listener: EventListener<TEventData[TEventName]>): () => void;
|
|
2549
2322
|
```
|
|
2550
2323
|
|
|
2551
|
-
|
|
2324
|
+
Subscribes a listener that will be invoked only once for the specified event, then automatically removed.
|
|
2552
2325
|
|
|
2553
|
-
|
|
2326
|
+
### Type Parameters
|
|
2554
2327
|
|
|
2555
|
-
|
|
2328
|
+
| Type Parameter |
|
|
2329
|
+
| ------ |
|
|
2330
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
2556
2331
|
|
|
2557
2332
|
### Parameters
|
|
2558
2333
|
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
`TEventName`
|
|
2562
|
-
|
|
2563
|
-
#### listener
|
|
2564
|
-
|
|
2565
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2334
|
+
| Parameter | Type | Description |
|
|
2335
|
+
| ------ | ------ | ------ |
|
|
2336
|
+
| `eventName` | `TEventName` | The event to listen for. |
|
|
2337
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> | The callback to invoke once. |
|
|
2566
2338
|
|
|
2567
2339
|
### Returns
|
|
2568
2340
|
|
|
2341
|
+
An unsubscribe function.
|
|
2342
|
+
|
|
2569
2343
|
```ts
|
|
2570
2344
|
(): void;
|
|
2571
2345
|
```
|
|
@@ -2589,9 +2363,9 @@ Instances are created by merging caller-provided params over the factory default
|
|
|
2589
2363
|
|
|
2590
2364
|
## Type Parameters
|
|
2591
2365
|
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)
|
|
2366
|
+
| Type Parameter | Default type |
|
|
2367
|
+
| ------ | ------ |
|
|
2368
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance) | [`CreatableInstance`](#../interfaces/CreatableInstance) |
|
|
2595
2369
|
|
|
2596
2370
|
## Implements
|
|
2597
2371
|
|
|
@@ -2603,24 +2377,18 @@ Instances are created by merging caller-provided params over the factory default
|
|
|
2603
2377
|
|
|
2604
2378
|
```ts
|
|
2605
2379
|
new Factory<T>(
|
|
2606
|
-
creatable
|
|
2607
|
-
params
|
|
2608
|
-
labels
|
|
2380
|
+
creatable: Creatable<T>,
|
|
2381
|
+
params?: Partial<T["params"]>,
|
|
2382
|
+
labels?: Labels): Factory<T>;
|
|
2609
2383
|
```
|
|
2610
2384
|
|
|
2611
2385
|
### Parameters
|
|
2612
2386
|
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2620
|
-
|
|
2621
|
-
#### labels?
|
|
2622
|
-
|
|
2623
|
-
[`Labels`](#../interfaces/Labels) = `{}`
|
|
2387
|
+
| Parameter | Type |
|
|
2388
|
+
| ------ | ------ |
|
|
2389
|
+
| `creatable` | [`Creatable`](#../interfaces/Creatable)\<`T`\> |
|
|
2390
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
2391
|
+
| `labels?` | [`Labels`](#../interfaces/Labels) |
|
|
2624
2392
|
|
|
2625
2393
|
### Returns
|
|
2626
2394
|
|
|
@@ -2628,33 +2396,11 @@ labels?): Factory<T>;
|
|
|
2628
2396
|
|
|
2629
2397
|
## Properties
|
|
2630
2398
|
|
|
2631
|
-
|
|
2632
|
-
|
|
2633
|
-
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
The Creatable class this factory delegates creation to.
|
|
2638
|
-
|
|
2639
|
-
***
|
|
2640
|
-
|
|
2641
|
-
### defaultParams?
|
|
2642
|
-
|
|
2643
|
-
```ts
|
|
2644
|
-
optional defaultParams: Partial<T["params"]>;
|
|
2645
|
-
```
|
|
2646
|
-
|
|
2647
|
-
Default parameters merged into every `create` call.
|
|
2648
|
-
|
|
2649
|
-
***
|
|
2650
|
-
|
|
2651
|
-
### labels?
|
|
2652
|
-
|
|
2653
|
-
```ts
|
|
2654
|
-
optional labels: Labels;
|
|
2655
|
-
```
|
|
2656
|
-
|
|
2657
|
-
Labels identifying resources created by this factory.
|
|
2399
|
+
| Property | Type | Description |
|
|
2400
|
+
| ------ | ------ | ------ |
|
|
2401
|
+
| <a id="creatable"></a> `creatable` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | The Creatable class this factory delegates creation to. |
|
|
2402
|
+
| <a id="defaultparams"></a> `defaultParams?` | `Partial`\<`T`\[`"params"`\]\> | Default parameters merged into every `create` call. |
|
|
2403
|
+
| <a id="labels"></a> `labels?` | [`Labels`](#../interfaces/Labels) | Labels identifying resources created by this factory. |
|
|
2658
2404
|
|
|
2659
2405
|
## Methods
|
|
2660
2406
|
|
|
@@ -2662,38 +2408,26 @@ Labels identifying resources created by this factory.
|
|
|
2662
2408
|
|
|
2663
2409
|
```ts
|
|
2664
2410
|
static withParams<T>(
|
|
2665
|
-
creatableModule
|
|
2666
|
-
params
|
|
2667
|
-
labels
|
|
2411
|
+
creatableModule: Creatable<T>,
|
|
2412
|
+
params?: Partial<T["params"]>,
|
|
2413
|
+
labels?: Labels): Factory<T>;
|
|
2668
2414
|
```
|
|
2669
2415
|
|
|
2670
2416
|
Creates a new Factory instance with the given default params and labels.
|
|
2671
2417
|
|
|
2672
2418
|
### Type Parameters
|
|
2673
2419
|
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
2420
|
+
| Type Parameter |
|
|
2421
|
+
| ------ |
|
|
2422
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
2677
2423
|
|
|
2678
2424
|
### Parameters
|
|
2679
2425
|
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
#### params?
|
|
2687
|
-
|
|
2688
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2689
|
-
|
|
2690
|
-
Default parameters for new instances
|
|
2691
|
-
|
|
2692
|
-
#### labels?
|
|
2693
|
-
|
|
2694
|
-
[`Labels`](#../interfaces/Labels) = `{}`
|
|
2695
|
-
|
|
2696
|
-
Labels to assign to created instances
|
|
2426
|
+
| Parameter | Type | Description |
|
|
2427
|
+
| ------ | ------ | ------ |
|
|
2428
|
+
| `creatableModule` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | The Creatable class to wrap |
|
|
2429
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> | Default parameters for new instances |
|
|
2430
|
+
| `labels?` | [`Labels`](#../interfaces/Labels) | Labels to assign to created instances |
|
|
2697
2431
|
|
|
2698
2432
|
### Returns
|
|
2699
2433
|
|
|
@@ -2704,18 +2438,16 @@ Labels to assign to created instances
|
|
|
2704
2438
|
### create()
|
|
2705
2439
|
|
|
2706
2440
|
```ts
|
|
2707
|
-
create(params
|
|
2441
|
+
create(params?: Partial<T["params"]>): Promise<T>;
|
|
2708
2442
|
```
|
|
2709
2443
|
|
|
2710
2444
|
Creates a new instance, merging the provided params over the factory defaults.
|
|
2711
2445
|
|
|
2712
2446
|
### Parameters
|
|
2713
2447
|
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2717
|
-
|
|
2718
|
-
Optional parameters to override the factory defaults
|
|
2448
|
+
| Parameter | Type | Description |
|
|
2449
|
+
| ------ | ------ | ------ |
|
|
2450
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> | Optional parameters to override the factory defaults |
|
|
2719
2451
|
|
|
2720
2452
|
### Returns
|
|
2721
2453
|
|
|
@@ -2734,7 +2466,7 @@ Optional parameters to override the factory defaults
|
|
|
2734
2466
|
***
|
|
2735
2467
|
|
|
2736
2468
|
```ts
|
|
2737
|
-
function creatable<T>(): <U>(constructor) => void;
|
|
2469
|
+
function creatable<T>(): <U>(constructor: U) => void;
|
|
2738
2470
|
```
|
|
2739
2471
|
|
|
2740
2472
|
Class annotation to be used to decorate Modules which support
|
|
@@ -2742,9 +2474,9 @@ an asynchronous creation pattern
|
|
|
2742
2474
|
|
|
2743
2475
|
## Type Parameters
|
|
2744
2476
|
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
2477
|
+
| Type Parameter |
|
|
2478
|
+
| ------ |
|
|
2479
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
2748
2480
|
|
|
2749
2481
|
## Returns
|
|
2750
2482
|
|
|
@@ -2752,20 +2484,20 @@ The decorated Module requiring it implement the members
|
|
|
2752
2484
|
of the CreatableModule as statics properties/methods
|
|
2753
2485
|
|
|
2754
2486
|
```ts
|
|
2755
|
-
<U>(constructor): void;
|
|
2487
|
+
<U>(constructor: U): void;
|
|
2756
2488
|
```
|
|
2757
2489
|
|
|
2758
2490
|
### Type Parameters
|
|
2759
2491
|
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
`U` *extends* [`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
2492
|
+
| Type Parameter |
|
|
2493
|
+
| ------ |
|
|
2494
|
+
| `U` *extends* [`Creatable`](#../interfaces/Creatable)\<`T`\> |
|
|
2763
2495
|
|
|
2764
2496
|
### Parameters
|
|
2765
2497
|
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
`U`
|
|
2498
|
+
| Parameter | Type |
|
|
2499
|
+
| ------ | ------ |
|
|
2500
|
+
| `constructor` | `U` |
|
|
2769
2501
|
|
|
2770
2502
|
### Returns
|
|
2771
2503
|
|
|
@@ -2778,7 +2510,7 @@ of the CreatableModule as statics properties/methods
|
|
|
2778
2510
|
***
|
|
2779
2511
|
|
|
2780
2512
|
```ts
|
|
2781
|
-
function creatableFactory(): <U>(constructor) => void;
|
|
2513
|
+
function creatableFactory(): <U>(constructor: U) => void;
|
|
2782
2514
|
```
|
|
2783
2515
|
|
|
2784
2516
|
Class annotation to be used to decorate Modules which support
|
|
@@ -2790,20 +2522,20 @@ The decorated Module requiring it implement the members
|
|
|
2790
2522
|
of the CreatableModule as statics properties/methods
|
|
2791
2523
|
|
|
2792
2524
|
```ts
|
|
2793
|
-
<U>(constructor): void;
|
|
2525
|
+
<U>(constructor: U): void;
|
|
2794
2526
|
```
|
|
2795
2527
|
|
|
2796
2528
|
### Type Parameters
|
|
2797
2529
|
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
`U` *extends* [`CreatableFactory`](#../interfaces/CreatableFactory)\<[`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>\>
|
|
2530
|
+
| Type Parameter |
|
|
2531
|
+
| ------ |
|
|
2532
|
+
| `U` *extends* [`CreatableFactory`](#../interfaces/CreatableFactory)\<[`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>\> |
|
|
2801
2533
|
|
|
2802
2534
|
### Parameters
|
|
2803
2535
|
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
`U`
|
|
2536
|
+
| Parameter | Type |
|
|
2537
|
+
| ------ | ------ |
|
|
2538
|
+
| `constructor` | `U` |
|
|
2807
2539
|
|
|
2808
2540
|
### Returns
|
|
2809
2541
|
|
|
@@ -2816,24 +2548,17 @@ of the CreatableModule as statics properties/methods
|
|
|
2816
2548
|
***
|
|
2817
2549
|
|
|
2818
2550
|
```ts
|
|
2819
|
-
function hasAllLabels(source
|
|
2551
|
+
function hasAllLabels(source?: Labels, required?: Labels): boolean;
|
|
2820
2552
|
```
|
|
2821
2553
|
|
|
2822
2554
|
Returns true if the source object has all the labels from the required set
|
|
2823
2555
|
|
|
2824
2556
|
## Parameters
|
|
2825
2557
|
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
[`Labels`](#../interfaces/Labels)
|
|
2829
|
-
|
|
2830
|
-
Source object to check against
|
|
2831
|
-
|
|
2832
|
-
### required?
|
|
2833
|
-
|
|
2834
|
-
[`Labels`](#../interfaces/Labels)
|
|
2835
|
-
|
|
2836
|
-
Set of labels to check for in source
|
|
2558
|
+
| Parameter | Type | Description |
|
|
2559
|
+
| ------ | ------ | ------ |
|
|
2560
|
+
| `source?` | [`Labels`](#../interfaces/Labels) | Source object to check against |
|
|
2561
|
+
| `required?` | [`Labels`](#../interfaces/Labels) | Set of labels to check for in source |
|
|
2837
2562
|
|
|
2838
2563
|
## Returns
|
|
2839
2564
|
|
|
@@ -2859,29 +2584,26 @@ used to construct instances through the creatable lifecycle.
|
|
|
2859
2584
|
|
|
2860
2585
|
## Type Parameters
|
|
2861
2586
|
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)
|
|
2587
|
+
| Type Parameter | Default type |
|
|
2588
|
+
| ------ | ------ |
|
|
2589
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance) | [`CreatableInstance`](#CreatableInstance) |
|
|
2865
2590
|
|
|
2866
2591
|
## Constructors
|
|
2867
2592
|
|
|
2868
2593
|
### Constructor
|
|
2869
2594
|
|
|
2870
2595
|
```ts
|
|
2871
|
-
new Creatable(key, params): T & AbstractCreatable<T["params"], EventData>;
|
|
2596
|
+
new Creatable(key: unknown, params: Partial<CreatableParams>): T & AbstractCreatable<T["params"], EventData>;
|
|
2872
2597
|
```
|
|
2873
2598
|
|
|
2874
2599
|
Constructs a new raw instance. Should not be called directly; use `create` instead.
|
|
2875
2600
|
|
|
2876
2601
|
### Parameters
|
|
2877
2602
|
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
`unknown`
|
|
2881
|
-
|
|
2882
|
-
#### params
|
|
2883
|
-
|
|
2884
|
-
`Partial`\<[`CreatableParams`](#CreatableParams)\>
|
|
2603
|
+
| Parameter | Type |
|
|
2604
|
+
| ------ | ------ |
|
|
2605
|
+
| `key` | `unknown` |
|
|
2606
|
+
| `params` | `Partial`\<[`CreatableParams`](#CreatableParams)\> |
|
|
2885
2607
|
|
|
2886
2608
|
### Returns
|
|
2887
2609
|
|
|
@@ -2889,39 +2611,32 @@ Constructs a new raw instance. Should not be called directly; use `create` inste
|
|
|
2889
2611
|
|
|
2890
2612
|
## Properties
|
|
2891
2613
|
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
optional defaultLogger: Logger;
|
|
2896
|
-
```
|
|
2897
|
-
|
|
2898
|
-
Optional default logger shared across instances created by this class.
|
|
2614
|
+
| Property | Type | Description |
|
|
2615
|
+
| ------ | ------ | ------ |
|
|
2616
|
+
| <a id="defaultlogger"></a> `defaultLogger?` | `Logger` | Optional default logger shared across instances created by this class. |
|
|
2899
2617
|
|
|
2900
2618
|
## Methods
|
|
2901
2619
|
|
|
2902
2620
|
### create()
|
|
2903
2621
|
|
|
2904
2622
|
```ts
|
|
2905
|
-
create<T>(this
|
|
2623
|
+
create<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promise<T>;
|
|
2906
2624
|
```
|
|
2907
2625
|
|
|
2908
2626
|
Asynchronously creates and initializes a new instance with the given params.
|
|
2909
2627
|
|
|
2910
2628
|
### Type Parameters
|
|
2911
2629
|
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
2630
|
+
| Type Parameter |
|
|
2631
|
+
| ------ |
|
|
2632
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
2915
2633
|
|
|
2916
2634
|
### Parameters
|
|
2917
2635
|
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
`Creatable`\<`T`\>
|
|
2921
|
-
|
|
2922
|
-
#### params?
|
|
2923
|
-
|
|
2924
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2636
|
+
| Parameter | Type |
|
|
2637
|
+
| ------ | ------ |
|
|
2638
|
+
| `this` | `Creatable`\<`T`\> |
|
|
2639
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
2925
2640
|
|
|
2926
2641
|
### Returns
|
|
2927
2642
|
|
|
@@ -2932,26 +2647,23 @@ Asynchronously creates and initializes a new instance with the given params.
|
|
|
2932
2647
|
### createHandler()
|
|
2933
2648
|
|
|
2934
2649
|
```ts
|
|
2935
|
-
createHandler<T>(this
|
|
2650
|
+
createHandler<T>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
2936
2651
|
```
|
|
2937
2652
|
|
|
2938
2653
|
Hook called after construction to perform additional initialization on the instance.
|
|
2939
2654
|
|
|
2940
2655
|
### Type Parameters
|
|
2941
2656
|
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
2657
|
+
| Type Parameter |
|
|
2658
|
+
| ------ |
|
|
2659
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
2945
2660
|
|
|
2946
2661
|
### Parameters
|
|
2947
2662
|
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
`Creatable`\<`T`\>
|
|
2951
|
-
|
|
2952
|
-
#### instance
|
|
2953
|
-
|
|
2954
|
-
`T`
|
|
2663
|
+
| Parameter | Type |
|
|
2664
|
+
| ------ | ------ |
|
|
2665
|
+
| `this` | `Creatable`\<`T`\> |
|
|
2666
|
+
| `instance` | `T` |
|
|
2955
2667
|
|
|
2956
2668
|
### Returns
|
|
2957
2669
|
|
|
@@ -2962,26 +2674,23 @@ Hook called after construction to perform additional initialization on the insta
|
|
|
2962
2674
|
### paramsHandler()
|
|
2963
2675
|
|
|
2964
2676
|
```ts
|
|
2965
|
-
paramsHandler<T>(this
|
|
2677
|
+
paramsHandler<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promisable<T["params"] & RequiredCreatableParams<void>>;
|
|
2966
2678
|
```
|
|
2967
2679
|
|
|
2968
2680
|
Hook called to validate and transform params before instance construction.
|
|
2969
2681
|
|
|
2970
2682
|
### Type Parameters
|
|
2971
2683
|
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
2684
|
+
| Type Parameter |
|
|
2685
|
+
| ------ |
|
|
2686
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
2975
2687
|
|
|
2976
2688
|
### Parameters
|
|
2977
2689
|
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
`Creatable`\<`T`\>
|
|
2981
|
-
|
|
2982
|
-
#### params?
|
|
2983
|
-
|
|
2984
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2690
|
+
| Parameter | Type |
|
|
2691
|
+
| ------ | ------ |
|
|
2692
|
+
| `this` | `Creatable`\<`T`\> |
|
|
2693
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
2985
2694
|
|
|
2986
2695
|
### Returns
|
|
2987
2696
|
|
|
@@ -3007,29 +2716,26 @@ Unlike the full Creatable, this only exposes the `create` method.
|
|
|
3007
2716
|
|
|
3008
2717
|
## Type Parameters
|
|
3009
2718
|
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)
|
|
2719
|
+
| Type Parameter | Default type |
|
|
2720
|
+
| ------ | ------ |
|
|
2721
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance) | [`CreatableInstance`](#CreatableInstance) |
|
|
3013
2722
|
|
|
3014
2723
|
## Methods
|
|
3015
2724
|
|
|
3016
2725
|
### create()
|
|
3017
2726
|
|
|
3018
2727
|
```ts
|
|
3019
|
-
create(this
|
|
2728
|
+
create(this: CreatableFactory<T>, params?: Partial<T["params"]>): Promise<T>;
|
|
3020
2729
|
```
|
|
3021
2730
|
|
|
3022
2731
|
Creates a new instance, merging the provided params with the factory's defaults.
|
|
3023
2732
|
|
|
3024
2733
|
### Parameters
|
|
3025
2734
|
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
`CreatableFactory`\<`T`\>
|
|
3029
|
-
|
|
3030
|
-
#### params?
|
|
3031
|
-
|
|
3032
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2735
|
+
| Parameter | Type |
|
|
2736
|
+
| ------ | ------ |
|
|
2737
|
+
| `this` | `CreatableFactory`\<`T`\> |
|
|
2738
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3033
2739
|
|
|
3034
2740
|
### Returns
|
|
3035
2741
|
|
|
@@ -3049,91 +2755,36 @@ Represents a created instance with a managed lifecycle (start/stop) and event em
|
|
|
3049
2755
|
|
|
3050
2756
|
## Type Parameters
|
|
3051
2757
|
|
|
3052
|
-
|
|
3053
|
-
|
|
3054
|
-
`TParams` *extends* [`CreatableParams`](#CreatableParams)
|
|
3055
|
-
|
|
3056
|
-
### TEventData
|
|
3057
|
-
|
|
3058
|
-
`TEventData` *extends* `EventData` = `EventData`
|
|
2758
|
+
| Type Parameter | Default type |
|
|
2759
|
+
| ------ | ------ |
|
|
2760
|
+
| `TParams` *extends* [`CreatableParams`](#CreatableParams) | [`CreatableParams`](#CreatableParams) |
|
|
2761
|
+
| `TEventData` *extends* `EventData` | `EventData` |
|
|
3059
2762
|
|
|
3060
2763
|
## Properties
|
|
3061
2764
|
|
|
3062
|
-
|
|
3063
|
-
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
### Overrides
|
|
3071
|
-
|
|
3072
|
-
```ts
|
|
3073
|
-
EventEmitter.eventData
|
|
3074
|
-
```
|
|
3075
|
-
|
|
3076
|
-
***
|
|
3077
|
-
|
|
3078
|
-
### name
|
|
3079
|
-
|
|
3080
|
-
```ts
|
|
3081
|
-
name: CreatableName;
|
|
3082
|
-
```
|
|
3083
|
-
|
|
3084
|
-
The name identifier for this instance.
|
|
3085
|
-
|
|
3086
|
-
***
|
|
3087
|
-
|
|
3088
|
-
### params
|
|
3089
|
-
|
|
3090
|
-
```ts
|
|
3091
|
-
params: TParams;
|
|
3092
|
-
```
|
|
3093
|
-
|
|
3094
|
-
The parameters used to configure this instance.
|
|
3095
|
-
|
|
3096
|
-
***
|
|
3097
|
-
|
|
3098
|
-
### start()
|
|
3099
|
-
|
|
3100
|
-
```ts
|
|
3101
|
-
start: () => Promise<boolean>;
|
|
3102
|
-
```
|
|
3103
|
-
|
|
3104
|
-
Starts the instance. Resolves to true if started successfully.
|
|
3105
|
-
|
|
3106
|
-
### Returns
|
|
3107
|
-
|
|
3108
|
-
`Promise`\<`boolean`\>
|
|
3109
|
-
|
|
3110
|
-
***
|
|
3111
|
-
|
|
3112
|
-
### stop()
|
|
3113
|
-
|
|
3114
|
-
```ts
|
|
3115
|
-
stop: () => Promise<boolean>;
|
|
3116
|
-
```
|
|
3117
|
-
|
|
3118
|
-
Stops the instance. Resolves to true if stopped successfully.
|
|
3119
|
-
|
|
3120
|
-
### Returns
|
|
3121
|
-
|
|
3122
|
-
`Promise`\<`boolean`\>
|
|
2765
|
+
| Property | Type | Description | Overrides |
|
|
2766
|
+
| ------ | ------ | ------ | ------ |
|
|
2767
|
+
| <a id="eventdata"></a> `eventData` | `TEventData` | The event data type associated with this instance. | `EventEmitter.eventData` |
|
|
2768
|
+
| <a id="name"></a> `name` | [`CreatableName`](#../type-aliases/CreatableName) | The name identifier for this instance. | - |
|
|
2769
|
+
| <a id="params"></a> `params` | `TParams` | The parameters used to configure this instance. | - |
|
|
2770
|
+
| <a id="start"></a> `start` | () => `Promise`\<`boolean`\> | Starts the instance. Resolves to true if started successfully. | - |
|
|
2771
|
+
| <a id="stop"></a> `stop` | () => `Promise`\<`boolean`\> | Stops the instance. Resolves to true if stopped successfully. | - |
|
|
3123
2772
|
|
|
3124
2773
|
## Methods
|
|
3125
2774
|
|
|
3126
2775
|
### clearListeners()
|
|
3127
2776
|
|
|
3128
2777
|
```ts
|
|
3129
|
-
clearListeners(eventNames): void;
|
|
2778
|
+
clearListeners(eventNames: keyof TEventData | keyof TEventData[]): void;
|
|
3130
2779
|
```
|
|
3131
2780
|
|
|
3132
|
-
|
|
2781
|
+
Removes all listeners for the specified event name(s).
|
|
3133
2782
|
|
|
3134
|
-
|
|
2783
|
+
### Parameters
|
|
3135
2784
|
|
|
3136
|
-
|
|
2785
|
+
| Parameter | Type |
|
|
2786
|
+
| ------ | ------ |
|
|
2787
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] |
|
|
3137
2788
|
|
|
3138
2789
|
### Returns
|
|
3139
2790
|
|
|
@@ -3150,24 +2801,23 @@ EventEmitter.clearListeners
|
|
|
3150
2801
|
### emit()
|
|
3151
2802
|
|
|
3152
2803
|
```ts
|
|
3153
|
-
emit<TEventName>(eventName, eventArgs): Promise<void>;
|
|
2804
|
+
emit<TEventName>(eventName: TEventName, eventArgs: TEventData[TEventName]): Promise<void>;
|
|
3154
2805
|
```
|
|
3155
2806
|
|
|
3156
|
-
|
|
2807
|
+
Emits an event, invoking all registered listeners concurrently.
|
|
3157
2808
|
|
|
3158
|
-
|
|
2809
|
+
### Type Parameters
|
|
3159
2810
|
|
|
3160
|
-
|
|
2811
|
+
| Type Parameter |
|
|
2812
|
+
| ------ |
|
|
2813
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3161
2814
|
|
|
3162
2815
|
### Parameters
|
|
3163
2816
|
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
`TEventName`
|
|
3167
|
-
|
|
3168
|
-
#### eventArgs
|
|
3169
|
-
|
|
3170
|
-
`TEventData`\[`TEventName`\]
|
|
2817
|
+
| Parameter | Type |
|
|
2818
|
+
| ------ | ------ |
|
|
2819
|
+
| `eventName` | `TEventName` |
|
|
2820
|
+
| `eventArgs` | `TEventData`\[`TEventName`\] |
|
|
3171
2821
|
|
|
3172
2822
|
### Returns
|
|
3173
2823
|
|
|
@@ -3184,24 +2834,23 @@ EventEmitter.emit
|
|
|
3184
2834
|
### emitSerial()
|
|
3185
2835
|
|
|
3186
2836
|
```ts
|
|
3187
|
-
emitSerial<TEventName>(eventName, eventArgs): Promise<void>;
|
|
2837
|
+
emitSerial<TEventName>(eventName: TEventName, eventArgs: TEventData[TEventName]): Promise<void>;
|
|
3188
2838
|
```
|
|
3189
2839
|
|
|
3190
|
-
|
|
2840
|
+
Emits an event, invoking all registered listeners sequentially in order.
|
|
3191
2841
|
|
|
3192
|
-
|
|
2842
|
+
### Type Parameters
|
|
3193
2843
|
|
|
3194
|
-
|
|
2844
|
+
| Type Parameter |
|
|
2845
|
+
| ------ |
|
|
2846
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3195
2847
|
|
|
3196
2848
|
### Parameters
|
|
3197
2849
|
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
`TEventName`
|
|
3201
|
-
|
|
3202
|
-
#### eventArgs
|
|
3203
|
-
|
|
3204
|
-
`TEventData`\[`TEventName`\]
|
|
2850
|
+
| Parameter | Type |
|
|
2851
|
+
| ------ | ------ |
|
|
2852
|
+
| `eventName` | `TEventName` |
|
|
2853
|
+
| `eventArgs` | `TEventData`\[`TEventName`\] |
|
|
3205
2854
|
|
|
3206
2855
|
### Returns
|
|
3207
2856
|
|
|
@@ -3218,14 +2867,16 @@ EventEmitter.emitSerial
|
|
|
3218
2867
|
### listenerCount()
|
|
3219
2868
|
|
|
3220
2869
|
```ts
|
|
3221
|
-
listenerCount(eventNames): number;
|
|
2870
|
+
listenerCount(eventNames: keyof TEventData | keyof TEventData[]): number;
|
|
3222
2871
|
```
|
|
3223
2872
|
|
|
3224
|
-
|
|
2873
|
+
Returns the total number of listeners registered for the specified event name(s).
|
|
3225
2874
|
|
|
3226
|
-
|
|
2875
|
+
### Parameters
|
|
3227
2876
|
|
|
3228
|
-
|
|
2877
|
+
| Parameter | Type |
|
|
2878
|
+
| ------ | ------ |
|
|
2879
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] |
|
|
3229
2880
|
|
|
3230
2881
|
### Returns
|
|
3231
2882
|
|
|
@@ -3242,24 +2893,23 @@ EventEmitter.listenerCount
|
|
|
3242
2893
|
### off()
|
|
3243
2894
|
|
|
3244
2895
|
```ts
|
|
3245
|
-
off<TEventName>(eventNames, listener): void;
|
|
2896
|
+
off<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): void;
|
|
3246
2897
|
```
|
|
3247
2898
|
|
|
3248
|
-
|
|
2899
|
+
Removes a specific listener from the specified event name(s).
|
|
3249
2900
|
|
|
3250
|
-
|
|
2901
|
+
### Type Parameters
|
|
3251
2902
|
|
|
3252
|
-
|
|
2903
|
+
| Type Parameter |
|
|
2904
|
+
| ------ |
|
|
2905
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3253
2906
|
|
|
3254
2907
|
### Parameters
|
|
3255
2908
|
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
`
|
|
3259
|
-
|
|
3260
|
-
#### listener
|
|
3261
|
-
|
|
3262
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2909
|
+
| Parameter | Type |
|
|
2910
|
+
| ------ | ------ |
|
|
2911
|
+
| `eventNames` | `TEventName` \| `TEventName`[] |
|
|
2912
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> |
|
|
3263
2913
|
|
|
3264
2914
|
### Returns
|
|
3265
2915
|
|
|
@@ -3276,14 +2926,16 @@ EventEmitter.off
|
|
|
3276
2926
|
### offAny()
|
|
3277
2927
|
|
|
3278
2928
|
```ts
|
|
3279
|
-
offAny(listener): void;
|
|
2929
|
+
offAny(listener: Promise<void> | EventAnyListener): void;
|
|
3280
2930
|
```
|
|
3281
2931
|
|
|
3282
|
-
|
|
2932
|
+
Removes a wildcard listener that was receiving all events.
|
|
3283
2933
|
|
|
3284
|
-
|
|
2934
|
+
### Parameters
|
|
3285
2935
|
|
|
3286
|
-
|
|
2936
|
+
| Parameter | Type |
|
|
2937
|
+
| ------ | ------ |
|
|
2938
|
+
| `listener` | `Promise`\<`void`\> \| `EventAnyListener` |
|
|
3287
2939
|
|
|
3288
2940
|
### Returns
|
|
3289
2941
|
|
|
@@ -3300,24 +2952,23 @@ EventEmitter.offAny
|
|
|
3300
2952
|
### on()
|
|
3301
2953
|
|
|
3302
2954
|
```ts
|
|
3303
|
-
on<TEventName>(eventNames, listener): EventUnsubscribeFunction;
|
|
2955
|
+
on<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): EventUnsubscribeFunction;
|
|
3304
2956
|
```
|
|
3305
2957
|
|
|
3306
|
-
|
|
2958
|
+
Subscribes a listener to the specified event name(s) and returns an unsubscribe function.
|
|
3307
2959
|
|
|
3308
|
-
|
|
2960
|
+
### Type Parameters
|
|
3309
2961
|
|
|
3310
|
-
|
|
2962
|
+
| Type Parameter |
|
|
2963
|
+
| ------ |
|
|
2964
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3311
2965
|
|
|
3312
2966
|
### Parameters
|
|
3313
2967
|
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
`
|
|
3317
|
-
|
|
3318
|
-
#### listener
|
|
3319
|
-
|
|
3320
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2968
|
+
| Parameter | Type |
|
|
2969
|
+
| ------ | ------ |
|
|
2970
|
+
| `eventNames` | `TEventName` \| `TEventName`[] |
|
|
2971
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> |
|
|
3321
2972
|
|
|
3322
2973
|
### Returns
|
|
3323
2974
|
|
|
@@ -3334,14 +2985,16 @@ EventEmitter.on
|
|
|
3334
2985
|
### onAny()
|
|
3335
2986
|
|
|
3336
2987
|
```ts
|
|
3337
|
-
onAny(listener): EventUnsubscribeFunction;
|
|
2988
|
+
onAny(listener: EventAnyListener): EventUnsubscribeFunction;
|
|
3338
2989
|
```
|
|
3339
2990
|
|
|
3340
|
-
|
|
2991
|
+
Subscribes a wildcard listener that receives all events and returns an unsubscribe function.
|
|
3341
2992
|
|
|
3342
|
-
|
|
2993
|
+
### Parameters
|
|
3343
2994
|
|
|
3344
|
-
|
|
2995
|
+
| Parameter | Type |
|
|
2996
|
+
| ------ | ------ |
|
|
2997
|
+
| `listener` | `EventAnyListener` |
|
|
3345
2998
|
|
|
3346
2999
|
### Returns
|
|
3347
3000
|
|
|
@@ -3358,24 +3011,23 @@ EventEmitter.onAny
|
|
|
3358
3011
|
### once()
|
|
3359
3012
|
|
|
3360
3013
|
```ts
|
|
3361
|
-
once<TEventName>(eventName, listener): EventUnsubscribeFunction;
|
|
3014
|
+
once<TEventName>(eventName: TEventName, listener: EventListener<TEventData[TEventName]>): EventUnsubscribeFunction;
|
|
3362
3015
|
```
|
|
3363
3016
|
|
|
3364
|
-
|
|
3017
|
+
Subscribes a listener that will be invoked only once for the specified event, then automatically removed.
|
|
3365
3018
|
|
|
3366
|
-
|
|
3019
|
+
### Type Parameters
|
|
3367
3020
|
|
|
3368
|
-
|
|
3021
|
+
| Type Parameter |
|
|
3022
|
+
| ------ |
|
|
3023
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3369
3024
|
|
|
3370
3025
|
### Parameters
|
|
3371
3026
|
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
`TEventName`
|
|
3375
|
-
|
|
3376
|
-
#### listener
|
|
3377
|
-
|
|
3378
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
3027
|
+
| Parameter | Type |
|
|
3028
|
+
| ------ | ------ |
|
|
3029
|
+
| `eventName` | `TEventName` |
|
|
3030
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> |
|
|
3379
3031
|
|
|
3380
3032
|
### Returns
|
|
3381
3033
|
|
|
@@ -3401,67 +3053,13 @@ Parameters for creating a creatable instance, combining required params with emi
|
|
|
3401
3053
|
|
|
3402
3054
|
## Properties
|
|
3403
3055
|
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
|
|
3412
|
-
[`RequiredCreatableParams`](#RequiredCreatableParams).[`logger`](RequiredCreatableParams.md#logger)
|
|
3413
|
-
|
|
3414
|
-
***
|
|
3415
|
-
|
|
3416
|
-
### meterProvider?
|
|
3417
|
-
|
|
3418
|
-
```ts
|
|
3419
|
-
optional meterProvider: MeterProvider;
|
|
3420
|
-
```
|
|
3421
|
-
|
|
3422
|
-
### Inherited from
|
|
3423
|
-
|
|
3424
|
-
[`RequiredCreatableParams`](#RequiredCreatableParams).[`meterProvider`](RequiredCreatableParams.md#meterprovider)
|
|
3425
|
-
|
|
3426
|
-
***
|
|
3427
|
-
|
|
3428
|
-
### traceProvider?
|
|
3429
|
-
|
|
3430
|
-
```ts
|
|
3431
|
-
optional traceProvider: TracerProvider;
|
|
3432
|
-
```
|
|
3433
|
-
|
|
3434
|
-
### Inherited from
|
|
3435
|
-
|
|
3436
|
-
[`RequiredCreatableParams`](#RequiredCreatableParams).[`traceProvider`](RequiredCreatableParams.md#traceprovider)
|
|
3437
|
-
|
|
3438
|
-
***
|
|
3439
|
-
|
|
3440
|
-
### name?
|
|
3441
|
-
|
|
3442
|
-
```ts
|
|
3443
|
-
optional name: CreatableName;
|
|
3444
|
-
```
|
|
3445
|
-
|
|
3446
|
-
Optional name identifying this creatable instance.
|
|
3447
|
-
|
|
3448
|
-
### Inherited from
|
|
3449
|
-
|
|
3450
|
-
[`RequiredCreatableParams`](#RequiredCreatableParams).[`name`](RequiredCreatableParams.md#name)
|
|
3451
|
-
|
|
3452
|
-
***
|
|
3453
|
-
|
|
3454
|
-
### statusReporter?
|
|
3455
|
-
|
|
3456
|
-
```ts
|
|
3457
|
-
optional statusReporter: CreatableStatusReporter<void>;
|
|
3458
|
-
```
|
|
3459
|
-
|
|
3460
|
-
Optional reporter for broadcasting status changes.
|
|
3461
|
-
|
|
3462
|
-
### Inherited from
|
|
3463
|
-
|
|
3464
|
-
[`RequiredCreatableParams`](#RequiredCreatableParams).[`statusReporter`](RequiredCreatableParams.md#statusreporter)
|
|
3056
|
+
| Property | Type | Description | Inherited from |
|
|
3057
|
+
| ------ | ------ | ------ | ------ |
|
|
3058
|
+
| <a id="logger"></a> `logger?` | `Logger` | - | [`RequiredCreatableParams`](#RequiredCreatableParams).[`logger`](RequiredCreatableParams.md#logger) |
|
|
3059
|
+
| <a id="meterprovider"></a> `meterProvider?` | `MeterProvider` | - | [`RequiredCreatableParams`](#RequiredCreatableParams).[`meterProvider`](RequiredCreatableParams.md#meterprovider) |
|
|
3060
|
+
| <a id="traceprovider"></a> `traceProvider?` | `TracerProvider` | - | [`RequiredCreatableParams`](#RequiredCreatableParams).[`traceProvider`](RequiredCreatableParams.md#traceprovider) |
|
|
3061
|
+
| <a id="name"></a> `name?` | [`CreatableName`](#../type-aliases/CreatableName) | Optional name identifying this creatable instance. | [`RequiredCreatableParams`](#RequiredCreatableParams).[`name`](RequiredCreatableParams.md#name) |
|
|
3062
|
+
| <a id="statusreporter"></a> `statusReporter?` | [`CreatableStatusReporter`](#CreatableStatusReporter)\<`void`\> | Optional reporter for broadcasting status changes. | [`RequiredCreatableParams`](#RequiredCreatableParams).[`statusReporter`](RequiredCreatableParams.md#statusreporter) |
|
|
3465
3063
|
|
|
3466
3064
|
### <a id="CreatableStatusReporter"></a>CreatableStatusReporter
|
|
3467
3065
|
|
|
@@ -3473,9 +3071,9 @@ Reports status changes for a creatable, supporting progress tracking and error r
|
|
|
3473
3071
|
|
|
3474
3072
|
## Type Parameters
|
|
3475
3073
|
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
`TAdditionalStatus` *extends* `void` \| `string`
|
|
3074
|
+
| Type Parameter | Default type |
|
|
3075
|
+
| ------ | ------ |
|
|
3076
|
+
| `TAdditionalStatus` *extends* `void` \| `string` | `void` |
|
|
3479
3077
|
|
|
3480
3078
|
## Methods
|
|
3481
3079
|
|
|
@@ -3485,26 +3083,27 @@ Reports status changes for a creatable, supporting progress tracking and error r
|
|
|
3485
3083
|
|
|
3486
3084
|
```ts
|
|
3487
3085
|
report(
|
|
3488
|
-
name,
|
|
3489
|
-
status
|
|
3490
|
-
|
|
3086
|
+
name: BaseClassName,
|
|
3087
|
+
status:
|
|
3088
|
+
| "creating"
|
|
3089
|
+
| "created"
|
|
3090
|
+
| "starting"
|
|
3091
|
+
| "started"
|
|
3092
|
+
| "stopping"
|
|
3093
|
+
| "stopped"
|
|
3094
|
+
| Exclude<TAdditionalStatus extends void ? StandardCreatableStatus : TAdditionalStatus, "error">,
|
|
3095
|
+
progress: number): void;
|
|
3491
3096
|
```
|
|
3492
3097
|
|
|
3493
3098
|
Report a non-error status with a numeric progress value.
|
|
3494
3099
|
|
|
3495
3100
|
#### Parameters
|
|
3496
3101
|
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
`BaseClassName`
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
`"creating"` | `"created"` | `"starting"` | `"started"` | `"stopping"` | `"stopped"` | `Exclude`\<`TAdditionalStatus` *extends* `void` ? [`StandardCreatableStatus`](#../type-aliases/StandardCreatableStatus) : `TAdditionalStatus`, `"error"`\>
|
|
3504
|
-
|
|
3505
|
-
##### progress
|
|
3506
|
-
|
|
3507
|
-
`number`
|
|
3102
|
+
| Parameter | Type |
|
|
3103
|
+
| ------ | ------ |
|
|
3104
|
+
| `name` | `BaseClassName` |
|
|
3105
|
+
| `status` | \| `"creating"` \| `"created"` \| `"starting"` \| `"started"` \| `"stopping"` \| `"stopped"` \| `Exclude`\<`TAdditionalStatus` *extends* `void` ? [`StandardCreatableStatus`](#../type-aliases/StandardCreatableStatus) : `TAdditionalStatus`, `"error"`\> |
|
|
3106
|
+
| `progress` | `number` |
|
|
3508
3107
|
|
|
3509
3108
|
#### Returns
|
|
3510
3109
|
|
|
@@ -3514,26 +3113,22 @@ Report a non-error status with a numeric progress value.
|
|
|
3514
3113
|
|
|
3515
3114
|
```ts
|
|
3516
3115
|
report(
|
|
3517
|
-
name,
|
|
3518
|
-
status
|
|
3519
|
-
|
|
3116
|
+
name: BaseClassName,
|
|
3117
|
+
status:
|
|
3118
|
+
| "error"
|
|
3119
|
+
| Extract<TAdditionalStatus extends void ? StandardCreatableStatus : TAdditionalStatus, "error">,
|
|
3120
|
+
error: Error): void;
|
|
3520
3121
|
```
|
|
3521
3122
|
|
|
3522
3123
|
Report an error status with the associated Error.
|
|
3523
3124
|
|
|
3524
3125
|
#### Parameters
|
|
3525
3126
|
|
|
3526
|
-
|
|
3527
|
-
|
|
3528
|
-
`BaseClassName`
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
`"error"` | `Extract`\<`TAdditionalStatus` *extends* `void` ? [`StandardCreatableStatus`](#../type-aliases/StandardCreatableStatus) : `TAdditionalStatus`, `"error"`\>
|
|
3533
|
-
|
|
3534
|
-
##### error
|
|
3535
|
-
|
|
3536
|
-
`Error`
|
|
3127
|
+
| Parameter | Type |
|
|
3128
|
+
| ------ | ------ |
|
|
3129
|
+
| `name` | `BaseClassName` |
|
|
3130
|
+
| `status` | \| `"error"` \| `Extract`\<`TAdditionalStatus` *extends* `void` ? [`StandardCreatableStatus`](#../type-aliases/StandardCreatableStatus) : `TAdditionalStatus`, `"error"`\> |
|
|
3131
|
+
| `error` | `Error` |
|
|
3537
3132
|
|
|
3538
3133
|
#### Returns
|
|
3539
3134
|
|
|
@@ -3542,20 +3137,17 @@ Report an error status with the associated Error.
|
|
|
3542
3137
|
### Call Signature
|
|
3543
3138
|
|
|
3544
3139
|
```ts
|
|
3545
|
-
report(name, status): void;
|
|
3140
|
+
report(name: BaseClassName, status: CreatableStatus<TAdditionalStatus>): void;
|
|
3546
3141
|
```
|
|
3547
3142
|
|
|
3548
3143
|
Report a status change without progress or error details.
|
|
3549
3144
|
|
|
3550
3145
|
#### Parameters
|
|
3551
3146
|
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
`BaseClassName`
|
|
3555
|
-
|
|
3556
|
-
##### status
|
|
3557
|
-
|
|
3558
|
-
[`CreatableStatus`](#../type-aliases/CreatableStatus)\<`TAdditionalStatus`\>
|
|
3147
|
+
| Parameter | Type |
|
|
3148
|
+
| ------ | ------ |
|
|
3149
|
+
| `name` | `BaseClassName` |
|
|
3150
|
+
| `status` | [`CreatableStatus`](#../type-aliases/CreatableStatus)\<`TAdditionalStatus`\> |
|
|
3559
3151
|
|
|
3560
3152
|
#### Returns
|
|
3561
3153
|
|
|
@@ -3575,29 +3167,26 @@ Extends Creatable with a `factory` method that produces pre-configured Creatable
|
|
|
3575
3167
|
|
|
3576
3168
|
## Type Parameters
|
|
3577
3169
|
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)
|
|
3170
|
+
| Type Parameter | Default type |
|
|
3171
|
+
| ------ | ------ |
|
|
3172
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance) | [`CreatableInstance`](#CreatableInstance) |
|
|
3581
3173
|
|
|
3582
3174
|
## Constructors
|
|
3583
3175
|
|
|
3584
3176
|
### Constructor
|
|
3585
3177
|
|
|
3586
3178
|
```ts
|
|
3587
|
-
new CreatableWithFactory(key, params): T & AbstractCreatable<T["params"], EventData>;
|
|
3179
|
+
new CreatableWithFactory(key: unknown, params: Partial<CreatableParams>): T & AbstractCreatable<T["params"], EventData>;
|
|
3588
3180
|
```
|
|
3589
3181
|
|
|
3590
3182
|
Constructs a new raw instance. Should not be called directly; use `create` instead.
|
|
3591
3183
|
|
|
3592
3184
|
### Parameters
|
|
3593
3185
|
|
|
3594
|
-
|
|
3595
|
-
|
|
3596
|
-
`unknown`
|
|
3597
|
-
|
|
3598
|
-
#### params
|
|
3599
|
-
|
|
3600
|
-
`Partial`\<[`CreatableParams`](#CreatableParams)\>
|
|
3186
|
+
| Parameter | Type |
|
|
3187
|
+
| ------ | ------ |
|
|
3188
|
+
| `key` | `unknown` |
|
|
3189
|
+
| `params` | `Partial`\<[`CreatableParams`](#CreatableParams)\> |
|
|
3601
3190
|
|
|
3602
3191
|
### Returns
|
|
3603
3192
|
|
|
@@ -3609,43 +3198,32 @@ Constructs a new raw instance. Should not be called directly; use `create` inste
|
|
|
3609
3198
|
|
|
3610
3199
|
## Properties
|
|
3611
3200
|
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
optional defaultLogger: Logger;
|
|
3616
|
-
```
|
|
3617
|
-
|
|
3618
|
-
Optional default logger shared across instances created by this class.
|
|
3619
|
-
|
|
3620
|
-
### Inherited from
|
|
3621
|
-
|
|
3622
|
-
[`Creatable`](#Creatable).[`defaultLogger`](Creatable.md#defaultlogger)
|
|
3201
|
+
| Property | Type | Description | Inherited from |
|
|
3202
|
+
| ------ | ------ | ------ | ------ |
|
|
3203
|
+
| <a id="defaultlogger"></a> `defaultLogger?` | `Logger` | Optional default logger shared across instances created by this class. | [`Creatable`](#Creatable).[`defaultLogger`](Creatable.md#defaultlogger) |
|
|
3623
3204
|
|
|
3624
3205
|
## Methods
|
|
3625
3206
|
|
|
3626
3207
|
### create()
|
|
3627
3208
|
|
|
3628
3209
|
```ts
|
|
3629
|
-
create<T>(this
|
|
3210
|
+
create<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promise<T>;
|
|
3630
3211
|
```
|
|
3631
3212
|
|
|
3632
3213
|
Asynchronously creates and initializes a new instance with the given params.
|
|
3633
3214
|
|
|
3634
3215
|
### Type Parameters
|
|
3635
3216
|
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
3217
|
+
| Type Parameter |
|
|
3218
|
+
| ------ |
|
|
3219
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3639
3220
|
|
|
3640
3221
|
### Parameters
|
|
3641
3222
|
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
[`Creatable`](#Creatable)\<`T`\>
|
|
3645
|
-
|
|
3646
|
-
#### params?
|
|
3647
|
-
|
|
3648
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
3223
|
+
| Parameter | Type |
|
|
3224
|
+
| ------ | ------ |
|
|
3225
|
+
| `this` | [`Creatable`](#Creatable)\<`T`\> |
|
|
3226
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3649
3227
|
|
|
3650
3228
|
### Returns
|
|
3651
3229
|
|
|
@@ -3660,26 +3238,23 @@ Asynchronously creates and initializes a new instance with the given params.
|
|
|
3660
3238
|
### createHandler()
|
|
3661
3239
|
|
|
3662
3240
|
```ts
|
|
3663
|
-
createHandler<T>(this
|
|
3241
|
+
createHandler<T>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
3664
3242
|
```
|
|
3665
3243
|
|
|
3666
3244
|
Hook called after construction to perform additional initialization on the instance.
|
|
3667
3245
|
|
|
3668
3246
|
### Type Parameters
|
|
3669
3247
|
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
3248
|
+
| Type Parameter |
|
|
3249
|
+
| ------ |
|
|
3250
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3673
3251
|
|
|
3674
3252
|
### Parameters
|
|
3675
3253
|
|
|
3676
|
-
|
|
3677
|
-
|
|
3678
|
-
[`Creatable`](#Creatable)\<`T`\>
|
|
3679
|
-
|
|
3680
|
-
#### instance
|
|
3681
|
-
|
|
3682
|
-
`T`
|
|
3254
|
+
| Parameter | Type |
|
|
3255
|
+
| ------ | ------ |
|
|
3256
|
+
| `this` | [`Creatable`](#Creatable)\<`T`\> |
|
|
3257
|
+
| `instance` | `T` |
|
|
3683
3258
|
|
|
3684
3259
|
### Returns
|
|
3685
3260
|
|
|
@@ -3694,26 +3269,23 @@ Hook called after construction to perform additional initialization on the insta
|
|
|
3694
3269
|
### paramsHandler()
|
|
3695
3270
|
|
|
3696
3271
|
```ts
|
|
3697
|
-
paramsHandler<T>(this
|
|
3272
|
+
paramsHandler<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promisable<T["params"] & RequiredCreatableParams<void>>;
|
|
3698
3273
|
```
|
|
3699
3274
|
|
|
3700
3275
|
Hook called to validate and transform params before instance construction.
|
|
3701
3276
|
|
|
3702
3277
|
### Type Parameters
|
|
3703
3278
|
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
3279
|
+
| Type Parameter |
|
|
3280
|
+
| ------ |
|
|
3281
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3707
3282
|
|
|
3708
3283
|
### Parameters
|
|
3709
3284
|
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
[`Creatable`](#Creatable)\<`T`\>
|
|
3713
|
-
|
|
3714
|
-
#### params?
|
|
3715
|
-
|
|
3716
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
3285
|
+
| Parameter | Type |
|
|
3286
|
+
| ------ | ------ |
|
|
3287
|
+
| `this` | [`Creatable`](#Creatable)\<`T`\> |
|
|
3288
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3717
3289
|
|
|
3718
3290
|
### Returns
|
|
3719
3291
|
|
|
@@ -3729,32 +3301,26 @@ Hook called to validate and transform params before instance construction.
|
|
|
3729
3301
|
|
|
3730
3302
|
```ts
|
|
3731
3303
|
factory<T>(
|
|
3732
|
-
this
|
|
3733
|
-
params
|
|
3734
|
-
labels
|
|
3304
|
+
this: Creatable<T>,
|
|
3305
|
+
params?: Partial<T["params"]>,
|
|
3306
|
+
labels?: Labels): CreatableFactory<T>;
|
|
3735
3307
|
```
|
|
3736
3308
|
|
|
3737
3309
|
Creates a factory with the given default params and labels.
|
|
3738
3310
|
|
|
3739
3311
|
### Type Parameters
|
|
3740
3312
|
|
|
3741
|
-
|
|
3742
|
-
|
|
3743
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
3313
|
+
| Type Parameter |
|
|
3314
|
+
| ------ |
|
|
3315
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3744
3316
|
|
|
3745
3317
|
### Parameters
|
|
3746
3318
|
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
[`Creatable`](#Creatable)\<`T`\>
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
3754
|
-
|
|
3755
|
-
#### labels?
|
|
3756
|
-
|
|
3757
|
-
[`Labels`](#Labels)
|
|
3319
|
+
| Parameter | Type |
|
|
3320
|
+
| ------ | ------ |
|
|
3321
|
+
| `this` | [`Creatable`](#Creatable)\<`T`\> |
|
|
3322
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3323
|
+
| `labels?` | [`Labels`](#Labels) |
|
|
3758
3324
|
|
|
3759
3325
|
### Returns
|
|
3760
3326
|
|
|
@@ -3792,71 +3358,19 @@ The minimum required parameters for constructing a creatable.
|
|
|
3792
3358
|
|
|
3793
3359
|
## Type Parameters
|
|
3794
3360
|
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
`TAdditionalStatus` *extends* [`CreatableStatus`](#../type-aliases/CreatableStatus) \| `void`
|
|
3361
|
+
| Type Parameter | Default type |
|
|
3362
|
+
| ------ | ------ |
|
|
3363
|
+
| `TAdditionalStatus` *extends* [`CreatableStatus`](#../type-aliases/CreatableStatus) \| `void` | `void` |
|
|
3798
3364
|
|
|
3799
3365
|
## Properties
|
|
3800
3366
|
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
```ts
|
|
3810
|
-
BaseEmitterParams.logger
|
|
3811
|
-
```
|
|
3812
|
-
|
|
3813
|
-
***
|
|
3814
|
-
|
|
3815
|
-
### meterProvider?
|
|
3816
|
-
|
|
3817
|
-
```ts
|
|
3818
|
-
optional meterProvider: MeterProvider;
|
|
3819
|
-
```
|
|
3820
|
-
|
|
3821
|
-
### Inherited from
|
|
3822
|
-
|
|
3823
|
-
```ts
|
|
3824
|
-
BaseEmitterParams.meterProvider
|
|
3825
|
-
```
|
|
3826
|
-
|
|
3827
|
-
***
|
|
3828
|
-
|
|
3829
|
-
### traceProvider?
|
|
3830
|
-
|
|
3831
|
-
```ts
|
|
3832
|
-
optional traceProvider: TracerProvider;
|
|
3833
|
-
```
|
|
3834
|
-
|
|
3835
|
-
### Inherited from
|
|
3836
|
-
|
|
3837
|
-
```ts
|
|
3838
|
-
BaseEmitterParams.traceProvider
|
|
3839
|
-
```
|
|
3840
|
-
|
|
3841
|
-
***
|
|
3842
|
-
|
|
3843
|
-
### name?
|
|
3844
|
-
|
|
3845
|
-
```ts
|
|
3846
|
-
optional name: CreatableName;
|
|
3847
|
-
```
|
|
3848
|
-
|
|
3849
|
-
Optional name identifying this creatable instance.
|
|
3850
|
-
|
|
3851
|
-
***
|
|
3852
|
-
|
|
3853
|
-
### statusReporter?
|
|
3854
|
-
|
|
3855
|
-
```ts
|
|
3856
|
-
optional statusReporter: CreatableStatusReporter<TAdditionalStatus>;
|
|
3857
|
-
```
|
|
3858
|
-
|
|
3859
|
-
Optional reporter for broadcasting status changes.
|
|
3367
|
+
| Property | Type | Description | Inherited from |
|
|
3368
|
+
| ------ | ------ | ------ | ------ |
|
|
3369
|
+
| <a id="logger"></a> `logger?` | `Logger` | - | `BaseEmitterParams.logger` |
|
|
3370
|
+
| <a id="meterprovider"></a> `meterProvider?` | `MeterProvider` | - | `BaseEmitterParams.meterProvider` |
|
|
3371
|
+
| <a id="traceprovider"></a> `traceProvider?` | `TracerProvider` | - | `BaseEmitterParams.traceProvider` |
|
|
3372
|
+
| <a id="name"></a> `name?` | [`CreatableName`](#../type-aliases/CreatableName) | Optional name identifying this creatable instance. | - |
|
|
3373
|
+
| <a id="statusreporter"></a> `statusReporter?` | [`CreatableStatusReporter`](#CreatableStatusReporter)\<`TAdditionalStatus`\> | Optional reporter for broadcasting status changes. | - |
|
|
3860
3374
|
|
|
3861
3375
|
### <a id="WithLabels"></a>WithLabels
|
|
3862
3376
|
|
|
@@ -3868,17 +3382,15 @@ Interface for objects that have labels.
|
|
|
3868
3382
|
|
|
3869
3383
|
## Type Parameters
|
|
3870
3384
|
|
|
3871
|
-
|
|
3872
|
-
|
|
3873
|
-
`T` *extends* [`Labels`](#Labels)
|
|
3385
|
+
| Type Parameter | Default type |
|
|
3386
|
+
| ------ | ------ |
|
|
3387
|
+
| `T` *extends* [`Labels`](#Labels) | [`Labels`](#Labels) |
|
|
3874
3388
|
|
|
3875
3389
|
## Properties
|
|
3876
3390
|
|
|
3877
|
-
|
|
3878
|
-
|
|
3879
|
-
|
|
3880
|
-
labels: T;
|
|
3881
|
-
```
|
|
3391
|
+
| Property | Type |
|
|
3392
|
+
| ------ | ------ |
|
|
3393
|
+
| <a id="labels"></a> `labels` | `T` |
|
|
3882
3394
|
|
|
3883
3395
|
### <a id="WithOptionalLabels"></a>WithOptionalLabels
|
|
3884
3396
|
|
|
@@ -3890,17 +3402,15 @@ Interface for objects that have labels.
|
|
|
3890
3402
|
|
|
3891
3403
|
## Type Parameters
|
|
3892
3404
|
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
`T` *extends* [`Labels`](#Labels)
|
|
3405
|
+
| Type Parameter | Default type |
|
|
3406
|
+
| ------ | ------ |
|
|
3407
|
+
| `T` *extends* [`Labels`](#Labels) | [`Labels`](#Labels) |
|
|
3896
3408
|
|
|
3897
3409
|
## Properties
|
|
3898
3410
|
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
optional labels: T;
|
|
3903
|
-
```
|
|
3411
|
+
| Property | Type |
|
|
3412
|
+
| ------ | ------ |
|
|
3413
|
+
| <a id="labels"></a> `labels?` | `T` |
|
|
3904
3414
|
|
|
3905
3415
|
### type-aliases
|
|
3906
3416
|
|
|
@@ -3932,9 +3442,9 @@ A creatable's status, optionally extended with additional custom status values.
|
|
|
3932
3442
|
|
|
3933
3443
|
## Type Parameters
|
|
3934
3444
|
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
`TAdditionalStatus` *extends* `void` \| `string`
|
|
3445
|
+
| Type Parameter | Default type |
|
|
3446
|
+
| ------ | ------ |
|
|
3447
|
+
| `TAdditionalStatus` *extends* `void` \| `string` | `void` |
|
|
3938
3448
|
|
|
3939
3449
|
### <a id="StandardCreatableStatus"></a>StandardCreatableStatus
|
|
3940
3450
|
|