@fluidframework/presence 2.10.0-307399
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/LICENSE +21 -0
- package/README.md +216 -0
- package/dist/alpha.d.ts +58 -0
- package/dist/baseTypes.d.ts +24 -0
- package/dist/baseTypes.d.ts.map +1 -0
- package/dist/baseTypes.js +7 -0
- package/dist/baseTypes.js.map +1 -0
- package/dist/container-definitions/containerExtensions.d.ts +137 -0
- package/dist/container-definitions/containerExtensions.d.ts.map +1 -0
- package/dist/container-definitions/containerExtensions.js +7 -0
- package/dist/container-definitions/containerExtensions.js.map +1 -0
- package/dist/container-definitions/index.d.ts +7 -0
- package/dist/container-definitions/index.d.ts.map +1 -0
- package/dist/container-definitions/index.js +7 -0
- package/dist/container-definitions/index.js.map +1 -0
- package/dist/container-definitions/runtime.d.ts +12 -0
- package/dist/container-definitions/runtime.d.ts.map +1 -0
- package/dist/container-definitions/runtime.js +7 -0
- package/dist/container-definitions/runtime.js.map +1 -0
- package/dist/core-interfaces/exposedUtilityTypes.d.ts +446 -0
- package/dist/core-interfaces/exposedUtilityTypes.d.ts.map +1 -0
- package/dist/core-interfaces/exposedUtilityTypes.js +11 -0
- package/dist/core-interfaces/exposedUtilityTypes.js.map +1 -0
- package/dist/core-interfaces/index.d.ts +10 -0
- package/dist/core-interfaces/index.d.ts.map +1 -0
- package/dist/core-interfaces/index.js +7 -0
- package/dist/core-interfaces/index.js.map +1 -0
- package/dist/core-interfaces/jsonDeserialized.d.ts +109 -0
- package/dist/core-interfaces/jsonDeserialized.d.ts.map +1 -0
- package/dist/core-interfaces/jsonDeserialized.js +7 -0
- package/dist/core-interfaces/jsonDeserialized.js.map +1 -0
- package/dist/core-interfaces/jsonSerializable.d.ts +120 -0
- package/dist/core-interfaces/jsonSerializable.d.ts.map +1 -0
- package/dist/core-interfaces/jsonSerializable.js +7 -0
- package/dist/core-interfaces/jsonSerializable.js.map +1 -0
- package/dist/core-interfaces/jsonSerializationErrors.d.ts +31 -0
- package/dist/core-interfaces/jsonSerializationErrors.d.ts.map +1 -0
- package/dist/core-interfaces/jsonSerializationErrors.js +7 -0
- package/dist/core-interfaces/jsonSerializationErrors.js.map +1 -0
- package/dist/core-interfaces/jsonType.d.ts +29 -0
- package/dist/core-interfaces/jsonType.d.ts.map +1 -0
- package/dist/core-interfaces/jsonType.js +7 -0
- package/dist/core-interfaces/jsonType.js.map +1 -0
- package/dist/datastorePresenceManagerFactory.d.ts +48 -0
- package/dist/datastorePresenceManagerFactory.d.ts.map +1 -0
- package/dist/datastorePresenceManagerFactory.js +79 -0
- package/dist/datastorePresenceManagerFactory.js.map +1 -0
- package/dist/datastoreSupport.d.ts +31 -0
- package/dist/datastoreSupport.d.ts.map +1 -0
- package/dist/datastoreSupport.js +82 -0
- package/dist/datastoreSupport.js.map +1 -0
- package/dist/events/events.d.ts +198 -0
- package/dist/events/events.d.ts.map +1 -0
- package/dist/events/events.js +157 -0
- package/dist/events/events.js.map +1 -0
- package/dist/experimentalAccess.d.ts +15 -0
- package/dist/experimentalAccess.d.ts.map +1 -0
- package/dist/experimentalAccess.js +46 -0
- package/dist/experimentalAccess.js.map +1 -0
- package/dist/exposedInternalTypes.d.ts +100 -0
- package/dist/exposedInternalTypes.d.ts.map +1 -0
- package/dist/exposedInternalTypes.js +19 -0
- package/dist/exposedInternalTypes.js.map +1 -0
- package/dist/exposedUtilityTypes.d.ts +63 -0
- package/dist/exposedUtilityTypes.d.ts.map +1 -0
- package/dist/exposedUtilityTypes.js +7 -0
- package/dist/exposedUtilityTypes.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/internalTypes.d.ts +39 -0
- package/dist/internalTypes.d.ts.map +1 -0
- package/dist/internalTypes.js +14 -0
- package/dist/internalTypes.js.map +1 -0
- package/dist/latestMapValueManager.d.ts +182 -0
- package/dist/latestMapValueManager.d.ts.map +1 -0
- package/dist/latestMapValueManager.js +206 -0
- package/dist/latestMapValueManager.js.map +1 -0
- package/dist/latestValueControls.d.ts +44 -0
- package/dist/latestValueControls.d.ts.map +1 -0
- package/dist/latestValueControls.js +28 -0
- package/dist/latestValueControls.js.map +1 -0
- package/dist/latestValueManager.d.ts +69 -0
- package/dist/latestValueManager.d.ts.map +1 -0
- package/dist/latestValueManager.js +100 -0
- package/dist/latestValueManager.js.map +1 -0
- package/dist/latestValueTypes.d.ts +44 -0
- package/dist/latestValueTypes.d.ts.map +1 -0
- package/dist/latestValueTypes.js +7 -0
- package/dist/latestValueTypes.js.map +1 -0
- package/dist/notificationsManager.d.ts +101 -0
- package/dist/notificationsManager.d.ts.map +1 -0
- package/dist/notificationsManager.js +82 -0
- package/dist/notificationsManager.js.map +1 -0
- package/dist/package.json +15 -0
- package/dist/presence.d.ts +180 -0
- package/dist/presence.d.ts.map +1 -0
- package/dist/presence.js +23 -0
- package/dist/presence.js.map +1 -0
- package/dist/presenceDatastoreManager.d.ts +91 -0
- package/dist/presenceDatastoreManager.d.ts.map +1 -0
- package/dist/presenceDatastoreManager.js +248 -0
- package/dist/presenceDatastoreManager.js.map +1 -0
- package/dist/presenceManager.d.ts +20 -0
- package/dist/presenceManager.d.ts.map +1 -0
- package/dist/presenceManager.js +104 -0
- package/dist/presenceManager.js.map +1 -0
- package/dist/presenceStates.d.ts +78 -0
- package/dist/presenceStates.d.ts.map +1 -0
- package/dist/presenceStates.js +182 -0
- package/dist/presenceStates.js.map +1 -0
- package/dist/stateDatastore.d.ts +35 -0
- package/dist/stateDatastore.d.ts.map +1 -0
- package/dist/stateDatastore.js +26 -0
- package/dist/stateDatastore.js.map +1 -0
- package/dist/systemWorkspace.d.ts +51 -0
- package/dist/systemWorkspace.d.ts.map +1 -0
- package/dist/systemWorkspace.js +180 -0
- package/dist/systemWorkspace.js.map +1 -0
- package/dist/types.d.ts +92 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/dist/valueManager.d.ts +19 -0
- package/dist/valueManager.d.ts.map +1 -0
- package/dist/valueManager.js +26 -0
- package/dist/valueManager.js.map +1 -0
- package/lib/alpha.d.ts +58 -0
- package/lib/baseTypes.d.ts +24 -0
- package/lib/baseTypes.d.ts.map +1 -0
- package/lib/baseTypes.js +6 -0
- package/lib/baseTypes.js.map +1 -0
- package/lib/container-definitions/containerExtensions.d.ts +137 -0
- package/lib/container-definitions/containerExtensions.d.ts.map +1 -0
- package/lib/container-definitions/containerExtensions.js +6 -0
- package/lib/container-definitions/containerExtensions.js.map +1 -0
- package/lib/container-definitions/index.d.ts +7 -0
- package/lib/container-definitions/index.d.ts.map +1 -0
- package/lib/container-definitions/index.js +6 -0
- package/lib/container-definitions/index.js.map +1 -0
- package/lib/container-definitions/runtime.d.ts +12 -0
- package/lib/container-definitions/runtime.d.ts.map +1 -0
- package/lib/container-definitions/runtime.js +6 -0
- package/lib/container-definitions/runtime.js.map +1 -0
- package/lib/core-interfaces/exposedUtilityTypes.d.ts +446 -0
- package/lib/core-interfaces/exposedUtilityTypes.d.ts.map +1 -0
- package/lib/core-interfaces/exposedUtilityTypes.js +10 -0
- package/lib/core-interfaces/exposedUtilityTypes.js.map +1 -0
- package/lib/core-interfaces/index.d.ts +10 -0
- package/lib/core-interfaces/index.d.ts.map +1 -0
- package/lib/core-interfaces/index.js +6 -0
- package/lib/core-interfaces/index.js.map +1 -0
- package/lib/core-interfaces/jsonDeserialized.d.ts +109 -0
- package/lib/core-interfaces/jsonDeserialized.d.ts.map +1 -0
- package/lib/core-interfaces/jsonDeserialized.js +6 -0
- package/lib/core-interfaces/jsonDeserialized.js.map +1 -0
- package/lib/core-interfaces/jsonSerializable.d.ts +120 -0
- package/lib/core-interfaces/jsonSerializable.d.ts.map +1 -0
- package/lib/core-interfaces/jsonSerializable.js +6 -0
- package/lib/core-interfaces/jsonSerializable.js.map +1 -0
- package/lib/core-interfaces/jsonSerializationErrors.d.ts +31 -0
- package/lib/core-interfaces/jsonSerializationErrors.d.ts.map +1 -0
- package/lib/core-interfaces/jsonSerializationErrors.js +6 -0
- package/lib/core-interfaces/jsonSerializationErrors.js.map +1 -0
- package/lib/core-interfaces/jsonType.d.ts +29 -0
- package/lib/core-interfaces/jsonType.d.ts.map +1 -0
- package/lib/core-interfaces/jsonType.js +6 -0
- package/lib/core-interfaces/jsonType.js.map +1 -0
- package/lib/datastorePresenceManagerFactory.d.ts +48 -0
- package/lib/datastorePresenceManagerFactory.d.ts.map +1 -0
- package/lib/datastorePresenceManagerFactory.js +75 -0
- package/lib/datastorePresenceManagerFactory.js.map +1 -0
- package/lib/datastoreSupport.d.ts +31 -0
- package/lib/datastoreSupport.d.ts.map +1 -0
- package/lib/datastoreSupport.js +77 -0
- package/lib/datastoreSupport.js.map +1 -0
- package/lib/events/events.d.ts +198 -0
- package/lib/events/events.d.ts.map +1 -0
- package/lib/events/events.js +152 -0
- package/lib/events/events.js.map +1 -0
- package/lib/experimentalAccess.d.ts +15 -0
- package/lib/experimentalAccess.d.ts.map +1 -0
- package/lib/experimentalAccess.js +42 -0
- package/lib/experimentalAccess.js.map +1 -0
- package/lib/exposedInternalTypes.d.ts +100 -0
- package/lib/exposedInternalTypes.d.ts.map +1 -0
- package/lib/exposedInternalTypes.js +16 -0
- package/lib/exposedInternalTypes.js.map +1 -0
- package/lib/exposedUtilityTypes.d.ts +63 -0
- package/lib/exposedUtilityTypes.d.ts.map +1 -0
- package/lib/exposedUtilityTypes.js +6 -0
- package/lib/exposedUtilityTypes.js.map +1 -0
- package/lib/index.d.ts +22 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/internalTypes.d.ts +39 -0
- package/lib/internalTypes.d.ts.map +1 -0
- package/lib/internalTypes.js +11 -0
- package/lib/internalTypes.js.map +1 -0
- package/lib/latestMapValueManager.d.ts +182 -0
- package/lib/latestMapValueManager.d.ts.map +1 -0
- package/lib/latestMapValueManager.js +202 -0
- package/lib/latestMapValueManager.js.map +1 -0
- package/lib/latestValueControls.d.ts +44 -0
- package/lib/latestValueControls.d.ts.map +1 -0
- package/lib/latestValueControls.js +24 -0
- package/lib/latestValueControls.js.map +1 -0
- package/lib/latestValueManager.d.ts +69 -0
- package/lib/latestValueManager.d.ts.map +1 -0
- package/lib/latestValueManager.js +96 -0
- package/lib/latestValueManager.js.map +1 -0
- package/lib/latestValueTypes.d.ts +44 -0
- package/lib/latestValueTypes.d.ts.map +1 -0
- package/lib/latestValueTypes.js +6 -0
- package/lib/latestValueTypes.js.map +1 -0
- package/lib/notificationsManager.d.ts +101 -0
- package/lib/notificationsManager.d.ts.map +1 -0
- package/lib/notificationsManager.js +78 -0
- package/lib/notificationsManager.js.map +1 -0
- package/lib/presence.d.ts +180 -0
- package/lib/presence.d.ts.map +1 -0
- package/lib/presence.js +20 -0
- package/lib/presence.js.map +1 -0
- package/lib/presenceDatastoreManager.d.ts +91 -0
- package/lib/presenceDatastoreManager.d.ts.map +1 -0
- package/lib/presenceDatastoreManager.js +244 -0
- package/lib/presenceDatastoreManager.js.map +1 -0
- package/lib/presenceManager.d.ts +20 -0
- package/lib/presenceManager.d.ts.map +1 -0
- package/lib/presenceManager.js +100 -0
- package/lib/presenceManager.js.map +1 -0
- package/lib/presenceStates.d.ts +78 -0
- package/lib/presenceStates.d.ts.map +1 -0
- package/lib/presenceStates.js +177 -0
- package/lib/presenceStates.js.map +1 -0
- package/lib/stateDatastore.d.ts +35 -0
- package/lib/stateDatastore.d.ts.map +1 -0
- package/lib/stateDatastore.js +21 -0
- package/lib/stateDatastore.js.map +1 -0
- package/lib/systemWorkspace.d.ts +51 -0
- package/lib/systemWorkspace.d.ts.map +1 -0
- package/lib/systemWorkspace.js +176 -0
- package/lib/systemWorkspace.js.map +1 -0
- package/lib/tsdoc-metadata.json +11 -0
- package/lib/types.d.ts +92 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/types.js +7 -0
- package/lib/types.js.map +1 -0
- package/lib/valueManager.d.ts +19 -0
- package/lib/valueManager.d.ts.map +1 -0
- package/lib/valueManager.js +21 -0
- package/lib/valueManager.js.map +1 -0
- package/package.json +175 -0
|
@@ -0,0 +1,109 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,120 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { SharedObjectKind } from "@fluidframework/shared-object-base";
|
|
7
|
+
import type { IPresence } from "./presence.js";
|
|
8
|
+
/**
|
|
9
|
+
* Brand for Experimental Presence Data Object.
|
|
10
|
+
*
|
|
11
|
+
* @remarks
|
|
12
|
+
* See {@link acquirePresenceViaDataObject} for example usage.
|
|
13
|
+
*
|
|
14
|
+
* @sealed
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export declare class ExperimentalPresenceDO {
|
|
18
|
+
private readonly _self;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* DataStore based Presence Manager that is used as fallback for preferred Container
|
|
22
|
+
* Extension based version requires registration. Export SharedObjectKind for registration.
|
|
23
|
+
*
|
|
24
|
+
* @alpha
|
|
25
|
+
*/
|
|
26
|
+
export declare const ExperimentalPresenceManager: SharedObjectKind<IFluidLoadable & ExperimentalPresenceDO>;
|
|
27
|
+
/**
|
|
28
|
+
* Acquire IPresence from a DataStore based Presence Manager
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const containerSchema = {
|
|
33
|
+
* initialObjects: {
|
|
34
|
+
* experimentalPresence: ExperimentalPresenceDO,
|
|
35
|
+
* },
|
|
36
|
+
* } satisfies ContainerSchema;
|
|
37
|
+
* ```
|
|
38
|
+
* then
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const presence = acquirePresenceViaDataObject(
|
|
41
|
+
* container.initialObjects.experimentalPresence,
|
|
42
|
+
* );
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* @alpha
|
|
46
|
+
*/
|
|
47
|
+
export declare function acquirePresenceViaDataObject(fluidLoadable: ExperimentalPresenceDO): IPresence;
|
|
48
|
+
//# sourceMappingURL=datastorePresenceManagerFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datastorePresenceManagerFactory.d.ts","sourceRoot":"","sources":["../src/datastorePresenceManagerFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAGtE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAG3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAkD/C;;;;;;;;GAQG;AACH,MAAM,CAAC,OAAO,OAAO,sBAAsB;IAC1C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyB;CAC/C;AAED;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,2DAGtC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAC3C,aAAa,EAAE,sBAAsB,GACnC,SAAS,CAMX"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.acquirePresenceViaDataObject = exports.ExperimentalPresenceManager = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
+
const datastoreSupport_js_1 = require("./datastoreSupport.js");
|
|
10
|
+
const presenceManager_js_1 = require("./presenceManager.js");
|
|
11
|
+
function assertSignalMessageIsValid(message) {
|
|
12
|
+
(0, internal_1.assert)(message.clientId !== null, 0xa58 /* Signal must have a client ID */);
|
|
13
|
+
// The other difference between messages is that `content` for
|
|
14
|
+
// IExtensionMessage is JsonDeserialized and we are fine assuming that.
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Simple FluidObject holding Presence Manager.
|
|
18
|
+
*/
|
|
19
|
+
class PresenceManagerDataObject extends datastoreSupport_js_1.LoadableFluidObject {
|
|
20
|
+
presenceManager() {
|
|
21
|
+
if (!this._presenceManager) {
|
|
22
|
+
// TODO: investigate if ContainerExtensionStore (path-based address routing for
|
|
23
|
+
// Signals) is readily detectable here and use that presence manager directly.
|
|
24
|
+
const manager = (0, presenceManager_js_1.createPresenceManager)(this.runtime);
|
|
25
|
+
this.runtime.on("signal", (message, local) => {
|
|
26
|
+
assertSignalMessageIsValid(message);
|
|
27
|
+
manager.processSignal("", message, local);
|
|
28
|
+
});
|
|
29
|
+
this._presenceManager = manager;
|
|
30
|
+
}
|
|
31
|
+
return this._presenceManager;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Factory class to create {@link IPresence} in own data store.
|
|
36
|
+
*/
|
|
37
|
+
class PresenceManagerFactory {
|
|
38
|
+
constructor() {
|
|
39
|
+
this.factory = new datastoreSupport_js_1.BasicDataStoreFactory("@fluidframework/presence", PresenceManagerDataObject);
|
|
40
|
+
}
|
|
41
|
+
is(value) {
|
|
42
|
+
return value instanceof PresenceManagerDataObject;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* DataStore based Presence Manager that is used as fallback for preferred Container
|
|
47
|
+
* Extension based version requires registration. Export SharedObjectKind for registration.
|
|
48
|
+
*
|
|
49
|
+
* @alpha
|
|
50
|
+
*/
|
|
51
|
+
exports.ExperimentalPresenceManager = new PresenceManagerFactory();
|
|
52
|
+
/**
|
|
53
|
+
* Acquire IPresence from a DataStore based Presence Manager
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* const containerSchema = {
|
|
58
|
+
* initialObjects: {
|
|
59
|
+
* experimentalPresence: ExperimentalPresenceDO,
|
|
60
|
+
* },
|
|
61
|
+
* } satisfies ContainerSchema;
|
|
62
|
+
* ```
|
|
63
|
+
* then
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const presence = acquirePresenceViaDataObject(
|
|
66
|
+
* container.initialObjects.experimentalPresence,
|
|
67
|
+
* );
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @alpha
|
|
71
|
+
*/
|
|
72
|
+
function acquirePresenceViaDataObject(fluidLoadable) {
|
|
73
|
+
if (fluidLoadable instanceof PresenceManagerDataObject) {
|
|
74
|
+
return fluidLoadable.presenceManager();
|
|
75
|
+
}
|
|
76
|
+
throw new Error("Incompatible loadable; make sure to use ExperimentalPresenceManager");
|
|
77
|
+
}
|
|
78
|
+
exports.acquirePresenceViaDataObject = acquirePresenceViaDataObject;
|
|
79
|
+
//# sourceMappingURL=datastorePresenceManagerFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datastorePresenceManagerFactory.js","sourceRoot":"","sources":["../src/datastorePresenceManagerFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,kEAA6D;AAI7D,+DAAmF;AAEnF,6DAA6D;AAI7D,SAAS,0BAA0B,CAClC,OAAkD;IAElD,IAAA,iBAAM,EAAC,OAAO,CAAC,QAAQ,KAAK,IAAI,EAAE,KAAK,CAAC,kCAAkC,CAAC,CAAC;IAC5E,8DAA8D;IAC9D,uEAAuE;AACxE,CAAC;AAED;;GAEG;AACH,MAAM,yBAA0B,SAAQ,yCAAmB;IAKnD,eAAe;QACrB,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAC5B,+EAA+E;YAC/E,8EAA8E;YAC9E,MAAM,OAAO,GAAG,IAAA,0CAAqB,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACpD,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,CAAC,OAA8B,EAAE,KAAc,EAAE,EAAE;gBAC5E,0BAA0B,CAAC,OAAO,CAAC,CAAC;gBACpC,OAAO,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;QACjC,CAAC;QACD,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;CACD;AAED;;GAEG;AACH,MAAM,sBAAsB;IAA5B;QAKiB,YAAO,GAAG,IAAI,2CAAqB,CAClD,0BAA0B,EAC1B,yBAAyB,CACzB,CAAC;IACH,CAAC;IARO,EAAE,CAAC,KAA8C;QACvD,OAAO,KAAK,YAAY,yBAAyB,CAAC;IACnD,CAAC;CAMD;AAeD;;;;;GAKG;AACU,QAAA,2BAA2B,GACvC,IAAI,sBAAsB,EAEzB,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,4BAA4B,CAC3C,aAAqC;IAErC,IAAI,aAAa,YAAY,yBAAyB,EAAE,CAAC;QACxD,OAAO,aAAa,CAAC,eAAe,EAAE,CAAC;IACxC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;AACxF,CAAC;AARD,oEAQC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/*\n * Hacky support for internal datastore based usages.\n */\n\nimport type { IFluidLoadable } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IInboundSignalMessage } from \"@fluidframework/runtime-definitions/internal\";\nimport type { SharedObjectKind } from \"@fluidframework/shared-object-base\";\n\nimport { BasicDataStoreFactory, LoadableFluidObject } from \"./datastoreSupport.js\";\nimport type { IPresence } from \"./presence.js\";\nimport { createPresenceManager } from \"./presenceManager.js\";\n\nimport type { IExtensionMessage } from \"@fluidframework/presence/internal/container-definitions/internal\";\n\nfunction assertSignalMessageIsValid(\n\tmessage: IInboundSignalMessage | IExtensionMessage,\n): asserts message is IExtensionMessage {\n\tassert(message.clientId !== null, 0xa58 /* Signal must have a client ID */);\n\t// The other difference between messages is that `content` for\n\t// IExtensionMessage is JsonDeserialized and we are fine assuming that.\n}\n\n/**\n * Simple FluidObject holding Presence Manager.\n */\nclass PresenceManagerDataObject extends LoadableFluidObject {\n\t// Creation of presence manager is deferred until first acquisition to avoid\n\t// instantiations and stand-up by Summarizer that has no actual use.\n\tprivate _presenceManager: IPresence | undefined;\n\n\tpublic presenceManager(): IPresence {\n\t\tif (!this._presenceManager) {\n\t\t\t// TODO: investigate if ContainerExtensionStore (path-based address routing for\n\t\t\t// Signals) is readily detectable here and use that presence manager directly.\n\t\t\tconst manager = createPresenceManager(this.runtime);\n\t\t\tthis.runtime.on(\"signal\", (message: IInboundSignalMessage, local: boolean) => {\n\t\t\t\tassertSignalMessageIsValid(message);\n\t\t\t\tmanager.processSignal(\"\", message, local);\n\t\t\t});\n\t\t\tthis._presenceManager = manager;\n\t\t}\n\t\treturn this._presenceManager;\n\t}\n}\n\n/**\n * Factory class to create {@link IPresence} in own data store.\n */\nclass PresenceManagerFactory {\n\tpublic is(value: IFluidLoadable | ExperimentalPresenceDO): value is ExperimentalPresenceDO {\n\t\treturn value instanceof PresenceManagerDataObject;\n\t}\n\n\tpublic readonly factory = new BasicDataStoreFactory(\n\t\t\"@fluidframework/presence\",\n\t\tPresenceManagerDataObject,\n\t);\n}\n\n/**\n * Brand for Experimental Presence Data Object.\n *\n * @remarks\n * See {@link acquirePresenceViaDataObject} for example usage.\n *\n * @sealed\n * @alpha\n */\nexport declare class ExperimentalPresenceDO {\n\tprivate readonly _self: ExperimentalPresenceDO;\n}\n\n/**\n * DataStore based Presence Manager that is used as fallback for preferred Container\n * Extension based version requires registration. Export SharedObjectKind for registration.\n *\n * @alpha\n */\nexport const ExperimentalPresenceManager =\n\tnew PresenceManagerFactory() as unknown as SharedObjectKind<\n\t\tIFluidLoadable & ExperimentalPresenceDO\n\t>;\n\n/**\n * Acquire IPresence from a DataStore based Presence Manager\n *\n * @example\n * ```typescript\n * const containerSchema = {\n * \tinitialObjects: {\n * \t\texperimentalPresence: ExperimentalPresenceDO,\n * \t},\n * } satisfies ContainerSchema;\n * ```\n * then\n * ```typescript\n * const presence = acquirePresenceViaDataObject(\n * \tcontainer.initialObjects.experimentalPresence,\n * \t);\n * ```\n *\n * @alpha\n */\nexport function acquirePresenceViaDataObject(\n\tfluidLoadable: ExperimentalPresenceDO,\n): IPresence {\n\tif (fluidLoadable instanceof PresenceManagerDataObject) {\n\t\treturn fluidLoadable.presenceManager();\n\t}\n\n\tthrow new Error(\"Incompatible loadable; make sure to use ExperimentalPresenceManager\");\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { FluidObject, IFluidLoadable } from "@fluidframework/core-interfaces";
|
|
6
|
+
import type { IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
|
|
7
|
+
import { FluidDataStoreRuntime } from "@fluidframework/datastore/internal";
|
|
8
|
+
import type { IFluidDataStoreContext, IFluidDataStoreFactory } from "@fluidframework/runtime-definitions/internal";
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare class BasicDataStoreFactory<Type extends string> implements IFluidDataStoreFactory {
|
|
13
|
+
readonly type: Type;
|
|
14
|
+
private readonly instanceCtor;
|
|
15
|
+
get IFluidDataStoreFactory(): IFluidDataStoreFactory;
|
|
16
|
+
constructor(type: Type, instanceCtor: new (runtime: FluidDataStoreRuntime) => LoadableFluidObject);
|
|
17
|
+
instantiateDataStore(context: IFluidDataStoreContext, existing: boolean): Promise<FluidDataStoreRuntime>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare abstract class LoadableFluidObject implements FluidObject, IFluidLoadable {
|
|
23
|
+
protected readonly runtime: FluidDataStoreRuntime;
|
|
24
|
+
constructor(runtime: FluidDataStoreRuntime);
|
|
25
|
+
get IFluidLoadable(): this;
|
|
26
|
+
/**
|
|
27
|
+
* Handle to the this Fluid object.
|
|
28
|
+
*/
|
|
29
|
+
get handle(): IFluidHandleInternal<FluidObject>;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=datastoreSupport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datastoreSupport.d.ts","sourceRoot":"","sources":["../src/datastoreSupport.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,WAAW,EACX,cAAc,EAGd,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAErF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EACX,sBAAsB,EACtB,sBAAsB,EACtB,MAAM,8CAA8C,CAAC;AA+BtD;;GAEG;AACH,qBAAa,qBAAqB,CAAC,IAAI,SAAS,MAAM,CAAE,YAAW,sBAAsB;aAMvE,IAAI,EAAE,IAAI;IAC1B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAN9B,IAAW,sBAAsB,IAAI,sBAAsB,CAE1D;gBAGgB,IAAI,EAAE,IAAI,EACT,YAAY,EAAE,KAAK,OAAO,EAAE,qBAAqB,KAAK,mBAAmB;IAG9E,oBAAoB,CAChC,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,OAAO,GACf,OAAO,CAAC,qBAAqB,CAAC;CAiBjC;AAED;;GAEG;AACH,8BAAsB,mBAAoB,YAAW,WAAW,EAAE,cAAc;IAC5D,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,qBAAqB;gBAA9B,OAAO,EAAE,qBAAqB;IAEpE,IAAW,cAAc,IAAI,IAAI,CAEhC;IAED;;OAEG;IACH,IAAW,MAAM,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAMrD;CACD"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.LoadableFluidObject = exports.BasicDataStoreFactory = void 0;
|
|
8
|
+
const internal_1 = require("@fluidframework/core-utils/internal");
|
|
9
|
+
const internal_2 = require("@fluidframework/datastore/internal");
|
|
10
|
+
const internal_3 = require("@fluidframework/runtime-utils/internal");
|
|
11
|
+
/**
|
|
12
|
+
* Extends the FluidDataStoreRuntime to provide a request method that routes requests to
|
|
13
|
+
* the entrypoint Fluid object that is expected to be a {@link LoadableFluidObject}.
|
|
14
|
+
*/
|
|
15
|
+
class BasicFluidDataStoreRuntime extends internal_2.FluidDataStoreRuntime {
|
|
16
|
+
async request(request) {
|
|
17
|
+
const response = await super.request(request);
|
|
18
|
+
if (response.status !== 404) {
|
|
19
|
+
return response;
|
|
20
|
+
}
|
|
21
|
+
// Return entrypoint object if someone requests it directly.
|
|
22
|
+
// Direct requests exist from two scenarios:
|
|
23
|
+
// 1. the request url is a "/"
|
|
24
|
+
// 2. the request url is empty
|
|
25
|
+
if (request.url === "" || request.url === "/" || request.url.startsWith("/?")) {
|
|
26
|
+
// The provideEntryPoint callback below always returns an instance of
|
|
27
|
+
// LoadableFluidObject. Make sure that is the case.
|
|
28
|
+
const dataObject = await this.entryPoint.get();
|
|
29
|
+
(0, internal_1.assert)(dataObject instanceof LoadableFluidObject, 0xa36 /* Data store runtime entryPoint is not expected type */);
|
|
30
|
+
return { mimeType: "fluid/object", status: 200, value: dataObject };
|
|
31
|
+
}
|
|
32
|
+
return (0, internal_3.create404Response)(request);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
class BasicDataStoreFactory {
|
|
39
|
+
get IFluidDataStoreFactory() {
|
|
40
|
+
return this;
|
|
41
|
+
}
|
|
42
|
+
constructor(type, instanceCtor) {
|
|
43
|
+
this.type = type;
|
|
44
|
+
this.instanceCtor = instanceCtor;
|
|
45
|
+
}
|
|
46
|
+
async instantiateDataStore(context, existing) {
|
|
47
|
+
// Create a new runtime for our data store.
|
|
48
|
+
// The runtime is what Fluid uses to route to our data store.
|
|
49
|
+
const runtime = new BasicFluidDataStoreRuntime(context,
|
|
50
|
+
/* ISharedObjectRegistry */ new Map(), existing,
|
|
51
|
+
/* provideEntryPoint */ async () => {
|
|
52
|
+
(0, internal_1.assert)(instance !== undefined, 0xa37 /* Intended entryPoint is undefined */);
|
|
53
|
+
return instance;
|
|
54
|
+
});
|
|
55
|
+
const instance = new this.instanceCtor(runtime);
|
|
56
|
+
return runtime;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.BasicDataStoreFactory = BasicDataStoreFactory;
|
|
60
|
+
/**
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
class LoadableFluidObject {
|
|
64
|
+
constructor(runtime) {
|
|
65
|
+
this.runtime = runtime;
|
|
66
|
+
}
|
|
67
|
+
get IFluidLoadable() {
|
|
68
|
+
return this;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Handle to the this Fluid object.
|
|
72
|
+
*/
|
|
73
|
+
get handle() {
|
|
74
|
+
// BasicDataStoreFactory provides an entryPoint initialization function
|
|
75
|
+
// to the data store runtime; so, this object should always have access to a
|
|
76
|
+
// non-null entryPoint.
|
|
77
|
+
(0, internal_1.assert)(this.runtime.entryPoint !== undefined, 0xa38 /* EntryPoint was undefined */);
|
|
78
|
+
return this.runtime.entryPoint;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.LoadableFluidObject = LoadableFluidObject;
|
|
82
|
+
//# sourceMappingURL=datastoreSupport.js.map
|