@fluidframework/core-interfaces 2.92.0 → 2.93.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 +25 -0
- package/README.md +1 -1
- package/api-report/core-interfaces.beta.api.md +7 -0
- package/api-report/core-interfaces.legacy.alpha.api.md +37 -1
- package/api-report/core-interfaces.legacy.beta.api.md +37 -1
- package/api-report/core-interfaces.legacy.public.api.md +7 -0
- package/api-report/core-interfaces.public.api.md +7 -0
- 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 +3 -2
- 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 +6 -2
- package/dist/legacy.d.ts +6 -2
- package/dist/opaqueJson.d.ts +2 -2
- package/dist/opaqueJson.js.map +1 -1
- package/dist/public.d.ts +1 -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 +3 -2
- 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 +6 -2
- package/lib/legacy.d.ts +6 -2
- package/lib/opaqueJson.d.ts +2 -2
- package/lib/opaqueJson.js.map +1 -1
- package/lib/public.d.ts +1 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +5 -6
- 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 +9 -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/opaqueJson.ts +2 -2
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Like TypeScript's built-in `Iterable` type.
|
|
7
|
+
*
|
|
8
|
+
* @privateRemarks
|
|
9
|
+
* This exists to be unaffected by TypeScript's version and configuration options.
|
|
10
|
+
*
|
|
11
|
+
* @sealed @beta
|
|
12
|
+
*/
|
|
13
|
+
export interface FluidIterable<T> {
|
|
14
|
+
/**
|
|
15
|
+
* Returns an iterator over the elements in this iterable.
|
|
16
|
+
*
|
|
17
|
+
* @remarks Works like the built-in {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator | \[Symbol.iterator\]} protocol.
|
|
18
|
+
*/
|
|
19
|
+
[Symbol.iterator](): FluidIterableIterator<T>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Like TypeScript's built-in iterable iterator type.
|
|
23
|
+
*
|
|
24
|
+
* @privateRemarks
|
|
25
|
+
* The done branch uses `any` rather than `undefined` to match TypeScript's built-in IteratorReturnResult, which defaults to any for the same reason.
|
|
26
|
+
* Using `undefined` causes TypeScript to include it in type inference at call sites like `Array.from` which would infer `T | undefined` instead of `T`.
|
|
27
|
+
* The done value is rarely meaningful to callers since values are mainly consumed when done is false.
|
|
28
|
+
* Thus `any` is not particularly harmful here, and the unsafety is worth it as
|
|
29
|
+
* it interacts better with the existing TypeScript `IteratorResult` interfaces where `TReturn` defaults to any.
|
|
30
|
+
*
|
|
31
|
+
* @sealed @beta
|
|
32
|
+
*/
|
|
33
|
+
export interface FluidIterableIterator<T> extends FluidIterable<T> {
|
|
34
|
+
/**
|
|
35
|
+
* Returns the next element in the iteration sequence.
|
|
36
|
+
*
|
|
37
|
+
* @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.
|
|
38
|
+
* When there are remaining elements, returns `\{ value: T; done?: false \}`.
|
|
39
|
+
* When the iteration is complete, returns `\{ value: any; done: true \}`.
|
|
40
|
+
*/
|
|
41
|
+
next(): {
|
|
42
|
+
value: T;
|
|
43
|
+
done?: false;
|
|
44
|
+
} | {
|
|
45
|
+
value: any;
|
|
46
|
+
done: true;
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Like TypeScript's built in `ReadonlyMap` type.
|
|
51
|
+
* Unlike the built in `ReadonlyMap`, this interface includes Symbol.toStringTag.
|
|
52
|
+
*
|
|
53
|
+
* @privateRemarks
|
|
54
|
+
* This exists so that Fluid has a `ReadonlyMap` type which is unaffected by TypeScript's version and configuration options,
|
|
55
|
+
* and safe to implement without being broken by changes to TypeScript's default ReadonlyMap type.
|
|
56
|
+
* All behavior exposed through this interface should be compatible with the corresponding behavior of built in ReadonlyMaps,
|
|
57
|
+
* but it may lack some of the newer APIs,
|
|
58
|
+
* and might express the type slightly different from how TypeScript does in its `ReadonlyMap` type.
|
|
59
|
+
*
|
|
60
|
+
* @sealed @beta
|
|
61
|
+
*/
|
|
62
|
+
export interface FluidReadonlyMap<K, V> {
|
|
63
|
+
/**
|
|
64
|
+
* Returns an iterable of entries in the map.
|
|
65
|
+
*/
|
|
66
|
+
[Symbol.iterator](): FluidIterableIterator<[K, V]>;
|
|
67
|
+
/**
|
|
68
|
+
* The number of entries in the map.
|
|
69
|
+
*/
|
|
70
|
+
readonly size: number;
|
|
71
|
+
/**
|
|
72
|
+
* Returns an iterable of key, value pairs for every entry in the map.
|
|
73
|
+
*/
|
|
74
|
+
entries(): FluidIterableIterator<[K, V]>;
|
|
75
|
+
/**
|
|
76
|
+
* Executes the provided function once per each key/value pair in the map.
|
|
77
|
+
*/
|
|
78
|
+
forEach(callbackfn: (value: V, key: K, map: FluidReadonlyMap<K, V>) => void, thisArg?: any): void;
|
|
79
|
+
/**
|
|
80
|
+
* Returns the value associated to the specified key, or undefined if there is none.
|
|
81
|
+
*/
|
|
82
|
+
get(key: K): V | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Returns a boolean indicating whether an element with the specified key exists or not.
|
|
85
|
+
*/
|
|
86
|
+
has(key: K): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* Returns an iterable of keys in the map.
|
|
89
|
+
*/
|
|
90
|
+
keys(): FluidIterableIterator<K>;
|
|
91
|
+
/**
|
|
92
|
+
* Returns an iterable of values in the map.
|
|
93
|
+
*/
|
|
94
|
+
values(): FluidIterableIterator<V>;
|
|
95
|
+
/**
|
|
96
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag | Symbol.toStringTag}
|
|
97
|
+
*/
|
|
98
|
+
readonly [Symbol.toStringTag]: string;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Like TypeScript's built in `Map` type.
|
|
102
|
+
*
|
|
103
|
+
* @privateRemarks
|
|
104
|
+
* This exists so that Fluid has a `Map` type which is unaffected by TypeScript's version and configuration options,
|
|
105
|
+
* and safe to implement without being broken by changes to TypeScript's default Map type.
|
|
106
|
+
* All behavior exposed through this interface should be compatible with the corresponding behavior of JavaScript Maps,
|
|
107
|
+
* but it may lack some of the newer APIs,
|
|
108
|
+
* and might express the type slightly different from how TypeScript does in its `Map` type.
|
|
109
|
+
*
|
|
110
|
+
* @sealed @beta
|
|
111
|
+
*/
|
|
112
|
+
export interface FluidMap<K, V> extends FluidReadonlyMap<K, V> {
|
|
113
|
+
/**
|
|
114
|
+
* Removes the specified element from the map by its key.
|
|
115
|
+
*
|
|
116
|
+
* @remarks
|
|
117
|
+
* Unlike the built-in `Map.delete`, this returns `void` instead of a boolean.
|
|
118
|
+
* This is intentional: in a distributed system, the caller often cannot reliably know
|
|
119
|
+
* whether the element existed at the time of deletion.
|
|
120
|
+
* Subtypes may override this to return a boolean if appropriate.
|
|
121
|
+
*/
|
|
122
|
+
delete(key: K): void;
|
|
123
|
+
/**
|
|
124
|
+
* Executes the provided function once per each key/value pair in the map.
|
|
125
|
+
*/
|
|
126
|
+
forEach(callbackfn: (value: V, key: K, map: FluidMap<K, V>) => void, thisArg?: any): void;
|
|
127
|
+
/**
|
|
128
|
+
* Adds a new element with a specified key and value to the map.
|
|
129
|
+
* If an element with the same key already exists, the element will be updated.
|
|
130
|
+
*/
|
|
131
|
+
set(key: K, value: V): void;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=fluidMap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluidMap.d.ts","sourceRoot":"","sources":["../src/fluidMap.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC;IAC/B;;;;OAIG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,qBAAqB,CAAC,CAAC,CAAE,SAAQ,aAAa,CAAC,CAAC,CAAC;IACjE;;;;;;OAMG;IAEH,IAAI,IAAI;QAAE,KAAK,EAAE,CAAC,CAAC;QAAC,IAAI,CAAC,EAAE,KAAK,CAAA;KAAE,GAAG;QAAE,KAAK,EAAE,GAAG,CAAC;QAAC,IAAI,EAAE,IAAI,CAAA;KAAE,CAAC;CAChE;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,EAAE,CAAC;IACrC;;OAEG;IACH,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEnD;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,IAAI,qBAAqB,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEzC;;OAEG;IACH,OAAO,CACN,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAGnE,OAAO,CAAC,EAAE,GAAG,GACX,IAAI,CAAC;IAER;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAE3B;;OAEG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC;IAErB;;OAEG;IACH,IAAI,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAEjC;;OAEG;IACH,MAAM,IAAI,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAEnC;;OAEG;IACH,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CACtC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAE,SAAQ,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7D;;;;;;;;OAQG;IACH,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;IAErB;;OAEG;IACH,OAAO,CACN,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,EAG3D,OAAO,CAAC,EAAE,GAAG,GACX,IAAI,CAAC;IAER;;;OAGG;IACH,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;CAC5B"}
|
package/lib/fluidMap.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fluidMap.js","sourceRoot":"","sources":["../src/fluidMap.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 * Like TypeScript's built-in `Iterable` type.\n *\n * @privateRemarks\n * This exists to be unaffected by TypeScript's version and configuration options.\n *\n * @sealed @beta\n */\nexport interface FluidIterable<T> {\n\t/**\n\t * Returns an iterator over the elements in this iterable.\n\t *\n\t * @remarks Works like the built-in {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/iterator | \\[Symbol.iterator\\]} protocol.\n\t */\n\t[Symbol.iterator](): FluidIterableIterator<T>;\n}\n\n/**\n * Like TypeScript's built-in iterable iterator type.\n *\n * @privateRemarks\n * The done branch uses `any` rather than `undefined` to match TypeScript's built-in IteratorReturnResult, which defaults to any for the same reason.\n * Using `undefined` causes TypeScript to include it in type inference at call sites like `Array.from` which would infer `T | undefined` instead of `T`.\n * The done value is rarely meaningful to callers since values are mainly consumed when done is false.\n * Thus `any` is not particularly harmful here, and the unsafety is worth it as\n * it interacts better with the existing TypeScript `IteratorResult` interfaces where `TReturn` defaults to any.\n *\n * @sealed @beta\n */\nexport interface FluidIterableIterator<T> extends FluidIterable<T> {\n\t/**\n\t * Returns the next element in the iteration sequence.\n\t *\n\t * @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.\n\t * When there are remaining elements, returns `\\{ value: T; done?: false \\}`.\n\t * When the iteration is complete, returns `\\{ value: any; done: true \\}`.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\tnext(): { value: T; done?: false } | { value: any; done: true };\n}\n\n/**\n * Like TypeScript's built in `ReadonlyMap` type.\n * Unlike the built in `ReadonlyMap`, this interface includes Symbol.toStringTag.\n *\n * @privateRemarks\n * This exists so that Fluid has a `ReadonlyMap` type which is unaffected by TypeScript's version and configuration options,\n * and safe to implement without being broken by changes to TypeScript's default ReadonlyMap type.\n * All behavior exposed through this interface should be compatible with the corresponding behavior of built in ReadonlyMaps,\n * but it may lack some of the newer APIs,\n * and might express the type slightly different from how TypeScript does in its `ReadonlyMap` type.\n *\n * @sealed @beta\n */\nexport interface FluidReadonlyMap<K, V> {\n\t/**\n\t * Returns an iterable of entries in the map.\n\t */\n\t[Symbol.iterator](): FluidIterableIterator<[K, V]>;\n\n\t/**\n\t * The number of entries in the map.\n\t */\n\treadonly size: number;\n\n\t/**\n\t * Returns an iterable of key, value pairs for every entry in the map.\n\t */\n\tentries(): FluidIterableIterator<[K, V]>;\n\n\t/**\n\t * Executes the provided function once per each key/value pair in the map.\n\t */\n\tforEach(\n\t\tcallbackfn: (value: V, key: K, map: FluidReadonlyMap<K, V>) => void,\n\t\t// Typing inherited from ReadonlyMap.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthisArg?: any,\n\t): void;\n\n\t/**\n\t * Returns the value associated to the specified key, or undefined if there is none.\n\t */\n\tget(key: K): V | undefined;\n\n\t/**\n\t * Returns a boolean indicating whether an element with the specified key exists or not.\n\t */\n\thas(key: K): boolean;\n\n\t/**\n\t * Returns an iterable of keys in the map.\n\t */\n\tkeys(): FluidIterableIterator<K>;\n\n\t/**\n\t * Returns an iterable of values in the map.\n\t */\n\tvalues(): FluidIterableIterator<V>;\n\n\t/**\n\t * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag | Symbol.toStringTag}\n\t */\n\treadonly [Symbol.toStringTag]: string;\n}\n\n/**\n * Like TypeScript's built in `Map` type.\n *\n * @privateRemarks\n * This exists so that Fluid has a `Map` type which is unaffected by TypeScript's version and configuration options,\n * and safe to implement without being broken by changes to TypeScript's default Map type.\n * All behavior exposed through this interface should be compatible with the corresponding behavior of JavaScript Maps,\n * but it may lack some of the newer APIs,\n * and might express the type slightly different from how TypeScript does in its `Map` type.\n *\n * @sealed @beta\n */\nexport interface FluidMap<K, V> extends FluidReadonlyMap<K, V> {\n\t/**\n\t * Removes the specified element from the map by its key.\n\t *\n\t * @remarks\n\t * Unlike the built-in `Map.delete`, this returns `void` instead of a boolean.\n\t * This is intentional: in a distributed system, the caller often cannot reliably know\n\t * whether the element existed at the time of deletion.\n\t * Subtypes may override this to return a boolean if appropriate.\n\t */\n\tdelete(key: K): void;\n\n\t/**\n\t * Executes the provided function once per each key/value pair in the map.\n\t */\n\tforEach(\n\t\tcallbackfn: (value: V, key: K, map: FluidMap<K, V>) => void,\n\t\t// Typing inherited from Map.\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\tthisArg?: any,\n\t): void;\n\n\t/**\n\t * Adds a new element with a specified key and value to the map.\n\t * If an element with the same key already exists, the element will be updated.\n\t */\n\tset(key: K, value: V): void;\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -4,11 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export type { BrandedType } from "./brandedType.js";
|
|
6
6
|
export type { IDisposable } from "./disposable.js";
|
|
7
|
+
export type { FluidIterable, FluidIterableIterator, FluidMap, FluidReadonlyMap, } from "./fluidMap.js";
|
|
7
8
|
export type { IErrorBase, IGenericError, IUsageError, IThrottlingWarning, ILayerIncompatibilityError, } from "./error.js";
|
|
8
9
|
export { FluidErrorTypes, FluidErrorTypesAlpha, } from "./error.js";
|
|
9
10
|
export type { ExtendEventProvider, IErrorEvent, IEvent, IEventProvider, IEventThisPlaceHolder, IEventTransformer, ReplaceIEventThisPlaceHolder, TransformedEvent, } from "./events.js";
|
|
10
|
-
export type { IProvideFluidLoadable
|
|
11
|
-
export { IFluidLoadable
|
|
11
|
+
export type { IProvideFluidLoadable } from "./fluidLoadable.js";
|
|
12
|
+
export { IFluidLoadable } from "./fluidLoadable.js";
|
|
12
13
|
export type { IRequest, IRequestHeader, IResponse } from "./fluidRouter.js";
|
|
13
14
|
export type { IFluidHandleErased, IFluidHandleEvents, IFluidHandleInternal, IFluidHandleInternalPayloadPending, IFluidHandlePayloadPending, ILocalFluidHandle, ILocalFluidHandleEvents, IProvideFluidHandle, IProvideFluidHandleContext, PayloadState, } from "./handles.js";
|
|
14
15
|
export { IFluidHandleContext, IFluidHandle, fluidHandleSymbol } from "./handles.js";
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,YAAY,EACX,UAAU,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,0BAA0B,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,eAAe,EACf,oBAAoB,GACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACX,mBAAmB,EACnB,WAAW,EACX,MAAM,EACN,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,4BAA4B,EAC5B,gBAAgB,GAChB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,YAAY,EACX,aAAa,EACb,qBAAqB,EACrB,QAAQ,EACR,gBAAgB,GAChB,MAAM,eAAe,CAAC;AAEvB,YAAY,EACX,UAAU,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,0BAA0B,GAC1B,MAAM,YAAY,CAAC;AACpB,OAAO,EACN,eAAe,EACf,oBAAoB,GACpB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACX,mBAAmB,EACnB,WAAW,EACX,MAAM,EACN,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,4BAA4B,EAC5B,gBAAgB,GAChB,MAAM,aAAa,CAAC;AAErB,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAKpD,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE5E,YAAY,EACX,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,EACpB,kCAAkC,EAClC,0BAA0B,EAC1B,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,0BAA0B,EAC1B,YAAY,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEpF,YAAY,EACX,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,wBAAwB,EACxB,MAAM,EACN,8BAA8B,GAC9B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,uBAAuB,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAC3F,YAAY,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACpE,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AACnE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D,YAAY,EACX,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,SAAS,EACT,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,GAAG,GACH,MAAM,mBAAmB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
export { FluidErrorTypes, FluidErrorTypesAlpha, } from "./error.js";
|
|
6
|
-
export { IFluidLoadable
|
|
6
|
+
export { IFluidLoadable } from "./fluidLoadable.js";
|
|
7
7
|
export { IFluidHandleContext, IFluidHandle, fluidHandleSymbol } from "./handles.js";
|
|
8
8
|
export { LogLevel } from "./logger.js";
|
|
9
9
|
export { ErasedTypeImplementation } from "./erasedType.js";
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,OAAO,EACN,eAAe,EACf,oBAAoB,GACpB,MAAM,YAAY,CAAC;AAcpB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAmBpD,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAUpF,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAKvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport type { BrandedType } from \"./brandedType.js\";\n\nexport type { IDisposable } from \"./disposable.js\";\n\nexport type {\n\tFluidIterable,\n\tFluidIterableIterator,\n\tFluidMap,\n\tFluidReadonlyMap,\n} from \"./fluidMap.js\";\n\nexport type {\n\tIErrorBase,\n\tIGenericError,\n\tIUsageError,\n\tIThrottlingWarning,\n\tILayerIncompatibilityError,\n} from \"./error.js\";\nexport {\n\tFluidErrorTypes,\n\tFluidErrorTypesAlpha,\n} from \"./error.js\";\n\nexport type {\n\tExtendEventProvider,\n\tIErrorEvent,\n\tIEvent,\n\tIEventProvider,\n\tIEventThisPlaceHolder,\n\tIEventTransformer,\n\tReplaceIEventThisPlaceHolder,\n\tTransformedEvent,\n} from \"./events.js\";\n\nexport type { IProvideFluidLoadable } from \"./fluidLoadable.js\";\nexport { IFluidLoadable } from \"./fluidLoadable.js\";\n\n// TypeScript forgets the index signature when customers augment IRequestHeader if we export *.\n// So we export the explicit members as a workaround:\n// https://github.com/microsoft/TypeScript/issues/18877#issuecomment-476921038\nexport type { IRequest, IRequestHeader, IResponse } from \"./fluidRouter.js\";\n\nexport type {\n\tIFluidHandleErased,\n\tIFluidHandleEvents,\n\tIFluidHandleInternal,\n\tIFluidHandleInternalPayloadPending,\n\tIFluidHandlePayloadPending,\n\tILocalFluidHandle,\n\tILocalFluidHandleEvents,\n\tIProvideFluidHandle,\n\tIProvideFluidHandleContext,\n\tPayloadState,\n} from \"./handles.js\";\nexport { IFluidHandleContext, IFluidHandle, fluidHandleSymbol } from \"./handles.js\";\n\nexport type {\n\tILoggingError,\n\tITelemetryBaseEvent,\n\tITelemetryBaseLogger,\n\tITelemetryBaseProperties,\n\tTagged,\n\tTelemetryBaseEventPropertyType,\n} from \"./logger.js\";\nexport { LogLevel } from \"./logger.js\";\nexport type { FluidObjectProviderKeys, FluidObject, FluidObjectKeys } from \"./provider.js\";\nexport type { ConfigTypes, IConfigProviderBase } from \"./config.js\";\nexport type { ISignalEnvelope, TypedMessage } from \"./messages.js\";\nexport type { ErasedType, ErasedBaseType, InstanceTypeRelaxed } from \"./erasedType.js\";\nexport { ErasedTypeImplementation } from \"./erasedType.js\";\n\nexport type {\n\tHasListeners,\n\tIEmitter,\n\tIsListener,\n\tListeners,\n\tListenable,\n\tMapGetSet,\n\tNoListenersCallback,\n\tOff,\n} from \"./events/index.js\";\n"]}
|
|
@@ -6,7 +6,7 @@ import type { InternalUtilityTypes } from "./exposedInternalUtilityTypes.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* Options for {@link JsonDeserialized}.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
9
|
+
* @public
|
|
10
10
|
*/
|
|
11
11
|
export interface JsonDeserializedOptions {
|
|
12
12
|
/**
|
|
@@ -103,7 +103,7 @@ export interface JsonDeserializedOptions {
|
|
|
103
103
|
* function foo<T>(): JsonDeserialized<T> { ... }
|
|
104
104
|
* ```
|
|
105
105
|
*
|
|
106
|
-
* @
|
|
106
|
+
* @public
|
|
107
107
|
*/
|
|
108
108
|
export type JsonDeserialized<T, Options extends JsonDeserializedOptions = {
|
|
109
109
|
AllowExactly: [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonDeserialized.js","sourceRoot":"","sources":["../src/jsonDeserialized.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { InternalUtilityTypes } from \"./exposedInternalUtilityTypes.js\";\n\n/**\n * Options for {@link JsonDeserialized}.\n *\n * @
|
|
1
|
+
{"version":3,"file":"jsonDeserialized.js","sourceRoot":"","sources":["../src/jsonDeserialized.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { InternalUtilityTypes } from \"./exposedInternalUtilityTypes.js\";\n\n/**\n * Options for {@link JsonDeserialized}.\n *\n * @public\n */\nexport interface JsonDeserializedOptions {\n\t/**\n\t * Tuple of exact types that are managed by custom deserialization logic (beyond\n\t * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse|JSON.parse}\n\t * without a reviver). Only exact types matching specification will be\n\t * preserved unaltered.\n\t *\n\t * The default value is `[]`.\n\t */\n\tAllowExactly?: unknown[];\n\n\t/**\n\t * General types that are managed by custom deserialization logic (beyond\n\t * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse|JSON.parse}\n\t * without a reviver). Any type satisfying specification will be preserved\n\t * unaltered.\n\t *\n\t * The default value is `never`.\n\t */\n\tAllowExtensionOf?: unknown;\n}\n\n/**\n * Produces a type that results from a type `T` serialized and deserialized\n * through JSON using {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}\n * (without replacer) and {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse|JSON.parse}\n * (without reviver), respectively as base model.\n *\n * @typeParam T - The type that was serialized.\n * @typeParam Options - Options for the filter. See {@link JsonDeserializedOptions}.\n *\n * @remarks\n * Before adding use of this utility type, consider using a utility like\n * {@link https://github.com/sinclairzx81/typebox#readme | TypeBox} that allows\n * for runtime validation.\n *\n * This filter can be used to derive the expected type of a JSON deserialized\n * value whether or not the type of value serialized meets serialization\n * constraints (see {@link JsonSerializable} including serialization pitfalls).\n *\n * When used as a filter to inferred generic `T`, a compile-time error can be\n * produced trying to assign `JsonDeserialized<T>` to `T`.\n *\n * Simply deserialized JSON never contains `bigint`, `undefined`, `symbol`,\n * or function values. (Object properties which had those types before encoding\n * are omitted during serialization and thus won't be present after\n * deserialization.) Therefore, through this filter, such properties:\n *\n * - become optional with those types excluded (when there are other supported\n * types in union)\n *\n * - are removed (when nothing else in union is supported)\n *\n * - in an array are (1) replaced with `null` if `undefined`, `symbol`, and\n * function values or (2) simply removed (become `never`) if `bigint` value as\n * serialization attempts will throw.\n *\n * Examples results:\n *\n * | Before serialization | After deserialization | After in record | After in array |\n * | --------------------- | --------------------- | ------------------ | --------------------:|\n * | `undefined \\| number` | `number` | `prop?: number` | `(number \\| null)[]` |\n * | `symbol \\| number` | `number` | `prop?: number` | `(number \\| null)[]` |\n * | `bigint \\| number` | `number` | `prop: number` | `number[]` |\n * | `undefined` | N/A `never` | (prop not present) | `null[]` |\n * | `symbol` | N/A `never` | (prop not present) | `null[]` |\n * | `bigint` | N/A `never` | N/A (prop not present) | N/A `never[]` |\n * | `bigint \\| symbol` | N/A `never` | (prop not present) | `null[]` |\n * | `bigint \\| number \\| symbol` | `number` | `prop?: number` | `(number \\| null)[]` |\n *\n * Setter and getter properties become value properties after filtering\n * although no data will be persisted assuming those properties are backed\n * by functions. If an implementation of getter/setter interface uses a\n * simple data member (of supported type), that will persist.\n *\n * Recursive types without any required modification are preserved intact.\n * Recursive types that require modification are unrolled a limited number of\n * times (currently 4) and then further instances of recursion are replaced with\n * {@link JsonTypeWith|JsonTypeWith<Options.AllowExactly[number] \"or\" Options.AllowExtensionOf>}.\n *\n * Under basic serialization, class instances become simple data objects that\n * lose hidden properties and prototypes that are required for `instanceof`\n * runtime checks. An exception is made for classes that are intersected with\n * primitive types (specifically `boolean`, `string`, and `number`) under the\n * assumption that such classes are present only as type modifiers (as would\n * be the case for branding) and not as require runtime values.\n *\n * The optional 'Options.AllowExactly' and 'Options.AllowExtensionOf'\n * parameters may be used to permit additional leaf types handled by custom\n * serialization/deserialization logic.\n *\n * @example Example usage\n *\n * ```typescript\n * function foo<T>(): JsonDeserialized<T> { ... }\n * ```\n *\n * @public\n */\nexport type JsonDeserialized<\n\tT,\n\tOptions extends JsonDeserializedOptions = {\n\t\tAllowExactly: [];\n\t\tAllowExtensionOf: never;\n\t},\n> = InternalUtilityTypes.JsonDeserializedImpl<T, Options>;\n"]}
|
|
@@ -6,7 +6,7 @@ import type { InternalUtilityTypes } from "./exposedInternalUtilityTypes.js";
|
|
|
6
6
|
/**
|
|
7
7
|
* Options for {@link JsonSerializable}.
|
|
8
8
|
*
|
|
9
|
-
* @
|
|
9
|
+
* @public
|
|
10
10
|
*/
|
|
11
11
|
export interface JsonSerializableOptions {
|
|
12
12
|
/**
|
|
@@ -125,7 +125,7 @@ export interface JsonSerializableOptions {
|
|
|
125
125
|
* proper use, that will never be an issue as any filtering of types will happen
|
|
126
126
|
* before T recursion.
|
|
127
127
|
*
|
|
128
|
-
* @
|
|
128
|
+
* @public
|
|
129
129
|
*/
|
|
130
130
|
export type JsonSerializable<T, Options extends JsonSerializableOptions = {
|
|
131
131
|
AllowExactly: [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSerializable.js","sourceRoot":"","sources":["../src/jsonSerializable.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { InternalUtilityTypes } from \"./exposedInternalUtilityTypes.js\";\n\n/**\n * Options for {@link JsonSerializable}.\n *\n * @
|
|
1
|
+
{"version":3,"file":"jsonSerializable.js","sourceRoot":"","sources":["../src/jsonSerializable.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { InternalUtilityTypes } from \"./exposedInternalUtilityTypes.js\";\n\n/**\n * Options for {@link JsonSerializable}.\n *\n * @public\n */\nexport interface JsonSerializableOptions {\n\t/**\n\t * Tuple of exact types that are managed by custom serialization logic (beyond\n\t * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}\n\t * without a replacer). Only exact types matching specification will be\n\t * preserved unaltered.\n\t *\n\t * The default value is `[]`.\n\t */\n\tAllowExactly?: unknown[];\n\n\t/**\n\t * General types that are managed by custom serialization logic (beyond\n\t * {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}\n\t * without a replacer). Any type satisfying specification will be preserved\n\t * unaltered.\n\t *\n\t * The default value is `never`.\n\t */\n\tAllowExtensionOf?: unknown;\n\n\t/**\n\t * When set, inaccessible (protected and private) members throughout type T are\n\t * ignored as if not present. Otherwise, inaccessible members are considered\n\t * an error (type checking will mention `SerializationErrorPerNonPublicProperties`).\n\t *\n\t * @remarks\n\t * For this option to be set and accurately filter inaccessible members, all\n\t * inaccessible members (if any) must be either inherited, symbol keyed, or\n\t * non-enumerable.\n\t *\n\t * The default is that `IgnoreInaccessibleMembers` property is not specified,\n\t * which means that inaccessible members are considered an error, even if\n\t * they would not be serialized at runtime.\n\t */\n\tIgnoreInaccessibleMembers?: \"ignore-inaccessible-members\";\n}\n\n/**\n * Used to constrain a type `T` to types that are serializable as JSON\n * using {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}\n * (without a replacer) as base model.\n *\n * Under typical use a compile-time error is produced if `T` contains\n * non-JsonSerializable members.\n *\n * @typeParam T - The type to be constrained.\n * @typeParam Options - Options for the filter. See {@link JsonSerializableOptions}.\n *\n * @remarks\n * Before adding use of this utility type, consider using a utility like\n * {@link https://github.com/sinclairzx81/typebox#readme | TypeBox} that allows\n * for runtime validation.\n *\n * Note that this does NOT prevent use of values with non-JSON compatible data,\n * it only prevents using values with types that include non-JSON compatible data.\n * This means that one can, for example, pass in a value typed with JSON compatible\n * interface into this filter, that could actually be a class with lots on non-JSON\n * compatible fields and methods.\n *\n * Important: `T extends JsonSerializable<T>` is incorrect (does not even compile).\n *\n * The optional `Options.Allow*` parameters may be used to permit additional leaf types\n * to support situations where a `replacer` is used to handle special values (e.g.,\n * `JsonSerializable<{ x: IFluidHandle }, { AllowExtensionOf: IFluidHandle }>`).\n *\n * Note that `JsonSerializable<T>` does not protect against the following pitfalls\n * when serializing with JSON.stringify():\n *\n * - Non-finite numbers (`NaN`, `+/-Infinity`) are coerced to `null`.\n *\n * - Prototypes and non-enumerable properties are lost.\n *\n * - `ArrayLike` types that are not arrays and are serialized as `{ length: number }`.\n *\n * - Getter and setters properties are lost. (Though appear supported.)\n *\n * - Functions with properties may be absent or the properties may be preserved\n * depending on the runtime typo of the value. (If built via Object.assign the\n * target member's type is preserved.) typeof =\\> 'function' is lost whereas when\n * typeof =\\> 'object' the properties are preserved.\n *\n * - Sparse arrays are filled with `null`.\n *\n * Also, `JsonSerializable<T>` does not prevent the construction of circular references.\n *\n * Specifying `JsonSerializable<unknown>` or `JsonSerializable<any>` yields a type\n * alias for {@link JsonTypeWith}`<never>` | {@link OpaqueJsonSerializable}`<unknown>`\n * and should not be used if precise type safety is desired.\n *\n * Class instances are indistinguishable from general objects by type checking\n * unless they have non-public members.\n *\n * - Unless `Option.IgnoreInaccessibleMembers` is used, types with non-public\n * members will result in {@link SerializationErrorPerNonPublicProperties}.\n * When `Option.IgnoreInaccessibleMembers` is `ignore-inaccessible-members`,\n * non-public (non-function) members are preserved without error, but they are\n * filtered away by the type filters and thus produce an incorrectly narrowed\n * type compared to actual data. Though such a result may be customer desired.\n *\n * - An exception is made for classes that are intersected with primitives\n * (specifically `boolean`, `number`, * and `string`). In these cases, it is\n * assumed that the class only exists as a type modifier and not as a value\n * at runtime, and thus the class is permitted as no serialization is required.\n *\n * Perhaps a https://github.com/microsoft/TypeScript/issues/22677 fix will\n * enable better support.\n *\n * @example Typical usage\n *\n * ```typescript\n * function foo<T>(value: JsonSerializable<T>) { ... }\n * ```\n *\n * @privateRemarks\n * Upon recursion, the original type T is preserved intact. This is done to prevent\n * infinite recursion and produces a technically incorrect result type. However, with\n * proper use, that will never be an issue as any filtering of types will happen\n * before T recursion.\n *\n * @public\n */\nexport type JsonSerializable<\n\tT,\n\tOptions extends JsonSerializableOptions = {\n\t\tAllowExactly: [];\n\t\tAllowExtensionOf: never;\n\t},\n> = InternalUtilityTypes.JsonSerializableImpl<T, Options>;\n"]}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @privateRemarks type is used over interface; so inspection of type
|
|
10
10
|
* result can be more informative than just the type name.
|
|
11
11
|
*
|
|
12
|
-
* @
|
|
12
|
+
* @public
|
|
13
13
|
* @system
|
|
14
14
|
*/
|
|
15
15
|
export type SerializationErrorPerUndefinedArrayElement = {
|
|
@@ -22,7 +22,7 @@ export type SerializationErrorPerUndefinedArrayElement = {
|
|
|
22
22
|
* @privateRemarks type is used over interface; so inspection of type
|
|
23
23
|
* result can be more informative than just the type name.
|
|
24
24
|
*
|
|
25
|
-
* @
|
|
25
|
+
* @public
|
|
26
26
|
* @system
|
|
27
27
|
*/
|
|
28
28
|
export type SerializationErrorPerNonPublicProperties = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSerializationErrors.js","sourceRoot":"","sources":["../src/jsonSerializationErrors.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 * Type resulting from {@link JsonSerializable} use given an array with\n * `undefined` elements.\n *\n * @privateRemarks type is used over interface; so inspection of type\n * result can be more informative than just the type name.\n *\n * @
|
|
1
|
+
{"version":3,"file":"jsonSerializationErrors.js","sourceRoot":"","sources":["../src/jsonSerializationErrors.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 * Type resulting from {@link JsonSerializable} use given an array with\n * `undefined` elements.\n *\n * @privateRemarks type is used over interface; so inspection of type\n * result can be more informative than just the type name.\n *\n * @public\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type SerializationErrorPerUndefinedArrayElement = {\n\t\"array serialization error\": \"undefined elements are not supported\";\n};\n\n/**\n * Type resulting from {@link JsonSerializable} use given a class with\n * non-public properties.\n *\n * @privateRemarks type is used over interface; so inspection of type\n * result can be more informative than just the type name.\n *\n * @public\n * @system\n */\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type SerializationErrorPerNonPublicProperties = {\n\t\"object serialization error\": \"non-public properties are not supported\";\n};\n"]}
|
package/lib/jsonType.d.ts
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* Prefer using `JsonSerializable<unknown>` or `JsonDeserialized<unknown>` over this type that
|
|
15
15
|
* is an implementation detail.
|
|
16
16
|
*
|
|
17
|
-
* @
|
|
17
|
+
* @public
|
|
18
18
|
*/
|
|
19
19
|
export type JsonTypeWith<T> = null | boolean | number | string | T | {
|
|
20
20
|
[key: string | number]: JsonTypeWith<T>;
|
|
@@ -22,7 +22,7 @@ export type JsonTypeWith<T> = null | boolean | number | string | T | {
|
|
|
22
22
|
/**
|
|
23
23
|
* Portion of {@link JsonTypeWith} that is an object (including array) and not null.
|
|
24
24
|
*
|
|
25
|
-
* @
|
|
25
|
+
* @public
|
|
26
26
|
*/
|
|
27
27
|
export type NonNullJsonObjectWith<T> = {
|
|
28
28
|
[key: string | number]: JsonTypeWith<T>;
|
|
@@ -42,7 +42,7 @@ export type NonNullJsonObjectWith<T> = {
|
|
|
42
42
|
* ```
|
|
43
43
|
* does not prevent later `x = 5`. (Does prevent `x.a = 2`.)
|
|
44
44
|
*
|
|
45
|
-
* @
|
|
45
|
+
* @public
|
|
46
46
|
*/
|
|
47
47
|
export type ReadonlyJsonTypeWith<TReadonlyAlternates> = null | boolean | number | string | TReadonlyAlternates | {
|
|
48
48
|
readonly [key: string | number]: ReadonlyJsonTypeWith<TReadonlyAlternates>;
|
package/lib/jsonType.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jsonType.js","sourceRoot":"","sources":["../src/jsonType.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 * Type constraint for types that are likely encodable as JSON, deserializable from JSON,\n * or have a custom alternate type.\n *\n * @remarks\n * Use `JsonTypeWith<never>` for just JSON encodable/deserializable types.\n * See {@link JsonSerializable} for encoding pitfalls.\n *\n * @privateRemarks\n * Prefer using `JsonSerializable<unknown>` or `JsonDeserialized<unknown>` over this type that\n * is an implementation detail.\n *\n * @
|
|
1
|
+
{"version":3,"file":"jsonType.js","sourceRoot":"","sources":["../src/jsonType.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 * Type constraint for types that are likely encodable as JSON, deserializable from JSON,\n * or have a custom alternate type.\n *\n * @remarks\n * Use `JsonTypeWith<never>` for just JSON encodable/deserializable types.\n * See {@link JsonSerializable} for encoding pitfalls.\n *\n * @privateRemarks\n * Prefer using `JsonSerializable<unknown>` or `JsonDeserialized<unknown>` over this type that\n * is an implementation detail.\n *\n * @public\n */\nexport type JsonTypeWith<T> =\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| boolean\n\t| number\n\t| string\n\t| T\n\t| { [key: string | number]: JsonTypeWith<T> }\n\t| JsonTypeWith<T>[];\n\n/**\n * Portion of {@link JsonTypeWith} that is an object (including array) and not null.\n *\n * @public\n */\nexport type NonNullJsonObjectWith<T> =\n\t| { [key: string | number]: JsonTypeWith<T> }\n\t| JsonTypeWith<T>[];\n\n/**\n * Deeply immutable type that is encodable as JSON and deserializable from JSON.\n *\n * @typeParam TReadonlyAlternates - Additional [immutable] types that are supported.\n *\n * @remarks\n * If `TReadonlyAlternates` is allowed as-is. So if it is not immutable, then result type\n * is not wholly immutable.\n *\n * A `const` variable is still required to avoid top-level mutability. I.e.\n * ```typescript\n * let x: ReadonlyJsonTypeWith<never> = { a: 1 };\n * ```\n * does not prevent later `x = 5`. (Does prevent `x.a = 2`.)\n *\n * @public\n */\nexport type ReadonlyJsonTypeWith<TReadonlyAlternates> =\n\t// eslint-disable-next-line @rushstack/no-new-null\n\t| null\n\t| boolean\n\t| number\n\t| string\n\t| TReadonlyAlternates\n\t| { readonly [key: string | number]: ReadonlyJsonTypeWith<TReadonlyAlternates> }\n\t| readonly ReadonlyJsonTypeWith<TReadonlyAlternates>[];\n\n/**\n * Portion of {@link ReadonlyJsonTypeWith} that is an object (including array) and not null.\n *\n * @internal\n */\nexport type ReadonlyNonNullJsonObjectWith<TReadonlyAlternates> =\n\t| { readonly [key: string | number]: ReadonlyJsonTypeWith<TReadonlyAlternates> }\n\t| readonly ReadonlyJsonTypeWith<TReadonlyAlternates>[];\n"]}
|
package/lib/legacy.alpha.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
export {
|
|
12
12
|
// #region @public APIs
|
|
13
|
+
BrandedType,
|
|
13
14
|
ConfigTypes,
|
|
14
15
|
ErasedType,
|
|
15
16
|
ExtendEventProvider,
|
|
@@ -47,8 +48,11 @@ export {
|
|
|
47
48
|
// #endregion
|
|
48
49
|
|
|
49
50
|
// #region @beta APIs
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
ErasedBaseType,
|
|
52
|
+
FluidIterable,
|
|
53
|
+
FluidIterableIterator,
|
|
54
|
+
FluidMap,
|
|
55
|
+
FluidReadonlyMap,
|
|
52
56
|
// #endregion
|
|
53
57
|
|
|
54
58
|
// #region @legacyBeta APIs
|
package/lib/legacy.d.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
export {
|
|
12
12
|
// #region @public APIs
|
|
13
|
+
BrandedType,
|
|
13
14
|
ConfigTypes,
|
|
14
15
|
ErasedType,
|
|
15
16
|
ExtendEventProvider,
|
|
@@ -47,8 +48,11 @@ export {
|
|
|
47
48
|
// #endregion
|
|
48
49
|
|
|
49
50
|
// #region @beta APIs
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
ErasedBaseType,
|
|
52
|
+
FluidIterable,
|
|
53
|
+
FluidIterableIterator,
|
|
54
|
+
FluidMap,
|
|
55
|
+
FluidReadonlyMap,
|
|
52
56
|
// #endregion
|
|
53
57
|
|
|
54
58
|
// #region @legacyBeta APIs
|
package/lib/opaqueJson.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import { BrandedType } from "./brandedType.js";
|
|
|
17
17
|
* be read.
|
|
18
18
|
*
|
|
19
19
|
* @sealed
|
|
20
|
-
* @
|
|
20
|
+
* @public
|
|
21
21
|
*/
|
|
22
22
|
export declare class OpaqueJsonDeserialized<T, in out Option_AllowExactly extends unknown[] = [], out Option_AllowExtensionOf = never> extends BrandedType<"JsonDeserialized"> {
|
|
23
23
|
protected readonly JsonDeserialized: {
|
|
@@ -44,7 +44,7 @@ export declare class OpaqueJsonDeserialized<T, in out Option_AllowExactly extend
|
|
|
44
44
|
* when "instance" will be forwarded along.
|
|
45
45
|
*
|
|
46
46
|
* @sealed
|
|
47
|
-
* @
|
|
47
|
+
* @public
|
|
48
48
|
*/
|
|
49
49
|
export declare class OpaqueJsonSerializable<T, in out Option_AllowExactly extends unknown[] = [], out Option_AllowExtensionOf = never> extends BrandedType<"JsonSerializable"> {
|
|
50
50
|
protected readonly JsonSerializable: {
|
package/lib/opaqueJson.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opaqueJson.js","sourceRoot":"","sources":["../src/opaqueJson.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BrandedType } from \"./brandedType.js\";\n\n/**\n * Placeholder for value that is known to be JSON because it has been\n * deserialized (`T` filtered through {@link JsonDeserialized} as out value).\n *\n * @remarks\n * Usage:\n *\n * - Cast to with `as unknown as OpaqueJsonDeserialized<T>` when value `T`\n * has been filtered through {@link JsonDeserialized}.\n *\n * - Cast from with `as unknown as JsonDeserialized<T>` when \"instance\" will\n * be read.\n *\n * @sealed\n * @
|
|
1
|
+
{"version":3,"file":"opaqueJson.js","sourceRoot":"","sources":["../src/opaqueJson.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { BrandedType } from \"./brandedType.js\";\n\n/**\n * Placeholder for value that is known to be JSON because it has been\n * deserialized (`T` filtered through {@link JsonDeserialized} as out value).\n *\n * @remarks\n * Usage:\n *\n * - Cast to with `as unknown as OpaqueJsonDeserialized<T>` when value `T`\n * has been filtered through {@link JsonDeserialized}.\n *\n * - Cast from with `as unknown as JsonDeserialized<T>` when \"instance\" will\n * be read.\n *\n * @sealed\n * @public\n */\nexport declare class OpaqueJsonDeserialized<\n\tT,\n\t// These options are split from typical `JsonDeserializedOptions` as this type\n\t// requires correct variance per the two options and AllowExactly has special\n\t// variance and must be treated as invariant. In actuality, each member of the\n\t// AllowExactly tuple is invariant, but tuple as a set is covariant. This is not\n\t// expressible in TypeScript.\n\tin out Option_AllowExactly extends unknown[] = [],\n\tout Option_AllowExtensionOf = never,\n> extends BrandedType<\"JsonDeserialized\"> {\n\tprotected readonly JsonDeserialized: {\n\t\tType: T;\n\t\tOptions: {\n\t\t\tAllowExactly: Option_AllowExactly;\n\t\t\tAllowExtensionOf: Option_AllowExtensionOf;\n\t\t};\n\t};\n\t// Option_AllowExactly is covariant from above. This removes covariance, leaving only invariance.\n\tprotected readonly Option_AllowExactly_Invariance: (\n\t\tOption_AllowExactly: Option_AllowExactly,\n\t) => void;\n\tprivate constructor();\n}\n\n/**\n * Placeholder for value that is known to be JSON because it will have been\n * serialized checked (`T` filtered through {@link JsonSerializable} before \"created\").\n *\n * @remarks\n * Usage:\n *\n * - Cast to with `as unknown as OpaqueJsonSerializable<T>` when value `T`\n * has been filtered through {@link JsonSerializable}.\n *\n * - Cast from with `as unknown as JsonSerializable<T>` or `as unknown as T`\n * when \"instance\" will be forwarded along.\n *\n * @sealed\n * @public\n */\nexport declare class OpaqueJsonSerializable<\n\tT,\n\t// These options are split from typical `JsonSerializableOptions` as this type\n\t// requires correct variance per the two options and AllowExactly has special\n\t// variance and must be treated as invariant. In actuality, each member of the\n\t// AllowExactly tuple is invariant, but tuple as a set is covariant. This is not\n\t// expressible in TypeScript.\n\tin out Option_AllowExactly extends unknown[] = [],\n\tout Option_AllowExtensionOf = never,\n\t// JsonSerializableOptions.IgnoreInaccessibleMembers is ignored\n> extends BrandedType<\"JsonSerializable\"> {\n\tprotected readonly JsonSerializable: {\n\t\tType: T;\n\t\tOptions: {\n\t\t\tAllowExactly: Option_AllowExactly;\n\t\t\tAllowExtensionOf: Option_AllowExtensionOf;\n\t\t};\n\t};\n\t// Option_AllowExactly is covariant from above. This removes covariance, leaving only invariance.\n\tprotected readonly Option_AllowExactly_Invariance: (\n\t\tOption_AllowExactly: Option_AllowExactly,\n\t) => void;\n\tprivate constructor();\n}\n"]}
|
package/lib/public.d.ts
CHANGED
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/core-interfaces",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.93.0",
|
|
4
4
|
"description": "Fluid object interfaces",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -86,11 +86,11 @@
|
|
|
86
86
|
"@fluid-tools/build-cli": "^0.64.0",
|
|
87
87
|
"@fluidframework/build-common": "^2.0.3",
|
|
88
88
|
"@fluidframework/build-tools": "^0.64.0",
|
|
89
|
-
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.
|
|
89
|
+
"@fluidframework/core-interfaces-previous": "npm:@fluidframework/core-interfaces@2.92.0",
|
|
90
90
|
"@fluidframework/eslint-config-fluid": "^9.0.0",
|
|
91
|
-
"@microsoft/api-extractor": "7.
|
|
91
|
+
"@microsoft/api-extractor": "7.58.1",
|
|
92
92
|
"@types/mocha": "^10.0.10",
|
|
93
|
-
"@types/node": "~
|
|
93
|
+
"@types/node": "~22.19.17",
|
|
94
94
|
"c8": "^10.1.3",
|
|
95
95
|
"concurrently": "^9.2.1",
|
|
96
96
|
"copyfiles": "^2.4.1",
|
|
@@ -161,7 +161,6 @@
|
|
|
161
161
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
162
162
|
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && npm run place:cjs:package-stub",
|
|
163
163
|
"tsc:watch": "npm run place:cjs:package-stub && fluid-tsc commonjs --project ./tsconfig.cjs.json --watch",
|
|
164
|
-
"typetests:gen": "flub generate typetests --dir . -v"
|
|
165
|
-
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
|
|
164
|
+
"typetests:gen": "flub generate typetests --dir . -v"
|
|
166
165
|
}
|
|
167
166
|
}
|
package/src/brandedType.ts
CHANGED
|
@@ -36,6 +36,19 @@
|
|
|
36
36
|
*
|
|
37
37
|
* This class should never exist at runtime, so it is only declared.
|
|
38
38
|
*
|
|
39
|
+
* As this is a class and not just an interface, to match derived types, the
|
|
40
|
+
* declarations for any two derivatives must come from the same source - the
|
|
41
|
+
* same package version. If a type must cross package boundaries, as may be the
|
|
42
|
+
* case for cross layer types, the derived type should pick a specific version
|
|
43
|
+
* of core-interfaces to import BrandedType from. Exact versions are best, but
|
|
44
|
+
* as security best practice, use ~ specification. Consumers are expected to
|
|
45
|
+
* use a package manager that will produce consistency over minor patches.
|
|
46
|
+
* A change in version should be considered a breaking change.
|
|
47
|
+
*
|
|
48
|
+
* In the preferred derived class pattern, the derived class is subject to the
|
|
49
|
+
* same identity rules and might benefit from being in a type-only `-definitions`
|
|
50
|
+
* package. See {@link ErasedType} example comments for version stable patterns.
|
|
51
|
+
*
|
|
39
52
|
* @example
|
|
40
53
|
* Definition of two branded types with different variance:
|
|
41
54
|
* ```typescript
|
|
@@ -69,7 +82,7 @@
|
|
|
69
82
|
* }
|
|
70
83
|
* ```
|
|
71
84
|
*
|
|
72
|
-
* @
|
|
85
|
+
* @public
|
|
73
86
|
*/
|
|
74
87
|
export declare class BrandedType<out Brand> {
|
|
75
88
|
/**
|
package/src/deepReadonly.ts
CHANGED
|
@@ -16,7 +16,7 @@ import type {
|
|
|
16
16
|
* @privateRemarks
|
|
17
17
|
* WeakRef should be added when lib is updated to ES2021 or later.
|
|
18
18
|
*
|
|
19
|
-
* @
|
|
19
|
+
* @public
|
|
20
20
|
* @system
|
|
21
21
|
*/
|
|
22
22
|
export type DeepReadonlySupportedGenericsDefault =
|
|
@@ -29,7 +29,7 @@ export type DeepReadonlySupportedGenericsDefault =
|
|
|
29
29
|
/**
|
|
30
30
|
* Options for {@link DeepReadonly}.
|
|
31
31
|
*
|
|
32
|
-
* @
|
|
32
|
+
* @public
|
|
33
33
|
*/
|
|
34
34
|
export interface DeepReadonlyOptions {
|
|
35
35
|
/**
|
|
@@ -58,7 +58,7 @@ export interface DeepReadonlyOptions {
|
|
|
58
58
|
* {@link DeepReadonlySupportedGenericsDefault} for generics that have
|
|
59
59
|
* immutability applied to generic type by default.
|
|
60
60
|
*
|
|
61
|
-
* @
|
|
61
|
+
* @public
|
|
62
62
|
*/
|
|
63
63
|
export type DeepReadonly<
|
|
64
64
|
T,
|