@fluidframework/runtime-utils 2.0.0-internal.7.0.0 → 2.0.0-internal.7.1.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.
- package/CHANGELOG.md +4 -0
- package/api-extractor.json +9 -1
- package/api-report/runtime-utils.api.md +205 -0
- package/dist/objectstoragepartition.d.ts.map +1 -1
- package/dist/objectstoragepartition.js.map +1 -1
- package/dist/runtime-utils-alpha.d.ts +220 -0
- package/dist/runtime-utils-beta.d.ts +220 -0
- package/dist/runtime-utils-public.d.ts +220 -0
- package/dist/runtime-utils.d.ts +247 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/objectstoragepartition.d.ts.map +1 -1
- package/lib/objectstoragepartition.js.map +1 -1
- package/package.json +20 -20
- package/src/objectstoragepartition.ts +4 -1
package/CHANGELOG.md
CHANGED
package/api-extractor.json
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
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-
|
|
3
|
+
"extends": "@fluidframework/build-common/api-extractor-base.json",
|
|
4
|
+
"messages": {
|
|
5
|
+
"extractorMessageReporting": {
|
|
6
|
+
"ae-missing-release-tag": {
|
|
7
|
+
// TODO: Fix violations and remove this rule override
|
|
8
|
+
"logLevel": "none"
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
}
|
|
4
12
|
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
## API Report File for "@fluidframework/runtime-utils"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
9
|
+
import { IContainerContext } from '@fluidframework/container-definitions';
|
|
10
|
+
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
11
|
+
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
12
|
+
import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
13
|
+
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
|
|
14
|
+
import { IFluidRouter } from '@fluidframework/core-interfaces';
|
|
15
|
+
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
|
|
16
|
+
import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
17
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
18
|
+
import { IRequestHeader } from '@fluidframework/core-interfaces';
|
|
19
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
20
|
+
import { IRuntime } from '@fluidframework/container-definitions';
|
|
21
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
22
|
+
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
|
|
23
|
+
import { ISummarizeResult } from '@fluidframework/runtime-definitions';
|
|
24
|
+
import { ISummaryBlob } from '@fluidframework/protocol-definitions';
|
|
25
|
+
import { ISummaryStats } from '@fluidframework/runtime-definitions';
|
|
26
|
+
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
27
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
28
|
+
import { ITelemetryContext } from '@fluidframework/runtime-definitions';
|
|
29
|
+
import { ITree } from '@fluidframework/protocol-definitions';
|
|
30
|
+
import { SummaryObject } from '@fluidframework/protocol-definitions';
|
|
31
|
+
import { SummaryType } from '@fluidframework/protocol-definitions';
|
|
32
|
+
import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
33
|
+
|
|
34
|
+
// @public (undocumented)
|
|
35
|
+
export function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;
|
|
36
|
+
|
|
37
|
+
// @public (undocumented)
|
|
38
|
+
export function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
39
|
+
|
|
40
|
+
// @public (undocumented)
|
|
41
|
+
export function addTreeToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
42
|
+
|
|
43
|
+
// @public (undocumented)
|
|
44
|
+
export function calculateStats(summary: SummaryObject): ISummaryStats;
|
|
45
|
+
|
|
46
|
+
// @public
|
|
47
|
+
export function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTree): ISummaryTreeWithStats;
|
|
48
|
+
|
|
49
|
+
// @public
|
|
50
|
+
export function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;
|
|
51
|
+
|
|
52
|
+
// @public
|
|
53
|
+
export function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;
|
|
54
|
+
|
|
55
|
+
// @public
|
|
56
|
+
export function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
57
|
+
|
|
58
|
+
// @public (undocumented)
|
|
59
|
+
export const create404Response: (request: IRequest) => IResponse;
|
|
60
|
+
|
|
61
|
+
// @public (undocumented)
|
|
62
|
+
export function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
|
|
63
|
+
|
|
64
|
+
// @public (undocumented)
|
|
65
|
+
export function createResponseError(status: number, value: string, request: IRequest, headers?: {
|
|
66
|
+
[key: string]: any;
|
|
67
|
+
}): IResponse;
|
|
68
|
+
|
|
69
|
+
// @public (undocumented)
|
|
70
|
+
export function exceptionToResponse(err: any): IResponse;
|
|
71
|
+
|
|
72
|
+
// @public (undocumented)
|
|
73
|
+
export type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
|
|
74
|
+
|
|
75
|
+
// @internal
|
|
76
|
+
export class GCDataBuilder implements IGarbageCollectionData {
|
|
77
|
+
// (undocumented)
|
|
78
|
+
addNode(id: string, outboundRoutes: string[]): void;
|
|
79
|
+
// (undocumented)
|
|
80
|
+
addNodes(gcNodes: {
|
|
81
|
+
[id: string]: string[];
|
|
82
|
+
}): void;
|
|
83
|
+
addRouteToAllNodes(outboundRoute: string): void;
|
|
84
|
+
// (undocumented)
|
|
85
|
+
get gcNodes(): {
|
|
86
|
+
[id: string]: string[];
|
|
87
|
+
};
|
|
88
|
+
// (undocumented)
|
|
89
|
+
getGCData(): IGarbageCollectionData;
|
|
90
|
+
prefixAndAddNodes(prefixId: string, gcNodes: {
|
|
91
|
+
[id: string]: string[];
|
|
92
|
+
}): void;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// @public
|
|
96
|
+
export function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
|
|
97
|
+
|
|
98
|
+
// @public (undocumented)
|
|
99
|
+
export function getBlobSize(content: ISummaryBlob["content"]): number;
|
|
100
|
+
|
|
101
|
+
// @public (undocumented)
|
|
102
|
+
export function getNormalizedObjectStoragePathParts(path: string): string[];
|
|
103
|
+
|
|
104
|
+
// @public (undocumented)
|
|
105
|
+
export function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
|
|
106
|
+
|
|
107
|
+
// @public
|
|
108
|
+
export function mergeStats(...stats: ISummaryStats[]): ISummaryStats;
|
|
109
|
+
|
|
110
|
+
// @public
|
|
111
|
+
export class ObjectStoragePartition implements IChannelStorageService {
|
|
112
|
+
constructor(storage: IChannelStorageService, path: string);
|
|
113
|
+
// (undocumented)
|
|
114
|
+
contains(path: string): Promise<boolean>;
|
|
115
|
+
// (undocumented)
|
|
116
|
+
list(path: string): Promise<string[]>;
|
|
117
|
+
// (undocumented)
|
|
118
|
+
readBlob(path: string): Promise<ArrayBufferLike>;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// @public
|
|
122
|
+
export type ReadAndParseBlob = <T>(id: string) => Promise<T>;
|
|
123
|
+
|
|
124
|
+
// @public @deprecated (undocumented)
|
|
125
|
+
export function requestFluidObject<T = FluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;
|
|
126
|
+
|
|
127
|
+
// @public
|
|
128
|
+
export class RequestParser implements IRequest {
|
|
129
|
+
protected constructor(request: Readonly<IRequest>);
|
|
130
|
+
// (undocumented)
|
|
131
|
+
static create(request: Readonly<IRequest>): RequestParser;
|
|
132
|
+
createSubRequest(startingPathIndex: number): IRequest;
|
|
133
|
+
static getPathParts(url: string): readonly string[];
|
|
134
|
+
// (undocumented)
|
|
135
|
+
get headers(): IRequestHeader | undefined;
|
|
136
|
+
isLeaf(elements: number): boolean;
|
|
137
|
+
get pathParts(): readonly string[];
|
|
138
|
+
// (undocumented)
|
|
139
|
+
readonly query: string;
|
|
140
|
+
// (undocumented)
|
|
141
|
+
get url(): string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// @public (undocumented)
|
|
145
|
+
export function responseToException(response: IResponse, request: IRequest): Error;
|
|
146
|
+
|
|
147
|
+
// @public (undocumented)
|
|
148
|
+
export abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
|
|
149
|
+
// (undocumented)
|
|
150
|
+
hasInitialized(_runtime: T): Promise<void>;
|
|
151
|
+
// (undocumented)
|
|
152
|
+
instantiateFirstTime(_runtime: T): Promise<void>;
|
|
153
|
+
// (undocumented)
|
|
154
|
+
instantiateFromExisting(_runtime: T): Promise<void>;
|
|
155
|
+
// (undocumented)
|
|
156
|
+
instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
|
|
157
|
+
// (undocumented)
|
|
158
|
+
get IRuntimeFactory(): this;
|
|
159
|
+
// (undocumented)
|
|
160
|
+
abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// @public
|
|
164
|
+
export function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
|
|
165
|
+
|
|
166
|
+
// @public (undocumented)
|
|
167
|
+
export class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
168
|
+
constructor();
|
|
169
|
+
// (undocumented)
|
|
170
|
+
addAttachment(id: string): void;
|
|
171
|
+
// (undocumented)
|
|
172
|
+
addBlob(key: string, content: string | Uint8Array): void;
|
|
173
|
+
// (undocumented)
|
|
174
|
+
addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
|
|
175
|
+
// (undocumented)
|
|
176
|
+
addWithStats(key: string, summarizeResult: ISummarizeResult): void;
|
|
177
|
+
// (undocumented)
|
|
178
|
+
getSummaryTree(): ISummaryTreeWithStats;
|
|
179
|
+
// (undocumented)
|
|
180
|
+
get stats(): Readonly<ISummaryStats>;
|
|
181
|
+
// (undocumented)
|
|
182
|
+
get summary(): ISummaryTree;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// @public (undocumented)
|
|
186
|
+
export class TelemetryContext implements ITelemetryContext {
|
|
187
|
+
// (undocumented)
|
|
188
|
+
get(prefix: string, property: string): TelemetryEventPropertyType;
|
|
189
|
+
// (undocumented)
|
|
190
|
+
serialize(): string;
|
|
191
|
+
// (undocumented)
|
|
192
|
+
set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
|
|
193
|
+
// (undocumented)
|
|
194
|
+
setMultiple(prefix: string, property: string, values: Record<string, TelemetryEventPropertyType>): void;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// @public
|
|
198
|
+
export function unpackChildNodesUsedRoutes(usedRoutes: string[]): Map<string, string[]>;
|
|
199
|
+
|
|
200
|
+
// @public (undocumented)
|
|
201
|
+
export function utf8ByteLength(str: string): number;
|
|
202
|
+
|
|
203
|
+
// (No @packageDocumentation comment for this package)
|
|
204
|
+
|
|
205
|
+
```
|
|
@@ -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;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectstoragepartition.js","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAGpD;;GAEG;AACH,MAAa,sBAAsB;IAClC,
|
|
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"]}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
3
|
+
import { IContainerContext } from '@fluidframework/container-definitions';
|
|
4
|
+
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
5
|
+
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
6
|
+
import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
7
|
+
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { IFluidRouter } from '@fluidframework/core-interfaces';
|
|
9
|
+
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
|
|
10
|
+
import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
11
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
12
|
+
import { IRequestHeader } from '@fluidframework/core-interfaces';
|
|
13
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
14
|
+
import { IRuntime } from '@fluidframework/container-definitions';
|
|
15
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
16
|
+
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
|
|
17
|
+
import { ISummarizeResult } from '@fluidframework/runtime-definitions';
|
|
18
|
+
import { ISummaryBlob } from '@fluidframework/protocol-definitions';
|
|
19
|
+
import { ISummaryStats } from '@fluidframework/runtime-definitions';
|
|
20
|
+
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
21
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
22
|
+
import { ITelemetryContext } from '@fluidframework/runtime-definitions';
|
|
23
|
+
import { ITree } from '@fluidframework/protocol-definitions';
|
|
24
|
+
import { SummaryObject } from '@fluidframework/protocol-definitions';
|
|
25
|
+
import { SummaryType } from '@fluidframework/protocol-definitions';
|
|
26
|
+
import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
27
|
+
|
|
28
|
+
export declare function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;
|
|
29
|
+
|
|
30
|
+
export declare function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
31
|
+
|
|
32
|
+
export declare function addTreeToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
33
|
+
|
|
34
|
+
export declare function calculateStats(summary: SummaryObject): ISummaryStats;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was
|
|
38
|
+
* was taken by serialize api in detached container.
|
|
39
|
+
* @param snapshot - snapshot in ISnapshotTree format
|
|
40
|
+
*/
|
|
41
|
+
export declare function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTree): ISummaryTreeWithStats;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
|
|
45
|
+
* @param summaryTree - summary tree in ISummaryTree format
|
|
46
|
+
*/
|
|
47
|
+
export declare function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
51
|
+
* @param snapshot - snapshot in ITree format
|
|
52
|
+
* @param fullTree - true to never use handles, even if id is specified
|
|
53
|
+
*/
|
|
54
|
+
export declare function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
58
|
+
* @param snapshot - snapshot in ITree format
|
|
59
|
+
* @param fullTree - true to never use handles, even if id is specified
|
|
60
|
+
*/
|
|
61
|
+
export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
62
|
+
|
|
63
|
+
export declare const create404Response: (request: IRequest) => IResponse;
|
|
64
|
+
|
|
65
|
+
export declare function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
|
|
66
|
+
|
|
67
|
+
export declare function createResponseError(status: number, value: string, request: IRequest, headers?: {
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
}): IResponse;
|
|
70
|
+
|
|
71
|
+
export declare function exceptionToResponse(err: any): IResponse;
|
|
72
|
+
|
|
73
|
+
export declare type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
|
|
74
|
+
|
|
75
|
+
/* Excluded from this release type: GCDataBuilder */
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Generates the absolute path for a Fluid object given its path and its parent routeContext.
|
|
79
|
+
* @param path - The path to the Fluid object relative to the route context.
|
|
80
|
+
* @param routeContext - The route context that contains the Fluid object.
|
|
81
|
+
* @returns The absolute path to the Fluid object from the root of the Container.
|
|
82
|
+
*/
|
|
83
|
+
export declare function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
|
|
84
|
+
|
|
85
|
+
export declare function getBlobSize(content: ISummaryBlob["content"]): number;
|
|
86
|
+
|
|
87
|
+
export declare function getNormalizedObjectStoragePathParts(path: string): string[];
|
|
88
|
+
|
|
89
|
+
export declare function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Combines summary stats by adding their totals together.
|
|
93
|
+
* Returns empty stats if called without args.
|
|
94
|
+
* @param stats - stats to merge
|
|
95
|
+
*/
|
|
96
|
+
export declare function mergeStats(...stats: ISummaryStats[]): ISummaryStats;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Returns a new IChannelStorageService that resolves the given `path` as root.
|
|
100
|
+
*/
|
|
101
|
+
export declare class ObjectStoragePartition implements IChannelStorageService {
|
|
102
|
+
private readonly storage;
|
|
103
|
+
private readonly path;
|
|
104
|
+
constructor(storage: IChannelStorageService, path: string);
|
|
105
|
+
readBlob(path: string): Promise<ArrayBufferLike>;
|
|
106
|
+
contains(path: string): Promise<boolean>;
|
|
107
|
+
list(path: string): Promise<string[]>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Reads a blob from storage and parses it from JSON. */
|
|
111
|
+
export declare type ReadAndParseBlob = <T>(id: string) => Promise<T>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
115
|
+
*/
|
|
116
|
+
export declare function requestFluidObject<T = FluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The Request Parser takes an IRequest provides parsing and sub request creation
|
|
120
|
+
*/
|
|
121
|
+
export declare class RequestParser implements IRequest {
|
|
122
|
+
private readonly request;
|
|
123
|
+
/**
|
|
124
|
+
* Splits the path of the url and decodes each path part
|
|
125
|
+
* @param url - the url to get path parts of
|
|
126
|
+
*/
|
|
127
|
+
static getPathParts(url: string): readonly string[];
|
|
128
|
+
private requestPathParts;
|
|
129
|
+
readonly query: string;
|
|
130
|
+
static create(request: Readonly<IRequest>): RequestParser;
|
|
131
|
+
protected constructor(request: Readonly<IRequest>);
|
|
132
|
+
get url(): string;
|
|
133
|
+
get headers(): IRequestHeader | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Returns the decoded path parts of the request's url
|
|
136
|
+
*/
|
|
137
|
+
get pathParts(): readonly string[];
|
|
138
|
+
/**
|
|
139
|
+
* Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.
|
|
140
|
+
* @param elements - number of elements in path
|
|
141
|
+
*/
|
|
142
|
+
isLeaf(elements: number): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Creates a sub request starting at a specific path part of this request's url
|
|
145
|
+
* The sub request url always has a leading slash, and always include query params if original url has any
|
|
146
|
+
* e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams
|
|
147
|
+
* createSubRequest(1) is /b/?queryParams
|
|
148
|
+
* createSubRequest(2) is /?queryParams
|
|
149
|
+
* createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception
|
|
150
|
+
*
|
|
151
|
+
* note: query params are not counted towards path parts.
|
|
152
|
+
*
|
|
153
|
+
* @param startingPathIndex - The index of the first path part of the sub request
|
|
154
|
+
*/
|
|
155
|
+
createSubRequest(startingPathIndex: number): IRequest;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export declare function responseToException(response: IResponse, request: IRequest): Error;
|
|
159
|
+
|
|
160
|
+
export declare abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
|
|
161
|
+
get IRuntimeFactory(): this;
|
|
162
|
+
instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
|
|
163
|
+
abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;
|
|
164
|
+
instantiateFirstTime(_runtime: T): Promise<void>;
|
|
165
|
+
instantiateFromExisting(_runtime: T): Promise<void>;
|
|
166
|
+
hasInitialized(_runtime: T): Promise<void>;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Fetches the sequence number of the snapshot tree by examining the protocol.
|
|
171
|
+
* @param tree - snapshot tree to examine
|
|
172
|
+
* @param readAndParseBlob - function to read blob contents from storage
|
|
173
|
+
* and parse the result from JSON.
|
|
174
|
+
*/
|
|
175
|
+
export declare function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
|
|
176
|
+
|
|
177
|
+
export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
178
|
+
private attachmentCounter;
|
|
179
|
+
get summary(): ISummaryTree;
|
|
180
|
+
get stats(): Readonly<ISummaryStats>;
|
|
181
|
+
constructor();
|
|
182
|
+
private readonly summaryTree;
|
|
183
|
+
private summaryStats;
|
|
184
|
+
addBlob(key: string, content: string | Uint8Array): void;
|
|
185
|
+
addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
|
|
186
|
+
addWithStats(key: string, summarizeResult: ISummarizeResult): void;
|
|
187
|
+
addAttachment(id: string): void;
|
|
188
|
+
getSummaryTree(): ISummaryTreeWithStats;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export declare class TelemetryContext implements ITelemetryContext {
|
|
192
|
+
private readonly telemetry;
|
|
193
|
+
/**
|
|
194
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.set}
|
|
195
|
+
*/
|
|
196
|
+
set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
|
|
197
|
+
/**
|
|
198
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.setMultiple}
|
|
199
|
+
*/
|
|
200
|
+
setMultiple(prefix: string, property: string, values: Record<string, TelemetryEventPropertyType>): void;
|
|
201
|
+
/**
|
|
202
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.get}
|
|
203
|
+
*/
|
|
204
|
+
get(prefix: string, property: string): TelemetryEventPropertyType;
|
|
205
|
+
/**
|
|
206
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.serialize}
|
|
207
|
+
*/
|
|
208
|
+
serialize(): string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Helper function that unpacks the used routes of children from a given node's used routes.
|
|
213
|
+
* @param usedRoutes - The used routes of a node.
|
|
214
|
+
* @returns A map of used routes of each children of the the given node.
|
|
215
|
+
*/
|
|
216
|
+
export declare function unpackChildNodesUsedRoutes(usedRoutes: string[]): Map<string, string[]>;
|
|
217
|
+
|
|
218
|
+
export declare function utf8ByteLength(str: string): number;
|
|
219
|
+
|
|
220
|
+
export { }
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
3
|
+
import { IContainerContext } from '@fluidframework/container-definitions';
|
|
4
|
+
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
5
|
+
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
6
|
+
import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
7
|
+
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { IFluidRouter } from '@fluidframework/core-interfaces';
|
|
9
|
+
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
|
|
10
|
+
import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
11
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
12
|
+
import { IRequestHeader } from '@fluidframework/core-interfaces';
|
|
13
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
14
|
+
import { IRuntime } from '@fluidframework/container-definitions';
|
|
15
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
16
|
+
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
|
|
17
|
+
import { ISummarizeResult } from '@fluidframework/runtime-definitions';
|
|
18
|
+
import { ISummaryBlob } from '@fluidframework/protocol-definitions';
|
|
19
|
+
import { ISummaryStats } from '@fluidframework/runtime-definitions';
|
|
20
|
+
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
21
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
22
|
+
import { ITelemetryContext } from '@fluidframework/runtime-definitions';
|
|
23
|
+
import { ITree } from '@fluidframework/protocol-definitions';
|
|
24
|
+
import { SummaryObject } from '@fluidframework/protocol-definitions';
|
|
25
|
+
import { SummaryType } from '@fluidframework/protocol-definitions';
|
|
26
|
+
import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
27
|
+
|
|
28
|
+
export declare function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;
|
|
29
|
+
|
|
30
|
+
export declare function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
31
|
+
|
|
32
|
+
export declare function addTreeToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
33
|
+
|
|
34
|
+
export declare function calculateStats(summary: SummaryObject): ISummaryStats;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was
|
|
38
|
+
* was taken by serialize api in detached container.
|
|
39
|
+
* @param snapshot - snapshot in ISnapshotTree format
|
|
40
|
+
*/
|
|
41
|
+
export declare function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTree): ISummaryTreeWithStats;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
|
|
45
|
+
* @param summaryTree - summary tree in ISummaryTree format
|
|
46
|
+
*/
|
|
47
|
+
export declare function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
51
|
+
* @param snapshot - snapshot in ITree format
|
|
52
|
+
* @param fullTree - true to never use handles, even if id is specified
|
|
53
|
+
*/
|
|
54
|
+
export declare function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
58
|
+
* @param snapshot - snapshot in ITree format
|
|
59
|
+
* @param fullTree - true to never use handles, even if id is specified
|
|
60
|
+
*/
|
|
61
|
+
export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
62
|
+
|
|
63
|
+
export declare const create404Response: (request: IRequest) => IResponse;
|
|
64
|
+
|
|
65
|
+
export declare function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
|
|
66
|
+
|
|
67
|
+
export declare function createResponseError(status: number, value: string, request: IRequest, headers?: {
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
}): IResponse;
|
|
70
|
+
|
|
71
|
+
export declare function exceptionToResponse(err: any): IResponse;
|
|
72
|
+
|
|
73
|
+
export declare type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
|
|
74
|
+
|
|
75
|
+
/* Excluded from this release type: GCDataBuilder */
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Generates the absolute path for a Fluid object given its path and its parent routeContext.
|
|
79
|
+
* @param path - The path to the Fluid object relative to the route context.
|
|
80
|
+
* @param routeContext - The route context that contains the Fluid object.
|
|
81
|
+
* @returns The absolute path to the Fluid object from the root of the Container.
|
|
82
|
+
*/
|
|
83
|
+
export declare function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
|
|
84
|
+
|
|
85
|
+
export declare function getBlobSize(content: ISummaryBlob["content"]): number;
|
|
86
|
+
|
|
87
|
+
export declare function getNormalizedObjectStoragePathParts(path: string): string[];
|
|
88
|
+
|
|
89
|
+
export declare function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Combines summary stats by adding their totals together.
|
|
93
|
+
* Returns empty stats if called without args.
|
|
94
|
+
* @param stats - stats to merge
|
|
95
|
+
*/
|
|
96
|
+
export declare function mergeStats(...stats: ISummaryStats[]): ISummaryStats;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Returns a new IChannelStorageService that resolves the given `path` as root.
|
|
100
|
+
*/
|
|
101
|
+
export declare class ObjectStoragePartition implements IChannelStorageService {
|
|
102
|
+
private readonly storage;
|
|
103
|
+
private readonly path;
|
|
104
|
+
constructor(storage: IChannelStorageService, path: string);
|
|
105
|
+
readBlob(path: string): Promise<ArrayBufferLike>;
|
|
106
|
+
contains(path: string): Promise<boolean>;
|
|
107
|
+
list(path: string): Promise<string[]>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Reads a blob from storage and parses it from JSON. */
|
|
111
|
+
export declare type ReadAndParseBlob = <T>(id: string) => Promise<T>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
115
|
+
*/
|
|
116
|
+
export declare function requestFluidObject<T = FluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The Request Parser takes an IRequest provides parsing and sub request creation
|
|
120
|
+
*/
|
|
121
|
+
export declare class RequestParser implements IRequest {
|
|
122
|
+
private readonly request;
|
|
123
|
+
/**
|
|
124
|
+
* Splits the path of the url and decodes each path part
|
|
125
|
+
* @param url - the url to get path parts of
|
|
126
|
+
*/
|
|
127
|
+
static getPathParts(url: string): readonly string[];
|
|
128
|
+
private requestPathParts;
|
|
129
|
+
readonly query: string;
|
|
130
|
+
static create(request: Readonly<IRequest>): RequestParser;
|
|
131
|
+
protected constructor(request: Readonly<IRequest>);
|
|
132
|
+
get url(): string;
|
|
133
|
+
get headers(): IRequestHeader | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Returns the decoded path parts of the request's url
|
|
136
|
+
*/
|
|
137
|
+
get pathParts(): readonly string[];
|
|
138
|
+
/**
|
|
139
|
+
* Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.
|
|
140
|
+
* @param elements - number of elements in path
|
|
141
|
+
*/
|
|
142
|
+
isLeaf(elements: number): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Creates a sub request starting at a specific path part of this request's url
|
|
145
|
+
* The sub request url always has a leading slash, and always include query params if original url has any
|
|
146
|
+
* e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams
|
|
147
|
+
* createSubRequest(1) is /b/?queryParams
|
|
148
|
+
* createSubRequest(2) is /?queryParams
|
|
149
|
+
* createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception
|
|
150
|
+
*
|
|
151
|
+
* note: query params are not counted towards path parts.
|
|
152
|
+
*
|
|
153
|
+
* @param startingPathIndex - The index of the first path part of the sub request
|
|
154
|
+
*/
|
|
155
|
+
createSubRequest(startingPathIndex: number): IRequest;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export declare function responseToException(response: IResponse, request: IRequest): Error;
|
|
159
|
+
|
|
160
|
+
export declare abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
|
|
161
|
+
get IRuntimeFactory(): this;
|
|
162
|
+
instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
|
|
163
|
+
abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;
|
|
164
|
+
instantiateFirstTime(_runtime: T): Promise<void>;
|
|
165
|
+
instantiateFromExisting(_runtime: T): Promise<void>;
|
|
166
|
+
hasInitialized(_runtime: T): Promise<void>;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Fetches the sequence number of the snapshot tree by examining the protocol.
|
|
171
|
+
* @param tree - snapshot tree to examine
|
|
172
|
+
* @param readAndParseBlob - function to read blob contents from storage
|
|
173
|
+
* and parse the result from JSON.
|
|
174
|
+
*/
|
|
175
|
+
export declare function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
|
|
176
|
+
|
|
177
|
+
export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
178
|
+
private attachmentCounter;
|
|
179
|
+
get summary(): ISummaryTree;
|
|
180
|
+
get stats(): Readonly<ISummaryStats>;
|
|
181
|
+
constructor();
|
|
182
|
+
private readonly summaryTree;
|
|
183
|
+
private summaryStats;
|
|
184
|
+
addBlob(key: string, content: string | Uint8Array): void;
|
|
185
|
+
addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
|
|
186
|
+
addWithStats(key: string, summarizeResult: ISummarizeResult): void;
|
|
187
|
+
addAttachment(id: string): void;
|
|
188
|
+
getSummaryTree(): ISummaryTreeWithStats;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export declare class TelemetryContext implements ITelemetryContext {
|
|
192
|
+
private readonly telemetry;
|
|
193
|
+
/**
|
|
194
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.set}
|
|
195
|
+
*/
|
|
196
|
+
set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
|
|
197
|
+
/**
|
|
198
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.setMultiple}
|
|
199
|
+
*/
|
|
200
|
+
setMultiple(prefix: string, property: string, values: Record<string, TelemetryEventPropertyType>): void;
|
|
201
|
+
/**
|
|
202
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.get}
|
|
203
|
+
*/
|
|
204
|
+
get(prefix: string, property: string): TelemetryEventPropertyType;
|
|
205
|
+
/**
|
|
206
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.serialize}
|
|
207
|
+
*/
|
|
208
|
+
serialize(): string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Helper function that unpacks the used routes of children from a given node's used routes.
|
|
213
|
+
* @param usedRoutes - The used routes of a node.
|
|
214
|
+
* @returns A map of used routes of each children of the the given node.
|
|
215
|
+
*/
|
|
216
|
+
export declare function unpackChildNodesUsedRoutes(usedRoutes: string[]): Map<string, string[]>;
|
|
217
|
+
|
|
218
|
+
export declare function utf8ByteLength(str: string): number;
|
|
219
|
+
|
|
220
|
+
export { }
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
3
|
+
import { IContainerContext } from '@fluidframework/container-definitions';
|
|
4
|
+
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
5
|
+
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
6
|
+
import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
7
|
+
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { IFluidRouter } from '@fluidframework/core-interfaces';
|
|
9
|
+
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
|
|
10
|
+
import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
11
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
12
|
+
import { IRequestHeader } from '@fluidframework/core-interfaces';
|
|
13
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
14
|
+
import { IRuntime } from '@fluidframework/container-definitions';
|
|
15
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
16
|
+
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
|
|
17
|
+
import { ISummarizeResult } from '@fluidframework/runtime-definitions';
|
|
18
|
+
import { ISummaryBlob } from '@fluidframework/protocol-definitions';
|
|
19
|
+
import { ISummaryStats } from '@fluidframework/runtime-definitions';
|
|
20
|
+
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
21
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
22
|
+
import { ITelemetryContext } from '@fluidframework/runtime-definitions';
|
|
23
|
+
import { ITree } from '@fluidframework/protocol-definitions';
|
|
24
|
+
import { SummaryObject } from '@fluidframework/protocol-definitions';
|
|
25
|
+
import { SummaryType } from '@fluidframework/protocol-definitions';
|
|
26
|
+
import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
27
|
+
|
|
28
|
+
export declare function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;
|
|
29
|
+
|
|
30
|
+
export declare function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
31
|
+
|
|
32
|
+
export declare function addTreeToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
33
|
+
|
|
34
|
+
export declare function calculateStats(summary: SummaryObject): ISummaryStats;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was
|
|
38
|
+
* was taken by serialize api in detached container.
|
|
39
|
+
* @param snapshot - snapshot in ISnapshotTree format
|
|
40
|
+
*/
|
|
41
|
+
export declare function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTree): ISummaryTreeWithStats;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
|
|
45
|
+
* @param summaryTree - summary tree in ISummaryTree format
|
|
46
|
+
*/
|
|
47
|
+
export declare function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
51
|
+
* @param snapshot - snapshot in ITree format
|
|
52
|
+
* @param fullTree - true to never use handles, even if id is specified
|
|
53
|
+
*/
|
|
54
|
+
export declare function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
58
|
+
* @param snapshot - snapshot in ITree format
|
|
59
|
+
* @param fullTree - true to never use handles, even if id is specified
|
|
60
|
+
*/
|
|
61
|
+
export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
62
|
+
|
|
63
|
+
export declare const create404Response: (request: IRequest) => IResponse;
|
|
64
|
+
|
|
65
|
+
export declare function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
|
|
66
|
+
|
|
67
|
+
export declare function createResponseError(status: number, value: string, request: IRequest, headers?: {
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
}): IResponse;
|
|
70
|
+
|
|
71
|
+
export declare function exceptionToResponse(err: any): IResponse;
|
|
72
|
+
|
|
73
|
+
export declare type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
|
|
74
|
+
|
|
75
|
+
/* Excluded from this release type: GCDataBuilder */
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Generates the absolute path for a Fluid object given its path and its parent routeContext.
|
|
79
|
+
* @param path - The path to the Fluid object relative to the route context.
|
|
80
|
+
* @param routeContext - The route context that contains the Fluid object.
|
|
81
|
+
* @returns The absolute path to the Fluid object from the root of the Container.
|
|
82
|
+
*/
|
|
83
|
+
export declare function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
|
|
84
|
+
|
|
85
|
+
export declare function getBlobSize(content: ISummaryBlob["content"]): number;
|
|
86
|
+
|
|
87
|
+
export declare function getNormalizedObjectStoragePathParts(path: string): string[];
|
|
88
|
+
|
|
89
|
+
export declare function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Combines summary stats by adding their totals together.
|
|
93
|
+
* Returns empty stats if called without args.
|
|
94
|
+
* @param stats - stats to merge
|
|
95
|
+
*/
|
|
96
|
+
export declare function mergeStats(...stats: ISummaryStats[]): ISummaryStats;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Returns a new IChannelStorageService that resolves the given `path` as root.
|
|
100
|
+
*/
|
|
101
|
+
export declare class ObjectStoragePartition implements IChannelStorageService {
|
|
102
|
+
private readonly storage;
|
|
103
|
+
private readonly path;
|
|
104
|
+
constructor(storage: IChannelStorageService, path: string);
|
|
105
|
+
readBlob(path: string): Promise<ArrayBufferLike>;
|
|
106
|
+
contains(path: string): Promise<boolean>;
|
|
107
|
+
list(path: string): Promise<string[]>;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Reads a blob from storage and parses it from JSON. */
|
|
111
|
+
export declare type ReadAndParseBlob = <T>(id: string) => Promise<T>;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
115
|
+
*/
|
|
116
|
+
export declare function requestFluidObject<T = FluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* The Request Parser takes an IRequest provides parsing and sub request creation
|
|
120
|
+
*/
|
|
121
|
+
export declare class RequestParser implements IRequest {
|
|
122
|
+
private readonly request;
|
|
123
|
+
/**
|
|
124
|
+
* Splits the path of the url and decodes each path part
|
|
125
|
+
* @param url - the url to get path parts of
|
|
126
|
+
*/
|
|
127
|
+
static getPathParts(url: string): readonly string[];
|
|
128
|
+
private requestPathParts;
|
|
129
|
+
readonly query: string;
|
|
130
|
+
static create(request: Readonly<IRequest>): RequestParser;
|
|
131
|
+
protected constructor(request: Readonly<IRequest>);
|
|
132
|
+
get url(): string;
|
|
133
|
+
get headers(): IRequestHeader | undefined;
|
|
134
|
+
/**
|
|
135
|
+
* Returns the decoded path parts of the request's url
|
|
136
|
+
*/
|
|
137
|
+
get pathParts(): readonly string[];
|
|
138
|
+
/**
|
|
139
|
+
* Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.
|
|
140
|
+
* @param elements - number of elements in path
|
|
141
|
+
*/
|
|
142
|
+
isLeaf(elements: number): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* Creates a sub request starting at a specific path part of this request's url
|
|
145
|
+
* The sub request url always has a leading slash, and always include query params if original url has any
|
|
146
|
+
* e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams
|
|
147
|
+
* createSubRequest(1) is /b/?queryParams
|
|
148
|
+
* createSubRequest(2) is /?queryParams
|
|
149
|
+
* createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception
|
|
150
|
+
*
|
|
151
|
+
* note: query params are not counted towards path parts.
|
|
152
|
+
*
|
|
153
|
+
* @param startingPathIndex - The index of the first path part of the sub request
|
|
154
|
+
*/
|
|
155
|
+
createSubRequest(startingPathIndex: number): IRequest;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export declare function responseToException(response: IResponse, request: IRequest): Error;
|
|
159
|
+
|
|
160
|
+
export declare abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
|
|
161
|
+
get IRuntimeFactory(): this;
|
|
162
|
+
instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
|
|
163
|
+
abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;
|
|
164
|
+
instantiateFirstTime(_runtime: T): Promise<void>;
|
|
165
|
+
instantiateFromExisting(_runtime: T): Promise<void>;
|
|
166
|
+
hasInitialized(_runtime: T): Promise<void>;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Fetches the sequence number of the snapshot tree by examining the protocol.
|
|
171
|
+
* @param tree - snapshot tree to examine
|
|
172
|
+
* @param readAndParseBlob - function to read blob contents from storage
|
|
173
|
+
* and parse the result from JSON.
|
|
174
|
+
*/
|
|
175
|
+
export declare function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
|
|
176
|
+
|
|
177
|
+
export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
178
|
+
private attachmentCounter;
|
|
179
|
+
get summary(): ISummaryTree;
|
|
180
|
+
get stats(): Readonly<ISummaryStats>;
|
|
181
|
+
constructor();
|
|
182
|
+
private readonly summaryTree;
|
|
183
|
+
private summaryStats;
|
|
184
|
+
addBlob(key: string, content: string | Uint8Array): void;
|
|
185
|
+
addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
|
|
186
|
+
addWithStats(key: string, summarizeResult: ISummarizeResult): void;
|
|
187
|
+
addAttachment(id: string): void;
|
|
188
|
+
getSummaryTree(): ISummaryTreeWithStats;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export declare class TelemetryContext implements ITelemetryContext {
|
|
192
|
+
private readonly telemetry;
|
|
193
|
+
/**
|
|
194
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.set}
|
|
195
|
+
*/
|
|
196
|
+
set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
|
|
197
|
+
/**
|
|
198
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.setMultiple}
|
|
199
|
+
*/
|
|
200
|
+
setMultiple(prefix: string, property: string, values: Record<string, TelemetryEventPropertyType>): void;
|
|
201
|
+
/**
|
|
202
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.get}
|
|
203
|
+
*/
|
|
204
|
+
get(prefix: string, property: string): TelemetryEventPropertyType;
|
|
205
|
+
/**
|
|
206
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.serialize}
|
|
207
|
+
*/
|
|
208
|
+
serialize(): string;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Helper function that unpacks the used routes of children from a given node's used routes.
|
|
213
|
+
* @param usedRoutes - The used routes of a node.
|
|
214
|
+
* @returns A map of used routes of each children of the the given node.
|
|
215
|
+
*/
|
|
216
|
+
export declare function unpackChildNodesUsedRoutes(usedRoutes: string[]): Map<string, string[]>;
|
|
217
|
+
|
|
218
|
+
export declare function utf8ByteLength(str: string): number;
|
|
219
|
+
|
|
220
|
+
export { }
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { FluidObject } from '@fluidframework/core-interfaces';
|
|
2
|
+
import { IChannelStorageService } from '@fluidframework/datastore-definitions';
|
|
3
|
+
import { IContainerContext } from '@fluidframework/container-definitions';
|
|
4
|
+
import { IContainerRuntime } from '@fluidframework/container-runtime-definitions';
|
|
5
|
+
import { IFluidDataStoreFactory } from '@fluidframework/runtime-definitions';
|
|
6
|
+
import { IFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
7
|
+
import { IFluidHandleContext } from '@fluidframework/core-interfaces';
|
|
8
|
+
import { IFluidRouter } from '@fluidframework/core-interfaces';
|
|
9
|
+
import { IGarbageCollectionData } from '@fluidframework/runtime-definitions';
|
|
10
|
+
import { IProvideFluidDataStoreRegistry } from '@fluidframework/runtime-definitions';
|
|
11
|
+
import { IRequest } from '@fluidframework/core-interfaces';
|
|
12
|
+
import { IRequestHeader } from '@fluidframework/core-interfaces';
|
|
13
|
+
import { IResponse } from '@fluidframework/core-interfaces';
|
|
14
|
+
import { IRuntime } from '@fluidframework/container-definitions';
|
|
15
|
+
import { IRuntimeFactory } from '@fluidframework/container-definitions';
|
|
16
|
+
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
|
|
17
|
+
import { ISummarizeResult } from '@fluidframework/runtime-definitions';
|
|
18
|
+
import { ISummaryBlob } from '@fluidframework/protocol-definitions';
|
|
19
|
+
import { ISummaryStats } from '@fluidframework/runtime-definitions';
|
|
20
|
+
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
21
|
+
import { ISummaryTreeWithStats } from '@fluidframework/runtime-definitions';
|
|
22
|
+
import { ITelemetryContext } from '@fluidframework/runtime-definitions';
|
|
23
|
+
import { ITree } from '@fluidframework/protocol-definitions';
|
|
24
|
+
import { SummaryObject } from '@fluidframework/protocol-definitions';
|
|
25
|
+
import { SummaryType } from '@fluidframework/protocol-definitions';
|
|
26
|
+
import { TelemetryEventPropertyType } from '@fluidframework/core-interfaces';
|
|
27
|
+
|
|
28
|
+
export declare function addBlobToSummary(summary: ISummaryTreeWithStats, key: string, content: string | Uint8Array): void;
|
|
29
|
+
|
|
30
|
+
export declare function addSummarizeResultToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
31
|
+
|
|
32
|
+
export declare function addTreeToSummary(summary: ISummaryTreeWithStats, key: string, summarizeResult: ISummarizeResult): void;
|
|
33
|
+
|
|
34
|
+
export declare function calculateStats(summary: SummaryObject): ISummaryStats;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Converts ISnapshotTree to ISummaryTree format and tracks stats. This snapshot tree was
|
|
38
|
+
* was taken by serialize api in detached container.
|
|
39
|
+
* @param snapshot - snapshot in ISnapshotTree format
|
|
40
|
+
*/
|
|
41
|
+
export declare function convertSnapshotTreeToSummaryTree(snapshot: ISnapshotTree): ISummaryTreeWithStats;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Converts ISummaryTree to ITree format. This is needed for back-compat while we get rid of snapshot.
|
|
45
|
+
* @param summaryTree - summary tree in ISummaryTree format
|
|
46
|
+
*/
|
|
47
|
+
export declare function convertSummaryTreeToITree(summaryTree: ISummaryTree): ITree;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
51
|
+
* @param snapshot - snapshot in ITree format
|
|
52
|
+
* @param fullTree - true to never use handles, even if id is specified
|
|
53
|
+
*/
|
|
54
|
+
export declare function convertToSummaryTree(snapshot: ITree, fullTree?: boolean): ISummarizeResult;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Converts snapshot ITree to ISummaryTree format and tracks stats.
|
|
58
|
+
* @param snapshot - snapshot in ITree format
|
|
59
|
+
* @param fullTree - true to never use handles, even if id is specified
|
|
60
|
+
*/
|
|
61
|
+
export declare function convertToSummaryTreeWithStats(snapshot: ITree, fullTree?: boolean): ISummaryTreeWithStats;
|
|
62
|
+
|
|
63
|
+
export declare const create404Response: (request: IRequest) => IResponse;
|
|
64
|
+
|
|
65
|
+
export declare function createDataStoreFactory(type: string, factory: Factory | Promise<Factory>): IFluidDataStoreFactory & IFluidDataStoreRegistry;
|
|
66
|
+
|
|
67
|
+
export declare function createResponseError(status: number, value: string, request: IRequest, headers?: {
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
}): IResponse;
|
|
70
|
+
|
|
71
|
+
export declare function exceptionToResponse(err: any): IResponse;
|
|
72
|
+
|
|
73
|
+
export declare type Factory = IFluidDataStoreFactory & Partial<IProvideFluidDataStoreRegistry>;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Helper class to build the garbage collection data of a node by combining the data from multiple nodes.
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
export declare class GCDataBuilder implements IGarbageCollectionData {
|
|
80
|
+
private readonly gcNodesSet;
|
|
81
|
+
get gcNodes(): {
|
|
82
|
+
[id: string]: string[];
|
|
83
|
+
};
|
|
84
|
+
addNode(id: string, outboundRoutes: string[]): void;
|
|
85
|
+
/**
|
|
86
|
+
* Adds the given GC nodes. It does the following:
|
|
87
|
+
* - Normalizes the ids of the given nodes.
|
|
88
|
+
* - Prefixes the given `prefixId` to the given nodes' ids.
|
|
89
|
+
* - Adds the outbound routes of the nodes against the normalized and prefixed id.
|
|
90
|
+
*/
|
|
91
|
+
prefixAndAddNodes(prefixId: string, gcNodes: {
|
|
92
|
+
[id: string]: string[];
|
|
93
|
+
}): void;
|
|
94
|
+
addNodes(gcNodes: {
|
|
95
|
+
[id: string]: string[];
|
|
96
|
+
}): void;
|
|
97
|
+
/**
|
|
98
|
+
* Adds the given outbound route to the outbound routes of all GC nodes.
|
|
99
|
+
*/
|
|
100
|
+
addRouteToAllNodes(outboundRoute: string): void;
|
|
101
|
+
getGCData(): IGarbageCollectionData;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Generates the absolute path for a Fluid object given its path and its parent routeContext.
|
|
106
|
+
* @param path - The path to the Fluid object relative to the route context.
|
|
107
|
+
* @param routeContext - The route context that contains the Fluid object.
|
|
108
|
+
* @returns The absolute path to the Fluid object from the root of the Container.
|
|
109
|
+
*/
|
|
110
|
+
export declare function generateHandleContextPath(path: string, routeContext?: IFluidHandleContext): string;
|
|
111
|
+
|
|
112
|
+
export declare function getBlobSize(content: ISummaryBlob["content"]): number;
|
|
113
|
+
|
|
114
|
+
export declare function getNormalizedObjectStoragePathParts(path: string): string[];
|
|
115
|
+
|
|
116
|
+
export declare function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]>;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Combines summary stats by adding their totals together.
|
|
120
|
+
* Returns empty stats if called without args.
|
|
121
|
+
* @param stats - stats to merge
|
|
122
|
+
*/
|
|
123
|
+
export declare function mergeStats(...stats: ISummaryStats[]): ISummaryStats;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Returns a new IChannelStorageService that resolves the given `path` as root.
|
|
127
|
+
*/
|
|
128
|
+
export declare class ObjectStoragePartition implements IChannelStorageService {
|
|
129
|
+
private readonly storage;
|
|
130
|
+
private readonly path;
|
|
131
|
+
constructor(storage: IChannelStorageService, path: string);
|
|
132
|
+
readBlob(path: string): Promise<ArrayBufferLike>;
|
|
133
|
+
contains(path: string): Promise<boolean>;
|
|
134
|
+
list(path: string): Promise<string[]>;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Reads a blob from storage and parses it from JSON. */
|
|
138
|
+
export declare type ReadAndParseBlob = <T>(id: string) => Promise<T>;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @deprecated Will be removed in future major release. Migrate all usage of IFluidRouter to the "entryPoint" pattern. Refer to Removing-IFluidRouter.md
|
|
142
|
+
*/
|
|
143
|
+
export declare function requestFluidObject<T = FluidObject>(router: IFluidRouter, url: string | IRequest): Promise<T>;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* The Request Parser takes an IRequest provides parsing and sub request creation
|
|
147
|
+
*/
|
|
148
|
+
export declare class RequestParser implements IRequest {
|
|
149
|
+
private readonly request;
|
|
150
|
+
/**
|
|
151
|
+
* Splits the path of the url and decodes each path part
|
|
152
|
+
* @param url - the url to get path parts of
|
|
153
|
+
*/
|
|
154
|
+
static getPathParts(url: string): readonly string[];
|
|
155
|
+
private requestPathParts;
|
|
156
|
+
readonly query: string;
|
|
157
|
+
static create(request: Readonly<IRequest>): RequestParser;
|
|
158
|
+
protected constructor(request: Readonly<IRequest>);
|
|
159
|
+
get url(): string;
|
|
160
|
+
get headers(): IRequestHeader | undefined;
|
|
161
|
+
/**
|
|
162
|
+
* Returns the decoded path parts of the request's url
|
|
163
|
+
*/
|
|
164
|
+
get pathParts(): readonly string[];
|
|
165
|
+
/**
|
|
166
|
+
* Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.
|
|
167
|
+
* @param elements - number of elements in path
|
|
168
|
+
*/
|
|
169
|
+
isLeaf(elements: number): boolean;
|
|
170
|
+
/**
|
|
171
|
+
* Creates a sub request starting at a specific path part of this request's url
|
|
172
|
+
* The sub request url always has a leading slash, and always include query params if original url has any
|
|
173
|
+
* e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams
|
|
174
|
+
* createSubRequest(1) is /b/?queryParams
|
|
175
|
+
* createSubRequest(2) is /?queryParams
|
|
176
|
+
* createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception
|
|
177
|
+
*
|
|
178
|
+
* note: query params are not counted towards path parts.
|
|
179
|
+
*
|
|
180
|
+
* @param startingPathIndex - The index of the first path part of the sub request
|
|
181
|
+
*/
|
|
182
|
+
createSubRequest(startingPathIndex: number): IRequest;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export declare function responseToException(response: IResponse, request: IRequest): Error;
|
|
186
|
+
|
|
187
|
+
export declare abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {
|
|
188
|
+
get IRuntimeFactory(): this;
|
|
189
|
+
instantiateRuntime(context: IContainerContext, existing: boolean): Promise<IRuntime>;
|
|
190
|
+
abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;
|
|
191
|
+
instantiateFirstTime(_runtime: T): Promise<void>;
|
|
192
|
+
instantiateFromExisting(_runtime: T): Promise<void>;
|
|
193
|
+
hasInitialized(_runtime: T): Promise<void>;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Fetches the sequence number of the snapshot tree by examining the protocol.
|
|
198
|
+
* @param tree - snapshot tree to examine
|
|
199
|
+
* @param readAndParseBlob - function to read blob contents from storage
|
|
200
|
+
* and parse the result from JSON.
|
|
201
|
+
*/
|
|
202
|
+
export declare function seqFromTree(tree: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<number>;
|
|
203
|
+
|
|
204
|
+
export declare class SummaryTreeBuilder implements ISummaryTreeWithStats {
|
|
205
|
+
private attachmentCounter;
|
|
206
|
+
get summary(): ISummaryTree;
|
|
207
|
+
get stats(): Readonly<ISummaryStats>;
|
|
208
|
+
constructor();
|
|
209
|
+
private readonly summaryTree;
|
|
210
|
+
private summaryStats;
|
|
211
|
+
addBlob(key: string, content: string | Uint8Array): void;
|
|
212
|
+
addHandle(key: string, handleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment, handle: string): void;
|
|
213
|
+
addWithStats(key: string, summarizeResult: ISummarizeResult): void;
|
|
214
|
+
addAttachment(id: string): void;
|
|
215
|
+
getSummaryTree(): ISummaryTreeWithStats;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export declare class TelemetryContext implements ITelemetryContext {
|
|
219
|
+
private readonly telemetry;
|
|
220
|
+
/**
|
|
221
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.set}
|
|
222
|
+
*/
|
|
223
|
+
set(prefix: string, property: string, value: TelemetryEventPropertyType): void;
|
|
224
|
+
/**
|
|
225
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.setMultiple}
|
|
226
|
+
*/
|
|
227
|
+
setMultiple(prefix: string, property: string, values: Record<string, TelemetryEventPropertyType>): void;
|
|
228
|
+
/**
|
|
229
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.get}
|
|
230
|
+
*/
|
|
231
|
+
get(prefix: string, property: string): TelemetryEventPropertyType;
|
|
232
|
+
/**
|
|
233
|
+
* {@inheritDoc @fluidframework/runtime-definitions#ITelemetryContext.serialize}
|
|
234
|
+
*/
|
|
235
|
+
serialize(): string;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Helper function that unpacks the used routes of children from a given node's used routes.
|
|
240
|
+
* @param usedRoutes - The used routes of a node.
|
|
241
|
+
* @returns A map of used routes of each children of the the given node.
|
|
242
|
+
*/
|
|
243
|
+
export declare function unpackChildNodesUsedRoutes(usedRoutes: string[]): Map<string, string[]>;
|
|
244
|
+
|
|
245
|
+
export declare function utf8ByteLength(str: string): number;
|
|
246
|
+
|
|
247
|
+
export { }
|
package/dist/tsdoc-metadata.json
CHANGED
|
@@ -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;
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"objectstoragepartition.js","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAClC,
|
|
1
|
+
{"version":3,"file":"objectstoragepartition.js","sourceRoot":"","sources":["../src/objectstoragepartition.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAClC,YACkB,OAA+B,EAC/B,IAAY;QADZ,YAAO,GAAP,OAAO,CAAwB;QAC/B,SAAI,GAAJ,IAAI,CAAQ;QAE7B,kDAAkD;QAClD,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,mDAAmD,CAAC,CAAC;IACxF,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,IAAI,CAAC,IAAY;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IChannelStorageService } from \"@fluidframework/datastore-definitions\";\n\n/**\n * Returns a new IChannelStorageService that resolves the given `path` as root.\n */\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/runtime-utils",
|
|
3
|
-
"version": "2.0.0-internal.7.
|
|
3
|
+
"version": "2.0.0-internal.7.1.0",
|
|
4
4
|
"description": "Collection of utility functions for Fluid Runtime",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -35,36 +35,36 @@
|
|
|
35
35
|
"temp-directory": "nyc/.nyc_output"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@fluid-internal/client-utils": ">=2.0.0-internal.7.
|
|
39
|
-
"@fluidframework/container-definitions": ">=2.0.0-internal.7.
|
|
40
|
-
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.7.
|
|
41
|
-
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.
|
|
42
|
-
"@fluidframework/core-utils": ">=2.0.0-internal.7.
|
|
43
|
-
"@fluidframework/datastore-definitions": ">=2.0.0-internal.7.
|
|
44
|
-
"@fluidframework/driver-utils": ">=2.0.0-internal.7.
|
|
38
|
+
"@fluid-internal/client-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
39
|
+
"@fluidframework/container-definitions": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
40
|
+
"@fluidframework/container-runtime-definitions": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
41
|
+
"@fluidframework/core-interfaces": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
42
|
+
"@fluidframework/core-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
43
|
+
"@fluidframework/datastore-definitions": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
44
|
+
"@fluidframework/driver-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
45
45
|
"@fluidframework/protocol-definitions": "^3.0.0",
|
|
46
|
-
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.
|
|
47
|
-
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.
|
|
46
|
+
"@fluidframework/runtime-definitions": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
47
|
+
"@fluidframework/telemetry-utils": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@fluid-tools/build-cli": "^0.
|
|
51
|
-
"@fluidframework/build-common": "^2.0.
|
|
52
|
-
"@fluidframework/build-tools": "^0.
|
|
53
|
-
"@fluidframework/eslint-config-fluid": "^
|
|
54
|
-
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.
|
|
55
|
-
"@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@2.0.0-internal.
|
|
50
|
+
"@fluid-tools/build-cli": "^0.25.0",
|
|
51
|
+
"@fluidframework/build-common": "^2.0.1",
|
|
52
|
+
"@fluidframework/build-tools": "^0.25.0",
|
|
53
|
+
"@fluidframework/eslint-config-fluid": "^3.0.0",
|
|
54
|
+
"@fluidframework/mocha-test-setup": ">=2.0.0-internal.7.1.0 <2.0.0-internal.7.2.0",
|
|
55
|
+
"@fluidframework/runtime-utils-previous": "npm:@fluidframework/runtime-utils@2.0.0-internal.7.0.0",
|
|
56
56
|
"@microsoft/api-extractor": "^7.37.0",
|
|
57
57
|
"@types/mocha": "^9.1.1",
|
|
58
58
|
"@types/node": "^16.18.38",
|
|
59
59
|
"c8": "^7.7.1",
|
|
60
60
|
"copyfiles": "^2.4.1",
|
|
61
61
|
"cross-env": "^7.0.3",
|
|
62
|
-
"eslint": "~8.
|
|
62
|
+
"eslint": "~8.50.0",
|
|
63
63
|
"mocha": "^10.2.0",
|
|
64
64
|
"mocha-json-output-reporter": "^2.0.1",
|
|
65
65
|
"mocha-multi-reporters": "^1.5.1",
|
|
66
66
|
"moment": "^2.21.0",
|
|
67
|
-
"prettier": "~
|
|
67
|
+
"prettier": "~3.0.3",
|
|
68
68
|
"rimraf": "^4.4.0",
|
|
69
69
|
"sinon": "^7.4.2",
|
|
70
70
|
"ts-node": "^10.9.1",
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
"build": "fluid-build . --task build",
|
|
78
78
|
"build:commonjs": "fluid-build . --task commonjs",
|
|
79
79
|
"build:compile": "fluid-build . --task compile",
|
|
80
|
-
"build:docs": "api-extractor run --local
|
|
80
|
+
"build:docs": "api-extractor run --local",
|
|
81
81
|
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
82
82
|
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
83
|
-
"ci:build:docs": "api-extractor run
|
|
83
|
+
"ci:build:docs": "api-extractor run",
|
|
84
84
|
"clean": "rimraf --glob 'dist' 'lib' '*.tsbuildinfo' '*.build.log' '_api-extractor-temp' 'nyc'",
|
|
85
85
|
"eslint": "eslint --format stylish src",
|
|
86
86
|
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
@@ -10,7 +10,10 @@ import { IChannelStorageService } from "@fluidframework/datastore-definitions";
|
|
|
10
10
|
* Returns a new IChannelStorageService that resolves the given `path` as root.
|
|
11
11
|
*/
|
|
12
12
|
export class ObjectStoragePartition implements IChannelStorageService {
|
|
13
|
-
constructor(
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly storage: IChannelStorageService,
|
|
15
|
+
private readonly path: string,
|
|
16
|
+
) {
|
|
14
17
|
// `path` must not include the trailing separator.
|
|
15
18
|
assert(!path.endsWith("/"), 0x19c /* "storage service path has trailing separator" */);
|
|
16
19
|
}
|