@fluidframework/shared-object-base 0.59.2000 → 0.59.3000-67119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/handle.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ISharedObject } from "./types";
10
10
  * This object is used for already loaded (in-memory) shared object
11
11
  * and is used only for serialization purposes.
12
12
  * De-serialization process goes through FluidObjectHandle and request flow:
13
- * FluidDataStoreRuntime.request() recognizes requests in the form of '/<shared object id>'
13
+ * FluidDataStoreRuntime.request() recognizes requests in the form of '/\<shared object id\>'
14
14
  * and loads shared object.
15
15
  */
16
16
  export declare class SharedObjectHandle extends FluidObjectHandle<ISharedObject> {
package/dist/handle.js CHANGED
@@ -11,7 +11,7 @@ const datastore_1 = require("@fluidframework/datastore");
11
11
  * This object is used for already loaded (in-memory) shared object
12
12
  * and is used only for serialization purposes.
13
13
  * De-serialization process goes through FluidObjectHandle and request flow:
14
- * FluidDataStoreRuntime.request() recognizes requests in the form of '/<shared object id>'
14
+ * FluidDataStoreRuntime.request() recognizes requests in the form of '/\<shared object id\>'
15
15
  * and loads shared object.
16
16
  */
17
17
  class SharedObjectHandle extends datastore_1.FluidObjectHandle {
@@ -1 +1 @@
1
- {"version":3,"file":"handle.js","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,yDAA8D;AAG9D;;;;;;;GAOG;AACH,MAAa,kBAAmB,SAAQ,6BAAgC;IACpE;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,YACI,KAAoB,EACpB,IAAY,EACZ,YAAiC;QAEjC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,WAAW;QACd,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,WAAW,EAAE,CAAC;IACxB,CAAC;CACJ;AA9BD,gDA8BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidHandleContext,\n} from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { ISharedObject } from \"./types\";\n\n/**\n * Handle for shared object\n * This object is used for already loaded (in-memory) shared object\n * and is used only for serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * FluidDataStoreRuntime.request() recognizes requests in the form of '/<shared object id>'\n * and loads shared object.\n */\nexport class SharedObjectHandle extends FluidObjectHandle<ISharedObject> {\n /**\n * Whether services have been attached for the associated shared object.\n */\n public get isAttached(): boolean {\n return this.value.isAttached();\n }\n\n /**\n * Creates a new SharedObjectHandle.\n * @param value - The shared object this handle is for.\n * @param path - The id of the shared object. It is also the path to this object relative to the routeContext.\n * @param routeContext - The parent IFluidHandleContext that has a route to this handle.\n */\n constructor(\n value: ISharedObject,\n path: string,\n routeContext: IFluidHandleContext,\n ) {\n super(value, path, routeContext);\n }\n\n /**\n * Attaches all bound handles first (which may in turn attach further handles), then attaches this handle.\n * When attaching the handle, it registers the associated shared object.\n */\n public attachGraph(): void {\n this.value.bindToContext();\n super.attachGraph();\n }\n}\n"]}
1
+ {"version":3,"file":"handle.js","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH,yDAA8D;AAG9D;;;;;;;GAOG;AACH,MAAa,kBAAmB,SAAQ,6BAAgC;IACpE;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,YACI,KAAoB,EACpB,IAAY,EACZ,YAAiC;QAEjC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,WAAW;QACd,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,WAAW,EAAE,CAAC;IACxB,CAAC;CACJ;AA9BD,gDA8BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidHandleContext,\n} from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { ISharedObject } from \"./types\";\n\n/**\n * Handle for shared object\n * This object is used for already loaded (in-memory) shared object\n * and is used only for serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * FluidDataStoreRuntime.request() recognizes requests in the form of '/\\<shared object id\\>'\n * and loads shared object.\n */\nexport class SharedObjectHandle extends FluidObjectHandle<ISharedObject> {\n /**\n * Whether services have been attached for the associated shared object.\n */\n public get isAttached(): boolean {\n return this.value.isAttached();\n }\n\n /**\n * Creates a new SharedObjectHandle.\n * @param value - The shared object this handle is for.\n * @param path - The id of the shared object. It is also the path to this object relative to the routeContext.\n * @param routeContext - The parent IFluidHandleContext that has a route to this handle.\n */\n constructor(\n value: ISharedObject,\n path: string,\n routeContext: IFluidHandleContext,\n ) {\n super(value, path, routeContext);\n }\n\n /**\n * Attaches all bound handles first (which may in turn attach further handles), then attaches this handle.\n * When attaching the handle, it registers the associated shared object.\n */\n public attachGraph(): void {\n this.value.bindToContext();\n super.attachGraph();\n }\n}\n"]}
@@ -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 = "0.59.2000";
8
+ export declare const pkgVersion = "0.59.3000-67119";
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,cAAc,CAAC"}
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,oBAAoB,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 = "0.59.2000";
11
+ exports.pkgVersion = "0.59.3000-67119";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +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,WAAW,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 = \"0.59.2000\";\n"]}
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,iBAAiB,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 = \"0.59.3000-67119\";\n"]}
@@ -25,7 +25,7 @@ class RemoteFluidObjectHandle {
25
25
  this.absolutePath = absolutePath;
26
26
  this.routeContext = routeContext;
27
27
  this.isAttached = true;
28
- common_utils_1.assert(absolutePath.startsWith("/"), 0x19d /* "Handles should always have absolute paths" */);
28
+ (0, common_utils_1.assert)(absolutePath.startsWith("/"), 0x19d /* "Handles should always have absolute paths" */);
29
29
  }
30
30
  get IFluidRouter() { return this; }
31
31
  get IFluidHandleContext() { return this; }
@@ -40,7 +40,7 @@ class RemoteFluidObjectHandle {
40
40
  const fluidObject = response.value;
41
41
  return fluidObject;
42
42
  }
43
- throw runtime_utils_1.responseToException(response, request);
43
+ throw (0, runtime_utils_1.responseToException)(response, request);
44
44
  });
45
45
  }
46
46
  return this.objectP;
@@ -57,10 +57,10 @@ class RemoteFluidObjectHandle {
57
57
  const router = object.IFluidRouter;
58
58
  return router !== undefined
59
59
  ? router.request(request)
60
- : runtime_utils_1.create404Response(request);
60
+ : (0, runtime_utils_1.create404Response)(request);
61
61
  }
62
62
  catch (error) {
63
- return runtime_utils_1.exceptionToResponse(error);
63
+ return (0, runtime_utils_1.exceptionToResponse)(error);
64
64
  }
65
65
  }
