@fluidframework/shared-object-base 2.0.0-internal.7.2.2 → 2.0.0-internal.7.3.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 +4 -0
- package/api-extractor.json +3 -0
- package/dist/{handle.js → handle.cjs} +1 -1
- package/dist/handle.cjs.map +1 -0
- package/dist/{index.js → index.cjs} +6 -6
- package/dist/index.cjs.map +1 -0
- package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/{remoteObjectHandle.js → remoteObjectHandle.cjs} +1 -1
- package/dist/remoteObjectHandle.cjs.map +1 -0
- package/dist/{serializer.js → serializer.cjs} +2 -2
- package/dist/serializer.cjs.map +1 -0
- package/dist/shared-object-base-alpha.d.ts +479 -0
- package/dist/shared-object-base-beta.d.ts +479 -0
- package/dist/shared-object-base-public.d.ts +479 -0
- package/dist/shared-object-base-untrimmed.d.ts +491 -0
- package/dist/{sharedObject.js → sharedObject.cjs} +4 -4
- package/dist/sharedObject.cjs.map +1 -0
- package/dist/{summarySerializer.js → summarySerializer.cjs} +2 -2
- package/dist/summarySerializer.cjs.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{types.js → types.cjs} +1 -1
- package/dist/types.cjs.map +1 -0
- package/dist/{utils.js → utils.cjs} +1 -1
- package/{lib/utils.js.map → dist/utils.cjs.map} +1 -1
- package/dist/{valueType.js → valueType.cjs} +1 -1
- package/dist/valueType.cjs.map +1 -0
- package/lib/{handle.js → handle.mjs} +1 -1
- package/lib/handle.mjs.map +1 -0
- package/lib/index.mjs +10 -0
- package/lib/index.mjs.map +1 -0
- package/lib/packageVersion.d.ts +1 -1
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{remoteObjectHandle.js → remoteObjectHandle.mjs} +1 -1
- package/lib/remoteObjectHandle.mjs.map +1 -0
- package/lib/{serializer.js → serializer.mjs} +2 -4
- package/lib/serializer.mjs.map +1 -0
- package/lib/shared-object-base-alpha.d.ts +479 -0
- package/lib/shared-object-base-beta.d.ts +479 -0
- package/lib/shared-object-base-public.d.ts +479 -0
- package/lib/shared-object-base-untrimmed.d.ts +491 -0
- package/lib/{sharedObject.js → sharedObject.mjs} +4 -4
- package/lib/sharedObject.mjs.map +1 -0
- package/lib/{summarySerializer.js → summarySerializer.mjs} +2 -2
- package/lib/summarySerializer.mjs.map +1 -0
- package/lib/{types.js → types.mjs} +1 -1
- package/{dist/types.js.map → lib/types.mjs.map} +1 -1
- package/lib/{utils.js → utils.mjs} +1 -1
- package/lib/utils.mjs.map +1 -0
- package/lib/{valueType.js → valueType.mjs} +1 -1
- package/lib/valueType.mjs.map +1 -0
- package/package.json +55 -26
- package/src/packageVersion.ts +1 -1
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +5 -3
- package/dist/handle.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/packageVersion.js.map +0 -1
- package/dist/remoteObjectHandle.js.map +0 -1
- package/dist/serializer.js.map +0 -1
- package/dist/sharedObject.js.map +0 -1
- package/dist/summarySerializer.js.map +0 -1
- package/dist/utils.js.map +0 -1
- package/dist/valueType.js.map +0 -1
- package/lib/handle.js.map +0 -1
- package/lib/index.js +0 -10
- package/lib/index.js.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/remoteObjectHandle.js.map +0 -1
- package/lib/serializer.js.map +0 -1
- package/lib/sharedObject.js.map +0 -1
- package/lib/summarySerializer.js.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/valueType.js.map +0 -1
- package/tsconfig.esnext.json +0 -7
package/CHANGELOG.md
CHANGED
package/api-extractor.json
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
|
|
3
3
|
"extends": "@fluidframework/build-common/api-extractor-base.json",
|
|
4
|
+
"dtsRollup": {
|
|
5
|
+
"enabled": true
|
|
6
|
+
},
|
|
4
7
|
"messages": {
|
|
5
8
|
"extractorMessageReporting": {
|
|
6
9
|
"ae-missing-release-tag": {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handle.cjs","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"]}
|
|
@@ -5,19 +5,19 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.ValueType = exports.serializeHandles = exports.parseHandles = exports.makeHandlesSerializable = exports.createSingleBlobSummary = exports.SummarySerializer = exports.SharedObjectCore = exports.SharedObject = exports.isSerializedHandle = exports.FluidSerializer = void 0;
|
|
8
|
-
var serializer_1 = require("./serializer");
|
|
8
|
+
var serializer_1 = require("./serializer.cjs");
|
|
9
9
|
Object.defineProperty(exports, "FluidSerializer", { enumerable: true, get: function () { return serializer_1.FluidSerializer; } });
|
|
10
10
|
Object.defineProperty(exports, "isSerializedHandle", { enumerable: true, get: function () { return serializer_1.isSerializedHandle; } });
|
|
11
|
-
var sharedObject_1 = require("./sharedObject");
|
|
11
|
+
var sharedObject_1 = require("./sharedObject.cjs");
|
|
12
12
|
Object.defineProperty(exports, "SharedObject", { enumerable: true, get: function () { return sharedObject_1.SharedObject; } });
|
|
13
13
|
Object.defineProperty(exports, "SharedObjectCore", { enumerable: true, get: function () { return sharedObject_1.SharedObjectCore; } });
|
|
14
|
-
var summarySerializer_1 = require("./summarySerializer");
|
|
14
|
+
var summarySerializer_1 = require("./summarySerializer.cjs");
|
|
15
15
|
Object.defineProperty(exports, "SummarySerializer", { enumerable: true, get: function () { return summarySerializer_1.SummarySerializer; } });
|
|
16
|
-
var utils_1 = require("./utils");
|
|
16
|
+
var utils_1 = require("./utils.cjs");
|
|
17
17
|
Object.defineProperty(exports, "createSingleBlobSummary", { enumerable: true, get: function () { return utils_1.createSingleBlobSummary; } });
|
|
18
18
|
Object.defineProperty(exports, "makeHandlesSerializable", { enumerable: true, get: function () { return utils_1.makeHandlesSerializable; } });
|
|
19
19
|
Object.defineProperty(exports, "parseHandles", { enumerable: true, get: function () { return utils_1.parseHandles; } });
|
|
20
20
|
Object.defineProperty(exports, "serializeHandles", { enumerable: true, get: function () { return utils_1.serializeHandles; } });
|
|
21
|
-
var valueType_1 = require("./valueType");
|
|
21
|
+
var valueType_1 = require("./valueType.cjs");
|
|
22
22
|
Object.defineProperty(exports, "ValueType", { enumerable: true, get: function () { return valueType_1.ValueType; } });
|
|
23
|
-
//# sourceMappingURL=index.
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+CAKsB;AAJrB,6GAAA,eAAe,OAAA;AAGf,gHAAA,kBAAkB,OAAA;AAEnB,mDAAgE;AAAvD,4GAAA,YAAY,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AACvC,6DAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAE1B,qCAKiB;AAJhB,gHAAA,uBAAuB,OAAA;AACvB,gHAAA,uBAAuB,OAAA;AACvB,qGAAA,YAAY,OAAA;AACZ,yGAAA,gBAAgB,OAAA;AAEjB,6CAAwC;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 {\n\tFluidSerializer,\n\tIFluidSerializer,\n\tISerializedHandle,\n\tisSerializedHandle,\n} 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"]}
|
|
@@ -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-internal.7.
|
|
12
|
-
//# sourceMappingURL=packageVersion.
|
|
11
|
+
exports.pkgVersion = "2.0.0-internal.7.3.0";
|
|
12
|
+
//# sourceMappingURL=packageVersion.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packageVersion.cjs","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,oCAAoC,CAAC;AAC/C,QAAA,UAAU,GAAG,sBAAsB,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-internal.7.3.0\";\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-internal.7.
|
|
8
|
+
export declare const pkgVersion = "2.0.0-internal.7.3.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remoteObjectHandle.cjs","sourceRoot":"","sources":["../src/remoteObjectHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AACpD,yEAAmE;AAUnE,iEAIuC;AAEvC;;;;;;GAMG;AACH,MAAa,uBAAuB;IACnC;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IACD,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;IAED;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,OAAiB;QACrC,IAAI;YACH,gDAAgD;YAChD,MAAM,MAAM,GAA8B,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;YAEnC,OAAO,MAAM,KAAK,SAAS;gBAC1B,CAAC,CAAC,IAAA,iCAAiB,EAAC,OAAO,CAAC;gBAC5B,CAAC,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SACjC;QAAC,OAAO,KAAK,EAAE;YACf,OAAO,IAAA,mCAAmB,EAAC,KAAK,CAAC,CAAC;SAClC;IACF,CAAC;CACD;AA5ED,0DA4EC","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\tIResponse,\n\tFluidObject,\n\t// eslint-disable-next-line import/no-deprecated\n\tIFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport {\n\tcreate404Response,\n\texceptionToResponse,\n\tresponseToException,\n} 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\t/**\n\t * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic get IFluidRouter() {\n\t\treturn this;\n\t}\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\t/**\n\t * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n\t */\n\tpublic async request(request: IRequest): Promise<IResponse> {\n\t\ttry {\n\t\t\t// eslint-disable-next-line import/no-deprecated\n\t\t\tconst object: FluidObject<IFluidRouter> = await this.get();\n\t\t\tconst router = object.IFluidRouter;\n\n\t\t\treturn router === undefined\n\t\t\t\t? create404Response(request)\n\t\t\t\t: await router.request(request);\n\t\t} catch (error) {\n\t\t\treturn exceptionToResponse(error);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -8,7 +8,7 @@ exports.FluidSerializer = exports.isSerializedHandle = 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");
|
|
11
|
+
const remoteObjectHandle_1 = require("./remoteObjectHandle.cjs");
|
|
12
12
|
const isSerializedHandle = (value) => value?.type === "__fluid_handle__";
|
|
13
13
|
exports.isSerializedHandle = isSerializedHandle;
|
|
14
14
|
/**
|
|
@@ -142,4 +142,4 @@ class FluidSerializer {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
exports.FluidSerializer = FluidSerializer;
|
|
145
|
-
//# sourceMappingURL=serializer.
|
|
145
|
+
//# sourceMappingURL=serializer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.cjs","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"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","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 } from \"@fluidframework/runtime-utils\";\nimport { IFluidHandle, IFluidHandleContext } from \"@fluidframework/core-interfaces\";\nimport { RemoteFluidObjectHandle } from \"./remoteObjectHandle\";\n\n/**\n * JSON serialized form of an IFluidHandle\n */\nexport interface ISerializedHandle {\n\t// Marker to indicate to JSON.parse that the object is a Fluid handle\n\ttype: \"__fluid_handle__\";\n\n\t// URL to the object. Relative URLs are relative to the handle context passed to the stringify.\n\turl: string;\n}\n\nexport const isSerializedHandle = (value: any): value is ISerializedHandle =>\n\tvalue?.type === \"__fluid_handle__\";\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 */\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"]}
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import { EventEmitterWithErrorHandling } from '@fluidframework/telemetry-utils';
|
|
2
|
+
import { IChannel } from '@fluidframework/datastore-definitions';
|
|
3
|
+
import { IChannelAttributes } from '@fluidframework/datastore-definitions';
|
|
4
|
+
import { IChannelServices } from '@fluidframework/datastore-definitions';
|
|
5
|
+
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
6
|
+
import { IErrorEvent } from '@fluidframework/core-interfaces';
|
|
7
|
+
import { IEventProvider } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { IEventThisPlaceHolder } from '@fluidframework/core-interfaces';
|
|
9
|
+
import { IExperimentalIncrementalSummaryContext } from '@fluidframework/runtime-definitions';
|
|
10
|
+
import { IFluidDataStoreRuntime } from '@fluidframework/datastore-definitions';
|
|
11
|
+
import { IFluidHandle } from '@fluidframework/core-interfaces';
|
|
12
|
+
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
|
|
13
|
+
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
|
|
14
|
+
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
15
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
16
|
+
import { ITelemetryContext } from '@fluidframework/runtime-definitions';
|
|
17
|
+
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Create a new summary containing one blob
|
|
21
|
+
* @param key - the key for the blob in the summary
|
|
22
|
+
* @param content - blob content
|
|
23
|
+
* @returns The summary containing the blob
|
|
24
|
+
*/
|
|
25
|
+
export declare function createSingleBlobSummary(key: string, content: string | Uint8Array): ISummaryTreeWithStats;
|
|
26
|
+
|
|
27
|
+
/* Excluded from this release type: EventEmitterEventType */
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Data Store serializer implementation
|
|
31
|
+
*/
|
|
32
|
+
export declare class FluidSerializer implements IFluidSerializer {
|
|
33
|
+
private readonly context;
|
|
34
|
+
private readonly handleParsedCb;
|
|
35
|
+
private readonly root;
|
|
36
|
+
constructor(context: IFluidHandleContext, handleParsedCb: (handle: IFluidHandle) => void);
|
|
37
|
+
get IFluidSerializer(): this;
|
|
38
|
+
/**
|
|
39
|
+
* Given a mostly-jsonable object tree that may have handle objects embedded within, will return a
|
|
40
|
+
* fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable form.
|
|
41
|
+
*
|
|
42
|
+
* The original `input` object is not mutated. This method will shallowly clone all objects in the path from
|
|
43
|
+
* the root to any replaced handles. (If no handles are found, returns the original object.)
|
|
44
|
+
*
|
|
45
|
+
* Any unbound handles encountered are bound to the provided IFluidHandle.
|
|
46
|
+
*/
|
|
47
|
+
encode(input: any, bind: IFluidHandle): any;
|
|
48
|
+
/**
|
|
49
|
+
* Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an
|
|
50
|
+
* equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.
|
|
51
|
+
*
|
|
52
|
+
* The original `input` object is not mutated. This method will shallowly clone all objects in the path from
|
|
53
|
+
* the root to any replaced handles. (If no handles are found, returns the original object.)
|
|
54
|
+
*
|
|
55
|
+
* The decoded handles are implicitly bound to the handle context of this serializer.
|
|
56
|
+
*/
|
|
57
|
+
decode(input: any): any;
|
|
58
|
+
stringify(input: any, bind: IFluidHandle): string;
|
|
59
|
+
parse(input: string): any;
|
|
60
|
+
private readonly encodeValue;
|
|
61
|
+
private readonly decodeValue;
|
|
62
|
+
private recursivelyReplace;
|
|
63
|
+
protected serializeHandle(handle: IFluidHandle, bind: IFluidHandle): {
|
|
64
|
+
type: string;
|
|
65
|
+
url: string;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export declare interface IFluidSerializer {
|
|
70
|
+
/**
|
|
71
|
+
* Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object
|
|
72
|
+
* where any embedded IFluidHandles have been replaced with a serializable form.
|
|
73
|
+
*
|
|
74
|
+
* The original `input` object is not mutated. This method will shallowly clones all objects in the path from
|
|
75
|
+
* the root to any replaced handles. (If no handles are found, returns the original object.)
|
|
76
|
+
*/
|
|
77
|
+
encode(value: any, bind: IFluidHandle): any;
|
|
78
|
+
/**
|
|
79
|
+
* Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an
|
|
80
|
+
* equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.
|
|
81
|
+
*
|
|
82
|
+
* The original `input` object is not mutated. This method will shallowly clone all objects in the path from
|
|
83
|
+
* the root to any replaced handles. (If no handles are found, returns the original object.)
|
|
84
|
+
*
|
|
85
|
+
* The decoded handles are implicitly bound to the handle context of this serializer.
|
|
86
|
+
*/
|
|
87
|
+
decode(input: any): any;
|
|
88
|
+
/**
|
|
89
|
+
* Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.
|
|
90
|
+
*/
|
|
91
|
+
stringify(value: any, bind: IFluidHandle): string;
|
|
92
|
+
/**
|
|
93
|
+
* Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid
|
|
94
|
+
* handles will be realized as part of the parse
|
|
95
|
+
*/
|
|
96
|
+
parse(value: string): any;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* JSON serialized form of an IFluidHandle
|
|
101
|
+
*/
|
|
102
|
+
export declare interface ISerializedHandle {
|
|
103
|
+
type: "__fluid_handle__";
|
|
104
|
+
url: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Base interface for shared objects from which other interfaces derive. Implemented by SharedObject
|
|
109
|
+
*/
|
|
110
|
+
export declare interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends IChannel, IEventProvider<TEvent> {
|
|
111
|
+
/**
|
|
112
|
+
* Binds the given shared object to its containing data store runtime, causing it to attach once
|
|
113
|
+
* the runtime attaches.
|
|
114
|
+
*/
|
|
115
|
+
bindToContext(): void;
|
|
116
|
+
/**
|
|
117
|
+
* Returns the GC data for this shared object. It contains a list of GC nodes that contains references to
|
|
118
|
+
* other GC nodes.
|
|
119
|
+
* @param fullGC - true to bypass optimizations and force full generation of GC data.
|
|
120
|
+
*/
|
|
121
|
+
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Events emitted by {@link ISharedObject}.
|
|
126
|
+
*/
|
|
127
|
+
export declare interface ISharedObjectEvents extends IErrorEvent {
|
|
128
|
+
/**
|
|
129
|
+
* Fires before an incoming operation (op) is applied to the shared object.
|
|
130
|
+
*
|
|
131
|
+
* @remarks Note: this should be considered an internal implementation detail. It is not recommended for external
|
|
132
|
+
* use.
|
|
133
|
+
*
|
|
134
|
+
* @eventProperty
|
|
135
|
+
*/
|
|
136
|
+
(event: "pre-op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
137
|
+
/**
|
|
138
|
+
* Fires after an incoming op is applied to the shared object.
|
|
139
|
+
*
|
|
140
|
+
* @remarks Note: this should be considered an internal implementation detail. It is not recommended for external
|
|
141
|
+
* use.
|
|
142
|
+
*
|
|
143
|
+
* @eventProperty
|
|
144
|
+
*/
|
|
145
|
+
(event: "op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export declare const isSerializedHandle: (value: any) => value is ISerializedHandle;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object
|
|
152
|
+
* where any embedded IFluidHandles have been replaced with a serializable form.
|
|
153
|
+
*
|
|
154
|
+
* The original `input` object is not mutated. This method will shallowly clones all objects in the path from
|
|
155
|
+
* the root to any replaced handles. (If no handles are found, returns the original object.)
|
|
156
|
+
*
|
|
157
|
+
* @param input - The mostly-plain object
|
|
158
|
+
* @param context - The handle context for the container
|
|
159
|
+
* @param bind - Bind any other handles we find in the object against this given handle.
|
|
160
|
+
* @returns The fully-plain object
|
|
161
|
+
*/
|
|
162
|
+
export declare function makeHandlesSerializable(value: any, serializer: IFluidSerializer, bind: IFluidHandle): any;
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Given a fully-plain object that may have serializable-form handles within, will return the mostly-plain object
|
|
166
|
+
* with handle objects created instead.
|
|
167
|
+
* @param value - The fully-plain object
|
|
168
|
+
* @param serializer - The serializer that knows how to convert serializable-form handles into handle objects
|
|
169
|
+
* @param context - The handle context for the container
|
|
170
|
+
* @returns The mostly-plain object with handle objects within
|
|
171
|
+
*/
|
|
172
|
+
export declare function parseHandles(value: any, serializer: IFluidSerializer): any;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Given a mostly-plain object that may have handle objects embedded within, return a string representation of an object
|
|
176
|
+
* where the handle objects have been replaced with a serializable form.
|
|
177
|
+
* @param value - The mostly-plain object
|
|
178
|
+
* @param serializer - The serializer that knows how to convert handles into serializable format
|
|
179
|
+
* @param context - The handle context for the container
|
|
180
|
+
* @param bind - Bind any other handles we find in the object against this given handle.
|
|
181
|
+
* @returns Result of strigifying an object
|
|
182
|
+
*/
|
|
183
|
+
export declare function serializeHandles(value: any, serializer: IFluidSerializer, bind: IFluidHandle): string | undefined;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* SharedObject with simplified, synchronous summarization and GC.
|
|
187
|
+
* DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.
|
|
188
|
+
*/
|
|
189
|
+
export declare abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends SharedObjectCore<TEvent> {
|
|
190
|
+
private readonly telemetryContextPrefix;
|
|
191
|
+
/**
|
|
192
|
+
* True while we are garbage collecting this object's data.
|
|
193
|
+
*/
|
|
194
|
+
private _isGCing;
|
|
195
|
+
/**
|
|
196
|
+
* The serializer to use to serialize / parse handles, if any.
|
|
197
|
+
*/
|
|
198
|
+
private readonly _serializer;
|
|
199
|
+
protected get serializer(): IFluidSerializer;
|
|
200
|
+
/**
|
|
201
|
+
* @param id - The id of the shared object
|
|
202
|
+
* @param runtime - The IFluidDataStoreRuntime which contains the shared object
|
|
203
|
+
* @param attributes - Attributes of the shared object
|
|
204
|
+
*/
|
|
205
|
+
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes, telemetryContextPrefix: string);
|
|
206
|
+
/**
|
|
207
|
+
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
|
|
208
|
+
*/
|
|
209
|
+
getAttachSummary(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
210
|
+
/**
|
|
211
|
+
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
|
|
212
|
+
*/
|
|
213
|
+
summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): Promise<ISummaryTreeWithStats>;
|
|
214
|
+
/**
|
|
215
|
+
* {@inheritDoc (ISharedObject:interface).getGCData}
|
|
216
|
+
*/
|
|
217
|
+
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
218
|
+
/**
|
|
219
|
+
* Calls the serializer over all data in this object that reference other GC nodes.
|
|
220
|
+
* Derived classes must override this to provide custom list of references to other GC nodes.
|
|
221
|
+
*/
|
|
222
|
+
protected processGCDataCore(serializer: SummarySerializer): void;
|
|
223
|
+
/**
|
|
224
|
+
* Gets a form of the object that can be serialized.
|
|
225
|
+
* @returns A tree representing the snapshot of the shared object.
|
|
226
|
+
*/
|
|
227
|
+
protected abstract summarizeCore(serializer: IFluidSerializer, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): ISummaryTreeWithStats;
|
|
228
|
+
private incrementTelemetryMetric;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Base class from which all shared objects derive.
|
|
233
|
+
*/
|
|
234
|
+
export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {
|
|
235
|
+
id: string;
|
|
236
|
+
protected runtime: IFluidDataStoreRuntime;
|
|
237
|
+
readonly attributes: IChannelAttributes;
|
|
238
|
+
get IFluidLoadable(): this;
|
|
239
|
+
private readonly opProcessingHelper;
|
|
240
|
+
private readonly callbacksHelper;
|
|
241
|
+
/**
|
|
242
|
+
* The handle referring to this SharedObject
|
|
243
|
+
*/
|
|
244
|
+
readonly handle: IFluidHandle;
|
|
245
|
+
/**
|
|
246
|
+
* Telemetry logger for the shared object
|
|
247
|
+
*/
|
|
248
|
+
protected readonly logger: ITelemetryLoggerExt;
|
|
249
|
+
private readonly mc;
|
|
250
|
+
/**
|
|
251
|
+
* Connection state
|
|
252
|
+
*/
|
|
253
|
+
private _connected;
|
|
254
|
+
/**
|
|
255
|
+
* Services used by the shared object
|
|
256
|
+
*/
|
|
257
|
+
private services;
|
|
258
|
+
/**
|
|
259
|
+
* True if the dds is bound to its parent.
|
|
260
|
+
*/
|
|
261
|
+
private _isBoundToContext;
|
|
262
|
+
/**
|
|
263
|
+
* Tracks error that closed this object.
|
|
264
|
+
*/
|
|
265
|
+
private closeError?;
|
|
266
|
+
/**
|
|
267
|
+
* Gets the connection state
|
|
268
|
+
* @returns The state of the connection
|
|
269
|
+
*/
|
|
270
|
+
get connected(): boolean;
|
|
271
|
+
/**
|
|
272
|
+
* @param id - The id of the shared object
|
|
273
|
+
* @param runtime - The IFluidDataStoreRuntime which contains the shared object
|
|
274
|
+
* @param attributes - Attributes of the shared object
|
|
275
|
+
*/
|
|
276
|
+
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
|
|
277
|
+
/**
|
|
278
|
+
* This function is only supposed to be called from SharedObjectCore's constructor and
|
|
279
|
+
* depends on a few things being set already. assert() calls make sure of it.
|
|
280
|
+
* @returns The telemetry sampling helpers, so the constructor can be the one to assign them
|
|
281
|
+
* to variables to avoid complaints from TypeScript.
|
|
282
|
+
*/
|
|
283
|
+
private setUpSampledTelemetryHelpers;
|
|
284
|
+
/**
|
|
285
|
+
* Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)
|
|
286
|
+
* would result in same error thrown. If called multiple times, only first error is remembered.
|
|
287
|
+
* @param error - error object that is thrown whenever an attempt is made to modify this object
|
|
288
|
+
*/
|
|
289
|
+
private closeWithError;
|
|
290
|
+
/**
|
|
291
|
+
* Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.
|
|
292
|
+
*/
|
|
293
|
+
private verifyNotClosed;
|
|
294
|
+
/**
|
|
295
|
+
* Event listener handler helper that can be used to react to exceptions thrown from event listeners
|
|
296
|
+
* It wraps error with DataProcessingError, closes this object and throws resulting error.
|
|
297
|
+
* See closeWithError() for more details
|
|
298
|
+
* Ideally such situation never happens, as consumers of DDS should never throw exceptions
|
|
299
|
+
* in event listeners (i.e. catch any of the issues and make determination on how to handle it).
|
|
300
|
+
* When such exceptions propagate through, most likely data model is no longer consistent, i.e.
|
|
301
|
+
* DDS state does not match what user sees. Because of it DDS moves to "corrupted state" and does not
|
|
302
|
+
* allow processing of ops or local changes, which very quickly results in container closure.
|
|
303
|
+
*/
|
|
304
|
+
private eventListenerErrorHandler;
|
|
305
|
+
private attachListeners;
|
|
306
|
+
/**
|
|
307
|
+
* A shared object, after construction, can either be loaded in the case that it is already part of
|
|
308
|
+
* a shared document. Or later attached if it is being newly added.
|
|
309
|
+
* @param services - Services used by the shared object
|
|
310
|
+
*/
|
|
311
|
+
load(services: IChannelServices): Promise<void>;
|
|
312
|
+
/**
|
|
313
|
+
* Initializes the object as a local, non-shared object. This object can become shared after
|
|
314
|
+
* it is attached to the document.
|
|
315
|
+
*/
|
|
316
|
+
initializeLocal(): void;
|
|
317
|
+
/**
|
|
318
|
+
* {@inheritDoc (ISharedObject:interface).bindToContext}
|
|
319
|
+
*/
|
|
320
|
+
bindToContext(): void;
|
|
321
|
+
/**
|
|
322
|
+
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}
|
|
323
|
+
*/
|
|
324
|
+
connect(services: IChannelServices): void;
|
|
325
|
+
/**
|
|
326
|
+
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}
|
|
327
|
+
*/
|
|
328
|
+
isAttached(): boolean;
|
|
329
|
+
/**
|
|
330
|
+
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
|
|
331
|
+
*/
|
|
332
|
+
abstract getAttachSummary(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): ISummaryTreeWithStats;
|
|
333
|
+
/**
|
|
334
|
+
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
|
|
335
|
+
*/
|
|
336
|
+
abstract summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
|
|
337
|
+
/**
|
|
338
|
+
* {@inheritDoc (ISharedObject:interface).getGCData}
|
|
339
|
+
*/
|
|
340
|
+
abstract getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
341
|
+
/**
|
|
342
|
+
* Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference
|
|
343
|
+
* to another object in the container.
|
|
344
|
+
* @param decodedHandle - The handle of the Fluid object that is decoded.
|
|
345
|
+
*/
|
|
346
|
+
protected handleDecoded(decodedHandle: IFluidHandle): void;
|
|
347
|
+
/**
|
|
348
|
+
* Allows the distributed data type to perform custom loading
|
|
349
|
+
* @param services - Storage used by the shared object
|
|
350
|
+
*/
|
|
351
|
+
protected abstract loadCore(services: IChannelStorageService): Promise<void>;
|
|
352
|
+
/**
|
|
353
|
+
* Allows the distributed data type to perform custom local loading.
|
|
354
|
+
*/
|
|
355
|
+
protected initializeLocalCore(): void;
|
|
356
|
+
/**
|
|
357
|
+
* Allows the distributive data type the ability to perform custom processing once an attach has happened.
|
|
358
|
+
* Also called after non-local data type get loaded.
|
|
359
|
+
*/
|
|
360
|
+
protected didAttach(): void;
|
|
361
|
+
/**
|
|
362
|
+
* Derived classes must override this to do custom processing on a remote message.
|
|
363
|
+
* @param message - The message to process
|
|
364
|
+
* @param local - True if the shared object is local
|
|
365
|
+
* @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
366
|
+
* For messages from a remote client, this will be undefined.
|
|
367
|
+
*/
|
|
368
|
+
protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): any;
|
|
369
|
+
/**
|
|
370
|
+
* Called when the object has disconnected from the delta stream.
|
|
371
|
+
*/
|
|
372
|
+
protected abstract onDisconnect(): any;
|
|
373
|
+
/**
|
|
374
|
+
* Submits a message by the local client to the runtime.
|
|
375
|
+
* @param content - Content of the message
|
|
376
|
+
* @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime
|
|
377
|
+
* and not sent to the server. This will be sent back when this message is received back from the server. This is
|
|
378
|
+
* also sent if we are asked to resubmit the message.
|
|
379
|
+
*/
|
|
380
|
+
protected submitLocalMessage(content: any, localOpMetadata?: unknown): void;
|
|
381
|
+
/**
|
|
382
|
+
* Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock
|
|
383
|
+
* that want to be part of summary but does not generate ops.
|
|
384
|
+
*/
|
|
385
|
+
protected dirty(): void;
|
|
386
|
+
/**
|
|
387
|
+
* Called when the object has fully connected to the delta stream
|
|
388
|
+
* Default implementation for DDS, override if different behavior is required.
|
|
389
|
+
*/
|
|
390
|
+
protected onConnect(): void;
|
|
391
|
+
/**
|
|
392
|
+
* Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.
|
|
393
|
+
* The default implementation here is to resubmit the same message. The client can override if different behavior
|
|
394
|
+
* is required. It can choose to resubmit the same message, submit different / multiple messages or not submit
|
|
395
|
+
* anything at all.
|
|
396
|
+
* @param content - The content of the original message.
|
|
397
|
+
* @param localOpMetadata - The local metadata associated with the original message.
|
|
398
|
+
*/
|
|
399
|
+
protected reSubmitCore(content: any, localOpMetadata: unknown): void;
|
|
400
|
+
/**
|
|
401
|
+
* Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.
|
|
402
|
+
* It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),
|
|
403
|
+
* the Promise will reject.
|
|
404
|
+
* If runtime is disposed when this call is made, executor is not run and promise is rejected right away.
|
|
405
|
+
*/
|
|
406
|
+
protected newAckBasedPromise<T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
|
|
407
|
+
private attachDeltaHandler;
|
|
408
|
+
/**
|
|
409
|
+
* Set the state of connection to services.
|
|
410
|
+
* @param connected - true if connected, false otherwise.
|
|
411
|
+
*/
|
|
412
|
+
private setConnectionState;
|
|
413
|
+
/**
|
|
414
|
+
* Handles a message being received from the remote delta server.
|
|
415
|
+
* @param message - The message to process
|
|
416
|
+
* @param local - Whether the message originated from the local client
|
|
417
|
+
* @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
418
|
+
* For messages from a remote client, this will be undefined.
|
|
419
|
+
*/
|
|
420
|
+
private process;
|
|
421
|
+
/**
|
|
422
|
+
* Called when a message has to be resubmitted. This typically happens for unacked messages after a
|
|
423
|
+
* reconnection.
|
|
424
|
+
* @param content - The content of the original message.
|
|
425
|
+
* @param localOpMetadata - The local metadata associated with the original message.
|
|
426
|
+
*/
|
|
427
|
+
private reSubmit;
|
|
428
|
+
/**
|
|
429
|
+
* Revert an op
|
|
430
|
+
*/
|
|
431
|
+
protected rollback(content: any, localOpMetadata: unknown): void;
|
|
432
|
+
/**
|
|
433
|
+
* Apply changes from an op. Used when rehydrating an attached container
|
|
434
|
+
* with pending changes. This prepares the SharedObject for seeing an ACK
|
|
435
|
+
* for the op or resubmitting the op upon reconnection.
|
|
436
|
+
* @param content - Contents of a stashed op.
|
|
437
|
+
* @returns localMetadata of the op, to be passed to process() or resubmit()
|
|
438
|
+
* when the op is ACKed or resubmitted, respectively
|
|
439
|
+
*/
|
|
440
|
+
protected abstract applyStashedOp(content: any): unknown;
|
|
441
|
+
/* Excluded from this release type: emit */
|
|
442
|
+
/**
|
|
443
|
+
* Use to emit events inside {@link SharedObjectCore}, with no telemetry measurement
|
|
444
|
+
* done on the duration of the callbacks. Simply calls `super.emit()`.
|
|
445
|
+
* @param event - Event to emit
|
|
446
|
+
* @param args - Arguments for the event
|
|
447
|
+
* @returns Whatever `super.emit()` returns.
|
|
448
|
+
*/
|
|
449
|
+
private emitInternal;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Serializer implementation for serializing handles during summary.
|
|
454
|
+
*/
|
|
455
|
+
export declare class SummarySerializer extends FluidSerializer {
|
|
456
|
+
private readonly serializedRoutes;
|
|
457
|
+
getSerializedRoutes(): string[];
|
|
458
|
+
protected serializeHandle(handle: IFluidHandle, bind: IFluidHandle): {
|
|
459
|
+
type: string;
|
|
460
|
+
url: string;
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* enum representing the possible types of a shared object
|
|
466
|
+
*/
|
|
467
|
+
export declare enum ValueType {
|
|
468
|
+
/**
|
|
469
|
+
* The value is a shared object
|
|
470
|
+
* @deprecated Instead store the handle of the shared object, rather than the shared object itself.
|
|
471
|
+
*/
|
|
472
|
+
Shared = 0,
|
|
473
|
+
/**
|
|
474
|
+
* The value is a plain JavaScript object or handle. If a plain object, it may contain handles deeper within.
|
|
475
|
+
*/
|
|
476
|
+
Plain = 1
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
export { }
|