@fluidframework/runtime-utils 2.0.0-internal.7.3.0 → 2.0.0-internal.8.0.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 (103) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/api-extractor-lint.json +13 -0
  3. package/api-extractor.json +3 -3
  4. package/api-report/runtime-utils.api.md +31 -35
  5. package/dist/dataStoreHandleContextUtils.d.ts +1 -0
  6. package/dist/dataStoreHandleContextUtils.d.ts.map +1 -1
  7. package/dist/dataStoreHandleContextUtils.js +1 -0
  8. package/dist/dataStoreHandleContextUtils.js.map +1 -1
  9. package/dist/dataStoreHelpers.d.ts +17 -3
  10. package/dist/dataStoreHelpers.d.ts.map +1 -1
  11. package/dist/dataStoreHelpers.js +14 -14
  12. package/dist/dataStoreHelpers.js.map +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -2
  16. package/dist/index.js.map +1 -1
  17. package/dist/objectstoragepartition.d.ts +1 -0
  18. package/dist/objectstoragepartition.d.ts.map +1 -1
  19. package/dist/objectstoragepartition.js +1 -0
  20. package/dist/objectstoragepartition.js.map +1 -1
  21. package/dist/objectstorageutils.d.ts +6 -0
  22. package/dist/objectstorageutils.d.ts.map +1 -1
  23. package/dist/objectstorageutils.js +6 -0
  24. package/dist/objectstorageutils.js.map +1 -1
  25. package/dist/requestParser.d.ts +1 -0
  26. package/dist/requestParser.d.ts.map +1 -1
  27. package/dist/requestParser.js +1 -0
  28. package/dist/requestParser.js.map +1 -1
  29. package/dist/runtime-utils-alpha.d.ts +134 -0
  30. package/dist/runtime-utils-beta.d.ts +121 -0
  31. package/dist/runtime-utils-public.d.ts +121 -0
  32. package/dist/runtime-utils-untrimmed.d.ts +306 -0
  33. package/dist/runtimeFactoryHelper.d.ts +3 -0
  34. package/dist/runtimeFactoryHelper.d.ts.map +1 -1
  35. package/dist/runtimeFactoryHelper.js +3 -0
  36. package/dist/runtimeFactoryHelper.js.map +1 -1
  37. package/dist/summaryUtils.d.ts +32 -2
  38. package/dist/summaryUtils.d.ts.map +1 -1
  39. package/dist/summaryUtils.js +29 -0
  40. package/dist/summaryUtils.js.map +1 -1
  41. package/dist/unpackUsedRoutes.d.ts +2 -1
  42. package/dist/unpackUsedRoutes.d.ts.map +1 -1
  43. package/dist/unpackUsedRoutes.js +1 -0
  44. package/dist/unpackUsedRoutes.js.map +1 -1
  45. package/dist/utils.d.ts +6 -1
  46. package/dist/utils.d.ts.map +1 -1
  47. package/dist/utils.js +1 -0
  48. package/dist/utils.js.map +1 -1
  49. package/lib/dataStoreHandleContextUtils.d.ts +1 -0
  50. package/lib/dataStoreHandleContextUtils.d.ts.map +1 -1
  51. package/lib/dataStoreHandleContextUtils.js +1 -0
  52. package/lib/dataStoreHandleContextUtils.js.map +1 -1
  53. package/lib/dataStoreHelpers.d.ts +17 -3
  54. package/lib/dataStoreHelpers.d.ts.map +1 -1
  55. package/lib/dataStoreHelpers.js +13 -12
  56. package/lib/dataStoreHelpers.js.map +1 -1
  57. package/lib/index.d.ts +1 -1
  58. package/lib/index.d.ts.map +1 -1
  59. package/lib/index.js +1 -1
  60. package/lib/index.js.map +1 -1
  61. package/lib/objectstoragepartition.d.ts +1 -0
  62. package/lib/objectstoragepartition.d.ts.map +1 -1
  63. package/lib/objectstoragepartition.js +1 -0
  64. package/lib/objectstoragepartition.js.map +1 -1
  65. package/lib/objectstorageutils.d.ts +6 -0
  66. package/lib/objectstorageutils.d.ts.map +1 -1
  67. package/lib/objectstorageutils.js +6 -0
  68. package/lib/objectstorageutils.js.map +1 -1
  69. package/lib/requestParser.d.ts +1 -0
  70. package/lib/requestParser.d.ts.map +1 -1
  71. package/lib/requestParser.js +1 -0
  72. package/lib/requestParser.js.map +1 -1
  73. package/lib/runtime-utils-alpha.d.ts +134 -0
  74. package/lib/runtime-utils-beta.d.ts +121 -0
  75. package/lib/runtime-utils-public.d.ts +121 -0
  76. package/lib/runtime-utils-untrimmed.d.ts +306 -0
  77. package/lib/runtimeFactoryHelper.d.ts +3 -0
  78. package/lib/runtimeFactoryHelper.d.ts.map +1 -1
  79. package/lib/runtimeFactoryHelper.js +3 -0
  80. package/lib/runtimeFactoryHelper.js.map +1 -1
  81. package/lib/summaryUtils.d.ts +32 -2
  82. package/lib/summaryUtils.d.ts.map +1 -1
  83. package/lib/summaryUtils.js +29 -0
  84. package/lib/summaryUtils.js.map +1 -1
  85. package/lib/unpackUsedRoutes.d.ts +2 -1
  86. package/lib/unpackUsedRoutes.d.ts.map +1 -1
  87. package/lib/unpackUsedRoutes.js +1 -0
  88. package/lib/unpackUsedRoutes.js.map +1 -1
  89. package/lib/utils.d.ts +6 -1
  90. package/lib/utils.d.ts.map +1 -1
  91. package/lib/utils.js +1 -0
  92. package/lib/utils.js.map +1 -1
  93. package/package.json +41 -17
  94. package/src/dataStoreHandleContextUtils.ts +1 -0
  95. package/src/dataStoreHelpers.ts +17 -19
  96. package/src/index.ts +0 -1
  97. package/src/objectstoragepartition.ts +1 -0
  98. package/src/objectstorageutils.ts +6 -0
  99. package/src/requestParser.ts +1 -0
  100. package/src/runtimeFactoryHelper.ts +3 -0
  101. package/src/summaryUtils.ts +35 -4
  102. package/src/unpackUsedRoutes.ts +2 -1
  103. package/src/utils.ts +6 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @fluidframework/runtime-utils
