@fluid-experimental/dds-interceptions 2.90.0-378676 → 2.90.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # @fluidframework/dds-interceptions
2
2
 
3
+ ## 2.90.0
4
+
5
+ Dependency updates only.
6
+
3
7
  ## 2.83.0
4
8
 
5
9
  Dependency updates only.
@@ -1 +1 @@
1
- {"version":3,"file":"sharedDirectoryWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAiI3F;;;;;;;;;;;;;;;;;;;;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,OAAO,KACV,IAAI,GACP,CAAC,CAOH"}
1
+ {"version":3,"file":"sharedDirectoryWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAgI3F;;;;;;;;;;;;;;;;;;;;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,OAAO,KACV,IAAI,GACP,CAAC,CAOH"}
@@ -86,7 +86,6 @@ function createSubDirectoryWithInterception(baseDirectory, subDirectory, context
86
86
  ? subSubDirectory
87
87
  : createSubDirectoryWithInterception(baseDirectory, subSubDirectory, context, setInterceptionCallback);
88
88
  };
89
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
90
89
  return subDirectoryWithInterception;
91
90
  }
92
91
  /**
@@ -1 +1 @@
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,CAAM,CAAC;IAEtE,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,4BAA4B,CAAC,GAAG,GAAG,CAAC,GAAW,EAAE,KAAc,EAAE,EAAE;QAClE,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,CAAC;gBACJ,uBAAuB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;YAClE,CAAC;oBAAS,CAAC;gBACV,iBAAiB,GAAG,KAAK,CAAC;YAC3B,CAAC;QACF,CAAC,CAAC,CAAC;QACH,+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Q,CAAC;gBAChB,OAAO,IAAI,CAAC;YACb,CAAC;SACD,CAAC;QACF,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC;IAEF,4BAA4B,CAAC,mBAAmB,GAAG,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,CACvB,CAAC;IACL,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 type { IDirectory } from \"@fluidframework/map/internal\";\nimport type { 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: unknown,\n\t) => void,\n): T {\n\tconst subDirectoryWithInterception = Object.create(subDirectory) as T;\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: unknown) => {\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 = (\n\t\tsubdirName: string,\n\t): 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\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\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: unknown,\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,CAAM,CAAC;IAEtE,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,4BAA4B,CAAC,GAAG,GAAG,CAAC,GAAW,EAAE,KAAc,EAAE,EAAE;QAClE,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,G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ACb,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAChB,OAAO,EACP,uBAAuB,CACvB,CAAC;oBACF,OAAO,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gBAC3D,CAAC;YACF,CAAC;YACD,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAChB,OAAO,IAAI,CAAC;YACb,CAAC;SACD,CAAC;QACF,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC;IAEF,4BAA4B,CAAC,mBAAmB,GAAG,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,CACvB,CAAC;IACL,CAAC,CAAC;IAEF,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 type { IDirectory } from \"@fluidframework/map/internal\";\nimport type { 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: unknown,\n\t) => void,\n): T {\n\tconst subDirectoryWithInterception = Object.create(subDirectory) as T;\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: unknown) => {\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 = (\n\t\tsubdirName: string,\n\t): 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\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\t);\n\t};\n\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: unknown,\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 +1 @@
1
- {"version":3,"file":"sharedDirectoryWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAiI3F;;;;;;;;;;;;;;;;;;;;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,OAAO,KACV,IAAI,GACP,CAAC,CAOH"}
1
+ {"version":3,"file":"sharedDirectoryWithInterception.d.ts","sourceRoot":"","sources":["../../src/map/sharedDirectoryWithInterception.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8CAA8C,CAAC;AAgI3F;;;;;;;;;;;;;;;;;;;;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,OAAO,KACV,IAAI,GACP,CAAC,CAOH"}
@@ -83,7 +83,6 @@ function createSubDirectoryWithInterception(baseDirectory, subDirectory, context
83
83
  ? subSubDirectory
84
84
  : createSubDirectoryWithInterception(baseDirectory, subSubDirectory, context, setInterceptionCallback);
85
85
  };
86
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
87
86
  return subDirectoryWithInterception;
88
87
  }
89
88
  /**
@@ -1 +1 @@
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,CAAM,CAAC;IAEtE,uGAAuG;IACvG,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,4BAA4B,CAAC,GAAG,GAAG,CAAC,G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,GAAG,wBAAwB,CAAC,IAAI,EAAE,CAAC;gBAChD,yEAAyE;gBACzE,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;oBAClB,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;gBACzC,CAAC;qBAAM,CAAC;oBACP,4DAA4D;oBAC5D,MAAM,MAAM,GAAG,kCAAkC,CAChD,aAAa,EACb,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAChB,OAAO,EACP,uBAAuB,CACvB,CAAC;oBACF,OAAO,EAAE,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;gBAC3D,CAAC;YACF,CAAC;YACD,CAAC,MAAM,CAAC,QAAQ,CAAC;gBAChB,OAAO,IAAI,CAAC;YACb,CAAC;SACD,CAAC;QACF,OAAO,QAAQ,CAAC;IACjB,CAAC,CAAC;IAEF,4BAA4B,CAAC,mBAAmB,GAAG,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,CACvB,CAAC;IACL,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 type { IDirectory } from \"@fluidframework/map/internal\";\nimport type { 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: unknown,\n\t) => void,\n): T {\n\tconst subDirectoryWithInterception = Object.create(subDirectory) as T;\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: unknown) => {\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 = (\n\t\tsubdirName: string,\n\t): 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\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\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: unknown,\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;A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;;;;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 type { IDirectory } from \"@fluidframework/map/internal\";\nimport type { 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: unknown,\n\t) => void,\n): T {\n\tconst subDirectoryWithInterception = Object.create(subDirectory) as T;\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: unknown) => {\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 = (\n\t\tsubdirName: string,\n\t): 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\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\t);\n\t};\n\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: unknown,\n\t) => void,\n): T {\n\treturn createSubDirectoryWithInterception(\n\t\tbaseDirectory,\n\t\tbaseDirectory,\n\t\tcontext,\n\t\tsetInterceptionCallback,\n\t);\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-experimental/dds-interceptions",
3
- "version": "2.90.0-378676",
3
+ "version": "2.90.0",
4
4
  "description": "Distributed Data Structures that support an interception callback",
5
5
  "homepage": "https://fluidframework.com",
6
6
  "repository": {
@@ -49,21 +49,21 @@
49
49
  "temp-directory": "nyc/.nyc_output"
50
50
  },
51
51
  "dependencies": {
52
- "@fluidframework/core-utils": "2.90.0-378676",
53
- "@fluidframework/map": "2.90.0-378676",
54
- "@fluidframework/merge-tree": "2.90.0-378676",
55
- "@fluidframework/runtime-definitions": "2.90.0-378676",
56
- "@fluidframework/sequence": "2.90.0-378676"
52
+ "@fluidframework/core-utils": "~2.90.0",
53
+ "@fluidframework/map": "~2.90.0",
54
+ "@fluidframework/merge-tree": "~2.90.0",
55
+ "@fluidframework/runtime-definitions": "~2.90.0",
56
+ "@fluidframework/sequence": "~2.90.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@arethetypeswrong/cli": "^0.18.2",
60
60
  "@biomejs/biome": "~1.9.3",
61
- "@fluid-internal/mocha-test-setup": "2.90.0-378676",
61
+ "@fluid-internal/mocha-test-setup": "~2.90.0",
62
62
  "@fluid-tools/build-cli": "^0.63.0",
63
63
  "@fluidframework/build-common": "^2.0.3",
64
64
  "@fluidframework/build-tools": "^0.63.0",
65
- "@fluidframework/eslint-config-fluid": "2.90.0-378676",
66
- "@fluidframework/test-runtime-utils": "2.90.0-378676",
65
+ "@fluidframework/eslint-config-fluid": "~2.90.0",
66
+ "@fluidframework/test-runtime-utils": "~2.90.0",
67
67
  "@microsoft/api-extractor": "7.52.11",
68
68
  "@types/diff": "^3.5.1",
69
69
  "@types/mocha": "^10.0.10",
@@ -75,9 +75,9 @@
75
75
  "diff": "^3.5.0",
76
76
  "eslint": "~9.39.1",
77
77
  "jiti": "^2.6.1",
78
- "mocha": "^10.8.2",
78
+ "mocha": "^11.7.5",
79
79
  "mocha-multi-reporters": "^1.5.1",
80
- "rimraf": "^6.1.2",
80
+ "rimraf": "^6.1.3",
81
81
  "typescript": "~5.4.5"
82
82
  },
83
83
  "typeValidation": {
@@ -130,7 +130,6 @@ function createSubDirectoryWithInterception<T extends IDirectory>(
130
130
  );
131
131
  };
132
132
 
133
- // eslint-disable-next-line @typescript-eslint/no-unsafe-return
134
133
  return subDirectoryWithInterception;
135
134
  }
136
135