@fluidframework/datastore 2.70.0-361248 → 2.70.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 (39) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/api-report/datastore.legacy.beta.api.md +0 -2
  3. package/dist/dataStoreLayerCompatState.d.ts +3 -2
  4. package/dist/dataStoreLayerCompatState.d.ts.map +1 -1
  5. package/dist/dataStoreLayerCompatState.js +2 -18
  6. package/dist/dataStoreLayerCompatState.js.map +1 -1
  7. package/dist/dataStoreRuntime.d.ts +2 -8
  8. package/dist/dataStoreRuntime.d.ts.map +1 -1
  9. package/dist/dataStoreRuntime.js +13 -32
  10. package/dist/dataStoreRuntime.js.map +1 -1
  11. package/dist/packageVersion.d.ts +1 -1
  12. package/dist/packageVersion.d.ts.map +1 -1
  13. package/dist/packageVersion.js +1 -1
  14. package/dist/packageVersion.js.map +1 -1
  15. package/lib/dataStoreLayerCompatState.d.ts +3 -2
  16. package/lib/dataStoreLayerCompatState.d.ts.map +1 -1
  17. package/lib/dataStoreLayerCompatState.js +3 -19
  18. package/lib/dataStoreLayerCompatState.js.map +1 -1
  19. package/lib/dataStoreRuntime.d.ts +2 -8
  20. package/lib/dataStoreRuntime.d.ts.map +1 -1
  21. package/lib/dataStoreRuntime.js +14 -33
  22. package/lib/dataStoreRuntime.js.map +1 -1
  23. package/lib/packageVersion.d.ts +1 -1
  24. package/lib/packageVersion.d.ts.map +1 -1
  25. package/lib/packageVersion.js +1 -1
  26. package/lib/packageVersion.js.map +1 -1
  27. package/package.json +22 -15
  28. package/src/dataStoreLayerCompatState.ts +14 -21
  29. package/src/dataStoreRuntime.ts +22 -45
  30. package/src/packageVersion.ts +1 -1
  31. package/dist/localChannelStorageService.d.ts +0 -16
  32. package/dist/localChannelStorageService.d.ts.map +0 -1
  33. package/dist/localChannelStorageService.js +0 -54
  34. package/dist/localChannelStorageService.js.map +0 -1
  35. package/lib/localChannelStorageService.d.ts +0 -16
  36. package/lib/localChannelStorageService.d.ts.map +0 -1
  37. package/lib/localChannelStorageService.js +0 -50
  38. package/lib/localChannelStorageService.js.map +0 -1
  39. package/src/localChannelStorageService.ts +0 -62
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluidframework/datastore",
3
- "version": "2.70.0-361248",
3
+ "version": "2.70.0",
4
4
  "description": "Fluid data store implementation",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -69,29 +69,29 @@
69
69
  "temp-directory": "nyc/.nyc_output"
70
70
  },
71
71
  "dependencies": {
72
- "@fluid-internal/client-utils": "2.70.0-361248",
73
- "@fluidframework/container-definitions": "2.70.0-361248",
74
- "@fluidframework/core-interfaces": "2.70.0-361248",
75
- "@fluidframework/core-utils": "2.70.0-361248",
76
- "@fluidframework/datastore-definitions": "2.70.0-361248",
77
- "@fluidframework/driver-definitions": "2.70.0-361248",
78
- "@fluidframework/driver-utils": "2.70.0-361248",
79
- "@fluidframework/id-compressor": "2.70.0-361248",
80
- "@fluidframework/runtime-definitions": "2.70.0-361248",
81
- "@fluidframework/runtime-utils": "2.70.0-361248",
82
- "@fluidframework/telemetry-utils": "2.70.0-361248",
72
+ "@fluid-internal/client-utils": "~2.70.0",
73
+ "@fluidframework/container-definitions": "~2.70.0",
74
+ "@fluidframework/core-interfaces": "~2.70.0",
75
+ "@fluidframework/core-utils": "~2.70.0",
76
+ "@fluidframework/datastore-definitions": "~2.70.0",
77
+ "@fluidframework/driver-definitions": "~2.70.0",
78
+ "@fluidframework/driver-utils": "~2.70.0",
79
+ "@fluidframework/id-compressor": "~2.70.0",
80
+ "@fluidframework/runtime-definitions": "~2.70.0",
81
+ "@fluidframework/runtime-utils": "~2.70.0",
82
+ "@fluidframework/telemetry-utils": "~2.70.0",
83
83
  "uuid": "^11.1.0"
84
84
  },
