@fluidframework/runtime-utils 2.0.0-dev-rc.3.0.0.254866 → 2.0.0-dev-rc.5.0.0.263932
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 +53 -0
- package/api-report/runtime-utils.api.md +44 -1
- package/dist/dataStoreHelpers.d.ts +1 -1
- package/dist/dataStoreHelpers.js +1 -1
- package/dist/dataStoreHelpers.js.map +1 -1
- package/dist/deltaManager.d.ts +19 -0
- package/dist/deltaManager.d.ts.map +1 -0
- package/dist/deltaManager.js +25 -0
- package/dist/deltaManager.js.map +1 -0
- package/dist/handles.d.ts +35 -0
- package/dist/handles.d.ts.map +1 -1
- package/dist/handles.js +79 -1
- package/dist/handles.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -1
- package/dist/index.js.map +1 -1
- package/dist/{alpha.d.ts → legacy.d.ts} +8 -2
- package/dist/public.d.ts +3 -0
- package/dist/snapshotUtils.d.ts +14 -0
- package/dist/snapshotUtils.d.ts.map +1 -0
- package/dist/snapshotUtils.js +37 -0
- package/dist/snapshotUtils.js.map +1 -0
- package/{dist/beta.d.ts → internal.d.ts} +2 -0
- package/{lib/beta.d.ts → legacy.d.ts} +2 -0
- package/lib/dataStoreHelpers.d.ts +1 -1
- package/lib/dataStoreHelpers.js +1 -1
- package/lib/dataStoreHelpers.js.map +1 -1
- package/lib/deltaManager.d.ts +19 -0
- package/lib/deltaManager.d.ts.map +1 -0
- package/lib/deltaManager.js +20 -0
- package/lib/deltaManager.js.map +1 -0
- package/lib/handles.d.ts +35 -0
- package/lib/handles.d.ts.map +1 -1
- package/lib/handles.js +74 -0
- package/lib/handles.js.map +1 -1
- package/lib/index.d.ts +3 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -1
- package/lib/index.js.map +1 -1
- package/lib/{alpha.d.ts → legacy.d.ts} +8 -2
- package/lib/public.d.ts +3 -0
- package/lib/snapshotUtils.d.ts +14 -0
- package/lib/snapshotUtils.d.ts.map +1 -0
- package/lib/snapshotUtils.js +33 -0
- package/lib/snapshotUtils.js.map +1 -0
- package/lib/tsdoc-metadata.json +1 -1
- package/package.json +26 -31
- package/src/dataStoreHelpers.ts +1 -1
- package/src/deltaManager.ts +32 -0
- package/src/handles.ts +92 -0
- package/src/index.ts +10 -1
- package/src/snapshotUtils.ts +38 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { generateErrorWithStack } from \"@fluidframework/telemetry-utils/internal\";\n\ninterface IResponseException extends Error {\n\terrorFromRequestFluidObject: true;\n\tmessage: string;\n\tcode: number;\n\tstack?: string;\n\tunderlyingResponseHeaders?: { [key: string]: any };\n}\n\n/**\n * @internal\n */\nexport function exceptionToResponse(err: any): IResponse {\n\tconst status = 500;\n\tif (err !== null && typeof err === \"object\" && err.errorFromRequestFluidObject === true) {\n\t\tconst responseErr: IResponseException = err;\n\t\treturn {\n\t\t\tmimeType: \"text/plain\",\n\t\t\tstatus: responseErr.code,\n\t\t\tvalue: responseErr.message,\n\t\t\tget stack() {\n\t\t\t\treturn responseErr.stack;\n\t\t\t},\n\t\t\theaders: responseErr.underlyingResponseHeaders,\n\t\t};\n\t}\n\n\t// Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: `${err}`,\n\t\tget stack() {\n\t\t\treturn (err?.stack as string | undefined) ?? errWithStack.stack;\n\t\t},\n\t};\n}\n\n/**\n * @internal\n */\nexport function responseToException(response: IResponse, request: IRequest): Error {\n\tconst message = response.value;\n\tconst errWithStack = generateErrorWithStack();\n\tconst responseErr: Error & IResponseException = {\n\t\terrorFromRequestFluidObject: true,\n\t\tmessage,\n\t\tname: \"Error\",\n\t\tcode: response.status,\n\t\tget stack() {\n\t\t\treturn response.stack ?? errWithStack.stack;\n\t\t},\n\t\tunderlyingResponseHeaders: response.headers,\n\t};\n\n\treturn responseErr;\n}\n\n/**\n * @
|
|
1
|
+
{"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAM7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAUlF;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAQ;IAC3C,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,2BAA2B,KAAK,IAAI,EAAE;QACxF,MAAM,WAAW,GAAuB,GAAG,CAAC;QAC5C,OAAO;YACN,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,WAAW,CAAC,IAAI;YACxB,KAAK,EAAE,WAAW,CAAC,OAAO;YAC1B,IAAI,KAAK;gBACR,OAAO,WAAW,CAAC,KAAK,CAAC;YAC1B,CAAC;YACD,OAAO,EAAE,WAAW,CAAC,yBAAyB;SAC9C,CAAC;KACF;IAED,0GAA0G;IAC1G,MAAM,YAAY,GAAG,sBAAsB,EAAE,CAAC;IAE9C,OAAO;QACN,QAAQ,EAAE,YAAY;QACtB,MAAM;QACN,KAAK,EAAE,GAAG,GAAG,EAAE;QACf,IAAI,KAAK;YACR,OAAQ,GAAG,EAAE,KAA4B,IAAI,YAAY,CAAC,KAAK,CAAC;QACjE,CAAC;KACD,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAmB,EAAE,OAAiB;IACzE,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC;IAC/B,MAAM,YAAY,GAAG,sBAAsB,EAAE,CAAC;IAC9C,MAAM,WAAW,GAA+B;QAC/C,2BAA2B,EAAE,IAAI;QACjC,OAAO;QACP,IAAI,EAAE,OAAO;QACb,IAAI,EAAE,QAAQ,CAAC,MAAM;QACrB,IAAI,KAAK;YACR,OAAO,QAAQ,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC;QAC7C,CAAC;QACD,yBAAyB,EAAE,QAAQ,CAAC,OAAO;KAC3C,CAAC;IAEF,OAAO,WAAW,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAiB,EAAE,EAAE,CACtD,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAAc,EACd,KAAa,EACb,OAAiB,EACjB,OAAgC;IAEhC,MAAM,CAAC,MAAM,KAAK,GAAG,EAAE,KAAK,CAAC,sDAAsD,CAAC,CAAC;IACrF,wEAAwE;IACxE,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAE9C,0GAA0G;IAC1G,MAAM,YAAY,GAAG,sBAAsB,EAAE,CAAC;IAE9C,OAAO;QACN,QAAQ,EAAE,YAAY;QACtB,MAAM;QACN,KAAK,EAAE,UAAU,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,UAAU,EAAE;QACnE,IAAI,KAAK;YACR,OAAO,YAAY,CAAC,KAAK,CAAC;QAC3B,CAAC;QACD,OAAO;KACP,CAAC;AACH,CAAC;AAOD;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACrC,IAAY,EACZ,OAAmC;IAEnC,OAAO;QACN,IAAI;QACJ,IAAI,sBAAsB;YACzB,OAAO,IAAI,CAAC;QACb,CAAC;QACD,IAAI,uBAAuB;YAC1B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,CACjD,CAAC,MAAM,OAAO,CAAC,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC;QACxD,GAAG,EAAE,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,uBAAuB,EAAE,GAAG,CAAC,IAAI,CAAC;KAC/E,CAAC;AACH,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport {\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n} from \"@fluidframework/runtime-definitions/internal\";\nimport { generateErrorWithStack } from \"@fluidframework/telemetry-utils/internal\";\n\ninterface IResponseException extends Error {\n\terrorFromRequestFluidObject: true;\n\tmessage: string;\n\tcode: number;\n\tstack?: string;\n\tunderlyingResponseHeaders?: { [key: string]: any };\n}\n\n/**\n * @internal\n */\nexport function exceptionToResponse(err: any): IResponse {\n\tconst status = 500;\n\tif (err !== null && typeof err === \"object\" && err.errorFromRequestFluidObject === true) {\n\t\tconst responseErr: IResponseException = err;\n\t\treturn {\n\t\t\tmimeType: \"text/plain\",\n\t\t\tstatus: responseErr.code,\n\t\t\tvalue: responseErr.message,\n\t\t\tget stack() {\n\t\t\t\treturn responseErr.stack;\n\t\t\t},\n\t\t\theaders: responseErr.underlyingResponseHeaders,\n\t\t};\n\t}\n\n\t// Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: `${err}`,\n\t\tget stack() {\n\t\t\treturn (err?.stack as string | undefined) ?? errWithStack.stack;\n\t\t},\n\t};\n}\n\n/**\n * @internal\n */\nexport function responseToException(response: IResponse, request: IRequest): Error {\n\tconst message = response.value;\n\tconst errWithStack = generateErrorWithStack();\n\tconst responseErr: Error & IResponseException = {\n\t\terrorFromRequestFluidObject: true,\n\t\tmessage,\n\t\tname: \"Error\",\n\t\tcode: response.status,\n\t\tget stack() {\n\t\t\treturn response.stack ?? errWithStack.stack;\n\t\t},\n\t\tunderlyingResponseHeaders: response.headers,\n\t};\n\n\treturn responseErr;\n}\n\n/**\n * @alpha\n */\nexport const create404Response = (request: IRequest) =>\n\tcreateResponseError(404, \"not found\", request);\n\n/**\n * @internal\n */\nexport function createResponseError(\n\tstatus: number,\n\tvalue: string,\n\trequest: IRequest,\n\theaders?: { [key: string]: any },\n): IResponse {\n\tassert(status !== 200, 0x19b /* \"Cannot not create response error on 200 status\" */);\n\t// Omit query string which could contain personal data unfit for logging\n\tconst urlNoQuery = request.url?.split(\"?\")[0];\n\n\t// Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: urlNoQuery === undefined ? value : `${value}: ${urlNoQuery}`,\n\t\tget stack() {\n\t\t\treturn errWithStack.stack;\n\t\t},\n\t\theaders,\n\t};\n}\n\n/**\n * @internal\n */\nexport type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;\n\n/**\n * @internal\n */\nexport function createDataStoreFactory(\n\ttype: string,\n\tfactory: Factory | Promise<Factory>,\n): IFluidDataStoreFactory & IFluidDataStoreRegistry {\n\treturn {\n\t\ttype,\n\t\tget IFluidDataStoreFactory() {\n\t\t\treturn this;\n\t\t},\n\t\tget IFluidDataStoreRegistry() {\n\t\t\treturn this;\n\t\t},\n\t\tinstantiateDataStore: async (context, existing) =>\n\t\t\t(await factory).instantiateDataStore(context, existing),\n\t\tget: async (name: string) => (await factory).IFluidDataStoreRegistry?.get(name),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { IDeltaManager } from "@fluidframework/container-definitions/internal";
|
|
6
|
+
import type { IDeltaManagerErased } from "@fluidframework/datastore-definitions";
|
|
7
|
+
import type { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
8
|
+
/**
|
|
9
|
+
* Casts the public API for delta manager into the internal one,
|
|
10
|
+
* exposing access to APIs needed by the implementation of Fluid Framework but not its users.
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
export declare function toDeltaManagerInternal(deltaManager: IDeltaManagerErased): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
14
|
+
/**
|
|
15
|
+
* Casts the the internal API for delta manager into the public type erased API for returning from public APIs that should not have access to any of its members.
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
18
|
+
export declare function toDeltaManagerErased(deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>): IDeltaManagerErased;
|
|
19
|
+
//# sourceMappingURL=deltaManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deltaManager.d.ts","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,OAAO,KAAK,EACX,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,sCAAsC,CAAC;AAE9C;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,YAAY,EAAE,mBAAmB,GAC/B,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,CAE5D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,GACtE,mBAAmB,CAErB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Casts the public API for delta manager into the internal one,
|
|
7
|
+
* exposing access to APIs needed by the implementation of Fluid Framework but not its users.
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export function toDeltaManagerInternal(deltaManager) {
|
|
11
|
+
return deltaManager;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Casts the the internal API for delta manager into the public type erased API for returning from public APIs that should not have access to any of its members.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export function toDeltaManagerErased(deltaManager) {
|
|
18
|
+
return deltaManager;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=deltaManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACrC,YAAiC;IAEjC,OAAO,YAAqF,CAAC;AAC9F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CACnC,YAAwE;IAExE,OAAO,YAA8C,CAAC;AACvD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IDeltaManager } from \"@fluidframework/container-definitions/internal\";\nimport type { IDeltaManagerErased } from \"@fluidframework/datastore-definitions\";\nimport type {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Casts the public API for delta manager into the internal one,\n * exposing access to APIs needed by the implementation of Fluid Framework but not its users.\n * @alpha\n */\nexport function toDeltaManagerInternal(\n\tdeltaManager: IDeltaManagerErased,\n): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\treturn deltaManager as unknown as IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;\n}\n\n/**\n * Casts the the internal API for delta manager into the public type erased API for returning from public APIs that should not have access to any of its members.\n * @internal\n */\nexport function toDeltaManagerErased(\n\tdeltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,\n): IDeltaManagerErased {\n\treturn deltaManager as unknown as IDeltaManagerErased;\n}\n"]}
|
package/lib/handles.d.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import type { IFluidHandleErased, IFluidHandleInternal } from "@fluidframework/core-interfaces/internal";
|
|
6
|
+
import { IFluidHandle, fluidHandleSymbol } from "@fluidframework/core-interfaces";
|
|
5
7
|
/**
|
|
6
8
|
* JSON serialized form of an IFluidHandle
|
|
7
9
|
* @internal
|
|
@@ -15,4 +17,37 @@ export interface ISerializedHandle {
|
|
|
15
17
|
* @internal
|
|
16
18
|
*/
|
|
17
19
|
export declare const isSerializedHandle: (value: any) => value is ISerializedHandle;
|
|
20
|
+
/**
|
|
21
|
+
* Check if a value is an IFluidHandle.
|
|
22
|
+
* @remarks
|
|
23
|
+
* Objects which have a field named `IFluidHandle` can in some cases produce a false positive.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function isFluidHandle(value: unknown): value is IFluidHandle;
|
|
27
|
+
/**
|
|
28
|
+
* Downcast an IFluidHandle to an IFluidHandleInternal.
|
|
29
|
+
* @alpha
|
|
30
|
+
*/
|
|
31
|
+
export declare function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T>;
|
|
32
|
+
/**
|
|
33
|
+
* Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.
|
|
34
|
+
* @alpha
|
|
35
|
+
*/
|
|
36
|
+
export declare function toFluidHandleErased<T>(handle: IFluidHandleInternal<T>): IFluidHandleErased<T>;
|
|
37
|
+
/**
|
|
38
|
+
* Base class which can be uses to assist implementing IFluidHandleInternal.
|
|
39
|
+
* @alpha
|
|
40
|
+
*/
|
|
41
|
+
export declare abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {
|
|
42
|
+
abstract absolutePath: string;
|
|
43
|
+
abstract attachGraph(): void;
|
|
44
|
+
abstract bind(handle: IFluidHandleInternal): void;
|
|
45
|
+
abstract readonly isAttached: boolean;
|
|
46
|
+
abstract get(): Promise<T>;
|
|
47
|
+
/**
|
|
48
|
+
* {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
|
|
49
|
+
*/
|
|
50
|
+
get IFluidHandle(): IFluidHandleInternal;
|
|
51
|
+
get [fluidHandleSymbol](): IFluidHandleErased<T>;
|
|
52
|
+
}
|
|
18
53
|
//# sourceMappingURL=handles.d.ts.map
|
package/lib/handles.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAEjC,IAAI,EAAE,kBAAkB,CAAC;IAGzB,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAAW,GAAG,+BACV,CAAC"}
|
|
1
|
+
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EACX,kBAAkB,EAClB,oBAAoB,EACpB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAElF;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAEjC,IAAI,EAAE,kBAAkB,CAAC;IAGzB,GAAG,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,eAAO,MAAM,kBAAkB,UAAW,GAAG,+BACV,CAAC;AAcpC;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAkBnE;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAWzF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAE7F;AAED;;;GAGG;AACH,8BAAsB,eAAe,CAAC,CAAC,CAAE,YAAW,oBAAoB,CAAC,CAAC,CAAC;IAC1E,SAAgB,YAAY,EAAE,MAAM,CAAC;aACrB,WAAW,IAAI,IAAI;aACnB,IAAI,CAAC,MAAM,EAAE,oBAAoB,GAAG,IAAI;IACxD,kBAAyB,UAAU,EAAE,OAAO,CAAC;aAC7B,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC;IAEjC;;OAEG;IACH,IAAW,YAAY,IAAI,oBAAoB,CAE9C;IAED,IAAW,CAAC,iBAAiB,CAAC,IAAI,kBAAkB,CAAC,CAAC,CAAC,CAEtD;CACD"}
|
package/lib/handles.js
CHANGED
|
@@ -2,9 +2,83 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
+
import { IFluidHandle, fluidHandleSymbol } from "@fluidframework/core-interfaces";
|
|
5
6
|
/**
|
|
6
7
|
* Is the input object a @see ISerializedHandle?
|
|
7
8
|
* @internal
|
|
8
9
|
*/
|
|
9
10
|
export const isSerializedHandle = (value) => value?.type === "__fluid_handle__";
|
|
11
|
+
/**
|
|
12
|
+
* Setting to opt into compatibility with handles from before {@link fluidHandleSymbol} existed (Fluid Framework client 2.0.0-rc.3.0.0 and earlier).
|
|
13
|
+
*
|
|
14
|
+
* Some code which uses this library might dynamically load multiple versions of it,
|
|
15
|
+
* as well as old or duplicated versions of packages which produce or implement handles.
|
|
16
|
+
* To correctly interoperate with this old packages and object produced by them, the old in-memory format for handles, without the symbol, are explicitly supported.
|
|
17
|
+
*
|
|
18
|
+
* This setting mostly exists as a way to easily find any code that only exists to provide this compatibility and clarify how to remove that compatibility.
|
|
19
|
+
* At some point this might be removed or turned into an actual configuration option, but for now its really just documentation.
|
|
20
|
+
*/
|
|
21
|
+
const enableBackwardsCompatibility = true;
|
|
22
|
+
/**
|
|
23
|
+
* Check if a value is an IFluidHandle.
|
|
24
|
+
* @remarks
|
|
25
|
+
* Objects which have a field named `IFluidHandle` can in some cases produce a false positive.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export function isFluidHandle(value) {
|
|
29
|
+
// `in` gives a type error on non-objects and null, so filter them out
|
|
30
|
+
if (typeof value !== "object" || value === null) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
if (fluidHandleSymbol in value) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
// If enableBackwardsCompatibility, run check for FluidHandles predating use of fluidHandleSymbol.
|
|
37
|
+
if (enableBackwardsCompatibility && IFluidHandle in value) {
|
|
38
|
+
// Since this check can have false positives, make it a bit more robust by checking value[IFluidHandle][IFluidHandle]
|
|
39
|
+
const inner = value[IFluidHandle];
|
|
40
|
+
if (typeof inner !== "object" || inner === null) {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
return IFluidHandle in inner;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Downcast an IFluidHandle to an IFluidHandleInternal.
|
|
49
|
+
* @alpha
|
|
50
|
+
*/
|
|
51
|
+
export function toFluidHandleInternal(handle) {
|
|
52
|
+
if (!(fluidHandleSymbol in handle) || !(fluidHandleSymbol in handle[fluidHandleSymbol])) {
|
|
53
|
+
if (enableBackwardsCompatibility && IFluidHandle in handle) {
|
|
54
|
+
return handle[IFluidHandle];
|
|
55
|
+
}
|
|
56
|
+
throw new TypeError("Invalid IFluidHandle");
|
|
57
|
+
}
|
|
58
|
+
// This casts the IFluidHandleErased from the symbol instead of `handle` to ensure that if someone
|
|
59
|
+
// implements their own IFluidHandle in terms of an existing handle, it won't break anything.
|
|
60
|
+
return handle[fluidHandleSymbol];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.
|
|
64
|
+
* @alpha
|
|
65
|
+
*/
|
|
66
|
+
export function toFluidHandleErased(handle) {
|
|
67
|
+
return handle;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Base class which can be uses to assist implementing IFluidHandleInternal.
|
|
71
|
+
* @alpha
|
|
72
|
+
*/
|
|
73
|
+
export class FluidHandleBase {
|
|
74
|
+
/**
|
|
75
|
+
* {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}
|
|
76
|
+
*/
|
|
77
|
+
get IFluidHandle() {
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
get [fluidHandleSymbol]() {
|
|
81
|
+
return toFluidHandleErased(this);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
10
84
|
//# sourceMappingURL=handles.js.map
|
package/lib/handles.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAclF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAU,EAA8B,EAAE,CAC5E,KAAK,EAAE,IAAI,KAAK,kBAAkB,CAAC;AAEpC;;;;;;;;;GASG;AACH,MAAM,4BAA4B,GAAG,IAAI,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC3C,sEAAsE;IACtE,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;QAChD,OAAO,KAAK,CAAC;KACb;IACD,IAAI,iBAAiB,IAAI,KAAK,EAAE;QAC/B,OAAO,IAAI,CAAC;KACZ;IACD,kGAAkG;IAClG,IAAI,4BAA4B,IAAI,YAAY,IAAI,KAAK,EAAE;QAC1D,qHAAqH;QACrH,MAAM,KAAK,GAAG,KAAK,CAAC,YAAY,CAAiB,CAAC;QAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,EAAE;YAChD,OAAO,KAAK,CAAC;SACb;QACD,OAAO,YAAY,IAAI,KAAK,CAAC;KAC7B;IACD,OAAO,KAAK,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAI,MAAuB;IAC/D,IAAI,CAAC,CAAC,iBAAiB,IAAI,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,IAAI,MAAM,CAAC,iBAAiB,CAAC,CAAC,EAAE;QACxF,IAAI,4BAA4B,IAAI,YAAY,IAAI,MAAM,EAAE;YAC3D,OAAO,MAAM,CAAC,YAAY,CAA4B,CAAC;SACvD;QACD,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,CAAC;KAC5C;IAED,kGAAkG;IAClG,6FAA6F;IAC7F,OAAO,MAAM,CAAC,iBAAiB,CAAuC,CAAC;AACxE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAI,MAA+B;IACrE,OAAO,MAA0C,CAAC;AACnD,CAAC;AAED;;;GAGG;AACH,MAAM,OAAgB,eAAe;IAOpC;;OAEG;IACH,IAAW,YAAY;QACtB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,IAAW,CAAC,iBAAiB,CAAC;QAC7B,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type {\n\tIFluidHandleErased,\n\tIFluidHandleInternal,\n} from \"@fluidframework/core-interfaces/internal\";\nimport { IFluidHandle, fluidHandleSymbol } from \"@fluidframework/core-interfaces\";\n\n/**\n * JSON serialized form of an IFluidHandle\n * @internal\n */\nexport interface ISerializedHandle {\n\t// Marker to indicate to JSON.parse that the object is a Fluid handle\n\ttype: \"__fluid_handle__\";\n\n\t// URL to the object. Relative URLs are relative to the handle context passed to the stringify.\n\turl: string;\n}\n\n/**\n * Is the input object a @see ISerializedHandle?\n * @internal\n */\nexport const isSerializedHandle = (value: any): value is ISerializedHandle =>\n\tvalue?.type === \"__fluid_handle__\";\n\n/**\n * Setting to opt into compatibility with handles from before {@link fluidHandleSymbol} existed (Fluid Framework client 2.0.0-rc.3.0.0 and earlier).\n *\n * Some code which uses this library might dynamically load multiple versions of it,\n * as well as old or duplicated versions of packages which produce or implement handles.\n * To correctly interoperate with this old packages and object produced by them, the old in-memory format for handles, without the symbol, are explicitly supported.\n *\n * This setting mostly exists as a way to easily find any code that only exists to provide this compatibility and clarify how to remove that compatibility.\n * At some point this might be removed or turned into an actual configuration option, but for now its really just documentation.\n */\nconst enableBackwardsCompatibility = true;\n\n/**\n * Check if a value is an IFluidHandle.\n * @remarks\n * Objects which have a field named `IFluidHandle` can in some cases produce a false positive.\n * @internal\n */\nexport function isFluidHandle(value: unknown): value is IFluidHandle {\n\t// `in` gives a type error on non-objects and null, so filter them out\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\tif (fluidHandleSymbol in value) {\n\t\treturn true;\n\t}\n\t// If enableBackwardsCompatibility, run check for FluidHandles predating use of fluidHandleSymbol.\n\tif (enableBackwardsCompatibility && IFluidHandle in value) {\n\t\t// Since this check can have false positives, make it a bit more robust by checking value[IFluidHandle][IFluidHandle]\n\t\tconst inner = value[IFluidHandle] as IFluidHandle;\n\t\tif (typeof inner !== \"object\" || inner === null) {\n\t\t\treturn false;\n\t\t}\n\t\treturn IFluidHandle in inner;\n\t}\n\treturn false;\n}\n\n/**\n * Downcast an IFluidHandle to an IFluidHandleInternal.\n * @alpha\n */\nexport function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T> {\n\tif (!(fluidHandleSymbol in handle) || !(fluidHandleSymbol in handle[fluidHandleSymbol])) {\n\t\tif (enableBackwardsCompatibility && IFluidHandle in handle) {\n\t\t\treturn handle[IFluidHandle] as IFluidHandleInternal<T>;\n\t\t}\n\t\tthrow new TypeError(\"Invalid IFluidHandle\");\n\t}\n\n\t// This casts the IFluidHandleErased from the symbol instead of `handle` to ensure that if someone\n\t// implements their own IFluidHandle in terms of an existing handle, it won't break anything.\n\treturn handle[fluidHandleSymbol] as unknown as IFluidHandleInternal<T>;\n}\n\n/**\n * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.\n * @alpha\n */\nexport function toFluidHandleErased<T>(handle: IFluidHandleInternal<T>): IFluidHandleErased<T> {\n\treturn handle as unknown as IFluidHandleErased<T>;\n}\n\n/**\n * Base class which can be uses to assist implementing IFluidHandleInternal.\n * @alpha\n */\nexport abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {\n\tpublic abstract absolutePath: string;\n\tpublic abstract attachGraph(): void;\n\tpublic abstract bind(handle: IFluidHandleInternal): void;\n\tpublic abstract readonly isAttached: boolean;\n\tpublic abstract get(): Promise<T>;\n\n\t/**\n\t * {@inheritDoc @fluidframework/core-interfaces#IProvideFluidHandle.IFluidHandle}\n\t */\n\tpublic get IFluidHandle(): IFluidHandleInternal {\n\t\treturn this;\n\t}\n\n\tpublic get [fluidHandleSymbol](): IFluidHandleErased<T> {\n\t\treturn toFluidHandleErased(this);\n\t}\n}\n"]}
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { generateHandleContextPath } from "./dataStoreHandleContextUtils.js";
|
|
6
6
|
export { create404Response, createDataStoreFactory, createResponseError, exceptionToResponse, Factory, responseToException, } from "./dataStoreHelpers.js";
|
|
7
|
-
export { ISerializedHandle, isSerializedHandle } from "./handles.js";
|
|
7
|
+
export { ISerializedHandle, isSerializedHandle, isFluidHandle, toFluidHandleErased, toFluidHandleInternal, FluidHandleBase, } from "./handles.js";
|
|
8
8
|
export { ObjectStoragePartition } from "./objectstoragepartition.js";
|
|
9
9
|
export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from "./objectstorageutils.js";
|
|
10
10
|
export { RequestParser } from "./requestParser.js";
|
|
@@ -12,4 +12,6 @@ export { RuntimeFactoryHelper } from "./runtimeFactoryHelper.js";
|
|
|
12
12
|
export { addBlobToSummary, addSummarizeResultToSummary, calculateStats, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, convertToSummaryTree, convertToSummaryTreeWithStats, GCDataBuilder, getBlobSize, mergeStats, processAttachMessageGCData, SummaryTreeBuilder, TelemetryContext, utf8ByteLength, } from "./summaryUtils.js";
|
|
13
13
|
export { unpackChildNodesUsedRoutes } from "./unpackUsedRoutes.js";
|
|
14
14
|
export { ReadAndParseBlob, seqFromTree, encodeCompactIdToString } from "./utils.js";
|
|
15
|
+
export { isSnapshotFetchRequiredForLoadingGroupId } from "./snapshotUtils.js";
|
|
16
|
+
export { toDeltaManagerErased, toDeltaManagerInternal } from "./deltaManager.js";
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mCAAmC,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { generateHandleContextPath } from "./dataStoreHandleContextUtils.js";
|
|
6
6
|
export { create404Response, createDataStoreFactory, createResponseError, exceptionToResponse, responseToException, } from "./dataStoreHelpers.js";
|
|
7
|
-
export { isSerializedHandle } from "./handles.js";
|
|
7
|
+
export { isSerializedHandle, isFluidHandle, toFluidHandleErased, toFluidHandleInternal, FluidHandleBase, } from "./handles.js";
|
|
8
8
|
export { ObjectStoragePartition } from "./objectstoragepartition.js";
|
|
9
9
|
export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from "./objectstorageutils.js";
|
|
10
10
|
export { RequestParser } from "./requestParser.js";
|
|
@@ -12,4 +12,6 @@ export { RuntimeFactoryHelper } from "./runtimeFactoryHelper.js";
|
|
|
12
12
|
export { addBlobToSummary, addSummarizeResultToSummary, calculateStats, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, convertToSummaryTree, convertToSummaryTreeWithStats, GCDataBuilder, getBlobSize, mergeStats, processAttachMessageGCData, SummaryTreeBuilder, TelemetryContext, utf8ByteLength, } from "./summaryUtils.js";
|
|
13
13
|
export { unpackChildNodesUsedRoutes } from "./unpackUsedRoutes.js";
|
|
14
14
|
export { seqFromTree, encodeCompactIdToString } from "./utils.js";
|
|
15
|
+
export { isSnapshotFetchRequiredForLoadingGroupId } from "./snapshotUtils.js";
|
|
16
|
+
export { toDeltaManagerErased, toDeltaManagerInternal } from "./deltaManager.js";
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EAEnB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACN,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EAEnB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAEN,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,qBAAqB,EACrB,eAAe,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,mCAAmC,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,OAAO,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAoB,WAAW,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils.js\";\nexport {\n\tcreate404Response,\n\tcreateDataStoreFactory,\n\tcreateResponseError,\n\texceptionToResponse,\n\tFactory,\n\tresponseToException,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tISerializedHandle,\n\tisSerializedHandle,\n\tisFluidHandle,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n\tFluidHandleBase,\n} from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from \"./objectstorageutils.js\";\nexport { RequestParser } from \"./requestParser.js\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper.js\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tprocessAttachMessageGCData,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils.js\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes.js\";\nexport { ReadAndParseBlob, seqFromTree, encodeCompactIdToString } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport { toDeltaManagerErased, toDeltaManagerInternal } from \"./deltaManager.js\";\n"]}
|
|
@@ -7,10 +7,16 @@
|
|
|
7
7
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
|
8
8
|
* Generated by "flub generate entrypoints" in @fluidframework/build-tools.
|
|
9
9
|
*/
|
|
10
|
+
|
|
10
11
|
export {
|
|
11
|
-
// alpha APIs
|
|
12
|
+
// @alpha APIs
|
|
13
|
+
FluidHandleBase,
|
|
12
14
|
RequestParser,
|
|
13
15
|
RuntimeFactoryHelper,
|
|
14
16
|
SummaryTreeBuilder,
|
|
15
|
-
convertToSummaryTreeWithStats
|
|
17
|
+
convertToSummaryTreeWithStats,
|
|
18
|
+
create404Response,
|
|
19
|
+
toDeltaManagerInternal,
|
|
20
|
+
toFluidHandleErased,
|
|
21
|
+
toFluidHandleInternal
|
|
16
22
|
} from "./index.js";
|
package/lib/public.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import type { ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
6
|
+
/**
|
|
7
|
+
* Utility function to check if any blobs under a snapshot tree is missing and if so, then return
|
|
8
|
+
* true if that is the case.
|
|
9
|
+
* @internal
|
|
10
|
+
* @param snapshotTree - snapshotTree to be evaluated for missing blobs.
|
|
11
|
+
* @param blobContents - blobContents of the snapshot.
|
|
12
|
+
*/
|
|
13
|
+
export declare function isSnapshotFetchRequiredForLoadingGroupId(snapshotTree: ISnapshotTree, blobContents: Map<string, ArrayBuffer>): boolean;
|
|
14
|
+
//# sourceMappingURL=snapshotUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotUtils.d.ts","sourceRoot":"","sources":["../src/snapshotUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,wCAAwC,CACvD,YAAY,EAAE,aAAa,EAC3B,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,GACpC,OAAO,CAoBT"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Utility function to check if any blobs under a snapshot tree is missing and if so, then return
|
|
7
|
+
* true if that is the case.
|
|
8
|
+
* @internal
|
|
9
|
+
* @param snapshotTree - snapshotTree to be evaluated for missing blobs.
|
|
10
|
+
* @param blobContents - blobContents of the snapshot.
|
|
11
|
+
*/
|
|
12
|
+
export function isSnapshotFetchRequiredForLoadingGroupId(snapshotTree, blobContents) {
|
|
13
|
+
for (const [_, id] of Object.entries(snapshotTree.blobs)) {
|
|
14
|
+
if (!blobContents.has(id)) {
|
|
15
|
+
return true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
for (const [_, childTree] of Object.entries(snapshotTree.trees)) {
|
|
19
|
+
// Only evaluate childTree if it does not have a loading groupId because if the childTree has a loading
|
|
20
|
+
// groupId then it will be evaluated whether we want to fetch blobs for that childTree or not when
|
|
21
|
+
// that particular childTree is getting realized. Now we just want to check for blobs which belongs to
|
|
22
|
+
// tree with current loading groupId. Note: Child with no loading groupId, will fall under parent with
|
|
23
|
+
// a loading groupId as it does not have its own loading groupId.
|
|
24
|
+
if (childTree.groupId === undefined) {
|
|
25
|
+
const value = isSnapshotFetchRequiredForLoadingGroupId(childTree, blobContents);
|
|
26
|
+
if (value) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=snapshotUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snapshotUtils.js","sourceRoot":"","sources":["../src/snapshotUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,wCAAwC,CACvD,YAA2B,EAC3B,YAAsC;IAEtC,KAAK,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;QACzD,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;YAC1B,OAAO,IAAI,CAAC;SACZ;KACD;IACD,KAAK,MAAM,CAAC,CAAC,EAAE,SAAS,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;QAChE,uGAAuG;QACvG,kGAAkG;QAClG,sGAAsG;QACtG,sGAAsG;QACtG,iEAAiE;QACjE,IAAI,SAAS,CAAC,OAAO,KAAK,SAAS,EAAE;YACpC,MAAM,KAAK,GAAG,wCAAwC,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;YAChF,IAAI,KAAK,EAAE;gBACV,OAAO,IAAI,CAAC;aACZ;SACD;KACD;IACD,OAAO,KAAK,CAAC;AACd,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ISnapshotTree } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Utility function to check if any blobs under a snapshot tree is missing and if so, then return\n * true if that is the case.\n * @internal\n * @param snapshotTree - snapshotTree to be evaluated for missing blobs.\n * @param blobContents - blobContents of the snapshot.\n */\nexport function isSnapshotFetchRequiredForLoadingGroupId(\n\tsnapshotTree: ISnapshotTree,\n\tblobContents: Map<string, ArrayBuffer>,\n): boolean {\n\tfor (const [_, id] of Object.entries(snapshotTree.blobs)) {\n\t\tif (!blobContents.has(id)) {\n\t\t\treturn true;\n\t\t}\n\t}\n\tfor (const [_, childTree] of Object.entries(snapshotTree.trees)) {\n\t\t// Only evaluate childTree if it does not have a loading groupId because if the childTree has a loading\n\t\t// groupId then it will be evaluated whether we want to fetch blobs for that childTree or not when\n\t\t// that particular childTree is getting realized. Now we just want to check for blobs which belongs to\n\t\t// tree with current loading groupId. Note: Child with no loading groupId, will fall under parent with\n\t\t// a loading groupId as it does not have its own loading groupId.\n\t\tif (childTree.groupId === undefined) {\n\t\t\tconst value = isSnapshotFetchRequiredForLoadingGroupId(childTree, blobContents);\n\t\t\tif (value) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t}\n\treturn false;\n}\n"]}
|
package/lib/tsdoc-metadata.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/runtime-utils",
|
|
3
|
-
"version": "2.0.0-dev-rc.
|
|
3
|
+
"version": "2.0.0-dev-rc.5.0.0.263932",
|
|
4
4
|
"description": "Collection of utility functions for Fluid Runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -23,13 +23,13 @@
|
|
|
23
23
|
"default": "./dist/index.js"
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
|
-
"./
|
|
26
|
+
"./legacy": {
|
|
27
27
|
"import": {
|
|
28
|
-
"types": "./lib/
|
|
28
|
+
"types": "./lib/legacy.d.ts",
|
|
29
29
|
"default": "./lib/index.js"
|
|
30
30
|
},
|
|
31
31
|
"require": {
|
|
32
|
-
"types": "./dist/
|
|
32
|
+
"types": "./dist/legacy.d.ts",
|
|
33
33
|
"default": "./dist/index.js"
|
|
34
34
|
}
|
|
35
35
|
},
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
"main": "
|
|
48
|
-
"types": "
|
|
47
|
+
"main": "lib/index.js",
|
|
48
|
+
"types": "lib/public.d.ts",
|
|
49
49
|
"c8": {
|
|
50
50
|
"all": true,
|
|
51
51
|
"cache-dir": "nyc/.cache",
|
|
@@ -67,27 +67,27 @@
|
|
|
67
67
|
"temp-directory": "nyc/.nyc_output"
|
|
68
68
|
},
|
|
69
69
|
"dependencies": {
|
|
70
|
-
"@fluid-internal/client-utils": "2.0.0-dev-rc.
|
|
71
|
-
"@fluidframework/container-definitions": "2.0.0-dev-rc.
|
|
72
|
-
"@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.
|
|
73
|
-
"@fluidframework/core-interfaces": "2.0.0-dev-rc.
|
|
74
|
-
"@fluidframework/core-utils": "2.0.0-dev-rc.
|
|
75
|
-
"@fluidframework/datastore-definitions": "2.0.0-dev-rc.
|
|
76
|
-
"@fluidframework/driver-utils": "2.0.0-dev-rc.
|
|
70
|
+
"@fluid-internal/client-utils": "2.0.0-dev-rc.5.0.0.263932",
|
|
71
|
+
"@fluidframework/container-definitions": "2.0.0-dev-rc.5.0.0.263932",
|
|
72
|
+
"@fluidframework/container-runtime-definitions": "2.0.0-dev-rc.5.0.0.263932",
|
|
73
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.5.0.0.263932",
|
|
74
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.5.0.0.263932",
|
|
75
|
+
"@fluidframework/datastore-definitions": "2.0.0-dev-rc.5.0.0.263932",
|
|
76
|
+
"@fluidframework/driver-utils": "2.0.0-dev-rc.5.0.0.263932",
|
|
77
77
|
"@fluidframework/protocol-definitions": "^3.2.0",
|
|
78
|
-
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.
|
|
79
|
-
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.
|
|
78
|
+
"@fluidframework/runtime-definitions": "2.0.0-dev-rc.5.0.0.263932",
|
|
79
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.5.0.0.263932"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@arethetypeswrong/cli": "^0.15.2",
|
|
83
83
|
"@biomejs/biome": "^1.6.2",
|
|
84
|
-
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.
|
|
85
|
-
"@fluid-tools/build-cli": "^0.
|
|
84
|
+
"@fluid-internal/mocha-test-setup": "2.0.0-dev-rc.5.0.0.263932",
|
|
85
|
+
"@fluid-tools/build-cli": "^0.38.0",
|
|
86
86
|
"@fluidframework/build-common": "^2.0.3",
|
|
87
|
-
"@fluidframework/build-tools": "^0.
|
|
87
|
+
"@fluidframework/build-tools": "^0.38.0",
|
|
88
88
|
"@fluidframework/eslint-config-fluid": "^5.1.0",
|
|
89
|
-
"@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@2.0.0-
|
|
90
|
-
"@microsoft/api-extractor": "^7.
|
|
89
|
+
"@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@2.0.0-rc.3.0.0",
|
|
90
|
+
"@microsoft/api-extractor": "^7.43.1",
|
|
91
91
|
"@types/mocha": "^9.1.1",
|
|
92
92
|
"@types/node": "^18.19.0",
|
|
93
93
|
"@types/sinon": "^17.0.3",
|
|
@@ -106,17 +106,12 @@
|
|
|
106
106
|
"typescript": "~5.1.6"
|
|
107
107
|
},
|
|
108
108
|
"typeValidation": {
|
|
109
|
-
"broken": {
|
|
110
|
-
"RemovedFunctionDeclaration_addTreeToSummary": {
|
|
111
|
-
"forwardCompat": false,
|
|
112
|
-
"backCompat": false
|
|
113
|
-
}
|
|
114
|
-
}
|
|
109
|
+
"broken": {}
|
|
115
110
|
},
|
|
116
111
|
"scripts": {
|
|
117
112
|
"api": "fluid-build . --task api",
|
|
118
|
-
"api-extractor:commonjs": "flub generate entrypoints --outDir ./dist",
|
|
119
|
-
"api-extractor:esnext": "flub generate entrypoints --outDir ./lib",
|
|
113
|
+
"api-extractor:commonjs": "flub generate entrypoints --outFileAlpha legacy --outDir ./dist",
|
|
114
|
+
"api-extractor:esnext": "flub generate entrypoints --outFileAlpha legacy --outDir ./lib --node10TypeCompat",
|
|
120
115
|
"build": "fluid-build . --task build",
|
|
121
116
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
122
117
|
"build:compile": "fluid-build . --task compile",
|
|
@@ -125,11 +120,11 @@
|
|
|
125
120
|
"build:test": "npm run build:test:esm && npm run build:test:cjs",
|
|
126
121
|
"build:test:cjs": "fluid-tsc commonjs --project ./src/test/tsconfig.cjs.json",
|
|
127
122
|
"build:test:esm": "tsc --project ./src/test/tsconfig.json",
|
|
128
|
-
"check:are-the-types-wrong": "attw --pack .
|
|
123
|
+
"check:are-the-types-wrong": "attw --pack .",
|
|
129
124
|
"check:prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
130
125
|
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
131
126
|
"ci:build:docs": "api-extractor run",
|
|
132
|
-
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
127
|
+
"clean": "rimraf --glob dist lib \"*.d.ts\" \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
133
128
|
"eslint": "eslint --format stylish src",
|
|
134
129
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
135
130
|
"format": "fluid-build --task format .",
|
|
@@ -143,7 +138,7 @@
|
|
|
143
138
|
"test:mocha:esm": "mocha --recursive \"lib/test/**/*.spec.*js\" --exit",
|
|
144
139
|
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
145
140
|
"tsc": "fluid-tsc commonjs --project ./tsconfig.cjs.json && copyfiles -f ../../../common/build/build-common/src/cjs/package.json ./dist",
|
|
146
|
-
"typetests:gen": "
|
|
141
|
+
"typetests:gen": "flub generate typetests --dir . -v --publicFallback",
|
|
147
142
|
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
|
|
148
143
|
}
|
|
149
144
|
}
|
package/src/dataStoreHelpers.ts
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IDeltaManager } from "@fluidframework/container-definitions/internal";
|
|
7
|
+
import type { IDeltaManagerErased } from "@fluidframework/datastore-definitions";
|
|
8
|
+
import type {
|
|
9
|
+
IDocumentMessage,
|
|
10
|
+
ISequencedDocumentMessage,
|
|
11
|
+
} from "@fluidframework/protocol-definitions";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Casts the public API for delta manager into the internal one,
|
|
15
|
+
* exposing access to APIs needed by the implementation of Fluid Framework but not its users.
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export function toDeltaManagerInternal(
|
|
19
|
+
deltaManager: IDeltaManagerErased,
|
|
20
|
+
): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {
|
|
21
|
+
return deltaManager as unknown as IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Casts the the internal API for delta manager into the public type erased API for returning from public APIs that should not have access to any of its members.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export function toDeltaManagerErased(
|
|
29
|
+
deltaManager: IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>,
|
|
30
|
+
): IDeltaManagerErased {
|
|
31
|
+
return deltaManager as unknown as IDeltaManagerErased;
|
|
32
|
+
}
|