@fluidframework/runtime-utils 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.224419

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 (187) hide show
  1. package/.eslintrc.js +5 -7
  2. package/.mocharc.js +12 -0
  3. package/CHANGELOG.md +191 -0
  4. package/README.md +68 -1
  5. package/api-extractor-lint.json +4 -0
  6. package/api-extractor.json +2 -2
  7. package/api-report/runtime-utils.api.md +201 -0
  8. package/dist/{dataStoreHandleContextUtils.js → dataStoreHandleContextUtils.cjs} +5 -2
  9. package/dist/dataStoreHandleContextUtils.cjs.map +1 -0
  10. package/dist/dataStoreHandleContextUtils.d.ts +1 -0
  11. package/dist/dataStoreHandleContextUtils.d.ts.map +1 -1
  12. package/dist/{dataStoreHelpers.js → dataStoreHelpers.cjs} +44 -25
  13. package/dist/dataStoreHelpers.cjs.map +1 -0
  14. package/dist/dataStoreHelpers.d.ts +23 -4
  15. package/dist/dataStoreHelpers.d.ts.map +1 -1
  16. package/dist/index.cjs +44 -0
  17. package/dist/index.cjs.map +1 -0
  18. package/dist/index.d.ts +9 -9
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/{objectstoragepartition.js → objectstoragepartition.cjs} +4 -3
  21. package/dist/objectstoragepartition.cjs.map +1 -0
  22. package/dist/objectstoragepartition.d.ts +1 -0
  23. package/dist/objectstoragepartition.d.ts.map +1 -1
  24. package/dist/{objectstorageutils.js → objectstorageutils.cjs} +11 -15
  25. package/dist/objectstorageutils.cjs.map +1 -0
  26. package/dist/objectstorageutils.d.ts +6 -0
  27. package/dist/objectstorageutils.d.ts.map +1 -1
  28. package/dist/{requestParser.js → requestParser.cjs} +7 -11
  29. package/dist/requestParser.cjs.map +1 -0
  30. package/dist/requestParser.d.ts +1 -0
  31. package/dist/requestParser.d.ts.map +1 -1
  32. package/dist/runtime-utils-alpha.d.ts +155 -0
  33. package/dist/runtime-utils-beta.d.ts +103 -0
  34. package/dist/runtime-utils-public.d.ts +103 -0
  35. package/dist/runtime-utils-untrimmed.d.ts +306 -0
  36. package/dist/{runtimeFactoryHelper.js → runtimeFactoryHelper.cjs} +11 -12
  37. package/dist/runtimeFactoryHelper.cjs.map +1 -0
  38. package/dist/runtimeFactoryHelper.d.ts +4 -1
  39. package/dist/runtimeFactoryHelper.d.ts.map +1 -1
  40. package/dist/{summaryUtils.js → summaryUtils.cjs} +138 -34
  41. package/dist/summaryUtils.cjs.map +1 -0
  42. package/dist/summaryUtils.d.ts +66 -4
  43. package/dist/summaryUtils.d.ts.map +1 -1
  44. package/dist/tsdoc-metadata.json +11 -0
  45. package/dist/unpackUsedRoutes.cjs +34 -0
  46. package/dist/unpackUsedRoutes.cjs.map +1 -0
  47. package/dist/unpackUsedRoutes.d.ts +12 -0
  48. package/dist/unpackUsedRoutes.d.ts.map +1 -0
  49. package/dist/{utils.js → utils.cjs} +2 -1
  50. package/dist/utils.cjs.map +1 -0
  51. package/dist/utils.d.ts +7 -2
  52. package/dist/utils.d.ts.map +1 -1
  53. package/lib/{dataStoreHandleContextUtils.d.ts → dataStoreHandleContextUtils.d.mts} +1 -0
  54. package/lib/dataStoreHandleContextUtils.d.mts.map +1 -0
  55. package/lib/{dataStoreHandleContextUtils.js → dataStoreHandleContextUtils.mjs} +5 -2
  56. package/lib/dataStoreHandleContextUtils.mjs.map +1 -0
  57. package/lib/{dataStoreHelpers.d.ts → dataStoreHelpers.d.mts} +23 -4
  58. package/lib/dataStoreHelpers.d.mts.map +1 -0
  59. package/lib/{dataStoreHelpers.js → dataStoreHelpers.mjs} +42 -22
  60. package/lib/dataStoreHelpers.mjs.map +1 -0
  61. package/lib/index.d.mts +14 -0
  62. package/lib/index.d.mts.map +1 -0
  63. package/lib/index.mjs +14 -0
  64. package/lib/index.mjs.map +1 -0
  65. package/lib/{objectstoragepartition.d.ts → objectstoragepartition.d.mts} +1 -0
  66. package/lib/objectstoragepartition.d.mts.map +1 -0
  67. package/lib/{objectstoragepartition.js → objectstoragepartition.mjs} +3 -2
  68. package/lib/objectstoragepartition.mjs.map +1 -0
  69. package/lib/{objectstorageutils.d.ts → objectstorageutils.d.mts} +6 -0
  70. package/lib/objectstorageutils.d.mts.map +1 -0
  71. package/lib/{objectstorageutils.js → objectstorageutils.mjs} +11 -15
  72. package/lib/objectstorageutils.mjs.map +1 -0
  73. package/lib/{requestParser.d.ts → requestParser.d.mts} +1 -4
  74. package/lib/requestParser.d.mts.map +1 -0
  75. package/lib/{requestParser.js → requestParser.mjs} +7 -11
  76. package/lib/requestParser.mjs.map +1 -0
  77. package/lib/runtime-utils-alpha.d.mts +155 -0
  78. package/lib/runtime-utils-beta.d.mts +103 -0
  79. package/lib/runtime-utils-public.d.mts +103 -0
  80. package/lib/runtime-utils-untrimmed.d.mts +306 -0
  81. package/lib/{runtimeFactoryHelper.d.ts → runtimeFactoryHelper.d.mts} +4 -1
  82. package/lib/runtimeFactoryHelper.d.mts.map +1 -0
  83. package/lib/runtimeFactoryHelper.mjs +24 -0
  84. package/lib/runtimeFactoryHelper.mjs.map +1 -0
  85. package/lib/{summaryUtils.d.ts → summaryUtils.d.mts} +66 -4
  86. package/lib/summaryUtils.d.mts.map +1 -0
  87. package/lib/{summaryUtils.js → summaryUtils.mjs} +129 -26
  88. package/lib/summaryUtils.mjs.map +1 -0
  89. package/lib/unpackUsedRoutes.d.mts +12 -0
  90. package/lib/unpackUsedRoutes.d.mts.map +1 -0
  91. package/lib/unpackUsedRoutes.mjs +30 -0
  92. package/lib/unpackUsedRoutes.mjs.map +1 -0
  93. package/lib/{utils.d.ts → utils.d.mts} +7 -2
  94. package/lib/utils.d.mts.map +1 -0
  95. package/lib/{utils.js → utils.mjs} +2 -1
  96. package/lib/utils.mjs.map +1 -0
  97. package/package.json +102 -66
  98. package/prettier.config.cjs +8 -0
  99. package/src/dataStoreHandleContextUtils.ts +24 -16
  100. package/src/dataStoreHelpers.ts +106 -83
  101. package/src/index.ts +31 -9
  102. package/src/objectstoragepartition.ts +18 -14
  103. package/src/objectstorageutils.ts +37 -36
  104. package/src/requestParser.ts +81 -86
  105. package/src/runtimeFactoryHelper.ts +27 -26
  106. package/src/summaryUtils.ts +425 -299
  107. package/src/unpackUsedRoutes.ts +31 -0
  108. package/src/utils.ts +12 -7
  109. package/tsc-multi.test.json +4 -0
  110. package/tsconfig.json +10 -12
  111. package/dist/dataStoreHandleContextUtils.js.map +0 -1
  112. package/dist/dataStoreHelpers.js.map +0 -1
  113. package/dist/index.js +0 -26
  114. package/dist/index.js.map +0 -1
  115. package/dist/objectstoragepartition.js.map +0 -1
  116. package/dist/objectstorageutils.js.map +0 -1
  117. package/dist/packageVersion.d.ts +0 -9
  118. package/dist/packageVersion.d.ts.map +0 -1
  119. package/dist/packageVersion.js +0 -12
  120. package/dist/packageVersion.js.map +0 -1
  121. package/dist/requestParser.js.map +0 -1
  122. package/dist/runtimeFactoryHelper.js.map +0 -1
  123. package/dist/summarizerNode/index.d.ts +0 -8
  124. package/dist/summarizerNode/index.d.ts.map +0 -1
  125. package/dist/summarizerNode/index.js +0 -12
  126. package/dist/summarizerNode/index.js.map +0 -1
  127. package/dist/summarizerNode/summarizerNode.d.ts +0 -139
  128. package/dist/summarizerNode/summarizerNode.d.ts.map +0 -1
  129. package/dist/summarizerNode/summarizerNode.js +0 -480
  130. package/dist/summarizerNode/summarizerNode.js.map +0 -1
  131. package/dist/summarizerNode/summarizerNodeUtils.d.ts +0 -161
  132. package/dist/summarizerNode/summarizerNodeUtils.d.ts.map +0 -1
  133. package/dist/summarizerNode/summarizerNodeUtils.js +0 -225
  134. package/dist/summarizerNode/summarizerNodeUtils.js.map +0 -1
  135. package/dist/summarizerNode/summarizerNodeWithGc.d.ts +0 -133
  136. package/dist/summarizerNode/summarizerNodeWithGc.d.ts.map +0 -1
  137. package/dist/summarizerNode/summarizerNodeWithGc.js +0 -294
  138. package/dist/summarizerNode/summarizerNodeWithGc.js.map +0 -1
  139. package/dist/summaryUtils.js.map +0 -1
  140. package/dist/utils.js.map +0 -1
  141. package/lib/dataStoreHandleContextUtils.d.ts.map +0 -1
  142. package/lib/dataStoreHandleContextUtils.js.map +0 -1
  143. package/lib/dataStoreHelpers.d.ts.map +0 -1
  144. package/lib/dataStoreHelpers.js.map +0 -1
  145. package/lib/index.d.ts +0 -14
  146. package/lib/index.d.ts.map +0 -1
  147. package/lib/index.js +0 -14
  148. package/lib/index.js.map +0 -1
  149. package/lib/objectstoragepartition.d.ts.map +0 -1
  150. package/lib/objectstoragepartition.js.map +0 -1
  151. package/lib/objectstorageutils.d.ts.map +0 -1
  152. package/lib/objectstorageutils.js.map +0 -1
  153. package/lib/packageVersion.d.ts +0 -9
  154. package/lib/packageVersion.d.ts.map +0 -1
  155. package/lib/packageVersion.js +0 -9
  156. package/lib/packageVersion.js.map +0 -1
  157. package/lib/requestParser.d.ts.map +0 -1
  158. package/lib/requestParser.js.map +0 -1
  159. package/lib/runtimeFactoryHelper.d.ts.map +0 -1
  160. package/lib/runtimeFactoryHelper.js +0 -25
  161. package/lib/runtimeFactoryHelper.js.map +0 -1
  162. package/lib/summarizerNode/index.d.ts +0 -8
  163. package/lib/summarizerNode/index.d.ts.map +0 -1
  164. package/lib/summarizerNode/index.js +0 -7
  165. package/lib/summarizerNode/index.js.map +0 -1
  166. package/lib/summarizerNode/summarizerNode.d.ts +0 -139
  167. package/lib/summarizerNode/summarizerNode.d.ts.map +0 -1
  168. package/lib/summarizerNode/summarizerNode.js +0 -475
  169. package/lib/summarizerNode/summarizerNode.js.map +0 -1
  170. package/lib/summarizerNode/summarizerNodeUtils.d.ts +0 -161
  171. package/lib/summarizerNode/summarizerNodeUtils.d.ts.map +0 -1
  172. package/lib/summarizerNode/summarizerNodeUtils.js +0 -216
  173. package/lib/summarizerNode/summarizerNodeUtils.js.map +0 -1
  174. package/lib/summarizerNode/summarizerNodeWithGc.d.ts +0 -133
  175. package/lib/summarizerNode/summarizerNodeWithGc.d.ts.map +0 -1
  176. package/lib/summarizerNode/summarizerNodeWithGc.js +0 -289
  177. package/lib/summarizerNode/summarizerNodeWithGc.js.map +0 -1
  178. package/lib/summaryUtils.d.ts.map +0 -1
  179. package/lib/summaryUtils.js.map +0 -1
  180. package/lib/utils.d.ts.map +0 -1
  181. package/lib/utils.js.map +0 -1
  182. package/src/packageVersion.ts +0 -9
  183. package/src/summarizerNode/index.ts +0 -8
  184. package/src/summarizerNode/summarizerNode.ts +0 -662
  185. package/src/summarizerNode/summarizerNodeUtils.ts +0 -339
  186. package/src/summarizerNode/summarizerNodeWithGc.ts +0 -459
  187. package/tsconfig.esnext.json +0 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataStoreHandleContextUtils.d.ts","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;AAErE;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,mBAAmB,GAChC,MAAM,CAqBR"}