85
85
  "devDependencies": {
86
86
  "@arethetypeswrong/cli": "^0.17.1",
87
87
  "@biomejs/biome": "~1.9.3",
88
- "@fluid-internal/mocha-test-setup": "2.70.0-361248",
88
+ "@fluid-internal/mocha-test-setup": "~2.70.0",
89
89
  "@fluid-tools/build-cli": "^0.58.3",
90
90
  "@fluidframework/build-common": "^2.0.3",
91
91
  "@fluidframework/build-tools": "^0.58.3",
92
92
  "@fluidframework/datastore-previous": "npm:@fluidframework/datastore@2.63.0",
93
93
  "@fluidframework/eslint-config-fluid": "^6.1.0",
94
- "@fluidframework/test-runtime-utils": "2.70.0-361248",
94
+ "@fluidframework/test-runtime-utils": "~2.70.0",
95
95
  "@microsoft/api-extractor": "7.52.11",
96
96
  "@types/lodash": "^4.14.118",
97
97
  "@types/mocha": "^10.0.10",
@@ -109,7 +109,14 @@
109
109
  "typescript": "~5.4.5"
110
110
  },
111
111
  "typeValidation": {
112
- "broken": {},
112
+ "broken": {
113
+ "Class_FluidDataStoreRuntime": {
114
+ "backCompat": false
115
+ },
116
+ "ClassStatics_FluidDataStoreRuntime": {
117
+ "backCompat": false
118
+ }
119
+ },
113
120
  "entrypoint": "legacy"
114
121
  },
