@fluidframework/tool-utils 2.0.0-dev-rc.1.0.0.232845 → 2.0.0-dev-rc.2.0.0.246488

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 (91) hide show
  1. package/.eslintrc.cjs +4 -1
  2. package/{.mocharc.js → .mocharc.cjs} +1 -1
  3. package/CHANGELOG.md +4 -0
  4. package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
  5. package/api-extractor-lint.json +1 -1
  6. package/api-extractor.json +1 -1
  7. package/api-report/tool-utils.api.md +2 -2
  8. package/dist/debug.js +2 -2
  9. package/dist/debug.js.map +1 -1
  10. package/dist/fluidToolRC.d.ts +1 -1
  11. package/dist/fluidToolRC.d.ts.map +1 -1
  12. package/dist/fluidToolRC.js.map +1 -1
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +11 -11
  16. package/dist/index.js.map +1 -1
  17. package/dist/odspTokenManager.d.ts +2 -2
  18. package/dist/odspTokenManager.d.ts.map +1 -1
  19. package/dist/odspTokenManager.js +22 -22
  20. package/dist/odspTokenManager.js.map +1 -1
  21. package/dist/package.json +3 -0
  22. package/dist/packageVersion.d.ts +1 -1
  23. package/dist/packageVersion.js +1 -1
  24. package/dist/packageVersion.js.map +1 -1
  25. package/dist/snapshotNormalizer.d.ts.map +1 -1
  26. package/dist/snapshotNormalizer.js +4 -0
  27. package/dist/snapshotNormalizer.js.map +1 -1
  28. package/dist/tool-utils-alpha.d.ts +2 -2
  29. package/dist/tool-utils-beta.d.ts +2 -2
  30. package/dist/tool-utils-public.d.ts +2 -2
  31. package/dist/tool-utils-untrimmed.d.ts +2 -2
  32. package/dist/tsdoc-metadata.json +1 -1
  33. package/lib/{debug.d.mts → debug.d.ts} +1 -1
  34. package/lib/debug.d.ts.map +1 -0
  35. package/lib/{debug.mjs → debug.js} +2 -2
  36. package/lib/debug.js.map +1 -0
  37. package/lib/{fluidToolRC.d.mts → fluidToolRC.d.ts} +2 -2
  38. package/lib/fluidToolRC.d.ts.map +1 -0
  39. package/lib/{fluidToolRC.mjs → fluidToolRC.js} +1 -1
  40. package/lib/fluidToolRC.js.map +1 -0
  41. package/lib/{httpHelpers.d.mts → httpHelpers.d.ts} +3 -3
  42. package/lib/httpHelpers.d.ts.map +1 -0
  43. package/lib/{httpHelpers.mjs → httpHelpers.js} +1 -1
  44. package/lib/httpHelpers.js.map +1 -0
  45. package/lib/{index.d.mts → index.d.ts} +4 -4
  46. package/lib/index.d.ts.map +1 -0
  47. package/lib/{index.mjs → index.js} +4 -4
  48. package/lib/index.js.map +1 -0
  49. package/lib/{odspTokenManager.d.mts → odspTokenManager.d.ts} +3 -3
  50. package/lib/odspTokenManager.d.ts.map +1 -0
  51. package/lib/{odspTokenManager.mjs → odspTokenManager.js} +5 -5
  52. package/lib/odspTokenManager.js.map +1 -0
  53. package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
  54. package/lib/packageVersion.d.ts.map +1 -0
  55. package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
  56. package/lib/packageVersion.js.map +1 -0
  57. package/lib/{snapshotNormalizer.d.mts → snapshotNormalizer.d.ts} +1 -1
  58. package/lib/snapshotNormalizer.d.ts.map +1 -0
  59. package/lib/{snapshotNormalizer.mjs → snapshotNormalizer.js} +5 -1
  60. package/lib/snapshotNormalizer.js.map +1 -0
  61. package/lib/test/snapshotNormalizer.spec.js +140 -0
  62. package/lib/test/snapshotNormalizer.spec.js.map +1 -0
  63. package/lib/test/types/validateToolUtilsPrevious.generated.js +28 -0
  64. package/lib/test/types/validateToolUtilsPrevious.generated.js.map +1 -0
  65. package/lib/{tool-utils-alpha.d.mts → tool-utils-alpha.d.ts} +2 -2
  66. package/lib/{tool-utils-beta.d.mts → tool-utils-beta.d.ts} +2 -2
  67. package/lib/{tool-utils-public.d.mts → tool-utils-public.d.ts} +2 -2
  68. package/lib/{tool-utils-untrimmed.d.mts → tool-utils-untrimmed.d.ts} +2 -2
  69. package/package.json +45 -22
  70. package/src/debug.ts +1 -1
  71. package/src/fluidToolRC.ts +1 -1
  72. package/src/index.ts +3 -3
  73. package/src/odspTokenManager.ts +4 -4
  74. package/src/packageVersion.ts +1 -1
  75. package/src/snapshotNormalizer.ts +4 -0
  76. package/tsconfig.cjs.json +7 -0
  77. package/tsconfig.json +3 -5
  78. package/lib/debug.d.mts.map +0 -1
  79. package/lib/debug.mjs.map +0 -1
  80. package/lib/fluidToolRC.d.mts.map +0 -1
  81. package/lib/fluidToolRC.mjs.map +0 -1
  82. package/lib/httpHelpers.d.mts.map +0 -1
  83. package/lib/httpHelpers.mjs.map +0 -1
  84. package/lib/index.d.mts.map +0 -1
  85. package/lib/index.mjs.map +0 -1
  86. package/lib/odspTokenManager.d.mts.map +0 -1
  87. package/lib/odspTokenManager.mjs.map +0 -1
  88. package/lib/packageVersion.d.mts.map +0 -1
  89. package/lib/packageVersion.mjs.map +0 -1
  90. package/lib/snapshotNormalizer.d.mts.map +0 -1
  91. package/lib/snapshotNormalizer.mjs.map +0 -1
@@ -1,5 +1,5 @@
1
- import { IClientConfig } from '@fluidframework/odsp-doclib-utils';
2
- import { IOdspTokens } from '@fluidframework/odsp-doclib-utils';
1
+ import { IClientConfig } from '@fluidframework/odsp-doclib-utils/internal';
2
+ import { IOdspTokens } from '@fluidframework/odsp-doclib-utils/internal';
3
3
  import { ITree } from '@fluidframework/protocol-definitions';
4
4
 
5
5
  /**
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.39.1"
8
+ "packageVersion": "7.42.3"
9
9
  }
10
10
  ]
11
11
  }
@@ -4,4 +4,4 @@
4
4
  */
5
5
  import registerDebug from "debug";
6
6
  export declare const debug: registerDebug.Debugger;
7
- //# sourceMappingURL=debug.d.mts.map
7
+ //# sourceMappingURL=debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.d.ts","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,aAAa,MAAM,OAAO,CAAC;AAGlC,eAAO,MAAM,KAAK,wBAAoC,CAAC"}
@@ -3,7 +3,7 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import registerDebug from "debug";
6
- import { pkgName, pkgVersion } from "./packageVersion.mjs";
6
+ import { pkgName, pkgVersion } from "./packageVersion.js";
7
7
  export const debug = registerDebug("fluid:tool-utils");
8
8
  debug(`Package: ${pkgName} - Version: ${pkgVersion}`);
9
- //# sourceMappingURL=debug.mjs.map
9
+ //# sourceMappingURL=debug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug.js","sourceRoot":"","sources":["../src/debug.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,aAAa,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,CAAC,MAAM,KAAK,GAAG,aAAa,CAAC,kBAAkB,CAAC,CAAC;AACvD,KAAK,CAAC,YAAY,OAAO,eAAe,UAAU,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport registerDebug from \"debug\";\nimport { pkgName, pkgVersion } from \"./packageVersion.js\";\n\nexport const debug = registerDebug(\"fluid:tool-utils\");\ndebug(`Package: ${pkgName} - Version: ${pkgVersion}`);\n"]}
@@ -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 { IOdspTokens } from "@fluidframework/odsp-doclib-utils";
5
+ import { IOdspTokens } from "@fluidframework/odsp-doclib-utils/internal";
6
6
  /**
7
7
  * @internal
8
8
  */
@@ -37,4 +37,4 @@ export declare function saveRC(rc: IResources): Promise<void>;
37
37
  * @internal
38
38
  */
39
39
  export declare function lockRC(): Promise<any>;
40
- //# sourceMappingURL=fluidToolRC.d.mts.map
40
+ //# sourceMappingURL=fluidToolRC.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fluidToolRC.d.ts","sourceRoot":"","sources":["../src/fluidToolRC.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,IAAI,EAAE,MAAM;IACxC,GAAG,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,IAAI,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,MAAM,CAAC,EAAE;QACR,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE;YACL,CAAC,GAAG,EAAE,MAAM,GAAG;gBACd,OAAO,CAAC,EAAE,WAAW,CAAC;gBACtB,IAAI,CAAC,EAAE,WAAW,CAAC;aACnB,CAAC;SACF,CAAC;KACF,CAAC;CACF;AAID;;GAEG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,UAAU,CAAC,CAclD;AAED;;GAEG;AACH,wBAAsB,MAAM,CAAC,EAAE,EAAE,UAAU,iBAI1C;AAED;;GAEG;AACH,wBAAsB,MAAM,iBAS3B"}
@@ -48,4 +48,4 @@ export async function lockRC() {
48
48
  realpath: false,
49
49
  });
50
50
  }
51
- //# sourceMappingURL=fluidToolRC.mjs.map
51
+ //# sourceMappingURL=fluidToolRC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fluidToolRC.js","sourceRoot":"","sources":["../src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CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,MAAM;IAC3B,+DAA+D;IAC/D,OAAO,IAAI,CAAC,aAAa,EAAE,EAAE;QAC5B,OAAO,EAAE;YACR,OAAO,EAAE,IAAI;SACb;QACD,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,KAAK;KACf,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport fs from \"fs\";\nimport os from \"os\";\nimport path from \"path\";\nimport util from \"util\";\nimport { lock } from \"proper-lockfile\";\nimport { IOdspTokens } from \"@fluidframework/odsp-doclib-utils/internal\";\n\n/**\n * @internal\n */\nexport interface IAsyncCache<TKey, TValue> {\n\tget(key: TKey): Promise<TValue | undefined>;\n\tsave(key: TKey, value: TValue): Promise<void>;\n\tlock<T>(callback: () => Promise<T>): Promise<T>;\n}\n\n/**\n * @internal\n */\nexport interface IResources {\n\ttokens?: {\n\t\tversion?: number;\n\t\tdata: {\n\t\t\t[key: string]: {\n\t\t\t\tstorage?: IOdspTokens;\n\t\t\t\tpush?: IOdspTokens;\n\t\t\t};\n\t\t};\n\t};\n}\n\nconst getRCFileName = () => path.join(os.homedir(), \".fluidtoolrc\");\n\n/**\n * @internal\n */\nexport async function loadRC(): Promise<IResources> {\n\tconst readFile = util.promisify(fs.readFile);\n\tconst exists = util.promisify(fs.exists);\n\tconst fileName = getRCFileName();\n\tif (await exists(fileName)) {\n\t\tconst buf = await readFile(fileName);\n\t\ttry {\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\t\t\treturn JSON.parse(buf.toString(\"utf8\"));\n\t\t} catch (e) {\n\t\t\t// Nothing\n\t\t}\n\t}\n\treturn {};\n}\n\n/**\n * @internal\n */\nexport async function saveRC(rc: IResources) {\n\tconst writeFile = util.promisify(fs.writeFile);\n\tconst content = JSON.stringify(rc, undefined, 2);\n\treturn writeFile(getRCFileName(), Buffer.from(content, \"utf8\"));\n}\n\n/**\n * @internal\n */\nexport async function lockRC() {\n\t// eslint-disable-next-line @typescript-eslint/no-unsafe-return\n\treturn lock(getRCFileName(), {\n\t\tretries: {\n\t\t\tforever: true,\n\t\t},\n\t\tstale: 60000,\n\t\trealpath: false,\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
- /// <reference types="node" />
6
- /// <reference types="node" />
5
+ /// <reference types="node" resolution-mode="require"/>
6
+ /// <reference types="node" resolution-mode="require"/>
7
7
  import http from "http";
