@fluidframework/runtime-utils 2.53.1 → 2.60.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.
Files changed (127) hide show
  1. package/.eslintrc.cjs +1 -4
  2. package/CHANGELOG.md +4 -0
  3. package/api-report/{runtime-utils.legacy.alpha.api.md → runtime-utils.legacy.beta.api.md} +12 -12
  4. package/dist/compatibilityBase.d.ts +1 -3
  5. package/dist/compatibilityBase.d.ts.map +1 -1
  6. package/dist/compatibilityBase.js +3 -0
  7. package/dist/compatibilityBase.js.map +1 -1
  8. package/dist/dataStoreHandleContextUtils.d.ts +1 -1
  9. package/dist/dataStoreHandleContextUtils.d.ts.map +1 -1
  10. package/dist/dataStoreHandleContextUtils.js.map +1 -1
  11. package/dist/dataStoreHelpers.d.ts +18 -6
  12. package/dist/dataStoreHelpers.d.ts.map +1 -1
  13. package/dist/dataStoreHelpers.js +39 -11
  14. package/dist/dataStoreHelpers.js.map +1 -1
  15. package/dist/deltaManager.d.ts +1 -2
  16. package/dist/deltaManager.d.ts.map +1 -1
  17. package/dist/deltaManager.js +3 -2
  18. package/dist/deltaManager.js.map +1 -1
  19. package/dist/handles.d.ts +8 -12
  20. package/dist/handles.d.ts.map +1 -1
  21. package/dist/handles.js +14 -12
  22. package/dist/handles.js.map +1 -1
  23. package/dist/index.d.ts +6 -3
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/objectstoragepartition.d.ts +1 -1
  27. package/dist/objectstoragepartition.d.ts.map +1 -1
  28. package/dist/objectstoragepartition.js.map +1 -1
  29. package/dist/objectstorageutils.d.ts +9 -1
  30. package/dist/objectstorageutils.d.ts.map +1 -1
  31. package/dist/objectstorageutils.js +15 -6
  32. package/dist/objectstorageutils.js.map +1 -1
  33. package/dist/packageVersion.d.ts +1 -1
  34. package/dist/packageVersion.js +1 -1
  35. package/dist/packageVersion.js.map +1 -1
  36. package/dist/remoteFluidObjectHandle.d.ts +2 -2
  37. package/dist/remoteFluidObjectHandle.d.ts.map +1 -1
  38. package/dist/remoteFluidObjectHandle.js +1 -0
  39. package/dist/remoteFluidObjectHandle.js.map +1 -1
  40. package/dist/requestParser.d.ts +2 -3
  41. package/dist/requestParser.d.ts.map +1 -1
  42. package/dist/requestParser.js +9 -11
  43. package/dist/requestParser.js.map +1 -1
  44. package/dist/runtimeFactoryHelper.d.ts +3 -4
  45. package/dist/runtimeFactoryHelper.d.ts.map +1 -1
  46. package/dist/runtimeFactoryHelper.js +1 -2
  47. package/dist/runtimeFactoryHelper.js.map +1 -1
  48. package/dist/summaryUtils.d.ts +29 -20
  49. package/dist/summaryUtils.d.ts.map +1 -1
  50. package/dist/summaryUtils.js +49 -21
  51. package/dist/summaryUtils.js.map +1 -1
  52. package/dist/unpackUsedRoutes.d.ts.map +1 -1
  53. package/dist/unpackUsedRoutes.js +3 -3
  54. package/dist/unpackUsedRoutes.js.map +1 -1
  55. package/dist/utils.d.ts +1 -1
  56. package/dist/utils.d.ts.map +1 -1
  57. package/dist/utils.js.map +1 -1
  58. package/lib/compatibilityBase.d.ts +1 -3
  59. package/lib/compatibilityBase.d.ts.map +1 -1
  60. package/lib/compatibilityBase.js +3 -0
  61. package/lib/compatibilityBase.js.map +1 -1
  62. package/lib/dataStoreHandleContextUtils.d.ts +1 -1
  63. package/lib/dataStoreHandleContextUtils.d.ts.map +1 -1
  64. package/lib/dataStoreHandleContextUtils.js.map +1 -1
  65. package/lib/dataStoreHelpers.d.ts +18 -6
  66. package/lib/dataStoreHelpers.d.ts.map +1 -1
  67. package/lib/dataStoreHelpers.js +39 -11
  68. package/lib/dataStoreHelpers.js.map +1 -1
  69. package/lib/deltaManager.d.ts +1 -2
  70. package/lib/deltaManager.d.ts.map +1 -1
  71. package/lib/deltaManager.js +3 -2
  72. package/lib/deltaManager.js.map +1 -1
  73. package/lib/handles.d.ts +8 -12
  74. package/lib/handles.d.ts.map +1 -1
  75. package/lib/handles.js +14 -12
  76. package/lib/handles.js.map +1 -1
  77. package/lib/index.d.ts +6 -3
  78. package/lib/index.d.ts.map +1 -1
  79. package/lib/index.js.map +1 -1
  80. package/lib/objectstoragepartition.d.ts +1 -1
  81. package/lib/objectstoragepartition.d.ts.map +1 -1
  82. package/lib/objectstoragepartition.js.map +1 -1
  83. package/lib/objectstorageutils.d.ts +9 -1
  84. package/lib/objectstorageutils.d.ts.map +1 -1
  85. package/lib/objectstorageutils.js +15 -6
  86. package/lib/objectstorageutils.js.map +1 -1
  87. package/lib/packageVersion.d.ts +1 -1
  88. package/lib/packageVersion.js +1 -1
  89. package/lib/packageVersion.js.map +1 -1
  90. package/lib/remoteFluidObjectHandle.d.ts +2 -2
  91. package/lib/remoteFluidObjectHandle.d.ts.map +1 -1
  92. package/lib/remoteFluidObjectHandle.js +1 -0
  93. package/lib/remoteFluidObjectHandle.js.map +1 -1
  94. package/lib/requestParser.d.ts +2 -3
  95. package/lib/requestParser.d.ts.map +1 -1
  96. package/lib/requestParser.js +9 -11
  97. package/lib/requestParser.js.map +1 -1
  98. package/lib/runtimeFactoryHelper.d.ts +3 -4
  99. package/lib/runtimeFactoryHelper.d.ts.map +1 -1
  100. package/lib/runtimeFactoryHelper.js +1 -2
  101. package/lib/runtimeFactoryHelper.js.map +1 -1
  102. package/lib/summaryUtils.d.ts +29 -20
  103. package/lib/summaryUtils.d.ts.map +1 -1
  104. package/lib/summaryUtils.js +51 -23
  105. package/lib/summaryUtils.js.map +1 -1
  106. package/lib/unpackUsedRoutes.d.ts.map +1 -1
  107. package/lib/unpackUsedRoutes.js +3 -3
  108. package/lib/unpackUsedRoutes.js.map +1 -1
  109. package/lib/utils.d.ts +1 -1
  110. package/lib/utils.d.ts.map +1 -1
  111. package/lib/utils.js.map +1 -1
  112. package/package.json +13 -13
  113. package/src/compatibilityBase.ts +4 -3
  114. package/src/dataStoreHandleContextUtils.ts +1 -1
  115. package/src/dataStoreHelpers.ts +49 -16
  116. package/src/deltaManager.ts +3 -2
  117. package/src/handles.ts +14 -13
  118. package/src/index.ts +6 -4
  119. package/src/objectstoragepartition.ts +2 -2
  120. package/src/objectstorageutils.ts +17 -8
  121. package/src/packageVersion.ts +1 -1
  122. package/src/remoteFluidObjectHandle.ts +4 -3
  123. package/src/requestParser.ts +15 -15
  124. package/src/runtimeFactoryHelper.ts +4 -5
  125. package/src/summaryUtils.ts +70 -43
  126. package/src/unpackUsedRoutes.ts +7 -5
  127. package/src/utils.ts +2 -2