115
122
  "scripts": {
@@ -3,12 +3,14 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
 
6
- import {
7
- checkLayerCompatibility,
8
- type ILayerCompatDetails,
9
- type ILayerCompatSupportRequirements,
6
+ import type {
7
+ ILayerCompatDetails,
8
+ ILayerCompatSupportRequirements,
10
9
  } from "@fluid-internal/client-utils";
11
- import { UsageError } from "@fluidframework/telemetry-utils/internal";
10
+ import {
11
+ validateLayerCompatibility,
12
+ type ITelemetryLoggerExt,
13
+ } from "@fluidframework/telemetry-utils/internal";
12
14
 
13
15
  import { pkgVersion } from "./packageVersion.js";
14
16
 
@@ -62,24 +64,15 @@ export const runtimeSupportRequirementsForDataStore: ILayerCompatSupportRequirem
62
64
  export function validateRuntimeCompatibility(
63
65
  maybeRuntimeCompatDetails: ILayerCompatDetails | undefined,
64
66
  disposeFn: () => void,
67
+ logger: ITelemetryLoggerExt,
65
68
  ): void {
66
- const layerCheckResult = checkLayerCompatibility(
69
+ validateLayerCompatibility(
70
+ "dataStore",
71
+ "runtime",
72
+ dataStoreCompatDetailsForRuntime,
67
73
  runtimeSupportRequirementsForDataStore,
68
74
  maybeRuntimeCompatDetails,
75
+ disposeFn,
76
+ logger,
69
77
  );
70
- if (!layerCheckResult.isCompatible) {
71
- const error = new UsageError("DataStore is not compatible with Runtime", {
72
- errorDetails: JSON.stringify({
73
- dataStoreVersion: dataStoreCoreCompatDetails.pkgVersion,
74
- runtimeVersion: maybeRuntimeCompatDetails?.pkgVersion,
75
- dataStoreGeneration: dataStoreCoreCompatDetails.generation,
76
- runtimeGeneration: maybeRuntimeCompatDetails?.generation,
77
- minSupportedGeneration: runtimeSupportRequirementsForDataStore.minSupportedGeneration,
78
- isGenerationCompatible: layerCheckResult.isGenerationCompatible,
79
- unsupportedFeatures: layerCheckResult.unsupportedFeatures,
80
- }),
81
- });
82
- disposeFn();
83
- throw error;
84
- }
85
78
  }
@@ -29,8 +29,7 @@ import type {
29
29
  IFluidDataStoreRuntime,
30
30
  IFluidDataStoreRuntimeEvents,
31
31
  IDeltaManagerErased,
32
- // eslint-disable-next-line import/no-deprecated
33
- IFluidDataStoreRuntimeExperimental,
32
+ IFluidDataStoreRuntimeAlpha,
34
33
  } from "@fluidframework/datastore-definitions/internal";
35
34
  import {
36
35
  type IClientDetails,
@@ -61,12 +60,11 @@ import {
61
60
  type IInboundSignalMessage,
62
61
  type IRuntimeMessageCollection,
63
62
  type IRuntimeMessagesContent,
64
- // eslint-disable-next-line import/no-deprecated
65
- type IContainerRuntimeBaseExperimental,
66
63
  notifiesReadOnlyState,
67
64
  encodeHandlesInContainerRuntime,
68
65
  type IFluidDataStorePolicies,
69
66
  type MinimumVersionForCollab,
67
+ asLegacyAlpha,
70
68
  } from "@fluidframework/runtime-definitions/internal";
71
69
  import {
72
70
  GCDataBuilder,
@@ -323,12 +321,23 @@ export class FluidDataStoreRuntime
323
321
  0x30e /* Id cannot contain slashes. DataStoreContext should have validated this. */,
324
322
  );
325
323
 
326
- this.policies = { ...defaultPolicies, ...policies };
324
+ this.mc = createChildMonitoringContext({
325
+ logger: dataStoreContext.baseLogger,
326
+ namespace: "FluidDataStoreRuntime",
327
+ properties: {
328
+ all: { dataStoreId: uuid(), dataStoreVersion: pkgVersion },
329
+ error: { inStagingMode: () => this.inStagingMode, isDirty: () => this.isDirty },
330
+ },
331
+ });
327
332
 
328
333
  // Validate that the Runtime is compatible with this DataStore.
329
334
  const { ILayerCompatDetails: runtimeCompatDetails } =
330
335
  dataStoreContext as FluidObject<ILayerCompatDetails>;
331
- validateRuntimeCompatibility(runtimeCompatDetails, this.dispose.bind(this));
336
+ validateRuntimeCompatibility(
337
+ runtimeCompatDetails,
338
+ this.dispose.bind(this),
339
+ this.mc.logger,
340
+ );
332
341
 
333
342
  if (contextSupportsFeature(dataStoreContext, notifiesReadOnlyState)) {
334
343
  this._readonly = dataStoreContext.isReadOnly();
@@ -339,6 +348,8 @@ export class FluidDataStoreRuntime
339
348
  );
340
349
  }
341
350
 
351
+ this.policies = { ...defaultPolicies, ...policies };
352
+
342
353
  this.submitMessagesWithoutEncodingHandles = contextSupportsFeature(
343
354
  dataStoreContext,
344
355
  encodeHandlesInContainerRuntime,
@@ -346,14 +357,6 @@ export class FluidDataStoreRuntime
346
357
  // We read this property here to avoid a compiler error (unused private member)
347
358
  debugAssert(() => this.submitMessagesWithoutEncodingHandles !== undefined);
348
359
 
349
- this.mc = createChildMonitoringContext({
350
- logger: dataStoreContext.baseLogger,
351
- namespace: "FluidDataStoreRuntime",
352
- properties: {
353
- all: { dataStoreId: uuid(), dataStoreVersion: pkgVersion },
354
- },
355
- });
356
-
357
360
  this.id = dataStoreContext.id;
358
361
  this.options = dataStoreContext.options;
359
362
  this.deltaManagerInternal = dataStoreContext.deltaManager;
@@ -443,31 +446,20 @@ export class FluidDataStoreRuntime
443
446
  this.localChangesTelemetryCount =
444
447
  this.mc.config.getNumber("Fluid.Telemetry.LocalChangesTelemetryCount") ?? 10;
445
448
 
446
- // Reference these properties to avoid unused private member errors.
447
- // They're accessed via IFluidDataStoreRuntimeExperimental interface.
448
- // eslint-disable-next-line no-void
449
- void [this.inStagingMode, this.isDirty];
450
-
451
449
  this.minVersionForCollab = this.dataStoreContext.minVersionForCollab;
452
450
  }
453
451
 
454
452
  /**
455
- * Implementation of IFluidDataStoreRuntimeExperimental.inStagingMode
453
+ * Implementation of IFluidDataStoreRuntimeAlpha.inStagingMode
456
454
  */
457
- // eslint-disable-next-line import/no-deprecated
458
- private get inStagingMode(): IFluidDataStoreRuntimeExperimental["inStagingMode"] {
459
- return (
460
- // eslint-disable-next-line import/no-deprecated
461
- (this.dataStoreContext.containerRuntime as IContainerRuntimeBaseExperimental)
462
- ?.inStagingMode
463
- );
455
+ private get inStagingMode(): IFluidDataStoreRuntimeAlpha["inStagingMode"] {
456
+ return asLegacyAlpha(this.dataStoreContext.containerRuntime)?.inStagingMode;
464
457
  }
465
458
 
466
459
  /**
467
- * Implementation of IFluidDataStoreRuntimeExperimental.isDirty
460
+ * Implementation of IFluidDataStoreRuntimeAlpha.isDirty
468
461
  */
469
- // eslint-disable-next-line import/no-deprecated
470
- private get isDirty(): IFluidDataStoreRuntimeExperimental["isDirty"] {
462
+ private get isDirty(): IFluidDataStoreRuntimeAlpha["isDirty"] {
471
463
  return this.pendingOpCount.value > 0;
472
464
  }
473
465
 
@@ -1166,21 +1158,6 @@ export class FluidDataStoreRuntime
1166
1158
  }
1167
1159
  }
1168
1160
 
1169
- /**
1170
- * Do not use.
1171
- * @deprecated Use `IFluidDataStoreContext.submitMessage` instead.
1172
- * @see https://github.com/microsoft/FluidFramework/issues/24406
1173
- */
1174
- public submitMessage(
1175
- type: DataStoreMessageType,
1176
- // TODO: use something other than `any` here (breaking change)
1177
- // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
1178
- content: any,
1179
- localOpMetadata: unknown,
1180
- ): void {
1181
- this.submit(type, content, localOpMetadata);
1182
- }
1183
-
1184
1161
  /**
1185
1162
  * Submits the signal to be sent to other clients.
1186
1163
  * @param type - Type of the signal.
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/datastore";
9
- export const pkgVersion = "2.70.0-361248";
9
+ export const pkgVersion = "2.70.0";
@@ -1,16 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
- import { type ITree } from "@fluidframework/driver-definitions/internal";
7
- export declare class LocalChannelStorageService implements IChannelStorageService {
8
- private readonly tree;
9
- constructor(tree: ITree);
10
- readBlob(path: string): Promise<ArrayBufferLike>;
11
- contains(path: string): Promise<boolean>;
12
- list(path: string): Promise<string[]>;
13
- private readBlobSync;
14
- private readBlobSyncInternal;
15
- }
16
- //# sourceMappingURL=localChannelStorageService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localChannelStorageService.d.ts","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAEN,KAAK,KAAK,EAEV,MAAM,6CAA6C,CAAC;AAGrD,qBAAa,0BAA2B,YAAW,sBAAsB;IAC5D,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,KAAK;IAE3B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAQhD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIlD,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,oBAAoB;CAuB5B"}
@@ -1,54 +0,0 @@
1
- "use strict";
2
- /*!
3
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
4
- * Licensed under the MIT License.
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.LocalChannelStorageService = void 0;
8
- const client_utils_1 = require("@fluid-internal/client-utils");
9
- const internal_1 = require("@fluidframework/driver-definitions/internal");
10
- const internal_2 = require("@fluidframework/runtime-utils/internal");
11
- class LocalChannelStorageService {
12
- constructor(tree) {
13
- this.tree = tree;
14
- }
15
- async readBlob(path) {
16
- const blob = this.readBlobSync(path);
17
- if (blob === undefined) {
18
- throw new Error("Blob Not Found");
19
- }
20
- return (0, client_utils_1.stringToBuffer)(blob.contents, blob.encoding);
21
- }
22
- async contains(path) {
23
- const blob = this.readBlobSync(path);
24
- return blob === undefined ? false : blob.contents !== undefined;
25
- }
26
- async list(path) {
27
- return (0, internal_2.listBlobsAtTreePath)(this.tree, path);
28
- }
29
- readBlobSync(path) {
30
- return this.readBlobSyncInternal(path, this.tree);
31
- }
32
- readBlobSyncInternal(path, tree) {
33
- for (const entry of tree.entries) {
34
- switch (entry.type) {
35
- case internal_1.TreeEntry.Blob: {
36
- if (path === entry.path) {
37
- return entry.value;
38
- }
39
- break;
40
- }
41
- case internal_1.TreeEntry.Tree: {
42
- if (path.startsWith(entry.path)) {
43
- return this.readBlobSyncInternal(path.slice(entry.path.length + 1), entry.value);
44
- }
45
- break;
46
- }
47
- default:
48
- }
49
- }
50
- return undefined;
51
- }
52
- }
53
- exports.LocalChannelStorageService = LocalChannelStorageService;
54
- //# sourceMappingURL=localChannelStorageService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localChannelStorageService.js","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAE9D,0EAIqD;AACrD,qEAA6E;AAE7E,MAAa,0BAA0B;IACtC,YAA6B,IAAW;QAAX,SAAI,GAAJ,IAAI,CAAO;IAAG,CAAC;IAErC,KAAK,CAAC,QAAQ,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,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;oBAClF,CAAC;oBACD,MAAM;gBACP,CAAC;gBAED,QAAQ;YACT,CAAC;QACF,CAAC;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD;AA/CD,gEA+CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\ttype IBlob,\n\ttype ITree,\n\tTreeEntry,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { listBlobsAtTreePath } from \"@fluidframework/runtime-utils/internal\";\n\nexport class LocalChannelStorageService implements IChannelStorageService {\n\tconstructor(private readonly tree: ITree) {}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.readBlobSync(path);\n\t\tif (blob === undefined) {\n\t\t\tthrow new Error(\"Blob Not Found\");\n\t\t}\n\t\treturn stringToBuffer(blob.contents, blob.encoding);\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\tconst blob = this.readBlobSync(path);\n\t\treturn blob === undefined ? false : blob.contents !== undefined;\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\treturn listBlobsAtTreePath(this.tree, path);\n\t}\n\n\tprivate readBlobSync(path: string): IBlob | undefined {\n\t\treturn this.readBlobSyncInternal(path, this.tree);\n\t}\n\n\tprivate readBlobSyncInternal(path: string, tree: ITree): IBlob | undefined {\n\t\tfor (const entry of tree.entries) {\n\t\t\tswitch (entry.type) {\n\t\t\t\tcase TreeEntry.Blob: {\n\t\t\t\t\tif (path === entry.path) {\n\t\t\t\t\t\treturn entry.value;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase TreeEntry.Tree: {\n\t\t\t\t\tif (path.startsWith(entry.path)) {\n\t\t\t\t\t\treturn this.readBlobSyncInternal(path.slice(entry.path.length + 1), entry.value);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n"]}
@@ -1,16 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
6
- import { type ITree } from "@fluidframework/driver-definitions/internal";
7
- export declare class LocalChannelStorageService implements IChannelStorageService {
8
- private readonly tree;
9
- constructor(tree: ITree);
10
- readBlob(path: string): Promise<ArrayBufferLike>;
11
- contains(path: string): Promise<boolean>;
12
- list(path: string): Promise<string[]>;
13
- private readBlobSync;
14
- private readBlobSyncInternal;
15
- }
16
- //# sourceMappingURL=localChannelStorageService.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localChannelStorageService.d.ts","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAC7F,OAAO,EAEN,KAAK,KAAK,EAEV,MAAM,6CAA6C,CAAC;AAGrD,qBAAa,0BAA2B,YAAW,sBAAsB;IAC5D,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,KAAK;IAE3B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAQhD,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKxC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAIlD,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,oBAAoB;CAuB5B"}
@@ -1,50 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
- import { stringToBuffer } from "@fluid-internal/client-utils";
6
- import { TreeEntry, } from "@fluidframework/driver-definitions/internal";
7
- import { listBlobsAtTreePath } from "@fluidframework/runtime-utils/internal";
8
- export class LocalChannelStorageService {
9
- constructor(tree) {
10
- this.tree = tree;
11
- }
12
- async readBlob(path) {
13
- const blob = this.readBlobSync(path);
14
- if (blob === undefined) {
15
- throw new Error("Blob Not Found");
16
- }
17
- return stringToBuffer(blob.contents, blob.encoding);
18
- }
19
- async contains(path) {
20
- const blob = this.readBlobSync(path);
21
- return blob === undefined ? false : blob.contents !== undefined;
22
- }
23
- async list(path) {
24
- return listBlobsAtTreePath(this.tree, path);
25
- }
26
- readBlobSync(path) {
27
- return this.readBlobSyncInternal(path, this.tree);
28
- }
29
- readBlobSyncInternal(path, tree) {
30
- for (const entry of tree.entries) {
31
- switch (entry.type) {
32
- case TreeEntry.Blob: {
33
- if (path === entry.path) {
34
- return entry.value;
35
- }
36
- break;
37
- }
38
- case TreeEntry.Tree: {
39
- if (path.startsWith(entry.path)) {
40
- return this.readBlobSyncInternal(path.slice(entry.path.length + 1), entry.value);
41
- }
42
- break;
43
- }
44
- default:
45
- }
46
- }
47
- return undefined;
48
- }
49
- }
50
- //# sourceMappingURL=localChannelStorageService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"localChannelStorageService.js","sourceRoot":"","sources":["../src/localChannelStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAGN,SAAS,GACT,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,MAAM,OAAO,0BAA0B;IACtC,YAA6B,IAAW;QAAX,SAAI,GAAJ,IAAI,CAAO;IAAG,CAAC;IAErC,KAAK,CAAC,QAAQ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KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;oBAClF,CAAC;oBACD,MAAM;gBACP,CAAC;gBAED,QAAQ;YACT,CAAC;QACF,CAAC;QAED,OAAO,SAAS,CAAC;IAClB,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { stringToBuffer } from \"@fluid-internal/client-utils\";\nimport type { IChannelStorageService } from \"@fluidframework/datastore-definitions/internal\";\nimport {\n\ttype IBlob,\n\ttype ITree,\n\tTreeEntry,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { listBlobsAtTreePath } from \"@fluidframework/runtime-utils/internal\";\n\nexport class LocalChannelStorageService implements IChannelStorageService {\n\tconstructor(private readonly tree: ITree) {}\n\n\tpublic async readBlob(path: string): Promise<ArrayBufferLike> {\n\t\tconst blob = this.readBlobSync(path);\n\t\tif (blob === undefined) {\n\t\t\tthrow new Error(\"Blob Not Found\");\n\t\t}\n\t\treturn stringToBuffer(blob.contents, blob.encoding);\n\t}\n\n\tpublic async contains(path: string): Promise<boolean> {\n\t\tconst blob = this.readBlobSync(path);\n\t\treturn blob === undefined ? false : blob.contents !== undefined;\n\t}\n\n\tpublic async list(path: string): Promise<string[]> {\n\t\treturn listBlobsAtTreePath(this.tree, path);\n\t}\n\n\tprivate readBlobSync(path: string): IBlob | undefined {\n\t\treturn this.readBlobSyncInternal(path, this.tree);\n\t}\n\n\tprivate readBlobSyncInternal(path: string, tree: ITree): IBlob | undefined {\n\t\tfor (const entry of tree.entries) {\n\t\t\tswitch (entry.type) {\n\t\t\t\tcase TreeEntry.Blob: {\n\t\t\t\t\tif (path === entry.path) {\n\t\t\t\t\t\treturn entry.value;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase TreeEntry.Tree: {\n\t\t\t\t\tif (path.startsWith(entry.path)) {\n\t\t\t\t\t\treturn this.readBlobSyncInternal(path.slice(entry.path.length + 1), entry.value);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\t\t\t}\n\t\t}\n\n\t\treturn undefined;\n\t}\n}\n"]}
@@ -1,62 +0,0 @@
1
- /*!
2
- * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
- * Licensed under the MIT License.
4
- */
5
-
6
- import { stringToBuffer } from "@fluid-internal/client-utils";
7
- import type { IChannelStorageService } from "@fluidframework/datastore-definitions/internal";
8
- import {
9
- type IBlob,
10
- type ITree,
11
- TreeEntry,
12
- } from "@fluidframework/driver-definitions/internal";
13
- import { listBlobsAtTreePath } from "@fluidframework/runtime-utils/internal";
14
-
15
- export class LocalChannelStorageService implements IChannelStorageService {
16
- constructor(private readonly tree: ITree) {}
17
-
18
- public async readBlob(path: string): Promise<ArrayBufferLike> {
19
- const blob = this.readBlobSync(path);
20
- if (blob === undefined) {
21
- throw new Error("Blob Not Found");
22
- }
23
- return stringToBuffer(blob.contents, blob.encoding);
24
- }
25
-
26
- public async contains(path: string): Promise<boolean> {
27
- const blob = this.readBlobSync(path);
28
- return blob === undefined ? false : blob.contents !== undefined;
29
- }
30
-
31
- public async list(path: string): Promise<string[]> {
32
- return listBlobsAtTreePath(this.tree, path);
33
- }
34
-
35
- private readBlobSync(path: string): IBlob | undefined {
36
- return this.readBlobSyncInternal(path, this.tree);
37
- }
38
-
39
- private readBlobSyncInternal(path: string, tree: ITree): IBlob | undefined {
40
- for (const entry of tree.entries) {
41
- switch (entry.type) {
42
- case TreeEntry.Blob: {
43
- if (path === entry.path) {
44
- return entry.value;
45
- }
46
- break;
47
- }
48
-
49
- case TreeEntry.Tree: {
50
- if (path.startsWith(entry.path)) {
51
- return this.readBlobSyncInternal(path.slice(entry.path.length + 1), entry.value);
52
- }
53
- break;
54
- }
55
-
56
- default:
57
- }
58
- }
59
-
60
- return undefined;
61
- }
62
- }