@fluidframework/routerlicious-driver 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.204906

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 (90) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/api-extractor.json +9 -1
  3. package/api-report/routerlicious-driver.api.md +108 -0
  4. package/dist/contracts.d.ts +1 -1
  5. package/dist/contracts.d.ts.map +1 -1
  6. package/dist/documentService.js +3 -3
  7. package/dist/documentService.js.map +1 -1
  8. package/dist/documentServiceFactory.d.ts.map +1 -1
  9. package/dist/documentServiceFactory.js +0 -2
  10. package/dist/documentServiceFactory.js.map +1 -1
  11. package/dist/documentStorageService.js +7 -7
  12. package/dist/documentStorageService.js.map +1 -1
  13. package/dist/errorUtils.d.ts +3 -2
  14. package/dist/errorUtils.d.ts.map +1 -1
  15. package/dist/errorUtils.js +1 -1
  16. package/dist/errorUtils.js.map +1 -1
  17. package/dist/gitManager.d.ts +1 -5
  18. package/dist/gitManager.d.ts.map +1 -1
  19. package/dist/gitManager.js +1 -44
  20. package/dist/gitManager.js.map +1 -1
  21. package/dist/packageVersion.d.ts +1 -1
  22. package/dist/packageVersion.js +1 -1
  23. package/dist/packageVersion.js.map +1 -1
  24. package/dist/policies.d.ts +0 -8
  25. package/dist/policies.d.ts.map +1 -1
  26. package/dist/policies.js.map +1 -1
  27. package/dist/restWrapper.d.ts +2 -2
  28. package/dist/restWrapper.d.ts.map +1 -1
  29. package/dist/restWrapper.js +1 -0
  30. package/dist/restWrapper.js.map +1 -1
  31. package/dist/restWrapperBase.d.ts +1 -1
  32. package/dist/restWrapperBase.d.ts.map +1 -1
  33. package/dist/routerlicious-driver-alpha.d.ts +245 -0
  34. package/dist/routerlicious-driver-beta.d.ts +245 -0
  35. package/dist/routerlicious-driver-public.d.ts +245 -0
  36. package/dist/routerlicious-driver-untrimmed.d.ts +245 -0
  37. package/dist/shreddedSummaryDocumentStorageService.d.ts +2 -1
  38. package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
  39. package/dist/shreddedSummaryDocumentStorageService.js +11 -8
  40. package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
  41. package/dist/tsdoc-metadata.json +1 -1
  42. package/dist/wholeSummaryDocumentStorageService.d.ts +2 -1
  43. package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  44. package/dist/wholeSummaryDocumentStorageService.js +13 -8
  45. package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
  46. package/lib/contracts.d.ts +1 -1
  47. package/lib/contracts.d.ts.map +1 -1
  48. package/lib/documentService.js +3 -3
  49. package/lib/documentService.js.map +1 -1
  50. package/lib/documentServiceFactory.d.ts.map +1 -1
  51. package/lib/documentServiceFactory.js +0 -2
  52. package/lib/documentServiceFactory.js.map +1 -1
  53. package/lib/documentStorageService.js +7 -7
  54. package/lib/documentStorageService.js.map +1 -1
  55. package/lib/errorUtils.d.ts +3 -2
  56. package/lib/errorUtils.d.ts.map +1 -1
  57. package/lib/errorUtils.js.map +1 -1
  58. package/lib/gitManager.d.ts +1 -5
  59. package/lib/gitManager.d.ts.map +1 -1
  60. package/lib/gitManager.js +1 -44
  61. package/lib/gitManager.js.map +1 -1
  62. package/lib/packageVersion.d.ts +1 -1
  63. package/lib/packageVersion.js +1 -1
  64. package/lib/packageVersion.js.map +1 -1
  65. package/lib/policies.d.ts +0 -8
  66. package/lib/policies.d.ts.map +1 -1
  67. package/lib/policies.js.map +1 -1
  68. package/lib/restWrapper.d.ts +2 -2
  69. package/lib/restWrapper.d.ts.map +1 -1
  70. package/lib/restWrapper.js +1 -0
  71. package/lib/restWrapper.js.map +1 -1
  72. package/lib/restWrapperBase.d.ts +1 -1
  73. package/lib/restWrapperBase.d.ts.map +1 -1
  74. package/lib/shreddedSummaryDocumentStorageService.d.ts +2 -1
  75. package/lib/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
  76. package/lib/shreddedSummaryDocumentStorageService.js +12 -9
  77. package/lib/shreddedSummaryDocumentStorageService.js.map +1 -1
  78. package/lib/wholeSummaryDocumentStorageService.d.ts +2 -1
  79. package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -1
  80. package/lib/wholeSummaryDocumentStorageService.js +14 -9
  81. package/lib/wholeSummaryDocumentStorageService.js.map +1 -1
  82. package/package.json +24 -25
  83. package/src/documentServiceFactory.ts +0 -2
  84. package/src/errorUtils.ts +1 -1
  85. package/src/gitManager.ts +2 -51
  86. package/src/packageVersion.ts +1 -1
  87. package/src/policies.ts +0 -8
  88. package/src/restWrapper.ts +2 -0
  89. package/src/shreddedSummaryDocumentStorageService.ts +15 -4
  90. package/src/wholeSummaryDocumentStorageService.ts +20 -8
