@fluidframework/presence 2.23.0 → 2.30.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/dist/container-definitions/containerExtensions.d.ts +1 -1
- package/dist/container-definitions/containerExtensions.d.ts.map +1 -1
- package/dist/container-definitions/containerExtensions.js.map +1 -1
- package/dist/exposedInternalTypes.d.ts +1 -1
- package/dist/exposedInternalTypes.d.ts.map +1 -1
- package/dist/exposedInternalTypes.js.map +1 -1
- package/dist/exposedUtilityTypes.d.ts +1 -1
- package/dist/exposedUtilityTypes.d.ts.map +1 -1
- package/dist/exposedUtilityTypes.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/latestMapValueManager.d.ts +1 -1
- package/dist/latestMapValueManager.d.ts.map +1 -1
- package/dist/latestMapValueManager.js.map +1 -1
- package/dist/latestValueManager.d.ts +1 -1
- package/dist/latestValueManager.d.ts.map +1 -1
- package/dist/latestValueManager.js.map +1 -1
- package/dist/latestValueTypes.d.ts +1 -1
- package/dist/latestValueTypes.d.ts.map +1 -1
- package/dist/latestValueTypes.js.map +1 -1
- package/dist/notificationsManager.d.ts.map +1 -1
- package/dist/notificationsManager.js.map +1 -1
- package/dist/package.json +0 -1
- package/lib/container-definitions/containerExtensions.d.ts +1 -1
- package/lib/container-definitions/containerExtensions.d.ts.map +1 -1
- package/lib/container-definitions/containerExtensions.js.map +1 -1
- package/lib/exposedInternalTypes.d.ts +1 -1
- package/lib/exposedInternalTypes.d.ts.map +1 -1
- package/lib/exposedInternalTypes.js.map +1 -1
- package/lib/exposedUtilityTypes.d.ts +1 -1
- package/lib/exposedUtilityTypes.d.ts.map +1 -1
- package/lib/exposedUtilityTypes.js.map +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/latestMapValueManager.d.ts +1 -1
- package/lib/latestMapValueManager.d.ts.map +1 -1
- package/lib/latestMapValueManager.js.map +1 -1
- package/lib/latestValueManager.d.ts +1 -1
- package/lib/latestValueManager.d.ts.map +1 -1
- package/lib/latestValueManager.js.map +1 -1
- package/lib/latestValueTypes.d.ts +1 -1
- package/lib/latestValueTypes.d.ts.map +1 -1
- package/lib/latestValueTypes.js.map +1 -1
- package/lib/notificationsManager.d.ts.map +1 -1
- package/lib/notificationsManager.js.map +1 -1
- package/package.json +20 -28
- package/dist/core-interfaces/exposedUtilityTypes.d.ts +0 -446
- package/dist/core-interfaces/exposedUtilityTypes.d.ts.map +0 -1
- package/dist/core-interfaces/exposedUtilityTypes.js +0 -11
- package/dist/core-interfaces/exposedUtilityTypes.js.map +0 -1
- package/dist/core-interfaces/index.d.ts +0 -10
- package/dist/core-interfaces/index.d.ts.map +0 -1
- package/dist/core-interfaces/index.js +0 -7
- package/dist/core-interfaces/index.js.map +0 -1
- package/dist/core-interfaces/jsonDeserialized.d.ts +0 -109
- package/dist/core-interfaces/jsonDeserialized.d.ts.map +0 -1
- package/dist/core-interfaces/jsonDeserialized.js +0 -7
- package/dist/core-interfaces/jsonDeserialized.js.map +0 -1
- package/dist/core-interfaces/jsonSerializable.d.ts +0 -120
- package/dist/core-interfaces/jsonSerializable.d.ts.map +0 -1
- package/dist/core-interfaces/jsonSerializable.js +0 -7
- package/dist/core-interfaces/jsonSerializable.js.map +0 -1
- package/dist/core-interfaces/jsonSerializationErrors.d.ts +0 -31
- package/dist/core-interfaces/jsonSerializationErrors.d.ts.map +0 -1
- package/dist/core-interfaces/jsonSerializationErrors.js +0 -7
- package/dist/core-interfaces/jsonSerializationErrors.js.map +0 -1
- package/dist/core-interfaces/jsonType.d.ts +0 -29
- package/dist/core-interfaces/jsonType.d.ts.map +0 -1
- package/dist/core-interfaces/jsonType.js +0 -7
- package/dist/core-interfaces/jsonType.js.map +0 -1
- package/lib/core-interfaces/exposedUtilityTypes.d.ts +0 -446
- package/lib/core-interfaces/exposedUtilityTypes.d.ts.map +0 -1
- package/lib/core-interfaces/exposedUtilityTypes.js +0 -10
- package/lib/core-interfaces/exposedUtilityTypes.js.map +0 -1
- package/lib/core-interfaces/index.d.ts +0 -10
- package/lib/core-interfaces/index.d.ts.map +0 -1
- package/lib/core-interfaces/index.js +0 -6
- package/lib/core-interfaces/index.js.map +0 -1
- package/lib/core-interfaces/jsonDeserialized.d.ts +0 -109
- package/lib/core-interfaces/jsonDeserialized.d.ts.map +0 -1
- package/lib/core-interfaces/jsonDeserialized.js +0 -6
- package/lib/core-interfaces/jsonDeserialized.js.map +0 -1
- package/lib/core-interfaces/jsonSerializable.d.ts +0 -120
- package/lib/core-interfaces/jsonSerializable.d.ts.map +0 -1
- package/lib/core-interfaces/jsonSerializable.js +0 -6
- package/lib/core-interfaces/jsonSerializable.js.map +0 -1
- package/lib/core-interfaces/jsonSerializationErrors.d.ts +0 -31
- package/lib/core-interfaces/jsonSerializationErrors.d.ts.map +0 -1
- package/lib/core-interfaces/jsonSerializationErrors.js +0 -6
- package/lib/core-interfaces/jsonSerializationErrors.js.map +0 -1
- package/lib/core-interfaces/jsonType.d.ts +0 -29
- package/lib/core-interfaces/jsonType.d.ts.map +0 -1
- package/lib/core-interfaces/jsonType.js +0 -6
- package/lib/core-interfaces/jsonType.js.map +0 -1
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { InternalUtilityTypes } from "./exposedUtilityTypes.js";
|
|
6
|
-
/**
|
|
7
|
-
* Options for {@link JsonDeserialized}.
|
|
8
|
-
*
|
|
9
|
-
* @alpha
|
|
10
|
-
*/
|
|
11
|
-
export interface JsonDeserializedOptions {
|
|
12
|
-
/**
|
|
13
|
-
* Exact types that are managed by custom deserialization logic (beyond
|
|
14
|
-
* {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse|JSON.parse}
|
|
15
|
-
* without a reviver). Only exact types matching specification will be
|
|
16
|
-
* preserved unaltered.
|
|
17
|
-
*
|
|
18
|
-
* The default value is `never`.
|
|
19
|
-
*/
|
|
20
|
-
AllowExactly?: unknown;
|
|
21
|
-
/**
|
|
22
|
-
* General types that are managed by custom deserialization logic (beyond
|
|
23
|
-
* {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse|JSON.parse}
|
|
24
|
-
* without a reviver). Any type satisfying specification will be preserved
|
|
25
|
-
* unaltered.
|
|
26
|
-
*
|
|
27
|
-
* The default value is `never`.
|
|
28
|
-
*/
|
|
29
|
-
AllowExtensionOf?: unknown;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Produces a type that results from a type `T` serialized and deserialized
|
|
33
|
-
* through JSON using {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}
|
|
34
|
-
* (without replacer) and {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse|JSON.parse}
|
|
35
|
-
* (without reviver), respectively as base model.
|
|
36
|
-
*
|
|
37
|
-
* @typeParam T - The type that was serialized.
|
|
38
|
-
* @typeParam Options - Options for the filter. See {@link JsonDeserializedOptions}.
|
|
39
|
-
*
|
|
40
|
-
* @remarks
|
|
41
|
-
* Before adding use of this utility type, consider using a utility like
|
|
42
|
-
* {@link https://github.com/sinclairzx81/typebox#readme | TypeBox} that allows
|
|
43
|
-
* for runtime validation.
|
|
44
|
-
*
|
|
45
|
-
* This filter can be used to derive the expected type of a JSON deserialized
|
|
46
|
-
* value whether or not the type of value serialized meets serialization
|
|
47
|
-
* constraints (see {@link JsonSerializable} including serialization pitfalls).
|
|
48
|
-
*
|
|
49
|
-
* When used as a filter to inferred generic `T`, a compile-time error can be
|
|
50
|
-
* produced trying to assign `JsonDeserialized<T>` to `T`.
|
|
51
|
-
*
|
|
52
|
-
* Simply deserialized JSON never contains `bigint`, `undefined`, `symbol`,
|
|
53
|
-
* or function values. (Object properties which had those types before encoding
|
|
54
|
-
* are omitted during serialization and thus won't be present after
|
|
55
|
-
* deserialization.) Therefore, through this filter, such properties:
|
|
56
|
-
*
|
|
57
|
-
* - become optional with those types excluded (when there are other supported
|
|
58
|
-
* types in union)
|
|
59
|
-
*
|
|
60
|
-
* - are removed (when nothing else in union is supported)
|
|
61
|
-
*
|
|
62
|
-
* - in an array are (1) replaced with `null` if `undefined`, `symbol`, and
|
|
63
|
-
* function values or (2) simply removed (become `never`) if `bigint` value as
|
|
64
|
-
* serialization attempts will throw.
|
|
65
|
-
*
|
|
66
|
-
* Examples results:
|
|
67
|
-
*
|
|
68
|
-
* | Before serialization | After deserialization | After in record | After in array |
|
|
69
|
-
* | --------------------- | --------------------- | ------------------ | --------------------:|
|
|
70
|
-
* | `undefined \| number` | `number` | `prop?: number` | `(number \| null)[]` |
|
|
71
|
-
* | `symbol \| number` | `number` | `prop?: number` | `(number \| null)[]` |
|
|
72
|
-
* | `bigint \| number` | `number` | `prop: number` | `number[]` |
|
|
73
|
-
* | `undefined` | N/A `never` | (prop not present) | `null[]` |
|
|
74
|
-
* | `symbol` | N/A `never` | (prop not present) | `null[]` |
|
|
75
|
-
* | `bigint` | N/A `never` | N/A (prop not present) | N/A `never[]` |
|
|
76
|
-
* | `bigint \| symbol` | N/A `never` | (prop not present) | `null[]` |
|
|
77
|
-
* | `bigint \| number \| symbol` | `number` | `prop?: number` | `(number \| null)[]` |
|
|
78
|
-
*
|
|
79
|
-
* Setter and getter properties become value properties after filtering
|
|
80
|
-
* although no data will be persisted assuming those properties are backed
|
|
81
|
-
* by functions. If an implementation of getter/setter interface uses a
|
|
82
|
-
* simple data member (of supported type), that will persist.
|
|
83
|
-
*
|
|
84
|
-
* Recursive types without any required modification are preserved intact.
|
|
85
|
-
* Recursive types that require modification are unrolled a limited number of
|
|
86
|
-
* times (currently 4) and then further instances of recursion are replaced with
|
|
87
|
-
* {@link JsonTypeWith|JsonTypeWith<Options.AllowExactly "or" Options.AllowExtensionOf>}.
|
|
88
|
-
*
|
|
89
|
-
* Under basic serialization, class instances become simple data objects that
|
|
90
|
-
* lose hidden properties and prototypes that are required for `instanceof`
|
|
91
|
-
* runtime checks.
|
|
92
|
-
*
|
|
93
|
-
* The optional 'Options.AllowExactly' and 'Options.AllowExtensionOf'
|
|
94
|
-
* parameters may be used to permit additional leaf types handled by custom
|
|
95
|
-
* serialization/deserialization logic.
|
|
96
|
-
*
|
|
97
|
-
* @example Example usage
|
|
98
|
-
*
|
|
99
|
-
* ```typescript
|
|
100
|
-
* function foo<T>(): JsonDeserialized<T> { ... }
|
|
101
|
-
* ```
|
|
102
|
-
*
|
|
103
|
-
* @alpha
|
|
104
|
-
*/
|
|
105
|
-
export type JsonDeserialized<T, Options extends JsonDeserializedOptions = {
|
|
106
|
-
AllowExactly: never;
|
|
107
|
-
AllowExtensionOf: never;
|
|
108
|
-
}> = InternalUtilityTypes.JsonDeserializedImpl<T, Options>;
|
|
109
|
-
//# sourceMappingURL=jsonDeserialized.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonDeserialized.d.ts","sourceRoot":"","sources":["../../src/core-interfaces/jsonDeserialized.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,MAAM,MAAM,gBAAgB,CAC3B,CAAC,EACD,OAAO,SAAS,uBAAuB,GAAG;IACzC,YAAY,EAAE,KAAK,CAAC;IACpB,gBAAgB,EAAE,KAAK,CAAC;CACxB,IACE,oBAAoB,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonDeserialized.js","sourceRoot":"","sources":["../../src/core-interfaces/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 \"./exposedUtilityTypes.js\";\n\n/**\n * Options for {@link JsonDeserialized}.\n *\n * @alpha\n */\nexport interface JsonDeserializedOptions {\n\t/**\n\t * 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 `never`.\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 \"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.\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 * @alpha\n */\nexport type JsonDeserialized<\n\tT,\n\tOptions extends JsonDeserializedOptions = {\n\t\tAllowExactly: never;\n\t\tAllowExtensionOf: never;\n\t},\n> = InternalUtilityTypes.JsonDeserializedImpl<T, Options>;\n"]}
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
import type { InternalUtilityTypes } from "./exposedUtilityTypes.js";
|
|
6
|
-
/**
|
|
7
|
-
* Options for {@link JsonSerializable}.
|
|
8
|
-
*
|
|
9
|
-
* @alpha
|
|
10
|
-
*/
|
|
11
|
-
export interface JsonSerializableOptions {
|
|
12
|
-
/**
|
|
13
|
-
* Exact types that are managed by custom serialization logic (beyond
|
|
14
|
-
* {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}
|
|
15
|
-
* without a replacer). Only exact types matching specification will be
|
|
16
|
-
* preserved unaltered.
|
|
17
|
-
*
|
|
18
|
-
* The default value is `never`.
|
|
19
|
-
*/
|
|
20
|
-
AllowExactly?: unknown;
|
|
21
|
-
/**
|
|
22
|
-
* General types that are managed by custom serialization logic (beyond
|
|
23
|
-
* {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}
|
|
24
|
-
* without a replacer). Any type satisfying specification will be preserved
|
|
25
|
-
* unaltered.
|
|
26
|
-
*
|
|
27
|
-
* The default value is `never`.
|
|
28
|
-
*/
|
|
29
|
-
AllowExtensionOf?: unknown;
|
|
30
|
-
/**
|
|
31
|
-
* When set, inaccessible (protected and private) members throughout type T are
|
|
32
|
-
* ignored as if not present.
|
|
33
|
-
*
|
|
34
|
-
* The default value is not present.
|
|
35
|
-
*/
|
|
36
|
-
IgnoreInaccessibleMembers?: "ignore-inaccessible-members";
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Used to constrain a type `T` to types that are serializable as JSON
|
|
40
|
-
* using {@link https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify|JSON.stringify}
|
|
41
|
-
* (without a replacer) as base model.
|
|
42
|
-
*
|
|
43
|
-
* Under typical use a compile-time error is produced if `T` contains
|
|
44
|
-
* non-JsonSerializable members.
|
|
45
|
-
*
|
|
46
|
-
* @typeParam T - The type to be constrained.
|
|
47
|
-
* @typeParam Options - Options for the filter. See {@link JsonSerializableOptions}.
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* Before adding use of this utility type, consider using a utility like
|
|
51
|
-
* {@link https://github.com/sinclairzx81/typebox#readme | TypeBox} that allows
|
|
52
|
-
* for runtime validation.
|
|
53
|
-
*
|
|
54
|
-
* Note that this does NOT prevent use of values with non-JSON compatible data,
|
|
55
|
-
* it only prevents using values with types that include non-JSON compatible data.
|
|
56
|
-
* This means that one can, for example, pass in a value typed with JSON compatible
|
|
57
|
-
* interface into this filter, that could actually be a class with lots on non-JSON
|
|
58
|
-
* compatible fields and methods.
|
|
59
|
-
*
|
|
60
|
-
* Important: `T extends JsonSerializable<T>` is incorrect (does not even compile).
|
|
61
|
-
*
|
|
62
|
-
* The optional `Options.Allow*` parameters may be used to permit additional leaf types
|
|
63
|
-
* to support situations where a `replacer` is used to handle special values (e.g.,
|
|
64
|
-
* `JsonSerializable<{ x: IFluidHandle }, { AllowExtensionOf: IFluidHandle }>`).
|
|
65
|
-
*
|
|
66
|
-
* Note that `JsonSerializable<T>` does not protect against the following pitfalls
|
|
67
|
-
* when serializing with JSON.stringify():
|
|
68
|
-
*
|
|
69
|
-
* - Non-finite numbers (`NaN`, `+/-Infinity`) are coerced to `null`.
|
|
70
|
-
*
|
|
71
|
-
* - Prototypes and non-enumerable properties are lost.
|
|
72
|
-
*
|
|
73
|
-
* - `ArrayLike` types that are not arrays and are serialized as `{ length: number }`.
|
|
74
|
-
*
|
|
75
|
-
* - Getter and setters properties are lost. (Though appear supported.)
|
|
76
|
-
*
|
|
77
|
-
* - Functions with properties may be absent or the properties may be perserved
|
|
78
|
-
* depending on the runtime typo of the value. (If built via Object.assign the
|
|
79
|
-
* target member's type is preserved.) typeof =\> 'function' is lost whereas when
|
|
80
|
-
* typeof =\> 'object' the properties are preserved.
|
|
81
|
-
*
|
|
82
|
-
* - Sparse arrays are filled with `null`.
|
|
83
|
-
*
|
|
84
|
-
* Also, `JsonSerializable<T>` does not prevent the construction of circular references.
|
|
85
|
-
*
|
|
86
|
-
* Specifying `JsonSerializable<unknown>` or `JsonSerializable<any>` yields a type
|
|
87
|
-
* alias for {@link JsonTypeWith}`<never>` and should not be used if precise type
|
|
88
|
-
* safety is desired.
|
|
89
|
-
*
|
|
90
|
-
* Class instances are indistinguishable from general objects by type checking
|
|
91
|
-
* unless they have non-public members.
|
|
92
|
-
* Unless `Option.IgnoreInaccessibleMembers` is used, types with non-public
|
|
93
|
-
* members will result in {@link SerializationErrorPerNonPublicProperties}.
|
|
94
|
-
* When `Option.IgnoreInaccessibleMembers` is `ignore-inaccessible-members`,
|
|
95
|
-
* non-public (non-function) members are preserved without error, but they are
|
|
96
|
-
* filtered away by the type filters and thus produce an incorrectly narrowed
|
|
97
|
-
* type compared to actual data. Though such a result may be customer desired.
|
|
98
|
-
*
|
|
99
|
-
* Perhaps a https://github.com/microsoft/TypeScript/issues/22677 fix will
|
|
100
|
-
* enable better support.
|
|
101
|
-
*
|
|
102
|
-
* @example Typical usage
|
|
103
|
-
*
|
|
104
|
-
* ```typescript
|
|
105
|
-
* function foo<T>(value: JsonSerializable<T>) { ... }
|
|
106
|
-
* ```
|
|
107
|
-
*
|
|
108
|
-
* @privateRemarks
|
|
109
|
-
* Upon recursion, the original type T is preserved intact. This is done to prevent
|
|
110
|
-
* infinite recursion and produces a technically incorrect result type. However, with
|
|
111
|
-
* proper use, that will never be an issue as any filtering of types will happen
|
|
112
|
-
* before T recursion.
|
|
113
|
-
*
|
|
114
|
-
* @alpha
|
|
115
|
-
*/
|
|
116
|
-
export type JsonSerializable<T, Options extends JsonSerializableOptions = {
|
|
117
|
-
AllowExactly: never;
|
|
118
|
-
AllowExtensionOf: never;
|
|
119
|
-
}> = InternalUtilityTypes.JsonSerializableImpl<T, Options>;
|
|
120
|
-
//# sourceMappingURL=jsonSerializable.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSerializable.d.ts","sourceRoot":"","sources":["../../src/core-interfaces/jsonSerializable.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAErE;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACvC;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B;;;;;OAKG;IACH,yBAAyB,CAAC,EAAE,6BAA6B,CAAC;CAC1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,MAAM,MAAM,gBAAgB,CAC3B,CAAC,EACD,OAAO,SAAS,uBAAuB,GAAG;IACzC,YAAY,EAAE,KAAK,CAAC;IACpB,gBAAgB,EAAE,KAAK,CAAC;CACxB,IACE,oBAAoB,CAAC,oBAAoB,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSerializable.js","sourceRoot":"","sources":["../../src/core-interfaces/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 \"./exposedUtilityTypes.js\";\n\n/**\n * Options for {@link JsonSerializable}.\n *\n * @alpha\n */\nexport interface JsonSerializableOptions {\n\t/**\n\t * 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 `never`.\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.\n\t *\n\t * The default value is not present.\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 perserved\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>` and should not be used if precise type\n * safety is desired.\n *\n * Class instances are indistinguishable from general objects by type checking\n * unless they have non-public members.\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 * 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 * @alpha\n */\nexport type JsonSerializable<\n\tT,\n\tOptions extends JsonSerializableOptions = {\n\t\tAllowExactly: never;\n\t\tAllowExtensionOf: never;\n\t},\n> = InternalUtilityTypes.JsonSerializableImpl<T, Options>;\n"]}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Type resulting from {@link JsonSerializable} use given an array with
|
|
7
|
-
* `undefined` elements.
|
|
8
|
-
*
|
|
9
|
-
* @privateRemarks type is used over interface; so inspection of type
|
|
10
|
-
* result can be more informative than just the type name.
|
|
11
|
-
*
|
|
12
|
-
* @alpha
|
|
13
|
-
* @system
|
|
14
|
-
*/
|
|
15
|
-
export type SerializationErrorPerUndefinedArrayElement = {
|
|
16
|
-
"array serialization error": "undefined elements are not supported";
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Type resulting from {@link JsonSerializable} use given a class with
|
|
20
|
-
* non-public properties.
|
|
21
|
-
*
|
|
22
|
-
* @privateRemarks type is used over interface; so inspection of type
|
|
23
|
-
* result can be more informative than just the type name.
|
|
24
|
-
*
|
|
25
|
-
* @alpha
|
|
26
|
-
* @system
|
|
27
|
-
*/
|
|
28
|
-
export type SerializationErrorPerNonPublicProperties = {
|
|
29
|
-
"object serialization error": "non-public properties are not supported";
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=jsonSerializationErrors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSerializationErrors.d.ts","sourceRoot":"","sources":["../../src/core-interfaces/jsonSerializationErrors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;GASG;AAEH,MAAM,MAAM,0CAA0C,GAAG;IACxD,2BAA2B,EAAE,sCAAsC,CAAC;CACpE,CAAC;AAEF;;;;;;;;;GASG;AAEH,MAAM,MAAM,wCAAwC,GAAG;IACtD,4BAA4B,EAAE,yCAAyC,CAAC;CACxE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonSerializationErrors.js","sourceRoot":"","sources":["../../src/core-interfaces/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 * @alpha\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 * @alpha\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"]}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Type constraint for types that are likely encodable as JSON, deserializable from JSON,
|
|
7
|
-
* or have a custom alternate type.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Use `JsonTypeWith<never>` for just JSON encodable/deserializable types.
|
|
11
|
-
* See {@link JsonSerializable} for encoding pitfalls.
|
|
12
|
-
*
|
|
13
|
-
* @privateRemarks
|
|
14
|
-
* Prefer using `JsonSerializable<unknown>` or `JsonDeserialized<unknown>` over this type that
|
|
15
|
-
* is an implementation detail.
|
|
16
|
-
* @alpha
|
|
17
|
-
*/
|
|
18
|
-
export type JsonTypeWith<T> = null | boolean | number | string | T | {
|
|
19
|
-
[key: string | number]: JsonTypeWith<T>;
|
|
20
|
-
} | JsonTypeWith<T>[];
|
|
21
|
-
/**
|
|
22
|
-
* Portion of {@link JsonTypeWith} that is an object (including array) and not null.
|
|
23
|
-
*
|
|
24
|
-
* @alpha
|
|
25
|
-
*/
|
|
26
|
-
export type NonNullJsonObjectWith<T> = {
|
|
27
|
-
[key: string | number]: JsonTypeWith<T>;
|
|
28
|
-
} | JsonTypeWith<T>[];
|
|
29
|
-
//# sourceMappingURL=jsonType.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonType.d.ts","sourceRoot":"","sources":["../../src/core-interfaces/jsonType.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,IAEvB,IAAI,GACJ,OAAO,GACP,MAAM,GACN,MAAM,GACN,CAAC,GACD;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;CAAE,GAC3C,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;AAErB;;;;GAIG;AACH,MAAM,MAAM,qBAAqB,CAAC,CAAC,IAChC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAA;CAAE,GAC3C,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsonType.js","sourceRoot":"","sources":["../../src/core-interfaces/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 * @alpha\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 * @alpha\n */\nexport type NonNullJsonObjectWith<T> =\n\t| { [key: string | number]: JsonTypeWith<T> }\n\t| JsonTypeWith<T>[];\n"]}
|