@fluidframework/core-interfaces 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/Removing-IFluidRouter.md +22 -17
- package/api-extractor-lint.json +13 -0
- package/api-extractor.json +3 -6
- package/api-report/core-interfaces.api.md +66 -73
- package/dist/config.d.ts +35 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +7 -0
- package/dist/config.js.map +1 -0
- package/dist/core-interfaces-alpha.d.ts +101 -249
- package/dist/core-interfaces-beta.d.ts +105 -905
- package/dist/core-interfaces-public.d.ts +105 -905
- package/dist/core-interfaces-untrimmed.d.ts +112 -18
- package/dist/disposable.d.ts +1 -0
- package/dist/disposable.d.ts.map +1 -1
- package/dist/disposable.js.map +1 -1
- package/dist/error.d.ts +9 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +1 -0
- package/dist/error.js.map +1 -1
- package/dist/events.d.ts +8 -1
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js.map +1 -1
- package/dist/fluidLoadable.d.ts +16 -0
- package/dist/fluidLoadable.d.ts.map +1 -1
- package/dist/fluidLoadable.js +6 -0
- package/dist/fluidLoadable.js.map +1 -1
- package/dist/fluidPackage.d.ts +9 -0
- package/dist/fluidPackage.d.ts.map +1 -1
- package/dist/fluidPackage.js +3 -0
- package/dist/fluidPackage.js.map +1 -1
- package/dist/fluidRouter.d.ts +9 -17
- package/dist/fluidRouter.d.ts.map +1 -1
- package/dist/fluidRouter.js +0 -5
- package/dist/fluidRouter.js.map +1 -1
- package/dist/handles.d.ts +14 -0
- package/dist/handles.d.ts.map +1 -1
- package/dist/handles.js +6 -0
- package/dist/handles.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -6
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts +16 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +1 -0
- package/dist/logger.js.map +1 -1
- package/dist/provider.d.ts +3 -2
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js.map +1 -1
- package/lib/config.d.ts +35 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +7 -0
- package/lib/config.js.map +1 -0
- package/lib/core-interfaces-alpha.d.ts +101 -249
- package/lib/core-interfaces-beta.d.ts +105 -905
- package/lib/core-interfaces-public.d.ts +105 -905
- package/lib/core-interfaces-untrimmed.d.ts +112 -18
- package/lib/disposable.d.ts +1 -0
- package/lib/disposable.d.ts.map +1 -1
- package/lib/disposable.js +2 -1
- package/lib/disposable.js.map +1 -1
- package/lib/error.d.ts +9 -0
- package/lib/error.d.ts.map +1 -1
- package/lib/error.js +5 -1
- package/lib/error.js.map +1 -1
- package/lib/events.d.ts +8 -1
- package/lib/events.d.ts.map +1 -1
- package/lib/events.js +2 -1
- package/lib/events.js.map +1 -1
- package/lib/fluidLoadable.d.ts +16 -0
- package/lib/fluidLoadable.d.ts.map +1 -1
- package/lib/fluidLoadable.js +11 -2
- package/lib/fluidLoadable.js.map +1 -1
- package/lib/fluidPackage.d.ts +9 -0
- package/lib/fluidPackage.d.ts.map +1 -1
- package/lib/fluidPackage.js +12 -4
- package/lib/fluidPackage.js.map +1 -1
- package/lib/fluidRouter.d.ts +9 -17
- package/lib/fluidRouter.d.ts.map +1 -1
- package/lib/fluidRouter.js +2 -4
- package/lib/fluidRouter.js.map +1 -1
- package/lib/handles.d.ts +14 -0
- package/lib/handles.d.ts.map +1 -1
- package/lib/handles.js +11 -2
- package/lib/handles.js.map +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -9
- package/lib/index.js.map +1 -1
- package/lib/logger.d.ts +16 -0
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +5 -1
- package/lib/logger.js.map +1 -1
- package/lib/provider.d.ts +3 -2
- package/lib/provider.d.ts.map +1 -1
- package/lib/provider.js +2 -1
- package/lib/provider.js.map +1 -1
- package/package.json +22 -6
- package/src/config.ts +36 -0
- package/src/disposable.ts +1 -0
- package/src/error.ts +9 -0
- package/src/events.ts +8 -1
- package/src/fluidLoadable.ts +16 -0
- package/src/fluidPackage.ts +9 -0
- package/src/fluidRouter.ts +9 -20
- package/src/handles.ts +14 -0
- package/src/index.ts +2 -7
- package/src/logger.ts +16 -0
- package/src/provider.ts +3 -2
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types supported by {@link IConfigProviderBase}.
|
|
3
|
+
* @alpha
|
|
4
|
+
*/
|
|
5
|
+
export declare type ConfigTypes = string | number | boolean | number[] | string[] | boolean[] | undefined;
|
|
6
|
+
|
|
1
7
|
/**
|
|
2
8
|
* Allows an interface to extend interfaces that already extend an {@link IEventProvider}.
|
|
3
9
|
*
|
|
@@ -20,12 +26,13 @@
|
|
|
20
26
|
* ```
|
|
21
27
|
*
|
|
22
28
|
* interface B will now extend interface A and its events
|
|
23
|
-
*
|
|
29
|
+
* @alpha
|
|
24
30
|
*/
|
|
25
31
|
export declare type ExtendEventProvider<TBaseEvent extends IEvent, TBase extends IEventProvider<TBaseEvent>, TEvent extends TBaseEvent> = Omit<Omit<Omit<TBase, "on">, "once">, "off"> & IEventProvider<TBaseEvent> & IEventProvider<TEvent>;
|
|
26
32
|
|
|
27
33
|
/**
|
|
28
34
|
* Error types the Fluid Framework may report.
|
|
35
|
+
* @internal
|
|
29
36
|
*/
|
|
30
37
|
export declare const FluidErrorTypes: {
|
|
31
38
|
/**
|
|
@@ -50,6 +57,9 @@ export declare const FluidErrorTypes: {
|
|
|
50
57
|
readonly usageError: "usageError";
|
|
51
58
|
};
|
|
52
59
|
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
53
63
|
export declare type FluidErrorTypes = (typeof FluidErrorTypes)[keyof typeof FluidErrorTypes];
|
|
54
64
|
|
|
55
65
|
/**
|
|
@@ -83,7 +93,7 @@ export declare type FluidErrorTypes = (typeof FluidErrorTypes)[keyof typeof Flui
|
|
|
83
93
|
*
|
|
84
94
|
* You can inspect multiple types via a intersection. For example:
|
|
85
95
|
* `FluidObject<IFoo & IBar>`
|
|
86
|
-
*
|
|
96
|
+
* @alpha
|
|
87
97
|
*/
|
|
88
98
|
export declare type FluidObject<T = unknown> = {
|
|
89
99
|
[P in FluidObjectProviderKeys<T>]?: T[P];
|
|
@@ -96,7 +106,7 @@ export declare type FluidObject<T = unknown> = {
|
|
|
96
106
|
* See {@link FluidObject}
|
|
97
107
|
*
|
|
98
108
|
* For example `FluidObjectKeys<IFoo & IBar>` would result in `"IFoo" | "IBar"`
|
|
99
|
-
*
|
|
109
|
+
* @alpha
|
|
100
110
|
*/
|
|
101
111
|
export declare type FluidObjectKeys<T> = keyof FluidObject<T>;
|
|
102
112
|
|
|
@@ -124,11 +134,39 @@ export declare type FluidObjectKeys<T> = keyof FluidObject<T>;
|
|
|
124
134
|
*
|
|
125
135
|
* This pattern enables discovery, and delegation in a standard way which is central
|
|
126
136
|
* to FluidObject pattern.
|
|
137
|
+
* @alpha
|
|
127
138
|
*/
|
|
128
139
|
export declare type FluidObjectProviderKeys<T, TProp extends keyof T = keyof T> = string extends TProp ? never : number extends TProp ? never : TProp extends keyof Required<T>[TProp] ? Required<T>[TProp] extends Required<Required<T>[TProp]>[TProp] ? TProp : never : never;
|
|
129
140
|
|
|
141
|
+
/**
|
|
142
|
+
* Base interface for providing configurations to enable/disable/control features.
|
|
143
|
+
* @alpha
|
|
144
|
+
*/
|
|
145
|
+
export declare interface IConfigProviderBase {
|
|
146
|
+
/**
|
|
147
|
+
* For the specified config name this function gets the value.
|
|
148
|
+
*
|
|
149
|
+
* This type is meant be easy to implement by Fluid Framework consumers
|
|
150
|
+
* so the returned valued needs minimal type coercion, and allows consumers to
|
|
151
|
+
* return values in a natural way from whatever source they retrieve them.
|
|
152
|
+
*
|
|
153
|
+
* For instance a value of 1 maybe be returned as a string or a number.
|
|
154
|
+
* For array types a json string or an object are allowable.
|
|
155
|
+
*
|
|
156
|
+
* It should return undefined if there is no value available for the config name.
|
|
157
|
+
*
|
|
158
|
+
* @param name - The name of the config to get the value for.
|
|
159
|
+
*
|
|
160
|
+
* @privateRemarks Generally, this type should only be taken as input, and be wrapped by an
|
|
161
|
+
* internal monitoring context from the fluidframework/telemetry-utils package. That will provide
|
|
162
|
+
* a wrapper with provides strongly typed access to values via consistent type coercion.
|
|
163
|
+
*/
|
|
164
|
+
getRawConfig(name: string): ConfigTypes;
|
|
165
|
+
}
|
|
166
|
+
|
|
130
167
|
/**
|
|
131
168
|
* Base interface for objects that require lifetime management via explicit disposal.
|
|
169
|
+
* @alpha
|
|
132
170
|
*/
|
|
133
171
|
export declare interface IDisposable {
|
|
134
172
|
/**
|
|
@@ -153,6 +191,8 @@ export declare interface IDisposable {
|
|
|
153
191
|
* those from container-definitions. Once fully migrated, this will be a base interface for all errors and
|
|
154
192
|
* warnings emitted by the Fluid Framework. Currently only the container layer is using IErrorBase.
|
|
155
193
|
* Runtime and others will follow soon.
|
|
194
|
+
*
|
|
195
|
+
* @alpha
|
|
156
196
|
*/
|
|
157
197
|
export declare interface IErrorBase extends Partial<Error> {
|
|
158
198
|
/**
|
|
@@ -191,6 +231,7 @@ export declare interface IErrorBase extends Partial<Error> {
|
|
|
191
231
|
|
|
192
232
|
/**
|
|
193
233
|
* Base interface for error event emitters.
|
|
234
|
+
* @alpha
|
|
194
235
|
*/
|
|
195
236
|
export declare interface IErrorEvent extends IEvent {
|
|
196
237
|
/**
|
|
@@ -203,6 +244,7 @@ export declare interface IErrorEvent extends IEvent {
|
|
|
203
244
|
|
|
204
245
|
/**
|
|
205
246
|
* Base interface for event emitters.
|
|
247
|
+
* @alpha
|
|
206
248
|
*/
|
|
207
249
|
export declare interface IEvent {
|
|
208
250
|
/**
|
|
@@ -220,6 +262,7 @@ export declare interface IEvent {
|
|
|
220
262
|
|
|
221
263
|
/**
|
|
222
264
|
* Base interface for event providers.
|
|
265
|
+
* @alpha
|
|
223
266
|
*/
|
|
224
267
|
export declare interface IEventProvider<TEvent extends IEvent> {
|
|
225
268
|
/**
|
|
@@ -238,6 +281,7 @@ export declare interface IEventProvider<TEvent extends IEvent> {
|
|
|
238
281
|
|
|
239
282
|
/**
|
|
240
283
|
* The placeholder type that should be used instead of `this` in events.
|
|
284
|
+
* @alpha
|
|
241
285
|
*/
|
|
242
286
|
export declare type IEventThisPlaceHolder = {
|
|
243
287
|
thisPlaceHolder: "thisPlaceHolder";
|
|
@@ -251,6 +295,7 @@ export declare type IEventThisPlaceHolder = {
|
|
|
251
295
|
* It currently supports the max of 15 event overloads which is more than we use anywhere.
|
|
252
296
|
* At more than 15 overloads we start to hit {@link https://github.com/microsoft/TypeScript/issues/37209 | TS2589}.
|
|
253
297
|
* If we need to move beyond 15 we should evaluate using a mapped type pattern like `{"event":(listenerArgs)=>void}`
|
|
298
|
+
* @alpha
|
|
254
299
|
*/
|
|
255
300
|
export declare type IEventTransformer<TThis, TEvent extends IEvent> = TEvent extends {
|
|
256
301
|
(event: infer E0, listener: (...args: infer A0) => void): any;
|
|
@@ -409,6 +454,7 @@ export declare type IEventTransformer<TThis, TEvent extends IEvent> = TEvent ext
|
|
|
409
454
|
*
|
|
410
455
|
* @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetails}
|
|
411
456
|
* to have code loading modules in same package.
|
|
457
|
+
* @internal
|
|
412
458
|
*/
|
|
413
459
|
export declare interface IFluidCodeDetails {
|
|
414
460
|
/**
|
|
@@ -425,6 +471,7 @@ export declare interface IFluidCodeDetails {
|
|
|
425
471
|
/**
|
|
426
472
|
* @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}
|
|
427
473
|
* to have code loading modules in same package.
|
|
474
|
+
* @internal
|
|
428
475
|
*/
|
|
429
476
|
export declare const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsComparer;
|
|
430
477
|
|
|
@@ -433,6 +480,7 @@ export declare const IFluidCodeDetailsComparer: keyof IProvideFluidCodeDetailsCo
|
|
|
433
480
|
*
|
|
434
481
|
* @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsComparer}
|
|
435
482
|
* to have code loading modules in same package.
|
|
483
|
+
* @internal
|
|
436
484
|
*/
|
|
437
485
|
export declare interface IFluidCodeDetailsComparer extends IProvideFluidCodeDetailsComparer {
|
|
438
486
|
/**
|
|
@@ -464,15 +512,20 @@ export declare interface IFluidCodeDetailsComparer extends IProvideFluidCodeDeta
|
|
|
464
512
|
*
|
|
465
513
|
* @deprecated in favor of {@link @fluidframework/container-definitions#IFluidCodeDetailsConfig}
|
|
466
514
|
* to have code loading modules in same package.
|
|
515
|
+
* @internal
|
|
467
516
|
*/
|
|
468
517
|
export declare interface IFluidCodeDetailsConfig {
|
|
469
518
|
readonly [key: string]: string;
|
|
470
519
|
}
|
|
471
520
|
|
|
521
|
+
/**
|
|
522
|
+
* @alpha
|
|
523
|
+
*/
|
|
472
524
|
export declare const IFluidHandle: keyof IProvideFluidHandle;
|
|
473
525
|
|
|
474
526
|
/**
|
|
475
527
|
* Handle to a shared {@link FluidObject}.
|
|
528
|
+
* @alpha
|
|
476
529
|
*/
|
|
477
530
|
export declare interface IFluidHandle<T = FluidObject & IFluidLoadable> extends IProvideFluidHandle {
|
|
478
531
|
/**
|
|
@@ -504,10 +557,14 @@ export declare interface IFluidHandle<T = FluidObject & IFluidLoadable> extends
|
|
|
504
557
|
bind(handle: IFluidHandle): void;
|
|
505
558
|
}
|
|
506
559
|
|
|
560
|
+
/**
|
|
561
|
+
* @alpha
|
|
562
|
+
*/
|
|
507
563
|
export declare const IFluidHandleContext: keyof IProvideFluidHandleContext;
|
|
508
564
|
|
|
509
565
|
/**
|
|
510
566
|
* Describes a routing context from which other `IFluidHandleContext`s are defined.
|
|
567
|
+
* @alpha
|
|
511
568
|
*/
|
|
512
569
|
export declare interface IFluidHandleContext extends IProvideFluidHandleContext {
|
|
513
570
|
/**
|
|
@@ -530,10 +587,14 @@ export declare interface IFluidHandleContext extends IProvideFluidHandleContext
|
|
|
530
587
|
resolveHandle(request: IRequest): Promise<IResponse>;
|
|
531
588
|
}
|
|
532
589
|
|
|
590
|
+
/**
|
|
591
|
+
* @alpha
|
|
592
|
+
*/
|
|
533
593
|
export declare const IFluidLoadable: keyof IProvideFluidLoadable;
|
|
534
594
|
|
|
535
595
|
/**
|
|
536
596
|
* A shared FluidObject has a URL from which it can be referenced
|
|
597
|
+
* @alpha
|
|
537
598
|
*/
|
|
538
599
|
export declare interface IFluidLoadable extends IProvideFluidLoadable {
|
|
539
600
|
handle: IFluidHandle;
|
|
@@ -547,6 +608,7 @@ export declare interface IFluidLoadable extends IProvideFluidLoadable {
|
|
|
547
608
|
*
|
|
548
609
|
* @deprecated In favor of {@link @fluidframework/container-definitions#IFluidPackage}
|
|
549
610
|
* to have code loading modules in same package.
|
|
611
|
+
* @internal
|
|
550
612
|
*/
|
|
551
613
|
export declare interface IFluidPackage {
|
|
552
614
|
/**
|
|
@@ -576,6 +638,7 @@ export declare interface IFluidPackage {
|
|
|
576
638
|
*
|
|
577
639
|
* @deprecated In favor of {@link @fluidframework/container-definitions#IFluidPackageEnvironment}
|
|
578
640
|
* to have code loading modules in same package.
|
|
641
|
+
* @internal
|
|
579
642
|
*/
|
|
580
643
|
export declare interface IFluidPackageEnvironment {
|
|
581
644
|
/**
|
|
@@ -599,19 +662,13 @@ export declare interface IFluidPackageEnvironment {
|
|
|
599
662
|
}
|
|
600
663
|
|
|
601
664
|
/**
|
|
602
|
-
* @
|
|
665
|
+
* @internal
|
|
603
666
|
*/
|
|
604
|
-
export declare const
|
|
667
|
+
export declare const IFluidRunnable: keyof IProvideFluidRunnable;
|
|
605
668
|
|
|
606
669
|
/**
|
|
607
|
-
* @
|
|
670
|
+
* @internal
|
|
608
671
|
*/
|
|
609
|
-
export declare interface IFluidRouter extends IProvideFluidRouter {
|
|
610
|
-
request(request: IRequest): Promise<IResponse>;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
|
-
export declare const IFluidRunnable: keyof IProvideFluidRunnable;
|
|
614
|
-
|
|
615
672
|
export declare interface IFluidRunnable {
|
|
616
673
|
run(...args: any[]): Promise<void>;
|
|
617
674
|
stop(reason?: string): void;
|
|
@@ -619,6 +676,7 @@ export declare interface IFluidRunnable {
|
|
|
619
676
|
|
|
620
677
|
/**
|
|
621
678
|
* Generic wrapper for an unrecognized/uncategorized error object
|
|
679
|
+
* @internal
|
|
622
680
|
*/
|
|
623
681
|
export declare interface IGenericError extends IErrorBase {
|
|
624
682
|
/**
|
|
@@ -630,6 +688,7 @@ export declare interface IGenericError extends IErrorBase {
|
|
|
630
688
|
|
|
631
689
|
/**
|
|
632
690
|
* An error object that supports exporting its properties to be logged to telemetry
|
|
691
|
+
* @internal
|
|
633
692
|
*/
|
|
634
693
|
export declare interface ILoggingError extends Error {
|
|
635
694
|
/**
|
|
@@ -641,44 +700,58 @@ export declare interface ILoggingError extends Error {
|
|
|
641
700
|
/**
|
|
642
701
|
* @deprecated in favor of {@link @fluidframework/container-definitions#IProvideFluidCodeDetailsComparer}
|
|
643
702
|
* to have code loading modules in same package.
|
|
703
|
+
* @internal
|
|
644
704
|
*/
|
|
645
705
|
export declare interface IProvideFluidCodeDetailsComparer {
|
|
646
706
|
readonly IFluidCodeDetailsComparer: IFluidCodeDetailsComparer;
|
|
647
707
|
}
|
|
648
708
|
|
|
709
|
+
/**
|
|
710
|
+
* @alpha
|
|
711
|
+
*/
|
|
649
712
|
export declare interface IProvideFluidHandle {
|
|
650
713
|
readonly IFluidHandle: IFluidHandle;
|
|
651
714
|
}
|
|
652
715
|
|
|
716
|
+
/**
|
|
717
|
+
* @alpha
|
|
718
|
+
*/
|
|
653
719
|
export declare interface IProvideFluidHandleContext {
|
|
654
720
|
readonly IFluidHandleContext: IFluidHandleContext;
|
|
655
721
|
}
|
|
656
722
|
|
|
723
|
+
/**
|
|
724
|
+
* @alpha
|
|
725
|
+
*/
|
|
657
726
|
export declare interface IProvideFluidLoadable {
|
|
658
727
|
readonly IFluidLoadable: IFluidLoadable;
|
|
659
728
|
}
|
|
660
729
|
|
|
661
730
|
/**
|
|
662
|
-
*
|
|
663
|
-
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
731
|
+
* @internal
|
|
664
732
|
*/
|
|
665
|
-
export declare interface IProvideFluidRouter {
|
|
666
|
-
readonly IFluidRouter: IFluidRouter;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
733
|
export declare interface IProvideFluidRunnable {
|
|
670
734
|
readonly IFluidRunnable: IFluidRunnable;
|
|
671
735
|
}
|
|
672
736
|
|
|
737
|
+
/**
|
|
738
|
+
* @alpha
|
|
739
|
+
*/
|
|
673
740
|
export declare interface IRequest {
|
|
674
741
|
url: string;
|
|
675
742
|
headers?: IRequestHeader;
|
|
676
743
|
}
|
|
677
744
|
|
|
745
|
+
/**
|
|
746
|
+
* @alpha
|
|
747
|
+
*/
|
|
678
748
|
export declare interface IRequestHeader {
|
|
679
749
|
[index: string]: any;
|
|
680
750
|
}
|
|
681
751
|
|
|
752
|
+
/**
|
|
753
|
+
* @alpha
|
|
754
|
+
*/
|
|
682
755
|
export declare interface IResponse {
|
|
683
756
|
mimeType: string;
|
|
684
757
|
status: number;
|
|
@@ -692,6 +765,7 @@ export declare interface IResponse {
|
|
|
692
765
|
/**
|
|
693
766
|
* @deprecated in favor of {@link @fluidframework/container-definitions#isFluidCodeDetails}
|
|
694
767
|
* to have code loading modules in same package.
|
|
768
|
+
* @internal
|
|
695
769
|
*/
|
|
696
770
|
export declare const isFluidCodeDetails: (details: unknown) => details is Readonly<IFluidCodeDetails>;
|
|
697
771
|
|
|
@@ -702,6 +776,7 @@ export declare const isFluidCodeDetails: (details: unknown) => details is Readon
|
|
|
702
776
|
* to have code loading modules in same package.
|
|
703
777
|
*
|
|
704
778
|
* @param pkg - The package json data to check if it is a Fluid package.
|
|
779
|
+
* @internal
|
|
705
780
|
*/
|
|
706
781
|
export declare const isFluidPackage: (pkg: unknown) => pkg is Readonly<IFluidPackage>;
|
|
707
782
|
|
|
@@ -709,6 +784,7 @@ export declare const isFluidPackage: (pkg: unknown) => pkg is Readonly<IFluidPac
|
|
|
709
784
|
* @see {@link Tagged} for info on tagging
|
|
710
785
|
*
|
|
711
786
|
* @deprecated Use Tagged\<TelemetryBaseEventPropertyType\>
|
|
787
|
+
* @internal
|
|
712
788
|
*/
|
|
713
789
|
export declare interface ITaggedTelemetryPropertyType {
|
|
714
790
|
value: TelemetryEventPropertyType;
|
|
@@ -720,6 +796,7 @@ export declare interface ITaggedTelemetryPropertyType {
|
|
|
720
796
|
* Can contain any number of properties that get serialized as json payload.
|
|
721
797
|
* @param category - category of the event, like "error", "performance", "generic", etc.
|
|
722
798
|
* @param eventName - name of the event.
|
|
799
|
+
* @alpha
|
|
723
800
|
*/
|
|
724
801
|
export declare interface ITelemetryBaseEvent extends ITelemetryBaseProperties {
|
|
725
802
|
category: string;
|
|
@@ -729,6 +806,7 @@ export declare interface ITelemetryBaseEvent extends ITelemetryBaseProperties {
|
|
|
729
806
|
/**
|
|
730
807
|
* Interface to output telemetry events.
|
|
731
808
|
* Implemented by hosting app / loader
|
|
809
|
+
* @alpha
|
|
732
810
|
*/
|
|
733
811
|
export declare interface ITelemetryBaseLogger {
|
|
734
812
|
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
@@ -737,6 +815,7 @@ export declare interface ITelemetryBaseLogger {
|
|
|
737
815
|
|
|
738
816
|
/**
|
|
739
817
|
* JSON-serializable properties, which will be logged with telemetry.
|
|
818
|
+
* @alpha
|
|
740
819
|
*/
|
|
741
820
|
export declare type ITelemetryBaseProperties = ITelemetryProperties;
|
|
742
821
|
|
|
@@ -746,6 +825,7 @@ export declare type ITelemetryBaseProperties = ITelemetryProperties;
|
|
|
746
825
|
*
|
|
747
826
|
* @deprecated For internal use within FluidFramework, use ITelemetryErrorEventExt in \@fluidframework/telemetry-utils.
|
|
748
827
|
* No replacement intended for FluidFramework consumers.
|
|
828
|
+
* @alpha
|
|
749
829
|
*/
|
|
750
830
|
export declare interface ITelemetryErrorEvent extends ITelemetryProperties {
|
|
751
831
|
eventName: string;
|
|
@@ -757,6 +837,7 @@ export declare interface ITelemetryErrorEvent extends ITelemetryProperties {
|
|
|
757
837
|
*
|
|
758
838
|
* @deprecated For internal use within FluidFramework, use ITelemetryGenericEventExt in \@fluidframework/telemetry-utils.
|
|
759
839
|
* No replacement intended for FluidFramework consumers.
|
|
840
|
+
* @alpha
|
|
760
841
|
*/
|
|
761
842
|
export declare interface ITelemetryGenericEvent extends ITelemetryProperties {
|
|
762
843
|
eventName: string;
|
|
@@ -770,6 +851,7 @@ export declare interface ITelemetryGenericEvent extends ITelemetryProperties {
|
|
|
770
851
|
*
|
|
771
852
|
* @deprecated For internal use within FluidFramework, use ITelemetryLoggerExt in \@fluidframework/telemetry-utils.
|
|
772
853
|
* No replacement intended for FluidFramework consumers.
|
|
854
|
+
* @alpha
|
|
773
855
|
*/
|
|
774
856
|
export declare interface ITelemetryLogger extends ITelemetryBaseLogger {
|
|
775
857
|
/**
|
|
@@ -807,6 +889,7 @@ export declare interface ITelemetryLogger extends ITelemetryBaseLogger {
|
|
|
807
889
|
*
|
|
808
890
|
* @deprecated For internal use within FluidFramework, use ITelemetryPerformanceEventExt in \@fluidframework/telemetry-utils.
|
|
809
891
|
* No replacement intended for FluidFramework consumers.
|
|
892
|
+
* @alpha
|
|
810
893
|
*/
|
|
811
894
|
export declare interface ITelemetryPerformanceEvent extends ITelemetryGenericEvent {
|
|
812
895
|
duration?: number;
|
|
@@ -816,6 +899,7 @@ export declare interface ITelemetryPerformanceEvent extends ITelemetryGenericEve
|
|
|
816
899
|
* {@inheritDoc ITelemetryBaseProperties}
|
|
817
900
|
*
|
|
818
901
|
* @deprecated Renamed to {@link ITelemetryBaseProperties}
|
|
902
|
+
* @alpha
|
|
819
903
|
*/
|
|
820
904
|
export declare interface ITelemetryProperties {
|
|
821
905
|
[index: string]: TelemetryEventPropertyType | Tagged<TelemetryEventPropertyType>;
|
|
@@ -823,6 +907,7 @@ export declare interface ITelemetryProperties {
|
|
|
823
907
|
|
|
824
908
|
/**
|
|
825
909
|
* Warning emitted when requests to storage are being throttled
|
|
910
|
+
* @internal
|
|
826
911
|
*/
|
|
827
912
|
export declare interface IThrottlingWarning extends IErrorBase {
|
|
828
913
|
/**
|
|
@@ -834,6 +919,7 @@ export declare interface IThrottlingWarning extends IErrorBase {
|
|
|
834
919
|
|
|
835
920
|
/**
|
|
836
921
|
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
922
|
+
* @internal
|
|
837
923
|
*/
|
|
838
924
|
export declare interface IUsageError extends IErrorBase {
|
|
839
925
|
/**
|
|
@@ -844,6 +930,7 @@ export declare interface IUsageError extends IErrorBase {
|
|
|
844
930
|
|
|
845
931
|
/**
|
|
846
932
|
* Specify levels of the logs.
|
|
933
|
+
* @alpha
|
|
847
934
|
*/
|
|
848
935
|
export declare const LogLevel: {
|
|
849
936
|
readonly verbose: 10;
|
|
@@ -853,11 +940,13 @@ export declare const LogLevel: {
|
|
|
853
940
|
|
|
854
941
|
/**
|
|
855
942
|
* Specify a level to the log to filter out logs based on the level.
|
|
943
|
+
* @alpha
|
|
856
944
|
*/
|
|
857
945
|
export declare type LogLevel = (typeof LogLevel)[keyof typeof LogLevel];
|
|
858
946
|
|
|
859
947
|
/**
|
|
860
948
|
* Does the type replacement by changing types of {@link IEventThisPlaceHolder} to `TThis`
|
|
949
|
+
* @alpha
|
|
861
950
|
*/
|
|
862
951
|
export declare type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L extends any[] ? {
|
|
863
952
|
[K in keyof L]: L[K] extends IEventThisPlaceHolder ? TThis : L[K];
|
|
@@ -869,6 +958,7 @@ export declare type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L ext
|
|
|
869
958
|
*
|
|
870
959
|
* This indicates that the value should be organized or handled differently by loggers in various first or third
|
|
871
960
|
* party scenarios. For example, tags are used to mark data that should not be stored in logs for privacy reasons.
|
|
961
|
+
* @alpha
|
|
872
962
|
*/
|
|
873
963
|
export declare interface Tagged<V, T extends string = string> {
|
|
874
964
|
value: V;
|
|
@@ -881,6 +971,7 @@ export declare interface Tagged<V, T extends string = string> {
|
|
|
881
971
|
* @remarks Logging entire objects is considered extremely dangerous from a telemetry point of view because people can
|
|
882
972
|
* easily add fields to objects that shouldn't be logged and not realize it's going to be logged.
|
|
883
973
|
* General best practice is to explicitly log the fields you care about from objects.
|
|
974
|
+
* @internal
|
|
884
975
|
*/
|
|
885
976
|
export declare type TelemetryBaseEventPropertyType = TelemetryEventPropertyType;
|
|
886
977
|
|
|
@@ -888,6 +979,7 @@ export declare type TelemetryBaseEventPropertyType = TelemetryEventPropertyType;
|
|
|
888
979
|
* Examples of known categories, however category can be any string for extensibility.
|
|
889
980
|
*
|
|
890
981
|
* @deprecated Moved to \@fluidframework/telemetry-utils package
|
|
982
|
+
* @alpha
|
|
891
983
|
*/
|
|
892
984
|
export declare type TelemetryEventCategory = "generic" | "error" | "performance";
|
|
893
985
|
|
|
@@ -895,12 +987,14 @@ export declare type TelemetryEventCategory = "generic" | "error" | "performance"
|
|
|
895
987
|
* {@inheritDoc TelemetryBaseEventPropertyType}
|
|
896
988
|
*
|
|
897
989
|
* @deprecated Renamed to {@link TelemetryBaseEventPropertyType}
|
|
990
|
+
* @alpha
|
|
898
991
|
*/
|
|
899
992
|
export declare type TelemetryEventPropertyType = string | number | boolean | undefined;
|
|
900
993
|
|
|
901
994
|
/**
|
|
902
995
|
* Transforms the event overload by replacing {@link IEventThisPlaceHolder} with `TThis` in the event listener
|
|
903
996
|
* arguments and having the overload return `TTHis` as well
|
|
997
|
+
* @alpha
|
|
904
998
|
*/
|
|
905
999
|
export declare type TransformedEvent<TThis, E, A extends any[]> = (event: E, listener: (...args: ReplaceIEventThisPlaceHolder<A, TThis>) => void) => TThis;
|
|
906
1000
|
|
package/dist/disposable.d.ts
CHANGED
package/dist/disposable.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH
|
|
1
|
+
{"version":3,"file":"disposable.d.ts","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC3B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAE3B;;;;OAIG;IACH,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;CAC7B"}
|
package/dist/disposable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disposable.js","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Base interface for objects that require lifetime management via explicit disposal.\n */\nexport interface IDisposable {\n\t/**\n\t * Whether or not the object has been disposed.\n\t * If true, the object should be considered invalid, and its other state should be disregarded.\n\t */\n\treadonly disposed: boolean;\n\n\t/**\n\t * Dispose of the object and its resources.\n\t * @param error - Optional error indicating the reason for the disposal, if the object was\n\t * disposed as the result of an error.\n\t */\n\tdispose(error?: Error): void;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"disposable.js","sourceRoot":"","sources":["../src/disposable.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Base interface for objects that require lifetime management via explicit disposal.\n * @alpha\n */\nexport interface IDisposable {\n\t/**\n\t * Whether or not the object has been disposed.\n\t * If true, the object should be considered invalid, and its other state should be disregarded.\n\t */\n\treadonly disposed: boolean;\n\n\t/**\n\t * Dispose of the object and its resources.\n\t * @param error - Optional error indicating the reason for the disposal, if the object was\n\t * disposed as the result of an error.\n\t */\n\tdispose(error?: Error): void;\n}\n"]}
|
package/dist/error.d.ts
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { ITelemetryBaseProperties } from "./index";
|
|
6
6
|
/**
|
|
7
7
|
* Error types the Fluid Framework may report.
|
|
8
|
+
* @internal
|
|
8
9
|
*/
|
|
9
10
|
export declare const FluidErrorTypes: {
|
|
10
11
|
/**
|
|
@@ -28,6 +29,9 @@ export declare const FluidErrorTypes: {
|
|
|
28
29
|
*/
|
|
29
30
|
readonly usageError: "usageError";
|
|
30
31
|
};
|
|
32
|
+
/**
|
|
33
|
+
* @internal
|
|
34
|
+
*/
|
|
31
35
|
export type FluidErrorTypes = (typeof FluidErrorTypes)[keyof typeof FluidErrorTypes];
|
|
32
36
|
/**
|
|
33
37
|
* Base interface for all errors and warnings emitted the container.
|
|
@@ -38,6 +42,8 @@ export type FluidErrorTypes = (typeof FluidErrorTypes)[keyof typeof FluidErrorTy
|
|
|
38
42
|
* those from container-definitions. Once fully migrated, this will be a base interface for all errors and
|
|
39
43
|
* warnings emitted by the Fluid Framework. Currently only the container layer is using IErrorBase.
|
|
40
44
|
* Runtime and others will follow soon.
|
|
45
|
+
*
|
|
46
|
+
* @alpha
|
|
41
47
|
*/
|
|
42
48
|
export interface IErrorBase extends Partial<Error> {
|
|
43
49
|
/**
|
|
@@ -75,6 +81,7 @@ export interface IErrorBase extends Partial<Error> {
|
|
|
75
81
|
}
|
|
76
82
|
/**
|
|
77
83
|
* Generic wrapper for an unrecognized/uncategorized error object
|
|
84
|
+
* @internal
|
|
78
85
|
*/
|
|
79
86
|
export interface IGenericError extends IErrorBase {
|
|
80
87
|
/**
|
|
@@ -85,6 +92,7 @@ export interface IGenericError extends IErrorBase {
|
|
|
85
92
|
}
|
|
86
93
|
/**
|
|
87
94
|
* Error indicating an API is being used improperly resulting in an invalid operation.
|
|
95
|
+
* @internal
|
|
88
96
|
*/
|
|
89
97
|
export interface IUsageError extends IErrorBase {
|
|
90
98
|
/**
|
|
@@ -94,6 +102,7 @@ export interface IUsageError extends IErrorBase {
|
|
|
94
102
|
}
|
|
95
103
|
/**
|
|
96
104
|
* Warning emitted when requests to storage are being throttled
|
|
105
|
+
* @internal
|
|
97
106
|
*/
|
|
98
107
|
export interface IThrottlingWarning extends IErrorBase {
|
|
99
108
|
/**
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAEnD;;;GAGG;AACH,eAAO,MAAM,eAAe;IAC3B;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEM,CAAC;AACX;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC;AAErF;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,UAAW,SAAQ,OAAO,CAAC,KAAK,CAAC;IACjD;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,sBAAsB,CAAC,IAAI,wBAAwB,CAAC;CACpD;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,UAAU;IAChD;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,eAAe,CAAC,YAAY,CAAC;IAIxD,KAAK,CAAC,EAAE,GAAG,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,WAAY,SAAQ,UAAU;IAC9C;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,eAAe,CAAC,UAAU,CAAC;CACtD;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACrD;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,OAAO,eAAe,CAAC,eAAe,CAAC;IAC3D,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;CACnC"}
|
package/dist/error.js
CHANGED
package/dist/error.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH
|
|
1
|
+
{"version":3,"file":"error.js","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;GAGG;AACU,QAAA,eAAe,GAAG;IAC9B;;OAEG;IACH,YAAY,EAAE,cAAc;IAE5B;;OAEG;IACH,eAAe,EAAE,iBAAiB;IAElC;;OAEG;IACH,mBAAmB,EAAE,qBAAqB;IAE1C;;OAEG;IACH,mBAAmB,EAAE,qBAAqB;IAE1C;;OAEG;IACH,UAAU,EAAE,YAAY;CACf,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseProperties } from \"./index\";\n\n/**\n * Error types the Fluid Framework may report.\n * @internal\n */\nexport const FluidErrorTypes = {\n\t/**\n\t * Some error, most likely an exception caught by runtime and propagated to container as critical error\n\t */\n\tgenericError: \"genericError\",\n\n\t/**\n\t * Throttling error from server. Server is busy and is asking not to reconnect for some time\n\t */\n\tthrottlingError: \"throttlingError\",\n\n\t/**\n\t * Data loss error detected by Container / DeltaManager. Likely points to storage issue.\n\t */\n\tdataCorruptionError: \"dataCorruptionError\",\n\n\t/**\n\t * Error encountered when processing an operation. May correlate with data corruption.\n\t */\n\tdataProcessingError: \"dataProcessingError\",\n\n\t/**\n\t * Error indicating an API is being used improperly resulting in an invalid operation.\n\t */\n\tusageError: \"usageError\",\n} as const;\n/**\n * @internal\n */\nexport type FluidErrorTypes = (typeof FluidErrorTypes)[keyof typeof FluidErrorTypes];\n\n/**\n * Base interface for all errors and warnings emitted the container.\n *\n * @remarks\n *\n * We are in the process of unifying error types across layers of the Framework. For now we have only migrated\n * those from container-definitions. Once fully migrated, this will be a base interface for all errors and\n * warnings emitted by the Fluid Framework. Currently only the container layer is using IErrorBase.\n * Runtime and others will follow soon.\n *\n * @alpha\n */\nexport interface IErrorBase extends Partial<Error> {\n\t/**\n\t * A type tag differentiating kinds of errors emitted by the container.\n\t *\n\t * @see See {@link FluidErrorTypes#genericError} for some common examples.\n\t * - container\n\t * - runtime\n\t * - drivers\n\t */\n\treadonly errorType: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error | Error.message}\n\t *\n\t * @remarks\n\t *\n\t * Privacy Note - This is a freeform string that we may not control in all cases (e.g. a dependency throws an error)\n\t * If there are known cases where this contains privacy-sensitive data it will be tagged and included in the result\n\t * of getTelemetryProperties. When logging, consider fetching it that way rather than straight from this field.\n\t */\n\treadonly message: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/name | Error.name}\n\t */\n\treadonly name?: string;\n\n\t/**\n\t * See {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error/stack | Error.stack}\n\t */\n\treadonly stack?: string;\n\n\t/**\n\t * Returns all properties of this error object that are fit for logging.\n\t * Some may be tagged to indicate they contain some kind of sensitive data.\n\t */\n\tgetTelemetryProperties?(): ITelemetryBaseProperties;\n}\n\n/**\n * Generic wrapper for an unrecognized/uncategorized error object\n * @internal\n */\nexport interface IGenericError extends IErrorBase {\n\t/**\n\t * {@inheritDoc IErrorBase.errorType}\n\t */\n\treadonly errorType: typeof FluidErrorTypes.genericError;\n\n\t// TODO: Use `unknown` instead (API-Breaking)\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\terror?: any;\n}\n\n/**\n * Error indicating an API is being used improperly resulting in an invalid operation.\n * @internal\n */\nexport interface IUsageError extends IErrorBase {\n\t/**\n\t * {@inheritDoc IErrorBase.errorType}\n\t */\n\treadonly errorType: typeof FluidErrorTypes.usageError;\n}\n\n/**\n * Warning emitted when requests to storage are being throttled\n * @internal\n */\nexport interface IThrottlingWarning extends IErrorBase {\n\t/**\n\t * {@inheritDoc IErrorBase.errorType}\n\t */\n\treadonly errorType: typeof FluidErrorTypes.throttlingError;\n\treadonly retryAfterSeconds: number;\n}\n"]}
|
package/dist/events.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* Base interface for event emitters.
|
|
7
|
+
* @alpha
|
|
7
8
|
*/
|
|
8
9
|
export interface IEvent {
|
|
9
10
|
/**
|
|
@@ -20,6 +21,7 @@ export interface IEvent {
|
|
|
20
21
|
}
|
|
21
22
|
/**
|
|
22
23
|
* Base interface for error event emitters.
|
|
24
|
+
* @alpha
|
|
23
25
|
*/
|
|
24
26
|
export interface IErrorEvent extends IEvent {
|
|
25
27
|
/**
|
|
@@ -31,6 +33,7 @@ export interface IErrorEvent extends IEvent {
|
|
|
31
33
|
}
|
|
32
34
|
/**
|
|
33
35
|
* Base interface for event providers.
|
|
36
|
+
* @alpha
|
|
34
37
|
*/
|
|
35
38
|
export interface IEventProvider<TEvent extends IEvent> {
|
|
36
39
|
/**
|
|
@@ -68,17 +71,19 @@ export interface IEventProvider<TEvent extends IEvent> {
|
|
|
68
71
|
* ```
|
|
69
72
|
*
|
|
70
73
|
* interface B will now extend interface A and its events
|
|
71
|
-
*
|
|
74
|
+
* @alpha
|
|
72
75
|
*/
|
|
73
76
|
export type ExtendEventProvider<TBaseEvent extends IEvent, TBase extends IEventProvider<TBaseEvent>, TEvent extends TBaseEvent> = Omit<Omit<Omit<TBase, "on">, "once">, "off"> & IEventProvider<TBaseEvent> & IEventProvider<TEvent>;
|
|
74
77
|
/**
|
|
75
78
|
* The placeholder type that should be used instead of `this` in events.
|
|
79
|
+
* @alpha
|
|
76
80
|
*/
|
|
77
81
|
export type IEventThisPlaceHolder = {
|
|
78
82
|
thisPlaceHolder: "thisPlaceHolder";
|
|
79
83
|
};
|
|
80
84
|
/**
|
|
81
85
|
* Does the type replacement by changing types of {@link IEventThisPlaceHolder} to `TThis`
|
|
86
|
+
* @alpha
|
|
82
87
|
*/
|
|
83
88
|
export type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L extends any[] ? {
|
|
84
89
|
[K in keyof L]: L[K] extends IEventThisPlaceHolder ? TThis : L[K];
|
|
@@ -86,6 +91,7 @@ export type ReplaceIEventThisPlaceHolder<L extends any[], TThis> = L extends any
|
|
|
86
91
|
/**
|
|
87
92
|
* Transforms the event overload by replacing {@link IEventThisPlaceHolder} with `TThis` in the event listener
|
|
88
93
|
* arguments and having the overload return `TTHis` as well
|
|
94
|
+
* @alpha
|
|
89
95
|
*/
|
|
90
96
|
export type TransformedEvent<TThis, E, A extends any[]> = (event: E, listener: (...args: ReplaceIEventThisPlaceHolder<A, TThis>) => void) => TThis;
|
|
91
97
|
/**
|
|
@@ -96,6 +102,7 @@ export type TransformedEvent<TThis, E, A extends any[]> = (event: E, listener: (
|
|
|
96
102
|
* It currently supports the max of 15 event overloads which is more than we use anywhere.
|
|
97
103
|
* At more than 15 overloads we start to hit {@link https://github.com/microsoft/TypeScript/issues/37209 | TS2589}.
|
|
98
104
|
* If we need to move beyond 15 we should evaluate using a mapped type pattern like `{"event":(listenerArgs)=>void}`
|
|
105
|
+
* @alpha
|
|
99
106
|
*/
|
|
100
107
|
export type IEventTransformer<TThis, TEvent extends IEvent> = TEvent extends {
|
|
101
108
|
(event: infer E0, listener: (...args: infer A0) => void): any;
|