package/src/gitManager.ts CHANGED
@@ -9,59 +9,19 @@ import {
9
9
  IWriteSummaryResponse,
10
10
  } from "@fluidframework/server-services-client";
11
11
  import { IGitManager, IHistorian } from "./storageContracts";
12
- import { IR11sResponse, createR11sResponseFromContent } from "./restWrapper";
12
+ import { IR11sResponse } from "./restWrapper";
13
13
  import { IWholeFlatSnapshot } from "./contracts";
14
14
 
15
15
  export class GitManager implements IGitManager {
16
- private readonly blobCache = new Map<string, resources.IBlob>();
17
- private readonly commitCache = new Map<string, resources.ICommit>();
18
- private readonly treeCache = new Map<string, resources.ITree>();
19
- private readonly refCache = new Map<string, string>();
20
-
21
16
  constructor(private readonly historian: IHistorian) {}
22
17
 
23
18
  /**
24
19
  * Reads the object with the given ID. We defer to the client implementation to do the actual read.
25
20
  */
26
21
  public async getCommits(
27
- shaOrRef: string,
22
+ sha: string,
28
23
  count: number,
29
24
  ): Promise<IR11sResponse<resources.ICommitDetails[]>> {
30
- let sha: string | undefined = shaOrRef;
31
-
32
- // See if the sha is really a ref and convert
33
- if (this.refCache.has(shaOrRef)) {
34
- sha = this.refCache.get(shaOrRef);
35
-
36
- // Delete refcache after first use
37
- this.refCache.delete(shaOrRef);
38
-
39
- // If null is stored for the ref then there are no commits - return an empty array
40
- if (!sha) {
41
- return createR11sResponseFromContent([]);
42
- }
43
- }
44
-
45
- // See if the commit sha is hashed and return it if so
46
- const commit = this.commitCache.get(sha);
47
- if (commit !== undefined) {
48
- return createR11sResponseFromContent([
49
- {
50
- commit: {
51
- author: commit.author,
52
- committer: commit.committer,
53
- message: commit.message,
54
- tree: commit.tree,
55
- url: commit.url,
56
- },
57
- parents: commit.parents,
58
- sha: commit.sha,
59
- url: commit.url,
60
- },
61
- ]);
62
- }
63
-
64
- // Otherwise fall back to the historian
65
25
  return this.historian.getCommits(sha, count);
66
26
  }
67
27
 
@@ -69,19 +29,10 @@ export class GitManager implements IGitManager {
69
29
  * Reads the object with the given ID. We defer to the client implementation to do the actual read.
70
30
  */
71
31
  public async getTree(root: string, recursive = true): Promise<IR11sResponse<resources.ITree>> {
72
- const tree = this.treeCache.get(root);
73
- if (tree !== undefined) {
74
- return createR11sResponseFromContent(tree);
75
- }
76
-
77
32
  return this.historian.getTree(root, recursive);
78
33
  }
79
34
 
80
35
  public async getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>> {
81
- const blob = this.blobCache.get(sha);
82
- if (blob !== undefined) {
83
- return createR11sResponseFromContent(blob);
84
- }
85
36
  return this.historian.getBlob(sha);
86
37
  }
87
38
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/routerlicious-driver";
9
- export const pkgVersion = "2.0.0-dev.6.4.0.192049";
9
+ export const pkgVersion = "2.0.0-dev.7.2.0.204906";
package/src/policies.ts CHANGED
@@ -19,14 +19,6 @@ export interface IRouterliciousDriverPolicies {
19
19
  * Default: 100
20
20
  */
21
21
  maxConcurrentOrdererRequests: number;
22
- /**
23
- * Give hosts the option to change blob aggregation behavior to suit their needs.
24
- * Larger number means fewer blob individual requests, but less blob-deduping.
25
- * Smaller number means more blob individual requests, but more blob-deduping.
26
- * Setting to `undefined` disables blob aggregration.
27
- * Default: undefined
28
- */
29
- aggregateBlobsSmallerThanBytes: number | undefined;
30
22
  /**
31
23
  * Enable uploading entire summary tree as a IWholeSummaryPayload to storage.
32
24
  * Default: false
@@ -76,6 +76,7 @@ function headersToMap(headers: Headers) {
76
76
  }
77
77
 
78
78
  export function getPropsToLogFromResponse(headers: {
79
+ // eslint-disable-next-line @rushstack/no-new-null
79
80
  get: (id: string) => string | undefined | null;
80
81
  }) {
81
82
  interface LoggingHeader {
@@ -183,6 +184,7 @@ export class RouterliciousRestWrapper extends RestWrapper {
183
184
  return {
184
185
  content: result,
185
186
  headers,
187
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
186
188
  requestUrl: fetchRequestConfig[0].toString(),
187
189
  propsToLog: {
188
190
  ...getPropsToLogFromResponse(headers),
@@ -3,7 +3,12 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
6
+ import {
7
+ ITelemetryLoggerExt,
8
+ MonitoringContext,
9
+ PerformanceEvent,
10
+ createChildMonitoringContext,
11
+ } from "@fluidframework/telemetry-utils";
7
12
  import { stringToBuffer, Uint8ArrayToString } from "@fluid-internal/client-utils";
8
13
  import {
9
14
  IDocumentStorageService,
@@ -34,15 +39,14 @@ const isNode = typeof window === "undefined";
34
39
  * Downloads summaries piece-by-piece on-demand, or up-front when prefetch is enabled.
35
40
  */
36
41
  export class ShreddedSummaryDocumentStorageService implements IDocumentStorageService {
42
+ private readonly mc: MonitoringContext;
37
43
  // The values of this cache is useless. We only need the keys. So we are always putting
38
44
  // empty strings as values.
39
45
  protected readonly blobsShaCache = new Map<string, string>();
40
46
  private readonly blobCache: ICache<ArrayBufferLike> | undefined;
41
47
  private readonly snapshotTreeCache: ICache<ISnapshotTreeVersion> | undefined;
42
48
 
43
- public get repositoryUrl(): string {
44
- return "";
45
- }
49
+ public readonly repositoryUrl = "";
46
50
 
47
51
  private async getSummaryUploadManager(): Promise<ISummaryUploadManager> {
48
52
  const manager = await this.getStorageManager();
@@ -69,6 +73,10 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
69
73
  this.blobCache = blobCache ?? new InMemoryCache();
70
74
  this.snapshotTreeCache = snapshotTreeCache ?? new InMemoryCache();
71
75
  }
76
+
77
+ this.mc = createChildMonitoringContext({
78
+ logger,
79
+ });
72
80
  }
73
81
 
74
82
  public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {
@@ -153,6 +161,9 @@ export class ShreddedSummaryDocumentStorageService implements IDocumentStorageSe
153
161
  });
154
162
  return response;
155
163
  },
164
+ undefined, // workers
165
+ undefined, // recordHeapSize
166
+ this.mc.config.getNumber("Fluid.Driver.ReadBlobTelemetrySampling"),
156
167
  );
