@xylabs/creatable 5.0.84 → 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 +656 -1280
- 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,79 +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
|
-
Type-level reference to the event data shape for external type queries.
|
|
182
|
-
|
|
183
|
-
### Inherited from
|
|
184
|
-
|
|
185
|
-
```ts
|
|
186
|
-
BaseEmitter.eventData
|
|
187
|
-
```
|
|
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` |
|
|
188
127
|
|
|
189
128
|
## Accessors
|
|
190
129
|
|
|
@@ -203,14 +142,14 @@ get static historyInterval(): number;
|
|
|
203
142
|
### Set Signature
|
|
204
143
|
|
|
205
144
|
```ts
|
|
206
|
-
set static historyInterval(value): void;
|
|
145
|
+
set static historyInterval(value: number): void;
|
|
207
146
|
```
|
|
208
147
|
|
|
209
148
|
#### Parameters
|
|
210
149
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
`number`
|
|
150
|
+
| Parameter | Type |
|
|
151
|
+
| ------ | ------ |
|
|
152
|
+
| `value` | `number` |
|
|
214
153
|
|
|
215
154
|
#### Returns
|
|
216
155
|
|
|
@@ -239,14 +178,14 @@ get static historyTime(): number;
|
|
|
239
178
|
### Set Signature
|
|
240
179
|
|
|
241
180
|
```ts
|
|
242
|
-
set static historyTime(value): void;
|
|
181
|
+
set static historyTime(value: number): void;
|
|
243
182
|
```
|
|
244
183
|
|
|
245
184
|
#### Parameters
|
|
246
185
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
`number`
|
|
186
|
+
| Parameter | Type |
|
|
187
|
+
| ------ | ------ |
|
|
188
|
+
| `value` | `number` |
|
|
250
189
|
|
|
251
190
|
#### Returns
|
|
252
191
|
|
|
@@ -275,14 +214,14 @@ get static maxGcFrequency(): number;
|
|
|
275
214
|
### Set Signature
|
|
276
215
|
|
|
277
216
|
```ts
|
|
278
|
-
set static maxGcFrequency(value): void;
|
|
217
|
+
set static maxGcFrequency(value: number): void;
|
|
279
218
|
```
|
|
280
219
|
|
|
281
220
|
#### Parameters
|
|
282
221
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
`number`
|
|
222
|
+
| Parameter | Type |
|
|
223
|
+
| ------ | ------ |
|
|
224
|
+
| `value` | `number` |
|
|
286
225
|
|
|
287
226
|
#### Returns
|
|
288
227
|
|
|
@@ -470,14 +409,14 @@ The status reporter used to broadcast lifecycle changes.
|
|
|
470
409
|
### Call Signature
|
|
471
410
|
|
|
472
411
|
```ts
|
|
473
|
-
static gc(force
|
|
412
|
+
static gc(force?: boolean): void;
|
|
474
413
|
```
|
|
475
414
|
|
|
476
415
|
#### Parameters
|
|
477
416
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
`boolean`
|
|
417
|
+
| Parameter | Type |
|
|
418
|
+
| ------ | ------ |
|
|
419
|
+
| `force?` | `boolean` |
|
|
481
420
|
|
|
482
421
|
#### Returns
|
|
483
422
|
|
|
@@ -492,14 +431,14 @@ BaseEmitter.gc
|
|
|
492
431
|
### Call Signature
|
|
493
432
|
|
|
494
433
|
```ts
|
|
495
|
-
static gc(className): void;
|
|
434
|
+
static gc(className: BaseClassName): void;
|
|
496
435
|
```
|
|
497
436
|
|
|
498
437
|
#### Parameters
|
|
499
438
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
`BaseClassName`
|
|
439
|
+
| Parameter | Type |
|
|
440
|
+
| ------ | ------ |
|
|
441
|
+
| `className` | `BaseClassName` |
|
|
503
442
|
|
|
504
443
|
#### Returns
|
|
505
444
|
|
|
@@ -516,14 +455,14 @@ BaseEmitter.gc
|
|
|
516
455
|
### instanceCount()
|
|
517
456
|
|
|
518
457
|
```ts
|
|
519
|
-
static instanceCount(className): number;
|
|
458
|
+
static instanceCount(className: BaseClassName): number;
|
|
520
459
|
```
|
|
521
460
|
|
|
522
461
|
### Parameters
|
|
523
462
|
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
`BaseClassName`
|
|
463
|
+
| Parameter | Type |
|
|
464
|
+
| ------ | ------ |
|
|
465
|
+
| `className` | `BaseClassName` |
|
|
527
466
|
|
|
528
467
|
### Returns
|
|
529
468
|
|
|
@@ -594,7 +533,7 @@ BaseEmitter.stopHistory
|
|
|
594
533
|
### create()
|
|
595
534
|
|
|
596
535
|
```ts
|
|
597
|
-
static create<T>(this
|
|
536
|
+
static create<T>(this: Creatable<T>, inParams?: Partial<T["params"]>): Promise<T>;
|
|
598
537
|
```
|
|
599
538
|
|
|
600
539
|
Asynchronously creates a new instance by processing params, constructing,
|
|
@@ -602,21 +541,16 @@ and running both static and instance createHandlers.
|
|
|
602
541
|
|
|
603
542
|
### Type Parameters
|
|
604
543
|
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
544
|
+
| Type Parameter |
|
|
545
|
+
| ------ |
|
|
546
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
608
547
|
|
|
609
548
|
### Parameters
|
|
610
549
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
614
|
-
|
|
615
|
-
#### inParams?
|
|
616
|
-
|
|
617
|
-
`Partial`\<`T`\[`"params"`\]\> = `{}`
|
|
618
|
-
|
|
619
|
-
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 |
|
|
620
554
|
|
|
621
555
|
### Returns
|
|
622
556
|
|
|
@@ -629,7 +563,7 @@ The fully initialized instance
|
|
|
629
563
|
### createHandler()
|
|
630
564
|
|
|
631
565
|
```ts
|
|
632
|
-
static createHandler<T>(this
|
|
566
|
+
static createHandler<T>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
633
567
|
```
|
|
634
568
|
|
|
635
569
|
Static hook called during creation to perform additional initialization.
|
|
@@ -637,21 +571,16 @@ Override in subclasses to customize post-construction setup.
|
|
|
637
571
|
|
|
638
572
|
### Type Parameters
|
|
639
573
|
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
574
|
+
| Type Parameter |
|
|
575
|
+
| ------ |
|
|
576
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
643
577
|
|
|
644
578
|
### Parameters
|
|
645
579
|
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
649
|
-
|
|
650
|
-
#### instance
|
|
651
|
-
|
|
652
|
-
`T`
|
|
653
|
-
|
|
654
|
-
The newly constructed instance
|
|
580
|
+
| Parameter | Type | Description |
|
|
581
|
+
| ------ | ------ | ------ |
|
|
582
|
+
| `this` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | - |
|
|
583
|
+
| `instance` | `T` | The newly constructed instance |
|
|
655
584
|
|
|
656
585
|
### Returns
|
|
657
586
|
|
|
@@ -664,7 +593,7 @@ The instance, potentially modified
|
|
|
664
593
|
### paramsHandler()
|
|
665
594
|
|
|
666
595
|
```ts
|
|
667
|
-
static paramsHandler<T>(this
|
|
596
|
+
static paramsHandler<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promisable<T["params"]>;
|
|
668
597
|
```
|
|
669
598
|
|
|
670
599
|
Static hook called during creation to validate and transform params.
|
|
@@ -672,21 +601,16 @@ Override in subclasses to add default values or validation.
|
|
|
672
601
|
|
|
673
602
|
### Type Parameters
|
|
674
603
|
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
604
|
+
| Type Parameter |
|
|
605
|
+
| ------ |
|
|
606
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
678
607
|
|
|
679
608
|
### Parameters
|
|
680
609
|
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
684
|
-
|
|
685
|
-
#### params?
|
|
686
|
-
|
|
687
|
-
`Partial`\<`T`\[`"params"`\]\> = `{}`
|
|
688
|
-
|
|
689
|
-
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` |
|
|
690
614
|
|
|
691
615
|
### Returns
|
|
692
616
|
|
|
@@ -713,7 +637,7 @@ Instance-level creation hook. Override in subclasses to perform setup after cons
|
|
|
713
637
|
### paramsValidator()
|
|
714
638
|
|
|
715
639
|
```ts
|
|
716
|
-
paramsValidator(params): TParams & RequiredCreatableParams<void>;
|
|
640
|
+
paramsValidator(params: Partial<TParams & RequiredCreatableParams>): TParams & RequiredCreatableParams<void>;
|
|
717
641
|
```
|
|
718
642
|
|
|
719
643
|
Validates and returns the merged params, ensuring required fields are present.
|
|
@@ -721,11 +645,9 @@ Override in subclasses to add custom validation logic.
|
|
|
721
645
|
|
|
722
646
|
### Parameters
|
|
723
647
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
`Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\>
|
|
727
|
-
|
|
728
|
-
The raw partial params to validate
|
|
648
|
+
| Parameter | Type | Description |
|
|
649
|
+
| ------ | ------ | ------ |
|
|
650
|
+
| `params` | `Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\> | The raw partial params to validate |
|
|
729
651
|
|
|
730
652
|
### Returns
|
|
731
653
|
|
|
@@ -738,30 +660,23 @@ The validated params
|
|
|
738
660
|
### span()
|
|
739
661
|
|
|
740
662
|
```ts
|
|
741
|
-
span<T>(name, fn): T;
|
|
663
|
+
span<T>(name: string, fn: () => T): T;
|
|
742
664
|
```
|
|
743
665
|
|
|
744
666
|
Executes a function within a telemetry span.
|
|
745
667
|
|
|
746
668
|
### Type Parameters
|
|
747
669
|
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
`T`
|
|
670
|
+
| Type Parameter |
|
|
671
|
+
| ------ |
|
|
672
|
+
| `T` |
|
|
751
673
|
|
|
752
674
|
### Parameters
|
|
753
675
|
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
`string`
|
|
757
|
-
|
|
758
|
-
The span name
|
|
759
|
-
|
|
760
|
-
#### fn
|
|
761
|
-
|
|
762
|
-
() => `T`
|
|
763
|
-
|
|
764
|
-
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 |
|
|
765
680
|
|
|
766
681
|
### Returns
|
|
767
682
|
|
|
@@ -773,38 +688,26 @@ The function to execute within the span
|
|
|
773
688
|
|
|
774
689
|
```ts
|
|
775
690
|
spanAsync<T>(
|
|
776
|
-
name,
|
|
777
|
-
fn
|
|
778
|
-
config
|
|
691
|
+
name: string,
|
|
692
|
+
fn: () => Promise<T>,
|
|
693
|
+
config?: SpanConfig): Promise<T>;
|
|
779
694
|
```
|
|
780
695
|
|
|
781
696
|
Executes an async function within a telemetry span.
|
|
782
697
|
|
|
783
698
|
### Type Parameters
|
|
784
699
|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
`T`
|
|
700
|
+
| Type Parameter |
|
|
701
|
+
| ------ |
|
|
702
|
+
| `T` |
|
|
788
703
|
|
|
789
704
|
### Parameters
|
|
790
705
|
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
`string`
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
#### fn
|
|
798
|
-
|
|
799
|
-
() => `Promise`\<`T`\>
|
|
800
|
-
|
|
801
|
-
The async function to execute within the span
|
|
802
|
-
|
|
803
|
-
#### config?
|
|
804
|
-
|
|
805
|
-
`SpanConfig` = `{}`
|
|
806
|
-
|
|
807
|
-
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 |
|
|
808
711
|
|
|
809
712
|
### Returns
|
|
810
713
|
|
|
@@ -830,7 +733,7 @@ Thread-safe via mutex. Returns true if already started or started successfully.
|
|
|
830
733
|
### started()
|
|
831
734
|
|
|
832
735
|
```ts
|
|
833
|
-
started(notStartedAction
|
|
736
|
+
started(notStartedAction?: "error" | "throw" | "warn" | "log" | "none"): boolean;
|
|
834
737
|
```
|
|
835
738
|
|
|
836
739
|
Checks whether this instance is currently started.
|
|
@@ -838,11 +741,9 @@ Takes an action if not started, based on the notStartedAction parameter.
|
|
|
838
741
|
|
|
839
742
|
### Parameters
|
|
840
743
|
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
What to do if not started: 'error'/'throw' throws, 'warn'/'log' logs, 'none' is silent
|
|
844
|
-
|
|
845
|
-
`"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 |
|
|
846
747
|
|
|
847
748
|
### Returns
|
|
848
749
|
|
|
@@ -855,24 +756,17 @@ True if started, false otherwise
|
|
|
855
756
|
### startedAsync()
|
|
856
757
|
|
|
857
758
|
```ts
|
|
858
|
-
startedAsync(notStartedAction
|
|
759
|
+
startedAsync(notStartedAction?: "error" | "throw" | "warn" | "log" | "none", tryStart?: boolean): Promise<boolean>;
|
|
859
760
|
```
|
|
860
761
|
|
|
861
762
|
Async version of `started` that can optionally auto-start the instance.
|
|
862
763
|
|
|
863
764
|
### Parameters
|
|
864
765
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
What to do if not started and auto-start is disabled
|
|
868
|
-
|
|
869
|
-
`"error"` | `"throw"` | `"warn"` | `"log"` | `"none"`
|
|
870
|
-
|
|
871
|
-
#### tryStart?
|
|
872
|
-
|
|
873
|
-
`boolean` = `true`
|
|
874
|
-
|
|
875
|
-
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 |
|
|
876
770
|
|
|
877
771
|
### Returns
|
|
878
772
|
|
|
@@ -900,7 +794,7 @@ Thread-safe via mutex. Returns true if already stopped or stopped successfully.
|
|
|
900
794
|
### \_noOverride()
|
|
901
795
|
|
|
902
796
|
```ts
|
|
903
|
-
protected _noOverride(functionName
|
|
797
|
+
protected _noOverride(functionName?: string): void;
|
|
904
798
|
```
|
|
905
799
|
|
|
906
800
|
Asserts that the given function has not been overridden in a subclass.
|
|
@@ -908,9 +802,9 @@ Used to enforce the handler pattern (override `startHandler` not `start`).
|
|
|
908
802
|
|
|
909
803
|
### Parameters
|
|
910
804
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
`string`
|
|
805
|
+
| Parameter | Type |
|
|
806
|
+
| ------ | ------ |
|
|
807
|
+
| `functionName` | `string` |
|
|
914
808
|
|
|
915
809
|
### Returns
|
|
916
810
|
|
|
@@ -923,20 +817,17 @@ Used to enforce the handler pattern (override `startHandler` not `start`).
|
|
|
923
817
|
### Call Signature
|
|
924
818
|
|
|
925
819
|
```ts
|
|
926
|
-
protected setStatus(value, progress
|
|
820
|
+
protected setStatus(value: "creating" | "created" | "starting" | "started" | "stopping" | "stopped", progress?: number): void;
|
|
927
821
|
```
|
|
928
822
|
|
|
929
823
|
Sets the lifecycle status and reports it via the status reporter.
|
|
930
824
|
|
|
931
825
|
#### Parameters
|
|
932
826
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
`"creating"`
|
|
936
|
-
|
|
937
|
-
##### progress?
|
|
938
|
-
|
|
939
|
-
`number`
|
|
827
|
+
| Parameter | Type |
|
|
828
|
+
| ------ | ------ |
|
|
829
|
+
| `value` | `"creating"` \| `"created"` \| `"starting"` \| `"started"` \| `"stopping"` \| `"stopped"` |
|
|
830
|
+
| `progress?` | `number` |
|
|
940
831
|
|
|
941
832
|
#### Returns
|
|
942
833
|
|
|
@@ -945,20 +836,17 @@ Sets the lifecycle status and reports it via the status reporter.
|
|
|
945
836
|
### Call Signature
|
|
946
837
|
|
|
947
838
|
```ts
|
|
948
|
-
protected setStatus(value, error
|
|
839
|
+
protected setStatus(value: "error", error?: Error): void;
|
|
949
840
|
```
|
|
950
841
|
|
|
951
842
|
Sets the lifecycle status and reports it via the status reporter.
|
|
952
843
|
|
|
953
844
|
#### Parameters
|
|
954
845
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
`"error"`
|
|
958
|
-
|
|
959
|
-
##### error?
|
|
960
|
-
|
|
961
|
-
`Error`
|
|
846
|
+
| Parameter | Type |
|
|
847
|
+
| ------ | ------ |
|
|
848
|
+
| `value` | `"error"` |
|
|
849
|
+
| `error?` | `Error` |
|
|
962
850
|
|
|
963
851
|
#### Returns
|
|
964
852
|
|
|
@@ -997,18 +885,16 @@ Override in subclasses to define stop behavior. Throw an error on failure.
|
|
|
997
885
|
### clearListeners()
|
|
998
886
|
|
|
999
887
|
```ts
|
|
1000
|
-
clearListeners(eventNames): this;
|
|
888
|
+
clearListeners(eventNames: keyof TEventData | keyof TEventData[]): this;
|
|
1001
889
|
```
|
|
1002
890
|
|
|
1003
891
|
Removes all listeners for the specified event name(s).
|
|
1004
892
|
|
|
1005
893
|
### Parameters
|
|
1006
894
|
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
One or more event names to clear listeners for.
|
|
1010
|
-
|
|
1011
|
-
keyof `TEventData` | keyof `TEventData`[]
|
|
895
|
+
| Parameter | Type | Description |
|
|
896
|
+
| ------ | ------ | ------ |
|
|
897
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] | One or more event names to clear listeners for. |
|
|
1012
898
|
|
|
1013
899
|
### Returns
|
|
1014
900
|
|
|
@@ -1027,34 +913,24 @@ BaseEmitter.clearListeners
|
|
|
1027
913
|
### emit()
|
|
1028
914
|
|
|
1029
915
|
```ts
|
|
1030
|
-
emit<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
916
|
+
emit<TEventName, TEventArgs>(eventName: TEventName, eventArgs: TEventArgs): Promise<void>;
|
|
1031
917
|
```
|
|
1032
918
|
|
|
1033
919
|
Emits an event, invoking all registered listeners concurrently.
|
|
1034
920
|
|
|
1035
921
|
### Type Parameters
|
|
1036
922
|
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
1040
|
-
|
|
1041
|
-
#### TEventArgs
|
|
1042
|
-
|
|
1043
|
-
`TEventArgs` *extends* `EventArgs` = `TEventData`\[`TEventName`\]
|
|
923
|
+
| Type Parameter | Default type |
|
|
924
|
+
| ------ | ------ |
|
|
925
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` | keyof `TEventData` |
|
|
926
|
+
| `TEventArgs` *extends* `EventArgs` | `TEventData`\[`TEventName`\] |
|
|
1044
927
|
|
|
1045
928
|
### Parameters
|
|
1046
929
|
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
`TEventName`
|
|
1050
|
-
|
|
1051
|
-
The event to emit.
|
|
1052
|
-
|
|
1053
|
-
#### eventArgs
|
|
1054
|
-
|
|
1055
|
-
`TEventArgs`
|
|
1056
|
-
|
|
1057
|
-
The data to pass to listeners.
|
|
930
|
+
| Parameter | Type | Description |
|
|
931
|
+
| ------ | ------ | ------ |
|
|
932
|
+
| `eventName` | `TEventName` | The event to emit. |
|
|
933
|
+
| `eventArgs` | `TEventArgs` | The data to pass to listeners. |
|
|
1058
934
|
|
|
1059
935
|
### Returns
|
|
1060
936
|
|
|
@@ -1071,34 +947,24 @@ BaseEmitter.emit
|
|
|
1071
947
|
### emitSerial()
|
|
1072
948
|
|
|
1073
949
|
```ts
|
|
1074
|
-
emitSerial<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
950
|
+
emitSerial<TEventName, TEventArgs>(eventName: TEventName, eventArgs: TEventArgs): Promise<void>;
|
|
1075
951
|
```
|
|
1076
952
|
|
|
1077
953
|
Emits an event, invoking all registered listeners sequentially in order.
|
|
1078
954
|
|
|
1079
955
|
### Type Parameters
|
|
1080
956
|
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
1084
|
-
|
|
1085
|
-
#### TEventArgs
|
|
1086
|
-
|
|
1087
|
-
`TEventArgs` *extends* `EventArgs` = `TEventData`\[`TEventName`\]
|
|
957
|
+
| Type Parameter | Default type |
|
|
958
|
+
| ------ | ------ |
|
|
959
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` | keyof `TEventData` |
|
|
960
|
+
| `TEventArgs` *extends* `EventArgs` | `TEventData`\[`TEventName`\] |
|
|
1088
961
|
|
|
1089
962
|
### Parameters
|
|
1090
963
|
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
`TEventName`
|
|
1094
|
-
|
|
1095
|
-
The event to emit.
|
|
1096
|
-
|
|
1097
|
-
#### eventArgs
|
|
1098
|
-
|
|
1099
|
-
`TEventArgs`
|
|
1100
|
-
|
|
1101
|
-
The data to pass to listeners.
|
|
964
|
+
| Parameter | Type | Description |
|
|
965
|
+
| ------ | ------ | ------ |
|
|
966
|
+
| `eventName` | `TEventName` | The event to emit. |
|
|
967
|
+
| `eventArgs` | `TEventArgs` | The data to pass to listeners. |
|
|
1102
968
|
|
|
1103
969
|
### Returns
|
|
1104
970
|
|
|
@@ -1115,18 +981,16 @@ BaseEmitter.emitSerial
|
|
|
1115
981
|
### listenerCount()
|
|
1116
982
|
|
|
1117
983
|
```ts
|
|
1118
|
-
listenerCount(eventNames): number;
|
|
984
|
+
listenerCount(eventNames: keyof TEventData | keyof TEventData[]): number;
|
|
1119
985
|
```
|
|
1120
986
|
|
|
1121
987
|
Returns the total number of listeners registered for the specified event name(s).
|
|
1122
988
|
|
|
1123
989
|
### Parameters
|
|
1124
990
|
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
One or more event names to count listeners for.
|
|
1128
|
-
|
|
1129
|
-
keyof `TEventData` | keyof `TEventData`[]
|
|
991
|
+
| Parameter | Type | Description |
|
|
992
|
+
| ------ | ------ | ------ |
|
|
993
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] | One or more event names to count listeners for. |
|
|
1130
994
|
|
|
1131
995
|
### Returns
|
|
1132
996
|
|
|
@@ -1145,30 +1009,23 @@ BaseEmitter.listenerCount
|
|
|
1145
1009
|
### off()
|
|
1146
1010
|
|
|
1147
1011
|
```ts
|
|
1148
|
-
off<TEventName>(eventNames, listener): void;
|
|
1012
|
+
off<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): void;
|
|
1149
1013
|
```
|
|
1150
1014
|
|
|
1151
1015
|
Removes a specific listener from the specified event name(s).
|
|
1152
1016
|
|
|
1153
1017
|
### Type Parameters
|
|
1154
1018
|
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
1019
|
+
| Type Parameter |
|
|
1020
|
+
| ------ |
|
|
1021
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
1158
1022
|
|
|
1159
1023
|
### Parameters
|
|
1160
1024
|
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
One or more event names to unsubscribe from.
|
|
1164
|
-
|
|
1165
|
-
`TEventName` | `TEventName`[]
|
|
1166
|
-
|
|
1167
|
-
#### listener
|
|
1168
|
-
|
|
1169
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
1170
|
-
|
|
1171
|
-
The listener to remove.
|
|
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. |
|
|
1172
1029
|
|
|
1173
1030
|
### Returns
|
|
1174
1031
|
|
|
@@ -1185,18 +1042,16 @@ BaseEmitter.off
|
|
|
1185
1042
|
### offAny()
|
|
1186
1043
|
|
|
1187
1044
|
```ts
|
|
1188
|
-
offAny(listener): void;
|
|
1045
|
+
offAny(listener: EventAnyListener): void;
|
|
1189
1046
|
```
|
|
1190
1047
|
|
|
1191
1048
|
Removes a wildcard listener that was receiving all events.
|
|
1192
1049
|
|
|
1193
1050
|
### Parameters
|
|
1194
1051
|
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
`EventAnyListener`
|
|
1198
|
-
|
|
1199
|
-
The wildcard listener to remove.
|
|
1052
|
+
| Parameter | Type | Description |
|
|
1053
|
+
| ------ | ------ | ------ |
|
|
1054
|
+
| `listener` | `EventAnyListener` | The wildcard listener to remove. |
|
|
1200
1055
|
|
|
1201
1056
|
### Returns
|
|
1202
1057
|
|
|
@@ -1213,30 +1068,23 @@ BaseEmitter.offAny
|
|
|
1213
1068
|
### on()
|
|
1214
1069
|
|
|
1215
1070
|
```ts
|
|
1216
|
-
on<TEventName>(eventNames, listener): () => void;
|
|
1071
|
+
on<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): () => void;
|
|
1217
1072
|
```
|
|
1218
1073
|
|
|
1219
1074
|
Subscribes a listener to the specified event name(s).
|
|
1220
1075
|
|
|
1221
1076
|
### Type Parameters
|
|
1222
1077
|
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
1078
|
+
| Type Parameter |
|
|
1079
|
+
| ------ |
|
|
1080
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
1226
1081
|
|
|
1227
1082
|
### Parameters
|
|
1228
1083
|
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
One or more event names to listen for.
|
|
1232
|
-
|
|
1233
|
-
`TEventName` | `TEventName`[]
|
|
1234
|
-
|
|
1235
|
-
#### listener
|
|
1236
|
-
|
|
1237
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
1238
|
-
|
|
1239
|
-
The callback to invoke when the event fires.
|
|
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. |
|
|
1240
1088
|
|
|
1241
1089
|
### Returns
|
|
1242
1090
|
|
|
@@ -1261,18 +1109,16 @@ BaseEmitter.on
|
|
|
1261
1109
|
### onAny()
|
|
1262
1110
|
|
|
1263
1111
|
```ts
|
|
1264
|
-
onAny(listener): () => void;
|
|
1112
|
+
onAny(listener: EventAnyListener): () => void;
|
|
1265
1113
|
```
|
|
1266
1114
|
|
|
1267
1115
|
Subscribes a wildcard listener that receives all events.
|
|
1268
1116
|
|
|
1269
1117
|
### Parameters
|
|
1270
1118
|
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
`EventAnyListener`
|
|
1274
|
-
|
|
1275
|
-
The callback to invoke for any event.
|
|
1119
|
+
| Parameter | Type | Description |
|
|
1120
|
+
| ------ | ------ | ------ |
|
|
1121
|
+
| `listener` | `EventAnyListener` | The callback to invoke for any event. |
|
|
1276
1122
|
|
|
1277
1123
|
### Returns
|
|
1278
1124
|
|
|
@@ -1297,30 +1143,23 @@ BaseEmitter.onAny
|
|
|
1297
1143
|
### once()
|
|
1298
1144
|
|
|
1299
1145
|
```ts
|
|
1300
|
-
once<TEventName>(eventName, listener): () => void;
|
|
1146
|
+
once<TEventName>(eventName: TEventName, listener: EventListener<TEventData[TEventName]>): () => void;
|
|
1301
1147
|
```
|
|
1302
1148
|
|
|
1303
1149
|
Subscribes a listener that will be invoked only once for the specified event, then automatically removed.
|
|
1304
1150
|
|
|
1305
1151
|
### Type Parameters
|
|
1306
1152
|
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
1153
|
+
| Type Parameter |
|
|
1154
|
+
| ------ |
|
|
1155
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
1310
1156
|
|
|
1311
1157
|
### Parameters
|
|
1312
1158
|
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
`TEventName`
|
|
1316
|
-
|
|
1317
|
-
The event to listen for.
|
|
1318
|
-
|
|
1319
|
-
#### listener
|
|
1320
|
-
|
|
1321
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
1322
|
-
|
|
1323
|
-
The callback to invoke once.
|
|
1159
|
+
| Parameter | Type | Description |
|
|
1160
|
+
| ------ | ------ | ------ |
|
|
1161
|
+
| `eventName` | `TEventName` | The event to listen for. |
|
|
1162
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> | The callback to invoke once. |
|
|
1324
1163
|
|
|
1325
1164
|
### Returns
|
|
1326
1165
|
|
|
@@ -1355,31 +1194,25 @@ pre-configured CreatableFactory instances.
|
|
|
1355
1194
|
|
|
1356
1195
|
## Type Parameters
|
|
1357
1196
|
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
`TParams` *extends* [`CreatableParams`](#../interfaces/CreatableParams)
|
|
1361
|
-
|
|
1362
|
-
### TEventData
|
|
1363
|
-
|
|
1364
|
-
`TEventData` *extends* `EventData` = `EventData`
|
|
1197
|
+
| Type Parameter | Default type |
|
|
1198
|
+
| ------ | ------ |
|
|
1199
|
+
| `TParams` *extends* [`CreatableParams`](#../interfaces/CreatableParams) | [`CreatableParams`](#../interfaces/CreatableParams) |
|
|
1200
|
+
| `TEventData` *extends* `EventData` | `EventData` |
|
|
1365
1201
|
|
|
1366
1202
|
## Constructors
|
|
1367
1203
|
|
|
1368
1204
|
### Constructor
|
|
1369
1205
|
|
|
1370
1206
|
```ts
|
|
1371
|
-
new AbstractCreatableWithFactory<TParams, TEventData>(key, params): AbstractCreatableWithFactory<TParams, TEventData>;
|
|
1207
|
+
new AbstractCreatableWithFactory<TParams, TEventData>(key: unknown, params: Partial<TParams & RequiredCreatableParams>): AbstractCreatableWithFactory<TParams, TEventData>;
|
|
1372
1208
|
```
|
|
1373
1209
|
|
|
1374
1210
|
### Parameters
|
|
1375
1211
|
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
`unknown`
|
|
1379
|
-
|
|
1380
|
-
#### params
|
|
1381
|
-
|
|
1382
|
-
`Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\>
|
|
1212
|
+
| Parameter | Type |
|
|
1213
|
+
| ------ | ------ |
|
|
1214
|
+
| `key` | `unknown` |
|
|
1215
|
+
| `params` | `Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\> |
|
|
1383
1216
|
|
|
1384
1217
|
### Returns
|
|
1385
1218
|
|
|
@@ -1391,79 +1224,14 @@ new AbstractCreatableWithFactory<TParams, TEventData>(key, params): AbstractCrea
|
|
|
1391
1224
|
|
|
1392
1225
|
## Properties
|
|
1393
1226
|
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
[`AbstractCreatable`](#AbstractCreatable).[`defaultLogger`](AbstractCreatable.md#defaultlogger)
|
|
1403
|
-
|
|
1404
|
-
***
|
|
1405
|
-
|
|
1406
|
-
### globalInstances
|
|
1407
|
-
|
|
1408
|
-
```ts
|
|
1409
|
-
readonly static globalInstances: Record<BaseClassName, WeakRef<Base>[]>;
|
|
1410
|
-
```
|
|
1411
|
-
|
|
1412
|
-
### Inherited from
|
|
1413
|
-
|
|
1414
|
-
[`AbstractCreatable`](#AbstractCreatable).[`globalInstances`](AbstractCreatable.md#globalinstances)
|
|
1415
|
-
|
|
1416
|
-
***
|
|
1417
|
-
|
|
1418
|
-
### globalInstancesCountHistory
|
|
1419
|
-
|
|
1420
|
-
```ts
|
|
1421
|
-
readonly static globalInstancesCountHistory: Record<BaseClassName, number[]>;
|
|
1422
|
-
```
|
|
1423
|
-
|
|
1424
|
-
### Inherited from
|
|
1425
|
-
|
|
1426
|
-
[`AbstractCreatable`](#AbstractCreatable).[`globalInstancesCountHistory`](AbstractCreatable.md#globalinstancescounthistory)
|
|
1427
|
-
|
|
1428
|
-
***
|
|
1429
|
-
|
|
1430
|
-
### defaultLogger?
|
|
1431
|
-
|
|
1432
|
-
```ts
|
|
1433
|
-
optional defaultLogger: Logger;
|
|
1434
|
-
```
|
|
1435
|
-
|
|
1436
|
-
Optional default logger for this instance.
|
|
1437
|
-
|
|
1438
|
-
### Inherited from
|
|
1439
|
-
|
|
1440
|
-
[`AbstractCreatable`](#AbstractCreatable).[`defaultLogger`](AbstractCreatable.md#defaultlogger-1)
|
|
1441
|
-
|
|
1442
|
-
***
|
|
1443
|
-
|
|
1444
|
-
### \_startPromise
|
|
1445
|
-
|
|
1446
|
-
```ts
|
|
1447
|
-
protected _startPromise: Promisable<boolean> | undefined;
|
|
1448
|
-
```
|
|
1449
|
-
|
|
1450
|
-
### Inherited from
|
|
1451
|
-
|
|
1452
|
-
[`AbstractCreatable`](#AbstractCreatable).[`_startPromise`](AbstractCreatable.md#_startpromise)
|
|
1453
|
-
|
|
1454
|
-
***
|
|
1455
|
-
|
|
1456
|
-
### eventData
|
|
1457
|
-
|
|
1458
|
-
```ts
|
|
1459
|
-
eventData: TEventData;
|
|
1460
|
-
```
|
|
1461
|
-
|
|
1462
|
-
Type-level reference to the event data shape for external type queries.
|
|
1463
|
-
|
|
1464
|
-
### Inherited from
|
|
1465
|
-
|
|
1466
|
-
[`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) |
|
|
1467
1235
|
|
|
1468
1236
|
## Accessors
|
|
1469
1237
|
|
|
@@ -1482,14 +1250,14 @@ get static historyInterval(): number;
|
|
|
1482
1250
|
### Set Signature
|
|
1483
1251
|
|
|
1484
1252
|
```ts
|
|
1485
|
-
set static historyInterval(value): void;
|
|
1253
|
+
set static historyInterval(value: number): void;
|
|
1486
1254
|
```
|
|
1487
1255
|
|
|
1488
1256
|
#### Parameters
|
|
1489
1257
|
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
`number`
|
|
1258
|
+
| Parameter | Type |
|
|
1259
|
+
| ------ | ------ |
|
|
1260
|
+
| `value` | `number` |
|
|
1493
1261
|
|
|
1494
1262
|
#### Returns
|
|
1495
1263
|
|
|
@@ -1516,14 +1284,14 @@ get static historyTime(): number;
|
|
|
1516
1284
|
### Set Signature
|
|
1517
1285
|
|
|
1518
1286
|
```ts
|
|
1519
|
-
set static historyTime(value): void;
|
|
1287
|
+
set static historyTime(value: number): void;
|
|
1520
1288
|
```
|
|
1521
1289
|
|
|
1522
1290
|
#### Parameters
|
|
1523
1291
|
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
`number`
|
|
1292
|
+
| Parameter | Type |
|
|
1293
|
+
| ------ | ------ |
|
|
1294
|
+
| `value` | `number` |
|
|
1527
1295
|
|
|
1528
1296
|
#### Returns
|
|
1529
1297
|
|
|
@@ -1550,14 +1318,14 @@ get static maxGcFrequency(): number;
|
|
|
1550
1318
|
### Set Signature
|
|
1551
1319
|
|
|
1552
1320
|
```ts
|
|
1553
|
-
set static maxGcFrequency(value): void;
|
|
1321
|
+
set static maxGcFrequency(value: number): void;
|
|
1554
1322
|
```
|
|
1555
1323
|
|
|
1556
1324
|
#### Parameters
|
|
1557
1325
|
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
`number`
|
|
1326
|
+
| Parameter | Type |
|
|
1327
|
+
| ------ | ------ |
|
|
1328
|
+
| `value` | `number` |
|
|
1561
1329
|
|
|
1562
1330
|
#### Returns
|
|
1563
1331
|
|
|
@@ -1749,14 +1517,14 @@ The status reporter used to broadcast lifecycle changes.
|
|
|
1749
1517
|
### Call Signature
|
|
1750
1518
|
|
|
1751
1519
|
```ts
|
|
1752
|
-
static gc(force
|
|
1520
|
+
static gc(force?: boolean): void;
|
|
1753
1521
|
```
|
|
1754
1522
|
|
|
1755
1523
|
#### Parameters
|
|
1756
1524
|
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
`boolean`
|
|
1525
|
+
| Parameter | Type |
|
|
1526
|
+
| ------ | ------ |
|
|
1527
|
+
| `force?` | `boolean` |
|
|
1760
1528
|
|
|
1761
1529
|
#### Returns
|
|
1762
1530
|
|
|
@@ -1769,14 +1537,14 @@ static gc(force?): void;
|
|
|
1769
1537
|
### Call Signature
|
|
1770
1538
|
|
|
1771
1539
|
```ts
|
|
1772
|
-
static gc(className): void;
|
|
1540
|
+
static gc(className: BaseClassName): void;
|
|
1773
1541
|
```
|
|
1774
1542
|
|
|
1775
1543
|
#### Parameters
|
|
1776
1544
|
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
`BaseClassName`
|
|
1545
|
+
| Parameter | Type |
|
|
1546
|
+
| ------ | ------ |
|
|
1547
|
+
| `className` | `BaseClassName` |
|
|
1780
1548
|
|
|
1781
1549
|
#### Returns
|
|
1782
1550
|
|
|
@@ -1791,14 +1559,14 @@ static gc(className): void;
|
|
|
1791
1559
|
### instanceCount()
|
|
1792
1560
|
|
|
1793
1561
|
```ts
|
|
1794
|
-
static instanceCount(className): number;
|
|
1562
|
+
static instanceCount(className: BaseClassName): number;
|
|
1795
1563
|
```
|
|
1796
1564
|
|
|
1797
1565
|
### Parameters
|
|
1798
1566
|
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
`BaseClassName`
|
|
1567
|
+
| Parameter | Type |
|
|
1568
|
+
| ------ | ------ |
|
|
1569
|
+
| `className` | `BaseClassName` |
|
|
1802
1570
|
|
|
1803
1571
|
### Returns
|
|
1804
1572
|
|
|
@@ -1861,7 +1629,7 @@ static stopHistory(): void;
|
|
|
1861
1629
|
### create()
|
|
1862
1630
|
|
|
1863
1631
|
```ts
|
|
1864
|
-
static create<T>(this
|
|
1632
|
+
static create<T>(this: Creatable<T>, inParams?: Partial<T["params"]>): Promise<T>;
|
|
1865
1633
|
```
|
|
1866
1634
|
|
|
1867
1635
|
Asynchronously creates a new instance by processing params, constructing,
|
|
@@ -1869,21 +1637,16 @@ and running both static and instance createHandlers.
|
|
|
1869
1637
|
|
|
1870
1638
|
### Type Parameters
|
|
1871
1639
|
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
1640
|
+
| Type Parameter |
|
|
1641
|
+
| ------ |
|
|
1642
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
1875
1643
|
|
|
1876
1644
|
### Parameters
|
|
1877
1645
|
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
1881
|
-
|
|
1882
|
-
#### inParams?
|
|
1883
|
-
|
|
1884
|
-
`Partial`\<`T`\[`"params"`\]\> = `{}`
|
|
1885
|
-
|
|
1886
|
-
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 |
|
|
1887
1650
|
|
|
1888
1651
|
### Returns
|
|
1889
1652
|
|
|
@@ -1900,7 +1663,7 @@ The fully initialized instance
|
|
|
1900
1663
|
### createHandler()
|
|
1901
1664
|
|
|
1902
1665
|
```ts
|
|
1903
|
-
static createHandler<T>(this
|
|
1666
|
+
static createHandler<T>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
1904
1667
|
```
|
|
1905
1668
|
|
|
1906
1669
|
Static hook called during creation to perform additional initialization.
|
|
@@ -1908,21 +1671,16 @@ Override in subclasses to customize post-construction setup.
|
|
|
1908
1671
|
|
|
1909
1672
|
### Type Parameters
|
|
1910
1673
|
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
1674
|
+
| Type Parameter |
|
|
1675
|
+
| ------ |
|
|
1676
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
1914
1677
|
|
|
1915
1678
|
### Parameters
|
|
1916
1679
|
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
1920
|
-
|
|
1921
|
-
#### instance
|
|
1922
|
-
|
|
1923
|
-
`T`
|
|
1924
|
-
|
|
1925
|
-
The newly constructed instance
|
|
1680
|
+
| Parameter | Type | Description |
|
|
1681
|
+
| ------ | ------ | ------ |
|
|
1682
|
+
| `this` | [`Creatable`](#../interfaces/Creatable)\<`T`\> | - |
|
|
1683
|
+
| `instance` | `T` | The newly constructed instance |
|
|
1926
1684
|
|
|
1927
1685
|
### Returns
|
|
1928
1686
|
|
|
@@ -1939,7 +1697,7 @@ The instance, potentially modified
|
|
|
1939
1697
|
### paramsHandler()
|
|
1940
1698
|
|
|
1941
1699
|
```ts
|
|
1942
|
-
static paramsHandler<T>(this
|
|
1700
|
+
static paramsHandler<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promisable<T["params"]>;
|
|
1943
1701
|
```
|
|
1944
1702
|
|
|
1945
1703
|
Static hook called during creation to validate and transform params.
|
|
@@ -1947,21 +1705,16 @@ Override in subclasses to add default values or validation.
|
|
|
1947
1705
|
|
|
1948
1706
|
### Type Parameters
|
|
1949
1707
|
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
1708
|
+
| Type Parameter |
|
|
1709
|
+
| ------ |
|
|
1710
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
1953
1711
|
|
|
1954
1712
|
### Parameters
|
|
1955
1713
|
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
1959
|
-
|
|
1960
|
-
#### params?
|
|
1961
|
-
|
|
1962
|
-
`Partial`\<`T`\[`"params"`\]\> = `{}`
|
|
1963
|
-
|
|
1964
|
-
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` |
|
|
1965
1718
|
|
|
1966
1719
|
### Returns
|
|
1967
1720
|
|
|
@@ -1996,7 +1749,7 @@ Instance-level creation hook. Override in subclasses to perform setup after cons
|
|
|
1996
1749
|
### paramsValidator()
|
|
1997
1750
|
|
|
1998
1751
|
```ts
|
|
1999
|
-
paramsValidator(params): TParams & RequiredCreatableParams<void>;
|
|
1752
|
+
paramsValidator(params: Partial<TParams & RequiredCreatableParams>): TParams & RequiredCreatableParams<void>;
|
|
2000
1753
|
```
|
|
2001
1754
|
|
|
2002
1755
|
Validates and returns the merged params, ensuring required fields are present.
|
|
@@ -2004,11 +1757,9 @@ Override in subclasses to add custom validation logic.
|
|
|
2004
1757
|
|
|
2005
1758
|
### Parameters
|
|
2006
1759
|
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
`Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\>
|
|
2010
|
-
|
|
2011
|
-
The raw partial params to validate
|
|
1760
|
+
| Parameter | Type | Description |
|
|
1761
|
+
| ------ | ------ | ------ |
|
|
1762
|
+
| `params` | `Partial`\<`TParams` & [`RequiredCreatableParams`](#../interfaces/RequiredCreatableParams)\> | The raw partial params to validate |
|
|
2012
1763
|
|
|
2013
1764
|
### Returns
|
|
2014
1765
|
|
|
@@ -2025,34 +1776,27 @@ The validated params
|
|
|
2025
1776
|
### span()
|
|
2026
1777
|
|
|
2027
1778
|
```ts
|
|
2028
|
-
span<T>(name, fn): T;
|
|
1779
|
+
span<T>(name: string, fn: () => T): T;
|
|
2029
1780
|
```
|
|
2030
1781
|
|
|
2031
1782
|
Executes a function within a telemetry span.
|
|
2032
1783
|
|
|
2033
1784
|
### Type Parameters
|
|
2034
1785
|
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
`T`
|
|
1786
|
+
| Type Parameter |
|
|
1787
|
+
| ------ |
|
|
1788
|
+
| `T` |
|
|
2038
1789
|
|
|
2039
1790
|
### Parameters
|
|
2040
1791
|
|
|
2041
|
-
|
|
1792
|
+
| Parameter | Type | Description |
|
|
1793
|
+
| ------ | ------ | ------ |
|
|
1794
|
+
| `name` | `string` | The span name |
|
|
1795
|
+
| `fn` | () => `T` | The function to execute within the span |
|
|
2042
1796
|
|
|
2043
|
-
|
|
1797
|
+
### Returns
|
|
2044
1798
|
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
#### fn
|
|
2048
|
-
|
|
2049
|
-
() => `T`
|
|
2050
|
-
|
|
2051
|
-
The function to execute within the span
|
|
2052
|
-
|
|
2053
|
-
### Returns
|
|
2054
|
-
|
|
2055
|
-
`T`
|
|
1799
|
+
`T`
|
|
2056
1800
|
|
|
2057
1801
|
### Inherited from
|
|
2058
1802
|
|
|
@@ -2064,38 +1808,26 @@ The function to execute within the span
|
|
|
2064
1808
|
|
|
2065
1809
|
```ts
|
|
2066
1810
|
spanAsync<T>(
|
|
2067
|
-
name,
|
|
2068
|
-
fn
|
|
2069
|
-
config
|
|
1811
|
+
name: string,
|
|
1812
|
+
fn: () => Promise<T>,
|
|
1813
|
+
config?: SpanConfig): Promise<T>;
|
|
2070
1814
|
```
|
|
2071
1815
|
|
|
2072
1816
|
Executes an async function within a telemetry span.
|
|
2073
1817
|
|
|
2074
1818
|
### Type Parameters
|
|
2075
1819
|
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
`T`
|
|
1820
|
+
| Type Parameter |
|
|
1821
|
+
| ------ |
|
|
1822
|
+
| `T` |
|
|
2079
1823
|
|
|
2080
1824
|
### Parameters
|
|
2081
1825
|
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
`string`
|
|
2085
|
-
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
#### fn
|
|
2089
|
-
|
|
2090
|
-
() => `Promise`\<`T`\>
|
|
2091
|
-
|
|
2092
|
-
The async function to execute within the span
|
|
2093
|
-
|
|
2094
|
-
#### config?
|
|
2095
|
-
|
|
2096
|
-
`SpanConfig` = `{}`
|
|
2097
|
-
|
|
2098
|
-
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 |
|
|
2099
1831
|
|
|
2100
1832
|
### Returns
|
|
2101
1833
|
|
|
@@ -2129,7 +1861,7 @@ Thread-safe via mutex. Returns true if already started or started successfully.
|
|
|
2129
1861
|
### started()
|
|
2130
1862
|
|
|
2131
1863
|
```ts
|
|
2132
|
-
started(notStartedAction
|
|
1864
|
+
started(notStartedAction?: "error" | "throw" | "warn" | "log" | "none"): boolean;
|
|
2133
1865
|
```
|
|
2134
1866
|
|
|
2135
1867
|
Checks whether this instance is currently started.
|
|
@@ -2137,11 +1869,9 @@ Takes an action if not started, based on the notStartedAction parameter.
|
|
|
2137
1869
|
|
|
2138
1870
|
### Parameters
|
|
2139
1871
|
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
What to do if not started: 'error'/'throw' throws, 'warn'/'log' logs, 'none' is silent
|
|
2143
|
-
|
|
2144
|
-
`"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 |
|
|
2145
1875
|
|
|
2146
1876
|
### Returns
|
|
2147
1877
|
|
|
@@ -2158,24 +1888,17 @@ True if started, false otherwise
|
|
|
2158
1888
|
### startedAsync()
|
|
2159
1889
|
|
|
2160
1890
|
```ts
|
|
2161
|
-
startedAsync(notStartedAction
|
|
1891
|
+
startedAsync(notStartedAction?: "error" | "throw" | "warn" | "log" | "none", tryStart?: boolean): Promise<boolean>;
|
|
2162
1892
|
```
|
|
2163
1893
|
|
|
2164
1894
|
Async version of `started` that can optionally auto-start the instance.
|
|
2165
1895
|
|
|
2166
1896
|
### Parameters
|
|
2167
1897
|
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
What to do if not started and auto-start is disabled
|
|
2171
|
-
|
|
2172
|
-
`"error"` | `"throw"` | `"warn"` | `"log"` | `"none"`
|
|
2173
|
-
|
|
2174
|
-
#### tryStart?
|
|
2175
|
-
|
|
2176
|
-
`boolean` = `true`
|
|
2177
|
-
|
|
2178
|
-
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 |
|
|
2179
1902
|
|
|
2180
1903
|
### Returns
|
|
2181
1904
|
|
|
@@ -2211,7 +1934,7 @@ Thread-safe via mutex. Returns true if already stopped or stopped successfully.
|
|
|
2211
1934
|
### \_noOverride()
|
|
2212
1935
|
|
|
2213
1936
|
```ts
|
|
2214
|
-
protected _noOverride(functionName
|
|
1937
|
+
protected _noOverride(functionName?: string): void;
|
|
2215
1938
|
```
|
|
2216
1939
|
|
|
2217
1940
|
Asserts that the given function has not been overridden in a subclass.
|
|
@@ -2219,9 +1942,9 @@ Used to enforce the handler pattern (override `startHandler` not `start`).
|
|
|
2219
1942
|
|
|
2220
1943
|
### Parameters
|
|
2221
1944
|
|
|
2222
|
-
|
|
2223
|
-
|
|
2224
|
-
`string`
|
|
1945
|
+
| Parameter | Type |
|
|
1946
|
+
| ------ | ------ |
|
|
1947
|
+
| `functionName` | `string` |
|
|
2225
1948
|
|
|
2226
1949
|
### Returns
|
|
2227
1950
|
|
|
@@ -2238,20 +1961,17 @@ Used to enforce the handler pattern (override `startHandler` not `start`).
|
|
|
2238
1961
|
### Call Signature
|
|
2239
1962
|
|
|
2240
1963
|
```ts
|
|
2241
|
-
protected setStatus(value, progress
|
|
1964
|
+
protected setStatus(value: "creating" | "created" | "starting" | "started" | "stopping" | "stopped", progress?: number): void;
|
|
2242
1965
|
```
|
|
2243
1966
|
|
|
2244
1967
|
Sets the lifecycle status and reports it via the status reporter.
|
|
2245
1968
|
|
|
2246
1969
|
#### Parameters
|
|
2247
1970
|
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
`"creating"`
|
|
2251
|
-
|
|
2252
|
-
##### progress?
|
|
2253
|
-
|
|
2254
|
-
`number`
|
|
1971
|
+
| Parameter | Type |
|
|
1972
|
+
| ------ | ------ |
|
|
1973
|
+
| `value` | `"creating"` \| `"created"` \| `"starting"` \| `"started"` \| `"stopping"` \| `"stopped"` |
|
|
1974
|
+
| `progress?` | `number` |
|
|
2255
1975
|
|
|
2256
1976
|
#### Returns
|
|
2257
1977
|
|
|
@@ -2264,20 +1984,17 @@ Sets the lifecycle status and reports it via the status reporter.
|
|
|
2264
1984
|
### Call Signature
|
|
2265
1985
|
|
|
2266
1986
|
```ts
|
|
2267
|
-
protected setStatus(value, error
|
|
1987
|
+
protected setStatus(value: "error", error?: Error): void;
|
|
2268
1988
|
```
|
|
2269
1989
|
|
|
2270
1990
|
Sets the lifecycle status and reports it via the status reporter.
|
|
2271
1991
|
|
|
2272
1992
|
#### Parameters
|
|
2273
1993
|
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
`"error"`
|
|
2277
|
-
|
|
2278
|
-
##### error?
|
|
2279
|
-
|
|
2280
|
-
`Error`
|
|
1994
|
+
| Parameter | Type |
|
|
1995
|
+
| ------ | ------ |
|
|
1996
|
+
| `value` | `"error"` |
|
|
1997
|
+
| `error?` | `Error` |
|
|
2281
1998
|
|
|
2282
1999
|
#### Returns
|
|
2283
2000
|
|
|
@@ -2329,36 +2046,26 @@ Override in subclasses to define stop behavior. Throw an error on failure.
|
|
|
2329
2046
|
|
|
2330
2047
|
```ts
|
|
2331
2048
|
static factory<T>(
|
|
2332
|
-
this
|
|
2333
|
-
params
|
|
2334
|
-
labels
|
|
2049
|
+
this: Creatable<T>,
|
|
2050
|
+
params?: Partial<T["params"]>,
|
|
2051
|
+
labels?: Labels): CreatableFactory<T>;
|
|
2335
2052
|
```
|
|
2336
2053
|
|
|
2337
2054
|
Creates a factory that produces instances of this class with pre-configured params and labels.
|
|
2338
2055
|
|
|
2339
2056
|
### Type Parameters
|
|
2340
2057
|
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
2058
|
+
| Type Parameter |
|
|
2059
|
+
| ------ |
|
|
2060
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
2344
2061
|
|
|
2345
2062
|
### Parameters
|
|
2346
2063
|
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2354
|
-
|
|
2355
|
-
Default parameters for instances created by the factory
|
|
2356
|
-
|
|
2357
|
-
#### labels?
|
|
2358
|
-
|
|
2359
|
-
[`Labels`](#../interfaces/Labels)
|
|
2360
|
-
|
|
2361
|
-
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 |
|
|
2362
2069
|
|
|
2363
2070
|
### Returns
|
|
2364
2071
|
|
|
@@ -2369,18 +2076,16 @@ Labels to assign to created instances
|
|
|
2369
2076
|
### clearListeners()
|
|
2370
2077
|
|
|
2371
2078
|
```ts
|
|
2372
|
-
clearListeners(eventNames): this;
|
|
2079
|
+
clearListeners(eventNames: keyof TEventData | keyof TEventData[]): this;
|
|
2373
2080
|
```
|
|
2374
2081
|
|
|
2375
2082
|
Removes all listeners for the specified event name(s).
|
|
2376
2083
|
|
|
2377
2084
|
### Parameters
|
|
2378
2085
|
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
One or more event names to clear listeners for.
|
|
2382
|
-
|
|
2383
|
-
keyof `TEventData` | keyof `TEventData`[]
|
|
2086
|
+
| Parameter | Type | Description |
|
|
2087
|
+
| ------ | ------ | ------ |
|
|
2088
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] | One or more event names to clear listeners for. |
|
|
2384
2089
|
|
|
2385
2090
|
### Returns
|
|
2386
2091
|
|
|
@@ -2397,34 +2102,24 @@ This instance for chaining.
|
|
|
2397
2102
|
### emit()
|
|
2398
2103
|
|
|
2399
2104
|
```ts
|
|
2400
|
-
emit<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
2105
|
+
emit<TEventName, TEventArgs>(eventName: TEventName, eventArgs: TEventArgs): Promise<void>;
|
|
2401
2106
|
```
|
|
2402
2107
|
|
|
2403
2108
|
Emits an event, invoking all registered listeners concurrently.
|
|
2404
2109
|
|
|
2405
2110
|
### Type Parameters
|
|
2406
2111
|
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
2410
|
-
|
|
2411
|
-
#### TEventArgs
|
|
2412
|
-
|
|
2413
|
-
`TEventArgs` *extends* `EventArgs` = `TEventData`\[`TEventName`\]
|
|
2112
|
+
| Type Parameter | Default type |
|
|
2113
|
+
| ------ | ------ |
|
|
2114
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` | keyof `TEventData` |
|
|
2115
|
+
| `TEventArgs` *extends* `EventArgs` | `TEventData`\[`TEventName`\] |
|
|
2414
2116
|
|
|
2415
2117
|
### Parameters
|
|
2416
2118
|
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
`TEventName`
|
|
2420
|
-
|
|
2421
|
-
The event to emit.
|
|
2422
|
-
|
|
2423
|
-
#### eventArgs
|
|
2424
|
-
|
|
2425
|
-
`TEventArgs`
|
|
2426
|
-
|
|
2427
|
-
The data to pass to listeners.
|
|
2119
|
+
| Parameter | Type | Description |
|
|
2120
|
+
| ------ | ------ | ------ |
|
|
2121
|
+
| `eventName` | `TEventName` | The event to emit. |
|
|
2122
|
+
| `eventArgs` | `TEventArgs` | The data to pass to listeners. |
|
|
2428
2123
|
|
|
2429
2124
|
### Returns
|
|
2430
2125
|
|
|
@@ -2439,34 +2134,24 @@ The data to pass to listeners.
|
|
|
2439
2134
|
### emitSerial()
|
|
2440
2135
|
|
|
2441
2136
|
```ts
|
|
2442
|
-
emitSerial<TEventName, TEventArgs>(eventName, eventArgs): Promise<void>;
|
|
2137
|
+
emitSerial<TEventName, TEventArgs>(eventName: TEventName, eventArgs: TEventArgs): Promise<void>;
|
|
2443
2138
|
```
|
|
2444
2139
|
|
|
2445
2140
|
Emits an event, invoking all registered listeners sequentially in order.
|
|
2446
2141
|
|
|
2447
2142
|
### Type Parameters
|
|
2448
2143
|
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
2452
|
-
|
|
2453
|
-
#### TEventArgs
|
|
2454
|
-
|
|
2455
|
-
`TEventArgs` *extends* `EventArgs` = `TEventData`\[`TEventName`\]
|
|
2144
|
+
| Type Parameter | Default type |
|
|
2145
|
+
| ------ | ------ |
|
|
2146
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` | keyof `TEventData` |
|
|
2147
|
+
| `TEventArgs` *extends* `EventArgs` | `TEventData`\[`TEventName`\] |
|
|
2456
2148
|
|
|
2457
2149
|
### Parameters
|
|
2458
2150
|
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
`TEventName`
|
|
2462
|
-
|
|
2463
|
-
The event to emit.
|
|
2464
|
-
|
|
2465
|
-
#### eventArgs
|
|
2466
|
-
|
|
2467
|
-
`TEventArgs`
|
|
2468
|
-
|
|
2469
|
-
The data to pass to listeners.
|
|
2151
|
+
| Parameter | Type | Description |
|
|
2152
|
+
| ------ | ------ | ------ |
|
|
2153
|
+
| `eventName` | `TEventName` | The event to emit. |
|
|
2154
|
+
| `eventArgs` | `TEventArgs` | The data to pass to listeners. |
|
|
2470
2155
|
|
|
2471
2156
|
### Returns
|
|
2472
2157
|
|
|
@@ -2481,18 +2166,16 @@ The data to pass to listeners.
|
|
|
2481
2166
|
### listenerCount()
|
|
2482
2167
|
|
|
2483
2168
|
```ts
|
|
2484
|
-
listenerCount(eventNames): number;
|
|
2169
|
+
listenerCount(eventNames: keyof TEventData | keyof TEventData[]): number;
|
|
2485
2170
|
```
|
|
2486
2171
|
|
|
2487
2172
|
Returns the total number of listeners registered for the specified event name(s).
|
|
2488
2173
|
|
|
2489
2174
|
### Parameters
|
|
2490
2175
|
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
One or more event names to count listeners for.
|
|
2494
|
-
|
|
2495
|
-
keyof `TEventData` | keyof `TEventData`[]
|
|
2176
|
+
| Parameter | Type | Description |
|
|
2177
|
+
| ------ | ------ | ------ |
|
|
2178
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] | One or more event names to count listeners for. |
|
|
2496
2179
|
|
|
2497
2180
|
### Returns
|
|
2498
2181
|
|
|
@@ -2509,30 +2192,23 @@ The total listener count.
|
|
|
2509
2192
|
### off()
|
|
2510
2193
|
|
|
2511
2194
|
```ts
|
|
2512
|
-
off<TEventName>(eventNames, listener): void;
|
|
2195
|
+
off<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): void;
|
|
2513
2196
|
```
|
|
2514
2197
|
|
|
2515
2198
|
Removes a specific listener from the specified event name(s).
|
|
2516
2199
|
|
|
2517
2200
|
### Type Parameters
|
|
2518
2201
|
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
2202
|
+
| Type Parameter |
|
|
2203
|
+
| ------ |
|
|
2204
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
2522
2205
|
|
|
2523
2206
|
### Parameters
|
|
2524
2207
|
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
One or more event names to unsubscribe from.
|
|
2528
|
-
|
|
2529
|
-
`TEventName` | `TEventName`[]
|
|
2530
|
-
|
|
2531
|
-
#### listener
|
|
2532
|
-
|
|
2533
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2534
|
-
|
|
2535
|
-
The listener to remove.
|
|
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. |
|
|
2536
2212
|
|
|
2537
2213
|
### Returns
|
|
2538
2214
|
|
|
@@ -2547,18 +2223,16 @@ The listener to remove.
|
|
|
2547
2223
|
### offAny()
|
|
2548
2224
|
|
|
2549
2225
|
```ts
|
|
2550
|
-
offAny(listener): void;
|
|
2226
|
+
offAny(listener: EventAnyListener): void;
|
|
2551
2227
|
```
|
|
2552
2228
|
|
|
2553
2229
|
Removes a wildcard listener that was receiving all events.
|
|
2554
2230
|
|
|
2555
2231
|
### Parameters
|
|
2556
2232
|
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
`EventAnyListener`
|
|
2560
|
-
|
|
2561
|
-
The wildcard listener to remove.
|
|
2233
|
+
| Parameter | Type | Description |
|
|
2234
|
+
| ------ | ------ | ------ |
|
|
2235
|
+
| `listener` | `EventAnyListener` | The wildcard listener to remove. |
|
|
2562
2236
|
|
|
2563
2237
|
### Returns
|
|
2564
2238
|
|
|
@@ -2573,30 +2247,23 @@ The wildcard listener to remove.
|
|
|
2573
2247
|
### on()
|
|
2574
2248
|
|
|
2575
2249
|
```ts
|
|
2576
|
-
on<TEventName>(eventNames, listener): () => void;
|
|
2250
|
+
on<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): () => void;
|
|
2577
2251
|
```
|
|
2578
2252
|
|
|
2579
2253
|
Subscribes a listener to the specified event name(s).
|
|
2580
2254
|
|
|
2581
2255
|
### Type Parameters
|
|
2582
2256
|
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
2257
|
+
| Type Parameter |
|
|
2258
|
+
| ------ |
|
|
2259
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
2586
2260
|
|
|
2587
2261
|
### Parameters
|
|
2588
2262
|
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
One or more event names to listen for.
|
|
2592
|
-
|
|
2593
|
-
`TEventName` | `TEventName`[]
|
|
2594
|
-
|
|
2595
|
-
#### listener
|
|
2596
|
-
|
|
2597
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2598
|
-
|
|
2599
|
-
The callback to invoke when the event fires.
|
|
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. |
|
|
2600
2267
|
|
|
2601
2268
|
### Returns
|
|
2602
2269
|
|
|
@@ -2619,18 +2286,16 @@ An unsubscribe function.
|
|
|
2619
2286
|
### onAny()
|
|
2620
2287
|
|
|
2621
2288
|
```ts
|
|
2622
|
-
onAny(listener): () => void;
|
|
2289
|
+
onAny(listener: EventAnyListener): () => void;
|
|
2623
2290
|
```
|
|
2624
2291
|
|
|
2625
2292
|
Subscribes a wildcard listener that receives all events.
|
|
2626
2293
|
|
|
2627
2294
|
### Parameters
|
|
2628
2295
|
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
`EventAnyListener`
|
|
2632
|
-
|
|
2633
|
-
The callback to invoke for any event.
|
|
2296
|
+
| Parameter | Type | Description |
|
|
2297
|
+
| ------ | ------ | ------ |
|
|
2298
|
+
| `listener` | `EventAnyListener` | The callback to invoke for any event. |
|
|
2634
2299
|
|
|
2635
2300
|
### Returns
|
|
2636
2301
|
|
|
@@ -2653,30 +2318,23 @@ An unsubscribe function.
|
|
|
2653
2318
|
### once()
|
|
2654
2319
|
|
|
2655
2320
|
```ts
|
|
2656
|
-
once<TEventName>(eventName, listener): () => void;
|
|
2321
|
+
once<TEventName>(eventName: TEventName, listener: EventListener<TEventData[TEventName]>): () => void;
|
|
2657
2322
|
```
|
|
2658
2323
|
|
|
2659
2324
|
Subscribes a listener that will be invoked only once for the specified event, then automatically removed.
|
|
2660
2325
|
|
|
2661
2326
|
### Type Parameters
|
|
2662
2327
|
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
2328
|
+
| Type Parameter |
|
|
2329
|
+
| ------ |
|
|
2330
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
2666
2331
|
|
|
2667
2332
|
### Parameters
|
|
2668
2333
|
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
`TEventName`
|
|
2672
|
-
|
|
2673
|
-
The event to listen for.
|
|
2674
|
-
|
|
2675
|
-
#### listener
|
|
2676
|
-
|
|
2677
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2678
|
-
|
|
2679
|
-
The callback to invoke once.
|
|
2334
|
+
| Parameter | Type | Description |
|
|
2335
|
+
| ------ | ------ | ------ |
|
|
2336
|
+
| `eventName` | `TEventName` | The event to listen for. |
|
|
2337
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> | The callback to invoke once. |
|
|
2680
2338
|
|
|
2681
2339
|
### Returns
|
|
2682
2340
|
|
|
@@ -2705,9 +2363,9 @@ Instances are created by merging caller-provided params over the factory default
|
|
|
2705
2363
|
|
|
2706
2364
|
## Type Parameters
|
|
2707
2365
|
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)
|
|
2366
|
+
| Type Parameter | Default type |
|
|
2367
|
+
| ------ | ------ |
|
|
2368
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance) | [`CreatableInstance`](#../interfaces/CreatableInstance) |
|
|
2711
2369
|
|
|
2712
2370
|
## Implements
|
|
2713
2371
|
|
|
@@ -2719,24 +2377,18 @@ Instances are created by merging caller-provided params over the factory default
|
|
|
2719
2377
|
|
|
2720
2378
|
```ts
|
|
2721
2379
|
new Factory<T>(
|
|
2722
|
-
creatable
|
|
2723
|
-
params
|
|
2724
|
-
labels
|
|
2380
|
+
creatable: Creatable<T>,
|
|
2381
|
+
params?: Partial<T["params"]>,
|
|
2382
|
+
labels?: Labels): Factory<T>;
|
|
2725
2383
|
```
|
|
2726
2384
|
|
|
2727
2385
|
### Parameters
|
|
2728
2386
|
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2736
|
-
|
|
2737
|
-
#### labels?
|
|
2738
|
-
|
|
2739
|
-
[`Labels`](#../interfaces/Labels) = `{}`
|
|
2387
|
+
| Parameter | Type |
|
|
2388
|
+
| ------ | ------ |
|
|
2389
|
+
| `creatable` | [`Creatable`](#../interfaces/Creatable)\<`T`\> |
|
|
2390
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
2391
|
+
| `labels?` | [`Labels`](#../interfaces/Labels) |
|
|
2740
2392
|
|
|
2741
2393
|
### Returns
|
|
2742
2394
|
|
|
@@ -2744,33 +2396,11 @@ labels?): Factory<T>;
|
|
|
2744
2396
|
|
|
2745
2397
|
## Properties
|
|
2746
2398
|
|
|
2747
|
-
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
The Creatable class this factory delegates creation to.
|
|
2754
|
-
|
|
2755
|
-
***
|
|
2756
|
-
|
|
2757
|
-
### defaultParams?
|
|
2758
|
-
|
|
2759
|
-
```ts
|
|
2760
|
-
optional defaultParams: Partial<T["params"]>;
|
|
2761
|
-
```
|
|
2762
|
-
|
|
2763
|
-
Default parameters merged into every `create` call.
|
|
2764
|
-
|
|
2765
|
-
***
|
|
2766
|
-
|
|
2767
|
-
### labels?
|
|
2768
|
-
|
|
2769
|
-
```ts
|
|
2770
|
-
optional labels: Labels;
|
|
2771
|
-
```
|
|
2772
|
-
|
|
2773
|
-
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. |
|
|
2774
2404
|
|
|
2775
2405
|
## Methods
|
|
2776
2406
|
|
|
@@ -2778,38 +2408,26 @@ Labels identifying resources created by this factory.
|
|
|
2778
2408
|
|
|
2779
2409
|
```ts
|
|
2780
2410
|
static withParams<T>(
|
|
2781
|
-
creatableModule
|
|
2782
|
-
params
|
|
2783
|
-
labels
|
|
2411
|
+
creatableModule: Creatable<T>,
|
|
2412
|
+
params?: Partial<T["params"]>,
|
|
2413
|
+
labels?: Labels): Factory<T>;
|
|
2784
2414
|
```
|
|
2785
2415
|
|
|
2786
2416
|
Creates a new Factory instance with the given default params and labels.
|
|
2787
2417
|
|
|
2788
2418
|
### Type Parameters
|
|
2789
2419
|
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
2420
|
+
| Type Parameter |
|
|
2421
|
+
| ------ |
|
|
2422
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
2793
2423
|
|
|
2794
2424
|
### Parameters
|
|
2795
2425
|
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
[`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
#### params?
|
|
2803
|
-
|
|
2804
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2805
|
-
|
|
2806
|
-
Default parameters for new instances
|
|
2807
|
-
|
|
2808
|
-
#### labels?
|
|
2809
|
-
|
|
2810
|
-
[`Labels`](#../interfaces/Labels) = `{}`
|
|
2811
|
-
|
|
2812
|
-
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 |
|
|
2813
2431
|
|
|
2814
2432
|
### Returns
|
|
2815
2433
|
|
|
@@ -2820,18 +2438,16 @@ Labels to assign to created instances
|
|
|
2820
2438
|
### create()
|
|
2821
2439
|
|
|
2822
2440
|
```ts
|
|
2823
|
-
create(params
|
|
2441
|
+
create(params?: Partial<T["params"]>): Promise<T>;
|
|
2824
2442
|
```
|
|
2825
2443
|
|
|
2826
2444
|
Creates a new instance, merging the provided params over the factory defaults.
|
|
2827
2445
|
|
|
2828
2446
|
### Parameters
|
|
2829
2447
|
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2833
|
-
|
|
2834
|
-
Optional parameters to override the factory defaults
|
|
2448
|
+
| Parameter | Type | Description |
|
|
2449
|
+
| ------ | ------ | ------ |
|
|
2450
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> | Optional parameters to override the factory defaults |
|
|
2835
2451
|
|
|
2836
2452
|
### Returns
|
|
2837
2453
|
|
|
@@ -2850,7 +2466,7 @@ Optional parameters to override the factory defaults
|
|
|
2850
2466
|
***
|
|
2851
2467
|
|
|
2852
2468
|
```ts
|
|
2853
|
-
function creatable<T>(): <U>(constructor) => void;
|
|
2469
|
+
function creatable<T>(): <U>(constructor: U) => void;
|
|
2854
2470
|
```
|
|
2855
2471
|
|
|
2856
2472
|
Class annotation to be used to decorate Modules which support
|
|
@@ -2858,9 +2474,9 @@ an asynchronous creation pattern
|
|
|
2858
2474
|
|
|
2859
2475
|
## Type Parameters
|
|
2860
2476
|
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
`T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\>
|
|
2477
|
+
| Type Parameter |
|
|
2478
|
+
| ------ |
|
|
2479
|
+
| `T` *extends* [`CreatableInstance`](#../interfaces/CreatableInstance)\<[`CreatableParams`](#../interfaces/CreatableParams), `EventData`\> |
|
|
2864
2480
|
|
|
2865
2481
|
## Returns
|
|
2866
2482
|
|
|
@@ -2868,20 +2484,20 @@ The decorated Module requiring it implement the members
|
|
|
2868
2484
|
of the CreatableModule as statics properties/methods
|
|
2869
2485
|
|
|
2870
2486
|
```ts
|
|
2871
|
-
<U>(constructor): void;
|
|
2487
|
+
<U>(constructor: U): void;
|
|
2872
2488
|
```
|
|
2873
2489
|
|
|
2874
2490
|
### Type Parameters
|
|
2875
2491
|
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
`U` *extends* [`Creatable`](#../interfaces/Creatable)\<`T`\>
|
|
2492
|
+
| Type Parameter |
|
|
2493
|
+
| ------ |
|
|
2494
|
+
| `U` *extends* [`Creatable`](#../interfaces/Creatable)\<`T`\> |
|
|
2879
2495
|
|
|
2880
2496
|
### Parameters
|
|
2881
2497
|
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
`U`
|
|
2498
|
+
| Parameter | Type |
|
|
2499
|
+
| ------ | ------ |
|
|
2500
|
+
| `constructor` | `U` |
|
|
2885
2501
|
|
|
2886
2502
|
### Returns
|
|
2887
2503
|
|
|
@@ -2894,7 +2510,7 @@ of the CreatableModule as statics properties/methods
|
|
|
2894
2510
|
***
|
|
2895
2511
|
|
|
2896
2512
|
```ts
|
|
2897
|
-
function creatableFactory(): <U>(constructor) => void;
|
|
2513
|
+
function creatableFactory(): <U>(constructor: U) => void;
|
|
2898
2514
|
```
|
|
2899
2515
|
|
|
2900
2516
|
Class annotation to be used to decorate Modules which support
|
|
@@ -2906,20 +2522,20 @@ The decorated Module requiring it implement the members
|
|
|
2906
2522
|
of the CreatableModule as statics properties/methods
|
|
2907
2523
|
|
|
2908
2524
|
```ts
|
|
2909
|
-
<U>(constructor): void;
|
|
2525
|
+
<U>(constructor: U): void;
|
|
2910
2526
|
```
|
|
2911
2527
|
|
|
2912
2528
|
### Type Parameters
|
|
2913
2529
|
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
`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`\>\> |
|
|
2917
2533
|
|
|
2918
2534
|
### Parameters
|
|
2919
2535
|
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
`U`
|
|
2536
|
+
| Parameter | Type |
|
|
2537
|
+
| ------ | ------ |
|
|
2538
|
+
| `constructor` | `U` |
|
|
2923
2539
|
|
|
2924
2540
|
### Returns
|
|
2925
2541
|
|
|
@@ -2932,24 +2548,17 @@ of the CreatableModule as statics properties/methods
|
|
|
2932
2548
|
***
|
|
2933
2549
|
|
|
2934
2550
|
```ts
|
|
2935
|
-
function hasAllLabels(source
|
|
2551
|
+
function hasAllLabels(source?: Labels, required?: Labels): boolean;
|
|
2936
2552
|
```
|
|
2937
2553
|
|
|
2938
2554
|
Returns true if the source object has all the labels from the required set
|
|
2939
2555
|
|
|
2940
2556
|
## Parameters
|
|
2941
2557
|
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
[`Labels`](#../interfaces/Labels)
|
|
2945
|
-
|
|
2946
|
-
Source object to check against
|
|
2947
|
-
|
|
2948
|
-
### required?
|
|
2949
|
-
|
|
2950
|
-
[`Labels`](#../interfaces/Labels)
|
|
2951
|
-
|
|
2952
|
-
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 |
|
|
2953
2562
|
|
|
2954
2563
|
## Returns
|
|
2955
2564
|
|
|
@@ -2975,29 +2584,26 @@ used to construct instances through the creatable lifecycle.
|
|
|
2975
2584
|
|
|
2976
2585
|
## Type Parameters
|
|
2977
2586
|
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)
|
|
2587
|
+
| Type Parameter | Default type |
|
|
2588
|
+
| ------ | ------ |
|
|
2589
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance) | [`CreatableInstance`](#CreatableInstance) |
|
|
2981
2590
|
|
|
2982
2591
|
## Constructors
|
|
2983
2592
|
|
|
2984
2593
|
### Constructor
|
|
2985
2594
|
|
|
2986
2595
|
```ts
|
|
2987
|
-
new Creatable(key, params): T & AbstractCreatable<T["params"], EventData>;
|
|
2596
|
+
new Creatable(key: unknown, params: Partial<CreatableParams>): T & AbstractCreatable<T["params"], EventData>;
|
|
2988
2597
|
```
|
|
2989
2598
|
|
|
2990
2599
|
Constructs a new raw instance. Should not be called directly; use `create` instead.
|
|
2991
2600
|
|
|
2992
2601
|
### Parameters
|
|
2993
2602
|
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
`unknown`
|
|
2997
|
-
|
|
2998
|
-
#### params
|
|
2999
|
-
|
|
3000
|
-
`Partial`\<[`CreatableParams`](#CreatableParams)\>
|
|
2603
|
+
| Parameter | Type |
|
|
2604
|
+
| ------ | ------ |
|
|
2605
|
+
| `key` | `unknown` |
|
|
2606
|
+
| `params` | `Partial`\<[`CreatableParams`](#CreatableParams)\> |
|
|
3001
2607
|
|
|
3002
2608
|
### Returns
|
|
3003
2609
|
|
|
@@ -3005,39 +2611,32 @@ Constructs a new raw instance. Should not be called directly; use `create` inste
|
|
|
3005
2611
|
|
|
3006
2612
|
## Properties
|
|
3007
2613
|
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
optional defaultLogger: Logger;
|
|
3012
|
-
```
|
|
3013
|
-
|
|
3014
|
-
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. |
|
|
3015
2617
|
|
|
3016
2618
|
## Methods
|
|
3017
2619
|
|
|
3018
2620
|
### create()
|
|
3019
2621
|
|
|
3020
2622
|
```ts
|
|
3021
|
-
create<T>(this
|
|
2623
|
+
create<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promise<T>;
|
|
3022
2624
|
```
|
|
3023
2625
|
|
|
3024
2626
|
Asynchronously creates and initializes a new instance with the given params.
|
|
3025
2627
|
|
|
3026
2628
|
### Type Parameters
|
|
3027
2629
|
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
2630
|
+
| Type Parameter |
|
|
2631
|
+
| ------ |
|
|
2632
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3031
2633
|
|
|
3032
2634
|
### Parameters
|
|
3033
2635
|
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
`Creatable`\<`T`\>
|
|
3037
|
-
|
|
3038
|
-
#### params?
|
|
3039
|
-
|
|
3040
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2636
|
+
| Parameter | Type |
|
|
2637
|
+
| ------ | ------ |
|
|
2638
|
+
| `this` | `Creatable`\<`T`\> |
|
|
2639
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3041
2640
|
|
|
3042
2641
|
### Returns
|
|
3043
2642
|
|
|
@@ -3048,26 +2647,23 @@ Asynchronously creates and initializes a new instance with the given params.
|
|
|
3048
2647
|
### createHandler()
|
|
3049
2648
|
|
|
3050
2649
|
```ts
|
|
3051
|
-
createHandler<T>(this
|
|
2650
|
+
createHandler<T>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
3052
2651
|
```
|
|
3053
2652
|
|
|
3054
2653
|
Hook called after construction to perform additional initialization on the instance.
|
|
3055
2654
|
|
|
3056
2655
|
### Type Parameters
|
|
3057
2656
|
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
2657
|
+
| Type Parameter |
|
|
2658
|
+
| ------ |
|
|
2659
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3061
2660
|
|
|
3062
2661
|
### Parameters
|
|
3063
2662
|
|
|
3064
|
-
|
|
3065
|
-
|
|
3066
|
-
`Creatable`\<`T`\>
|
|
3067
|
-
|
|
3068
|
-
#### instance
|
|
3069
|
-
|
|
3070
|
-
`T`
|
|
2663
|
+
| Parameter | Type |
|
|
2664
|
+
| ------ | ------ |
|
|
2665
|
+
| `this` | `Creatable`\<`T`\> |
|
|
2666
|
+
| `instance` | `T` |
|
|
3071
2667
|
|
|
3072
2668
|
### Returns
|
|
3073
2669
|
|
|
@@ -3078,26 +2674,23 @@ Hook called after construction to perform additional initialization on the insta
|
|
|
3078
2674
|
### paramsHandler()
|
|
3079
2675
|
|
|
3080
2676
|
```ts
|
|
3081
|
-
paramsHandler<T>(this
|
|
2677
|
+
paramsHandler<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promisable<T["params"] & RequiredCreatableParams<void>>;
|
|
3082
2678
|
```
|
|
3083
2679
|
|
|
3084
2680
|
Hook called to validate and transform params before instance construction.
|
|
3085
2681
|
|
|
3086
2682
|
### Type Parameters
|
|
3087
2683
|
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
2684
|
+
| Type Parameter |
|
|
2685
|
+
| ------ |
|
|
2686
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3091
2687
|
|
|
3092
2688
|
### Parameters
|
|
3093
2689
|
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
`Creatable`\<`T`\>
|
|
3097
|
-
|
|
3098
|
-
#### params?
|
|
3099
|
-
|
|
3100
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2690
|
+
| Parameter | Type |
|
|
2691
|
+
| ------ | ------ |
|
|
2692
|
+
| `this` | `Creatable`\<`T`\> |
|
|
2693
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3101
2694
|
|
|
3102
2695
|
### Returns
|
|
3103
2696
|
|
|
@@ -3123,29 +2716,26 @@ Unlike the full Creatable, this only exposes the `create` method.
|
|
|
3123
2716
|
|
|
3124
2717
|
## Type Parameters
|
|
3125
2718
|
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)
|
|
2719
|
+
| Type Parameter | Default type |
|
|
2720
|
+
| ------ | ------ |
|
|
2721
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance) | [`CreatableInstance`](#CreatableInstance) |
|
|
3129
2722
|
|
|
3130
2723
|
## Methods
|
|
3131
2724
|
|
|
3132
2725
|
### create()
|
|
3133
2726
|
|
|
3134
2727
|
```ts
|
|
3135
|
-
create(this
|
|
2728
|
+
create(this: CreatableFactory<T>, params?: Partial<T["params"]>): Promise<T>;
|
|
3136
2729
|
```
|
|
3137
2730
|
|
|
3138
2731
|
Creates a new instance, merging the provided params with the factory's defaults.
|
|
3139
2732
|
|
|
3140
2733
|
### Parameters
|
|
3141
2734
|
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
`CreatableFactory`\<`T`\>
|
|
3145
|
-
|
|
3146
|
-
#### params?
|
|
3147
|
-
|
|
3148
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
2735
|
+
| Parameter | Type |
|
|
2736
|
+
| ------ | ------ |
|
|
2737
|
+
| `this` | `CreatableFactory`\<`T`\> |
|
|
2738
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3149
2739
|
|
|
3150
2740
|
### Returns
|
|
3151
2741
|
|
|
@@ -3165,93 +2755,36 @@ Represents a created instance with a managed lifecycle (start/stop) and event em
|
|
|
3165
2755
|
|
|
3166
2756
|
## Type Parameters
|
|
3167
2757
|
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
`TParams` *extends* [`CreatableParams`](#CreatableParams)
|
|
3171
|
-
|
|
3172
|
-
### TEventData
|
|
3173
|
-
|
|
3174
|
-
`TEventData` *extends* `EventData` = `EventData`
|
|
2758
|
+
| Type Parameter | Default type |
|
|
2759
|
+
| ------ | ------ |
|
|
2760
|
+
| `TParams` *extends* [`CreatableParams`](#CreatableParams) | [`CreatableParams`](#CreatableParams) |
|
|
2761
|
+
| `TEventData` *extends* `EventData` | `EventData` |
|
|
3175
2762
|
|
|
3176
2763
|
## Properties
|
|
3177
2764
|
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
### Overrides
|
|
3187
|
-
|
|
3188
|
-
```ts
|
|
3189
|
-
EventEmitter.eventData
|
|
3190
|
-
```
|
|
3191
|
-
|
|
3192
|
-
***
|
|
3193
|
-
|
|
3194
|
-
### name
|
|
3195
|
-
|
|
3196
|
-
```ts
|
|
3197
|
-
name: CreatableName;
|
|
3198
|
-
```
|
|
3199
|
-
|
|
3200
|
-
The name identifier for this instance.
|
|
3201
|
-
|
|
3202
|
-
***
|
|
3203
|
-
|
|
3204
|
-
### params
|
|
3205
|
-
|
|
3206
|
-
```ts
|
|
3207
|
-
params: TParams;
|
|
3208
|
-
```
|
|
3209
|
-
|
|
3210
|
-
The parameters used to configure this instance.
|
|
3211
|
-
|
|
3212
|
-
***
|
|
3213
|
-
|
|
3214
|
-
### start()
|
|
3215
|
-
|
|
3216
|
-
```ts
|
|
3217
|
-
start: () => Promise<boolean>;
|
|
3218
|
-
```
|
|
3219
|
-
|
|
3220
|
-
Starts the instance. Resolves to true if started successfully.
|
|
3221
|
-
|
|
3222
|
-
### Returns
|
|
3223
|
-
|
|
3224
|
-
`Promise`\<`boolean`\>
|
|
3225
|
-
|
|
3226
|
-
***
|
|
3227
|
-
|
|
3228
|
-
### stop()
|
|
3229
|
-
|
|
3230
|
-
```ts
|
|
3231
|
-
stop: () => Promise<boolean>;
|
|
3232
|
-
```
|
|
3233
|
-
|
|
3234
|
-
Stops the instance. Resolves to true if stopped successfully.
|
|
3235
|
-
|
|
3236
|
-
### Returns
|
|
3237
|
-
|
|
3238
|
-
`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. | - |
|
|
3239
2772
|
|
|
3240
2773
|
## Methods
|
|
3241
2774
|
|
|
3242
2775
|
### clearListeners()
|
|
3243
2776
|
|
|
3244
2777
|
```ts
|
|
3245
|
-
clearListeners(eventNames): void;
|
|
2778
|
+
clearListeners(eventNames: keyof TEventData | keyof TEventData[]): void;
|
|
3246
2779
|
```
|
|
3247
2780
|
|
|
3248
2781
|
Removes all listeners for the specified event name(s).
|
|
3249
2782
|
|
|
3250
2783
|
### Parameters
|
|
3251
2784
|
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
keyof `TEventData`
|
|
2785
|
+
| Parameter | Type |
|
|
2786
|
+
| ------ | ------ |
|
|
2787
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] |
|
|
3255
2788
|
|
|
3256
2789
|
### Returns
|
|
3257
2790
|
|
|
@@ -3268,26 +2801,23 @@ EventEmitter.clearListeners
|
|
|
3268
2801
|
### emit()
|
|
3269
2802
|
|
|
3270
2803
|
```ts
|
|
3271
|
-
emit<TEventName>(eventName, eventArgs): Promise<void>;
|
|
2804
|
+
emit<TEventName>(eventName: TEventName, eventArgs: TEventData[TEventName]): Promise<void>;
|
|
3272
2805
|
```
|
|
3273
2806
|
|
|
3274
2807
|
Emits an event, invoking all registered listeners concurrently.
|
|
3275
2808
|
|
|
3276
2809
|
### Type Parameters
|
|
3277
2810
|
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
2811
|
+
| Type Parameter |
|
|
2812
|
+
| ------ |
|
|
2813
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3281
2814
|
|
|
3282
2815
|
### Parameters
|
|
3283
2816
|
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
`TEventName`
|
|
3287
|
-
|
|
3288
|
-
#### eventArgs
|
|
3289
|
-
|
|
3290
|
-
`TEventData`\[`TEventName`\]
|
|
2817
|
+
| Parameter | Type |
|
|
2818
|
+
| ------ | ------ |
|
|
2819
|
+
| `eventName` | `TEventName` |
|
|
2820
|
+
| `eventArgs` | `TEventData`\[`TEventName`\] |
|
|
3291
2821
|
|
|
3292
2822
|
### Returns
|
|
3293
2823
|
|
|
@@ -3304,26 +2834,23 @@ EventEmitter.emit
|
|
|
3304
2834
|
### emitSerial()
|
|
3305
2835
|
|
|
3306
2836
|
```ts
|
|
3307
|
-
emitSerial<TEventName>(eventName, eventArgs): Promise<void>;
|
|
2837
|
+
emitSerial<TEventName>(eventName: TEventName, eventArgs: TEventData[TEventName]): Promise<void>;
|
|
3308
2838
|
```
|
|
3309
2839
|
|
|
3310
2840
|
Emits an event, invoking all registered listeners sequentially in order.
|
|
3311
2841
|
|
|
3312
2842
|
### Type Parameters
|
|
3313
2843
|
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
2844
|
+
| Type Parameter |
|
|
2845
|
+
| ------ |
|
|
2846
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3317
2847
|
|
|
3318
2848
|
### Parameters
|
|
3319
2849
|
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
`TEventName`
|
|
3323
|
-
|
|
3324
|
-
#### eventArgs
|
|
3325
|
-
|
|
3326
|
-
`TEventData`\[`TEventName`\]
|
|
2850
|
+
| Parameter | Type |
|
|
2851
|
+
| ------ | ------ |
|
|
2852
|
+
| `eventName` | `TEventName` |
|
|
2853
|
+
| `eventArgs` | `TEventData`\[`TEventName`\] |
|
|
3327
2854
|
|
|
3328
2855
|
### Returns
|
|
3329
2856
|
|
|
@@ -3340,16 +2867,16 @@ EventEmitter.emitSerial
|
|
|
3340
2867
|
### listenerCount()
|
|
3341
2868
|
|
|
3342
2869
|
```ts
|
|
3343
|
-
listenerCount(eventNames): number;
|
|
2870
|
+
listenerCount(eventNames: keyof TEventData | keyof TEventData[]): number;
|
|
3344
2871
|
```
|
|
3345
2872
|
|
|
3346
2873
|
Returns the total number of listeners registered for the specified event name(s).
|
|
3347
2874
|
|
|
3348
2875
|
### Parameters
|
|
3349
2876
|
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
keyof `TEventData`
|
|
2877
|
+
| Parameter | Type |
|
|
2878
|
+
| ------ | ------ |
|
|
2879
|
+
| `eventNames` | keyof `TEventData` \| keyof `TEventData`[] |
|
|
3353
2880
|
|
|
3354
2881
|
### Returns
|
|
3355
2882
|
|
|
@@ -3366,26 +2893,23 @@ EventEmitter.listenerCount
|
|
|
3366
2893
|
### off()
|
|
3367
2894
|
|
|
3368
2895
|
```ts
|
|
3369
|
-
off<TEventName>(eventNames, listener): void;
|
|
2896
|
+
off<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): void;
|
|
3370
2897
|
```
|
|
3371
2898
|
|
|
3372
2899
|
Removes a specific listener from the specified event name(s).
|
|
3373
2900
|
|
|
3374
2901
|
### Type Parameters
|
|
3375
2902
|
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
2903
|
+
| Type Parameter |
|
|
2904
|
+
| ------ |
|
|
2905
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3379
2906
|
|
|
3380
2907
|
### Parameters
|
|
3381
2908
|
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
`
|
|
3385
|
-
|
|
3386
|
-
#### listener
|
|
3387
|
-
|
|
3388
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2909
|
+
| Parameter | Type |
|
|
2910
|
+
| ------ | ------ |
|
|
2911
|
+
| `eventNames` | `TEventName` \| `TEventName`[] |
|
|
2912
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> |
|
|
3389
2913
|
|
|
3390
2914
|
### Returns
|
|
3391
2915
|
|
|
@@ -3402,16 +2926,16 @@ EventEmitter.off
|
|
|
3402
2926
|
### offAny()
|
|
3403
2927
|
|
|
3404
2928
|
```ts
|
|
3405
|
-
offAny(listener): void;
|
|
2929
|
+
offAny(listener: Promise<void> | EventAnyListener): void;
|
|
3406
2930
|
```
|
|
3407
2931
|
|
|
3408
2932
|
Removes a wildcard listener that was receiving all events.
|
|
3409
2933
|
|
|
3410
2934
|
### Parameters
|
|
3411
2935
|
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
`Promise`\<`void`\>
|
|
2936
|
+
| Parameter | Type |
|
|
2937
|
+
| ------ | ------ |
|
|
2938
|
+
| `listener` | `Promise`\<`void`\> \| `EventAnyListener` |
|
|
3415
2939
|
|
|
3416
2940
|
### Returns
|
|
3417
2941
|
|
|
@@ -3428,26 +2952,23 @@ EventEmitter.offAny
|
|
|
3428
2952
|
### on()
|
|
3429
2953
|
|
|
3430
2954
|
```ts
|
|
3431
|
-
on<TEventName>(eventNames, listener): EventUnsubscribeFunction;
|
|
2955
|
+
on<TEventName>(eventNames: TEventName | TEventName[], listener: EventListener<TEventData[TEventName]>): EventUnsubscribeFunction;
|
|
3432
2956
|
```
|
|
3433
2957
|
|
|
3434
2958
|
Subscribes a listener to the specified event name(s) and returns an unsubscribe function.
|
|
3435
2959
|
|
|
3436
2960
|
### Type Parameters
|
|
3437
2961
|
|
|
3438
|
-
|
|
3439
|
-
|
|
3440
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
2962
|
+
| Type Parameter |
|
|
2963
|
+
| ------ |
|
|
2964
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3441
2965
|
|
|
3442
2966
|
### Parameters
|
|
3443
2967
|
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
`
|
|
3447
|
-
|
|
3448
|
-
#### listener
|
|
3449
|
-
|
|
3450
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
2968
|
+
| Parameter | Type |
|
|
2969
|
+
| ------ | ------ |
|
|
2970
|
+
| `eventNames` | `TEventName` \| `TEventName`[] |
|
|
2971
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> |
|
|
3451
2972
|
|
|
3452
2973
|
### Returns
|
|
3453
2974
|
|
|
@@ -3464,16 +2985,16 @@ EventEmitter.on
|
|
|
3464
2985
|
### onAny()
|
|
3465
2986
|
|
|
3466
2987
|
```ts
|
|
3467
|
-
onAny(listener): EventUnsubscribeFunction;
|
|
2988
|
+
onAny(listener: EventAnyListener): EventUnsubscribeFunction;
|
|
3468
2989
|
```
|
|
3469
2990
|
|
|
3470
2991
|
Subscribes a wildcard listener that receives all events and returns an unsubscribe function.
|
|
3471
2992
|
|
|
3472
2993
|
### Parameters
|
|
3473
2994
|
|
|
3474
|
-
|
|
3475
|
-
|
|
3476
|
-
`EventAnyListener`
|
|
2995
|
+
| Parameter | Type |
|
|
2996
|
+
| ------ | ------ |
|
|
2997
|
+
| `listener` | `EventAnyListener` |
|
|
3477
2998
|
|
|
3478
2999
|
### Returns
|
|
3479
3000
|
|
|
@@ -3490,26 +3011,23 @@ EventEmitter.onAny
|
|
|
3490
3011
|
### once()
|
|
3491
3012
|
|
|
3492
3013
|
```ts
|
|
3493
|
-
once<TEventName>(eventName, listener): EventUnsubscribeFunction;
|
|
3014
|
+
once<TEventName>(eventName: TEventName, listener: EventListener<TEventData[TEventName]>): EventUnsubscribeFunction;
|
|
3494
3015
|
```
|
|
3495
3016
|
|
|
3496
3017
|
Subscribes a listener that will be invoked only once for the specified event, then automatically removed.
|
|
3497
3018
|
|
|
3498
3019
|
### Type Parameters
|
|
3499
3020
|
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
`TEventName` *extends* `string` \| `number` \| `symbol`
|
|
3021
|
+
| Type Parameter |
|
|
3022
|
+
| ------ |
|
|
3023
|
+
| `TEventName` *extends* `string` \| `number` \| `symbol` |
|
|
3503
3024
|
|
|
3504
3025
|
### Parameters
|
|
3505
3026
|
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
`TEventName`
|
|
3509
|
-
|
|
3510
|
-
#### listener
|
|
3511
|
-
|
|
3512
|
-
`EventListener`\<`TEventData`\[`TEventName`\]\>
|
|
3027
|
+
| Parameter | Type |
|
|
3028
|
+
| ------ | ------ |
|
|
3029
|
+
| `eventName` | `TEventName` |
|
|
3030
|
+
| `listener` | `EventListener`\<`TEventData`\[`TEventName`\]\> |
|
|
3513
3031
|
|
|
3514
3032
|
### Returns
|
|
3515
3033
|
|
|
@@ -3535,67 +3053,13 @@ Parameters for creating a creatable instance, combining required params with emi
|
|
|
3535
3053
|
|
|
3536
3054
|
## Properties
|
|
3537
3055
|
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
[`RequiredCreatableParams`](#RequiredCreatableParams).[`logger`](RequiredCreatableParams.md#logger)
|
|
3547
|
-
|
|
3548
|
-
***
|
|
3549
|
-
|
|
3550
|
-
### meterProvider?
|
|
3551
|
-
|
|
3552
|
-
```ts
|
|
3553
|
-
optional meterProvider: MeterProvider;
|
|
3554
|
-
```
|
|
3555
|
-
|
|
3556
|
-
### Inherited from
|
|
3557
|
-
|
|
3558
|
-
[`RequiredCreatableParams`](#RequiredCreatableParams).[`meterProvider`](RequiredCreatableParams.md#meterprovider)
|
|
3559
|
-
|
|
3560
|
-
***
|
|
3561
|
-
|
|
3562
|
-
### traceProvider?
|
|
3563
|
-
|
|
3564
|
-
```ts
|
|
3565
|
-
optional traceProvider: TracerProvider;
|
|
3566
|
-
```
|
|
3567
|
-
|
|
3568
|
-
### Inherited from
|
|
3569
|
-
|
|
3570
|
-
[`RequiredCreatableParams`](#RequiredCreatableParams).[`traceProvider`](RequiredCreatableParams.md#traceprovider)
|
|
3571
|
-
|
|
3572
|
-
***
|
|
3573
|
-
|
|
3574
|
-
### name?
|
|
3575
|
-
|
|
3576
|
-
```ts
|
|
3577
|
-
optional name: CreatableName;
|
|
3578
|
-
```
|
|
3579
|
-
|
|
3580
|
-
Optional name identifying this creatable instance.
|
|
3581
|
-
|
|
3582
|
-
### Inherited from
|
|
3583
|
-
|
|
3584
|
-
[`RequiredCreatableParams`](#RequiredCreatableParams).[`name`](RequiredCreatableParams.md#name)
|
|
3585
|
-
|
|
3586
|
-
***
|
|
3587
|
-
|
|
3588
|
-
### statusReporter?
|
|
3589
|
-
|
|
3590
|
-
```ts
|
|
3591
|
-
optional statusReporter: CreatableStatusReporter<void>;
|
|
3592
|
-
```
|
|
3593
|
-
|
|
3594
|
-
Optional reporter for broadcasting status changes.
|
|
3595
|
-
|
|
3596
|
-
### Inherited from
|
|
3597
|
-
|
|
3598
|
-
[`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) |
|
|
3599
3063
|
|
|
3600
3064
|
### <a id="CreatableStatusReporter"></a>CreatableStatusReporter
|
|
3601
3065
|
|
|
@@ -3607,9 +3071,9 @@ Reports status changes for a creatable, supporting progress tracking and error r
|
|
|
3607
3071
|
|
|
3608
3072
|
## Type Parameters
|
|
3609
3073
|
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
`TAdditionalStatus` *extends* `void` \| `string`
|
|
3074
|
+
| Type Parameter | Default type |
|
|
3075
|
+
| ------ | ------ |
|
|
3076
|
+
| `TAdditionalStatus` *extends* `void` \| `string` | `void` |
|
|
3613
3077
|
|
|
3614
3078
|
## Methods
|
|
3615
3079
|
|
|
@@ -3619,26 +3083,27 @@ Reports status changes for a creatable, supporting progress tracking and error r
|
|
|
3619
3083
|
|
|
3620
3084
|
```ts
|
|
3621
3085
|
report(
|
|
3622
|
-
name,
|
|
3623
|
-
status
|
|
3624
|
-
|
|
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;
|
|
3625
3096
|
```
|
|
3626
3097
|
|
|
3627
3098
|
Report a non-error status with a numeric progress value.
|
|
3628
3099
|
|
|
3629
3100
|
#### Parameters
|
|
3630
3101
|
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
`BaseClassName`
|
|
3634
|
-
|
|
3635
|
-
|
|
3636
|
-
|
|
3637
|
-
`"creating"` | `"created"` | `"starting"` | `"started"` | `"stopping"` | `"stopped"` | `Exclude`\<`TAdditionalStatus` *extends* `void` ? [`StandardCreatableStatus`](#../type-aliases/StandardCreatableStatus) : `TAdditionalStatus`, `"error"`\>
|
|
3638
|
-
|
|
3639
|
-
##### progress
|
|
3640
|
-
|
|
3641
|
-
`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` |
|
|
3642
3107
|
|
|
3643
3108
|
#### Returns
|
|
3644
3109
|
|
|
@@ -3648,26 +3113,22 @@ Report a non-error status with a numeric progress value.
|
|
|
3648
3113
|
|
|
3649
3114
|
```ts
|
|
3650
3115
|
report(
|
|
3651
|
-
name,
|
|
3652
|
-
status
|
|
3653
|
-
|
|
3116
|
+
name: BaseClassName,
|
|
3117
|
+
status:
|
|
3118
|
+
| "error"
|
|
3119
|
+
| Extract<TAdditionalStatus extends void ? StandardCreatableStatus : TAdditionalStatus, "error">,
|
|
3120
|
+
error: Error): void;
|
|
3654
3121
|
```
|
|
3655
3122
|
|
|
3656
3123
|
Report an error status with the associated Error.
|
|
3657
3124
|
|
|
3658
3125
|
#### Parameters
|
|
3659
3126
|
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
`BaseClassName`
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
`"error"` | `Extract`\<`TAdditionalStatus` *extends* `void` ? [`StandardCreatableStatus`](#../type-aliases/StandardCreatableStatus) : `TAdditionalStatus`, `"error"`\>
|
|
3667
|
-
|
|
3668
|
-
##### error
|
|
3669
|
-
|
|
3670
|
-
`Error`
|
|
3127
|
+
| Parameter | Type |
|
|
3128
|
+
| ------ | ------ |
|
|
3129
|
+
| `name` | `BaseClassName` |
|
|
3130
|
+
| `status` | \| `"error"` \| `Extract`\<`TAdditionalStatus` *extends* `void` ? [`StandardCreatableStatus`](#../type-aliases/StandardCreatableStatus) : `TAdditionalStatus`, `"error"`\> |
|
|
3131
|
+
| `error` | `Error` |
|
|
3671
3132
|
|
|
3672
3133
|
#### Returns
|
|
3673
3134
|
|
|
@@ -3676,20 +3137,17 @@ Report an error status with the associated Error.
|
|
|
3676
3137
|
### Call Signature
|
|
3677
3138
|
|
|
3678
3139
|
```ts
|
|
3679
|
-
report(name, status): void;
|
|
3140
|
+
report(name: BaseClassName, status: CreatableStatus<TAdditionalStatus>): void;
|
|
3680
3141
|
```
|
|
3681
3142
|
|
|
3682
3143
|
Report a status change without progress or error details.
|
|
3683
3144
|
|
|
3684
3145
|
#### Parameters
|
|
3685
3146
|
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
`BaseClassName`
|
|
3689
|
-
|
|
3690
|
-
##### status
|
|
3691
|
-
|
|
3692
|
-
[`CreatableStatus`](#../type-aliases/CreatableStatus)\<`TAdditionalStatus`\>
|
|
3147
|
+
| Parameter | Type |
|
|
3148
|
+
| ------ | ------ |
|
|
3149
|
+
| `name` | `BaseClassName` |
|
|
3150
|
+
| `status` | [`CreatableStatus`](#../type-aliases/CreatableStatus)\<`TAdditionalStatus`\> |
|
|
3693
3151
|
|
|
3694
3152
|
#### Returns
|
|
3695
3153
|
|
|
@@ -3709,29 +3167,26 @@ Extends Creatable with a `factory` method that produces pre-configured Creatable
|
|
|
3709
3167
|
|
|
3710
3168
|
## Type Parameters
|
|
3711
3169
|
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)
|
|
3170
|
+
| Type Parameter | Default type |
|
|
3171
|
+
| ------ | ------ |
|
|
3172
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance) | [`CreatableInstance`](#CreatableInstance) |
|
|
3715
3173
|
|
|
3716
3174
|
## Constructors
|
|
3717
3175
|
|
|
3718
3176
|
### Constructor
|
|
3719
3177
|
|
|
3720
3178
|
```ts
|
|
3721
|
-
new CreatableWithFactory(key, params): T & AbstractCreatable<T["params"], EventData>;
|
|
3179
|
+
new CreatableWithFactory(key: unknown, params: Partial<CreatableParams>): T & AbstractCreatable<T["params"], EventData>;
|
|
3722
3180
|
```
|
|
3723
3181
|
|
|
3724
3182
|
Constructs a new raw instance. Should not be called directly; use `create` instead.
|
|
3725
3183
|
|
|
3726
3184
|
### Parameters
|
|
3727
3185
|
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
`unknown`
|
|
3731
|
-
|
|
3732
|
-
#### params
|
|
3733
|
-
|
|
3734
|
-
`Partial`\<[`CreatableParams`](#CreatableParams)\>
|
|
3186
|
+
| Parameter | Type |
|
|
3187
|
+
| ------ | ------ |
|
|
3188
|
+
| `key` | `unknown` |
|
|
3189
|
+
| `params` | `Partial`\<[`CreatableParams`](#CreatableParams)\> |
|
|
3735
3190
|
|
|
3736
3191
|
### Returns
|
|
3737
3192
|
|
|
@@ -3743,43 +3198,32 @@ Constructs a new raw instance. Should not be called directly; use `create` inste
|
|
|
3743
3198
|
|
|
3744
3199
|
## Properties
|
|
3745
3200
|
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
optional defaultLogger: Logger;
|
|
3750
|
-
```
|
|
3751
|
-
|
|
3752
|
-
Optional default logger shared across instances created by this class.
|
|
3753
|
-
|
|
3754
|
-
### Inherited from
|
|
3755
|
-
|
|
3756
|
-
[`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) |
|
|
3757
3204
|
|
|
3758
3205
|
## Methods
|
|
3759
3206
|
|
|
3760
3207
|
### create()
|
|
3761
3208
|
|
|
3762
3209
|
```ts
|
|
3763
|
-
create<T>(this
|
|
3210
|
+
create<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promise<T>;
|
|
3764
3211
|
```
|
|
3765
3212
|
|
|
3766
3213
|
Asynchronously creates and initializes a new instance with the given params.
|
|
3767
3214
|
|
|
3768
3215
|
### Type Parameters
|
|
3769
3216
|
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
3217
|
+
| Type Parameter |
|
|
3218
|
+
| ------ |
|
|
3219
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3773
3220
|
|
|
3774
3221
|
### Parameters
|
|
3775
3222
|
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
[`Creatable`](#Creatable)\<`T`\>
|
|
3779
|
-
|
|
3780
|
-
#### params?
|
|
3781
|
-
|
|
3782
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
3223
|
+
| Parameter | Type |
|
|
3224
|
+
| ------ | ------ |
|
|
3225
|
+
| `this` | [`Creatable`](#Creatable)\<`T`\> |
|
|
3226
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3783
3227
|
|
|
3784
3228
|
### Returns
|
|
3785
3229
|
|
|
@@ -3794,26 +3238,23 @@ Asynchronously creates and initializes a new instance with the given params.
|
|
|
3794
3238
|
### createHandler()
|
|
3795
3239
|
|
|
3796
3240
|
```ts
|
|
3797
|
-
createHandler<T>(this
|
|
3241
|
+
createHandler<T>(this: Creatable<T>, instance: T): Promisable<T>;
|
|
3798
3242
|
```
|
|
3799
3243
|
|
|
3800
3244
|
Hook called after construction to perform additional initialization on the instance.
|
|
3801
3245
|
|
|
3802
3246
|
### Type Parameters
|
|
3803
3247
|
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
3248
|
+
| Type Parameter |
|
|
3249
|
+
| ------ |
|
|
3250
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3807
3251
|
|
|
3808
3252
|
### Parameters
|
|
3809
3253
|
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
[`Creatable`](#Creatable)\<`T`\>
|
|
3813
|
-
|
|
3814
|
-
#### instance
|
|
3815
|
-
|
|
3816
|
-
`T`
|
|
3254
|
+
| Parameter | Type |
|
|
3255
|
+
| ------ | ------ |
|
|
3256
|
+
| `this` | [`Creatable`](#Creatable)\<`T`\> |
|
|
3257
|
+
| `instance` | `T` |
|
|
3817
3258
|
|
|
3818
3259
|
### Returns
|
|
3819
3260
|
|
|
@@ -3828,26 +3269,23 @@ Hook called after construction to perform additional initialization on the insta
|
|
|
3828
3269
|
### paramsHandler()
|
|
3829
3270
|
|
|
3830
3271
|
```ts
|
|
3831
|
-
paramsHandler<T>(this
|
|
3272
|
+
paramsHandler<T>(this: Creatable<T>, params?: Partial<T["params"]>): Promisable<T["params"] & RequiredCreatableParams<void>>;
|
|
3832
3273
|
```
|
|
3833
3274
|
|
|
3834
3275
|
Hook called to validate and transform params before instance construction.
|
|
3835
3276
|
|
|
3836
3277
|
### Type Parameters
|
|
3837
3278
|
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
3279
|
+
| Type Parameter |
|
|
3280
|
+
| ------ |
|
|
3281
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3841
3282
|
|
|
3842
3283
|
### Parameters
|
|
3843
3284
|
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
[`Creatable`](#Creatable)\<`T`\>
|
|
3847
|
-
|
|
3848
|
-
#### params?
|
|
3849
|
-
|
|
3850
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
3285
|
+
| Parameter | Type |
|
|
3286
|
+
| ------ | ------ |
|
|
3287
|
+
| `this` | [`Creatable`](#Creatable)\<`T`\> |
|
|
3288
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3851
3289
|
|
|
3852
3290
|
### Returns
|
|
3853
3291
|
|
|
@@ -3863,32 +3301,26 @@ Hook called to validate and transform params before instance construction.
|
|
|
3863
3301
|
|
|
3864
3302
|
```ts
|
|
3865
3303
|
factory<T>(
|
|
3866
|
-
this
|
|
3867
|
-
params
|
|
3868
|
-
labels
|
|
3304
|
+
this: Creatable<T>,
|
|
3305
|
+
params?: Partial<T["params"]>,
|
|
3306
|
+
labels?: Labels): CreatableFactory<T>;
|
|
3869
3307
|
```
|
|
3870
3308
|
|
|
3871
3309
|
Creates a factory with the given default params and labels.
|
|
3872
3310
|
|
|
3873
3311
|
### Type Parameters
|
|
3874
3312
|
|
|
3875
|
-
|
|
3876
|
-
|
|
3877
|
-
`T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\>
|
|
3313
|
+
| Type Parameter |
|
|
3314
|
+
| ------ |
|
|
3315
|
+
| `T` *extends* [`CreatableInstance`](#CreatableInstance)\<[`CreatableParams`](#CreatableParams), `EventData`\> |
|
|
3878
3316
|
|
|
3879
3317
|
### Parameters
|
|
3880
3318
|
|
|
3881
|
-
|
|
3882
|
-
|
|
3883
|
-
[`Creatable`](#Creatable)\<`T`\>
|
|
3884
|
-
|
|
3885
|
-
|
|
3886
|
-
|
|
3887
|
-
`Partial`\<`T`\[`"params"`\]\>
|
|
3888
|
-
|
|
3889
|
-
#### labels?
|
|
3890
|
-
|
|
3891
|
-
[`Labels`](#Labels)
|
|
3319
|
+
| Parameter | Type |
|
|
3320
|
+
| ------ | ------ |
|
|
3321
|
+
| `this` | [`Creatable`](#Creatable)\<`T`\> |
|
|
3322
|
+
| `params?` | `Partial`\<`T`\[`"params"`\]\> |
|
|
3323
|
+
| `labels?` | [`Labels`](#Labels) |
|
|
3892
3324
|
|
|
3893
3325
|
### Returns
|
|
3894
3326
|
|
|
@@ -3926,71 +3358,19 @@ The minimum required parameters for constructing a creatable.
|
|
|
3926
3358
|
|
|
3927
3359
|
## Type Parameters
|
|
3928
3360
|
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
`TAdditionalStatus` *extends* [`CreatableStatus`](#../type-aliases/CreatableStatus) \| `void`
|
|
3361
|
+
| Type Parameter | Default type |
|
|
3362
|
+
| ------ | ------ |
|
|
3363
|
+
| `TAdditionalStatus` *extends* [`CreatableStatus`](#../type-aliases/CreatableStatus) \| `void` | `void` |
|
|
3932
3364
|
|
|
3933
3365
|
## Properties
|
|
3934
3366
|
|
|
3935
|
-
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
```ts
|
|
3944
|
-
BaseEmitterParams.logger
|
|
3945
|
-
```
|
|
3946
|
-
|
|
3947
|
-
***
|
|
3948
|
-
|
|
3949
|
-
### meterProvider?
|
|
3950
|
-
|
|
3951
|
-
```ts
|
|
3952
|
-
optional meterProvider: MeterProvider;
|
|
3953
|
-
```
|
|
3954
|
-
|
|
3955
|
-
### Inherited from
|
|
3956
|
-
|
|
3957
|
-
```ts
|
|
3958
|
-
BaseEmitterParams.meterProvider
|
|
3959
|
-
```
|
|
3960
|
-
|
|
3961
|
-
***
|
|
3962
|
-
|
|
3963
|
-
### traceProvider?
|
|
3964
|
-
|
|
3965
|
-
```ts
|
|
3966
|
-
optional traceProvider: TracerProvider;
|
|
3967
|
-
```
|
|
3968
|
-
|
|
3969
|
-
### Inherited from
|
|
3970
|
-
|
|
3971
|
-
```ts
|
|
3972
|
-
BaseEmitterParams.traceProvider
|
|
3973
|
-
```
|
|
3974
|
-
|
|
3975
|
-
***
|
|
3976
|
-
|
|
3977
|
-
### name?
|
|
3978
|
-
|
|
3979
|
-
```ts
|
|
3980
|
-
optional name: CreatableName;
|
|
3981
|
-
```
|
|
3982
|
-
|
|
3983
|
-
Optional name identifying this creatable instance.
|
|
3984
|
-
|
|
3985
|
-
***
|
|
3986
|
-
|
|
3987
|
-
### statusReporter?
|
|
3988
|
-
|
|
3989
|
-
```ts
|
|
3990
|
-
optional statusReporter: CreatableStatusReporter<TAdditionalStatus>;
|
|
3991
|
-
```
|
|
3992
|
-
|
|
3993
|
-
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. | - |
|
|
3994
3374
|
|
|
3995
3375
|
### <a id="WithLabels"></a>WithLabels
|
|
3996
3376
|
|
|
@@ -4002,17 +3382,15 @@ Interface for objects that have labels.
|
|
|
4002
3382
|
|
|
4003
3383
|
## Type Parameters
|
|
4004
3384
|
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
`T` *extends* [`Labels`](#Labels)
|
|
3385
|
+
| Type Parameter | Default type |
|
|
3386
|
+
| ------ | ------ |
|
|
3387
|
+
| `T` *extends* [`Labels`](#Labels) | [`Labels`](#Labels) |
|
|
4008
3388
|
|
|
4009
3389
|
## Properties
|
|
4010
3390
|
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
labels: T;
|
|
4015
|
-
```
|
|
3391
|
+
| Property | Type |
|
|
3392
|
+
| ------ | ------ |
|
|
3393
|
+
| <a id="labels"></a> `labels` | `T` |
|
|
4016
3394
|
|
|
4017
3395
|
### <a id="WithOptionalLabels"></a>WithOptionalLabels
|
|
4018
3396
|
|
|
@@ -4024,17 +3402,15 @@ Interface for objects that have labels.
|
|
|
4024
3402
|
|
|
4025
3403
|
## Type Parameters
|
|
4026
3404
|
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
`T` *extends* [`Labels`](#Labels)
|
|
3405
|
+
| Type Parameter | Default type |
|
|
3406
|
+
| ------ | ------ |
|
|
3407
|
+
| `T` *extends* [`Labels`](#Labels) | [`Labels`](#Labels) |
|
|
4030
3408
|
|
|
4031
3409
|
## Properties
|
|
4032
3410
|
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
optional labels: T;
|
|
4037
|
-
```
|
|
3411
|
+
| Property | Type |
|
|
3412
|
+
| ------ | ------ |
|
|
3413
|
+
| <a id="labels"></a> `labels?` | `T` |
|
|
4038
3414
|
|
|
4039
3415
|
### type-aliases
|
|
4040
3416
|
|
|
@@ -4066,9 +3442,9 @@ A creatable's status, optionally extended with additional custom status values.
|
|
|
4066
3442
|
|
|
4067
3443
|
## Type Parameters
|
|
4068
3444
|
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
`TAdditionalStatus` *extends* `void` \| `string`
|
|
3445
|
+
| Type Parameter | Default type |
|
|
3446
|
+
| ------ | ------ |
|
|
3447
|
+
| `TAdditionalStatus` *extends* `void` \| `string` | `void` |
|
|
4072
3448
|
|
|
4073
3449
|
### <a id="StandardCreatableStatus"></a>StandardCreatableStatus
|
|
4074
3450
|
|