@@ -7,6 +7,7 @@
7
7
  * @param path - The path to the Fluid object relative to the route context.
8
8
  * @param routeContext - The route context that contains the Fluid object.
9
9
  * @returns The absolute path to the Fluid object from the root of the Container.
10
+ * @internal
10
11
  */
11
12
  export function generateHandleContextPath(path, routeContext) {
12
13
  if (path === "") {
@@ -18,7 +19,9 @@ export function generateHandleContextPath(path, routeContext) {
18
19
  else {
19
20
  // Remove beginning and trailing slashes, if any, from the path.
20
21
  let normalizedPath = path.startsWith("/") ? path.slice(1) : path;
21
- normalizedPath = normalizedPath.endsWith("/") ? normalizedPath.slice(0, -1) : normalizedPath;
22
+ normalizedPath = normalizedPath.endsWith("/")
23
+ ? normalizedPath.slice(0, -1)
24
+ : normalizedPath;
22
25
  // If the routeContext does not exist, path is the absolute path.
23
26
  // If the routeContext exists, absolute path is routeContext's absolute path plus the path.
24
27
  return routeContext === undefined
@@ -26,4 +29,4 @@ export function generateHandleContextPath(path, routeContext) {
26
29
  : `${routeContext.absolutePath === "/" ? "" : routeContext.absolutePath}/${normalizedPath}`;
27
30
  }
28
31
  }
29
- //# sourceMappingURL=dataStoreHandleContextUtils.js.map
32
+ //# sourceMappingURL=dataStoreHandleContextUtils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataStoreHandleContextUtils.mjs","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CACxC,IAAY,EACZ,YAAkC;IAElC,IAAI,IAAI,KAAK,EAAE,EAAE;QAChB,uBAAuB;QACvB,wDAAwD;QACxD,yFAAyF;QACzF,OAAO,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC;KACnE;SAAM;QACN,gEAAgE;QAChE,IAAI,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACjE,cAAc,GAAG,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC;YAC5C,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAC7B,CAAC,CAAC,cAAc,CAAC;QAElB,iEAAiE;QACjE,2FAA2F;QAC3F,OAAO,YAAY,KAAK,SAAS;YAChC,CAAC,CAAC,IAAI,cAAc,EAAE;YACtB,CAAC,CAAC,GACA,YAAY,CAAC,YAAY,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,YACtD,IAAI,cAAc,EAAE,CAAC;KACxB;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IFluidHandleContext } from \"@fluidframework/core-interfaces\";\n\n/**\n * Generates the absolute path for a Fluid object given its path and its parent routeContext.\n * @param path - The path to the Fluid object relative to the route context.\n * @param routeContext - The route context that contains the Fluid object.\n * @returns The absolute path to the Fluid object from the root of the Container.\n * @internal\n */\nexport function generateHandleContextPath(\n\tpath: string,\n\trouteContext?: IFluidHandleContext,\n): string {\n\tif (path === \"\") {\n\t\t// The `path` is empty.\n\t\t// If the routeContext does not exist, this is the root.\n\t\t// If the routeContext exists, the absolute path is the same as that of the routeContext.\n\t\treturn routeContext === undefined ? \"\" : routeContext.absolutePath;\n\t} else {\n\t\t// Remove beginning and trailing slashes, if any, from the path.\n\t\tlet normalizedPath = path.startsWith(\"/\") ? path.slice(1) : path;\n\t\tnormalizedPath = normalizedPath.endsWith(\"/\")\n\t\t\t? normalizedPath.slice(0, -1)\n\t\t\t: normalizedPath;\n\n\t\t// If the routeContext does not exist, path is the absolute path.\n\t\t// If the routeContext exists, absolute path is routeContext's absolute path plus the path.\n\t\treturn routeContext === undefined\n\t\t\t? `/${normalizedPath}`\n\t\t\t: `${\n\t\t\t\t\trouteContext.absolutePath === \"/\" ? \"\" : routeContext.absolutePath\n\t\t\t }/${normalizedPath}`;\n\t}\n}\n"]}
@@ -2,13 +2,32 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { FluidObject, IFluidRouter, IRequest, IResponse } from "@fluidframework/core-interfaces";
5
+ import { IRequest, IResponse } from "@fluidframework/core-interfaces";
6
6
  import { IFluidDataStoreFactory, IFluidDataStoreRegistry, IProvideFluidDataStoreRegistry } from "@fluidframework/runtime-definitions";
7
+ /**
8
+ * @internal
9
+ */
7
10
  export declare function exceptionToResponse(err: any): IResponse;
11
+ /**
12
+ * @internal
13
+ */
8
14
  export declare function responseToException(response: IResponse, request: IRequest): Error;
9
- export declare function requestFluidObject<T = FluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;
15
+ /**
16
+ * @internal
17
+ */
10
18
  export declare const create404Response: (request: IRequest) => IResponse;
11
- export declare function createResponseError(status: number, value: string, request: IRequest): IResponse;
12
- export declare type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
19
+ /**
20
+ * @internal
21
+ */
22
+ export declare function createResponseError(status: number, value: string, request: IRequest, headers?: {
23
+ [key: string]: any;
24
+ }): IResponse;
25
+ /**
26
+ * @internal
27
+ */
28
+ export type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
29
+ /**
30
+ * @internal
31
+ */
13
32
  export declare function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
14
33
  //# sourceMappingURL=dataStoreHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataStoreHelpers.d.ts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC;OAC9D,EACN,sBAAsB,EACtB,uBAAuB,EACvB,8BAA8B,EAC9B,MAAM,qCAAqC;AAW5C;;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;;GAEG;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;AAED;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,sBAAsB,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAEvF;;GAEG;AACH,wBAAgB,sBAAsB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GACjC,sBAAsB,GAAG,uBAAuB,CAalD"}
@@ -2,8 +2,11 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/common-utils";
5
+ import { assert } from "@fluidframework/core-utils";
6
6
  import { generateErrorWithStack } from "@fluidframework/telemetry-utils";
7
+ /**
8
+ * @internal
9
+ */
7
10
  export function exceptionToResponse(err) {
8
11
  const status = 500;
9
12
  if (err !== null && typeof err === "object" && err.errorFromRequestFluidObject === true) {
@@ -12,7 +15,10 @@ export function exceptionToResponse(err) {
12
15
  mimeType: "text/plain",
13
16
  status: responseErr.code,
14
17
  value: responseErr.message,
15
- get stack() { return responseErr.stack; },
18
+ get stack() {
19
+ return responseErr.stack;
20
+ },
21
+ headers: responseErr.underlyingResponseHeaders,
16
22
  };
17
23
  }
18
24
  // Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it
@@ -21,9 +27,14 @@ export function exceptionToResponse(err) {
21
27
  mimeType: "text/plain",
22
28
  status,
23
29
  value: `${err}`,
24
- get stack() { var _a; return (_a = (err === null || err === void 0 ? void 0 : err.stack)) !== null && _a !== void 0 ? _a : errWithStack.stack; },
30
+ get stack() {
31
+ return err?.stack ?? errWithStack.stack;
32
+ },
25
33
  };
26
34
  }
35
+ /**
36
+ * @internal
37
+ */
27
38
  export function responseToException(response, request) {
28
39
  const message = response.value;
29
40
  const errWithStack = generateErrorWithStack();
@@ -32,41 +43,50 @@ export function responseToException(response, request) {
32
43
  message,
33
44
  name: "Error",
34
45
  code: response.status,
35
- get stack() { var _a; return (_a = response.stack) !== null && _a !== void 0 ? _a : errWithStack.stack; },
46
+ get stack() {
47
+ return response.stack ?? errWithStack.stack;
48
+ },
49
+ underlyingResponseHeaders: response.headers,
36
50
  };
37
51
  return responseErr;
38
52
  }
39
- export async function requestFluidObject(router, url) {
40
- const request = typeof url === "string" ? { url } : url;
41
- const response = await router.request(request);
42
- if (response.status !== 200 || response.mimeType !== "fluid/object") {
43
- throw responseToException(response, request);
44
- }
45
- assert(response.value, 0x19a /* "Invalid response value for Fluid object request" */);
46
- return response.value;
47
- }
53
+ /**
54
+ * @internal
55
+ */
48
56
  export const create404Response = (request) => createResponseError(404, "not found", request);
49
- export function createResponseError(status, value, request) {
50
- var _a;
57
+ /**
58
+ * @internal
59
+ */
60
+ export function createResponseError(status, value, request, headers) {
51
61
  assert(status !== 200, 0x19b /* "Cannot not create response error on 200 status" */);
52
- // Omit query string which could contain personal data (aka "PII")
53
- const urlNoQuery = (_a = request.url) === null || _a === void 0 ? void 0 : _a.split("?")[0];
62
+ // Omit query string which could contain personal data unfit for logging
63
+ const urlNoQuery = request.url?.split("?")[0];
54
64
  // Capture error objects, not stack itself, as stack retrieval is very expensive operation, so we delay it
55
65
  const errWithStack = generateErrorWithStack();
56
66
  return {
57
67
  mimeType: "text/plain",
58
68
  status,
59
69
  value: urlNoQuery === undefined ? value : `${value}: ${urlNoQuery}`,
60
- get stack() { return errWithStack.stack; },
70
+ get stack() {
71
+ return errWithStack.stack;
72
+ },
73
+ headers,
61
74
  };
62
75
  }
76
+ /**
77
+ * @internal
78
+ */
63
79
  export function createDataStoreFactory(type, factory) {
64
80
  return {
65
81
  type,
66
- get IFluidDataStoreFactory() { return this; },
67
- get IFluidDataStoreRegistry() { return this; },
82
+ get IFluidDataStoreFactory() {
83
+ return this;
84
+ },
85
+ get IFluidDataStoreRegistry() {
86
+ return this;
87
+ },
68
88
  instantiateDataStore: async (context, existing) => (await factory).instantiateDataStore(context, existing),
69
- get: async (name) => { var _a; return (_a = (await factory).IFluidDataStoreRegistry) === null || _a === void 0 ? void 0 : _a.get(name); },
89
+ get: async (name) => (await factory).IFluidDataStoreRegistry?.get(name),
70
90
  };
71
91
  }
72
- //# sourceMappingURL=dataStoreHelpers.js.map
92
+ //# sourceMappingURL=dataStoreHelpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataStoreHelpers.mjs","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 { assert } from \"@fluidframework/core-utils\";\nimport { IRequest, IResponse } from \"@fluidframework/core-interfaces\";\nimport {\n\tIFluidDataStoreFactory,\n\tIFluidDataStoreRegistry,\n\tIProvideFluidDataStoreRegistry,\n} from \"@fluidframework/runtime-definitions\";\nimport { generateErrorWithStack } from \"@fluidframework/telemetry-utils\";\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 * @internal\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,14 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { generateHandleContextPath } from "./dataStoreHandleContextUtils.mjs";
6
+ export { create404Response, createDataStoreFactory, createResponseError, exceptionToResponse, Factory, responseToException, } from "./dataStoreHelpers.mjs";
7
+ export { ObjectStoragePartition } from "./objectstoragepartition.mjs";
8
+ export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from "./objectstorageutils.mjs";
9
+ export { RequestParser } from "./requestParser.mjs";
10
+ export { RuntimeFactoryHelper } from "./runtimeFactoryHelper.mjs";
11
+ export { addBlobToSummary, addSummarizeResultToSummary, addTreeToSummary, calculateStats, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, convertToSummaryTree, convertToSummaryTreeWithStats, GCDataBuilder, getBlobSize, mergeStats, SummaryTreeBuilder, TelemetryContext, utf8ByteLength, } from "./summaryUtils.mjs";
12
+ export { unpackChildNodesUsedRoutes } from "./unpackUsedRoutes.mjs";
13
+ export { ReadAndParseBlob, seqFromTree } from "./utils.mjs";
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,yBAAyB,EAAE;OAC7B,EACN,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,GACnB;OACM,EAAE,sBAAsB,EAAE;OAC1B,EAAE,mCAAmC,EAAE,mBAAmB,EAAE;OAC5D,EAAE,aAAa,EAAE;OACjB,EAAE,oBAAoB,EAAE;OACxB,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd;OACM,EAAE,0BAA0B,EAAE;OAC9B,EAAE,gBAAgB,EAAE,WAAW,EAAE"}
package/lib/index.mjs ADDED
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { generateHandleContextPath } from "./dataStoreHandleContextUtils.mjs";
6
+ export { create404Response, createDataStoreFactory, createResponseError, exceptionToResponse, responseToException, } from "./dataStoreHelpers.mjs";
7
+ export { ObjectStoragePartition } from "./objectstoragepartition.mjs";
8
+ export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from "./objectstorageutils.mjs";
9
+ export { RequestParser } from "./requestParser.mjs";
10
+ export { RuntimeFactoryHelper } from "./runtimeFactoryHelper.mjs";
11
+ export { addBlobToSummary, addSummarizeResultToSummary, addTreeToSummary, calculateStats, convertSnapshotTreeToSummaryTree, convertSummaryTreeToITree, convertToSummaryTree, convertToSummaryTreeWithStats, GCDataBuilder, getBlobSize, mergeStats, SummaryTreeBuilder, TelemetryContext, utf8ByteLength, } from "./summaryUtils.mjs";
12
+ export { unpackChildNodesUsedRoutes } from "./unpackUsedRoutes.mjs";
13
+ export { seqFromTree } from "./utils.mjs";
14
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,yBAAyB,EAAE;OAC7B,EACN,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EAEnB,mBAAmB,GACnB;OACM,EAAE,sBAAsB,EAAE;OAC1B,EAAE,mCAAmC,EAAE,mBAAmB,EAAE;OAC5D,EAAE,aAAa,EAAE;OACjB,EAAE,oBAAoB,EAAE;OACxB,EACN,gBAAgB,EAChB,2BAA2B,EAC3B,gBAAgB,EAChB,cAAc,EACd,gCAAgC,EAChC,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,EAC7B,aAAa,EACb,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,GACd;OACM,EAAE,0BAA0B,EAAE;OAC9B,EAAoB,WAAW,EAAE","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { generateHandleContextPath } from \"./dataStoreHandleContextUtils\";\nexport {\n\tcreate404Response,\n\tcreateDataStoreFactory,\n\tcreateResponseError,\n\texceptionToResponse,\n\tFactory,\n\tresponseToException,\n} from \"./dataStoreHelpers\";\nexport { ObjectStoragePartition } from \"./objectstoragepartition\";\nexport { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from \"./objectstorageutils\";\nexport { RequestParser } from \"./requestParser\";\nexport { RuntimeFactoryHelper } from \"./runtimeFactoryHelper\";\nexport {\n\taddBlobToSummary,\n\taddSummarizeResultToSummary,\n\taddTreeToSummary,\n\tcalculateStats,\n\tconvertSnapshotTreeToSummaryTree,\n\tconvertSummaryTreeToITree,\n\tconvertToSummaryTree,\n\tconvertToSummaryTreeWithStats,\n\tGCDataBuilder,\n\tgetBlobSize,\n\tmergeStats,\n\tSummaryTreeBuilder,\n\tTelemetryContext,\n\tutf8ByteLength,\n} from \"./summaryUtils\";\nexport { unpackChildNodesUsedRoutes } from \"./unpackUsedRoutes\";\nexport { ReadAndParseBlob, seqFromTree } from \"./utils\";\n"]}
@@ -5,6 +5,7 @@
5
5
  import { IChannelStorageService } from "@fluidframework/datastore-definitions";
6
6
  /**
7
7
  * Returns a new IChannelStorageService that resolves the given `path` as root.
8
+ * @internal
8
9
  */
9
10
  export declare class ObjectStoragePartition implements IChannelStorageService {
10
11
  private readonly storage;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectstoragepartition.d.ts","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,sBAAsB,EAAE,MAAM,uCAAuC;AAE9E;;;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"}
@@ -2,9 +2,10 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/common-utils";
5
+ import { assert } from "@fluidframework/core-utils";
6
6
  /**
7
7
  * Returns a new IChannelStorageService that resolves the given `path` as root.
8
+ * @internal
8
9
  */
9
10
  export class ObjectStoragePartition {
10
11
  constructor(storage, path) {
@@ -23,4 +24,4 @@ export class ObjectStoragePartition {
23
24
  return this.storage.list(`${this.path}/${path}`);
24
25
  }
25
26
  }
26
- //# sourceMappingURL=objectstoragepartition.js.map
27
+ //# sourceMappingURL=objectstoragepartition.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectstoragepartition.mjs","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,MAAM,EAAE,MAAM,4BAA4B;AAGnD;;;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\";\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions\";\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"]}
@@ -3,6 +3,12 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { ITree } from "@fluidframework/protocol-definitions";
6
+ /**
7
+ * @internal
8
+ */
6
9
  export declare function getNormalizedObjectStoragePathParts(path: string): string[];
10
+ /**
11
+ * @internal
12
+ */
7
13
  export declare function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
8
14
  //# sourceMappingURL=objectstorageutils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectstorageutils.d.ts","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,KAAK,EAAE,MAAM,sCAAsC;AAE5D;;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"}
@@ -2,6 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
+ /**
6
+ * @internal
7
+ */
5
8
  export function getNormalizedObjectStoragePathParts(path) {
6
9
  let normalizePath = path;
7
10
  if (normalizePath.startsWith("/")) {
@@ -15,32 +18,25 @@ export function getNormalizedObjectStoragePathParts(path) {
15
18
  }
16
19
  return [];
17
20
  }
21
+ /**
22
+ * @internal
23
+ */
18
24
  export async function listBlobsAtTreePath(inputTree, path) {
19
25
  const pathParts = getNormalizedObjectStoragePathParts(path);
20
26
  let tree = inputTree;
21
- while ((tree === null || tree === void 0 ? void 0 : tree.entries) !== undefined && pathParts.length > 0) {
27
+ while (tree?.entries !== undefined && pathParts.length > 0) {
22
28
  const part = pathParts.shift();
23
29
  const treeEntry = tree.entries.find((value) => {
24
- if (value.type === "Tree" && value.path === part) {
25
- return true;
26
- }
27
- else {
28
- return false;
29
- }
30
+ return value.type === "Tree" && value.path === part ? true : false;
30
31
  });
31
32
  // this check is largely superfluous due to the same check being done
32
33
  // immediately above. the type system, however, is not aware of this.
33
34
  // so we must redundantly determine that the entry's type is "Tree"
34
- if ((treeEntry === null || treeEntry === void 0 ? void 0 : treeEntry.type) === "Tree") {
35
- tree = treeEntry.value;
36
- }
37
- else {
38
- tree = undefined;
39
- }
35
+ tree = treeEntry?.type === "Tree" ? treeEntry.value : undefined;
40
36
  }
41
- if ((tree === null || tree === void 0 ? void 0 : tree.entries) === undefined || pathParts.length !== 0) {
37
+ if (tree?.entries === undefined || pathParts.length !== 0) {
42
38
  throw new Error("path does not exist");
43
39
  }
44
40
  return tree.entries.filter((e) => e.type === "Blob").map((e) => e.path);
45
41
  }
46
- //# sourceMappingURL=objectstorageutils.js.map
42
+ //# sourceMappingURL=objectstorageutils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectstorageutils.mjs","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;QAClC,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KACxC;IACD,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAChC,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KAClE;IACD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC7B,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KAChC;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;QAC3D,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;KAChE;IACD,IAAI,IAAI,EAAE,OAAO,KAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1D,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;KACvC;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/protocol-definitions\";\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,10 +1,7 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
1
  import { IRequest, IRequestHeader } from "@fluidframework/core-interfaces";
6
2
  /**
7
3
  * The Request Parser takes an IRequest provides parsing and sub request creation
4
+ * @alpha
8
5
  */
9
6
  export declare class RequestParser implements IRequest {
10
7
  private readonly request;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestParser.d.ts","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":"OAIO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iCAAiC;AAE1E;;;GAGG;AACH,qBAAa,aAAc,YAAW,QAAQ;IA6BvB,OAAO,CAAC,QAAQ,CAAC,OAAO;IA5B9C;;;OAGG;WACW,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IAa1D,OAAO,CAAC,gBAAgB,CAAgC;IACxD,SAAgB,KAAK,EAAE,MAAM,CAAC;WAEhB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAQhD,SAAS,aAA8B,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAKlE,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,IAAW,OAAO,IAAI,cAAc,GAAG,SAAS,CAE/C;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,SAAS,MAAM,EAAE,CAKxC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAQ,EAAE,MAAM;IAI9B;;;;;;;;;;;OAWG;IACI,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,QAAQ;CAiB5D"}
@@ -1,17 +1,8 @@
1
1
  /**
2
2
  * The Request Parser takes an IRequest provides parsing and sub request creation
3
+ * @alpha
3
4
  */
4
5
  export class RequestParser {
5
- constructor(request) {
6
- this.request = request;
7
- const queryStartIndex = this.request.url.indexOf("?");
8
- if (queryStartIndex >= 0) {
9
- this.query = this.request.url.substring(queryStartIndex);
10
- }
11
- else {
12
- this.query = "";
13
- }
14
- }
15
6
  /**
16
7
  * Splits the path of the url and decodes each path part
17
8
  * @param url - the url to get path parts of
@@ -35,6 +26,11 @@ export class RequestParser {
35
26
  }
36
27
  return new RequestParser(request);
37
28
  }
29
+ constructor(request) {
30
+ this.request = request;
31
+ const queryStartIndex = this.request.url.indexOf("?");
32
+ this.query = queryStartIndex >= 0 ? this.request.url.substring(queryStartIndex) : "";
33
+ }
38
34
  get url() {
39
35
  return this.request.url;
40
36
  }
@@ -87,4 +83,4 @@ export class RequestParser {
87
83
  };
88
84
  }
89
85
  }
90
- //# sourceMappingURL=requestParser.js.map
86
+ //# sourceMappingURL=requestParser.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requestParser.mjs","sourceRoot":"","sources":["../src/requestParser.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 */\nimport { IRequest, IRequestHeader } from \"@fluidframework/core-interfaces\";\n\n/**\n * The Request Parser takes an IRequest provides parsing and sub request creation\n * @alpha\n */\nexport class RequestParser implements IRequest {\n\t/**\n\t * Splits the path of the url and decodes each path part\n\t * @param url - the url to get path parts of\n\t */\n\tpublic static getPathParts(url: string): readonly string[] {\n\t\tconst queryStartIndex = url.indexOf(\"?\");\n\t\treturn url\n\t\t\t.substring(0, queryStartIndex < 0 ? url.length : queryStartIndex)\n\t\t\t.split(\"/\")\n\t\t\t.reduce<string[]>((pv, cv) => {\n\t\t\t\tif (cv !== undefined && cv.length > 0) {\n\t\t\t\t\tpv.push(decodeURIComponent(cv));\n\t\t\t\t}\n\t\t\t\treturn pv;\n\t\t\t}, []);\n\t}\n\n\tprivate requestPathParts: readonly string[] | undefined;\n\tpublic readonly query: string;\n\n\tpublic static create(request: Readonly<IRequest>) {\n\t\t// Perf optimizations.\n\t\tif (request instanceof RequestParser) {\n\t\t\treturn request;\n\t\t}\n\t\treturn new RequestParser(request);\n\t}\n\n\tprotected constructor(private readonly request: Readonly<IRequest>) {\n\t\tconst queryStartIndex = this.request.url.indexOf(\"?\");\n\t\tthis.query = queryStartIndex >= 0 ? this.request.url.substring(queryStartIndex) : \"\";\n\t}\n\n\tpublic get url(): string {\n\t\treturn this.request.url;\n\t}\n\n\tpublic get headers(): IRequestHeader | undefined {\n\t\treturn this.request.headers;\n\t}\n\n\t/**\n\t * Returns the decoded path parts of the request's url\n\t */\n\tpublic get pathParts(): readonly string[] {\n\t\tif (this.requestPathParts === undefined) {\n\t\t\tthis.requestPathParts = RequestParser.getPathParts(this.url);\n\t\t}\n\t\treturn this.requestPathParts;\n\t}\n\n\t/**\n\t * Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.\n\t * @param elements - number of elements in path\n\t */\n\tpublic isLeaf(elements: number) {\n\t\treturn this.query === \"\" && this.pathParts.length === elements;\n\t}\n\n\t/**\n\t * Creates a sub request starting at a specific path part of this request's url\n\t * The sub request url always has a leading slash, and always include query params if original url has any\n\t * e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams\n\t * createSubRequest(1) is /b/?queryParams\n\t * createSubRequest(2) is /?queryParams\n\t * createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception\n\t *\n\t * note: query params are not counted towards path parts.\n\t *\n\t * @param startingPathIndex - The index of the first path part of the sub request\n\t */\n\tpublic createSubRequest(startingPathIndex: number): IRequest {\n\t\tconst pathLen = this.pathParts.length;\n\t\tif (startingPathIndex < 0 || startingPathIndex > pathLen) {\n\t\t\tthrow new Error(\"incorrect sub-request\");\n\t\t}\n\t\tif (startingPathIndex === pathLen && this.url.includes(\"?\")) {\n\t\t\treturn {\n\t\t\t\turl: `/${this.query}`,\n\t\t\t\theaders: this.headers,\n\t\t\t};\n\t\t}\n\t\tconst path = `/${this.pathParts.slice(startingPathIndex).join(\"/\")}`;\n\t\treturn {\n\t\t\turl: this.query === \"\" ? path : `${path}/${this.query}`,\n\t\t\theaders: this.headers,\n\t\t};\n\t}\n}\n"]}
@@ -0,0 +1,155 @@
1
+ import { IChannelStorageService } from '@fluidframework/datastore-definitions';
2
+ import { IContainerContext } from '@fluidframework/container-definitions';
3
+ import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
4
+ import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
5
+ import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
6
+ import { IFluidHandleContext } from '@fluidframework/core-interfaces';
7
+ import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
8
+ import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
9
+ import { IRequest } from '@fluidframework/core-interfaces';
10
+ import { IRequestHeader } from '@fluidframework/core-interfaces';
11
+ import { IResponse } from '@fluidframework/core-interfaces';
12
+ import { IRuntime } from '@fluidframework/container-definitions';
13
+ import { IRuntimeFactory } from '@fluidframework/container-definitions';
14
+ import { ISnapshotTree } from '@fluidframework/protocol-definitions';
15
+ import { ISnapshotTreeWithBlobContents } from '@fluidframework/container-definitions';
16
+ import { ISummarizeResult } from '@fluidframework/runtime-definitions';
17
+ import { ISummaryBlob } from '@fluidframework/protocol-definitions';
18
+ import { ISummaryStats } from '@fluidframework/runtime-definitions';
19
+ import { ISummaryTree } from '@fluidframework/protocol-definitions';
20
+ import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
21
+ import { ITelemetryContext } from '@fluidframework/runtime-definitions';
22
+ import { ITree } from '@fluidframework/protocol-definitions';
23
+ import { SummaryObject } from '@fluidframework/protocol-definitions';
24
+ import { SummaryType } from '@fluidframework/protocol-definitions';
25
+ import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
26
+
27
+ /* Excluded from this release type: addBlobToSummary */
28
+
29
+ /* Excluded from this release type: addSummarizeResultToSummary */
30
+
31
+ /* Excluded from this release type: addTreeToSummary */
32
+
33
+ /* Excluded from this release type: calculateStats */
34
+
35
+ /* Excluded from this release type: convertSnapshotTreeToSummaryTree */
36
+
37
+ /* Excluded from this release type: convertSummaryTreeToITree */
38
+
39
+ /* Excluded from this release type: convertToSummaryTree */
40
+
41
+ /**
42
+ * Converts snapshot ITree to ISummaryTree format and tracks stats.
43
+ * @param snapshot - snapshot in ITree format
44
+ * @param fullTree - true to never use handles, even if id is specified
45
+ * @alpha
46
+ */
47
+ export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
48
+
49
+ /* Excluded from this release type: create404Response */
50
+
51
+ /* Excluded from this release type: createDataStoreFactory */
52
+
53
+ /* Excluded from this release type: createResponseError */
54
+
55
+ /* Excluded from this release type: exceptionToResponse */
56
+
57
+ /* Excluded from this release type: Factory */
58
+
59
+ /* Excluded from this release type: GCDataBuilder */
60
+
61
+ /* Excluded from this release type: generateHandleContextPath */
62
+
63
+ /* Excluded from this release type: getBlobSize */
64
+
65
+ /* Excluded from this release type: getNormalizedObjectStoragePathParts */
66
+
67
+ /* Excluded from this release type: listBlobsAtTreePath */
68
+
69
+ /* Excluded from this release type: mergeStats */
70
+
71
+ /* Excluded from this release type: ObjectStoragePartition */
72
+
73
+ /* Excluded from this release type: ReadAndParseBlob */
74
+
75
+ /**
76
+ * The Request Parser takes an IRequest provides parsing and sub request creation
77
+ * @alpha
78
+ */
79
+ export declare class RequestParser implements IRequest {
80
+ private readonly request;
81
+ /**
82
+ * Splits the path of the url and decodes each path part
83
+ * @param url - the url to get path parts of
84
+ */
85
+ static getPathParts(url: string): readonly string[];
86
+ private requestPathParts;
87
+ readonly query: string;
88
+ static create(request: Readonly<IRequest>): RequestParser;
89
+ protected constructor(request: Readonly<IRequest>);
90
+ get url(): string;
91
+ get headers(): IRequestHeader | undefined;
92
+ /**
93
+ * Returns the decoded path parts of the request's url
94
+ */
95
+ get pathParts(): readonly string[];
96
+ /**
97
+ * Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.
98
+ * @param elements - number of elements in path
99
+ */
100
+ isLeaf(elements: number): boolean;
101
+ /**
102
+ * Creates a sub request starting at a specific path part of this request's url
103
+ * The sub request url always has a leading slash, and always include query params if original url has any
104
+ * e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams
105
+ * createSubRequest(1) is /b/?queryParams
106
+ * createSubRequest(2) is /?queryParams
107
+ * createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception
108
+ *
109
+ * note: query params are not counted towards path parts.
110
+ *
111
+ * @param startingPathIndex - The index of the first path part of the sub request
112
+ */
113
+ createSubRequest(startingPathIndex: number): IRequest;
114
+ }
115
+
116
+ /* Excluded from this release type: responseToException */
117
+
118
+ /**
119
+ * @alpha
120
+ */
121
+ export declare abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
122
+ get IRuntimeFactory(): this;
123
+ instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
124
+ abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;
125
+ instantiateFirstTime(_runtime: T): Promise<void>;
126
+ instantiateFromExisting(_runtime: T): Promise<void>;
127
+ hasInitialized(_runtime: T): Promise<void>;
128
+ }
129
+
130
+ /* Excluded from this release type: seqFromTree */
131
+
132
+ /**
133
+ * @alpha
134
+ */
135
+ export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
136
+ private attachmentCounter;
137
+ get summary(): ISummaryTree;
138
+ get stats(): Readonly<ISummaryStats>;
139
+ constructor();
140
+ private readonly summaryTree;
141
+ private summaryStats;
142
+ addBlob(key: string, content: string | Uint8Array): void;
143
+ addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
144
+ addWithStats(key: string, summarizeResult: ISummarizeResult): void;
145
+ addAttachment(id: string): void;
146
+ getSummaryTree(): ISummaryTreeWithStats;
147
+ }
148
+
149
+ /* Excluded from this release type: TelemetryContext */
150
+
151
+ /* Excluded from this release type: unpackChildNodesUsedRoutes */
152
+
153
+ /* Excluded from this release type: utf8ByteLength */
154
+
155
+ export { }