@fluidframework/runtime-utils 2.0.0-rc.2.0.2 → 2.0.0-rc.3.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 (78) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/runtime-utils.api.md +10 -10
  3. package/dist/dataStoreHelpers.d.ts +2 -2
  4. package/dist/dataStoreHelpers.d.ts.map +1 -1
  5. package/dist/dataStoreHelpers.js +7 -7
  6. package/dist/dataStoreHelpers.js.map +1 -1
  7. package/dist/legacy.d.ts +18 -0
  8. package/dist/objectstoragepartition.js +2 -2
  9. package/dist/objectstoragepartition.js.map +1 -1
  10. package/dist/public.d.ts +12 -0
  11. package/dist/requestParser.d.ts.map +1 -1
  12. package/dist/requestParser.js +4 -0
  13. package/dist/requestParser.js.map +1 -1
  14. package/dist/runtimeFactoryHelper.d.ts +2 -2
  15. package/dist/runtimeFactoryHelper.d.ts.map +1 -1
  16. package/dist/runtimeFactoryHelper.js.map +1 -1
  17. package/dist/summaryUtils.d.ts +4 -3
  18. package/dist/summaryUtils.d.ts.map +1 -1
  19. package/dist/summaryUtils.js +7 -7
  20. package/dist/summaryUtils.js.map +1 -1
  21. package/dist/unpackUsedRoutes.js +2 -2
  22. package/dist/unpackUsedRoutes.js.map +1 -1
  23. package/dist/utils.js +2 -2
  24. package/dist/utils.js.map +1 -1
  25. package/internal.d.ts +11 -0
  26. package/legacy.d.ts +11 -0
  27. package/lib/dataStoreHelpers.d.ts +2 -2
  28. package/lib/dataStoreHelpers.d.ts.map +1 -1
  29. package/lib/dataStoreHelpers.js +3 -3
  30. package/lib/dataStoreHelpers.js.map +1 -1
  31. package/lib/legacy.d.ts +18 -0
  32. package/lib/objectstoragepartition.js +1 -1
  33. package/lib/objectstoragepartition.js.map +1 -1
  34. package/lib/public.d.ts +12 -0
  35. package/lib/requestParser.d.ts.map +1 -1
  36. package/lib/requestParser.js +4 -0
  37. package/lib/requestParser.js.map +1 -1
  38. package/lib/runtimeFactoryHelper.d.ts +2 -2
  39. package/lib/runtimeFactoryHelper.d.ts.map +1 -1
  40. package/lib/runtimeFactoryHelper.js.map +1 -1
  41. package/lib/summaryUtils.d.ts +4 -3
  42. package/lib/summaryUtils.d.ts.map +1 -1
  43. package/lib/summaryUtils.js +3 -3
  44. package/lib/summaryUtils.js.map +1 -1
  45. package/lib/unpackUsedRoutes.js +1 -1
  46. package/lib/unpackUsedRoutes.js.map +1 -1
  47. package/lib/utils.js +1 -1
  48. package/lib/utils.js.map +1 -1
  49. package/package.json +33 -54
  50. package/src/dataStoreHelpers.ts +4 -4
  51. package/src/objectstoragepartition.ts +1 -1
  52. package/src/requestParser.ts +1 -0
  53. package/src/runtimeFactoryHelper.ts +2 -2
  54. package/src/summaryUtils.ts +16 -12
  55. package/src/unpackUsedRoutes.ts +1 -1
  56. package/src/utils.ts +1 -1
  57. package/api-extractor-cjs.json +0 -8
  58. package/dist/runtime-utils-alpha.d.ts +0 -161
  59. package/dist/runtime-utils-beta.d.ts +0 -109
  60. package/dist/runtime-utils-public.d.ts +0 -109
  61. package/dist/runtime-utils-untrimmed.d.ts +0 -346
  62. package/lib/runtime-utils-alpha.d.ts +0 -161
  63. package/lib/runtime-utils-beta.d.ts +0 -109
  64. package/lib/runtime-utils-public.d.ts +0 -109
  65. package/lib/runtime-utils-untrimmed.d.ts +0 -346
  66. package/lib/test/dataStoreHelpers.spec.js +0 -29
  67. package/lib/test/dataStoreHelpers.spec.js.map +0 -1
  68. package/lib/test/requestParser.spec.js +0 -111
  69. package/lib/test/requestParser.spec.js.map +0 -1
  70. package/lib/test/runtimeFactoryHelper.spec.js +0 -44
  71. package/lib/test/runtimeFactoryHelper.spec.js.map +0 -1
  72. package/lib/test/summaryUtils.spec.js +0 -283
  73. package/lib/test/summaryUtils.spec.js.map +0 -1
  74. package/lib/test/types/validateRuntimeUtilsPrevious.generated.js +0 -58
  75. package/lib/test/types/validateRuntimeUtilsPrevious.generated.js.map +0 -1
  76. package/lib/test/utils.spec.js +0 -65
  77. package/lib/test/utils.spec.js.map +0 -1
  78. /package/{dist → lib}/tsdoc-metadata.json +0 -0
