@fluidframework/local-driver 2.90.0 → 2.92.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 (88) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/auth.d.ts +2 -2
  3. package/dist/auth.d.ts.map +1 -1
  4. package/dist/auth.js +2 -2
  5. package/dist/auth.js.map +1 -1
  6. package/dist/legacy.d.ts +1 -1
  7. package/dist/localCreateDocument.d.ts +2 -2
  8. package/dist/localCreateDocument.d.ts.map +1 -1
  9. package/dist/localCreateDocument.js.map +1 -1
  10. package/dist/localDeltaStorageService.d.ts +2 -2
  11. package/dist/localDeltaStorageService.d.ts.map +1 -1
  12. package/dist/localDeltaStorageService.js.map +1 -1
  13. package/dist/localDocumentDeltaConnection.d.ts +5 -4
  14. package/dist/localDocumentDeltaConnection.d.ts.map +1 -1
  15. package/dist/localDocumentDeltaConnection.js.map +1 -1
  16. package/dist/localDocumentService.d.ts +5 -5
  17. package/dist/localDocumentService.d.ts.map +1 -1
  18. package/dist/localDocumentService.js.map +1 -1
  19. package/dist/localDocumentServiceFactory.d.ts +4 -4
  20. package/dist/localDocumentServiceFactory.d.ts.map +1 -1
  21. package/dist/localDocumentServiceFactory.js.map +1 -1
  22. package/dist/localDocumentStorageService.d.ts +4 -4
  23. package/dist/localDocumentStorageService.d.ts.map +1 -1
  24. package/dist/localDocumentStorageService.js +1 -1
  25. package/dist/localDocumentStorageService.js.map +1 -1
  26. package/dist/localResolver.d.ts +2 -2
  27. package/dist/localResolver.d.ts.map +1 -1
  28. package/dist/localResolver.js +3 -3
  29. package/dist/localResolver.js.map +1 -1
  30. package/dist/localSessionStorageDb.d.ts +2 -2
  31. package/dist/localSessionStorageDb.d.ts.map +1 -1
  32. package/dist/localSessionStorageDb.js +13 -13
  33. package/dist/localSessionStorageDb.js.map +1 -1
  34. package/dist/packageVersion.d.ts +1 -1
  35. package/dist/packageVersion.js +1 -1
  36. package/dist/packageVersion.js.map +1 -1
  37. package/dist/public.d.ts +1 -1
  38. package/eslint.config.mts +14 -2
  39. package/internal.d.ts +1 -1
  40. package/legacy.d.ts +1 -1
  41. package/lib/auth.d.ts +2 -2
  42. package/lib/auth.d.ts.map +1 -1
  43. package/lib/auth.js +2 -2
  44. package/lib/auth.js.map +1 -1
  45. package/lib/legacy.d.ts +1 -1
  46. package/lib/localCreateDocument.d.ts +2 -2
  47. package/lib/localCreateDocument.d.ts.map +1 -1
  48. package/lib/localCreateDocument.js.map +1 -1
  49. package/lib/localDeltaStorageService.d.ts +2 -2
  50. package/lib/localDeltaStorageService.d.ts.map +1 -1
  51. package/lib/localDeltaStorageService.js.map +1 -1
  52. package/lib/localDocumentDeltaConnection.d.ts +5 -4
  53. package/lib/localDocumentDeltaConnection.d.ts.map +1 -1
  54. package/lib/localDocumentDeltaConnection.js +1 -1
  55. package/lib/localDocumentDeltaConnection.js.map +1 -1
  56. package/lib/localDocumentService.d.ts +5 -5
  57. package/lib/localDocumentService.d.ts.map +1 -1
  58. package/lib/localDocumentService.js.map +1 -1
  59. package/lib/localDocumentServiceFactory.d.ts +4 -4
  60. package/lib/localDocumentServiceFactory.d.ts.map +1 -1
  61. package/lib/localDocumentServiceFactory.js.map +1 -1
  62. package/lib/localDocumentStorageService.d.ts +4 -4
  63. package/lib/localDocumentStorageService.d.ts.map +1 -1
  64. package/lib/localDocumentStorageService.js +2 -2
  65. package/lib/localDocumentStorageService.js.map +1 -1
  66. package/lib/localResolver.d.ts +2 -2
  67. package/lib/localResolver.d.ts.map +1 -1
  68. package/lib/localResolver.js +4 -4
  69. package/lib/localResolver.js.map +1 -1
  70. package/lib/localSessionStorageDb.d.ts +2 -2
  71. package/lib/localSessionStorageDb.d.ts.map +1 -1
  72. package/lib/localSessionStorageDb.js +13 -13
  73. package/lib/localSessionStorageDb.js.map +1 -1
  74. package/lib/packageVersion.d.ts +1 -1
  75. package/lib/packageVersion.js +1 -1
  76. package/lib/packageVersion.js.map +1 -1
  77. package/lib/public.d.ts +1 -1
  78. package/package.json +17 -17
  79. package/src/auth.ts +4 -4
  80. package/src/localCreateDocument.ts +3 -3
  81. package/src/localDeltaStorageService.ts +2 -2
  82. package/src/localDocumentDeltaConnection.ts +6 -9
  83. package/src/localDocumentService.ts +5 -5
  84. package/src/localDocumentServiceFactory.ts +5 -5
  85. package/src/localDocumentStorageService.ts +10 -10
  86. package/src/localResolver.ts +6 -10
  87. package/src/localSessionStorageDb.ts +13 -13
  88. package/src/packageVersion.ts +1 -1
