@fluid-experimental/dds-interceptions 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.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 (46) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/api-report/dds-interceptions.api.md +5 -5
  3. package/dist/map/sharedDirectoryWithInterception.d.ts +2 -2
  4. package/dist/map/sharedDirectoryWithInterception.d.ts.map +1 -1
  5. package/dist/map/sharedDirectoryWithInterception.js +2 -2
  6. package/dist/map/sharedDirectoryWithInterception.js.map +1 -1
  7. package/dist/map/sharedMapWithInterception.d.ts +2 -2
  8. package/dist/map/sharedMapWithInterception.d.ts.map +1 -1
  9. package/dist/map/sharedMapWithInterception.js +2 -2
  10. package/dist/map/sharedMapWithInterception.js.map +1 -1
  11. package/dist/sequence/sharedStringWithInterception.d.ts +3 -3
  12. package/dist/sequence/sharedStringWithInterception.d.ts.map +1 -1
  13. package/dist/sequence/sharedStringWithInterception.js +9 -9
  14. package/dist/sequence/sharedStringWithInterception.js.map +1 -1
  15. package/lib/map/sharedDirectoryWithInterception.d.ts +2 -2
  16. package/lib/map/sharedDirectoryWithInterception.d.ts.map +1 -1
  17. package/lib/map/sharedDirectoryWithInterception.js +1 -1
  18. package/lib/map/sharedDirectoryWithInterception.js.map +1 -1
  19. package/lib/map/sharedMapWithInterception.d.ts +2 -2
  20. package/lib/map/sharedMapWithInterception.d.ts.map +1 -1
  21. package/lib/map/sharedMapWithInterception.js +1 -1
  22. package/lib/map/sharedMapWithInterception.js.map +1 -1
  23. package/lib/sequence/sharedStringWithInterception.d.ts +3 -3
  24. package/lib/sequence/sharedStringWithInterception.d.ts.map +1 -1
  25. package/lib/sequence/sharedStringWithInterception.js +1 -1
  26. package/lib/sequence/sharedStringWithInterception.js.map +1 -1
  27. package/package.json +23 -57
  28. package/src/map/sharedDirectoryWithInterception.ts +3 -3
  29. package/src/map/sharedMapWithInterception.ts +3 -3
  30. package/src/sequence/sharedStringWithInterception.ts +4 -4
  31. package/api-extractor-cjs.json +0 -8
  32. package/dist/dds-interceptions-alpha.d.ts +0 -13
  33. package/dist/dds-interceptions-beta.d.ts +0 -19
  34. package/dist/dds-interceptions-public.d.ts +0 -19
  35. package/dist/dds-interceptions-untrimmed.d.ts +0 -67
  36. package/lib/dds-interceptions-alpha.d.ts +0 -13
  37. package/lib/dds-interceptions-beta.d.ts +0 -19
  38. package/lib/dds-interceptions-public.d.ts +0 -19
  39. package/lib/dds-interceptions-untrimmed.d.ts +0 -67
  40. package/lib/test/sharedDirectoryWithInterception.spec.js +0 -282
  41. package/lib/test/sharedDirectoryWithInterception.spec.js.map +0 -1
  42. package/lib/test/sharedMapWithInterception.spec.js +0 -105
  43. package/lib/test/sharedMapWithInterception.spec.js.map +0 -1
  44. package/lib/test/sharedStringWithInterception.spec.js +0 -147
  45. package/lib/test/sharedStringWithInterception.spec.js.map +0 -1
  46. /package/{dist → lib}/tsdoc-metadata.json +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @fluidframework/dds-interceptions
2
2
 