@@ -1,109 +0,0 @@
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 type { TelemetryBaseEventPropertyType } 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: calculateStats */
32
-
33
- /* Excluded from this release type: convertSnapshotTreeToSummaryTree */
34
-
35
- /* Excluded from this release type: convertSummaryTreeToITree */
36
-
37
- /* Excluded from this release type: convertToSummaryTree */
38
-
39
- /* Excluded from this release type: convertToSummaryTreeWithStats */
40
-
41
- /* Excluded from this release type: create404Response */
42
-
43
- /* Excluded from this release type: createDataStoreFactory */
44
-
45
- /* Excluded from this release type: createResponseError */
46
-
47
- /* Excluded from this release type: encodeCompactIdToString */
48
-
49
- /* Excluded from this release type: exceptionToResponse */
50
-
51
- /* Excluded from this release type: Factory */
52
-
53
- /* Excluded from this release type: GCDataBuilder */
54
-
55
- /* Excluded from this release type: generateHandleContextPath */
56
-
57
- /* Excluded from this release type: getBlobSize */
58
-
59
- /* Excluded from this release type: getNormalizedObjectStoragePathParts */
60
-
61
- /* Excluded from this release type: IContainerContext */
62
-
63
- /* Excluded from this release type: IContainerRuntime */
64
-
65
- /* Excluded from this release type: IFluidDataStoreFactory */
66
-
67
- /* Excluded from this release type: IFluidDataStoreRegistry */
68
-
69
- /* Excluded from this release type: IProvideFluidDataStoreRegistry */
70
-
71
- /* Excluded from this release type: IRuntime */
72
-
73
- /* Excluded from this release type: IRuntimeFactory */
74
-
75
- /* Excluded from this release type: ISerializedHandle */
76
-
77
- /* Excluded from this release type: ISnapshotTreeWithBlobContents */
78
-
79
- /* Excluded from this release type: isSerializedHandle */
80
-
81
- /* Excluded from this release type: ISummarizeResult */
82
-
83
- /* Excluded from this release type: listBlobsAtTreePath */
84
-
85
- /* Excluded from this release type: mergeStats */
86
-
87
- /* Excluded from this release type: ObjectStoragePartition */
88
-
89
- /* Excluded from this release type: processAttachMessageGCData */
90
-
91
- /* Excluded from this release type: ReadAndParseBlob */
92
-
93
- /* Excluded from this release type: RequestParser */
94
-
95
- /* Excluded from this release type: responseToException */
96
-
97
- /* Excluded from this release type: RuntimeFactoryHelper */
98
-
99
- /* Excluded from this release type: seqFromTree */
100
-
101
- /* Excluded from this release type: SummaryTreeBuilder */
102
-
103
- /* Excluded from this release type: TelemetryContext */
104
-
105
- /* Excluded from this release type: unpackChildNodesUsedRoutes */
106
-
107
- /* Excluded from this release type: utf8ByteLength */
108
-
109
- export { }
@@ -1,109 +0,0 @@
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 type { TelemetryBaseEventPropertyType } 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: calculateStats */
32
-
33
- /* Excluded from this release type: convertSnapshotTreeToSummaryTree */
34
-
35
- /* Excluded from this release type: convertSummaryTreeToITree */
36
-
37
- /* Excluded from this release type: convertToSummaryTree */
38
-
39
- /* Excluded from this release type: convertToSummaryTreeWithStats */
40
-
41
- /* Excluded from this release type: create404Response */
42
-
43
- /* Excluded from this release type: createDataStoreFactory */
44
-
45
- /* Excluded from this release type: createResponseError */
46
-
47
- /* Excluded from this release type: encodeCompactIdToString */
48
-
49
- /* Excluded from this release type: exceptionToResponse */
50
-
51
- /* Excluded from this release type: Factory */
52
-
53
- /* Excluded from this release type: GCDataBuilder */
54
-
55
- /* Excluded from this release type: generateHandleContextPath */
56
-
57
- /* Excluded from this release type: getBlobSize */
58
-
59
- /* Excluded from this release type: getNormalizedObjectStoragePathParts */
60
-
61
- /* Excluded from this release type: IContainerContext */
62
-
63
- /* Excluded from this release type: IContainerRuntime */
64
-
65
- /* Excluded from this release type: IFluidDataStoreFactory */
66
-
67
- /* Excluded from this release type: IFluidDataStoreRegistry */
68
-
69
- /* Excluded from this release type: IProvideFluidDataStoreRegistry */
70
-
71
- /* Excluded from this release type: IRuntime */
72
-
73
- /* Excluded from this release type: IRuntimeFactory */
74
-
75
- /* Excluded from this release type: ISerializedHandle */
76
-
77
- /* Excluded from this release type: ISnapshotTreeWithBlobContents */
78
-
79
- /* Excluded from this release type: isSerializedHandle */
80
-
81
- /* Excluded from this release type: ISummarizeResult */
82
-
83
- /* Excluded from this release type: listBlobsAtTreePath */
84
-
85
- /* Excluded from this release type: mergeStats */
86
-
87
- /* Excluded from this release type: ObjectStoragePartition */
88
-
89
- /* Excluded from this release type: processAttachMessageGCData */
90
-
91
- /* Excluded from this release type: ReadAndParseBlob */
92
-
93
- /* Excluded from this release type: RequestParser */
94
-
95
- /* Excluded from this release type: responseToException */
96
-
97
- /* Excluded from this release type: RuntimeFactoryHelper */
98
-
99
- /* Excluded from this release type: seqFromTree */
100
-
101
- /* Excluded from this release type: SummaryTreeBuilder */
102
-
103
- /* Excluded from this release type: TelemetryContext */
104
-
105
- /* Excluded from this release type: unpackChildNodesUsedRoutes */
106
-
107
- /* Excluded from this release type: utf8ByteLength */
108
-
109
- export { }
@@ -1,346 +0,0 @@
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 type { TelemetryBaseEventPropertyType } from '@fluidframework/core-interfaces';
26
-
27
- /**
28
- * @internal
29
- */
30
- export declare function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;
31
-
32
- /**
33
- * @internal
34
- */
35
- export declare function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
36
-
37
- /**
38
- * @internal
39
- */
40
- export declare function calculateStats(summary: SummaryObject): ISummaryStats;
41
-
42
- /**
43
- * Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was
44
- * was taken by serialize api in detached container.
45
- * @param snapshot - snapshot in ISnapshotTree format
46
- * @internal
47
- */
48
- export declare function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTreeWithBlobContents): ISummaryTreeWithStats;
49
-
50
- /**
51
- * Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
52
- * @param summaryTree - summary tree in ISummaryTree format
53
- * @internal
54
- */
55
- export declare function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;
56
-
57
- /**
58
- * Converts snapshot ITree to ISummaryTree format and tracks stats.
59
- * @param snapshot - snapshot in ITree format
60
- * @param fullTree - true to never use handles, even if id is specified
61
- * @internal
62
- */
63
- export declare function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;
64
-
65
- /**
66
- * Converts snapshot ITree to ISummaryTree format and tracks stats.
67
- * @param snapshot - snapshot in ITree format
68
- * @param fullTree - true to never use handles, even if id is specified
69
- * @alpha
70
- */
71
- export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
72
-
73
- /**
74
- * @internal
75
- */
76
- export declare const create404Response: (request: IRequest) => IResponse;
77
-
78
- /**
79
- * @internal
80
- */
81
- export declare function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
82
-
83
- /**
84
- * @internal
85
- */
86
- export declare function createResponseError(status: number, value: string, request: IRequest, headers?: {
87
- [key: string]: any;
88
- }): IResponse;
89
-
90
- /**
91
- * Encode compact ID (returned by IContainerRuntime.generateDocumentUniqueId()) to a compact string representation.
92
- * While this is the main usage pattern, it works with any non-negative integer or a string.
93
- * Strings are retured as is, and assumed to be UUIDs, i.e. unique enough to never overlap with
94
- * numbers encoded as strings by this function. Any other strings are likely to run into collisions and should not be used!
95
- * This function is useful in places where we serialize resulting ID as string and use them as strings, thus we are not
96
- * gaining any efficiency from having a number type.
97
- * We do not provide a decode function, so this API is only useful only result is stored and there is no need to go back to origianl form.
98
- * @param idArg - input - either a non-negative integer or a string. Strings are returned as is, while numbers are encoded in compat form
99
- * @param prefix - optinal string prefix
100
- * @returns A string - representation of an input
101
- * @internal
102
- */
103
- export declare function encodeCompactIdToString(idArg: number | string, prefix?: string): string;
104
-
105
- /**
106
- * @internal
107
- */
108
- export declare function exceptionToResponse(err: any): IResponse;
109
-
110
- /**
111
- * @internal
112
- */
113
- export declare type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
114
-
115
- /**
116
- * Helper class to build the garbage collection data of a node by combining the data from multiple nodes.
117
- * @internal
118
- */
119
- export declare class GCDataBuilder implements IGarbageCollectionData {
120
- private readonly gcNodesSet;
121
- get gcNodes(): {
122
- [id: string]: string[];
123
- };
124
- addNode(id: string, outboundRoutes: string[]): void;
125
- /**
126
- * Adds the given GC nodes. It does the following:
127
- * - Normalizes the ids of the given nodes.
128
- * - Prefixes the given `prefixId` to the given nodes' ids.
129
- * - Adds the outbound routes of the nodes against the normalized and prefixed id.
130
- */
131
- prefixAndAddNodes(prefixId: string, gcNodes: {
132
- [id: string]: string[];
133
- }): void;
134
- addNodes(gcNodes: {
135
- [id: string]: string[];
136
- }): void;
137
- /**
138
- * Adds the given outbound route to the outbound routes of all GC nodes.
139
- */
140
- addRouteToAllNodes(outboundRoute: string): void;
141
- getGCData(): IGarbageCollectionData;
142
- }
143
-
144
- /**
145
- * Generates the absolute path for a Fluid object given its path and its parent routeContext.
146
- * @param path - The path to the Fluid object relative to the route context.
147
- * @param routeContext - The route context that contains the Fluid object.
148
- * @returns The absolute path to the Fluid object from the root of the Container.
149
- * @internal
150
- */
151
- export declare function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
152
-
153
- /**
154
- * @internal
155
- */
156
- export declare function getBlobSize(content: ISummaryBlob["content"]): number;
157
-
158
- /**
159
- * @internal
160
- */
161
- export declare function getNormalizedObjectStoragePathParts(path: string): string[];
162
-
163
- /**
164
- * JSON serialized form of an IFluidHandle
165
- * @internal
166
- */
167
- export declare interface ISerializedHandle {
168
- type: "__fluid_handle__";
169
- url: string;
170
- }
171
-
172
- /**
173
- * Is the input object a @see ISerializedHandle?
174
- * @internal
175
- */
176
- export declare const isSerializedHandle: (value: any) => value is ISerializedHandle;
177
-
178
- /**
179
- * @internal
180
- */
181
- export declare function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
182
-
183
- /**
184
- * Combines summary stats by adding their totals together.
185
- * Returns empty stats if called without args.
186
- * @param stats - stats to merge
187
- * @internal
188
- */
189
- export declare function mergeStats(...stats: ISummaryStats[]): ISummaryStats;
190
-
191
- /**
192
- * Returns a new IChannelStorageService that resolves the given `path` as root.
193
- * @internal
194
- */
195
- export declare class ObjectStoragePartition implements IChannelStorageService {
196
- private readonly storage;
197
- private readonly path;
198
- constructor(storage: IChannelStorageService, path: string);
199
- readBlob(path: string): Promise<ArrayBufferLike>;
200
- contains(path: string): Promise<boolean>;
201
- list(path: string): Promise<string[]>;
202
- }
203
-
204
- /**
205
- * Looks in the given attach message snapshot for the .gcdata blob, which would
206
- * contain the initial GC Data for the node being attached.
207
- * If it finds it, it notifies GC of all the new outbound routes being added by the attach.
208
- *
209
- * @param snapshot - The snapshot from the attach message
210
- * @param addedGCOutboundRoute - Callback to notify GC of a new outbound route.
211
- * IMPORTANT: addedGCOutboundRoute's param nodeId is "/" for the attaching node itself, or "/<id>" for its children.
212
- *
213
- * @returns true if it found/processed GC Data, false otherwise
214
- *
215
- * @internal
216
- */
217
- export declare function processAttachMessageGCData(snapshot: ITree | null, addedGCOutboundRoute: (fromNodeId: string, toPath: string) => void): boolean;
218
-
219
- /**
220
- * Reads a blob from storage and parses it from JSON.
221
- *
222
- * @internal
223
- */
224
- export declare type ReadAndParseBlob = <T>(id: string) => Promise<T>;
225
-
226
- /**
227
- * The Request Parser takes an IRequest provides parsing and sub request creation
228
- * @alpha
229
- */
230
- export declare class RequestParser implements IRequest {
231
- private readonly request;
232
- /**
233
- * Splits the path of the url and decodes each path part
234
- * @param url - the url to get path parts of
235
- */
236
- static getPathParts(url: string): readonly string[];
237
- private requestPathParts;
238
- readonly query: string;
239
- static create(request: Readonly<IRequest>): RequestParser;
240
- protected constructor(request: Readonly<IRequest>);
241
- get url(): string;
242
- get headers(): IRequestHeader | undefined;
243
- /**
244
- * Returns the decoded path parts of the request's url
245
- */
246
- get pathParts(): readonly string[];
247
- /**
248
- * Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.
249
- * @param elements - number of elements in path
250
- */
251
- isLeaf(elements: number): boolean;
252
- /**
253
- * Creates a sub request starting at a specific path part of this request's url
254
- * The sub request url always has a leading slash, and always include query params if original url has any
255
- * e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams
256
- * createSubRequest(1) is /b/?queryParams
257
- * createSubRequest(2) is /?queryParams
258
- * createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception
259
- *
260
- * note: query params are not counted towards path parts.
261
- *
262
- * @param startingPathIndex - The index of the first path part of the sub request
263
- */
264
- createSubRequest(startingPathIndex: number): IRequest;
265
- }
266
-
267
- /**
268
- * @internal
269
- */
270
- export declare function responseToException(response: IResponse, request: IRequest): Error;
271
-
272
- /**
273
- * @alpha
274
- */
275
- export declare abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
276
- get IRuntimeFactory(): this;
277
- instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
278
- abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;
279
- instantiateFirstTime(_runtime: T): Promise<void>;
280
- instantiateFromExisting(_runtime: T): Promise<void>;
281
- hasInitialized(_runtime: T): Promise<void>;
282
- }
283
-
284
- /**
285
- * Fetches the sequence number of the snapshot tree by examining the protocol.
286
- * @param tree - snapshot tree to examine
287
- * @param readAndParseBlob - function to read blob contents from storage
288
- * and parse the result from JSON.
289
- * @internal
290
- */
291
- export declare function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
292
-
293
- /**
294
- * @alpha
295
- */
296
- export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
297
- private attachmentCounter;
298
- get summary(): ISummaryTree;
299
- get stats(): Readonly<ISummaryStats>;
300
- constructor();
301
- private readonly summaryTree;
302
- private summaryStats;
303
- addBlob(key: string, content: string | Uint8Array): void;
304
- addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
305
- addWithStats(key: string, summarizeResult: ISummarizeResult): void;
306
- addAttachment(id: string): void;
307
- getSummaryTree(): ISummaryTreeWithStats;
308
- }
309
-
310
- /**
311
- * @internal
312
- */
313
- export declare class TelemetryContext implements ITelemetryContext {
314
- private readonly telemetry;
315
- /**
316
- * {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.set}
317
- */
318
- set(prefix: string, property: string, value: TelemetryBaseEventPropertyType): void;
319
- /**
320
- * {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.setMultiple}
321
- */
322
- setMultiple(prefix: string, property: string, values: Record<string, TelemetryBaseEventPropertyType>): void;
323
- /**
324
- * {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.get}
325
- */
326
- get(prefix: string, property: string): TelemetryBaseEventPropertyType;
327
- /**
328
- * {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.serialize}
329
- */
330
- serialize(): string;
331
- }
332
-
333
- /**
334
- * Helper function that unpacks the used routes of children from a given node's used routes.
335
- * @param usedRoutes - The used routes of a node.
336
- * @returns A map of used routes of each children of the the given node.
337
- * @internal
338
- */
339
- export declare function unpackChildNodesUsedRoutes(usedRoutes: readonly string[]): Map<string, string[]>;
340
-
341
- /**
342
- * @internal
343
- */
344
- export declare function utf8ByteLength(str: string): number;
345
-
346
- export { }
@@ -1,29 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { strict as assert } from "assert";
6
- import { createResponseError, exceptionToResponse, responseToException, } from "../dataStoreHelpers.js";
7
- describe("createResponseError", () => {
8
- it("Strip URL query param ", () => {
9
- const response = createResponseError(400, "SomeValue", { url: "http://foo.com?a=b" });
10
- assert.strictEqual(response.value, "SomeValue: http://foo.com");
11
- });
12
- it("request / response / error handling ", () => {
13
- const request = { url: "/foo/bar?something" };
14
- const response = createResponseError(401, "some value", request);
15
- const value = "some value: /foo/bar";
16
- assert.strict.equal(response.status, 401, "status code");
17
- assert.strict.equal(response.value, value, "value");
18
- const stack = response.stack;
19
- assert.strict.notEqual(stack, undefined, "stack");
20
- const exception = responseToException(response, request);
21
- assert.strict.equal(exception.message, value, "value2");
22
- assert.strict.equal(exception.stack, stack, "stack2");
23
- const response2 = exceptionToResponse(exception);
24
- assert.strict.equal(response2.status, 401, "status code3");
25
- assert.strict.equal(response2.value, value, "value3");
26
- assert.strict.equal(response.stack, stack, "stack3");
27
- });
28
- });
29
- //# sourceMappingURL=dataStoreHelpers.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataStoreHelpers.spec.js","sourceRoot":"","sources":["../../src/test/dataStoreHelpers.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACjC,MAAM,QAAQ,GAAG,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,EAAE,GAAG,EAAE,oBAAoB,EAAE,CAAC,CAAC;QACtF,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sCAAsC,EAAE,GAAG,EAAE;QAC/C,MAAM,OAAO,GAAG,EAAE,GAAG,EAAE,oBAAoB,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,mBAAmB,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QACjE,MAAM,KAAK,GAAG,sBAAsB,CAAC;QACrC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE,aAAa,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACpD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAElD,MAAM,SAAS,GAAG,mBAAmB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QACxD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QAEtD,MAAM,SAAS,GAAG,mBAAmB,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,cAAc,CAAC,CAAC;QAC3D,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;QACtD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport {\n\tcreateResponseError,\n\texceptionToResponse,\n\tresponseToException,\n} from \"../dataStoreHelpers.js\";\n\ndescribe(\"createResponseError\", () => {\n\tit(\"Strip URL query param \", () => {\n\t\tconst response = createResponseError(400, \"SomeValue\", { url: \"http://foo.com?a=b\" });\n\t\tassert.strictEqual(response.value, \"SomeValue: http://foo.com\");\n\t});\n\n\tit(\"request / response / error handling \", () => {\n\t\tconst request = { url: \"/foo/bar?something\" };\n\t\tconst response = createResponseError(401, \"some value\", request);\n\t\tconst value = \"some value: /foo/bar\";\n\t\tassert.strict.equal(response.status, 401, \"status code\");\n\t\tassert.strict.equal(response.value, value, \"value\");\n\t\tconst stack = response.stack;\n\t\tassert.strict.notEqual(stack, undefined, \"stack\");\n\n\t\tconst exception = responseToException(response, request);\n\t\tassert.strict.equal(exception.message, value, \"value2\");\n\t\tassert.strict.equal(exception.stack, stack, \"stack2\");\n\n\t\tconst response2 = exceptionToResponse(exception);\n\t\tassert.strict.equal(response2.status, 401, \"status code3\");\n\t\tassert.strict.equal(response2.value, value, \"value3\");\n\t\tassert.strict.equal(response.stack, stack, \"stack3\");\n\t});\n});\n"]}