66
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"remoteObjectHandle.js","sourceRoot":"","sources":["../src/remoteObjectHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AACtD,yEAAmE;AASnE,iEAA4G;AAE5G;;;;;;GAMG;AACH,MAAa,uBAAuB;IAQhC;;;;OAIG;IACH,YACoB,YAAoB,EACpB,YAAiC;QADjC,iBAAY,GAAZ,YAAY,CAAQ;QACpB,iBAAY,GAAZ,YAAY,CAAqB;QAVrC,eAAU,GAAG,IAAI,CAAC;QAY9B,qBAAM,CAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAClG,CAAC;IAjBD,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAC1C,IAAW,mBAAmB,KAAK,OAAO,IAA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["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { RuntimeHeaders } from \"@fluidframework/container-runtime\";\nimport {\n IFluidHandle,\n IFluidHandleContext,\n IRequest,\n IResponse,\n FluidObject,\n IFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport { create404Response, exceptionToResponse, 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 DDSs, custom\n * objects) that are stored in SharedObjects. The Data Store or SharedObject corresponding to the IFluidHandle can be\n * retrieved by calling `get` on it.\n */\nexport class RemoteFluidObjectHandle implements IFluidHandle {\n public get IFluidRouter() { return this; }\n public get IFluidHandleContext() { return this; }\n public get IFluidHandle() { return this; }\n\n public readonly isAttached = true;\n private objectP: Promise<FluidObject> | undefined;\n\n /**\n * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.\n * @param absolutePath - The absolute path to the handle from the container runtime.\n * @param routeContext - The root IFluidHandleContext that has a route to this handle.\n */\n constructor(\n public readonly absolutePath: string,\n public readonly routeContext: IFluidHandleContext,\n ) {\n assert(absolutePath.startsWith(\"/\"), 0x19d /* \"Handles should always have absolute paths\" */);\n }\n\n public async get(): Promise<any> {\n if (this.objectP === undefined) {\n // Add `viaHandle` header to distinguish from requests from non-handle paths.\n const request: IRequest = { url: this.absolutePath, headers: { [RuntimeHeaders.viaHandle]: true } };\n this.objectP = this.routeContext.resolveHandle(request)\n .then<FluidObject>((response) => {\n if (response.mimeType === \"fluid/object\") {\n const fluidObject: FluidObject = response.value;\n return fluidObject;\n }\n throw responseToException(response, request);\n });\n }\n return this.objectP;\n }\n\n public attachGraph(): void {\n return;\n }\n\n public bind(handle: IFluidHandle): void {\n handle.attachGraph();\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n try {\n const object: FluidObject<IFluidRouter> = await this.get();\n const router = object.IFluidRouter;\n\n return router !== undefined\n ? router.request(request)\n : create404Response(request);\n } catch (error) {\n return exceptionToResponse(error);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"remoteObjectHandle.js","sourceRoot":"","sources":["../src/remoteObjectHandle.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAsD;AACtD,yEAAmE;AASnE,iEAA4G;AAE5G;;;;;;GAMG;AACH,MAAa,uBAAuB;IAQhC;;;;OAIG;IACH,YACoB,YAAoB,EACpB,YAAiC;QADjC,iBAAY,GAAZ,YAAY,CAAQ;QACpB,iBAAY,GAAZ,YAAY,CAAqB;QAVrC,eAAU,GAAG,IAAI,CAAC;QAY9B,IAAA,qBAAM,EAAC,YAAY,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAClG,CAAC;IAjBD,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAC1C,IAAW,mBAAmB,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IACjD,IAAW,YAAY,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAiBnC,KAAK,CAAC,GAAG;QACZ,IAAI,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE;YAC5B,6EAA6E;YAC7E,MAAM,OAAO,GAAa,EAAE,GAAG,EAAE,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,EAAE,CAAC,kCAAc,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;YACpG,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC;iBAClD,IAAI,CAAc,CAAC,QAAQ,EAAE,EAAE;gBAC5B,IAAI,QAAQ,CAAC,QAAQ,KAAK,cAAc,EAAE;oBACtC,MAAM,WAAW,GAAgB,QAAQ,CAAC,KAAK,CAAC;oBAChD,OAAO,WAAW,CAAC;iBACtB;gBACD,MAAM,IAAA,mCAAmB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACjD,CAAC,CAAC,CAAC;SACV;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAEM,WAAW;QACd,OAAO;IACX,CAAC;IAEM,IAAI,CAAC,MAAoB;QAC5B,MAAM,CAAC,WAAW,EAAE,CAAC;IACzB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,OAAiB;QAClC,IAAI;YACA,MAAM,MAAM,GAA8B,MAAM,IAAI,CAAC,GAAG,EAAE,CAAC;YAC3D,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC;YAEnC,OAAO,MAAM,KAAK,SAAS;gBACvB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;gBACzB,CAAC,CAAC,IAAA,iCAAiB,EAAC,OAAO,CAAC,CAAC;SACpC;QAAC,OAAO,KAAK,EAAE;YACZ,OAAO,IAAA,mCAAmB,EAAC,KAAK,CAAC,CAAC;SACrC;IACL,CAAC;CACJ;AAxDD,0DAwDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/common-utils\";\nimport { RuntimeHeaders } from \"@fluidframework/container-runtime\";\nimport {\n IFluidHandle,\n IFluidHandleContext,\n IRequest,\n IResponse,\n FluidObject,\n IFluidRouter,\n} from \"@fluidframework/core-interfaces\";\nimport { create404Response, exceptionToResponse, 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 DDSs, custom\n * objects) that are stored in SharedObjects. The Data Store or SharedObject corresponding to the IFluidHandle can be\n * retrieved by calling `get` on it.\n */\nexport class RemoteFluidObjectHandle implements IFluidHandle {\n public get IFluidRouter() { return this; }\n public get IFluidHandleContext() { return this; }\n public get IFluidHandle() { return this; }\n\n public readonly isAttached = true;\n private objectP: Promise<FluidObject> | undefined;\n\n /**\n * Creates a new RemoteFluidObjectHandle when parsing an IFluidHandle.\n * @param absolutePath - The absolute path to the handle from the container runtime.\n * @param routeContext - The root IFluidHandleContext that has a route to this handle.\n */\n constructor(\n public readonly absolutePath: string,\n public readonly routeContext: IFluidHandleContext,\n ) {\n assert(absolutePath.startsWith(\"/\"), 0x19d /* \"Handles should always have absolute paths\" */);\n }\n\n public async get(): Promise<any> {\n if (this.objectP === undefined) {\n // Add `viaHandle` header to distinguish from requests from non-handle paths.\n const request: IRequest = { url: this.absolutePath, headers: { [RuntimeHeaders.viaHandle]: true } };\n this.objectP = this.routeContext.resolveHandle(request)\n .then<FluidObject>((response) => {\n if (response.mimeType === \"fluid/object\") {\n const fluidObject: FluidObject = response.value;\n return fluidObject;\n }\n throw responseToException(response, request);\n });\n }\n return this.objectP;\n }\n\n public attachGraph(): void {\n return;\n }\n\n public bind(handle: IFluidHandle): void {\n handle.attachGraph();\n }\n\n public async request(request: IRequest): Promise<IResponse> {\n try {\n const object: FluidObject<IFluidRouter> = await this.get();\n const router = object.IFluidRouter;\n\n return router !== undefined\n ? router.request(request)\n : create404Response(request);\n } catch (error) {\n return exceptionToResponse(error);\n }\n }\n}\n"]}
@@ -34,12 +34,12 @@ class FluidSerializer {
34
34
  // Otherwise returns the original 'value'. Used by 'decode()' and 'parse()'.
35
35
  this.decodeValue = (value) => {
36
36
  // If 'value' is a serialized IFluidHandle return the deserialized result.
37
- if (exports.isSerializedHandle(value)) {
37
+ if ((0, exports.isSerializedHandle)(value)) {
38
38
  // Old documents may have handles with relative path in their summaries. Convert these to absolute
39
39
  // paths. This will ensure that future summaries will have absolute paths for these handles.
40
40
  const absolutePath = value.url.startsWith("/")
41
41
  ? value.url
42
- : runtime_utils_1.generateHandleContextPath(value.url, this.context);
42
+ : (0, runtime_utils_1.generateHandleContextPath)(value.url, this.context);
43
43
  const parsedHandle = new remoteObjectHandle_1.RemoteFluidObjectHandle(absolutePath, this.root);
44
44
  this.handleParsedCb(parsedHandle);
45
45
  return parsedHandle;
@@ -1 +1 @@
1
- {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iEAAiE;AACjE,wDAAwD;AAExD,iEAA0E;AAE1E,6DAA+D;AAaxD,MAAM,kBAAkB,GAAG,CAAC,KAAU,EAA8B,EAAE,CACzE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,kBAAkB,CAAC;AAD1B,QAAA,kBAAkB,sBACQ;AAmCvC;;GAEG;AACH,MAAa,eAAe;IAGxB,YACqB,OAA4B;IAC7C,+DAA+D;IAC9C,cAA8C;QAF9C,YAAO,GAAP,OAAO,CAAqB;QAE5B,mBAAc,GAAd,cAAc,CAAgC;QA0DnE,6EAA6E;QAC7E,iFAAiF;QAChE,gBAAW,GAAG,CAAC,KAAU,EAAE,IAAkB,EAAE,EAAE;YAC9D,wCAAwC;YACxC,MAAM,MAAM,GAAG,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,YAAY,CAAC;YAEnC,yDAAyD;YACzD,OAAO,MAAM,KAAK,SAAS;gBACvB,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC;gBACpC,CAAC,CAAC,KAAK,CAAC;QAChB,CAAC,CAAC;QAEF,qFAAqF;QACrF,6EAA6E;QAC5D,gBAAW,GAAG,CAAC,KAAU,EAAE,EAAE;YAC1C,0EAA0E;YAC1E,IAAI,0BAAkB,CAAC,KAAK,CAAC,EAAE;gBAC3B,kGAAkG;gBAClG,4FAA4F;gBAC5F,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC;oBAC1C,CAAC,CAAC,KAAK,CAAC,GAAG;oBACX,CAAC,CAAC,yCAAyB,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC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BAEpB,+EAA+E;oBAC/E,oEAAoE;oBACpE,KAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;iBAC1B;aACJ;SACJ;QACD,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,KAAK,CAAC;IAC1B,CAAC;IAES,eAAe,CAAC,MAAoB,EAAE,IAAkB;QAC9D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,OAAO;YACH,IAAI,EAAE,kBAAkB;YACxB,GAAG,EAAE,MAAM,CAAC,YAAY;SAC3B,CAAC;IACN,CAAC;CACJ;AAzJD,0CAyJC","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 */\n export interface ISerializedHandle {\n // Marker to indicate to JSON.parse that the object is a Fluid handle\n type: \"__fluid_handle__\";\n\n // URL to the object. Relative URLs are relative to the handle context passed to the stringify.\n url: string;\n}\n\nexport const isSerializedHandle = (value: any): value is ISerializedHandle =>\n value?.type === \"__fluid_handle__\";\n\nexport interface IFluidSerializer {\n /**\n * Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object\n * where any embedded IFluidHandles have been replaced with a serializable form.\n *\n * The original `input` object is not mutated. This method will shallowly clones all objects in the path from\n * the root to any replaced handles. (If no handles are found, returns the original object.)\n */\n encode(value: any, bind: IFluidHandle): any;\n\n /**\n * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n *\n * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n * the root to any replaced handles. (If no handles are found, returns the original object.)\n *\n * The decoded handles are implicitly bound to the handle context of this serializer.\n */\n decode(input: any): any;\n\n /**\n * Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.\n */\n stringify(value: any, bind: IFluidHandle): string;\n\n /**\n * Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid\n * handles will be realized as part of the parse\n */\n parse(value: string): any;\n}\n\n/**\n * Data Store serializer implementation\n */\nexport class FluidSerializer implements IFluidSerializer {\n private readonly root: IFluidHandleContext;\n\n public constructor(\n private readonly context: IFluidHandleContext,\n // To be called whenever a handle is parsed by this serializer.\n private readonly handleParsedCb: (handle: IFluidHandle) => void,\n ) {\n this.root = this.context;\n while (this.root.routeContext !== undefined) {\n this.root = this.root.routeContext;\n }\n }\n\n public get IFluidSerializer() { return this; }\n\n /**\n * Given a mostly-jsonable object tree that may have handle objects embedded within, will return a\n * fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable form.\n *\n * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n * the root to any replaced handles. (If no handles are found, returns the original object.)\n *\n * Any unbound handles encountered are bound to the provided IFluidHandle.\n */\n public encode(\n input: any,\n bind: IFluidHandle,\n ) {\n // If the given 'input' cannot contain handles, return it immediately. Otherwise,\n // return the result of 'recursivelyReplace()'.\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n return !!input && typeof input === \"object\"\n ? this.recursivelyReplace(input, this.encodeValue, bind)\n : input;\n }\n\n /**\n * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n *\n * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n * the root to any replaced handles. (If no handles are found, returns the original object.)\n *\n * The decoded handles are implicitly bound to the handle context of this serializer.\n */\n public decode(input: any) {\n // If the given 'input' cannot contain handles, return it immediately. Otherwise,\n // return the result of 'recursivelyReplace()'.\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n return !!input && typeof input === \"object\"\n ? this.recursivelyReplace(input, this.decodeValue)\n : input;\n }\n\n public stringify(input: any, bind: IFluidHandle) {\n return JSON.stringify(input, (key, value) => this.encodeValue(value, bind));\n }\n\n // Parses the serialized data - context must match the context with which the JSON was stringified\n public parse(input: string) {\n return JSON.parse(input, (key, value) => this.decodeValue(value));\n }\n\n // If the given 'value' is an IFluidHandle, returns the encoded IFluidHandle.\n // Otherwise returns the original 'value'. Used by 'encode()' and 'stringify()'.\n private readonly encodeValue = (value: any, bind: IFluidHandle) => {\n // Detect if 'value' is an IFluidHandle.\n const handle = value?.IFluidHandle;\n\n // If 'value' is an IFluidHandle return its encoded form.\n return handle !== undefined\n ? this.serializeHandle(handle, bind)\n : value;\n };\n\n // If the given 'value' is an encoded IFluidHandle, returns the decoded IFluidHandle.\n // Otherwise returns the original 'value'. Used by 'decode()' and 'parse()'.\n private readonly decodeValue = (value: any) => {\n // If 'value' is a serialized IFluidHandle return the deserialized result.\n if (isSerializedHandle(value)) {\n // Old documents may have handles with relative path in their summaries. Convert these to absolute\n // paths. This will ensure that future summaries will have absolute paths for these handles.\n const absolutePath = value.url.startsWith(\"/\")\n ? value.url\n : generateHandleContextPath(value.url, this.context);\n\n const parsedHandle = new RemoteFluidObjectHandle(absolutePath, this.root);\n this.handleParsedCb(parsedHandle);\n return parsedHandle;\n } else {\n return value;\n }\n };\n\n // Invoked for non-null objects to recursively replace references to IFluidHandles.\n // Clones as-needed to avoid mutating the `input` object. If no IFluidHandes are present,\n // returns the original `input`.\n private recursivelyReplace(\n input: any,\n replacer: (input: any, context: any) => any,\n context?: any,\n ) {\n // Note: Caller is responsible for ensuring that `input` is defined / non-null.\n // (Required for Object.keys() below.)\n\n // Execute the `replace` on the current input. Note that Caller is responsible for ensuring that `input`\n // is a non-null object.\n const maybeReplaced = replacer(input, context);\n\n // If the replacer made a substitution there is no need to decscend further. IFluidHandles are always\n // leaves in the object graph.\n if (maybeReplaced !== input) {\n return maybeReplaced;\n }\n\n // Otherwise descend into the object graph looking for IFluidHandle instances.\n // eslint-disable-next-line @typescript-eslint/ban-types\n let clone: object | undefined;\n for (const key of Object.keys(input)) {\n const value = input[key];\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!!value && typeof value === \"object\") {\n // Note: Except for IFluidHandle, `input` must not contain circular references (as object must\n // be JSON serializable.) Therefore, guarding against infinite recursion here would only\n // lead to a later error when attempting to stringify().\n const replaced = this.recursivelyReplace(value, replacer, context);\n\n // If the `replaced` object is different than the original `value` then the subgraph contained one\n // or more handles. If this happens, we need to return a clone of the `input` object where the\n // current property is replaced by the `replaced` value.\n if (replaced !== value) {\n // Lazily create a shallow clone of the `input` object if we haven't done so already.\n clone = clone ?? (Array.isArray(input)\n ? [...input]\n : { ...input });\n\n // Overwrite the current property `key` in the clone with the `replaced` value.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n clone![key] = replaced;\n }\n }\n }\n return clone ?? input;\n }\n\n protected serializeHandle(handle: IFluidHandle, bind: IFluidHandle) {\n bind.bind(handle);\n return {\n type: \"__fluid_handle__\",\n url: handle.absolutePath,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"serializer.js","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,iEAAiE;AACjE,wDAAwD;AAExD,iEAA0E;AAE1E,6DAA+D;AAaxD,MAAM,kBAAkB,GAAG,CAAC,KAAU,EAA8B,EAAE,CACzE,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,MAAK,kBAAkB,CAAC;AAD1B,QAAA,kBAAkB,sBACQ;AAmCvC;;GAEG;AACH,MAAa,eAAe;IAGxB,YACqB,OAA4B;IAC7C,+DAA+D;IAC9C,cAA8C;QAF9C,YAAO,GAAP,OAAO,CAAqB;QAE5B,mBAAc,GAAd,cAAc,CAAgC;QA0DnE,6EAA6E;QAC7E,iFAAiF;QAChE,gBAAW,GAAG,CAAC,KAAU,EAAE,IAAkB,EAAE,EAAE;YAC9D,wCAAw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,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;YAClC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;YACzB,yEAAyE;YACzE,IAAI,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;gBACtC,8FAA8F;gBAC9F,+FAA+F;gBAC/F,8DAA8D;gBAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;gBAEnE,kGAAkG;gBAClG,+FAA+F;gBAC/F,wDAAwD;gBACxD,IAAI,QAAQ,KAAK,KAAK,EAAE;oBACpB,qFAAqF;oBACrF,KAAK,GAAG,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;wBAClC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;wBACZ,CAAC,mBAAM,KAAK,CAAE,CAAC,CAAC;oBAEpB,+EAA+E;oBAC/E,oEAAoE;oBACpE,KAAM,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;iBAC1B;aACJ;SACJ;QACD,OAAO,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,KAAK,CAAC;IAC1B,CAAC;IAES,eAAe,CAAC,MAAoB,EAAE,IAAkB;QAC9D,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,OAAO;YACH,IAAI,EAAE,kBAAkB;YACxB,GAAG,EAAE,MAAM,CAAC,YAAY;SAC3B,CAAC;IACN,CAAC;CACJ;AAzJD,0CAyJC","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 */\n export interface ISerializedHandle {\n // Marker to indicate to JSON.parse that the object is a Fluid handle\n type: \"__fluid_handle__\";\n\n // URL to the object. Relative URLs are relative to the handle context passed to the stringify.\n url: string;\n}\n\nexport const isSerializedHandle = (value: any): value is ISerializedHandle =>\n value?.type === \"__fluid_handle__\";\n\nexport interface IFluidSerializer {\n /**\n * Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object\n * where any embedded IFluidHandles have been replaced with a serializable form.\n *\n * The original `input` object is not mutated. This method will shallowly clones all objects in the path from\n * the root to any replaced handles. (If no handles are found, returns the original object.)\n */\n encode(value: any, bind: IFluidHandle): any;\n\n /**\n * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n *\n * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n * the root to any replaced handles. (If no handles are found, returns the original object.)\n *\n * The decoded handles are implicitly bound to the handle context of this serializer.\n */\n decode(input: any): any;\n\n /**\n * Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.\n */\n stringify(value: any, bind: IFluidHandle): string;\n\n /**\n * Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid\n * handles will be realized as part of the parse\n */\n parse(value: string): any;\n}\n\n/**\n * Data Store serializer implementation\n */\nexport class FluidSerializer implements IFluidSerializer {\n private readonly root: IFluidHandleContext;\n\n public constructor(\n private readonly context: IFluidHandleContext,\n // To be called whenever a handle is parsed by this serializer.\n private readonly handleParsedCb: (handle: IFluidHandle) => void,\n ) {\n this.root = this.context;\n while (this.root.routeContext !== undefined) {\n this.root = this.root.routeContext;\n }\n }\n\n public get IFluidSerializer() { return this; }\n\n /**\n * Given a mostly-jsonable object tree that may have handle objects embedded within, will return a\n * fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable form.\n *\n * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n * the root to any replaced handles. (If no handles are found, returns the original object.)\n *\n * Any unbound handles encountered are bound to the provided IFluidHandle.\n */\n public encode(\n input: any,\n bind: IFluidHandle,\n ) {\n // If the given 'input' cannot contain handles, return it immediately. Otherwise,\n // return the result of 'recursivelyReplace()'.\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n return !!input && typeof input === \"object\"\n ? this.recursivelyReplace(input, this.encodeValue, bind)\n : input;\n }\n\n /**\n * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n *\n * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n * the root to any replaced handles. (If no handles are found, returns the original object.)\n *\n * The decoded handles are implicitly bound to the handle context of this serializer.\n */\n public decode(input: any) {\n // If the given 'input' cannot contain handles, return it immediately. Otherwise,\n // return the result of 'recursivelyReplace()'.\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n return !!input && typeof input === \"object\"\n ? this.recursivelyReplace(input, this.decodeValue)\n : input;\n }\n\n public stringify(input: any, bind: IFluidHandle) {\n return JSON.stringify(input, (key, value) => this.encodeValue(value, bind));\n }\n\n // Parses the serialized data - context must match the context with which the JSON was stringified\n public parse(input: string) {\n return JSON.parse(input, (key, value) => this.decodeValue(value));\n }\n\n // If the given 'value' is an IFluidHandle, returns the encoded IFluidHandle.\n // Otherwise returns the original 'value'. Used by 'encode()' and 'stringify()'.\n private readonly encodeValue = (value: any, bind: IFluidHandle) => {\n // Detect if 'value' is an IFluidHandle.\n const handle = value?.IFluidHandle;\n\n // If 'value' is an IFluidHandle return its encoded form.\n return handle !== undefined\n ? this.serializeHandle(handle, bind)\n : value;\n };\n\n // If the given 'value' is an encoded IFluidHandle, returns the decoded IFluidHandle.\n // Otherwise returns the original 'value'. Used by 'decode()' and 'parse()'.\n private readonly decodeValue = (value: any) => {\n // If 'value' is a serialized IFluidHandle return the deserialized result.\n if (isSerializedHandle(value)) {\n // Old documents may have handles with relative path in their summaries. Convert these to absolute\n // paths. This will ensure that future summaries will have absolute paths for these handles.\n const absolutePath = value.url.startsWith(\"/\")\n ? value.url\n : generateHandleContextPath(value.url, this.context);\n\n const parsedHandle = new RemoteFluidObjectHandle(absolutePath, this.root);\n this.handleParsedCb(parsedHandle);\n return parsedHandle;\n } else {\n return value;\n }\n };\n\n // Invoked for non-null objects to recursively replace references to IFluidHandles.\n // Clones as-needed to avoid mutating the `input` object. If no IFluidHandes are present,\n // returns the original `input`.\n private recursivelyReplace(\n input: any,\n replacer: (input: any, context: any) => any,\n context?: any,\n ) {\n // Note: Caller is responsible for ensuring that `input` is defined / non-null.\n // (Required for Object.keys() below.)\n\n // Execute the `replace` on the current input. Note that Caller is responsible for ensuring that `input`\n // is a non-null object.\n const maybeReplaced = replacer(input, context);\n\n // If the replacer made a substitution there is no need to decscend further. IFluidHandles are always\n // leaves in the object graph.\n if (maybeReplaced !== input) {\n return maybeReplaced;\n }\n\n // Otherwise descend into the object graph looking for IFluidHandle instances.\n // eslint-disable-next-line @typescript-eslint/ban-types\n let clone: object | undefined;\n for (const key of Object.keys(input)) {\n const value = input[key];\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (!!value && typeof value === \"object\") {\n // Note: Except for IFluidHandle, `input` must not contain circular references (as object must\n // be JSON serializable.) Therefore, guarding against infinite recursion here would only\n // lead to a later error when attempting to stringify().\n const replaced = this.recursivelyReplace(value, replacer, context);\n\n // If the `replaced` object is different than the original `value` then the subgraph contained one\n // or more handles. If this happens, we need to return a clone of the `input` object where the\n // current property is replaced by the `replaced` value.\n if (replaced !== value) {\n // Lazily create a shallow clone of the `input` object if we haven't done so already.\n clone = clone ?? (Array.isArray(input)\n ? [...input]\n : { ...input });\n\n // Overwrite the current property `key` in the clone with the `replaced` value.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n clone![key] = replaced;\n }\n }\n }\n return clone ?? input;\n }\n\n protected serializeHandle(handle: IFluidHandle, bind: IFluidHandle) {\n bind.bind(handle);\n return {\n type: \"__fluid_handle__\",\n url: handle.absolutePath,\n };\n }\n}\n"]}
@@ -92,19 +92,19 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
92
92
  */
93
93
  bindToContext(): void;
94
94
  /**
95
- * {@inheritDoc (ISharedObject:interface).connect}
95
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}
96
96
  */
97
97
  connect(services: IChannelServices): void;
98
98
  /**
99
- * {@inheritDoc (ISharedObject:interface).isAttached}
99
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}
100
100
  */
101
101
  isAttached(): boolean;
102
102
  /**
103
- * {@inheritDoc (ISharedObject:interface).getAttachSummary}
103
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
104
104
  */
105
105
  abstract getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
106
106
  /**
107
- * {@inheritDoc (ISharedObject:interface).summarize}
107
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
108
108
  */
109
109
  abstract summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
110
110
  /**
@@ -198,6 +198,14 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
198
198
  * @param localOpMetadata - The local metadata associated with the original message.
199
199
  */
200
200
  private reSubmit;
201
+ /**
202
+ * Apply changes from an op. Used when rehydrating an attached container
203
+ * with pending changes. This prepares the SharedObject for seeing an ACK
204
+ * for the op or resubmitting the op upon reconnection.
205
+ * @param content - Contents of a stashed op.
206
+ * @returns localMetadata of the op, to be passed to process() or resubmit()
207
+ * when the op is ACKed or resubmitted, respectively
208
+ */
201
209
  protected abstract applyStashedOp(content: any): unknown;
202
210
  }
203
211
  /**
@@ -221,11 +229,11 @@ export declare abstract class SharedObject<TEvent extends ISharedObjectEvents =
221
229
  */
222
230
  constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
223
231
  /**
224
- * {@inheritDoc (ISharedObject:interface).getAttachSummary}
232
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
225
233
  */
226
234
  getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
227
235
  /**
228
- * {@inheritDoc (ISharedObject:interface).summarize}
236
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
229
237
  */
230
238
  summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
231
239
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sharedObject.d.ts","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EACnB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACH,sBAAsB,EACtB,qBAAqB,EACxB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAe,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAE7F,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE7D;;GAEG;AACH,8BAAsB,gBAAgB,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,CAC3F,SAAQ,6BAA6B,CAAC,MAAM,CAAE,YAAW,aAAa,CAAC,MAAM,CAAC;IA+CnE,EAAE,EAAE,MAAM;IACjB,SAAS,CAAC,OAAO,EAAE,sBAAsB;aACzB,UAAU,EAAE,kBAAkB;IAhDlD,IAAW,c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Bb,OAAO,CAAC,kBAAkB;IA4B1B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;;;;;OAMG;IACH,OAAO,CAAC,OAAO;IAOf;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;CAC3D;AAED;;;GAGG;AACH,8BAAsB,YAAY,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,CACvF,SAAQ,gBAAgB,CAAC,MAAM,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAkB;IAElC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAE/C,SAAS,KAAK,UAAU,IAAI,gBAAgB,CAW3C;IAED;;;;OAIG;gBAEC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB;IASlC;;OAEG;IACI,gBAAgB,CAAC,QAAQ,GAAE,OAAe,EAAE,UAAU,GAAE,OAAe,GAAG,qBAAqB;IAItG;;OAEG;IACU,SAAS,CAAC,QAAQ,GAAE,OAAe,EAAE,UAAU,GAAE,OAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI9G;;OAEG;IACI,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,sBAAsB;IAwBjE;;;OAGG;IACH,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,iBAAiB;IAOzD;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;CACxF"}
@@ -36,7 +36,7 @@ class SharedObjectCore extends telemetry_utils_1.EventEmitterWithErrorHandling {
36
36
  */
37
37
  this._isBoundToContext = false;
38
38
  this.handle = new handle_1.SharedObjectHandle(this, id, runtime.IFluidHandleContext);
39
- this.logger = telemetry_utils_1.ChildLogger.create(runtime.logger, undefined, { all: { sharedObjectId: uuid_1.v4() } });
39
+ this.logger = telemetry_utils_1.ChildLogger.create(runtime.logger, undefined, { all: { sharedObjectId: (0, uuid_1.v4)() } });
40
40
  this.attachListeners();
41
41
  }
42
42
  get IFluidLoadable() { return this; }
@@ -123,14 +123,14 @@ class SharedObjectCore extends telemetry_utils_1.EventEmitterWithErrorHandling {
123
123
  this.runtime.bindChannel(this);
124
124
  }
125
125
  /**
126
- * {@inheritDoc (ISharedObject:interface).connect}
126
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}
127
127
  */
128
128
  connect(services) {
129
129
  this.services = services;
130
130
  this.attachDeltaHandler();
131
131
  }
132
132
  /**
133
- * {@inheritDoc (ISharedObject:interface).isAttached}
133
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}
134
134
  */
135
135
  isAttached() {
136
136
  return this.services !== undefined && this.runtime.attachState !== container_definitions_1.AttachState.Detached;
@@ -225,7 +225,7 @@ class SharedObjectCore extends telemetry_utils_1.EventEmitterWithErrorHandling {
225
225
  }
226
226
  attachDeltaHandler() {
227
227
  // Services should already be there in case we are attaching delta handler.
228
- common_utils_1.assert(this.services !== undefined, 0x07a /* "Services should be there to attach delta handler" */);
228
+ (0, common_utils_1.assert)(this.services !== undefined, 0x07a /* "Services should be there to attach delta handler" */);
229
229
  this._isBoundToContext = true;
230
230
  // Allows objects to do any custom processing if it is attached.
231
231
  this.didAttach();
@@ -323,17 +323,17 @@ class SharedObject extends SharedObjectCore {
323
323
  * This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content
324
324
  * in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.
325
325
  */
326
- common_utils_1.assert(!this._isGCing, 0x075 /* "SummarySerializer should be used for serializing data during summary." */);
326
+ (0, common_utils_1.assert)(!this._isGCing, 0x075 /* "SummarySerializer should be used for serializing data during summary." */);
327
327
  return this._serializer;
328
328
  }
329
329
  /**
330
- * {@inheritDoc (ISharedObject:interface).getAttachSummary}
330
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
331
331
  */
332
332
  getAttachSummary(fullTree = false, trackState = false) {
333
333
  return this.summarizeCore(this.serializer);
334
334
  }
335
335
  /**
336
- * {@inheritDoc (ISharedObject:interface).summarize}
336
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
337
337
  */
338
338
  async summarize(fullTree = false, trackState = false) {
339
339
  return this.summarizeCore(this.serializer);
@@ -344,7 +344,7 @@ class SharedObject extends SharedObjectCore {
344
344
  getGCData(fullGC = false) {
345
345
  // Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles
346
346
  // in this object's data.
347
- common_utils_1.assert(!this._isGCing, 0x078 /* "Possible re-entrancy! Summary should not already be in progress." */);
347
+ (0, common_utils_1.assert)(!this._isGCing, 0x078 /* "Possible re-entrancy! Summary should not already be in progress." */);
348
348
  this._isGCing = true;
349
349
  let gcData;
350
350
  try {
@@ -353,7 +353,7 @@ class SharedObject extends SharedObjectCore {
353
353
  // The GC data for this shared object contains a single GC node. The outbound routes of this node are the
354
354
  // routes of handles serialized during summarization.
355
355
  gcData = { gcNodes: { "/": serializer.getSerializedRoutes() } };
356
- common_utils_1.assert(this._isGCing, 0x079 /* "Possible re-entrancy! Summary should have been in progress." */);
356
+ (0, common_utils_1.assert)(this._isGCing, 0x079 /* "Possible re-entrancy! Summary should have been in progress." */);
357
357
  }
358
358
  finally {
359
359
  this._isGCing = false;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedObject.js","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAElC,+DAA6E;AAC7E,iFAAoE;AAapE,qEAA6F;AAC7F,qEAAsE;AACtE,6CAAiE;AACjE,qCAA8C;AAC9C,2DAAwD;AAGxD;;GAEG;AACH,MAAsB,gBAClB,SAAQ,+CAAqC;IAyC7C;;;;OAIG;IACH,YACW,EAAU,EACP,OAA+B,EACz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AAE,EAAE,CAAC;YAChE,qBAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,mEAAmE,CAAC,CAAC;SACpG;gBAAS;YACN,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;SACzB;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;OAGG;IACO,iBAAiB,CAAC,UAA6B;QACrD,wGAAwG;QACxG,2GAA2G;QAC3G,+DAA+D;QAC/D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;CAOJ;AApGD,oCAoGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, EventEmitterEventType } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IGarbageCollectionData,\n ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, EventEmitterWithErrorHandling } from \"@fluidframework/telemetry-utils\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { FluidSerializer, IFluidSerializer } from \"./serializer\";\nimport { SharedObjectHandle } from \"./handle\";\nimport { SummarySerializer } from \"./summarySerializer\";\nimport { ISharedObject, ISharedObjectEvents } from \"./types\";\n\n/**\n * Base class from which all shared objects derive\n */\nexport abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {\n public get IFluidLoadable() { return this; }\n\n /**\n * The handle referring to this SharedObject\n */\n public readonly handle: IFluidHandle;\n\n /**\n * Telemetry logger for the shared object\n */\n protected readonly logger: ITelemetryLogger;\n\n /**\n * Connection state\n */\n private _connected = false;\n\n /**\n * Services used by the shared object\n */\n private services: IChannelServices | undefined;\n\n /**\n * True if the dds is bound to its parent.\n */\n private _isBoundToContext: boolean = false;\n\n /**\n * Tracks error that closed this object.\n */\n private closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n /**\n * Gets the connection state\n * @returns The state of the connection\n */\n public get connected(): boolean {\n return this._connected;\n }\n\n /**\n * @param id - The id of the shared object\n * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n * @param attributes - Attributes of the shared object\n */\n constructor(\n public id: string,\n protected runtime: IFluidDataStoreRuntime,\n public readonly attributes: IChannelAttributes)\n {\n super((event: EventEmitterEventType, e: any) => this.eventListenerErrorHandler(event, e));\n\n this.handle = new SharedObjectHandle(\n this,\n id,\n runtime.IFluidHandleContext);\n\n this.logger = ChildLogger.create(\n runtime.logger,\n undefined,\n { all: { sharedObjectId: uuid() } },\n );\n\n this.attachListeners();\n }\n\n /**\n * Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)\n * would result in same error thrown. If called multiple times, only first error is remembered.\n * @param error - error object that is thrown whenever an attempt is made to modify this object\n */\n private closeWithError(error: any) {\n if (this.closeError === undefined) {\n this.closeError = error;\n }\n }\n\n /**\n * Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.\n */\n private verifyNotClosed() {\n if (this.closeError !== undefined) {\n throw this.closeError;\n }\n }\n\n /**\n * Event listener handler helper that can be used to react to exceptions thrown from event listeners\n * It wraps error with DataProcessingError, closes this object and throws resulting error.\n * See closeWithError() for more details\n * Ideally such situation never happens, as consumers of DDS should never throw exceptions\n * in event listeners (i.e. catch any of the issues and make determination on how to handle it).\n * When such exceptions propagate through, most likely data model is no longer consistent, i.e.\n * DDS state does not match what user sees. Because of it DDS moves to \"corrupted state\" and does not\n * allow processing of ops or local changes, which very quickly results in container closure.\n */\n private eventListenerErrorHandler(event: EventEmitterEventType, e: any) {\n const error = DataProcessingError.wrapIfUnrecognized(\n e,\n \"SharedObjectEventListenerException\");\n error.addTelemetryProperties({ emittedEventName: String(event) });\n\n this.closeWithError(error);\n throw error;\n }\n\n private attachListeners() {\n // Only listen to these events if not attached.\n if (!this.isAttached()) {\n this.runtime.once(\"attaching\", () => {\n // Calling this will let the dds to do any custom processing based on attached\n // like starting generating ops.\n this.didAttach();\n });\n }\n }\n\n /**\n * A shared object, after construction, can either be loaded in the case that it is already part of\n * a shared document. Or later attached if it is being newly added.\n * @param services - Services used by the shared object\n */\n public async load(services: IChannelServices): Promise<void> {\n if (this.runtime.attachState !== AttachState.Detached) {\n this.services = services;\n }\n await this.loadCore(services.objectStorage);\n if (this.runtime.attachState !== AttachState.Detached) {\n this.attachDeltaHandler();\n }\n }\n\n /**\n * Initializes the object as a local, non-shared object. This object can become shared after\n * it is attached to the document.\n */\n public initializeLocal(): void {\n this.initializeLocalCore();\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).bindToContext}\n */\n public bindToContext(): void {\n if (this._isBoundToContext) {\n return;\n }\n\n this._isBoundToContext = true;\n\n this.runtime.bindChannel(this);\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).connect}\n */\n public connect(services: IChannelServices) {\n this.services = services;\n this.attachDeltaHandler();\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).isAttached}\n */\n public isAttached(): boolean {\n return this.services !== undefined && this.runtime.attachState !== AttachState.Detached;\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).getAttachSummary}\n */\n public abstract getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;\n\n /**\n * {@inheritDoc (ISharedObject:interface).summarize}\n */\n public abstract summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;\n\n /**\n * {@inheritDoc (ISharedObject:interface).getGCData}\n */\n public abstract getGCData(fullGC?: boolean): IGarbageCollectionData;\n\n /**\n * Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference\n * to another object in the container.\n * @param decodedHandle - The handle of the Fluid object that is decoded.\n */\n protected handleDecoded(decodedHandle: IFluidHandle) {\n if (this.isAttached()) {\n // This represents an outbound reference from this object to the node represented by decodedHandle.\n this.services?.deltaConnection.addedGCOutboundReference?.(this.handle, decodedHandle);\n }\n }\n\n /**\n * Allows the distributed data type to perform custom loading\n * @param services - Storage used by the shared object\n */\n protected abstract loadCore(services: IChannelStorageService): Promise<void>;\n\n /**\n * Allows the distributed data type to perform custom local loading.\n */\n protected initializeLocalCore() {\n return;\n }\n\n /**\n * Allows the distributive data type the ability to perform custom processing once an attach has happened.\n * Also called after non-local data type get loaded.\n */\n protected didAttach() {\n return;\n }\n\n /**\n * Derived classes must override this to do custom processing on a remote message.\n * @param message - The message to process\n * @param local - True if the shared object is local\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown);\n\n /**\n * Called when the object has disconnected from the delta stream.\n */\n protected abstract onDisconnect();\n\n /**\n * Submits a message by the local client to the runtime.\n * @param content - Content of the message\n * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n */\n protected submitLocalMessage(content: any, localOpMetadata: unknown = undefined): void {\n this.verifyNotClosed();\n if (this.isAttached()) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.services!.deltaConnection.submit(content, localOpMetadata);\n }\n }\n\n /**\n * Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock\n * that want to be part of summary but does not generate ops.\n */\n protected dirty(): void {\n if (!this.isAttached()) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.services!.deltaConnection.dirty();\n }\n\n /**\n * Called when the object has fully connected to the delta stream\n * Default implementation for DDS, override if different behavior is required.\n */\n protected onConnect() { }\n\n /**\n * Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.\n * The default implementation here is to resubmit the same message. The client can override if different behavior\n * is required. It can choose to resubmit the same message, submit different / multiple messages or not submit\n * anything at all.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.submitLocalMessage(content, localOpMetadata);\n }\n\n /**\n * Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.\n * It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),\n * the Promise will reject.\n * If runtime is disposed when this call is made, executor is not run and promise is rejected right away.\n */\n protected async newAckBasedPromise<T>(\n executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void,\n ): Promise<T> {\n let rejectBecauseDispose: () => void;\n return new Promise<T>((resolve, reject) => {\n rejectBecauseDispose =\n () => reject(new Error(\"FluidDataStoreRuntime disposed while this ack-based Promise was pending\"));\n\n if (this.runtime.disposed) {\n rejectBecauseDispose();\n return;\n }\n\n this.runtime.on(\"dispose\", rejectBecauseDispose);\n executor(resolve, reject);\n }).finally(() => {\n // Note: rejectBecauseDispose will never be undefined here\n this.runtime.off(\"dispose\", rejectBecauseDispose);\n });\n }\n\n private attachDeltaHandler() {\n // Services should already be there in case we are attaching delta handler.\n assert(this.services !== undefined, 0x07a /* \"Services should be there to attach delta handler\" */);\n this._isBoundToContext = true;\n // Allows objects to do any custom processing if it is attached.\n this.didAttach();\n\n // attachDeltaHandler is only called after services is assigned\n this.services.deltaConnection.attach({\n process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => {\n this.process(message, local, localOpMetadata);\n },\n setConnectionState: (connected: boolean) => {\n this.setConnectionState(connected);\n },\n reSubmit: (content: any, localOpMetadata: unknown) => {\n this.reSubmit(content, localOpMetadata);\n },\n applyStashedOp: (content: any): unknown => {\n return this.applyStashedOp(content);\n },\n });\n\n // Trigger initial state\n // attachDeltaHandler is only called after services is assigned\n this.setConnectionState(this.services.deltaConnection.connected);\n }\n\n /**\n * Set the state of connection to services.\n * @param connected - true if connected, false otherwise.\n */\n private setConnectionState(connected: boolean) {\n if (this._connected === connected) {\n // Not changing state, nothing the same.\n return;\n }\n\n // Should I change the state at the end? So that we *can't* send new stuff before we send old?\n this._connected = connected;\n\n if (!connected) {\n // Things that are true now...\n // - if we had a connection we can no longer send messages over it\n // - if we had outbound messages some may or may not be ACK'd. Won't know until next message\n //\n // - nack could get a new msn - but might as well do it in the join?\n this.onDisconnect();\n } else {\n // Call this for now so that DDSes like ConsensesOrderedCollection that maintain their own pending\n // messages will work.\n this.onConnect();\n }\n }\n\n /**\n * Handles a message being received from the remote delta server.\n * @param message - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n private process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed(); // This will result in container closure.\n this.emit(\"pre-op\", message, local, this);\n this.processCore(message, local, localOpMetadata);\n this.emit(\"op\", message, local, this);\n }\n\n /**\n * Called when a message has to be resubmitted. This typically happens for unacked messages after a\n * reconnection.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n private reSubmit(content: any, localOpMetadata: unknown) {\n this.reSubmitCore(content, localOpMetadata);\n }\n\n protected abstract applyStashedOp(content: any): unknown;\n}\n\n/**\n * SharedObject with simplified, synchronous summarization and GC.\n * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.\n */\nexport abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends SharedObjectCore<TEvent> {\n /**\n * True while we are garbage collecting this object's data.\n */\n private _isGCing: boolean = false;\n\n /**\n * The serializer to use to serialize / parse handles, if any.\n */\n private readonly _serializer: IFluidSerializer;\n\n protected get serializer(): IFluidSerializer {\n /**\n * During garbage collection, the SummarySerializer keeps track of IFluidHandles that are serialized. These\n * handles represent references to other Fluid objects.\n *\n * This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content\n * in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.\n */\n assert(!this._isGCing,\n 0x075 /* \"SummarySerializer should be used for serializing data during summary.\" */);\n return this._serializer;\n }\n\n /**\n * @param id - The id of the shared object\n * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n * @param attributes - Attributes of the shared object\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes)\n {\n super(id, runtime, attributes);\n\n this._serializer = new FluidSerializer(\n this.runtime.channelsRoutingContext,\n (handle: IFluidHandle) => this.handleDecoded(handle),\n );\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).getAttachSummary}\n */\n public getAttachSummary(fullTree: boolean = false, trackState: boolean = false): ISummaryTreeWithStats {\n return this.summarizeCore(this.serializer);\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).summarize}\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummaryTreeWithStats> {\n return this.summarizeCore(this.serializer);\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).getGCData}\n */\n public getGCData(fullGC: boolean = false): IGarbageCollectionData {\n // Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles\n // in this object's data.\n assert(!this._isGCing, 0x078 /* \"Possible re-entrancy! Summary should not already be in progress.\" */);\n this._isGCing = true;\n\n let gcData: IGarbageCollectionData;\n try {\n const serializer = new SummarySerializer(\n this.runtime.channelsRoutingContext,\n (handle: IFluidHandle) => this.handleDecoded(handle),\n );\n this.processGCDataCore(serializer);\n // The GC data for this shared object contains a single GC node. The outbound routes of this node are the\n // routes of handles serialized during summarization.\n gcData = { gcNodes: { \"/\": serializer.getSerializedRoutes() } };\n assert(this._isGCing, 0x079 /* \"Possible re-entrancy! Summary should have been in progress.\" */);\n } finally {\n this._isGCing = false;\n }\n\n return gcData;\n }\n\n /**\n * Calls the serializer over all data in this object that reference other GC nodes.\n * Derived classes must override this to provide custom list of references to other GC nodes.\n */\n protected processGCDataCore(serializer: SummarySerializer) {\n // We run the full summarize logic to get the list of outbound routes from this object. This is a little\n // expensive but its okay for now. It will be updated to not use full summarize and make it more efficient.\n // See: https://github.com/microsoft/FluidFramework/issues/4547\n this.summarizeCore(serializer);\n }\n\n /**\n * Gets a form of the object that can be serialized.\n * @returns A tree representing the snapshot of the shared object.\n */\n protected abstract summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;\n}\n"]}
1
+ {"version":3,"file":"sharedObject.js","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+BAAkC;AAElC,+DAA6E;AAC7E,iFAAoE;AAapE,qEAA6F;AAC7F,qEAAsE;AACtE,6CAAiE;AACjE,qCAA8C;AAC9C,2DAAwD;AAGxD;;GAEG;AACH,MAAsB,gBAClB,SAAQ,+CAAqC;IAyC7C;;;;OAIG;IACH,YACW,EAAU,EACP,OAA+B,EACzB,UAA8B;QAC9C,KAAK,CAAC,CAAC,KAA4B,EAAE,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAHnF,OAAE,GAAF,EAAE,CAAQ;QACP,YAAO,GAAP,OAAO,CAAwB;QACzB,eAAU,GAAV,UAAU,CAAoB;QApClD;;WAEG;QACK,eAAU,GAAG,KAAK,CAAC;QAO3B;;WAEG;QACK,sBAAiB,GAAY,KAAK,CAAC;QA0BvC,IAAI,CAAC,MAAM,GAAG,IAAI,2BAAkB,CAChC,IAAI,EACJ,EAAE,EACF,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAEjC,IAAI,CAAC,MAAM,GAAG,6BAAW,CAAC,MAAM,CAC5B,OAAO,CAAC,MAAM,EACd,SAAS,EACT,EAAE,GAAG,EAAE,EAAE,cAAc,EAAE,IAAA,SAAI,GAAE,EAAE,EAAE,CACtC,CAAC;QAEF,IAAI,CAAC,eA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AAsB,KAAK;QACzE,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;IAED;;OAEG;IACI,SAAS,CAAC,SAAkB,KAAK;QACpC,4GAA4G;QAC5G,yBAAyB;QACzB,IAAA,qBAAM,EAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,wEAAwE,CAAC,CAAC;QACvG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QAErB,IAAI,MAA8B,CAAC;QACnC,IAAI;YACA,MAAM,UAAU,GAAG,IAAI,qCAAiB,CACpC,IAAI,CAAC,OAAO,CAAC,sBAAsB,EACnC,CAAC,MAAoB,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CACvD,CAAC;YACF,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;YACnC,yGAAyG;YACzG,qDAAqD;YACrD,MAAM,GAAG,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,UAAU,CAAC,mBAAmB,EAAE,EAAE,EAAE,CAAC;YAChE,IAAA,qBAAM,EAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,mEAAmE,CAAC,CAAC;SACpG;gBAAS;YACN,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;SACzB;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;OAGG;IACO,iBAAiB,CAAC,UAA6B;QACrD,wGAAwG;QACxG,2GAA2G;QAC3G,+DAA+D;QAC/D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;CAOJ;AAnGD,oCAmGC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, EventEmitterEventType } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IGarbageCollectionData,\n ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, EventEmitterWithErrorHandling } from \"@fluidframework/telemetry-utils\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { FluidSerializer, IFluidSerializer } from \"./serializer\";\nimport { SharedObjectHandle } from \"./handle\";\nimport { SummarySerializer } from \"./summarySerializer\";\nimport { ISharedObject, ISharedObjectEvents } from \"./types\";\n\n/**\n * Base class from which all shared objects derive\n */\nexport abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {\n public get IFluidLoadable() { return this; }\n\n /**\n * The handle referring to this SharedObject\n */\n public readonly handle: IFluidHandle;\n\n /**\n * Telemetry logger for the shared object\n */\n protected readonly logger: ITelemetryLogger;\n\n /**\n * Connection state\n */\n private _connected = false;\n\n /**\n * Services used by the shared object\n */\n private services: IChannelServices | undefined;\n\n /**\n * True if the dds is bound to its parent.\n */\n private _isBoundToContext: boolean = false;\n\n /**\n * Tracks error that closed this object.\n */\n private closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n /**\n * Gets the connection state\n * @returns The state of the connection\n */\n public get connected(): boolean {\n return this._connected;\n }\n\n /**\n * @param id - The id of the shared object\n * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n * @param attributes - Attributes of the shared object\n */\n constructor(\n public id: string,\n protected runtime: IFluidDataStoreRuntime,\n public readonly attributes: IChannelAttributes) {\n super((event: EventEmitterEventType, e: any) => this.eventListenerErrorHandler(event, e));\n\n this.handle = new SharedObjectHandle(\n this,\n id,\n runtime.IFluidHandleContext);\n\n this.logger = ChildLogger.create(\n runtime.logger,\n undefined,\n { all: { sharedObjectId: uuid() } },\n );\n\n this.attachListeners();\n }\n\n /**\n * Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)\n * would result in same error thrown. If called multiple times, only first error is remembered.\n * @param error - error object that is thrown whenever an attempt is made to modify this object\n */\n private closeWithError(error: any) {\n if (this.closeError === undefined) {\n this.closeError = error;\n }\n }\n\n /**\n * Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.\n */\n private verifyNotClosed() {\n if (this.closeError !== undefined) {\n throw this.closeError;\n }\n }\n\n /**\n * Event listener handler helper that can be used to react to exceptions thrown from event listeners\n * It wraps error with DataProcessingError, closes this object and throws resulting error.\n * See closeWithError() for more details\n * Ideally such situation never happens, as consumers of DDS should never throw exceptions\n * in event listeners (i.e. catch any of the issues and make determination on how to handle it).\n * When such exceptions propagate through, most likely data model is no longer consistent, i.e.\n * DDS state does not match what user sees. Because of it DDS moves to \"corrupted state\" and does not\n * allow processing of ops or local changes, which very quickly results in container closure.\n */\n private eventListenerErrorHandler(event: EventEmitterEventType, e: any) {\n const error = DataProcessingError.wrapIfUnrecognized(\n e,\n \"SharedObjectEventListenerException\");\n error.addTelemetryProperties({ emittedEventName: String(event) });\n\n this.closeWithError(error);\n throw error;\n }\n\n private attachListeners() {\n // Only listen to these events if not attached.\n if (!this.isAttached()) {\n this.runtime.once(\"attaching\", () => {\n // Calling this will let the dds to do any custom processing based on attached\n // like starting generating ops.\n this.didAttach();\n });\n }\n }\n\n /**\n * A shared object, after construction, can either be loaded in the case that it is already part of\n * a shared document. Or later attached if it is being newly added.\n * @param services - Services used by the shared object\n */\n public async load(services: IChannelServices): Promise<void> {\n if (this.runtime.attachState !== AttachState.Detached) {\n this.services = services;\n }\n await this.loadCore(services.objectStorage);\n if (this.runtime.attachState !== AttachState.Detached) {\n this.attachDeltaHandler();\n }\n }\n\n /**\n * Initializes the object as a local, non-shared object. This object can become shared after\n * it is attached to the document.\n */\n public initializeLocal(): void {\n this.initializeLocalCore();\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).bindToContext}\n */\n public bindToContext(): void {\n if (this._isBoundToContext) {\n return;\n }\n\n this._isBoundToContext = true;\n\n this.runtime.bindChannel(this);\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}\n */\n public connect(services: IChannelServices) {\n this.services = services;\n this.attachDeltaHandler();\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}\n */\n public isAttached(): boolean {\n return this.services !== undefined && this.runtime.attachState !== AttachState.Detached;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n */\n public abstract getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n */\n public abstract summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;\n\n /**\n * {@inheritDoc (ISharedObject:interface).getGCData}\n */\n public abstract getGCData(fullGC?: boolean): IGarbageCollectionData;\n\n /**\n * Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference\n * to another object in the container.\n * @param decodedHandle - The handle of the Fluid object that is decoded.\n */\n protected handleDecoded(decodedHandle: IFluidHandle) {\n if (this.isAttached()) {\n // This represents an outbound reference from this object to the node represented by decodedHandle.\n this.services?.deltaConnection.addedGCOutboundReference?.(this.handle, decodedHandle);\n }\n }\n\n /**\n * Allows the distributed data type to perform custom loading\n * @param services - Storage used by the shared object\n */\n protected abstract loadCore(services: IChannelStorageService): Promise<void>;\n\n /**\n * Allows the distributed data type to perform custom local loading.\n */\n protected initializeLocalCore() {\n return;\n }\n\n /**\n * Allows the distributive data type the ability to perform custom processing once an attach has happened.\n * Also called after non-local data type get loaded.\n */\n protected didAttach() {\n return;\n }\n\n /**\n * Derived classes must override this to do custom processing on a remote message.\n * @param message - The message to process\n * @param local - True if the shared object is local\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown);\n\n /**\n * Called when the object has disconnected from the delta stream.\n */\n protected abstract onDisconnect();\n\n /**\n * Submits a message by the local client to the runtime.\n * @param content - Content of the message\n * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n */\n protected submitLocalMessage(content: any, localOpMetadata: unknown = undefined): void {\n this.verifyNotClosed();\n if (this.isAttached()) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.services!.deltaConnection.submit(content, localOpMetadata);\n }\n }\n\n /**\n * Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock\n * that want to be part of summary but does not generate ops.\n */\n protected dirty(): void {\n if (!this.isAttached()) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.services!.deltaConnection.dirty();\n }\n\n /**\n * Called when the object has fully connected to the delta stream\n * Default implementation for DDS, override if different behavior is required.\n */\n protected onConnect() { }\n\n /**\n * Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.\n * The default implementation here is to resubmit the same message. The client can override if different behavior\n * is required. It can choose to resubmit the same message, submit different / multiple messages or not submit\n * anything at all.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.submitLocalMessage(content, localOpMetadata);\n }\n\n /**\n * Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.\n * It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),\n * the Promise will reject.\n * If runtime is disposed when this call is made, executor is not run and promise is rejected right away.\n */\n protected async newAckBasedPromise<T>(\n executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void,\n ): Promise<T> {\n let rejectBecauseDispose: () => void;\n return new Promise<T>((resolve, reject) => {\n rejectBecauseDispose =\n () => reject(new Error(\"FluidDataStoreRuntime disposed while this ack-based Promise was pending\"));\n\n if (this.runtime.disposed) {\n rejectBecauseDispose();\n return;\n }\n\n this.runtime.on(\"dispose\", rejectBecauseDispose);\n executor(resolve, reject);\n }).finally(() => {\n // Note: rejectBecauseDispose will never be undefined here\n this.runtime.off(\"dispose\", rejectBecauseDispose);\n });\n }\n\n private attachDeltaHandler() {\n // Services should already be there in case we are attaching delta handler.\n assert(this.services !== undefined, 0x07a /* \"Services should be there to attach delta handler\" */);\n this._isBoundToContext = true;\n // Allows objects to do any custom processing if it is attached.\n this.didAttach();\n\n // attachDeltaHandler is only called after services is assigned\n this.services.deltaConnection.attach({\n process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => {\n this.process(message, local, localOpMetadata);\n },\n setConnectionState: (connected: boolean) => {\n this.setConnectionState(connected);\n },\n reSubmit: (content: any, localOpMetadata: unknown) => {\n this.reSubmit(content, localOpMetadata);\n },\n applyStashedOp: (content: any): unknown => {\n return this.applyStashedOp(content);\n },\n });\n\n // Trigger initial state\n // attachDeltaHandler is only called after services is assigned\n this.setConnectionState(this.services.deltaConnection.connected);\n }\n\n /**\n * Set the state of connection to services.\n * @param connected - true if connected, false otherwise.\n */\n private setConnectionState(connected: boolean) {\n if (this._connected === connected) {\n // Not changing state, nothing the same.\n return;\n }\n\n // Should I change the state at the end? So that we *can't* send new stuff before we send old?\n this._connected = connected;\n\n if (!connected) {\n // Things that are true now...\n // - if we had a connection we can no longer send messages over it\n // - if we had outbound messages some may or may not be ACK'd. Won't know until next message\n //\n // - nack could get a new msn - but might as well do it in the join?\n this.onDisconnect();\n } else {\n // Call this for now so that DDSes like ConsensesOrderedCollection that maintain their own pending\n // messages will work.\n this.onConnect();\n }\n }\n\n /**\n * Handles a message being received from the remote delta server.\n * @param message - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n private process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed(); // This will result in container closure.\n this.emit(\"pre-op\", message, local, this);\n this.processCore(message, local, localOpMetadata);\n this.emit(\"op\", message, local, this);\n }\n\n /**\n * Called when a message has to be resubmitted. This typically happens for unacked messages after a\n * reconnection.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n private reSubmit(content: any, localOpMetadata: unknown) {\n this.reSubmitCore(content, localOpMetadata);\n }\n\n /**\n * Apply changes from an op. Used when rehydrating an attached container\n * with pending changes. This prepares the SharedObject for seeing an ACK\n * for the op or resubmitting the op upon reconnection.\n * @param content - Contents of a stashed op.\n * @returns localMetadata of the op, to be passed to process() or resubmit()\n * when the op is ACKed or resubmitted, respectively\n */\n protected abstract applyStashedOp(content: any): unknown;\n}\n\n/**\n * SharedObject with simplified, synchronous summarization and GC.\n * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.\n */\nexport abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends SharedObjectCore<TEvent> {\n /**\n * True while we are garbage collecting this object's data.\n */\n private _isGCing: boolean = false;\n\n /**\n * The serializer to use to serialize / parse handles, if any.\n */\n private readonly _serializer: IFluidSerializer;\n\n protected get serializer(): IFluidSerializer {\n /**\n * During garbage collection, the SummarySerializer keeps track of IFluidHandles that are serialized. These\n * handles represent references to other Fluid objects.\n *\n * This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content\n * in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.\n */\n assert(!this._isGCing,\n 0x075 /* \"SummarySerializer should be used for serializing data during summary.\" */);\n return this._serializer;\n }\n\n /**\n * @param id - The id of the shared object\n * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n * @param attributes - Attributes of the shared object\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes) {\n super(id, runtime, attributes);\n\n this._serializer = new FluidSerializer(\n this.runtime.channelsRoutingContext,\n (handle: IFluidHandle) => this.handleDecoded(handle),\n );\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n */\n public getAttachSummary(fullTree: boolean = false, trackState: boolean = false): ISummaryTreeWithStats {\n return this.summarizeCore(this.serializer);\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummaryTreeWithStats> {\n return this.summarizeCore(this.serializer);\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).getGCData}\n */\n public getGCData(fullGC: boolean = false): IGarbageCollectionData {\n // Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles\n // in this object's data.\n assert(!this._isGCing, 0x078 /* \"Possible re-entrancy! Summary should not already be in progress.\" */);\n this._isGCing = true;\n\n let gcData: IGarbageCollectionData;\n try {\n const serializer = new SummarySerializer(\n this.runtime.channelsRoutingContext,\n (handle: IFluidHandle) => this.handleDecoded(handle),\n );\n this.processGCDataCore(serializer);\n // The GC data for this shared object contains a single GC node. The outbound routes of this node are the\n // routes of handles serialized during summarization.\n gcData = { gcNodes: { \"/\": serializer.getSerializedRoutes() } };\n assert(this._isGCing, 0x079 /* \"Possible re-entrancy! Summary should have been in progress.\" */);\n } finally {\n this._isGCing = false;\n }\n\n return gcData;\n }\n\n /**\n * Calls the serializer over all data in this object that reference other GC nodes.\n * Derived classes must override this to provide custom list of references to other GC nodes.\n */\n protected processGCDataCore(serializer: SummarySerializer) {\n // We run the full summarize logic to get the list of outbound routes from this object. This is a little\n // expensive but its okay for now. It will be updated to not use full summarize and make it more efficient.\n // See: https://github.com/microsoft/FluidFramework/issues/4547\n this.summarizeCore(serializer);\n }\n\n /**\n * Gets a form of the object that can be serialized.\n * @returns A tree representing the snapshot of the shared object.\n */\n protected abstract summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;\n}\n"]}
package/dist/types.d.ts CHANGED
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from "@fluidframework/common-definitions";
6
- import { IChannel, IChannelServices } from "@fluidframework/datastore-definitions";
6
+ import { IChannel } from "@fluidframework/datastore-definitions";
7
7
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
8
- import { IGarbageCollectionData, ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
8
+ import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";
9
9
  export interface ISharedObjectEvents extends IErrorEvent {
10
10
  (event: "pre-op" | "op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
11
11
  }
@@ -18,27 +18,6 @@ export interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjec
18
18
  * the runtime attaches.
19
19
  */
20
20
  bindToContext(): void;
21
- /**
22
- * Returns whether the given shared object is attached to storage.
23
- * @returns True if the given shared object is attached
24
- */
25
- isAttached(): boolean;
26
- /**
27
- * Generates summary of the channel synchronously.
28
- * @returns A tree representing the summary of the shared object.
29
- */
30
- getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
31
- /**
32
- * Generates summary of the shared object asynchronously.
33
- * This should not be called where the object can be modified while summarization is in progress.
34
- * @returns A tree representing the summary of the channel.
35
- */
36
- summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
37
- /**
38
- * Enables the channel to send and receive ops.
39
- * @param services - Services to connect to
40
- */
41
- connect(services: IChannelServices): void;
42
21
  /**
43
22
  * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to
44
23
  * other GC nodes.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oCAA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AAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACpD,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,EACnB,QAAQ,EAAE,CAAC,EAAE,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,KAAK,IAAI,OAAE;CACzG;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,CACnF,SAAQ,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC;IACxC;;;OAGG;IACH,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;CACvD"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\nimport { IChannel, IChannelServices } from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IGarbageCollectionData, ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\n\nexport interface ISharedObjectEvents extends IErrorEvent {\n (event: \"pre-op\" | \"op\",\n listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * Base interface for shared objects from which other interfaces derive. Implemented by SharedObject\n */\nexport interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends IChannel, IEventProvider<TEvent> {\n /**\n * Binds the given shared object to its containing data store runtime, causing it to attach once\n * the runtime attaches.\n */\n bindToContext(): void;\n\n /**\n * Returns whether the given shared object is attached to storage.\n * @returns True if the given shared object is attached\n */\n isAttached(): boolean;\n\n /**\n * Generates summary of the channel synchronously.\n * @returns A tree representing the summary of the shared object.\n */\n getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;\n\n /**\n * Generates summary of the shared object asynchronously.\n * This should not be called where the object can be modified while summarization is in progress.\n * @returns A tree representing the summary of the channel.\n */\n summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;\n\n /**\n * Enables the channel to send and receive ops.\n * @param services - Services to connect to\n */\n connect(services: IChannelServices): void;\n\n /**\n * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to\n * other GC nodes.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n getGCData(fullGC?: boolean): IGarbageCollectionData;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\nimport { IChannel } from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IGarbageCollectionData } from \"@fluidframework/runtime-definitions\";\n\nexport interface ISharedObjectEvents extends IErrorEvent {\n (event: \"pre-op\" | \"op\",\n listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * Base interface for shared objects from which other interfaces derive. Implemented by SharedObject\n */\nexport interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends IChannel, IEventProvider<TEvent> {\n /**\n * Binds the given shared object to its containing data store runtime, causing it to attach once\n * the runtime attaches.\n */\n bindToContext(): void;\n\n /**\n * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to\n * other GC nodes.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n getGCData(fullGC?: boolean): IGarbageCollectionData;\n}\n"]}
package/lib/handle.d.ts CHANGED
@@ -10,7 +10,7 @@ import { ISharedObject } from "./types";
10
10
  * This object is used for already loaded (in-memory) shared object
11
11
  * and is used only for serialization purposes.
12
12
  * De-serialization process goes through FluidObjectHandle and request flow:
13
- * FluidDataStoreRuntime.request() recognizes requests in the form of '/<shared object id>'
13
+ * FluidDataStoreRuntime.request() recognizes requests in the form of '/\<shared object id\>'
14
14
  * and loads shared object.
15
15
  */
16
16
  export declare class SharedObjectHandle extends FluidObjectHandle<ISharedObject> {
package/lib/handle.js CHANGED
@@ -8,7 +8,7 @@ import { FluidObjectHandle } from "@fluidframework/datastore";
8
8
  * This object is used for already loaded (in-memory) shared object
9
9
  * and is used only for serialization purposes.
10
10
  * De-serialization process goes through FluidObjectHandle and request flow:
11
- * FluidDataStoreRuntime.request() recognizes requests in the form of '/<shared object id>'
11
+ * FluidDataStoreRuntime.request() recognizes requests in the form of '/\<shared object id\>'
12
12
  * and loads shared object.
13
13
  */
14
14
  export class SharedObjectHandle extends FluidObjectHandle {
package/lib/handle.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"handle.js","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAgC;IACpE;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,YACI,KAAoB,EACpB,IAAY,EACZ,YAAiC;QAEjC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,WAAW;QACd,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,WAAW,EAAE,CAAC;IACxB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidHandleContext,\n} from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { ISharedObject } from \"./types\";\n\n/**\n * Handle for shared object\n * This object is used for already loaded (in-memory) shared object\n * and is used only for serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * FluidDataStoreRuntime.request() recognizes requests in the form of '/<shared object id>'\n * and loads shared object.\n */\nexport class SharedObjectHandle extends FluidObjectHandle<ISharedObject> {\n /**\n * Whether services have been attached for the associated shared object.\n */\n public get isAttached(): boolean {\n return this.value.isAttached();\n }\n\n /**\n * Creates a new SharedObjectHandle.\n * @param value - The shared object this handle is for.\n * @param path - The id of the shared object. It is also the path to this object relative to the routeContext.\n * @param routeContext - The parent IFluidHandleContext that has a route to this handle.\n */\n constructor(\n value: ISharedObject,\n path: string,\n routeContext: IFluidHandleContext,\n ) {\n super(value, path, routeContext);\n }\n\n /**\n * Attaches all bound handles first (which may in turn attach further handles), then attaches this handle.\n * When attaching the handle, it registers the associated shared object.\n */\n public attachGraph(): void {\n this.value.bindToContext();\n super.attachGraph();\n }\n}\n"]}
1
+ {"version":3,"file":"handle.js","sourceRoot":"","sources":["../src/handle.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAG9D;;;;;;;GAOG;AACH,MAAM,OAAO,kBAAmB,SAAQ,iBAAgC;IACpE;;OAEG;IACH,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACnC,CAAC;IAED;;;;;OAKG;IACH,YACI,KAAoB,EACpB,IAAY,EACZ,YAAiC;QAEjC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACI,WAAW;QACd,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,CAAC;QAC3B,KAAK,CAAC,WAAW,EAAE,CAAC;IACxB,CAAC;CACJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IFluidHandleContext,\n} from \"@fluidframework/core-interfaces\";\nimport { FluidObjectHandle } from \"@fluidframework/datastore\";\nimport { ISharedObject } from \"./types\";\n\n/**\n * Handle for shared object\n * This object is used for already loaded (in-memory) shared object\n * and is used only for serialization purposes.\n * De-serialization process goes through FluidObjectHandle and request flow:\n * FluidDataStoreRuntime.request() recognizes requests in the form of '/\\<shared object id\\>'\n * and loads shared object.\n */\nexport class SharedObjectHandle extends FluidObjectHandle<ISharedObject> {\n /**\n * Whether services have been attached for the associated shared object.\n */\n public get isAttached(): boolean {\n return this.value.isAttached();\n }\n\n /**\n * Creates a new SharedObjectHandle.\n * @param value - The shared object this handle is for.\n * @param path - The id of the shared object. It is also the path to this object relative to the routeContext.\n * @param routeContext - The parent IFluidHandleContext that has a route to this handle.\n */\n constructor(\n value: ISharedObject,\n path: string,\n routeContext: IFluidHandleContext,\n ) {\n super(value, path, routeContext);\n }\n\n /**\n * Attaches all bound handles first (which may in turn attach further handles), then attaches this handle.\n * When attaching the handle, it registers the associated shared object.\n */\n public attachGraph(): void {\n this.value.bindToContext();\n super.attachGraph();\n }\n}\n"]}
@@ -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 = "0.59.2000";
8
+ export declare const pkgVersion = "0.59.3000-67119";
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,cAAc,CAAC"}
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,oBAAoB,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/shared-object-base";
8
- export const pkgVersion = "0.59.2000";
8
+ export const pkgVersion = "0.59.3000-67119";
9
9
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,oCAAoC,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,WAAW,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 = \"0.59.2000\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,oCAAoC,CAAC;AAC5D,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,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 = \"0.59.3000-67119\";\n"]}
@@ -92,19 +92,19 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
92
92
  */
93
93
  bindToContext(): void;
94
94
  /**
95
- * {@inheritDoc (ISharedObject:interface).connect}
95
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}
96
96
  */
97
97
  connect(services: IChannelServices): void;
98
98
  /**
99
- * {@inheritDoc (ISharedObject:interface).isAttached}
99
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}
100
100
  */
101
101
  isAttached(): boolean;
102
102
  /**
103
- * {@inheritDoc (ISharedObject:interface).getAttachSummary}
103
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
104
104
  */
105
105
  abstract getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
106
106
  /**
107
- * {@inheritDoc (ISharedObject:interface).summarize}
107
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
108
108
  */
109
109
  abstract summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
110
110
  /**
@@ -198,6 +198,14 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
198
198
  * @param localOpMetadata - The local metadata associated with the original message.
199
199
  */
200
200
  private reSubmit;
201
+ /**
202
+ * Apply changes from an op. Used when rehydrating an attached container
203
+ * with pending changes. This prepares the SharedObject for seeing an ACK
204
+ * for the op or resubmitting the op upon reconnection.
205
+ * @param content - Contents of a stashed op.
206
+ * @returns localMetadata of the op, to be passed to process() or resubmit()
207
+ * when the op is ACKed or resubmitted, respectively
208
+ */
201
209
  protected abstract applyStashedOp(content: any): unknown;
202
210
  }
203
211
  /**
@@ -221,11 +229,11 @@ export declare abstract class SharedObject<TEvent extends ISharedObjectEvents =
221
229
  */
222
230
  constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
223
231
  /**
224
- * {@inheritDoc (ISharedObject:interface).getAttachSummary}
232
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
225
233
  */
226
234
  getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
227
235
  /**
228
- * {@inheritDoc (ISharedObject:interface).summarize}
236
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
229
237
  */
230
238
  summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
231
239
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"sharedObject.d.ts","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EACH,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,EACnB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EACH,sBAAsB,EACtB,qBAAqB,EACxB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAe,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAE7F,OAAO,EAAmB,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE7D;;GAEG;AACH,8BAAsB,gBAAgB,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,CAC3F,SAAQ,6BAA6B,CAAC,MAAM,CAAE,YAAW,aAAa,CAAC,MAAM,CAAC;IA+CnE,EAAE,EAAE,MAAM;IACjB,SAAS,CAAC,OAAO,EAAE,sBAAsB;aACzB,UAAU,EAAE,kBAAkB;IAhDlD,IAAW,cAAc,SAAmB;IAE5C;;OAEG;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4B1B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAuB1B;;;;;;OAMG;IACH,OAAO,CAAC,OAAO;IAOf;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAIhB;;;;;;;OAOG;IACH,SAAS,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO;CAC3D;AAED;;;GAGG;AACH,8BAAsB,YAAY,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,CACvF,SAAQ,gBAAgB,CAAC,MAAM,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAkB;IAElC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmB;IAE/C,SAAS,KAAK,UAAU,IAAI,gBAAgB,CAW3C;IAED;;;;OAIG;gBAEC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,sBAAsB,EAC/B,UAAU,EAAE,kBAAkB;IASlC;;OAEG;IACI,gBAAgB,CAAC,QAAQ,GAAE,OAAe,EAAE,UAAU,GAAE,OAAe,GAAG,qBAAqB;IAItG;;OAEG;IACU,SAAS,CAAC,QAAQ,GAAE,OAAe,EAAE,UAAU,GAAE,OAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI9G;;OAEG;IACI,SAAS,CAAC,MAAM,GAAE,OAAe,GAAG,sBAAsB;IAwBjE;;;OAGG;IACH,SAAS,CAAC,iBAAiB,CAAC,UAAU,EAAE,iBAAiB;IAOzD;;;OAGG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,CAAC,UAAU,EAAE,gBAAgB,GAAG,qBAAqB;CACxF"}
@@ -120,14 +120,14 @@ export class SharedObjectCore extends EventEmitterWithErrorHandling {
120
120
  this.runtime.bindChannel(this);
121
121
  }
122
122
  /**
123
- * {@inheritDoc (ISharedObject:interface).connect}
123
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}
124
124
  */
125
125
  connect(services) {
126
126
  this.services = services;
127
127
  this.attachDeltaHandler();
128
128
  }
129
129
  /**
130
- * {@inheritDoc (ISharedObject:interface).isAttached}
130
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}
131
131
  */
132
132
  isAttached() {
133
133
  return this.services !== undefined && this.runtime.attachState !== AttachState.Detached;
@@ -323,13 +323,13 @@ export class SharedObject extends SharedObjectCore {
323
323
  return this._serializer;
324
324
  }
325
325
  /**
326
- * {@inheritDoc (ISharedObject:interface).getAttachSummary}
326
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
327
327
  */
328
328
  getAttachSummary(fullTree = false, trackState = false) {
329
329
  return this.summarizeCore(this.serializer);
330
330
  }
331
331
  /**
332
- * {@inheritDoc (ISharedObject:interface).summarize}
332
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
333
333
  */
334
334
  async summarize(fullTree = false, trackState = false) {
335
335
  return this.summarizeCore(this.serializer);
@@ -1 +1 @@
1
- {"version":3,"file":"sharedObject.js","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,MAAM,EAAyB,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAapE,OAAO,EAAE,WAAW,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;GAEG;AACH,MAAM,OAAgB,gBAClB,SAAQ,6BAAqC;IAyC7C;;;;OAIG;IACH,YACW,EAAU,EACP,OAA+B,EACzB,UA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AAM,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,mEAAmE,CAAC,CAAC;SACpG;gBAAS;YACN,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;SACzB;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;;OAGG;IACO,iBAAiB,CAAC,UAA6B;QACrD,wGAAwG;QACxG,2GAA2G;QAC3G,+DAA+D;QAC/D,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;CAOJ","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, EventEmitterEventType } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IGarbageCollectionData,\n ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, EventEmitterWithErrorHandling } from \"@fluidframework/telemetry-utils\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { FluidSerializer, IFluidSerializer } from \"./serializer\";\nimport { SharedObjectHandle } from \"./handle\";\nimport { SummarySerializer } from \"./summarySerializer\";\nimport { ISharedObject, ISharedObjectEvents } from \"./types\";\n\n/**\n * Base class from which all shared objects derive\n */\nexport abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {\n public get IFluidLoadable() { return this; }\n\n /**\n * The handle referring to this SharedObject\n */\n public readonly handle: IFluidHandle;\n\n /**\n * Telemetry logger for the shared object\n */\n protected readonly logger: ITelemetryLogger;\n\n /**\n * Connection state\n */\n private _connected = false;\n\n /**\n * Services used by the shared object\n */\n private services: IChannelServices | undefined;\n\n /**\n * True if the dds is bound to its parent.\n */\n private _isBoundToContext: boolean = false;\n\n /**\n * Tracks error that closed this object.\n */\n private closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n /**\n * Gets the connection state\n * @returns The state of the connection\n */\n public get connected(): boolean {\n return this._connected;\n }\n\n /**\n * @param id - The id of the shared object\n * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n * @param attributes - Attributes of the shared object\n */\n constructor(\n public id: string,\n protected runtime: IFluidDataStoreRuntime,\n public readonly attributes: IChannelAttributes)\n {\n super((event: EventEmitterEventType, e: any) => this.eventListenerErrorHandler(event, e));\n\n this.handle = new SharedObjectHandle(\n this,\n id,\n runtime.IFluidHandleContext);\n\n this.logger = ChildLogger.create(\n runtime.logger,\n undefined,\n { all: { sharedObjectId: uuid() } },\n );\n\n this.attachListeners();\n }\n\n /**\n * Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)\n * would result in same error thrown. If called multiple times, only first error is remembered.\n * @param error - error object that is thrown whenever an attempt is made to modify this object\n */\n private closeWithError(error: any) {\n if (this.closeError === undefined) {\n this.closeError = error;\n }\n }\n\n /**\n * Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.\n */\n private verifyNotClosed() {\n if (this.closeError !== undefined) {\n throw this.closeError;\n }\n }\n\n /**\n * Event listener handler helper that can be used to react to exceptions thrown from event listeners\n * It wraps error with DataProcessingError, closes this object and throws resulting error.\n * See closeWithError() for more details\n * Ideally such situation never happens, as consumers of DDS should never throw exceptions\n * in event listeners (i.e. catch any of the issues and make determination on how to handle it).\n * When such exceptions propagate through, most likely data model is no longer consistent, i.e.\n * DDS state does not match what user sees. Because of it DDS moves to \"corrupted state\" and does not\n * allow processing of ops or local changes, which very quickly results in container closure.\n */\n private eventListenerErrorHandler(event: EventEmitterEventType, e: any) {\n const error = DataProcessingError.wrapIfUnrecognized(\n e,\n \"SharedObjectEventListenerException\");\n error.addTelemetryProperties({ emittedEventName: String(event) });\n\n this.closeWithError(error);\n throw error;\n }\n\n private attachListeners() {\n // Only listen to these events if not attached.\n if (!this.isAttached()) {\n this.runtime.once(\"attaching\", () => {\n // Calling this will let the dds to do any custom processing based on attached\n // like starting generating ops.\n this.didAttach();\n });\n }\n }\n\n /**\n * A shared object, after construction, can either be loaded in the case that it is already part of\n * a shared document. Or later attached if it is being newly added.\n * @param services - Services used by the shared object\n */\n public async load(services: IChannelServices): Promise<void> {\n if (this.runtime.attachState !== AttachState.Detached) {\n this.services = services;\n }\n await this.loadCore(services.objectStorage);\n if (this.runtime.attachState !== AttachState.Detached) {\n this.attachDeltaHandler();\n }\n }\n\n /**\n * Initializes the object as a local, non-shared object. This object can become shared after\n * it is attached to the document.\n */\n public initializeLocal(): void {\n this.initializeLocalCore();\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).bindToContext}\n */\n public bindToContext(): void {\n if (this._isBoundToContext) {\n return;\n }\n\n this._isBoundToContext = true;\n\n this.runtime.bindChannel(this);\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).connect}\n */\n public connect(services: IChannelServices) {\n this.services = services;\n this.attachDeltaHandler();\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).isAttached}\n */\n public isAttached(): boolean {\n return this.services !== undefined && this.runtime.attachState !== AttachState.Detached;\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).getAttachSummary}\n */\n public abstract getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;\n\n /**\n * {@inheritDoc (ISharedObject:interface).summarize}\n */\n public abstract summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;\n\n /**\n * {@inheritDoc (ISharedObject:interface).getGCData}\n */\n public abstract getGCData(fullGC?: boolean): IGarbageCollectionData;\n\n /**\n * Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference\n * to another object in the container.\n * @param decodedHandle - The handle of the Fluid object that is decoded.\n */\n protected handleDecoded(decodedHandle: IFluidHandle) {\n if (this.isAttached()) {\n // This represents an outbound reference from this object to the node represented by decodedHandle.\n this.services?.deltaConnection.addedGCOutboundReference?.(this.handle, decodedHandle);\n }\n }\n\n /**\n * Allows the distributed data type to perform custom loading\n * @param services - Storage used by the shared object\n */\n protected abstract loadCore(services: IChannelStorageService): Promise<void>;\n\n /**\n * Allows the distributed data type to perform custom local loading.\n */\n protected initializeLocalCore() {\n return;\n }\n\n /**\n * Allows the distributive data type the ability to perform custom processing once an attach has happened.\n * Also called after non-local data type get loaded.\n */\n protected didAttach() {\n return;\n }\n\n /**\n * Derived classes must override this to do custom processing on a remote message.\n * @param message - The message to process\n * @param local - True if the shared object is local\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown);\n\n /**\n * Called when the object has disconnected from the delta stream.\n */\n protected abstract onDisconnect();\n\n /**\n * Submits a message by the local client to the runtime.\n * @param content - Content of the message\n * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n */\n protected submitLocalMessage(content: any, localOpMetadata: unknown = undefined): void {\n this.verifyNotClosed();\n if (this.isAttached()) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.services!.deltaConnection.submit(content, localOpMetadata);\n }\n }\n\n /**\n * Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock\n * that want to be part of summary but does not generate ops.\n */\n protected dirty(): void {\n if (!this.isAttached()) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.services!.deltaConnection.dirty();\n }\n\n /**\n * Called when the object has fully connected to the delta stream\n * Default implementation for DDS, override if different behavior is required.\n */\n protected onConnect() { }\n\n /**\n * Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.\n * The default implementation here is to resubmit the same message. The client can override if different behavior\n * is required. It can choose to resubmit the same message, submit different / multiple messages or not submit\n * anything at all.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.submitLocalMessage(content, localOpMetadata);\n }\n\n /**\n * Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.\n * It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),\n * the Promise will reject.\n * If runtime is disposed when this call is made, executor is not run and promise is rejected right away.\n */\n protected async newAckBasedPromise<T>(\n executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void,\n ): Promise<T> {\n let rejectBecauseDispose: () => void;\n return new Promise<T>((resolve, reject) => {\n rejectBecauseDispose =\n () => reject(new Error(\"FluidDataStoreRuntime disposed while this ack-based Promise was pending\"));\n\n if (this.runtime.disposed) {\n rejectBecauseDispose();\n return;\n }\n\n this.runtime.on(\"dispose\", rejectBecauseDispose);\n executor(resolve, reject);\n }).finally(() => {\n // Note: rejectBecauseDispose will never be undefined here\n this.runtime.off(\"dispose\", rejectBecauseDispose);\n });\n }\n\n private attachDeltaHandler() {\n // Services should already be there in case we are attaching delta handler.\n assert(this.services !== undefined, 0x07a /* \"Services should be there to attach delta handler\" */);\n this._isBoundToContext = true;\n // Allows objects to do any custom processing if it is attached.\n this.didAttach();\n\n // attachDeltaHandler is only called after services is assigned\n this.services.deltaConnection.attach({\n process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => {\n this.process(message, local, localOpMetadata);\n },\n setConnectionState: (connected: boolean) => {\n this.setConnectionState(connected);\n },\n reSubmit: (content: any, localOpMetadata: unknown) => {\n this.reSubmit(content, localOpMetadata);\n },\n applyStashedOp: (content: any): unknown => {\n return this.applyStashedOp(content);\n },\n });\n\n // Trigger initial state\n // attachDeltaHandler is only called after services is assigned\n this.setConnectionState(this.services.deltaConnection.connected);\n }\n\n /**\n * Set the state of connection to services.\n * @param connected - true if connected, false otherwise.\n */\n private setConnectionState(connected: boolean) {\n if (this._connected === connected) {\n // Not changing state, nothing the same.\n return;\n }\n\n // Should I change the state at the end? So that we *can't* send new stuff before we send old?\n this._connected = connected;\n\n if (!connected) {\n // Things that are true now...\n // - if we had a connection we can no longer send messages over it\n // - if we had outbound messages some may or may not be ACK'd. Won't know until next message\n //\n // - nack could get a new msn - but might as well do it in the join?\n this.onDisconnect();\n } else {\n // Call this for now so that DDSes like ConsensesOrderedCollection that maintain their own pending\n // messages will work.\n this.onConnect();\n }\n }\n\n /**\n * Handles a message being received from the remote delta server.\n * @param message - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n private process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed(); // This will result in container closure.\n this.emit(\"pre-op\", message, local, this);\n this.processCore(message, local, localOpMetadata);\n this.emit(\"op\", message, local, this);\n }\n\n /**\n * Called when a message has to be resubmitted. This typically happens for unacked messages after a\n * reconnection.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n private reSubmit(content: any, localOpMetadata: unknown) {\n this.reSubmitCore(content, localOpMetadata);\n }\n\n protected abstract applyStashedOp(content: any): unknown;\n}\n\n/**\n * SharedObject with simplified, synchronous summarization and GC.\n * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.\n */\nexport abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends SharedObjectCore<TEvent> {\n /**\n * True while we are garbage collecting this object's data.\n */\n private _isGCing: boolean = false;\n\n /**\n * The serializer to use to serialize / parse handles, if any.\n */\n private readonly _serializer: IFluidSerializer;\n\n protected get serializer(): IFluidSerializer {\n /**\n * During garbage collection, the SummarySerializer keeps track of IFluidHandles that are serialized. These\n * handles represent references to other Fluid objects.\n *\n * This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content\n * in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.\n */\n assert(!this._isGCing,\n 0x075 /* \"SummarySerializer should be used for serializing data during summary.\" */);\n return this._serializer;\n }\n\n /**\n * @param id - The id of the shared object\n * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n * @param attributes - Attributes of the shared object\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes)\n {\n super(id, runtime, attributes);\n\n this._serializer = new FluidSerializer(\n this.runtime.channelsRoutingContext,\n (handle: IFluidHandle) => this.handleDecoded(handle),\n );\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).getAttachSummary}\n */\n public getAttachSummary(fullTree: boolean = false, trackState: boolean = false): ISummaryTreeWithStats {\n return this.summarizeCore(this.serializer);\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).summarize}\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummaryTreeWithStats> {\n return this.summarizeCore(this.serializer);\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).getGCData}\n */\n public getGCData(fullGC: boolean = false): IGarbageCollectionData {\n // Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles\n // in this object's data.\n assert(!this._isGCing, 0x078 /* \"Possible re-entrancy! Summary should not already be in progress.\" */);\n this._isGCing = true;\n\n let gcData: IGarbageCollectionData;\n try {\n const serializer = new SummarySerializer(\n this.runtime.channelsRoutingContext,\n (handle: IFluidHandle) => this.handleDecoded(handle),\n );\n this.processGCDataCore(serializer);\n // The GC data for this shared object contains a single GC node. The outbound routes of this node are the\n // routes of handles serialized during summarization.\n gcData = { gcNodes: { \"/\": serializer.getSerializedRoutes() } };\n assert(this._isGCing, 0x079 /* \"Possible re-entrancy! Summary should have been in progress.\" */);\n } finally {\n this._isGCing = false;\n }\n\n return gcData;\n }\n\n /**\n * Calls the serializer over all data in this object that reference other GC nodes.\n * Derived classes must override this to provide custom list of references to other GC nodes.\n */\n protected processGCDataCore(serializer: SummarySerializer) {\n // We run the full summarize logic to get the list of outbound routes from this object. This is a little\n // expensive but its okay for now. It will be updated to not use full summarize and make it more efficient.\n // See: https://github.com/microsoft/FluidFramework/issues/4547\n this.summarizeCore(serializer);\n }\n\n /**\n * Gets a form of the object that can be serialized.\n * @returns A tree representing the snapshot of the shared object.\n */\n protected abstract summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;\n}\n"]}
1
+ {"version":3,"file":"sharedObject.js","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,MAAM,EAAyB,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AAapE,OAAO,EAAE,WAAW,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAC7F,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,eAAe,EAAoB,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;GAEG;AACH,MAAM,OAAgB,gBAClB,SAAQ,6BAAqC;IAyC7C;;;;OAIG;IACH,YACW,EAAU,EACP,OAA+B,EACzB,UAA8B;QAC9C,KAAK,CAAC,CAAC,KAA4B,EAAE,CAAM,EAAE,EAAE,CAAC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;QAHnF,OAAE,GAAF,EAAE,CAAQ;QACP,YAAO,GAAP,OAAO,CAAwB;QACzB,eAAU,GAAV,UAAU,CAAoB;QApClD;;WAEG;QACK,eAAU,GAAG,KAAK,CAAC;QAO3B;;WAEG;QACK,sBAAiB,GAAY,KAAK,CAAC;QA0BvC,IAAI,CA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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { v4 as uuid } from \"uuid\";\nimport { ITelemetryLogger } from \"@fluidframework/common-definitions\";\nimport { assert, EventEmitterEventType } from \"@fluidframework/common-utils\";\nimport { AttachState } from \"@fluidframework/container-definitions\";\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n IChannelAttributes,\n IFluidDataStoreRuntime,\n IChannelStorageService,\n IChannelServices,\n} from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport {\n IGarbageCollectionData,\n ISummaryTreeWithStats,\n} from \"@fluidframework/runtime-definitions\";\nimport { ChildLogger, EventEmitterWithErrorHandling } from \"@fluidframework/telemetry-utils\";\nimport { DataProcessingError } from \"@fluidframework/container-utils\";\nimport { FluidSerializer, IFluidSerializer } from \"./serializer\";\nimport { SharedObjectHandle } from \"./handle\";\nimport { SummarySerializer } from \"./summarySerializer\";\nimport { ISharedObject, ISharedObjectEvents } from \"./types\";\n\n/**\n * Base class from which all shared objects derive\n */\nexport abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {\n public get IFluidLoadable() { return this; }\n\n /**\n * The handle referring to this SharedObject\n */\n public readonly handle: IFluidHandle;\n\n /**\n * Telemetry logger for the shared object\n */\n protected readonly logger: ITelemetryLogger;\n\n /**\n * Connection state\n */\n private _connected = false;\n\n /**\n * Services used by the shared object\n */\n private services: IChannelServices | undefined;\n\n /**\n * True if the dds is bound to its parent.\n */\n private _isBoundToContext: boolean = false;\n\n /**\n * Tracks error that closed this object.\n */\n private closeError?: ReturnType<typeof DataProcessingError.wrapIfUnrecognized>;\n\n /**\n * Gets the connection state\n * @returns The state of the connection\n */\n public get connected(): boolean {\n return this._connected;\n }\n\n /**\n * @param id - The id of the shared object\n * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n * @param attributes - Attributes of the shared object\n */\n constructor(\n public id: string,\n protected runtime: IFluidDataStoreRuntime,\n public readonly attributes: IChannelAttributes) {\n super((event: EventEmitterEventType, e: any) => this.eventListenerErrorHandler(event, e));\n\n this.handle = new SharedObjectHandle(\n this,\n id,\n runtime.IFluidHandleContext);\n\n this.logger = ChildLogger.create(\n runtime.logger,\n undefined,\n { all: { sharedObjectId: uuid() } },\n );\n\n this.attachListeners();\n }\n\n /**\n * Marks this objects as closed. Any attempt to change it (local changes or processing remote ops)\n * would result in same error thrown. If called multiple times, only first error is remembered.\n * @param error - error object that is thrown whenever an attempt is made to modify this object\n */\n private closeWithError(error: any) {\n if (this.closeError === undefined) {\n this.closeError = error;\n }\n }\n\n /**\n * Verifies that this object is not closed via closeWithError(). If it is, throws an error used to close it.\n */\n private verifyNotClosed() {\n if (this.closeError !== undefined) {\n throw this.closeError;\n }\n }\n\n /**\n * Event listener handler helper that can be used to react to exceptions thrown from event listeners\n * It wraps error with DataProcessingError, closes this object and throws resulting error.\n * See closeWithError() for more details\n * Ideally such situation never happens, as consumers of DDS should never throw exceptions\n * in event listeners (i.e. catch any of the issues and make determination on how to handle it).\n * When such exceptions propagate through, most likely data model is no longer consistent, i.e.\n * DDS state does not match what user sees. Because of it DDS moves to \"corrupted state\" and does not\n * allow processing of ops or local changes, which very quickly results in container closure.\n */\n private eventListenerErrorHandler(event: EventEmitterEventType, e: any) {\n const error = DataProcessingError.wrapIfUnrecognized(\n e,\n \"SharedObjectEventListenerException\");\n error.addTelemetryProperties({ emittedEventName: String(event) });\n\n this.closeWithError(error);\n throw error;\n }\n\n private attachListeners() {\n // Only listen to these events if not attached.\n if (!this.isAttached()) {\n this.runtime.once(\"attaching\", () => {\n // Calling this will let the dds to do any custom processing based on attached\n // like starting generating ops.\n this.didAttach();\n });\n }\n }\n\n /**\n * A shared object, after construction, can either be loaded in the case that it is already part of\n * a shared document. Or later attached if it is being newly added.\n * @param services - Services used by the shared object\n */\n public async load(services: IChannelServices): Promise<void> {\n if (this.runtime.attachState !== AttachState.Detached) {\n this.services = services;\n }\n await this.loadCore(services.objectStorage);\n if (this.runtime.attachState !== AttachState.Detached) {\n this.attachDeltaHandler();\n }\n }\n\n /**\n * Initializes the object as a local, non-shared object. This object can become shared after\n * it is attached to the document.\n */\n public initializeLocal(): void {\n this.initializeLocalCore();\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).bindToContext}\n */\n public bindToContext(): void {\n if (this._isBoundToContext) {\n return;\n }\n\n this._isBoundToContext = true;\n\n this.runtime.bindChannel(this);\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}\n */\n public connect(services: IChannelServices) {\n this.services = services;\n this.attachDeltaHandler();\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}\n */\n public isAttached(): boolean {\n return this.services !== undefined && this.runtime.attachState !== AttachState.Detached;\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n */\n public abstract getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n */\n public abstract summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;\n\n /**\n * {@inheritDoc (ISharedObject:interface).getGCData}\n */\n public abstract getGCData(fullGC?: boolean): IGarbageCollectionData;\n\n /**\n * Called when a handle is decoded by this object. A handle in the object's data represents an outbound reference\n * to another object in the container.\n * @param decodedHandle - The handle of the Fluid object that is decoded.\n */\n protected handleDecoded(decodedHandle: IFluidHandle) {\n if (this.isAttached()) {\n // This represents an outbound reference from this object to the node represented by decodedHandle.\n this.services?.deltaConnection.addedGCOutboundReference?.(this.handle, decodedHandle);\n }\n }\n\n /**\n * Allows the distributed data type to perform custom loading\n * @param services - Storage used by the shared object\n */\n protected abstract loadCore(services: IChannelStorageService): Promise<void>;\n\n /**\n * Allows the distributed data type to perform custom local loading.\n */\n protected initializeLocalCore() {\n return;\n }\n\n /**\n * Allows the distributive data type the ability to perform custom processing once an attach has happened.\n * Also called after non-local data type get loaded.\n */\n protected didAttach() {\n return;\n }\n\n /**\n * Derived classes must override this to do custom processing on a remote message.\n * @param message - The message to process\n * @param local - True if the shared object is local\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown);\n\n /**\n * Called when the object has disconnected from the delta stream.\n */\n protected abstract onDisconnect();\n\n /**\n * Submits a message by the local client to the runtime.\n * @param content - Content of the message\n * @param localOpMetadata - The local metadata associated with the message. This is kept locally by the runtime\n * and not sent to the server. This will be sent back when this message is received back from the server. This is\n * also sent if we are asked to resubmit the message.\n */\n protected submitLocalMessage(content: any, localOpMetadata: unknown = undefined): void {\n this.verifyNotClosed();\n if (this.isAttached()) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.services!.deltaConnection.submit(content, localOpMetadata);\n }\n }\n\n /**\n * Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock\n * that want to be part of summary but does not generate ops.\n */\n protected dirty(): void {\n if (!this.isAttached()) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n this.services!.deltaConnection.dirty();\n }\n\n /**\n * Called when the object has fully connected to the delta stream\n * Default implementation for DDS, override if different behavior is required.\n */\n protected onConnect() { }\n\n /**\n * Called when a message has to be resubmitted. This typically happens after a reconnection for unacked messages.\n * The default implementation here is to resubmit the same message. The client can override if different behavior\n * is required. It can choose to resubmit the same message, submit different / multiple messages or not submit\n * anything at all.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n protected reSubmitCore(content: any, localOpMetadata: unknown) {\n this.submitLocalMessage(content, localOpMetadata);\n }\n\n /**\n * Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.\n * It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),\n * the Promise will reject.\n * If runtime is disposed when this call is made, executor is not run and promise is rejected right away.\n */\n protected async newAckBasedPromise<T>(\n executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void,\n ): Promise<T> {\n let rejectBecauseDispose: () => void;\n return new Promise<T>((resolve, reject) => {\n rejectBecauseDispose =\n () => reject(new Error(\"FluidDataStoreRuntime disposed while this ack-based Promise was pending\"));\n\n if (this.runtime.disposed) {\n rejectBecauseDispose();\n return;\n }\n\n this.runtime.on(\"dispose\", rejectBecauseDispose);\n executor(resolve, reject);\n }).finally(() => {\n // Note: rejectBecauseDispose will never be undefined here\n this.runtime.off(\"dispose\", rejectBecauseDispose);\n });\n }\n\n private attachDeltaHandler() {\n // Services should already be there in case we are attaching delta handler.\n assert(this.services !== undefined, 0x07a /* \"Services should be there to attach delta handler\" */);\n this._isBoundToContext = true;\n // Allows objects to do any custom processing if it is attached.\n this.didAttach();\n\n // attachDeltaHandler is only called after services is assigned\n this.services.deltaConnection.attach({\n process: (message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) => {\n this.process(message, local, localOpMetadata);\n },\n setConnectionState: (connected: boolean) => {\n this.setConnectionState(connected);\n },\n reSubmit: (content: any, localOpMetadata: unknown) => {\n this.reSubmit(content, localOpMetadata);\n },\n applyStashedOp: (content: any): unknown => {\n return this.applyStashedOp(content);\n },\n });\n\n // Trigger initial state\n // attachDeltaHandler is only called after services is assigned\n this.setConnectionState(this.services.deltaConnection.connected);\n }\n\n /**\n * Set the state of connection to services.\n * @param connected - true if connected, false otherwise.\n */\n private setConnectionState(connected: boolean) {\n if (this._connected === connected) {\n // Not changing state, nothing the same.\n return;\n }\n\n // Should I change the state at the end? So that we *can't* send new stuff before we send old?\n this._connected = connected;\n\n if (!connected) {\n // Things that are true now...\n // - if we had a connection we can no longer send messages over it\n // - if we had outbound messages some may or may not be ACK'd. Won't know until next message\n //\n // - nack could get a new msn - but might as well do it in the join?\n this.onDisconnect();\n } else {\n // Call this for now so that DDSes like ConsensesOrderedCollection that maintain their own pending\n // messages will work.\n this.onConnect();\n }\n }\n\n /**\n * Handles a message being received from the remote delta server.\n * @param message - The message to process\n * @param local - Whether the message originated from the local client\n * @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.\n * For messages from a remote client, this will be undefined.\n */\n private process(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown) {\n this.verifyNotClosed(); // This will result in container closure.\n this.emit(\"pre-op\", message, local, this);\n this.processCore(message, local, localOpMetadata);\n this.emit(\"op\", message, local, this);\n }\n\n /**\n * Called when a message has to be resubmitted. This typically happens for unacked messages after a\n * reconnection.\n * @param content - The content of the original message.\n * @param localOpMetadata - The local metadata associated with the original message.\n */\n private reSubmit(content: any, localOpMetadata: unknown) {\n this.reSubmitCore(content, localOpMetadata);\n }\n\n /**\n * Apply changes from an op. Used when rehydrating an attached container\n * with pending changes. This prepares the SharedObject for seeing an ACK\n * for the op or resubmitting the op upon reconnection.\n * @param content - Contents of a stashed op.\n * @returns localMetadata of the op, to be passed to process() or resubmit()\n * when the op is ACKed or resubmitted, respectively\n */\n protected abstract applyStashedOp(content: any): unknown;\n}\n\n/**\n * SharedObject with simplified, synchronous summarization and GC.\n * DDS implementations with async and incremental summarization should extend SharedObjectCore directly instead.\n */\nexport abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends SharedObjectCore<TEvent> {\n /**\n * True while we are garbage collecting this object's data.\n */\n private _isGCing: boolean = false;\n\n /**\n * The serializer to use to serialize / parse handles, if any.\n */\n private readonly _serializer: IFluidSerializer;\n\n protected get serializer(): IFluidSerializer {\n /**\n * During garbage collection, the SummarySerializer keeps track of IFluidHandles that are serialized. These\n * handles represent references to other Fluid objects.\n *\n * This is fine for now. However, if we implement delay loading in DDss, they may load and de-serialize content\n * in summarize. When that happens, they may incorrectly hit this assert and we will have to change this.\n */\n assert(!this._isGCing,\n 0x075 /* \"SummarySerializer should be used for serializing data during summary.\" */);\n return this._serializer;\n }\n\n /**\n * @param id - The id of the shared object\n * @param runtime - The IFluidDataStoreRuntime which contains the shared object\n * @param attributes - Attributes of the shared object\n */\n constructor(\n id: string,\n runtime: IFluidDataStoreRuntime,\n attributes: IChannelAttributes) {\n super(id, runtime, attributes);\n\n this._serializer = new FluidSerializer(\n this.runtime.channelsRoutingContext,\n (handle: IFluidHandle) => this.handleDecoded(handle),\n );\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}\n */\n public getAttachSummary(fullTree: boolean = false, trackState: boolean = false): ISummaryTreeWithStats {\n return this.summarizeCore(this.serializer);\n }\n\n /**\n * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}\n */\n public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummaryTreeWithStats> {\n return this.summarizeCore(this.serializer);\n }\n\n /**\n * {@inheritDoc (ISharedObject:interface).getGCData}\n */\n public getGCData(fullGC: boolean = false): IGarbageCollectionData {\n // Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles\n // in this object's data.\n assert(!this._isGCing, 0x078 /* \"Possible re-entrancy! Summary should not already be in progress.\" */);\n this._isGCing = true;\n\n let gcData: IGarbageCollectionData;\n try {\n const serializer = new SummarySerializer(\n this.runtime.channelsRoutingContext,\n (handle: IFluidHandle) => this.handleDecoded(handle),\n );\n this.processGCDataCore(serializer);\n // The GC data for this shared object contains a single GC node. The outbound routes of this node are the\n // routes of handles serialized during summarization.\n gcData = { gcNodes: { \"/\": serializer.getSerializedRoutes() } };\n assert(this._isGCing, 0x079 /* \"Possible re-entrancy! Summary should have been in progress.\" */);\n } finally {\n this._isGCing = false;\n }\n\n return gcData;\n }\n\n /**\n * Calls the serializer over all data in this object that reference other GC nodes.\n * Derived classes must override this to provide custom list of references to other GC nodes.\n */\n protected processGCDataCore(serializer: SummarySerializer) {\n // We run the full summarize logic to get the list of outbound routes from this object. This is a little\n // expensive but its okay for now. It will be updated to not use full summarize and make it more efficient.\n // See: https://github.com/microsoft/FluidFramework/issues/4547\n this.summarizeCore(serializer);\n }\n\n /**\n * Gets a form of the object that can be serialized.\n * @returns A tree representing the snapshot of the shared object.\n */\n protected abstract summarizeCore(serializer: IFluidSerializer): ISummaryTreeWithStats;\n}\n"]}
package/lib/types.d.ts CHANGED
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from "@fluidframework/common-definitions";
6
- import { IChannel, IChannelServices } from "@fluidframework/datastore-definitions";
6
+ import { IChannel } from "@fluidframework/datastore-definitions";
7
7
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
8
- import { IGarbageCollectionData, ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
8
+ import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";
9
9
  export interface ISharedObjectEvents extends IErrorEvent {
10
10
  (event: "pre-op" | "op", listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void): any;
11
11
  }
@@ -18,27 +18,6 @@ export interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjec
18
18
  * the runtime attaches.
19
19
  */
20
20
  bindToContext(): void;
21
- /**
22
- * Returns whether the given shared object is attached to storage.
23
- * @returns True if the given shared object is attached
24
- */
25
- isAttached(): boolean;
26
- /**
27
- * Generates summary of the channel synchronously.
28
- * @returns A tree representing the summary of the shared object.
29
- */
30
- getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
31
- /**
32
- * Generates summary of the shared object asynchronously.
33
- * This should not be called where the object can be modified while summarization is in progress.
34
- * @returns A tree representing the summary of the channel.
35
- */
36
- summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
37
- /**
38
- * Enables the channel to send and receive ops.
39
- * @param services - Services to connect to
40
- */
41
- connect(services: IChannelServices): void;
42
21
  /**
43
22
  * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to
44
23
  * other GC nodes.
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACxG,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AACnF,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAEpG,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACpD,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,EACnB,QAAQ,EAAE,CAAC,EAAE,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,KAAK,IAAI,OAAE;CACzG;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,CACnF,SAAQ,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC;IACxC;;;OAGG;IACH,aAAa,IAAI,IAAI,CAAC;IAEtB;;;OAGG;IACH,UAAU,IAAI,OAAO,CAAC;IAEtB;;;OAGG;IACH,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,qBAAqB,CAAC;IAElF;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;IAEpF;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAE1C;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;CACvD"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AACxG,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AACjF,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACpD,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI,EACnB,QAAQ,EAAE,CAAC,EAAE,EAAE,yBAAyB,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,qBAAqB,KAAK,IAAI,OAAE;CACzG;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,MAAM,SAAS,mBAAmB,GAAG,mBAAmB,CACnF,SAAQ,QAAQ,EAAE,cAAc,CAAC,MAAM,CAAC;IACxC;;;OAGG;IACH,aAAa,IAAI,IAAI,CAAC;IAEtB;;;;OAIG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,sBAAsB,CAAC;CACvD"}
package/lib/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\nimport { IChannel, IChannelServices } from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IGarbageCollectionData, ISummaryTreeWithStats } from \"@fluidframework/runtime-definitions\";\n\nexport interface ISharedObjectEvents extends IErrorEvent {\n (event: \"pre-op\" | \"op\",\n listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * Base interface for shared objects from which other interfaces derive. Implemented by SharedObject\n */\nexport interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends IChannel, IEventProvider<TEvent> {\n /**\n * Binds the given shared object to its containing data store runtime, causing it to attach once\n * the runtime attaches.\n */\n bindToContext(): void;\n\n /**\n * Returns whether the given shared object is attached to storage.\n * @returns True if the given shared object is attached\n */\n isAttached(): boolean;\n\n /**\n * Generates summary of the channel synchronously.\n * @returns A tree representing the summary of the shared object.\n */\n getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;\n\n /**\n * Generates summary of the shared object asynchronously.\n * This should not be called where the object can be modified while summarization is in progress.\n * @returns A tree representing the summary of the channel.\n */\n summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;\n\n /**\n * Enables the channel to send and receive ops.\n * @param services - Services to connect to\n */\n connect(services: IChannelServices): void;\n\n /**\n * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to\n * other GC nodes.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n getGCData(fullGC?: boolean): IGarbageCollectionData;\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from \"@fluidframework/common-definitions\";\nimport { IChannel } from \"@fluidframework/datastore-definitions\";\nimport { ISequencedDocumentMessage } from \"@fluidframework/protocol-definitions\";\nimport { IGarbageCollectionData } from \"@fluidframework/runtime-definitions\";\n\nexport interface ISharedObjectEvents extends IErrorEvent {\n (event: \"pre-op\" | \"op\",\n listener: (op: ISequencedDocumentMessage, local: boolean, target: IEventThisPlaceHolder) => void);\n}\n\n/**\n * Base interface for shared objects from which other interfaces derive. Implemented by SharedObject\n */\nexport interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents>\n extends IChannel, IEventProvider<TEvent> {\n /**\n * Binds the given shared object to its containing data store runtime, causing it to attach once\n * the runtime attaches.\n */\n bindToContext(): void;\n\n /**\n * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to\n * other GC nodes.\n * @param fullGC - true to bypass optimizations and force full generation of GC data.\n */\n getGCData(fullGC?: boolean): IGarbageCollectionData;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/shared-object-base",
3
- "version": "0.59.2000",
3
+ "version": "0.59.3000-67119",
4
4
  "description": "Fluid base class for shared distributed data structures",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -64,22 +64,23 @@
64
64
  "@fluidframework/common-definitions": "^0.20.1",
65
65
  "@fluidframework/common-utils": "^0.32.1",
66
66
  "@fluidframework/container-definitions": "^0.48.1000",
67
- "@fluidframework/container-runtime": "^0.59.2000",
68
- "@fluidframework/container-utils": "^0.59.2000",
67
+ "@fluidframework/container-runtime": "0.59.3000-67119",
68
+ "@fluidframework/container-utils": "0.59.3000-67119",
69
69
  "@fluidframework/core-interfaces": "^0.43.1000",
70
- "@fluidframework/datastore": "^0.59.2000",
71
- "@fluidframework/datastore-definitions": "^0.59.2000",
70
+ "@fluidframework/datastore": "0.59.3000-67119",
71
+ "@fluidframework/datastore-definitions": "0.59.3000-67119",
72
72
  "@fluidframework/protocol-definitions": "^0.1028.1000",
73
- "@fluidframework/runtime-definitions": "^0.59.2000",
74
- "@fluidframework/runtime-utils": "^0.59.2000",
75
- "@fluidframework/telemetry-utils": "^0.59.2000",
73
+ "@fluidframework/runtime-definitions": "0.59.3000-67119",
74
+ "@fluidframework/runtime-utils": "0.59.3000-67119",
75
+ "@fluidframework/telemetry-utils": "0.59.3000-67119",
76
76
  "uuid": "^8.3.1"
77
77
  },
78
78
  "devDependencies": {
79
79
  "@fluidframework/build-common": "^0.23.0",
80
- "@fluidframework/eslint-config-fluid": "^0.28.1000",
81
- "@fluidframework/mocha-test-setup": "^0.59.2000",
82
- "@fluidframework/shared-object-base-previous": "npm:@fluidframework/shared-object-base@0.59.1000",
80
+ "@fluidframework/build-tools": "^0.2.66793",
81
+ "@fluidframework/eslint-config-fluid": "^0.28.2000-0",
82
+ "@fluidframework/mocha-test-setup": "0.59.3000-67119",
83
+ "@fluidframework/shared-object-base-previous": "npm:@fluidframework/shared-object-base@0.59.2000",
83
84
  "@microsoft/api-extractor": "^7.22.2",
84
85
  "@rushstack/eslint-config": "^2.5.1",
85
86
  "@types/benchmark": "^2.1.0",
@@ -105,11 +106,11 @@
105
106
  "nyc": "^15.0.0",
106
107
  "rimraf": "^2.6.2",
107
108
  "ts-node": "^7.0.1",
108
- "typescript": "~4.1.3",
109
+ "typescript": "~4.5.5",
109
110
  "typescript-formatter": "7.1.0"
110
111
  },
111
112
  "typeValidation": {
112
- "version": "0.59.2000",
113
+ "version": "0.59.3000",
113
114
  "broken": {}
114
115
  }
115
116
  }
package/src/handle.ts CHANGED
@@ -14,7 +14,7 @@ import { ISharedObject } from "./types";
14
14
  * This object is used for already loaded (in-memory) shared object
15
15
  * and is used only for serialization purposes.
16
16
  * De-serialization process goes through FluidObjectHandle and request flow:
17
- * FluidDataStoreRuntime.request() recognizes requests in the form of '/<shared object id>'
17
+ * FluidDataStoreRuntime.request() recognizes requests in the form of '/\<shared object id\>'
18
18
  * and loads shared object.
19
19
  */
20
20
  export class SharedObjectHandle extends FluidObjectHandle<ISharedObject> {
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/shared-object-base";
9
- export const pkgVersion = "0.59.2000";
9
+ export const pkgVersion = "0.59.3000-67119";
@@ -79,8 +79,7 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
79
79
  constructor(
80
80
  public id: string,
81
81
  protected runtime: IFluidDataStoreRuntime,
82
- public readonly attributes: IChannelAttributes)
83
- {
82
+ public readonly attributes: IChannelAttributes) {
84
83
  super((event: EventEmitterEventType, e: any) => this.eventListenerErrorHandler(event, e));
85
84
 
86
85
  this.handle = new SharedObjectHandle(
@@ -185,7 +184,7 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
185
184
  }
186
185
 
187
186
  /**
188
- * {@inheritDoc (ISharedObject:interface).connect}
187
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).connect}
189
188
  */
190
189
  public connect(services: IChannelServices) {
191
190
  this.services = services;
@@ -193,19 +192,19 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
193
192
  }
194
193
 
195
194
  /**
196
- * {@inheritDoc (ISharedObject:interface).isAttached}
195
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).isAttached}
197
196
  */
198
197
  public isAttached(): boolean {
199
198
  return this.services !== undefined && this.runtime.attachState !== AttachState.Detached;
200
199
  }
201
200
 
202
201
  /**
203
- * {@inheritDoc (ISharedObject:interface).getAttachSummary}
202
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
204
203
  */
205
204
  public abstract getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
206
205
 
207
206
  /**
208
- * {@inheritDoc (ISharedObject:interface).summarize}
207
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
209
208
  */
210
209
  public abstract summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
211
210
 
@@ -413,6 +412,14 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
413
412
  this.reSubmitCore(content, localOpMetadata);
414
413
  }
415
414
 
415
+ /**
416
+ * Apply changes from an op. Used when rehydrating an attached container
417
+ * with pending changes. This prepares the SharedObject for seeing an ACK
418
+ * for the op or resubmitting the op upon reconnection.
419
+ * @param content - Contents of a stashed op.
420
+ * @returns localMetadata of the op, to be passed to process() or resubmit()
421
+ * when the op is ACKed or resubmitted, respectively
422
+ */
416
423
  protected abstract applyStashedOp(content: any): unknown;
417
424
  }
418
425
 
@@ -453,8 +460,7 @@ export abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedO
453
460
  constructor(
454
461
  id: string,
455
462
  runtime: IFluidDataStoreRuntime,
456
- attributes: IChannelAttributes)
457
- {
463
+ attributes: IChannelAttributes) {
458
464
  super(id, runtime, attributes);
459
465
 
460
466
  this._serializer = new FluidSerializer(
@@ -464,14 +470,14 @@ export abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedO
464
470
  }
465
471
 
466
472
  /**
467
- * {@inheritDoc (ISharedObject:interface).getAttachSummary}
473
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getAttachSummary}
468
474
  */
469
475
  public getAttachSummary(fullTree: boolean = false, trackState: boolean = false): ISummaryTreeWithStats {
470
476
  return this.summarizeCore(this.serializer);
471
477
  }
472
478
 
473
479
  /**
474
- * {@inheritDoc (ISharedObject:interface).summarize}
480
+ * {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).summarize}
475
481
  */
476
482
  public async summarize(fullTree: boolean = false, trackState: boolean = false): Promise<ISummaryTreeWithStats> {
477
483
  return this.summarizeCore(this.serializer);
package/src/types.ts CHANGED
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  import { IErrorEvent, IEventProvider, IEventThisPlaceHolder } from "@fluidframework/common-definitions";
7
- import { IChannel, IChannelServices } from "@fluidframework/datastore-definitions";
7
+ import { IChannel } from "@fluidframework/datastore-definitions";
8
8
  import { ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
9
- import { IGarbageCollectionData, ISummaryTreeWithStats } from "@fluidframework/runtime-definitions";
9
+ import { IGarbageCollectionData } from "@fluidframework/runtime-definitions";
10
10
 
11
11
  export interface ISharedObjectEvents extends IErrorEvent {
12
12
  (event: "pre-op" | "op",
@@ -24,31 +24,6 @@ export interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjec
24
24
  */
25
25
  bindToContext(): void;
26
26
 
27
- /**
28
- * Returns whether the given shared object is attached to storage.
29
- * @returns True if the given shared object is attached
30
- */
31
- isAttached(): boolean;
32
-
33
- /**
34
- * Generates summary of the channel synchronously.
35
- * @returns A tree representing the summary of the shared object.
36
- */
37
- getAttachSummary(fullTree?: boolean, trackState?: boolean): ISummaryTreeWithStats;
38
-
39
- /**
40
- * Generates summary of the shared object asynchronously.
41
- * This should not be called where the object can be modified while summarization is in progress.
42
- * @returns A tree representing the summary of the channel.
43
- */
44
- summarize(fullTree?: boolean, trackState?: boolean): Promise<ISummaryTreeWithStats>;
45
-
46
- /**
47
- * Enables the channel to send and receive ops.
48
- * @param services - Services to connect to
49
- */
50
- connect(services: IChannelServices): void;
51
-
52
27
  /**
53
28
  * Returns the GC data for this shared object. It contains a list of GC nodes that contains references to
54
29
  * other GC nodes.