@fluid-experimental/dds-interceptions 2.0.0-dev-rc.2.0.0.245554

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 (83) hide show
  1. package/.eslintrc.cjs +14 -0
  2. package/.mocharc.cjs +12 -0
  3. package/CHANGELOG.md +93 -0
  4. package/LICENSE +21 -0
  5. package/README.md +95 -0
  6. package/api-extractor-cjs.json +8 -0
  7. package/api-extractor-lint.json +4 -0
  8. package/api-extractor.json +4 -0
  9. package/api-report/dds-interceptions.api.md +24 -0
  10. package/dist/dds-interceptions-alpha.d.ts +13 -0
  11. package/dist/dds-interceptions-beta.d.ts +19 -0
  12. package/dist/dds-interceptions-public.d.ts +19 -0
  13. package/dist/dds-interceptions-untrimmed.d.ts +67 -0
  14. package/dist/index.d.ts +7 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +13 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/map/index.d.ts +7 -0
  19. package/dist/map/index.d.ts.map +1 -0
  20. package/dist/map/index.js +12 -0
  21. package/dist/map/index.js.map +1 -0
  22. package/dist/map/sharedDirectoryWithInterception.d.ts +29 -0
  23. package/dist/map/sharedDirectoryWithInterception.d.ts.map +1 -0
  24. package/dist/map/sharedDirectoryWithInterception.js +117 -0
  25. package/dist/map/sharedDirectoryWithInterception.js.map +1 -0
  26. package/dist/map/sharedMapWithInterception.d.ts +23 -0
  27. package/dist/map/sharedMapWithInterception.d.ts.map +1 -0
  28. package/dist/map/sharedMapWithInterception.js +49 -0
  29. package/dist/map/sharedMapWithInterception.js.map +1 -0
  30. package/dist/package.json +3 -0
  31. package/dist/sequence/index.d.ts +6 -0
  32. package/dist/sequence/index.d.ts.map +1 -0
  33. package/dist/sequence/index.js +10 -0
  34. package/dist/sequence/index.js.map +1 -0
  35. package/dist/sequence/sharedStringWithInterception.d.ts +27 -0
  36. package/dist/sequence/sharedStringWithInterception.d.ts.map +1 -0
  37. package/dist/sequence/sharedStringWithInterception.js +207 -0
  38. package/dist/sequence/sharedStringWithInterception.js.map +1 -0
  39. package/dist/tsdoc-metadata.json +11 -0
  40. package/lib/dds-interceptions-alpha.d.ts +13 -0
  41. package/lib/dds-interceptions-beta.d.ts +19 -0
  42. package/lib/dds-interceptions-public.d.ts +19 -0
  43. package/lib/dds-interceptions-untrimmed.d.ts +67 -0
  44. package/lib/index.d.ts +7 -0
  45. package/lib/index.d.ts.map +1 -0
  46. package/lib/index.js +7 -0
  47. package/lib/index.js.map +1 -0
  48. package/lib/map/index.d.ts +7 -0
  49. package/lib/map/index.d.ts.map +1 -0
  50. package/lib/map/index.js +7 -0
  51. package/lib/map/index.js.map +1 -0
  52. package/lib/map/sharedDirectoryWithInterception.d.ts +29 -0
  53. package/lib/map/sharedDirectoryWithInterception.d.ts.map +1 -0
  54. package/lib/map/sharedDirectoryWithInterception.js +113 -0
  55. package/lib/map/sharedDirectoryWithInterception.js.map +1 -0
  56. package/lib/map/sharedMapWithInterception.d.ts +23 -0
  57. package/lib/map/sharedMapWithInterception.d.ts.map +1 -0
  58. package/lib/map/sharedMapWithInterception.js +45 -0
  59. package/lib/map/sharedMapWithInterception.js.map +1 -0
  60. package/lib/sequence/index.d.ts +6 -0
  61. package/lib/sequence/index.d.ts.map +1 -0
  62. package/lib/sequence/index.js +6 -0
  63. package/lib/sequence/index.js.map +1 -0
  64. package/lib/sequence/sharedStringWithInterception.d.ts +27 -0
  65. package/lib/sequence/sharedStringWithInterception.d.ts.map +1 -0
  66. package/lib/sequence/sharedStringWithInterception.js +203 -0
  67. package/lib/sequence/sharedStringWithInterception.js.map +1 -0
  68. package/lib/test/sharedDirectoryWithInterception.spec.js +282 -0
  69. package/lib/test/sharedDirectoryWithInterception.spec.js.map +1 -0
  70. package/lib/test/sharedMapWithInterception.spec.js +105 -0
  71. package/lib/test/sharedMapWithInterception.spec.js.map +1 -0
  72. package/lib/test/sharedStringWithInterception.spec.js +147 -0
  73. package/lib/test/sharedStringWithInterception.spec.js.map +1 -0
  74. package/package.json +151 -0
  75. package/prettier.config.cjs +8 -0
  76. package/src/index.ts +7 -0
  77. package/src/map/index.ts +7 -0
  78. package/src/map/sharedDirectoryWithInterception.ts +172 -0
  79. package/src/map/sharedMapWithInterception.ts +58 -0
  80. package/src/sequence/index.ts +6 -0
  81. package/src/sequence/sharedStringWithInterception.ts +288 -0
  82. package/tsconfig.cjs.json +7 -0
  83. package/tsconfig.json +9 -0
