@fluidframework/runtime-utils 1.3.0 → 2.0.0-dev.1.4.5.105745

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 (66) hide show
  1. package/.mocharc.js +12 -0
  2. package/dist/objectstorageutils.d.ts.map +1 -1
  3. package/dist/objectstorageutils.js +2 -12
  4. package/dist/objectstorageutils.js.map +1 -1
  5. package/dist/packageVersion.d.ts +1 -1
  6. package/dist/packageVersion.d.ts.map +1 -1
  7. package/dist/packageVersion.js +1 -1
  8. package/dist/packageVersion.js.map +1 -1
  9. package/dist/requestParser.d.ts.map +1 -1
  10. package/dist/requestParser.js +1 -6
  11. package/dist/requestParser.js.map +1 -1
  12. package/dist/runtimeFactoryHelper.d.ts.map +1 -1
  13. package/dist/runtimeFactoryHelper.js +1 -6
  14. package/dist/runtimeFactoryHelper.js.map +1 -1
  15. package/dist/summarizerNode/summarizerNode.d.ts +18 -16
  16. package/dist/summarizerNode/summarizerNode.d.ts.map +1 -1
  17. package/dist/summarizerNode/summarizerNode.js +63 -87
  18. package/dist/summarizerNode/summarizerNode.js.map +1 -1
  19. package/dist/summarizerNode/summarizerNodeUtils.d.ts +5 -38
  20. package/dist/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  21. package/dist/summarizerNode/summarizerNodeUtils.js +1 -94
  22. package/dist/summarizerNode/summarizerNodeUtils.js.map +1 -1
  23. package/dist/summarizerNode/summarizerNodeWithGc.d.ts +7 -3
  24. package/dist/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  25. package/dist/summarizerNode/summarizerNodeWithGc.js +7 -3
  26. package/dist/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  27. package/dist/summaryUtils.d.ts.map +1 -1
  28. package/dist/summaryUtils.js +4 -13
  29. package/dist/summaryUtils.js.map +1 -1
  30. package/lib/objectstorageutils.d.ts.map +1 -1
  31. package/lib/objectstorageutils.js +2 -12
  32. package/lib/objectstorageutils.js.map +1 -1
  33. package/lib/packageVersion.d.ts +1 -1
  34. package/lib/packageVersion.d.ts.map +1 -1
  35. package/lib/packageVersion.js +1 -1
  36. package/lib/packageVersion.js.map +1 -1
  37. package/lib/requestParser.d.ts.map +1 -1
  38. package/lib/requestParser.js +1 -6
  39. package/lib/requestParser.js.map +1 -1
  40. package/lib/runtimeFactoryHelper.d.ts.map +1 -1
  41. package/lib/runtimeFactoryHelper.js +1 -6
  42. package/lib/runtimeFactoryHelper.js.map +1 -1
  43. package/lib/summarizerNode/summarizerNode.d.ts +18 -16
  44. package/lib/summarizerNode/summarizerNode.d.ts.map +1 -1
  45. package/lib/summarizerNode/summarizerNode.js +64 -88
  46. package/lib/summarizerNode/summarizerNode.js.map +1 -1
  47. package/lib/summarizerNode/summarizerNodeUtils.d.ts +5 -38
  48. package/lib/summarizerNode/summarizerNodeUtils.d.ts.map +1 -1
  49. package/lib/summarizerNode/summarizerNodeUtils.js +0 -91
  50. package/lib/summarizerNode/summarizerNodeUtils.js.map +1 -1
  51. package/lib/summarizerNode/summarizerNodeWithGc.d.ts +7 -3
  52. package/lib/summarizerNode/summarizerNodeWithGc.d.ts.map +1 -1
  53. package/lib/summarizerNode/summarizerNodeWithGc.js +7 -3
  54. package/lib/summarizerNode/summarizerNodeWithGc.js.map +1 -1
  55. package/lib/summaryUtils.d.ts.map +1 -1
  56. package/lib/summaryUtils.js +4 -13
  57. package/lib/summaryUtils.js.map +1 -1
  58. package/package.json +18 -18
  59. package/src/objectstorageutils.ts +2 -10
  60. package/src/packageVersion.ts +1 -1
  61. package/src/requestParser.ts +1 -5
  62. package/src/runtimeFactoryHelper.ts +1 -5
  63. package/src/summarizerNode/summarizerNode.ts +64 -111
  64. package/src/summarizerNode/summarizerNodeUtils.ts +4 -127
  65. package/src/summarizerNode/summarizerNodeWithGc.ts +7 -3
  66. package/src/summaryUtils.ts +4 -11