8
8
  import { Socket } from "net";
9
9
  export interface ITrackedHttpServer {
@@ -16,4 +16,4 @@ export type OnceListenerHandler<T> = (req: http.IncomingMessage, res: http.Serve
16
16
  export type OnceListenerResult<T> = Promise<() => Promise<T>>;
17
17
  export declare const serverListenAndHandle: <T>(port: number, handler: OnceListenerHandler<T>) => OnceListenerResult<T>;
18
18
  export declare const endResponse: (response: http.ServerResponse) => Promise<void>;
19
- //# sourceMappingURL=httpHelpers.d.mts.map
19
+ //# sourceMappingURL=httpHelpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpHelpers.d.ts","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;;;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAE7B,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,UAAU,IAAI,IAAI,CAAC;CACnB;AACD,wBAAgB,mBAAmB,CAClC,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,IAAI,CAAC,eAAe,GACnC,kBAAkB,CAiBpB;AACD,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CACpC,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,GAAG,EAAE,IAAI,CAAC,cAAc,KACpB,OAAO,CAAC,CAAC,CAAC,CAAC;AAChB,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9D,eAAO,MAAM,qBAAqB,YAC3B,MAAM,2DAuBV,CAAC;AAEJ,eAAO,MAAM,WAAW,aAAoB,KAAK,cAAc,KAAG,QAAQ,IAAI,CAO3E,CAAC"}
@@ -46,4 +46,4 @@ export const endResponse = async (response) => new Promise((resolve, reject) =>
46
46
  reject(error);
47
47
  }
48
48
  });
49
- //# sourceMappingURL=httpHelpers.mjs.map
49
+ //# sourceMappingURL=httpHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpHelpers.js","sourceRoot":"","sources":["../src/httpHelpers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AAQxB,MAAM,UAAU,mBAAmB,CAClC,IAAY,EACZ,eAAqC;IAErC,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;IAElC,MAAM,CAAC,EAAE,CAAC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE;QAClC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACpB,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,OAAO;QACN,MAAM;QACN,OAAO;QACP,UAAU;YACT,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,OAAO,CAAC,CAAC,MA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AK,EAAE;QACf,MAAM,CAAC,KAAK,CAAC,CAAC;KACd;AACF,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport http from \"http\";\nimport { Socket } from \"net\";\n\nexport interface ITrackedHttpServer {\n\treadonly server: http.Server;\n\treadonly sockets: Set<Socket>;\n\tfullyClose(): void;\n}\nexport function createTrackedServer(\n\tport: number,\n\trequestListener: http.RequestListener,\n): ITrackedHttpServer {\n\tconst server = http.createServer(requestListener).listen(port);\n\tconst sockets = new Set<Socket>();\n\n\tserver.on(\"connection\", (socket) => {\n\t\tsockets.add(socket);\n\t\tsocket.on(\"close\", () => sockets.delete(socket));\n\t});\n\n\treturn {\n\t\tserver,\n\t\tsockets,\n\t\tfullyClose() {\n\t\t\tserver.close();\n\t\t\tsockets.forEach((socket) => socket.destroy());\n\t\t},\n\t};\n}\nexport type OnceListenerHandler<T> = (\n\treq: http.IncomingMessage,\n\tres: http.ServerResponse,\n) => Promise<T>;\nexport type OnceListenerResult<T> = Promise<() => Promise<T>>;\nexport const serverListenAndHandle = async <T>(\n\tport: number,\n\thandler: OnceListenerHandler<T>,\n): OnceListenerResult<T> =>\n\t// eslint-disable-next-line promise/param-names\n\tnew Promise((outerResolve, outerReject) => {\n\t\t// eslint-disable-next-line promise/param-names\n\t\tconst innerP = new Promise<T>((innerResolve, innerReject) => {\n\t\t\tconst httpServer = createTrackedServer(port, (req, res) => {\n\t\t\t\t// ignore favicon\n\t\t\t\tif (req.url === \"/favicon.ico\") {\n\t\t\t\t\tres.writeHead(200, { \"Content-Type\": \"image/x-icon\" });\n\t\t\t\t\tres.end();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\thandler(req, res)\n\t\t\t\t\t.finally(() => httpServer.fullyClose())\n\t\t\t\t\t.then(\n\t\t\t\t\t\t(result) => innerResolve(result),\n\t\t\t\t\t\t(error) => innerReject(error),\n\t\t\t\t\t);\n\t\t\t});\n\t\t\touterResolve(async () => innerP);\n\t\t});\n\t});\n\nexport const endResponse = async (response: http.ServerResponse): Promise<void> =>\n\tnew Promise((resolve, reject) => {\n\t\ttry {\n\t\t\tresponse.end(resolve);\n\t\t} catch (error) {\n\t\t\treject(error);\n\t\t}\n\t});\n"]}
@@ -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
- export { IAsyncCache, IResources, loadRC, lockRC, saveRC } from "./fluidToolRC.mjs";
6
- export { getMicrosoftConfiguration, IOdspTokenManagerCacheKey, OdspTokenConfig, OdspTokenManager, odspTokensCache, } from "./odspTokenManager.mjs";
7
- export { gcBlobPrefix, getNormalizedSnapshot, ISnapshotNormalizerConfig, } from "./snapshotNormalizer.mjs";
8
- //# sourceMappingURL=index.d.mts.map
5
+ export { IAsyncCache, IResources, loadRC, lockRC, saveRC } from "./fluidToolRC.js";
6
+ export { getMicrosoftConfiguration, IOdspTokenManagerCacheKey, OdspTokenConfig, OdspTokenManager, odspTokensCache, } from "./odspTokenManager.js";
7
+ export { gcBlobPrefix, getNormalizedSnapshot, ISnapshotNormalizerConfig, } from "./snapshotNormalizer.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EACN,yBAAyB,EACzB,yBAAyB,EACzB,eAAe,EACf,gBAAgB,EAChB,eAAe,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,GACzB,MAAM,yBAAyB,CAAC"}
@@ -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
- export { loadRC, lockRC, saveRC } from "./fluidToolRC.mjs";
6
- export { getMicrosoftConfiguration, OdspTokenManager, odspTokensCache, } from "./odspTokenManager.mjs";
7
- export { gcBlobPrefix, getNormalizedSnapshot, } from "./snapshotNormalizer.mjs";
8
- //# sourceMappingURL=index.mjs.map
5
+ export { loadRC, lockRC, saveRC } from "./fluidToolRC.js";
6
+ export { getMicrosoftConfiguration, OdspTokenManager, odspTokensCache, } from "./odspTokenManager.js";
7
+ export { gcBlobPrefix, getNormalizedSnapshot, } from "./snapshotNormalizer.js";
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA2B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACnF,OAAO,EACN,yBAAyB,EAGzB,gBAAgB,EAChB,eAAe,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACN,YAAY,EACZ,qBAAqB,GAErB,MAAM,yBAAyB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport { IAsyncCache, IResources, loadRC, lockRC, saveRC } from \"./fluidToolRC.js\";\nexport {\n\tgetMicrosoftConfiguration,\n\tIOdspTokenManagerCacheKey,\n\tOdspTokenConfig,\n\tOdspTokenManager,\n\todspTokensCache,\n} from \"./odspTokenManager.js\";\nexport {\n\tgcBlobPrefix,\n\tgetNormalizedSnapshot,\n\tISnapshotNormalizerConfig,\n} from \"./snapshotNormalizer.js\";\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 { IOdspTokens, IClientConfig } from "@fluidframework/odsp-doclib-utils";
6
- import { IAsyncCache } from "./fluidToolRC.mjs";
5
+ import { IOdspTokens, IClientConfig } from "@fluidframework/odsp-doclib-utils/internal";
6
+ import { IAsyncCache } from "./fluidToolRC.js";
7
7
  /**
8
8
  * @internal
9
9
  */
@@ -53,4 +53,4 @@ export declare class OdspTokenManager {
53
53
  * @internal
54
54
  */
55
55
  export declare const odspTokensCache: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens>;
56
- //# sourceMappingURL=odspTokenManager.d.mts.map
56
+ //# sourceMappingURL=odspTokenManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspTokenManager.d.ts","sourceRoot":"","sources":["../src/odspTokenManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,WAAW,EACX,aAAa,EAOb,MAAM,4CAA4C,CAAC;AAIpD,OAAO,EAAE,WAAW,EAA0B,MAAM,kBAAkB,CAAC;AAOvE;;GAEG;AACH,eAAO,MAAM,yBAAyB,QAAO,aAe3C,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,eAAe,GACxB;IACA,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAChB,GACD;IACA,IAAI,EAAE,cAAc,CAAC;IACrB,SAAS,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D,CAAC;AAEL;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC9B;AAiBD;;GAEG;AACH,qBAAa,gBAAgB;IAK3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC;IAJ7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAkC;IAC/D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAkC;IAC5D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAe;gBAExB,UAAU,CAAC,iEAAqD;IAGrE,iBAAiB,CAAC,GAAG,EAAE,yBAAyB,EAAE,KAAK,EAAE,WAAW;YAMnE,4BAA4B;IAO7B,aAAa,CACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,EAC5B,YAAY,UAAQ,EACpB,WAAW,UAAQ,GACjB,OAAO,CAAC,WAAW,CAAC;IAIV,aAAa,CACzB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,EAC5B,YAAY,UAAQ,EACpB,WAAW,UAAQ,GACjB,OAAO,CAAC,WAAW,CAAC;YAIT,iBAAiB;IAe/B,OAAO,CAAC,MAAM,CAAC,WAAW;YAYZ,SAAS;YA0CT,aAAa;YA+Db,yBAAyB;YAezB,4BAA4B;YAuC5B,yBAAyB;IAMvC,OAAO,CAAC,wBAAwB;CAWhC;AAYD;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,yBAAyB,EAAE,WAAW,CA6B/E,CAAC"}
@@ -3,12 +3,12 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { unreachableCase } from "@fluidframework/core-utils";
6
- import { fetchTokens, refreshTokens, getOdspScope, pushScope, getLoginPageUrl, } from "@fluidframework/odsp-doclib-utils";
6
+ import { fetchTokens, refreshTokens, getOdspScope, pushScope, getLoginPageUrl, } from "@fluidframework/odsp-doclib-utils/internal";
7
7
  import { jwtDecode } from "jwt-decode";
8
8
  import { Mutex } from "async-mutex";
9
- import { debug } from "./debug.mjs";
10
- import { loadRC, saveRC, lockRC } from "./fluidToolRC.mjs";
11
- import { serverListenAndHandle, endResponse } from "./httpHelpers.mjs";
9
+ import { debug } from "./debug.js";
10
+ import { loadRC, saveRC, lockRC } from "./fluidToolRC.js";
11
+ import { serverListenAndHandle, endResponse } from "./httpHelpers.js";
12
12
  const odspAuthRedirectPort = 7000;
13
13
  const odspAuthRedirectOrigin = `http://localhost:${odspAuthRedirectPort}`;
14
14
  const odspAuthRedirectUri = new URL("/auth/callback", odspAuthRedirectOrigin).href;
@@ -252,4 +252,4 @@ export const odspTokensCache = {
252
252
  }
253
253
  },
