@fluid-experimental/property-properties 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.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 (266) hide show
  1. package/README.md +1 -0
  2. package/dist/containerSerializer.d.ts.map +1 -1
  3. package/dist/containerSerializer.js +5 -5
  4. package/dist/containerSerializer.js.map +1 -1
  5. package/dist/enableValidations.js.map +1 -1
  6. package/dist/index.d.ts +19 -19
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/properties/abstractStaticCollectionProperty.d.ts +10 -10
  10. package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
  11. package/dist/properties/abstractStaticCollectionProperty.js +70 -53
  12. package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
  13. package/dist/properties/arrayProperty.d.ts.map +1 -1
  14. package/dist/properties/arrayProperty.js +152 -103
  15. package/dist/properties/arrayProperty.js.map +1 -1
  16. package/dist/properties/baseProperty.d.ts +4 -4
  17. package/dist/properties/baseProperty.d.ts.map +1 -1
  18. package/dist/properties/baseProperty.js +69 -47
  19. package/dist/properties/baseProperty.js.map +1 -1
  20. package/dist/properties/boolProperty.d.ts.map +1 -1
  21. package/dist/properties/boolProperty.js +3 -3
  22. package/dist/properties/boolProperty.js.map +1 -1
  23. package/dist/properties/containerProperty.d.ts +8 -8
  24. package/dist/properties/containerProperty.d.ts.map +1 -1
  25. package/dist/properties/containerProperty.js +33 -26
  26. package/dist/properties/containerProperty.js.map +1 -1
  27. package/dist/properties/enumArrayProperty.d.ts.map +1 -1
  28. package/dist/properties/enumArrayProperty.js +14 -14
  29. package/dist/properties/enumArrayProperty.js.map +1 -1
  30. package/dist/properties/enumProperty.d.ts.map +1 -1
  31. package/dist/properties/enumProperty.js +17 -17
  32. package/dist/properties/enumProperty.js.map +1 -1
  33. package/dist/properties/floatProperties.js +4 -4
  34. package/dist/properties/floatProperties.js.map +1 -1
  35. package/dist/properties/index.d.ts +23 -23
  36. package/dist/properties/index.d.ts.map +1 -1
  37. package/dist/properties/index.js.map +1 -1
  38. package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
  39. package/dist/properties/indexedCollectionBaseProperty.js +47 -37
  40. package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
  41. package/dist/properties/intProperties.d.ts.map +1 -1
  42. package/dist/properties/intProperties.js +10 -10
  43. package/dist/properties/intProperties.js.map +1 -1
  44. package/dist/properties/lazyLoadedProperties.js.map +1 -1
  45. package/dist/properties/mapProperty.d.ts.map +1 -1
  46. package/dist/properties/mapProperty.js +21 -17
  47. package/dist/properties/mapProperty.js.map +1 -1
  48. package/dist/properties/namedNodeProperty.d.ts.map +1 -1
  49. package/dist/properties/namedNodeProperty.js +3 -3
  50. package/dist/properties/namedNodeProperty.js.map +1 -1
  51. package/dist/properties/namedProperty.d.ts.map +1 -1
  52. package/dist/properties/namedProperty.js +7 -5
  53. package/dist/properties/namedProperty.js.map +1 -1
  54. package/dist/properties/nodeProperty.d.ts.map +1 -1
  55. package/dist/properties/nodeProperty.js +5 -3
  56. package/dist/properties/nodeProperty.js.map +1 -1
  57. package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
  58. package/dist/properties/primitiveTypeCasts.js +9 -9
  59. package/dist/properties/primitiveTypeCasts.js.map +1 -1
  60. package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
  61. package/dist/properties/referenceArrayProperty.js +31 -25
  62. package/dist/properties/referenceArrayProperty.js.map +1 -1
  63. package/dist/properties/referenceMapProperty.d.ts.map +1 -1
  64. package/dist/properties/referenceMapProperty.js +18 -18
  65. package/dist/properties/referenceMapProperty.js.map +1 -1
  66. package/dist/properties/referenceProperty.d.ts.map +1 -1
  67. package/dist/properties/referenceProperty.js +33 -29
  68. package/dist/properties/referenceProperty.js.map +1 -1
  69. package/dist/properties/setProperty.d.ts.map +1 -1
  70. package/dist/properties/setProperty.js +31 -29
  71. package/dist/properties/setProperty.js.map +1 -1
  72. package/dist/properties/stringProperty.d.ts.map +1 -1
  73. package/dist/properties/stringProperty.js +56 -40
  74. package/dist/properties/stringProperty.js.map +1 -1
  75. package/dist/properties/uintProperties.js +5 -5
  76. package/dist/properties/uintProperties.js.map +1 -1
  77. package/dist/properties/valueArrayProperty.d.ts +1 -1
  78. package/dist/properties/valueArrayProperty.d.ts.map +1 -1
  79. package/dist/properties/valueArrayProperty.js +30 -29
  80. package/dist/properties/valueArrayProperty.js.map +1 -1
  81. package/dist/properties/valueMapProperty.d.ts.map +1 -1
  82. package/dist/properties/valueMapProperty.js +31 -29
  83. package/dist/properties/valueMapProperty.js.map +1 -1
  84. package/dist/properties/valueProperty.d.ts.map +1 -1
  85. package/dist/properties/valueProperty.js +11 -9
  86. package/dist/properties/valueProperty.js.map +1 -1
  87. package/dist/propertyFactory.d.ts.map +1 -1
  88. package/dist/propertyFactory.js +309 -252
  89. package/dist/propertyFactory.js.map +1 -1
  90. package/dist/propertyTemplate.d.ts +17 -17
  91. package/dist/propertyTemplate.d.ts.map +1 -1
  92. package/dist/propertyTemplate.js +64 -45
  93. package/dist/propertyTemplate.js.map +1 -1
  94. package/dist/propertyTemplateWrapper.d.ts.map +1 -1
  95. package/dist/propertyTemplateWrapper.js +40 -25
  96. package/dist/propertyTemplateWrapper.js.map +1 -1
  97. package/dist/propertyUtils.d.ts.map +1 -1
  98. package/dist/propertyUtils.js.map +1 -1
  99. package/dist/test/properties/arrayProperty.spec.js +566 -490
  100. package/dist/test/properties/arrayProperty.spec.js.map +1 -1
  101. package/dist/test/properties/baseProperty.spec.js +293 -280
  102. package/dist/test/properties/baseProperty.spec.js.map +1 -1
  103. package/dist/test/properties/containerProperty.spec.js +100 -94
  104. package/dist/test/properties/containerProperty.spec.js.map +1 -1
  105. package/dist/test/properties/customArrayProperty.spec.js +174 -147
  106. package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
  107. package/dist/test/properties/enumArrayProperty.spec.js +67 -63
  108. package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
  109. package/dist/test/properties/enumProperty.spec.js +115 -97
  110. package/dist/test/properties/enumProperty.spec.js.map +1 -1
  111. package/dist/test/properties/float32.spec.js +5 -5
  112. package/dist/test/properties/float32.spec.js.map +1 -1
  113. package/dist/test/properties/int64ArrayProperty.spec.js +157 -93
  114. package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
  115. package/dist/test/properties/int64MapProperty.spec.js +185 -166
  116. package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
  117. package/dist/test/properties/int64Property.spec.js +109 -109
  118. package/dist/test/properties/int64Property.spec.js.map +1 -1
  119. package/dist/test/properties/isLeafNode.spec.js +75 -76
  120. package/dist/test/properties/isLeafNode.spec.js.map +1 -1
  121. package/dist/test/properties/mapProperty.spec.js +571 -531
  122. package/dist/test/properties/mapProperty.spec.js.map +1 -1
  123. package/dist/test/properties/namedNodeProperty.spec.js +31 -31
  124. package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
  125. package/dist/test/properties/nodeProperty.spec.js +805 -795
  126. package/dist/test/properties/nodeProperty.spec.js.map +1 -1
  127. package/dist/test/properties/referenceProperty.spec.js +729 -679
  128. package/dist/test/properties/referenceProperty.spec.js.map +1 -1
  129. package/dist/test/properties/relationshipProperty.spec.js +16 -16
  130. package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
  131. package/dist/test/properties/setProperty.spec.js +288 -227
  132. package/dist/test/properties/setProperty.spec.js.map +1 -1
  133. package/dist/test/properties/stringProperty.spec.js +326 -318
  134. package/dist/test/properties/stringProperty.spec.js.map +1 -1
  135. package/dist/test/properties/uint64Property.spec.js +46 -36
  136. package/dist/test/properties/uint64Property.spec.js.map +1 -1
  137. package/dist/test/properties/valueMapProperty.spec.js +259 -246
  138. package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
  139. package/dist/test/properties/valueProperty.spec.js +49 -43
  140. package/dist/test/properties/valueProperty.spec.js.map +1 -1
  141. package/dist/test/propertyFactory.spec.js +2038 -1631
  142. package/dist/test/propertyFactory.spec.js.map +1 -1
  143. package/dist/test/propertyTemplateWrapper.spec.js +72 -102
  144. package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
  145. package/dist/test/propertyUtils.spec.js +22 -21
  146. package/dist/test/propertyUtils.spec.js.map +1 -1
  147. package/dist/test/reversibleChangeset.spec.js +857 -703
  148. package/dist/test/reversibleChangeset.spec.js.map +1 -1
  149. package/dist/test/setup.js +5 -5
  150. package/dist/test/setup.js.map +1 -1
  151. package/dist/test/tsconfig.tsbuildinfo +1 -1
  152. package/dist/test/utils.spec.js +1334 -1144
  153. package/dist/test/utils.spec.js.map +1 -1
  154. package/dist/test/validation/badMissingSemverInTypeid.js +20 -20
  155. package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
  156. package/dist/test/validation/badPrimitiveTypeid.js +12 -12
  157. package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
  158. package/dist/test/validation/goodColorId.js +91 -91
  159. package/dist/test/validation/goodColorId.js.map +1 -1
  160. package/dist/test/validation/goodColorPalette.js +4 -4
  161. package/dist/test/validation/goodColorPalette.js.map +1 -1
  162. package/dist/test/validation/goodPointId.js +20 -20
  163. package/dist/test/validation/goodPointId.js.map +1 -1
  164. package/dist/test/validation/reversibleChangeSetTestData.js +23841 -2
  165. package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
  166. package/lib/containerSerializer.d.ts.map +1 -1
  167. package/lib/containerSerializer.js +5 -5
  168. package/lib/containerSerializer.js.map +1 -1
  169. package/lib/enableValidations.js.map +1 -1
  170. package/lib/index.d.ts +19 -19
  171. package/lib/index.d.ts.map +1 -1
  172. package/lib/index.js +19 -19
  173. package/lib/index.js.map +1 -1
  174. package/lib/properties/abstractStaticCollectionProperty.d.ts +10 -10
  175. package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
  176. package/lib/properties/abstractStaticCollectionProperty.js +70 -53
  177. package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
  178. package/lib/properties/arrayProperty.d.ts.map +1 -1
  179. package/lib/properties/arrayProperty.js +152 -103
  180. package/lib/properties/arrayProperty.js.map +1 -1
  181. package/lib/properties/baseProperty.d.ts +4 -4
  182. package/lib/properties/baseProperty.d.ts.map +1 -1
  183. package/lib/properties/baseProperty.js +73 -51
  184. package/lib/properties/baseProperty.js.map +1 -1
  185. package/lib/properties/boolProperty.d.ts.map +1 -1
  186. package/lib/properties/boolProperty.js +3 -3
  187. package/lib/properties/boolProperty.js.map +1 -1
  188. package/lib/properties/containerProperty.d.ts +8 -8
  189. package/lib/properties/containerProperty.d.ts.map +1 -1
  190. package/lib/properties/containerProperty.js +33 -26
  191. package/lib/properties/containerProperty.js.map +1 -1
  192. package/lib/properties/enumArrayProperty.d.ts.map +1 -1
  193. package/lib/properties/enumArrayProperty.js +14 -14
  194. package/lib/properties/enumArrayProperty.js.map +1 -1
  195. package/lib/properties/enumProperty.d.ts.map +1 -1
  196. package/lib/properties/enumProperty.js +17 -17
  197. package/lib/properties/enumProperty.js.map +1 -1
  198. package/lib/properties/floatProperties.js +4 -4
  199. package/lib/properties/floatProperties.js.map +1 -1
  200. package/lib/properties/index.d.ts +23 -23
  201. package/lib/properties/index.d.ts.map +1 -1
  202. package/lib/properties/index.js +23 -23
  203. package/lib/properties/index.js.map +1 -1
  204. package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
  205. package/lib/properties/indexedCollectionBaseProperty.js +47 -37
  206. package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
  207. package/lib/properties/intProperties.d.ts.map +1 -1
  208. package/lib/properties/intProperties.js +10 -10
  209. package/lib/properties/intProperties.js.map +1 -1
  210. package/lib/properties/lazyLoadedProperties.js.map +1 -1
  211. package/lib/properties/mapProperty.d.ts.map +1 -1
  212. package/lib/properties/mapProperty.js +21 -17
  213. package/lib/properties/mapProperty.js.map +1 -1
  214. package/lib/properties/namedNodeProperty.d.ts.map +1 -1
  215. package/lib/properties/namedNodeProperty.js +3 -3
  216. package/lib/properties/namedNodeProperty.js.map +1 -1
  217. package/lib/properties/namedProperty.d.ts.map +1 -1
  218. package/lib/properties/namedProperty.js +7 -5
  219. package/lib/properties/namedProperty.js.map +1 -1
  220. package/lib/properties/nodeProperty.d.ts.map +1 -1
  221. package/lib/properties/nodeProperty.js +5 -3
  222. package/lib/properties/nodeProperty.js.map +1 -1
  223. package/lib/properties/primitiveTypeCasts.d.ts.map +1 -1
  224. package/lib/properties/primitiveTypeCasts.js +9 -9
  225. package/lib/properties/primitiveTypeCasts.js.map +1 -1
  226. package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
  227. package/lib/properties/referenceArrayProperty.js +31 -25
  228. package/lib/properties/referenceArrayProperty.js.map +1 -1
  229. package/lib/properties/referenceMapProperty.d.ts.map +1 -1
  230. package/lib/properties/referenceMapProperty.js +18 -18
  231. package/lib/properties/referenceMapProperty.js.map +1 -1
  232. package/lib/properties/referenceProperty.d.ts.map +1 -1
  233. package/lib/properties/referenceProperty.js +33 -29
  234. package/lib/properties/referenceProperty.js.map +1 -1
  235. package/lib/properties/setProperty.d.ts.map +1 -1
  236. package/lib/properties/setProperty.js +31 -29
  237. package/lib/properties/setProperty.js.map +1 -1
  238. package/lib/properties/stringProperty.d.ts.map +1 -1
  239. package/lib/properties/stringProperty.js +56 -40
  240. package/lib/properties/stringProperty.js.map +1 -1
  241. package/lib/properties/uintProperties.js +5 -5
  242. package/lib/properties/uintProperties.js.map +1 -1
  243. package/lib/properties/valueArrayProperty.d.ts +1 -1
  244. package/lib/properties/valueArrayProperty.d.ts.map +1 -1
  245. package/lib/properties/valueArrayProperty.js +30 -29
  246. package/lib/properties/valueArrayProperty.js.map +1 -1
  247. package/lib/properties/valueMapProperty.d.ts.map +1 -1
  248. package/lib/properties/valueMapProperty.js +31 -29
  249. package/lib/properties/valueMapProperty.js.map +1 -1
  250. package/lib/properties/valueProperty.d.ts.map +1 -1
  251. package/lib/properties/valueProperty.js +11 -9
  252. package/lib/properties/valueProperty.js.map +1 -1
  253. package/lib/propertyFactory.d.ts.map +1 -1
  254. package/lib/propertyFactory.js +309 -252
  255. package/lib/propertyFactory.js.map +1 -1
  256. package/lib/propertyTemplate.d.ts +17 -17
  257. package/lib/propertyTemplate.d.ts.map +1 -1
  258. package/lib/propertyTemplate.js +64 -45
  259. package/lib/propertyTemplate.js.map +1 -1
  260. package/lib/propertyTemplateWrapper.d.ts.map +1 -1
  261. package/lib/propertyTemplateWrapper.js +40 -25
  262. package/lib/propertyTemplateWrapper.js.map +1 -1
  263. package/lib/propertyUtils.d.ts.map +1 -1
  264. package/lib/propertyUtils.js.map +1 -1
  265. package/package.json +28 -28
  266. package/src/index.d.ts +2750 -2681