package/.mocharc.js ADDED
@@ -0,0 +1,12 @@
1
+ /*!
2
+ * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const getFluidTestMochaConfig = require('@fluidframework/mocha-test-setup/mocharc-common');
9
+
10
+ const packageDir = __dirname;
11
+ const config = getFluidTestMochaConfig(packageDir);
12
+ module.exports = config;
@@ -1 +1 @@
1
- {"version":3,"file":"objectstorageutils.d.ts","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAE7D,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,MAAM,YAY/D;AAED,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA0BvG"}
1
+ {"version":3,"file":"objectstorageutils.d.ts","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,sCAAsC,CAAC;AAE7D,wBAAgB,mCAAmC,CAAC,IAAI,EAAE,MAAM,YAY/D;AAED,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,KAAK,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAkBvG"}
@@ -25,22 +25,12 @@ async function listBlobsAtTreePath(inputTree, path) {
25
25
  while ((tree === null || tree === void 0 ? void 0 : tree.entries) !== undefined && pathParts.length > 0) {
26
26
  const part = pathParts.shift();
27
27
  const treeEntry = tree.entries.find((value) => {
28
- if (value.type === "Tree" && value.path === part) {
29
- return true;
30
- }
31
- else {
32
- return false;
33
- }
28
+ return value.type === "Tree" && value.path === part ? true : false;
34
29
  });
35
30
  // this check is largely superfluous due to the same check being done
36
31
  // immediately above. the type system, however, is not aware of this.
37
32
  // so we must redundantly determine that the entry's type is "Tree"
38
- if ((treeEntry === null || treeEntry === void 0 ? void 0 : treeEntry.type) === "Tree") {
39
- tree = treeEntry.value;
40
- }
41
- else {
42
- tree = undefined;
43
- }
33
+ tree = (treeEntry === null || treeEntry === void 0 ? void 0 : treeEntry.type) === "Tree" ? treeEntry.value : undefined;
44
34
  }
45
35
  if ((tree === null || tree === void 0 ? void 0 : tree.entries) === undefined || pathParts.length !== 0) {
46
36
  throw new Error("path does not exist");
@@ -1 +1 @@
1
- {"version":3,"file":"objectstorageutils.js","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,SAAgB,mCAAmC,CAAC,IAAY;IAC5D,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,IAAI,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC/B,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAC3C;IACD,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC7B,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACrE;IACD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1B,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACnC;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AAZD,kFAYC;AAEM,KAAK,UAAU,mBAAmB,CAAC,SAA4B,EAAE,IAAY;IAChF,MAAM,SAAS,GAAG,mCAAmC,CAAC,IAAI,CAAC,CAAC;IAC5D,IAAI,IAAI,GAAsB,SAAS,CAAC;IACxC,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,MAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;QACxD,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YAC1C,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;gBAC9C,OAAO,IAAI,CAAC;aACf;iBAAM;gBACH,OAAO,KAAK,CAAC;aAChB;QACL,CAAC,CAAC,CAAC;QAEH,qEAAqE;QACrE,qEAAqE;QACrE,mEAAmE;QACnE,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,MAAM,EAAE;YAC5B,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC;SAC1B;aAAM;YACH,IAAI,GAAG,SAAS,CAAC;SACpB;KACJ;IACD,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,MAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QACvD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;KAC1C;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;AA1BD,kDA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITree } from \"@fluidframework/protocol-definitions\";\n\nexport function getNormalizedObjectStoragePathParts(path: string) {\n let normalizePath = path;\n if (normalizePath.startsWith(\"/\")) {\n normalizePath = normalizePath.substr(1);\n }\n if (normalizePath.endsWith(\"/\")) {\n normalizePath = normalizePath.substr(0, normalizePath.length - 1);\n }\n if (normalizePath.length > 0) {\n return normalizePath.split(\"/\");\n }\n return [];\n}\n\nexport async function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]> {\n const pathParts = getNormalizedObjectStoragePathParts(path);\n let tree: ITree | undefined = inputTree;\n while (tree?.entries !== undefined && pathParts.length > 0) {\n const part = pathParts.shift();\n const treeEntry = tree.entries.find((value) => {\n if (value.type === \"Tree\" && value.path === part) {\n return true;\n } else {\n return false;\n }\n });\n\n // this check is largely superfluous due to the same check being done\n // immediately above. the type system, however, is not aware of this.\n // so we must redundantly determine that the entry's type is \"Tree\"\n if (treeEntry?.type === \"Tree\") {\n tree = treeEntry.value;\n } else {\n tree = undefined;\n }\n }\n if (tree?.entries === undefined || pathParts.length !== 0) {\n throw new Error(\"path does not exist\");\n }\n return tree.entries.filter((e) => e.type === \"Blob\").map((e) => e.path);\n}\n"]}
1
+ {"version":3,"file":"objectstorageutils.js","sourceRoot":"","sources":["../src/objectstorageutils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAIH,SAAgB,mCAAmC,CAAC,IAAY;IAC5D,IAAI,aAAa,GAAG,IAAI,CAAC;IACzB,IAAI,aAAa,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAC/B,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;KAC3C;IACD,IAAI,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC7B,aAAa,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;KACrE;IACD,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;QAC1B,OAAO,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;KACnC;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AAZD,kFAYC;AAEM,KAAK,UAAU,mBAAmB,CAAC,SAA4B,EAAE,IAAY;IAChF,MAAM,SAAS,GAAG,mCAAmC,CAAC,IAAI,CAAC,CAAC;IAC5D,IAAI,IAAI,GAAsB,SAAS,CAAC;IACxC,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,MAAK,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;QACxD,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,EAAE,CAAC;QAC/B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;YAC1C,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QACvE,CAAC,CAAC,CAAC;QAEH,qEAAqE;QACrE,qEAAqE;QACrE,mEAAmE;QACnE,IAAI,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,IAAI,MAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;KACnE;IACD,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,MAAK,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE;QACvD,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;KAC1C;IACD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;AAC5E,CAAC;AAlBD,kDAkBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITree } from \"@fluidframework/protocol-definitions\";\n\nexport function getNormalizedObjectStoragePathParts(path: string) {\n let normalizePath = path;\n if (normalizePath.startsWith(\"/\")) {\n normalizePath = normalizePath.substr(1);\n }\n if (normalizePath.endsWith(\"/\")) {\n normalizePath = normalizePath.substr(0, normalizePath.length - 1);\n }\n if (normalizePath.length > 0) {\n return normalizePath.split(\"/\");\n }\n return [];\n}\n\nexport async function listBlobsAtTreePath(inputTree: ITree | undefined, path: string): Promise<string[]> {\n const pathParts = getNormalizedObjectStoragePathParts(path);\n let tree: ITree | undefined = inputTree;\n while (tree?.entries !== undefined && pathParts.length > 0) {\n const part = pathParts.shift();\n const treeEntry = tree.entries.find((value) => {\n return value.type === \"Tree\" && value.path === part ? true : false;\n });\n\n // this check is largely superfluous due to the same check being done\n // immediately above. the type system, however, is not aware of this.\n // so we must redundantly determine that the entry's type is \"Tree\"\n tree = treeEntry?.type === \"Tree\" ? treeEntry.value : undefined;\n }\n if (tree?.entries === undefined || pathParts.length !== 0) {\n throw new Error(\"path does not exist\");\n }\n return tree.entries.filter((e) => e.type === \"Blob\").map((e) => e.path);\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/runtime-utils";
8
- export declare const pkgVersion = "1.3.0";
8
+ export declare const pkgVersion = "2.0.0-dev.1.4.5.105745";
9
9
  //# sourceMappingURL=packageVersion.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,UAAU,CAAC"}
1
+ {"version":3,"file":"packageVersion.d.ts","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,OAAO,kCAAkC,CAAC;AACvD,eAAO,MAAM,UAAU,2BAA2B,CAAC"}
@@ -8,5 +8,5 @@
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.pkgVersion = exports.pkgName = void 0;
10
10
  exports.pkgName = "@fluidframework/runtime-utils";
11
- exports.pkgVersion = "1.3.0";
11
+ exports.pkgVersion = "2.0.0-dev.1.4.5.105745";
12
12
  //# sourceMappingURL=packageVersion.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,OAAO,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/runtime-utils\";\nexport const pkgVersion = \"1.3.0\";\n"]}
1
+ {"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,+BAA+B,CAAC;AAC1C,QAAA,UAAU,GAAG,wBAAwB,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/runtime-utils\";\nexport const pkgVersion = \"2.0.0-dev.1.4.5.105745\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"requestParser.d.ts","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAE3E;;GAEG;AACH,qBAAa,aAAc,YAAW,QAAQ;IA+BpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IA9B9C;;;OAGG;WACW,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IAe1D,OAAO,CAAC,gBAAgB,CAAgC;IACxD,SAAgB,KAAK,EAAE,MAAM,CAAC;WAEhB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAQhD,SAAS,aAA8B,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC;IASlE,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,IAAW,OAAO,IAAI,cAAc,GAAG,SAAS,CAE/C;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,SAAS,MAAM,EAAE,CAKxC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAQ,EAAE,MAAM;IAI9B;;;;;;;;;;;OAWG;IACI,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,QAAQ;CAiB/D"}
1
+ {"version":3,"file":"requestParser.d.ts","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAE3E;;GAEG;AACH,qBAAa,aAAc,YAAW,QAAQ;IA+BpB,OAAO,CAAC,QAAQ,CAAC,OAAO;IA9B9C;;;OAGG;WACW,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE;IAe1D,OAAO,CAAC,gBAAgB,CAAgC;IACxD,SAAgB,KAAK,EAAE,MAAM,CAAC;WAEhB,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAQhD,SAAS,aAA8B,OAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC;IAKlE,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,IAAW,OAAO,IAAI,cAAc,GAAG,SAAS,CAE/C;IAED;;OAEG;IACH,IAAW,SAAS,IAAI,SAAS,MAAM,EAAE,CAKxC;IAED;;;OAGG;IACI,MAAM,CAAC,QAAQ,EAAE,MAAM;IAI9B;;;;;;;;;;;OAWG;IACI,gBAAgB,CAAC,iBAAiB,EAAE,MAAM,GAAG,QAAQ;CAiB/D"}
@@ -8,12 +8,7 @@ class RequestParser {
8
8
  constructor(request) {
9
9
  this.request = request;
10
10
  const queryStartIndex = this.request.url.indexOf("?");
11
- if (queryStartIndex >= 0) {
12
- this.query = this.request.url.substring(queryStartIndex);
13
- }
14
- else {
15
- this.query = "";
16
- }
11
+ this.query = queryStartIndex >= 0 ? this.request.url.substring(queryStartIndex) : "";
17
12
  }
18
13
  /**
19
14
  * Splits the path of the url and decodes each path part
@@ -1 +1 @@
1
- {"version":3,"file":"requestParser.js","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,MAAa,aAAa;IA+BtB,YAAuC,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;QAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtD,IAAI,eAAe,IAAI,CAAC,EAAE;YACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;SAC5D;aAAM;YACH,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;SACnB;IACL,CAAC;IArCD;;;OAGG;IACI,MAAM,CAAC,YAAY,CAAC,GAAW;QAClC,MAAM,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACzC,OAAO,GAAG;aACL,SAAS,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC;aAChE,KAAK,CAAC,GAAG,CAAC;aACV,MAAM,CACH,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE;YACP,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE;gBACnC,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;aACnC;YACD,OAAO,EAAE,CAAC;QACd,CAAC,EACD,EAAE,CAAC,CAAC;IAChB,CAAC;IAKM,MAAM,CAAC,MAAM,CAAC,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C;QACrE,OAAO;YACH,GAAG,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YACvD,OAAO,EAAE,IAAI,CAAC,OAAO;SACxB,CAAC;IACN,CAAC;CACJ;AA/FD,sCA+FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IRequest, IRequestHeader } from \"@fluidframework/core-interfaces\";\n\n/**\n * The Request Parser takes an IRequest provides parsing and sub request creation\n */\nexport class RequestParser implements IRequest {\n /**\n * Splits the path of the url and decodes each path part\n * @param url - the url to get path parts of\n */\n public static getPathParts(url: string): readonly string[] {\n const queryStartIndex = url.indexOf(\"?\");\n return url\n .substring(0, queryStartIndex < 0 ? url.length : queryStartIndex)\n .split(\"/\")\n .reduce<string[]>(\n (pv, cv) => {\n if (cv !== undefined && cv.length > 0) {\n pv.push(decodeURIComponent(cv));\n }\n return pv;\n },\n []);\n }\n\n private requestPathParts: readonly string[] | undefined;\n public readonly query: string;\n\n public static create(request: Readonly<IRequest>) {\n // Perf optimizations.\n if (request instanceof RequestParser) {\n return request;\n }\n return new RequestParser(request);\n }\n\n protected constructor(private readonly request: Readonly<IRequest>) {\n const queryStartIndex = this.request.url.indexOf(\"?\");\n if (queryStartIndex >= 0) {\n this.query = this.request.url.substring(queryStartIndex);\n } else {\n this.query = \"\";\n }\n }\n\n public get url(): string {\n return this.request.url;\n }\n\n public get headers(): IRequestHeader | undefined {\n return this.request.headers;\n }\n\n /**\n * Returns the decoded path parts of the request's url\n */\n public get pathParts(): readonly string[] {\n if (this.requestPathParts === undefined) {\n this.requestPathParts = RequestParser.getPathParts(this.url);\n }\n return this.requestPathParts;\n }\n\n /**\n * Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.\n * @param elements - number of elements in path\n */\n public isLeaf(elements: number) {\n return this.query === \"\" && this.pathParts.length === elements;\n }\n\n /**\n * Creates a sub request starting at a specific path part of this request's url\n * The sub request url always has a leading slash, and always include query params if original url has any\n * e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams\n * createSubRequest(1) is /b/?queryParams\n * createSubRequest(2) is /?queryParams\n * createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception\n *\n * note: query params are not counted towards path parts.\n *\n * @param startingPathIndex - The index of the first path part of the sub request\n */\n public createSubRequest(startingPathIndex: number): IRequest {\n const pathLen = this.pathParts.length;\n if (startingPathIndex < 0 || startingPathIndex > pathLen) {\n throw new Error(\"incorrect sub-request\");\n }\n if (startingPathIndex === pathLen && this.url.includes(\"?\")) {\n return {\n url: `/${this.query}`,\n headers: this.headers,\n };\n }\n const path = `/${this.pathParts.slice(startingPathIndex).join(\"/\")}`;\n return {\n url: this.query === \"\" ? path : `${path}/${this.query}`,\n headers: this.headers,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"requestParser.js","sourceRoot":"","sources":["../src/requestParser.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,MAAa,aAAa;IA+BtB,YAAuC,OAA2B;QAA3B,YAAO,GAAP,OAAO,CAAoB;QAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACtD,IAAI,CAAC,KAAK,GAAG,eAAe,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzF,CAAC;IAjCD;;;OAGG;IACI,MAAM,CAAC,YAAY,CAAC,GAAW;QAClC,MAAM,eAAe,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACzC,OAAO,GAAG;aACL,SAAS,CAAC,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CA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,uBAAuB,CAAC,CAAC;SAC5C;QACD,IAAI,iBAAiB,KAAK,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;YACzD,OAAO;gBACH,GAAG,EAAE,IAAI,IAAI,CAAC,KAAK,EAAE;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;aACxB,CAAC;SACL;QACD,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;QACrE,OAAO;YACH,GAAG,EAAE,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,IAAI,CAAC,KAAK,EAAE;YACvD,OAAO,EAAE,IAAI,CAAC,OAAO;SACxB,CAAC;IACN,CAAC;CACJ;AA3FD,sCA2FC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { IRequest, IRequestHeader } from \"@fluidframework/core-interfaces\";\n\n/**\n * The Request Parser takes an IRequest provides parsing and sub request creation\n */\nexport class RequestParser implements IRequest {\n /**\n * Splits the path of the url and decodes each path part\n * @param url - the url to get path parts of\n */\n public static getPathParts(url: string): readonly string[] {\n const queryStartIndex = url.indexOf(\"?\");\n return url\n .substring(0, queryStartIndex < 0 ? url.length : queryStartIndex)\n .split(\"/\")\n .reduce<string[]>(\n (pv, cv) => {\n if (cv !== undefined && cv.length > 0) {\n pv.push(decodeURIComponent(cv));\n }\n return pv;\n },\n []);\n }\n\n private requestPathParts: readonly string[] | undefined;\n public readonly query: string;\n\n public static create(request: Readonly<IRequest>) {\n // Perf optimizations.\n if (request instanceof RequestParser) {\n return request;\n }\n return new RequestParser(request);\n }\n\n protected constructor(private readonly request: Readonly<IRequest>) {\n const queryStartIndex = this.request.url.indexOf(\"?\");\n this.query = queryStartIndex >= 0 ? this.request.url.substring(queryStartIndex) : \"\";\n }\n\n public get url(): string {\n return this.request.url;\n }\n\n public get headers(): IRequestHeader | undefined {\n return this.request.headers;\n }\n\n /**\n * Returns the decoded path parts of the request's url\n */\n public get pathParts(): readonly string[] {\n if (this.requestPathParts === undefined) {\n this.requestPathParts = RequestParser.getPathParts(this.url);\n }\n return this.requestPathParts;\n }\n\n /**\n * Returns true if it's a terminating path, i.e. no more elements after `elements` entries and empty query.\n * @param elements - number of elements in path\n */\n public isLeaf(elements: number) {\n return this.query === \"\" && this.pathParts.length === elements;\n }\n\n /**\n * Creates a sub request starting at a specific path part of this request's url\n * The sub request url always has a leading slash, and always include query params if original url has any\n * e.g. original url is /a/b/?queryParams, createSubRequest(0) is /a/b/?queryParams\n * createSubRequest(1) is /b/?queryParams\n * createSubRequest(2) is /?queryParams\n * createSubRequest(n) where n is bigger than parts length, e.g. 2, or n is less than 0 will throw an exception\n *\n * note: query params are not counted towards path parts.\n *\n * @param startingPathIndex - The index of the first path part of the sub request\n */\n public createSubRequest(startingPathIndex: number): IRequest {\n const pathLen = this.pathParts.length;\n if (startingPathIndex < 0 || startingPathIndex > pathLen) {\n throw new Error(\"incorrect sub-request\");\n }\n if (startingPathIndex === pathLen && this.url.includes(\"?\")) {\n return {\n url: `/${this.query}`,\n headers: this.headers,\n };\n }\n const path = `/${this.pathParts.slice(startingPathIndex).join(\"/\")}`;\n return {\n url: this.query === \"\" ? path : `${path}/${this.query}`,\n headers: this.headers,\n };\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeFactoryHelper.d.ts","sourceRoot":"","sources":["../src/runtimeFactoryHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,iBAAiB,EACjB,QAAQ,EACR,eAAe,EAClB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AAElF,8BAAsB,oBAAoB,CAAC,CAAC,GAAG,iBAAiB,CAAE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 -12,12 +12,7 @@ class RuntimeFactoryHelper {
12
12
  ? context.existing === true
13
13
  : existing;
14
14
  const runtime = await this.preInitialize(context, fromExisting);
15
- if (fromExisting) {
16
- await this.instantiateFromExisting(runtime);
17
- }
18
- else {
19
- await this.instantiateFirstTime(runtime);
20
- }
15
+ await (fromExisting ? this.instantiateFromExisting(runtime) : this.instantiateFirstTime(runtime));
21
16
  await this.hasInitialized(runtime);
22
17
  return runtime;
23
18
  }
@@ -1 +1 @@
1
- {"version":3,"file":"runtimeFactoryHelper.js","sourceRoot":"","sources":["../src/runtimeFactoryHelper.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,MAAsB,oBAAoB;IACtC,IAAW,eAAe,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAEtC,KAAK,CAAC,kBAAkB,CAC3B,OAA0B,EAC1B,QAAkB;QAElB,MAAM,YAAY,GAAG,QAAQ,KAAK,SAAS;YACvC,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI;YAC3B,CAAC,CAAC,QAAQ,CAAC;QACf,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAEhE,IAAI,YAAY,EAAE;YACd,MAAM,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;SAC/C;aAAM;YACH,MAAM,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;SAC5C;QAED,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,OAAO,CAAC;IACnB,CAAC;IAGM,KAAK,CAAC,oBAAoB,CAAC,QAAW,IAAkB,CAAC;IACzD,KAAK,CAAC,uBAAuB,CAAC,QAAW,IAAkB,CAAC;IAC5D,KAAK,CAAC,cAAc,CAAC,QAAW,IAAkB,CAAC;CAC7D;AA1BD,oDA0BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IContainerContext,\n IRuntime,\n IRuntimeFactory,\n} from \"@fluidframework/container-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\n\nexport abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {\n public get IRuntimeFactory() { return this; }\n\n public async instantiateRuntime(\n context: IContainerContext,\n existing?: boolean,\n ): Promise<IRuntime> {\n const fromExisting = existing === undefined\n ? context.existing === true\n : existing;\n const runtime = await this.preInitialize(context, fromExisting);\n\n if (fromExisting) {\n await this.instantiateFromExisting(runtime);\n } else {\n await this.instantiateFirstTime(runtime);\n }\n\n await this.hasInitialized(runtime);\n return runtime;\n }\n\n public abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;\n public async instantiateFirstTime(_runtime: T): Promise<void> {}\n public async instantiateFromExisting(_runtime: T): Promise<void> {}\n public async hasInitialized(_runtime: T): Promise<void> {}\n}\n"]}
1
+ {"version":3,"file":"runtimeFactoryHelper.js","sourceRoot":"","sources":["../src/runtimeFactoryHelper.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,MAAsB,oBAAoB;IACtC,IAAW,eAAe,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAEtC,KAAK,CAAC,kBAAkB,CAC3B,OAA0B,EAC1B,QAAkB;QAElB,MAAM,YAAY,GAAG,QAAQ,KAAK,SAAS;YACvC,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,IAAI;YAC3B,CAAC,CAAC,QAAQ,CAAC;QACf,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;QAEhE,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC;QAElG,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,OAAO,CAAC;IACnB,CAAC;IAGM,KAAK,CAAC,oBAAoB,CAAC,QAAW,IAAkB,CAAC;IACzD,KAAK,CAAC,uBAAuB,CAAC,QAAW,IAAkB,CAAC;IAC5D,KAAK,CAAC,cAAc,CAAC,QAAW,IAAkB,CAAC;CAC7D;AAtBD,oDAsBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n IContainerContext,\n IRuntime,\n IRuntimeFactory,\n} from \"@fluidframework/container-definitions\";\nimport { IContainerRuntime } from \"@fluidframework/container-runtime-definitions\";\n\nexport abstract class RuntimeFactoryHelper<T = IContainerRuntime> implements IRuntimeFactory {\n public get IRuntimeFactory() { return this; }\n\n public async instantiateRuntime(\n context: IContainerContext,\n existing?: boolean,\n ): Promise<IRuntime> {\n const fromExisting = existing === undefined\n ? context.existing === true\n : existing;\n const runtime = await this.preInitialize(context, fromExisting);\n\n await (fromExisting ? this.instantiateFromExisting(runtime) : this.instantiateFirstTime(runtime));\n\n await this.hasInitialized(runtime);\n return runtime;\n }\n\n public abstract preInitialize(context: IContainerContext, existing: boolean): Promise<IRuntime & T>;\n public async instantiateFirstTime(_runtime: T): Promise<void> {}\n public async instantiateFromExisting(_runtime: T): Promise<void> {}\n public async hasInitialized(_runtime: T): Promise<void> {}\n}\n"]}
@@ -37,7 +37,6 @@ export declare class SummarizerNode implements IRootSummarizerNode {
37
37
  get referenceSequenceNumber(): number;
38
38
  protected readonly children: Map<string, SummarizerNode>;
39
39
  protected readonly pendingSummaries: Map<string, SummaryNode>;
40
- private readonly outstandingOps;
41
40
  private wipReferenceSequenceNumber;
42
41
  private wipLocalPaths;
43
42
  private wipSkipRecursion;
@@ -57,21 +56,28 @@ export declare class SummarizerNode implements IRootSummarizerNode {
57
56
  * it becomes the latest summary. If the current summary is already ahead (e.g., loaded from a service summary),
58
57
  * we skip the update. Otherwise, we get the snapshot by calling `getSnapshot` and update latest
59
58
  * summary based off of that.
59
+ *
60
60
  * @returns A RefreshSummaryResult type which returns information based on the following three scenarios:
61
- * 1. The latest summary was not udpated.
62
- * 2. The latest summary was updated and the summary corresponding to the params was being tracked.
63
- * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this
64
- * case, the latest summary is updated based on the downloaded snapshot which is also returned.
61
+ *
62
+ * 1. The latest summary was not udpated.
63
+ *
64
+ * 2. The latest summary was updated and the summary corresponding to the params was being tracked.
65
+ *
66
+ * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this
67
+ * case, the latest summary is updated based on the downloaded snapshot which is also returned.
65
68
  */
66
69
  refreshLatestSummary(proposalHandle: string | undefined, summaryRefSeq: number, getSnapshot: () => Promise<ISnapshotTree>, readAndParseBlob: ReadAndParseBlob, correlatedSummaryLogger: ITelemetryLogger): Promise<RefreshSummaryResult>;
70
+ /**
71
+ * Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node
72
+ * from the state in the pending summary queue.
73
+ * @param proposalHandle - Handle for the current proposal.
74
+ * @param referenceSequenceNumber - reference sequence number of sent summary.
75
+ */
67
76
  protected refreshLatestSummaryFromPending(proposalHandle: string, referenceSequenceNumber: number): void;
68
77
  protected refreshLatestSummaryFromSnapshot(referenceSequenceNumber: number, snapshotTree: ISnapshotTree, basePath: EscapedPath | undefined, localPath: EscapedPath, correlatedSummaryLogger: ITelemetryLogger, readAndParseBlob: ReadAndParseBlob): Promise<void>;
69
78
  private refreshLatestSummaryCore;
70
79
  loadBaseSummaryWithoutDifferential(snapshot: ISnapshotTree): void;
71
- loadBaseSummary(snapshot: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<{
72
- baseSummary: ISnapshotTree;
73
- outstandingOps: ISequencedDocumentMessage[];
74
- }>;
80
+ loadBaseSummary(snapshot: ISnapshotTree, readAndParseBlob: ReadAndParseBlob): Promise<ISnapshotTree>;
75
81
  recordChange(op: ISequencedDocumentMessage): void;
76
82
  invalidate(sequenceNumber: number): void;
77
83
  /**
@@ -82,13 +88,6 @@ export declare class SummarizerNode implements IRootSummarizerNode {
82
88
  protected hasChanged(): boolean;
83
89
  get latestSummary(): Readonly<SummaryNode> | undefined;
84
90
  private readonly canReuseHandle;
85
- private readonly throwOnError;
86
- /**
87
- * Sequence number of latest tracked op. This updates during recordChange,
88
- * but not for invalidate since we don't have the op. If this drifts from
89
- * changeSequenceNumber and we try to create a differential summary we assert.
90
- */
91
- private trackingSequenceNumber;
92
91
  /**
93
92
  * Do not call constructor directly.
94
93
  * Use createRootSummarizerNode to create root node, or createChild to create child nodes.
@@ -118,9 +117,12 @@ export declare class SummarizerNode implements IRootSummarizerNode {
118
117
  /**
119
118
  * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's
120
119
  * summary tracking state needs to be updated too.
120
+ * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's
121
+ * pending summary as well.
121
122
  * @param child - The child node whose state is to be updated.
122
123
  */
123
124
  protected maybeUpdateChildState(child: SummarizerNode): void;
125
+ protected addPendingSummary(key: string, summary: SummaryNode): void;
124
126
  /**
125
127
  * Tells whether summary tracking is in progress. True if "startSummary" API is called before summarize.
126
128
  */
@@ -1 +1 @@
1
- {"version":3,"file":"summarizerNode.d.ts","sourceRoot":"","sources":["../../src/summarizerNode/summarizerNode.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,gBAAgB,EAEhB,8BAA8B,EAE9B,mBAAmB,EACnB,iBAAiB,EACpB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EACH,yBAAyB,EAEzB,aAAa,EAEhB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAGtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,EAIH,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,2BAA2B,EAG3B,oBAAoB,EACpB,WAAW,EACd,MAAM,u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AoBrD,SAAS,CAAC,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;IAG7D;;OAEG;IACH,SAAS,CAAC,oBAAoB,IAAI,OAAO;CAG5C;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,WACzB,gBAAgB,uBACH,mBAAmB,wBAClB,MAAM,2BACH,MAAM,GAAG,SAAS,WACnC,qBAAqB,KAC9B,mBAME,CAAC"}
@@ -40,14 +40,8 @@ class SummarizerNode {
40
40
  this.wipSummaryLogger = wipSummaryLogger;
41
41
  this.children = new Map();
42
42
  this.pendingSummaries = new Map();
43
- this.outstandingOps = [];
44
43
  this.wipSkipRecursion = false;
45
44
  this.canReuseHandle = (_a = config.canReuseHandle) !== null && _a !== void 0 ? _a : true;
46
- // BUGBUG: Seeing issues with differential summaries.
47
- // this will disable them, and throw instead
48
- // while we continue to investigate
49
- this.throwOnError = true; // config.throwOnFailure ?? false;
50
- this.trackingSequenceNumber = this._changeSequenceNumber;
51
45
  }
52
46
  /**
53
47
  * The reference sequence number of the most recent acked summary.
@@ -90,53 +84,12 @@ class SummarizerNode {
90
84
  };
91
85
  }
92
86
  }
93
- try {
94
- const result = await this.summarizeInternalFn(fullTree, true, telemetryContext);
95
- this.wipLocalPaths = { localPath: summarizerNodeUtils_1.EscapedPath.create(result.id) };
96
- if (result.pathPartsForChildren !== undefined) {
97
- this.wipLocalPaths.additionalPath = summarizerNodeUtils_1.EscapedPath.createAndConcat(result.pathPartsForChildren);
98
- }
99
- return { summary: result.summary, stats: result.stats };
100
- }
101
- catch (error) {
102
- if (this.throwOnError || this.trackingSequenceNumber < this._changeSequenceNumber) {
103
- throw error;
104
- }
105
- const latestSummary = this._latestSummary;
106
- const initialSummary = this.initialSummary;
107
- let encodeParam;
108
- let localPath;
109
- if (latestSummary !== undefined) {
110
- // Create using handle of latest acked summary
111
- encodeParam = {
112
- fromSummary: true,
113
- summaryNode: latestSummary,
114
- };
115
- localPath = latestSummary.localPath;
116
- }
117
- else if ((initialSummary === null || initialSummary === void 0 ? void 0 : initialSummary.summary) !== undefined) {
118
- // Create using initial summary from attach op
119
- encodeParam = {
120
- fromSummary: false,
121
- initialSummary: initialSummary.summary,
122
- };
123
- localPath = summarizerNodeUtils_1.EscapedPath.create(initialSummary.id);
124
- }
125
- else {
126
- // No base summary to reference
127
- throw error;
128
- }
129
- this.wipSummaryLogger.sendErrorEvent({
130
- eventName: "SummarizingWithBasePlusOps",
131
- }, error);
132
- const summary = (0, summarizerNodeUtils_1.encodeSummary)(encodeParam, this.outstandingOps);
133
- this.wipLocalPaths = {
134
- localPath,
135
- additionalPath: summary.additionalPath,
136
- };
137
- this.wipSkipRecursion = true;
138
- return { summary: summary.summary, stats: summary.stats };
87
+ const result = await this.summarizeInternalFn(fullTree, true, telemetryContext);
88
+ this.wipLocalPaths = { localPath: summarizerNodeUtils_1.EscapedPath.create(result.id) };
89
+ if (result.pathPartsForChildren !== undefined) {
90
+ this.wipLocalPaths.additionalPath = summarizerNodeUtils_1.EscapedPath.createAndConcat(result.pathPartsForChildren);
139
91
  }
92
+ return { summary: result.summary, stats: result.stats };
140
93
  }
141
94
  /**
142
95
  * Complete the WIP summary for the given proposalHandle
@@ -148,6 +101,7 @@ class SummarizerNode {
148
101
  * Recursive implementation for completeSummary, with additional internal-only parameters
149
102
  */
150
103
  completeSummaryCore(proposalHandle, parentPath, parentSkipRecursion) {
104
+ var _a, _b;
151
105
  (0, common_utils_1.assert)(this.wipSummaryLogger !== undefined, 0x1a3 /* "wipSummaryLogger should have been set in startSummary or ctor" */);
152
106
  (0, common_utils_1.assert)(this.wipReferenceSequenceNumber !== undefined, 0x1a4 /* "Not tracking a summary" */);
153
107
  let localPathsToUse = this.wipLocalPaths;
@@ -180,7 +134,12 @@ class SummarizerNode {
180
134
  // if parentIsFailure or parentIsReused is true.
181
135
  // If there is no latestSummary, clearSummary and return before reaching this code.
182
136
  (0, common_utils_1.assert)(!!localPathsToUse, 0x1a5 /* "Tracked summary local paths not set" */);
183
- const summary = new summarizerNodeUtils_1.SummaryNode(Object.assign(Object.assign({}, localPathsToUse), { referenceSequenceNumber: this.wipReferenceSequenceNumber, basePath: parentPath }));
137
+ // DataStore can be realized out-of-order during the summary execution (ex. the mixinSummaryHandler
138
+ // in order to provide search capability to the summaries). If that happens,
139
+ // a child node will not have the handle paths with ".channels".
140
+ // By using the _latestSummary's basePath we have a safe path to compose its pendingSummary.
141
+ // PR: https://github.com/microsoft/FluidFramework/pull/11697
142
+ const summary = new summarizerNodeUtils_1.SummaryNode(Object.assign(Object.assign({}, localPathsToUse), { referenceSequenceNumber: this.wipReferenceSequenceNumber, basePath: parentSkipRecursion ? (_b = (_a = this._latestSummary) === null || _a === void 0 ? void 0 : _a.basePath) !== null && _b !== void 0 ? _b : parentPath : parentPath }));
184
143
  const fullPathForChildren = summary.fullPathForChildren;
185
144
  for (const child of this.children.values()) {
186
145
  child.completeSummaryCore(proposalHandle, fullPathForChildren, this.wipSkipRecursion || parentSkipRecursion);
@@ -208,19 +167,34 @@ class SummarizerNode {
208
167
  * it becomes the latest summary. If the current summary is already ahead (e.g., loaded from a service summary),
209
168
  * we skip the update. Otherwise, we get the snapshot by calling `getSnapshot` and update latest
210
169
  * summary based off of that.
170
+ *
211
171
  * @returns A RefreshSummaryResult type which returns information based on the following three scenarios:
212
- * 1. The latest summary was not udpated.
213
- * 2. The latest summary was updated and the summary corresponding to the params was being tracked.
214
- * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this
215
- * case, the latest summary is updated based on the downloaded snapshot which is also returned.
172
+ *
173
+ * 1. The latest summary was not udpated.
174
+ *
175
+ * 2. The latest summary was updated and the summary corresponding to the params was being tracked.
176
+ *
177
+ * 3. The latest summary was updated but the summary corresponding to the params was not tracked. In this
178
+ * case, the latest summary is updated based on the downloaded snapshot which is also returned.
216
179
  */
217
180
  async refreshLatestSummary(proposalHandle, summaryRefSeq, getSnapshot, readAndParseBlob, correlatedSummaryLogger) {
181
+ var _a;
218
182
  if (proposalHandle !== undefined) {
219
183
  const maybeSummaryNode = this.pendingSummaries.get(proposalHandle);
220
184
  if (maybeSummaryNode !== undefined) {
221
185
  this.refreshLatestSummaryFromPending(proposalHandle, maybeSummaryNode.referenceSequenceNumber);
222
186
  return { latestSummaryUpdated: true, wasSummaryTracked: true };
223
187
  }
188
+ const props = {
189
+ summaryRefSeq,
190
+ pendingSize: (_a = this.pendingSummaries.size) !== null && _a !== void 0 ? _a : undefined,
191
+ };
192
+ this.defaultLogger.sendTelemetryEvent({
193
+ eventName: "PendingSummaryNotFound",
194
+ proposalHandle,
195
+ referenceSequenceNumber: this.referenceSequenceNumber,
196
+ details: JSON.stringify(props),
197
+ });
224
198
  }
225
199
  // If we have seen a summary same or later as the current one, ignore it.
226
200
  if (this.referenceSequenceNumber >= summaryRefSeq) {
@@ -230,6 +204,12 @@ class SummarizerNode {
230
204
  await this.refreshLatestSummaryFromSnapshot(summaryRefSeq, snapshotTree, undefined, summarizerNodeUtils_1.EscapedPath.create(""), correlatedSummaryLogger, readAndParseBlob);
231
205
  return { latestSummaryUpdated: true, wasSummaryTracked: false, snapshot: snapshotTree };
232
206
  }
207
+ /**
208
+ * Called when we get an ack from the server for a summary we've just sent. Updates the reference state of this node
209
+ * from the state in the pending summary queue.
210
+ * @param proposalHandle - Handle for the current proposal.
211
+ * @param referenceSequenceNumber - reference sequence number of sent summary.
212
+ */
233
213
  refreshLatestSummaryFromPending(proposalHandle, referenceSequenceNumber) {
234
214
  const summaryNode = this.pendingSummaries.get(proposalHandle);
235
215
  if (summaryNode === undefined) {
@@ -255,13 +235,13 @@ class SummarizerNode {
255
235
  return;
256
236
  }
257
237
  this.refreshLatestSummaryCore(referenceSequenceNumber);
258
- const { baseSummary, pathParts } = (0, summarizerNodeUtils_1.decodeSummary)(snapshotTree, correlatedSummaryLogger);
259
238
  this._latestSummary = new summarizerNodeUtils_1.SummaryNode({
260
239
  referenceSequenceNumber,
261
240
  basePath,
262
241
  localPath,
263
242
  });
264
- const { childrenTree, childrenPathPart } = (0, summarizerNodeUtils_1.parseSummaryForSubtrees)(baseSummary);
243
+ const pathParts = [];
244
+ const { childrenTree, childrenPathPart } = (0, summarizerNodeUtils_1.parseSummaryForSubtrees)(snapshotTree);
265
245
  if (childrenPathPart !== undefined) {
266
246
  pathParts.push(childrenPathPart);
267
247
  }
@@ -285,11 +265,6 @@ class SummarizerNode {
285
265
  this.pendingSummaries.delete(key);
286
266
  }
287
267
  }
288
- // Clear earlier outstanding ops
289
- while (this.outstandingOps.length > 0
290
- && this.outstandingOps[0].sequenceNumber <= referenceSequenceNumber) {
291
- this.outstandingOps.shift();
292
- }
293
268
  }
294
269
  loadBaseSummaryWithoutDifferential(snapshot) {
295
270
  // Check base summary to see if it has any additional path parts
@@ -300,34 +275,18 @@ class SummarizerNode {
300
275
  }
301
276
  }
302
277
  async loadBaseSummary(snapshot, readAndParseBlob) {
303
- const decodedSummary = (0, summarizerNodeUtils_1.decodeSummary)(snapshot, this.defaultLogger);
304
- const outstandingOps = await decodedSummary.getOutstandingOps(readAndParseBlob);
305
- const { childrenPathPart } = (0, summarizerNodeUtils_1.parseSummaryForSubtrees)(decodedSummary.baseSummary);
278
+ const pathParts = [];
279
+ const { childrenPathPart } = (0, summarizerNodeUtils_1.parseSummaryForSubtrees)(snapshot);
306
280
  if (childrenPathPart !== undefined) {
307
- decodedSummary.pathParts.push(childrenPathPart);
308
- }
309
- if (decodedSummary.pathParts.length > 0 && this._latestSummary !== undefined) {
310
- this._latestSummary.additionalPath = summarizerNodeUtils_1.EscapedPath.createAndConcat(decodedSummary.pathParts);
281
+ pathParts.push(childrenPathPart);
311
282
  }
312
- // Defensive assertion: tracking number should already exceed this number.
313
- // This is probably a little excessive; can remove when stable.
314
- if (outstandingOps.length > 0) {
315
- const newOpsLatestSeq = outstandingOps[outstandingOps.length - 1].sequenceNumber;
316
- (0, common_utils_1.assert)(newOpsLatestSeq <= this.trackingSequenceNumber, 0x1a9 /* "When loading base summary, expected outstanding ops <= tracking sequence number" */);
283
+ if (pathParts.length > 0 && this._latestSummary !== undefined) {
284
+ this._latestSummary.additionalPath = summarizerNodeUtils_1.EscapedPath.createAndConcat(pathParts);
317
285
  }
318
- return {
319
- baseSummary: decodedSummary.baseSummary,
320
- outstandingOps,
321
- };
286
+ return snapshot;
322
287
  }
323
288
  recordChange(op) {
324
- const lastOp = this.outstandingOps[this.outstandingOps.length - 1];
325
- if (lastOp !== undefined) {
326
- (0, common_utils_1.assert)(lastOp.sequenceNumber < op.sequenceNumber, 0x1aa /* Out of order change recorded */);
327
- }
328
289
  this.invalidate(op.sequenceNumber);
329
- this.trackingSequenceNumber = op.sequenceNumber;
330
- this.outstandingOps.push(op);
331
290
  }
332
291
  invalidate(sequenceNumber) {
333
292
  if (sequenceNumber > this._changeSequenceNumber) {
@@ -360,7 +319,8 @@ class SummarizerNode {
360
319
  const createDetails = this.getCreateDetailsForChild(id, createParam);
361
320
  const child = new SummarizerNode(this.defaultLogger, summarizeInternalFn, config, createDetails.changeSequenceNumber, createDetails.latestSummary, createDetails.initialSummary, this.wipSummaryLogger);
362
321
  // There may be additional state that has to be updated in this child. For example, if a summary is being
363
- // tracked, the child's summary tracking state needs to be updated too.
322
+ // tracked, the child's summary tracking state needs to be updated too. Same goes for pendingSummaries we might
323
+ // have outstanding on the parent in case we realize nodes in between Summary Op and Summary Ack.
364
324
  this.maybeUpdateChildState(child);
365
325
  this.children.set(id, child);
366
326
  return child;
@@ -449,6 +409,8 @@ class SummarizerNode {
449
409
  /**
450
410
  * Updates the state of the child if required. For example, if a summary is currently being tracked, the child's
451
411
  * summary tracking state needs to be updated too.
412
+ * Also, in case a child node gets realized in between Summary Op and Summary Ack, let's initialize the child's
413
+ * pending summary as well.
452
414
  * @param child - The child node whose state is to be updated.
453
415
  */
454
416
  maybeUpdateChildState(child) {
@@ -457,6 +419,20 @@ class SummarizerNode {
457
419
  if (this.isTrackingInProgress()) {
458
420
  child.wipReferenceSequenceNumber = this.wipReferenceSequenceNumber;
459
421
  }
422
+ // In case we have pending summaries on the parent, let's initialize it on the child.
423
+ if (child._latestSummary !== undefined) {
424
+ for (const [key, value] of this.pendingSummaries.entries()) {
425
+ const newLatestSummaryNode = new summarizerNodeUtils_1.SummaryNode({
426
+ referenceSequenceNumber: value.referenceSequenceNumber,
427
+ basePath: child._latestSummary.basePath,
428
+ localPath: child._latestSummary.localPath,
429
+ });
430
+ child.addPendingSummary(key, newLatestSummaryNode);
431
+ }
432
+ }
433
+ }
434
+ addPendingSummary(key, summary) {
435
+ this.pendingSummaries.set(key, summary);
460
436
  }
461
437
  /**
462
438
  * Tells whether summary tracking is in progress. True if "startSummary" API is called before summarize.