254
254
  };
255
- //# sourceMappingURL=odspTokenManager.mjs.map
255
+ //# sourceMappingURL=odspTokenManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"odspTokenManager.js","sourceRoot":"","sources":["../src/odspTokenManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAGN,WAAW,EACX,aAAa,EACb,YAAY,EACZ,SAAS,EACT,eAAe,GAEf,MAAM,4CAA4C,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAe,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEtE,MAAM,oBAAoB,GAAG,IAAI,CAAC;AAClC,MAAM,sBAAsB,GAAG,oBAAoB,oBAAoB,EAAE,CAAC;AAC1E,MAAM,mBAAmB,GAAG,IAAI,GAAG,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC,IAAI,CAAC;AAEnF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAkB,EAAE,CAAC,CAAC;IAC9D,IAAI,QAAQ;QACX,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE;YAC5C,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;SACvF;QACD,OAAO,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC;IAC/C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M,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAClD,IAAI,CAAC,UAAU,EAAE;YAChB,UAAU,GAAG,EAAE,CAAC;YAChB,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,UAAU,CAAC;SAC9C;QACD,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;QACrD,OAAO,MAAM,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC;IACD,KAAK,CAAC,IAAI,CAAI,QAA0B;QACvC,MAAM,OAAO,GAAG,MAAM,MAAM,EAAE,CAAC;QAC/B,IAAI;YACH,OAAO,MAAM,QAAQ,EAAE,CAAC;SACxB;gBAAS;YACT,MAAM,OAAO,EAAE,CAAC;SAChB;IACF,CAAC;CACD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { unreachableCase } from \"@fluidframework/core-utils\";\nimport {\n\tIOdspTokens,\n\tIClientConfig,\n\tfetchTokens,\n\trefreshTokens,\n\tgetOdspScope,\n\tpushScope,\n\tgetLoginPageUrl,\n\tTokenRequestCredentials,\n} from \"@fluidframework/odsp-doclib-utils/internal\";\nimport { jwtDecode } from \"jwt-decode\";\nimport { Mutex } from \"async-mutex\";\nimport { debug } from \"./debug.js\";\nimport { IAsyncCache, loadRC, saveRC, lockRC } from \"./fluidToolRC.js\";\nimport { serverListenAndHandle, endResponse } from \"./httpHelpers.js\";\n\nconst odspAuthRedirectPort = 7000;\nconst odspAuthRedirectOrigin = `http://localhost:${odspAuthRedirectPort}`;\nconst odspAuthRedirectUri = new URL(\"/auth/callback\", odspAuthRedirectOrigin).href;\n\n/**\n * @internal\n */\nexport const getMicrosoftConfiguration = (): IClientConfig => ({\n\tget clientId() {\n\t\tif (!process.env.login__microsoft__clientId) {\n\t\t\tthrow new Error(\"Client ID environment variable not set: login__microsoft__clientId.\");\n\t\t}\n\t\treturn process.env.login__microsoft__clientId;\n\t},\n\tget clientSecret() {\n\t\tif (!process.env.login__microsoft__secret) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Client Secret environment variable not set: login__microsoft__secret.\",\n\t\t\t);\n\t\t}\n\t\treturn process.env.login__microsoft__secret;\n\t},\n});\n\n/**\n * @internal\n */\nexport type OdspTokenConfig =\n\t| {\n\t\t\ttype: \"password\";\n\t\t\tusername: string;\n\t\t\tpassword: string;\n\t }\n\t| {\n\t\t\ttype: \"browserLogin\";\n\t\t\tnavigator: (url: string) => void;\n\t\t\tredirectUriCallback?: (tokens: IOdspTokens) => Promise<string>;\n\t };\n\n/**\n * @internal\n */\nexport interface IOdspTokenManagerCacheKey {\n\treadonly isPush: boolean;\n\treadonly userOrServer: string;\n}\n\nconst isValidToken = (token: string) => {\n\t// Return false for undefined or empty tokens.\n\tif (!token || token.length === 0) {\n\t\treturn false;\n\t}\n\n\tconst decodedToken = jwtDecode<any>(token);\n\t// Give it a 60s buffer\n\treturn decodedToken.exp - 60 >= new Date().getTime() / 1000;\n};\n\nconst cacheKeyToString = (key: IOdspTokenManagerCacheKey) => {\n\treturn `${key.userOrServer}${key.isPush ? \"[Push]\" : \"\"}`;\n};\n\n/**\n * @internal\n */\nexport class OdspTokenManager {\n\tprivate readonly storageCache = new Map<string, IOdspTokens>();\n\tprivate readonly pushCache = new Map<string, IOdspTokens>();\n\tprivate readonly cacheMutex = new Mutex();\n\tconstructor(\n\t\tprivate readonly tokenCache?: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens>,\n\t) {}\n\n\tpublic async updateTokensCache(key: IOdspTokenManagerCacheKey, value: IOdspTokens) {\n\t\tawait this.cacheMutex.runExclusive(async () => {\n\t\t\tawait this.updateTokensCacheWithoutLock(key, value);\n\t\t});\n\t}\n\n\tprivate async updateTokensCacheWithoutLock(key: IOdspTokenManagerCacheKey, value: IOdspTokens) {\n\t\tdebug(`${cacheKeyToString(key)}: Saving tokens`);\n\t\tconst memoryCache = key.isPush ? this.pushCache : this.storageCache;\n\t\tmemoryCache.set(key.userOrServer, value);\n\t\tawait this.tokenCache?.save(key, value);\n\t}\n\n\tpublic async getOdspTokens(\n\t\tserver: string,\n\t\tclientConfig: IClientConfig,\n\t\ttokenConfig: OdspTokenConfig,\n\t\tforceRefresh = false,\n\t\tforceReauth = false,\n\t): Promise<IOdspTokens> {\n\t\treturn this.getTokens(false, server, clientConfig, tokenConfig, forceRefresh, forceReauth);\n\t}\n\n\tpublic async getPushTokens(\n\t\tserver: string,\n\t\tclientConfig: IClientConfig,\n\t\ttokenConfig: OdspTokenConfig,\n\t\tforceRefresh = false,\n\t\tforceReauth = false,\n\t): Promise<IOdspTokens> {\n\t\treturn this.getTokens(true, server, clientConfig, tokenConfig, forceRefresh, forceReauth);\n\t}\n\n\tprivate async getTokenFromCache(cacheKey: IOdspTokenManagerCacheKey) {\n\t\tconst memoryCache = cacheKey.isPush ? this.pushCache : this.storageCache;\n\t\tconst memoryToken = memoryCache.get(cacheKey.userOrServer);\n\t\tif (memoryToken) {\n\t\t\tdebug(`${cacheKeyToString(cacheKey)}: Token found in memory `);\n\t\t\treturn memoryToken;\n\t\t}\n\t\tconst fileToken = await this.tokenCache?.get(cacheKey);\n\t\tif (fileToken) {\n\t\t\tdebug(`${cacheKeyToString(cacheKey)}: Token found in file`);\n\t\t\tmemoryCache.set(cacheKey.userOrServer, fileToken);\n\t\t\treturn fileToken;\n\t\t}\n\t}\n\n\tprivate static getCacheKey(\n\t\tisPush: boolean,\n\t\ttokenConfig: OdspTokenConfig,\n\t\tserver: string,\n\t): IOdspTokenManagerCacheKey {\n\t\t// If we are using password, we should cache the token per user instead of per server\n\t\treturn {\n\t\t\tisPush,\n\t\t\tuserOrServer: tokenConfig.type === \"password\" ? tokenConfig.username : server,\n\t\t};\n\t}\n\n\tprivate async getTokens(\n\t\tisPush: boolean,\n\t\tserver: string,\n\t\tclientConfig: IClientConfig,\n\t\ttokenConfig: OdspTokenConfig,\n\t\tforceRefresh: boolean,\n\t\tforceReauth: boolean,\n\t): Promise<IOdspTokens> {\n\t\tconst invokeGetTokensCore = async () => {\n\t\t\t// Don't solely rely on tokenCache lock, ensure serialized execution of\n\t\t\t// cache update to avoid multiple fetch.\n\t\t\treturn this.cacheMutex.runExclusive(async () => {\n\t\t\t\treturn this.getTokensCore(\n\t\t\t\t\tisPush,\n\t\t\t\t\tserver,\n\t\t\t\t\tclientConfig,\n\t\t\t\t\ttokenConfig,\n\t\t\t\t\tforceRefresh,\n\t\t\t\t\tforceReauth,\n\t\t\t\t);\n\t\t\t});\n\t\t};\n\t\tif (!forceReauth && !forceRefresh) {\n\t\t\t// check and return if it exists without lock\n\t\t\tconst cacheKey = OdspTokenManager.getCacheKey(isPush, tokenConfig, server);\n\t\t\tconst tokensFromCache = await this.getTokenFromCache(cacheKey);\n\t\t\tif (tokensFromCache) {\n\t\t\t\tif (isValidToken(tokensFromCache.accessToken)) {\n\t\t\t\t\tdebug(`${cacheKeyToString(cacheKey)}: Token reused from cache `);\n\t\t\t\t\tawait this.onTokenRetrievalFromCache(tokenConfig, tokensFromCache);\n\t\t\t\t\treturn tokensFromCache;\n\t\t\t\t}\n\t\t\t\tdebug(`${cacheKeyToString(cacheKey)}: Token expired from cache `);\n\t\t\t}\n\t\t}\n\t\tif (this.tokenCache) {\n\t\t\t// check with lock, used to prevent concurrent auth attempts\n\t\t\treturn this.tokenCache.lock(invokeGetTokensCore);\n\t\t}\n\t\treturn invokeGetTokensCore();\n\t}\n\n\tprivate async getTokensCore(\n\t\tisPush: boolean,\n\t\tserver: string,\n\t\tclientConfig: IClientConfig,\n\t\ttokenConfig: OdspTokenConfig,\n\t\tforceRefresh,\n\t\tforceReauth,\n\t): Promise<IOdspTokens> {\n\t\tconst scope = isPush ? pushScope : getOdspScope(server);\n\t\tconst cacheKey = OdspTokenManager.getCacheKey(isPush, tokenConfig, server);\n\t\tlet tokens: IOdspTokens | undefined;\n\t\tif (!forceReauth) {\n\t\t\t// check the cache again under the lock (if it is there)\n\t\t\tconst tokensFromCache = await this.getTokenFromCache(cacheKey);\n\t\t\tif (tokensFromCache) {\n\t\t\t\tif (forceRefresh || !isValidToken(tokensFromCache.accessToken)) {\n\t\t\t\t\ttry {\n\t\t\t\t\t\t// This updates the tokens in tokensFromCache\n\t\t\t\t\t\ttokens = await refreshTokens(server, scope, clientConfig, tokensFromCache);\n\t\t\t\t\t\tawait this.updateTokensCacheWithoutLock(cacheKey, tokens);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tdebug(`${cacheKeyToString(cacheKey)}: Error in refreshing token. ${error}`);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttokens = tokensFromCache;\n\t\t\t\t\tdebug(`${cacheKeyToString(cacheKey)}: Token reused from locked cache `);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (tokens) {\n\t\t\tawait this.onTokenRetrievalFromCache(tokenConfig, tokens);\n\t\t\treturn tokens;\n\t\t}\n\n\t\tswitch (tokenConfig.type) {\n\t\t\tcase \"password\":\n\t\t\t\ttokens = await this.acquireTokensWithPassword(\n\t\t\t\t\tserver,\n\t\t\t\t\tscope,\n\t\t\t\t\tclientConfig,\n\t\t\t\t\ttokenConfig.username,\n\t\t\t\t\ttokenConfig.password,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tcase \"browserLogin\":\n\t\t\t\ttokens = await this.acquireTokensViaBrowserLogin(\n\t\t\t\t\tgetLoginPageUrl(server, clientConfig, scope, odspAuthRedirectUri),\n\t\t\t\t\tserver,\n\t\t\t\t\tclientConfig,\n\t\t\t\t\tscope,\n\t\t\t\t\ttokenConfig.navigator,\n\t\t\t\t\ttokenConfig.redirectUriCallback,\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tunreachableCase(tokenConfig);\n\t\t}\n\n\t\tawait this.updateTokensCacheWithoutLock(cacheKey, tokens);\n\t\treturn tokens;\n\t}\n\n\tprivate async acquireTokensWithPassword(\n\t\tserver: string,\n\t\tscope: string,\n\t\tclientConfig: IClientConfig,\n\t\tusername: string,\n\t\tpassword: string,\n\t): Promise<IOdspTokens> {\n\t\tconst credentials: TokenRequestCredentials = {\n\t\t\tgrant_type: \"password\",\n\t\t\tusername,\n\t\t\tpassword,\n\t\t};\n\t\treturn fetchTokens(server, scope, clientConfig, credentials);\n\t}\n\n\tprivate async acquireTokensViaBrowserLogin(\n\t\tloginPageUrl: string,\n\t\tserver: string,\n\t\tclientConfig: IClientConfig,\n\t\tscope: string,\n\t\tnavigator: (url: string) => void,\n\t\tredirectUriCallback?: (tokens: IOdspTokens) => Promise<string>,\n\t): Promise<IOdspTokens> {\n\t\t// Start up a local auth redirect handler service to receive the tokens after login\n\t\tconst tokenGetter = await serverListenAndHandle(odspAuthRedirectPort, async (req, res) => {\n\t\t\t// extract code from request URL and fetch the tokens\n\t\t\tconst credentials: TokenRequestCredentials = {\n\t\t\t\tgrant_type: \"authorization_code\",\n\t\t\t\tcode: this.extractAuthorizationCode(req.url),\n\t\t\t\tredirect_uri: odspAuthRedirectUri,\n\t\t\t};\n\t\t\tconst tokens = await fetchTokens(server, scope, clientConfig, credentials);\n\n\t\t\t// redirect now that the browser is done with auth\n\t\t\tif (redirectUriCallback) {\n\t\t\t\tres.writeHead(301, { Location: await redirectUriCallback(tokens) });\n\t\t\t\tawait endResponse(res);\n\t\t\t} else {\n\t\t\t\tres.write(\"Please close the window\");\n\t\t\t\tawait endResponse(res);\n\t\t\t}\n\n\t\t\treturn tokens;\n\t\t});\n\n\t\t// Now that our local redirect handler is up, navigate the browser to the login page\n\t\tnavigator(loginPageUrl);\n\n\t\t// Receive and extract the tokens\n\t\tconst odspTokens = await tokenGetter();\n\n\t\treturn odspTokens;\n\t}\n\n\tprivate async onTokenRetrievalFromCache(config: OdspTokenConfig, tokens: IOdspTokens) {\n\t\tif (config.type === \"browserLogin\" && config.redirectUriCallback) {\n\t\t\tconfig.navigator(await config.redirectUriCallback(tokens));\n\t\t}\n\t}\n\n\tprivate extractAuthorizationCode(relativeUrl: string | undefined): string {\n\t\tif (relativeUrl === undefined) {\n\t\t\tthrow Error(\"Failed to get authorization\");\n\t\t}\n\t\tconst parsedUrl = new URL(relativeUrl, odspAuthRedirectOrigin);\n\t\tconst code = parsedUrl.searchParams.get(\"code\");\n\t\tif (!code) {\n\t\t\tthrow Error(\"Failed to get authorization\");\n\t\t}\n\t\treturn code;\n\t}\n}\n\nasync function loadAndPatchRC() {\n\tconst rc = await loadRC();\n\tif (rc.tokens && rc.tokens.version === undefined) {\n\t\t// Clean up older versions\n\t\tdelete (rc as any).tokens;\n\t\tdelete (rc as any).pushTokens;\n\t}\n\treturn rc;\n}\n\n/**\n * @internal\n */\nexport const odspTokensCache: IAsyncCache<IOdspTokenManagerCacheKey, IOdspTokens> = {\n\tasync get(key: IOdspTokenManagerCacheKey): Promise<IOdspTokens | undefined> {\n\t\tconst rc = await loadAndPatchRC();\n\t\treturn rc.tokens?.data[key.userOrServer]?.[key.isPush ? \"push\" : \"storage\"];\n\t},\n\tasync save(key: IOdspTokenManagerCacheKey, tokens: IOdspTokens): Promise<void> {\n\t\tconst rc = await loadAndPatchRC();\n\t\tif (!rc.tokens) {\n\t\t\trc.tokens = {\n\t\t\t\tversion: 1,\n\t\t\t\tdata: {},\n\t\t\t};\n\t\t}\n\t\tlet prevTokens = rc.tokens.data[key.userOrServer];\n\t\tif (!prevTokens) {\n\t\t\tprevTokens = {};\n\t\t\trc.tokens.data[key.userOrServer] = prevTokens;\n\t\t}\n\t\tprevTokens[key.isPush ? \"push\" : \"storage\"] = tokens;\n\t\treturn saveRC(rc);\n\t},\n\tasync lock<T>(callback: () => Promise<T>): Promise<T> {\n\t\tconst release = await lockRC();\n\t\ttry {\n\t\t\treturn await callback();\n\t\t} finally {\n\t\t\tawait release();\n\t\t}\n\t},\n};\n"]}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export declare const pkgName = "@fluidframework/tool-utils";
8
- export declare const pkgVersion = "2.0.0-dev-rc.1.0.0.232845";
9
- //# sourceMappingURL=packageVersion.d.mts.map
8
+ export declare const pkgVersion = "2.0.0-dev-rc.2.0.0.246488";
9
+ //# sourceMappingURL=packageVersion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,+BAA+B,CAAC;AACpD,eAAO,MAAM,UAAU,8BAA8B,CAAC"}
@@ -5,5 +5,5 @@
5
5
  * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
