@fluidframework/shared-object-base 2.0.0-internal.8.0.0 → 2.0.0-rc.1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/README.md +0 -6
- package/api-extractor-esm.json +4 -0
- package/api-extractor-lint.json +1 -10
- package/api-extractor.json +1 -9
- package/api-report/shared-object-base.api.md +11 -22
- package/dist/{handle.cjs → handle.js} +1 -1
- package/dist/handle.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/{index.cjs → index.js} +7 -8
- package/dist/index.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/{packageVersion.cjs → packageVersion.js} +2 -2
- package/dist/packageVersion.js.map +1 -0
- package/dist/{remoteObjectHandle.cjs → remoteObjectHandle.js} +1 -1
- package/dist/remoteObjectHandle.js.map +1 -0
- package/dist/serializer.d.ts +3 -15
- package/dist/serializer.d.ts.map +1 -1
- package/dist/{serializer.cjs → serializer.js} +6 -11
- package/dist/serializer.js.map +1 -0
- package/dist/shared-object-base-alpha.d.ts +32 -64
- package/dist/shared-object-base-beta.d.ts +353 -46
- package/dist/shared-object-base-public.d.ts +353 -46
- package/dist/shared-object-base-untrimmed.d.ts +11 -25
- package/dist/sharedObject.d.ts +3 -4
- package/dist/sharedObject.d.ts.map +1 -1
- package/dist/{sharedObject.cjs → sharedObject.js} +6 -6
- package/dist/{sharedObject.cjs.map → sharedObject.js.map} +1 -1
- package/dist/summarySerializer.d.ts +1 -1
- package/dist/{summarySerializer.cjs → summarySerializer.js} +3 -3
- package/dist/summarySerializer.js.map +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/{types.cjs → types.js} +1 -1
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +2 -2
- package/dist/{utils.cjs → utils.js} +3 -3
- package/dist/utils.js.map +1 -0
- package/dist/{valueType.cjs → valueType.js} +1 -1
- package/dist/valueType.js.map +1 -0
- package/lib/{handle.d.ts → handle.d.mts} +1 -1
- package/lib/handle.d.mts.map +1 -0
- package/lib/{index.d.ts → index.d.mts} +2 -2
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +2 -2
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/{remoteObjectHandle.d.ts → remoteObjectHandle.d.mts} +1 -1
- package/lib/remoteObjectHandle.d.mts.map +1 -0
- package/lib/{serializer.d.ts → serializer.d.mts} +4 -16
- package/lib/serializer.d.mts.map +1 -0
- package/lib/serializer.mjs +3 -7
- package/lib/serializer.mjs.map +1 -1
- package/lib/shared-object-base-alpha.d.mts +411 -0
- package/lib/{shared-object-base-alpha.d.ts → shared-object-base-beta.d.mts} +8 -62
- package/lib/shared-object-base-public.d.mts +389 -0
- package/lib/{shared-object-base-untrimmed.d.ts → shared-object-base-untrimmed.d.mts} +11 -25
- package/lib/{sharedObject.d.ts → sharedObject.d.mts} +4 -5
- package/lib/sharedObject.d.mts.map +1 -0
- package/lib/sharedObject.mjs +2 -2
- package/lib/sharedObject.mjs.map +1 -1
- package/lib/{summarySerializer.d.ts → summarySerializer.d.mts} +2 -2
- package/lib/summarySerializer.d.mts.map +1 -0
- package/lib/summarySerializer.mjs +1 -1
- package/lib/summarySerializer.mjs.map +1 -1
- package/lib/{types.d.ts → types.d.mts} +3 -3
- package/lib/types.d.mts.map +1 -0
- package/lib/types.mjs.map +1 -1
- package/lib/{utils.d.ts → utils.d.mts} +3 -3
- package/lib/utils.d.mts.map +1 -0
- package/lib/utils.mjs +2 -2
- package/lib/utils.mjs.map +1 -1
- package/lib/{valueType.d.ts → valueType.d.mts} +1 -1
- package/lib/valueType.d.mts.map +1 -0
- package/package.json +91 -29
- package/src/index.ts +1 -6
- package/src/packageVersion.ts +1 -1
- package/src/serializer.ts +4 -22
- package/src/sharedObject.ts +3 -3
- package/src/summarySerializer.ts +1 -1
- package/src/types.ts +2 -2
- package/src/utils.ts +2 -2
- package/dist/handle.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/packageVersion.cjs.map +0 -1
- package/dist/remoteObjectHandle.cjs.map +0 -1
- package/dist/serializer.cjs.map +0 -1
- package/dist/summarySerializer.cjs.map +0 -1
- package/dist/types.cjs.map +0 -1
- package/dist/utils.cjs.map +0 -1
- package/dist/valueType.cjs.map +0 -1
- package/lib/handle.d.ts.map +0 -1
- package/lib/index.d.ts.map +0 -1
- package/lib/packageVersion.d.ts.map +0 -1
- package/lib/remoteObjectHandle.d.ts.map +0 -1
- package/lib/serializer.d.ts.map +0 -1
- package/lib/shared-object-base-beta.d.ts +0 -82
- package/lib/shared-object-base-public.d.ts +0 -82
- package/lib/sharedObject.d.ts.map +0 -1
- package/lib/summarySerializer.d.ts.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/utils.d.ts.map +0 -1
- package/lib/valueType.d.ts.map +0 -1
- package/tsc-multi.test.json +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,43 @@
|
|
|
1
1
|
# @fluidframework/shared-object-base
|
|
2
2
|
|
|
3
|
+
## 2.0.0-rc.1.0.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Updated server dependencies ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
8
|
+
|
|
9
|
+
The following Fluid server dependencies have been updated to the latest version, 3.0.0. [See the full changelog.](https://github.com/microsoft/FluidFramework/releases/tag/server_v3.0.0)
|
|
10
|
+
|
|
11
|
+
- @fluidframework/gitresources
|
|
12
|
+
- @fluidframework/server-kafka-orderer
|
|
13
|
+
- @fluidframework/server-lambdas
|
|
14
|
+
- @fluidframework/server-lambdas-driver
|
|
15
|
+
- @fluidframework/server-local-server
|
|
16
|
+
- @fluidframework/server-memory-orderer
|
|
17
|
+
- @fluidframework/protocol-base
|
|
18
|
+
- @fluidframework/server-routerlicious
|
|
19
|
+
- @fluidframework/server-routerlicious-base
|
|
20
|
+
- @fluidframework/server-services
|
|
21
|
+
- @fluidframework/server-services-client
|
|
22
|
+
- @fluidframework/server-services-core
|
|
23
|
+
- @fluidframework/server-services-ordering-kafkanode
|
|
24
|
+
- @fluidframework/server-services-ordering-rdkafka
|
|
25
|
+
- @fluidframework/server-services-ordering-zookeeper
|
|
26
|
+
- @fluidframework/server-services-shared
|
|
27
|
+
- @fluidframework/server-services-telemetry
|
|
28
|
+
- @fluidframework/server-services-utils
|
|
29
|
+
- @fluidframework/server-test-utils
|
|
30
|
+
- tinylicious
|
|
31
|
+
|
|
32
|
+
- Updated @fluidframework/protocol-definitions ([#19122](https://github.com/microsoft/FluidFramework/issues/19122)) [25366b4229](https://github.com/microsoft/FluidFramework/commits/25366b422918cb43685c5f328b50450749592902)
|
|
33
|
+
|
|
34
|
+
The @fluidframework/protocol-definitions dependency has been upgraded to v3.1.0. [See the full
|
|
35
|
+
changelog.](https://github.com/microsoft/FluidFramework/blob/main/common/lib/protocol-definitions/CHANGELOG.md#310)
|
|
36
|
+
|
|
37
|
+
- shared-object-base: SharedObject processGCDataCore now takes IFluidSerializer rather than SummarySerializer ([#18803](https://github.com/microsoft/FluidFramework/issues/18803)) [396b8e9738](https://github.com/microsoft/FluidFramework/commits/396b8e9738156ff88b62424a0076f09fb5028a32)
|
|
38
|
+
|
|
39
|
+
This change should be a no-op for consumers, and `SummarySerializer` and `IFluidSerializer` expose the same consumer facing APIs. This change just makes our APIs more consistent by only using interfaces, rather than a mix of interfaces and concrete implementations.
|
|
40
|
+
|
|
3
41
|
## 2.0.0-internal.8.0.0
|
|
4
42
|
|
|
5
43
|
Dependency updates only.
|
package/README.md
CHANGED
|
@@ -13,12 +13,6 @@ When taking a dependency on a Fluid Framework library, we recommend using a `^`
|
|
|
13
13
|
While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
|
|
14
14
|
library consumers should always prefer `^`.
|
|
15
15
|
|
|
16
|
-
Note that when depending on a library version of the form `2.0.0-internal.x.y.z`, called the Fluid internal version scheme,
|
|
17
|
-
you must use a `>= <` dependency range (such as `>=2.0.0-internal.x.y.z <2.0.0-internal.w.0.0` where `w` is `x+1`).
|
|
18
|
-
Standard `^` and `~` ranges will not work as expected.
|
|
19
|
-
See the [@fluid-tools/version-tools](https://github.com/microsoft/FluidFramework/blob/main/build-tools/packages/version-tools/README.md)
|
|
20
|
-
package for more information including tools to convert between version schemes.
|
|
21
|
-
|
|
22
16
|
<!-- prettier-ignore-end -->
|
|
23
17
|
|
|
24
18
|
<!-- AUTO-GENERATED-CONTENT:END -->
|
package/api-extractor-lint.json
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-lint.json"
|
|
4
|
-
"messages": {
|
|
5
|
-
"extractorMessageReporting": {
|
|
6
|
-
// TODO: remove once base config has this enabled as an error
|
|
7
|
-
"ae-incompatible-release-tags": {
|
|
8
|
-
"logLevel": "error",
|
|
9
|
-
"addToApiReportFile": false
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-lint.json"
|
|
13
4
|
}
|
package/api-extractor.json
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
|
-
"extends": "../../../common/build/build-common/api-extractor-base.json"
|
|
4
|
-
"messages": {
|
|
5
|
-
"extractorMessageReporting": {
|
|
6
|
-
// TODO: Add missing documentation and remove this rule override
|
|
7
|
-
"ae-undocumented": {
|
|
8
|
-
"logLevel": "none"
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
}
|
|
3
|
+
"extends": "../../../common/build/build-common/api-extractor-base.json"
|
|
12
4
|
}
|
|
@@ -26,9 +26,9 @@ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
|
26
26
|
// @internal
|
|
27
27
|
export function createSingleBlobSummary(key: string, content: string | Uint8Array): ISummaryTreeWithStats;
|
|
28
28
|
|
|
29
|
-
// @
|
|
29
|
+
// @internal
|
|
30
30
|
export class FluidSerializer implements IFluidSerializer {
|
|
31
|
-
constructor(context: IFluidHandleContext, handleParsedCb
|
|
31
|
+
constructor(context: IFluidHandleContext, handleParsedCb?: (handle: IFluidHandle) => void);
|
|
32
32
|
decode(input: any): any;
|
|
33
33
|
encode(input: any, bind: IFluidHandle): any;
|
|
34
34
|
// (undocumented)
|
|
@@ -44,7 +44,7 @@ export class FluidSerializer implements IFluidSerializer {
|
|
|
44
44
|
stringify(input: any, bind: IFluidHandle): string;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// @
|
|
47
|
+
// @public (undocumented)
|
|
48
48
|
export interface IFluidSerializer {
|
|
49
49
|
decode(input: any): any;
|
|
50
50
|
encode(value: any, bind: IFluidHandle): any;
|
|
@@ -52,21 +52,13 @@ export interface IFluidSerializer {
|
|
|
52
52
|
stringify(value: any, bind: IFluidHandle): string;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
// @
|
|
56
|
-
export interface ISerializedHandle {
|
|
57
|
-
// (undocumented)
|
|
58
|
-
type: "__fluid_handle__";
|
|
59
|
-
// (undocumented)
|
|
60
|
-
url: string;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// @alpha
|
|
55
|
+
// @public
|
|
64
56
|
export interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends IChannel, IEventProvider<TEvent> {
|
|
65
57
|
bindToContext(): void;
|
|
66
58
|
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
67
59
|
}
|
|
68
60
|
|
|
69
|
-
// @
|
|
61
|
+
// @public
|
|
70
62
|
export interface ISharedObjectEvents extends IErrorEvent {
|
|
71
63
|
// @eventProperty
|
|
72
64
|
(event: "pre-op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
@@ -74,25 +66,22 @@ export interface ISharedObjectEvents extends IErrorEvent {
|
|
|
74
66
|
(event: "op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
75
67
|
}
|
|
76
68
|
|
|
77
|
-
// @
|
|
78
|
-
export const isSerializedHandle: (value: any) => value is ISerializedHandle;
|
|
79
|
-
|
|
80
|
-
// @internal
|
|
69
|
+
// @alpha
|
|
81
70
|
export function makeHandlesSerializable(value: any, serializer: IFluidSerializer, bind: IFluidHandle): any;
|
|
82
71
|
|
|
83
|
-
// @
|
|
72
|
+
// @alpha
|
|
84
73
|
export function parseHandles(value: any, serializer: IFluidSerializer): any;
|
|
85
74
|
|
|
86
75
|
// @internal
|
|
87
76
|
export function serializeHandles(value: any, serializer: IFluidSerializer, bind: IFluidHandle): string | undefined;
|
|
88
77
|
|
|
89
|
-
// @
|
|
78
|
+
// @public
|
|
90
79
|
export abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends SharedObjectCore<TEvent> {
|
|
91
80
|
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, telemetryContextPrefix: string);
|
|
92
81
|
// (undocumented)
|
|
93
82
|
getAttachSummary(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
94
83
|
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
95
|
-
protected processGCDataCore(serializer:
|
|
84
|
+
protected processGCDataCore(serializer: IFluidSerializer): void;
|
|
96
85
|
// (undocumented)
|
|
97
86
|
protected get serializer(): IFluidSerializer;
|
|
98
87
|
// (undocumented)
|
|
@@ -100,7 +89,7 @@ export abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedO
|
|
|
100
89
|
protected abstract summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): ISummaryTreeWithStats;
|
|
101
90
|
}
|
|
102
91
|
|
|
103
|
-
// @
|
|
92
|
+
// @public
|
|
104
93
|
export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {
|
|
105
94
|
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
|
|
106
95
|
protected abstract applyStashedOp(content: any): unknown;
|
|
@@ -142,7 +131,7 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
|
|
|
142
131
|
abstract summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
|
|
143
132
|
}
|
|
144
133
|
|
|
145
|
-
// @
|
|
134
|
+
// @internal
|
|
146
135
|
export class SummarySerializer extends FluidSerializer {
|
|
147
136
|
// (undocumented)
|
|
148
137
|
getSerializedRoutes(): string[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle.js","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,yDAA8D;AAG9D;;;;;;;;;;GAUG;AACH,MAAa,kBAAmB,SAAQ,6BAAgC;IACvE;;OAEG;IACH,IAAW,UAAU;QACpB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IAED;;;;;;OAMG;IACH,YACoB,KAAoB,EACvC,IAAY,EACZ,YAAiC;QAEjC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;QAJd,UAAK,GAAL,KAAK,CAAe;IAKxC,CAAC;IAED;;;OAGG;IACI,WAAW;QACjB,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,WAAW,EAAE,CAAC;IACrB,CAAC;CACD;AA/BD,gDA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { ISharedObject } from \"./types\";\n\n/**\n * Handle for a shared object.\n *\n * @remarks\n *\n * This object is used for already loaded (in-memory) shared objects and is used only for serialization purposes.\n *\n * De-serialization process goes through {@link @fluidframework/datastore#FluidObjectHandle}, and request flow:\n * {@link @fluidframework/datastore#FluidDataStoreRuntime.request} recognizes requests in the form of\n * '/\\<shared object id\\>' and loads shared object.\n */\nexport class SharedObjectHandle extends FluidObjectHandle<ISharedObject> {\n\t/**\n\t * Whether services have been attached for the associated shared object.\n\t */\n\tpublic get isAttached(): boolean {\n\t\treturn this.value.isAttached();\n\t}\n\n\t/**\n\t * Creates a new SharedObjectHandle.\n\t * @param value - The shared object this handle is for.\n\t * @param path - The id of the shared object. It is also the path to this object relative to the routeContext.\n\t * @param routeContext - The parent {@link @fluidframework/core-interfaces#IFluidHandleContext} that has a route\n\t * to this handle.\n\t */\n\tconstructor(\n\t\tprotected readonly value: ISharedObject,\n\t\tpath: string,\n\t\trouteContext: IFluidHandleContext,\n\t) {\n\t\tsuper(value, path, routeContext);\n\t}\n\n\t/**\n\t * Attaches all bound handles first (which may in turn attach further handles), then attaches this handle.\n\t * When attaching the handle, it registers the associated shared object.\n\t */\n\tpublic attachGraph(): void {\n\t\tthis.value.bindToContext();\n\t\tsuper.attachGraph();\n\t}\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { FluidSerializer, IFluidSerializer
|
|
5
|
+
export { FluidSerializer, IFluidSerializer } from "./serializer";
|
|
6
6
|
export { SharedObject, SharedObjectCore } from "./sharedObject";
|
|
7
7
|
export { SummarySerializer } from "./summarySerializer";
|
|
8
8
|
export { ISharedObject, ISharedObjectEvents } from "./types";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EACN,uBAAuB,EACvB,uBAAuB,EACvB,YAAY,EACZ,gBAAgB,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -4,20 +4,19 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ValueType = exports.serializeHandles = exports.parseHandles = exports.makeHandlesSerializable = exports.createSingleBlobSummary = exports.SummarySerializer = exports.SharedObjectCore = exports.SharedObject = exports.
|
|
8
|
-
var serializer_1 = require("./serializer
|
|
7
|
+
exports.ValueType = exports.serializeHandles = exports.parseHandles = exports.makeHandlesSerializable = exports.createSingleBlobSummary = exports.SummarySerializer = exports.SharedObjectCore = exports.SharedObject = exports.FluidSerializer = void 0;
|
|
8
|
+
var serializer_1 = require("./serializer");
|
|
9
9
|
Object.defineProperty(exports, "FluidSerializer", { enumerable: true, get: function () { return serializer_1.FluidSerializer; } });
|
|
10
|
-
|
|
11
|
-
var sharedObject_1 = require("./sharedObject.cjs");
|
|
10
|
+
var sharedObject_1 = require("./sharedObject");
|
|
12
11
|
Object.defineProperty(exports, "SharedObject", { enumerable: true, get: function () { return sharedObject_1.SharedObject; } });
|
|
13
12
|
Object.defineProperty(exports, "SharedObjectCore", { enumerable: true, get: function () { return sharedObject_1.SharedObjectCore; } });
|
|
14
|
-
var summarySerializer_1 = require("./summarySerializer
|
|
13
|
+
var summarySerializer_1 = require("./summarySerializer");
|
|
15
14
|
Object.defineProperty(exports, "SummarySerializer", { enumerable: true, get: function () { return summarySerializer_1.SummarySerializer; } });
|
|
16
|
-
var utils_1 = require("./utils
|
|
15
|
+
var utils_1 = require("./utils");
|
|
17
16
|
Object.defineProperty(exports, "createSingleBlobSummary", { enumerable: true, get: function () { return utils_1.createSingleBlobSummary; } });
|
|
18
17
|
Object.defineProperty(exports, "makeHandlesSerializable", { enumerable: true, get: function () { return utils_1.makeHandlesSerializable; } });
|
|
19
18
|
Object.defineProperty(exports, "parseHandles", { enumerable: true, get: function () { return utils_1.parseHandles; } });
|
|
20
19
|
Object.defineProperty(exports, "serializeHandles", { enumerable: true, get: function () { return utils_1.serializeHandles; } });
|
|
21
|
-
var valueType_1 = require("./valueType
|
|
20
|
+
var valueType_1 = require("./valueType");
|
|
22
21
|
Object.defineProperty(exports, "ValueType", { enumerable: true, get: function () { return valueType_1.ValueType; } });
|
|
23
|
-
//# sourceMappingURL=index.
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAiE;AAAxD,6GAAA,eAAe,OAAA;AACxB,+CAAgE;AAAvD,4GAAA,YAAY,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AACvC,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAE1B,iCAKiB;AAJhB,gHAAA,uBAAuB,OAAA;AACvB,gHAAA,uBAAuB,OAAA;AACvB,qGAAA,YAAY,OAAA;AACZ,yGAAA,gBAAgB,OAAA;AAEjB,yCAAwC;AAA/B,sGAAA,SAAS,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { FluidSerializer, IFluidSerializer } from \"./serializer\";\nexport { SharedObject, SharedObjectCore } from \"./sharedObject\";\nexport { SummarySerializer } from \"./summarySerializer\";\nexport { ISharedObject, ISharedObjectEvents } from \"./types\";\nexport {\n\tcreateSingleBlobSummary,\n\tmakeHandlesSerializable,\n\tparseHandles,\n\tserializeHandles,\n} from \"./utils\";\nexport { ValueType } from \"./valueType\";\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/shared-object-base";
|
|
8
|
-
export declare const pkgVersion = "2.0.0-
|
|
8
|
+
export declare const pkgVersion = "2.0.0-rc.1.0.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,uCAAuC,CAAC;AAC5D,eAAO,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,uCAAuC,CAAC;AAC5D,eAAO,MAAM,UAAU,mBAAmB,CAAC"}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/shared-object-base";
|
|
11
|
-
exports.pkgVersion = "2.0.0-
|
|
12
|
-
//# sourceMappingURL=packageVersion.
|
|
11
|
+
exports.pkgVersion = "2.0.0-rc.1.0.0";
|
|
12
|
+
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,oCAAoC,CAAC;AAC/C,QAAA,UAAU,GAAG,gBAAgB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/shared-object-base\";\nexport const pkgVersion = \"2.0.0-rc.1.0.0\";\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteObjectHandle.js","sourceRoot":"","sources":["../src/remoteObjectHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AACpD,yEAAmE;AAOnE,iEAAoE;AAEpE;;;;;;GAMG;AACH,MAAa,uBAAuB;IACnC,IAAW,mBAAmB;QAC7B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAKD;;;;OAIG;IACH,YACiB,YAAoB,EACpB,YAAiC;QADjC,iBAAY,GAAZ,YAAY,CAAQ;QACpB,iBAAY,GAAZ,YAAY,CAAqB;QAVlC,eAAU,GAAG,IAAI,CAAC;QAYjC,IAAA,mBAAM,EACL,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAC5B,KAAK,CAAC,iDAAiD,CACvD,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,GAAG;QACf,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC/B,6EAA6E;YAC7E,MAAM,OAAO,GAAa;gBACzB,GAAG,EAAE,IAAI,CAAC,YAAY;gBACtB,OAAO,EAAE,EAAE,CAAC,kCAAc,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE;aAC7C,CAAC;YACF,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY;iBAC9B,aAAa,CAAC,OAAO,CAAC;iBACtB,IAAI,CAAc,CAAC,QAAQ,EAAE,EAAE;gBAC/B,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;oBACzC,MAAM,WAAW,GAAgB,QAAQ,CAAC,KAAK,CAAC;oBAChD,OAAO,WAAW,CAAC;iBACnB;gBACD,MAAM,IAAA,mCAAmB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC9C,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;IAEM,WAAW;QACjB,OAAO;IACR,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC/B,MAAM,CAAC,WAAW,EAAE,CAAC;IACtB,CAAC;CACD;AArDD,0DAqDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { RuntimeHeaders } from \"@fluidframework/container-runtime\";\nimport {\n\tIFluidHandle,\n\tIFluidHandleContext,\n\tIRequest,\n\tFluidObject,\n} from \"@fluidframework/core-interfaces\";\nimport { responseToException } from \"@fluidframework/runtime-utils\";\n\n/**\n * This handle is used to dynamically load a Fluid object on a remote client and is created on parsing a serialized\n * FluidObjectHandle.\n * This class is used to generate an IFluidHandle when de-serializing any all handles (including handles to DDSes,\n * custom objects) that are stored in SharedObjects. The Data Store or SharedObject corresponding to the\n * IFluidHandle can be retrieved by calling `get` on it.\n */\nexport class RemoteFluidObjectHandle implements IFluidHandle {\n\tpublic get IFluidHandleContext() {\n\t\treturn this;\n\t}\n\tpublic get IFluidHandle() {\n\t\treturn this;\n\t}\n\n\tpublic readonly isAttached = true;\n\tprivate objectP: Promise<FluidObject> | undefined;\n\n\t/**\n\t * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.\n\t * @param absolutePath - The absolute path to the handle from the container runtime.\n\t * @param routeContext - The root IFluidHandleContext that has a route to this handle.\n\t */\n\tconstructor(\n\t\tpublic readonly absolutePath: string,\n\t\tpublic readonly routeContext: IFluidHandleContext,\n\t) {\n\t\tassert(\n\t\t\tabsolutePath.startsWith(\"/\"),\n\t\t\t0x19d /* \"Handles should always have absolute paths\" */,\n\t\t);\n\t}\n\n\tpublic async get(): Promise<any> {\n\t\tif (this.objectP === undefined) {\n\t\t\t// Add `viaHandle` header to distinguish from requests from non-handle paths.\n\t\t\tconst request: IRequest = {\n\t\t\t\turl: this.absolutePath,\n\t\t\t\theaders: { [RuntimeHeaders.viaHandle]: true },\n\t\t\t};\n\t\t\tthis.objectP = this.routeContext\n\t\t\t\t.resolveHandle(request)\n\t\t\t\t.then<FluidObject>((response) => {\n\t\t\t\t\tif (response.mimeType === \"fluid/object\") {\n\t\t\t\t\t\tconst fluidObject: FluidObject = response.value;\n\t\t\t\t\t\treturn fluidObject;\n\t\t\t\t\t}\n\t\t\t\t\tthrow responseToException(response, request);\n\t\t\t\t});\n\t\t}\n\t\treturn this.objectP;\n\t}\n\n\tpublic attachGraph(): void {\n\t\treturn;\n\t}\n\n\tpublic bind(handle: IFluidHandle): void {\n\t\thandle.attachGraph();\n\t}\n}\n"]}
|
package/dist/serializer.d.ts
CHANGED
|
@@ -4,19 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IFluidHandle, IFluidHandleContext } from "@fluidframework/core-interfaces";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export interface ISerializedHandle {
|
|
11
|
-
type: "__fluid_handle__";
|
|
12
|
-
url: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export declare const isSerializedHandle: (value: any) => value is ISerializedHandle;
|
|
18
|
-
/**
|
|
19
|
-
* @alpha
|
|
7
|
+
* @public
|
|
20
8
|
*/
|
|
21
9
|
export interface IFluidSerializer {
|
|
22
10
|
/**
|
|
@@ -49,13 +37,13 @@ export interface IFluidSerializer {
|
|
|
49
37
|
}
|
|
50
38
|
/**
|
|
51
39
|
* Data Store serializer implementation
|
|
52
|
-
* @
|
|
40
|
+
* @internal
|
|
53
41
|
*/
|
|
54
42
|
export declare class FluidSerializer implements IFluidSerializer {
|
|
55
43
|
private readonly context;
|
|
56
44
|
private readonly handleParsedCb;
|
|
57
45
|
private readonly root;
|
|
58
|
-
constructor(context: IFluidHandleContext, handleParsedCb
|
|
46
|
+
constructor(context: IFluidHandleContext, handleParsedCb?: (handle: IFluidHandle) => void);
|
|
59
47
|
get IFluidSerializer(): this;
|
|
60
48
|
/**
|
|
61
49
|
* Given a mostly-jsonable object tree that may have handle objects embedded within, will return a
|
package/dist/serializer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGpF
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAGpF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,GAAG,GAAG,CAAC;IAE5C;;;;;;;;OAQG;IACH,MAAM,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM,CAAC;IAElD;;;OAGG;IACH,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC;CAC1B;AAED;;;GAGG;AACH,qBAAa,eAAgB,YAAW,gBAAgB;IAItD,OAAO,CAAC,QAAQ,CAAC,OAAO;IAExB,OAAO,CAAC,QAAQ,CAAC,cAAc;IALhC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAsB;gBAGzB,OAAO,EAAE,mBAAmB,EAE5B,cAAc,GAAE,CAAC,MAAM,EAAE,YAAY,KAAK,IAAe;IAQ3E,IAAW,gBAAgB,SAE1B;IAED;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY;IAS5C;;;;;;;;OAQG;IACI,MAAM,CAAC,KAAK,EAAE,GAAG;IASjB,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY;IAKxC,KAAK,CAAC,KAAK,EAAE,MAAM;IAM1B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAM1B;IAIF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAe1B;IAKF,OAAO,CAAC,kBAAkB;IA6C1B,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY;;;;CAOlE"}
|
|
@@ -4,24 +4,19 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.FluidSerializer =
|
|
7
|
+
exports.FluidSerializer = void 0;
|
|
8
8
|
// RATIONALE: Many methods consume and return 'any' by necessity.
|
|
9
9
|
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
10
10
|
const runtime_utils_1 = require("@fluidframework/runtime-utils");
|
|
11
|
-
const remoteObjectHandle_1 = require("./remoteObjectHandle
|
|
12
|
-
/**
|
|
13
|
-
* @internal
|
|
14
|
-
*/
|
|
15
|
-
const isSerializedHandle = (value) => value?.type === "__fluid_handle__";
|
|
16
|
-
exports.isSerializedHandle = isSerializedHandle;
|
|
11
|
+
const remoteObjectHandle_1 = require("./remoteObjectHandle");
|
|
17
12
|
/**
|
|
18
13
|
* Data Store serializer implementation
|
|
19
|
-
* @
|
|
14
|
+
* @internal
|
|
20
15
|
*/
|
|
21
16
|
class FluidSerializer {
|
|
22
17
|
constructor(context,
|
|
23
18
|
// To be called whenever a handle is parsed by this serializer.
|
|
24
|
-
handleParsedCb) {
|
|
19
|
+
handleParsedCb = () => { }) {
|
|
25
20
|
this.context = context;
|
|
26
21
|
this.handleParsedCb = handleParsedCb;
|
|
27
22
|
// If the given 'value' is an IFluidHandle, returns the encoded IFluidHandle.
|
|
@@ -36,7 +31,7 @@ class FluidSerializer {
|
|
|
36
31
|
// Otherwise returns the original 'value'. Used by 'decode()' and 'parse()'.
|
|
37
32
|
this.decodeValue = (value) => {
|
|
38
33
|
// If 'value' is a serialized IFluidHandle return the deserialized result.
|
|
39
|
-
if ((0,
|
|
34
|
+
if ((0, runtime_utils_1.isSerializedHandle)(value)) {
|
|
40
35
|
// Old documents may have handles with relative path in their summaries. Convert these to absolute
|
|
41
36
|
// paths. This will ensure that future summaries will have absolute paths for these handles.
|
|
42
37
|
const absolutePath = value.url.startsWith("/")
|
|
@@ -146,4 +141,4 @@ class FluidSerializer {
|
|
|
146
141
|
}
|
|
147
142
|
}
|
|
148
143
|
exports.FluidSerializer = FluidSerializer;
|
|
149
|
-
//# sourceMappingURL=serializer.
|
|
144
|
+
//# sourceMappingURL=serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":";AAAA;;;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ACD;AAnJD,0CAmJC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// RATIONALE: Many methods consume and return 'any' by necessity.\n/* eslint-disable @typescript-eslint/no-unsafe-return */\n\nimport { generateHandleContextPath, isSerializedHandle } from \"@fluidframework/runtime-utils\";\nimport { IFluidHandle, IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { RemoteFluidObjectHandle } from \"./remoteObjectHandle\";\n\n/**\n * @public\n */\nexport interface IFluidSerializer {\n\t/**\n\t * Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object\n\t * where any embedded IFluidHandles have been replaced with a serializable form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clones all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t */\n\tencode(value: any, bind: IFluidHandle): any;\n\n\t/**\n\t * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n\t * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t *\n\t * The decoded handles are implicitly bound to the handle context of this serializer.\n\t */\n\tdecode(input: any): any;\n\n\t/**\n\t * Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.\n\t */\n\tstringify(value: any, bind: IFluidHandle): string;\n\n\t/**\n\t * Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid\n\t * handles will be realized as part of the parse\n\t */\n\tparse(value: string): any;\n}\n\n/**\n * Data Store serializer implementation\n * @internal\n */\nexport class FluidSerializer implements IFluidSerializer {\n\tprivate readonly root: IFluidHandleContext;\n\n\tpublic constructor(\n\t\tprivate readonly context: IFluidHandleContext,\n\t\t// To be called whenever a handle is parsed by this serializer.\n\t\tprivate readonly handleParsedCb: (handle: IFluidHandle) => void = () => {},\n\t) {\n\t\tthis.root = this.context;\n\t\twhile (this.root.routeContext !== undefined) {\n\t\t\tthis.root = this.root.routeContext;\n\t\t}\n\t}\n\n\tpublic get IFluidSerializer() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Given a mostly-jsonable object tree that may have handle objects embedded within, will return a\n\t * fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t *\n\t * Any unbound handles encountered are bound to the provided IFluidHandle.\n\t */\n\tpublic encode(input: any, bind: IFluidHandle) {\n\t\t// If the given 'input' cannot contain handles, return it immediately. Otherwise,\n\t\t// return the result of 'recursivelyReplace()'.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\treturn !!input && typeof input === \"object\"\n\t\t\t? this.recursivelyReplace(input, this.encodeValue, bind)\n\t\t\t: input;\n\t}\n\n\t/**\n\t * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n\t * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t *\n\t * The decoded handles are implicitly bound to the handle context of this serializer.\n\t */\n\tpublic decode(input: any) {\n\t\t// If the given 'input' cannot contain handles, return it immediately. Otherwise,\n\t\t// return the result of 'recursivelyReplace()'.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\treturn !!input && typeof input === \"object\"\n\t\t\t? this.recursivelyReplace(input, this.decodeValue)\n\t\t\t: input;\n\t}\n\n\tpublic stringify(input: any, bind: IFluidHandle) {\n\t\treturn JSON.stringify(input, (key, value) => this.encodeValue(value, bind));\n\t}\n\n\t// Parses the serialized data - context must match the context with which the JSON was stringified\n\tpublic parse(input: string) {\n\t\treturn JSON.parse(input, (key, value) => this.decodeValue(value));\n\t}\n\n\t// If the given 'value' is an IFluidHandle, returns the encoded IFluidHandle.\n\t// Otherwise returns the original 'value'. Used by 'encode()' and 'stringify()'.\n\tprivate readonly encodeValue = (value: any, bind: IFluidHandle) => {\n\t\t// Detect if 'value' is an IFluidHandle.\n\t\tconst handle = value?.IFluidHandle;\n\n\t\t// If 'value' is an IFluidHandle return its encoded form.\n\t\treturn handle !== undefined ? this.serializeHandle(handle, bind) : value;\n\t};\n\n\t// If the given 'value' is an encoded IFluidHandle, returns the decoded IFluidHandle.\n\t// Otherwise returns the original 'value'. Used by 'decode()' and 'parse()'.\n\tprivate readonly decodeValue = (value: any) => {\n\t\t// If 'value' is a serialized IFluidHandle return the deserialized result.\n\t\tif (isSerializedHandle(value)) {\n\t\t\t// Old documents may have handles with relative path in their summaries. Convert these to absolute\n\t\t\t// paths. This will ensure that future summaries will have absolute paths for these handles.\n\t\t\tconst absolutePath = value.url.startsWith(\"/\")\n\t\t\t\t? value.url\n\t\t\t\t: generateHandleContextPath(value.url, this.context);\n\n\t\t\tconst parsedHandle = new RemoteFluidObjectHandle(absolutePath, this.root);\n\t\t\tthis.handleParsedCb(parsedHandle);\n\t\t\treturn parsedHandle;\n\t\t} else {\n\t\t\treturn value;\n\t\t}\n\t};\n\n\t// Invoked for non-null objects to recursively replace references to IFluidHandles.\n\t// Clones as-needed to avoid mutating the `input` object. If no IFluidHandes are present,\n\t// returns the original `input`.\n\tprivate recursivelyReplace(\n\t\tinput: any,\n\t\treplacer: (input: any, context: any) => any,\n\t\tcontext?: any,\n\t) {\n\t\t// Note: Caller is responsible for ensuring that `input` is defined / non-null.\n\t\t// (Required for Object.keys() below.)\n\n\t\t// Execute the `replace` on the current input. Note that Caller is responsible for ensuring that `input`\n\t\t// is a non-null object.\n\t\tconst maybeReplaced = replacer(input, context);\n\n\t\t// If the replacer made a substitution there is no need to decscend further. IFluidHandles are always\n\t\t// leaves in the object graph.\n\t\tif (maybeReplaced !== input) {\n\t\t\treturn maybeReplaced;\n\t\t}\n\n\t\t// Otherwise descend into the object graph looking for IFluidHandle instances.\n\t\tlet clone: object | undefined;\n\t\tfor (const key of Object.keys(input)) {\n\t\t\tconst value = input[key];\n\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\tif (!!value && typeof value === \"object\") {\n\t\t\t\t// Note: Except for IFluidHandle, `input` must not contain circular references (as object must\n\t\t\t\t// be JSON serializable.) Therefore, guarding against infinite recursion here would only\n\t\t\t\t// lead to a later error when attempting to stringify().\n\t\t\t\tconst replaced = this.recursivelyReplace(value, replacer, context);\n\n\t\t\t\t// If the `replaced` object is different than the original `value` then the subgraph contained one\n\t\t\t\t// or more handles. If this happens, we need to return a clone of the `input` object where the\n\t\t\t\t// current property is replaced by the `replaced` value.\n\t\t\t\tif (replaced !== value) {\n\t\t\t\t\t// Lazily create a shallow clone of the `input` object if we haven't done so already.\n\t\t\t\t\tclone = clone ?? (Array.isArray(input) ? [...input] : { ...input });\n\n\t\t\t\t\t// Overwrite the current property `key` in the clone with the `replaced` value.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\t\t\t\t\tclone![key] = replaced;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn clone ?? input;\n\t}\n\n\tprotected serializeHandle(handle: IFluidHandle, bind: IFluidHandle) {\n\t\tbind.bind(handle);\n\t\treturn {\n\t\t\ttype: \"__fluid_handle__\",\n\t\t\turl: handle.absolutePath,\n\t\t};\n\t}\n}\n"]}
|
|
@@ -19,49 +19,10 @@ import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
|
19
19
|
|
|
20
20
|
/* Excluded from this release type: createSingleBlobSummary */
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
* Data Store serializer implementation
|
|
24
|
-
* @alpha
|
|
25
|
-
*/
|
|
26
|
-
export declare class FluidSerializer implements IFluidSerializer {
|
|
27
|
-
private readonly context;
|
|
28
|
-
private readonly handleParsedCb;
|
|
29
|
-
private readonly root;
|
|
30
|
-
constructor(context: IFluidHandleContext, handleParsedCb: (handle: IFluidHandle) => void);
|
|
31
|
-
get IFluidSerializer(): this;
|
|
32
|
-
/**
|
|
33
|
-
* Given a mostly-jsonable object tree that may have handle objects embedded within, will return a
|
|
34
|
-
* fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable form.
|
|
35
|
-
*
|
|
36
|
-
* The original `input` object is not mutated. This method will shallowly clone all objects in the path from
|
|
37
|
-
* the root to any replaced handles. (If no handles are found, returns the original object.)
|
|
38
|
-
*
|
|
39
|
-
* Any unbound handles encountered are bound to the provided IFluidHandle.
|
|
40
|
-
*/
|
|
41
|
-
encode(input: any, bind: IFluidHandle): any;
|
|
42
|
-
/**
|
|
43
|
-
* Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an
|
|
44
|
-
* equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.
|
|
45
|
-
*
|
|
46
|
-
* The original `input` object is not mutated. This method will shallowly clone all objects in the path from
|
|
47
|
-
* the root to any replaced handles. (If no handles are found, returns the original object.)
|
|
48
|
-
*
|
|
49
|
-
* The decoded handles are implicitly bound to the handle context of this serializer.
|
|
50
|
-
*/
|
|
51
|
-
decode(input: any): any;
|
|
52
|
-
stringify(input: any, bind: IFluidHandle): string;
|
|
53
|
-
parse(input: string): any;
|
|
54
|
-
private readonly encodeValue;
|
|
55
|
-
private readonly decodeValue;
|
|
56
|
-
private recursivelyReplace;
|
|
57
|
-
protected serializeHandle(handle: IFluidHandle, bind: IFluidHandle): {
|
|
58
|
-
type: string;
|
|
59
|
-
url: string;
|
|
60
|
-
};
|
|
61
|
-
}
|
|
22
|
+
/* Excluded from this release type: FluidSerializer */
|
|
62
23
|
|
|
63
24
|
/**
|
|
64
|
-
* @
|
|
25
|
+
* @public
|
|
65
26
|
*/
|
|
66
27
|
export declare interface IFluidSerializer {
|
|
67
28
|
/**
|
|
@@ -93,11 +54,9 @@ export declare interface IFluidSerializer {
|
|
|
93
54
|
parse(value: string): any;
|
|
94
55
|
}
|
|
95
56
|
|
|
96
|
-
/* Excluded from this release type: ISerializedHandle */
|
|
97
|
-
|
|
98
57
|
/**
|
|
99
58
|
* Base interface for shared objects from which other interfaces derive. Implemented by SharedObject
|
|
100
|
-
* @
|
|
59
|
+
* @public
|
|
101
60
|
*/
|
|
102
61
|
export declare interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends IChannel, IEventProvider<TEvent> {
|
|
103
62
|
/**
|
|
@@ -115,7 +74,7 @@ export declare interface ISharedObject<TEvent extends ISharedObjectEvents = ISha
|
|
|
115
74
|
|
|
116
75
|
/**
|
|
117
76
|
* Events emitted by {@link ISharedObject}.
|
|
118
|
-
* @
|
|
77
|
+
* @public
|
|
119
78
|
*/
|
|
120
79
|
export declare interface ISharedObjectEvents extends IErrorEvent {
|
|
121
80
|
/**
|
|
@@ -138,18 +97,38 @@ export declare interface ISharedObjectEvents extends IErrorEvent {
|
|
|
138
97
|
(event: "op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
139
98
|
}
|
|
140
99
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
100
|
+
/**
|
|
101
|
+
* Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object
|
|
102
|
+
* where any embedded IFluidHandles have been replaced with a serializable form.
|
|
103
|
+
*
|
|
104
|
+
* The original `input` object is not mutated. This method will shallowly clones all objects in the path from
|
|
105
|
+
* the root to any replaced handles. (If no handles are found, returns the original object.)
|
|
106
|
+
*
|
|
107
|
+
* @param input - The mostly-plain object
|
|
108
|
+
* @param context - The handle context for the container
|
|
109
|
+
* @param bind - Bind any other handles we find in the object against this given handle.
|
|
110
|
+
* @returns The fully-plain object
|
|
111
|
+
* @alpha
|
|
112
|
+
*/
|
|
113
|
+
export declare function makeHandlesSerializable(value: any, serializer: IFluidSerializer, bind: IFluidHandle): any;
|
|
144
114
|
|
|
145
|
-
|
|
115
|
+
/**
|
|
116
|
+
* Given a fully-plain object that may have serializable-form handles within, will return the mostly-plain object
|
|
117
|
+
* with handle objects created instead.
|
|
118
|
+
* @param value - The fully-plain object
|
|
119
|
+
* @param serializer - The serializer that knows how to convert serializable-form handles into handle objects
|
|
120
|
+
* @param context - The handle context for the container
|
|
121
|
+
* @returns The mostly-plain object with handle objects within
|
|
122
|
+
* @alpha
|
|
123
|
+
*/
|
|
124
|
+
export declare function parseHandles(value: any, serializer: IFluidSerializer): any;
|
|
146
125
|
|
|
147
126
|
/* Excluded from this release type: serializeHandles */
|
|
148
127
|
|
|
149
128
|
/**
|
|
150
129
|
* SharedObject with simplified, synchronous summarization and GC.
|
|
151
130
|
* DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.
|
|
152
|
-
* @
|
|
131
|
+
* @public
|
|
153
132
|
*/
|
|
154
133
|
export declare abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends SharedObjectCore<TEvent> {
|
|
155
134
|
private readonly telemetryContextPrefix;
|
|
@@ -184,7 +163,7 @@ export declare abstract class SharedObject<TEvent extends ISharedObjectEvents =
|
|
|
184
163
|
* Calls the serializer over all data in this object that reference other GC nodes.
|
|
185
164
|
* Derived classes must override this to provide custom list of references to other GC nodes.
|
|
186
165
|
*/
|
|
187
|
-
protected processGCDataCore(serializer:
|
|
166
|
+
protected processGCDataCore(serializer: IFluidSerializer): void;
|
|
188
167
|
/**
|
|
189
168
|
* Gets a form of the object that can be serialized.
|
|
190
169
|
* @returns A tree representing the snapshot of the shared object.
|
|
@@ -195,7 +174,7 @@ export declare abstract class SharedObject<TEvent extends ISharedObjectEvents =
|
|
|
195
174
|
|
|
196
175
|
/**
|
|
197
176
|
* Base class from which all shared objects derive.
|
|
198
|
-
* @
|
|
177
|
+
* @public
|
|
199
178
|
*/
|
|
200
179
|
export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {
|
|
201
180
|
id: string;
|
|
@@ -425,18 +404,7 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
|
|
|
425
404
|
private emitInternal;
|
|
426
405
|
}
|
|
427
406
|
|
|
428
|
-
|
|
429
|
-
* Serializer implementation for serializing handles during summary.
|
|
430
|
-
* @alpha
|
|
431
|
-
*/
|
|
432
|
-
export declare class SummarySerializer extends FluidSerializer {
|
|
433
|
-
private readonly serializedRoutes;
|
|
434
|
-
getSerializedRoutes(): string[];
|
|
435
|
-
protected serializeHandle(handle: IFluidHandle, bind: IFluidHandle): {
|
|
436
|
-
type: string;
|
|
437
|
-
url: string;
|
|
438
|
-
};
|
|
439
|
-
}
|
|
407
|
+
/* Excluded from this release type: SummarySerializer */
|
|
440
408
|
|
|
441
409
|
/* Excluded from this release type: ValueType */
|
|
442
410
|
|