3
+ ## 2.0.0-rc.3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - Packages now use package.json "exports" and require modern module resolution [97d68aa06b](https://github.com/microsoft/FluidFramework/commit/97d68aa06bd5c022ecb026655814aea222a062ae)
8
+
9
+ Fluid Framework packages have been updated to use the [package.json "exports"
10
+ field](https://nodejs.org/docs/latest-v18.x/api/packages.html#exports) to define explicit entry points for both
11
+ TypeScript types and implementation code.
12
+
13
+ This means that using Fluid Framework packages require the following TypeScript settings in tsconfig.json:
14
+
15
+ - `"moduleResolution": "Node16"` with `"module": "Node16"`
16
+ - `"moduleResolution": "Bundler"` with `"module": "ESNext"`
17
+
18
+ We recommend using Node16/Node16 unless absolutely necessary. That will produce transpiled JavaScript that is suitable
19
+ for use with modern versions of Node.js _and_ Bundlers.
20
+ [See the TypeScript documentation](https://www.typescriptlang.org/tsconfig#moduleResolution) for more information
21
+ regarding the module and moduleResolution options.
22
+
23
+ **Node10 moduleResolution is not supported; it does not support Fluid Framework's API structuring pattern that is used
24
+ to distinguish stable APIs from those that are in development.**
25
+
3
26
  ## 2.0.0-rc.2.0.0
4
27
 
5
28
  ### Minor Changes
@@ -4,11 +4,11 @@
4
4
 
5
5
  ```ts
6
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';
7
+ import { IDirectory } from '@fluidframework/map/internal';
8
+ import { IFluidDataStoreContext } from '@fluidframework/runtime-definitions/internal';
9
+ import { ISharedMap } from '@fluidframework/map/internal';
10
+ import * as MergeTree from '@fluidframework/merge-tree/internal';
11
+ import { SharedString } from '@fluidframework/sequence/internal';
12
12
 
13
13
  // @internal
14
14
  export function createDirectoryWithInterception<T extends IDirectory>(baseDirectory: T, context: IFluidDataStoreContext, setInterceptionCallback: (baseDirectory: IDirectory, subDirectory: IDirectory, key: string, value: any) => void): T;
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IDirectory } from "@fluidframework/map";
6
- import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
5
+ import { IDirectory } from "@fluidframework/map/internal";
6
+ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
7
7
  /**
8
8
  * - Create a new object from the passed IDirectory object.
9
9
  *
@@ -1 +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"}
1
+ {"version":3,"file":"sharedDirectoryWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AA+HtF;;;;;;;;;;;;;;;;;;;;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"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.createDirectoryWithInterception = void 0;
8
- const core_utils_1 = require("@fluidframework/core-utils");
8
+ const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  /**
10
10
  * - Create a new object from the passed subDirectory.
11
11
  *
@@ -35,7 +35,7 @@ function createSubDirectoryWithInterception(baseDirectory, subDirectory, context
35
35
  let directory;
36
36
  // Set should not be called on the wrapped object from the interception callback as this will lead to
37
37
  // infinite recursion.
38
- (0, core_utils_1.assert)(executingCallback === false, 0x0bf /* "set called recursively from the interception callback" */);
38
+ (0, internal_1.assert)(executingCallback === false, 0x0bf /* "set called recursively from the interception callback" */);
39
39
  context.containerRuntime.orderSequentially(() => {
40
40
  directory = subDirectory.set(key, value);
41
41
  executingCallback = true;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedDirectoryWithInterception.js","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAIpD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,kCAAkC,CAC1C,aAAgB,EAChB,YAAe,EACf,OAA+B,EAC/B,uBAKS;IAET,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEjE,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,4BAA4B,CAAC,GAAG,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;QAC9D,IAAI,SAAS,CAAC;QACd,qGAAqG;QACrG,sBAAsB;QACtB,IAAA,mBAAM,EACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,6DAA6D,CACnE,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACzC,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,uBAAuB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;aACjE;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;QACH,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC;IAEF,4BAA4B,CAAC,kBAAkB,GAAG,CAAC,UAAkB,EAAc,EAAE;QACpF,MAAM,eAAe,GAAG,YAAY,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACpE,OAAO,kCAAkC,CACxC,aAAa,EACb,eAAe,EACf,OAAO,EACP,uBAAuB,CACvB,CAAC;IACH,CAAC,CA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AAC,kCAAkC,CAClC,aAAa,EACb,eAAe,EACf,OAAO,EACP,uBAAuB,CACtB,CAAC;IACN,CAAC,CAAC;IAEF,+DAA+D;IAC/D,OAAO,4BAA4B,CAAC;AACrC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,+BAA+B,CAC9C,aAAgB,EAChB,OAA+B,EAC/B,uBAKS;IAET,OAAO,kCAAkC,CACxC,aAAa,EACb,aAAa,EACb,OAAO,EACP,uBAAuB,CACvB,CAAC;AACH,CAAC;AAhBD,0EAgBC","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"]}
1
+ {"version":3,"file":"sharedDirectoryWithInterception.js","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAI7D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,kCAAkC,CAC1C,aAAgB,EAChB,YAAe,EACf,OAA+B,EAC/B,uBAKS;IAET,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEjE,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,4BAA4B,CAAC,GAAG,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;QAC9D,IAAI,SAAS,CAAC;QACd,qGAAqG;QACrG,sBAAsB;QACtB,IAAA,iBAAM,EACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,6DAA6D,CACnE,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACzC,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,uBAAuB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;aACjE;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;QACH,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC;IAEF,4BAA4B,CAAC,kBAAkB,GAAG,CAAC,UAAkB,EAAc,EA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AG,CAClD,YAAoB,EACK,EAAE;QAC3B,MAAM,eAAe,GAAG,YAAY,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QACvE,OAAO,eAAe,KAAK,SAAS;YACnC,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,kCAAkC,CAClC,aAAa,EACb,eAAe,EACf,OAAO,EACP,uBAAuB,CACtB,CAAC;IACN,CAAC,CAAC;IAEF,+DAA+D;IAC/D,OAAO,4BAA4B,CAAC;AACrC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,+BAA+B,CAC9C,aAAgB,EAChB,OAA+B,EAC/B,uBAKS;IAET,OAAO,kCAAkC,CACxC,aAAa,EACb,aAAa,EACb,OAAO,EACP,uBAAuB,CACvB,CAAC;AACH,CAAC;AAhBD,0EAgBC","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/internal\";\nimport { IDirectory } from \"@fluidframework/map/internal\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions/internal\";\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"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ISharedMap } from "@fluidframework/map";
6
- import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
5
+ import { ISharedMap } from "@fluidframework/map/internal";
6
+ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
7
7
  /**
8
8
  * - Create a new object from the passed SharedMap.
9
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedMapWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedMapWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,+BAA+B,CAC9C,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,sBAAsB,EAC/B,uBAAuB,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,GAC/E,UAAU,CA6BZ"}
1
+ {"version":3,"file":"sharedMapWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedMapWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,+BAA+B,CAC9C,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,sBAAsB,EAC/B,uBAAuB,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,GAC/E,UAAU,CA6BZ"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.createSharedMapWithInterception = void 0;
8
- const core_utils_1 = require("@fluidframework/core-utils");
8
+ const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  /**
10
10
  * - Create a new object from the passed SharedMap.
11
11
  *
@@ -29,7 +29,7 @@ function createSharedMapWithInterception(sharedMap, context, setInterceptionCall
29
29
  let map;
30
30
  // Set should not be called on the wrapped object from the interception callback as this will lead to
31
31
  // infinite recursion.
32
- (0, core_utils_1.assert)(executingCallback === false, 0x0c0 /* "set called recursively from the interception callback" */);
32
+ (0, internal_1.assert)(executingCallback === false, 0x0c0 /* "set called recursively from the interception callback" */);
33
33
  context.containerRuntime.orderSequentially(() => {
34
34
  map = sharedMap.set(key, value);
35
35
  executingCallback = true;
@@ -1 +1 @@
1
- {"version":3,"file":"sharedMapWithInterception.js","sourceRoot":"","sources":["../../src/map/sharedMapWithInterception.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAIpD;;;;;;;;;;;;;;GAcG;AACH,SAAgB,+BAA+B,CAC9C,SAAqB,EACrB,OAA+B,EAC/B,uBAAiF;IAEjF,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAE3D,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,yBAAyB,CAAC,GAAG,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;QAC3D,IAAI,GAAG,CAAC;QACR,qGAAqG;QACrG,sBAAsB;QACtB,IAAA,mBAAM,EACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,6DAA6D,CACnE,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAChC,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,uBAAuB,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;aAC/C;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;QACH,+DAA+D;QAC/D,OAAO,GAAG,CAAC;IACZ,CAAC,CAAC;IAEF,OAAO,yBAAuC,CAAC;AAChD,CAAC;AAjCD,0EAiCC","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 { ISharedMap } from \"@fluidframework/map\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\n\n/**\n * - Create a new object from the passed SharedMap.\n *\n * - Modify the set method to call the setInterceptionCallback before calling set on the underlying SharedMap.\n *\n * - The setInterceptionCallback and the call to the underlying SharedMap are wrapped around an\n * orderSequentially call to batch any operations that might happen in the callback.\n *\n * @param sharedMap - The underlying SharedMap\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 SharedMap that intercepts the set method and calls the setInterceptionCallback.\n * @internal\n */\nexport function createSharedMapWithInterception(\n\tsharedMap: ISharedMap,\n\tcontext: IFluidDataStoreContext,\n\tsetInterceptionCallback: (sharedMap: ISharedMap, key: string, value: any) => void,\n): ISharedMap {\n\tconst sharedMapWithInterception = Object.create(sharedMap);\n\n\t// executingCallback keeps track of whether set is called recursively from the setInterceptionCallback.\n\tlet executingCallback: boolean = false;\n\n\tsharedMapWithInterception.set = (key: string, value: any) => {\n\t\tlet map;\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\t0x0c0 /* \"set called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\tmap = sharedMap.set(key, value);\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsetInterceptionCallback(sharedMap, 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 map;\n\t};\n\n\treturn sharedMapWithInterception as ISharedMap;\n}\n"]}
1
+ {"version":3,"file":"sharedMapWithInterception.js","sourceRoot":"","sources":["../../src/map/sharedMapWithInterception.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAI7D;;;;;;;;;;;;;;GAcG;AACH,SAAgB,+BAA+B,CAC9C,SAAqB,EACrB,OAA+B,EAC/B,uBAAiF;IAEjF,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAE3D,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,yBAAyB,CAAC,GAAG,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;QAC3D,IAAI,GAAG,CAAC;QACR,qGAAqG;QACrG,sBAAsB;QACtB,IAAA,iBAAM,EACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,6DAA6D,CACnE,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAChC,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,uBAAuB,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;aAC/C;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;QACH,+DAA+D;QAC/D,OAAO,GAAG,CAAC;IACZ,CAAC,CAAC;IAEF,OAAO,yBAAuC,CAAC;AAChD,CAAC;AAjCD,0EAiCC","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/internal\";\nimport { ISharedMap } from \"@fluidframework/map/internal\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions/internal\";\n\n/**\n * - Create a new object from the passed SharedMap.\n *\n * - Modify the set method to call the setInterceptionCallback before calling set on the underlying SharedMap.\n *\n * - The setInterceptionCallback and the call to the underlying SharedMap are wrapped around an\n * orderSequentially call to batch any operations that might happen in the callback.\n *\n * @param sharedMap - The underlying SharedMap\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 SharedMap that intercepts the set method and calls the setInterceptionCallback.\n * @internal\n */\nexport function createSharedMapWithInterception(\n\tsharedMap: ISharedMap,\n\tcontext: IFluidDataStoreContext,\n\tsetInterceptionCallback: (sharedMap: ISharedMap, key: string, value: any) => void,\n): ISharedMap {\n\tconst sharedMapWithInterception = Object.create(sharedMap);\n\n\t// executingCallback keeps track of whether set is called recursively from the setInterceptionCallback.\n\tlet executingCallback: boolean = false;\n\n\tsharedMapWithInterception.set = (key: string, value: any) => {\n\t\tlet map;\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\t0x0c0 /* \"set called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\tmap = sharedMap.set(key, value);\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsetInterceptionCallback(sharedMap, 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 map;\n\t};\n\n\treturn sharedMapWithInterception as ISharedMap;\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import * as MergeTree from "@fluidframework/merge-tree";
6
- import { SharedString } from "@fluidframework/sequence";
7
- import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
5
+ import * as MergeTree from "@fluidframework/merge-tree/internal";
6
+ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
7
+ import { SharedString } from "@fluidframework/sequence/internal";
8
8
  /**
9
9
  * - Create a new object from the passed SharedString.
10
10
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedStringWithInterception.d.ts","sourceRoot":"","sources":["../../src/sequence/sharedStringWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kCAAkC,CACjD,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,sBAAsB,EAC/B,4BAA4B,EAAE,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,KAAK,SAAS,CAAC,WAAW,GACpF,YAAY,CA+Pd"}
1
+ {"version":3,"file":"sharedStringWithInterception.d.ts","sourceRoot":"","sources":["../../src/sequence/sharedStringWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kCAAkC,CACjD,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,sBAAsB,EAC/B,4BAA4B,EAAE,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,KAAK,SAAS,CAAC,WAAW,GACpF,YAAY,CA+Pd"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
7
  exports.createSharedStringWithInterception = void 0;
8
- const core_utils_1 = require("@fluidframework/core-utils");
8
+ const internal_1 = require("@fluidframework/core-utils/internal");
9
9
  /**
10
10
  * - Create a new object from the passed SharedString.
11
11
  *
@@ -39,7 +39,7 @@ function createSharedStringWithInterception(sharedString, context, propertyInter
39
39
  sharedStringWithInterception.insertMarkerRelative = (relativePos1, refType, props) => {
40
40
  // Wrapper methods should not be called from the interception callback as this will lead to
41
41
  // infinite recursion.
42
- (0, core_utils_1.assert)(executingCallback === false, 0x0c1 /* "Interception wrapper methods called recursively from the interception callback" */);
42
+ (0, internal_1.assert)(executingCallback === false, 0x0c1 /* "Interception wrapper methods called recursively from the interception callback" */);
43
43
  context.containerRuntime.orderSequentially(() => {
44
44
  executingCallback = true;
45
45
  try {
@@ -61,7 +61,7 @@ function createSharedStringWithInterception(sharedString, context, propertyInter
61
61
  let insertOp;
62
62
  // Wrapper methods should not be called from the interception callback as this will lead to
63
63
  // infinite recursion.
64
- (0, core_utils_1.assert)(executingCallback === false, 0x0c2 /* "Interception wrapper methods called recursively from the interception callback" */);
64
+ (0, internal_1.assert)(executingCallback === false, 0x0c2 /* "Interception wrapper methods called recursively from the interception callback" */);
65
65
  context.containerRuntime.orderSequentially(() => {
66
66
  executingCallback = true;
67
67
  try {
@@ -84,7 +84,7 @@ function createSharedStringWithInterception(sharedString, context, propertyInter
84
84
  sharedStringWithInterception.insertTextRelative = (relativePos1, text, props) => {
85
85
  // Wrapper methods should not be called from the interception callback as this will lead to
86
86
  // infinite recursion.
87
- (0, core_utils_1.assert)(executingCallback === false, 0x0c3 /* "Interception wrapper methods called recursively from the interception callback" */);
87
+ (0, internal_1.assert)(executingCallback === false, 0x0c3 /* "Interception wrapper methods called recursively from the interception callback" */);
88
88
  context.containerRuntime.orderSequentially(() => {
89
89
  executingCallback = true;
90
90
  try {
@@ -105,7 +105,7 @@ function createSharedStringWithInterception(sharedString, context, propertyInter
105
105
  sharedStringWithInterception.insertText = (pos, text, props) => {
106
106
  // Wrapper methods should not be called from the interception callback as this will lead to
107
107
  // infinite recursion.
108
- (0, core_utils_1.assert)(executingCallback === false, 0x0c4 /* "Interception wrapper methods called recursively from the interception callback" */);
108
+ (0, internal_1.assert)(executingCallback === false, 0x0c4 /* "Interception wrapper methods called recursively from the interception callback" */);
109
109
  context.containerRuntime.orderSequentially(() => {
110
110
  executingCallback = true;
111
111
  try {
@@ -127,7 +127,7 @@ function createSharedStringWithInterception(sharedString, context, propertyInter
127
127
  sharedStringWithInterception.replaceText = (start, end, text, props) => {
128
128
  // Wrapper methods should not be called from the interception callback as this will lead to
129
129
  // infinite recursion.
130
- (0, core_utils_1.assert)(executingCallback === false, 0x0c5 /* "Interception wrapper methods called recursively from the interception callback" */);
130
+ (0, internal_1.assert)(executingCallback === false, 0x0c5 /* "Interception wrapper methods called recursively from the interception callback" */);
131
131
  context.containerRuntime.orderSequentially(() => {
132
132
  executingCallback = true;
133
133
  try {
@@ -147,7 +147,7 @@ function createSharedStringWithInterception(sharedString, context, propertyInter
147
147
  sharedStringWithInterception.annotateMarker = (marker, props) => {
148
148
  // Wrapper methods should not be called from the interception callback as this will lead to
149
149
  // infinite recursion.
150
- (0, core_utils_1.assert)(executingCallback === false, 0x0c7 /* "Interception wrapper methods called recursively from the interception callback" */);
150
+ (0, internal_1.assert)(executingCallback === false, 0x0c7 /* "Interception wrapper methods called recursively from the interception callback" */);
151
151
  context.containerRuntime.orderSequentially(() => {
152
152
  executingCallback = true;
153
153
  try {
@@ -169,7 +169,7 @@ function createSharedStringWithInterception(sharedString, context, propertyInter
169
169
  sharedStringWithInterception.annotateRange = (start, end, props) => {
170
170
  // Wrapper methods should not be called from the interception callback as this will lead to
171
171
  // infinite recursion.
172
- (0, core_utils_1.assert)(executingCallback === false, 0x0c8 /* "Interception wrapper methods called recursively from the interception callback" */);
172
+ (0, internal_1.assert)(executingCallback === false, 0x0c8 /* "Interception wrapper methods called recursively from the interception callback" */);
173
173
  context.containerRuntime.orderSequentially(() => {
174
174
  executingCallback = true;
175
175
  try {
@@ -189,7 +189,7 @@ function createSharedStringWithInterception(sharedString, context, propertyInter
189
189
  sharedStringWithInterception.insertAtReferencePosition = (pos, segment) => {
190
190
  // Wrapper methods should not be called from the interception callback as this will lead to
191
191
  // infinite recursion.
192
- (0, core_utils_1.assert)(executingCallback === false, 0x0c9 /* "Interception wrapper methods called recursively from the interception callback" */);
192
+ (0, internal_1.assert)(executingCallback === false, 0x0c9 /* "Interception wrapper methods called recursively from the interception callback" */);
193
193
  context.containerRuntime.orderSequentially(() => {
194
194
  executingCallback = true;
195
195
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"sharedStringWithInterception.js","sourceRoot":"","sources":["../../src/sequence/sharedStringWithInterception.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAKpD;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,kCAAkC,CACjD,YAA0B,EAC1B,OAA+B,EAC/B,4BAAsF;IAEtF,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEjE,iGAAiG;IACjG,yCAAyC;IACzC,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC;;;;;;OAMG;IACH,4BAA4B,CAAC,oBAAoB,GAAG,CACnD,YAAyC,EACzC,OAAgC,EACh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AK,KAAK,EAC3B,KAAK,CAAC,sFAAsF,CAC5F,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,OAAO,CAAC,UAAU,GAAG,4BAA4B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBACtE,YAAY,CAAC,yBAAyB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;aACrD;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,4BAA4C,CAAC;AACrD,CAAC;AAnQD,gFAmQC","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 * as MergeTree from \"@fluidframework/merge-tree\";\nimport { SharedString } from \"@fluidframework/sequence\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\n\n/**\n * - Create a new object from the passed SharedString.\n *\n * - Modify the methods that insert / remove / annotate the properties of the SharedString to call\n * the propertyInterceptionCallback to get new properties.\n *\n * - Use these new properties to call the underlying SharedString.\n *\n * - The propertyInterceptionCallback and the call to the underlying SharedString are wrapped around an\n * orderSequentially call to batch any operations that might happen in the callback.\n *\n * @param sharedString - The underlying SharedString\n * @param context - The IFluidDataStoreContext that will be used to call orderSequentially\n * @param propertyInterceptionCallback - The interception callback to be called\n *\n * @returns A new SharedString that intercepts the methods modifying the SharedString properties.\n * @internal\n */\nexport function createSharedStringWithInterception(\n\tsharedString: SharedString,\n\tcontext: IFluidDataStoreContext,\n\tpropertyInterceptionCallback: (props?: MergeTree.PropertySet) => MergeTree.PropertySet,\n): SharedString {\n\tconst sharedStringWithInterception = Object.create(sharedString);\n\n\t// executingCallback keeps track of whether a method on this wrapper object is called recursively\n\t// from the propertyInterceptionCallback.\n\tlet executingCallback: boolean = false;\n\n\t/**\n\t * Inserts a marker at a relative position.\n\t *\n\t * @param relativePos1 - The relative position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tsharedStringWithInterception.insertMarkerRelative = (\n\t\trelativePos1: MergeTree.IRelativePosition,\n\t\trefType: MergeTree.ReferenceType,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c1 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertMarkerRelative(\n\t\t\t\t\trelativePos1,\n\t\t\t\t\trefType,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts a marker at the position.\n\t *\n\t * @param pos - The position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tsharedStringWithInterception.insertMarker = (\n\t\tpos: number,\n\t\trefType: MergeTree.ReferenceType,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\tlet insertOp;\n\t\t// Wrapper methods should not be called 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\t0x0c2 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tinsertOp = sharedString.insertMarker(\n\t\t\t\t\tpos,\n\t\t\t\t\trefType,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\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 insertOp;\n\t};\n\n\t/**\n\t * Inserts the text at a relative position.\n\t *\n\t * @param relativePos1 - The relative position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tsharedStringWithInterception.insertTextRelative = (\n\t\trelativePos1: MergeTree.IRelativePosition,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c3 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertTextRelative(\n\t\t\t\t\trelativePos1,\n\t\t\t\t\ttext,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts the text at the position.\n\t *\n\t * @param pos - The position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tsharedStringWithInterception.insertText = (\n\t\tpos: number,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c4 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertText(pos, text, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Replaces a range with the provided text.\n\t *\n\t * @param start - The inclusive start of the range to replace\n\t * @param end - The exclusive end of the range to replace\n\t * @param text - The text to replace the range with\n\t * @param props - Optional. The properties of the replacement text\n\t */\n\tsharedStringWithInterception.replaceText = (\n\t\tstart: number,\n\t\tend: number,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c5 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.replaceText(start, end, text, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Annotates the marker with the provided properties.\n\t *\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t */\n\tsharedStringWithInterception.annotateMarker = (\n\t\tmarker: MergeTree.Marker,\n\t\tprops: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c7 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.annotateMarker(marker, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Annotates the range with the provided properties.\n\t *\n\t * @param start - The inclusive start position of the range to annotate\n\t * @param end - The exclusive end position of the range to annotate\n\t * @param props - The properties to annotate the range with\n\t *\n\t */\n\tsharedStringWithInterception.annotateRange = (\n\t\tstart: number,\n\t\tend: number,\n\t\tprops: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c8 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.annotateRange(start, end, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts the segment at the given position\n\t *\n\t * @param pos - The position to insert the segment at\n\t * @param segment - The segment to insert\n\t */\n\tsharedStringWithInterception.insertAtReferencePosition = (\n\t\tpos: MergeTree.ReferencePosition,\n\t\tsegment: MergeTree.TextSegment,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c9 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsegment.properties = propertyInterceptionCallback(segment.properties);\n\t\t\t\tsharedString.insertAtReferencePosition(pos, segment);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\treturn sharedStringWithInterception as SharedString;\n}\n"]}
1
+ {"version":3,"file":"sharedStringWithInterception.js","sourceRoot":"","sources":["../../src/sequence/sharedStringWithInterception.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,kEAA6D;AAK7D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,kCAAkC,CACjD,YAA0B,EAC1B,OAA+B,EAC/B,4BAAsF;IAEtF,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEjE,iGAAiG;IACjG,yCAAyC;IACzC,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC;;;;;;OAM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E;QACH,2FAA2F;QAC3F,sBAAsB;QACtB,IAAA,iBAAM,EACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,sFAAsF,CAC5F,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,OAAO,CAAC,UAAU,GAAG,4BAA4B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBACtE,YAAY,CAAC,yBAAyB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;aACrD;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,4BAA4C,CAAC;AACrD,CAAC;AAnQD,gFAmQC","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/internal\";\nimport * as MergeTree from \"@fluidframework/merge-tree/internal\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions/internal\";\nimport { SharedString } from \"@fluidframework/sequence/internal\";\n\n/**\n * - Create a new object from the passed SharedString.\n *\n * - Modify the methods that insert / remove / annotate the properties of the SharedString to call\n * the propertyInterceptionCallback to get new properties.\n *\n * - Use these new properties to call the underlying SharedString.\n *\n * - The propertyInterceptionCallback and the call to the underlying SharedString are wrapped around an\n * orderSequentially call to batch any operations that might happen in the callback.\n *\n * @param sharedString - The underlying SharedString\n * @param context - The IFluidDataStoreContext that will be used to call orderSequentially\n * @param propertyInterceptionCallback - The interception callback to be called\n *\n * @returns A new SharedString that intercepts the methods modifying the SharedString properties.\n * @internal\n */\nexport function createSharedStringWithInterception(\n\tsharedString: SharedString,\n\tcontext: IFluidDataStoreContext,\n\tpropertyInterceptionCallback: (props?: MergeTree.PropertySet) => MergeTree.PropertySet,\n): SharedString {\n\tconst sharedStringWithInterception = Object.create(sharedString);\n\n\t// executingCallback keeps track of whether a method on this wrapper object is called recursively\n\t// from the propertyInterceptionCallback.\n\tlet executingCallback: boolean = false;\n\n\t/**\n\t * Inserts a marker at a relative position.\n\t *\n\t * @param relativePos1 - The relative position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tsharedStringWithInterception.insertMarkerRelative = (\n\t\trelativePos1: MergeTree.IRelativePosition,\n\t\trefType: MergeTree.ReferenceType,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c1 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertMarkerRelative(\n\t\t\t\t\trelativePos1,\n\t\t\t\t\trefType,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts a marker at the position.\n\t *\n\t * @param pos - The position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tsharedStringWithInterception.insertMarker = (\n\t\tpos: number,\n\t\trefType: MergeTree.ReferenceType,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\tlet insertOp;\n\t\t// Wrapper methods should not be called 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\t0x0c2 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tinsertOp = sharedString.insertMarker(\n\t\t\t\t\tpos,\n\t\t\t\t\trefType,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\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 insertOp;\n\t};\n\n\t/**\n\t * Inserts the text at a relative position.\n\t *\n\t * @param relativePos1 - The relative position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tsharedStringWithInterception.insertTextRelative = (\n\t\trelativePos1: MergeTree.IRelativePosition,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c3 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertTextRelative(\n\t\t\t\t\trelativePos1,\n\t\t\t\t\ttext,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts the text at the position.\n\t *\n\t * @param pos - The position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tsharedStringWithInterception.insertText = (\n\t\tpos: number,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c4 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertText(pos, text, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Replaces a range with the provided text.\n\t *\n\t * @param start - The inclusive start of the range to replace\n\t * @param end - The exclusive end of the range to replace\n\t * @param text - The text to replace the range with\n\t * @param props - Optional. The properties of the replacement text\n\t */\n\tsharedStringWithInterception.replaceText = (\n\t\tstart: number,\n\t\tend: number,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c5 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.replaceText(start, end, text, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Annotates the marker with the provided properties.\n\t *\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t */\n\tsharedStringWithInterception.annotateMarker = (\n\t\tmarker: MergeTree.Marker,\n\t\tprops: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c7 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.annotateMarker(marker, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Annotates the range with the provided properties.\n\t *\n\t * @param start - The inclusive start position of the range to annotate\n\t * @param end - The exclusive end position of the range to annotate\n\t * @param props - The properties to annotate the range with\n\t *\n\t */\n\tsharedStringWithInterception.annotateRange = (\n\t\tstart: number,\n\t\tend: number,\n\t\tprops: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c8 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.annotateRange(start, end, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts the segment at the given position\n\t *\n\t * @param pos - The position to insert the segment at\n\t * @param segment - The segment to insert\n\t */\n\tsharedStringWithInterception.insertAtReferencePosition = (\n\t\tpos: MergeTree.ReferencePosition,\n\t\tsegment: MergeTree.TextSegment,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c9 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsegment.properties = propertyInterceptionCallback(segment.properties);\n\t\t\t\tsharedString.insertAtReferencePosition(pos, segment);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\treturn sharedStringWithInterception as SharedString;\n}\n"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { IDirectory } from "@fluidframework/map";
6
- import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
5
+ import { IDirectory } from "@fluidframework/map/internal";
6
+ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
7
7
  /**
8
8
  * - Create a new object from the passed IDirectory object.
9
9
  *
@@ -1 +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"}
1
+ {"version":3,"file":"sharedDirectoryWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AA+HtF;;;;;;;;;;;;;;;;;;;;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"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/core-utils";
5
+ import { assert } from "@fluidframework/core-utils/internal";
6
6
  /**
7
7
  * - Create a new object from the passed subDirectory.
8
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"s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AuB,CACtB,CAAC;IACN,CAAC,CAAC;IAEF,+DAA+D;IAC/D,OAAO,4BAA4B,CAAC;AACrC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,+BAA+B,CAC9C,aAAgB,EAChB,OAA+B,EAC/B,uBAKS;IAET,OAAO,kCAAkC,CACxC,aAAa,EACb,aAAa,EACb,OAAO,EACP,uBAAuB,CACvB,CAAC;AACH,CAAC","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"]}
1
+ {"version":3,"file":"sharedDirectoryWithInterception.js","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAS,kCAAkC,CAC1C,aAAgB,EAChB,YAAe,EACf,OAA+B,EAC/B,uBAKS;IAET,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEjE,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,4BAA4B,CAAC,GAAG,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;QAC9D,IAAI,SAAS,CAAC;QACd,qGAAqG;QACrG,sBAAsB;QACtB,MAAM,CACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,6DAA6D,CACnE,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YACzC,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,uBAAuB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;aACjE;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;QACH,+DAA+D;QAC/D,OAAO,SAAS,CAAC;IAClB,CAAC,CAAC;IAEF,4BAA4B,CAAC,kBAAkB,GAAG,CAAC,UAAkB,EAAc,EAAE;QACpF,MAAM,eAAe,GAAG,YAAY,CAAC,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,eAAe,GAAG,YAAY,CAAC,mBAAmB,CAAC,YAAY,CAAC,CAAC;QACvE,OAAO,eAAe,KAAK,SAAS;YACnC,CAAC,CAAC,eAAe;YACjB,CAAC,CAAC,kCAAkC,CAClC,aAAa,EACb,eAAe,EACf,OAAO,EACP,uBAAuB,CACtB,CAAC;IACN,CAAC,CAAC;IAEF,+DAA+D;IAC/D,OAAO,4BAA4B,CAAC;AACrC,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,+BAA+B,CAC9C,aAAgB,EAChB,OAA+B,EAC/B,uBAKS;IAET,OAAO,kCAAkC,CACxC,aAAa,EACb,aAAa,EACb,OAAO,EACP,uBAAuB,CACvB,CAAC;AACH,CAAC","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/internal\";\nimport { IDirectory } from \"@fluidframework/map/internal\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions/internal\";\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"]}
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ISharedMap } from "@fluidframework/map";
6
- import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
5
+ import { ISharedMap } from "@fluidframework/map/internal";
6
+ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
7
7
  /**
8
8
  * - Create a new object from the passed SharedMap.
9
9
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedMapWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedMapWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,+BAA+B,CAC9C,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,sBAAsB,EAC/B,uBAAuB,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,GAC/E,UAAU,CA6BZ"}
1
+ {"version":3,"file":"sharedMapWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedMapWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAEtF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,+BAA+B,CAC9C,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,sBAAsB,EAC/B,uBAAuB,EAAE,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,GAC/E,UAAU,CA6BZ"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/core-utils";
5
+ import { assert } from "@fluidframework/core-utils/internal";
6
6
  /**
7
7
  * - Create a new object from the passed SharedMap.
8
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedMapWithInterception.js","sourceRoot":"","sources":["../../src/map/sharedMapWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAIpD;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,+BAA+B,CAC9C,SAAqB,EACrB,OAA+B,EAC/B,uBAAiF;IAEjF,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAE3D,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,yBAAyB,CAAC,GAAG,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;QAC3D,IAAI,GAAG,CAAC;QACR,qGAAqG;QACrG,sBAAsB;QACtB,MAAM,CACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,6DAA6D,CACnE,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAChC,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,uBAAuB,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;aAC/C;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;QACH,+DAA+D;QAC/D,OAAO,GAAG,CAAC;IACZ,CAAC,CAAC;IAEF,OAAO,yBAAuC,CAAC;AAChD,CAAC","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 { ISharedMap } from \"@fluidframework/map\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\n\n/**\n * - Create a new object from the passed SharedMap.\n *\n * - Modify the set method to call the setInterceptionCallback before calling set on the underlying SharedMap.\n *\n * - The setInterceptionCallback and the call to the underlying SharedMap are wrapped around an\n * orderSequentially call to batch any operations that might happen in the callback.\n *\n * @param sharedMap - The underlying SharedMap\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 SharedMap that intercepts the set method and calls the setInterceptionCallback.\n * @internal\n */\nexport function createSharedMapWithInterception(\n\tsharedMap: ISharedMap,\n\tcontext: IFluidDataStoreContext,\n\tsetInterceptionCallback: (sharedMap: ISharedMap, key: string, value: any) => void,\n): ISharedMap {\n\tconst sharedMapWithInterception = Object.create(sharedMap);\n\n\t// executingCallback keeps track of whether set is called recursively from the setInterceptionCallback.\n\tlet executingCallback: boolean = false;\n\n\tsharedMapWithInterception.set = (key: string, value: any) => {\n\t\tlet map;\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\t0x0c0 /* \"set called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\tmap = sharedMap.set(key, value);\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsetInterceptionCallback(sharedMap, 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 map;\n\t};\n\n\treturn sharedMapWithInterception as ISharedMap;\n}\n"]}
1
+ {"version":3,"file":"sharedMapWithInterception.js","sourceRoot":"","sources":["../../src/map/sharedMapWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAI7D;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,+BAA+B,CAC9C,SAAqB,EACrB,OAA+B,EAC/B,uBAAiF;IAEjF,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAE3D,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,yBAAyB,CAAC,GAAG,GAAG,CAAC,GAAW,EAAE,KAAU,EAAE,EAAE;QAC3D,IAAI,GAAG,CAAC;QACR,qGAAqG;QACrG,sBAAsB;QACtB,MAAM,CACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,6DAA6D,CACnE,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,GAAG,GAAG,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAChC,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,uBAAuB,CAAC,SAAS,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;aAC/C;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;QACH,+DAA+D;QAC/D,OAAO,GAAG,CAAC;IACZ,CAAC,CAAC;IAEF,OAAO,yBAAuC,CAAC;AAChD,CAAC","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/internal\";\nimport { ISharedMap } from \"@fluidframework/map/internal\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions/internal\";\n\n/**\n * - Create a new object from the passed SharedMap.\n *\n * - Modify the set method to call the setInterceptionCallback before calling set on the underlying SharedMap.\n *\n * - The setInterceptionCallback and the call to the underlying SharedMap are wrapped around an\n * orderSequentially call to batch any operations that might happen in the callback.\n *\n * @param sharedMap - The underlying SharedMap\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 SharedMap that intercepts the set method and calls the setInterceptionCallback.\n * @internal\n */\nexport function createSharedMapWithInterception(\n\tsharedMap: ISharedMap,\n\tcontext: IFluidDataStoreContext,\n\tsetInterceptionCallback: (sharedMap: ISharedMap, key: string, value: any) => void,\n): ISharedMap {\n\tconst sharedMapWithInterception = Object.create(sharedMap);\n\n\t// executingCallback keeps track of whether set is called recursively from the setInterceptionCallback.\n\tlet executingCallback: boolean = false;\n\n\tsharedMapWithInterception.set = (key: string, value: any) => {\n\t\tlet map;\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\t0x0c0 /* \"set called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\tmap = sharedMap.set(key, value);\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsetInterceptionCallback(sharedMap, 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 map;\n\t};\n\n\treturn sharedMapWithInterception as ISharedMap;\n}\n"]}
@@ -2,9 +2,9 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import * as MergeTree from "@fluidframework/merge-tree";
6
- import { SharedString } from "@fluidframework/sequence";
7
- import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions";
5
+ import * as MergeTree from "@fluidframework/merge-tree/internal";
6
+ import { IFluidDataStoreContext } from "@fluidframework/runtime-definitions/internal";
7
+ import { SharedString } from "@fluidframework/sequence/internal";
8
8
  /**
9
9
  * - Create a new object from the passed SharedString.
10
10
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedStringWithInterception.d.ts","sourceRoot":"","sources":["../../src/sequence/sharedStringWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,SAAS,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAE7E;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kCAAkC,CACjD,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,sBAAsB,EAC/B,4BAA4B,EAAE,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,KAAK,SAAS,CAAC,WAAW,GACpF,YAAY,CA+Pd"}
1
+ {"version":3,"file":"sharedStringWithInterception.d.ts","sourceRoot":"","sources":["../../src/sequence/sharedStringWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,SAAS,MAAM,qCAAqC,CAAC;AACjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kCAAkC,CACjD,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,sBAAsB,EAC/B,4BAA4B,EAAE,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,WAAW,KAAK,SAAS,CAAC,WAAW,GACpF,YAAY,CA+Pd"}
@@ -2,7 +2,7 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { assert } from "@fluidframework/core-utils";
5
+ import { assert } from "@fluidframework/core-utils/internal";
6
6
  /**
7
7
  * - Create a new object from the passed SharedString.
8
8
  *
@@ -1 +1 @@
1
- {"version":3,"file":"sharedStringWithInterception.js","sourceRoot":"","sources":["../../src/sequence/sharedStringWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAKpD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kCAAkC,CACjD,YAA0B,EAC1B,OAA+B,EAC/B,4BAAsF;IAEtF,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEjE,iGAAiG;IACjG,yCAAyC;IACzC,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC;;;;;;OAMG;IACH,4BAA4B,CAAC,oBAAoB,GAAG,CACnD,YAAyC,EACzC,OAAgC,EAChC,KAA6B,EAC5B,EAAE;QACH,2FAA2F;QAC3F,sBAAsB;QACtB,MAAM,CACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,sFAAsF,CAC5F,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,YAAY,CAAC,oBAAoB,CAChC,YAAY,EACZ,OAAO,EACP,4BAA4B,CAAC,KAAK,CAAC,CACnC,CAAC;aACF;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF;;;;;;OAMG;IACH,4BAA4B,CAAC,YAAY,GAAG,CAC3C,GAAW,EACX,OAAgC,EAChC,KAA6B,EAC5B,EAAE;QACH,IAAI,QAAQ,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;OAOG;IACH,4BAA4B,CAAC,aAAa,GAAG,CAC5C,KAAa,EACb,GAAW,EACX,KAA4B,EAC3B,EAAE;QACH,2FAA2F;QAC3F,sBAAsB;QACtB,MAAM,CACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,sFAAsF,CAC5F,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,YAAY,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,4BAA4B,CAAC,KAAK,CAAC,CAAC,CAAC;aAC5E;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF;;;;;OAKG;IACH,4BAA4B,CAAC,yBAAyB,GAAG,CACxD,GAAgC,EAChC,OAA8B,EAC7B,EAAE;QACH,2FAA2F;QAC3F,sBAAsB;QACtB,MAAM,CACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,sFAAsF,CAC5F,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,OAAO,CAAC,UAAU,GAAG,4BAA4B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBACtE,YAAY,CAAC,yBAAyB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;aACrD;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,4BAA4C,CAAC;AACrD,CAAC","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 * as MergeTree from \"@fluidframework/merge-tree\";\nimport { SharedString } from \"@fluidframework/sequence\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions\";\n\n/**\n * - Create a new object from the passed SharedString.\n *\n * - Modify the methods that insert / remove / annotate the properties of the SharedString to call\n * the propertyInterceptionCallback to get new properties.\n *\n * - Use these new properties to call the underlying SharedString.\n *\n * - The propertyInterceptionCallback and the call to the underlying SharedString are wrapped around an\n * orderSequentially call to batch any operations that might happen in the callback.\n *\n * @param sharedString - The underlying SharedString\n * @param context - The IFluidDataStoreContext that will be used to call orderSequentially\n * @param propertyInterceptionCallback - The interception callback to be called\n *\n * @returns A new SharedString that intercepts the methods modifying the SharedString properties.\n * @internal\n */\nexport function createSharedStringWithInterception(\n\tsharedString: SharedString,\n\tcontext: IFluidDataStoreContext,\n\tpropertyInterceptionCallback: (props?: MergeTree.PropertySet) => MergeTree.PropertySet,\n): SharedString {\n\tconst sharedStringWithInterception = Object.create(sharedString);\n\n\t// executingCallback keeps track of whether a method on this wrapper object is called recursively\n\t// from the propertyInterceptionCallback.\n\tlet executingCallback: boolean = false;\n\n\t/**\n\t * Inserts a marker at a relative position.\n\t *\n\t * @param relativePos1 - The relative position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tsharedStringWithInterception.insertMarkerRelative = (\n\t\trelativePos1: MergeTree.IRelativePosition,\n\t\trefType: MergeTree.ReferenceType,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c1 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertMarkerRelative(\n\t\t\t\t\trelativePos1,\n\t\t\t\t\trefType,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts a marker at the position.\n\t *\n\t * @param pos - The position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tsharedStringWithInterception.insertMarker = (\n\t\tpos: number,\n\t\trefType: MergeTree.ReferenceType,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\tlet insertOp;\n\t\t// Wrapper methods should not be called 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\t0x0c2 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tinsertOp = sharedString.insertMarker(\n\t\t\t\t\tpos,\n\t\t\t\t\trefType,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\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 insertOp;\n\t};\n\n\t/**\n\t * Inserts the text at a relative position.\n\t *\n\t * @param relativePos1 - The relative position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tsharedStringWithInterception.insertTextRelative = (\n\t\trelativePos1: MergeTree.IRelativePosition,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c3 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertTextRelative(\n\t\t\t\t\trelativePos1,\n\t\t\t\t\ttext,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts the text at the position.\n\t *\n\t * @param pos - The position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tsharedStringWithInterception.insertText = (\n\t\tpos: number,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c4 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertText(pos, text, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Replaces a range with the provided text.\n\t *\n\t * @param start - The inclusive start of the range to replace\n\t * @param end - The exclusive end of the range to replace\n\t * @param text - The text to replace the range with\n\t * @param props - Optional. The properties of the replacement text\n\t */\n\tsharedStringWithInterception.replaceText = (\n\t\tstart: number,\n\t\tend: number,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c5 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.replaceText(start, end, text, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Annotates the marker with the provided properties.\n\t *\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t */\n\tsharedStringWithInterception.annotateMarker = (\n\t\tmarker: MergeTree.Marker,\n\t\tprops: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c7 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.annotateMarker(marker, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Annotates the range with the provided properties.\n\t *\n\t * @param start - The inclusive start position of the range to annotate\n\t * @param end - The exclusive end position of the range to annotate\n\t * @param props - The properties to annotate the range with\n\t *\n\t */\n\tsharedStringWithInterception.annotateRange = (\n\t\tstart: number,\n\t\tend: number,\n\t\tprops: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c8 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.annotateRange(start, end, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts the segment at the given position\n\t *\n\t * @param pos - The position to insert the segment at\n\t * @param segment - The segment to insert\n\t */\n\tsharedStringWithInterception.insertAtReferencePosition = (\n\t\tpos: MergeTree.ReferencePosition,\n\t\tsegment: MergeTree.TextSegment,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c9 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsegment.properties = propertyInterceptionCallback(segment.properties);\n\t\t\t\tsharedString.insertAtReferencePosition(pos, segment);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\treturn sharedStringWithInterception as SharedString;\n}\n"]}
1
+ {"version":3,"file":"sharedStringWithInterception.js","sourceRoot":"","sources":["../../src/sequence/sharedStringWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAK7D;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,kCAAkC,CACjD,YAA0B,EAC1B,OAA+B,EAC/B,4BAAsF;IAEtF,MAAM,4BAA4B,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAEjE,iGAAiG;IACjG,yCAAyC;IACzC,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC;;;;;;OAMG;IACH,4BAA4B,CAAC,oBAAoB,GAAG,CACnD,YAAyC,EACzC,OAAgC,EAChC,KAA6B,EAC5B,EAAE;QACH,2FAA2F;QAC3F,sBAAsB;QACtB,MAAM,CACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,sFAAsF,CAC5F,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,YAAY,CAAC,oBAAoB,CAChC,YAAY,EACZ,OAAO,EACP,4BAA4B,CAAC,KAAK,CAAC,CACnC,CAAC;aACF;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF;;;;;;OAMG;IACH,4BAA4B,CAAC,YAAY,GAAG,CAC3C,GAAW,EACX,OAAgC,EAChC,KAA6B,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;IACJ,CAAC,CAAC;IAEF;;;;;;;OAOG;IACH,4BAA4B,CAAC,aAAa,GAAG,CAC5C,KAAa,EACb,GAAW,EACX,KAA4B,EAC3B,EAAE;QACH,2FAA2F;QAC3F,sBAAsB;QACtB,MAAM,CACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,sFAAsF,CAC5F,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,YAAY,CAAC,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,4BAA4B,CAAC,KAAK,CAAC,CAAC,CAAC;aAC5E;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF;;;;;OAKG;IACH,4BAA4B,CAAC,yBAAyB,GAAG,CACxD,GAAgC,EAChC,OAA8B,EAC7B,EAAE;QACH,2FAA2F;QAC3F,sBAAsB;QACtB,MAAM,CACL,iBAAiB,KAAK,KAAK,EAC3B,KAAK,CAAC,sFAAsF,CAC5F,CAAC;QAEF,OAAO,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,GAAG,EAAE;YAC/C,iBAAiB,GAAG,IAAI,CAAC;YACzB,IAAI;gBACH,OAAO,CAAC,UAAU,GAAG,4BAA4B,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;gBACtE,YAAY,CAAC,yBAAyB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;aACrD;oBAAS;gBACT,iBAAiB,GAAG,KAAK,CAAC;aAC1B;QACF,CAAC,CAAC,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,4BAA4C,CAAC;AACrD,CAAC","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/internal\";\nimport * as MergeTree from \"@fluidframework/merge-tree/internal\";\nimport { IFluidDataStoreContext } from \"@fluidframework/runtime-definitions/internal\";\nimport { SharedString } from \"@fluidframework/sequence/internal\";\n\n/**\n * - Create a new object from the passed SharedString.\n *\n * - Modify the methods that insert / remove / annotate the properties of the SharedString to call\n * the propertyInterceptionCallback to get new properties.\n *\n * - Use these new properties to call the underlying SharedString.\n *\n * - The propertyInterceptionCallback and the call to the underlying SharedString are wrapped around an\n * orderSequentially call to batch any operations that might happen in the callback.\n *\n * @param sharedString - The underlying SharedString\n * @param context - The IFluidDataStoreContext that will be used to call orderSequentially\n * @param propertyInterceptionCallback - The interception callback to be called\n *\n * @returns A new SharedString that intercepts the methods modifying the SharedString properties.\n * @internal\n */\nexport function createSharedStringWithInterception(\n\tsharedString: SharedString,\n\tcontext: IFluidDataStoreContext,\n\tpropertyInterceptionCallback: (props?: MergeTree.PropertySet) => MergeTree.PropertySet,\n): SharedString {\n\tconst sharedStringWithInterception = Object.create(sharedString);\n\n\t// executingCallback keeps track of whether a method on this wrapper object is called recursively\n\t// from the propertyInterceptionCallback.\n\tlet executingCallback: boolean = false;\n\n\t/**\n\t * Inserts a marker at a relative position.\n\t *\n\t * @param relativePos1 - The relative position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tsharedStringWithInterception.insertMarkerRelative = (\n\t\trelativePos1: MergeTree.IRelativePosition,\n\t\trefType: MergeTree.ReferenceType,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c1 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertMarkerRelative(\n\t\t\t\t\trelativePos1,\n\t\t\t\t\trefType,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts a marker at the position.\n\t *\n\t * @param pos - The position to insert the marker at\n\t * @param refType - The reference type of the marker\n\t * @param props - The properties of the marker\n\t */\n\tsharedStringWithInterception.insertMarker = (\n\t\tpos: number,\n\t\trefType: MergeTree.ReferenceType,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\tlet insertOp;\n\t\t// Wrapper methods should not be called 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\t0x0c2 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tinsertOp = sharedString.insertMarker(\n\t\t\t\t\tpos,\n\t\t\t\t\trefType,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\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 insertOp;\n\t};\n\n\t/**\n\t * Inserts the text at a relative position.\n\t *\n\t * @param relativePos1 - The relative position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tsharedStringWithInterception.insertTextRelative = (\n\t\trelativePos1: MergeTree.IRelativePosition,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c3 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertTextRelative(\n\t\t\t\t\trelativePos1,\n\t\t\t\t\ttext,\n\t\t\t\t\tpropertyInterceptionCallback(props),\n\t\t\t\t);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts the text at the position.\n\t *\n\t * @param pos - The position to insert the text at\n\t * @param text - The text to insert\n\t * @param props - The properties of text\n\t */\n\tsharedStringWithInterception.insertText = (\n\t\tpos: number,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c4 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.insertText(pos, text, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Replaces a range with the provided text.\n\t *\n\t * @param start - The inclusive start of the range to replace\n\t * @param end - The exclusive end of the range to replace\n\t * @param text - The text to replace the range with\n\t * @param props - Optional. The properties of the replacement text\n\t */\n\tsharedStringWithInterception.replaceText = (\n\t\tstart: number,\n\t\tend: number,\n\t\ttext: string,\n\t\tprops?: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c5 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.replaceText(start, end, text, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Annotates the marker with the provided properties.\n\t *\n\t * @param marker - The marker to annotate\n\t * @param props - The properties to annotate the marker with\n\t */\n\tsharedStringWithInterception.annotateMarker = (\n\t\tmarker: MergeTree.Marker,\n\t\tprops: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c7 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.annotateMarker(marker, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Annotates the range with the provided properties.\n\t *\n\t * @param start - The inclusive start position of the range to annotate\n\t * @param end - The exclusive end position of the range to annotate\n\t * @param props - The properties to annotate the range with\n\t *\n\t */\n\tsharedStringWithInterception.annotateRange = (\n\t\tstart: number,\n\t\tend: number,\n\t\tprops: MergeTree.PropertySet,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c8 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsharedString.annotateRange(start, end, propertyInterceptionCallback(props));\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\t/**\n\t * Inserts the segment at the given position\n\t *\n\t * @param pos - The position to insert the segment at\n\t * @param segment - The segment to insert\n\t */\n\tsharedStringWithInterception.insertAtReferencePosition = (\n\t\tpos: MergeTree.ReferencePosition,\n\t\tsegment: MergeTree.TextSegment,\n\t) => {\n\t\t// Wrapper methods should not be called 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\t0x0c9 /* \"Interception wrapper methods called recursively from the interception callback\" */,\n\t\t);\n\n\t\tcontext.containerRuntime.orderSequentially(() => {\n\t\t\texecutingCallback = true;\n\t\t\ttry {\n\t\t\t\tsegment.properties = propertyInterceptionCallback(segment.properties);\n\t\t\t\tsharedString.insertAtReferencePosition(pos, segment);\n\t\t\t} finally {\n\t\t\t\texecutingCallback = false;\n\t\t\t}\n\t\t});\n\t};\n\n\treturn sharedStringWithInterception as SharedString;\n}\n"]}