@fluid-experimental/property-changeset 2.0.0-rc.2.0.2 → 2.0.0-rc.3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (205) hide show
  1. package/dist/ajvFactory.cjs +19 -0
  2. package/dist/ajvFactory.cjs.map +1 -0
  3. package/dist/ajvFactory.d.cts +7 -0
  4. package/dist/ajvFactory.d.cts.map +1 -0
  5. package/dist/changeset.d.ts +3 -6
  6. package/dist/changeset.d.ts.map +1 -1
  7. package/dist/changeset.js +75 -75
  8. package/dist/changeset.js.map +1 -1
  9. package/dist/changeset_operations/array.d.ts +6 -2
  10. package/dist/changeset_operations/array.d.ts.map +1 -1
  11. package/dist/changeset_operations/array.js +94 -96
  12. package/dist/changeset_operations/array.js.map +1 -1
  13. package/dist/changeset_operations/arrayChangesetIterator.d.ts +2 -5
  14. package/dist/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
  15. package/dist/changeset_operations/arrayChangesetIterator.js +11 -12
  16. package/dist/changeset_operations/arrayChangesetIterator.js.map +1 -1
  17. package/dist/changeset_operations/changesetConflictTypes.d.ts.map +1 -1
  18. package/dist/changeset_operations/changesetConflictTypes.js +2 -2
  19. package/dist/changeset_operations/changesetConflictTypes.js.map +1 -1
  20. package/dist/changeset_operations/indexedCollection.d.ts +1 -4
  21. package/dist/changeset_operations/indexedCollection.d.ts.map +1 -1
  22. package/dist/changeset_operations/indexedCollection.js +48 -49
  23. package/dist/changeset_operations/indexedCollection.js.map +1 -1
  24. package/dist/changeset_operations/isEmptyChangeset.d.ts +1 -4
  25. package/dist/changeset_operations/isEmptyChangeset.d.ts.map +1 -1
  26. package/dist/changeset_operations/isEmptyChangeset.js +9 -9
  27. package/dist/changeset_operations/isEmptyChangeset.js.map +1 -1
  28. package/dist/helpers/typeidHelper.d.ts +0 -3
  29. package/dist/helpers/typeidHelper.d.ts.map +1 -1
  30. package/dist/helpers/typeidHelper.js +10 -10
  31. package/dist/helpers/typeidHelper.js.map +1 -1
  32. package/dist/index.d.ts +8 -8
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +19 -19
  35. package/dist/index.js.map +1 -1
  36. package/dist/isReservedKeyword.d.ts.map +1 -1
  37. package/dist/isReservedKeyword.js +2 -2
  38. package/dist/isReservedKeyword.js.map +1 -1
  39. package/dist/package.json +3 -0
  40. package/dist/pathHelper.d.ts +0 -3
  41. package/dist/pathHelper.d.ts.map +1 -1
  42. package/dist/pathHelper.js +2 -2
  43. package/dist/pathHelper.js.map +1 -1
  44. package/dist/rebase.js +8 -8
  45. package/dist/rebase.js.map +1 -1
  46. package/dist/templateSchema.d.ts.map +1 -1
  47. package/dist/templateSchema.js +2 -2
  48. package/dist/templateSchema.js.map +1 -1
  49. package/dist/templateValidator.d.ts +1 -1
  50. package/dist/templateValidator.d.ts.map +1 -1
  51. package/dist/templateValidator.js +49 -54
  52. package/dist/templateValidator.js.map +1 -1
  53. package/dist/test/array.spec.js +34 -36
  54. package/dist/test/array.spec.js.map +1 -1
  55. package/dist/test/indexedCollection.spec.js +9 -6
  56. package/dist/test/indexedCollection.spec.js.map +1 -1
  57. package/dist/test/map.spec.js +4 -4
  58. package/dist/test/map.spec.js.map +1 -1
  59. package/dist/test/pathHelper.spec.js +185 -185
  60. package/dist/test/pathHelper.spec.js.map +1 -1
  61. package/dist/test/reversibleCs.spec.js +5 -5
  62. package/dist/test/reversibleCs.spec.js.map +1 -1
  63. package/dist/test/schemaValidator.js +12 -11
  64. package/dist/test/schemaValidator.js.map +1 -1
  65. package/dist/test/schemas/badBothPropertiesAndTypeid.js +18 -18
  66. package/dist/test/schemas/badBothPropertiesAndTypeid.js.map +1 -1
  67. package/dist/test/schemas/badInvalidSemverInTypeid.js +40 -40
  68. package/dist/test/schemas/badInvalidSemverInTypeid.js.map +1 -1
  69. package/dist/test/schemas/badMissingSemverInTypeid.js +40 -40
  70. package/dist/test/schemas/badMissingSemverInTypeid.js.map +1 -1
  71. package/dist/test/schemas/badNestedProperties.js +40 -40
  72. package/dist/test/schemas/badNestedProperties.js.map +1 -1
  73. package/dist/test/schemas/badPrimitiveTypeid.js +25 -25
  74. package/dist/test/schemas/badPrimitiveTypeid.js.map +1 -1
  75. package/dist/test/schemas/badVersionedTypeid.js +41 -41
  76. package/dist/test/schemas/badVersionedTypeid.js.map +1 -1
  77. package/dist/test/schemas/goodColorPalette.js +15 -15
  78. package/dist/test/schemas/goodColorPalette.js.map +1 -1
  79. package/dist/test/schemas/goodDraftAsVersion.js +12 -12
  80. package/dist/test/schemas/goodDraftAsVersion.js.map +1 -1
  81. package/dist/test/schemas/goodPointId.js +40 -40
  82. package/dist/test/schemas/goodPointId.js.map +1 -1
  83. package/dist/test/schemas/goodReferenceAndRegular.js +16 -16
  84. package/dist/test/schemas/goodReferenceAndRegular.js.map +1 -1
  85. package/dist/test/schemas/goodReservedTypes.js +22 -22
  86. package/dist/test/schemas/goodReservedTypes.js.map +1 -1
  87. package/dist/test/schemas/goodUIBorder.js +34 -34
  88. package/dist/test/schemas/goodUIBorder.js.map +1 -1
  89. package/dist/test/schemas/index.js +55 -0
  90. package/dist/test/schemas/index.js.map +1 -0
  91. package/dist/test/tsconfig.cjs.tsbuildinfo +1 -0
  92. package/dist/test/validator/templateSyntax.spec.js +20 -25
  93. package/dist/test/validator/templateSyntax.spec.js.map +1 -1
  94. package/dist/test/validator/templateValidator.spec.js +118 -89
  95. package/dist/test/validator/templateValidator.spec.js.map +1 -1
  96. package/dist/test/validator/typeidHelper.spec.js +42 -41
  97. package/dist/test/validator/typeidHelper.spec.js.map +1 -1
  98. package/dist/utils.d.ts +17 -13
  99. package/dist/utils.d.ts.map +1 -1
  100. package/dist/utils.js +79 -79
  101. package/dist/utils.js.map +1 -1
  102. package/dist/validationResultBuilder.d.ts +2 -1
  103. package/dist/validationResultBuilder.d.ts.map +1 -1
  104. package/dist/validationResultBuilder.js.map +1 -1
  105. package/lib/ajvFactory.cjs +19 -0
  106. package/lib/ajvFactory.cjs.map +1 -0
  107. package/lib/ajvFactory.d.cts +7 -0
  108. package/lib/ajvFactory.d.cts.map +1 -0
  109. package/lib/changeset.d.ts +3 -6
  110. package/lib/changeset.d.ts.map +1 -1
  111. package/lib/changeset.js +16 -16
  112. package/lib/changeset.js.map +1 -1
  113. package/lib/changeset_operations/array.d.ts +6 -2
  114. package/lib/changeset_operations/array.d.ts.map +1 -1
  115. package/lib/changeset_operations/array.js +7 -9
  116. package/lib/changeset_operations/array.js.map +1 -1
  117. package/lib/changeset_operations/arrayChangesetIterator.d.ts +2 -5
  118. package/lib/changeset_operations/arrayChangesetIterator.d.ts.map +1 -1
  119. package/lib/changeset_operations/arrayChangesetIterator.js +3 -4
  120. package/lib/changeset_operations/arrayChangesetIterator.js.map +1 -1
  121. package/lib/changeset_operations/changesetConflictTypes.d.ts.map +1 -1
  122. package/lib/changeset_operations/changesetConflictTypes.js.map +1 -1
  123. package/lib/changeset_operations/indexedCollection.d.ts +1 -4
  124. package/lib/changeset_operations/indexedCollection.d.ts.map +1 -1
  125. package/lib/changeset_operations/indexedCollection.js +10 -11
  126. package/lib/changeset_operations/indexedCollection.js.map +1 -1
  127. package/lib/changeset_operations/isEmptyChangeset.d.ts +1 -4
  128. package/lib/changeset_operations/isEmptyChangeset.d.ts.map +1 -1
  129. package/lib/changeset_operations/isEmptyChangeset.js +3 -3
  130. package/lib/changeset_operations/isEmptyChangeset.js.map +1 -1
  131. package/lib/helpers/typeidHelper.d.ts +0 -3
  132. package/lib/helpers/typeidHelper.d.ts.map +1 -1
  133. package/lib/helpers/typeidHelper.js +1 -1
  134. package/lib/helpers/typeidHelper.js.map +1 -1
  135. package/lib/index.d.ts +8 -8
  136. package/lib/index.d.ts.map +1 -1
  137. package/lib/index.js +8 -8
  138. package/lib/index.js.map +1 -1
  139. package/lib/isReservedKeyword.d.ts.map +1 -1
  140. package/lib/isReservedKeyword.js.map +1 -1
  141. package/lib/pathHelper.d.ts +0 -3
  142. package/lib/pathHelper.d.ts.map +1 -1
  143. package/lib/pathHelper.js.map +1 -1
  144. package/lib/rebase.js +2 -2
  145. package/lib/rebase.js.map +1 -1
  146. package/lib/templateSchema.d.ts.map +1 -1
  147. package/lib/templateSchema.js.map +1 -1
  148. package/lib/templateValidator.d.ts +1 -1
  149. package/lib/templateValidator.d.ts.map +1 -1
  150. package/lib/templateValidator.js +24 -29
  151. package/lib/templateValidator.js.map +1 -1
  152. package/lib/test/array.spec.js +768 -0
  153. package/lib/test/array.spec.js.map +1 -0
  154. package/lib/test/indexedCollection.spec.js +75 -0
  155. package/lib/test/indexedCollection.spec.js.map +1 -0
  156. package/lib/test/map.spec.js +17 -0
  157. package/lib/test/map.spec.js.map +1 -0
  158. package/lib/test/pathHelper.spec.js +435 -0
  159. package/lib/test/pathHelper.spec.js.map +1 -0
  160. package/lib/test/reversibleCs.spec.js +42 -0
  161. package/lib/test/reversibleCs.spec.js.map +1 -0
  162. package/lib/test/schemaValidator.js +103 -0
  163. package/lib/test/schemaValidator.js.map +1 -0
  164. package/lib/test/schemas/badBothPropertiesAndTypeid.js +24 -0
  165. package/lib/test/schemas/badBothPropertiesAndTypeid.js.map +1 -0
  166. package/lib/test/schemas/badInvalidSemverInTypeid.js +46 -0
  167. package/lib/test/schemas/badInvalidSemverInTypeid.js.map +1 -0
  168. package/lib/test/schemas/badMissingSemverInTypeid.js +46 -0
  169. package/lib/test/schemas/badMissingSemverInTypeid.js.map +1 -0
  170. package/lib/test/schemas/badNestedProperties.js +46 -0
  171. package/lib/test/schemas/badNestedProperties.js.map +1 -0
  172. package/lib/test/schemas/badPrimitiveTypeid.js +31 -0
  173. package/lib/test/schemas/badPrimitiveTypeid.js.map +1 -0
  174. package/lib/test/schemas/badVersionedTypeid.js +47 -0
  175. package/lib/test/schemas/badVersionedTypeid.js.map +1 -0
  176. package/lib/test/schemas/goodColorPalette.js +21 -0
  177. package/lib/test/schemas/goodColorPalette.js.map +1 -0
  178. package/lib/test/schemas/goodDraftAsVersion.js +18 -0
  179. package/lib/test/schemas/goodDraftAsVersion.js.map +1 -0
  180. package/lib/test/schemas/goodPointId.js +46 -0
  181. package/lib/test/schemas/goodPointId.js.map +1 -0
  182. package/lib/test/schemas/goodReferenceAndRegular.js +22 -0
  183. package/lib/test/schemas/goodReferenceAndRegular.js.map +1 -0
  184. package/lib/test/schemas/goodReservedTypes.js +29 -0
  185. package/lib/test/schemas/goodReservedTypes.js.map +1 -0
  186. package/lib/test/schemas/goodUIBorder.js +41 -0
  187. package/lib/test/schemas/goodUIBorder.js.map +1 -0
  188. package/lib/test/schemas/index.js +29 -0
  189. package/lib/test/schemas/index.js.map +1 -0
  190. package/lib/test/tsconfig.tsbuildinfo +1 -0
  191. package/lib/test/validator/templateSyntax.spec.js +83 -0
  192. package/lib/test/validator/templateSyntax.spec.js.map +1 -0
  193. package/lib/test/validator/templateValidator.spec.js +1022 -0
  194. package/lib/test/validator/templateValidator.spec.js.map +1 -0
  195. package/lib/test/validator/typeidHelper.spec.js +142 -0
  196. package/lib/test/validator/typeidHelper.spec.js.map +1 -0
  197. package/lib/utils.d.ts +17 -13
  198. package/lib/utils.d.ts.map +1 -1
  199. package/lib/utils.js +23 -23
  200. package/lib/utils.js.map +1 -1
  201. package/lib/validationResultBuilder.d.ts +2 -1
  202. package/lib/validationResultBuilder.d.ts.map +1 -1
  203. package/lib/validationResultBuilder.js.map +1 -1
  204. package/package.json +37 -16
  205. package/dist/test/tsconfig.tsbuildinfo +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"typeidHelper.js","sourceRoot":"","sources":["../../src/helpers/typeidHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAEH,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEtF,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAgB1B;;;;GAIG;AACH,2DA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,KAAK,aAAa,EAAE;YACpE,OAAO,IAAI,CAAC;SACZ;QAED,IAAI,SAAS,KAAK,cAAc,EAAE;YACjC,OAAO,KAAK,CAAC;SACb;QAED,IAAI,OAAO,GAAG,WAAW,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC,CAAC;QAEjD,6DAA6D;QAC7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACxC,IAAI,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE;gBACvD,OAAO,IAAI,CAAC;aACZ;SACD;QACD,OAAO,KAAK,CAAC;IACd,CAAC;IAtCe,+BAAkB,qBAsCjC,CAAA;IAED;;;;;OAKG;IACH,SAAgB,mBAAmB;QAClC,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;IAFe,gCAAmB,sBAElC,CAAA;IAED;;;;;OAKG;IACH,SAAgB,kBAAkB;QACjC,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAFe,+BAAkB,qBAEjC,CAAA;AACF,CAAC,EA7QgB,YAAY,KAAZ,YAAY,QA6Q5B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to work with typeid strings\n */\n\n// @ts-ignore\nimport { constants } from \"@fluid-experimental/property-common\";\nimport { TemplateSchema as templateSchemaJson, NativeTypes } from \"../templateSchema\";\n\nconst { MSG } = constants;\n\nexport declare interface ExtractedVersion {\n\tversion: string;\n\ttypeidWithoutVersion: string;\n}\n\n/**\n * @internal\n */\nexport declare interface ExtractedContext {\n\ttypeid: string;\n\tcontext: string;\n\tisEnum: boolean;\n}\n\n/**\n * Helper for Type IDs\n * @description Helper functions to work with typeid strings\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace TypeIdHelper {\n\t/**\n\t * Checks whether the given type is a primitive type.\n\t *\n\t * @param in_typeid - The typeid we want to check\n\t * @returns Is this a base type?\n\t * @internal\n\t */\n\texport function isPrimitiveType(in_typeid: string): boolean {\n\t\tconst primitiveTypes = templateSchemaJson[\"$defs\"][\"primitive-typeid\"][\"enum\"];\n\n\t\tif (in_typeid === undefined || in_typeid === \"\") {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn (\n\t\t\tin_typeid.substr(0, 5) === \"enum<\" ||\n\t\t\tin_typeid.substr(0, 10) === \"Reference<\" ||\n\t\t\tprimitiveTypes.indexOf(in_typeid) >= 0\n\t\t);\n\t}\n\n\t/**\n\t * Checks whether the given type is a template typeid.\n\t *\n\t * @param in_typeid - The typeid we want to check\n\t * @returns Is this a base template typeid?\n\t * @internal\n\t */\n\texport function isTemplateTypeid(in_typeid: string): boolean {\n\t\treturn in_typeid.indexOf(\":\") !== -1;\n\t}\n\n\t/**\n\t * Checks whether the given type is a reserved type.\n\t *\n\t * @param in_typeid - The typeid we want to check\n\t * @returns Is this a reserved type?\n\t * @internal\n\t */\n\texport function isReservedType(in_typeid: string): boolean {\n\t\tconst reservedTypes = templateSchemaJson[\"$defs\"][\"reserved-typeid\"][\"enum\"];\n\t\treturn reservedTypes.indexOf(in_typeid) >= 0;\n\t}\n\n\t/**\n\t * Extract the version number from the given typeid\n\t * @param in_typeid - The typeid to check against\n\t * @returns Extracted version\n\t * @internal\n\t */\n\texport function extractVersion(in_typeid): ExtractedVersion {\n\t\tif (!in_typeid) {\n\t\t\tthrow new Error(MSG.TYPEID_NOT_DEFINED);\n\t\t}\n\t\tconst splitTypeId = in_typeid.split(\"-\");\n\n\t\treturn {\n\t\t\tversion: splitTypeId[1],\n\t\t\ttypeidWithoutVersion: splitTypeId[0],\n\t\t};\n\t}\n\n\t/**\n\t * Extracts the context from a typeid\n\t *\n\t * @param in_typeid - The typeid to process\n\t * @returns The typeid without context, the context and if we have an enum type\n\t * @internal\n\t */\n\texport function extractContext(in_typeid: string | undefined): ExtractedContext {\n\t\tconst bracketIndex = in_typeid.indexOf(\"<\");\n\t\tif (bracketIndex !== -1 && in_typeid.endsWith(\">\")) {\n\t\t\tlet typeid = in_typeid.substr(bracketIndex + 1, in_typeid.length - bracketIndex - 2);\n\t\t\tlet context = in_typeid.substr(0, bracketIndex);\n\n\t\t\t// Special case to handle collections without a typeid (e.g. \"map<>\", which should\n\t\t\t// be able to support all property types\n\t\t\tif (typeid === \"\") {\n\t\t\t\ttypeid = context !== \"set\" ? \"BaseProperty\" : \"NamedProperty\";\n\t\t\t}\n\n\t\t\t// Special case to handle enums (e.g. array<enum<myType>>)\n\t\t\tlet isEnum = false;\n\t\t\tif (context === \"enum\" || typeid.substr(0, 5) === \"enum<\") {\n\t\t\t\tisEnum = true;\n\t\t\t\tif (context === \"enum\") {\n\t\t\t\t\tcontext = \"single\";\n\t\t\t\t} else {\n\t\t\t\t\t// remove the `enum<...>` tag to get the raw typeid\n\t\t\t\t\ttypeid = typeid.substr(5, typeid.length - 6);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (context === \"Reference\") {\n\t\t\t\ttypeid = `Reference<${typeid}>`;\n\t\t\t\tcontext = \"single\";\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttypeid,\n\t\t\t\tcontext,\n\t\t\t\tisEnum,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\ttypeid: in_typeid,\n\t\t\t\tcontext: \"single\",\n\t\t\t\tisEnum: false,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Creates a collection typeid string from the\n\t * typeid and the context.\n\t *\n\t * @param in_typeid - The typeid in the collection\n\t * @param in_context - The context\n\t * @param in_enum - Set to true if the type should get an enum tag\n\t *\n\t * @returns The combined typeid string\n\t * @internal\n\t */\n\texport function createSerializationTypeId(\n\t\tin_typeid: string,\n\t\tin_context: string,\n\t\tin_enum: boolean,\n\t): string {\n\t\t// in_enum\n\t\tif (in_typeid === \"BaseProperty\") {\n\t\t\t// Special case for BaseProperties. These get represented as a collection\n\t\t\t// typeid without a child typeid. E.g. map<> instead of map<BaseProperty>\n\t\t\treturn `${in_context}<>`;\n\t\t} else {\n\t\t\tif (in_enum) {\n\t\t\t\treturn in_context === \"\" || in_context === \"single\"\n\t\t\t\t\t? `enum<${in_typeid}>`\n\t\t\t\t\t: `${in_context}<enum<${in_typeid}>>`;\n\t\t\t} else {\n\t\t\t\treturn `${in_context}<${in_typeid}>`;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks, whether the supplied typeid is a reference property type id\n\t *\n\t * @param in_typeid - The typeid to check\n\t * @returns Is this a reference property typeid?\n\t * @internal\n\t */\n\texport function isReferenceTypeId(in_typeid: string | undefined): boolean {\n\t\t// in_enum\n\t\treturn (\n\t\t\tin_typeid === \"Reference\" ||\n\t\t\t(in_typeid.substr(0, 10) === \"Reference<\" && in_typeid.substr(-1) === \">\")\n\t\t);\n\t}\n\n\t/**\n\t * Returns the type of the properties a reference points to\n\t *\n\t * @param in_typeid - The typeid to process\n\t * @return The type of the referenced property\n\t * @internal\n\t */\n\texport function extractReferenceTargetTypeIdFromReference(in_typeid: string): string {\n\t\t// in_enum\n\t\treturn in_typeid.substr(0, 10) === \"Reference<\"\n\t\t\t? in_typeid.substr(10, in_typeid.length - 11)\n\t\t\t: \"BaseProperty\";\n\t}\n\n\t/**\n\t * Checks whether the given type is a template typeid.\n\t *\n\t * @param in_typeid - The typeid we want to check\n\t * @returns Is this a base template typeid?\n\t * @internal\n\t */\n\texport function isSchemaTypeid(in_typeid: string): boolean {\n\t\treturn typeof in_typeid === \"string\" && in_typeid.indexOf(\":\") !== -1;\n\t}\n\n\t/**\n\t * Extracts referenced typeid from input typeid\n\t *\n\t * @param in_typeid - typeid\n\t *\n\t * @return referenced typeid or in_param if it is not a reference\n\t * @internal\n\t */\n\texport function extractTypeId(in_typeid): string {\n\t\tconst matches = in_typeid.match(/\\<(.*?)\\>/);\n\t\treturn matches !== null && matches.length > 0\n\t\t\t? matches[0].replace(/[\\<\\>]/gi, \"\")\n\t\t\t: in_typeid;\n\t}\n\n\t/**\n\t * Check wether the in_typeid inherits from the in_baseTypeid.\n\t *\n\t * @remarks Note: By default, this also returns true if in_typeid === in_baseTypeid.\n\t *\n\t * @param in_typeid - Typeid for which we want to check, whethwe in_baseTypeid is a parent.\n\t * @param in_baseTypeid - The base typeId to check for.\n\t * @throws If in_typeid or in_baseTypeid are not native typeid.\n\t * @returns True if in_baseTypeid is a parent of in_typeid.\n\t * @internal\n\t */\n\texport function nativeInheritsFrom(in_typeid: string, in_baseTypeid: string): boolean {\n\t\tif (!in_typeid || !in_baseTypeid) {\n\t\t\tthrow new Error(MSG.TYPEID_NOT_DEFINED);\n\t\t}\n\n\t\tif (in_typeid.substr(0, 10) === \"Reference<\") {\n\t\t\tin_typeid = \"Reference\";\n\t\t}\n\n\t\tif (in_baseTypeid.substr(0, 10) === \"Reference<\") {\n\t\t\tin_baseTypeid = \"Reference\";\n\t\t}\n\n\t\tif (!NativeTypes[in_typeid]) {\n\t\t\tthrow new Error(MSG.TYPEID_NOT_NATIVE + in_typeid);\n\t\t}\n\n\t\tif (!NativeTypes[in_baseTypeid]) {\n\t\t\tthrow new Error(MSG.TYPEID_NOT_NATIVE + in_baseTypeid);\n\t\t}\n\n\t\tif (in_baseTypeid === \"BaseProperty\" || in_typeid === in_baseTypeid) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (in_typeid === \"BaseProperty\") {\n\t\t\treturn false;\n\t\t}\n\n\t\tlet parents = NativeTypes[in_typeid][\"inherits\"];\n\n\t\t// recursively call the function for the parent of the typeid\n\t\tfor (let i = 0; i < parents.length; i++) {\n\t\t\tif (this.nativeInheritsFrom(parents[i], in_baseTypeid)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * return all primitive typeIds\n\t *\n\t * @returns return a list of primitiveTypeIds\n\t * @internal\n\t */\n\texport function getPrimitiveTypeIds(): string[] {\n\t\treturn templateSchemaJson[\"$defs\"][\"primitive-typeid\"][\"enum\"];\n\t}\n\n\t/**\n\t * return all reserved typeIds\n\t *\n\t * @returns return a list of reservedTypeIds\n\t * @internal\n\t */\n\texport function getReservedTypeIds(): string[] {\n\t\treturn templateSchemaJson[\"$defs\"][\"reserved-typeid\"][\"enum\"];\n\t}\n}\n"]}
