@xylabs/base 5.0.83 → 5.0.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -192
- package/dist/neutral/Base.d.ts +7 -0
- package/dist/neutral/Base.d.ts.map +1 -1
- package/dist/neutral/UniqueBase.d.ts +1 -0
- package/dist/neutral/UniqueBase.d.ts.map +1 -1
- package/dist/neutral/globallyUnique.d.ts +9 -0
- package/dist/neutral/globallyUnique.d.ts.map +1 -1
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +6 -6
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/base**
|
|
@@ -23,19 +25,25 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
23
25
|
|
|
24
26
|
## Classes
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
| Class | Description |
|
|
29
|
+
| ------ | ------ |
|
|
30
|
+
| [Base](#classes/Base) | Abstract base class providing logging, telemetry, and global instance tracking with WeakRef-based GC. |
|
|
31
|
+
| [UniqueBase](#classes/UniqueBase) | Base class that registers itself as globally unique, preventing duplicate module instances. |
|
|
28
32
|
|
|
29
33
|
## Type Aliases
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
| Type Alias | Description |
|
|
36
|
+
| ------ | ------ |
|
|
37
|
+
| [BaseClassName](#type-aliases/BaseClassName) | Branded string type representing a class name used for global instance tracking. |
|
|
38
|
+
| [BaseParamsFields](#type-aliases/BaseParamsFields) | Common parameter fields available to all Base instances (logger, meter, tracer). |
|
|
39
|
+
| [BaseParams](#type-aliases/BaseParams) | Parameters for constructing a Base instance, combining BaseParamsFields with optional additional params. |
|
|
34
40
|
|
|
35
41
|
## Functions
|
|
36
42
|
|
|
37
|
-
|
|
38
|
-
|
|
43
|
+
| Function | Description |
|
|
44
|
+
| ------ | ------ |
|
|
45
|
+
| [disableGloballyUnique](#functions/disableGloballyUnique) | Disables global uniqueness checks, allowing duplicate registrations without throwing. |
|
|
46
|
+
| [globallyUnique](#functions/globallyUnique) | Registers a value as globally unique under the given name and domain. Throws if a different value is already registered under the same key. |
|
|
39
47
|
|
|
40
48
|
### classes
|
|
41
49
|
|
|
@@ -45,29 +53,31 @@ Base functionality used throughout XY Labs TypeScript/JavaScript libraries
|
|
|
45
53
|
|
|
46
54
|
***
|
|
47
55
|
|
|
56
|
+
Abstract base class providing logging, telemetry, and global instance tracking with WeakRef-based GC.
|
|
57
|
+
|
|
48
58
|
## Extended by
|
|
49
59
|
|
|
50
60
|
- [`UniqueBase`](#UniqueBase)
|
|
51
61
|
|
|
52
62
|
## Type Parameters
|
|
53
63
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
`TParams` *extends* [`BaseParams`](#../type-aliases/BaseParams)
|
|
64
|
+
| Type Parameter | Default type | Description |
|
|
65
|
+
| ------ | ------ | ------ |
|
|
66
|
+
| `TParams` *extends* [`BaseParams`](#../type-aliases/BaseParams) | [`BaseParams`](#../type-aliases/BaseParams) | The parameter type, extending BaseParams |
|
|
57
67
|
|
|
58
68
|
## Constructors
|
|
59
69
|
|
|
60
70
|
### Constructor
|
|
61
71
|
|
|
62
72
|
```ts
|
|
63
|
-
new Base<TParams>(params): Base<TParams>;
|
|
73
|
+
new Base<TParams>(params: BaseParams<TParams>): Base<TParams>;
|
|
64
74
|
```
|
|
65
75
|
|
|
66
76
|
### Parameters
|
|
67
77
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
[`BaseParams`](#../type-aliases/BaseParams)\<`TParams`\>
|
|
78
|
+
| Parameter | Type |
|
|
79
|
+
| ------ | ------ |
|
|
80
|
+
| `params` | [`BaseParams`](#../type-aliases/BaseParams)\<`TParams`\> |
|
|
71
81
|
|
|
72
82
|
### Returns
|
|
73
83
|
|
|
@@ -75,27 +85,11 @@ new Base<TParams>(params): Base<TParams>;
|
|
|
75
85
|
|
|
76
86
|
## Properties
|
|
77
87
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
***
|
|
85
|
-
|
|
86
|
-
### globalInstances
|
|
87
|
-
|
|
88
|
-
```ts
|
|
89
|
-
readonly static globalInstances: Record<BaseClassName, WeakRef<Base>[]> = {};
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
***
|
|
93
|
-
|
|
94
|
-
### globalInstancesCountHistory
|
|
95
|
-
|
|
96
|
-
```ts
|
|
97
|
-
readonly static globalInstancesCountHistory: Record<BaseClassName, number[]> = {};
|
|
98
|
-
```
|
|
88
|
+
| Property | Modifier | Type | Default value |
|
|
89
|
+
| ------ | ------ | ------ | ------ |
|
|
90
|
+
| <a id="defaultlogger"></a> `defaultLogger?` | `static` | `Logger` | `undefined` |
|
|
91
|
+
| <a id="globalinstances"></a> `globalInstances` | `readonly` | `Record`\<[`BaseClassName`](#../type-aliases/BaseClassName), `WeakRef`\<`Base`\>[]\> | `{}` |
|
|
92
|
+
| <a id="globalinstancescounthistory"></a> `globalInstancesCountHistory` | `readonly` | `Record`\<[`BaseClassName`](#../type-aliases/BaseClassName), `number`[]\> | `{}` |
|
|
99
93
|
|
|
100
94
|
## Accessors
|
|
101
95
|
|
|
@@ -114,14 +108,14 @@ get static historyInterval(): number;
|
|
|
114
108
|
### Set Signature
|
|
115
109
|
|
|
116
110
|
```ts
|
|
117
|
-
set static historyInterval(value): void;
|
|
111
|
+
set static historyInterval(value: number): void;
|
|
118
112
|
```
|
|
119
113
|
|
|
120
114
|
#### Parameters
|
|
121
115
|
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
`number`
|
|
116
|
+
| Parameter | Type |
|
|
117
|
+
| ------ | ------ |
|
|
118
|
+
| `value` | `number` |
|
|
125
119
|
|
|
126
120
|
#### Returns
|
|
127
121
|
|
|
@@ -144,14 +138,14 @@ get static historyTime(): number;
|
|
|
144
138
|
### Set Signature
|
|
145
139
|
|
|
146
140
|
```ts
|
|
147
|
-
set static historyTime(value): void;
|
|
141
|
+
set static historyTime(value: number): void;
|
|
148
142
|
```
|
|
149
143
|
|
|
150
144
|
#### Parameters
|
|
151
145
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
`number`
|
|
146
|
+
| Parameter | Type |
|
|
147
|
+
| ------ | ------ |
|
|
148
|
+
| `value` | `number` |
|
|
155
149
|
|
|
156
150
|
#### Returns
|
|
157
151
|
|
|
@@ -174,14 +168,14 @@ get static maxGcFrequency(): number;
|
|
|
174
168
|
### Set Signature
|
|
175
169
|
|
|
176
170
|
```ts
|
|
177
|
-
set static maxGcFrequency(value): void;
|
|
171
|
+
set static maxGcFrequency(value: number): void;
|
|
178
172
|
```
|
|
179
173
|
|
|
180
174
|
#### Parameters
|
|
181
175
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
`number`
|
|
176
|
+
| Parameter | Type |
|
|
177
|
+
| ------ | ------ |
|
|
178
|
+
| `value` | `number` |
|
|
185
179
|
|
|
186
180
|
#### Returns
|
|
187
181
|
|
|
@@ -264,14 +258,14 @@ get tracer(): Tracer | undefined;
|
|
|
264
258
|
### Call Signature
|
|
265
259
|
|
|
266
260
|
```ts
|
|
267
|
-
static gc(force
|
|
261
|
+
static gc(force?: boolean): void;
|
|
268
262
|
```
|
|
269
263
|
|
|
270
264
|
#### Parameters
|
|
271
265
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
`boolean`
|
|
266
|
+
| Parameter | Type |
|
|
267
|
+
| ------ | ------ |
|
|
268
|
+
| `force?` | `boolean` |
|
|
275
269
|
|
|
276
270
|
#### Returns
|
|
277
271
|
|
|
@@ -280,14 +274,14 @@ static gc(force?): void;
|
|
|
280
274
|
### Call Signature
|
|
281
275
|
|
|
282
276
|
```ts
|
|
283
|
-
static gc(className): void;
|
|
277
|
+
static gc(className: BaseClassName): void;
|
|
284
278
|
```
|
|
285
279
|
|
|
286
280
|
#### Parameters
|
|
287
281
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
[`BaseClassName`](#../type-aliases/BaseClassName)
|
|
282
|
+
| Parameter | Type |
|
|
283
|
+
| ------ | ------ |
|
|
284
|
+
| `className` | [`BaseClassName`](#../type-aliases/BaseClassName) |
|
|
291
285
|
|
|
292
286
|
#### Returns
|
|
293
287
|
|
|
@@ -298,14 +292,14 @@ static gc(className): void;
|
|
|
298
292
|
### instanceCount()
|
|
299
293
|
|
|
300
294
|
```ts
|
|
301
|
-
static instanceCount(className): number;
|
|
295
|
+
static instanceCount(className: BaseClassName): number;
|
|
302
296
|
```
|
|
303
297
|
|
|
304
298
|
### Parameters
|
|
305
299
|
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
[`BaseClassName`](#../type-aliases/BaseClassName)
|
|
300
|
+
| Parameter | Type |
|
|
301
|
+
| ------ | ------ |
|
|
302
|
+
| `className` | [`BaseClassName`](#../type-aliases/BaseClassName) |
|
|
309
303
|
|
|
310
304
|
### Returns
|
|
311
305
|
|
|
@@ -353,29 +347,31 @@ static stopHistory(): void;
|
|
|
353
347
|
|
|
354
348
|
***
|
|
355
349
|
|
|
350
|
+
Base class that registers itself as globally unique, preventing duplicate module instances.
|
|
351
|
+
|
|
356
352
|
## Extends
|
|
357
353
|
|
|
358
354
|
- [`Base`](#Base)\<`TParams`\>
|
|
359
355
|
|
|
360
356
|
## Type Parameters
|
|
361
357
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
`TParams` *extends* [`BaseParams`](#../type-aliases/BaseParams)
|
|
358
|
+
| Type Parameter | Default type |
|
|
359
|
+
| ------ | ------ |
|
|
360
|
+
| `TParams` *extends* [`BaseParams`](#../type-aliases/BaseParams) | [`BaseParams`](#../type-aliases/BaseParams) |
|
|
365
361
|
|
|
366
362
|
## Constructors
|
|
367
363
|
|
|
368
364
|
### Constructor
|
|
369
365
|
|
|
370
366
|
```ts
|
|
371
|
-
new UniqueBase<TParams>(params): UniqueBase<TParams>;
|
|
367
|
+
new UniqueBase<TParams>(params: BaseParams<TParams>): UniqueBase<TParams>;
|
|
372
368
|
```
|
|
373
369
|
|
|
374
370
|
### Parameters
|
|
375
371
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
[`BaseParams`](#../type-aliases/BaseParams)\<`TParams`\>
|
|
372
|
+
| Parameter | Type |
|
|
373
|
+
| ------ | ------ |
|
|
374
|
+
| `params` | [`BaseParams`](#../type-aliases/BaseParams)\<`TParams`\> |
|
|
379
375
|
|
|
380
376
|
### Returns
|
|
381
377
|
|
|
@@ -387,63 +383,14 @@ new UniqueBase<TParams>(params): UniqueBase<TParams>;
|
|
|
387
383
|
|
|
388
384
|
## Properties
|
|
389
385
|
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
[`Base`](#Base).[`defaultLogger`](Base.md#defaultlogger)
|
|
399
|
-
|
|
400
|
-
***
|
|
401
|
-
|
|
402
|
-
### globalInstances
|
|
403
|
-
|
|
404
|
-
```ts
|
|
405
|
-
readonly static globalInstances: Record<BaseClassName, WeakRef<Base>[]> = {};
|
|
406
|
-
```
|
|
407
|
-
|
|
408
|
-
### Inherited from
|
|
409
|
-
|
|
410
|
-
[`Base`](#Base).[`globalInstances`](Base.md#globalinstances)
|
|
411
|
-
|
|
412
|
-
***
|
|
413
|
-
|
|
414
|
-
### globalInstancesCountHistory
|
|
415
|
-
|
|
416
|
-
```ts
|
|
417
|
-
readonly static globalInstancesCountHistory: Record<BaseClassName, number[]> = {};
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
### Inherited from
|
|
421
|
-
|
|
422
|
-
[`Base`](#Base).[`globalInstancesCountHistory`](Base.md#globalinstancescounthistory)
|
|
423
|
-
|
|
424
|
-
***
|
|
425
|
-
|
|
426
|
-
### uniqueDomain
|
|
427
|
-
|
|
428
|
-
```ts
|
|
429
|
-
readonly static uniqueDomain: "xy" = 'xy';
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
***
|
|
433
|
-
|
|
434
|
-
### uniqueName
|
|
435
|
-
|
|
436
|
-
```ts
|
|
437
|
-
readonly static uniqueName: string;
|
|
438
|
-
```
|
|
439
|
-
|
|
440
|
-
***
|
|
441
|
-
|
|
442
|
-
### uniqueNameXyo
|
|
443
|
-
|
|
444
|
-
```ts
|
|
445
|
-
readonly static uniqueNameXyo: string;
|
|
446
|
-
```
|
|
386
|
+
| Property | Modifier | Type | Default value | Inherited from |
|
|
387
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
388
|
+
| <a id="defaultlogger"></a> `defaultLogger?` | `static` | `Logger` | `undefined` | [`Base`](#Base).[`defaultLogger`](Base.md#defaultlogger) |
|
|
389
|
+
| <a id="globalinstances"></a> `globalInstances` | `readonly` | `Record`\<[`BaseClassName`](#../type-aliases/BaseClassName), `WeakRef`\<[`Base`](#Base)\>[]\> | `{}` | [`Base`](#Base).[`globalInstances`](Base.md#globalinstances) |
|
|
390
|
+
| <a id="globalinstancescounthistory"></a> `globalInstancesCountHistory` | `readonly` | `Record`\<[`BaseClassName`](#../type-aliases/BaseClassName), `number`[]\> | `{}` | [`Base`](#Base).[`globalInstancesCountHistory`](Base.md#globalinstancescounthistory) |
|
|
391
|
+
| <a id="uniquedomain"></a> `uniqueDomain` | `readonly` | `"xy"` | `'xy'` | - |
|
|
392
|
+
| <a id="uniquename"></a> `uniqueName` | `readonly` | `string` | `undefined` | - |
|
|
393
|
+
| <a id="uniquenamexyo"></a> `uniqueNameXyo` | `readonly` | `string` | `undefined` | - |
|
|
447
394
|
|
|
448
395
|
## Accessors
|
|
449
396
|
|
|
@@ -462,14 +409,14 @@ get static historyInterval(): number;
|
|
|
462
409
|
### Set Signature
|
|
463
410
|
|
|
464
411
|
```ts
|
|
465
|
-
set static historyInterval(value): void;
|
|
412
|
+
set static historyInterval(value: number): void;
|
|
466
413
|
```
|
|
467
414
|
|
|
468
415
|
#### Parameters
|
|
469
416
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
`number`
|
|
417
|
+
| Parameter | Type |
|
|
418
|
+
| ------ | ------ |
|
|
419
|
+
| `value` | `number` |
|
|
473
420
|
|
|
474
421
|
#### Returns
|
|
475
422
|
|
|
@@ -496,14 +443,14 @@ get static historyTime(): number;
|
|
|
496
443
|
### Set Signature
|
|
497
444
|
|
|
498
445
|
```ts
|
|
499
|
-
set static historyTime(value): void;
|
|
446
|
+
set static historyTime(value: number): void;
|
|
500
447
|
```
|
|
501
448
|
|
|
502
449
|
#### Parameters
|
|
503
450
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
`number`
|
|
451
|
+
| Parameter | Type |
|
|
452
|
+
| ------ | ------ |
|
|
453
|
+
| `value` | `number` |
|
|
507
454
|
|
|
508
455
|
#### Returns
|
|
509
456
|
|
|
@@ -530,14 +477,14 @@ get static maxGcFrequency(): number;
|
|
|
530
477
|
### Set Signature
|
|
531
478
|
|
|
532
479
|
```ts
|
|
533
|
-
set static maxGcFrequency(value): void;
|
|
480
|
+
set static maxGcFrequency(value: number): void;
|
|
534
481
|
```
|
|
535
482
|
|
|
536
483
|
#### Parameters
|
|
537
484
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
`number`
|
|
485
|
+
| Parameter | Type |
|
|
486
|
+
| ------ | ------ |
|
|
487
|
+
| `value` | `number` |
|
|
541
488
|
|
|
542
489
|
#### Returns
|
|
543
490
|
|
|
@@ -644,14 +591,14 @@ get tracer(): Tracer | undefined;
|
|
|
644
591
|
### Call Signature
|
|
645
592
|
|
|
646
593
|
```ts
|
|
647
|
-
static gc(force
|
|
594
|
+
static gc(force?: boolean): void;
|
|
648
595
|
```
|
|
649
596
|
|
|
650
597
|
#### Parameters
|
|
651
598
|
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
`boolean`
|
|
599
|
+
| Parameter | Type |
|
|
600
|
+
| ------ | ------ |
|
|
601
|
+
| `force?` | `boolean` |
|
|
655
602
|
|
|
656
603
|
#### Returns
|
|
657
604
|
|
|
@@ -664,14 +611,14 @@ static gc(force?): void;
|
|
|
664
611
|
### Call Signature
|
|
665
612
|
|
|
666
613
|
```ts
|
|
667
|
-
static gc(className): void;
|
|
614
|
+
static gc(className: BaseClassName): void;
|
|
668
615
|
```
|
|
669
616
|
|
|
670
617
|
#### Parameters
|
|
671
618
|
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
[`BaseClassName`](#../type-aliases/BaseClassName)
|
|
619
|
+
| Parameter | Type |
|
|
620
|
+
| ------ | ------ |
|
|
621
|
+
| `className` | [`BaseClassName`](#../type-aliases/BaseClassName) |
|
|
675
622
|
|
|
676
623
|
#### Returns
|
|
677
624
|
|
|
@@ -686,14 +633,14 @@ static gc(className): void;
|
|
|
686
633
|
### instanceCount()
|
|
687
634
|
|
|
688
635
|
```ts
|
|
689
|
-
static instanceCount(className): number;
|
|
636
|
+
static instanceCount(className: BaseClassName): number;
|
|
690
637
|
```
|
|
691
638
|
|
|
692
639
|
### Parameters
|
|
693
640
|
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
[`BaseClassName`](#../type-aliases/BaseClassName)
|
|
641
|
+
| Parameter | Type |
|
|
642
|
+
| ------ | ------ |
|
|
643
|
+
| `className` | [`BaseClassName`](#../type-aliases/BaseClassName) |
|
|
697
644
|
|
|
698
645
|
### Returns
|
|
699
646
|
|
|
@@ -763,6 +710,8 @@ static stopHistory(): void;
|
|
|
763
710
|
function disableGloballyUnique(): void;
|
|
764
711
|
```
|
|
765
712
|
|
|
713
|
+
Disables global uniqueness checks, allowing duplicate registrations without throwing.
|
|
714
|
+
|
|
766
715
|
## Returns
|
|
767
716
|
|
|
768
717
|
`void`
|
|
@@ -775,29 +724,28 @@ function disableGloballyUnique(): void;
|
|
|
775
724
|
|
|
776
725
|
```ts
|
|
777
726
|
function globallyUnique(
|
|
778
|
-
name,
|
|
779
|
-
value,
|
|
780
|
-
domain
|
|
727
|
+
name: string | symbol,
|
|
728
|
+
value: unknown,
|
|
729
|
+
domain?: string): string;
|
|
781
730
|
```
|
|
782
731
|
|
|
783
|
-
|
|
732
|
+
Registers a value as globally unique under the given name and domain.
|
|
733
|
+
Throws if a different value is already registered under the same key.
|
|
784
734
|
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
`string` | `symbol`
|
|
788
|
-
|
|
789
|
-
### value
|
|
790
|
-
|
|
791
|
-
`unknown`
|
|
792
|
-
|
|
793
|
-
### domain?
|
|
735
|
+
## Parameters
|
|
794
736
|
|
|
795
|
-
|
|
737
|
+
| Parameter | Type | Default value | Description |
|
|
738
|
+
| ------ | ------ | ------ | ------ |
|
|
739
|
+
| `name` | `string` \| `symbol` | `undefined` | The unique name or symbol |
|
|
740
|
+
| `value` | `unknown` | `undefined` | The value to register |
|
|
741
|
+
| `domain` | `string` | `'global'` | The namespace domain (default 'global') |
|
|
796
742
|
|
|
797
743
|
## Returns
|
|
798
744
|
|
|
799
745
|
`string`
|
|
800
746
|
|
|
747
|
+
The fully qualified unique name
|
|
748
|
+
|
|
801
749
|
### type-aliases
|
|
802
750
|
|
|
803
751
|
### <a id="BaseClassName"></a>BaseClassName
|
|
@@ -807,16 +755,18 @@ function globallyUnique(
|
|
|
807
755
|
***
|
|
808
756
|
|
|
809
757
|
```ts
|
|
810
|
-
type BaseClassName = string &
|
|
758
|
+
type BaseClassName = string & {
|
|
759
|
+
__baseClassName: true;
|
|
760
|
+
};
|
|
811
761
|
```
|
|
812
762
|
|
|
813
|
-
|
|
763
|
+
Branded string type representing a class name used for global instance tracking.
|
|
814
764
|
|
|
815
|
-
|
|
765
|
+
## Type Declaration
|
|
816
766
|
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
767
|
+
| Name | Type |
|
|
768
|
+
| ------ | ------ |
|
|
769
|
+
| `__baseClassName` | `true` |
|
|
820
770
|
|
|
821
771
|
### <a id="BaseParams"></a>BaseParams
|
|
822
772
|
|
|
@@ -828,11 +778,13 @@ __baseClassName: true;
|
|
|
828
778
|
type BaseParams<TAdditionalParams> = TAdditionalParams & BaseParamsFields;
|
|
829
779
|
```
|
|
830
780
|
|
|
831
|
-
|
|
781
|
+
Parameters for constructing a Base instance, combining BaseParamsFields with optional additional params.
|
|
832
782
|
|
|
833
|
-
|
|
783
|
+
## Type Parameters
|
|
834
784
|
|
|
835
|
-
|
|
785
|
+
| Type Parameter | Default type |
|
|
786
|
+
| ------ | ------ |
|
|
787
|
+
| `TAdditionalParams` *extends* `EmptyObject` | `EmptyObject` |
|
|
836
788
|
|
|
837
789
|
### <a id="BaseParamsFields"></a>BaseParamsFields
|
|
838
790
|
|
|
@@ -841,32 +793,22 @@ type BaseParams<TAdditionalParams> = TAdditionalParams & BaseParamsFields;
|
|
|
841
793
|
***
|
|
842
794
|
|
|
843
795
|
```ts
|
|
844
|
-
type BaseParamsFields =
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
### logger?
|
|
850
|
-
|
|
851
|
-
```ts
|
|
852
|
-
optional logger: Logger;
|
|
853
|
-
```
|
|
854
|
-
|
|
855
|
-
***
|
|
856
|
-
|
|
857
|
-
### meterProvider?
|
|
858
|
-
|
|
859
|
-
```ts
|
|
860
|
-
optional meterProvider: MeterProvider;
|
|
796
|
+
type BaseParamsFields = {
|
|
797
|
+
logger?: Logger;
|
|
798
|
+
meterProvider?: MeterProvider;
|
|
799
|
+
traceProvider?: TracerProvider;
|
|
800
|
+
};
|
|
861
801
|
```
|
|
862
802
|
|
|
863
|
-
|
|
803
|
+
Common parameter fields available to all Base instances (logger, meter, tracer).
|
|
864
804
|
|
|
865
|
-
|
|
805
|
+
## Properties
|
|
866
806
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
807
|
+
| Property | Type |
|
|
808
|
+
| ------ | ------ |
|
|
809
|
+
| <a id="logger"></a> `logger?` | `Logger` |
|
|
810
|
+
| <a id="meterprovider"></a> `meterProvider?` | `MeterProvider` |
|
|
811
|
+
| <a id="traceprovider"></a> `traceProvider?` | `TracerProvider` |
|
|
870
812
|
|
|
871
813
|
|
|
872
814
|
Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
|
package/dist/neutral/Base.d.ts
CHANGED
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import type { Meter, MeterProvider, Tracer, TracerProvider } from '@opentelemetry/api';
|
|
2
2
|
import type { Logger } from '@xylabs/logger';
|
|
3
3
|
import type { EmptyObject } from '@xylabs/object';
|
|
4
|
+
/** Branded string type representing a class name used for global instance tracking. */
|
|
4
5
|
export type BaseClassName = string & {
|
|
5
6
|
__baseClassName: true;
|
|
6
7
|
};
|
|
8
|
+
/** Common parameter fields available to all Base instances (logger, meter, tracer). */
|
|
7
9
|
export type BaseParamsFields = {
|
|
8
10
|
logger?: Logger;
|
|
9
11
|
meterProvider?: MeterProvider;
|
|
10
12
|
traceProvider?: TracerProvider;
|
|
11
13
|
};
|
|
14
|
+
/** Parameters for constructing a Base instance, combining BaseParamsFields with optional additional params. */
|
|
12
15
|
export type BaseParams<TAdditionalParams extends EmptyObject = EmptyObject> = TAdditionalParams & BaseParamsFields;
|
|
16
|
+
/**
|
|
17
|
+
* Abstract base class providing logging, telemetry, and global instance tracking with WeakRef-based GC.
|
|
18
|
+
* @typeParam TParams - The parameter type, extending BaseParams
|
|
19
|
+
*/
|
|
13
20
|
export declare abstract class Base<TParams extends BaseParams = BaseParams> {
|
|
14
21
|
static defaultLogger?: Logger;
|
|
15
22
|
static readonly globalInstances: Record<BaseClassName, WeakRef<Base>[]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../src/Base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,KAAK,EACL,aAAa,EAAE,MAAM,EAAE,cAAc,EACtC,MAA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,SAAS,CAE7B;IAED,IAAI,MAAM,wBAET;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,SAAS,CAE/B;IAED,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAChC,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,aAAa,GAAG,IAAI;IAWzC,MAAM,CAAC,aAAa,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM;IAItD,MAAM,CAAC,cAAc,IAAI,MAAM,CAAC,aAAa,EAAE,MAAM,CAAC;IAOtD,MAAM,CAAC,YAAY,IAAI,IAAI;IAe3B,MAAM,CAAC,WAAW,IAAI,IAAI;IAO1B,OAAO,CAAC,MAAM,CAAC,YAAY;IAQ3B,OAAO,CAAC,MAAM,CAAC,KAAK;IAMpB,OAAO,CAAC,MAAM,CAAC,OAAO;IAKtB,OAAO,CAAC,cAAc;CAMvB"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { BaseParams } from './Base.ts';
|
|
2
2
|
import { Base } from './Base.ts';
|
|
3
|
+
/** Base class that registers itself as globally unique, preventing duplicate module instances. */
|
|
3
4
|
export declare abstract class UniqueBase<TParams extends BaseParams = BaseParams> extends Base<TParams> {
|
|
4
5
|
static readonly uniqueDomain = "xy";
|
|
5
6
|
static readonly uniqueName: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UniqueBase.d.ts","sourceRoot":"","sources":["../../src/UniqueBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,8BAAsB,UAAU,CAAC,OAAO,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,IAAI,CAAC,OAAO,CAAC;IAC7F,MAAM,CAAC,QAAQ,CAAC,YAAY,QAAO;IACnC,MAAM,CAAC,QAAQ,CAAC,UAAU,SAAqD;IAE/E,MAAM,CAAC,QAAQ,CAAC,aAAa,SAAyC;gBAC1D,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC;CAGxC"}
|
|
1
|
+
{"version":3,"file":"UniqueBase.d.ts","sourceRoot":"","sources":["../../src/UniqueBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAGhC,kGAAkG;AAClG,8BAAsB,UAAU,CAAC,OAAO,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,IAAI,CAAC,OAAO,CAAC;IAC7F,MAAM,CAAC,QAAQ,CAAC,YAAY,QAAO;IACnC,MAAM,CAAC,QAAQ,CAAC,UAAU,SAAqD;IAE/E,MAAM,CAAC,QAAQ,CAAC,aAAa,SAAyC;gBAC1D,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC;CAGxC"}
|
|
@@ -4,6 +4,15 @@ declare global {
|
|
|
4
4
|
uniqueDisabled?: boolean;
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
|
+
/** Disables global uniqueness checks, allowing duplicate registrations without throwing. */
|
|
7
8
|
export declare const disableGloballyUnique: () => void;
|
|
9
|
+
/**
|
|
10
|
+
* Registers a value as globally unique under the given name and domain.
|
|
11
|
+
* Throws if a different value is already registered under the same key.
|
|
12
|
+
* @param name - The unique name or symbol
|
|
13
|
+
* @param value - The value to register
|
|
14
|
+
* @param domain - The namespace domain (default 'global')
|
|
15
|
+
* @returns The fully qualified unique name
|
|
16
|
+
*/
|
|
8
17
|
export declare const globallyUnique: (name: string | symbol, value: unknown, domain?: string) => string;
|
|
9
18
|
//# sourceMappingURL=globallyUnique.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"globallyUnique.d.ts","sourceRoot":"","sources":["../../src/globallyUnique.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,MAAM,EAAE;QACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;KACzB,CAAA;CACF;AAOD,eAAO,MAAM,qBAAqB,YAEjC,CAAA;AAED,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,GAAG,MAAM,EAAE,OAAO,OAAO,EAAE,eAAiB,WAgBtF,CAAA"}
|
|
1
|
+
{"version":3,"file":"globallyUnique.d.ts","sourceRoot":"","sources":["../../src/globallyUnique.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,IAAI,MAAM,EAAE;QACV,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAC/B,cAAc,CAAC,EAAE,OAAO,CAAA;KACzB,CAAA;CACF;AAOD,4FAA4F;AAC5F,eAAO,MAAM,qBAAqB,YAEjC,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,GAAG,MAAM,EAAE,OAAO,OAAO,EAAE,eAAiB,WAgBtF,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/Base.ts","../../src/globallyUnique.ts","../../src/UniqueBase.ts"],"sourcesContent":["import type {\n Meter,\n MeterProvider, Tracer, TracerProvider,\n} from '@opentelemetry/api'\nimport { assertEx } from '@xylabs/assert'\nimport type { Logger } from '@xylabs/logger'\nimport type { EmptyObject } from '@xylabs/object'\n\nconst DEFAULT_HISTORY_INTERVAL = 1000 * 5\nconst DEFAULT_HISTORY_TIME = 60 * 60 * 1000\nconst MAX_GC_FREQUENCY = 1000 * 60\nconst MIN_GC_FREQUENCY = 1000\nconst MIN_HISTORY_INTERVAL = 1000\n\nexport type BaseClassName = string & { __baseClassName: true }\n\nexport type BaseParamsFields = {\n logger?: Logger\n meterProvider?: MeterProvider\n traceProvider?: TracerProvider\n}\n\nexport type BaseParams<TAdditionalParams extends EmptyObject = EmptyObject> = TAdditionalParams & BaseParamsFields\n\nexport abstract class Base<TParams extends BaseParams = BaseParams> {\n static defaultLogger?: Logger\n static readonly globalInstances: Record<BaseClassName, WeakRef<Base>[]> = {}\n static readonly globalInstancesCountHistory: Record<BaseClassName, number[]> = {}\n private static _historyInterval = DEFAULT_HISTORY_INTERVAL\n private static _historyTime = DEFAULT_HISTORY_TIME\n private static _historyTimeout?: ReturnType<typeof setTimeout>\n private static _lastGC = 0\n private static _maxGcFrequency = MAX_GC_FREQUENCY\n private _params: BaseParams<TParams>\n\n constructor(params: BaseParams<TParams>) {\n this._params = params\n params?.logger?.debug(`Base constructed [${Object(this).name}]`)\n this.recordInstance()\n }\n\n static get historyInterval() {\n return this._historyInterval\n }\n\n static set historyInterval(value: number) {\n assertEx(value <= this.historyTime, () => `historyInterval [${value}] must be less than or equal to historyTime [${this.historyTime}]`)\n this._historyInterval = Math.max(value, MIN_HISTORY_INTERVAL)\n }\n\n static get historyTime() {\n return this._historyTime\n }\n\n static set historyTime(value: number) {\n assertEx(value >= this.historyInterval, () => `historyTime [${value}] must be greater than or equal to historyInterval [${this.historyInterval}]`)\n this._historyInterval = value\n }\n\n static get maxGcFrequency() {\n return this._maxGcFrequency\n }\n\n static set maxGcFrequency(value: number) {\n this._maxGcFrequency = Math.max(value, MIN_GC_FREQUENCY)\n }\n\n static get maxHistoryDepth() {\n return Math.floor(this.historyTime / this.historyInterval)\n }\n\n get logger() {\n return this.params?.logger ?? Base.defaultLogger\n }\n\n get meter(): Meter | undefined {\n return this.params?.meterProvider?.getMeter(this.constructor.name)\n }\n\n get params() {\n return this._params\n }\n\n get tracer(): Tracer | undefined {\n return this.params?.traceProvider?.getTracer(this.constructor.name)\n }\n\n static gc(force?: boolean): void\n static gc(className: BaseClassName): void\n static gc(classNameOrForce: BaseClassName | boolean = false): void {\n if (typeof classNameOrForce === 'string') {\n this.gcClass(classNameOrForce)\n } else {\n if (classNameOrForce || Date.now() - this._lastGC > this._maxGcFrequency) {\n this.gcAll()\n }\n }\n }\n\n static instanceCount(className: BaseClassName): number {\n return this.globalInstances[className]?.length ?? 0\n }\n\n static instanceCounts(): Record<BaseClassName, number> {\n this.gc()\n const result: Record<BaseClassName, number> = {}\n for (const [className, instances] of Object.entries(this.globalInstances)) result[className as BaseClassName] = instances.length\n return result\n }\n\n static startHistory(): void {\n if (this._historyTimeout) {\n this.stopHistory()\n }\n\n const timeoutHandler = () => {\n if (this._historyTimeout) {\n this.addToHistory()\n this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval)\n }\n }\n\n this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval)\n }\n\n static stopHistory(): void {\n if (this._historyTimeout) {\n clearTimeout(this._historyTimeout)\n this._historyTimeout = undefined\n }\n }\n\n private static addToHistory() {\n const counts = this.instanceCounts()\n for (const className of Object.keys(this.globalInstances) as BaseClassName[]) {\n this.globalInstancesCountHistory[className] = this.globalInstancesCountHistory[className]?.slice(-this.maxHistoryDepth) ?? []\n this.globalInstancesCountHistory[className].push(counts[className])\n }\n }\n\n private static gcAll() {\n for (const className of Object.keys(this.globalInstances) as BaseClassName[]) {\n this.gcClass(className)\n }\n }\n\n private static gcClass(className: BaseClassName) {\n // remove all the weak refs that are now empty\n this.globalInstances[className] = this.globalInstances[className]?.filter(ref => ref.deref() !== null) ?? []\n }\n\n private recordInstance() {\n const baseClassName = this.constructor.name as BaseClassName\n const instanceArray = Base.globalInstances[baseClassName] ?? []\n instanceArray.push(new WeakRef(this))\n Base.globalInstances[baseClassName] = instanceArray\n }\n}\n","declare global {\n var xylabs: {\n unique: Record<string, unknown>\n uniqueDisabled?: boolean\n }\n}\n\nconst xyoGlobal = () => {\n globalThis.xylabs = globalThis.xylabs ?? {}\n return globalThis.xylabs\n}\n\nexport const disableGloballyUnique = () => {\n xyoGlobal().uniqueDisabled = true\n}\n\nexport const globallyUnique = (name: string | symbol, value: unknown, domain = 'global') => {\n const uniqueName = domain === 'bundle' ? [domain, name].join(':') : [domain, import.meta.url, name].join(':')\n if (!xyoGlobal().uniqueDisabled) {\n const xylabs = globalThis.xylabs = globalThis.xylabs ?? {}\n const unique = (xylabs.unique = xylabs.unique ?? {})\n if (unique[uniqueName] === undefined) {\n unique[uniqueName] = value\n } else {\n if (unique[uniqueName] !== value) {\n throw new Error(\n `Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`,\n )\n }\n }\n }\n return uniqueName\n}\n","import type { BaseParams } from './Base.ts'\nimport { Base } from './Base.ts'\nimport { globallyUnique } from './globallyUnique.ts'\n\nexport abstract class UniqueBase<TParams extends BaseParams = BaseParams> extends Base<TParams> {\n static readonly uniqueDomain = 'xy'\n static readonly uniqueName = globallyUnique(this.name, this, this.uniqueDomain)\n // TODO: Remove xyo domain version when old xyo versions are no longer needed\n static readonly uniqueNameXyo = globallyUnique(this.name, this, 'xyo')\n constructor(params: BaseParams<TParams>) {\n super(params)\n }\n}\n"],"mappings":";AAIA,SAAS,gBAAgB;AAIzB,IAAM,2BAA2B,MAAO;AACxC,IAAM,uBAAuB,KAAK,KAAK;AACvC,IAAM,mBAAmB,MAAO;AAChC,IAAM,mBAAmB;AACzB,IAAM,uBAAuB;AAYtB,IAAe,OAAf,MAAe,MAA8C;AAAA,EAClE,OAAO;AAAA,EACP,OAAgB,kBAA0D,CAAC;AAAA,EAC3E,OAAgB,8BAA+D,CAAC;AAAA,EAChF,OAAe,mBAAmB;AAAA,EAClC,OAAe,eAAe;AAAA,EAC9B,OAAe;AAAA,EACf,OAAe,UAAU;AAAA,EACzB,OAAe,kBAAkB;AAAA,EACzB;AAAA,EAER,YAAY,QAA6B;AACvC,SAAK,UAAU;AACf,YAAQ,QAAQ,MAAM,qBAAqB,OAAO,IAAI,EAAE,IAAI,GAAG;AAC/D,SAAK,eAAe;AAAA,EACtB;AAAA,EAEA,WAAW,kBAAkB;AAC3B,WAAO,KAAK;AAAA,EACd;AAAA,EAEA,WAAW,gBAAgB,OAAe;AACxC,aAAS,SAAS,KAAK,aAAa,MAAM,oBAAoB,KAAK,gDA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AAgB,aAAa,IAAI;AAAA,EACxC;AACF;;;ACtJA,IAAM,YAAY,MAAM;AACtB,aAAW,SAAS,WAAW,UAAU,CAAC;AAC1C,SAAO,WAAW;AACpB;AAEO,IAAM,wBAAwB,MAAM;AACzC,YAAU,EAAE,iBAAiB;AAC/B;AAEO,IAAM,iBAAiB,CAAC,MAAuB,OAAgB,SAAS,aAAa;AAC1F,QAAM,aAAa,WAAW,WAAW,CAAC,QAAQ,IAAI,EAAE,KAAK,GAAG,IAAI,CAAC,QAAQ,YAAY,KAAK,IAAI,EAAE,KAAK,GAAG;AAC5G,MAAI,CAAC,UAAU,EAAE,gBAAgB;AAC/B,UAAM,SAAS,WAAW,SAAS,WAAW,UAAU,CAAC;AACzD,UAAM,SAAU,OAAO,SAAS,OAAO,UAAU,CAAC;AAClD,QAAI,OAAO,UAAU,MAAM,QAAW;AACpC,aAAO,UAAU,IAAI;AAAA,IACvB,OAAO;AACL,UAAI,OAAO,UAAU,MAAM,OAAO;AAChC,cAAM,IAAI;AAAA,UACR,sBAAsB,UAAU;AAAA,QAClC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;AC5BO,IAAe,aAAf,cAA2E,KAAc;AAAA,EAC9F,OAAgB,eAAe;AAAA,EAC/B,OAAgB,aAAa,eAAe,KAAK,MAAM,MAAM,KAAK,YAAY;AAAA;AAAA,EAE9E,OAAgB,gBAAgB,eAAe,KAAK,MAAM,MAAM,KAAK;AAAA,EACrE,YAAY,QAA6B;AACvC,UAAM,MAAM;AAAA,EACd;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/Base.ts","../../src/globallyUnique.ts","../../src/UniqueBase.ts"],"sourcesContent":["import type {\n Meter,\n MeterProvider, Tracer, TracerProvider,\n} from '@opentelemetry/api'\nimport { assertEx } from '@xylabs/assert'\nimport type { Logger } from '@xylabs/logger'\nimport type { EmptyObject } from '@xylabs/object'\n\nconst DEFAULT_HISTORY_INTERVAL = 1000 * 5\nconst DEFAULT_HISTORY_TIME = 60 * 60 * 1000\nconst MAX_GC_FREQUENCY = 1000 * 60\nconst MIN_GC_FREQUENCY = 1000\nconst MIN_HISTORY_INTERVAL = 1000\n\n/** Branded string type representing a class name used for global instance tracking. */\nexport type BaseClassName = string & { __baseClassName: true }\n\n/** Common parameter fields available to all Base instances (logger, meter, tracer). */\nexport type BaseParamsFields = {\n logger?: Logger\n meterProvider?: MeterProvider\n traceProvider?: TracerProvider\n}\n\n/** Parameters for constructing a Base instance, combining BaseParamsFields with optional additional params. */\nexport type BaseParams<TAdditionalParams extends EmptyObject = EmptyObject> = TAdditionalParams & BaseParamsFields\n\n/**\n * Abstract base class providing logging, telemetry, and global instance tracking with WeakRef-based GC.\n * @typeParam TParams - The parameter type, extending BaseParams\n */\nexport abstract class Base<TParams extends BaseParams = BaseParams> {\n static defaultLogger?: Logger\n static readonly globalInstances: Record<BaseClassName, WeakRef<Base>[]> = {}\n static readonly globalInstancesCountHistory: Record<BaseClassName, number[]> = {}\n private static _historyInterval = DEFAULT_HISTORY_INTERVAL\n private static _historyTime = DEFAULT_HISTORY_TIME\n private static _historyTimeout?: ReturnType<typeof setTimeout>\n private static _lastGC = 0\n private static _maxGcFrequency = MAX_GC_FREQUENCY\n private _params: BaseParams<TParams>\n\n constructor(params: BaseParams<TParams>) {\n this._params = params\n params?.logger?.debug(`Base constructed [${Object(this).name}]`)\n this.recordInstance()\n }\n\n static get historyInterval() {\n return this._historyInterval\n }\n\n static set historyInterval(value: number) {\n assertEx(value <= this.historyTime, () => `historyInterval [${value}] must be less than or equal to historyTime [${this.historyTime}]`)\n this._historyInterval = Math.max(value, MIN_HISTORY_INTERVAL)\n }\n\n static get historyTime() {\n return this._historyTime\n }\n\n static set historyTime(value: number) {\n assertEx(value >= this.historyInterval, () => `historyTime [${value}] must be greater than or equal to historyInterval [${this.historyInterval}]`)\n this._historyInterval = value\n }\n\n static get maxGcFrequency() {\n return this._maxGcFrequency\n }\n\n static set maxGcFrequency(value: number) {\n this._maxGcFrequency = Math.max(value, MIN_GC_FREQUENCY)\n }\n\n static get maxHistoryDepth() {\n return Math.floor(this.historyTime / this.historyInterval)\n }\n\n get logger() {\n return this.params?.logger ?? Base.defaultLogger\n }\n\n get meter(): Meter | undefined {\n return this.params?.meterProvider?.getMeter(this.constructor.name)\n }\n\n get params() {\n return this._params\n }\n\n get tracer(): Tracer | undefined {\n return this.params?.traceProvider?.getTracer(this.constructor.name)\n }\n\n static gc(force?: boolean): void\n static gc(className: BaseClassName): void\n static gc(classNameOrForce: BaseClassName | boolean = false): void {\n if (typeof classNameOrForce === 'string') {\n this.gcClass(classNameOrForce)\n } else {\n if (classNameOrForce || Date.now() - this._lastGC > this._maxGcFrequency) {\n this.gcAll()\n }\n }\n }\n\n static instanceCount(className: BaseClassName): number {\n return this.globalInstances[className]?.length ?? 0\n }\n\n static instanceCounts(): Record<BaseClassName, number> {\n this.gc()\n const result: Record<BaseClassName, number> = {}\n for (const [className, instances] of Object.entries(this.globalInstances)) result[className as BaseClassName] = instances.length\n return result\n }\n\n static startHistory(): void {\n if (this._historyTimeout) {\n this.stopHistory()\n }\n\n const timeoutHandler = () => {\n if (this._historyTimeout) {\n this.addToHistory()\n this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval)\n }\n }\n\n this._historyTimeout = setTimeout(timeoutHandler, this.historyInterval)\n }\n\n static stopHistory(): void {\n if (this._historyTimeout) {\n clearTimeout(this._historyTimeout)\n this._historyTimeout = undefined\n }\n }\n\n private static addToHistory() {\n const counts = this.instanceCounts()\n for (const className of Object.keys(this.globalInstances) as BaseClassName[]) {\n this.globalInstancesCountHistory[className] = this.globalInstancesCountHistory[className]?.slice(-this.maxHistoryDepth) ?? []\n this.globalInstancesCountHistory[className].push(counts[className])\n }\n }\n\n private static gcAll() {\n for (const className of Object.keys(this.globalInstances) as BaseClassName[]) {\n this.gcClass(className)\n }\n }\n\n private static gcClass(className: BaseClassName) {\n // remove all the weak refs that are now empty\n this.globalInstances[className] = this.globalInstances[className]?.filter(ref => ref.deref() !== null) ?? []\n }\n\n private recordInstance() {\n const baseClassName = this.constructor.name as BaseClassName\n const instanceArray = Base.globalInstances[baseClassName] ?? []\n instanceArray.push(new WeakRef(this))\n Base.globalInstances[baseClassName] = instanceArray\n }\n}\n","declare global {\n var xylabs: {\n unique: Record<string, unknown>\n uniqueDisabled?: boolean\n }\n}\n\nconst xyoGlobal = () => {\n globalThis.xylabs = globalThis.xylabs ?? {}\n return globalThis.xylabs\n}\n\n/** Disables global uniqueness checks, allowing duplicate registrations without throwing. */\nexport const disableGloballyUnique = () => {\n xyoGlobal().uniqueDisabled = true\n}\n\n/**\n * Registers a value as globally unique under the given name and domain.\n * Throws if a different value is already registered under the same key.\n * @param name - The unique name or symbol\n * @param value - The value to register\n * @param domain - The namespace domain (default 'global')\n * @returns The fully qualified unique name\n */\nexport const globallyUnique = (name: string | symbol, value: unknown, domain = 'global') => {\n const uniqueName = domain === 'bundle' ? [domain, name].join(':') : [domain, import.meta.url, name].join(':')\n if (!xyoGlobal().uniqueDisabled) {\n const xylabs = globalThis.xylabs = globalThis.xylabs ?? {}\n const unique = (xylabs.unique = xylabs.unique ?? {})\n if (unique[uniqueName] === undefined) {\n unique[uniqueName] = value\n } else {\n if (unique[uniqueName] !== value) {\n throw new Error(\n `Global unique item ${uniqueName} already defined. Make sure you are not importing two versions of the package that contains this item`,\n )\n }\n }\n }\n return uniqueName\n}\n","import type { BaseParams } from './Base.ts'\nimport { Base } from './Base.ts'\nimport { globallyUnique } from './globallyUnique.ts'\n\n/** Base class that registers itself as globally unique, preventing duplicate module instances. */\nexport abstract class UniqueBase<TParams extends BaseParams = BaseParams> extends Base<TParams> {\n static readonly uniqueDomain = 'xy'\n static readonly uniqueName = globallyUnique(this.name, this, this.uniqueDomain)\n // TODO: Remove xyo domain version when old xyo versions are no longer needed\n static readonly uniqueNameXyo = globallyUnique(this.name, this, 'xyo')\n constructor(params: BaseParams<TParams>) {\n super(params)\n }\n}\n"],"mappings":";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AAI;AAAA,IACvB,OAAO;AACL,UAAI,OAAO,UAAU,MAAM,OAAO;AAChC,cAAM,IAAI;AAAA,UACR,sBAAsB,UAAU;AAAA,QAClC;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ACpCO,IAAe,aAAf,cAA2E,KAAc;AAAA,EAC9F,OAAgB,eAAe;AAAA,EAC/B,OAAgB,aAAa,eAAe,KAAK,MAAM,MAAM,KAAK,YAAY;AAAA;AAAA,EAE9E,OAAgB,gBAAgB,eAAe,KAAK,MAAM,MAAM,KAAK;AAAA,EACrE,YAAY,QAA6B;AACvC,UAAM,MAAM;AAAA,EACd;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/base",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.86",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -36,13 +36,13 @@
|
|
|
36
36
|
],
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@opentelemetry/api": "^1.9.0",
|
|
39
|
-
"@xylabs/assert": "~5.0.
|
|
40
|
-
"@xylabs/logger": "~5.0.
|
|
41
|
-
"@xylabs/object": "~5.0.
|
|
39
|
+
"@xylabs/assert": "~5.0.86",
|
|
40
|
+
"@xylabs/logger": "~5.0.86",
|
|
41
|
+
"@xylabs/object": "~5.0.86"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@xylabs/ts-scripts-yarn3": "~7.4.
|
|
45
|
-
"@xylabs/tsconfig": "~7.4.
|
|
44
|
+
"@xylabs/ts-scripts-yarn3": "~7.4.16",
|
|
45
|
+
"@xylabs/tsconfig": "~7.4.16",
|
|
46
46
|
"typescript": "~5.9.3",
|
|
47
47
|
"vitest": "~4.0.18"
|
|
48
48
|
},
|