@fluidframework/datastore 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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 (67) hide show
  1. package/.eslintrc.js +5 -7
  2. package/.mocharc.js +2 -2
  3. package/README.md +3 -0
  4. package/api-extractor.json +2 -2
  5. package/dist/channelContext.d.ts.map +1 -1
  6. package/dist/channelContext.js.map +1 -1
  7. package/dist/channelDeltaConnection.d.ts.map +1 -1
  8. package/dist/channelDeltaConnection.js.map +1 -1
  9. package/dist/channelStorageService.d.ts.map +1 -1
  10. package/dist/channelStorageService.js +1 -3
  11. package/dist/channelStorageService.js.map +1 -1
  12. package/dist/dataStoreRuntime.d.ts +10 -18
  13. package/dist/dataStoreRuntime.d.ts.map +1 -1
  14. package/dist/dataStoreRuntime.js +65 -83
  15. package/dist/dataStoreRuntime.js.map +1 -1
  16. package/dist/fluidHandle.d.ts.map +1 -1
  17. package/dist/fluidHandle.js.map +1 -1
  18. package/dist/localChannelContext.d.ts.map +1 -1
  19. package/dist/localChannelContext.js +9 -5
  20. package/dist/localChannelContext.js.map +1 -1
  21. package/dist/localChannelStorageService.d.ts.map +1 -1
  22. package/dist/localChannelStorageService.js.map +1 -1
  23. package/dist/packageVersion.d.ts +1 -1
  24. package/dist/packageVersion.js +1 -1
  25. package/dist/packageVersion.js.map +1 -1
  26. package/dist/remoteChannelContext.d.ts +2 -2
  27. package/dist/remoteChannelContext.d.ts.map +1 -1
  28. package/dist/remoteChannelContext.js +4 -4
  29. package/dist/remoteChannelContext.js.map +1 -1
  30. package/lib/channelContext.d.ts.map +1 -1
  31. package/lib/channelContext.js.map +1 -1
  32. package/lib/channelDeltaConnection.d.ts.map +1 -1
  33. package/lib/channelDeltaConnection.js.map +1 -1
  34. package/lib/channelStorageService.d.ts.map +1 -1
  35. package/lib/channelStorageService.js +1 -3
  36. package/lib/channelStorageService.js.map +1 -1
  37. package/lib/dataStoreRuntime.d.ts +10 -18
  38. package/lib/dataStoreRuntime.d.ts.map +1 -1
  39. package/lib/dataStoreRuntime.js +68 -86
  40. package/lib/dataStoreRuntime.js.map +1 -1
  41. package/lib/fluidHandle.d.ts.map +1 -1
  42. package/lib/fluidHandle.js.map +1 -1
  43. package/lib/localChannelContext.d.ts.map +1 -1
  44. package/lib/localChannelContext.js +9 -5
  45. package/lib/localChannelContext.js.map +1 -1
  46. package/lib/localChannelStorageService.d.ts.map +1 -1
  47. package/lib/localChannelStorageService.js.map +1 -1
  48. package/lib/packageVersion.d.ts +1 -1
  49. package/lib/packageVersion.js +1 -1
  50. package/lib/packageVersion.js.map +1 -1
  51. package/lib/remoteChannelContext.d.ts +2 -2
  52. package/lib/remoteChannelContext.d.ts.map +1 -1
  53. package/lib/remoteChannelContext.js +4 -4
  54. package/lib/remoteChannelContext.js.map +1 -1
  55. package/package.json +50 -49
  56. package/prettier.config.cjs +1 -1
  57. package/src/channelContext.ts +66 -65
  58. package/src/channelDeltaConnection.ts +50 -44
  59. package/src/channelStorageService.ts +58 -54
  60. package/src/dataStoreRuntime.ts +1131 -1087
  61. package/src/fluidHandle.ts +87 -91
  62. package/src/localChannelContext.ts +302 -255
  63. package/src/localChannelStorageService.ts +47 -45
  64. package/src/packageVersion.ts +1 -1
  65. package/src/remoteChannelContext.ts +297 -291
  66. package/tsconfig.esnext.json +6 -6
  67. package/tsconfig.json +9 -13