1
+ {"version":3,"file":"typeidHelper.js","sourceRoot":"","sources":["../../src/helpers/typeidHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,OAAO,EAAE,WAAW,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAEzF,MAAM,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAgB1B;;;;GAIG;AACH,2DAA2D;AAC3D,MAAM,KAAW,YAAY,CA6Q5B;AA7QD,WAAiB,YAAY;IAC5B;;;;;;OAMG;IACH,SAAgB,eAAe,CAAC,SAAiB;QAChD,MAAM,cAAc,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;QAE/E,IAAI,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,EAAE,EAAE;YAChD,OAAO,KAAK,CAAC;SACb;QAED,OAAO,CACN,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,OAAO;YAClC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,YAAY;YACxC,cAAc,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CACtC,CAAC;IACH,CAAC;IAZe,4BAAe,kBAY9B,CAAA;IAED;;;;;;OAMG;IACH,SAAgB,gBAAgB,CAAC,SAAi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,CAAC,CAAC;IAChE,CAAC;IAFe,gCAAmB,sBAElC,CAAA;IAED;;;;;OAKG;IACH,SAAgB,kBAAkB;QACjC,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/D,CAAC;IAFe,+BAAkB,qBAEjC,CAAA;AACF,CAAC,EA7QgB,YAAY,KAAZ,YAAY,QA6Q5B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Helper functions to work with typeid strings\n */\n\n// @ts-ignore\nimport { constants } from \"@fluid-experimental/property-common\";\n\nimport { NativeTypes, TemplateSchema as templateSchemaJson } from \"../templateSchema.js\";\n\nconst { MSG } = constants;\n\nexport declare interface ExtractedVersion {\n\tversion: string;\n\ttypeidWithoutVersion: string;\n}\n\n/**\n * @internal\n */\nexport declare interface ExtractedContext {\n\ttypeid: string;\n\tcontext: string;\n\tisEnum: boolean;\n}\n\n/**\n * Helper for Type IDs\n * @description Helper functions to work with typeid strings\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace TypeIdHelper {\n\t/**\n\t * Checks whether the given type is a primitive type.\n\t *\n\t * @param in_typeid - The typeid we want to check\n\t * @returns Is this a base type?\n\t * @internal\n\t */\n\texport function isPrimitiveType(in_typeid: string): boolean {\n\t\tconst primitiveTypes = templateSchemaJson[\"$defs\"][\"primitive-typeid\"][\"enum\"];\n\n\t\tif (in_typeid === undefined || in_typeid === \"\") {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn (\n\t\t\tin_typeid.substr(0, 5) === \"enum<\" ||\n\t\t\tin_typeid.substr(0, 10) === \"Reference<\" ||\n\t\t\tprimitiveTypes.indexOf(in_typeid) >= 0\n\t\t);\n\t}\n\n\t/**\n\t * Checks whether the given type is a template typeid.\n\t *\n\t * @param in_typeid - The typeid we want to check\n\t * @returns Is this a base template typeid?\n\t * @internal\n\t */\n\texport function isTemplateTypeid(in_typeid: string): boolean {\n\t\treturn in_typeid.indexOf(\":\") !== -1;\n\t}\n\n\t/**\n\t * Checks whether the given type is a reserved type.\n\t *\n\t * @param in_typeid - The typeid we want to check\n\t * @returns Is this a reserved type?\n\t * @internal\n\t */\n\texport function isReservedType(in_typeid: string): boolean {\n\t\tconst reservedTypes = templateSchemaJson[\"$defs\"][\"reserved-typeid\"][\"enum\"];\n\t\treturn reservedTypes.indexOf(in_typeid) >= 0;\n\t}\n\n\t/**\n\t * Extract the version number from the given typeid\n\t * @param in_typeid - The typeid to check against\n\t * @returns Extracted version\n\t * @internal\n\t */\n\texport function extractVersion(in_typeid): ExtractedVersion {\n\t\tif (!in_typeid) {\n\t\t\tthrow new Error(MSG.TYPEID_NOT_DEFINED);\n\t\t}\n\t\tconst splitTypeId = in_typeid.split(\"-\");\n\n\t\treturn {\n\t\t\tversion: splitTypeId[1],\n\t\t\ttypeidWithoutVersion: splitTypeId[0],\n\t\t};\n\t}\n\n\t/**\n\t * Extracts the context from a typeid\n\t *\n\t * @param in_typeid - The typeid to process\n\t * @returns The typeid without context, the context and if we have an enum type\n\t * @internal\n\t */\n\texport function extractContext(in_typeid: string | undefined): ExtractedContext {\n\t\tconst bracketIndex = in_typeid.indexOf(\"<\");\n\t\tif (bracketIndex !== -1 && in_typeid.endsWith(\">\")) {\n\t\t\tlet typeid = in_typeid.substr(bracketIndex + 1, in_typeid.length - bracketIndex - 2);\n\t\t\tlet context = in_typeid.substr(0, bracketIndex);\n\n\t\t\t// Special case to handle collections without a typeid (e.g. \"map<>\", which should\n\t\t\t// be able to support all property types\n\t\t\tif (typeid === \"\") {\n\t\t\t\ttypeid = context !== \"set\" ? \"BaseProperty\" : \"NamedProperty\";\n\t\t\t}\n\n\t\t\t// Special case to handle enums (e.g. array<enum<myType>>)\n\t\t\tlet isEnum = false;\n\t\t\tif (context === \"enum\" || typeid.substr(0, 5) === \"enum<\") {\n\t\t\t\tisEnum = true;\n\t\t\t\tif (context === \"enum\") {\n\t\t\t\t\tcontext = \"single\";\n\t\t\t\t} else {\n\t\t\t\t\t// remove the `enum<...>` tag to get the raw typeid\n\t\t\t\t\ttypeid = typeid.substr(5, typeid.length - 6);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (context === \"Reference\") {\n\t\t\t\ttypeid = `Reference<${typeid}>`;\n\t\t\t\tcontext = \"single\";\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttypeid,\n\t\t\t\tcontext,\n\t\t\t\tisEnum,\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\ttypeid: in_typeid,\n\t\t\t\tcontext: \"single\",\n\t\t\t\tisEnum: false,\n\t\t\t};\n\t\t}\n\t}\n\n\t/**\n\t * Creates a collection typeid string from the\n\t * typeid and the context.\n\t *\n\t * @param in_typeid - The typeid in the collection\n\t * @param in_context - The context\n\t * @param in_enum - Set to true if the type should get an enum tag\n\t *\n\t * @returns The combined typeid string\n\t * @internal\n\t */\n\texport function createSerializationTypeId(\n\t\tin_typeid: string,\n\t\tin_context: string,\n\t\tin_enum: boolean,\n\t): string {\n\t\t// in_enum\n\t\tif (in_typeid === \"BaseProperty\") {\n\t\t\t// Special case for BaseProperties. These get represented as a collection\n\t\t\t// typeid without a child typeid. E.g. map<> instead of map<BaseProperty>\n\t\t\treturn `${in_context}<>`;\n\t\t} else {\n\t\t\tif (in_enum) {\n\t\t\t\treturn in_context === \"\" || in_context === \"single\"\n\t\t\t\t\t? `enum<${in_typeid}>`\n\t\t\t\t\t: `${in_context}<enum<${in_typeid}>>`;\n\t\t\t} else {\n\t\t\t\treturn `${in_context}<${in_typeid}>`;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks, whether the supplied typeid is a reference property type id\n\t *\n\t * @param in_typeid - The typeid to check\n\t * @returns Is this a reference property typeid?\n\t * @internal\n\t */\n\texport function isReferenceTypeId(in_typeid: string | undefined): boolean {\n\t\t// in_enum\n\t\treturn (\n\t\t\tin_typeid === \"Reference\" ||\n\t\t\t(in_typeid.substr(0, 10) === \"Reference<\" && in_typeid.substr(-1) === \">\")\n\t\t);\n\t}\n\n\t/**\n\t * Returns the type of the properties a reference points to\n\t *\n\t * @param in_typeid - The typeid to process\n\t * @return The type of the referenced property\n\t * @internal\n\t */\n\texport function extractReferenceTargetTypeIdFromReference(in_typeid: string): string {\n\t\t// in_enum\n\t\treturn in_typeid.substr(0, 10) === \"Reference<\"\n\t\t\t? in_typeid.substr(10, in_typeid.length - 11)\n\t\t\t: \"BaseProperty\";\n\t}\n\n\t/**\n\t * Checks whether the given type is a template typeid.\n\t *\n\t * @param in_typeid - The typeid we want to check\n\t * @returns Is this a base template typeid?\n\t * @internal\n\t */\n\texport function isSchemaTypeid(in_typeid: string): boolean {\n\t\treturn typeof in_typeid === \"string\" && in_typeid.indexOf(\":\") !== -1;\n\t}\n\n\t/**\n\t * Extracts referenced typeid from input typeid\n\t *\n\t * @param in_typeid - typeid\n\t *\n\t * @return referenced typeid or in_param if it is not a reference\n\t * @internal\n\t */\n\texport function extractTypeId(in_typeid): string {\n\t\tconst matches = in_typeid.match(/\\<(.*?)\\>/);\n\t\treturn matches !== null && matches.length > 0\n\t\t\t? matches[0].replace(/[\\<\\>]/gi, \"\")\n\t\t\t: in_typeid;\n\t}\n\n\t/**\n\t * Check wether the in_typeid inherits from the in_baseTypeid.\n\t *\n\t * @remarks Note: By default, this also returns true if in_typeid === in_baseTypeid.\n\t *\n\t * @param in_typeid - Typeid for which we want to check, whethwe in_baseTypeid is a parent.\n\t * @param in_baseTypeid - The base typeId to check for.\n\t * @throws If in_typeid or in_baseTypeid are not native typeid.\n\t * @returns True if in_baseTypeid is a parent of in_typeid.\n\t * @internal\n\t */\n\texport function nativeInheritsFrom(in_typeid: string, in_baseTypeid: string): boolean {\n\t\tif (!in_typeid || !in_baseTypeid) {\n\t\t\tthrow new Error(MSG.TYPEID_NOT_DEFINED);\n\t\t}\n\n\t\tif (in_typeid.substr(0, 10) === \"Reference<\") {\n\t\t\tin_typeid = \"Reference\";\n\t\t}\n\n\t\tif (in_baseTypeid.substr(0, 10) === \"Reference<\") {\n\t\t\tin_baseTypeid = \"Reference\";\n\t\t}\n\n\t\tif (!NativeTypes[in_typeid]) {\n\t\t\tthrow new Error(MSG.TYPEID_NOT_NATIVE + in_typeid);\n\t\t}\n\n\t\tif (!NativeTypes[in_baseTypeid]) {\n\t\t\tthrow new Error(MSG.TYPEID_NOT_NATIVE + in_baseTypeid);\n\t\t}\n\n\t\tif (in_baseTypeid === \"BaseProperty\" || in_typeid === in_baseTypeid) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif (in_typeid === \"BaseProperty\") {\n\t\t\treturn false;\n\t\t}\n\n\t\tlet parents = NativeTypes[in_typeid][\"inherits\"];\n\n\t\t// recursively call the function for the parent of the typeid\n\t\tfor (let i = 0; i < parents.length; i++) {\n\t\t\tif (this.nativeInheritsFrom(parents[i], in_baseTypeid)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * return all primitive typeIds\n\t *\n\t * @returns return a list of primitiveTypeIds\n\t * @internal\n\t */\n\texport function getPrimitiveTypeIds(): string[] {\n\t\treturn templateSchemaJson[\"$defs\"][\"primitive-typeid\"][\"enum\"];\n\t}\n\n\t/**\n\t * return all reserved typeIds\n\t *\n\t * @returns return a list of reservedTypeIds\n\t * @internal\n\t */\n\texport function getReservedTypeIds(): string[] {\n\t\treturn templateSchemaJson[\"$defs\"][\"reserved-typeid\"][\"enum\"];\n\t}\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -2,14 +2,14 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ChangeSet, SerializedChangeSet } from "./changeset";
6
- import { ArrayChangeSetIterator } from "./changeset_operations/arrayChangesetIterator";
7
- import { ExtractedContext, TypeIdHelper } from "./helpers/typeidHelper";
8
- import { PathHelper } from "./pathHelper";
9
- import { rebaseToRemoteChanges } from "./rebase";
10
- import { TemplateSchema } from "./templateSchema";
11
- import { TemplateValidator } from "./templateValidator";
12
- import { Utils } from "./utils";
5
+ import { ChangeSet, SerializedChangeSet } from "./changeset.js";
6
+ import { ArrayChangeSetIterator } from "./changeset_operations/arrayChangesetIterator.js";
7
+ import { ExtractedContext, TypeIdHelper } from "./helpers/typeidHelper.js";
8
+ import { PathHelper } from "./pathHelper.js";
9
+ import { rebaseToRemoteChanges } from "./rebase.js";
10
+ import { TemplateSchema } from "./templateSchema.js";
11
+ import { TemplateValidator } from "./templateValidator.js";
12
+ import { Utils } from "./utils.js";
13
13
  /**
14
14
  * @internal
15
15
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;GAEG;AACH,QAAA,MAAQ,gBAAgB,+BAAU,CAAC;AAEnC,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GAChB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;GAEG;AACH,QAAA,MAAQ,gBAAgB,+BAAU,CAAC;AAEnC,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GAChB,CAAC"}
package/lib/index.js CHANGED
@@ -2,14 +2,14 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- import { ChangeSet } from "./changeset";
6
- import { ArrayChangeSetIterator } from "./changeset_operations/arrayChangesetIterator";
7
- import { TypeIdHelper } from "./helpers/typeidHelper";
8
- import { PathHelper } from "./pathHelper";
9
- import { rebaseToRemoteChanges } from "./rebase";
10
- import { TemplateSchema } from "./templateSchema";
11
- import { TemplateValidator } from "./templateValidator";
12
- import { Utils } from "./utils";
5
+ import { ChangeSet } from "./changeset.js";
6
+ import { ArrayChangeSetIterator } from "./changeset_operations/arrayChangesetIterator.js";
7
+ import { TypeIdHelper } from "./helpers/typeidHelper.js";
8
+ import { PathHelper } from "./pathHelper.js";
9
+ import { rebaseToRemoteChanges } from "./rebase.js";
10
+ import { TemplateSchema } from "./templateSchema.js";
11
+ import { TemplateValidator } from "./templateValidator.js";
12
+ import { Utils } from "./utils.js";
13
13
  /**
14
14
  * @internal
15
15
  */
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAuB,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAoB,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAEhC;;GAEG;AACH,MAAM,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;AAEnC,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EAErB,gBAAgB,GAEhB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { ChangeSet, SerializedChangeSet } from \"./changeset\";\nimport { ArrayChangeSetIterator } from \"./changeset_operations/arrayChangesetIterator\";\nimport { ExtractedContext, TypeIdHelper } from \"./helpers/typeidHelper\";\nimport { PathHelper } from \"./pathHelper\";\nimport { rebaseToRemoteChanges } from \"./rebase\";\nimport { TemplateSchema } from \"./templateSchema\";\nimport { TemplateValidator } from \"./templateValidator\";\nimport { Utils } from \"./utils\";\n\n/**\n * @internal\n */\nconst { TraversalContext } = Utils;\n\nexport {\n\tTemplateSchema,\n\tTemplateValidator,\n\tTypeIdHelper,\n\tChangeSet,\n\tUtils,\n\tPathHelper,\n\tArrayChangeSetIterator,\n\trebaseToRemoteChanges,\n\tSerializedChangeSet,\n\tTraversalContext,\n\tExtractedContext,\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAuB,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,EAAoB,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC;;GAEG;AACH,MAAM,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;AAEnC,OAAO,EACN,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,SAAS,EACT,KAAK,EACL,UAAU,EACV,sBAAsB,EACtB,qBAAqB,EAErB,gBAAgB,GAEhB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ChangeSet, SerializedChangeSet } from \"./changeset.js\";\nimport { ArrayChangeSetIterator } from \"./changeset_operations/arrayChangesetIterator.js\";\nimport { ExtractedContext, TypeIdHelper } from \"./helpers/typeidHelper.js\";\nimport { PathHelper } from \"./pathHelper.js\";\nimport { rebaseToRemoteChanges } from \"./rebase.js\";\nimport { TemplateSchema } from \"./templateSchema.js\";\nimport { TemplateValidator } from \"./templateValidator.js\";\nimport { Utils } from \"./utils.js\";\n\n/**\n * @internal\n */\nconst { TraversalContext } = Utils;\n\nexport {\n\tTemplateSchema,\n\tTemplateValidator,\n\tTypeIdHelper,\n\tChangeSet,\n\tUtils,\n\tPathHelper,\n\tArrayChangeSetIterator,\n\trebaseToRemoteChanges,\n\tSerializedChangeSet,\n\tTraversalContext,\n\tExtractedContext,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"isReservedKeyword.d.ts","sourceRoot":"","sources":["../src/isReservedKeyword.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,OAKtB,CAAC"}
1
+ {"version":3,"file":"isReservedKeyword.d.ts","sourceRoot":"","sources":["../src/isReservedKeyword.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,WAAY,MAAM,KAAG,OAKtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"isReservedKeyword.js","sourceRoot":"","sources":["../src/isReservedKeyword.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAW,EAAE,CAC5D,MAAM,KAAK,QAAQ;IACnB,MAAM,KAAK,QAAQ;IACnB,MAAM,KAAK,QAAQ;IACnB,MAAM,KAAK,QAAQ;IACnB,MAAM,KAAK,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * Checks whether the given key from a ChangeSet is not a typeid, but one of the\n * reserved keywords.\n *\n * @ignore\n * @param in_key - The key to check\n * @returns True if it is a reserved keyword\n */\nexport const isReservedKeyword = (in_key: string): boolean =>\n\tin_key === \"insert\" ||\n\tin_key === \"remove\" ||\n\tin_key === \"modify\" ||\n\tin_key === \"typeid\" ||\n\tin_key === \"insertTemplates\";\n"]}
1
+ {"version":3,"file":"isReservedKeyword.js","sourceRoot":"","sources":["../src/isReservedKeyword.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAW,EAAE,CAC5D,MAAM,KAAK,QAAQ;IACnB,MAAM,KAAK,QAAQ;IACnB,MAAM,KAAK,QAAQ;IACnB,MAAM,KAAK,QAAQ;IACnB,MAAM,KAAK,iBAAiB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * Checks whether the given key from a ChangeSet is not a typeid, but one of the\n * reserved keywords.\n *\n * @ignore\n * @param in_key - The key to check\n * @returns True if it is a reserved keyword\n */\nexport const isReservedKeyword = (in_key: string): boolean =>\n\tin_key === \"insert\" ||\n\tin_key === \"remove\" ||\n\tin_key === \"modify\" ||\n\tin_key === \"typeid\" ||\n\tin_key === \"insertTemplates\";\n"]}
@@ -2,9 +2,6 @@
2
2
  * Copyright (c) Microsoft Corporation and contributors. All rights reserved.
3
3
  * Licensed under the MIT License.
4
4
  */
5
- /**
6
- * @fileoverview Helper functions to work with path strings
7
- */
8
5
  export type PathTree = Map<String, PathTree>;
9
6
  /**
10
7
  * Helper functions for string processing
@@ -1 +1 @@
1
- {"version":3,"file":"pathHelper.d.ts","sourceRoot":"","sources":["../src/pathHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAOH,MAAM,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAE7C;;;GAGG;AAEH,yBAAiB,UAAU,CAAC;IAG3B;;;;OAIG;IACH,MAAM,MAAM,WAAW;QACtB,6CAA6C;QAC7C,kBAAkB,IAAA;QAClB,+CAA+C;QAC/C,WAAW,IAAA;QACX,uCAAuC;QACvC,eAAe,IAAA;QACf,mDAAmD,CACnD,iBAAiB,IAAA;QACjB,2DAA2D;QAC3D,iBAAiB,IAAA;KACjB;IAED;;;;;;;;OAQG;IACH,MAAM,C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,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACzC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;gBACxC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;aACxB;SACD;QACD,IAAI,KAAK,CAAC,MAAM,EAAE;YACjB,+DAA+D;YAC/D,OAAO;gBACN,cAAc,EAAE,cAAc,CAAC,cAAc;gBAC7C,QAAQ,EAAE,KAAK;aACf,CAAC;SACF;QAED,yDAAyD;QACzD,OAAO;YACN,cAAc,EAAE,cAAc,CAAC,SAAS;YACxC,QAAQ,EAAE,KAAK;SACf,CAAC;IACH,CAAC,CAAC;AACH,CAAC,EA7gBgB,UAAU,KAAV,UAAU,QA6gB1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to work with path strings\n */\n\n// @ts-ignore\nimport { constants } from \"@fluid-experimental/property-common\";\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\nexport type PathTree = Map<String, PathTree>;\n\n/**\n * Helper functions for string processing\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace PathHelper {\n\tconst RE_ALL_OPEN_SQUARE_BRACKETS = new RegExp(\"[[]\", \"g\");\n\n\t/**\n\t * Token Types\n\t * Type of the token in the path string\n\t * @internal\n\t */\n\texport enum TOKEN_TYPES {\n\t\t/** A normal path segment, separated via . */\n\t\tPATH_SEGMENT_TOKEN,\n\t\t/** An array path segment, separated via [ ] */\n\t\tARRAY_TOKEN,\n\t\t/** A / at the beginning of the path */\n\t\tPATH_ROOT_TOKEN,\n\t\t/** A * that indicates a dereferencing operation */ // note: reversed!\n\t\tDEREFERENCE_TOKEN,\n\t\t/** A ../ that indicates one step above the current path */\n\t\tRAISE_LEVEL_TOKEN,\n\t}\n\n\t/**\n\t * Tokenizes a path string\n\t *\n\t * @param in_path - The path string to divide into tokens\n\t * @param out_types - The types of the tokens\n\t *\n\t * @returns the tokens from the path string\n\t * @internal\n\t */\n\texport const tokenizePathString = function (\n\t\tin_path: string,\n\t\tout_types?: TOKEN_TYPES[],\n\t): string[] {\n\t\tconst tokens = [];\n\t\tlet currentToken = \"\";\n\n\t\tif (out_types) {\n\t\t\t// Make sure out_types is empty\n\t\t\tout_types.splice(0, out_types.length);\n\t\t}\n\n\t\t// Handle a / at the beginning of the path by adding a special token for it\n\t\tlet path_start = 0;\n\t\tif (in_path.startsWith(\"/\")) {\n\t\t\ttokens.push(\"/\");\n\t\t\tif (out_types) {\n\t\t\t\tout_types.push(TOKEN_TYPES.PATH_ROOT_TOKEN);\n\t\t\t}\n\t\t\tpath_start = 1;\n\t\t} else if (in_path.substr(0, 3) === \"../\") {\n\t\t\t// Handle relative paths by extracting the number steps above\n\t\t\tvar extractLevel = function (current_path) {\n\t\t\t\tif (current_path.substr(0, 3) === \"../\") {\n\t\t\t\t\tif (out_types) {\n\t\t\t\t\t\tout_types.push(TOKEN_TYPES.RAISE_LEVEL_TOKEN);\n\t\t\t\t\t}\n\t\t\t\t\ttokens.push(\"../\");\n\t\t\t\t\textractLevel(current_path.substr(3));\n\t\t\t\t\tpath_start = path_start + 3;\n\t\t\t\t}\n\t\t\t};\n\t\t\textractLevel(in_path);\n\t\t}\n\n\t\t// Let's see if the path is simple enough to use a fast-track algorithm.\n\t\tlet hackedPath = in_path.substr(path_start);\n\t\tif (\n\t\t\tin_path.indexOf(\"\\\\\") === -1 &&\n\t\t\tin_path.indexOf('\"') === -1 &&\n\t\t\tin_path.indexOf(\"*\") === -1\n\t\t) {\n\t\t\t// Yes, we can do something faster than parsing each character one by one.\n\t\t\tlet additionalTokens: string[] = [];\n\t\t\tconst additionalTypes = [];\n\t\t\tlet token: string | string[];\n\t\t\tlet i: number;\n\t\t\t// Hack for simplicity, let's first replace all occurences of '[' by '.['\n\t\t\thackedPath = hackedPath.replace(RE_ALL_OPEN_SQUARE_BRACKETS, \".[\");\n\t\t\t// Then split on '.'\n\t\t\tadditionalTokens = hackedPath.split(\".\");\n\t\t\t// And validate each token.\n\t\t\tfor (i = 0; i < additionalTokens.length; ++i) {\n\t\t\t\ttoken = additionalTokens[i];\n\t\t\t\t// Empty tokens are considered errors... but shouldn't '' be a valid name?\n\t\t\t\tif (token.length === 0) {\n\t\t\t\t\t// There's an error somewhere. Let's abort the fast-track.\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (token.startsWith(\"[\")) {\n\t\t\t\t\tif (token.length > 2 && token.endsWith(\"]\")) {\n\t\t\t\t\t\tadditionalTypes.push(TOKEN_TYPES.ARRAY_TOKEN);\n\t\t\t\t\t\tadditionalTokens[i] = token.substr(1, token.length - 2);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// There's an error somewhere. Let's abort the fast-track.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (token.indexOf(\"]\") !== -1) {\n\t\t\t\t\t\t// There's an error somewhere. Let's abort the fast-track.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// It was a simple property name.\n\t\t\t\t\t\tadditionalTypes.push(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i === additionalTokens.length) {\n\t\t\t\t// Parsed everything successfully so end function here.\n\t\t\t\tif (out_types) {\n\t\t\t\t\tfor (i = 0; i < additionalTypes.length; i++) {\n\t\t\t\t\t\tout_types.push(additionalTypes[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn tokens.concat(additionalTokens);\n\t\t\t}\n\t\t}\n\n\t\tlet inSquareBrackets = false;\n\t\tlet tokenStarted = false;\n\t\tlet lastTokenWasQuoted = false;\n\n\t\t// We are in a context where an empty token is valid\n\t\tlet atStartToken = false;\n\t\tlet allowSegmentStart = true;\n\n\t\tconst storeNextToken = function (tokenType) {\n\t\t\t// Make sure, this is not an empty token (E.g. a .. or a [] )\n\t\t\tif (!tokenStarted) {\n\t\t\t\tif (!atStartToken) {\n\t\t\t\t\tthrow new Error(MSG.EMPTY_TOKEN + in_path);\n\t\t\t\t} else {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Store the token\n\t\t\ttokens.push(currentToken);\n\t\t\tcurrentToken = \"\";\n\t\t\ttokenStarted = false;\n\t\t\tatStartToken = false;\n\t\t\tlastTokenWasQuoted = false;\n\t\t\tallowSegmentStart = false;\n\n\t\t\tif (out_types) {\n\t\t\t\tout_types.push(tokenType);\n\t\t\t}\n\t\t};\n\n\t\tfor (var i = path_start; i < in_path.length; i++) {\n\t\t\tconst character = in_path[i];\n\n\t\t\tif (character === '\"') {\n\t\t\t\t// If we encounter a quotation mark, we start parsing the\n\t\t\t\t// quoted section\n\t\t\t\tif (!tokenStarted) {\n\t\t\t\t\tlet endFound = false;\n\n\t\t\t\t\t// Read the quoted token\n\t\t\t\t\tfor (i++; i < in_path.length; i++) {\n\t\t\t\t\t\tif (in_path[i] === '\"') {\n\t\t\t\t\t\t\t// We have found the end of the quoted token\n\t\t\t\t\t\t\tendFound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else if (in_path[i] === \"\\\\\") {\n\t\t\t\t\t\t\t// Read an escaped symbol\n\t\t\t\t\t\t\tif (in_path.length > i + 1) {\n\t\t\t\t\t\t\t\tif (in_path[i + 1] === \"\\\\\") {\n\t\t\t\t\t\t\t\t\tcurrentToken += \"\\\\\";\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t} else if (in_path[i + 1] === '\"') {\n\t\t\t\t\t\t\t\t\tcurrentToken += '\"';\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tthrow new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthrow new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Everything else is just added to the token\n\t\t\t\t\t\t\tcurrentToken += in_path[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!endFound) {\n\t\t\t\t\t\tthrow new Error(MSG.UNCLOSED_QUOTATION_MARKS + in_path);\n\t\t\t\t\t}\n\t\t\t\t\tlastTokenWasQuoted = true;\n\t\t\t\t\ttokenStarted = true;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n\t\t\t\t}\n\t\t\t} else if (!inSquareBrackets) {\n\t\t\t\tswitch (character) {\n\t\t\t\t\tcase PROPERTY_PATH_DELIMITER: {\n\t\t\t\t\t\t// A dot symbols starts a new token\n\t\t\t\t\t\tstoreNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\n\t\t\t\t\t\tallowSegmentStart = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[\": {\n\t\t\t\t\t\t// An opening square bracket starts a new token\n\t\t\t\t\t\tif (tokenStarted) {\n\t\t\t\t\t\t\tstoreNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// And sets the state to inSquareBrackets\n\t\t\t\t\t\tinSquareBrackets = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"]\": {\n\t\t\t\t\t\tthrow new Error(MSG.CLOSING_BRACKET_WITHOUT_OPENING + in_path);\n\t\t\t\t\t}\n\t\t\t\t\tcase \"*\": {\n\t\t\t\t\t\t// Store the last token\n\t\t\t\t\t\tif (tokenStarted) {\n\t\t\t\t\t\t\tstoreNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Create a new dereference token\n\t\t\t\t\t\ttokens.push(\"*\");\n\t\t\t\t\t\tif (out_types) {\n\t\t\t\t\t\t\tout_types.push(TOKEN_TYPES.DEREFERENCE_TOKEN);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Reset the token started flag\n\t\t\t\t\t\ttokenStarted = false;\n\t\t\t\t\t\tatStartToken = true;\n\t\t\t\t\t\tallowSegmentStart = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tif (!tokenStarted && !allowSegmentStart && !inSquareBrackets) {\n\t\t\t\t\t\t\tthrow new Error(MSG.MISSING_DOT_AT_SEGMENT_START + in_path);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrentToken += character;\n\n\t\t\t\t\t\t// We have started parsing the token\n\t\t\t\t\t\ttokenStarted = true;\n\n\t\t\t\t\t\t// When a symbols appears after a closing quotation mark, we have an error\n\t\t\t\t\t\tif (lastTokenWasQuoted) {\n\t\t\t\t\t\t\tthrow new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (character === \"]\") {\n\t\t\t\t\t// A closing square bracket starts a new token\n\t\t\t\t\tstoreNextToken(TOKEN_TYPES.ARRAY_TOKEN);\n\n\t\t\t\t\t// We now have to check the next character,\n\t\t\t\t\t// as only the combinations '][' and '].' are\n\t\t\t\t\t// valid\n\t\t\t\t\tif (in_path.length > i + 1) {\n\t\t\t\t\t\t// We only have to check this at the end of the string\n\t\t\t\t\t\tif (in_path[i + 1] === PROPERTY_PATH_DELIMITER) {\n\t\t\t\t\t\t\t// We are no longer in square brackets\n\t\t\t\t\t\t\tinSquareBrackets = false;\n\t\t\t\t\t\t\tallowSegmentStart = true;\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t} else if (in_path[i + 1] === \"[\") {\n\t\t\t\t\t\t\t// We remain in square brackets\n\t\t\t\t\t\t\t// so inSquareBrackets remains true;\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t} else if (in_path[i + 1] === \"*\") {\n\t\t\t\t\t\t\t// We leave the square brackets\n\t\t\t\t\t\t\tinSquareBrackets = false;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow new Error(MSG.INVALID_END_OF_SQUARE_BRACKETS + in_path);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinSquareBrackets = false;\n\t\t\t\t\t\ttokenStarted = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (character === PROPERTY_PATH_DELIMITER) {\n\t\t\t\t\tthrow new Error(MSG.DOTS_IN_SQUARE_BRACKETS + in_path);\n\t\t\t\t} else {\n\t\t\t\t\tcurrentToken += character;\n\n\t\t\t\t\t// We have started parsing the token\n\t\t\t\t\ttokenStarted = true;\n\n\t\t\t\t\t// When a symbols appears after a closing quotation mark, we have an error\n\t\t\t\t\tif (lastTokenWasQuoted) {\n\t\t\t\t\t\tthrow new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// At the end of the path we have to distinguish a few error cases\n\t\tif (inSquareBrackets) {\n\t\t\t// There was a un-closed bracket at the end\n\t\t\tthrow new Error(MSG.UNCLOSED_BRACKETS + in_path);\n\t\t} else if (in_path.endsWith(PROPERTY_PATH_DELIMITER)) {\n\t\t\t// A path ended with a PROPERTY_PATH_DELIMITER\n\t\t\tthrow new Error(MSG.DOT_AT_END + in_path);\n\t\t} else if (tokenStarted) {\n\t\t\t// There was a valid, not yet ended token\n\t\t\tstoreNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\t\t}\n\n\t\treturn tokens;\n\t};\n\n\t/**\n\t * Creates a quoted string for a path seqment to make sure it parses correctly\n\t *\n\t * @param in_pathSegment - The path string to put in quotes\n\t *\n\t * @returns quoted path string\n\t * @internal\n\t */\n\texport const quotePathSegment = function (in_pathSegment: string): string {\n\t\t// WARNING: I use RegExps here, as the normal replace\n\t\t// function only replaces the first occurrence\n\n\t\t// First we escape escape symbols\n\t\tin_pathSegment = in_pathSegment.replace(/\\\\/g, \"\\\\\\\\\");\n\n\t\t// Then we escape quotes\n\t\tin_pathSegment = in_pathSegment.replace(/\"/g, '\\\\\"');\n\n\t\t// And finally, we put the string into quotation marks\n\t\treturn `\"${in_pathSegment}\"`;\n\t};\n\n\t/**\n\t * Reverse a quoted/escaped string for a path seqment\n\t *\n\t * @param in_quotedPathSegment - The quoted/escaped path string to put in quotes\n\t *\n\t * @return unquoted path string\n\t * @internal\n\t */\n\texport const unquotePathSegment = function (in_quotedPathSegment: string): string {\n\t\tif (typeof in_quotedPathSegment !== \"string\") {\n\t\t\tthrow new TypeError(`Expecting a string as a path: ${in_quotedPathSegment}`);\n\t\t}\n\n\t\tif (in_quotedPathSegment.startsWith('\"') && in_quotedPathSegment.endsWith('\"')) {\n\t\t\t// We remove double quotes\n\t\t\tin_quotedPathSegment = in_quotedPathSegment.substr(1, in_quotedPathSegment.length - 2);\n\n\t\t\t// Then we unescape escape symbols\n\t\t\tin_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\\\\/g, \"\\\\\");\n\n\t\t\t// Then we unescape quotes\n\t\t\tin_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\"/g, '\"');\n\t\t}\n\n\t\treturn in_quotedPathSegment;\n\t};\n\n\t/**\n\t * Adds quotation marks to a path string if they are needed\n\t *\n\t * @param in_pathSegment - The path string to put in quotes\n\t *\n\t * @returns quoted path string\n\t * @internal\n\t */\n\texport const quotePathSegmentIfNeeded = function (in_pathSegment: string): string {\n\t\treturn in_pathSegment.indexOf(PROPERTY_PATH_DELIMITER) !== -1 ||\n\t\t\tin_pathSegment.indexOf('\"') !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"\\\\\") !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"/\") !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"*\") !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"[\") !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"]\") !== -1 ||\n\t\t\tin_pathSegment.length === 0\n\t\t\t? quotePathSegment(in_pathSegment)\n\t\t\t: in_pathSegment;\n\t};\n\n\t/**\n\t * This function checks, whether the supplied path is a valid repository absolute path.\n\t *\n\t * It has to be either an empty string, or a path starting with a /\n\t *\n\t * @param in_path - The path to check\n\t * @internal\n\t */\n\texport const checkValidRepositoryAbsolutePath = function (in_path: string) {\n\t\tif (\n\t\t\tin_path !== \"\" && // either an empty reference\n\t\t\t!in_path.startsWith(\"/\")\n\t\t) {\n\t\t\t// or an absolute path starting with /\n\t\t\tthrow new Error(MSG.INVALID_PATH_IN_REFERENCE);\n\t\t}\n\t};\n\n\t/**\n\t * This utility function provides a canonical representation of an absolute property path.\n\t * It is useful to compare partial checkout paths and property paths.\n\t * The canonical form of paths is not suitable for ChangeSets.\n\t *\n\t * @param in_absolutePath - The absolute path to make canonical\n\t * @return Absolute path in canonical form\n\t * @internal\n\t */\n\texport const convertAbsolutePathToCanonical = function (in_absolutePath: string): string {\n\t\tconst tokenTypes = [];\n\t\tconst tokens = tokenizePathString(in_absolutePath, tokenTypes);\n\t\tlet path = \"\";\n\t\tfor (let i = 0; i < tokenTypes.length; i++) {\n\t\t\tconst tokenType = tokenTypes[i];\n\t\t\tswitch (tokenType) {\n\t\t\t\tcase TOKEN_TYPES.PATH_ROOT_TOKEN:\n\t\t\t\t\t// Skip the leading '/'\n\t\t\t\t\tbreak;\n\t\t\t\tcase TOKEN_TYPES.RAISE_LEVEL_TOKEN:\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`No level up (\"../\") is expected in an absolute path: ${in_absolutePath}`,\n\t\t\t\t\t);\n\t\t\t\tcase TOKEN_TYPES.DEREFERENCE_TOKEN:\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Dereference (\"*\") is not supported in canonical paths: ${in_absolutePath}`,\n\t\t\t\t\t);\n\t\t\t\tcase TOKEN_TYPES.ARRAY_TOKEN:\n\t\t\t\tcase TOKEN_TYPES.PATH_SEGMENT_TOKEN:\n\t\t\t\t\tpath += PROPERTY_PATH_DELIMITER + quotePathSegmentIfNeeded(tokens[i]);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Removes the leading PROPERTY_PATH_DELIMITER.\n\t\tif (path) {\n\t\t\tpath = path.substring(1);\n\t\t}\n\t\treturn path;\n\t};\n\n\t/**\n\t * This utility function provides a canonical representation of a child property path.\n\t * It is useful to compare partial checkout paths and property paths.\n\t * The canonical form of paths is not suitable for ChangeSets.\n\t *\n\t * @param in_parentAbsolutePathCanonical - The absolute path of the parent property in canonical form\n\t * @param in_childId - The name of the child property in its parent\n\t * @returns Absolute path of the child property in canonical form\n\t * @internal\n\t */\n\texport const getChildAbsolutePathCanonical = function (\n\t\tin_parentAbsolutePathCanonical: string,\n\t\tin_childId: string,\n\t): string {\n\t\tconst childPath = quotePathSegmentIfNeeded(String(in_childId));\n\t\treturn in_parentAbsolutePathCanonical\n\t\t\t? in_parentAbsolutePathCanonical + PROPERTY_PATH_DELIMITER + childPath\n\t\t\t: childPath;\n\t};\n\n\t/**\n\t * @internal\n\t */\n\texport enum CoverageExtent {\n\t\t// The base path is not covered by any path from a given list of paths.\n\t\t// This means a property with this path and all its children would not be covered.\n\t\tUNCOVERED,\n\t\t// The base path is partially covered by at least one path from a given list of paths.\n\t\t// This means a property with this path would be covered, but some of its children could be uncovered.\n\t\tPARTLY_COVERED,\n\t\t// The base path is fully covered by at least one path from a given list of paths.\n\t\t// This means a property with this path would be covered and all of its children would be covered also.\n\t\tFULLY_COVERED,\n\t}\n\n\tinterface BasePathCoverage {\n\t\tcoverageExtent: CoverageExtent;\n\t\tpathList: string[];\n\t}\n\n\t/**\n\t * Determines if the base path is covered by the given list of paths. From that you can deduce if a\n\t * property with that path and all its children are covered by the given list of paths.\n\t *\n\t * This function uses the canonical representation of the property paths.\n\t *\n\t * @param in_basePath - The property's absolute path in canonical form\n\t * @param in_paths - The array of paths that must cover the property and its children\n\t * @returns The coverage of the property and its children. For a coverage of\n\t * 'FULLY_COVERED', only the first matching path is returned.\n\t * @internal\n\t */\n\texport const getPathCoverage = function (\n\t\tin_basePath: string,\n\t\tin_paths: string[],\n\t): BasePathCoverage {\n\t\t// First, check if the base path is entirely included in one of the paths\n\t\tfor (let i = 0; i < in_paths.length; i++) {\n\t\t\tif (in_basePath.startsWith(in_paths[i])) {\n\t\t\t\treturn {\n\t\t\t\t\tcoverageExtent: CoverageExtent.FULLY_COVERED,\n\t\t\t\t\tpathList: [in_paths[i]],\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\t// We did not find a path including all the children of this insertion\n\t\t// Let's check if there are paths going through it.\n\t\tconst paths = [];\n\t\tfor (let i = 0; i < in_paths.length; i++) {\n\t\t\tif (in_paths[i].startsWith(in_basePath)) {\n\t\t\t\tpaths.push(in_paths[i]);\n\t\t\t}\n\t\t}\n\t\tif (paths.length) {\n\t\t\t// We found at least one path including parts of the base path.\n\t\t\treturn {\n\t\t\t\tcoverageExtent: CoverageExtent.PARTLY_COVERED,\n\t\t\t\tpathList: paths,\n\t\t\t};\n\t\t}\n\n\t\t// We did not find any path covering the given base path.\n\t\treturn {\n\t\t\tcoverageExtent: CoverageExtent.UNCOVERED,\n\t\t\tpathList: paths,\n\t\t};\n\t};\n}\n"]}
1
+ {"version":3,"file":"pathHelper.js","sourceRoot":"","sources":["../src/pathHelper.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,aAAa;AACb,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAEhE,MAAM,EAAE,uBAAuB,EAAE,GAAG,EAAE,GAAG,SAAS,CAAC;AAInD;;;GAGG;AACH,2DAA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MAAM,EAAE,CAAC,EAAE,EAAE;YACzC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE;gBACxC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;aACxB;SACD;QACD,IAAI,KAAK,CAAC,MAAM,EAAE;YACjB,+DAA+D;YAC/D,OAAO;gBACN,cAAc,EAAE,cAAc,CAAC,cAAc;gBAC7C,QAAQ,EAAE,KAAK;aACf,CAAC;SACF;QAED,yDAAyD;QACzD,OAAO;YACN,cAAc,EAAE,cAAc,CAAC,SAAS;YACxC,QAAQ,EAAE,KAAK;SACf,CAAC;IACH,CAAC,CAAC;AACH,CAAC,EA7gBgB,UAAU,KAAV,UAAU,QA6gB1B","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Helper functions to work with path strings\n */\n\n// @ts-ignore\nimport { constants } from \"@fluid-experimental/property-common\";\n\nconst { PROPERTY_PATH_DELIMITER, MSG } = constants;\n\nexport type PathTree = Map<String, PathTree>;\n\n/**\n * Helper functions for string processing\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace PathHelper {\n\tconst RE_ALL_OPEN_SQUARE_BRACKETS = new RegExp(\"[[]\", \"g\");\n\n\t/**\n\t * Token Types\n\t * Type of the token in the path string\n\t * @internal\n\t */\n\texport enum TOKEN_TYPES {\n\t\t/** A normal path segment, separated via . */\n\t\tPATH_SEGMENT_TOKEN,\n\t\t/** An array path segment, separated via [ ] */\n\t\tARRAY_TOKEN,\n\t\t/** A / at the beginning of the path */\n\t\tPATH_ROOT_TOKEN,\n\t\t/** A * that indicates a dereferencing operation */ // note: reversed!\n\t\tDEREFERENCE_TOKEN,\n\t\t/** A ../ that indicates one step above the current path */\n\t\tRAISE_LEVEL_TOKEN,\n\t}\n\n\t/**\n\t * Tokenizes a path string\n\t *\n\t * @param in_path - The path string to divide into tokens\n\t * @param out_types - The types of the tokens\n\t *\n\t * @returns the tokens from the path string\n\t * @internal\n\t */\n\texport const tokenizePathString = function (\n\t\tin_path: string,\n\t\tout_types?: TOKEN_TYPES[],\n\t): string[] {\n\t\tconst tokens = [];\n\t\tlet currentToken = \"\";\n\n\t\tif (out_types) {\n\t\t\t// Make sure out_types is empty\n\t\t\tout_types.splice(0, out_types.length);\n\t\t}\n\n\t\t// Handle a / at the beginning of the path by adding a special token for it\n\t\tlet path_start = 0;\n\t\tif (in_path.startsWith(\"/\")) {\n\t\t\ttokens.push(\"/\");\n\t\t\tif (out_types) {\n\t\t\t\tout_types.push(TOKEN_TYPES.PATH_ROOT_TOKEN);\n\t\t\t}\n\t\t\tpath_start = 1;\n\t\t} else if (in_path.substr(0, 3) === \"../\") {\n\t\t\t// Handle relative paths by extracting the number steps above\n\t\t\tvar extractLevel = function (current_path) {\n\t\t\t\tif (current_path.substr(0, 3) === \"../\") {\n\t\t\t\t\tif (out_types) {\n\t\t\t\t\t\tout_types.push(TOKEN_TYPES.RAISE_LEVEL_TOKEN);\n\t\t\t\t\t}\n\t\t\t\t\ttokens.push(\"../\");\n\t\t\t\t\textractLevel(current_path.substr(3));\n\t\t\t\t\tpath_start = path_start + 3;\n\t\t\t\t}\n\t\t\t};\n\t\t\textractLevel(in_path);\n\t\t}\n\n\t\t// Let's see if the path is simple enough to use a fast-track algorithm.\n\t\tlet hackedPath = in_path.substr(path_start);\n\t\tif (\n\t\t\tin_path.indexOf(\"\\\\\") === -1 &&\n\t\t\tin_path.indexOf('\"') === -1 &&\n\t\t\tin_path.indexOf(\"*\") === -1\n\t\t) {\n\t\t\t// Yes, we can do something faster than parsing each character one by one.\n\t\t\tlet additionalTokens: string[] = [];\n\t\t\tconst additionalTypes = [];\n\t\t\tlet token: string | string[];\n\t\t\tlet i: number;\n\t\t\t// Hack for simplicity, let's first replace all occurences of '[' by '.['\n\t\t\thackedPath = hackedPath.replace(RE_ALL_OPEN_SQUARE_BRACKETS, \".[\");\n\t\t\t// Then split on '.'\n\t\t\tadditionalTokens = hackedPath.split(\".\");\n\t\t\t// And validate each token.\n\t\t\tfor (i = 0; i < additionalTokens.length; ++i) {\n\t\t\t\ttoken = additionalTokens[i];\n\t\t\t\t// Empty tokens are considered errors... but shouldn't '' be a valid name?\n\t\t\t\tif (token.length === 0) {\n\t\t\t\t\t// There's an error somewhere. Let's abort the fast-track.\n\t\t\t\t\tbreak;\n\t\t\t\t} else if (token.startsWith(\"[\")) {\n\t\t\t\t\tif (token.length > 2 && token.endsWith(\"]\")) {\n\t\t\t\t\t\tadditionalTypes.push(TOKEN_TYPES.ARRAY_TOKEN);\n\t\t\t\t\t\tadditionalTokens[i] = token.substr(1, token.length - 2);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// There's an error somewhere. Let's abort the fast-track.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (token.indexOf(\"]\") !== -1) {\n\t\t\t\t\t\t// There's an error somewhere. Let's abort the fast-track.\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// It was a simple property name.\n\t\t\t\t\t\tadditionalTypes.push(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (i === additionalTokens.length) {\n\t\t\t\t// Parsed everything successfully so end function here.\n\t\t\t\tif (out_types) {\n\t\t\t\t\tfor (i = 0; i < additionalTypes.length; i++) {\n\t\t\t\t\t\tout_types.push(additionalTypes[i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn tokens.concat(additionalTokens);\n\t\t\t}\n\t\t}\n\n\t\tlet inSquareBrackets = false;\n\t\tlet tokenStarted = false;\n\t\tlet lastTokenWasQuoted = false;\n\n\t\t// We are in a context where an empty token is valid\n\t\tlet atStartToken = false;\n\t\tlet allowSegmentStart = true;\n\n\t\tconst storeNextToken = function (tokenType) {\n\t\t\t// Make sure, this is not an empty token (E.g. a .. or a [] )\n\t\t\tif (!tokenStarted) {\n\t\t\t\tif (!atStartToken) {\n\t\t\t\t\tthrow new Error(MSG.EMPTY_TOKEN + in_path);\n\t\t\t\t} else {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Store the token\n\t\t\ttokens.push(currentToken);\n\t\t\tcurrentToken = \"\";\n\t\t\ttokenStarted = false;\n\t\t\tatStartToken = false;\n\t\t\tlastTokenWasQuoted = false;\n\t\t\tallowSegmentStart = false;\n\n\t\t\tif (out_types) {\n\t\t\t\tout_types.push(tokenType);\n\t\t\t}\n\t\t};\n\n\t\tfor (var i = path_start; i < in_path.length; i++) {\n\t\t\tconst character = in_path[i];\n\n\t\t\tif (character === '\"') {\n\t\t\t\t// If we encounter a quotation mark, we start parsing the\n\t\t\t\t// quoted section\n\t\t\t\tif (!tokenStarted) {\n\t\t\t\t\tlet endFound = false;\n\n\t\t\t\t\t// Read the quoted token\n\t\t\t\t\tfor (i++; i < in_path.length; i++) {\n\t\t\t\t\t\tif (in_path[i] === '\"') {\n\t\t\t\t\t\t\t// We have found the end of the quoted token\n\t\t\t\t\t\t\tendFound = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else if (in_path[i] === \"\\\\\") {\n\t\t\t\t\t\t\t// Read an escaped symbol\n\t\t\t\t\t\t\tif (in_path.length > i + 1) {\n\t\t\t\t\t\t\t\tif (in_path[i + 1] === \"\\\\\") {\n\t\t\t\t\t\t\t\t\tcurrentToken += \"\\\\\";\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t} else if (in_path[i + 1] === '\"') {\n\t\t\t\t\t\t\t\t\tcurrentToken += '\"';\n\t\t\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tthrow new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthrow new Error(MSG.INVALID_ESCAPE_SEQUENCE + in_path);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Everything else is just added to the token\n\t\t\t\t\t\t\tcurrentToken += in_path[i];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!endFound) {\n\t\t\t\t\t\tthrow new Error(MSG.UNCLOSED_QUOTATION_MARKS + in_path);\n\t\t\t\t\t}\n\t\t\t\t\tlastTokenWasQuoted = true;\n\t\t\t\t\ttokenStarted = true;\n\t\t\t\t} else {\n\t\t\t\t\tthrow new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n\t\t\t\t}\n\t\t\t} else if (!inSquareBrackets) {\n\t\t\t\tswitch (character) {\n\t\t\t\t\tcase PROPERTY_PATH_DELIMITER: {\n\t\t\t\t\t\t// A dot symbols starts a new token\n\t\t\t\t\t\tstoreNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\n\t\t\t\t\t\tallowSegmentStart = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"[\": {\n\t\t\t\t\t\t// An opening square bracket starts a new token\n\t\t\t\t\t\tif (tokenStarted) {\n\t\t\t\t\t\t\tstoreNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// And sets the state to inSquareBrackets\n\t\t\t\t\t\tinSquareBrackets = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tcase \"]\": {\n\t\t\t\t\t\tthrow new Error(MSG.CLOSING_BRACKET_WITHOUT_OPENING + in_path);\n\t\t\t\t\t}\n\t\t\t\t\tcase \"*\": {\n\t\t\t\t\t\t// Store the last token\n\t\t\t\t\t\tif (tokenStarted) {\n\t\t\t\t\t\t\tstoreNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Create a new dereference token\n\t\t\t\t\t\ttokens.push(\"*\");\n\t\t\t\t\t\tif (out_types) {\n\t\t\t\t\t\t\tout_types.push(TOKEN_TYPES.DEREFERENCE_TOKEN);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Reset the token started flag\n\t\t\t\t\t\ttokenStarted = false;\n\t\t\t\t\t\tatStartToken = true;\n\t\t\t\t\t\tallowSegmentStart = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tdefault: {\n\t\t\t\t\t\tif (!tokenStarted && !allowSegmentStart && !inSquareBrackets) {\n\t\t\t\t\t\t\tthrow new Error(MSG.MISSING_DOT_AT_SEGMENT_START + in_path);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tcurrentToken += character;\n\n\t\t\t\t\t\t// We have started parsing the token\n\t\t\t\t\t\ttokenStarted = true;\n\n\t\t\t\t\t\t// When a symbols appears after a closing quotation mark, we have an error\n\t\t\t\t\t\tif (lastTokenWasQuoted) {\n\t\t\t\t\t\t\tthrow new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (character === \"]\") {\n\t\t\t\t\t// A closing square bracket starts a new token\n\t\t\t\t\tstoreNextToken(TOKEN_TYPES.ARRAY_TOKEN);\n\n\t\t\t\t\t// We now have to check the next character,\n\t\t\t\t\t// as only the combinations '][' and '].' are\n\t\t\t\t\t// valid\n\t\t\t\t\tif (in_path.length > i + 1) {\n\t\t\t\t\t\t// We only have to check this at the end of the string\n\t\t\t\t\t\tif (in_path[i + 1] === PROPERTY_PATH_DELIMITER) {\n\t\t\t\t\t\t\t// We are no longer in square brackets\n\t\t\t\t\t\t\tinSquareBrackets = false;\n\t\t\t\t\t\t\tallowSegmentStart = true;\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t} else if (in_path[i + 1] === \"[\") {\n\t\t\t\t\t\t\t// We remain in square brackets\n\t\t\t\t\t\t\t// so inSquareBrackets remains true;\n\t\t\t\t\t\t\ti++;\n\t\t\t\t\t\t} else if (in_path[i + 1] === \"*\") {\n\t\t\t\t\t\t\t// We leave the square brackets\n\t\t\t\t\t\t\tinSquareBrackets = false;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthrow new Error(MSG.INVALID_END_OF_SQUARE_BRACKETS + in_path);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tinSquareBrackets = false;\n\t\t\t\t\t\ttokenStarted = false;\n\t\t\t\t\t}\n\t\t\t\t} else if (character === PROPERTY_PATH_DELIMITER) {\n\t\t\t\t\tthrow new Error(MSG.DOTS_IN_SQUARE_BRACKETS + in_path);\n\t\t\t\t} else {\n\t\t\t\t\tcurrentToken += character;\n\n\t\t\t\t\t// We have started parsing the token\n\t\t\t\t\ttokenStarted = true;\n\n\t\t\t\t\t// When a symbols appears after a closing quotation mark, we have an error\n\t\t\t\t\tif (lastTokenWasQuoted) {\n\t\t\t\t\t\tthrow new Error(MSG.QUOTES_WITHIN_TOKEN + in_path);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// At the end of the path we have to distinguish a few error cases\n\t\tif (inSquareBrackets) {\n\t\t\t// There was a un-closed bracket at the end\n\t\t\tthrow new Error(MSG.UNCLOSED_BRACKETS + in_path);\n\t\t} else if (in_path.endsWith(PROPERTY_PATH_DELIMITER)) {\n\t\t\t// A path ended with a PROPERTY_PATH_DELIMITER\n\t\t\tthrow new Error(MSG.DOT_AT_END + in_path);\n\t\t} else if (tokenStarted) {\n\t\t\t// There was a valid, not yet ended token\n\t\t\tstoreNextToken(TOKEN_TYPES.PATH_SEGMENT_TOKEN);\n\t\t}\n\n\t\treturn tokens;\n\t};\n\n\t/**\n\t * Creates a quoted string for a path seqment to make sure it parses correctly\n\t *\n\t * @param in_pathSegment - The path string to put in quotes\n\t *\n\t * @returns quoted path string\n\t * @internal\n\t */\n\texport const quotePathSegment = function (in_pathSegment: string): string {\n\t\t// WARNING: I use RegExps here, as the normal replace\n\t\t// function only replaces the first occurrence\n\n\t\t// First we escape escape symbols\n\t\tin_pathSegment = in_pathSegment.replace(/\\\\/g, \"\\\\\\\\\");\n\n\t\t// Then we escape quotes\n\t\tin_pathSegment = in_pathSegment.replace(/\"/g, '\\\\\"');\n\n\t\t// And finally, we put the string into quotation marks\n\t\treturn `\"${in_pathSegment}\"`;\n\t};\n\n\t/**\n\t * Reverse a quoted/escaped string for a path seqment\n\t *\n\t * @param in_quotedPathSegment - The quoted/escaped path string to put in quotes\n\t *\n\t * @return unquoted path string\n\t * @internal\n\t */\n\texport const unquotePathSegment = function (in_quotedPathSegment: string): string {\n\t\tif (typeof in_quotedPathSegment !== \"string\") {\n\t\t\tthrow new TypeError(`Expecting a string as a path: ${in_quotedPathSegment}`);\n\t\t}\n\n\t\tif (in_quotedPathSegment.startsWith('\"') && in_quotedPathSegment.endsWith('\"')) {\n\t\t\t// We remove double quotes\n\t\t\tin_quotedPathSegment = in_quotedPathSegment.substr(1, in_quotedPathSegment.length - 2);\n\n\t\t\t// Then we unescape escape symbols\n\t\t\tin_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\\\\/g, \"\\\\\");\n\n\t\t\t// Then we unescape quotes\n\t\t\tin_quotedPathSegment = in_quotedPathSegment.replace(/\\\\\"/g, '\"');\n\t\t}\n\n\t\treturn in_quotedPathSegment;\n\t};\n\n\t/**\n\t * Adds quotation marks to a path string if they are needed\n\t *\n\t * @param in_pathSegment - The path string to put in quotes\n\t *\n\t * @returns quoted path string\n\t * @internal\n\t */\n\texport const quotePathSegmentIfNeeded = function (in_pathSegment: string): string {\n\t\treturn in_pathSegment.indexOf(PROPERTY_PATH_DELIMITER) !== -1 ||\n\t\t\tin_pathSegment.indexOf('\"') !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"\\\\\") !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"/\") !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"*\") !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"[\") !== -1 ||\n\t\t\tin_pathSegment.indexOf(\"]\") !== -1 ||\n\t\t\tin_pathSegment.length === 0\n\t\t\t? quotePathSegment(in_pathSegment)\n\t\t\t: in_pathSegment;\n\t};\n\n\t/**\n\t * This function checks, whether the supplied path is a valid repository absolute path.\n\t *\n\t * It has to be either an empty string, or a path starting with a /\n\t *\n\t * @param in_path - The path to check\n\t * @internal\n\t */\n\texport const checkValidRepositoryAbsolutePath = function (in_path: string) {\n\t\tif (\n\t\t\tin_path !== \"\" && // either an empty reference\n\t\t\t!in_path.startsWith(\"/\")\n\t\t) {\n\t\t\t// or an absolute path starting with /\n\t\t\tthrow new Error(MSG.INVALID_PATH_IN_REFERENCE);\n\t\t}\n\t};\n\n\t/**\n\t * This utility function provides a canonical representation of an absolute property path.\n\t * It is useful to compare partial checkout paths and property paths.\n\t * The canonical form of paths is not suitable for ChangeSets.\n\t *\n\t * @param in_absolutePath - The absolute path to make canonical\n\t * @return Absolute path in canonical form\n\t * @internal\n\t */\n\texport const convertAbsolutePathToCanonical = function (in_absolutePath: string): string {\n\t\tconst tokenTypes = [];\n\t\tconst tokens = tokenizePathString(in_absolutePath, tokenTypes);\n\t\tlet path = \"\";\n\t\tfor (let i = 0; i < tokenTypes.length; i++) {\n\t\t\tconst tokenType = tokenTypes[i];\n\t\t\tswitch (tokenType) {\n\t\t\t\tcase TOKEN_TYPES.PATH_ROOT_TOKEN:\n\t\t\t\t\t// Skip the leading '/'\n\t\t\t\t\tbreak;\n\t\t\t\tcase TOKEN_TYPES.RAISE_LEVEL_TOKEN:\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`No level up (\"../\") is expected in an absolute path: ${in_absolutePath}`,\n\t\t\t\t\t);\n\t\t\t\tcase TOKEN_TYPES.DEREFERENCE_TOKEN:\n\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t`Dereference (\"*\") is not supported in canonical paths: ${in_absolutePath}`,\n\t\t\t\t\t);\n\t\t\t\tcase TOKEN_TYPES.ARRAY_TOKEN:\n\t\t\t\tcase TOKEN_TYPES.PATH_SEGMENT_TOKEN:\n\t\t\t\t\tpath += PROPERTY_PATH_DELIMITER + quotePathSegmentIfNeeded(tokens[i]);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// Removes the leading PROPERTY_PATH_DELIMITER.\n\t\tif (path) {\n\t\t\tpath = path.substring(1);\n\t\t}\n\t\treturn path;\n\t};\n\n\t/**\n\t * This utility function provides a canonical representation of a child property path.\n\t * It is useful to compare partial checkout paths and property paths.\n\t * The canonical form of paths is not suitable for ChangeSets.\n\t *\n\t * @param in_parentAbsolutePathCanonical - The absolute path of the parent property in canonical form\n\t * @param in_childId - The name of the child property in its parent\n\t * @returns Absolute path of the child property in canonical form\n\t * @internal\n\t */\n\texport const getChildAbsolutePathCanonical = function (\n\t\tin_parentAbsolutePathCanonical: string,\n\t\tin_childId: string,\n\t): string {\n\t\tconst childPath = quotePathSegmentIfNeeded(String(in_childId));\n\t\treturn in_parentAbsolutePathCanonical\n\t\t\t? in_parentAbsolutePathCanonical + PROPERTY_PATH_DELIMITER + childPath\n\t\t\t: childPath;\n\t};\n\n\t/**\n\t * @internal\n\t */\n\texport enum CoverageExtent {\n\t\t// The base path is not covered by any path from a given list of paths.\n\t\t// This means a property with this path and all its children would not be covered.\n\t\tUNCOVERED,\n\t\t// The base path is partially covered by at least one path from a given list of paths.\n\t\t// This means a property with this path would be covered, but some of its children could be uncovered.\n\t\tPARTLY_COVERED,\n\t\t// The base path is fully covered by at least one path from a given list of paths.\n\t\t// This means a property with this path would be covered and all of its children would be covered also.\n\t\tFULLY_COVERED,\n\t}\n\n\tinterface BasePathCoverage {\n\t\tcoverageExtent: CoverageExtent;\n\t\tpathList: string[];\n\t}\n\n\t/**\n\t * Determines if the base path is covered by the given list of paths. From that you can deduce if a\n\t * property with that path and all its children are covered by the given list of paths.\n\t *\n\t * This function uses the canonical representation of the property paths.\n\t *\n\t * @param in_basePath - The property's absolute path in canonical form\n\t * @param in_paths - The array of paths that must cover the property and its children\n\t * @returns The coverage of the property and its children. For a coverage of\n\t * 'FULLY_COVERED', only the first matching path is returned.\n\t * @internal\n\t */\n\texport const getPathCoverage = function (\n\t\tin_basePath: string,\n\t\tin_paths: string[],\n\t): BasePathCoverage {\n\t\t// First, check if the base path is entirely included in one of the paths\n\t\tfor (let i = 0; i < in_paths.length; i++) {\n\t\t\tif (in_basePath.startsWith(in_paths[i])) {\n\t\t\t\treturn {\n\t\t\t\t\tcoverageExtent: CoverageExtent.FULLY_COVERED,\n\t\t\t\t\tpathList: [in_paths[i]],\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t\t// We did not find a path including all the children of this insertion\n\t\t// Let's check if there are paths going through it.\n\t\tconst paths = [];\n\t\tfor (let i = 0; i < in_paths.length; i++) {\n\t\t\tif (in_paths[i].startsWith(in_basePath)) {\n\t\t\t\tpaths.push(in_paths[i]);\n\t\t\t}\n\t\t}\n\t\tif (paths.length) {\n\t\t\t// We found at least one path including parts of the base path.\n\t\t\treturn {\n\t\t\t\tcoverageExtent: CoverageExtent.PARTLY_COVERED,\n\t\t\t\tpathList: paths,\n\t\t\t};\n\t\t}\n\n\t\t// We did not find any path covering the given base path.\n\t\treturn {\n\t\t\tcoverageExtent: CoverageExtent.UNCOVERED,\n\t\t\tpathList: paths,\n\t\t};\n\t};\n}\n"]}
package/lib/rebase.js CHANGED
@@ -3,8 +3,8 @@
3
3
  * Licensed under the MIT License.
4
4
  */
5
5
  import { copy as cloneDeep } from "fastest-json-copy";
6
- import isEqual from "lodash/isEqual";
7
- import { ChangeSet } from "./changeset";
6
+ import isEqual from "lodash/isEqual.js";
7
+ import { ChangeSet } from "./changeset.js";
8
8
  class SyncPromise {
9
9
  constructor(x) {
10
10
  if (!(this instanceof SyncPromise))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B;SACvD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,kBAAkB,CAAC,aAAa,EAAE,eAAe;IACzD,IAAI,mBAAmB,GAAG,aAAa,CAAC;IACxC,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE;QACrC,MAAM,eAAe,GAAG,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC;QACnE,eAAe,CAAC,kBAAkB,EAAE,CAAC;QAErC,MAAM,SAAS,GAAG,EAAE,CAAC;QACrB,MAAM,CAAC,qBAAqB,GAAG,IAAI,GAAG,EAAE,CAAC;QACzC,mBAAmB,CAAC,gBAAgB,CAAC,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE;YACjE,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SACvD,CAAC,CAAC;QAEH,eAAe,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QACpD,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE;YAChD,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SACvD,CAAC,CAAC;QACH,mBAAmB,GAAG,eAAe,CAAC;KACtC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { copy as cloneDeep } from \"fastest-json-copy\";\nimport isEqual from \"lodash/isEqual\";\n\nimport { ChangeSet } from \"./changeset\";\n\nclass SyncPromise {\n\tvalue: any;\n\n\tconstructor(x: { value: any }) {\n\t\tif (!(this instanceof SyncPromise)) {\n\t\t\treturn new SyncPromise(x);\n\t\t}\n\t\tif (x instanceof SyncPromise) {\n\t\t\tx = x.value;\n\t\t}\n\t\tthis.value = x;\n\t}\n\n\tthen(fn: (arg0: any) => { value: any }): SyncPromise {\n\t\tthis.value = new SyncPromise(fn(this.value)).value;\n\t\treturn this;\n\t}\n}\n\nconst loop = (\n\tpromise: Promise<any>,\n\tfn: { (currentChange: any): any; (currentRebasedChange: any): any },\n\tmakePromise: (arg0: any) => any,\n) =>\n\tpromise\n\t\t.then(fn)\n\t\t.then((result) => (result === null ? result : loop(makePromise(result), fn, makePromise)));\n\n/**\n * @internal\n */\nexport function rebaseToRemoteChanges(\n\tchange: any,\n\tgetUnrebasedChange: any,\n\tgetRebasedChanges: any,\n\tisAsync: boolean = false,\n) {\n\tconst makePromise = isAsync ? Promise.resolve.bind(Promise) : (x) => new SyncPromise(x);\n\tlet mainPromise = makePromise();\n\n\tconst commitsOnOtherLocalBranch = {};\n\tlet rebaseBaseChangeSet = new ChangeSet({});\n\tconst changesOnOtherLocalBranch = [];\n\tif (change.referenceGuid !== change.remoteHeadGuid) {\n\t\t// Extract all changes between the remoteHeadGuid and the referenceGuid\n\t\tlet currentGuid = change.referenceGuid;\n\t\tmainPromise = loop(\n\t\t\tmakePromise(getUnrebasedChange(currentGuid)),\n\t\t\t(currentChange) => {\n\t\t\t\tif (currentChange === undefined) {\n\t\t\t\t\tthrow new Error(\"Received change that references a non-existing parent change\");\n\t\t\t\t}\n\t\t\t\tchangesOnOtherLocalBranch.unshift(currentChange);\n\t\t\t\tcommitsOnOtherLocalBranch[currentGuid] = currentChange;\n\t\t\t\tif (currentGuid === change.localBranchStart) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcurrentGuid = currentChange.referenceGuid;\n\t\t\t\treturn getUnrebasedChange(currentGuid);\n\t\t\t},\n\t\t\tmakePromise,\n\t\t);\n\n\t\t// Now we extract all changes until we arrive at a change that is relative to a remote change\n\t\tconst alreadyRebasedChanges = [];\n\n\t\tmainPromise = mainPromise.then(() =>\n\t\t\tloop(\n\t\t\t\tmakePromise(getUnrebasedChange(change.localBranchStart)),\n\t\t\t\t(currentRebasedChange) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tcurrentRebasedChange.remoteHeadGuid === currentRebasedChange.referenceGuid\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn makePromise(getUnrebasedChange(currentRebasedChange.referenceGuid)).then(\n\t\t\t\t\t\t(rebaseChange) => {\n\t\t\t\t\t\t\talreadyRebasedChanges.unshift(rebaseChange);\n\t\t\t\t\t\t\tif (rebaseChange === undefined) {\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\"Received change that references a non-existing parent change\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rebaseChange;\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmakePromise,\n\t\t\t),\n\t\t);\n\n\t\t// Compute the base Changeset to rebase the changes on the branch that was still the local branch\n\t\t// when the incoming change was created\n\n\t\tmainPromise = mainPromise\n\t\t\t.then(() => {\n\t\t\t\t// First invert all changes on the previous local branch\n\t\t\t\tconst startGuid =\n\t\t\t\t\talreadyRebasedChanges.length > 0\n\t\t\t\t\t\t? alreadyRebasedChanges[0].referenceGuid\n\t\t\t\t\t\t: changesOnOtherLocalBranch[0].referenceGuid;\n\n\t\t\t\t// Then apply all changes on the local remote branch\n\t\t\t\tconst endGuid = change.remoteHeadGuid;\n\t\t\t\treturn getRebasedChanges(startGuid, endGuid);\n\t\t\t})\n\t\t\t.then((relevantRemoteChanges) => {\n\t\t\t\tlet rebaseBaseChangeSetForAlreadyRebasedChanges = new ChangeSet({});\n\n\t\t\t\tif (relevantRemoteChanges.length > 0) {\n\t\t\t\t\tfor (const c of relevantRemoteChanges) {\n\t\t\t\t\t\tlet changeset = c.changeSet;\n\t\t\t\t\t\tlet applyAfterMetaInformation;\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\talreadyRebasedChanges[0] !== undefined &&\n\t\t\t\t\t\t\talreadyRebasedChanges[0].guid === c.guid\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst invertedChange = new ChangeSet(\n\t\t\t\t\t\t\t\tcloneDeep(alreadyRebasedChanges[0].changeSet),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tinvertedChange.toInverseChangeSet();\n\t\t\t\t\t\t\tinvertedChange.applyChangeSet(\n\t\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tapplyAfterMetaInformation = new Map();\n\t\t\t\t\t\t\tconst conflicts2 = [];\n\t\t\t\t\t\t\tchangeset = cloneDeep(alreadyRebasedChanges[0].changeSet);\n\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges._rebaseChangeSet(\n\t\t\t\t\t\t\t\tchangeset,\n\t\t\t\t\t\t\t\tconflicts2,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges = invertedChange;\n\t\t\t\t\t\t\talreadyRebasedChanges.shift();\n\t\t\t\t\t\t}\n\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges.applyChangeSet(changeset, {\n\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Now we have to rebase all changes from the remote local branch with respect to this base changeset\n\t\t\t\t\trebaseChangeArrays(\n\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges,\n\t\t\t\t\t\tchangesOnOtherLocalBranch,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Update the reference for the rebased changes to indicate that they are now with respect to the\n\t\t\t\t// new remoteHeadGuid\n\t\t\t\tif (changesOnOtherLocalBranch.length > 0) {\n\t\t\t\t\tchangesOnOtherLocalBranch[0].remoteHeadGuid = change.remoteHeadGuid;\n\t\t\t\t\tchangesOnOtherLocalBranch[0].referenceGuid = change.remoteHeadGuid;\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\treturn mainPromise\n\t\t.then(() => makePromise(getRebasedChanges(change.remoteHeadGuid)))\n\t\t.then((remoteChanges) => {\n\t\t\tconst conflicts = [];\n\t\t\tif (\n\t\t\t\t!isEqual(\n\t\t\t\t\tchangesOnOtherLocalBranch.map((change) => change.guid),\n\t\t\t\t\tremoteChanges.map((change) => change.guid),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tfor (const remoteChange of remoteChanges) {\n\t\t\t\t\tlet applyAfterMetaInformation =\n\t\t\t\t\t\tcommitsOnOtherLocalBranch[remoteChange.guid] !== undefined\n\t\t\t\t\t\t\t? remoteChange.rebaseMetaInformation\n\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\tlet changeset = remoteChange.changeSet;\n\t\t\t\t\tif (\n\t\t\t\t\t\tchangesOnOtherLocalBranch[0] !== undefined &&\n\t\t\t\t\t\tchangesOnOtherLocalBranch[0].guid === remoteChange.guid\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst invertedChange = new ChangeSet(\n\t\t\t\t\t\t\tcloneDeep(changesOnOtherLocalBranch[0].changeSet),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinvertedChange.toInverseChangeSet();\n\t\t\t\t\t\tinvertedChange.applyChangeSet(rebaseBaseChangeSet);\n\n\t\t\t\t\t\tapplyAfterMetaInformation = new Map();\n\t\t\t\t\t\tchangeset = cloneDeep(changesOnOtherLocalBranch[0].changeSet);\n\t\t\t\t\t\trebaseBaseChangeSet._rebaseChangeSet(changeset, conflicts, {\n\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t\t\t\t\t// assert(isEqual(changeset,this.remoteChanges[i].changeSet),\n\t\t\t\t\t\t// \"Failed Rebase in rebaseToRemoteChanges\");\n\t\t\t\t\t\trebaseBaseChangeSet = invertedChange;\n\t\t\t\t\t\tchangesOnOtherLocalBranch.shift();\n\t\t\t\t\t}\n\n\t\t\t\t\trebaseBaseChangeSet.applyChangeSet(changeset, {\n\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tchange.rebaseMetaInformation = new Map();\n\t\t\trebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n\t\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t\t});\n\t\t});\n}\n\nfunction rebaseChangeArrays(baseChangeSet, changesToRebase) {\n\tlet rebaseBaseChangeSet = baseChangeSet;\n\tfor (const change of changesToRebase) {\n\t\tconst copiedChangeSet = new ChangeSet(cloneDeep(change.changeSet));\n\t\tcopiedChangeSet.toInverseChangeSet();\n\n\t\tconst conflicts = [];\n\t\tchange.rebaseMetaInformation = new Map();\n\t\trebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t});\n\n\t\tcopiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n\t\tcopiedChangeSet.applyChangeSet(change.changeSet, {\n\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t});\n\t\trebaseBaseChangeSet = copiedChangeSet;\n\t}\n}\n"]}
1
+ {"version":3,"file":"rebase.js","sourceRoot":"","sources":["../src/rebase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,IAAI,IAAI,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,OAAO,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,MAAM,WAAW;IAGhB,YAAY,CAAiB;QAC5B,IAAI,CAAC,CAAC,IAAI,YAAY,WAAW,CAAC,EAAE;YACnC,OAAO,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;SAC1B;QACD,IAAI,CAAC,YAAY,WAAW,EAAE;YAC7B,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC;SACZ;QACD,IAAI,CAAC,KA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AAC,CAAC;QAEH,eAAe,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QACpD,eAAe,CAAC,cAAc,CAAC,MAAM,CAAC,SAAS,EAAE;YAChD,yBAAyB,EAAE,MAAM,CAAC,qBAAqB;SACvD,CAAC,CAAC;QACH,mBAAmB,GAAG,eAAe,CAAC;KACtC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { copy as cloneDeep } from \"fastest-json-copy\";\nimport isEqual from \"lodash/isEqual.js\";\n\nimport { ChangeSet } from \"./changeset.js\";\n\nclass SyncPromise {\n\tvalue: any;\n\n\tconstructor(x: { value: any }) {\n\t\tif (!(this instanceof SyncPromise)) {\n\t\t\treturn new SyncPromise(x);\n\t\t}\n\t\tif (x instanceof SyncPromise) {\n\t\t\tx = x.value;\n\t\t}\n\t\tthis.value = x;\n\t}\n\n\tthen(fn: (arg0: any) => { value: any }): SyncPromise {\n\t\tthis.value = new SyncPromise(fn(this.value)).value;\n\t\treturn this;\n\t}\n}\n\nconst loop = (\n\tpromise: Promise<any>,\n\tfn: { (currentChange: any): any; (currentRebasedChange: any): any },\n\tmakePromise: (arg0: any) => any,\n) =>\n\tpromise\n\t\t.then(fn)\n\t\t.then((result) => (result === null ? result : loop(makePromise(result), fn, makePromise)));\n\n/**\n * @internal\n */\nexport function rebaseToRemoteChanges(\n\tchange: any,\n\tgetUnrebasedChange: any,\n\tgetRebasedChanges: any,\n\tisAsync: boolean = false,\n) {\n\tconst makePromise = isAsync ? Promise.resolve.bind(Promise) : (x) => new SyncPromise(x);\n\tlet mainPromise = makePromise();\n\n\tconst commitsOnOtherLocalBranch = {};\n\tlet rebaseBaseChangeSet = new ChangeSet({});\n\tconst changesOnOtherLocalBranch = [];\n\tif (change.referenceGuid !== change.remoteHeadGuid) {\n\t\t// Extract all changes between the remoteHeadGuid and the referenceGuid\n\t\tlet currentGuid = change.referenceGuid;\n\t\tmainPromise = loop(\n\t\t\tmakePromise(getUnrebasedChange(currentGuid)),\n\t\t\t(currentChange) => {\n\t\t\t\tif (currentChange === undefined) {\n\t\t\t\t\tthrow new Error(\"Received change that references a non-existing parent change\");\n\t\t\t\t}\n\t\t\t\tchangesOnOtherLocalBranch.unshift(currentChange);\n\t\t\t\tcommitsOnOtherLocalBranch[currentGuid] = currentChange;\n\t\t\t\tif (currentGuid === change.localBranchStart) {\n\t\t\t\t\treturn null;\n\t\t\t\t}\n\t\t\t\tcurrentGuid = currentChange.referenceGuid;\n\t\t\t\treturn getUnrebasedChange(currentGuid);\n\t\t\t},\n\t\t\tmakePromise,\n\t\t);\n\n\t\t// Now we extract all changes until we arrive at a change that is relative to a remote change\n\t\tconst alreadyRebasedChanges = [];\n\n\t\tmainPromise = mainPromise.then(() =>\n\t\t\tloop(\n\t\t\t\tmakePromise(getUnrebasedChange(change.localBranchStart)),\n\t\t\t\t(currentRebasedChange) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tcurrentRebasedChange.remoteHeadGuid === currentRebasedChange.referenceGuid\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\t\t\t\t\treturn makePromise(getUnrebasedChange(currentRebasedChange.referenceGuid)).then(\n\t\t\t\t\t\t(rebaseChange) => {\n\t\t\t\t\t\t\talreadyRebasedChanges.unshift(rebaseChange);\n\t\t\t\t\t\t\tif (rebaseChange === undefined) {\n\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\"Received change that references a non-existing parent change\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn rebaseChange;\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmakePromise,\n\t\t\t),\n\t\t);\n\n\t\t// Compute the base Changeset to rebase the changes on the branch that was still the local branch\n\t\t// when the incoming change was created\n\n\t\tmainPromise = mainPromise\n\t\t\t.then(() => {\n\t\t\t\t// First invert all changes on the previous local branch\n\t\t\t\tconst startGuid =\n\t\t\t\t\talreadyRebasedChanges.length > 0\n\t\t\t\t\t\t? alreadyRebasedChanges[0].referenceGuid\n\t\t\t\t\t\t: changesOnOtherLocalBranch[0].referenceGuid;\n\n\t\t\t\t// Then apply all changes on the local remote branch\n\t\t\t\tconst endGuid = change.remoteHeadGuid;\n\t\t\t\treturn getRebasedChanges(startGuid, endGuid);\n\t\t\t})\n\t\t\t.then((relevantRemoteChanges) => {\n\t\t\t\tlet rebaseBaseChangeSetForAlreadyRebasedChanges = new ChangeSet({});\n\n\t\t\t\tif (relevantRemoteChanges.length > 0) {\n\t\t\t\t\tfor (const c of relevantRemoteChanges) {\n\t\t\t\t\t\tlet changeset = c.changeSet;\n\t\t\t\t\t\tlet applyAfterMetaInformation;\n\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\talreadyRebasedChanges[0] !== undefined &&\n\t\t\t\t\t\t\talreadyRebasedChanges[0].guid === c.guid\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst invertedChange = new ChangeSet(\n\t\t\t\t\t\t\t\tcloneDeep(alreadyRebasedChanges[0].changeSet),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tinvertedChange.toInverseChangeSet();\n\t\t\t\t\t\t\tinvertedChange.applyChangeSet(\n\t\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tapplyAfterMetaInformation = new Map();\n\t\t\t\t\t\t\tconst conflicts2 = [];\n\t\t\t\t\t\t\tchangeset = cloneDeep(alreadyRebasedChanges[0].changeSet);\n\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges._rebaseChangeSet(\n\t\t\t\t\t\t\t\tchangeset,\n\t\t\t\t\t\t\t\tconflicts2,\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges = invertedChange;\n\t\t\t\t\t\t\talreadyRebasedChanges.shift();\n\t\t\t\t\t\t}\n\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges.applyChangeSet(changeset, {\n\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\t// Now we have to rebase all changes from the remote local branch with respect to this base changeset\n\t\t\t\t\trebaseChangeArrays(\n\t\t\t\t\t\trebaseBaseChangeSetForAlreadyRebasedChanges,\n\t\t\t\t\t\tchangesOnOtherLocalBranch,\n\t\t\t\t\t);\n\t\t\t\t}\n\n\t\t\t\t// Update the reference for the rebased changes to indicate that they are now with respect to the\n\t\t\t\t// new remoteHeadGuid\n\t\t\t\tif (changesOnOtherLocalBranch.length > 0) {\n\t\t\t\t\tchangesOnOtherLocalBranch[0].remoteHeadGuid = change.remoteHeadGuid;\n\t\t\t\t\tchangesOnOtherLocalBranch[0].referenceGuid = change.remoteHeadGuid;\n\t\t\t\t}\n\t\t\t});\n\t}\n\n\treturn mainPromise\n\t\t.then(() => makePromise(getRebasedChanges(change.remoteHeadGuid)))\n\t\t.then((remoteChanges) => {\n\t\t\tconst conflicts = [];\n\t\t\tif (\n\t\t\t\t!isEqual(\n\t\t\t\t\tchangesOnOtherLocalBranch.map((change) => change.guid),\n\t\t\t\t\tremoteChanges.map((change) => change.guid),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tfor (const remoteChange of remoteChanges) {\n\t\t\t\t\tlet applyAfterMetaInformation =\n\t\t\t\t\t\tcommitsOnOtherLocalBranch[remoteChange.guid] !== undefined\n\t\t\t\t\t\t\t? remoteChange.rebaseMetaInformation\n\t\t\t\t\t\t\t: undefined;\n\n\t\t\t\t\tlet changeset = remoteChange.changeSet;\n\t\t\t\t\tif (\n\t\t\t\t\t\tchangesOnOtherLocalBranch[0] !== undefined &&\n\t\t\t\t\t\tchangesOnOtherLocalBranch[0].guid === remoteChange.guid\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst invertedChange = new ChangeSet(\n\t\t\t\t\t\t\tcloneDeep(changesOnOtherLocalBranch[0].changeSet),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tinvertedChange.toInverseChangeSet();\n\t\t\t\t\t\tinvertedChange.applyChangeSet(rebaseBaseChangeSet);\n\n\t\t\t\t\t\tapplyAfterMetaInformation = new Map();\n\t\t\t\t\t\tchangeset = cloneDeep(changesOnOtherLocalBranch[0].changeSet);\n\t\t\t\t\t\trebaseBaseChangeSet._rebaseChangeSet(changeset, conflicts, {\n\t\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// This is disabled for performance reasons. Only used during debugging\n\t\t\t\t\t\t// assert(isEqual(changeset,this.remoteChanges[i].changeSet),\n\t\t\t\t\t\t// \"Failed Rebase in rebaseToRemoteChanges\");\n\t\t\t\t\t\trebaseBaseChangeSet = invertedChange;\n\t\t\t\t\t\tchangesOnOtherLocalBranch.shift();\n\t\t\t\t\t}\n\n\t\t\t\t\trebaseBaseChangeSet.applyChangeSet(changeset, {\n\t\t\t\t\t\tapplyAfterMetaInformation,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tchange.rebaseMetaInformation = new Map();\n\t\t\trebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n\t\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t\t});\n\t\t});\n}\n\nfunction rebaseChangeArrays(baseChangeSet, changesToRebase) {\n\tlet rebaseBaseChangeSet = baseChangeSet;\n\tfor (const change of changesToRebase) {\n\t\tconst copiedChangeSet = new ChangeSet(cloneDeep(change.changeSet));\n\t\tcopiedChangeSet.toInverseChangeSet();\n\n\t\tconst conflicts = [];\n\t\tchange.rebaseMetaInformation = new Map();\n\t\trebaseBaseChangeSet._rebaseChangeSet(change.changeSet, conflicts, {\n\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t});\n\n\t\tcopiedChangeSet.applyChangeSet(rebaseBaseChangeSet);\n\t\tcopiedChangeSet.applyChangeSet(change.changeSet, {\n\t\t\tapplyAfterMetaInformation: change.rebaseMetaInformation,\n\t\t});\n\t\trebaseBaseChangeSet = copiedChangeSet;\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"templateSchema.d.ts","sourceRoot":"","sources":["../src/templateSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;;;GAIG;AAEH;;GAEG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFhB,CAAC;AAiFF;;GAEG;AACH,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2GnB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"templateSchema.d.ts","sourceRoot":"","sources":["../src/templateSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH;;GAEG;AACH,QAAA,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiFhB,CAAC;AAiFF;;GAEG;AACH,QAAA,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,EAAE,CAAC,IAAI,CAAC;SAChB;QACD,kBAAkB,EAAE;YACnB,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;SAC1B;KACD;IACD,KAAK,EAAE,CAAC,0BAA0B,EAAE,cAAc,CAAC;CACnD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview\n * Declaration of the TemplateSchema module\n * The TemplateSchema is used for validating PropertySet templates that code is attempting to register\n */\n\n/**\n * Namespace containing all schema-related data for property set validation\n */\nconst NativeTypes = {\n\tBaseProperty: {\n\t\tinherits: [],\n\t\tprimitive: false,\n\t},\n\tContainerProperty: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: false,\n\t},\n\tNamedProperty: {\n\t\tinherits: [\"ContainerProperty\"],\n\t\tprimitive: false,\n\t},\n\tNodeProperty: {\n\t\tinherits: [\"ContainerProperty\"],\n\t\tprimitive: false,\n\t},\n\tNamedNodeProperty: {\n\t\tinherits: [\"NodeProperty\", \"NamedProperty\"],\n\t\tprimitive: false,\n\t},\n\tRelationshipProperty: {\n\t\tinherits: [\"NodeProperty\", \"NamedProperty\"],\n\t\tprimitive: false,\n\t},\n\tString: {\n\t\tinherits: [\"ContainerProperty\"],\n\t\tprimitive: true,\n\t},\n\tFloat32: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tFloat64: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tInt8: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tUint8: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tInt16: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tUint16: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tInt32: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tUint32: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tBool: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tReference: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tEnum: {\n\t\tinherits: [\"Int32\"],\n\t\tprimitive: true,\n\t},\n\tInt64: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tUint64: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n};\n\nconst primitiveTypes = [];\nconst reservedTypes = [];\n\nObject.keys(NativeTypes).forEach(function (key) {\n\tif (NativeTypes[key].primitive) {\n\t\tprimitiveTypes.push(key);\n\t} else {\n\t\treservedTypes.push(key);\n\t}\n});\n\nconst requireTypeidIfNotInherits = {\n\tanyOf: [\n\t\t{\n\t\t\toneOf: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tconstants: { typeof: \"undefined\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tprohibited: [\"constants\"],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\ttype: \"object\",\n\t\t\trequired: [\"inherits\"],\n\t\t},\n\t\t{\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tconstants: {\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\titems: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\trequired: [\"typeid\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n};\n\nconst originalSchema = {\n\ttype: \"object\",\n\tminProperties: 1,\n\tproperties: {\n\t\ttypeid: {\n\t\t\t$ref: \"#/$defs/versioned-typeid\",\n\t\t},\n\t\tproperties: {\n\t\t\t$ref: \"#/$defs/properties\",\n\t\t},\n\t\tconstants: {\n\t\t\t$ref: \"#/$defs/constants\",\n\t\t},\n\t\tinherits: {\n\t\t\toneOf: [\n\t\t\t\t{\n\t\t\t\t\t$ref: \"#/$defs/typeid\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\titems: {\n\t\t\t\t\t\t$ref: \"#/$defs/typeid\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tannotation: {\n\t\t\t$ref: \"#/$defs/annotation\",\n\t\t},\n\t},\n\trequired: [\"typeid\"],\n};\n\n/**\n * @internal\n */\nconst TemplateSchema = {\n\t$schema: \"http://json-schema.org/schema\",\n\ttitle: \"Property set template schema\",\n\t$id: \"{TEMPLATE_SCHEMA_URL}\",\n\t$defs: {\n\t\t\"annotation\": {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tdescription: { type: \"string\" },\n\t\t\t\t// 'doc': { 'type': 'string', 'format': 'uri' }\n\t\t\t},\n\t\t},\n\t\t\"primitive-typeid\": {\n\t\t\tenum: primitiveTypes,\n\t\t\ttype: \"string\",\n\t\t},\n\t\t\"versioned-typeid\": {\n\t\t\ttype: \"string\",\n\t\t\tpattern: \"^[_a-zA-Z0-9\\\\.]+:[_a-zA-Z0-9\\\\.]+-(\\\\d+\\\\.\\\\d+\\\\.\\\\d+|draft)$\",\n\t\t},\n\t\t\"typed-reference-typeid\": {\n\t\t\ttype: \"string\",\n\t\t\tpattern: `^Reference<([_a-zA-Z0-9\\\\.]+:[_a-zA-Z0-9\\\\.]+(-\\\\d+\\\\.\\\\d+\\\\.\\\\d+)?|${primitiveTypes.join(\n\t\t\t\t\"|\",\n\t\t\t)}|${reservedTypes.join(\"|\")})>$`,\n\t\t},\n\t\t\"reserved-typeid\": {\n\t\t\tenum: reservedTypes,\n\t\t\ttype: \"string\",\n\t\t},\n\t\t\"context\": {\n\t\t\tenum: [\"single\", \"array\", \"map\", \"set\"],\n\t\t},\n\t\t\"typeid\": {\n\t\t\toneOf: [\n\t\t\t\t{ $ref: \"#/$defs/primitive-typeid\" },\n\t\t\t\t{ $ref: \"#/$defs/versioned-typeid\" },\n\t\t\t\t{ $ref: \"#/$defs/typed-reference-typeid\" },\n\t\t\t\t{ $ref: \"#/$defs/reserved-typeid\" },\n\t\t\t],\n\t\t},\n\t\t\"properties\": {\n\t\t\ttype: \"array\",\n\t\t\titems: { $ref: \"#/$defs/property-item\" },\n\t\t},\n\t\t\"property-item\": {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tcontext: { $ref: \"#/$defs/context\" },\n\t\t\t\ttypeid: { $ref: \"#/$defs/typeid\" },\n\t\t\t\tid: { type: \"string\" },\n\t\t\t\tvalue: {},\n\t\t\t\ttypedValue: {},\n\t\t\t\tproperties: { $ref: \"#/$defs/properties\" },\n\t\t\t\tannotation: { $ref: \"#/$defs/annotation\" },\n\t\t\t\tlength: {\n\t\t\t\t\ttype: \"integer\",\n\t\t\t\t\tmultipleOf: 1.0,\n\t\t\t\t\tminimum: 0,\n\t\t\t\t},\n\t\t\t\toptional: {\n\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t},\n\t\t\t},\n\t\t\trequired: [\"id\"],\n\t\t\tif: { properties: { typeid: { const: \"Enum\" } } },\n\t\t\tthen: { properties: { properties: { type: \"array\" } } },\n\t\t\telse: {\n\t\t\t\tanyOf: [\n\t\t\t\t\t{\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tproperties: { type: \"array\" },\n\t\t\t\t\t\t\ttypeid: { not: { type: \"string\" } },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttypeid: { type: \"string\" },\n\t\t\t\t\t\t\tproperties: { not: { type: \"array\" } },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t\"constants\": {\n\t\t\ttype: \"array\",\n\t\t\tminItems: 1,\n\t\t\titems: { $ref: \"#/$defs/constant-item\" },\n\t\t},\n\t\t\"constant-item\": {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tid: { type: \"string\" },\n\t\t\t\ttypeid: { $ref: \"#/$defs/typeid\" },\n\t\t\t\tvalue: {},\n\t\t\t\ttypedValue: {},\n\t\t\t\tcontext: { $ref: \"#/$defs/context\" },\n\t\t\t\tcontextKeyType: { $ref: \"#/$defs/context-key-type\" },\n\t\t\t\tannotation: { $ref: \"#/$defs/annotation\" },\n\t\t\t},\n\t\t\trequired: [\"id\"],\n\t\t},\n\t\t\"context-key-type\": {\n\t\t\tenum: [\"typeid\", \"string\"],\n\t\t},\n\t},\n\tallOf: [requireTypeidIfNotInherits, originalSchema],\n};\n\nexport { TemplateSchema, NativeTypes };\n"]}
1
+ {"version":3,"file":"templateSchema.js","sourceRoot":"","sources":["../src/templateSchema.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,GAAG;IACnB,YAAY,EAAE;QACb,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,KAAK;KAChB;IACD,iBAAiB,EAAE;QAClB,QAAQ,EAAE,CAAC,cAAc,CAAC;QAC1B,SAAS,EAAE,KAAK;KAChB;IACD,aAAa,EAAE;QACd,QAAQ,EAAE,CAAC,mBAAmB,CAAC;QAC/B,SAAS,EAAE,KAAK;KAChB;IACD,YAAY,EAAE;QACb,QAAQ,EAAE,CAAC,mBAAmB,CAAC;QAC/B,SAAS,EAAE,KAAK;KAChB;IACD,iBAAiB,EAAE;QAClB,QAAQ,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;QAC3C,SAAS,EAAE,KAAK;KAChB;IACD,oBAAoB,EAAE;QACrB,QAAQ,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;QAC3C,SAAS,EA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BACX,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBACtB,MAAM,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE;gBAClC,KAAK,EAAE,EAAE;gBACT,UAAU,EAAE,EAAE;gBACd,OAAO,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE;gBACpC,cAAc,EAAE,EAAE,IAAI,EAAE,0BAA0B,EAAE;gBACpD,UAAU,EAAE,EAAE,IAAI,EAAE,oBAAoB,EAAE;aAC1C;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SAChB;QACD,kBAAkB,EAAE;YACnB,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;SAC1B;KACD;IACD,KAAK,EAAE,CAAC,0BAA0B,EAAE,cAAc,CAAC;CACnD,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview\n * Declaration of the TemplateSchema module\n * The TemplateSchema is used for validating PropertySet templates that code is attempting to register\n */\n\n/**\n * Namespace containing all schema-related data for property set validation\n */\nconst NativeTypes = {\n\tBaseProperty: {\n\t\tinherits: [],\n\t\tprimitive: false,\n\t},\n\tContainerProperty: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: false,\n\t},\n\tNamedProperty: {\n\t\tinherits: [\"ContainerProperty\"],\n\t\tprimitive: false,\n\t},\n\tNodeProperty: {\n\t\tinherits: [\"ContainerProperty\"],\n\t\tprimitive: false,\n\t},\n\tNamedNodeProperty: {\n\t\tinherits: [\"NodeProperty\", \"NamedProperty\"],\n\t\tprimitive: false,\n\t},\n\tRelationshipProperty: {\n\t\tinherits: [\"NodeProperty\", \"NamedProperty\"],\n\t\tprimitive: false,\n\t},\n\tString: {\n\t\tinherits: [\"ContainerProperty\"],\n\t\tprimitive: true,\n\t},\n\tFloat32: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tFloat64: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tInt8: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tUint8: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tInt16: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tUint16: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tInt32: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tUint32: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tBool: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tReference: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tEnum: {\n\t\tinherits: [\"Int32\"],\n\t\tprimitive: true,\n\t},\n\tInt64: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n\tUint64: {\n\t\tinherits: [\"BaseProperty\"],\n\t\tprimitive: true,\n\t},\n};\n\nconst primitiveTypes = [];\nconst reservedTypes = [];\n\nObject.keys(NativeTypes).forEach(function (key) {\n\tif (NativeTypes[key].primitive) {\n\t\tprimitiveTypes.push(key);\n\t} else {\n\t\treservedTypes.push(key);\n\t}\n});\n\nconst requireTypeidIfNotInherits = {\n\tanyOf: [\n\t\t{\n\t\t\toneOf: [\n\t\t\t\t{\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tproperties: {\n\t\t\t\t\t\tconstants: { typeof: \"undefined\" },\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tprohibited: [\"constants\"],\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\ttype: \"object\",\n\t\t\trequired: [\"inherits\"],\n\t\t},\n\t\t{\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tconstants: {\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\titems: {\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\trequired: [\"typeid\"],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t],\n};\n\nconst originalSchema = {\n\ttype: \"object\",\n\tminProperties: 1,\n\tproperties: {\n\t\ttypeid: {\n\t\t\t$ref: \"#/$defs/versioned-typeid\",\n\t\t},\n\t\tproperties: {\n\t\t\t$ref: \"#/$defs/properties\",\n\t\t},\n\t\tconstants: {\n\t\t\t$ref: \"#/$defs/constants\",\n\t\t},\n\t\tinherits: {\n\t\t\toneOf: [\n\t\t\t\t{\n\t\t\t\t\t$ref: \"#/$defs/typeid\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\titems: {\n\t\t\t\t\t\t$ref: \"#/$defs/typeid\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\tannotation: {\n\t\t\t$ref: \"#/$defs/annotation\",\n\t\t},\n\t},\n\trequired: [\"typeid\"],\n};\n\n/**\n * @internal\n */\nconst TemplateSchema = {\n\t$schema: \"http://json-schema.org/schema\",\n\ttitle: \"Property set template schema\",\n\t$id: \"{TEMPLATE_SCHEMA_URL}\",\n\t$defs: {\n\t\t\"annotation\": {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tdescription: { type: \"string\" },\n\t\t\t\t// 'doc': { 'type': 'string', 'format': 'uri' }\n\t\t\t},\n\t\t},\n\t\t\"primitive-typeid\": {\n\t\t\tenum: primitiveTypes,\n\t\t\ttype: \"string\",\n\t\t},\n\t\t\"versioned-typeid\": {\n\t\t\ttype: \"string\",\n\t\t\tpattern: \"^[_a-zA-Z0-9\\\\.]+:[_a-zA-Z0-9\\\\.]+-(\\\\d+\\\\.\\\\d+\\\\.\\\\d+|draft)$\",\n\t\t},\n\t\t\"typed-reference-typeid\": {\n\t\t\ttype: \"string\",\n\t\t\tpattern: `^Reference<([_a-zA-Z0-9\\\\.]+:[_a-zA-Z0-9\\\\.]+(-\\\\d+\\\\.\\\\d+\\\\.\\\\d+)?|${primitiveTypes.join(\n\t\t\t\t\"|\",\n\t\t\t)}|${reservedTypes.join(\"|\")})>$`,\n\t\t},\n\t\t\"reserved-typeid\": {\n\t\t\tenum: reservedTypes,\n\t\t\ttype: \"string\",\n\t\t},\n\t\t\"context\": {\n\t\t\tenum: [\"single\", \"array\", \"map\", \"set\"],\n\t\t},\n\t\t\"typeid\": {\n\t\t\toneOf: [\n\t\t\t\t{ $ref: \"#/$defs/primitive-typeid\" },\n\t\t\t\t{ $ref: \"#/$defs/versioned-typeid\" },\n\t\t\t\t{ $ref: \"#/$defs/typed-reference-typeid\" },\n\t\t\t\t{ $ref: \"#/$defs/reserved-typeid\" },\n\t\t\t],\n\t\t},\n\t\t\"properties\": {\n\t\t\ttype: \"array\",\n\t\t\titems: { $ref: \"#/$defs/property-item\" },\n\t\t},\n\t\t\"property-item\": {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tcontext: { $ref: \"#/$defs/context\" },\n\t\t\t\ttypeid: { $ref: \"#/$defs/typeid\" },\n\t\t\t\tid: { type: \"string\" },\n\t\t\t\tvalue: {},\n\t\t\t\ttypedValue: {},\n\t\t\t\tproperties: { $ref: \"#/$defs/properties\" },\n\t\t\t\tannotation: { $ref: \"#/$defs/annotation\" },\n\t\t\t\tlength: {\n\t\t\t\t\ttype: \"integer\",\n\t\t\t\t\tmultipleOf: 1.0,\n\t\t\t\t\tminimum: 0,\n\t\t\t\t},\n\t\t\t\toptional: {\n\t\t\t\t\ttype: \"boolean\",\n\t\t\t\t},\n\t\t\t},\n\t\t\trequired: [\"id\"],\n\t\t\tif: { properties: { typeid: { const: \"Enum\" } } },\n\t\t\tthen: { properties: { properties: { type: \"array\" } } },\n\t\t\telse: {\n\t\t\t\tanyOf: [\n\t\t\t\t\t{\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\tproperties: { type: \"array\" },\n\t\t\t\t\t\t\ttypeid: { not: { type: \"string\" } },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\ttypeid: { type: \"string\" },\n\t\t\t\t\t\t\tproperties: { not: { type: \"array\" } },\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t\t\"constants\": {\n\t\t\ttype: \"array\",\n\t\t\tminItems: 1,\n\t\t\titems: { $ref: \"#/$defs/constant-item\" },\n\t\t},\n\t\t\"constant-item\": {\n\t\t\ttype: \"object\",\n\t\t\tproperties: {\n\t\t\t\tid: { type: \"string\" },\n\t\t\t\ttypeid: { $ref: \"#/$defs/typeid\" },\n\t\t\t\tvalue: {},\n\t\t\t\ttypedValue: {},\n\t\t\t\tcontext: { $ref: \"#/$defs/context\" },\n\t\t\t\tcontextKeyType: { $ref: \"#/$defs/context-key-type\" },\n\t\t\t\tannotation: { $ref: \"#/$defs/annotation\" },\n\t\t\t},\n\t\t\trequired: [\"id\"],\n\t\t},\n\t\t\"context-key-type\": {\n\t\t\tenum: [\"typeid\", \"string\"],\n\t\t},\n\t},\n\tallOf: [requireTypeidIfNotInherits, originalSchema],\n};\n\nexport { TemplateSchema, NativeTypes };\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 { SchemaValidationResult } from "./validationResultBuilder";
5
+ import { SchemaValidationResult } from "./validationResultBuilder.js";
6
6
  type ValuesType = {
7
7
  [key: string]: ValuesType;
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"templateValidator.d.ts","sourceRoot":"","sources":["../src/templateValidator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqCH,OAAO,EAAE,s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AC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAChE,kBAAkB,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACzF,eAAe,EAAE,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACrF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;IACtC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAU;gBAC1B,SAAS,GAAE,wBAAmE;IAuB1F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACH,QAAQ,CACP,WAAW,EAAE,cAAc,EAC3B,mBAAmB,CAAC,EAAE,cAAc,GAClC,sBAAsB;IA4FzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IACG,aAAa,CAClB,WAAW,EAAE,cAAc,EAC3B,mBAAmB,CAAC,EAAE,cAAc,GAClC,OAAO,CAAC,sBAAsB,CAAC;IAclC;;;;;;;;OAQG;YACW,gCAAgC;CAyD9C"}
@@ -8,38 +8,29 @@
8
8
  * versioning (semver) errors and warn about incorrect versioning practices.
9
9
  */
10
10
  // There are lots of violations in this file.
11
- /* eslint-disable @typescript-eslint/no-base-to-string */
12
11
  /* eslint-disable jsdoc/check-line-alignment */
13
- import Ajv from "ajv";
14
- import ajvKeywords from "ajv-keywords";
15
- import each from "lodash/each";
16
- import isEqual from "lodash/isEqual";
17
- import every from "lodash/every";
18
- import isString from "lodash/isString";
19
- import isObject from "lodash/isObject";
20
- import difference from "lodash/difference";
21
- import has from "lodash/has";
22
- import mapValues from "lodash/mapValues";
23
- import includes from "lodash/includes";
24
- import map from "lodash/map";
25
- import find from "lodash/find";
26
- import isEmpty from "lodash/isEmpty";
12
+ import { constants, ConsoleUtils } from "@fluid-experimental/property-common";
13
+ import { queue } from "async";
27
14
  import { copy as cloneDeep } from "fastest-json-copy";
28
- import { gt, diff, major, valid, compare } from "semver";
15
+ import difference from "lodash/difference.js";
16
+ import each from "lodash/each.js";
17
+ import every from "lodash/every.js";
18
+ import find from "lodash/find.js";
19
+ import has from "lodash/has.js";
20
+ import includes from "lodash/includes.js";
21
+ import isEmpty from "lodash/isEmpty.js";
22
+ import isEqual from "lodash/isEqual.js";
23
+ import isObject from "lodash/isObject.js";
24
+ import isString from "lodash/isString.js";
25
+ import map from "lodash/map.js";
26
+ import mapValues from "lodash/mapValues.js";
27
+ import { compare, diff, gt, major, valid } from "semver";
29
28
  import traverse from "traverse";
30
- import { queue } from "async";
31
- // @ts-ignore
32
- import { constants, ConsoleUtils } from "@fluid-experimental/property-common";
33
- import { TemplateSchema } from "./templateSchema";
34
- import { TypeIdHelper } from "./helpers/typeidHelper";
35
- import { ValidationResultBuilder } from "./validationResultBuilder";
29
+ import { ajvFactory } from "./ajvFactory.cjs";
30
+ import { TypeIdHelper } from "./helpers/typeidHelper.js";
31
+ import { TemplateSchema } from "./templateSchema.js";
32
+ import { ValidationResultBuilder } from "./validationResultBuilder.js";
36
33
  const { MSG } = constants;
37
- const ajvFactory = new Ajv({
38
- allErrors: true,
39
- verbose: true,
40
- });
41
- ajvKeywords(ajvFactory, "prohibited");
42
- ajvKeywords(ajvFactory, "typeof");
43
34
  const _syntaxValidator = ajvFactory.compile(TemplateSchema);
44
35
  /**
45
36
  * A weighted enumeration of semver change types. Higher values are more important.
@@ -671,6 +662,7 @@ const _processValidationResults = function (in_template) {
671
662
  switch (error.keyword) {
672
663
  case "pattern":
673
664
  if (error.instancePath === ".typeid") {
665
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
674
666
  error.message = `typeid should have a pattern like: my.example:point-1.0.0 ${error.data} does not match that pattern`;
675
667
  }
676
668
  else if ("pattern" && regexTypeId.test(error.instancePath)) {
@@ -681,15 +673,18 @@ const _processValidationResults = function (in_template) {
681
673
  `(for example: Sample:Rectangle-1.0.0) or match one of the Primitive Types (Float32, Float64, ` +
682
674
  `Int8, Uint8, Int16, Uint16, Int32, Uint32, Bool, String, Reference, Enum, Int64, Uint64) or ` +
683
675
  `Reserved Types (BaseProperty, NamedProperty, NodeProperty, NamedNodeProperty, ` +
676
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
684
677
  `RelationshipProperty). '${error.data}' is not valid`;
685
678
  }
686
679
  break;
687
680
  case "enum":
688
681
  error.message = regexTypeId.test(error.instancePath)
689
682
  ? ""
690
- : `${error.instancePath} should match one of the following: ${error.schema}`;
683
+ : // eslint-disable-next-line @typescript-eslint/no-base-to-string
684
+ `${error.instancePath} should match one of the following: ${error.schema}`;
691
685
  break;
692
686
  case "type":
687
+ // eslint-disable-next-line @typescript-eslint/no-base-to-string
693
688
  error.message = `${error.instancePath} should be a ${error.schema}`;
694
689
  break;
695
690
  case "not":