157
168
  this.blobsShaCache.set(value.sha, "");
158
169
  const bufferContent = stringToBuffer(value.content, value.encoding);
@@ -3,7 +3,12 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
6
+ import {
7
+ ITelemetryLoggerExt,
8
+ MonitoringContext,
9
+ PerformanceEvent,
10
+ createChildMonitoringContext,
11
+ } from "@fluidframework/telemetry-utils";
7
12
  import { performance, stringToBuffer, Uint8ArrayToString } from "@fluid-internal/client-utils";
8
13
  import { assert } from "@fluidframework/core-utils";
9
14
  import { getW3CData, promiseRaceWithWinner } from "@fluidframework/driver-base";
@@ -36,11 +41,10 @@ import { convertWholeFlatSnapshotToSnapshotTreeAndBlobs } from "./r11sSnapshotPa
36
41
  const latestSnapshotId: string = "latest";
37
42
 
38
43
  export class WholeSummaryDocumentStorageService implements IDocumentStorageService {
44
+ private readonly mc: MonitoringContext;
39
45
  private firstVersionsCall: boolean = true;
40
46
 
41
- public get repositoryUrl(): string {
42
- return "";
43
- }
47
+ public readonly repositoryUrl = "";
44
48
 
45
49
  private async getSummaryUploadManager(): Promise<ISummaryUploadManager> {
46
50
  const manager = await this.getStorageManager();
@@ -62,8 +66,13 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
62
66
  disableCache && this.noCacheGitManager !== undefined
63
67
  ? this.noCacheGitManager
64
68
  : this.manager,
65
- ) {}
69
+ ) {
70
+ this.mc = createChildMonitoringContext({
71
+ logger,
72
+ });
73
+ }
66
74
 