package/.eslintrc.cjs ADDED
@@ -0,0 +1,14 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ module.exports = {
7
+ extends: [
8
+ require.resolve("@fluidframework/eslint-config-fluid/minimal-deprecated"),
9
+ "prettier",
10
+ ],
11
+ parserOptions: {
12
+ project: ["./tsconfig.json", "./src/test/tsconfig.json"],
13
+ },
14
+ };
package/.mocharc.cjs ADDED
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ "use strict";
7
+
8
+ const getFluidTestMochaConfig = require("@fluid-internal/mocha-test-setup/mocharc-common");
9
+
10
+ const packageDir = __dirname;
11
+ const config = getFluidTestMochaConfig(packageDir);
12
+ module.exports = config;
package/CHANGELOG.md ADDED
@@ -0,0 +1,93 @@
1
+ # @fluidframework/dds-interceptions
2
+
3
+ ## 2.0.0-rc.2.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - @fluidframework/dds-interceptions is now considered experimental ([#19679](https://github.com/microsoft/FluidFramework/issues/19679)) [181d802c9b](https://github.com/microsoft/FluidFramework/commits/181d802c9bb990ec3464d0c9d78126b05fa06cd3)
8
+
9
+ The DDS interception pattern was intended to support attribution scenarios but is now in process of being replaced by a different attributor approach. It is not recommended for use.
10
+
11
+ ## 2.0.0-rc.1.0.0
12
+
13
+ Dependency updates only.
14
+
15
+ ## 2.0.0-internal.8.0.0
16
+
17
+ Dependency updates only.
18
+
19
+ ## 2.0.0-internal.7.4.0
20
+
21
+ Dependency updates only.
22
+
23
+ ## 2.0.0-internal.7.3.0
24
+
25
+ Dependency updates only.
26
+
27
+ ## 2.0.0-internal.7.2.0
28
+
29
+ Dependency updates only.
30
+
31
+ ## 2.0.0-internal.7.1.0
32
+
33
+ Dependency updates only.
34
+
35
+ ## 2.0.0-internal.7.0.0
36
+
37
+ ### Major Changes
38
+
39
+ - Minimum TypeScript version now 5.1.6 [871b3493dd](https://github.com/microsoft/FluidFramework/commits/871b3493dd0d7ea3a89be64998ceb6cb9021a04e)
40
+
41
+ The minimum supported TypeScript version for Fluid 2.0 clients is now 5.1.6.
42
+
43
+ ## 2.0.0-internal.6.4.0
44
+
45
+ Dependency updates only.
46
+
47
+ ## 2.0.0-internal.6.3.0
48
+
49
+ Dependency updates only.
50
+
51
+ ## 2.0.0-internal.6.2.0
52
+
53
+ Dependency updates only.
54
+
55
+ ## 2.0.0-internal.6.1.0
56
+
57
+ Dependency updates only.
58
+
59
+ ## 2.0.0-internal.6.0.0
60
+
61
+ ### Major Changes
62
+
63
+ - Upgraded typescript transpilation target to ES2020 [8abce8cdb4](https://github.com/microsoft/FluidFramework/commits/8abce8cdb4e2832fb6405fb44e393bef03d5648a)
64
+
65
+ Upgraded typescript transpilation target to ES2020. This is done in order to decrease the bundle sizes of Fluid Framework packages. This has provided size improvements across the board for ex. Loader, Driver, Runtime etc. Reduced bundle sizes helps to load lesser code in apps and hence also helps to improve the perf.If any app wants to target any older versions of browsers with which this target version is not compatible, then they can use packages like babel to transpile to a older target.
66
+
67
+ ## 2.0.0-internal.5.4.0
68
+
69
+ Dependency updates only.
70
+
71
+ ## 2.0.0-internal.5.3.0
72
+
73
+ Dependency updates only.
74
+
75
+ ## 2.0.0-internal.5.2.0
76
+
77
+ Dependency updates only.
78
+
79
+ ## 2.0.0-internal.5.1.0
80
+
81
+ Dependency updates only.
82
+
83
+ ## 2.0.0-internal.5.0.0
84
+
85
+ Dependency updates only.
86
+
87
+ ## 2.0.0-internal.4.4.0
88
+
89
+ Dependency updates only.
90
+
91
+ ## 2.0.0-internal.4.1.0
92
+
93
+ Dependency updates only.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) Microsoft Corporation and contributors. All rights reserved.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+ # @fluid-experimental/dds-interceptions
2
+
3
+ This package provides factory methods to create a wrapper around some of the basic Distributed Data Structures (DDS) that support an interception callback. Apps can provide a callback when creating these wrappers and this callback will be called when the DDS is modified. This allows apps to support features such as basic user attribution on a SharedString.
4
+
5
+ <!-- AUTO-GENERATED-CONTENT:START (README_DEPENDENCY_GUIDELINES_SECTION:includeHeading=TRUE) -->
6
+
7
+ <!-- prettier-ignore-start -->
8
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
9
+
10
+ ## Using Fluid Framework libraries
11
+
12
+ When taking a dependency on a Fluid Framework library, we recommend using a `^` (caret) version range, such as `^1.3.4`.
13
+ While Fluid Framework libraries may use different ranges with interdependencies between other Fluid Framework libraries,
14
+ library consumers should always prefer `^`.
15
+
16
+ <!-- prettier-ignore-end -->
17
+
18
+ <!-- AUTO-GENERATED-CONTENT:END -->
19
+
20
+ ## Shared String With Interception
21
+
22
+ It provides `createSharedStringWithInterception` that accepts a SharedString, the data store context and a callback, and returns a SharedString object:
23
+
24
+ ```typescript
25
+ function createSharedStringWithInterception(
26
+ sharedString: SharedString,
27
+ context: IFluidDataStoreContext,
28
+ propertyInterceptionCallback: (props?: MergeTree.PropertySet) => MergeTree.PropertySet,
29
+ ): SharedString;
30
+ ```
31
+
32
+ When a function is called that modifies the SharedString (for example, insertText), it calls propertyInterceptionCallback with the provided properties. The callback function can then provide the new set of properties that it wants to set. The operation in the called function and any operations in the callback are batched, i.e., they are guaranteed to be in order and will be applied together.
33
+
34
+ For example, to support a feature like simple user attribution, the app can append the user information to the properties in the callback. The user information can than be retrieved by getting the properties at any position.
35
+
36
+ ## Shared Map With Interception
37
+
38
+ It provides `createSharedMapWithInterception` that accepts a SharedMap, the data store context and a callback, and returns a SharedMap object:
39
+
40
+ ```typescript
41
+ function createSharedMapWithInterception(
42
+ sharedMap: SharedMap,
43
+ context: IFluidDataStoreContext,
44
+ setInterceptionCallback: (sharedMap: ISharedMap, key: string, value: any) => void,
45
+ ): SharedMap;
46
+ ```
47
+
48
+ When set is called on the SharedMap, it calls setInterceptionCallback with the underlying SharedMap, the key and value that the set was called with. The callback function can then perform operations on either the underlying SharedMap or any other DDS. The original set operation and any operations in the callback are batched, i.e., they are guaranteed to be in order and will be applied together.
49
+
50
+ Example: To support a feature like simple user attribution, in the callback, the app can set the user information in the underlying SharedMap against a key derived from the original key - say against "key.attribute". Or, it could use a separate SharedMap to store the user information against the same key.
51
+
52
+ ## Shared Directory / Sub Directory With Interception
53
+
54
+ It provides `createdDirectoryWithInterception` that accepts an IDirectory object, the data store context and a callback, and returns an IDirectory object:
55
+
56
+ ```typescript
57
+ function createDirectoryWithInterception<T extends IDirectory>(
58
+ baseDirectory: T,
59
+ context: IFluidDataStoreContext,
60
+ setInterceptionCallback: (
61
+ baseDirectory: IDirectory,
62
+ subDirectory: IDirectory,
63
+ key: string,
64
+ value: any,
65
+ ) => void,
66
+ ): T;
67
+ ```
68
+
69
+ It can be used to wrap a SharedDirectory or one of it's subdirectories to get an interception callback when set is called on the object. The callback function is passed the following:
70
+
71
+ - baseDirectory: This is the outermost directory in this directory structure that was wrapped. For example, when a SharedDirectory (say 'root') is wrapped, then a set on it or any of its sub directories will be passed 'root' as the baseDirectory.
72
+ - subDirectory: This is the directory that the set is called on and which calls the callback.
73
+ - key: They key that set was called with.
74
+ - value: They value that set was called with.
75
+
76
+ The original set operation and any operations in the callback function are batched, i.e., they are guaranteed to in order and will be applied together.
77
+
78
+ Example: To support a feature like simple user attribution, in the callback, the app can set the user information in a sub directory of the original object against the same key.
79
+
80
+ <!-- AUTO-GENERATED-CONTENT:START (README_TRADEMARK_SECTION:includeHeading=TRUE) -->
81
+
82
+ <!-- prettier-ignore-start -->
83
+ <!-- NOTE: This section is automatically generated using @fluid-tools/markdown-magic. Do not update these generated contents directly. -->
84
+
85
+ ## Trademark
86
+
87
+ This project may contain Microsoft trademarks or logos for Microsoft projects, products, or services.
88
+
89
+ Use of these trademarks or logos must follow Microsoft's [Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
90
+
91
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
92
+
93
+ <!-- prettier-ignore-end -->
94
+
95
+ <!-- AUTO-GENERATED-CONTENT:END -->
@@ -0,0 +1,8 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-base.cjs.primary.json",
4
+ // CJS is actually secondary; so, no report.
5
+ "apiReport": {
6
+ "enabled": false
7
+ }
8
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-lint.json"
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "$schema": "https://developer.microsoft.com/json-schemas/api-extractor/v7/api-extractor.schema.json",
3
+ "extends": "../../../common/build/build-common/api-extractor-base.esm.primary.json"
4
+ }
@@ -0,0 +1,24 @@
1
+ ## API Report File for "@fluid-experimental/dds-interceptions"
2
+
3
+ > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4
+
5
+ ```ts
6
+
7
+ import { IDirectory } from '@fluidframework/map';
8
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
9
+ import { ISharedMap } from '@fluidframework/map';
10
+ import * as MergeTree from '@fluidframework/merge-tree';
11
+ import { SharedString } from '@fluidframework/sequence';
12
+
13
+ // @internal
14
+ export function createDirectoryWithInterception<T extends IDirectory>(baseDirectory: T, context: IFluidDataStoreContext, setInterceptionCallback: (baseDirectory: IDirectory, subDirectory: IDirectory, key: string, value: any) => void): T;
15
+
16
+ // @internal
17
+ export function createSharedMapWithInterception(sharedMap: ISharedMap, context: IFluidDataStoreContext, setInterceptionCallback: (sharedMap: ISharedMap, key: string, value: any) => void): ISharedMap;
18
+
19
+ // @internal
20
+ export function createSharedStringWithInterception(sharedString: SharedString, context: IFluidDataStoreContext, propertyInterceptionCallback: (props?: MergeTree.PropertySet) => MergeTree.PropertySet): SharedString;
21
+
22
+ // (No @packageDocumentation comment for this package)
23
+
24
+ ```
@@ -0,0 +1,13 @@
1
+ import { IDirectory } from '@fluidframework/map';
2
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
3
+ import { ISharedMap } from '@fluidframework/map';
4
+ import * as MergeTree from '@fluidframework/merge-tree';
5
+ import { SharedString } from '@fluidframework/sequence';
6
+
7
+ /* Excluded from this release type: createDirectoryWithInterception */
8
+
9
+ /* Excluded from this release type: createSharedMapWithInterception */
10
+
11
+ /* Excluded from this release type: createSharedStringWithInterception */
12
+
13
+ export { }
@@ -0,0 +1,19 @@
1
+ import { IDirectory } from '@fluidframework/map';
2
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
3
+ import { ISharedMap } from '@fluidframework/map';
4
+ import * as MergeTree from '@fluidframework/merge-tree';
5
+ import { SharedString } from '@fluidframework/sequence';
6
+
7
+ /* Excluded from this release type: createDirectoryWithInterception */
8
+
9
+ /* Excluded from this release type: createSharedMapWithInterception */
10
+
11
+ /* Excluded from this release type: createSharedStringWithInterception */
12
+
13
+ /* Excluded from this release type: IDirectory */
14
+
15
+ /* Excluded from this release type: IFluidDataStoreContext */
16
+
17
+ /* Excluded from this release type: SharedString */
18
+
19
+ export { }
@@ -0,0 +1,19 @@
1
+ import { IDirectory } from '@fluidframework/map';
2
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
3
+ import { ISharedMap } from '@fluidframework/map';
4
+ import * as MergeTree from '@fluidframework/merge-tree';
5
+ import { SharedString } from '@fluidframework/sequence';
6
+
7
+ /* Excluded from this release type: createDirectoryWithInterception */
8
+
9
+ /* Excluded from this release type: createSharedMapWithInterception */
10
+
11
+ /* Excluded from this release type: createSharedStringWithInterception */
12
+
13
+ /* Excluded from this release type: IDirectory */
14
+
15
+ /* Excluded from this release type: IFluidDataStoreContext */
16
+
17
+ /* Excluded from this release type: SharedString */
18
+
19
+ export { }
@@ -0,0 +1,67 @@
1
+ import { IDirectory } from '@fluidframework/map';
2
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions';
3
+ import { ISharedMap } from '@fluidframework/map';
4
+ import * as MergeTree from '@fluidframework/merge-tree';
5
+ import { SharedString } from '@fluidframework/sequence';
6
+
7
+ /**
8
+ * - Create a new object from the passed IDirectory object.
9
+ *
10
+ * - Modify the set method to call the setInterceptionCallback before calling set on the underlying object.
11
+ *
12
+ * - The setInterceptionCallback and the call to the underlying object are wrapped around an orderSequentially
13
+ * call to batch any operations that might happen in the callback.
14
+ *
15
+ * - Modify the sub directory methods to create / return a wrapper object that in turn intercepts the set method and
16
+ * calls the setInterceptionCallback.
17
+ *
18
+ * - When a sub directory is created from this directory, this directory object is passed to it which is passed into
19
+ * the interception callback.
20
+ *
21
+ * @param baseDirectory - The underlying object that is to be intercepted
22
+ * @param context - The IFluidDataStoreContext that will be used to call orderSequentially
23
+ * @param setInterceptionCallback - The interception callback to be called
24
+ *
25
+ * @returns A new IDirectory object that intercepts the set method and calls the setInterceptionCallback.
26
+ * @internal
27
+ */
28
+ export declare function createDirectoryWithInterception<T extends IDirectory>(baseDirectory: T, context: IFluidDataStoreContext, setInterceptionCallback: (baseDirectory: IDirectory, subDirectory: IDirectory, key: string, value: any) => void): T;
29
+
30
+ /**
31
+ * - Create a new object from the passed SharedMap.
32
+ *
33
+ * - Modify the set method to call the setInterceptionCallback before calling set on the underlying SharedMap.
34
+ *
35
+ * - The setInterceptionCallback and the call to the underlying SharedMap are wrapped around an
36
+ * orderSequentially call to batch any operations that might happen in the callback.
37
+ *
38
+ * @param sharedMap - The underlying SharedMap
39
+ * @param context - The IFluidDataStoreContext that will be used to call orderSequentially
40
+ * @param setInterceptionCallback - The interception callback to be called
41
+ *
42
+ * @returns A new SharedMap that intercepts the set method and calls the setInterceptionCallback.
43
+ * @internal
44
+ */
45
+ export declare function createSharedMapWithInterception(sharedMap: ISharedMap, context: IFluidDataStoreContext, setInterceptionCallback: (sharedMap: ISharedMap, key: string, value: any) => void): ISharedMap;
46
+
47
+ /**
48
+ * - Create a new object from the passed SharedString.
49
+ *
50
+ * - Modify the methods that insert / remove / annotate the properties of the SharedString to call
51
+ * the propertyInterceptionCallback to get new properties.
52
+ *
53
+ * - Use these new properties to call the underlying SharedString.
54
+ *
55
+ * - The propertyInterceptionCallback and the call to the underlying SharedString are wrapped around an
56
+ * orderSequentially call to batch any operations that might happen in the callback.
57
+ *
58
+ * @param sharedString - The underlying SharedString
59
+ * @param context - The IFluidDataStoreContext that will be used to call orderSequentially
60
+ * @param propertyInterceptionCallback - The interception callback to be called
61
+ *
62
+ * @returns A new SharedString that intercepts the methods modifying the SharedString properties.
63
+ * @internal
64
+ */
65
+ export declare function createSharedStringWithInterception(sharedString: SharedString, context: IFluidDataStoreContext, propertyInterceptionCallback: (props?: MergeTree.PropertySet) => MergeTree.PropertySet): SharedString;
66
+
67
+ export { }
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { createDirectoryWithInterception, createSharedMapWithInterception } from "./map/index.js";
6
+ export { createSharedStringWithInterception } from "./sequence/index.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,+BAA+B,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAE,kCAAkC,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
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.createSharedStringWithInterception = exports.createSharedMapWithInterception = exports.createDirectoryWithInterception = void 0;
8
+ var index_js_1 = require("./map/index.js");
9
+ Object.defineProperty(exports, "createDirectoryWithInterception", { enumerable: true, get: function () { return index_js_1.createDirectoryWithInterception; } });
10
+ Object.defineProperty(exports, "createSharedMapWithInterception", { enumerable: true, get: function () { return index_js_1.createSharedMapWithInterception; } });
11
+ var index_js_2 = require("./sequence/index.js");
12
+ Object.defineProperty(exports, "createSharedStringWithInterception", { enumerable: true, get: function () { return index_js_2.createSharedStringWithInterception; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2CAAkG;AAAzF,2HAAA,+BAA+B,OAAA;AAAE,2HAAA,+BAA+B,OAAA;AACzE,gDAAyE;AAAhE,8HAAA,kCAAkC,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { createDirectoryWithInterception, createSharedMapWithInterception } from \"./map/index.js\";\nexport { createSharedStringWithInterception } from \"./sequence/index.js\";\n"]}
@@ -0,0 +1,7 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ export { createDirectoryWithInterception } from "./sharedDirectoryWithInterception.js";
6
+ export { createSharedMapWithInterception } from "./sharedMapWithInterception.js";
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC"}
@@ -0,0 +1,12 @@
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.createSharedMapWithInterception = exports.createDirectoryWithInterception = void 0;
8
+ var sharedDirectoryWithInterception_js_1 = require("./sharedDirectoryWithInterception.js");
9
+ Object.defineProperty(exports, "createDirectoryWithInterception", { enumerable: true, get: function () { return sharedDirectoryWithInterception_js_1.createDirectoryWithInterception; } });
10
+ var sharedMapWithInterception_js_1 = require("./sharedMapWithInterception.js");
11
+ Object.defineProperty(exports, "createSharedMapWithInterception", { enumerable: true, get: function () { return sharedMapWithInterception_js_1.createSharedMapWithInterception; } });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/map/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2FAAuF;AAA9E,qJAAA,+BAA+B,OAAA;AACxC,+EAAiF;AAAxE,+IAAA,+BAA+B,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { createDirectoryWithInterception } from \"./sharedDirectoryWithInterception.js\";\nexport { createSharedMapWithInterception } from \"./sharedMapWithInterception.js\";\n"]}
@@ -0,0 +1,29 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { IDirectory } from "@fluidframework/map";
6
+ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
7
+ /**
8
+ * - Create a new object from the passed IDirectory object.
9
+ *
10
+ * - Modify the set method to call the setInterceptionCallback before calling set on the underlying object.
11
+ *
12
+ * - The setInterceptionCallback and the call to the underlying object are wrapped around an orderSequentially
13
+ * call to batch any operations that might happen in the callback.
14
+ *
15
+ * - Modify the sub directory methods to create / return a wrapper object that in turn intercepts the set method and
16
+ * calls the setInterceptionCallback.
17
+ *
18
+ * - When a sub directory is created from this directory, this directory object is passed to it which is passed into
19
+ * the interception callback.
20
+ *
21
+ * @param baseDirectory - The underlying object that is to be intercepted
22
+ * @param context - The IFluidDataStoreContext that will be used to call orderSequentially
23
+ * @param setInterceptionCallback - The interception callback to be called
24
+ *
25
+ * @returns A new IDirectory object that intercepts the set method and calls the setInterceptionCallback.
26
+ * @internal
27
+ */
28
+ export declare function createDirectoryWithInterception<T extends IDirectory>(baseDirectory: T, context: IFluidDataStoreContext, setInterceptionCallback: (baseDirectory: IDirectory, subDirectory: IDirectory, key: string, value: any) => void): T;
29
+ //# sourceMappingURL=sharedDirectoryWithInterception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedDirectoryWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AA+H7E;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,+BAA+B,CAAC,CAAC,SAAS,UAAU,EACnE,aAAa,EAAE,CAAC,EAChB,OAAO,EAAE,sBAAsB,EAC/B,uBAAuB,EAAE,CACxB,aAAa,EAAE,UAAU,EACzB,YAAY,EAAE,UAAU,EACxB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,GAAG,KACN,IAAI,GACP,CAAC,CAOH"}
@@ -0,0 +1,117 @@
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.createDirectoryWithInterception = void 0;
8
+ const core_utils_1 = require("@fluidframework/core-utils");
9
+ /**
10
+ * - Create a new object from the passed subDirectory.
11
+ *
12
+ * - Modify the set method to call the setInterceptionCallback before calling set on the underlying object.
13
+ *
14
+ * - The setInterceptionCallback and the call to the underlying object are wrapped around an orderSequentially
15
+ * call to batch any operations that might happen in the callback.
16
+ *
17
+ * - Modify the sub directory methods to create / return a wrapper object that in turn intercepts the set method and
18
+ * calls the setInterceptionCallback.
19
+ *
20
+ * - When a sub directory is created from this directory, this base directory object is passed to it which is passed
21
+ * into the interception callback.
22
+ *
23
+ * @param baseDirectory - The base directory in the directory structure that is passed to the interception callback
24
+ * @param subDirectory - The underlying object that is to be intercepted
25
+ * @param context - The IFluidDataStoreContext that will be used to call orderSequentially
26
+ * @param setInterceptionCallback - The interception callback to be called
27
+ *
28
+ * @returns A new sub directory that intercepts the set method and calls the setInterceptionCallback.
29
+ */
30
+ function createSubDirectoryWithInterception(baseDirectory, subDirectory, context, setInterceptionCallback) {
31
+ const subDirectoryWithInterception = Object.create(subDirectory);
32
+ // executingCallback keeps track of whether set is called recursively from the setInterceptionCallback.
33
+ let executingCallback = false;
34
+ subDirectoryWithInterception.set = (key, value) => {
35
+ let directory;
36
+ // Set should not be called on the wrapped object from the interception callback as this will lead to
37
+ // infinite recursion.
38
+ (0, core_utils_1.assert)(executingCallback === false, 0x0bf /* "set called recursively from the interception callback" */);
39
+ context.containerRuntime.orderSequentially(() => {
40
+ directory = subDirectory.set(key, value);
41
+ executingCallback = true;
42
+ try {
43
+ setInterceptionCallback(baseDirectory, subDirectory, key, value);
44
+ }
45
+ finally {
46
+ executingCallback = false;
47
+ }
48
+ });
49
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
50
+ return directory;
51
+ };
52
+ subDirectoryWithInterception.createSubDirectory = (subdirName) => {
53
+ const subSubDirectory = subDirectory.createSubDirectory(subdirName);
54
+ return createSubDirectoryWithInterception(baseDirectory, subSubDirectory, context, setInterceptionCallback);
55
+ };
56
+ subDirectoryWithInterception.getSubDirectory = (subdirName) => {
57
+ const subSubDirectory = subDirectory.getSubDirectory(subdirName);
58
+ return subSubDirectory === undefined
59
+ ? subSubDirectory
60
+ : createSubDirectoryWithInterception(baseDirectory, subSubDirectory, context, setInterceptionCallback);
61
+ };
62
+ subDirectoryWithInterception.subdirectories = () => {
63
+ const localDirectoriesIterator = subDirectory.subdirectories();
64
+ const iterator = {
65
+ next() {
66
+ const nextVal = localDirectoriesIterator.next();
67
+ // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
68
+ if (nextVal.done) {
69
+ return { value: undefined, done: true };
70
+ }
71
+ else {
72
+ // Wrap the stored subdirectory in the interception wrapper.
73
+ const subDir = createSubDirectoryWithInterception(baseDirectory, nextVal.value[1], context, setInterceptionCallback);
74
+ return { value: [nextVal.value[0], subDir], done: false };
75
+ }
76
+ },
77
+ [Symbol.iterator]() {
78
+ return this;
79
+ },
80
+ };
81
+ return iterator;
82
+ };
83
+ subDirectoryWithInterception.getWorkingDirectory = (relativePath) => {
84
+ const subSubDirectory = subDirectory.getWorkingDirectory(relativePath);
85
+ return subSubDirectory === undefined
86
+ ? subSubDirectory
87
+ : createSubDirectoryWithInterception(baseDirectory, subSubDirectory, context, setInterceptionCallback);
88
+ };
89
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
90
+ return subDirectoryWithInterception;
91
+ }
92
+ /**
93
+ * - Create a new object from the passed IDirectory object.
94
+ *
95
+ * - Modify the set method to call the setInterceptionCallback before calling set on the underlying object.
96
+ *
97
+ * - The setInterceptionCallback and the call to the underlying object are wrapped around an orderSequentially
98
+ * call to batch any operations that might happen in the callback.
99
+ *
100
+ * - Modify the sub directory methods to create / return a wrapper object that in turn intercepts the set method and
101
+ * calls the setInterceptionCallback.
102
+ *
103
+ * - When a sub directory is created from this directory, this directory object is passed to it which is passed into
104
+ * the interception callback.
105
+ *
106
+ * @param baseDirectory - The underlying object that is to be intercepted
107
+ * @param context - The IFluidDataStoreContext that will be used to call orderSequentially
108
+ * @param setInterceptionCallback - The interception callback to be called
109
+ *
110
+ * @returns A new IDirectory object that intercepts the set method and calls the setInterceptionCallback.
111
+ * @internal
112
+ */
113
+ function createDirectoryWithInterception(baseDirectory, context, setInterceptionCallback) {
114
+ return createSubDirectoryWithInterception(baseDirectory, baseDirectory, context, setInterceptionCallback);
115
+ }
116
+ exports.createDirectoryWithInterception = createDirectoryWithInterception;
117
+ //# sourceMappingURL=sharedDirectoryWithInterception.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedDirectoryWithInterception.js","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDirectory } from \"@fluidframework/map\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\n\n/**\n * - Create a new object from the passed subDirectory.\n *\n * - Modify the set method to call the setInterceptionCallback before calling set on the underlying object.\n *\n * - The setInterceptionCallback and the call to the underlying object are wrapped around an orderSequentially\n * call to batch any operations that might happen in the callback.\n *\n * - Modify the sub directory methods to create / return a wrapper object that in turn intercepts the set method and\n * calls the setInterceptionCallback.\n *\n * - When a sub directory is created from this directory, this base directory object is passed to it which is passed\n * into the interception callback.\n *\n * @param baseDirectory - The base directory in the directory structure that is passed to the interception callback\n * @param subDirectory - The underlying object that is to be intercepted\n * @param context - The IFluidDataStoreContext that will be used to call orderSequentially\n * @param setInterceptionCallback - The interception callback to be called\n *\n * @returns A new sub directory that intercepts the set method and calls the setInterceptionCallback.\n */\nfunction createSubDirectoryWithInterception<T extends IDirectory>(\n\tbaseDirectory: T,\n\tsubDirectory: T,\n\tcontext: IFluidDataStoreContext,\n\tsetInterceptionCallback: (\n\t\tbaseDirectory: IDirectory,\n\t\tsubDirectory: IDirectory,\n\t\tkey: string,\n\t\tvalue: any,\n\t) => void,\n): T {\n\tconst subDirectoryWithInterception = Object.create(subDirectory);\n\n\t// executingCallback keeps track of whether set is called recursively from the setInterceptionCallback.\n\tlet executingCallback: boolean = false;\n\n\tsubDirectoryWithInterception.set = (key: string, value: any) => {\n\t\tlet directory;\n\t\t// Set should not be called on the wrapped object from the interception callback as this will lead to\n\t\t// infinite recursion.\n\t\tassert(\n\t\t\texecutingCallback === false,\n\t\t\t0x0bf /* \"set called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\tdirectory = subDirectory.set(key, value);\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsetInterceptionCallback(baseDirectory, subDirectory, key, value);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\treturn directory;\n\t};\n\n\tsubDirectoryWithInterception.createSubDirectory = (subdirName: string): IDirectory => {\n\t\tconst subSubDirectory = subDirectory.createSubDirectory(subdirName);\n\t\treturn createSubDirectoryWithInterception(\n\t\t\tbaseDirectory,\n\t\t\tsubSubDirectory,\n\t\t\tcontext,\n\t\t\tsetInterceptionCallback,\n\t\t);\n\t};\n\n\tsubDirectoryWithInterception.getSubDirectory = (subdirName: string): IDirectory | undefined => {\n\t\tconst subSubDirectory = subDirectory.getSubDirectory(subdirName);\n\t\treturn subSubDirectory === undefined\n\t\t\t? subSubDirectory\n\t\t\t: createSubDirectoryWithInterception(\n\t\t\t\t\tbaseDirectory,\n\t\t\t\t\tsubSubDirectory,\n\t\t\t\t\tcontext,\n\t\t\t\t\tsetInterceptionCallback,\n\t\t\t );\n\t};\n\n\tsubDirectoryWithInterception.subdirectories = (): IterableIterator<[string, IDirectory]> => {\n\t\tconst localDirectoriesIterator = subDirectory.subdirectories();\n\t\tconst iterator = {\n\t\t\tnext(): IteratorResult<[string, IDirectory]> {\n\t\t\t\tconst nextVal = localDirectoriesIterator.next();\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\t\t\tif (nextVal.done) {\n\t\t\t\t\treturn { value: undefined, done: true };\n\t\t\t\t} else {\n\t\t\t\t\t// Wrap the stored subdirectory in the interception wrapper.\n\t\t\t\t\tconst subDir = createSubDirectoryWithInterception(\n\t\t\t\t\t\tbaseDirectory,\n\t\t\t\t\t\tnextVal.value[1],\n\t\t\t\t\t\tcontext,\n\t\t\t\t\t\tsetInterceptionCallback,\n\t\t\t\t\t);\n\t\t\t\t\treturn { value: [nextVal.value[0], subDir], done: false };\n\t\t\t\t}\n\t\t\t},\n\t\t\t[Symbol.iterator]() {\n\t\t\t\treturn this;\n\t\t\t},\n\t\t};\n\t\treturn iterator;\n\t};\n\n\tsubDirectoryWithInterception.getWorkingDirectory = (\n\t\trelativePath: string,\n\t): IDirectory | undefined => {\n\t\tconst subSubDirectory = subDirectory.getWorkingDirectory(relativePath);\n\t\treturn subSubDirectory === undefined\n\t\t\t? subSubDirectory\n\t\t\t: createSubDirectoryWithInterception(\n\t\t\t\t\tbaseDirectory,\n\t\t\t\t\tsubSubDirectory,\n\t\t\t\t\tcontext,\n\t\t\t\t\tsetInterceptionCallback,\n\t\t\t );\n\t};\n\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn subDirectoryWithInterception;\n}\n\n/**\n * - Create a new object from the passed IDirectory object.\n *\n * - Modify the set method to call the setInterceptionCallback before calling set on the underlying object.\n *\n * - The setInterceptionCallback and the call to the underlying object are wrapped around an orderSequentially\n * call to batch any operations that might happen in the callback.\n *\n * - Modify the sub directory methods to create / return a wrapper object that in turn intercepts the set method and\n * calls the setInterceptionCallback.\n *\n * - When a sub directory is created from this directory, this directory object is passed to it which is passed into\n * the interception callback.\n *\n * @param baseDirectory - The underlying object that is to be intercepted\n * @param context - The IFluidDataStoreContext that will be used to call orderSequentially\n * @param setInterceptionCallback - The interception callback to be called\n *\n * @returns A new IDirectory object that intercepts the set method and calls the setInterceptionCallback.\n * @internal\n */\nexport function createDirectoryWithInterception<T extends IDirectory>(\n\tbaseDirectory: T,\n\tcontext: IFluidDataStoreContext,\n\tsetInterceptionCallback: (\n\t\tbaseDirectory: IDirectory,\n\t\tsubDirectory: IDirectory,\n\t\tkey: string,\n\t\tvalue: any,\n\t) => void,\n): T {\n\treturn createSubDirectoryWithInterception(\n\t\tbaseDirectory,\n\t\tbaseDirectory,\n\t\tcontext,\n\t\tsetInterceptionCallback,\n\t);\n}\n"]}