@@ -1 +1 @@
1
- {"version":3,"file":"referenceArrayProperty.js","sourceRoot":"","sources":["../../src/properties/referenceArrayProperty.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,kBAAkB,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AAC5F,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7D,MAAM,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAE/D;;GAEG;AACH,MAAa,sBAAuB,SAAQ,kBAAkB;IAC1D;;;;;;;;OAQG;IACH,YAA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\n */\n/**\n * @fileoverview Definition of the reference array property class\n */\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { UniversalDataArray, ConsoleUtils } = require('@fluid-experimental/property-common');\nconst _ = require('lodash');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { ReferenceProperty } = require('./referenceProperty');\nconst { ValueArrayProperty } = require('./valueArrayProperty');\n\n/**\n * An ArrayProperty which stores reference values\n */\nexport class ReferenceArrayProperty extends ValueArrayProperty {\n /**\n * @param {Object} in_params - Input parameters for property creation\n *\n * @constructor\n * @protected\n * @extends property-properties.ArrayProperty\n * @alias property-properties.ReferenceArrayProperty\n * @category Arrays\n */\n constructor(in_params) {\n super(in_params);\n }\n\n /**\n * Returns the typeid for the target of this reference\n *\n * Note: This is the type that is specified in the typeid of this reference and not the actual type\n * of the referenced object, which might inherit from that typeid.\n *\n * @returns {string} The typeid of the nodes this reference may point to\n */\n getReferenceTargetTypeId() {\n return TypeIdHelper.extractReferenceTargetTypeIdFromReference(this.getTypeid());\n }\n\n /**\n * Resolves the referenced property for the given key\n *\n * @param {number|array<string|number>} in_ids - the ID of the property or an array of IDs if an array is passed,\n * the .get function will be performed on each id in sequence for example .get([0, 'position','x']) is equivalent to\n * .get(0).get('position').get('x'). If `.get` resolves to a ReferenceProperty, it will, by default, return the\n * property that the ReferenceProperty refers to.\n * @param {Object} in_options - parameter object\n * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How\n * should this function behave during reference resolution?\n *\n * @returns {property-properties.BaseProperty|undefined} The property object the reference points to or undefined if\n * it could not be resolved\n */\n get(in_ids, in_options) {\n in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n\n if (_.isArray(in_ids)) {\n // Forward handling of arrays to the AbstractStaticCollectionProperty function\n return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n } else {\n var value = this._dataArrayRef.getValue(in_ids);\n if (value === undefined ||\n value === '') {\n return undefined;\n }\n\n return this.getParent().resolvePath(value, in_options);\n }\n }\n\n /**\n * Checks whether the reference is valid. This is either the case when it is empty or when the referenced\n * property exists.\n *\n * @param {number} in_position - The target index\n * @returns {boolean} True if the reference is valid, otherwise false.\n */\n isReferenceValid(in_position) {\n return ValueArrayProperty.prototype.get.call(this, in_position) === '' ||\n this.get(in_position) !== undefined;\n }\n\n /**\n * Sets the range in the array to point to the given property objects or to be equal to the given paths\n *\n * @param {number} in_offset - Target start index\n * @param {Array<property-properties.BaseProperty|undefined|String>} in_array - Contains the properties to be set or\n * the paths to those properties. If undefined is passed, the reference will be set to an empty string to\n * indicate an empty reference.\n * @throws If in_offset is smaller than zero, larger than the length of the array or not a number\n * @throws If in_array is not an array\n * @throws If one of the items in in_array is defined, but is not a property or a string.\n */\n setRange(in_offset, in_array) {\n var arr = ReferenceArrayProperty._convertInputToPaths(in_array, 'setRange');\n ValueArrayProperty.prototype.setRange.call(this, in_offset, arr);\n }\n\n /**\n * Insert a range which points to the given property objects into the array\n *\n * @param {number} in_offset - Target start index\n * @param {Array<property-properties.BaseProperty|undefined|String>} in_array - Contains the properties to be set or\n * the paths to those properties. If undefined is passed, the reference will be set to an empty string to\n * indicate an empty reference.\n * @throws If in_offset is smaller than zero, larger than the length of the array or not a number\n * @throws If in_array is not an array\n * @throws If one of the items in in_array is defined, but is not a property or a string.\n */\n insertRange(in_offset, in_array) {\n var arr = ReferenceArrayProperty._convertInputToPaths(in_array, 'insertRange');\n ValueArrayProperty.prototype.insertRange.call(this, in_offset, arr);\n }\n\n /**\n * Returns the path value of a reference.\n * @param {number} in_id - The index of the property\n * @returns {string} The path string\n */\n getValue(in_id) {\n return this._dataArrayRef.getValue(in_id);\n }\n\n /**\n * Returns an object with all the nested values contained in this property\n * @returns {array<String>} an array of strings representing the paths listed in this array\n * for example: ['/path1', '/path2']\n */\n getValues() {\n var result = [];\n var ids = this.getIds();\n for (var i = 0; i < ids.length; i++) {\n result.push(this.getValue(ids[i]));\n }\n return result;\n }\n\n /**\n * Removes the last element of the array\n * @throws If trying to modify a referenced property\n * @returns {String} deleted element (string path)\n */\n pop() {\n if (this._dataArrayRef.length > 0) {\n var item = this.getValue(this._dataArrayRef.length - 1);\n this.remove(this._dataArrayRef.length - 1);\n return item;\n } else {\n return undefined;\n }\n }\n\n /**\n * Removes an element of the array and shift remaining elements to the left\n * @param {number} in_position - The index that will be removed\n * @throws If in_position is not a number\n * @throws If trying to remove an item with a parent\n * @throws If trying to remove something that does not exist\n * @returns {String} the value that was removed (string path).\n */\n remove(in_position) {\n var value = this.getValue(in_position);\n this.removeRange(in_position, 1);\n return value;\n }\n\n /**\n * Removes a given number of elements from the array and shifts remaining values to the left.\n * @param {number} in_offset - Target start index\n * @param {number} in_deleteCount - Number of elements to be deleted\n * @throws If in_offset is not a number\n * @throws If in_deleteCount is not a number\n * @throws If trying to remove an item with a parent\n * @throws If in_offset is smaller than zero or if in_offset + in_delete count is larger than the length of the array\n * @returns {Array<String>} an array containing the values removed (string paths)\n */\n removeRange(in_offset, in_deleteCount) {\n ConsoleUtils.assert(_.isNumber(in_offset),\n MSG.NOT_NUMBER + 'in_offset, method: ArrayProperty.removeRange or .remove');\n ConsoleUtils.assert(_.isNumber(in_deleteCount),\n MSG.NOT_NUMBER + 'in_deleteCount, method: ArrayProperty.removeRange or .remove');\n ConsoleUtils.assert(in_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0,\n MSG.REMOVE_OUT_OF_BOUNDS + 'Cannot remove ' + in_deleteCount + ' items starting at index ' + in_offset);\n var result = [];\n for (var i = in_offset; i < in_offset + in_deleteCount; i++) {\n result.push(this.getValue(i));\n }\n this._checkIsNotReadOnly(true);\n this._removeRangeWithoutDirtying(in_offset, in_deleteCount);\n this._setDirty();\n return result;\n }\n\n /**\n * @inheritdoc\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n // Array tokens are automatically resolved\n return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN\n ? this.get(in_segment, { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER })\n // Everything else is handled by the implementation in the base property\n : AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\n\n /**\n * Creates and initializes the data array\n * @param {Number} in_length - The initial length of the array\n */\n _dataArrayCreate(in_length) {\n this._dataArrayRef = new UniversalDataArray(in_length);\n for (var i = 0; i < in_length; i++) {\n this._dataArraySetValue(i, '');\n }\n }\n\n /**\n * Validates the array and returns a sanitized version of it containing only strings.\n *\n * @param {Array<property-properties.BaseProperty|undefined|String>} in_array - contains the properties to be set or\n * the paths to those properties. If undefined is passed, the reference will be set to an empty string to\n * indicate an empty reference.\n * @param {String} in_callerName - the name of the function that called, to make it appear in\n * the error message if any\n * @returns {Array<string>} The array of paths\n * @throws If in_array is not an array\n * @throws If one of the items in in_array is defined, but is not a property or a string.\n */\n static _convertInputToPaths = function(in_array, in_callerName) {\n if (!_.isArray(in_array)) {\n throw new TypeError(MSG.IN_ARRAY_NOT_ARRAY + 'ReferenceArrayProperty.' + in_callerName);\n }\n var len = in_array.length;\n var arr = new Array(len);\n for (var i = 0; i < len; i++) {\n arr[i] = ReferenceProperty._convertInputToPath(in_array[i]);\n }\n return arr;\n };\n}\nReferenceArrayProperty.prototype._typeid = 'Reference';\n"]}
1
+ {"version":3,"file":"referenceArrayProperty.js","sourceRoot":"","sources":["../../src/properties/referenceArrayProperty.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAA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kB,GAAG,yBAAyB,GAAG,aAAa,CAAC,CAAC;KACxF;IACD,IAAI,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC;IAC1B,IAAI,GAAG,GAAG,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE;QAC7B,GAAG,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5D;IACD,OAAO,GAAG,CAAC;AACZ,CAAC,CAAC;AAEH,sBAAsB,CAAC,SAAS,CAAC,OAAO,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the reference array property class\n */\nconst { PathHelper, TypeIdHelper } = require(\"@fluid-experimental/property-changeset\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\nconst { UniversalDataArray, ConsoleUtils } = require(\"@fluid-experimental/property-common\");\nconst _ = require(\"lodash\");\nconst { AbstractStaticCollectionProperty } = require(\"./abstractStaticCollectionProperty\");\nconst { BaseProperty } = require(\"./baseProperty\");\nconst { ReferenceProperty } = require(\"./referenceProperty\");\nconst { ValueArrayProperty } = require(\"./valueArrayProperty\");\n\n/**\n * An ArrayProperty which stores reference values\n */\nexport class ReferenceArrayProperty extends ValueArrayProperty {\n\t/**\n\t * @param {Object} in_params - Input parameters for property creation\n\t *\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.ArrayProperty\n\t * @alias property-properties.ReferenceArrayProperty\n\t * @category Arrays\n\t */\n\tconstructor(in_params) {\n\t\tsuper(in_params);\n\t}\n\n\t/**\n\t * Returns the typeid for the target of this reference\n\t *\n\t * Note: This is the type that is specified in the typeid of this reference and not the actual type\n\t * of the referenced object, which might inherit from that typeid.\n\t *\n\t * @returns {string} The typeid of the nodes this reference may point to\n\t */\n\tgetReferenceTargetTypeId() {\n\t\treturn TypeIdHelper.extractReferenceTargetTypeIdFromReference(this.getTypeid());\n\t}\n\n\t/**\n\t * Resolves the referenced property for the given key\n\t *\n\t * @param {number|array<string|number>} in_ids - the ID of the property or an array of IDs if an array is passed,\n\t * the .get function will be performed on each id in sequence for example .get([0, 'position','x']) is equivalent to\n\t * .get(0).get('position').get('x'). If `.get` resolves to a ReferenceProperty, it will, by default, return the\n\t * property that the ReferenceProperty refers to.\n\t * @param {Object} in_options - parameter object\n\t * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How\n\t * should this function behave during reference resolution?\n\t *\n\t * @returns {property-properties.BaseProperty|undefined} The property object the reference points to or undefined if\n\t * it could not be resolved\n\t */\n\tget(in_ids, in_options) {\n\t\tin_options = in_options || {};\n\t\tin_options.referenceResolutionMode =\n\t\t\tin_options.referenceResolutionMode === undefined\n\t\t\t\t? BaseProperty.REFERENCE_RESOLUTION.ALWAYS\n\t\t\t\t: in_options.referenceResolutionMode;\n\n\t\tif (_.isArray(in_ids)) {\n\t\t\t// Forward handling of arrays to the AbstractStaticCollectionProperty function\n\t\t\treturn AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n\t\t} else {\n\t\t\tvar value = this._dataArrayRef.getValue(in_ids);\n\t\t\tif (value === undefined || value === \"\") {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn this.getParent().resolvePath(value, in_options);\n\t\t}\n\t}\n\n\t/**\n\t * Checks whether the reference is valid. This is either the case when it is empty or when the referenced\n\t * property exists.\n\t *\n\t * @param {number} in_position - The target index\n\t * @returns {boolean} True if the reference is valid, otherwise false.\n\t */\n\tisReferenceValid(in_position) {\n\t\treturn (\n\t\t\tValueArrayProperty.prototype.get.call(this, in_position) === \"\" ||\n\t\t\tthis.get(in_position) !== undefined\n\t\t);\n\t}\n\n\t/**\n\t * Sets the range in the array to point to the given property objects or to be equal to the given paths\n\t *\n\t * @param {number} in_offset - Target start index\n\t * @param {Array<property-properties.BaseProperty|undefined|String>} in_array - Contains the properties to be set or\n\t * the paths to those properties. If undefined is passed, the reference will be set to an empty string to\n\t * indicate an empty reference.\n\t * @throws If in_offset is smaller than zero, larger than the length of the array or not a number\n\t * @throws If in_array is not an array\n\t * @throws If one of the items in in_array is defined, but is not a property or a string.\n\t */\n\tsetRange(in_offset, in_array) {\n\t\tvar arr = ReferenceArrayProperty._convertInputToPaths(in_array, \"setRange\");\n\t\tValueArrayProperty.prototype.setRange.call(this, in_offset, arr);\n\t}\n\n\t/**\n\t * Insert a range which points to the given property objects into the array\n\t *\n\t * @param {number} in_offset - Target start index\n\t * @param {Array<property-properties.BaseProperty|undefined|String>} in_array - Contains the properties to be set or\n\t * the paths to those properties. If undefined is passed, the reference will be set to an empty string to\n\t * indicate an empty reference.\n\t * @throws If in_offset is smaller than zero, larger than the length of the array or not a number\n\t * @throws If in_array is not an array\n\t * @throws If one of the items in in_array is defined, but is not a property or a string.\n\t */\n\tinsertRange(in_offset, in_array) {\n\t\tvar arr = ReferenceArrayProperty._convertInputToPaths(in_array, \"insertRange\");\n\t\tValueArrayProperty.prototype.insertRange.call(this, in_offset, arr);\n\t}\n\n\t/**\n\t * Returns the path value of a reference.\n\t * @param {number} in_id - The index of the property\n\t * @returns {string} The path string\n\t */\n\tgetValue(in_id) {\n\t\treturn this._dataArrayRef.getValue(in_id);\n\t}\n\n\t/**\n\t * Returns an object with all the nested values contained in this property\n\t * @returns {array<String>} an array of strings representing the paths listed in this array\n\t * for example: ['/path1', '/path2']\n\t */\n\tgetValues() {\n\t\tvar result = [];\n\t\tvar ids = this.getIds();\n\t\tfor (var i = 0; i < ids.length; i++) {\n\t\t\tresult.push(this.getValue(ids[i]));\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Removes the last element of the array\n\t * @throws If trying to modify a referenced property\n\t * @returns {String} deleted element (string path)\n\t */\n\tpop() {\n\t\tif (this._dataArrayRef.length > 0) {\n\t\t\tvar item = this.getValue(this._dataArrayRef.length - 1);\n\t\t\tthis.remove(this._dataArrayRef.length - 1);\n\t\t\treturn item;\n\t\t} else {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t/**\n\t * Removes an element of the array and shift remaining elements to the left\n\t * @param {number} in_position - The index that will be removed\n\t * @throws If in_position is not a number\n\t * @throws If trying to remove an item with a parent\n\t * @throws If trying to remove something that does not exist\n\t * @returns {String} the value that was removed (string path).\n\t */\n\tremove(in_position) {\n\t\tvar value = this.getValue(in_position);\n\t\tthis.removeRange(in_position, 1);\n\t\treturn value;\n\t}\n\n\t/**\n\t * Removes a given number of elements from the array and shifts remaining values to the left.\n\t * @param {number} in_offset - Target start index\n\t * @param {number} in_deleteCount - Number of elements to be deleted\n\t * @throws If in_offset is not a number\n\t * @throws If in_deleteCount is not a number\n\t * @throws If trying to remove an item with a parent\n\t * @throws If in_offset is smaller than zero or if in_offset + in_delete count is larger than the length of the array\n\t * @returns {Array<String>} an array containing the values removed (string paths)\n\t */\n\tremoveRange(in_offset, in_deleteCount) {\n\t\tConsoleUtils.assert(\n\t\t\t_.isNumber(in_offset),\n\t\t\tMSG.NOT_NUMBER + \"in_offset, method: ArrayProperty.removeRange or .remove\",\n\t\t);\n\t\tConsoleUtils.assert(\n\t\t\t_.isNumber(in_deleteCount),\n\t\t\tMSG.NOT_NUMBER + \"in_deleteCount, method: ArrayProperty.removeRange or .remove\",\n\t\t);\n\t\tConsoleUtils.assert(\n\t\t\tin_offset + in_deleteCount < this.length + 1 && in_offset >= 0 && in_deleteCount > 0,\n\t\t\tMSG.REMOVE_OUT_OF_BOUNDS +\n\t\t\t\t\"Cannot remove \" +\n\t\t\t\tin_deleteCount +\n\t\t\t\t\" items starting at index \" +\n\t\t\t\tin_offset,\n\t\t);\n\t\tvar result = [];\n\t\tfor (var i = in_offset; i < in_offset + in_deleteCount; i++) {\n\t\t\tresult.push(this.getValue(i));\n\t\t}\n\t\tthis._checkIsNotReadOnly(true);\n\t\tthis._removeRangeWithoutDirtying(in_offset, in_deleteCount);\n\t\tthis._setDirty();\n\t\treturn result;\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_resolvePathSegment(in_segment, in_segmentType) {\n\t\t// Array tokens are automatically resolved\n\t\treturn in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN\n\t\t\t? this.get(in_segment, {\n\t\t\t\t\treferenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,\n\t\t\t })\n\t\t\t: // Everything else is handled by the implementation in the base property\n\t\t\t AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(\n\t\t\t\t\tthis,\n\t\t\t\t\tin_segment,\n\t\t\t\t\tin_segmentType,\n\t\t\t );\n\t}\n\n\t/**\n\t * Creates and initializes the data array\n\t * @param {Number} in_length - The initial length of the array\n\t */\n\t_dataArrayCreate(in_length) {\n\t\tthis._dataArrayRef = new UniversalDataArray(in_length);\n\t\tfor (var i = 0; i < in_length; i++) {\n\t\t\tthis._dataArraySetValue(i, \"\");\n\t\t}\n\t}\n\n\t/**\n\t * Validates the array and returns a sanitized version of it containing only strings.\n\t *\n\t * @param {Array<property-properties.BaseProperty|undefined|String>} in_array - contains the properties to be set or\n\t * the paths to those properties. If undefined is passed, the reference will be set to an empty string to\n\t * indicate an empty reference.\n\t * @param {String} in_callerName - the name of the function that called, to make it appear in\n\t * the error message if any\n\t * @returns {Array<string>} The array of paths\n\t * @throws If in_array is not an array\n\t * @throws If one of the items in in_array is defined, but is not a property or a string.\n\t */\n\tstatic _convertInputToPaths = function (in_array, in_callerName) {\n\t\tif (!_.isArray(in_array)) {\n\t\t\tthrow new TypeError(MSG.IN_ARRAY_NOT_ARRAY + \"ReferenceArrayProperty.\" + in_callerName);\n\t\t}\n\t\tvar len = in_array.length;\n\t\tvar arr = new Array(len);\n\t\tfor (var i = 0; i < len; i++) {\n\t\t\tarr[i] = ReferenceProperty._convertInputToPath(in_array[i]);\n\t\t}\n\t\treturn arr;\n\t};\n}\nReferenceArrayProperty.prototype._typeid = \"Reference\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"referenceMapProperty.d.ts","sourceRoot":"","sources":["../../src/properties/referenceMapProperty.js"],"names":[],"mappings":"AAeA;;GAEG;AACH;IAcI;;;;;;;OAOG;IACH,4BAFa,MAAM,CAIlB;IAwFD;;;;;;;;;;OAUG;IACH,+BAEC;IAiBD;;;;;;OAMG;IACH,yBAHW,MAAM,GACJ,OAAO,CAMnB;CAqBJ"}
1
+ {"version":3,"file":"referenceMapProperty.d.ts","sourceRoot":"","sources":["../../src/properties/referenceMapProperty.js"],"names":[],"mappings":"AAeA;;GAEG;AACH;IAcC;;;;;;;OAOG;IACH,4BAFa,MAAM,CAIlB;IAwFD;;;;;;;;;;OAUG;IACH,+BAEC;IAiBD;;;;;;OAMG;IACH,yBAHW,MAAM,GACJ,OAAO,CAInB;CA2BD"}
@@ -8,13 +8,13 @@ exports.ReferenceMapProperty = void 0;
8
8
  /**
9
9
  * @fileoverview Definition of the reference map property class
10
10
  */
11
- const { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');
12
- const { MSG } = require('@fluid-experimental/property-common').constants;
13
- const _ = require('lodash');
14
- const { BaseProperty } = require('./baseProperty');
15
- const { ContainerProperty } = require('./containerProperty');
16
- const { ReferenceProperty } = require('./referenceProperty');
17
- const { StringMapProperty } = require('./valueMapProperty');
11
+ const { PathHelper, TypeIdHelper } = require("@fluid-experimental/property-changeset");
12
+ const { MSG } = require("@fluid-experimental/property-common").constants;
13
+ const _ = require("lodash");
14
+ const { BaseProperty } = require("./baseProperty");
15
+ const { ContainerProperty } = require("./containerProperty");
16
+ const { ReferenceProperty } = require("./referenceProperty");
17
+ const { StringMapProperty } = require("./valueMapProperty");
18
18
  /**
19
19
  * A StringMapProperty which stores reference values
20
20
  */
@@ -60,16 +60,16 @@ class ReferenceMapProperty extends StringMapProperty {
60
60
  get(in_ids, in_options) {
61
61
  in_options = in_options || {};
62
62
  in_options.referenceResolutionMode =
63
- in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :
64
- in_options.referenceResolutionMode;
63
+ in_options.referenceResolutionMode === undefined
64
+ ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
65
+ : in_options.referenceResolutionMode;
65
66
  if (_.isArray(in_ids)) {
66
67
  // Forward handling of arrays to the BaseProperty function
67
68
  return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);
68
69
  }
69
70
  else {
70
71
  var value = this._dynamicChildren[in_ids];
71
- if (value === undefined ||
72
- value === '') {
72
+ if (value === undefined || value === "") {
73
73
  return undefined;
74
74
  }
75
75
  return this.getParent().resolvePath(value, in_options);
@@ -160,9 +160,7 @@ class ReferenceMapProperty extends StringMapProperty {
160
160
  * @returns {boolean} True if the reference is valid, otherwise false.
161
161
  */
162
162
  isReferenceValid(in_key) {
163
- return this.has(in_key) &&
164
- (this.getValue(in_key) === '' ||
165
- this.get(in_key) !== undefined);
163
+ return this.has(in_key) && (this.getValue(in_key) === "" || this.get(in_key) !== undefined);
166
164
  }
167
165
  /**
168
166
  * Returns the string value stored in the map
@@ -178,11 +176,13 @@ class ReferenceMapProperty extends StringMapProperty {
178
176
  _resolvePathSegment(in_segment, in_segmentType) {
179
177
  // Array tokens are automatically resolved
180
178
  return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN
181
- ? this.get(in_segment, { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER })
182
- // Everything else is handled by the implementation in the base property
183
- : AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);
179
+ ? this.get(in_segment, {
180
+ referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
181
+ })
182
+ : // Everything else is handled by the implementation in the base property
183
+ AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);
184
184
  }
185
185
  }
186
186
  exports.ReferenceMapProperty = ReferenceMapProperty;
187
- ReferenceMapProperty.prototype._typeid = 'Reference';
187
+ ReferenceMapProperty.prototype._typeid = "Reference";
188
188
  //# sourceMappingURL=referenceMapProperty.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"referenceMapProperty.js","sourceRoot":"","sources":["../../src/properties/referenceMapProperty.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7D,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7D,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAE5D;;GAEG;AACH,MAAa,oBAAqB,SAAQ,iBAAiB;IACvD;;;;;;;;OAQG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;IAED;;;;;;;OAOG;IACH,wBAAwB;QACpB,OAAO,YAAY,CAAC,yCAAyC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,GAAG,CAAC,MAAM,EAAE,UAAU;QAClB,UAAU,GAAG,UAAU,IAAI,EAAE,CAAC;QAC9B,UAAU,CAAC,uBAAuB;YAC9B,UAAU,CAAC,uBAAuB,KAAK,SAAS,CAAC,CAAC,CAAC,YAAY,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;gB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AAc,CAAC,CAAC;IAChH,CAAC;CACJ;AA9KD,oDA8KC;AAED,oBAAoB,CAAC,SAAS,CAAC,OAAO,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the reference map property class\n */\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst _ = require('lodash');\nconst { BaseProperty } = require('./baseProperty');\nconst { ContainerProperty } = require('./containerProperty');\nconst { ReferenceProperty } = require('./referenceProperty');\nconst { StringMapProperty } = require('./valueMapProperty');\n\n/**\n * A StringMapProperty which stores reference values\n */\nexport class ReferenceMapProperty extends StringMapProperty {\n /**\n * @param {Object} in_params - Input parameters for property creation\n *\n * @constructor\n * @protected\n * @extends property-properties.StringMapProperty\n * @alias property-properties.ReferenceMapProperty\n * @category Maps\n */\n constructor(in_params) {\n super(in_params);\n }\n\n /**\n * Returns the typeid for the target of this reference\n *\n * Note: This is the type that is specified in the typeid of this reference and not the actual type\n * of the referenced object, which might inherit from that typeid.\n *\n * @returns {string} The typeid of the nodes this reference may point to\n */\n getReferenceTargetTypeId() {\n return TypeIdHelper.extractReferenceTargetTypeIdFromReference(this.getTypeid());\n }\n\n /**\n * Resolves the referenced property for the given key\n *\n * @param {string|array<string|number>} in_ids - The ID of the property or an array of IDs\n * if an array is passed, the .get function will be performed on each id in sequence\n * for example .get(['position','x']) is equivalent to .get('position').get('x').\n * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n * refers to.\n * @param {Object} in_options - parameter object\n * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How\n * should this function behave during reference resolution?\n *\n * @returns {property-properties.BaseProperty|undefined} The property object the reference points to or undefined\n * if it could not be resolved\n */\n get(in_ids, in_options) {\n in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n\n if (_.isArray(in_ids)) {\n // Forward handling of arrays to the BaseProperty function\n return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n } else {\n var value = this._dynamicChildren[in_ids];\n if (value === undefined ||\n value === '') {\n return undefined;\n }\n return this.getParent().resolvePath(value, in_options);\n }\n }\n\n /**\n * Removes the entry with the given key from the map\n *\n * @param {string} in_key - The key of the entry to remove from the map\n * @throws If trying to remove an entry that does not exist\n * @returns {String} the item removed (a string pathT\n */\n remove(in_key) {\n var item = this.getValue(in_key);\n this._removeByKey(in_key, true);\n return item;\n }\n\n /**\n * Returns an object with all the nested path values.\n *\n * @example\n * ```javascript\n * {\n * 'firstPath': '/path',\n * 'secondPath': '/path2'\n * }\n * ```\n */\n getValues() {\n var ids = this.getIds();\n var result = {};\n for (var i = 0; i < ids.length; i++) {\n result[ids[i]] = this.getValue(ids[i]);\n }\n return result;\n }\n\n /**\n * Sets or inserts the reference to point to the given property object or to be equal to the given path string.\n *\n * @param {string} in_key - The key under which the entry is stored\n * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n * the path to this property. If undefined is passed, the reference will be set to an empty string to\n * indicate an empty reference.\n * @throws If in_key is not a string\n * @throws If in_value is defined, but is not a property or a string.\n * @throws If map is read only\n */\n set(in_key, in_value) {\n if (!_.isString(in_key)) {\n throw new TypeError(MSG.KEY_NOT_STRING + in_key);\n }\n var value = ReferenceProperty._convertInputToPath(in_value);\n StringMapProperty.prototype.set.call(this, in_key, value);\n }\n\n /**\n * Sets or inserts the reference to point to the given property object or to be equal to the given path string.\n *\n * @param {string} in_key - The key under which the entry is stored\n * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n * the path to this property. If undefined is passed, the reference will be set to an empty string to\n * indicate an empty reference.\n * @throws If in_key is not a string\n * @throws If in_value is defined, but is not a property or a string.\n * @deprecated\n */\n setValue(...args) {\n return this.set(...args);\n }\n\n /**\n * Inserts the reference to point to the given property object or to be equal to the given path string.\n *\n * @param {string} in_key - The key under which the entry is stored\n * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n * the path to this property. If undefined is passed, the reference will be set to an empty string to\n * indicate an empty reference.\n * @throws If there is already an entry under in_key\n * @throws If in_value is defined, but is not a property or a string.\n */\n insert(in_key, in_value) {\n var value = ReferenceProperty._convertInputToPath(in_value);\n this._insert(in_key, value, true);\n }\n\n /**\n * Checks whether the reference is valid. This is either the case when it is empty or when the referenced\n * property exists.\n *\n * @param {string} in_key - Key of the entry to check\n * @returns {boolean} True if the reference is valid, otherwise false.\n */\n isReferenceValid(in_key) {\n return this.has(in_key) &&\n (this.getValue(in_key) === '' ||\n this.get(in_key) !== undefined);\n }\n\n /**\n * Returns the string value stored in the map\n * @param {string} in_key - The key of the reference\n * @returns {string} The path string\n */\n getValue(in_key) {\n return this._getValue(in_key);\n }\n\n /**\n * @inheritdoc\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n // Array tokens are automatically resolved\n return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN\n ? this.get(in_segment, { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER })\n // Everything else is handled by the implementation in the base property\n : AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\n}\n\nReferenceMapProperty.prototype._typeid = 'Reference';\n"]}
1
+ {"version":3,"file":"referenceMapProperty.js","sourceRoot":"","sources":["../../src/properties/referenceMapProperty.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,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IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;OAMG;IACH,gBAAgB,CAAC,MAAM;QACtB,OAAO,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC;IAC7F,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,MAAM;QACd,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,UAAU,EAAE,cAAc;QAC7C,0CAA0C;QAC1C,OAAO,cAAc,KAAK,UAAU,CAAC,WAAW,CAAC,WAAW;YAC3D,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE;gBACrB,uBAAuB,EAAE,YAAY,CAAC,oBAAoB,CAAC,KAAK;aAC/D,CAAC;YACJ,CAAC,CAAC,wEAAwE;gBACxE,gCAAgC,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CACnE,IAAI,EACJ,UAAU,EACV,cAAc,CACb,CAAC;IACN,CAAC;CACD;AAlLD,oDAkLC;AAED,oBAAoB,CAAC,SAAS,CAAC,OAAO,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the reference map property class\n */\nconst { PathHelper, TypeIdHelper } = require(\"@fluid-experimental/property-changeset\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\nconst _ = require(\"lodash\");\nconst { BaseProperty } = require(\"./baseProperty\");\nconst { ContainerProperty } = require(\"./containerProperty\");\nconst { ReferenceProperty } = require(\"./referenceProperty\");\nconst { StringMapProperty } = require(\"./valueMapProperty\");\n\n/**\n * A StringMapProperty which stores reference values\n */\nexport class ReferenceMapProperty extends StringMapProperty {\n\t/**\n\t * @param {Object} in_params - Input parameters for property creation\n\t *\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.StringMapProperty\n\t * @alias property-properties.ReferenceMapProperty\n\t * @category Maps\n\t */\n\tconstructor(in_params) {\n\t\tsuper(in_params);\n\t}\n\n\t/**\n\t * Returns the typeid for the target of this reference\n\t *\n\t * Note: This is the type that is specified in the typeid of this reference and not the actual type\n\t * of the referenced object, which might inherit from that typeid.\n\t *\n\t * @returns {string} The typeid of the nodes this reference may point to\n\t */\n\tgetReferenceTargetTypeId() {\n\t\treturn TypeIdHelper.extractReferenceTargetTypeIdFromReference(this.getTypeid());\n\t}\n\n\t/**\n\t * Resolves the referenced property for the given key\n\t *\n\t * @param {string|array<string|number>} in_ids - The ID of the property or an array of IDs\n\t * if an array is passed, the .get function will be performed on each id in sequence\n\t * for example .get(['position','x']) is equivalent to .get('position').get('x').\n\t * If .get resolves to a ReferenceProperty, it will return the property that the ReferenceProperty\n\t * refers to.\n\t * @param {Object} in_options - parameter object\n\t * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How\n\t * should this function behave during reference resolution?\n\t *\n\t * @returns {property-properties.BaseProperty|undefined} The property object the reference points to or undefined\n\t * if it could not be resolved\n\t */\n\tget(in_ids, in_options) {\n\t\tin_options = in_options || {};\n\t\tin_options.referenceResolutionMode =\n\t\t\tin_options.referenceResolutionMode === undefined\n\t\t\t\t? BaseProperty.REFERENCE_RESOLUTION.ALWAYS\n\t\t\t\t: in_options.referenceResolutionMode;\n\n\t\tif (_.isArray(in_ids)) {\n\t\t\t// Forward handling of arrays to the BaseProperty function\n\t\t\treturn AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);\n\t\t} else {\n\t\t\tvar value = this._dynamicChildren[in_ids];\n\t\t\tif (value === undefined || value === \"\") {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\treturn this.getParent().resolvePath(value, in_options);\n\t\t}\n\t}\n\n\t/**\n\t * Removes the entry with the given key from the map\n\t *\n\t * @param {string} in_key - The key of the entry to remove from the map\n\t * @throws If trying to remove an entry that does not exist\n\t * @returns {String} the item removed (a string pathT\n\t */\n\tremove(in_key) {\n\t\tvar item = this.getValue(in_key);\n\t\tthis._removeByKey(in_key, true);\n\t\treturn item;\n\t}\n\n\t/**\n\t * Returns an object with all the nested path values.\n\t *\n\t * @example\n\t * ```javascript\n\t * {\n\t * 'firstPath': '/path',\n\t * 'secondPath': '/path2'\n\t * }\n\t * ```\n\t */\n\tgetValues() {\n\t\tvar ids = this.getIds();\n\t\tvar result = {};\n\t\tfor (var i = 0; i < ids.length; i++) {\n\t\t\tresult[ids[i]] = this.getValue(ids[i]);\n\t\t}\n\t\treturn result;\n\t}\n\n\t/**\n\t * Sets or inserts the reference to point to the given property object or to be equal to the given path string.\n\t *\n\t * @param {string} in_key - The key under which the entry is stored\n\t * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n\t * the path to this property. If undefined is passed, the reference will be set to an empty string to\n\t * indicate an empty reference.\n\t * @throws If in_key is not a string\n\t * @throws If in_value is defined, but is not a property or a string.\n\t * @throws If map is read only\n\t */\n\tset(in_key, in_value) {\n\t\tif (!_.isString(in_key)) {\n\t\t\tthrow new TypeError(MSG.KEY_NOT_STRING + in_key);\n\t\t}\n\t\tvar value = ReferenceProperty._convertInputToPath(in_value);\n\t\tStringMapProperty.prototype.set.call(this, in_key, value);\n\t}\n\n\t/**\n\t * Sets or inserts the reference to point to the given property object or to be equal to the given path string.\n\t *\n\t * @param {string} in_key - The key under which the entry is stored\n\t * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n\t * the path to this property. If undefined is passed, the reference will be set to an empty string to\n\t * indicate an empty reference.\n\t * @throws If in_key is not a string\n\t * @throws If in_value is defined, but is not a property or a string.\n\t * @deprecated\n\t */\n\tsetValue(...args) {\n\t\treturn this.set(...args);\n\t}\n\n\t/**\n\t * Inserts the reference to point to the given property object or to be equal to the given path string.\n\t *\n\t * @param {string} in_key - The key under which the entry is stored\n\t * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n\t * the path to this property. If undefined is passed, the reference will be set to an empty string to\n\t * indicate an empty reference.\n\t * @throws If there is already an entry under in_key\n\t * @throws If in_value is defined, but is not a property or a string.\n\t */\n\tinsert(in_key, in_value) {\n\t\tvar value = ReferenceProperty._convertInputToPath(in_value);\n\t\tthis._insert(in_key, value, true);\n\t}\n\n\t/**\n\t * Checks whether the reference is valid. This is either the case when it is empty or when the referenced\n\t * property exists.\n\t *\n\t * @param {string} in_key - Key of the entry to check\n\t * @returns {boolean} True if the reference is valid, otherwise false.\n\t */\n\tisReferenceValid(in_key) {\n\t\treturn this.has(in_key) && (this.getValue(in_key) === \"\" || this.get(in_key) !== undefined);\n\t}\n\n\t/**\n\t * Returns the string value stored in the map\n\t * @param {string} in_key - The key of the reference\n\t * @returns {string} The path string\n\t */\n\tgetValue(in_key) {\n\t\treturn this._getValue(in_key);\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_resolvePathSegment(in_segment, in_segmentType) {\n\t\t// Array tokens are automatically resolved\n\t\treturn in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN\n\t\t\t? this.get(in_segment, {\n\t\t\t\t\treferenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,\n\t\t\t })\n\t\t\t: // Everything else is handled by the implementation in the base property\n\t\t\t AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(\n\t\t\t\t\tthis,\n\t\t\t\t\tin_segment,\n\t\t\t\t\tin_segmentType,\n\t\t\t );\n\t}\n}\n\nReferenceMapProperty.prototype._typeid = \"Reference\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"referenceProperty.d.ts","sourceRoot":"","sources":["../../src/properties/referenceProperty.js"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH;IA8JI;;;;;;;;OAQG;IACH,2CAHa,MAAM,CAkBlB;IA9JD;;;;;;;OAOG;IACH,4BAFa,MAAM,CAIlB;IAiED;;;;;OAKG;IACH,oBAFa,OAAO,CAInB;IAkBD;;;;;;;;OAQG;IACH,0BAEC;IAkBD,kBAEC;IAND,eAEC;IAgCL,2CAAwC;CADvC"}
1
+ {"version":3,"file":"referenceProperty.d.ts","sourceRoot":"","sources":["../../src/properties/referenceProperty.js"],"names":[],"mappings":"AAgBA;;;;;GAKG;AACH;IA2KC;;;;;;;;OAQG;IACH,2CAHa,MAAM,CAoBlB;IA7KD;;;;;;;OAOG;IACH,4BAFa,MAAM,CAIlB;IA0ED;;;;;OAKG;IACH,oBAFa,OAAO,CAInB;IAkBD;;;;;;;;OAQG;IACH,0BAEC;IAsBD,kBAEC;IAND,eAEC;IAkCF,2CAAwC;CADvC"}
@@ -8,13 +8,13 @@
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.ReferenceProperty = void 0;
11
- const { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');
12
- const { MSG } = require('@fluid-experimental/property-common').constants;
13
- const _ = require('lodash');
14
- const { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');
15
- const { BaseProperty } = require('./baseProperty');
16
- const { _castFunctors } = require('./primitiveTypeCasts');
17
- const { ValueProperty } = require('./valueProperty');
11
+ const { PathHelper, TypeIdHelper } = require("@fluid-experimental/property-changeset");
12
+ const { MSG } = require("@fluid-experimental/property-common").constants;
13
+ const _ = require("lodash");
14
+ const { AbstractStaticCollectionProperty } = require("./abstractStaticCollectionProperty");
15
+ const { BaseProperty } = require("./baseProperty");
16
+ const { _castFunctors } = require("./primitiveTypeCasts");
17
+ const { ValueProperty } = require("./valueProperty");
18
18
  /**
19
19
  * This class serves as a view to read, write and listen to changes in an
20
20
  * object's value field. To do this we simply keep a pointer to the object and
@@ -23,18 +23,18 @@ const { ValueProperty } = require('./valueProperty');
23
23
  */
24
24
  class ReferenceProperty extends ValueProperty {
25
25
  /**
26
- * @param {Object=} in_params - The parameters
27
- *
28
- * @constructor
29
- * @protected
30
- * @extends property-properties.ValueProperty
31
- * @alias property-properties.ReferenceProperty
32
- * @category Properties
33
- */
26
+ * @param {Object=} in_params - The parameters
27
+ *
28
+ * @constructor
29
+ * @protected
30
+ * @extends property-properties.ValueProperty
31
+ * @alias property-properties.ReferenceProperty
32
+ * @category Properties
33
+ */
34
34
  constructor(in_params) {
35
35
  super(in_params);
36
36
  // default for this property type is an empty string
37
- this._data = '';
37
+ this._data = "";
38
38
  }
39
39
  /**
40
40
  * Evaluates Reference properties as primitives.
@@ -70,8 +70,9 @@ class ReferenceProperty extends ValueProperty {
70
70
  get(in_ids, in_options) {
71
71
  in_options = in_options || {};
72
72
  in_options.referenceResolutionMode =
73
- in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :
74
- in_options.referenceResolutionMode;
73
+ in_options.referenceResolutionMode === undefined
74
+ ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
75
+ : in_options.referenceResolutionMode;
75
76
  if (_.isArray(in_ids) && in_ids.length === 0) {
76
77
  return this;
77
78
  }
@@ -79,16 +80,18 @@ class ReferenceProperty extends ValueProperty {
79
80
  if (in_options.referenceResolutionMode !== BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {
80
81
  return undefined;
81
82
  }
82
- if (this.value === '') {
83
+ if (this.value === "") {
83
84
  return undefined;
84
85
  }
85
86
  if (this.getParent() === undefined) {
86
87
  return undefined;
87
88
  }
88
- var resolvedProperty = this.getParent().resolvePath(this.value, { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.ALWAYS });
89
+ var resolvedProperty = this.getParent().resolvePath(this.value, {
90
+ referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.ALWAYS,
91
+ });
89
92
  return resolvedProperty !== undefined && _.isArray(in_ids)
90
- // Forward handling of arrays to the BaseProperty function
91
- ? resolvedProperty.get(in_ids, in_options)
93
+ ? // Forward handling of arrays to the BaseProperty function
94
+ resolvedProperty.get(in_ids, in_options)
92
95
  : resolvedProperty;
93
96
  }
94
97
  /**
@@ -103,7 +106,8 @@ class ReferenceProperty extends ValueProperty {
103
106
  * @throws if in_path is not a valid path
104
107
  */
105
108
  resolvePath(in_path, in_options) {
106
- if (in_options && in_options.referenceResolutionMode &&
109
+ if (in_options &&
110
+ in_options.referenceResolutionMode &&
107
111
  in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.NEVER) {
108
112
  return undefined;
109
113
  }
@@ -116,7 +120,7 @@ class ReferenceProperty extends ValueProperty {
116
120
  * @returns {boolean} True if the reference is valid, otherwise false.
117
121
  */
118
122
  isReferenceValid() {
119
- return this.value === '' || this.ref !== undefined;
123
+ return this.value === "" || this.ref !== undefined;
120
124
  }
121
125
  /**
122
126
  * Sets the reference to point to the given property object or to be equal to the given path string.
@@ -150,8 +154,8 @@ class ReferenceProperty extends ValueProperty {
150
154
  */
151
155
  _resolvePathSegment(in_segment, in_segmentType) {
152
156
  // path segments and array tokens are no longer automatically forwarded to the referenced node
153
- return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN
154
- || in_segmentType === PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN
157
+ return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN ||
158
+ in_segmentType === PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN
155
159
  ? undefined
156
160
  : AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);
157
161
  }
@@ -173,11 +177,11 @@ class ReferenceProperty extends ValueProperty {
173
177
  */
174
178
  static _convertInputToPath(in_value) {
175
179
  var path;
176
- if (typeof in_value === 'string') {
180
+ if (typeof in_value === "string") {
177
181
  path = in_value;
178
182
  }
179
183
  else if (in_value === undefined) {
180
- path = '';
184
+ path = "";
181
185
  }
182
186
  else if (in_value instanceof BaseProperty) {
183
187
  // TODO: Check whether this is still the correct path once we start to support repository references
@@ -187,7 +191,7 @@ class ReferenceProperty extends ValueProperty {
187
191
  path = String(in_value);
188
192
  }
189
193
  else {
190
- throw new TypeError(MSG.PROPERTY_OR_UNDEFINED + '(' + typeof in_value + ') ' + in_value);
194
+ throw new TypeError(MSG.PROPERTY_OR_UNDEFINED + "(" + typeof in_value + ") " + in_value);
191
195
  }
192
196
  return path;
193
197
  }
@@ -1 +1 @@
1
- {"version":3,"file":"referenceProperty.js","sourceRoot":"","sources":["../../src/properties/referenceProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC,CAAC;AAC1D,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAErD;;;;;GAKG;AACH,MAAa,iBAAkB,SAAQ,aAAa;IAChD;;;;;;;;MAQE;IACF,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,oDAAoD;QACpD,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;IACpB,CAAC;IAED;;;OAGG;IACH,eAAe;QACX,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;;;OAOG;IACH,wBAAwB;QACpB,OAAO,YAAY,CAAC,yCAAyC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;IACpF,CAAC;IAED;;;;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AC,mBAAmB,CAAC,QAAQ;QAC/B,IAAI,IAAI,CAAC;QACT,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAC9B,IAAI,GAAG,QAAQ,CAAC;SACnB;aAAM,IAAI,QAAQ,KAAK,SAAS,EAAE;YAC/B,IAAI,GAAG,EAAE,CAAC;SACb;aAAM,IAAI,QAAQ,YAAY,YAAY,EAAE;YACzC,oGAAoG;YACpG,IAAI,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;SACrC;aAAM,IAAI,QAAQ,YAAY,MAAM,EAAE;YACnC,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;SAC3B;aAAM;YACH,MAAM,IAAI,SAAS,CAAC,GAAG,CAAC,qBAAqB,GAAG,GAAG,GAAG,OAAO,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC,CAAC;SAC5F;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAvLD,8CAuLC;AACD,iBAAiB,CAAC,SAAS,CAAC,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC;AAChE,iBAAiB,CAAC,SAAS,CAAC,OAAO,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the ReferenceProperty class\n */\n\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst _ = require('lodash');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { _castFunctors } = require('./primitiveTypeCasts');\nconst { ValueProperty } = require('./valueProperty');\n\n/**\n * This class serves as a view to read, write and listen to changes in an\n * object's value field. To do this we simply keep a pointer to the object and\n * it's associated data field that we are interested in. If no data field is\n * present this property will have an undefined value.\n */\nexport class ReferenceProperty extends ValueProperty {\n /**\n * @param {Object=} in_params - The parameters\n *\n * @constructor\n * @protected\n * @extends property-properties.ValueProperty\n * @alias property-properties.ReferenceProperty\n * @category Properties\n */\n constructor(in_params) {\n super(in_params);\n // default for this property type is an empty string\n this._data = '';\n }\n\n /**\n * Evaluates Reference properties as primitives.\n * @returns {boolean} true since Reference properties are primitives.\n */\n isPrimitiveType() {\n return true;\n }\n\n /**\n * Returns the typeid for the target of this reference\n *\n * Note: This is the type that is specified in the typeid of this reference and not the actual type\n * of the referenced object, which might inherit from that typeid.\n *\n * @returns {string} The typeid of the nodes this reference may point to\n */\n getReferenceTargetTypeId() {\n return TypeIdHelper.extractReferenceTargetTypeIdFromReference(this.getTypeid());\n }\n\n /**\n * Resolves the referenced property\n *\n * @param {string|number|array<string|number>} in_ids - The ID of the property or an array of IDs if an array is\n * passed, the .get function will be performed on each id in sequence for example .get(['position','x']) is\n * equivalent to .get('position').get('x'). If .get resolves to a ReferenceProperty, it will return the property\n * that the ReferenceProperty refers to.\n * @param {Object} in_options - parameter object\n * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How\n * should this function behave during reference resolution?\n * @returns {property-properties.BaseProperty|undefined} The property object the reference points to or undefined if\n * it could not be resolved\n */\n get(in_ids, in_options) {\n in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n\n if (_.isArray(in_ids) && in_ids.length === 0) {\n return this;\n }\n\n // Since this is a reference property, we return undefined, if reference resolution is disabled\n if (in_options.referenceResolutionMode !== BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n return undefined;\n }\n\n if (this.value === '') {\n return undefined;\n }\n\n if (this.getParent() === undefined) {\n return undefined;\n }\n var resolvedProperty = this.getParent().resolvePath(this.value,\n { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.ALWAYS });\n\n return resolvedProperty !== undefined && _.isArray(in_ids)\n // Forward handling of arrays to the BaseProperty function\n ? resolvedProperty.get(in_ids, in_options)\n : resolvedProperty;\n }\n\n /**\n * Expand a path returning the value or property at the end.\n *\n * @param {string} in_path - The path\n * @param {Object} in_options - Parameter object\n * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How\n * should this function behave during reference resolution?\n * @returns {property-properties.BaseProperty|undefined} resolved path\n * @throws if the path resolves to a primitive value\n * @throws if in_path is not a valid path\n */\n resolvePath(in_path, in_options) {\n if (in_options && in_options.referenceResolutionMode &&\n in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.NEVER) {\n return undefined;\n }\n return AbstractStaticCollectionProperty.prototype.resolvePath.call(this, in_path, in_options);\n }\n\n /**\n * Checks whether the reference is valid. This is either the case when it is empty or when the referenced\n * property exists.\n *\n * @returns {boolean} True if the reference is valid, otherwise false.\n */\n isReferenceValid() {\n return this.value === '' || this.ref !== undefined;\n }\n\n /**\n * Sets the reference to point to the given property object or to be equal to the given path string.\n *\n * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n * the path to this property. If undefined is passed, the reference will be set to an empty string to\n * indicate an empty reference.\n * @throws if property is read only\n * @throws if in_value is defined, but is not a property or a string.\n */\n setValue(in_value) {\n this._checkIsNotReadOnly(true);\n var value = ReferenceProperty._convertInputToPath(in_value);\n // Forward the call to setValue\n ValueProperty.prototype.setValue.call(this, value);\n }\n\n /**\n * Sets the reference to point to the given property object or to be equal to the given path string.\n *\n * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n * the path to this property. If undefined is passed, the reference will be set to an empty string to\n * indicate an empty reference.\n * @throws if property is read only\n * @throws if in_value is defined but is not a property or a string.\n */\n set(...args) {\n return this.setValue(...args);\n }\n\n /**\n * @inheritdoc\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n // path segments and array tokens are no longer automatically forwarded to the referenced node\n return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN\n || in_segmentType === PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN\n ? undefined\n : AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\n\n // Define a property to simplify accessing the referenced path\n get ref() {\n return this.get.apply(this, arguments);\n }\n\n set ref(val) {\n this.set.call(this, val);\n }\n\n /**\n * Validates the input and does as much as possible to return a string representing a path.\n *\n * @param {property-properties.BaseProperty|undefined|String} in_value - Contains the property to be set or\n * the path to this property. If undefined is passed, the reference will be set to an empty string to\n * indicate an empty reference.\n * @returns {string} The path\n * @throws if in_value is defined, but is not a property or a string.\n */\n static _convertInputToPath(in_value) {\n var path;\n if (typeof in_value === 'string') {\n path = in_value;\n } else if (in_value === undefined) {\n path = '';\n } else if (in_value instanceof BaseProperty) {\n // TODO: Check whether this is still the correct path once we start to support repository references\n path = in_value.getAbsolutePath();\n } else if (in_value instanceof String) {\n path = String(in_value);\n } else {\n throw new TypeError(MSG.PROPERTY_OR_UNDEFINED + '(' + typeof in_value + ') ' + in_value);\n }\n return path;\n }\n}\nReferenceProperty.prototype._castFunctor = _castFunctors.String;\nReferenceProperty.prototype._typeid = \"Reference\";\n"]}
1
+ {"version":3,"file":"referenceProperty.js","sourceRoot":"","sources":["../../src/properties/referenceProperty.js"],"names":[],"mappings":";AAAA;;;GAGG;AACH;;GAEG;;;AAEH,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AACvF,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,gCAAgC,EAAE,GAAG,OAAO,CAAC,oCAAoC,CAAC,CAAC;AAC3F,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC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,UAAU,CAAC,WAAW,CAAC,kBAAkB;YAC5D,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,gCAAgC,CAAC,SAAS,CAAC,mBAAmB,CAAC,IAAI,CACnE,IAAI,EACJ,UAAU,EACV,cAAc,CACb,CAAC;IACN,CAAC;IAED,8DAA8D;IAC9D,IAAI,GAAG;QACN,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,IAAI,GAAG,CAAC,GAAG;QACV,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC1B,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ;QAClC,IAAI,IAAI,CAAC;QACT,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YACjC,IAAI,GAAG,QAAQ,CAAC;SAChB;aAAM,IAAI,QAAQ,KAAK,SAAS,EAAE;YAClC,IAAI,GAAG,EAAE,CAAC;SACV;aAAM,IAAI,QAAQ,YAAY,YAAY,EAAE;YAC5C,oGAAoG;YACpG,IAAI,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAC;SAClC;aAAM,IAAI,QAAQ,YAAY,MAAM,EAAE;YACtC,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;SACxB;aAAM;YACN,MAAM,IAAI,SAAS,CAClB,GAAG,CAAC,qBAAqB,GAAG,GAAG,GAAG,OAAO,QAAQ,GAAG,IAAI,GAAG,QAAQ,CACnE,CAAC;SACF;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD;AAtMD,8CAsMC;AACD,iBAAiB,CAAC,SAAS,CAAC,YAAY,GAAG,aAAa,CAAC,MAAM,CAAC;AAChE,iBAAiB,CAAC,SAAS,CAAC,OAAO,GAAG,WAAW,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Definition of the ReferenceProperty class\n */\n\nconst { PathHelper, TypeIdHelper } = require(\"@fluid-experimental/property-changeset\");\nconst { MSG } = require(\"@fluid-experimental/property-common\").constants;\nconst _ = require(\"lodash\");\nconst { AbstractStaticCollectionProperty } = require(\"./abstractStaticCollectionProperty\");\nconst { BaseProperty } = require(\"./baseProperty\");\nconst { _castFunctors } = require(\"./primitiveTypeCasts\");\nconst { ValueProperty } = require(\"./valueProperty\");\n\n/**\n * This class serves as a view to read, write and listen to changes in an\n * object's value field. To do this we simply keep a pointer to the object and\n * it's associated data field that we are interested in. If no data field is\n * present this property will have an undefined value.\n */\nexport class ReferenceProperty extends ValueProperty {\n\t/**\n\t * @param {Object=} in_params - The parameters\n\t *\n\t * @constructor\n\t * @protected\n\t * @extends property-properties.ValueProperty\n\t * @alias property-properties.ReferenceProperty\n\t * @category Properties\n\t */\n\tconstructor(in_params) {\n\t\tsuper(in_params);\n\t\t// default for this property type is an empty string\n\t\tthis._data = \"\";\n\t}\n\n\t/**\n\t * Evaluates Reference properties as primitives.\n\t * @returns {boolean} true since Reference properties are primitives.\n\t */\n\tisPrimitiveType() {\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns the typeid for the target of this reference\n\t *\n\t * Note: This is the type that is specified in the typeid of this reference and not the actual type\n\t * of the referenced object, which might inherit from that typeid.\n\t *\n\t * @returns {string} The typeid of the nodes this reference may point to\n\t */\n\tgetReferenceTargetTypeId() {\n\t\treturn TypeIdHelper.extractReferenceTargetTypeIdFromReference(this.getTypeid());\n\t}\n\n\t/**\n\t * Resolves the referenced property\n\t *\n\t * @param {string|number|array<string|number>} in_ids - The ID of the property or an array of IDs if an array is\n\t * passed, the .get function will be performed on each id in sequence for example .get(['position','x']) is\n\t * equivalent to .get('position').get('x'). If .get resolves to a ReferenceProperty, it will return the property\n\t * that the ReferenceProperty refers to.\n\t * @param {Object} in_options - parameter object\n\t * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How\n\t * should this function behave during reference resolution?\n\t * @returns {property-properties.BaseProperty|undefined} The property object the reference points to or undefined if\n\t * it could not be resolved\n\t */\n\tget(in_ids, in_options) {\n\t\tin_options = in_options || {};\n\t\tin_options.referenceResolutionMode =\n\t\t\tin_options.referenceResolutionMode === undefined\n\t\t\t\t? BaseProperty.REFERENCE_RESOLUTION.ALWAYS\n\t\t\t\t: in_options.referenceResolutionMode;\n\n\t\tif (_.isArray(in_ids) && in_ids.length === 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\t// Since this is a reference property, we return undefined, if reference resolution is disabled\n\t\tif (in_options.referenceResolutionMode !== BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (this.value === \"\") {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (this.getParent() === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\tvar resolvedProperty = this.getParent().resolvePath(this.value, {\n\t\t\treferenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.ALWAYS,\n\t\t});\n\n\t\treturn resolvedProperty !== undefined && _.isArray(in_ids)\n\t\t\t? // Forward handling of arrays to the BaseProperty function\n\t\t\t resolvedProperty.get(in_ids, in_options)\n\t\t\t: resolvedProperty;\n\t}\n\n\t/**\n\t * Expand a path returning the value or property at the end.\n\t *\n\t * @param {string} in_path - The path\n\t * @param {Object} in_options - Parameter object\n\t * @param {property-properties.BaseProperty.REFERENCE_RESOLUTION} [in_options.referenceResolutionMode=ALWAYS] - How\n\t * should this function behave during reference resolution?\n\t * @returns {property-properties.BaseProperty|undefined} resolved path\n\t * @throws if the path resolves to a primitive value\n\t * @throws if in_path is not a valid path\n\t */\n\tresolvePath(in_path, in_options) {\n\t\tif (\n\t\t\tin_options &&\n\t\t\tin_options.referenceResolutionMode &&\n\t\t\tin_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.NEVER\n\t\t) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn AbstractStaticCollectionProperty.prototype.resolvePath.call(\n\t\t\tthis,\n\t\t\tin_path,\n\t\t\tin_options,\n\t\t);\n\t}\n\n\t/**\n\t * Checks whether the reference is valid. This is either the case when it is empty or when the referenced\n\t * property exists.\n\t *\n\t * @returns {boolean} True if the reference is valid, otherwise false.\n\t */\n\tisReferenceValid() {\n\t\treturn this.value === \"\" || this.ref !== undefined;\n\t}\n\n\t/**\n\t * Sets the reference to point to the given property object or to be equal to the given path string.\n\t *\n\t * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n\t * the path to this property. If undefined is passed, the reference will be set to an empty string to\n\t * indicate an empty reference.\n\t * @throws if property is read only\n\t * @throws if in_value is defined, but is not a property or a string.\n\t */\n\tsetValue(in_value) {\n\t\tthis._checkIsNotReadOnly(true);\n\t\tvar value = ReferenceProperty._convertInputToPath(in_value);\n\t\t// Forward the call to setValue\n\t\tValueProperty.prototype.setValue.call(this, value);\n\t}\n\n\t/**\n\t * Sets the reference to point to the given property object or to be equal to the given path string.\n\t *\n\t * @param {property-properties.BaseProperty|undefined|String} in_value - The property to assign to the reference or\n\t * the path to this property. If undefined is passed, the reference will be set to an empty string to\n\t * indicate an empty reference.\n\t * @throws if property is read only\n\t * @throws if in_value is defined but is not a property or a string.\n\t */\n\tset(...args) {\n\t\treturn this.setValue(...args);\n\t}\n\n\t/**\n\t * @inheritdoc\n\t */\n\t_resolvePathSegment(in_segment, in_segmentType) {\n\t\t// path segments and array tokens are no longer automatically forwarded to the referenced node\n\t\treturn in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN ||\n\t\t\tin_segmentType === PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN\n\t\t\t? undefined\n\t\t\t: AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(\n\t\t\t\t\tthis,\n\t\t\t\t\tin_segment,\n\t\t\t\t\tin_segmentType,\n\t\t\t );\n\t}\n\n\t// Define a property to simplify accessing the referenced path\n\tget ref() {\n\t\treturn this.get.apply(this, arguments);\n\t}\n\n\tset ref(val) {\n\t\tthis.set.call(this, val);\n\t}\n\n\t/**\n\t * Validates the input and does as much as possible to return a string representing a path.\n\t *\n\t * @param {property-properties.BaseProperty|undefined|String} in_value - Contains the property to be set or\n\t * the path to this property. If undefined is passed, the reference will be set to an empty string to\n\t * indicate an empty reference.\n\t * @returns {string} The path\n\t * @throws if in_value is defined, but is not a property or a string.\n\t */\n\tstatic _convertInputToPath(in_value) {\n\t\tvar path;\n\t\tif (typeof in_value === \"string\") {\n\t\t\tpath = in_value;\n\t\t} else if (in_value === undefined) {\n\t\t\tpath = \"\";\n\t\t} else if (in_value instanceof BaseProperty) {\n\t\t\t// TODO: Check whether this is still the correct path once we start to support repository references\n\t\t\tpath = in_value.getAbsolutePath();\n\t\t} else if (in_value instanceof String) {\n\t\t\tpath = String(in_value);\n\t\t} else {\n\t\t\tthrow new TypeError(\n\t\t\t\tMSG.PROPERTY_OR_UNDEFINED + \"(\" + typeof in_value + \") \" + in_value,\n\t\t\t);\n\t\t}\n\t\treturn path;\n\t}\n}\nReferenceProperty.prototype._castFunctor = _castFunctors.String;\nReferenceProperty.prototype._typeid = \"Reference\";\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"setProperty.d.ts","sourceRoot":"","sources":["../../src/properties/setProperty.js"],"names":[],"mappings":"AAmBA;;;GAGG;AACH;IACI;;;;;;;;;OASG;IACH,wBAOC;IAJG,eAAsB;IAEtB,oEAAoE;IACpE,qBAA0B;IAmF9B;;;;;;;OAOG;IACH,+BAOC;IAED;;;;;;;;OAQG;IACH,iBAFW,uCAAsC,QAehD;IAED;;;;;;OAMG;IACH,gCASC;IAgFD;;;;;;;OAOG;IACH,2BAkBC;IAqCD;;;;;;;OAOG;IACH,cAHY,eAAe,CAK1B;IAeD;;OAEG;IACH,cAKC;CACJ"}
1
+ {"version":3,"file":"setProperty.d.ts","sourceRoot":"","sources":["../../src/properties/setProperty.js"],"names":[],"mappings":"AAmBA;;;GAGG;AACH;IACC;;;;;;;;;OASG;IACH,wBAOC;IAJA,eAAsB;IAEtB,oEAAoE;IACpE,qBAA0B;IA0F3B;;;;;;;OAOG;IACH,+BAOC;IAED;;;;;;;;OAQG;IACH,iBAFW,uCAAsC,QAehD;IAED;;;;;;OAMG;IACH,gCASC;IAiFD;;;;;;;OAOG;IACH,2BA8BC;IAqCD;;;;;;;OAOG;IACH,cAHY,eAAe,CAK1B;IAeD;;OAEG;IACH,cAKC;CACD"}
@@ -8,13 +8,13 @@ exports.SetProperty = void 0;
8
8
  /**
9
9
  * @fileoverview Definition of the set property class
10
10
  */
11
- const { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');
12
- const { MSG } = require('@fluid-experimental/property-common').constants;
13
- const _ = require('lodash');
14
- const { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');
15
- const { BaseProperty } = require('./baseProperty');
16
- const { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');
17
- const { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');
11
+ const { PathHelper, TypeIdHelper } = require("@fluid-experimental/property-changeset");
12
+ const { MSG } = require("@fluid-experimental/property-common").constants;
13
+ const _ = require("lodash");
14
+ const { AbstractStaticCollectionProperty } = require("./abstractStaticCollectionProperty");
15
+ const { BaseProperty } = require("./baseProperty");
16
+ const { IndexedCollectionBaseProperty } = require("./indexedCollectionBaseProperty");
17
+ const { LazyLoadedProperties: Property } = require("./lazyLoadedProperties");
18
18
  var PATH_TOKENS = BaseProperty.PATH_TOKENS;
19
19
  /**
20
20
  * A SetProperty is a collection class that can contain an unordered set of properties. These properties
@@ -49,25 +49,26 @@ class SetProperty extends IndexedCollectionBaseProperty {
49
49
  return true;
50
50
  }
51
51
  /**
52
- * Returns an object with all the nested values contained in this property.
53
- * @return {object} An object representing the values of your property.
54
- * For example:
55
- *
56
- * ```json
57
- * {
58
- * position: {
59
- * x: 2,
60
- * y: 5
61
- * }
62
- * }
63
- * ```
64
- */
52
+ * Returns an object with all the nested values contained in this property.
53
+ * @return {object} An object representing the values of your property.
54
+ * For example:
55
+ *
56
+ * ```json
57
+ * {
58
+ * position: {
59
+ * x: 2,
60
+ * y: 5
61
+ * }
62
+ * }
63
+ * ```
64
+ */
65
65
  getValues() {
66
66
  var ids = this.getIds();
67
67
  var result = {};
68
68
  for (var i = 0; i < ids.length; i++) {
69
69
  var child = this.get(ids[i]);
70
- if (child instanceof Property.ValueProperty || child instanceof Property.StringProperty) {
70
+ if (child instanceof Property.ValueProperty ||
71
+ child instanceof Property.StringProperty) {
71
72
  result[ids[i]] = this.get(ids[i]).getValue();
72
73
  }
73
74
  else {
@@ -84,7 +85,7 @@ class SetProperty extends IndexedCollectionBaseProperty {
84
85
  getFullTypeid(in_hideCollection = false) {
85
86
  return in_hideCollection
86
87
  ? this._typeid
87
- : TypeIdHelper.createSerializationTypeId(this._typeid, 'set');
88
+ : TypeIdHelper.createSerializationTypeId(this._typeid, "set");
88
89
  }
89
90
  /**
90
91
  * Returns the path segment for a child
@@ -95,7 +96,7 @@ class SetProperty extends IndexedCollectionBaseProperty {
95
96
  * @protected
96
97
  */
97
98
  _getPathSegmentForChildNode(in_childNode) {
98
- return '[' + in_childNode.getGuid() + ']';
99
+ return "[" + in_childNode.getGuid() + "]";
99
100
  }
100
101
  /**
101
102
  * Resolves a direct child node based on the given path segment
@@ -121,7 +122,7 @@ class SetProperty extends IndexedCollectionBaseProperty {
121
122
  * @throws if a property already exists with the same guid as in_property
122
123
  */
123
124
  insert(in_property) {
124
- if (in_property instanceof AbstractStaticCollectionProperty && in_property.has('guid')) {
125
+ if (in_property instanceof AbstractStaticCollectionProperty && in_property.has("guid")) {
125
126
  var guid = in_property.getGuid();
126
127
  this._insert(guid, in_property, true);
127
128
  }
@@ -140,7 +141,7 @@ class SetProperty extends IndexedCollectionBaseProperty {
140
141
  */
141
142
  set(in_property) {
142
143
  this._checkIsNotReadOnly(true);
143
- if (in_property instanceof AbstractStaticCollectionProperty && in_property.has('guid')) {
144
+ if (in_property instanceof AbstractStaticCollectionProperty && in_property.has("guid")) {
144
145
  var guid = in_property.getGuid();
145
146
  if (this.has(guid)) {
146
147
  this.remove(guid);
@@ -212,8 +213,9 @@ class SetProperty extends IndexedCollectionBaseProperty {
212
213
  var prop = this;
213
214
  in_options = in_options || {};
214
215
  in_options.referenceResolutionMode =
215
- in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :
216
- in_options.referenceResolutionMode;
216
+ in_options.referenceResolutionMode === undefined
217
+ ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
218
+ : in_options.referenceResolutionMode;
217
219
  switch (in_ids) {
218
220
  case PATH_TOKENS.ROOT: {
219
221
  prop = prop.getRoot();
@@ -335,6 +337,6 @@ class SetProperty extends IndexedCollectionBaseProperty {
335
337
  }
336
338
  }
337
339
  exports.SetProperty = SetProperty;
338
- SetProperty.prototype._typeid = 'NamedProperty';
339
- SetProperty.prototype._context = 'set';
340
+ SetProperty.prototype._typeid = "NamedProperty";
341
+ SetProperty.prototype._context = "set";
340
342
  //# sourceMappingURL=setProperty.js.map