@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.
Files changed (147) hide show
  1. package/{.eslintrc.js → .eslintrc.cjs} +4 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +32 -0
  4. package/api-report/routerlicious-driver.api.md +6 -9
  5. package/dist/contracts.d.ts +1 -0
  6. package/dist/contracts.d.ts.map +1 -1
  7. package/dist/contracts.js.map +1 -1
  8. package/dist/deltaStorageService.js.map +1 -1
  9. package/dist/documentService.d.ts +2 -1
  10. package/dist/documentService.d.ts.map +1 -1
  11. package/dist/documentService.js +5 -3
  12. package/dist/documentService.js.map +1 -1
  13. package/dist/documentServiceFactory.d.ts.map +1 -1
  14. package/dist/documentServiceFactory.js +11 -9
  15. package/dist/documentServiceFactory.js.map +1 -1
  16. package/dist/errorUtils.d.ts +1 -18
  17. package/dist/errorUtils.d.ts.map +1 -1
  18. package/dist/errorUtils.js +2 -20
  19. package/dist/errorUtils.js.map +1 -1
  20. package/dist/index.d.ts +2 -1
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +1 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/nullBlobStorageService.d.ts +0 -1
  25. package/dist/nullBlobStorageService.d.ts.map +1 -1
  26. package/dist/nullBlobStorageService.js +0 -3
  27. package/dist/nullBlobStorageService.js.map +1 -1
  28. package/dist/packageVersion.d.ts +1 -1
  29. package/dist/packageVersion.js +1 -1
  30. package/dist/packageVersion.js.map +1 -1
  31. package/dist/policies.d.ts +0 -6
  32. package/dist/policies.d.ts.map +1 -1
  33. package/dist/policies.js.map +1 -1
  34. package/dist/r11sSnapshotParser.d.ts.map +1 -1
  35. package/dist/r11sSnapshotParser.js +1 -0
  36. package/dist/r11sSnapshotParser.js.map +1 -1
  37. package/dist/restWrapper.d.ts +3 -3
  38. package/dist/restWrapper.d.ts.map +1 -1
  39. package/dist/restWrapper.js.map +1 -1
  40. package/dist/routerlicious-driver-alpha.d.ts +25 -4
  41. package/dist/routerlicious-driver-beta.d.ts +3 -4
  42. package/dist/routerlicious-driver-public.d.ts +3 -4
  43. package/dist/routerlicious-driver-untrimmed.d.ts +23 -24
  44. package/dist/routerliciousResolvedUrl.d.ts +34 -0
  45. package/dist/routerliciousResolvedUrl.d.ts.map +1 -0
  46. package/dist/routerliciousResolvedUrl.js +14 -0
  47. package/dist/routerliciousResolvedUrl.js.map +1 -0
  48. package/dist/shreddedSummaryDocumentStorageService.d.ts +0 -1
  49. package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
  50. package/dist/shreddedSummaryDocumentStorageService.js +0 -1
  51. package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
  52. package/dist/tokens.d.ts +1 -2
  53. package/dist/tokens.d.ts.map +1 -1
  54. package/dist/tokens.js.map +1 -1
  55. package/dist/treeUtils.d.ts +1 -0
  56. package/dist/treeUtils.d.ts.map +1 -1
  57. package/dist/treeUtils.js +2 -0
  58. package/dist/treeUtils.js.map +1 -1
  59. package/dist/tsdoc-metadata.json +1 -1
  60. package/dist/urlUtils.d.ts +0 -2
  61. package/dist/urlUtils.d.ts.map +1 -1
  62. package/dist/urlUtils.js +9 -17
  63. package/dist/urlUtils.js.map +1 -1
  64. package/dist/wholeSummaryDocumentStorageService.d.ts +0 -1
  65. package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  66. package/dist/wholeSummaryDocumentStorageService.js +0 -1
  67. package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
  68. package/lib/contracts.d.mts +1 -0
  69. package/lib/contracts.d.mts.map +1 -1
  70. package/lib/contracts.mjs.map +1 -1
  71. package/lib/deltaStorageService.mjs.map +1 -1
  72. package/lib/documentService.d.mts +2 -1
  73. package/lib/documentService.d.mts.map +1 -1
  74. package/lib/documentService.mjs +5 -3
  75. package/lib/documentService.mjs.map +1 -1
  76. package/lib/documentServiceFactory.d.mts.map +1 -1
  77. package/lib/documentServiceFactory.mjs +12 -10
  78. package/lib/documentServiceFactory.mjs.map +1 -1
  79. package/lib/errorUtils.d.mts +1 -18
  80. package/lib/errorUtils.d.mts.map +1 -1
  81. package/lib/errorUtils.mjs +1 -19
  82. package/lib/errorUtils.mjs.map +1 -1
  83. package/lib/index.d.mts +2 -1
  84. package/lib/index.d.mts.map +1 -1
  85. package/lib/index.mjs +1 -1
  86. package/lib/index.mjs.map +1 -1
  87. package/lib/nullBlobStorageService.d.mts +0 -1
  88. package/lib/nullBlobStorageService.d.mts.map +1 -1
  89. package/lib/nullBlobStorageService.mjs +0 -3
  90. package/lib/nullBlobStorageService.mjs.map +1 -1
  91. package/lib/packageVersion.d.mts +1 -1
  92. package/lib/packageVersion.mjs +1 -1
  93. package/lib/packageVersion.mjs.map +1 -1
  94. package/lib/policies.d.mts +0 -6
  95. package/lib/policies.d.mts.map +1 -1
  96. package/lib/policies.mjs.map +1 -1
  97. package/lib/r11sSnapshotParser.d.mts.map +1 -1
  98. package/lib/r11sSnapshotParser.mjs +1 -0
  99. package/lib/r11sSnapshotParser.mjs.map +1 -1
  100. package/lib/restWrapper.d.mts +3 -3
  101. package/lib/restWrapper.d.mts.map +1 -1
  102. package/lib/restWrapper.mjs.map +1 -1
  103. package/lib/routerlicious-driver-alpha.d.mts +25 -4
  104. package/lib/routerlicious-driver-beta.d.mts +3 -4
  105. package/lib/routerlicious-driver-public.d.mts +3 -4
  106. package/lib/routerlicious-driver-untrimmed.d.mts +23 -24
  107. package/lib/routerliciousResolvedUrl.d.mts +34 -0
  108. package/lib/routerliciousResolvedUrl.d.mts.map +1 -0
  109. package/lib/routerliciousResolvedUrl.mjs +10 -0
  110. package/lib/routerliciousResolvedUrl.mjs.map +1 -0
  111. package/lib/shreddedSummaryDocumentStorageService.d.mts +0 -1
  112. package/lib/shreddedSummaryDocumentStorageService.d.mts.map +1 -1
  113. package/lib/shreddedSummaryDocumentStorageService.mjs +0 -1
  114. package/lib/shreddedSummaryDocumentStorageService.mjs.map +1 -1
  115. package/lib/tokens.d.mts +1 -2
  116. package/lib/tokens.d.mts.map +1 -1
  117. package/lib/tokens.mjs.map +1 -1
  118. package/lib/treeUtils.d.mts +1 -0
  119. package/lib/treeUtils.d.mts.map +1 -1
  120. package/lib/treeUtils.mjs +2 -0
  121. package/lib/treeUtils.mjs.map +1 -1
  122. package/lib/urlUtils.d.mts +0 -2
  123. package/lib/urlUtils.d.mts.map +1 -1
  124. package/lib/urlUtils.mjs +8 -12
  125. package/lib/urlUtils.mjs.map +1 -1
  126. package/lib/wholeSummaryDocumentStorageService.d.mts +0 -1
  127. package/lib/wholeSummaryDocumentStorageService.d.mts.map +1 -1
  128. package/lib/wholeSummaryDocumentStorageService.mjs +0 -1
  129. package/lib/wholeSummaryDocumentStorageService.mjs.map +1 -1
  130. package/package.json +31 -25
  131. package/src/contracts.ts +1 -0
  132. package/src/deltaStorageService.ts +3 -3
  133. package/src/documentService.ts +10 -4
  134. package/src/documentServiceFactory.ts +16 -13
  135. package/src/errorUtils.ts +2 -21
  136. package/src/index.ts +4 -1
  137. package/src/nullBlobStorageService.ts +0 -4
  138. package/src/packageVersion.ts +1 -1
  139. package/src/policies.ts +0 -6
  140. package/src/r11sSnapshotParser.ts +1 -0
  141. package/src/restWrapper.ts +3 -3
  142. package/src/routerliciousResolvedUrl.ts +39 -0
  143. package/src/shreddedSummaryDocumentStorageService.ts +0 -2
  144. package/src/tokens.ts +1 -2
  145. package/src/treeUtils.ts +3 -0
  146. package/src/urlUtils.ts +8 -13
  147. package/src/wholeSummaryDocumentStorageService.ts +0 -2
@@ -39,6 +39,7 @@ function buildHierarchy(
39
39
  blobs: {},
40
40
  trees: {},
41
41
  unreferenced: entry.unreferenced,
42
+ groupId: entry.groupId,
42
43
  };
43
44
  node.trees[decodeURIComponent(entryPathBase)] = newTree;
44
45
  lookup[entryPath] = newTree;
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryProperties } from "@fluidframework/core-interfaces";
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: ITelemetryProperties;
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: ITelemetryProperties = {
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 URLParse(session.ordererUrl);
28
- const deltaStorageUrl = new URLParse(resolvedUrl.endpoints.deltaStorageUrl);
29
- deltaStorageUrl.set("host", discoveredOrdererUrl.host);
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 URLParse(session.historianUrl);
32
- const storageUrl = new URLParse(resolvedUrl.endpoints.storageUrl);
33
- storageUrl.set("host", discoveredStorageUrl.host);
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 = parseFluidUrl(resolvedUrl.url);
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 URLParse(`fluid://${discoveredOrdererUrl.host}${parsedUrl.pathname}`).toString(),
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);