@@ -4,9 +4,9 @@
4
4
  */
5
5
 
6
6
  import { TypedEventEmitter } from "@fluid-internal/client-utils";
7
- import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
8
- import { IClient } from "@fluidframework/driver-definitions";
9
- import {
7
+ import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
8
+ import type { IClient } from "@fluidframework/driver-definitions";
9
+ import type {
10
10
  IDocumentDeltaConnection,
11
11
  IDocumentDeltaStorageService,
12
12
  IDocumentService,
@@ -15,8 +15,8 @@ import {
15
15
  IDocumentStorageService,
16
16
  IResolvedUrl,
17
17
  } from "@fluidframework/driver-definitions/internal";
18
- import { ITokenProvider } from "@fluidframework/routerlicious-driver";
19
- import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
18
+ import type { ITokenProvider } from "@fluidframework/routerlicious-driver";
19
+ import type { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
20
20
  import { GitManager } from "@fluidframework/server-services-client";
21
21
  import { TestHistorian } from "@fluidframework/server-test-utils";
22
22
 
@@ -3,9 +3,9 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
- import { ISummaryTree } from "@fluidframework/driver-definitions";
8
- import {
6
+ import type { ITelemetryBaseLogger } from "@fluidframework/core-interfaces";
7
+ import type { ISummaryTree } from "@fluidframework/driver-definitions";
8
+ import type {
9
9
  IDocumentService,
10
10
  IDocumentServiceFactory,
11
11
  IDocumentServicePolicies,
@@ -13,10 +13,10 @@ import {
13
13
  NackErrorType,
14
14
  } from "@fluidframework/driver-definitions/internal";
15
15
  import { DefaultTokenProvider } from "@fluidframework/routerlicious-driver/internal";
16
- import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
16
+ import type { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
17
17
 
18
18
  import { createDocument } from "./localCreateDocument.js";
19
- import { LocalDocumentDeltaConnection } from "./localDocumentDeltaConnection.js";
19
+ import type { LocalDocumentDeltaConnection } from "./localDocumentDeltaConnection.js";
20
20
  import { createLocalDocumentService } from "./localDocumentService.js";
21
21
  import { localDriverCompatDetailsForLoader } from "./localLayerCompatState.js";
22
22
 
@@ -10,25 +10,25 @@ import {
10
10
  stringToBuffer,
11
11
  } from "@fluid-internal/client-utils";
12
12
  import { assert } from "@fluidframework/core-utils/internal";
13
- import { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
14
- import {
13
+ import type { ISummaryHandle, ISummaryTree } from "@fluidframework/driver-definitions";
14
+ import type {
15
+ ICreateBlobResponse,
15
16
  IDocumentStorageService,
16
17
  IDocumentStorageServicePolicies,
17
18
  IResolvedUrl,
18
- type ISnapshot,
19
- type ISnapshotFetchOptions,
20
- ISummaryContext,
21
- ICreateBlobResponse,
19
+ ISnapshot,
20
+ ISnapshotFetchOptions,
22
21
  ISnapshotTreeEx,
22
+ ISummaryContext,
23
23
  IVersion,
24
24
  } from "@fluidframework/driver-definitions/internal";
25
25
  import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
26
- import { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
27
- import {
26
+ import type { ILocalDeltaConnectionServer } from "@fluidframework/server-local-server";
27
+ import type {
28
28
  GitManager,
29
29
  ISummaryUploadManager,
30
- SummaryTreeUploadManager,
31
30
  } from "@fluidframework/server-services-client";
31
+ import { SummaryTreeUploadManager } from "@fluidframework/server-services-client";
32
32
 
33
33
  import { createDocument } from "./localCreateDocument.js";
34
34
 
@@ -218,7 +218,7 @@ export class LocalDocumentStorageService implements IDocumentStorageService {
218
218
  );
219
219
  }),
220
220
  );
221
- const isAncestorOfDescendantsWithGroupId = descendants.some((keep) => keep);
221
+ const isAncestorOfDescendantsWithGroupId = descendants.some(Boolean);
222
222
 
223
223
  // We don't want to return prematurely as we still may have children that we want to keep.
224
224
  if (
@@ -3,14 +3,10 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import { IRequest } from "@fluidframework/core-interfaces";
6
+ import type { IRequest } from "@fluidframework/core-interfaces";
7
7
  import { assert } from "@fluidframework/core-utils/internal";
8
- import {
9
- DriverHeader,
10
- IResolvedUrl,
11
- IUrlResolver,
12
- ScopeType,
13
- } from "@fluidframework/driver-definitions/internal";
8
+ import type { IResolvedUrl, IUrlResolver } from "@fluidframework/driver-definitions/internal";
9
+ import { DriverHeader, ScopeType } from "@fluidframework/driver-definitions/internal";
14
10
 
15
11
  import { generateToken } from "./auth.js";
16
12
 
@@ -48,7 +44,7 @@ export class LocalResolver implements IUrlResolver {
48
44
  */
49
45
  public async resolve(request: IRequest): Promise<IResolvedUrl> {
50
46
  const parsedUrl = new URL(request.url);
51
- const fullPath = `${parsedUrl.pathname.substr(1)}${parsedUrl.search}`;
47
+ const fullPath = `${parsedUrl.pathname.slice(1)}${parsedUrl.search}`;
52
48
  // TODO Why are we non null asserting here
53
49
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
54
50
  const documentId = fullPath.split("/")[0]!;
@@ -74,13 +70,13 @@ export class LocalResolver implements IUrlResolver {
74
70
  ): Promise<string> {
75
71
  let url = relativeUrl;
76
72
  if (url.startsWith("/")) {
77
- url = url.substr(1);
73
+ url = url.slice(1);
78
74
  }
79
75
  const parsedUrl = new URL(resolvedUrl.url);
80
76
  if (parsedUrl.pathname === null) {
81
77
  throw new Error("Url should contain tenant and docId!!");
82
78
  }
83
- const [, , documentId] = parsedUrl.pathname.split("/");
79
+ const documentId = parsedUrl.pathname.split("/")[2];
84
80
  assert(
85
81
  !!documentId,
86
82
  0x09a /* "'documentId' must be a defined, non-zero length string." */,
@@ -4,8 +4,8 @@
4
4
  */
5
5
 
6
6
  import { EventEmitter } from "@fluid-internal/client-utils";
7
- import { ICollection, IDb } from "@fluidframework/server-services-core";
8
- import { ITestDbFactory } from "@fluidframework/server-test-utils";
7
+ import type { ICollection, IDb } from "@fluidframework/server-services-core";
8
+ import type { ITestDbFactory } from "@fluidframework/server-test-utils";
9
9
  import { v4 as uuid } from "uuid";
10
10
 
11
11
  /**
@@ -44,18 +44,18 @@ class LocalSessionStorageCollection<T> implements ICollection<T> {
44
44
  function getValueByKey(propertyBag, key: string): any {
45
45
  const keys = key.split(".");
46
46
  let value = propertyBag;
47
- keys.forEach((splitKey) => {
47
+ for (const splitKey of keys) {
48
48
  value = value[splitKey];
49
- });
49
+ }
50
50
  return value;
51
51
  }
52
52
 
53
53
  // getting keys of the query we are trying to find
54
54
  const queryKeys = Object.keys(query);
55
55
  let filteredCollection = this.getAllInternal();
56
- queryKeys.forEach((key) => {
56
+ for (const key of queryKeys) {
57
57
  if (!query[key]) {
58
- return;
58
+ continue;
59
59
  }
60
60
  if (query[key].$gt > 0 || query[key].$lt > 0) {
61
61
  if (query[key].$gt > 0) {
@@ -73,7 +73,7 @@ class LocalSessionStorageCollection<T> implements ICollection<T> {
73
73
  (value) => getValueByKey(value, key) === query[key],
74
74
  );
75
75
  }
76
- });
76
+ }
77
77
 
78
78
  if (sort && Object.keys(sort).length === 1) {
79
79
  function compare(a, b): number {
@@ -115,13 +115,13 @@ class LocalSessionStorageCollection<T> implements ICollection<T> {
115
115
  */
116
116
  public async update(query: any, set: any, addToSet: any): Promise<void> {
117
117
  const value = this.findOneInternal(query);
118
- if (!value) {
119
- throw new Error("Not found");
120
- } else {
118
+ if (value) {
121
119
  for (const key of Object.keys(set)) {
122
120
  value[key] = set[key];
123
121
  }
124
122
  this.insertInternal(value);
123
+ } else {
124
+ throw new Error("Not found");
125
125
  }
126
126
  }
127
127
 
@@ -133,13 +133,13 @@ class LocalSessionStorageCollection<T> implements ICollection<T> {
133
133
  */
134
134
  public async upsert(query: any, set: any, addToSet: any): Promise<void> {
135
135
  const value = this.findOneInternal(query);
136
- if (!value) {
137
- this.insertInternal(set);
138
- } else {
136
+ if (value) {
139
137
  for (const key of Object.keys(set)) {
140
138
  value[key] = set[key];
141
139
  }
142
140
  this.insertInternal(value);
141
+ } else {
142
+ this.insertInternal(set);
143
143
  }
144
144
  }
145
145
 
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/local-driver";
9
- export const pkgVersion = "2.90.0";
9
+ export const pkgVersion = "2.92.0";