@@ -2,24 +2,36 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IRequest, IResponse } from "@fluidframework/core-interfaces";
5
+ import type { IRequest, IResponse } from "@fluidframework/core-interfaces";
6
6
  /**
7
+ * Converts an error object into an {@link @fluidframework/core-interfaces#IResponse}.
7
8
  * @internal
8
9
  */
9
- export declare function exceptionToResponse(err: any): IResponse;
10
+ export declare function exceptionToResponse(error: unknown): IResponse;
10
11
  /**
12
+ * Converts an {@link @fluidframework/core-interfaces#IResponse} back into an Error object that can be thrown.
13
+ * @param response - The {@link @fluidframework/core-interfaces#IResponse} to convert.
14
+ * @param request - The original {@link @fluidframework/core-interfaces#IRequest}.
15
+ * @returns An Error object with additional properties from the response
11
16
  * @internal
12
17
  */
13
18
  export declare function responseToException(response: IResponse, request: IRequest): Error;
14
19
  /**
20
+ * Creates a 404 "not found" response for the given request
21
+ * @param request - The request that resulted in the 404 response
22
+ * @returns An {@link @fluidframework/core-interfaces#IResponse} with 404 status code.
15
23
  * @legacy
16
- * @alpha
24
+ * @beta
17
25
  */
18
26
  export declare const create404Response: (request: IRequest) => IResponse;
19
27
  /**
28
+ * Creates an error response with the specified status code and message
29
+ * @param status - HTTP status code for the error (must not be 200)
30
+ * @param value - Error message or description
31
+ * @param request - The request that resulted in this error
32
+ * @param headers - Optional headers to include in the response
33
+ * @returns An {@link @fluidframework/core-interfaces#IResponse} representing the error
20
34
  * @internal
21
35
  */
22
- export declare function createResponseError(status: number, value: string, request: IRequest, headers?: {
23
- [key: string]: any;
24
- }): IResponse;
36
+ export declare function createResponseError(status: number, value: string, request: IRequest, headers?: Record<string, unknown>): IResponse;
25
37
  //# sourceMappingURL=dataStoreHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHelpers.d.ts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAYtE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,GAAG,GAAG,SAAS,CA0BvD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK,CAejF;AAED;;;GAGG;AACH,eAAO,MAAM,iBAAiB,YAAa,QAAQ,cACJ,CAAC;AAEhD;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,GAC9B,SAAS,CAiBX"}
1
+ {"version":3,"file":"dataStoreHelpers.d.ts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAyB3E;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CA8B7D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,GAAG,KAAK,CAiBjF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,YAAa,QAAQ,KAAG,SACP,CAAC;AAEhD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,QAAQ,EACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,SAAS,CAiBX"}
@@ -5,37 +5,56 @@
5
5
  import { assert } from "@fluidframework/core-utils/internal";
6
6
  import { generateErrorWithStack } from "@fluidframework/telemetry-utils/internal";
7
7
  /**
8
+ * Type guard for determining if an error is an {@link IResponseException}.
8
9
  * @internal
9
10
  */