2
2
 
3
+ ## 2.0.0-internal.8.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - container-definitions: Fix ISnapshotTreeWithBlobContents and mark internal [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
8
+
9
+ `ISnapshotTreeWithBlobContents` is an internal type that should not be used externally. Additionally, the type didn't
10
+ match the usage, specifically in runtime-utils where an `any` cast was used to work around undefined blobContents. The
11
+ type has been updated to reflect that blobContents can be undefined.
12
+
13
+ - runtime-utils: Removed requestFluidObject [9a451d4946](https://github.com/microsoft/FluidFramework/commits/9a451d4946b5c51a52e4d1ab5bf51e7b285b0d74)
14
+
15
+ The `requestFluidObject` utility has been removed. Please migrate all usage of it to the new `entryPoint` pattern.
16
+
17
+ See [Removing-IFluidRouter.md](https://github.com/microsoft/FluidFramework/blob/main/packages/common/core-interfaces/Removing-IFluidRouter.md) for more details.
18
+
19
+ ## 2.0.0-internal.7.4.0
20
+
21
+ Dependency updates only.
22
+
3
23
  ## 2.0.0-internal.7.3.0
4
24
 
5
25
  Dependency updates only.
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-lint.json",
4
+ "messages": {
5
+ "extractorMessageReporting": {
6
+ // TODO: remove once base config has this enabled as an error
7
+ "ae-incompatible-release-tags": {
8
+ "logLevel": "error",
9
+ "addToApiReportFile": false
10
+ }
11
+ }
12
+ }
13
+ }
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
- "extends": "@fluidframework/build-common/api-extractor-base.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-base.json",
4
4
  "messages": {
5
5
  "extractorMessageReporting": {
6
- "ae-missing-release-tag": {
7
- // TODO: Fix violations and remove this rule override
6
+ // TODO: Add missing documentation and remove this rule override
7
+ "ae-undocumented": {
8
8
  "logLevel": "none"
9
9
  }
10
10
  }
@@ -4,14 +4,12 @@
4
4
 
5
5
  ```ts
6
6
 
7
- import { FluidObject } from '@fluidframework/core-interfaces';
8
7
  import { IChannelStorageService } from '@fluidframework/datastore-definitions';
9
8
  import { IContainerContext } from '@fluidframework/container-definitions';
10
9
  import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
11
10
  import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
12
11
  import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
13
12
  import { IFluidHandleContext } from '@fluidframework/core-interfaces';
14
- import { IFluidRouter } from '@fluidframework/core-interfaces';
15
13
  import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
16
14
  import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
17
15
  import { IRequest } from '@fluidframework/core-interfaces';
@@ -20,6 +18,7 @@ import { IResponse } from '@fluidframework/core-interfaces';
20
18
  import { IRuntime } from '@fluidframework/container-definitions';
21
19
  import { IRuntimeFactory } from '@fluidframework/container-definitions';
22
20
  import { ISnapshotTree } from '@fluidframework/protocol-definitions';
21
+ import { ISnapshotTreeWithBlobContents } from '@fluidframework/container-definitions';
23
22
  import { ISummarizeResult } from '@fluidframework/runtime-definitions';
24
23
  import { ISummaryBlob } from '@fluidframework/protocol-definitions';
25
24
  import { ISummaryStats } from '@fluidframework/runtime-definitions';
@@ -31,45 +30,45 @@ import { SummaryObject } from '@fluidframework/protocol-definitions';
31
30
  import { SummaryType } from '@fluidframework/protocol-definitions';
32
31
  import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
33
32
 
34
- // @public (undocumented)
33
+ // @internal (undocumented)
35
34
  export function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;
36
35
 
37
- // @public (undocumented)
36
+ // @internal (undocumented)
38
37
  export function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
39
38
 
40
- // @public (undocumented)
39
+ // @internal (undocumented)
41
40
  export function addTreeToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
42
41
 
43
- // @public (undocumented)
42
+ // @internal (undocumented)
44
43
  export function calculateStats(summary: SummaryObject): ISummaryStats;
45
44
 
46
- // @public
47
- export function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTree): ISummaryTreeWithStats;
45
+ // @internal
46
+ export function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTreeWithBlobContents): ISummaryTreeWithStats;
48
47
 
49
- // @public
48
+ // @internal
50
49
  export function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;
51
50
 
52
- // @public
51
+ // @internal
53
52
  export function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;
54
53
 
55
- // @public
54
+ // @internal
56
55
  export function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
57
56
 
58
- // @public (undocumented)
57
+ // @internal (undocumented)
59
58
  export const create404Response: (request: IRequest) => IResponse;
60
59
 
61
- // @public (undocumented)
60
+ // @internal (undocumented)
62
61
  export function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
63
62
 
64
- // @public (undocumented)
63
+ // @internal (undocumented)
65
64
  export function createResponseError(status: number, value: string, request: IRequest, headers?: {
66
65
  [key: string]: any;
67
66
  }): IResponse;
68
67
 
69
- // @public (undocumented)
68
+ // @internal (undocumented)
70
69
  export function exceptionToResponse(err: any): IResponse;
71
70
 
72
- // @public (undocumented)
71
+ // @internal (undocumented)
73
72
  export type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
74
73
 
75
74
  // @internal
@@ -92,22 +91,22 @@ export class GCDataBuilder implements IGarbageCollectionData {
92
91
  }): void;
93
92
  }
94
93
 
95
- // @public
94
+ // @internal
96
95
  export function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
97
96
 
98
- // @public (undocumented)
97
+ // @internal (undocumented)
99
98
  export function getBlobSize(content: ISummaryBlob["content"]): number;
100
99
 
101
- // @public (undocumented)
100
+ // @internal (undocumented)
102
101
  export function getNormalizedObjectStoragePathParts(path: string): string[];
103
102
 
104
- // @public (undocumented)
103
+ // @internal (undocumented)
105
104
  export function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
106
105
 
107
- // @public
106
+ // @internal
108
107
  export function mergeStats(...stats: ISummaryStats[]): ISummaryStats;
109
108
 
110
- // @public
109
+ // @internal
111
110
  export class ObjectStoragePartition implements IChannelStorageService {
112
111
  constructor(storage: IChannelStorageService, path: string);
113
112
  // (undocumented)
@@ -118,13 +117,10 @@ export class ObjectStoragePartition implements IChannelStorageService {
118
117
  readBlob(path: string): Promise<ArrayBufferLike>;
119
118
  }
120
119
 
121
- // @public
120
+ // @internal
122
121
  export type ReadAndParseBlob = <T>(id: string) => Promise<T>;
123
122
 
124
- // @public @deprecated (undocumented)
125
- export function requestFluidObject<T = FluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;
126
-
127
- // @public
123
+ // @alpha
128
124
  export class RequestParser implements IRequest {
129
125
  protected constructor(request: Readonly<IRequest>);
130
126
  // (undocumented)
@@ -141,10 +137,10 @@ export class RequestParser implements IRequest {
141
137
  get url(): string;
142
138
  }
143
139
 
144
- // @public (undocumented)
140
+ // @internal (undocumented)
145
141
  export function responseToException(response: IResponse, request: IRequest): Error;
146
142
 
147
- // @public (undocumented)
143
+ // @alpha (undocumented)
148
144
  export abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
149
145
  // (undocumented)
150
146
  hasInitialized(_runtime: T): Promise<void>;
@@ -160,10 +156,10 @@ export abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRu
160
156
  abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;
161
157
  }
162
158
 
163
- // @public
159
+ // @internal
164
160
  export function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
165
161
 
166
- // @public (undocumented)
162
+ // @internal (undocumented)
167
163
  export class SummaryTreeBuilder implements ISummaryTreeWithStats {
168
164
  constructor();
169
165
  // (undocumented)
@@ -182,7 +178,7 @@ export class SummaryTreeBuilder implements ISummaryTreeWithStats {
182
178
  get summary(): ISummaryTree;
183
179
  }
184
180
 
185
- // @public (undocumented)
181
+ // @internal (undocumented)
186
182
  export class TelemetryContext implements ITelemetryContext {
187
183
  // (undocumented)
188
184
  get(prefix: string, property: string): TelemetryEventPropertyType;
@@ -194,10 +190,10 @@ export class TelemetryContext implements ITelemetryContext {
194
190
  setMultiple(prefix: string, property: string, values: Record<string, TelemetryEventPropertyType>): void;
195
191
  }
196
192
 
197
- // @public
198
- export function unpackChildNodesUsedRoutes(usedRoutes: string[]): Map<string, string[]>;
193
+ // @internal
194
+ export function unpackChildNodesUsedRoutes(usedRoutes: readonly string[]): Map<string, string[]>;
199
195
 
200
- // @public (undocumented)
196
+ // @internal (undocumented)
201
197
  export function utf8ByteLength(str: string): number;
202
198
 
203
199
  // (No @packageDocumentation comment for this package)
@@ -8,6 +8,7 @@ import { IFluidHandleContext } from "@fluidframework/core-interfaces";
8
8
  * @param path - The path to the Fluid object relative to the route context.
9
9
  * @param routeContext - The route context that contains the Fluid object.
10
10
  * @returns The absolute path to the Fluid object from the root of the Container.
11
+ * @internal
11
12
  */
12
13
  export declare function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
13
14
  //# sourceMappingURL=dataStoreHandleContextUtils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHandleContextUtils.d.ts","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,mBAAmB,GAChC,MAAM,CAqBR"}
1
+ {"version":3,"file":"dataStoreHandleContextUtils.d.ts","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CACxC,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,mBAAmB,GAChC,MAAM,CAqBR"}
@@ -10,6 +10,7 @@ exports.generateHandleContextPath = void 0;
10
10
  * @param path - The path to the Fluid object relative to the route context.
11
11
  * @param routeContext - The route context that contains the Fluid object.
12
12
  * @returns The absolute path to the Fluid object from the root of the Container.
13
+ * @internal
13
14
  */
14
15
  function generateHandleContextPath(path, routeContext) {
15
16
  if (path === "") {
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHandleContextUtils.js","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;GAKG;AACH,SAAgB,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;AAxBD,8DAwBC","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 */\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"]}
1
+ {"version":3,"file":"dataStoreHandleContextUtils.js","sourceRoot":"","sources":["../src/dataStoreHandleContextUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH;;;;;;GAMG;AACH,SAAgB,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;AAxBD,8DAwBC","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,18 +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
15
  /**
10
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
16
+ * @internal
11
17
  */
12
- export declare function requestFluidObject<T = FluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;
13
18
  export declare const create404Response: (request: IRequest) => IResponse;
19
+ /**
20
+ * @internal
21
+ */
14
22
  export declare function createResponseError(status: number, value: string, request: IRequest, headers?: {
15
23
  [key: string]: any;
16
24
  }): IResponse;
25
+ /**
26
+ * @internal
27
+ */
17
28
  export type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
29
+ /**
30
+ * @internal
31
+ */
18
32
  export declare function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
19
33
  //# sourceMappingURL=dataStoreHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHelpers.d.ts","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,EACN,sBAAsB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AE,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"}
@@ -4,9 +4,12 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.createDataStoreFactory = exports.createResponseError = exports.create404Response = exports.requestFluidObject = exports.responseToException = exports.exceptionToResponse = void 0;
7
+ exports.createDataStoreFactory = exports.createResponseError = exports.create404Response = exports.responseToException = exports.exceptionToResponse = void 0;
8
8
  const core_utils_1 = require("@fluidframework/core-utils");
9
9
  const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
10
+ /**
11
+ * @internal
12
+ */
10
13
  function exceptionToResponse(err) {
11
14
  const status = 500;
12
15
  if (err !== null && typeof err === "object" && err.errorFromRequestFluidObject === true) {
@@ -33,6 +36,9 @@ function exceptionToResponse(err) {
33
36
  };
34
37
  }
35
38
  exports.exceptionToResponse = exceptionToResponse;
39
+ /**
40
+ * @internal
41
+ */
36
42
  function responseToException(response, request) {
37
43
  const message = response.value;
38
44
  const errWithStack = (0, telemetry_utils_1.generateErrorWithStack)();
@@ -50,22 +56,13 @@ function responseToException(response, request) {
50
56
  }
51
57
  exports.responseToException = responseToException;
52
58
  /**
53
- * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
59
+ * @internal
54
60
  */
55
- async function requestFluidObject(
56
- // eslint-disable-next-line import/no-deprecated
57
- router, url) {
58
- const request = typeof url === "string" ? { url } : url;
59
- const response = await router.request(request);
60
- if (response.status !== 200 || response.mimeType !== "fluid/object") {
61
- throw responseToException(response, request);
62
- }
63
- (0, core_utils_1.assert)(response.value, 0x19a /* "Invalid response value for Fluid object request" */);
64
- return response.value;
65
- }
66
- exports.requestFluidObject = requestFluidObject;
67
61
  const create404Response = (request) => createResponseError(404, "not found", request);
68
62
  exports.create404Response = create404Response;
63
+ /**
64
+ * @internal
65
+ */
69
66
  function createResponseError(status, value, request, headers) {
70
67
  (0, core_utils_1.assert)(status !== 200, 0x19b /* "Cannot not create response error on 200 status" */);
71
68
  // Omit query string which could contain personal data unfit for logging
@@ -83,6 +80,9 @@ function createResponseError(status, value, request, headers) {
83
80
  };
84
81
  }
85
82
  exports.createResponseError = createResponseError;
83
+ /**
84
+ * @internal
85
+ */
86
86
  function createDataStoreFactory(type, factory) {
87
87
  return {
88
88
  type,
@@ -1 +1 @@
1
- {"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAQpD,qEAAyE;AAUzE,SAAgB,mBAAmB,CAAC,GAAQ;IAC3C,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,2BAA2B,KAAK,IAAI,EAAE;QACxF,MAAM,WAAW,GAAuB,GAAG,CAAC;QAC5C,OAAO;YACN,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,WAAW,CAAC,IAAI;YACxB,KAAK,EAAE,WAAW,CAAC,OAAO;YAC1B,IAAI,KAAK;gBACR,OAAO,WAAW,CAAC,KAAK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AE,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,uBAAuB,EAAE,GAAG,CAAC,IAAI,CAAC;KAC/E,CAAC;AACH,CAAC;AAhBD,wDAgBC","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\";\n// eslint-disable-next-line import/no-deprecated\nimport { FluidObject, IFluidRouter, 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\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\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 * @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the \"entryPoint\" pattern. Refer to Removing-IFluidRouter.md\n */\nexport async function requestFluidObject<T = FluidObject>(\n\t// eslint-disable-next-line import/no-deprecated\n\trouter: IFluidRouter,\n\turl: string | IRequest,\n): Promise<T> {\n\tconst request = typeof url === \"string\" ? { url } : url;\n\tconst response = await router.request(request);\n\n\tif (response.status !== 200 || response.mimeType !== \"fluid/object\") {\n\t\tthrow responseToException(response, request);\n\t}\n\n\tassert(response.value, 0x19a /* \"Invalid response value for Fluid object request\" */);\n\treturn response.value as T;\n}\n\nexport const create404Response = (request: IRequest) =>\n\tcreateResponseError(404, \"not found\", request);\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\nexport type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;\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"]}
1
+ {"version":3,"file":"dataStoreHelpers.js","sourceRoot":"","sources":["../src/dataStoreHelpers.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAOpD,qEAAyE;AAUzE;;GAEG;AACH,SAAgB,mBAAmB,CAAC,GAAQ;IAC3C,MAAM,MAAM,GAAG,GAAG,CAAC;IACnB,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,2BAA2B,KAAK,IAAI,EAAE;QACxF,MAAM,WAAW,GAAuB,GAAG,CAAC;QAC5C,OAAO;YACN,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,WAAW,CAAC,IAAI;YACxB,KAAK,EAAE,WAAW,CAAC,OAAO;YAC1B,IAAI,KAAK;gBACR,OAAO,WAAW,CAAC,KAAK,CAAC;YAC1B,CAAC;YACD,OAAO,EAAE,WAAW,CAAC,yBAAyB;SAC9C,CAAC;KACF;IAED,0GAA0G;IAC1G,MAAM,YAAY,GAAG,IAAA,wCAAsB,GAAE,CAAC;IAE9C,OAAO;QACN,QAAQ,EAAE,YAAY;QACtB,MAAM;QACN,KAAK,EAAE,GAAG,GAAG,EAAE;QACf,IAAI,KAAK;YACR,OAAQ,GAAG,EAAE,KAA4B,IAAI,YAAY,CAAC,KAAK,CAAC;QACjE,CAAC;KACD,CAAC;AACH,CAAC;AA1BD,kDA0BC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,QAAmB,EAAE,OAAiB;IACzE,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC;IAC/B,MAAM,YAAY,GAAG,IAAA,wCAAsB,GAAE,CAAC;IAC9C,MAAM,WAAW,GAA+B;QAC/C,2BAA2B,EAAE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QACD,oBAAoB,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,CACjD,CAAC,MAAM,OAAO,CAAC,CAAC,oBAAoB,CAAC,OAAO,EAAE,QAAQ,CAAC;QACxD,GAAG,EAAE,KAAK,EAAE,IAAY,EAAE,EAAE,CAAC,CAAC,MAAM,OAAO,CAAC,CAAC,uBAAuB,EAAE,GAAG,CAAC,IAAI,CAAC;KAC/E,CAAC;AACH,CAAC;AAhBD,wDAgBC","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"]}
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  export { generateHandleContextPath } from "./dataStoreHandleContextUtils";
6
- export { create404Response, createDataStoreFactory, createResponseError, exceptionToResponse, Factory, requestFluidObject, responseToException, } from "./dataStoreHelpers";
6
+ export { create404Response, createDataStoreFactory, createResponseError, exceptionToResponse, Factory, responseToException, } from "./dataStoreHelpers";
7
7
  export { ObjectStoragePartition } from "./objectstoragepartition";
8
8
  export { getNormalizedObjectStoragePathParts, listBlobsAtTreePath } from "./objectstorageutils";
9
9
  export { RequestParser } from "./requestParser";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACN,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,OAAO,EACP,kBAAkB,EAClB,mBAAmB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,mCAAmC,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,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,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EACN,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,OAAO,EACP,mBAAmB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,mCAAmC,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,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,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@
4
4
  * Licensed under the MIT License.
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.seqFromTree = exports.unpackChildNodesUsedRoutes = exports.utf8ByteLength = exports.TelemetryContext = exports.SummaryTreeBuilder = exports.mergeStats = exports.getBlobSize = exports.GCDataBuilder = exports.convertToSummaryTreeWithStats = exports.convertToSummaryTree = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.calculateStats = exports.addTreeToSummary = exports.addSummarizeResultToSummary = exports.addBlobToSummary = exports.RuntimeFactoryHelper = exports.RequestParser = exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = exports.ObjectStoragePartition = exports.responseToException = exports.requestFluidObject = exports.exceptionToResponse = exports.createResponseError = exports.createDataStoreFactory = exports.create404Response = exports.generateHandleContextPath = void 0;
7
+ exports.seqFromTree = exports.unpackChildNodesUsedRoutes = exports.utf8ByteLength = exports.TelemetryContext = exports.SummaryTreeBuilder = exports.mergeStats = exports.getBlobSize = exports.GCDataBuilder = exports.convertToSummaryTreeWithStats = exports.convertToSummaryTree = exports.convertSummaryTreeToITree = exports.convertSnapshotTreeToSummaryTree = exports.calculateStats = exports.addTreeToSummary = exports.addSummarizeResultToSummary = exports.addBlobToSummary = exports.RuntimeFactoryHelper = exports.RequestParser = exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = exports.ObjectStoragePartition = exports.responseToException = exports.exceptionToResponse = exports.createResponseError = exports.createDataStoreFactory = exports.create404Response = exports.generateHandleContextPath = void 0;
8
8
  var dataStoreHandleContextUtils_1 = require("./dataStoreHandleContextUtils");
9
9
  Object.defineProperty(exports, "generateHandleContextPath", { enumerable: true, get: function () { return dataStoreHandleContextUtils_1.generateHandleContextPath; } });
10
10
  var dataStoreHelpers_1 = require("./dataStoreHelpers");
@@ -12,7 +12,6 @@ Object.defineProperty(exports, "create404Response", { enumerable: true, get: fun
12
12
  Object.defineProperty(exports, "createDataStoreFactory", { enumerable: true, get: function () { return dataStoreHelpers_1.createDataStoreFactory; } });
13
13
  Object.defineProperty(exports, "createResponseError", { enumerable: true, get: function () { return dataStoreHelpers_1.createResponseError; } });
14
14
  Object.defineProperty(exports, "exceptionToResponse", { enumerable: true, get: function () { return dataStoreHelpers_1.exceptionToResponse; } });
15
- Object.defineProperty(exports, "requestFluidObject", { enumerable: true, get: function () { return dataStoreHelpers_1.requestFluidObject; } });
16
15
  Object.defineProperty(exports, "responseToException", { enumerable: true, get: function () { return dataStoreHelpers_1.responseToException; } });
17
16
  var objectstoragepartition_1 = require("./objectstoragepartition");
18
17
  Object.defineProperty(exports, "ObjectStoragePartition", { enumerable: true, get: function () { return objectstoragepartition_1.ObjectStoragePartition; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAA0E;AAAjE,wIAAA,yBAAyB,OAAA;AAClC,uDAQ4B;AAP3B,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AACtB,uHAAA,mBAAmB,OAAA;AACnB,uHAAA,mBAAmB,OAAA;AAEnB,sHAAA,kBAAkB,OAAA;AAClB,uHAAA,mBAAmB,OAAA;AAEpB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,2DAAgG;AAAvF,yIAAA,mCAAmC,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AACjE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,+CAewB;AAdvB,gHAAA,gBAAgB,OAAA;AAChB,2HAAA,2BAA2B,OAAA;AAC3B,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AACd,gIAAA,gCAAgC,OAAA;AAChC,yHAAA,yBAAyB,OAAA;AACzB,oHAAA,oBAAoB,OAAA;AACpB,6HAAA,6BAA6B,OAAA;AAC7B,6GAAA,aAAa,OAAA;AACb,2GAAA,WAAW,OAAA;AACX,0GAAA,UAAU,OAAA;AACV,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AAEf,uDAAgE;AAAvD,8HAAA,0BAA0B,OAAA;AACnC,iCAAwD;AAA7B,oGAAA,WAAW,OAAA","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\trequestFluidObject,\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"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,6EAA0E;AAAjE,wIAAA,yBAAyB,OAAA;AAClC,uDAO4B;AAN3B,qHAAA,iBAAiB,OAAA;AACjB,0HAAA,sBAAsB,OAAA;AACtB,uHAAA,mBAAmB,OAAA;AACnB,uHAAA,mBAAmB,OAAA;AAEnB,uHAAA,mBAAmB,OAAA;AAEpB,mEAAkE;AAAzD,gIAAA,sBAAsB,OAAA;AAC/B,2DAAgG;AAAvF,yIAAA,mCAAmC,OAAA;AAAE,yHAAA,mBAAmB,OAAA;AACjE,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,+DAA8D;AAArD,4HAAA,oBAAoB,OAAA;AAC7B,+CAewB;AAdvB,gHAAA,gBAAgB,OAAA;AAChB,2HAAA,2BAA2B,OAAA;AAC3B,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AACd,gIAAA,gCAAgC,OAAA;AAChC,yHAAA,yBAAyB,OAAA;AACzB,oHAAA,oBAAoB,OAAA;AACpB,6HAAA,6BAA6B,OAAA;AAC7B,6GAAA,aAAa,OAAA;AACb,2GAAA,WAAW,OAAA;AACX,0GAAA,UAAU,OAAA;AACV,kHAAA,kBAAkB,OAAA;AAClB,gHAAA,gBAAgB,OAAA;AAChB,8GAAA,cAAc,OAAA;AAEf,uDAAgE;AAAvD,8HAAA,0BAA0B,OAAA;AACnC,iCAAwD;AAA7B,oGAAA,WAAW,OAAA","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;
@@ -1 +1 @@
1
- {"version":3,"file":"objectstoragepartition.d.ts","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E;;GAEG;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,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAE/E;;;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"}
@@ -8,6 +8,7 @@ exports.ObjectStoragePartition = void 0;
8
8
  const core_utils_1 = require("@fluidframework/core-utils");
9
9
  /**
10
10
  * Returns a new IChannelStorageService that resolves the given `path` as root.
11
+ * @internal
11
12
  */
12
13
  class ObjectStoragePartition {
13
14
  constructor(storage, path) {
@@ -1 +1 @@
1
- {"version":3,"file":"objectstoragepartition.js","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAGpD;;GAEG;AACH,MAAa,sBAAsB;IAClC,YACkB,OAA+B,EAC/B,IAAY;QADZ,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QAE7B,kDAAkD;QAClD,IAAA,mBAAM,EAAC,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;AApBD,wDAoBC","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 */\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,2DAAoD;AAGpD;;;GAGG;AACH,MAAa,sBAAsB;IAClC,YACkB,OAA+B,EAC/B,IAAY;QADZ,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QAE7B,kDAAkD;QAClD,IAAA,mBAAM,EAAC,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;AApBD,wDAoBC","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
@@ -1 +1 @@
1
- {"version":3,"file":"objectstorageutils.d.ts","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAE7D,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,MAAM,YAY/D;AAED,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,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAE7D;;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"}
@@ -5,6 +5,9 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.listBlobsAtTreePath = exports.getNormalizedObjectStoragePathParts = void 0;
8
+ /**
9
+ * @internal
10
+ */
8
11
  function getNormalizedObjectStoragePathParts(path) {
9
12
  let normalizePath = path;
10
13
  if (normalizePath.startsWith("/")) {
@@ -19,6 +22,9 @@ function getNormalizedObjectStoragePathParts(path) {
19
22
  return [];
20
23
  }
21
24
  exports.getNormalizedObjectStoragePathParts = getNormalizedObjectStoragePathParts;
25
+ /**
26
+ * @internal
27
+ */
22
28
  async function listBlobsAtTreePath(inputTree, path) {
23
29
  const pathParts = getNormalizedObjectStoragePathParts(path);
24
30
  let tree = inputTree;
@@ -1 +1 @@
1
- {"version":3,"file":"objectstorageutils.js","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,SAAgB,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,O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{ ITree } from \"@fluidframework/protocol-definitions\";\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\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;;;AAIH;;GAEG;AACH,SAAgB,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,EAA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CAAC,CAAC;AACzE,CAAC;AArBD,kDAqBC","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"]}
@@ -5,6 +5,7 @@
5
5
  import { IRequest, IRequestHeader } from "@fluidframework/core-interfaces";
6
6
  /**
7
7
  * The Request Parser takes an IRequest provides parsing and sub request creation
8
+ * @alpha
8
9
  */
9
10
  export declare class RequestParser implements IRequest {
10
11
  private readonly request;
@@ -1 +1 @@
1
- {"version":3,"file":"requestParser.d.ts","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mapp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AG,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"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RequestParser = void 0;
4
4
  /**
5
5
  * The Request Parser takes an IRequest provides parsing and sub request creation
6
+ * @alpha
6
7
  */
7
8
  class RequestParser {
8
9
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"requestParser.js","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,MAAa,aAAa;IACzB;;;OAGG;IACI,MAAM,CAAC,YAAY,CAAC,GAAW;QACrC,MAAM,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACzC,OAAO,GAAG;aACR,SAAS,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC;aAChE,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CAAW,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;YAC5B,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;gBACtC,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;aAChC;YACD,OAAO,EAAE,CAAC;QACX,CAAC,EAAE,EAAE,CAAC,CAAC;IACT,CAAC;IAKM,MAAM,CAAC,MAAM,CAAC,OAA2B;QAC/C,sBAAsB;QACtB,IAAI,OAAO,YAAY,aAAa,EAAE;YACrC,OAAO,OAAO,CAAC;SACf;QACD,OAAO,IAAI,aA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IAAI,IAAI,CAAC,KAAK,EAAE;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;aACrB,CAAC;SACF;QACD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACrE,OAAO;YACN,GAAG,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YACvD,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD;AAzFD,sCAyFC","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 */\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"]}
1
+ {"version":3,"file":"requestParser.js","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":";;;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IACH,IAAW,SAAS;QACnB,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,EAAE;YACxC,IAAI,CAAC,gBAAgB,GAAG,aAAa,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;SAC7D;QACD,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC9B,CAAC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAgB;QAC7B,OAAO,IAAI,CAAC,KAAK,KAAK,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,QAAQ,CAAC;IAChE,CAAC;IAED;;;;;;;;;;;OAWG;IACI,gBAAgB,CAAC,iBAAyB;QAChD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;QACtC,IAAI,iBAAiB,GAAG,CAAC,IAAI,iBAAiB,GAAG,OAAO,EAAE;YACzD,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;SACzC;QACD,IAAI,iBAAiB,KAAK,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YAC5D,OAAO;gBACN,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;aACrB,CAAC;SACF;QACD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACrE,OAAO;YACN,GAAG,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YACvD,OAAO,EAAE,IAAI,CAAC,OAAO;SACrB,CAAC;IACH,CAAC;CACD;AAzFD,sCAyFC","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"]}