6
6
  */
7
7
  export const pkgName = "@fluidframework/tool-utils";
8
- export const pkgVersion = "2.0.0-dev-rc.1.0.0.232845";
9
- //# sourceMappingURL=packageVersion.mjs.map
8
+ export const pkgVersion = "2.0.0-dev-rc.2.0.0.246488";
9
+ //# sourceMappingURL=packageVersion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,4BAA4B,CAAC;AACpD,MAAM,CAAC,MAAM,UAAU,GAAG,2BAA2B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/tool-utils\";\nexport const pkgVersion = \"2.0.0-dev-rc.2.0.0.246488\";\n"]}
@@ -32,4 +32,4 @@ export interface ISnapshotNormalizerConfig {
32
32
  * @internal
33
33
  */
34
34
  export declare function getNormalizedSnapshot(snapshot: ITree, config?: ISnapshotNormalizerConfig): ITree;
35
- //# sourceMappingURL=snapshotNormalizer.d.mts.map
35
+ //# sourceMappingURL=snapshotNormalizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotNormalizer.d.ts","sourceRoot":"","sources":["../src/snapshotNormalizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,KAAK,EAAyB,MAAM,sCAAsC,CAAC;AAIpF;;;;GAIG;AACH,eAAO,MAAM,YAAY,SAAS,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,yBAAyB;IAEzC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B;;;;OAIG;IACH,2BAA2B,CAAC,EAAE,MAAM,EAAE,CAAC;CACvC;AA4GD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,yBAAyB,GAAG,KAAK,CAkBhG"}
@@ -96,6 +96,10 @@ function getNormalizedBlobContent(blobContent, blobName) {
96
96
  if (metadata.telemetryDocumentId !== undefined) {
97
97
  metadata.telemetryDocumentId = "x";
98
98
  }
99
+ // default was not written before, now it's written in.
100
+ if (metadata.idCompressorMode === undefined) {
101
+ metadata.idCompressorMode = "off";
102
+ }
99
103
  content = JSON.stringify(metadata);
100
104
  }
101
105
  // Deep sort the content if it's parseable.
@@ -205,4 +209,4 @@ function normalizeEntry(entry, config) {
205
209
  throw new Error("Unknown entry type");
206
210
  }
207
211
  }