@@ -9,49 +9,51 @@ import { IBlob, ITree, TreeEntry } from "@fluidframework/protocol-definitions";
9
9
  import { listBlobsAtTreePath } from "@fluidframework/runtime-utils";
10
10
 
11
11
  export class LocalChannelStorageService implements IChannelStorageService {
12
- constructor(private readonly tree: ITree) {
13
- }
14
-
15
- public async readBlob(path: string): Promise<ArrayBufferLike> {
16
- const blob = this.readBlobSync(path);
17
- if (blob === undefined) {
18
- throw new Error("Blob Not Found");
19
- }
20
- return stringToBuffer(blob.contents, blob.encoding);
21
- }
22
-
23
- public async contains(path: string): Promise<boolean> {
24
- const blob = this.readBlobSync(path);
25
- return blob !== undefined ? blob.contents !== undefined : false;
26
- }
27
-
28
- public async list(path: string): Promise<string[]> {
29
- return listBlobsAtTreePath(this.tree, path);
30
- }
31
-
32
- private readBlobSync(path: string): IBlob | undefined {
33
- return this.readBlobSyncInternal(path, this.tree);
34
- }
35
-
36
- private readBlobSyncInternal(path: string, tree: ITree): IBlob | undefined {
37
- for (const entry of tree.entries) {
38
- switch (entry.type) {
39
- case TreeEntry.Blob:
40
- if (path === entry.path) {
41
- return entry.value;
42
- }
43
- break;
44
-
45
- case TreeEntry.Tree:
46
- if (path.startsWith(entry.path)) {
47
- return this.readBlobSyncInternal(path.substr(entry.path.length + 1), entry.value);
48
- }
49
- break;
50
-
51
- default:
52
- }
53
- }
54
-
55
- return undefined;
56
- }
12
+ constructor(private readonly tree: ITree) {}
13
+
14
+ public async readBlob(path: string): Promise<ArrayBufferLike> {
15
+ const blob = this.readBlobSync(path);
16
+ if (blob === undefined) {
17
+ throw new Error("Blob Not Found");
18
+ }
19
+ return stringToBuffer(blob.contents, blob.encoding);
20
+ }
21
+
22
+ public async contains(path: string): Promise<boolean> {
23
+ const blob = this.readBlobSync(path);
24
+ return blob !== undefined ? blob.contents !== undefined : false;
25
+ }
26
+
27
+ public async list(path: string): Promise<string[]> {
28
+ return listBlobsAtTreePath(this.tree, path);
29
+ }
30
+
31
+ private readBlobSync(path: string): IBlob | undefined {
32
+ return this.readBlobSyncInternal(path, this.tree);
33
+ }
34
+
35
+ private readBlobSyncInternal(path: string, tree: ITree): IBlob | undefined {
36
+ for (const entry of tree.entries) {
37
+ switch (entry.type) {
38
+ case TreeEntry.Blob:
39
+ if (path === entry.path) {
40
+ return entry.value;
41
+ }
42
+ break;
43
+
44
+ case TreeEntry.Tree:
45
+ if (path.startsWith(entry.path)) {
46
+ return this.readBlobSyncInternal(
47
+ path.substr(entry.path.length + 1),
48
+ entry.value,
49
+ );
50
+ }
51
+ break;
52
+
53
+ default:
54
+ }
55
+ }
56
+
57
+ return undefined;
58
+ }
57
59
  }
@@ -6,4 +6,4 @@
6
6
  */
7
7
 
8
8
  export const pkgName = "@fluidframework/datastore";
9
- export const pkgVersion = "2.0.0-internal.3.0.2";
9
+ export const pkgVersion = "2.0.0-internal.3.2.0";