10
- export function exceptionToResponse(err) {
11
+ function isResponseException(err) {
12
+ return (err !== null &&
13
+ typeof err === "object" &&
14
+ "errorFromRequestFluidObject" in err &&
15
+ err.errorFromRequestFluidObject === true);
16
+ }
17
+ /**
18
+ * Converts an error object into an {@link @fluidframework/core-interfaces#IResponse}.
19
+ * @internal
20
+ */
21
+ export function exceptionToResponse(error) {
11
22
  const status = 500;
12
- if (err !== null && typeof err === "object" && err.errorFromRequestFluidObject === true) {
13
- const responseErr = err;
23
+ if (isResponseException(error)) {
14
24
  return {
15
25
  mimeType: "text/plain",
16
- status: responseErr.code,
17
- value: responseErr.message,
26
+ status: error.code,
27
+ value: error.message,
18
28
  get stack() {
19
- return responseErr.stack;
29
+ return error.stack;
20
30
  },
21
- headers: responseErr.underlyingResponseHeaders,
31
+ headers: error.underlyingResponseHeaders,
22
32
  };
23
33
  }
24
- // Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it
34
+ // Capture error objects, not stack itself, as stack retrieval is very expensive operation
25
35
  const errWithStack = generateErrorWithStack();
26
36
  return {
27
37
  mimeType: "text/plain",
28
38
  status,
29
- value: `${err}`,
39
+ value: `${error}`,
30
40
  get stack() {
31
- return err?.stack ?? errWithStack.stack;
41
+ // Use type assertion after checking if error is an object with stack
42
+ return ((typeof error === "object" && error !== null && "stack" in error
43
+ ? error.stack
44
+ : undefined) ?? errWithStack.stack);
32
45
  },
33
46
  };
34
47
  }
35
48
  /**
49
+ * Converts an {@link @fluidframework/core-interfaces#IResponse} back into an Error object that can be thrown.
50
+ * @param response - The {@link @fluidframework/core-interfaces#IResponse} to convert.
51
+ * @param request - The original {@link @fluidframework/core-interfaces#IRequest}.
52
+ * @returns An Error object with additional properties from the response
36
53
  * @internal
37
54
  */
38
55
  export function responseToException(response, request) {
56
+ // As of 2025-08-20 the code seems to assume `response.value` is always a string.
57
+ // This type assertion just encodes that assumption as we move to stricter linting rules, but it might need to be revisited.
39
58
  const message = response.value;
40
59
  const errWithStack = generateErrorWithStack();
41
60
  const responseErr = {
@@ -51,11 +70,20 @@ export function responseToException(response, request) {
51
70
  return responseErr;
52
71
  }
53
72
  /**
73
+ * Creates a 404 "not found" response for the given request
74
+ * @param request - The request that resulted in the 404 response
75
+ * @returns An {@link @fluidframework/core-interfaces#IResponse} with 404 status code.
54
76
  * @legacy
55
- * @alpha
77
+ * @beta
56
78
  */
57
79
  export const create404Response = (request) => createResponseError(404, "not found", request);
58
80
  /**
81
+ * Creates an error response with the specified status code and message
82
+ * @param status - HTTP status code for the error (must not be 200)
83
+ * @param value - Error message or description
84
+ * @param request - The request that resulted in this error
85
+ * @param headers - Optional headers to include in the response
86
+ * @returns An {@link @fluidframework/core-interfaces#IResponse} representing the error
59
87
  * @internal
60
88
  */
61
89
  export function createResponseError(status, value, request, headers) {
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,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,E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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","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 { 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 * @legacy\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"]}
1
+ {"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAUlF;;;GAGG;AACH,SAAS,mBAAmB,CAAC,GAAY;IACxC,OAAO,CACN,GAAG,KAAK,IAAI;QACZ,OAAO,GAAG,KAAK,Q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AAC,KAAK,IAAI,YAAY,CAAC,KAAK,CAAC;QAC7C,CAAC;QACD,yBAAyB,EAAE,QAAQ,CAAC,OAAO;KAC3C,CAAC;IAEF,OAAO,WAAW,CAAC;AACpB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAiB,EAAa,EAAE,CACjE,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;AAEhD;;;;;;;;GAQG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAAc,EACd,KAAa,EACb,OAAiB,EACjB,OAAiC;IAEjC,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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/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?: Record<string, unknown>;\n}\n\n/**\n * Type guard for determining if an error is an {@link IResponseException}.\n * @internal\n */\nfunction isResponseException(err: unknown): err is IResponseException {\n\treturn (\n\t\terr !== null &&\n\t\ttypeof err === \"object\" &&\n\t\t\"errorFromRequestFluidObject\" in err &&\n\t\t(err as { errorFromRequestFluidObject: unknown }).errorFromRequestFluidObject === true\n\t);\n}\n\n/**\n * Converts an error object into an {@link @fluidframework/core-interfaces#IResponse}.\n * @internal\n */\nexport function exceptionToResponse(error: unknown): IResponse {\n\tconst status = 500;\n\tif (isResponseException(error)) {\n\t\treturn {\n\t\t\tmimeType: \"text/plain\",\n\t\t\tstatus: error.code,\n\t\t\tvalue: error.message,\n\t\t\tget stack() {\n\t\t\t\treturn error.stack;\n\t\t\t},\n\t\t\theaders: error.underlyingResponseHeaders,\n\t\t};\n\t}\n\n\t// Capture error objects, not stack itself, as stack retrieval is very expensive operation\n\tconst errWithStack = generateErrorWithStack();\n\n\treturn {\n\t\tmimeType: \"text/plain\",\n\t\tstatus,\n\t\tvalue: `${error}`,\n\t\tget stack() {\n\t\t\t// Use type assertion after checking if error is an object with stack\n\t\t\treturn (\n\t\t\t\t(typeof error === \"object\" && error !== null && \"stack\" in error\n\t\t\t\t\t? (error.stack as string | undefined)\n\t\t\t\t\t: undefined) ?? errWithStack.stack\n\t\t\t);\n\t\t},\n\t};\n}\n\n/**\n * Converts an {@link @fluidframework/core-interfaces#IResponse} back into an Error object that can be thrown.\n * @param response - The {@link @fluidframework/core-interfaces#IResponse} to convert.\n * @param request - The original {@link @fluidframework/core-interfaces#IRequest}.\n * @returns An Error object with additional properties from the response\n * @internal\n */\nexport function responseToException(response: IResponse, request: IRequest): Error {\n\t// As of 2025-08-20 the code seems to assume `response.value` is always a string.\n\t// This type assertion just encodes that assumption as we move to stricter linting rules, but it might need to be revisited.\n\tconst message = response.value as string;\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 * Creates a 404 \"not found\" response for the given request\n * @param request - The request that resulted in the 404 response\n * @returns An {@link @fluidframework/core-interfaces#IResponse} with 404 status code.\n * @legacy\n * @beta\n */\nexport const create404Response = (request: IRequest): IResponse =>\n\tcreateResponseError(404, \"not found\", request);\n\n/**\n * Creates an error response with the specified status code and message\n * @param status - HTTP status code for the error (must not be 200)\n * @param value - Error message or description\n * @param request - The request that resulted in this error\n * @param headers - Optional headers to include in the response\n * @returns An {@link @fluidframework/core-interfaces#IResponse} representing the error\n * @internal\n */\nexport function createResponseError(\n\tstatus: number,\n\tvalue: string,\n\trequest: IRequest,\n\theaders?: Record<string, unknown>,\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"]}
@@ -8,8 +8,7 @@ import type { IDocumentMessage, ISequencedDocumentMessage } from "@fluidframewor
8
8
  /**
9
9
  * Casts the public API for delta manager into the internal one,
10
10
  * exposing access to APIs needed by the implementation of Fluid Framework but not its users.
11
- * @legacy
12
- * @alpha
11
+ * @legacy @beta
13
12
  */
14
13
  export declare function toDeltaManagerInternal(deltaManager: IDeltaManagerErased): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage>;
15
14
  /**
@@ -1 +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,gDAAgD,CAAC;AAC1F,OAAO,KAAK,EACX,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD;;;;;GAKG;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"}
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,gDAAgD,CAAC;AAC1F,OAAO,KAAK,EACX,gBAAgB,EAChB,yBAAyB,EACzB,MAAM,6CAA6C,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,sBAAsB,CACrC,YAAY,EAAE,mBAAmB,GAC/B,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,CAG5D;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CACnC,YAAY,EAAE,aAAa,CAAC,yBAAyB,EAAE,gBAAgB,CAAC,GACtE,mBAAmB,CAGrB"}
@@ -5,10 +5,10 @@
5
5
  /**
6
6
  * Casts the public API for delta manager into the internal one,
7
7
  * exposing access to APIs needed by the implementation of Fluid Framework but not its users.
8
- * @legacy
9
- * @alpha
8
+ * @legacy @beta
10
9
  */
11
10
  export function toDeltaManagerInternal(deltaManager) {
11
+ // Type assertion is safe as IDeltaManagerErased is specifically designed to be a type-erased version of IDeltaManager
12
12
  return deltaManager;
13
13
  }
14
14
  /**
@@ -16,6 +16,7 @@ export function toDeltaManagerInternal(deltaManager) {
16
16
  * @internal
17
17
  */
18
18
  export function toDeltaManagerErased(deltaManager) {
19
+ // Type assertion is safe as we're intentionally erasing the type information for public API safety
19
20
  return deltaManager;
20
21
  }
21
22
  //# sourceMappingURL=deltaManager.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;;;GAKG;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/internal\";\nimport type {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\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 * @legacy\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"]}
1
+ {"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACrC,YAAiC;IAEjC,sHAAsH;IACtH,OAAO,YAAqF,CAAC;AAC9F,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CACnC,YAAwE;IAExE,mGAAmG;IACnG,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/internal\";\nimport type {\n\tIDocumentMessage,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\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 * @legacy @beta\n */\nexport function toDeltaManagerInternal(\n\tdeltaManager: IDeltaManagerErased,\n): IDeltaManager<ISequencedDocumentMessage, IDocumentMessage> {\n\t// Type assertion is safe as IDeltaManagerErased is specifically designed to be a type-erased version of IDeltaManager\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\t// Type assertion is safe as we're intentionally erasing the type information for public API safety\n\treturn deltaManager as unknown as IDeltaManagerErased;\n}\n"]}
package/lib/handles.d.ts CHANGED
@@ -24,11 +24,12 @@ export interface ISerializedHandle {
24
24
  readonly payloadPending?: true;
25
25
  }
26
26
  /**
27
- * Is the input object a @see ISerializedHandle?
27
+ * Narrow a value to {@link ISerializedHandle} by checking its type property.
28
28
  * @internal
29
29
  */
30
- export declare const isSerializedHandle: (value: any) => value is ISerializedHandle;
30
+ export declare const isSerializedHandle: (value: unknown) => value is ISerializedHandle;
31
31
  /**
32
+ * Checks if a Fluid handle's internal payload is pending.
32
33
  * @internal
33
34
  */
34
35
  export declare const isFluidHandleInternalPayloadPending: (fluidHandleInternal: IFluidHandleInternal) => fluidHandleInternal is IFluidHandleInternalPayloadPending<unknown>;
@@ -37,14 +38,12 @@ export declare const isFluidHandleInternalPayloadPending: (fluidHandleInternal:
37
38
  * @privateRemarks
38
39
  * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged
39
40
  * to IFluidHandle, this type guard will no longer be necessary.
40
- * @legacy
41
- * @alpha
41
+ * @legacy @beta
42
42
  */
43
43
  export declare const isFluidHandlePayloadPending: <T>(handle: IFluidHandle<T>) => handle is IFluidHandlePayloadPending<T>;
44
44
  /**
45
45
  * Check if the handle is an ILocalFluidHandle.
46
- * @legacy
47
- * @alpha
46
+ * @legacy @beta
48
47
  */
49
48
  export declare const isLocalFluidHandle: <T>(handle: IFluidHandle<T>) => handle is ILocalFluidHandle<T>;
50
49
  /**
@@ -71,20 +70,17 @@ export declare function isFluidHandle(value: unknown): value is IFluidHandle;
71
70
  export declare function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean;
72
71
  /**
73
72
  * Downcast an IFluidHandle to an IFluidHandleInternal.
74
- * @legacy
75
- * @alpha
73
+ * @legacy @beta
76
74
  */
77
75
  export declare function toFluidHandleInternal<T>(handle: IFluidHandle<T>): IFluidHandleInternal<T>;
78
76
  /**
79
77
  * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.
80
- * @legacy
81
- * @alpha
78
+ * @legacy @beta
82
79
  */
83
80
  export declare function toFluidHandleErased<T>(handle: IFluidHandleInternal<T>): IFluidHandleErased<T>;
84
81
  /**
85
82
  * Base class which can be uses to assist implementing IFluidHandleInternal.
86
- * @legacy
87
- * @alpha
83
+ * @legacy @beta
88
84
  */
89
85
  export declare abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {
90
86
  abstract absolutePath: string;
@@ -1 +1 @@
1
- {"version":3,"file":"handles.d.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;AACtE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,oBAAoB,GAAG,iBAAiB,CAW5F;AAcD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAmBnE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,OAAO,CAI7E;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAazF;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACpC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAC7B,kBAAkB,CAAC,CAAC,CAAC,CAGvB;AAED;;;GAGG;AACH,8BAAsB,eAAe,CAAC,CAAC,CAAE,YAAW,oBAAoB,CAAC,CAAC,CAAC;IAC1E,SAAgB,YAAY,EAAE,MAAM,CAAC;aACrB,WAAW,IAAI,IAAI;IACnC,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
@@ -4,11 +4,14 @@
4
4
  */
5
5
  import { IFluidHandle, fluidHandleSymbol } from "@fluidframework/core-interfaces";
6
6
  /**
7
- * Is the input object a @see ISerializedHandle?
7
+ * Narrow a value to {@link ISerializedHandle} by checking its type property.
8
8
  * @internal
9
9
  */
10
- export const isSerializedHandle = (value) => value?.type === "__fluid_handle__";
10
+ export const isSerializedHandle = (value) =>
11
+ // Type assertion is safe as we're only checking for the existence of the type property
12
+ value?.type === "__fluid_handle__";
11
13
  /**
14
+ * Checks if a Fluid handle's internal payload is pending.
12
15
  * @internal
13
16
  */
14
17
  export const isFluidHandleInternalPayloadPending = (fluidHandleInternal) => "payloadPending" in fluidHandleInternal && fluidHandleInternal.payloadPending === true;
@@ -17,15 +20,13 @@ export const isFluidHandleInternalPayloadPending = (fluidHandleInternal) => "pay
17
20
  * @privateRemarks
18
21
  * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged
19
22
  * to IFluidHandle, this type guard will no longer be necessary.
20
- * @legacy
21
- * @alpha
23
+ * @legacy @beta
22
24
  */
23
25
  export const isFluidHandlePayloadPending = (handle) => "payloadState" in handle &&
24
26
  (handle.payloadState === "shared" || handle.payloadState === "pending");
25
27
  /**
26
28
  * Check if the handle is an ILocalFluidHandle.
27
- * @legacy
28
- * @alpha
29
+ * @legacy @beta
29
30
  */
30
31
  export const isLocalFluidHandle = (handle) => isFluidHandlePayloadPending(handle) && "payloadShareError" in handle;
31
32
  /**
@@ -75,6 +76,7 @@ export function isFluidHandle(value) {
75
76
  // If enableBackwardsCompatibility, run check for FluidHandles predating use of fluidHandleSymbol.
76
77
  if (enableBackwardsCompatibility && IFluidHandle in value) {
77
78
  // Since this check can have false positives, make it a bit more robust by checking value[IFluidHandle][IFluidHandle]
79
+ // Type assertion is needed for backward compatibility with old FluidHandle format
78
80
  const inner = value[IFluidHandle];
79
81
  if (typeof inner !== "object" || inner === null) {
80
82
  return false;
@@ -96,32 +98,32 @@ export function compareFluidHandles(a, b) {
96
98
  }
97
99
  /**
98
100
  * Downcast an IFluidHandle to an IFluidHandleInternal.
99
- * @legacy
100
- * @alpha
101
+ * @legacy @beta
101
102
  */
102
103
  export function toFluidHandleInternal(handle) {
103
104
  if (!(fluidHandleSymbol in handle) || !(fluidHandleSymbol in handle[fluidHandleSymbol])) {
104
105
  if (enableBackwardsCompatibility && IFluidHandle in handle) {
106
+ // Type assertion needed for backward compatibility with old handle format
105
107
  return handle[IFluidHandle];
106
108
  }
107
109
  throw new TypeError("Invalid IFluidHandle");
108
110
  }
109
111
  // This casts the IFluidHandleErased from the symbol instead of `handle` to ensure that if someone
110
112
  // implements their own IFluidHandle in terms of an existing handle, it won't break anything.
113
+ // Type assertion is safe as fluidHandleSymbol is guaranteed to contain an IFluidHandleInternal
111
114
  return handle[fluidHandleSymbol];
112
115
  }
113
116
  /**
114
117
  * Type erase IFluidHandleInternal for use with {@link @fluidframework/core-interfaces#fluidHandleSymbol}.
115
- * @legacy
116
- * @alpha
118
+ * @legacy @beta
117
119
  */
118
120
  export function toFluidHandleErased(handle) {
121
+ // Type assertion is safe as we're intentionally erasing internal type information
119
122
  return handle;
120
123
  }
121
124
  /**
122
125
  * Base class which can be uses to assist implementing IFluidHandleInternal.
123
- * @legacy
124
- * @alpha
126
+ * @legacy @beta
125
127
  */
126
128
  export class FluidHandleBase {
127
129
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AA+BlF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAU,EAA8B,EAAE,CAC5E,KAAK,EAAE,IAAI,KAAK,kBAAkB,CAAC;AAEpC;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAClD,mBAAyC,EACmB,EAAE,CAC9D,gBAAgB,IAAI,mBAAmB,IAAI,mBAAmB,CAAC,cAAc,KAAK,IAAI,CAAC;AAExF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAC1C,MAAuB,EACmB,EAAE,CAC5C,cAAc,IAAI,MAAM;IACxB,CAAC,MAAM,CAAC,YAAY,KAAK,QAAQ,IAAI,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CACjC,MAAuB,EACU,EAA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SAAS,CAAC,YAAY,CAAC;AAC1D,CAAC;AAED;;;;GAIG;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,CAAC;QACzF,IAAI,4BAA4B,IAAI,YAAY,IAAI,MAAM,EAAE,CAAC;YAC5D,OAAO,MAAM,CAAC,YAAY,CAA4B,CAAC;QACxD,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAC7C,CAAC;IAED,kGAAkG;IAClG,6FAA6F;IAC7F,OAAO,MAAM,CAAC,iBAAiB,CAAuC,CAAC;AACxE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAClC,MAA+B;IAE/B,OAAO,MAA0C,CAAC;AACnD,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAgB,eAAe;IAMpC;;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 { IFluidHandleErased } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandle, fluidHandleSymbol } from \"@fluidframework/core-interfaces\";\nimport type {\n\tIFluidHandleInternal,\n\tIFluidHandleInternalPayloadPending,\n\tIFluidHandlePayloadPending,\n\tILocalFluidHandle,\n} from \"@fluidframework/core-interfaces/internal\";\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\t/**\n\t * The handle may have a pending payload, as determined by and resolvable by the subsystem that\n\t * the handle relates to. For instance, the BlobManager uses this to distinguish blob handles\n\t * which may not yet have an attached blob yet.\n\t *\n\t * @remarks\n\t * Will only exist if the handle was created with a pending payload, will be omitted entirely from\n\t * the serialized format if the handle was created with an already-shared payload.\n\t */\n\treadonly payloadPending?: true;\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 * @internal\n */\nexport const isFluidHandleInternalPayloadPending = (\n\tfluidHandleInternal: IFluidHandleInternal,\n): fluidHandleInternal is IFluidHandleInternalPayloadPending =>\n\t\"payloadPending\" in fluidHandleInternal && fluidHandleInternal.payloadPending === true;\n\n/**\n * Check if the handle is an IFluidHandlePayloadPending.\n * @privateRemarks\n * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged\n * to IFluidHandle, this type guard will no longer be necessary.\n * @legacy\n * @alpha\n */\nexport const isFluidHandlePayloadPending = <T>(\n\thandle: IFluidHandle<T>,\n): handle is IFluidHandlePayloadPending<T> =>\n\t\"payloadState\" in handle &&\n\t(handle.payloadState === \"shared\" || handle.payloadState === \"pending\");\n\n/**\n * Check if the handle is an ILocalFluidHandle.\n * @legacy\n * @alpha\n */\nexport const isLocalFluidHandle = <T>(\n\thandle: IFluidHandle<T>,\n): handle is ILocalFluidHandle<T> =>\n\tisFluidHandlePayloadPending(handle) && \"payloadShareError\" in handle;\n/**\n * Encodes the given IFluidHandle into a JSON-serializable form,\n * @param handle - The IFluidHandle to serialize.\n * @returns The serialized handle.\n *\n * @internal\n */\nexport function encodeHandleForSerialization(handle: IFluidHandleInternal): ISerializedHandle {\n\treturn isFluidHandleInternalPayloadPending(handle)\n\t\t? {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t\tpayloadPending: true,\n\t\t\t}\n\t\t: {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t};\n}\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 {@link @fluidframework/core-interfaces#IFluidHandle}.\n * @remarks\n * Objects which have a field named `IFluidHandle` can in some cases produce a false positive.\n * @public\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 * Compare two {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}.\n * @remarks\n * Returns true iff both handles have the same internal `absolutePath`.\n * @public\n */\nexport function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean {\n\tconst aInternal = toFluidHandleInternal(a);\n\tconst bInternal = toFluidHandleInternal(b);\n\treturn aInternal.absolutePath === bInternal.absolutePath;\n}\n\n/**\n * Downcast an IFluidHandle to an IFluidHandleInternal.\n * @legacy\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 * @legacy\n * @alpha\n */\nexport function toFluidHandleErased<T>(\n\thandle: IFluidHandleInternal<T>,\n): 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 * @legacy\n * @alpha\n */\nexport abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {\n\tpublic abstract absolutePath: string;\n\tpublic abstract attachGraph(): 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"]}
1
+ {"version":3,"file":"handles.js","sourceRoot":"","sources":["../src/handles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AA+BlF;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAc,EAA8B,EAAE;AAChF,uFAAuF;AACtF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;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 { IFluidHandleErased } from \"@fluidframework/core-interfaces\";\nimport { IFluidHandle, fluidHandleSymbol } from \"@fluidframework/core-interfaces\";\nimport type {\n\tIFluidHandleInternal,\n\tIFluidHandleInternalPayloadPending,\n\tIFluidHandlePayloadPending,\n\tILocalFluidHandle,\n} from \"@fluidframework/core-interfaces/internal\";\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\t/**\n\t * The handle may have a pending payload, as determined by and resolvable by the subsystem that\n\t * the handle relates to. For instance, the BlobManager uses this to distinguish blob handles\n\t * which may not yet have an attached blob yet.\n\t *\n\t * @remarks\n\t * Will only exist if the handle was created with a pending payload, will be omitted entirely from\n\t * the serialized format if the handle was created with an already-shared payload.\n\t */\n\treadonly payloadPending?: true;\n}\n\n/**\n * Narrow a value to {@link ISerializedHandle} by checking its type property.\n * @internal\n */\nexport const isSerializedHandle = (value: unknown): value is ISerializedHandle =>\n\t// Type assertion is safe as we're only checking for the existence of the type property\n\t(value as { type?: string } | undefined)?.type === \"__fluid_handle__\";\n\n/**\n * Checks if a Fluid handle's internal payload is pending.\n * @internal\n */\nexport const isFluidHandleInternalPayloadPending = (\n\tfluidHandleInternal: IFluidHandleInternal,\n): fluidHandleInternal is IFluidHandleInternalPayloadPending =>\n\t\"payloadPending\" in fluidHandleInternal && fluidHandleInternal.payloadPending === true;\n\n/**\n * Check if the handle is an IFluidHandlePayloadPending.\n * @privateRemarks\n * This should be true for locally-created BlobHandles currently. When IFluidHandlePayloadPending is merged\n * to IFluidHandle, this type guard will no longer be necessary.\n * @legacy @beta\n */\nexport const isFluidHandlePayloadPending = <T>(\n\thandle: IFluidHandle<T>,\n): handle is IFluidHandlePayloadPending<T> =>\n\t\"payloadState\" in handle &&\n\t(handle.payloadState === \"shared\" || handle.payloadState === \"pending\");\n\n/**\n * Check if the handle is an ILocalFluidHandle.\n * @legacy @beta\n */\nexport const isLocalFluidHandle = <T>(\n\thandle: IFluidHandle<T>,\n): handle is ILocalFluidHandle<T> =>\n\tisFluidHandlePayloadPending(handle) && \"payloadShareError\" in handle;\n/**\n * Encodes the given IFluidHandle into a JSON-serializable form,\n * @param handle - The IFluidHandle to serialize.\n * @returns The serialized handle.\n *\n * @internal\n */\nexport function encodeHandleForSerialization(handle: IFluidHandleInternal): ISerializedHandle {\n\treturn isFluidHandleInternalPayloadPending(handle)\n\t\t? {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t\tpayloadPending: true,\n\t\t\t}\n\t\t: {\n\t\t\t\ttype: \"__fluid_handle__\",\n\t\t\t\turl: handle.absolutePath,\n\t\t\t};\n}\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 {@link @fluidframework/core-interfaces#IFluidHandle}.\n * @remarks\n * Objects which have a field named `IFluidHandle` can in some cases produce a false positive.\n * @public\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\t// Type assertion is needed for backward compatibility with old FluidHandle format\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 * Compare two {@link @fluidframework/core-interfaces#IFluidHandle|IFluidHandles}.\n * @remarks\n * Returns true iff both handles have the same internal `absolutePath`.\n * @public\n */\nexport function compareFluidHandles(a: IFluidHandle, b: IFluidHandle): boolean {\n\tconst aInternal = toFluidHandleInternal(a);\n\tconst bInternal = toFluidHandleInternal(b);\n\treturn aInternal.absolutePath === bInternal.absolutePath;\n}\n\n/**\n * Downcast an IFluidHandle to an IFluidHandleInternal.\n * @legacy @beta\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\t// Type assertion needed for backward compatibility with old handle format\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\t// Type assertion is safe as fluidHandleSymbol is guaranteed to contain an IFluidHandleInternal\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 * @legacy @beta\n */\nexport function toFluidHandleErased<T>(\n\thandle: IFluidHandleInternal<T>,\n): IFluidHandleErased<T> {\n\t// Type assertion is safe as we're intentionally erasing internal type information\n\treturn handle as unknown as IFluidHandleErased<T>;\n}\n\n/**\n * Base class which can be uses to assist implementing IFluidHandleInternal.\n * @legacy @beta\n */\nexport abstract class FluidHandleBase<T> implements IFluidHandleInternal<T> {\n\tpublic abstract absolutePath: string;\n\tpublic abstract attachGraph(): 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,8 @@
4
4
  */
5
5
  export { generateHandleContextPath } from "./dataStoreHandleContextUtils.js";
6
6
  export { create404Response, createResponseError, exceptionToResponse, responseToException, } from "./dataStoreHelpers.js";
7
- export { compareFluidHandles, encodeHandleForSerialization, FluidHandleBase, ISerializedHandle, isFluidHandle, isFluidHandleInternalPayloadPending, isFluidHandlePayloadPending, isLocalFluidHandle, isSerializedHandle, toFluidHandleErased, toFluidHandleInternal, } from "./handles.js";
7
+ export { compareFluidHandles, encodeHandleForSerialization, FluidHandleBase, isFluidHandle, isFluidHandleInternalPayloadPending, isFluidHandlePayloadPending, isLocalFluidHandle, isSerializedHandle, toFluidHandleErased, toFluidHandleInternal, } from "./handles.js";
8
+ export type { ISerializedHandle } from "./handles.js";
8
9
  export { ObjectStoragePartition } from "./objectstoragepartition.js";
9
10
  export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath, } from "./objectstorageutils.js";
10
11
  export { RemoteFluidObjectHandle } from "./remoteFluidObjectHandle.js";
@@ -12,8 +13,10 @@ export { RequestParser } from "./requestParser.js";
12
13
  export { RuntimeFactoryHelper } from "./runtimeFactoryHelper.js";
13
14
  export { addBlobToSummary, addSummarizeResultToSummary, calculateStats, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, convertToSummaryTree, convertToSummaryTreeWithStats, GCDataBuilder, getBlobSize, mergeStats, processAttachMessageGCData, SummaryTreeBuilder, TelemetryContext, utf8ByteLength, } from "./summaryUtils.js";
14
15
  export { unpackChildNodesUsedRoutes } from "./unpackUsedRoutes.js";
15
- export { ReadAndParseBlob, RuntimeHeaders, seqFromTree, encodeCompactIdToString, } from "./utils.js";
16
+ export { RuntimeHeaders, seqFromTree, encodeCompactIdToString, } from "./utils.js";
17
+ export type { ReadAndParseBlob } from "./utils.js";
16
18
  export { isSnapshotFetchRequiredForLoadingGroupId } from "./snapshotUtils.js";
17
19
  export { toDeltaManagerErased, toDeltaManagerInternal, } from "./deltaManager.js";
18
- export { ConfigMap, configValueToMinVersionForCollab, ConfigValidationMap, defaultMinVersionForCollab, getValidationForRuntimeOptions, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, MinimumMinorSemanticVersion, SemanticVersion, } from "./compatibilityBase.js";
20
+ export { configValueToMinVersionForCollab, defaultMinVersionForCollab, getValidationForRuntimeOptions, getConfigsForMinVersionForCollab, isValidMinVersionForCollab, } from "./compatibilityBase.js";
21
+ export type { ConfigMap, ConfigValidationMap, MinimumMinorSemanticVersion, SemanticVersion, } from "./compatibilityBase.js";
19
22
  //# sourceMappingURL=index.d.ts.map
@@ -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,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,mCAAmC,EACnC,2BAA2B,EAC3B,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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,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EAEf,aAAa,EACb,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,mCAAmC,EACnC,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,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,EAEN,cAAc,EACd,WAAW,EACX,uBAAuB,GACvB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAEN,gCAAgC,EAEhC,0BAA0B,EAC1B,8BAA8B,EAC9B,gCAAgC,EAChC,0BAA0B,GAG1B,MAAM,wBAAwB,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\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tISerializedHandle,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.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 {\n\tReadAndParseBlob,\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tConfigMap,\n\tconfigValueToMinVersionForCollab,\n\tConfigValidationMap,\n\tdefaultMinVersionForCollab,\n\tgetValidationForRuntimeOptions,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\n"]}
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,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,mBAAmB,EACnB,4BAA4B,EAC5B,eAAe,EACf,aAAa,EACb,mCAAmC,EACnC,2BAA2B,EAC3B,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,qBAAqB,GACrB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EACN,mCAAmC,EACnC,mBAAmB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,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,EACN,cAAc,EACd,WAAW,EACX,uBAAuB,GACvB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,wCAAwC,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,EACN,oBAAoB,EACpB,sBAAsB,GACtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,gCAAgC,EAChC,0BAA0B,EAC1B,8BAA8B,EAC9B,gCAAgC,EAChC,0BAA0B,GAC1B,MAAM,wBAAwB,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\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n} from \"./dataStoreHelpers.js\";\nexport {\n\tcompareFluidHandles,\n\tencodeHandleForSerialization,\n\tFluidHandleBase,\n\tisFluidHandle,\n\tisFluidHandleInternalPayloadPending,\n\tisFluidHandlePayloadPending,\n\tisLocalFluidHandle,\n\tisSerializedHandle,\n\ttoFluidHandleErased,\n\ttoFluidHandleInternal,\n} from \"./handles.js\";\nexport type { ISerializedHandle } from \"./handles.js\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition.js\";\nexport {\n\tgetNormalizedObjectStoragePathParts,\n\tlistBlobsAtTreePath,\n} from \"./objectstorageutils.js\";\nexport { RemoteFluidObjectHandle } from \"./remoteFluidObjectHandle.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 {\n\tRuntimeHeaders,\n\tseqFromTree,\n\tencodeCompactIdToString,\n} from \"./utils.js\";\nexport type { ReadAndParseBlob } from \"./utils.js\";\nexport { isSnapshotFetchRequiredForLoadingGroupId } from \"./snapshotUtils.js\";\nexport {\n\ttoDeltaManagerErased,\n\ttoDeltaManagerInternal,\n} from \"./deltaManager.js\";\nexport {\n\tconfigValueToMinVersionForCollab,\n\tdefaultMinVersionForCollab,\n\tgetValidationForRuntimeOptions,\n\tgetConfigsForMinVersionForCollab,\n\tisValidMinVersionForCollab,\n} from \"./compatibilityBase.js\";\nexport type {\n\tConfigMap,\n\tConfigValidationMap,\n\tMinimumMinorSemanticVersion,\n\tSemanticVersion,\n} from \"./compatibilityBase.js\";\n"]}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
5
+ import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
6
  /**
7
7
  * Returns a new IChannelStorageService that resolves the given `path` as root.
8
8
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"objectstoragepartition.d.ts","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAExF;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,sBAAsB;IAEnE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,OAAO,EAAE,sBAAsB,EAC/B,IAAI,EAAE,MAAM;IAMjB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAIhD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAGlD"}
1
+ {"version":3,"file":"objectstoragepartition.d.ts","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAE7F;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,sBAAsB;IAEnE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBADJ,OAAO,EAAE,sBAAsB,EAC/B,IAAI,EAAE,MAAM;IAMjB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAIhD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIxC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAGlD"}
@@ -1 +1 @@
1
- {"version":3,"file":"objectstoragepartition.js","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAG7D;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAClC,YACkB,OAA+B,EAC/B,IAAY;QADZ,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QAE7B,kDAAkD;QAClD,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACxF,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\n\n/**\n * Returns a new IChannelStorageService that resolves the given `path` as root.\n * @internal\n */\nexport class ObjectStoragePartition implements IChannelStorageService {\n\tconstructor(\n\t\tprivate readonly storage: IChannelStorageService,\n\t\tprivate readonly path: string,\n\t) {\n\t\t// `path` must not include the trailing separator.\n\t\tassert(!path.endsWith(\"/\"), 0x19c /* \"storage service path has trailing separator\" */);\n\t}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(`${this.path}/${path}`);\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\treturn this.storage.contains(`${this.path}/${path}`);\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\treturn this.storage.list(`${this.path}/${path}`);\n\t}\n}\n"]}
1
+ {"version":3,"file":"objectstoragepartition.js","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAG7D;;;GAGG;AACH,MAAM,OAAO,sBAAsB;IAClC,YACkB,OAA+B,EAC/B,IAAY;QADZ,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QAE7B,kDAAkD;QAClD,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACxF,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\n\n/**\n * Returns a new IChannelStorageService that resolves the given `path` as root.\n * @internal\n */\nexport class ObjectStoragePartition implements IChannelStorageService {\n\tpublic constructor(\n\t\tprivate readonly storage: IChannelStorageService,\n\t\tprivate readonly path: string,\n\t) {\n\t\t// `path` must not include the trailing separator.\n\t\tassert(!path.endsWith(\"/\"), 0x19c /* \"storage service path has trailing separator\" */);\n\t}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\treturn this.storage.readBlob(`${this.path}/${path}`);\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\treturn this.storage.contains(`${this.path}/${path}`);\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\treturn this.storage.list(`${this.path}/${path}`);\n\t}\n}\n"]}
@@ -2,12 +2,20 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ITree } from "@fluidframework/driver-definitions/internal";
5
+ import type { ITree } from "@fluidframework/driver-definitions/internal";
6
6
  /**
7
+ * Normalizes a storage path by removing leading and trailing slashes and splitting into parts
8
+ * @param path - The storage path to normalize (e.g. "/foo/bar/")
9
+ * @returns Array of path segments (e.g. ["foo", "bar"])
7
10
  * @internal
8
11
  */
9
12
  export declare function getNormalizedObjectStoragePathParts(path: string): string[];
10
13
  /**
14
+ * Lists all blobs at the specified path in the given tree
15
+ * @param inputTree - The tree to search within
16
+ * @param path - The path to search at (e.g. "foo/bar")
17
+ * @returns Promise that resolves to an array of blob names at that path
18
+ * @throws Error if the path does not exist in the tree
11
19
  * @internal
12
20
  */
13
21
  export declare function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"objectstorageutils.d.ts","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,6CAA6C,CAAC;AAEpE;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,MAAM,YAY/D;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACxC,SAAS,EAAE,KAAK,GAAG,SAAS,EAC5B,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBnB"}
1
+ {"version":3,"file":"objectstorageutils.d.ts","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,6CAA6C,CAAC;AAGzE;;;;;GAKG;AACH,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAY1E;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACxC,SAAS,EAAE,KAAK,GAAG,SAAS,EAC5B,IAAI,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBnB"}
@@ -2,16 +2,20 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ import { TreeEntry } from "@fluidframework/driver-definitions/internal";
5
6
  /**
7
+ * Normalizes a storage path by removing leading and trailing slashes and splitting into parts
8
+ * @param path - The storage path to normalize (e.g. "/foo/bar/")
9
+ * @returns Array of path segments (e.g. ["foo", "bar"])
6
10
  * @internal
7
11
  */
8
12
  export function getNormalizedObjectStoragePathParts(path) {
9
13
  let normalizePath = path;
10
14
  if (normalizePath.startsWith("/")) {
11
- normalizePath = normalizePath.substr(1);
15
+ normalizePath = normalizePath.slice(1);
12
16
  }
13
17
  if (normalizePath.endsWith("/")) {
14
- normalizePath = normalizePath.substr(0, normalizePath.length - 1);
18
+ normalizePath = normalizePath.slice(0, -1);
15
19
  }
16
20
  if (normalizePath.length > 0) {
17
21
  return normalizePath.split("/");
@@ -19,6 +23,11 @@ export function getNormalizedObjectStoragePathParts(path) {
19
23
  return [];
20
24
  }
21
25
  /**
26
+ * Lists all blobs at the specified path in the given tree
27
+ * @param inputTree - The tree to search within
28
+ * @param path - The path to search at (e.g. "foo/bar")
29
+ * @returns Promise that resolves to an array of blob names at that path
30
+ * @throws Error if the path does not exist in the tree
22
31
  * @internal
23
32
  */
24
33
  export async function listBlobsAtTreePath(inputTree, path) {
@@ -27,16 +36,16 @@ export async function listBlobsAtTreePath(inputTree, path) {
27
36
  while (tree?.entries !== undefined && pathParts.length > 0) {
28
37
  const part = pathParts.shift();
29
38
  const treeEntry = tree.entries.find((value) => {
30
- return value.type === "Tree" && value.path === part ? true : false;
39
+ return value.type === TreeEntry.Tree && value.path === part ? true : false;
31
40
  });
32
41
  // this check is largely superfluous due to the same check being done
33
42
  // immediately above. the type system, however, is not aware of this.
34
43
  // so we must redundantly determine that the entry's type is "Tree"
35
- tree = treeEntry?.type === "Tree" ? treeEntry.value : undefined;
44
+ tree = treeEntry?.type === TreeEntry.Tree ? treeEntry.value : undefined;
36
45
  }
37
- if (tree?.entries === undefined || pathParts.length !== 0) {
46
+ if (tree?.entries === undefined || pathParts.length > 0) {
38
47
  throw new Error("path does not exist");
39
48
  }
40
- return tree.entries.filter((e) => e.type === "Blob").map((e) => e.path);
49
+ return tree.entries.filter((e) => e.type === TreeEntry.Blob).map((e) => e.path);
41
50
  }
42
51
  //# sourceMappingURL=objectstorageutils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"objectstorageutils.js","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,UAAU,mCAAmC,CAAC,IAAY;IAC/D,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,IAAI,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnE,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,EAAE,CAAC;AACX,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,SAA4B,EAC5B,IAAY;IAEZ,MAAM,SAAS,GAAG,mCAAmC,CAAC,IAAI,CAAC,CAAC;IAC5D,IAAI,IAAI,GAAsB,SAAS,CAAC;IACxC,OAAO,IAAI,EAAE,OAAO,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7C,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QACpE,CAAC,CAAC,CAAC;QAEH,qEAAqE;QACrE,qEAAqE;QACrE,mEAAmE;QACnE,IAAI,GAAG,SAAS,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACjE,CAAC;IACD,IAAI,IAAI,EAAE,OAAO,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACzE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITree } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * @internal\n */\nexport function getNormalizedObjectStoragePathParts(path: string) {\n\tlet normalizePath = path;\n\tif (normalizePath.startsWith(\"/\")) {\n\t\tnormalizePath = normalizePath.substr(1);\n\t}\n\tif (normalizePath.endsWith(\"/\")) {\n\t\tnormalizePath = normalizePath.substr(0, normalizePath.length - 1);\n\t}\n\tif (normalizePath.length > 0) {\n\t\treturn normalizePath.split(\"/\");\n\t}\n\treturn [];\n}\n\n/**\n * @internal\n */\nexport async function listBlobsAtTreePath(\n\tinputTree: ITree | undefined,\n\tpath: string,\n): Promise<string[]> {\n\tconst pathParts = getNormalizedObjectStoragePathParts(path);\n\tlet tree: ITree | undefined = inputTree;\n\twhile (tree?.entries !== undefined && pathParts.length > 0) {\n\t\tconst part = pathParts.shift();\n\t\tconst treeEntry = tree.entries.find((value) => {\n\t\t\treturn value.type === \"Tree\" && value.path === part ? true : false;\n\t\t});\n\n\t\t// this check is largely superfluous due to the same check being done\n\t\t// immediately above. the type system, however, is not aware of this.\n\t\t// so we must redundantly determine that the entry's type is \"Tree\"\n\t\ttree = treeEntry?.type === \"Tree\" ? treeEntry.value : undefined;\n\t}\n\tif (tree?.entries === undefined || pathParts.length !== 0) {\n\t\tthrow new Error(\"path does not exist\");\n\t}\n\treturn tree.entries.filter((e) => e.type === \"Blob\").map((e) => e.path);\n}\n"]}
1
+ {"version":3,"file":"objectstorageutils.js","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAC;AAExE;;;;;GAKG;AACH,MAAM,UAAU,mCAAmC,CAAC,IAAY;IAC/D,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,IAAI,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,aAAa,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC9B,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,EAAE,CAAC;AACX,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACxC,SAA4B,EAC5B,IAAY;IAEZ,MAAM,SAAS,GAAG,mCAAmC,CAAC,IAAI,CAAC,CAAC;IAC5D,IAAI,IAAI,GAAsB,SAAS,CAAC;IACxC,OAAO,IAAI,EAAE,OAAO,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YAC7C,OAAO,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAC5E,CAAC,CAAC,CAAC;QAEH,qEAAqE;QACrE,qEAAqE;QACrE,mEAAmE;QACnE,IAAI,GAAG,SAAS,EAAE,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACzE,CAAC;IACD,IAAI,IAAI,EAAE,OAAO,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AACjF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITree } from \"@fluidframework/driver-definitions/internal\";\nimport { TreeEntry } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Normalizes a storage path by removing leading and trailing slashes and splitting into parts\n * @param path - The storage path to normalize (e.g. \"/foo/bar/\")\n * @returns Array of path segments (e.g. [\"foo\", \"bar\"])\n * @internal\n */\nexport function getNormalizedObjectStoragePathParts(path: string): string[] {\n\tlet normalizePath = path;\n\tif (normalizePath.startsWith(\"/\")) {\n\t\tnormalizePath = normalizePath.slice(1);\n\t}\n\tif (normalizePath.endsWith(\"/\")) {\n\t\tnormalizePath = normalizePath.slice(0, -1);\n\t}\n\tif (normalizePath.length > 0) {\n\t\treturn normalizePath.split(\"/\");\n\t}\n\treturn [];\n}\n\n/**\n * Lists all blobs at the specified path in the given tree\n * @param inputTree - The tree to search within\n * @param path - The path to search at (e.g. \"foo/bar\")\n * @returns Promise that resolves to an array of blob names at that path\n * @throws Error if the path does not exist in the tree\n * @internal\n */\nexport async function listBlobsAtTreePath(\n\tinputTree: ITree | undefined,\n\tpath: string,\n): Promise<string[]> {\n\tconst pathParts = getNormalizedObjectStoragePathParts(path);\n\tlet tree: ITree | undefined = inputTree;\n\twhile (tree?.entries !== undefined && pathParts.length > 0) {\n\t\tconst part = pathParts.shift();\n\t\tconst treeEntry = tree.entries.find((value) => {\n\t\t\treturn value.type === TreeEntry.Tree && value.path === part ? true : false;\n\t\t});\n\n\t\t// this check is largely superfluous due to the same check being done\n\t\t// immediately above. the type system, however, is not aware of this.\n\t\t// so we must redundantly determine that the entry's type is \"Tree\"\n\t\ttree = treeEntry?.type === TreeEntry.Tree ? treeEntry.value : undefined;\n\t}\n\tif (tree?.entries === undefined || pathParts.length > 0) {\n\t\tthrow new Error(\"path does not exist\");\n\t}\n\treturn tree.entries.filter((e) => e.type === TreeEntry.Blob).map((e) => e.path);\n}\n"]}