208
- //# sourceMappingURL=snapshotNormalizer.mjs.map
212
+ //# sourceMappingURL=snapshotNormalizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotNormalizer.js","sourceRoot":"","sources":["../src/snapshotNormalizer.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AACjG,OAAO,EAAS,SAAS,EAAc,MAAM,sCAAsC,CAAC;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AM,CAAC,CAAC,CAC3D,CAAC;yBACF;wBACD,IACC,MAAM,CAAC,IAAI,KAAK,SAAS;4BACzB,MAAM,CAAC,2BAA2B,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,EACvD;4BACD,iDAAiD;4BACjD,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;yBACrE;qBACD;iBACD;aACD;YAED,OAAO,IAAI,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,qBAAqB,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;SACjF;QACD,KAAK,SAAS,CAAC,UAAU,CAAC,CAAC;YAC1B,OAAO,IAAI,mBAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;SAC3D;QAED;YACC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;KACvC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from \"@fluidframework/driver-utils\";\nimport { ITree, TreeEntry, ITreeEntry } from \"@fluidframework/protocol-definitions\";\n\n/** The name of the metadata blob added to the root of the container runtime. */\nconst metadataBlobName = \".metadata\";\n/**\n * The prefix that all GC blob names start with.\n *\n * @internal\n */\nexport const gcBlobPrefix = \"__gc\";\n\n/**\n * @internal\n */\nexport interface ISnapshotNormalizerConfig {\n\t// The paths of blobs whose contents should be normalized.\n\tblobsToNormalize?: string[];\n\t/**\n\t * channel types who's content (non-attribute) blobs will be excluded.\n\t * this is used to exclude the content of channels who's content cannot be compared\n\t * as the content is non-deterministic between snapshot at the same sequence number.\n\t */\n\texcludedChannelContentTypes?: string[];\n}\n\n/**\n * Function that deep sorts an array. It handles cases where array elements are objects or arrays.\n * @returns the sorted array.\n */\nfunction getDeepSortedArray(array: any[]): any[] {\n\tconst sortedArray: any[] = [];\n\t// Sort arrays and objects, if any, in the array.\n\tfor (const element of array) {\n\t\tif (Array.isArray(element)) {\n\t\t\tsortedArray.push(getDeepSortedArray(element));\n\t\t} else if (element instanceof Object) {\n\t\t\tsortedArray.push(getDeepSortedObject(element));\n\t\t} else {\n\t\t\tsortedArray.push(element);\n\t\t}\n\t}\n\n\t// Now that all the arrays and objects in this array's elements have been sorted, sort it by comparing each\n\t// element's stringified version.\n\tconst sortFn = (elem1: any, elem2: any) => {\n\t\tconst serializedElem1 = JSON.stringify(elem1);\n\t\tconst serializedElem2 = JSON.stringify(elem2);\n\t\treturn serializedElem1.localeCompare(serializedElem2);\n\t};\n\n\treturn sortedArray.sort(sortFn);\n}\n\n/**\n * Function that deep sorts an object. It handles cases where object properties are arrays or objects.\n * @returns the sorted object.\n */\nfunction getDeepSortedObject(obj: any): any {\n\tconst sortedObj: any = {};\n\t// Sort the object keys first. Then sort arrays and objects, if any, in the object.\n\tconst keys = Object.keys(obj).sort();\n\tfor (const key of keys) {\n\t\tconst value = obj[key];\n\t\tif (Array.isArray(value)) {\n\t\t\tsortedObj[key] = getDeepSortedArray(value);\n\t\t} else if (value instanceof Object) {\n\t\t\tsortedObj[key] = getDeepSortedObject(value);\n\t\t} else {\n\t\t\tsortedObj[key] = value;\n\t\t}\n\t}\n\n\treturn sortedObj;\n}\n\n/**\n * Function that normalizes a blob's content. If the content is an object or an array, deep sorts them.\n * Special handling for certain runtime blobs, such as the \"gc\" blob.\n * @returns the normalized blob content.\n */\nfunction getNormalizedBlobContent(blobContent: string, blobName: string): string {\n\tlet content = blobContent;\n\tif (blobName.startsWith(gcBlobPrefix)) {\n\t\t// GC blobs may contain `unreferencedTimestampMs` for node that became unreferenced. This is the timestamp\n\t\t// of the last op processed or current timestamp and can differ between clients depending on when GC was run.\n\t\t// So, remove it for the purposes of comparing snapshots.\n\t\tconst gcState = JSON.parse(content);\n\t\tfor (const [, data] of Object.entries(gcState.gcNodes)) {\n\t\t\tdelete (data as any).unreferencedTimestampMs;\n\t\t}\n\t\tcontent = JSON.stringify(gcState);\n\t}\n\n\t/**\n\t * The metadata blob has \"summaryNumber\" or \"summaryCount\" that tells which summary this is for a container. It can\n\t * be different in summaries of two clients even if they are generated at the same sequence#. For instance, at seq#\n\t * 1000, if one client has summarized 10 times and other has summarizer 15 times, summaryNumber will be different\n\t * for them. So, update \"summaryNumber\" to 0 for purposes of comparing snapshots.\n\t */\n\tif (blobName === metadataBlobName) {\n\t\tconst metadata = JSON.parse(content);\n\t\tif (metadata.summaryNumber !== undefined) {\n\t\t\tmetadata.summaryNumber = 0;\n\t\t}\n\t\tif (metadata.summaryCount !== undefined) {\n\t\t\tmetadata.summaryCount = 0;\n\t\t}\n\t\t// \"telemetryDocumentId\" is not a deterministic property (random guid), so we need to set it to something consistent\n\t\tif (metadata.telemetryDocumentId !== undefined) {\n\t\t\tmetadata.telemetryDocumentId = \"x\";\n\t\t}\n\t\t// default was not written before, now it's written in.\n\t\tif (metadata.idCompressorMode === undefined) {\n\t\t\tmetadata.idCompressorMode = \"off\";\n\t\t}\n\t\tcontent = JSON.stringify(metadata);\n\t}\n\n\t// Deep sort the content if it's parseable.\n\ttry {\n\t\tlet contentObj = JSON.parse(content);\n\t\tif (Array.isArray(contentObj)) {\n\t\t\tcontentObj = getDeepSortedArray(contentObj);\n\t\t} else if (contentObj instanceof Object) {\n\t\t\tcontentObj = getDeepSortedObject(contentObj);\n\t\t}\n\t\tcontent = JSON.stringify(contentObj);\n\t} catch {}\n\treturn content;\n}\n\n/**\n * Helper function that normalizes the given snapshot tree. It sorts objects and arrays in the snapshot. It also\n * normalizes certain blob contents for which the order of content does not matter. For example, garbage collection\n * blobs contains objects / arrays whose element order do not matter.\n * @param snapshot - The snapshot tree to normalize.\n * @param config - Configs to use when normalizing snapshot. For example, it can contain paths of blobs whose contents\n * should be normalized as well.\n * @returns a copy of the normalized snapshot tree.\n * @internal\n */\nexport function getNormalizedSnapshot(snapshot: ITree, config?: ISnapshotNormalizerConfig): ITree {\n\t// Merge blobs to normalize in the config with runtime blobs to normalize. The contents of these blobs will be\n\t// parsed and deep sorted.\n\tconst normalizedEntries: ITreeEntry[] = [];\n\n\t// The metadata blob in the root of the summary tree needs to be normalized.\n\tconst blobsToNormalize = [metadataBlobName, ...(config?.blobsToNormalize ?? [])];\n\tfor (const entry of snapshot.entries) {\n\t\tnormalizedEntries.push(normalizeEntry(entry, { ...config, blobsToNormalize }));\n\t}\n\n\t// Sort the tree entries based on their path.\n\tnormalizedEntries.sort((a, b) => a.path.localeCompare(b.path));\n\n\treturn {\n\t\tentries: normalizedEntries,\n\t\tid: snapshot.id,\n\t};\n}\n\nfunction normalizeMatrix(value: ITree): ITree {\n\tconst rows = value.entries.find((e) => e.path === \"rows\");\n\n\tif (!rows || !(\"entries\" in rows.value)) {\n\t\treturn value;\n\t}\n\n\tconst segments = rows.value.entries.find((e) => e.path === \"segments\");\n\n\tif (!segments || !(\"entries\" in segments.value)) {\n\t\treturn value;\n\t}\n\n\tconst header = segments.value.entries.find((e) => e.path === \"header\");\n\n\tif (!header || !(\"contents\" in header.value)) {\n\t\treturn value;\n\t}\n\n\tif (!header?.value.contents.includes(\"removedClientId\")) {\n\t\treturn value;\n\t}\n\n\tconst contents = JSON.parse(header?.value.contents);\n\n\tfor (const segment of contents.segments) {\n\t\tif (\"removedClientId\" in segment) {\n\t\t\tsegment.removedClientId = undefined;\n\t\t}\n\n\t\tif (\"removedClientIds\" in segment) {\n\t\t\tsegment.removedClientIds = undefined;\n\t\t}\n\t}\n\n\theader.value.contents = JSON.stringify(contents);\n\n\treturn value;\n}\n\nfunction normalizeEntry(\n\tentry: ITreeEntry,\n\tconfig: ISnapshotNormalizerConfig | undefined,\n): ITreeEntry {\n\tswitch (entry.type) {\n\t\tcase TreeEntry.Blob: {\n\t\t\tlet contents = entry.value.contents;\n\t\t\t// If this blob has to be normalized or it's a GC blob, parse and sort the blob contents first.\n\t\t\tif (\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- ?? is not logically equivalent when .includes returns false.\n\t\t\t\tconfig?.blobsToNormalize?.includes(entry.path) ||\n\t\t\t\tentry.path.startsWith(gcBlobPrefix)\n\t\t\t) {\n\t\t\t\tcontents = getNormalizedBlobContent(contents, entry.path);\n\t\t\t}\n\t\t\treturn new BlobTreeEntry(entry.path, contents);\n\t\t}\n\t\tcase TreeEntry.Tree: {\n\t\t\tif (config?.excludedChannelContentTypes !== undefined) {\n\t\t\t\tfor (const maybeAttributes of entry.value.entries) {\n\t\t\t\t\tif (\n\t\t\t\t\t\tmaybeAttributes.type === TreeEntry.Blob &&\n\t\t\t\t\t\tmaybeAttributes.path === \".attributes\"\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst parsed: { type?: string } = JSON.parse(\n\t\t\t\t\t\t\tmaybeAttributes.value.contents,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tif (parsed.type === \"https://graph.microsoft.com/types/sharedmatrix\") {\n\t\t\t\t\t\t\treturn new TreeTreeEntry(\n\t\t\t\t\t\t\t\tentry.path,\n\t\t\t\t\t\t\t\tnormalizeMatrix(getNormalizedSnapshot(entry.value, config)),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tparsed.type !== undefined &&\n\t\t\t\t\t\t\tconfig.excludedChannelContentTypes.includes(parsed.type)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t// remove everything to match the unknown channel\n\t\t\t\t\t\t\treturn new TreeTreeEntry(entry.path, { entries: [maybeAttributes] });\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn new TreeTreeEntry(entry.path, getNormalizedSnapshot(entry.value, config));\n\t\t}\n\t\tcase TreeEntry.Attachment: {\n\t\t\treturn new AttachmentTreeEntry(entry.path, entry.value.id);\n\t\t}\n\n\t\tdefault:\n\t\t\tthrow new Error(\"Unknown entry type\");\n\t}\n}\n"]}
@@ -0,0 +1,140 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+ import { strict as assert } from "assert";
6
+ import { BlobTreeEntry, TreeTreeEntry } from "@fluidframework/driver-utils";
7
+ import { gcBlobPrefix, getNormalizedSnapshot, } from "../snapshotNormalizer.js";
8
+ describe("Snapshot Normalizer", () => {
9
+ it("can normalize tree entries", () => {
10
+ // Snapshot tree with entries whose paths are not sorted.
11
+ const snapshot = {
12
+ id: "root",
13
+ entries: [
14
+ new TreeTreeEntry("entry2", {
15
+ id: "subTree",
16
+ entries: [],
17
+ }),
18
+ new BlobTreeEntry("entry3", "blob3"),
19
+ new BlobTreeEntry("entry1", "blob1"),
20
+ ],
21
+ };
22
+ const normalizedSnapshot = getNormalizedSnapshot(snapshot);
23
+ assert.strictEqual(normalizedSnapshot.entries[0].path, "entry1", "Snapshot tree entries not sorted");
24
+ assert.strictEqual(normalizedSnapshot.entries[1].path, "entry2", "Snapshot tree entries not sorted");
25
+ assert.strictEqual(normalizedSnapshot.entries[2].path, "entry3", "Snapshot tree entries not sorted");
26
+ });
27
+ it("can normalize GC blobs", () => {
28
+ const gcDetails = {
29
+ isRootNode: true,
30
+ gcNodes: {
31
+ node2: ["node1", "/"],
32
+ node1: ["node2", "/"],
33
+ },
34
+ };
35
+ const normalizedGCDetails = {
36
+ isRootNode: true,
37
+ gcNodes: {
38
+ node1: ["/", "node2"],
39
+ node2: ["/", "node1"],
40
+ },
41
+ };
42
+ const gcBlobName1 = `${gcBlobPrefix}_1`;
43
+ const gcBlobName2 = `${gcBlobPrefix}_2`;
44
+ // Snapshot with couple of GC blobs at different layers.
45
+ const snapshot = {
46
+ id: "root",
47
+ entries: [
48
+ new TreeTreeEntry("tree", {
49
+ id: "subTree",
50
+ entries: [new BlobTreeEntry(gcBlobName1, JSON.stringify(gcDetails))],
51
+ }),
52
+ new BlobTreeEntry(gcBlobName2, JSON.stringify(gcDetails)),
53
+ ],
54
+ };
55
+ const normalizedSnapshot = getNormalizedSnapshot(snapshot);
56
+ assert.strictEqual(normalizedSnapshot.entries[0].path, gcBlobName2, "Snapshot tree entries not sorted");
57
+ const gcBlob = normalizedSnapshot.entries[0].value;
58
+ assert.deepStrictEqual(JSON.parse(gcBlob.contents), normalizedGCDetails, "GC blob not normalized");
59
+ const innerGCBlob = normalizedSnapshot.entries[1].value.entries[0]
60
+ .value;
61
+ assert.deepStrictEqual(JSON.parse(innerGCBlob.contents), normalizedGCDetails, "Inner blob not normalized");
62
+ });
63
+ it("can normalize custom blobs with array of objects", () => {
64
+ // Blob content which is an array of objects within objects.
65
+ const blobContents = [
66
+ { id: "2", content: { key: "2", value: "two" } },
67
+ { id: "1", content: { key: "1", value: "one" } },
68
+ { id: "3", content: { key: "3", value: "three" } },
69
+ ];
70
+ const normalizedBlobContents = [
71
+ { id: "1", content: { key: "1", value: "one" } },
72
+ { id: "2", content: { key: "2", value: "two" } },
73
+ { id: "3", content: { key: "3", value: "three" } },
74
+ ];
75
+ const snapshot = {
76
+ id: "root",
77
+ entries: [
78
+ // Create a blob entry with normalized blob contents to make sure it remains normalized.
79
+ new BlobTreeEntry("normalized", JSON.stringify(normalizedBlobContents)),
80
+ new BlobTreeEntry("custom", JSON.stringify(blobContents)),
81
+ ],
82
+ };
83
+ // Config to normalize the above blobs.
84
+ const config = { blobsToNormalize: ["custom", "normalized"] };
85
+ const normalizedSnapshot = getNormalizedSnapshot(snapshot, config);
86
+ assert.strictEqual(normalizedSnapshot.entries[0].path, "custom", "Snapshot tree entries not sorted");
87
+ const customBlob = normalizedSnapshot.entries[0].value;
88
+ assert.deepStrictEqual(JSON.parse(customBlob.contents), normalizedBlobContents, "Custom blob not normalized");
89
+ assert.strictEqual(normalizedSnapshot.entries[1].path, "normalized");
90
+ const normalizedBlob = normalizedSnapshot.entries[0].value;
91
+ assert.deepStrictEqual(JSON.parse(normalizedBlob.contents), normalizedBlobContents, "Normalized blob changed");
92
+ });
93
+ it("can normalize custom blobs with object of arrays", () => {
94
+ // Blob content which is an object whose properties are arrays.
95
+ const blobContents = {
96
+ array2: ["2", "1", "3", "4"],
97
+ array1: ["c", "a", "d", "b"],
98
+ };
99
+ const normalizedBlobContents = {
100
+ array1: ["a", "b", "c", "d"],
101
+ array2: ["1", "2", "3", "4"],
102
+ };
103
+ const snapshot = {
104
+ id: "root",
105
+ entries: [
106
+ // Create a blob entry with normalized blob contents to make sure it remains normalized.
107
+ new BlobTreeEntry("normalized", JSON.stringify(normalizedBlobContents)),
108
+ new BlobTreeEntry("custom", JSON.stringify(blobContents)),
109
+ ],
110
+ };
111
+ // Config to normalize the above blobs.
112
+ const config = { blobsToNormalize: ["custom", "normalized"] };
113
+ const normalizedSnapshot = getNormalizedSnapshot(snapshot, config);
114
+ assert.strictEqual(normalizedSnapshot.entries[0].path, "custom", "Snapshot tree entries not sorted");
115
+ const customBlob = normalizedSnapshot.entries[0].value;
116
+ assert.deepStrictEqual(JSON.parse(customBlob.contents), normalizedBlobContents, "Custom blob not normalized");
117
+ assert.strictEqual(normalizedSnapshot.entries[1].path, "normalized");
118
+ const normalizedBlob = normalizedSnapshot.entries[0].value;
119
+ assert.deepStrictEqual(JSON.parse(normalizedBlob.contents), normalizedBlobContents, "Normalized blob changed");
120
+ });
121
+ it("can normalize blob whose contents are not objects", () => {
122
+ const snapshot = {
123
+ id: "root",
124
+ entries: [
125
+ // Create blob entry whose content is a string so that it cannot be JSON parsed.
126
+ new BlobTreeEntry("custom1", "contents"),
127
+ // Create another blob whose content is a JSON stringified string which is already normalized.
128
+ new BlobTreeEntry("custom2", JSON.stringify("contents")),
129
+ ],
130
+ };
131
+ // Config to normalize the above blobs.
132
+ const config = { blobsToNormalize: ["custom1", "custom2"] };
133
+ const normalizedSnapshot = getNormalizedSnapshot(snapshot, config);
134
+ const customBlob1 = normalizedSnapshot.entries[0].value;
135
+ assert.strictEqual(customBlob1.contents, "contents", "Blob with string not as expected");
136
+ const customBlob2 = normalizedSnapshot.entries[1].value;
137
+ assert.strictEqual(customBlob2.contents, JSON.stringify("contents"), "Blob with JSON strigified string not as expected");
138
+ });
139
+ });
140
+ //# sourceMappingURL=snapshotNormalizer.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshotNormalizer.spec.js","sourceRoot":"","sources":["../../src/test/snapshotNormalizer.spec.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE5E,OAAO,EACN,YAAY,EACZ,qBAAqB,GAErB,MAAM,0BAA0B,CAAC;AAElC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,4BAA4B,EAAE,GAAG,EAAE;QACrC,yDAAyD;QACzD,MAAM,QAAQ,GAAU;YACvB,EAAE,EAAE,MAAM;YACV,OAAO,EAAE;gBACR,IAAI,aAAa,CAAC,QAAQ,EAAE;oBAC3B,EAAE,EAAE,SAAS;oBACb,OAAO,EAAE,EAAE;iBACX,CAAC;gBACF,IAAI,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC;gBACpC,IAAI,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC;aACpC;SACD,CAAC;QACF,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAC3D,MAAM,CAAC,WAAW,CACjB,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,QAAQ,EACR,kCAAkC,CAClC,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,EAClC,QAAQ,EACR,kCAAkC,CAClC,CAAC;QACF,MAAM,CAAC,WAAW,CACjB,kBAAkB,CAAC,OAAO,CAA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sB,EACtB,yBAAyB,CACzB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;QAC5D,MAAM,QAAQ,GAAU;YACvB,EAAE,EAAE,MAAM;YACV,OAAO,EAAE;gBACR,gFAAgF;gBAChF,IAAI,aAAa,CAAC,SAAS,EAAE,UAAU,CAAC;gBACxC,8FAA8F;gBAC9F,IAAI,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;aACxD;SACD,CAAC;QAEF,uCAAuC;QACvC,MAAM,MAAM,GAA8B,EAAE,gBAAgB,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,CAAC;QACvF,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACnE,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAc,CAAC;QACjE,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,QAAQ,EAAE,UAAU,EAAE,kCAAkC,CAAC,CAAC;QAEzF,MAAM,WAAW,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAc,CAAC;QACjE,MAAM,CAAC,WAAW,CACjB,WAAW,CAAC,QAAQ,EACpB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,EAC1B,kDAAkD,CAClD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { strict as assert } from \"assert\";\nimport { BlobTreeEntry, TreeTreeEntry } from \"@fluidframework/driver-utils\";\nimport { IBlob, ITree } from \"@fluidframework/protocol-definitions\";\nimport {\n\tgcBlobPrefix,\n\tgetNormalizedSnapshot,\n\tISnapshotNormalizerConfig,\n} from \"../snapshotNormalizer.js\";\n\ndescribe(\"Snapshot Normalizer\", () => {\n\tit(\"can normalize tree entries\", () => {\n\t\t// Snapshot tree with entries whose paths are not sorted.\n\t\tconst snapshot: ITree = {\n\t\t\tid: \"root\",\n\t\t\tentries: [\n\t\t\t\tnew TreeTreeEntry(\"entry2\", {\n\t\t\t\t\tid: \"subTree\",\n\t\t\t\t\tentries: [],\n\t\t\t\t}),\n\t\t\t\tnew BlobTreeEntry(\"entry3\", \"blob3\"),\n\t\t\t\tnew BlobTreeEntry(\"entry1\", \"blob1\"),\n\t\t\t],\n\t\t};\n\t\tconst normalizedSnapshot = getNormalizedSnapshot(snapshot);\n\t\tassert.strictEqual(\n\t\t\tnormalizedSnapshot.entries[0].path,\n\t\t\t\"entry1\",\n\t\t\t\"Snapshot tree entries not sorted\",\n\t\t);\n\t\tassert.strictEqual(\n\t\t\tnormalizedSnapshot.entries[1].path,\n\t\t\t\"entry2\",\n\t\t\t\"Snapshot tree entries not sorted\",\n\t\t);\n\t\tassert.strictEqual(\n\t\t\tnormalizedSnapshot.entries[2].path,\n\t\t\t\"entry3\",\n\t\t\t\"Snapshot tree entries not sorted\",\n\t\t);\n\t});\n\n\tit(\"can normalize GC blobs\", () => {\n\t\tconst gcDetails = {\n\t\t\tisRootNode: true,\n\t\t\tgcNodes: {\n\t\t\t\tnode2: [\"node1\", \"/\"],\n\t\t\t\tnode1: [\"node2\", \"/\"],\n\t\t\t},\n\t\t};\n\t\tconst normalizedGCDetails = {\n\t\t\tisRootNode: true,\n\t\t\tgcNodes: {\n\t\t\t\tnode1: [\"/\", \"node2\"],\n\t\t\t\tnode2: [\"/\", \"node1\"],\n\t\t\t},\n\t\t};\n\t\tconst gcBlobName1 = `${gcBlobPrefix}_1`;\n\t\tconst gcBlobName2 = `${gcBlobPrefix}_2`;\n\t\t// Snapshot with couple of GC blobs at different layers.\n\t\tconst snapshot: ITree = {\n\t\t\tid: \"root\",\n\t\t\tentries: [\n\t\t\t\tnew TreeTreeEntry(\"tree\", {\n\t\t\t\t\tid: \"subTree\",\n\t\t\t\t\tentries: [new BlobTreeEntry(gcBlobName1, JSON.stringify(gcDetails))],\n\t\t\t\t}),\n\t\t\t\tnew BlobTreeEntry(gcBlobName2, JSON.stringify(gcDetails)),\n\t\t\t],\n\t\t};\n\n\t\tconst normalizedSnapshot = getNormalizedSnapshot(snapshot);\n\t\tassert.strictEqual(\n\t\t\tnormalizedSnapshot.entries[0].path,\n\t\t\tgcBlobName2,\n\t\t\t\"Snapshot tree entries not sorted\",\n\t\t);\n\t\tconst gcBlob = normalizedSnapshot.entries[0].value as IBlob;\n\t\tassert.deepStrictEqual(\n\t\t\tJSON.parse(gcBlob.contents),\n\t\t\tnormalizedGCDetails,\n\t\t\t\"GC blob not normalized\",\n\t\t);\n\n\t\tconst innerGCBlob = (normalizedSnapshot.entries[1].value as ITree).entries[0]\n\t\t\t.value as IBlob;\n\t\tassert.deepStrictEqual(\n\t\t\tJSON.parse(innerGCBlob.contents),\n\t\t\tnormalizedGCDetails,\n\t\t\t\"Inner blob not normalized\",\n\t\t);\n\t});\n\n\tit(\"can normalize custom blobs with array of objects\", () => {\n\t\t// Blob content which is an array of objects within objects.\n\t\tconst blobContents = [\n\t\t\t{ id: \"2\", content: { key: \"2\", value: \"two\" } },\n\t\t\t{ id: \"1\", content: { key: \"1\", value: \"one\" } },\n\t\t\t{ id: \"3\", content: { key: \"3\", value: \"three\" } },\n\t\t];\n\t\tconst normalizedBlobContents = [\n\t\t\t{ id: \"1\", content: { key: \"1\", value: \"one\" } },\n\t\t\t{ id: \"2\", content: { key: \"2\", value: \"two\" } },\n\t\t\t{ id: \"3\", content: { key: \"3\", value: \"three\" } },\n\t\t];\n\n\t\tconst snapshot: ITree = {\n\t\t\tid: \"root\",\n\t\t\tentries: [\n\t\t\t\t// Create a blob entry with normalized blob contents to make sure it remains normalized.\n\t\t\t\tnew BlobTreeEntry(\"normalized\", JSON.stringify(normalizedBlobContents)),\n\t\t\t\tnew BlobTreeEntry(\"custom\", JSON.stringify(blobContents)),\n\t\t\t],\n\t\t};\n\n\t\t// Config to normalize the above blobs.\n\t\tconst config: ISnapshotNormalizerConfig = { blobsToNormalize: [\"custom\", \"normalized\"] };\n\t\tconst normalizedSnapshot = getNormalizedSnapshot(snapshot, config);\n\n\t\tassert.strictEqual(\n\t\t\tnormalizedSnapshot.entries[0].path,\n\t\t\t\"custom\",\n\t\t\t\"Snapshot tree entries not sorted\",\n\t\t);\n\t\tconst customBlob = normalizedSnapshot.entries[0].value as IBlob;\n\t\tassert.deepStrictEqual(\n\t\t\tJSON.parse(customBlob.contents),\n\t\t\tnormalizedBlobContents,\n\t\t\t\"Custom blob not normalized\",\n\t\t);\n\n\t\tassert.strictEqual(normalizedSnapshot.entries[1].path, \"normalized\");\n\t\tconst normalizedBlob = normalizedSnapshot.entries[0].value as IBlob;\n\t\tassert.deepStrictEqual(\n\t\t\tJSON.parse(normalizedBlob.contents),\n\t\t\tnormalizedBlobContents,\n\t\t\t\"Normalized blob changed\",\n\t\t);\n\t});\n\n\tit(\"can normalize custom blobs with object of arrays\", () => {\n\t\t// Blob content which is an object whose properties are arrays.\n\t\tconst blobContents = {\n\t\t\tarray2: [\"2\", \"1\", \"3\", \"4\"],\n\t\t\tarray1: [\"c\", \"a\", \"d\", \"b\"],\n\t\t};\n\t\tconst normalizedBlobContents = {\n\t\t\tarray1: [\"a\", \"b\", \"c\", \"d\"],\n\t\t\tarray2: [\"1\", \"2\", \"3\", \"4\"],\n\t\t};\n\n\t\tconst snapshot: ITree = {\n\t\t\tid: \"root\",\n\t\t\tentries: [\n\t\t\t\t// Create a blob entry with normalized blob contents to make sure it remains normalized.\n\t\t\t\tnew BlobTreeEntry(\"normalized\", JSON.stringify(normalizedBlobContents)),\n\t\t\t\tnew BlobTreeEntry(\"custom\", JSON.stringify(blobContents)),\n\t\t\t],\n\t\t};\n\n\t\t// Config to normalize the above blobs.\n\t\tconst config: ISnapshotNormalizerConfig = { blobsToNormalize: [\"custom\", \"normalized\"] };\n\t\tconst normalizedSnapshot = getNormalizedSnapshot(snapshot, config);\n\n\t\tassert.strictEqual(\n\t\t\tnormalizedSnapshot.entries[0].path,\n\t\t\t\"custom\",\n\t\t\t\"Snapshot tree entries not sorted\",\n\t\t);\n\t\tconst customBlob = normalizedSnapshot.entries[0].value as IBlob;\n\t\tassert.deepStrictEqual(\n\t\t\tJSON.parse(customBlob.contents),\n\t\t\tnormalizedBlobContents,\n\t\t\t\"Custom blob not normalized\",\n\t\t);\n\n\t\tassert.strictEqual(normalizedSnapshot.entries[1].path, \"normalized\");\n\t\tconst normalizedBlob = normalizedSnapshot.entries[0].value as IBlob;\n\t\tassert.deepStrictEqual(\n\t\t\tJSON.parse(normalizedBlob.contents),\n\t\t\tnormalizedBlobContents,\n\t\t\t\"Normalized blob changed\",\n\t\t);\n\t});\n\n\tit(\"can normalize blob whose contents are not objects\", () => {\n\t\tconst snapshot: ITree = {\n\t\t\tid: \"root\",\n\t\t\tentries: [\n\t\t\t\t// Create blob entry whose content is a string so that it cannot be JSON parsed.\n\t\t\t\tnew BlobTreeEntry(\"custom1\", \"contents\"),\n\t\t\t\t// Create another blob whose content is a JSON stringified string which is already normalized.\n\t\t\t\tnew BlobTreeEntry(\"custom2\", JSON.stringify(\"contents\")),\n\t\t\t],\n\t\t};\n\n\t\t// Config to normalize the above blobs.\n\t\tconst config: ISnapshotNormalizerConfig = { blobsToNormalize: [\"custom1\", \"custom2\"] };\n\t\tconst normalizedSnapshot = getNormalizedSnapshot(snapshot, config);\n\t\tconst customBlob1 = normalizedSnapshot.entries[0].value as IBlob;\n\t\tassert.strictEqual(customBlob1.contents, \"contents\", \"Blob with string not as expected\");\n\n\t\tconst customBlob2 = normalizedSnapshot.entries[1].value as IBlob;\n\t\tassert.strictEqual(\n\t\t\tcustomBlob2.contents,\n\t\t\tJSON.stringify(\"contents\"),\n\t\t\t\"Blob with JSON strigified string not as expected\",\n\t\t);\n\t});\n});\n"]}
@@ -0,0 +1,28 @@
1
+ use_current_InterfaceDeclaration_IAsyncCache(get_old_InterfaceDeclaration_IAsyncCache());
2
+ use_old_InterfaceDeclaration_IAsyncCache(get_current_InterfaceDeclaration_IAsyncCache());
3
+ use_current_InterfaceDeclaration_IOdspTokenManagerCacheKey(get_old_InterfaceDeclaration_IOdspTokenManagerCacheKey());
4
+ use_old_InterfaceDeclaration_IOdspTokenManagerCacheKey(get_current_InterfaceDeclaration_IOdspTokenManagerCacheKey());
5
+ use_current_InterfaceDeclaration_IResources(get_old_InterfaceDeclaration_IResources());
6
+ use_old_InterfaceDeclaration_IResources(get_current_InterfaceDeclaration_IResources());
7
+ use_current_InterfaceDeclaration_ISnapshotNormalizerConfig(get_old_InterfaceDeclaration_ISnapshotNormalizerConfig());
8
+ use_old_InterfaceDeclaration_ISnapshotNormalizerConfig(get_current_InterfaceDeclaration_ISnapshotNormalizerConfig());
9
+ use_current_TypeAliasDeclaration_OdspTokenConfig(get_old_TypeAliasDeclaration_OdspTokenConfig());
10
+ use_old_TypeAliasDeclaration_OdspTokenConfig(get_current_TypeAliasDeclaration_OdspTokenConfig());
11
+ use_current_ClassDeclaration_OdspTokenManager(get_old_ClassDeclaration_OdspTokenManager());
12
+ use_old_ClassDeclaration_OdspTokenManager(get_current_ClassDeclaration_OdspTokenManager());
13
+ use_current_VariableDeclaration_gcBlobPrefix(get_old_VariableDeclaration_gcBlobPrefix());
14
+ use_old_VariableDeclaration_gcBlobPrefix(get_current_VariableDeclaration_gcBlobPrefix());
15
+ use_current_VariableDeclaration_getMicrosoftConfiguration(get_old_VariableDeclaration_getMicrosoftConfiguration());
16
+ use_old_VariableDeclaration_getMicrosoftConfiguration(get_current_VariableDeclaration_getMicrosoftConfiguration());
17
+ use_current_FunctionDeclaration_getNormalizedSnapshot(get_old_FunctionDeclaration_getNormalizedSnapshot());
18
+ use_old_FunctionDeclaration_getNormalizedSnapshot(get_current_FunctionDeclaration_getNormalizedSnapshot());
19
+ use_current_FunctionDeclaration_loadRC(get_old_FunctionDeclaration_loadRC());
20
+ use_old_FunctionDeclaration_loadRC(get_current_FunctionDeclaration_loadRC());
21
+ use_current_FunctionDeclaration_lockRC(get_old_FunctionDeclaration_lockRC());
22
+ use_old_FunctionDeclaration_lockRC(get_current_FunctionDeclaration_lockRC());
23
+ use_current_VariableDeclaration_odspTokensCache(get_old_VariableDeclaration_odspTokensCache());
24
+ use_old_VariableDeclaration_odspTokensCache(get_current_VariableDeclaration_odspTokensCache());
25
+ use_current_FunctionDeclaration_saveRC(get_old_FunctionDeclaration_saveRC());
26
+ use_old_FunctionDeclaration_saveRC(get_current_FunctionDeclaration_saveRC());
27
+ export {};
28
+ //# sourceMappingURL=validateToolUtilsPrevious.generated.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateToolUtilsPrevious.generated.js","sourceRoot":"","sources":["../../../src/test/types/validateToolUtilsPrevious.generated.ts"],"names":[],"mappings":"AAgCA,4CAA4C,CACxC,wCAAwC,EAAE,CAAC,CAAC;AAWhD,wCAAwC,CACpC,4CAA4C,EAAE,CAAC,CAAC;AAWpD,0DAA0D,CACtD,sDAAsD,EAAE,CAAC,CAAC;AAW9D,sDAAsD,CAClD,0DAA0D,EAAE,CAAC,CAAC;AAWlE,2CAA2C,CACvC,uCAAuC,EAAE,CAAC,CAAC;AAW/C,uCAAuC,CACnC,2CAA2C,EAAE,CAAC,CAAC;AAWnD,0DAA0D,CACtD,sDAAsD,EAAE,CAAC,CAAC;AAW9D,sDAAsD,CAClD,0DAA0D,EAAE,CAAC,CAAC;AAWlE,gDAAgD,CAC5C,4CAA4C,EAAE,CAAC,CAAC;AAWpD,4CAA4C,CACxC,gDAAgD,EAAE,CAAC,CAAC;AAWxD,6CAA6C,CACzC,yCAAyC,EAAE,CAAC,CAAC;AAWjD,yCAAyC,CACrC,6CAA6C,EAAE,CAAC,CAAC;AAWrD,4CAA4C,CACxC,wCAAwC,EAAE,CAAC,CAAC;AAWhD,wCAAwC,CACpC,4CAA4C,EAAE,CAAC,CAAC;AAWpD,yDAAyD,CACrD,qDAAqD,EAAE,CAAC,CAAC;AAW7D,qDAAqD,CACjD,yDAAyD,EAAE,CAAC,CAAC;AAWjE,qDAAqD,CACjD,iDAAiD,EAAE,CAAC,CAAC;AAWzD,iDAAiD,CAC7C,qDAAqD,EAAE,CAAC,CAAC;AAW7D,sCAAsC,CAClC,kCAAkC,EAAE,CAAC,CAAC;AAW1C,kCAAkC,CAC9B,sCAAsC,EAAE,CAAC,CAAC;AAW9C,sCAAsC,CAClC,kCAAkC,EAAE,CAAC,CAAC;AAW1C,kCAAkC,CAC9B,sCAAsC,EAAE,CAAC,CAAC;AAW9C,+CAA+C,CAC3C,2CAA2C,EAAE,CAAC,CAAC;AAWnD,2CAA2C,CACvC,+CAA+C,EAAE,CAAC,CAAC;AAWvD,sCAAsC,CAClC,kCAAkC,EAAE,CAAC,CAAC;AAW1C,kCAAkC,CAC9B,sCAAsC,EAAE,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/*\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.\n * Generated by fluid-type-test-generator in @fluidframework/build-tools.\n */\nimport type * as old from \"@fluidframework/tool-utils-previous\";\nimport type * as current from \"../../index.js\";\n\n\n// See 'build-tools/src/type-test-generator/compatibility.ts' for more information.\ntype TypeOnly<T> = T extends number\n\t? number\n\t: T extends string\n\t? string\n\t: T extends boolean | bigint | symbol\n\t? T\n\t: {\n\t\t\t[P in keyof T]: TypeOnly<T[P]>;\n\t };\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IAsyncCache\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IAsyncCache():\n TypeOnly<old.IAsyncCache<any,any>>;\ndeclare function use_current_InterfaceDeclaration_IAsyncCache(\n use: TypeOnly<current.IAsyncCache<any,any>>): void;\nuse_current_InterfaceDeclaration_IAsyncCache(\n get_old_InterfaceDeclaration_IAsyncCache());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IAsyncCache\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IAsyncCache():\n TypeOnly<current.IAsyncCache<any,any>>;\ndeclare function use_old_InterfaceDeclaration_IAsyncCache(\n use: TypeOnly<old.IAsyncCache<any,any>>): void;\nuse_old_InterfaceDeclaration_IAsyncCache(\n get_current_InterfaceDeclaration_IAsyncCache());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IOdspTokenManagerCacheKey\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IOdspTokenManagerCacheKey():\n TypeOnly<old.IOdspTokenManagerCacheKey>;\ndeclare function use_current_InterfaceDeclaration_IOdspTokenManagerCacheKey(\n use: TypeOnly<current.IOdspTokenManagerCacheKey>): void;\nuse_current_InterfaceDeclaration_IOdspTokenManagerCacheKey(\n get_old_InterfaceDeclaration_IOdspTokenManagerCacheKey());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IOdspTokenManagerCacheKey\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IOdspTokenManagerCacheKey():\n TypeOnly<current.IOdspTokenManagerCacheKey>;\ndeclare function use_old_InterfaceDeclaration_IOdspTokenManagerCacheKey(\n use: TypeOnly<old.IOdspTokenManagerCacheKey>): void;\nuse_old_InterfaceDeclaration_IOdspTokenManagerCacheKey(\n get_current_InterfaceDeclaration_IOdspTokenManagerCacheKey());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IResources\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_IResources():\n TypeOnly<old.IResources>;\ndeclare function use_current_InterfaceDeclaration_IResources(\n use: TypeOnly<current.IResources>): void;\nuse_current_InterfaceDeclaration_IResources(\n get_old_InterfaceDeclaration_IResources());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_IResources\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_IResources():\n TypeOnly<current.IResources>;\ndeclare function use_old_InterfaceDeclaration_IResources(\n use: TypeOnly<old.IResources>): void;\nuse_old_InterfaceDeclaration_IResources(\n get_current_InterfaceDeclaration_IResources());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ISnapshotNormalizerConfig\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_InterfaceDeclaration_ISnapshotNormalizerConfig():\n TypeOnly<old.ISnapshotNormalizerConfig>;\ndeclare function use_current_InterfaceDeclaration_ISnapshotNormalizerConfig(\n use: TypeOnly<current.ISnapshotNormalizerConfig>): void;\nuse_current_InterfaceDeclaration_ISnapshotNormalizerConfig(\n get_old_InterfaceDeclaration_ISnapshotNormalizerConfig());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"InterfaceDeclaration_ISnapshotNormalizerConfig\": {\"backCompat\": false}\n*/\ndeclare function get_current_InterfaceDeclaration_ISnapshotNormalizerConfig():\n TypeOnly<current.ISnapshotNormalizerConfig>;\ndeclare function use_old_InterfaceDeclaration_ISnapshotNormalizerConfig(\n use: TypeOnly<old.ISnapshotNormalizerConfig>): void;\nuse_old_InterfaceDeclaration_ISnapshotNormalizerConfig(\n get_current_InterfaceDeclaration_ISnapshotNormalizerConfig());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_OdspTokenConfig\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_TypeAliasDeclaration_OdspTokenConfig():\n TypeOnly<old.OdspTokenConfig>;\ndeclare function use_current_TypeAliasDeclaration_OdspTokenConfig(\n use: TypeOnly<current.OdspTokenConfig>): void;\nuse_current_TypeAliasDeclaration_OdspTokenConfig(\n get_old_TypeAliasDeclaration_OdspTokenConfig());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"TypeAliasDeclaration_OdspTokenConfig\": {\"backCompat\": false}\n*/\ndeclare function get_current_TypeAliasDeclaration_OdspTokenConfig():\n TypeOnly<current.OdspTokenConfig>;\ndeclare function use_old_TypeAliasDeclaration_OdspTokenConfig(\n use: TypeOnly<old.OdspTokenConfig>): void;\nuse_old_TypeAliasDeclaration_OdspTokenConfig(\n get_current_TypeAliasDeclaration_OdspTokenConfig());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_OdspTokenManager\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_ClassDeclaration_OdspTokenManager():\n TypeOnly<old.OdspTokenManager>;\ndeclare function use_current_ClassDeclaration_OdspTokenManager(\n use: TypeOnly<current.OdspTokenManager>): void;\nuse_current_ClassDeclaration_OdspTokenManager(\n get_old_ClassDeclaration_OdspTokenManager());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"ClassDeclaration_OdspTokenManager\": {\"backCompat\": false}\n*/\ndeclare function get_current_ClassDeclaration_OdspTokenManager():\n TypeOnly<current.OdspTokenManager>;\ndeclare function use_old_ClassDeclaration_OdspTokenManager(\n use: TypeOnly<old.OdspTokenManager>): void;\nuse_old_ClassDeclaration_OdspTokenManager(\n get_current_ClassDeclaration_OdspTokenManager());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_gcBlobPrefix\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_gcBlobPrefix():\n TypeOnly<typeof old.gcBlobPrefix>;\ndeclare function use_current_VariableDeclaration_gcBlobPrefix(\n use: TypeOnly<typeof current.gcBlobPrefix>): void;\nuse_current_VariableDeclaration_gcBlobPrefix(\n get_old_VariableDeclaration_gcBlobPrefix());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_gcBlobPrefix\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_gcBlobPrefix():\n TypeOnly<typeof current.gcBlobPrefix>;\ndeclare function use_old_VariableDeclaration_gcBlobPrefix(\n use: TypeOnly<typeof old.gcBlobPrefix>): void;\nuse_old_VariableDeclaration_gcBlobPrefix(\n get_current_VariableDeclaration_gcBlobPrefix());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_getMicrosoftConfiguration\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_getMicrosoftConfiguration():\n TypeOnly<typeof old.getMicrosoftConfiguration>;\ndeclare function use_current_VariableDeclaration_getMicrosoftConfiguration(\n use: TypeOnly<typeof current.getMicrosoftConfiguration>): void;\nuse_current_VariableDeclaration_getMicrosoftConfiguration(\n get_old_VariableDeclaration_getMicrosoftConfiguration());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_getMicrosoftConfiguration\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_getMicrosoftConfiguration():\n TypeOnly<typeof current.getMicrosoftConfiguration>;\ndeclare function use_old_VariableDeclaration_getMicrosoftConfiguration(\n use: TypeOnly<typeof old.getMicrosoftConfiguration>): void;\nuse_old_VariableDeclaration_getMicrosoftConfiguration(\n get_current_VariableDeclaration_getMicrosoftConfiguration());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_getNormalizedSnapshot\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_getNormalizedSnapshot():\n TypeOnly<typeof old.getNormalizedSnapshot>;\ndeclare function use_current_FunctionDeclaration_getNormalizedSnapshot(\n use: TypeOnly<typeof current.getNormalizedSnapshot>): void;\nuse_current_FunctionDeclaration_getNormalizedSnapshot(\n get_old_FunctionDeclaration_getNormalizedSnapshot());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_getNormalizedSnapshot\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_getNormalizedSnapshot():\n TypeOnly<typeof current.getNormalizedSnapshot>;\ndeclare function use_old_FunctionDeclaration_getNormalizedSnapshot(\n use: TypeOnly<typeof old.getNormalizedSnapshot>): void;\nuse_old_FunctionDeclaration_getNormalizedSnapshot(\n get_current_FunctionDeclaration_getNormalizedSnapshot());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_loadRC\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_loadRC():\n TypeOnly<typeof old.loadRC>;\ndeclare function use_current_FunctionDeclaration_loadRC(\n use: TypeOnly<typeof current.loadRC>): void;\nuse_current_FunctionDeclaration_loadRC(\n get_old_FunctionDeclaration_loadRC());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_loadRC\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_loadRC():\n TypeOnly<typeof current.loadRC>;\ndeclare function use_old_FunctionDeclaration_loadRC(\n use: TypeOnly<typeof old.loadRC>): void;\nuse_old_FunctionDeclaration_loadRC(\n get_current_FunctionDeclaration_loadRC());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_lockRC\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_lockRC():\n TypeOnly<typeof old.lockRC>;\ndeclare function use_current_FunctionDeclaration_lockRC(\n use: TypeOnly<typeof current.lockRC>): void;\nuse_current_FunctionDeclaration_lockRC(\n get_old_FunctionDeclaration_lockRC());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_lockRC\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_lockRC():\n TypeOnly<typeof current.lockRC>;\ndeclare function use_old_FunctionDeclaration_lockRC(\n use: TypeOnly<typeof old.lockRC>): void;\nuse_old_FunctionDeclaration_lockRC(\n get_current_FunctionDeclaration_lockRC());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_odspTokensCache\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_VariableDeclaration_odspTokensCache():\n TypeOnly<typeof old.odspTokensCache>;\ndeclare function use_current_VariableDeclaration_odspTokensCache(\n use: TypeOnly<typeof current.odspTokensCache>): void;\nuse_current_VariableDeclaration_odspTokensCache(\n get_old_VariableDeclaration_odspTokensCache());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"VariableDeclaration_odspTokensCache\": {\"backCompat\": false}\n*/\ndeclare function get_current_VariableDeclaration_odspTokensCache():\n TypeOnly<typeof current.odspTokensCache>;\ndeclare function use_old_VariableDeclaration_odspTokensCache(\n use: TypeOnly<typeof old.odspTokensCache>): void;\nuse_old_VariableDeclaration_odspTokensCache(\n get_current_VariableDeclaration_odspTokensCache());\n\n/*\n* Validate forward compat by using old type in place of current type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_saveRC\": {\"forwardCompat\": false}\n*/\ndeclare function get_old_FunctionDeclaration_saveRC():\n TypeOnly<typeof old.saveRC>;\ndeclare function use_current_FunctionDeclaration_saveRC(\n use: TypeOnly<typeof current.saveRC>): void;\nuse_current_FunctionDeclaration_saveRC(\n get_old_FunctionDeclaration_saveRC());\n\n/*\n* Validate back compat by using current type in place of old type\n* If breaking change required, add in package.json under typeValidation.broken:\n* \"FunctionDeclaration_saveRC\": {\"backCompat\": false}\n*/\ndeclare function get_current_FunctionDeclaration_saveRC():\n TypeOnly<typeof current.saveRC>;\ndeclare function use_old_FunctionDeclaration_saveRC(\n use: TypeOnly<typeof old.saveRC>): void;\nuse_old_FunctionDeclaration_saveRC(\n get_current_FunctionDeclaration_saveRC());\n"]}