@fluidframework/core-interfaces 2.92.0 → 2.100.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 +33 -0
- package/README.md +1 -1
- package/api-report/core-interfaces.beta.api.md +17 -5
- package/api-report/core-interfaces.legacy.alpha.api.md +47 -6
- package/api-report/core-interfaces.legacy.beta.api.md +47 -6
- package/api-report/core-interfaces.legacy.public.api.md +17 -5
- package/api-report/core-interfaces.public.api.md +17 -5
- package/dist/brandedType.d.ts +14 -1
- package/dist/brandedType.d.ts.map +1 -1
- package/dist/brandedType.js.map +1 -1
- package/dist/deepReadonly.d.ts +3 -3
- package/dist/deepReadonly.js.map +1 -1
- package/dist/erasedType.d.ts +28 -3
- package/dist/erasedType.d.ts.map +1 -1
- package/dist/erasedType.js +7 -70
- package/dist/erasedType.js.map +1 -1
- package/dist/exposedInternalUtilityTypes.d.ts +3 -3
- package/dist/exposedInternalUtilityTypes.js.map +1 -1
- package/dist/fluidLoadable.d.ts +0 -17
- package/dist/fluidLoadable.d.ts.map +1 -1
- package/dist/fluidLoadable.js +1 -5
- package/dist/fluidLoadable.js.map +1 -1
- package/dist/fluidMap.d.ts +133 -0
- package/dist/fluidMap.d.ts.map +1 -0
- package/dist/fluidMap.js +7 -0
- package/dist/fluidMap.js.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonDeserialized.d.ts +2 -2
- package/dist/jsonDeserialized.js.map +1 -1
- package/dist/jsonSerializable.d.ts +2 -2
- package/dist/jsonSerializable.js.map +1 -1
- package/dist/jsonSerializationErrors.d.ts +2 -2
- package/dist/jsonSerializationErrors.js.map +1 -1
- package/dist/jsonType.d.ts +3 -3
- package/dist/jsonType.js.map +1 -1
- package/dist/legacy.alpha.d.ts +7 -2
- package/dist/legacy.d.ts +7 -2
- package/dist/logger.d.ts +38 -4
- package/dist/logger.d.ts.map +1 -1
- package/dist/logger.js +7 -4
- package/dist/logger.js.map +1 -1
- package/dist/opaqueJson.d.ts +2 -2
- package/dist/opaqueJson.js.map +1 -1
- package/dist/public.d.ts +2 -0
- package/eslint.config.mts +1 -1
- package/lib/brandedType.d.ts +14 -1
- package/lib/brandedType.d.ts.map +1 -1
- package/lib/brandedType.js.map +1 -1
- package/lib/deepReadonly.d.ts +3 -3
- package/lib/deepReadonly.js.map +1 -1
- package/lib/erasedType.d.ts +28 -3
- package/lib/erasedType.d.ts.map +1 -1
- package/lib/erasedType.js +6 -68
- package/lib/erasedType.js.map +1 -1
- package/lib/exposedInternalUtilityTypes.d.ts +3 -3
- package/lib/exposedInternalUtilityTypes.js.map +1 -1
- package/lib/fluidLoadable.d.ts +0 -17
- package/lib/fluidLoadable.d.ts.map +1 -1
- package/lib/fluidLoadable.js +0 -4
- package/lib/fluidLoadable.js.map +1 -1
- package/lib/fluidMap.d.ts +133 -0
- package/lib/fluidMap.d.ts.map +1 -0
- package/lib/fluidMap.js +6 -0
- package/lib/fluidMap.js.map +1 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/jsonDeserialized.d.ts +2 -2
- package/lib/jsonDeserialized.js.map +1 -1
- package/lib/jsonSerializable.d.ts +2 -2
- package/lib/jsonSerializable.js.map +1 -1
- package/lib/jsonSerializationErrors.d.ts +2 -2
- package/lib/jsonSerializationErrors.js.map +1 -1
- package/lib/jsonType.d.ts +3 -3
- package/lib/jsonType.js.map +1 -1
- package/lib/legacy.alpha.d.ts +7 -2
- package/lib/legacy.d.ts +7 -2
- package/lib/logger.d.ts +38 -4
- package/lib/logger.d.ts.map +1 -1
- package/lib/logger.js +7 -4
- package/lib/logger.js.map +1 -1
- package/lib/opaqueJson.d.ts +2 -2
- package/lib/opaqueJson.js.map +1 -1
- package/lib/public.d.ts +2 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +7 -8
- package/src/brandedType.ts +14 -1
- package/src/deepReadonly.ts +3 -3
- package/src/erasedType.ts +31 -10
- package/src/exposedInternalUtilityTypes.ts +3 -3
- package/src/fluidLoadable.ts +0 -21
- package/src/fluidMap.ts +151 -0
- package/src/index.ts +10 -2
- package/src/jsonDeserialized.ts +2 -2
- package/src/jsonSerializable.ts +2 -2
- package/src/jsonSerializationErrors.ts +2 -2
- package/src/jsonType.ts +3 -3
- package/src/logger.ts +52 -7
- package/src/opaqueJson.ts +2 -2
package/src/erasedType.ts
CHANGED
|
@@ -13,13 +13,30 @@
|
|
|
13
13
|
* allowing code outside of a package to have a reference/handle to something in the package in a type safe way without the package having to publicly export the types of the object.
|
|
14
14
|
* This should not be confused with the more specific IFluidHandle which is also named after this design pattern.
|
|
15
15
|
*
|
|
16
|
+
* As this is a class and not just an interface, to match derived types, the
|
|
17
|
+
* declarations for any two derivatives must come from the same source - the
|
|
18
|
+
* same package version. If a type must cross package boundaries, as may be the
|
|
19
|
+
* case for cross layer types, the derived type should pick a specific version
|
|
20
|
+
* of core-interfaces to import ErasedType from. Exact versions are best, but
|
|
21
|
+
* as security best practice, use ~ specification. Consumers are expected to
|
|
22
|
+
* use a package manager that will produce consistency over minor patches.
|
|
23
|
+
* A change in version should be considered a breaking change.
|
|
24
|
+
*
|
|
16
25
|
* Recommended usage is to use `interface` instead of `type` so tooling (such as tsc and refactoring tools)
|
|
17
26
|
* uses the type name instead of expanding it.
|
|
18
27
|
*
|
|
19
28
|
* @example
|
|
29
|
+
* package.json:
|
|
30
|
+
* ```json
|
|
31
|
+
* "dependencies": {
|
|
32
|
+
* "@fluidframework/erased-type-v1": "npm:@fluidframework/core-interfaces@~2.0.0"
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
* source.ts:
|
|
20
36
|
* ```typescript
|
|
37
|
+
* import { ErasedType as ErasedTypeV1 } from "@fluidframework/erased-type-v1";
|
|
21
38
|
* // public sealed type
|
|
22
|
-
* export interface ErasedMyType extends
|
|
39
|
+
* export interface ErasedMyType extends ErasedTypeV1<"myPackage.MyType"> {}
|
|
23
40
|
* // internal type
|
|
24
41
|
* export interface MyType {
|
|
25
42
|
* example: number;
|
|
@@ -35,6 +52,7 @@
|
|
|
35
52
|
*
|
|
36
53
|
* Do not use this class with `instanceof`: this will always be false at runtime,
|
|
37
54
|
* but the compiler may think it's true in some cases.
|
|
55
|
+
*
|
|
38
56
|
* @privateRemarks
|
|
39
57
|
* For this pattern to work well it needs to be difficult for a user of the erased type to
|
|
40
58
|
* implicitly use something other than a instance received from the package as an instance of the erased type in type safe code.
|
|
@@ -57,7 +75,7 @@
|
|
|
57
75
|
* @sealed
|
|
58
76
|
* @public
|
|
59
77
|
*/
|
|
60
|
-
export abstract class ErasedType<out Name = unknown> {
|
|
78
|
+
export declare abstract class ErasedType<out Name = unknown> {
|
|
61
79
|
/**
|
|
62
80
|
* Compile time only marker to make type checking more strict.
|
|
63
81
|
* This method will not exist at runtime and accessing it is invalid.
|
|
@@ -70,31 +88,34 @@ export abstract class ErasedType<out Name = unknown> {
|
|
|
70
88
|
/**
|
|
71
89
|
* This class should never exist at runtime, so make it un-constructable.
|
|
72
90
|
*/
|
|
73
|
-
private constructor()
|
|
91
|
+
private constructor();
|
|
74
92
|
|
|
75
93
|
/**
|
|
76
94
|
* Since this class is a compile time only type brand, `instanceof` will never work with it.
|
|
77
|
-
* This `Symbol.hasInstance`
|
|
78
|
-
*
|
|
95
|
+
* This `Symbol.hasInstance` declaration (no definition) ensures that `instanceof` will
|
|
96
|
+
* produce `ReferenceError` if used at runtime. And in TypeScript 5.3 and newer will produce
|
|
97
|
+
* a compile time error if used.
|
|
79
98
|
*/
|
|
80
|
-
public static [Symbol.hasInstance](value: never): value is never
|
|
81
|
-
throw new Error(
|
|
82
|
-
"ErasedType is a compile time type brand not a real class that can be used with `instanceof` at runtime.",
|
|
83
|
-
);
|
|
84
|
-
}
|
|
99
|
+
public static [Symbol.hasInstance](value: never): value is never;
|
|
85
100
|
}
|
|
86
101
|
|
|
87
102
|
/**
|
|
88
103
|
* Used to mark a `@sealed` interface in a strongly typed way to prevent external implementations.
|
|
104
|
+
*
|
|
89
105
|
* @remarks
|
|
90
106
|
* This is an alternative to {@link ErasedType} which is more ergonomic to implement in the case where the implementation can extend `ErasedTypeImplementation`.
|
|
91
107
|
*
|
|
92
108
|
* Users of interfaces extending this should never refer to anything about this class:
|
|
93
109
|
* migrating the type branding to another mechanism, like {@link ErasedType} should be considered a non-breaking change.
|
|
110
|
+
*
|
|
111
|
+
* @see {@link ErasedType} for version compatibility notes.
|
|
112
|
+
*
|
|
94
113
|
* @privateRemarks
|
|
95
114
|
* Implement interfaces which extend this by sub-classing {@link ErasedTypeImplementation}.
|
|
96
115
|
*
|
|
97
116
|
* This class should only be a `type` package export, preventing users from extending it directly.
|
|
117
|
+
* But since {@link ErasedTypeImplementation} does extend it, an implementation
|
|
118
|
+
* of the constructor must be provided, unlike {@link ErasedType}.
|
|
98
119
|
*
|
|
99
120
|
* Since {@link ErasedTypeImplementation} is exported as `@internal`, this restricts implementations of the sealed interfaces to users of `@internal` APIs, which should be anything within this release group.
|
|
100
121
|
* Any finer grained restrictions can be done as documentation, but not type enforced.
|
|
@@ -27,7 +27,7 @@ const RecursionMarkerSymbol: unique symbol = Symbol("recursion here");
|
|
|
27
27
|
* @privateRemarks
|
|
28
28
|
* WeakRef should be added when lib is updated to ES2021 or later.
|
|
29
29
|
*
|
|
30
|
-
* @
|
|
30
|
+
* @public
|
|
31
31
|
*/
|
|
32
32
|
export type ReadonlySupportedGenerics =
|
|
33
33
|
| IFluidHandle
|
|
@@ -46,7 +46,7 @@ export type ReadonlySupportedGenerics =
|
|
|
46
46
|
* depth limit when a recursive type is found. Use of `0` will stop applying
|
|
47
47
|
* `DeepReadonly` at the first point recursion is detected.
|
|
48
48
|
*
|
|
49
|
-
* @
|
|
49
|
+
* @public
|
|
50
50
|
* @system
|
|
51
51
|
*/
|
|
52
52
|
export type DeepReadonlyRecursionLimit = "NoLimit" | 0 | `+${string}`;
|
|
@@ -67,7 +67,7 @@ export type DeepReadonlyRecursionLimit = "NoLimit" | 0 | `+${string}`;
|
|
|
67
67
|
* exported anyway. All in namespace are left exported to avoid api-extractor
|
|
68
68
|
* potentially failing to validate other modules correctly.
|
|
69
69
|
*
|
|
70
|
-
* @
|
|
70
|
+
* @public
|
|
71
71
|
* @system
|
|
72
72
|
*/
|
|
73
73
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
package/src/fluidLoadable.ts
CHANGED
|
@@ -29,24 +29,3 @@ export interface IFluidLoadable extends IProvideFluidLoadable {
|
|
|
29
29
|
*/
|
|
30
30
|
readonly handle: IFluidHandle;
|
|
31
31
|
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* @internal
|
|
35
|
-
*/
|
|
36
|
-
export const IFluidRunnable: keyof IProvideFluidRunnable = "IFluidRunnable";
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
export interface IProvideFluidRunnable {
|
|
42
|
-
readonly IFluidRunnable: IFluidRunnable;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* @internal
|
|
46
|
-
*/
|
|
47
|
-
export interface IFluidRunnable {
|
|
48
|
-
// TODO: Use `unknown` instead (API-Breaking)
|
|
49
|
-
|
|
50
|
-
run(...args: any[]): Promise<void>;
|
|
51
|
-
stop(reason?: string): void;
|
|
52
|
-
}
|
package/src/fluidMap.ts
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Like TypeScript's built-in `Iterable` type.
|
|
8
|
+
*
|
|
9
|
+
* @privateRemarks
|
|
10
|
+
* This exists to be unaffected by TypeScript's version and configuration options.
|
|
11
|
+
*
|
|
12
|
+
* @sealed @beta
|
|
13
|
+
*/
|
|
14
|
+
export interface FluidIterable<T> {
|
|
15
|
+
/**
|
|
16
|
+
* Returns an iterator over the elements in this iterable.
|
|
17
|
+
*
|
|
18
|
+
* @remarks Works like the built-in {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator | \[Symbol.iterator\]} protocol.
|
|
19
|
+
*/
|
|
20
|
+
[Symbol.iterator](): FluidIterableIterator<T>;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Like TypeScript's built-in iterable iterator type.
|
|
25
|
+
*
|
|
26
|
+
* @privateRemarks
|
|
27
|
+
* The done branch uses `any` rather than `undefined` to match TypeScript's built-in IteratorReturnResult, which defaults to any for the same reason.
|
|
28
|
+
* Using `undefined` causes TypeScript to include it in type inference at call sites like `Array.from` which would infer `T | undefined` instead of `T`.
|
|
29
|
+
* The done value is rarely meaningful to callers since values are mainly consumed when done is false.
|
|
30
|
+
* Thus `any` is not particularly harmful here, and the unsafety is worth it as
|
|
31
|
+
* it interacts better with the existing TypeScript `IteratorResult` interfaces where `TReturn` defaults to any.
|
|
32
|
+
*
|
|
33
|
+
* @sealed @beta
|
|
34
|
+
*/
|
|
35
|
+
export interface FluidIterableIterator<T> extends FluidIterable<T> {
|
|
36
|
+
/**
|
|
37
|
+
* Returns the next element in the iteration sequence.
|
|
38
|
+
*
|
|
39
|
+
* @remarks Works like the built-in {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_iterator_protocol | Iterator.next} method.
|
|
40
|
+
* When there are remaining elements, returns `\{ value: T; done?: false \}`.
|
|
41
|
+
* When the iteration is complete, returns `\{ value: any; done: true \}`.
|
|
42
|
+
*/
|
|
43
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
44
|
+
next(): { value: T; done?: false } | { value: any; done: true };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Like TypeScript's built in `ReadonlyMap` type.
|
|
49
|
+
* Unlike the built in `ReadonlyMap`, this interface includes Symbol.toStringTag.
|
|
50
|
+
*
|
|
51
|
+
* @privateRemarks
|
|
52
|
+
* This exists so that Fluid has a `ReadonlyMap` type which is unaffected by TypeScript's version and configuration options,
|
|
53
|
+
* and safe to implement without being broken by changes to TypeScript's default ReadonlyMap type.
|
|
54
|
+
* All behavior exposed through this interface should be compatible with the corresponding behavior of built in ReadonlyMaps,
|
|
55
|
+
* but it may lack some of the newer APIs,
|
|
56
|
+
* and might express the type slightly different from how TypeScript does in its `ReadonlyMap` type.
|
|
57
|
+
*
|
|
58
|
+
* @sealed @beta
|
|
59
|
+
*/
|
|
60
|
+
export interface FluidReadonlyMap<K, V> {
|
|
61
|
+
/**
|
|
62
|
+
* Returns an iterable of entries in the map.
|
|
63
|
+
*/
|
|
64
|
+
[Symbol.iterator](): FluidIterableIterator<[K, V]>;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* The number of entries in the map.
|
|
68
|
+
*/
|
|
69
|
+
readonly size: number;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Returns an iterable of key, value pairs for every entry in the map.
|
|
73
|
+
*/
|
|
74
|
+
entries(): FluidIterableIterator<[K, V]>;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Executes the provided function once per each key/value pair in the map.
|
|
78
|
+
*/
|
|
79
|
+
forEach(
|
|
80
|
+
callbackfn: (value: V, key: K, map: FluidReadonlyMap<K, V>) => void,
|
|
81
|
+
// Typing inherited from ReadonlyMap.
|
|
82
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
83
|
+
thisArg?: any,
|
|
84
|
+
): void;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Returns the value associated to the specified key, or undefined if there is none.
|
|
88
|
+
*/
|
|
89
|
+
get(key: K): V | undefined;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Returns a boolean indicating whether an element with the specified key exists or not.
|
|
93
|
+
*/
|
|
94
|
+
has(key: K): boolean;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Returns an iterable of keys in the map.
|
|
98
|
+
*/
|
|
99
|
+
keys(): FluidIterableIterator<K>;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Returns an iterable of values in the map.
|
|
103
|
+
*/
|
|
104
|
+
values(): FluidIterableIterator<V>;
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag | Symbol.toStringTag}
|
|
108
|
+
*/
|
|
109
|
+
readonly [Symbol.toStringTag]: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Like TypeScript's built in `Map` type.
|
|
114
|
+
*
|
|
115
|
+
* @privateRemarks
|
|
116
|
+
* This exists so that Fluid has a `Map` type which is unaffected by TypeScript's version and configuration options,
|
|
117
|
+
* and safe to implement without being broken by changes to TypeScript's default Map type.
|
|
118
|
+
* All behavior exposed through this interface should be compatible with the corresponding behavior of JavaScript Maps,
|
|
119
|
+
* but it may lack some of the newer APIs,
|
|
120
|
+
* and might express the type slightly different from how TypeScript does in its `Map` type.
|
|
121
|
+
*
|
|
122
|
+
* @sealed @beta
|
|
123
|
+
*/
|
|
124
|
+
export interface FluidMap<K, V> extends FluidReadonlyMap<K, V> {
|
|
125
|
+
/**
|
|
126
|
+
* Removes the specified element from the map by its key.
|
|
127
|
+
*
|
|
128
|
+
* @remarks
|
|
129
|
+
* Unlike the built-in `Map.delete`, this returns `void` instead of a boolean.
|
|
130
|
+
* This is intentional: in a distributed system, the caller often cannot reliably know
|
|
131
|
+
* whether the element existed at the time of deletion.
|
|
132
|
+
* Subtypes may override this to return a boolean if appropriate.
|
|
133
|
+
*/
|
|
134
|
+
delete(key: K): void;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* Executes the provided function once per each key/value pair in the map.
|
|
138
|
+
*/
|
|
139
|
+
forEach(
|
|
140
|
+
callbackfn: (value: V, key: K, map: FluidMap<K, V>) => void,
|
|
141
|
+
// Typing inherited from Map.
|
|
142
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
143
|
+
thisArg?: any,
|
|
144
|
+
): void;
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Adds a new element with a specified key and value to the map.
|
|
148
|
+
* If an element with the same key already exists, the element will be updated.
|
|
149
|
+
*/
|
|
150
|
+
set(key: K, value: V): void;
|
|
151
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,13 @@ export type { BrandedType } from "./brandedType.js";
|
|
|
7
7
|
|
|
8
8
|
export type { IDisposable } from "./disposable.js";
|
|
9
9
|
|
|
10
|
+
export type {
|
|
11
|
+
FluidIterable,
|
|
12
|
+
FluidIterableIterator,
|
|
13
|
+
FluidMap,
|
|
14
|
+
FluidReadonlyMap,
|
|
15
|
+
} from "./fluidMap.js";
|
|
16
|
+
|
|
10
17
|
export type {
|
|
11
18
|
IErrorBase,
|
|
12
19
|
IGenericError,
|
|
@@ -30,8 +37,8 @@ export type {
|
|
|
30
37
|
TransformedEvent,
|
|
31
38
|
} from "./events.js";
|
|
32
39
|
|
|
33
|
-
export type { IProvideFluidLoadable
|
|
34
|
-
export { IFluidLoadable
|
|
40
|
+
export type { IProvideFluidLoadable } from "./fluidLoadable.js";
|
|
41
|
+
export { IFluidLoadable } from "./fluidLoadable.js";
|
|
35
42
|
|
|
36
43
|
// TypeScript forgets the index signature when customers augment IRequestHeader if we export *.
|
|
37
44
|
// So we export the explicit members as a workaround:
|
|
@@ -57,6 +64,7 @@ export type {
|
|
|
57
64
|
ITelemetryBaseEvent,
|
|
58
65
|
ITelemetryBaseLogger,
|
|
59
66
|
ITelemetryBaseProperties,
|
|
67
|
+
LogLevelConst,
|
|
60
68
|
Tagged,
|
|
61
69
|
TelemetryBaseEventPropertyType,
|
|
62
70
|
} from "./logger.js";
|
package/src/jsonDeserialized.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { InternalUtilityTypes } from "./exposedInternalUtilityTypes.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Options for {@link JsonDeserialized}.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @public
|
|
12
12
|
*/
|
|
13
13
|
export interface JsonDeserializedOptions {
|
|
14
14
|
/**
|
|
@@ -107,7 +107,7 @@ export interface JsonDeserializedOptions {
|
|
|
107
107
|
* function foo<T>(): JsonDeserialized<T> { ... }
|
|
108
108
|
* ```
|
|
109
109
|
*
|
|
110
|
-
* @
|
|
110
|
+
* @public
|
|
111
111
|
*/
|
|
112
112
|
export type JsonDeserialized<
|
|
113
113
|
T,
|
package/src/jsonSerializable.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { InternalUtilityTypes } from "./exposedInternalUtilityTypes.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Options for {@link JsonSerializable}.
|
|
10
10
|
*
|
|
11
|
-
* @
|
|
11
|
+
* @public
|
|
12
12
|
*/
|
|
13
13
|
export interface JsonSerializableOptions {
|
|
14
14
|
/**
|
|
@@ -130,7 +130,7 @@ export interface JsonSerializableOptions {
|
|
|
130
130
|
* proper use, that will never be an issue as any filtering of types will happen
|
|
131
131
|
* before T recursion.
|
|
132
132
|
*
|
|
133
|
-
* @
|
|
133
|
+
* @public
|
|
134
134
|
*/
|
|
135
135
|
export type JsonSerializable<
|
|
136
136
|
T,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* @privateRemarks type is used over interface; so inspection of type
|
|
11
11
|
* result can be more informative than just the type name.
|
|
12
12
|
*
|
|
13
|
-
* @
|
|
13
|
+
* @public
|
|
14
14
|
* @system
|
|
15
15
|
*/
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
|
@@ -25,7 +25,7 @@ export type SerializationErrorPerUndefinedArrayElement = {
|
|
|
25
25
|
* @privateRemarks type is used over interface; so inspection of type
|
|
26
26
|
* result can be more informative than just the type name.
|
|
27
27
|
*
|
|
28
|
-
* @
|
|
28
|
+
* @public
|
|
29
29
|
* @system
|
|
30
30
|
*/
|
|
31
31
|
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
package/src/jsonType.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* Prefer using `JsonSerializable<unknown>` or `JsonDeserialized<unknown>` over this type that
|
|
16
16
|
* is an implementation detail.
|
|
17
17
|
*
|
|
18
|
-
* @
|
|
18
|
+
* @public
|
|
19
19
|
*/
|
|
20
20
|
export type JsonTypeWith<T> =
|
|
21
21
|
// eslint-disable-next-line @rushstack/no-new-null
|
|
@@ -30,7 +30,7 @@ export type JsonTypeWith<T> =
|
|
|
30
30
|
/**
|
|
31
31
|
* Portion of {@link JsonTypeWith} that is an object (including array) and not null.
|
|
32
32
|
*
|
|
33
|
-
* @
|
|
33
|
+
* @public
|
|
34
34
|
*/
|
|
35
35
|
export type NonNullJsonObjectWith<T> =
|
|
36
36
|
| { [key: string | number]: JsonTypeWith<T> }
|
|
@@ -51,7 +51,7 @@ export type NonNullJsonObjectWith<T> =
|
|
|
51
51
|
* ```
|
|
52
52
|
* does not prevent later `x = 5`. (Does prevent `x.a = 2`.)
|
|
53
53
|
*
|
|
54
|
-
* @
|
|
54
|
+
* @public
|
|
55
55
|
*/
|
|
56
56
|
export type ReadonlyJsonTypeWith<TReadonlyAlternates> =
|
|
57
57
|
// eslint-disable-next-line @rushstack/no-new-null
|
package/src/logger.ts
CHANGED
|
@@ -52,13 +52,58 @@ export interface ITelemetryBaseEvent extends ITelemetryBaseProperties {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
* Specify levels of the logs.
|
|
55
|
+
*
|
|
56
|
+
* @privateRemarks This interface exists solely for documentation. API Extractor does not
|
|
57
|
+
* propagate TSDoc comments from a const's inline type to API reports, so we define the shape
|
|
58
|
+
* here and use LogLevelConst on the LogLevel const to surface member docs.
|
|
59
|
+
*
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export interface LogLevelConst {
|
|
63
|
+
/**
|
|
64
|
+
* Chatty logs useful for debugging.
|
|
65
|
+
* @remarks They need not be collected in production.
|
|
66
|
+
*/
|
|
67
|
+
readonly verbose: 10;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Information about the session.
|
|
71
|
+
* @remarks These logs could be omitted in some sessions if needed (e.g. to reduce overall telemetry volume).
|
|
72
|
+
* If any are collected from a particular session, all should be.
|
|
73
|
+
*/
|
|
74
|
+
readonly info: 20;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Essential information about the operation of Fluid.
|
|
78
|
+
* @remarks It is recommended that these should always be collected, even in production, for diagnostic purposes.
|
|
79
|
+
*/
|
|
80
|
+
readonly essential: 30;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Default LogLevel
|
|
84
|
+
* @remarks Prefer {@link LogLevelConst.info | LogLevel.info} when selecting a level explicitly since this will be deprecated and removed in a future release.
|
|
85
|
+
*/
|
|
86
|
+
readonly default: 20;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* To log errors.
|
|
90
|
+
* @remarks Prefer {@link LogLevelConst.essential | LogLevel.essential} when selecting a level since this will be deprecated and removed in a future release.
|
|
91
|
+
*/
|
|
92
|
+
readonly error: 30;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Provides runtime {@link (LogLevel:type)} values via symbolic names
|
|
97
|
+
* @see {@link LogLevelConst} type.
|
|
55
98
|
* @public
|
|
56
99
|
*/
|
|
57
|
-
export const LogLevel = {
|
|
58
|
-
verbose: 10,
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
100
|
+
export const LogLevel: LogLevelConst = {
|
|
101
|
+
verbose: 10,
|
|
102
|
+
info: 20,
|
|
103
|
+
essential: 30,
|
|
104
|
+
default: 20,
|
|
105
|
+
error: 30,
|
|
106
|
+
};
|
|
62
107
|
|
|
63
108
|
/**
|
|
64
109
|
* Specify a level to the log to filter out logs based on the level.
|
|
@@ -75,13 +120,13 @@ export interface ITelemetryBaseLogger {
|
|
|
75
120
|
/**
|
|
76
121
|
* Log a telemetry event, if it meets the appropriate log-level threshold (see {@link ITelemetryBaseLogger.minLogLevel}).
|
|
77
122
|
* @param event - The event to log.
|
|
78
|
-
* @param logLevel - The log level of the event. Default: {@link
|
|
123
|
+
* @param logLevel - The log level of the event. Default: {@link LogLevelConst.default | LogLevel.default}.
|
|
79
124
|
*/
|
|
80
125
|
send(event: ITelemetryBaseEvent, logLevel?: LogLevel): void;
|
|
81
126
|
|
|
82
127
|
/**
|
|
83
128
|
* Minimum log level to be logged.
|
|
84
|
-
* @defaultValue {@link
|
|
129
|
+
* @defaultValue {@link LogLevelConst.default | LogLevel.default}.
|
|
85
130
|
*/
|
|
86
131
|
minLogLevel?: LogLevel;
|
|
87
132
|
}
|
package/src/opaqueJson.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { BrandedType } from "./brandedType.js";
|
|
|
19
19
|
* be read.
|
|
20
20
|
*
|
|
21
21
|
* @sealed
|
|
22
|
-
* @
|
|
22
|
+
* @public
|
|
23
23
|
*/
|
|
24
24
|
export declare class OpaqueJsonDeserialized<
|
|
25
25
|
T,
|
|
@@ -59,7 +59,7 @@ export declare class OpaqueJsonDeserialized<
|
|
|
59
59
|
* when "instance" will be forwarded along.
|
|
60
60
|
*
|
|
61
61
|
* @sealed
|
|
62
|
-
* @
|
|
62
|
+
* @public
|
|
63
63
|
*/
|
|
64
64
|
export declare class OpaqueJsonSerializable<
|
|
65
65
|
T,
|