@fluidframework/routerlicious-driver 2.0.0-rc.1.0.3 → 2.0.0-rc.2.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.
- package/{.eslintrc.js → .eslintrc.cjs} +4 -1
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +32 -0
- package/api-report/routerlicious-driver.api.md +6 -9
- package/dist/contracts.d.ts +1 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js.map +1 -1
- package/dist/deltaStorageService.js.map +1 -1
- package/dist/documentService.d.ts +2 -1
- package/dist/documentService.d.ts.map +1 -1
- package/dist/documentService.js +5 -3
- package/dist/documentService.js.map +1 -1
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js +11 -9
- package/dist/documentServiceFactory.js.map +1 -1
- package/dist/errorUtils.d.ts +1 -18
- package/dist/errorUtils.d.ts.map +1 -1
- package/dist/errorUtils.js +2 -20
- package/dist/errorUtils.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/nullBlobStorageService.d.ts +0 -1
- package/dist/nullBlobStorageService.d.ts.map +1 -1
- package/dist/nullBlobStorageService.js +0 -3
- package/dist/nullBlobStorageService.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/policies.d.ts +0 -6
- package/dist/policies.d.ts.map +1 -1
- package/dist/policies.js.map +1 -1
- package/dist/r11sSnapshotParser.d.ts.map +1 -1
- package/dist/r11sSnapshotParser.js +1 -0
- package/dist/r11sSnapshotParser.js.map +1 -1
- package/dist/restWrapper.d.ts +3 -3
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/restWrapper.js.map +1 -1
- package/dist/routerlicious-driver-alpha.d.ts +25 -4
- package/dist/routerlicious-driver-beta.d.ts +3 -4
- package/dist/routerlicious-driver-public.d.ts +3 -4
- package/dist/routerlicious-driver-untrimmed.d.ts +23 -24
- package/dist/routerliciousResolvedUrl.d.ts +34 -0
- package/dist/routerliciousResolvedUrl.d.ts.map +1 -0
- package/dist/routerliciousResolvedUrl.js +14 -0
- package/dist/routerliciousResolvedUrl.js.map +1 -0
- package/dist/shreddedSummaryDocumentStorageService.d.ts +0 -1
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.js +0 -1
- package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/dist/tokens.d.ts +1 -2
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js.map +1 -1
- package/dist/treeUtils.d.ts +1 -0
- package/dist/treeUtils.d.ts.map +1 -1
- package/dist/treeUtils.js +2 -0
- package/dist/treeUtils.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/urlUtils.d.ts +0 -2
- package/dist/urlUtils.d.ts.map +1 -1
- package/dist/urlUtils.js +9 -17
- package/dist/urlUtils.js.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts +0 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.js +0 -1
- package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
- package/lib/contracts.d.mts +1 -0
- package/lib/contracts.d.mts.map +1 -1
- package/lib/contracts.mjs.map +1 -1
- package/lib/deltaStorageService.mjs.map +1 -1
- package/lib/documentService.d.mts +2 -1
- package/lib/documentService.d.mts.map +1 -1
- package/lib/documentService.mjs +5 -3
- package/lib/documentService.mjs.map +1 -1
- package/lib/documentServiceFactory.d.mts.map +1 -1
- package/lib/documentServiceFactory.mjs +12 -10
- package/lib/documentServiceFactory.mjs.map +1 -1
- package/lib/errorUtils.d.mts +1 -18
- package/lib/errorUtils.d.mts.map +1 -1
- package/lib/errorUtils.mjs +1 -19
- package/lib/errorUtils.mjs.map +1 -1
- package/lib/index.d.mts +2 -1
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/nullBlobStorageService.d.mts +0 -1
- package/lib/nullBlobStorageService.d.mts.map +1 -1
- package/lib/nullBlobStorageService.mjs +0 -3
- package/lib/nullBlobStorageService.mjs.map +1 -1
- package/lib/packageVersion.d.mts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/policies.d.mts +0 -6
- package/lib/policies.d.mts.map +1 -1
- package/lib/policies.mjs.map +1 -1
- package/lib/r11sSnapshotParser.d.mts.map +1 -1
- package/lib/r11sSnapshotParser.mjs +1 -0
- package/lib/r11sSnapshotParser.mjs.map +1 -1
- package/lib/restWrapper.d.mts +3 -3
- package/lib/restWrapper.d.mts.map +1 -1
- package/lib/restWrapper.mjs.map +1 -1
- package/lib/routerlicious-driver-alpha.d.mts +25 -4
- package/lib/routerlicious-driver-beta.d.mts +3 -4
- package/lib/routerlicious-driver-public.d.mts +3 -4
- package/lib/routerlicious-driver-untrimmed.d.mts +23 -24
- package/lib/routerliciousResolvedUrl.d.mts +34 -0
- package/lib/routerliciousResolvedUrl.d.mts.map +1 -0
- package/lib/routerliciousResolvedUrl.mjs +10 -0
- package/lib/routerliciousResolvedUrl.mjs.map +1 -0
- package/lib/shreddedSummaryDocumentStorageService.d.mts +0 -1
- package/lib/shreddedSummaryDocumentStorageService.d.mts.map +1 -1
- package/lib/shreddedSummaryDocumentStorageService.mjs +0 -1
- package/lib/shreddedSummaryDocumentStorageService.mjs.map +1 -1
- package/lib/tokens.d.mts +1 -2
- package/lib/tokens.d.mts.map +1 -1
- package/lib/tokens.mjs.map +1 -1
- package/lib/treeUtils.d.mts +1 -0
- package/lib/treeUtils.d.mts.map +1 -1
- package/lib/treeUtils.mjs +2 -0
- package/lib/treeUtils.mjs.map +1 -1
- package/lib/urlUtils.d.mts +0 -2
- package/lib/urlUtils.d.mts.map +1 -1
- package/lib/urlUtils.mjs +8 -12
- package/lib/urlUtils.mjs.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.d.mts +0 -1
- package/lib/wholeSummaryDocumentStorageService.d.mts.map +1 -1
- package/lib/wholeSummaryDocumentStorageService.mjs +0 -1
- package/lib/wholeSummaryDocumentStorageService.mjs.map +1 -1
- package/package.json +31 -25
- package/src/contracts.ts +1 -0
- package/src/deltaStorageService.ts +3 -3
- package/src/documentService.ts +10 -4
- package/src/documentServiceFactory.ts +16 -13
- package/src/errorUtils.ts +2 -21
- package/src/index.ts +4 -1
- package/src/nullBlobStorageService.ts +0 -4
- package/src/packageVersion.ts +1 -1
- package/src/policies.ts +0 -6
- package/src/r11sSnapshotParser.ts +1 -0
- package/src/restWrapper.ts +3 -3
- package/src/routerliciousResolvedUrl.ts +39 -0
- package/src/shreddedSummaryDocumentStorageService.ts +0 -2
- package/src/tokens.ts +1 -2
- package/src/treeUtils.ts +3 -0
- package/src/urlUtils.ts +8 -13
- package/src/wholeSummaryDocumentStorageService.ts +0 -2
package/src/restWrapper.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { ITelemetryBaseProperties } from "@fluidframework/core-interfaces";
|
|
7
7
|
import {
|
|
8
8
|
ITelemetryLoggerExt,
|
|
9
9
|
PerformanceEvent,
|
|
@@ -49,7 +49,7 @@ const axiosRequestConfigToFetchRequestConfig = (
|
|
|
49
49
|
export interface IR11sResponse<T> {
|
|
50
50
|
content: T;
|
|
51
51
|
headers: Map<string, string>;
|
|
52
|
-
propsToLog:
|
|
52
|
+
propsToLog: ITelemetryBaseProperties;
|
|
53
53
|
requestUrl: string;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -91,7 +91,7 @@ export function getPropsToLogFromResponse(headers: {
|
|
|
91
91
|
{ headerName: "content-encoding", logName: "contentEncoding" },
|
|
92
92
|
{ headerName: "content-type", logName: "contentType" },
|
|
93
93
|
];
|
|
94
|
-
const additionalProps:
|
|
94
|
+
const additionalProps: ITelemetryBaseProperties = {
|
|
95
95
|
contentsize: numberFromString(headers.get("content-length")),
|
|
96
96
|
};
|
|
97
97
|
headersToLog.forEach((header) => {
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Routerlicious extends the resolved url with additional properties to control Routerlicious-specific behaviors.
|
|
10
|
+
*
|
|
11
|
+
* @privateRemarks
|
|
12
|
+
* {@link isRouterliciousResolvedUrl} can be used to detect whether an {@link @fluidframework/driver-definitions#IResolvedUrl}
|
|
13
|
+
* is an IRouterliciousResolvedUrl.
|
|
14
|
+
*
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
export interface IRouterliciousResolvedUrl extends IResolvedUrl {
|
|
18
|
+
/**
|
|
19
|
+
* A flag to facilitate type narrowing from {@link @fluidframework/driver-definitions#IResolvedUrl} to IRouterliciousResolvedUrl.
|
|
20
|
+
*/
|
|
21
|
+
routerliciousResolvedUrl: true;
|
|
22
|
+
/**
|
|
23
|
+
* Controls whether a newly created container will be ephemeral, which means the service will not retain it
|
|
24
|
+
* after the collaboration session ends. Only affects
|
|
25
|
+
* {@link @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer} requests.
|
|
26
|
+
*
|
|
27
|
+
* @defaultValue If left undefined, treated as `false`
|
|
28
|
+
*/
|
|
29
|
+
createAsEphemeral?: boolean;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Type guard to detect if an IResolvedUrl is an IRouterliciousResolvedUrl.
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export const isRouterliciousResolvedUrl = (
|
|
37
|
+
resolvedUrl: IResolvedUrl,
|
|
38
|
+
): resolvedUrl is IRouterliciousResolvedUrl =>
|
|
39
|
+
(resolvedUrl as IRouterliciousResolvedUrl).routerliciousResolvedUrl === true;
|
|
@@ -46,8 +46,6 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
|
|
|
46
46
|
private readonly blobCache: ICache<ArrayBufferLike> | undefined;
|
|
47
47
|
private readonly snapshotTreeCache: ICache<ISnapshotTreeVersion> | undefined;
|
|
48
48
|
|
|
49
|
-
public readonly repositoryUrl = "";
|
|
50
|
-
|
|
51
49
|
private async getSummaryUploadManager(): Promise<ISummaryUploadManager> {
|
|
52
50
|
const manager = await this.getStorageManager();
|
|
53
51
|
return new SummaryTreeUploadManager(
|
package/src/tokens.ts
CHANGED
|
@@ -87,8 +87,7 @@ export interface ITokenProvider {
|
|
|
87
87
|
*
|
|
88
88
|
* * Using the callback may have performance impact on the document creation process.
|
|
89
89
|
*
|
|
90
|
-
* * Any exceptions thrown in the callback would fail the creation workflow
|
|
91
|
-
* (see {@link RouterliciousDocumentServiceFactory.createContainer} for more details).
|
|
90
|
+
* * Any exceptions thrown in the callback would fail the creation workflow.
|
|
92
91
|
*
|
|
93
92
|
* @param documentId - Document ID.
|
|
94
93
|
* @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload
|
package/src/treeUtils.ts
CHANGED
|
@@ -21,6 +21,7 @@ export interface ISummaryTreeAssemblerProps {
|
|
|
21
21
|
* Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.
|
|
22
22
|
*/
|
|
23
23
|
unreferenced?: true;
|
|
24
|
+
groupId?: string;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -40,6 +41,7 @@ export class SummaryTreeAssembler {
|
|
|
40
41
|
type: SummaryType.Tree,
|
|
41
42
|
tree: { ...this.summaryTree },
|
|
42
43
|
unreferenced: this.props?.unreferenced,
|
|
44
|
+
groupId: this.props?.groupId,
|
|
43
45
|
};
|
|
44
46
|
}
|
|
45
47
|
|
|
@@ -95,6 +97,7 @@ export function convertSnapshotAndBlobsToSummaryTree(
|
|
|
95
97
|
): ISummaryTree {
|
|
96
98
|
const assembler = new SummaryTreeAssembler({
|
|
97
99
|
unreferenced: snapshot.unreferenced,
|
|
100
|
+
groupId: snapshot.groupId,
|
|
98
101
|
});
|
|
99
102
|
for (const [path, id] of Object.entries(snapshot.blobs)) {
|
|
100
103
|
const blob = blobs.get(id);
|
package/src/urlUtils.ts
CHANGED
|
@@ -4,13 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
7
|
-
import URLParse from "url-parse";
|
|
8
7
|
import { ISession } from "@fluidframework/server-services-client";
|
|
9
8
|
|
|
10
|
-
export const parseFluidUrl = (fluidUrl: string): URLParse => {
|
|
11
|
-
return new URLParse(fluidUrl, true);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
9
|
/**
|
|
15
10
|
* Assume documentId is at end of url path.
|
|
16
11
|
* This is true for Routerlicious' and Tinylicious' documentUrl and deltaStorageUrl.
|
|
@@ -24,15 +19,15 @@ export const getDiscoveredFluidResolvedUrl = (
|
|
|
24
19
|
resolvedUrl: IResolvedUrl,
|
|
25
20
|
session: ISession,
|
|
26
21
|
): IResolvedUrl => {
|
|
27
|
-
const discoveredOrdererUrl = new
|
|
28
|
-
const deltaStorageUrl = new
|
|
29
|
-
deltaStorageUrl.
|
|
22
|
+
const discoveredOrdererUrl = new URL(session.ordererUrl);
|
|
23
|
+
const deltaStorageUrl = new URL(resolvedUrl.endpoints.deltaStorageUrl);
|
|
24
|
+
deltaStorageUrl.host = discoveredOrdererUrl.host;
|
|
30
25
|
|
|
31
|
-
const discoveredStorageUrl = new
|
|
32
|
-
const storageUrl = new
|
|
33
|
-
storageUrl.
|
|
26
|
+
const discoveredStorageUrl = new URL(session.historianUrl);
|
|
27
|
+
const storageUrl = new URL(resolvedUrl.endpoints.storageUrl);
|
|
28
|
+
storageUrl.host = discoveredStorageUrl.host;
|
|
34
29
|
|
|
35
|
-
const parsedUrl =
|
|
30
|
+
const parsedUrl = new URL(resolvedUrl.url);
|
|
36
31
|
const discoveredResolvedUrl: IResolvedUrl = {
|
|
37
32
|
endpoints: {
|
|
38
33
|
deltaStorageUrl: deltaStorageUrl.toString(),
|
|
@@ -43,7 +38,7 @@ export const getDiscoveredFluidResolvedUrl = (
|
|
|
43
38
|
id: resolvedUrl.id,
|
|
44
39
|
tokens: resolvedUrl.tokens,
|
|
45
40
|
type: resolvedUrl.type,
|
|
46
|
-
url: new
|
|
41
|
+
url: new URL(`https://${discoveredOrdererUrl.host}${parsedUrl.pathname}`).toString(),
|
|
47
42
|
};
|
|
48
43
|
return discoveredResolvedUrl;
|
|
49
44
|
};
|
|
@@ -44,8 +44,6 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
|
|
|
44
44
|
private readonly mc: MonitoringContext;
|
|
45
45
|
private firstVersionsCall: boolean = true;
|
|
46
46
|
|
|
47
|
-
public readonly repositoryUrl = "";
|
|
48
|
-
|
|
49
47
|
private async getSummaryUploadManager(): Promise<ISummaryUploadManager> {
|
|
50
48
|
const manager = await this.getStorageManager();
|
|
51
49
|
return new WholeSummaryUploadManager(manager);
|