75
+ // eslint-disable-next-line @rushstack/no-new-null
67
76
  public async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {
68
77
  if (versionId !== this.id && versionId !== null) {
69
78
  // Blobs/Trees in this scenario will never have multiple versions, so return versionId as is
@@ -153,6 +162,7 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
153
162
  }));
154
163
  }
155
164
 
165
+ // eslint-disable-next-line @rushstack/no-new-null
156
166
  public async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {
157
167
  let requestVersion = version;
158
168
  if (!requestVersion) {
@@ -205,6 +215,9 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
205
215
  });
206
216
  return response;
207
217
  },
218
+ undefined, // workers
219
+ undefined, // recordHeapSize
220
+ this.mc.config.getNumber("Fluid.Driver.ReadBlobTelemetrySampling"),
208
221
  );
209
222
  const bufferValue = stringToBuffer(blob.content, blob.encoding);
210
223
 
@@ -296,9 +309,8 @@ export class WholeSummaryDocumentStorageService implements IDocumentStorageServi
296
309
  },
297
310
  async (event) => {
298
311
  const manager = await this.getStorageManager(disableCache);
299
- const response: IR11sResponse<IWholeFlatSnapshot> = await manager.getSnapshot(
300
- versionId,
301
- );
312
+ const response: IR11sResponse<IWholeFlatSnapshot> =
313
+ await manager.getSnapshot(versionId);
302
314
  const start = performance.now();
303
315
  const snapshot: INormalizedWholeSnapshot =
304
316
  convertWholeFlatSnapshotToSnapshotTreeAndBlobs(response.content);