@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,MAAM,OAAO,sBAAuB,SAAQ,kBAAkB;IAC1D;;;;;;;;OAQG;IACH,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ileoverview 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,CAAC;AACzE,MAAM,EA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,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"}
@@ -5,13 +5,13 @@
5
5
  /**
6
6
  * @fileoverview Definition of the reference map property class
7
7
  */
8
- const { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');
9
- const { MSG } = require('@fluid-experimental/property-common').constants;
10
- const _ = require('lodash');
11
- const { BaseProperty } = require('./baseProperty');
12
- const { ContainerProperty } = require('./containerProperty');
13
- const { ReferenceProperty } = require('./referenceProperty');
14
- const { StringMapProperty } = require('./valueMapProperty');
8
+ const { PathHelper, TypeIdHelper } = require("@fluid-experimental/property-changeset");
9
+ const { MSG } = require("@fluid-experimental/property-common").constants;
10
+ const _ = require("lodash");
11
+ const { BaseProperty } = require("./baseProperty");
12
+ const { ContainerProperty } = require("./containerProperty");
13
+ const { ReferenceProperty } = require("./referenceProperty");
14
+ const { StringMapProperty } = require("./valueMapProperty");
15
15
  /**
16
16
  * A StringMapProperty which stores reference values
17
17
  */
@@ -57,16 +57,16 @@ export class ReferenceMapProperty extends StringMapProperty {
57
57
  get(in_ids, in_options) {
58
58
  in_options = in_options || {};
59
59
  in_options.referenceResolutionMode =
60
- in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :
61
- in_options.referenceResolutionMode;
60
+ in_options.referenceResolutionMode === undefined
61
+ ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
62
+ : in_options.referenceResolutionMode;
62
63
  if (_.isArray(in_ids)) {
63
64
  // Forward handling of arrays to the BaseProperty function
64
65
  return AbstractStaticCollectionProperty.prototype.get.call(this, in_ids, in_options);
65
66
  }
66
67
  else {
67
68
  var value = this._dynamicChildren[in_ids];
68
- if (value === undefined ||
69
- value === '') {
69
+ if (value === undefined || value === "") {
70
70
  return undefined;
71
71
  }
72
72
  return this.getParent().resolvePath(value, in_options);
@@ -157,9 +157,7 @@ export class ReferenceMapProperty extends StringMapProperty {
157
157
  * @returns {boolean} True if the reference is valid, otherwise false.
158
158
  */
159
159
  isReferenceValid(in_key) {
160
- return this.has(in_key) &&
161
- (this.getValue(in_key) === '' ||
162
- this.get(in_key) !== undefined);
160
+ return this.has(in_key) && (this.getValue(in_key) === "" || this.get(in_key) !== undefined);
163
161
  }
164
162
  /**
165
163
  * Returns the string value stored in the map
@@ -175,10 +173,12 @@ export class ReferenceMapProperty extends StringMapProperty {
175
173
  _resolvePathSegment(in_segment, in_segmentType) {
176
174
  // Array tokens are automatically resolved
177
175
  return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN
178
- ? this.get(in_segment, { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER })
179
- // Everything else is handled by the implementation in the base property
180
- : AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);
176
+ ? this.get(in_segment, {
177
+ referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER,
178
+ })
179
+ : // Everything else is handled by the implementation in the base property
180
+ AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);
181
181
  }
182
182
  }
183
- ReferenceMapProperty.prototype._typeid = 'Reference';
183
+ ReferenceMapProperty.prototype._typeid = "Reference";
184
184
  //# 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,MAAM,OAAO,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;gBACzF,UAAU,CAAC,uBAAuB,CAAC;QAE3C,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,E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W,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,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACnD,MAAM,EAAE,iBAAiB,EAAE,GAAG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;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;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"}
@@ -5,13 +5,13 @@
5
5
  /**
6
6
  * @fileoverview Definition of the ReferenceProperty class
7
7
  */
8
- const { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');
9
- const { MSG } = require('@fluid-experimental/property-common').constants;
10
- const _ = require('lodash');
11
- const { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');
12
- const { BaseProperty } = require('./baseProperty');
13
- const { _castFunctors } = require('./primitiveTypeCasts');
14
- const { ValueProperty } = require('./valueProperty');
8
+ const { PathHelper, TypeIdHelper } = require("@fluid-experimental/property-changeset");
9
+ const { MSG } = require("@fluid-experimental/property-common").constants;
10
+ const _ = require("lodash");
11
+ const { AbstractStaticCollectionProperty } = require("./abstractStaticCollectionProperty");
12
+ const { BaseProperty } = require("./baseProperty");
13
+ const { _castFunctors } = require("./primitiveTypeCasts");
14
+ const { ValueProperty } = require("./valueProperty");
15
15
  /**
16
16
  * This class serves as a view to read, write and listen to changes in an
17
17
  * object's value field. To do this we simply keep a pointer to the object and
@@ -20,18 +20,18 @@ const { ValueProperty } = require('./valueProperty');
20
20
  */
21
21
  export class ReferenceProperty extends ValueProperty {
22
22
  /**
23
- * @param {Object=} in_params - The parameters
24
- *
25
- * @constructor
26
- * @protected
27
- * @extends property-properties.ValueProperty
28
- * @alias property-properties.ReferenceProperty
29
- * @category Properties
30
- */
23
+ * @param {Object=} in_params - The parameters
24
+ *
25
+ * @constructor
26
+ * @protected
27
+ * @extends property-properties.ValueProperty
28
+ * @alias property-properties.ReferenceProperty
29
+ * @category Properties
30
+ */
31
31
  constructor(in_params) {
32
32
  super(in_params);
33
33
  // default for this property type is an empty string
34
- this._data = '';
34
+ this._data = "";
35
35
  }
36
36
  /**
37
37
  * Evaluates Reference properties as primitives.
@@ -67,8 +67,9 @@ export class ReferenceProperty extends ValueProperty {
67
67
  get(in_ids, in_options) {
68
68
  in_options = in_options || {};
69
69
  in_options.referenceResolutionMode =
70
- in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :
71
- in_options.referenceResolutionMode;
70
+ in_options.referenceResolutionMode === undefined
71
+ ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
72
+ : in_options.referenceResolutionMode;
72
73
  if (_.isArray(in_ids) && in_ids.length === 0) {
73
74
  return this;
74
75
  }
@@ -76,16 +77,18 @@ export class ReferenceProperty extends ValueProperty {
76
77
  if (in_options.referenceResolutionMode !== BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {
77
78
  return undefined;
78
79
  }
79
- if (this.value === '') {
80
+ if (this.value === "") {
80
81
  return undefined;
81
82
  }
82
83
  if (this.getParent() === undefined) {
83
84
  return undefined;
84
85
  }
85
- var resolvedProperty = this.getParent().resolvePath(this.value, { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.ALWAYS });
86
+ var resolvedProperty = this.getParent().resolvePath(this.value, {
87
+ referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.ALWAYS,
88
+ });
86
89
  return resolvedProperty !== undefined && _.isArray(in_ids)
87
- // Forward handling of arrays to the BaseProperty function
88
- ? resolvedProperty.get(in_ids, in_options)
90
+ ? // Forward handling of arrays to the BaseProperty function
91
+ resolvedProperty.get(in_ids, in_options)
89
92
  : resolvedProperty;
90
93
  }
91
94
  /**
@@ -100,7 +103,8 @@ export class ReferenceProperty extends ValueProperty {
100
103
  * @throws if in_path is not a valid path
101
104
  */
102
105
  resolvePath(in_path, in_options) {
103
- if (in_options && in_options.referenceResolutionMode &&
106
+ if (in_options &&
107
+ in_options.referenceResolutionMode &&
104
108
  in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.NEVER) {
105
109
  return undefined;
106
110
  }
@@ -113,7 +117,7 @@ export class ReferenceProperty extends ValueProperty {
113
117
  * @returns {boolean} True if the reference is valid, otherwise false.
114
118
  */
115
119
  isReferenceValid() {
116
- return this.value === '' || this.ref !== undefined;
120
+ return this.value === "" || this.ref !== undefined;
117
121
  }
118
122
  /**
119
123
  * Sets the reference to point to the given property object or to be equal to the given path string.
@@ -147,8 +151,8 @@ export class ReferenceProperty extends ValueProperty {
147
151
  */
148
152
  _resolvePathSegment(in_segment, in_segmentType) {
149
153
  // path segments and array tokens are no longer automatically forwarded to the referenced node
150
- return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN
151
- || in_segmentType === PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN
154
+ return in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN ||
155
+ in_segmentType === PathHelper.TOKEN_TYPES.PATH_SEGMENT_TOKEN
152
156
  ? undefined
153
157
  : AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);
154
158
  }
@@ -170,11 +174,11 @@ export class ReferenceProperty extends ValueProperty {
170
174
  */
171
175
  static _convertInputToPath(in_value) {
172
176
  var path;
173
- if (typeof in_value === 'string') {
177
+ if (typeof in_value === "string") {
174
178
  path = in_value;
175
179
  }
176
180
  else if (in_value === undefined) {
177
- path = '';
181
+ path = "";
178
182
  }
179
183
  else if (in_value instanceof BaseProperty) {
180
184
  // TODO: Check whether this is still the correct path once we start to support repository references
@@ -184,7 +188,7 @@ export class ReferenceProperty extends ValueProperty {
184
188
  path = String(in_value);
185
189
  }
186
190
  else {
187
- throw new TypeError(MSG.PROPERTY_OR_UNDEFINED + '(' + typeof in_value + ') ' + in_value);
191
+ throw new TypeError(MSG.PROPERTY_OR_UNDEFINED + "(" + typeof in_value + ") " + in_value);
188
192
  }
189
193
  return path;
190
194
  }
@@ -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,MAAM,OAAO,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;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,MAAM,EAAE,UAAU;QAClB,UAAU,GAAG,UAAU,IAAI,EAAE,CAAC;QAC9B,UAAU,CAAC,uBA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AQ,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;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,CAAC;AAC1D,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAErD;;;;;GAKG;AACH,MAAM,OAAO,iBAAkB,SAAQ,aAAa;I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,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;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"}
@@ -5,13 +5,13 @@
5
5
  /**
6
6
  * @fileoverview Definition of the set property class
7
7
  */
8
- const { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');
9
- const { MSG } = require('@fluid-experimental/property-common').constants;
10
- const _ = require('lodash');
11
- const { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');
12
- const { BaseProperty } = require('./baseProperty');
13
- const { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');
14
- const { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');
8
+ const { PathHelper, TypeIdHelper } = require("@fluid-experimental/property-changeset");
9
+ const { MSG } = require("@fluid-experimental/property-common").constants;
10
+ const _ = require("lodash");
11
+ const { AbstractStaticCollectionProperty } = require("./abstractStaticCollectionProperty");
12
+ const { BaseProperty } = require("./baseProperty");
13
+ const { IndexedCollectionBaseProperty } = require("./indexedCollectionBaseProperty");
14
+ const { LazyLoadedProperties: Property } = require("./lazyLoadedProperties");
15
15
  var PATH_TOKENS = BaseProperty.PATH_TOKENS;
16
16
  /**
17
17
  * A SetProperty is a collection class that can contain an unordered set of properties. These properties
@@ -46,25 +46,26 @@ export class SetProperty extends IndexedCollectionBaseProperty {
46
46
  return true;
47
47
  }
48
48
  /**
49
- * Returns an object with all the nested values contained in this property.
50
- * @return {object} An object representing the values of your property.
51
- * For example:
52
- *
53
- * ```json
54
- * {
55
- * position: {
56
- * x: 2,
57
- * y: 5
58
- * }
59
- * }
60
- * ```
61
- */
49
+ * Returns an object with all the nested values contained in this property.
50
+ * @return {object} An object representing the values of your property.
51
+ * For example:
52
+ *
53
+ * ```json
54
+ * {
55
+ * position: {
56
+ * x: 2,
57
+ * y: 5
58
+ * }
59
+ * }
60
+ * ```
61
+ */
62
62
  getValues() {
63
63
  var ids = this.getIds();
64
64
  var result = {};
65
65
  for (var i = 0; i < ids.length; i++) {
66
66
  var child = this.get(ids[i]);
67
- if (child instanceof Property.ValueProperty || child instanceof Property.StringProperty) {
67
+ if (child instanceof Property.ValueProperty ||
68
+ child instanceof Property.StringProperty) {
68
69
  result[ids[i]] = this.get(ids[i]).getValue();
69
70
  }
70
71
  else {
@@ -81,7 +82,7 @@ export class SetProperty extends IndexedCollectionBaseProperty {
81
82
  getFullTypeid(in_hideCollection = false) {
82
83
  return in_hideCollection
83
84
  ? this._typeid
84
- : TypeIdHelper.createSerializationTypeId(this._typeid, 'set');
85
+ : TypeIdHelper.createSerializationTypeId(this._typeid, "set");
85
86
  }
86
87
  /**
87
88
  * Returns the path segment for a child
@@ -92,7 +93,7 @@ export class SetProperty extends IndexedCollectionBaseProperty {
92
93
  * @protected
93
94
  */
94
95
  _getPathSegmentForChildNode(in_childNode) {
95
- return '[' + in_childNode.getGuid() + ']';
96
+ return "[" + in_childNode.getGuid() + "]";
96
97
  }
97
98
  /**
98
99
  * Resolves a direct child node based on the given path segment
@@ -118,7 +119,7 @@ export class SetProperty extends IndexedCollectionBaseProperty {
118
119
  * @throws if a property already exists with the same guid as in_property
119
120
  */
120
121
  insert(in_property) {
121
- if (in_property instanceof AbstractStaticCollectionProperty && in_property.has('guid')) {
122
+ if (in_property instanceof AbstractStaticCollectionProperty && in_property.has("guid")) {
122
123
  var guid = in_property.getGuid();
123
124
  this._insert(guid, in_property, true);
124
125
  }
@@ -137,7 +138,7 @@ export class SetProperty extends IndexedCollectionBaseProperty {
137
138
  */
138
139
  set(in_property) {
139
140
  this._checkIsNotReadOnly(true);
140
- if (in_property instanceof AbstractStaticCollectionProperty && in_property.has('guid')) {
141
+ if (in_property instanceof AbstractStaticCollectionProperty && in_property.has("guid")) {
141
142
  var guid = in_property.getGuid();
142
143
  if (this.has(guid)) {
143
144
  this.remove(guid);
@@ -209,8 +210,9 @@ export class SetProperty extends IndexedCollectionBaseProperty {
209
210
  var prop = this;
210
211
  in_options = in_options || {};
211
212
  in_options.referenceResolutionMode =
212
- in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :
213
- in_options.referenceResolutionMode;
213
+ in_options.referenceResolutionMode === undefined
214
+ ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS
215
+ : in_options.referenceResolutionMode;
214
216
  switch (in_ids) {
215
217
  case PATH_TOKENS.ROOT: {
216
218
  prop = prop.getRoot();
@@ -331,6 +333,6 @@ export class SetProperty extends IndexedCollectionBaseProperty {
331
333
  });
332
334
  }
333
335
  }
334
- SetProperty.prototype._typeid = 'NamedProperty';
335
- SetProperty.prototype._context = 'set';
336
+ SetProperty.prototype._typeid = "NamedProperty";
337
+ SetProperty.prototype._context = "set";
336
338
  //# sourceMappingURL=setProperty.js.map