@fluidframework/shared-object-base 2.13.0 → 2.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/api-report/shared-object-base.legacy.alpha.api.md +13 -14
- package/dist/package.json +2 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serializer.d.ts +6 -6
- package/dist/serializer.d.ts.map +1 -1
- package/dist/serializer.js +1 -4
- package/dist/serializer.js.map +1 -1
- package/dist/sharedObject.d.ts +9 -9
- package/dist/sharedObject.d.ts.map +1 -1
- package/dist/sharedObject.js +1 -4
- package/dist/sharedObject.js.map +1 -1
- package/dist/types.d.ts +0 -7
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utils.d.ts +2 -2
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -1
- package/dist/utils.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializer.d.ts +6 -6
- package/lib/serializer.d.ts.map +1 -1
- package/lib/serializer.js +1 -4
- package/lib/serializer.js.map +1 -1
- package/lib/sharedObject.d.ts +9 -9
- package/lib/sharedObject.d.ts.map +1 -1
- package/lib/sharedObject.js +1 -4
- package/lib/sharedObject.js.map +1 -1
- package/lib/types.d.ts +0 -7
- package/lib/types.d.ts.map +1 -1
- package/lib/types.js.map +1 -1
- package/lib/utils.d.ts +2 -2
- package/lib/utils.d.ts.map +1 -1
- package/lib/utils.js +0 -1
- package/lib/utils.js.map +1 -1
- package/package.json +16 -16
- package/src/packageVersion.ts +1 -1
- package/src/serializer.ts +7 -14
- package/src/sharedObject.ts +9 -16
- package/src/types.ts +0 -8
- package/src/utils.ts +2 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,59 @@
|
|
|
1
1
|
# @fluidframework/shared-object-base
|
|
2
2
|
|
|
3
|
+
## 2.20.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Replace 'any' in return type for several APIs ([#23238](https://github.com/microsoft/FluidFramework/pull/23238)) [0783a31731](https://github.com/microsoft/FluidFramework/commit/0783a317317647e8881ec717a6f85c531cdbc956)
|
|
8
|
+
|
|
9
|
+
To improve type safety of the Fluid Framework legacy+alpha API surface,
|
|
10
|
+
we're moving away from using the `any` type in favor of `unknown`.
|
|
11
|
+
|
|
12
|
+
We expect that any changes required in consumers of these APIs will be limited to having to provide explicit types
|
|
13
|
+
when calling any of the APIs whose return value changed to `unknown`, like `IFluidSerializer.parse()`.
|
|
14
|
+
|
|
15
|
+
In summary, code that looked like this:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
// 'myVariable' ended up typed as 'any' here and TypeScript would not do any type-safety checks on it.
|
|
19
|
+
const myVariable = this.serializer.parse(stringHeader);
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Will now have to look like this:
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
// Do this if you know the type of the object you expect to get back.
|
|
26
|
+
const myVariable = this.serializer.parse(stringHeader) as MyType;
|
|
27
|
+
|
|
28
|
+
// Alternatively, this will maintain current behavior but also means no type-safety checks will be done by TS.
|
|
29
|
+
// const myVariable = this.serializer.parse(stringHeader) as any;
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
The appropriate type will depend on what the calling code is doing and the objects it expects to be dealing with.
|
|
33
|
+
|
|
34
|
+
We further encourage consumers of any of these APIs to add runtime checks
|
|
35
|
+
to validate that the returned object actually matches the expected type.
|
|
36
|
+
|
|
37
|
+
The list of affected APIs is as follows:
|
|
38
|
+
|
|
39
|
+
- `IFluidSerializer.encode(...)` now takes `value: unknown` instead of `value: any` and returns `unknown` instead of `any`.
|
|
40
|
+
- `IFluidSerializer.decode(...)` now takes `input: unknown` instead of `input: any` and returns `unknown` instead of `any`.
|
|
41
|
+
- `IFluidSerializer.stringify(...)` now takes `value: unknown` instead of `value: any`.
|
|
42
|
+
- `IFluidSerializer.parse(...)` now returns `unknown` instead of `any`.
|
|
43
|
+
- `SharedObjectCore.applyStashedOps(...)` now takes `content: unknown` instead of `content: any`.
|
|
44
|
+
- `SharedObjectCore.rollback(...)` now takes `content: unknown` instead of `content: any`.
|
|
45
|
+
- `SharedObjectCore.submitLocalMessage(...)` now takes `content: unknown` instead of `content: any`.
|
|
46
|
+
- `SharedObjectCore.reSubmitCore(...)` now takes `content: unknown` instead of `content: any`.
|
|
47
|
+
- In `SharedObjectCore.newAckBasedPromise<T>(...)` the `executor` parameter now takes `reject: (reason?: unknown)`
|
|
48
|
+
instead of `reject: (reason?: any)`.
|
|
49
|
+
- `makeHandlesSerializable(...)` now returns `unknown` instead of `any`.
|
|
50
|
+
- `parseHandles(...)` now returns `unknown` instead of `any`.
|
|
51
|
+
|
|
52
|
+
Additionally, the following APIs were never designed to return a value and have thus been updated to return `void` instead of `any`:
|
|
53
|
+
|
|
54
|
+
- `SharedObjectCore.processCore(...)`.
|
|
55
|
+
- `SharedObjectCore.onDisconnect(...)`
|
|
56
|
+
|
|
3
57
|
## 2.13.0
|
|
4
58
|
|
|
5
59
|
Dependency updates only.
|
|
@@ -6,16 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
// @alpha (undocumented)
|
|
8
8
|
export interface IFluidSerializer {
|
|
9
|
-
decode(input:
|
|
10
|
-
encode(value:
|
|
11
|
-
parse(value: string):
|
|
12
|
-
stringify(value:
|
|
9
|
+
decode(input: unknown): unknown;
|
|
10
|
+
encode(value: unknown, bind: IFluidHandle): unknown;
|
|
11
|
+
parse(value: string): unknown;
|
|
12
|
+
stringify(value: unknown, bind: IFluidHandle): string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
// @alpha
|
|
16
16
|
export interface ISharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends IChannel, IEventProvider<TEvent> {
|
|
17
17
|
bindToContext(): void;
|
|
18
|
-
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
20
|
// @alpha
|
|
@@ -33,10 +32,10 @@ export interface ISharedObjectKind<TSharedObject> {
|
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
// @alpha
|
|
36
|
-
export function makeHandlesSerializable(value: unknown, serializer: IFluidSerializer, bind: IFluidHandle):
|
|
35
|
+
export function makeHandlesSerializable(value: unknown, serializer: IFluidSerializer, bind: IFluidHandle): unknown;
|
|
37
36
|
|
|
38
37
|
// @alpha
|
|
39
|
-
export function parseHandles(value: unknown, serializer: IFluidSerializer):
|
|
38
|
+
export function parseHandles(value: unknown, serializer: IFluidSerializer): unknown;
|
|
40
39
|
|
|
41
40
|
// @alpha
|
|
42
41
|
export abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends SharedObjectCore<TEvent> {
|
|
@@ -53,7 +52,7 @@ export abstract class SharedObject<TEvent extends ISharedObjectEvents = ISharedO
|
|
|
53
52
|
// @alpha
|
|
54
53
|
export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISharedObjectEvents> extends EventEmitterWithErrorHandling<TEvent> implements ISharedObject<TEvent> {
|
|
55
54
|
constructor(id: string, runtime: IFluidDataStoreRuntime, attributes: IChannelAttributes);
|
|
56
|
-
protected abstract applyStashedOp(content:
|
|
55
|
+
protected abstract applyStashedOp(content: unknown): void;
|
|
57
56
|
// (undocumented)
|
|
58
57
|
readonly attributes: IChannelAttributes;
|
|
59
58
|
bindToContext(): void;
|
|
@@ -76,16 +75,16 @@ export abstract class SharedObjectCore<TEvent extends ISharedObjectEvents = ISha
|
|
|
76
75
|
load(services: IChannelServices): Promise<void>;
|
|
77
76
|
protected abstract loadCore(services: IChannelStorageService): Promise<void>;
|
|
78
77
|
protected readonly logger: ITelemetryLoggerExt;
|
|
79
|
-
protected newAckBasedPromise<T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?:
|
|
78
|
+
protected newAckBasedPromise<T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void) => void): Promise<T>;
|
|
80
79
|
protected onConnect(): void;
|
|
81
|
-
protected abstract onDisconnect():
|
|
82
|
-
protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown):
|
|
83
|
-
protected reSubmitCore(content:
|
|
84
|
-
protected rollback(content:
|
|
80
|
+
protected abstract onDisconnect(): void;
|
|
81
|
+
protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
82
|
+
protected reSubmitCore(content: unknown, localOpMetadata: unknown): void;
|
|
83
|
+
protected rollback(content: unknown, localOpMetadata: unknown): void;
|
|
85
84
|
// (undocumented)
|
|
86
85
|
protected runtime: IFluidDataStoreRuntime;
|
|
87
86
|
protected abstract get serializer(): IFluidSerializer;
|
|
88
|
-
protected submitLocalMessage(content:
|
|
87
|
+
protected submitLocalMessage(content: unknown, localOpMetadata?: unknown): void;
|
|
89
88
|
abstract summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
|
|
90
89
|
}
|
|
91
90
|
|
package/dist/package.json
CHANGED
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/shared-object-base";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.20.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/shared-object-base";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.20.0";
|
|
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,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/shared-object-base\";\nexport const pkgVersion = \"2.
|
|
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,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/shared-object-base\";\nexport const pkgVersion = \"2.20.0\";\n"]}
|
package/dist/serializer.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface IFluidSerializer {
|
|
|
17
17
|
* The original `input` object is not mutated. This method will shallowly clones all objects in the path from
|
|
18
18
|
* the root to any replaced handles. (If no handles are found, returns the original object.)
|
|
19
19
|
*/
|
|
20
|
-
encode(value:
|
|
20
|
+
encode(value: unknown, bind: IFluidHandle): unknown;
|
|
21
21
|
/**
|
|
22
22
|
* Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an
|
|
23
23
|
* equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.
|
|
@@ -27,16 +27,16 @@ export interface IFluidSerializer {
|
|
|
27
27
|
*
|
|
28
28
|
* The decoded handles are implicitly bound to the handle context of this serializer.
|
|
29
29
|
*/
|
|
30
|
-
decode(input:
|
|
30
|
+
decode(input: unknown): unknown;
|
|
31
31
|
/**
|
|
32
32
|
* Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.
|
|
33
33
|
*/
|
|
34
|
-
stringify(value:
|
|
34
|
+
stringify(value: unknown, bind: IFluidHandle): string;
|
|
35
35
|
/**
|
|
36
36
|
* Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid
|
|
37
37
|
* handles will be realized as part of the parse
|
|
38
38
|
*/
|
|
39
|
-
parse(value: string):
|
|
39
|
+
parse(value: string): unknown;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Data Store serializer implementation
|
|
@@ -56,7 +56,7 @@ export declare class FluidSerializer implements IFluidSerializer {
|
|
|
56
56
|
*
|
|
57
57
|
* Any unbound handles encountered are bound to the provided IFluidHandle.
|
|
58
58
|
*/
|
|
59
|
-
encode(input:
|
|
59
|
+
encode(input: unknown, bind: IFluidHandleInternal): unknown;
|
|
60
60
|
/**
|
|
61
61
|
* Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an
|
|
62
62
|
* equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.
|
|
@@ -66,7 +66,7 @@ export declare class FluidSerializer implements IFluidSerializer {
|
|
|
66
66
|
*
|
|
67
67
|
* The decoded handles are implicitly bound to the handle context of this serializer.
|
|
68
68
|
*/
|
|
69
|
-
decode(input: unknown):
|
|
69
|
+
decode(input: unknown): unknown;
|
|
70
70
|
stringify(input: unknown, bind: IFluidHandle): string;
|
|
71
71
|
parse(input: string): unknown;
|
|
72
72
|
private readonly encodeValue;
|
package/dist/serializer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,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,GAAG,OAAO;IAS/B,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,GAAG,MAAM;IAMrD,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO;IAMpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAO1B;IAIF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAa1B;IAKF,OAAO,CAAC,kBAAkB;IA6C1B,SAAS,CAAC,eAAe,CACxB,MAAM,EAAE,oBAAoB,EAC5B,IAAI,EAAE,oBAAoB,GACxB,iBAAiB;CAOpB"}
|
package/dist/serializer.js
CHANGED
|
@@ -58,14 +58,12 @@ class FluidSerializer {
|
|
|
58
58
|
*
|
|
59
59
|
* Any unbound handles encountered are bound to the provided IFluidHandle.
|
|
60
60
|
*/
|
|
61
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- TODO: AB#26129 ddsFuzzHarness breaks when we update any->unknown
|
|
62
61
|
encode(input, bind) {
|
|
63
62
|
// If the given 'input' cannot contain handles, return it immediately. Otherwise,
|
|
64
63
|
// return the result of 'recursivelyReplace()'.
|
|
65
64
|
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
66
65
|
return !!input && typeof input === "object"
|
|
67
|
-
?
|
|
68
|
-
this.recursivelyReplace(input, this.encodeValue, bind)
|
|
66
|
+
? this.recursivelyReplace(input, this.encodeValue, bind)
|
|
69
67
|
: input;
|
|
70
68
|
}
|
|
71
69
|
/**
|
|
@@ -77,7 +75,6 @@ class FluidSerializer {
|
|
|
77
75
|
*
|
|
78
76
|
* The decoded handles are implicitly bound to the handle context of this serializer.
|
|
79
77
|
*/
|
|
80
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: AB#26129 ddsFuzzHarness breaks when we update any->unknown
|
|
81
78
|
decode(input) {
|
|
82
79
|
// If the given 'input' cannot contain handles, return it immediately. Otherwise,
|
|
83
80
|
// return the result of 'recursivelyReplace()'.
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AC;YACF,CAAC;QACF,CAAC;QACD,OAAO,KAAK,IAAI,KAAK,CAAC;IACvB,CAAC;IAES,eAAe,CACxB,MAA4B,EAC5B,IAA0B;QAE1B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,OAAO;YACN,IAAI,EAAE,kBAAkB;YACxB,GAAG,EAAE,MAAM,CAAC,YAAY;SACxB,CAAC;IACH,CAAC;CACD;AArJD,0CAqJC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIFluidHandleContext,\n\ttype IFluidHandleInternal,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tgenerateHandleContextPath,\n\tisSerializedHandle,\n\tisFluidHandle,\n\ttoFluidHandleInternal,\n\ttype ISerializedHandle,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport { RemoteFluidObjectHandle } from \"./remoteObjectHandle.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IFluidSerializer {\n\t/**\n\t * Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object\n\t * where any embedded IFluidHandles have been replaced with a serializable form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clones all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: AB#26129 use unknown instead of any (legacy breaking)\n\tencode(value: any, bind: IFluidHandle): any;\n\n\t/**\n\t * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n\t * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t *\n\t * The decoded handles are implicitly bound to the handle context of this serializer.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: AB#26129 use unknown instead of any (legacy breaking)\n\tdecode(input: any): any;\n\n\t/**\n\t * Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: AB#26129 use unknown instead of any (legacy breaking)\n\tstringify(value: any, bind: IFluidHandle): string;\n\n\t/**\n\t * Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid\n\t * handles will be realized as part of the parse\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: AB#26129 use unknown instead of any (legacy breaking)\n\tparse(value: string): any;\n}\n\n/**\n * Data Store serializer implementation\n * @internal\n */\nexport class FluidSerializer implements IFluidSerializer {\n\tprivate readonly root: IFluidHandleContext;\n\n\tpublic constructor(private readonly context: IFluidHandleContext) {\n\t\tthis.root = this.context;\n\t\twhile (this.root.routeContext !== undefined) {\n\t\t\tthis.root = this.root.routeContext;\n\t\t}\n\t}\n\n\tpublic get IFluidSerializer(): IFluidSerializer {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Given a mostly-jsonable object tree that may have handle objects embedded within, will return a\n\t * fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t *\n\t * Any unbound handles encountered are bound to the provided IFluidHandle.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- TODO: AB#26129 ddsFuzzHarness breaks when we update any->unknown\n\tpublic encode(input: any, bind: IFluidHandleInternal): any {\n\t\t// If the given 'input' cannot contain handles, return it immediately. Otherwise,\n\t\t// return the result of 'recursivelyReplace()'.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\treturn !!input && typeof input === \"object\"\n\t\t\t? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument -- TODO: AB#26129 ddsFuzzHarness breaks when we update any->unknown\n\t\t\t\tthis.recursivelyReplace(input, this.encodeValue, bind)\n\t\t\t: input;\n\t}\n\n\t/**\n\t * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n\t * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t *\n\t * The decoded handles are implicitly bound to the handle context of this serializer.\n\t */\n\t// eslint-disable-next-line @typescript-eslint/no-explicit-any -- TODO: AB#26129 ddsFuzzHarness breaks when we update any->unknown\n\tpublic decode(input: unknown): any {\n\t\t// If the given 'input' cannot contain handles, return it immediately. Otherwise,\n\t\t// return the result of 'recursivelyReplace()'.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\treturn !!input && typeof input === \"object\"\n\t\t\t? this.recursivelyReplace(input, this.decodeValue)\n\t\t\t: input;\n\t}\n\n\tpublic stringify(input: unknown, bind: IFluidHandle): string {\n\t\tconst bindInternal = toFluidHandleInternal(bind);\n\t\treturn JSON.stringify(input, (key, value) => this.encodeValue(value, bindInternal));\n\t}\n\n\t// Parses the serialized data - context must match the context with which the JSON was stringified\n\tpublic parse(input: string): unknown {\n\t\treturn JSON.parse(input, (key, value) => this.decodeValue(value));\n\t}\n\n\t// If the given 'value' is an IFluidHandle, returns the encoded IFluidHandle.\n\t// Otherwise returns the original 'value'. Used by 'encode()' and 'stringify()'.\n\tprivate readonly encodeValue = (value: unknown, bind?: IFluidHandleInternal): unknown => {\n\t\t// If 'value' is an IFluidHandle return its encoded form.\n\t\tif (isFluidHandle(value)) {\n\t\t\tassert(bind !== undefined, 0xa93 /* Cannot encode a handle without a bind context */);\n\t\t\treturn this.serializeHandle(toFluidHandleInternal(value), bind);\n\t\t}\n\t\treturn value;\n\t};\n\n\t// If the given 'value' is an encoded IFluidHandle, returns the decoded IFluidHandle.\n\t// Otherwise returns the original 'value'. Used by 'decode()' and 'parse()'.\n\tprivate readonly decodeValue = (value: unknown): unknown => {\n\t\t// If 'value' is a serialized IFluidHandle return the deserialized result.\n\t\tif (isSerializedHandle(value)) {\n\t\t\t// Old documents may have handles with relative path in their summaries. Convert these to absolute\n\t\t\t// paths. This will ensure that future summaries will have absolute paths for these handles.\n\t\t\tconst absolutePath = value.url.startsWith(\"/\")\n\t\t\t\t? value.url\n\t\t\t\t: generateHandleContextPath(value.url, this.context);\n\n\t\t\treturn new RemoteFluidObjectHandle(absolutePath, this.root);\n\t\t} else {\n\t\t\treturn value;\n\t\t}\n\t};\n\n\t// Invoked for non-null objects to recursively replace references to IFluidHandles.\n\t// Clones as-needed to avoid mutating the `input` object. If no IFluidHandes are present,\n\t// returns the original `input`.\n\tprivate recursivelyReplace<TContext = unknown>(\n\t\tinput: object,\n\t\treplacer: (input: unknown, context?: TContext) => unknown,\n\t\tcontext?: TContext,\n\t): unknown {\n\t\t// Note: Caller is responsible for ensuring that `input` is defined / non-null.\n\t\t// (Required for Object.keys() below.)\n\n\t\t// Execute the `replace` on the current input. Note that Caller is responsible for ensuring that `input`\n\t\t// is a non-null object.\n\t\tconst maybeReplaced = replacer(input, context);\n\n\t\t// If either input or the replaced result is a Fluid Handle, there is no need to descend further.\n\t\t// IFluidHandles are always leaves in the object graph, and the code below cannot deal with IFluidHandle's structure.\n\t\tif (isFluidHandle(input) || isFluidHandle(maybeReplaced)) {\n\t\t\treturn maybeReplaced;\n\t\t}\n\n\t\t// Otherwise descend into the object graph looking for IFluidHandle instances.\n\t\tlet clone: object | undefined;\n\t\tfor (const key of Object.keys(input)) {\n\t\t\tconst value: unknown = input[key];\n\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\tif (!!value && typeof value === \"object\") {\n\t\t\t\t// Note: Except for IFluidHandle, `input` must not contain circular references (as object must\n\t\t\t\t// be JSON serializable.) Therefore, guarding against infinite recursion here would only\n\t\t\t\t// lead to a later error when attempting to stringify().\n\t\t\t\tconst replaced = this.recursivelyReplace(value, replacer, context);\n\n\t\t\t\t// If the `replaced` object is different than the original `value` then the subgraph contained one\n\t\t\t\t// or more handles. If this happens, we need to return a clone of the `input` object where the\n\t\t\t\t// current property is replaced by the `replaced` value.\n\t\t\t\tif (replaced !== value) {\n\t\t\t\t\t// Lazily create a shallow clone of the `input` object if we haven't done so already.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- TODO: not sure if there's a good solution\n\t\t\t\t\tclone = clone ?? (Array.isArray(input) ? [...input] : { ...input });\n\n\t\t\t\t\t// Overwrite the current property `key` in the clone with the `replaced` value.\n\t\t\t\t\tclone[key] = replaced;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn clone ?? input;\n\t}\n\n\tprotected serializeHandle(\n\t\thandle: IFluidHandleInternal,\n\t\tbind: IFluidHandleInternal,\n\t): ISerializedHandle {\n\t\tbind.bind(handle);\n\t\treturn {\n\t\t\ttype: \"__fluid_handle__\",\n\t\t\turl: handle.absolutePath,\n\t\t};\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../src/serializer.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAOH,kEAA6D;AAC7D,qEAMgD;AAEhD,mEAAkE;AAuClE;;;GAGG;AACH,MAAa,eAAe;IAG3B,YAAoC,OAA4B;QAA5B,YAAO,GAAP,OAAO,CAAqB;QAyDhE,6EAA6E;QAC7E,iFAAiF;QAChE,gBAAW,GAAG,CAAC,KAAc,EAAE,IAA2B,EAAW,EAAE;YACvF,yDAAyD;YACzD,IAAI,IAAA,wBAAa,EAAC,KAAK,CAAC,EAAE,CAAC;gBAC1B,IAAA,iBAAM,EAAC,IAAI,KAAK,SAAS,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;gBACtF,OAAO,IAAI,CAAC,eAAe,CAAC,IAAA,gCAAqB,EAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;YACjE,CAAC;YACD,OAAO,KA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AO,KAAK,KAAK,QAAQ,EAAE,CAAC;gBAC1C,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,CAAC;oBACxB,qFAAqF;oBACrF,gHAAgH;oBAChH,KAAK,GAAG,KAAK,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;oBAEpE,+EAA+E;oBAC/E,KAAK,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;gBACvB,CAAC;YACF,CAAC;QACF,CAAC;QACD,OAAO,KAAK,IAAI,KAAK,CAAC;IACvB,CAAC;IAES,eAAe,CACxB,MAA4B,EAC5B,IAA0B;QAE1B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAClB,OAAO;YACN,IAAI,EAAE,kBAAkB;YACxB,GAAG,EAAE,MAAM,CAAC,YAAY;SACxB,CAAC;IACH,CAAC;CACD;AAlJD,0CAkJC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandle } from \"@fluidframework/core-interfaces\";\nimport {\n\tIFluidHandleContext,\n\ttype IFluidHandleInternal,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tgenerateHandleContextPath,\n\tisSerializedHandle,\n\tisFluidHandle,\n\ttoFluidHandleInternal,\n\ttype ISerializedHandle,\n} from \"@fluidframework/runtime-utils/internal\";\n\nimport { RemoteFluidObjectHandle } from \"./remoteObjectHandle.js\";\n\n/**\n * @legacy\n * @alpha\n */\nexport interface IFluidSerializer {\n\t/**\n\t * Given a mostly-plain object that may have handle objects embedded within, will return a fully-plain object\n\t * where any embedded IFluidHandles have been replaced with a serializable form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clones all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t */\n\tencode(value: unknown, bind: IFluidHandle): unknown;\n\n\t/**\n\t * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n\t * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t *\n\t * The decoded handles are implicitly bound to the handle context of this serializer.\n\t */\n\tdecode(input: unknown): unknown;\n\n\t/**\n\t * Stringifies a given value. Converts any IFluidHandle to its stringified equivalent.\n\t */\n\tstringify(value: unknown, bind: IFluidHandle): string;\n\n\t/**\n\t * Parses the given JSON input string and returns the JavaScript object defined by it. Any Fluid\n\t * handles will be realized as part of the parse\n\t */\n\tparse(value: string): unknown;\n}\n\n/**\n * Data Store serializer implementation\n * @internal\n */\nexport class FluidSerializer implements IFluidSerializer {\n\tprivate readonly root: IFluidHandleContext;\n\n\tpublic constructor(private readonly context: IFluidHandleContext) {\n\t\tthis.root = this.context;\n\t\twhile (this.root.routeContext !== undefined) {\n\t\t\tthis.root = this.root.routeContext;\n\t\t}\n\t}\n\n\tpublic get IFluidSerializer(): IFluidSerializer {\n\t\treturn this;\n\t}\n\n\t/**\n\t * Given a mostly-jsonable object tree that may have handle objects embedded within, will return a\n\t * fully-jsonable object tree where any embedded IFluidHandles have been replaced with a serializable form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t *\n\t * Any unbound handles encountered are bound to the provided IFluidHandle.\n\t */\n\tpublic encode(input: unknown, bind: IFluidHandleInternal): unknown {\n\t\t// If the given 'input' cannot contain handles, return it immediately. Otherwise,\n\t\t// return the result of 'recursivelyReplace()'.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\treturn !!input && typeof input === \"object\"\n\t\t\t? this.recursivelyReplace(input, this.encodeValue, bind)\n\t\t\t: input;\n\t}\n\n\t/**\n\t * Given a fully-jsonable object tree that may have encoded handle objects embedded within, will return an\n\t * equivalent object tree where any encoded IFluidHandles have been replaced with their decoded form.\n\t *\n\t * The original `input` object is not mutated. This method will shallowly clone all objects in the path from\n\t * the root to any replaced handles. (If no handles are found, returns the original object.)\n\t *\n\t * The decoded handles are implicitly bound to the handle context of this serializer.\n\t */\n\tpublic decode(input: unknown): unknown {\n\t\t// If the given 'input' cannot contain handles, return it immediately. Otherwise,\n\t\t// return the result of 'recursivelyReplace()'.\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\treturn !!input && typeof input === \"object\"\n\t\t\t? this.recursivelyReplace(input, this.decodeValue)\n\t\t\t: input;\n\t}\n\n\tpublic stringify(input: unknown, bind: IFluidHandle): string {\n\t\tconst bindInternal = toFluidHandleInternal(bind);\n\t\treturn JSON.stringify(input, (key, value) => this.encodeValue(value, bindInternal));\n\t}\n\n\t// Parses the serialized data - context must match the context with which the JSON was stringified\n\tpublic parse(input: string): unknown {\n\t\treturn JSON.parse(input, (key, value) => this.decodeValue(value));\n\t}\n\n\t// If the given 'value' is an IFluidHandle, returns the encoded IFluidHandle.\n\t// Otherwise returns the original 'value'. Used by 'encode()' and 'stringify()'.\n\tprivate readonly encodeValue = (value: unknown, bind?: IFluidHandleInternal): unknown => {\n\t\t// If 'value' is an IFluidHandle return its encoded form.\n\t\tif (isFluidHandle(value)) {\n\t\t\tassert(bind !== undefined, 0xa93 /* Cannot encode a handle without a bind context */);\n\t\t\treturn this.serializeHandle(toFluidHandleInternal(value), bind);\n\t\t}\n\t\treturn value;\n\t};\n\n\t// If the given 'value' is an encoded IFluidHandle, returns the decoded IFluidHandle.\n\t// Otherwise returns the original 'value'. Used by 'decode()' and 'parse()'.\n\tprivate readonly decodeValue = (value: unknown): unknown => {\n\t\t// If 'value' is a serialized IFluidHandle return the deserialized result.\n\t\tif (isSerializedHandle(value)) {\n\t\t\t// Old documents may have handles with relative path in their summaries. Convert these to absolute\n\t\t\t// paths. This will ensure that future summaries will have absolute paths for these handles.\n\t\t\tconst absolutePath = value.url.startsWith(\"/\")\n\t\t\t\t? value.url\n\t\t\t\t: generateHandleContextPath(value.url, this.context);\n\n\t\t\treturn new RemoteFluidObjectHandle(absolutePath, this.root);\n\t\t} else {\n\t\t\treturn value;\n\t\t}\n\t};\n\n\t// Invoked for non-null objects to recursively replace references to IFluidHandles.\n\t// Clones as-needed to avoid mutating the `input` object. If no IFluidHandes are present,\n\t// returns the original `input`.\n\tprivate recursivelyReplace<TContext = unknown>(\n\t\tinput: object,\n\t\treplacer: (input: unknown, context?: TContext) => unknown,\n\t\tcontext?: TContext,\n\t): unknown {\n\t\t// Note: Caller is responsible for ensuring that `input` is defined / non-null.\n\t\t// (Required for Object.keys() below.)\n\n\t\t// Execute the `replace` on the current input. Note that Caller is responsible for ensuring that `input`\n\t\t// is a non-null object.\n\t\tconst maybeReplaced = replacer(input, context);\n\n\t\t// If either input or the replaced result is a Fluid Handle, there is no need to descend further.\n\t\t// IFluidHandles are always leaves in the object graph, and the code below cannot deal with IFluidHandle's structure.\n\t\tif (isFluidHandle(input) || isFluidHandle(maybeReplaced)) {\n\t\t\treturn maybeReplaced;\n\t\t}\n\n\t\t// Otherwise descend into the object graph looking for IFluidHandle instances.\n\t\tlet clone: object | undefined;\n\t\tfor (const key of Object.keys(input)) {\n\t\t\tconst value: unknown = input[key];\n\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\tif (!!value && typeof value === \"object\") {\n\t\t\t\t// Note: Except for IFluidHandle, `input` must not contain circular references (as object must\n\t\t\t\t// be JSON serializable.) Therefore, guarding against infinite recursion here would only\n\t\t\t\t// lead to a later error when attempting to stringify().\n\t\t\t\tconst replaced = this.recursivelyReplace(value, replacer, context);\n\n\t\t\t\t// If the `replaced` object is different than the original `value` then the subgraph contained one\n\t\t\t\t// or more handles. If this happens, we need to return a clone of the `input` object where the\n\t\t\t\t// current property is replaced by the `replaced` value.\n\t\t\t\tif (replaced !== value) {\n\t\t\t\t\t// Lazily create a shallow clone of the `input` object if we haven't done so already.\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- TODO: not sure if there's a good solution\n\t\t\t\t\tclone = clone ?? (Array.isArray(input) ? [...input] : { ...input });\n\n\t\t\t\t\t// Overwrite the current property `key` in the clone with the `replaced` value.\n\t\t\t\t\tclone[key] = replaced;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn clone ?? input;\n\t}\n\n\tprotected serializeHandle(\n\t\thandle: IFluidHandleInternal,\n\t\tbind: IFluidHandleInternal,\n\t): ISerializedHandle {\n\t\tbind.bind(handle);\n\t\treturn {\n\t\t\ttype: \"__fluid_handle__\",\n\t\t\turl: handle.absolutePath,\n\t\t};\n\t}\n}\n"]}
|
package/dist/sharedObject.d.ts
CHANGED
|
@@ -125,7 +125,7 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
|
|
|
125
125
|
*/
|
|
126
126
|
abstract summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext): Promise<ISummaryTreeWithStats>;
|
|
127
127
|
/**
|
|
128
|
-
* {@inheritDoc (
|
|
128
|
+
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getGCData}
|
|
129
129
|
*/
|
|
130
130
|
abstract getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
131
131
|
/**
|
|
@@ -149,11 +149,11 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
|
|
|
149
149
|
* @param localOpMetadata - For local client messages, this is the metadata that was submitted with the message.
|
|
150
150
|
* For messages from a remote client, this will be undefined.
|
|
151
151
|
*/
|
|
152
|
-
protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown):
|
|
152
|
+
protected abstract processCore(message: ISequencedDocumentMessage, local: boolean, localOpMetadata: unknown): void;
|
|
153
153
|
/**
|
|
154
154
|
* Called when the object has disconnected from the delta stream.
|
|
155
155
|
*/
|
|
156
|
-
protected abstract onDisconnect():
|
|
156
|
+
protected abstract onDisconnect(): void;
|
|
157
157
|
/**
|
|
158
158
|
* The serializer to serialize / parse handles.
|
|
159
159
|
*/
|
|
@@ -166,7 +166,7 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
|
|
|
166
166
|
* and not sent to the server. This will be sent back when this message is received back from the server. This is
|
|
167
167
|
* also sent if we are asked to resubmit the message.
|
|
168
168
|
*/
|
|
169
|
-
protected submitLocalMessage(content:
|
|
169
|
+
protected submitLocalMessage(content: unknown, localOpMetadata?: unknown): void;
|
|
170
170
|
/**
|
|
171
171
|
* Marks this object as dirty so that it is part of the next summary. It is called by a SharedSummaryBlock
|
|
172
172
|
* that want to be part of summary but does not generate ops.
|
|
@@ -185,14 +185,14 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
|
|
|
185
185
|
* @param content - The content of the original message.
|
|
186
186
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
187
187
|
*/
|
|
188
|
-
protected reSubmitCore(content:
|
|
188
|
+
protected reSubmitCore(content: unknown, localOpMetadata: unknown): void;
|
|
189
189
|
/**
|
|
190
190
|
* Promises that are waiting for an ack from the server before resolving should use this instead of new Promise.
|
|
191
191
|
* It ensures that if something changes that will interrupt that ack (e.g. the FluidDataStoreRuntime disposes),
|
|
192
192
|
* the Promise will reject.
|
|
193
193
|
* If runtime is disposed when this call is made, executor is not run and promise is rejected right away.
|
|
194
194
|
*/
|
|
195
|
-
protected newAckBasedPromise<T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?:
|
|
195
|
+
protected newAckBasedPromise<T>(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: unknown) => void) => void): Promise<T>;
|
|
196
196
|
private attachDeltaHandler;
|
|
197
197
|
/**
|
|
198
198
|
* Set the state of connection to services.
|
|
@@ -222,7 +222,7 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
|
|
|
222
222
|
/**
|
|
223
223
|
* Revert an op
|
|
224
224
|
*/
|
|
225
|
-
protected rollback(content:
|
|
225
|
+
protected rollback(content: unknown, localOpMetadata: unknown): void;
|
|
226
226
|
/**
|
|
227
227
|
* Apply changes from the provided op content just as if a local client has made the change,
|
|
228
228
|
* including submitting the op. Used when rehydrating an attached container
|
|
@@ -240,7 +240,7 @@ export declare abstract class SharedObjectCore<TEvent extends ISharedObjectEvent
|
|
|
240
240
|
*
|
|
241
241
|
* @param content - Contents of a stashed op.
|
|
242
242
|
*/
|
|
243
|
-
protected abstract applyStashedOp(content:
|
|
243
|
+
protected abstract applyStashedOp(content: unknown): void;
|
|
244
244
|
/**
|
|
245
245
|
* Emit an event. This function is only intended for use by DDS classes that extend SharedObject/SharedObjectCore,
|
|
246
246
|
* specifically to emit events that are part of the public interface of the DDS (i.e. those that can have listeners
|
|
@@ -293,7 +293,7 @@ export declare abstract class SharedObject<TEvent extends ISharedObjectEvents =
|
|
|
293
293
|
*/
|
|
294
294
|
summarize(fullTree?: boolean, trackState?: boolean, telemetryContext?: ITelemetryContext, incrementalSummaryContext?: IExperimentalIncrementalSummaryContext): Promise<ISummaryTreeWithStats>;
|
|
295
295
|
/**
|
|
296
|
-
* {@inheritDoc (
|
|
296
|
+
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getGCData}
|
|
297
297
|
*/
|
|
298
298
|
getGCData(fullGC?: boolean): IGarbageCollectionData;
|
|
299
299
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharedObject.d.ts","sourceRoot":"","sources":["../src/sharedObject.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,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AAsB,CAAC,aAAa,EACnD,OAAO,EAAE,CAAC,UAAU,eAAe,CAAC,aAAa,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC7E,iBAAiB,CAAC,aAAa,CAAC,GAAG,gBAAgB,CAAC,aAAa,CAAC,CAiBpE"}
|
package/dist/sharedObject.js
CHANGED
|
@@ -225,7 +225,6 @@ class SharedObjectCore extends internal_4.EventEmitterWithErrorHandling {
|
|
|
225
225
|
* and not sent to the server. This will be sent back when this message is received back from the server. This is
|
|
226
226
|
* also sent if we are asked to resubmit the message.
|
|
227
227
|
*/
|
|
228
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- TODO: AB#26129 use unknown instead of any (legacy breaking)
|
|
229
228
|
submitLocalMessage(content, localOpMetadata = undefined) {
|
|
230
229
|
this.verifyNotClosed();
|
|
231
230
|
if (this.isAttached()) {
|
|
@@ -257,7 +256,6 @@ class SharedObjectCore extends internal_4.EventEmitterWithErrorHandling {
|
|
|
257
256
|
* @param content - The content of the original message.
|
|
258
257
|
* @param localOpMetadata - The local metadata associated with the original message.
|
|
259
258
|
*/
|
|
260
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- TODO: AB#26129 use unknown instead of any (legacy breaking)
|
|
261
259
|
reSubmitCore(content, localOpMetadata) {
|
|
262
260
|
this.submitLocalMessage(content, localOpMetadata);
|
|
263
261
|
}
|
|
@@ -382,7 +380,6 @@ class SharedObjectCore extends internal_4.EventEmitterWithErrorHandling {
|
|
|
382
380
|
/**
|
|
383
381
|
* Revert an op
|
|
384
382
|
*/
|
|
385
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any -- TODO: AB#26129 use unknown instead of any (legacy breaking)
|
|
386
383
|
rollback(content, localOpMetadata) {
|
|
387
384
|
throw new Error("rollback not supported");
|
|
388
385
|
}
|
|
@@ -465,7 +462,7 @@ class SharedObject extends SharedObjectCore {
|
|
|
465
462
|
return result;
|
|
466
463
|
}
|
|
467
464
|
/**
|
|
468
|
-
* {@inheritDoc (
|
|
465
|
+
* {@inheritDoc @fluidframework/datastore-definitions#(IChannel:interface).getGCData}
|
|
469
466
|
*/
|
|
470
467
|
getGCData(fullGC = false) {
|
|
471
468
|
// Set _isGCing to true. This flag is used to ensure that we only use SummarySerializer to serialize handles
|