@fluid-experimental/property-properties 0.58.1001 → 0.58.2000-58133

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 (223) hide show
  1. package/dist/containerSerializer.d.ts.map +1 -1
  2. package/dist/containerSerializer.js +4 -10
  3. package/dist/containerSerializer.js.map +1 -1
  4. package/dist/enableValidations.d.ts.map +1 -1
  5. package/dist/enableValidations.js +1 -1
  6. package/dist/enableValidations.js.map +1 -1
  7. package/dist/index.d.ts +1 -1
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js.map +1 -1
  10. package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
  11. package/dist/properties/abstractStaticCollectionProperty.js +1 -28
  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 +26 -85
  15. package/dist/properties/arrayProperty.js.map +1 -1
  16. package/dist/properties/baseProperty.d.ts.map +1 -1
  17. package/dist/properties/baseProperty.js +9 -71
  18. package/dist/properties/baseProperty.js.map +1 -1
  19. package/dist/properties/boolProperty.d.ts.map +1 -1
  20. package/dist/properties/boolProperty.js +0 -1
  21. package/dist/properties/boolProperty.js.map +1 -1
  22. package/dist/properties/containerProperty.d.ts.map +1 -1
  23. package/dist/properties/containerProperty.js +4 -22
  24. package/dist/properties/containerProperty.js.map +1 -1
  25. package/dist/properties/enumArrayProperty.d.ts.map +1 -1
  26. package/dist/properties/enumArrayProperty.js +2 -14
  27. package/dist/properties/enumArrayProperty.js.map +1 -1
  28. package/dist/properties/enumProperty.d.ts.map +1 -1
  29. package/dist/properties/enumProperty.js +3 -10
  30. package/dist/properties/enumProperty.js.map +1 -1
  31. package/dist/properties/floatProperties.js +0 -2
  32. package/dist/properties/floatProperties.js.map +1 -1
  33. package/dist/properties/index.d.ts +7 -38
  34. package/dist/properties/index.d.ts.map +1 -1
  35. package/dist/properties/index.js +37 -68
  36. package/dist/properties/index.js.map +1 -1
  37. package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
  38. package/dist/properties/indexedCollectionBaseProperty.js +6 -18
  39. package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
  40. package/dist/properties/intProperties.d.ts.map +1 -1
  41. package/dist/properties/intProperties.js +3 -20
  42. package/dist/properties/intProperties.js.map +1 -1
  43. package/dist/properties/lazyLoadedProperties.js.map +1 -1
  44. package/dist/properties/mapProperty.d.ts.map +1 -1
  45. package/dist/properties/mapProperty.js +4 -23
  46. package/dist/properties/mapProperty.js.map +1 -1
  47. package/dist/properties/namedNodeProperty.d.ts.map +1 -1
  48. package/dist/properties/namedNodeProperty.js.map +1 -1
  49. package/dist/properties/namedProperty.d.ts.map +1 -1
  50. package/dist/properties/namedProperty.js +0 -3
  51. package/dist/properties/namedProperty.js.map +1 -1
  52. package/dist/properties/nodeProperty.d.ts.map +1 -1
  53. package/dist/properties/nodeProperty.js +0 -3
  54. package/dist/properties/nodeProperty.js.map +1 -1
  55. package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
  56. package/dist/properties/primitiveTypeCasts.js +2 -2
  57. package/dist/properties/primitiveTypeCasts.js.map +1 -1
  58. package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
  59. package/dist/properties/referenceArrayProperty.js +3 -16
  60. package/dist/properties/referenceArrayProperty.js.map +1 -1
  61. package/dist/properties/referenceMapProperty.d.ts.map +1 -1
  62. package/dist/properties/referenceMapProperty.js +3 -13
  63. package/dist/properties/referenceMapProperty.js.map +1 -1
  64. package/dist/properties/referenceProperty.d.ts.map +1 -1
  65. package/dist/properties/referenceProperty.js +4 -12
  66. package/dist/properties/referenceProperty.js.map +1 -1
  67. package/dist/properties/setProperty.d.ts.map +1 -1
  68. package/dist/properties/setProperty.js +3 -22
  69. package/dist/properties/setProperty.js.map +1 -1
  70. package/dist/properties/stringProperty.d.ts.map +1 -1
  71. package/dist/properties/stringProperty.js +12 -48
  72. package/dist/properties/stringProperty.js.map +1 -1
  73. package/dist/properties/uintProperties.js +0 -3
  74. package/dist/properties/uintProperties.js.map +1 -1
  75. package/dist/properties/valueArrayProperty.d.ts.map +1 -1
  76. package/dist/properties/valueArrayProperty.js +3 -45
  77. package/dist/properties/valueArrayProperty.js.map +1 -1
  78. package/dist/properties/valueMapProperty.d.ts.map +1 -1
  79. package/dist/properties/valueMapProperty.js +4 -29
  80. package/dist/properties/valueMapProperty.js.map +1 -1
  81. package/dist/properties/valueProperty.d.ts.map +1 -1
  82. package/dist/properties/valueProperty.js +2 -14
  83. package/dist/properties/valueProperty.js.map +1 -1
  84. package/dist/propertyFactory.d.ts.map +1 -1
  85. package/dist/propertyFactory.js +35 -72
  86. package/dist/propertyFactory.js.map +1 -1
  87. package/dist/propertyTemplate.d.ts.map +1 -1
  88. package/dist/propertyTemplate.js +0 -14
  89. package/dist/propertyTemplate.js.map +1 -1
  90. package/dist/propertyTemplateWrapper.d.ts.map +1 -1
  91. package/dist/propertyTemplateWrapper.js +4 -12
  92. package/dist/propertyTemplateWrapper.js.map +1 -1
  93. package/dist/propertyUtils.d.ts.map +1 -1
  94. package/dist/propertyUtils.js.map +1 -1
  95. package/dist/test/properties/arrayProperty.spec.js +82 -82
  96. package/dist/test/properties/arrayProperty.spec.js.map +1 -1
  97. package/dist/test/properties/baseProperty.spec.js +53 -53
  98. package/dist/test/properties/baseProperty.spec.js.map +1 -1
  99. package/dist/test/properties/containerProperty.spec.js +25 -25
  100. package/dist/test/properties/containerProperty.spec.js.map +1 -1
  101. package/dist/test/properties/customArrayProperty.spec.js +35 -35
  102. package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
  103. package/dist/test/properties/enumArrayProperty.spec.js +6 -6
  104. package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
  105. package/dist/test/properties/enumProperty.spec.js +26 -26
  106. package/dist/test/properties/enumProperty.spec.js.map +1 -1
  107. package/dist/test/properties/float32.spec.js.map +1 -1
  108. package/dist/test/properties/int64ArrayProperty.spec.js +22 -22
  109. package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
  110. package/dist/test/properties/int64MapProperty.spec.js +28 -28
  111. package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
  112. package/dist/test/properties/int64Property.spec.js +11 -11
  113. package/dist/test/properties/int64Property.spec.js.map +1 -1
  114. package/dist/test/properties/isLeafNode.spec.js +25 -25
  115. package/dist/test/properties/isLeafNode.spec.js.map +1 -1
  116. package/dist/test/properties/mapProperty.spec.js +110 -110
  117. package/dist/test/properties/mapProperty.spec.js.map +1 -1
  118. package/dist/test/properties/namedNodeProperty.spec.js +5 -5
  119. package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
  120. package/dist/test/properties/nodeProperty.spec.js +160 -160
  121. package/dist/test/properties/nodeProperty.spec.js.map +1 -1
  122. package/dist/test/properties/referenceProperty.spec.js +21 -21
  123. package/dist/test/properties/referenceProperty.spec.js.map +1 -1
  124. package/dist/test/properties/relationshipProperty.spec.js +4 -4
  125. package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
  126. package/dist/test/properties/setProperty.spec.js +32 -32
  127. package/dist/test/properties/setProperty.spec.js.map +1 -1
  128. package/dist/test/properties/stringProperty.spec.js +38 -38
  129. package/dist/test/properties/stringProperty.spec.js.map +1 -1
  130. package/dist/test/properties/uint64Property.spec.js +3 -3
  131. package/dist/test/properties/uint64Property.spec.js.map +1 -1
  132. package/dist/test/properties/valueMapProperty.spec.js +28 -28
  133. package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
  134. package/dist/test/properties/valueProperty.spec.js +7 -7
  135. package/dist/test/properties/valueProperty.spec.js.map +1 -1
  136. package/dist/test/propertyFactory.spec.js +559 -560
  137. package/dist/test/propertyFactory.spec.js.map +1 -1
  138. package/dist/test/propertyTemplateWrapper.spec.js +38 -38
  139. package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
  140. package/dist/test/propertyUtils.spec.js +5 -5
  141. package/dist/test/propertyUtils.spec.js.map +1 -1
  142. package/dist/test/reversibleChangeset.spec.js +266 -266
  143. package/dist/test/reversibleChangeset.spec.js.map +1 -1
  144. package/dist/test/setup.js.map +1 -1
  145. package/dist/test/tsconfig.tsbuildinfo +145 -145
  146. package/dist/test/utils.spec.js +508 -517
  147. package/dist/test/utils.spec.js.map +1 -1
  148. package/dist/test/validation/badMissingSemverInTypeid.js +9 -9
  149. package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
  150. package/dist/test/validation/badPrimitiveTypeid.js +5 -5
  151. package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
  152. package/dist/test/validation/goodColorId.js +42 -42
  153. package/dist/test/validation/goodColorId.js.map +1 -1
  154. package/dist/test/validation/goodColorPalette.js +2 -2
  155. package/dist/test/validation/goodColorPalette.js.map +1 -1
  156. package/dist/test/validation/goodPointId.js +9 -9
  157. package/dist/test/validation/goodPointId.js.map +1 -1
  158. package/dist/test/validation/reversibleChangeSetTestData.js +1 -1
  159. package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
  160. package/lib/containerSerializer.js +4 -10
  161. package/lib/containerSerializer.js.map +1 -1
  162. package/lib/enableValidations.js +1 -1
  163. package/lib/enableValidations.js.map +1 -1
  164. package/lib/index.js +1 -1
  165. package/lib/index.js.map +1 -1
  166. package/lib/properties/abstractStaticCollectionProperty.js +1 -28
  167. package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
  168. package/lib/properties/arrayProperty.js +26 -85
  169. package/lib/properties/arrayProperty.js.map +1 -1
  170. package/lib/properties/baseProperty.js +7 -69
  171. package/lib/properties/baseProperty.js.map +1 -1
  172. package/lib/properties/boolProperty.js +0 -1
  173. package/lib/properties/boolProperty.js.map +1 -1
  174. package/lib/properties/containerProperty.js +4 -22
  175. package/lib/properties/containerProperty.js.map +1 -1
  176. package/lib/properties/enumArrayProperty.js +2 -14
  177. package/lib/properties/enumArrayProperty.js.map +1 -1
  178. package/lib/properties/enumProperty.js +3 -10
  179. package/lib/properties/enumProperty.js.map +1 -1
  180. package/lib/properties/floatProperties.js +0 -2
  181. package/lib/properties/floatProperties.js.map +1 -1
  182. package/lib/properties/index.js +7 -38
  183. package/lib/properties/index.js.map +1 -1
  184. package/lib/properties/indexedCollectionBaseProperty.js +6 -18
  185. package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
  186. package/lib/properties/intProperties.js +3 -20
  187. package/lib/properties/intProperties.js.map +1 -1
  188. package/lib/properties/lazyLoadedProperties.js.map +1 -1
  189. package/lib/properties/mapProperty.js +4 -23
  190. package/lib/properties/mapProperty.js.map +1 -1
  191. package/lib/properties/namedNodeProperty.js.map +1 -1
  192. package/lib/properties/namedProperty.js +0 -3
  193. package/lib/properties/namedProperty.js.map +1 -1
  194. package/lib/properties/nodeProperty.js +0 -3
  195. package/lib/properties/nodeProperty.js.map +1 -1
  196. package/lib/properties/primitiveTypeCasts.js +2 -2
  197. package/lib/properties/primitiveTypeCasts.js.map +1 -1
  198. package/lib/properties/referenceArrayProperty.js +3 -16
  199. package/lib/properties/referenceArrayProperty.js.map +1 -1
  200. package/lib/properties/referenceMapProperty.js +3 -13
  201. package/lib/properties/referenceMapProperty.js.map +1 -1
  202. package/lib/properties/referenceProperty.js +4 -12
  203. package/lib/properties/referenceProperty.js.map +1 -1
  204. package/lib/properties/setProperty.js +3 -22
  205. package/lib/properties/setProperty.js.map +1 -1
  206. package/lib/properties/stringProperty.js +12 -48
  207. package/lib/properties/stringProperty.js.map +1 -1
  208. package/lib/properties/uintProperties.js +0 -3
  209. package/lib/properties/uintProperties.js.map +1 -1
  210. package/lib/properties/valueArrayProperty.js +3 -45
  211. package/lib/properties/valueArrayProperty.js.map +1 -1
  212. package/lib/properties/valueMapProperty.js +4 -29
  213. package/lib/properties/valueMapProperty.js.map +1 -1
  214. package/lib/properties/valueProperty.js +2 -14
  215. package/lib/properties/valueProperty.js.map +1 -1
  216. package/lib/propertyFactory.js +35 -72
  217. package/lib/propertyFactory.js.map +1 -1
  218. package/lib/propertyTemplate.js +0 -14
  219. package/lib/propertyTemplate.js.map +1 -1
  220. package/lib/propertyTemplateWrapper.js +4 -12
  221. package/lib/propertyTemplateWrapper.js.map +1 -1
  222. package/lib/propertyUtils.js.map +1 -1
  223. package/package.json +13 -6
@@ -5,13 +5,13 @@
5
5
  /**
6
6
  * @fileoverview Definition of the 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 { ConsoleUtils } = require('@fluid-experimental/property-common');
8
11
  const _ = require('lodash');
9
- const { BaseProperty } = require('./baseProperty');
10
12
  const { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');
13
+ const { BaseProperty } = require('./baseProperty');
11
14
  const { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');
12
- const { ConsoleUtils } = require('@fluid-experimental/property-common');
13
- const { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');
14
- const { MSG } = require('@fluid-experimental/property-common').constants;
15
15
  const { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');
16
16
  const PATH_TOKENS = BaseProperty.PATH_TOKENS;
17
17
  /**
@@ -40,7 +40,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
40
40
  /** Contains the actual entries of the map */
41
41
  this._dynamicChildren = {};
42
42
  }
43
- ;
44
43
  /**
45
44
  * Returns the full property type identifier for the ChangeSet including the enum type id
46
45
  * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted
@@ -54,7 +53,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
54
53
  return TypeIdHelper.createSerializationTypeId(this._typeid, 'map');
55
54
  }
56
55
  }
57
- ;
58
56
  /**
59
57
  * Is this property a leaf node with regard to flattening?
60
58
  *
@@ -65,7 +63,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
65
63
  _isFlattenLeaf() {
66
64
  return true;
67
65
  }
68
- ;
69
66
  /**
70
67
  * Sets multiple values in a map.
71
68
  *
@@ -117,7 +114,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
117
114
  });
118
115
  }
119
116
  }
120
- ;
121
117
  /**
122
118
  * Sets multiple values in a map.
123
119
  *
@@ -134,7 +130,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
134
130
  }
135
131
  this._setValuesInternal(in_values, in_typed);
136
132
  }
137
- ;
138
133
  /**
139
134
  * Sets multiple values in a map.
140
135
  *
@@ -154,7 +149,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
154
149
  this._setValues(in_values, false, false);
155
150
  }
156
151
  }
157
- ;
158
152
  /**
159
153
  * Returns an object with all the nested values contained in this property
160
154
  * @return {object} an object representing the values of your property
@@ -181,7 +175,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
181
175
  }
182
176
  return result;
183
177
  }
184
- ;
185
178
  /**
186
179
  * Returns the path segment for a child
187
180
  *
@@ -193,7 +186,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
193
186
  _getPathSegmentForChildNode(in_childNode) {
194
187
  return '[' + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + ']';
195
188
  }
196
- ;
197
189
  /**
198
190
  * Resolves a direct child node based on the given path segment
199
191
  *
@@ -212,7 +204,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
212
204
  return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);
213
205
  }
214
206
  }
215
- ;
216
207
  /**
217
208
  * Inserts a property or value into the map
218
209
  *
@@ -242,7 +233,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
242
233
  throw new Error(MSG.NONVALUE_MAP_INSERT_PROP);
243
234
  }
244
235
  }
245
- ;
246
236
  /**
247
237
  * Removes the entry with the given key from the map
248
238
  *
@@ -255,7 +245,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
255
245
  this._removeByKey(in_key, true);
256
246
  return item;
257
247
  }
258
- ;
259
248
  /**
260
249
  * Sets the entry with the given key to the property passed in
261
250
  *
@@ -285,7 +274,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
285
274
  this._reportDirtinessToView();
286
275
  }
287
276
  }
288
- ;
289
277
  /**
290
278
  * Returns an Object with all the entries of the map.
291
279
  * Contrary ot .getValues, for Property Maps, this will return the Property, not an object with their nested values.
@@ -298,7 +286,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
298
286
  getEntriesReadOnly() {
299
287
  return this._dynamicChildren;
300
288
  }
301
- ;
302
289
  /**
303
290
  * Returns the collection entry with the given key
304
291
  *
@@ -346,7 +333,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
346
333
  return prop;
347
334
  }
348
335
  }
349
- ;
350
336
  /**
351
337
  * Checks whether an entry with the given name exists
352
338
  *
@@ -356,7 +342,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
356
342
  has(in_id) {
357
343
  return this._dynamicChildren[in_id] !== undefined;
358
344
  }
359
- ;
360
345
  /**
361
346
  * Returns all entries of the map as an array.
362
347
  *
@@ -368,7 +353,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
368
353
  getAsArray() {
369
354
  return _.values(this._dynamicChildren);
370
355
  }
371
- ;
372
356
  /**
373
357
  * Returns all keys found in the map
374
358
  *
@@ -379,7 +363,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
379
363
  getIds() {
380
364
  return Object.keys(this._dynamicChildren);
381
365
  }
382
- ;
383
366
  /**
384
367
  * Get the scope to which this property belongs to.
385
368
  * @return {string|undefined} The guid representing the scope in which the
@@ -396,7 +379,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
396
379
  return this._scope;
397
380
  }
398
381
  }
399
- ;
400
382
  /**
401
383
  * Deletes all values from the Map
402
384
  */
@@ -406,7 +388,6 @@ export class MapProperty extends IndexedCollectionBaseProperty {
406
388
  that.remove(id);
407
389
  });
408
390
  }
409
- ;
410
391
  }
411
392
  MapProperty.prototype._typeid = 'BaseProperty';
412
393
  MapProperty.prototype._context = 'map';
@@ -1 +1 @@
1
- {"version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CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC;AAC/C,WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the map property class\n */\nconst _ = require('lodash');\nconst { BaseProperty } = require('./baseProperty');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');\n\nconst PATH_TOKENS = BaseProperty.PATH_TOKENS;\n\n/**\n * typedef {property-properties.BaseProperty|string|number|boolean} property-properties.MapProperty~MapValueType\n *\n * The type of the values that are set/inserted into the map. Depending on the type of the map, these can either\n * be property objects or primitive values\n */\n\n/**\n * A MapProperty is a collection class that can contain an dictionary that maps from strings to properties.\n */\nexport class MapProperty extends IndexedCollectionBaseProperty {\n\n /**\n * @param {Object} in_params - Input parameters for property creation\n * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n * @constructor\n * @protected\n * @extends property-properties.IndexedCollectionBaseProperty\n * @alias property-properties.MapProperty\n * @category Maps\n */\n constructor(in_params, in_scope) {\n super(in_params);\n\n this._scope = in_scope;\n this._contextKeyType = in_params.contextKeyType || 'string';\n\n /** Contains the actual entries of the map */\n this._dynamicChildren = {};\n };\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection = false) {\n if (in_hideCollection) {\n return this._typeid;\n } else {\n return TypeIdHelper.createSerializationTypeId(this._typeid, 'map');\n }\n };\n\n /**\n * Is this property a leaf node with regard to flattening?\n *\n * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n *\n * @return {boolean} Is it a leaf with regard to flattening?\n */\n _isFlattenLeaf() {\n return true;\n };\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @param {Boolean} in_typed - If the map's items have a typeid and a value then create the\n * properties with that typeid, else use the set's typeid (support polymorphic items).\n * @see {setValues}\n * @private\n */\n _setValuesInternal(in_values, in_typed) {\n if (this._containsPrimitiveTypes) {\n var that = this;\n _.each(in_values, function (value, key) {\n if (that.has(key)) {\n that.remove(key);\n }\n\n that.insert(key, value);\n });\n } else {\n var that = this;\n _.each(in_values, function (value, key) {\n var property = that.get(String(key), { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });\n // if key exists in set replace its value else insert a new key/value\n if (property) {\n if (property instanceof Property.ValueProperty || property instanceof Property.StringProperty) {\n property.setValue(value);\n } else if (property instanceof BaseProperty && _.isObject(value)) {\n property._setValues(value, false, false);\n } else {\n throw new Error(MSG.SET_VALUES_PATH_INVALID + key);\n }\n } else {\n if (value instanceof BaseProperty) {\n that.insert(key, value);\n } else {\n if (in_typed) {\n that.insert(key, Property.PropertyFactory._createProperty(\n value.typeid || that._typeid, null, value.value, that._getScope()));\n } else {\n that.insert(key, Property.PropertyFactory._createProperty(\n that._typeid, null, value, that._getScope()));\n }\n }\n }\n });\n }\n };\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @param {Bool} in_typed - Whether the values are typed/polymorphic.\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n * @see {setValues}\n * @override\n */\n _setValues(in_values, in_typed, in_initial) {\n if (in_initial) {\n this.clear();\n }\n\n this._setValuesInternal(in_values, in_typed);\n };\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @throws if one of the path in in_values does not exist in this property\n * @throws if trying to set a value to a path that leads to a Property other than ValueProperty or StringProperty\n * @override\n */\n setValues(in_values) {\n var checkoutView = this._getCheckoutView();\n if (checkoutView !== undefined) {\n checkoutView.pushNotificationDelayScope();\n this._setValues(in_values, false, false);\n checkoutView.popNotificationDelayScope();\n } else {\n this._setValues(in_values, false, false);\n }\n };\n\n /**\n * Returns an object with all the nested values contained in this property\n * @return {object} an object representing the values of your property\n * for example: {\n 'firstString': {\n 'stringValue': 'test1'\n },\n 'secondString': {\n 'stringValue': 'test2'\n }\n }\n */\n getValues() {\n var ids = this.getIds();\n var result = {};\n for (var i = 0; i < ids.length; i++) {\n var child = this.get(ids[i]);\n if (child.isPrimitiveType()) {\n result[ids[i]] = this.get(ids[i]).getValue();\n } else {\n result[ids[i]] = child.getValues();\n }\n }\n return result;\n };\n\n /**\n * Returns the path segment for a child\n *\n * @param {property-properties.BaseProperty} in_childNode - The child for which the path is returned\n *\n * @return {string} The path segment to resolve the child property under this property\n * @protected\n */\n _getPathSegmentForChildNode(in_childNode) {\n return '[' + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + ']';\n };\n\n /**\n * Resolves a direct child node based on the given path segment\n *\n * @param {String} in_segment - The path segment to resolve\n * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n *\n * @return {property-properties.BaseProperty|undefined} The child property that has been resolved\n * @protected\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n // Base Properties only support paths separated via dots\n if (in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN) {\n return this._dynamicChildren[in_segment];\n } else {\n return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\n };\n\n /**\n * Inserts a property or value into the map\n *\n * Note: This will trigger an exception when this key already exists in the map. If you want to overwrite\n * existing entries you can use the set function.\n *\n * @param {string} in_key - The key under which the entry is added\n * @param {property-properties.Property} in_property - The property to insert\n * @throws if the property already exists\n * @throws if the property already has a parent\n * @throws if in_key is not a string\n * @throws if the property is a root property\n */\n insert(in_key, in_property) {\n ConsoleUtils.assert(_.isString(in_key), MSG.KEY_NOT_STRING + in_key);\n if (this._dynamicChildren[in_key] !== undefined) {\n throw new Error(MSG.PROPERTY_ALREADY_EXISTS + in_key);\n }\n if (in_property instanceof BaseProperty) {\n in_property._validateInsertIn(this);\n // Set the ID of the entry, to make sure it corresponds to the used key\n in_property._setId(in_key);\n\n // Insert the entry into the collection\n this._insert(in_key, in_property, true);\n\n } else {\n throw new Error(MSG.NONVALUE_MAP_INSERT_PROP);\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 * @return {*} the item removed\n */\n remove(in_key) {\n var item = this.get(in_key);\n this._removeByKey(in_key, true);\n return item;\n };\n\n /**\n * Sets the entry with the given key to the property passed in\n *\n * Note: this will overwrite an already existing value\n *\n * @param {string} in_key - The key under which the entry is stored\n * @param {property-properties.MapProperty~MapValueType} in_property - The property to store in the map\n * @throws if in_property is not a property\n * @throws if trying to insert a property that has a parent\n * @throws if in_key is not a string or a number\n */\n set(in_key, in_property) {\n this._checkIsNotReadOnly(true);\n if (this._dynamicChildren[in_key] !== in_property) {\n if (this._containsPrimitiveTypes === false && in_property.getParent() !== undefined) {\n throw new Error(MSG.INSERTED_ENTRY_WITH_PARENT);\n }\n if (this._dynamicChildren[in_key] !== undefined) {\n this._removeByKey(in_key, false);\n }\n // Set the ID of the entry, to make sure it corresponds to the used key\n if (this._containsPrimitiveTypes === false) {\n in_property._setId(in_key);\n }\n this._insert(in_key, in_property, false);\n\n // Make one final report\n this._reportDirtinessToView();\n }\n };\n\n /**\n * Returns an Object with all the entries of the map.\n * Contrary ot .getValues, for Property Maps, this will return the Property, not an object with their nested values.\n * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified. It is\n * read only for fast access and iteration. Insertion and deletion MUST be done via the insert and remove functions\n * of this class.\n *\n * @return {Object} The map with all entries in the map.\n */\n getEntriesReadOnly() {\n return this._dynamicChildren;\n };\n\n /**\n * Returns the collection entry with the given key\n *\n * @param {string|array<string>} in_ids - key of the entry to return or an array of keys\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]\n * How should this function behave during reference resolution?\n *\n * @return {property-properties.Property|*|undefined} The entry in the collection or undefined\n * if none could be found\n */\n get(in_ids, in_options) {\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 in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n\n var prop = this;\n if (in_ids === PATH_TOKENS.ROOT) {\n prop = prop.getRoot();\n } else if (in_ids === PATH_TOKENS.UP) {\n prop = prop.getParent();\n } else if (in_ids === PATH_TOKENS.REF) {\n throw new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n } else {\n prop = prop._dynamicChildren[in_ids];\n }\n\n // Handle automatic reference resolution\n if (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n if (prop instanceof Property.ReferenceProperty) {\n prop = prop.ref;\n }\n }\n\n return prop;\n }\n };\n\n /**\n * Checks whether an entry with the given name exists\n *\n * @param {string} in_id - Name of the property\n * @return {boolean} True if the property exists, otherwise false.\n */\n has(in_id) {\n return this._dynamicChildren[in_id] !== undefined;\n };\n\n /**\n * Returns all entries of the map as an array.\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<property-properties.BaseProperty | *>} Array with all entries of the map. This array\n * is a shallow copy which can be modified by the caller without effects on the map.\n */\n getAsArray() {\n return _.values(this._dynamicChildren);\n };\n\n /**\n * Returns all keys found in the map\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<string>} The keys\n */\n getIds() {\n return Object.keys(this._dynamicChildren);\n };\n\n /**\n * Get the scope to which this property belongs to.\n * @return {string|undefined} The guid representing the scope in which the\n * map belongs to. If there is a workspace scope return it, else return the scope of this map.\n * @override\n * @private\n */\n _getScope() {\n var scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n if (scope !== undefined) {\n return scope;\n } else {\n return this._scope;\n }\n };\n\n /**\n * Deletes all values from the Map\n */\n clear() {\n var that = this;\n this.getIds().forEach(function (id) {\n that.remove(id);\n });\n };\n\n}\n\nMapProperty.prototype._typeid = 'BaseProperty';\nMapProperty.prototype._context = 'map';\n"]}
1
+ {"version":3,"file":"mapProperty.js","sourceRoot":"","sources":["../../src/properties/mapProperty.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;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,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,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,6BAA6B,EAAE,GAAG,OAAO,CAAC,iCAAiC,CAAC,CAAC;AACrF,MAAM,EAAE,oBAAoB,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AAE7E,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,CAAC;AAE7C;;;;;GAKG;AAEH;;GAEG;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,CAAC;IAED;;OAEG;IACH,KAAK;QACD,IAAI,IAAI,GAAG,IAAI,CAAC;QAChB,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,UAAS,EAAE;YAC7B,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACpB,CAAC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC;AAC/C,WAAW,CAAC,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the map property class\n */\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst _ = require('lodash');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { BaseProperty } = require('./baseProperty');\nconst { IndexedCollectionBaseProperty } = require('./indexedCollectionBaseProperty');\nconst { LazyLoadedProperties: Property } = require('./lazyLoadedProperties');\n\nconst PATH_TOKENS = BaseProperty.PATH_TOKENS;\n\n/**\n * typedef {property-properties.BaseProperty|string|number|boolean} property-properties.MapProperty~MapValueType\n *\n * The type of the values that are set/inserted into the map. Depending on the type of the map, these can either\n * be property objects or primitive values\n */\n\n/**\n * A MapProperty is a collection class that can contain an dictionary that maps from strings to properties.\n */\nexport class MapProperty extends IndexedCollectionBaseProperty {\n /**\n * @param {Object} in_params - Input parameters for property creation\n * @param {string|undefined} in_scope - The scope in which the map typeid is defined\n * @constructor\n * @protected\n * @extends property-properties.IndexedCollectionBaseProperty\n * @alias property-properties.MapProperty\n * @category Maps\n */\n constructor(in_params, in_scope) {\n super(in_params);\n\n this._scope = in_scope;\n this._contextKeyType = in_params.contextKeyType || 'string';\n\n /** Contains the actual entries of the map */\n this._dynamicChildren = {};\n }\n\n /**\n * Returns the full property type identifier for the ChangeSet including the enum type id\n * @param {boolean} [in_hideCollection=false] - if true the collection type (if applicable) will be omitted\n * @return {string} The typeid\n */\n getFullTypeid(in_hideCollection = false) {\n if (in_hideCollection) {\n return this._typeid;\n } else {\n return TypeIdHelper.createSerializationTypeId(this._typeid, 'map');\n }\n }\n\n /**\n * Is this property a leaf node with regard to flattening?\n *\n * TODO: Which semantics should flattening have? It stops at primitive types and collections?\n *\n * @return {boolean} Is it a leaf with regard to flattening?\n */\n _isFlattenLeaf() {\n return true;\n }\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @param {Boolean} in_typed - If the map's items have a typeid and a value then create the\n * properties with that typeid, else use the set's typeid (support polymorphic items).\n * @see {setValues}\n * @private\n */\n _setValuesInternal(in_values, in_typed) {\n if (this._containsPrimitiveTypes) {\n var that = this;\n _.each(in_values, function(value, key) {\n if (that.has(key)) {\n that.remove(key);\n }\n\n that.insert(key, value);\n });\n } else {\n var that = this;\n _.each(in_values, function(value, key) {\n var property = that.get(String(key), { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });\n // if key exists in set replace its value else insert a new key/value\n if (property) {\n if (property instanceof Property.ValueProperty || property instanceof Property.StringProperty) {\n property.setValue(value);\n } else if (property instanceof BaseProperty && _.isObject(value)) {\n property._setValues(value, false, false);\n } else {\n throw new Error(MSG.SET_VALUES_PATH_INVALID + key);\n }\n } else {\n if (value instanceof BaseProperty) {\n that.insert(key, value);\n } else {\n if (in_typed) {\n that.insert(key, Property.PropertyFactory._createProperty(\n value.typeid || that._typeid, null, value.value, that._getScope()));\n } else {\n that.insert(key, Property.PropertyFactory._createProperty(\n that._typeid, null, value, that._getScope()));\n }\n }\n }\n });\n }\n }\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @param {Bool} in_typed - Whether the values are typed/polymorphic.\n * @param {Bool} in_initial - Whether we are setting default/initial values\n * or if the function is called directly with the values to set.\n * @see {setValues}\n * @override\n */\n _setValues(in_values, in_typed, in_initial) {\n if (in_initial) {\n this.clear();\n }\n\n this._setValuesInternal(in_values, in_typed);\n }\n\n /**\n * Sets multiple values in a map.\n *\n * @param {object} in_values to assign to the collection\n * @throws if one of the path in in_values does not exist in this property\n * @throws if trying to set a value to a path that leads to a Property other than ValueProperty or StringProperty\n * @override\n */\n setValues(in_values) {\n var checkoutView = this._getCheckoutView();\n if (checkoutView !== undefined) {\n checkoutView.pushNotificationDelayScope();\n this._setValues(in_values, false, false);\n checkoutView.popNotificationDelayScope();\n } else {\n this._setValues(in_values, false, false);\n }\n }\n\n /**\n * Returns an object with all the nested values contained in this property\n * @return {object} an object representing the values of your property\n * for example: {\n 'firstString': {\n 'stringValue': 'test1'\n },\n 'secondString': {\n 'stringValue': 'test2'\n }\n }\n */\n getValues() {\n var ids = this.getIds();\n var result = {};\n for (var i = 0; i < ids.length; i++) {\n var child = this.get(ids[i]);\n if (child.isPrimitiveType()) {\n result[ids[i]] = this.get(ids[i]).getValue();\n } else {\n result[ids[i]] = child.getValues();\n }\n }\n return result;\n }\n\n /**\n * Returns the path segment for a child\n *\n * @param {property-properties.BaseProperty} in_childNode - The child for which the path is returned\n *\n * @return {string} The path segment to resolve the child property under this property\n * @protected\n */\n _getPathSegmentForChildNode(in_childNode) {\n return '[' + PathHelper.quotePathSegmentIfNeeded(in_childNode._id) + ']';\n }\n\n /**\n * Resolves a direct child node based on the given path segment\n *\n * @param {String} in_segment - The path segment to resolve\n * @param {property-properties.PathHelper.TOKEN_TYPES} in_segmentType - The type of segment in the tokenized path\n *\n * @return {property-properties.BaseProperty|undefined} The child property that has been resolved\n * @protected\n */\n _resolvePathSegment(in_segment, in_segmentType) {\n // Base Properties only support paths separated via dots\n if (in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN) {\n return this._dynamicChildren[in_segment];\n } else {\n return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\n }\n\n /**\n * Inserts a property or value into the map\n *\n * Note: This will trigger an exception when this key already exists in the map. If you want to overwrite\n * existing entries you can use the set function.\n *\n * @param {string} in_key - The key under which the entry is added\n * @param {property-properties.Property} in_property - The property to insert\n * @throws if the property already exists\n * @throws if the property already has a parent\n * @throws if in_key is not a string\n * @throws if the property is a root property\n */\n insert(in_key, in_property) {\n ConsoleUtils.assert(_.isString(in_key), MSG.KEY_NOT_STRING + in_key);\n if (this._dynamicChildren[in_key] !== undefined) {\n throw new Error(MSG.PROPERTY_ALREADY_EXISTS + in_key);\n }\n if (in_property instanceof BaseProperty) {\n in_property._validateInsertIn(this);\n // Set the ID of the entry, to make sure it corresponds to the used key\n in_property._setId(in_key);\n\n // Insert the entry into the collection\n this._insert(in_key, in_property, true);\n } else {\n throw new Error(MSG.NONVALUE_MAP_INSERT_PROP);\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 * @return {*} the item removed\n */\n remove(in_key) {\n var item = this.get(in_key);\n this._removeByKey(in_key, true);\n return item;\n }\n\n /**\n * Sets the entry with the given key to the property passed in\n *\n * Note: this will overwrite an already existing value\n *\n * @param {string} in_key - The key under which the entry is stored\n * @param {property-properties.MapProperty~MapValueType} in_property - The property to store in the map\n * @throws if in_property is not a property\n * @throws if trying to insert a property that has a parent\n * @throws if in_key is not a string or a number\n */\n set(in_key, in_property) {\n this._checkIsNotReadOnly(true);\n if (this._dynamicChildren[in_key] !== in_property) {\n if (this._containsPrimitiveTypes === false && in_property.getParent() !== undefined) {\n throw new Error(MSG.INSERTED_ENTRY_WITH_PARENT);\n }\n if (this._dynamicChildren[in_key] !== undefined) {\n this._removeByKey(in_key, false);\n }\n // Set the ID of the entry, to make sure it corresponds to the used key\n if (this._containsPrimitiveTypes === false) {\n in_property._setId(in_key);\n }\n this._insert(in_key, in_property, false);\n\n // Make one final report\n this._reportDirtinessToView();\n }\n }\n\n /**\n * Returns an Object with all the entries of the map.\n * Contrary ot .getValues, for Property Maps, this will return the Property, not an object with their nested values.\n * WARNING: This is a direct access to the internal data-structure and the collection MUST NOT be modified. It is\n * read only for fast access and iteration. Insertion and deletion MUST be done via the insert and remove functions\n * of this class.\n *\n * @return {Object} The map with all entries in the map.\n */\n getEntriesReadOnly() {\n return this._dynamicChildren;\n }\n\n /**\n * Returns the collection entry with the given key\n *\n * @param {string|array<string>} in_ids - key of the entry to return or an array of keys\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]\n * How should this function behave during reference resolution?\n *\n * @return {property-properties.Property|*|undefined} The entry in the collection or undefined\n * if none could be found\n */\n get(in_ids, in_options) {\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 in_options = in_options || {};\n in_options.referenceResolutionMode =\n in_options.referenceResolutionMode === undefined ? BaseProperty.REFERENCE_RESOLUTION.ALWAYS :\n in_options.referenceResolutionMode;\n\n var prop = this;\n if (in_ids === PATH_TOKENS.ROOT) {\n prop = prop.getRoot();\n } else if (in_ids === PATH_TOKENS.UP) {\n prop = prop.getParent();\n } else if (in_ids === PATH_TOKENS.REF) {\n throw new Error(MSG.NO_GET_DEREFERENCE_ONLY);\n } else {\n prop = prop._dynamicChildren[in_ids];\n }\n\n // Handle automatic reference resolution\n if (in_options.referenceResolutionMode === BaseProperty.REFERENCE_RESOLUTION.ALWAYS) {\n if (prop instanceof Property.ReferenceProperty) {\n prop = prop.ref;\n }\n }\n\n return prop;\n }\n }\n\n /**\n * Checks whether an entry with the given name exists\n *\n * @param {string} in_id - Name of the property\n * @return {boolean} True if the property exists, otherwise false.\n */\n has(in_id) {\n return this._dynamicChildren[in_id] !== undefined;\n }\n\n /**\n * Returns all entries of the map as an array.\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<property-properties.BaseProperty | *>} Array with all entries of the map. This array\n * is a shallow copy which can be modified by the caller without effects on the map.\n */\n getAsArray() {\n return _.values(this._dynamicChildren);\n }\n\n /**\n * Returns all keys found in the map\n *\n * NOTE: This function creates a copy and thus is less efficient as getEntriesReadOnly.\n *\n * @return {Array.<string>} The keys\n */\n getIds() {\n return Object.keys(this._dynamicChildren);\n }\n\n /**\n * Get the scope to which this property belongs to.\n * @return {string|undefined} The guid representing the scope in which the\n * map belongs to. If there is a workspace scope return it, else return the scope of this map.\n * @override\n * @private\n */\n _getScope() {\n var scope = IndexedCollectionBaseProperty.prototype._getScope.call(this);\n\n if (scope !== undefined) {\n return scope;\n } else {\n return this._scope;\n }\n }\n\n /**\n * Deletes all values from the Map\n */\n clear() {\n var that = this;\n this.getIds().forEach(function(id) {\n that.remove(id);\n });\n }\n}\n\nMapProperty.prototype._typeid = 'BaseProperty';\nMapProperty.prototype._context = 'map';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"namedNodeProperty.js","sourceRoot":"","sources":["../../src/properties/namedNodeProperty.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAE/C;;;;;;;;;;OAUG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;QAGrB;;;;;;WAMG;QACH,UAAK,GAAG,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC;QAEtC;;;;;;WAMG;QACH,YAAO,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC;QAE1C;;;WAGG;QACH,WAAM,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;IAxBxC,CAAC;CA0BJ;AAED,iBAAiB,CAAC,SAAS,CAAC,OAAO,GAAG,mBAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the named node property class\n */\n\nconst { NamedProperty } = require('./namedProperty');\nconst { NodeProperty } = require('./nodeProperty');\n\n/**\n * A NamedNodeProperty is a NodeProperty that has a GUID which unique identifies the property object.\n * This makes it possible to store it in a set collection.\n */\nexport class NamedNodeProperty extends NodeProperty {\n\n /**\n * @param {object} in_params - List of parameters\n * @param {string} in_params.id - id of the property (null, if the GUID should be used for the ID)\n * @param {string} in_params.typeid - The type identifier\n *\n * @constructor\n * @protected\n * @extends property-properties.NodeProperty\n * @alias property-properties.NamedNodeProperty\n * @category Other Collections\n */\n constructor(in_params) {\n super(in_params);\n }\n\n /**\n * Returns a string identifying the property\n *\n * If an id has been explicitly set on this property we return that one, otherwise the GUID is used.\n *\n * @return {string} String identifying the property\n */\n getId = NamedProperty.prototype.getId;\n\n /**\n * Returns the GUID of this named property\n * A Guid is a unique identifier for a branch, commit or repository,\n * similar to a URN. Most functions in the API will us a URN but the\n * Guid is used to traverse the commit graph.\n * @return {string} The GUID\n */\n getGuid = NamedProperty.prototype.getGuid;\n\n /**\n * Return the URN for this named property\n * @return {string} The URN\n */\n getUrn = NamedProperty.prototype.getUrn;\n\n}\n\nNamedNodeProperty.prototype._typeid = 'NamedNodeProperty';\n"]}
1
+ {"version":3,"file":"namedNodeProperty.js","sourceRoot":"","sources":["../../src/properties/namedNodeProperty.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AAEH,MAAM,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACrD,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAC/C;;;;;;;;;;OAUG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;QAGrB;;;;;;WAMG;QACH,UAAK,GAAG,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC;QAEtC;;;;;;WAMG;QACH,YAAO,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC;QAE1C;;;WAGG;QACH,WAAM,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC;IAxBxC,CAAC;CAyBJ;AAED,iBAAiB,CAAC,SAAS,CAAC,OAAO,GAAG,mBAAmB,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview Definition of the named node property class\n */\n\nconst { NamedProperty } = require('./namedProperty');\nconst { NodeProperty } = require('./nodeProperty');\n\n/**\n * A NamedNodeProperty is a NodeProperty that has a GUID which unique identifies the property object.\n * This makes it possible to store it in a set collection.\n */\nexport class NamedNodeProperty extends NodeProperty {\n /**\n * @param {object} in_params - List of parameters\n * @param {string} in_params.id - id of the property (null, if the GUID should be used for the ID)\n * @param {string} in_params.typeid - The type identifier\n *\n * @constructor\n * @protected\n * @extends property-properties.NodeProperty\n * @alias property-properties.NamedNodeProperty\n * @category Other Collections\n */\n constructor(in_params) {\n super(in_params);\n }\n\n /**\n * Returns a string identifying the property\n *\n * If an id has been explicitly set on this property we return that one, otherwise the GUID is used.\n *\n * @return {string} String identifying the property\n */\n getId = NamedProperty.prototype.getId;\n\n /**\n * Returns the GUID of this named property\n * A Guid is a unique identifier for a branch, commit or repository,\n * similar to a URN. Most functions in the API will us a URN but the\n * Guid is used to traverse the commit graph.\n * @return {string} The GUID\n */\n getGuid = NamedProperty.prototype.getGuid;\n\n /**\n * Return the URN for this named property\n * @return {string} The URN\n */\n getUrn = NamedProperty.prototype.getUrn;\n}\n\nNamedNodeProperty.prototype._typeid = 'NamedNodeProperty';\n"]}
@@ -26,7 +26,6 @@ export class NamedProperty extends ContainerProperty {
26
26
  constructor(in_params) {
27
27
  super(in_params);
28
28
  }
29
- ;
30
29
  /**
31
30
  * Returns a string identifying the property
32
31
  *
@@ -42,7 +41,6 @@ export class NamedProperty extends ContainerProperty {
42
41
  return this.getGuid();
43
42
  }
44
43
  }
45
- ;
46
44
  /**
47
45
  * Returns the GUID of this named property
48
46
  * A Guid is a unique identifier for a branch, commit or repository,
@@ -54,7 +52,6 @@ export class NamedProperty extends ContainerProperty {
54
52
  var guid = this.get('guid', { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });
55
53
  return guid ? guid.getValue() : '';
56
54
  }
57
- ;
58
55
  }
59
56
  NamedProperty.prototype._typeid = 'NamedProperty';
60
57
  //# sourceMappingURL=namedProperty.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"namedProperty.js","sourceRoot":"","sources":["../../src/properties/namedProperty.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAEH,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAEhD;;;;;;;;;;OAUG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;IAAA,CAAC;IAEF;;;;;;OAMG;IACH,KAAK;QACD,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE;YACnB,OAAO,IAAI,CAAC,GAAG,CAAC;SACnB;aAAM;YACH,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;SACzB;IACL,CAAC;IAAA,CAAC;IAEF;;;;;;OAMG;IACH,OAAO;QACH,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,uBAAuB,EAAE,YAAY,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC,CAAC;QAClG,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,CAAC;IAAA,CAAC;CAYL;AACD,aAAa,CAAC,SAAS,CAAC,OAAO,GAAG,eAAe,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 named property class\n */\n\nconst { ContainerProperty } = require('./containerProperty');\nconst { BaseProperty } = require('./baseProperty');\n\n/**\n * A NamedProperty has a URN which uniquely identifies the property object. This makes it possible to store it in a\n * set collection.\n */\nexport class NamedProperty extends ContainerProperty {\n\n /**\n * @param {object} in_params - List of parameters\n * @param {string} in_params.id - id of the property (null, if the GUID should be used for the ID)\n * @param {string} in_params.typeid - The type identifier\n *\n * @constructor\n * @protected\n * @extends property-properties.ContainerProperty\n * @alias property-properties.NamedProperty\n * @category Properties\n */\n constructor(in_params) {\n super(in_params);\n };\n\n /**\n * Returns a string identifying the property\n *\n * If an id has been explicitly set on this property we return that one, otherwise the GUID is used.\n *\n * @return {string} String identifying the property\n */\n getId() {\n if (this._id !== null) {\n return this._id;\n } else {\n return this.getGuid();\n }\n };\n\n /**\n * Returns the GUID of this named property\n * A Guid is a unique identifier for a branch, commit or repository,\n * similar to a URN. Most functions in the API will us a URN but the\n * Guid is used to traverse the commit graph.\n * @return {string} The GUID\n */\n getGuid() {\n var guid = this.get('guid', { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });\n return guid ? guid.getValue() : '';\n };\n\n\n // THIS IS DISABLED FOR THE MOMENT, UNTIL WE BETTER UNDERSTAND HOW REFERENCES WORK IN FLUID\n /**\n * Return the URN for this named property\n * @return {string} The URN\n */\n /*NamedProperty.prototype.getUrn = function() {\n\n };*/\n\n}\nNamedProperty.prototype._typeid = 'NamedProperty';\n"]}
1
+ {"version":3,"file":"namedProperty.js","sourceRoot":"","sources":["../../src/properties/namedProperty.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AAEH,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAC7D,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAEnD;;;GAGG;AACH,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAChD;;;;;;;;;;OAUG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;IAED;;;;;;OAMG;IACH,KAAK;QACD,IAAI,IAAI,CAAC,GAAG,KAAK,IAAI,EAAE;YACnB,OAAO,IAAI,CAAC,GAAG,CAAC;SACnB;aAAM;YACH,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;SACzB;IACL,CAAC;IAED;;;;;;OAMG;IACH,OAAO;QACH,IAAI,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,uBAAuB,EAAE,YAAY,CAAC,oBAAoB,CAAC,KAAK,EAAE,CAAC,CAAC;QAClG,OAAO,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACvC,CAAC;CAUJ;AACD,aAAa,CAAC,SAAS,CAAC,OAAO,GAAG,eAAe,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 named property class\n */\n\nconst { ContainerProperty } = require('./containerProperty');\nconst { BaseProperty } = require('./baseProperty');\n\n/**\n * A NamedProperty has a URN which uniquely identifies the property object. This makes it possible to store it in a\n * set collection.\n */\nexport class NamedProperty extends ContainerProperty {\n /**\n * @param {object} in_params - List of parameters\n * @param {string} in_params.id - id of the property (null, if the GUID should be used for the ID)\n * @param {string} in_params.typeid - The type identifier\n *\n * @constructor\n * @protected\n * @extends property-properties.ContainerProperty\n * @alias property-properties.NamedProperty\n * @category Properties\n */\n constructor(in_params) {\n super(in_params);\n }\n\n /**\n * Returns a string identifying the property\n *\n * If an id has been explicitly set on this property we return that one, otherwise the GUID is used.\n *\n * @return {string} String identifying the property\n */\n getId() {\n if (this._id !== null) {\n return this._id;\n } else {\n return this.getGuid();\n }\n }\n\n /**\n * Returns the GUID of this named property\n * A Guid is a unique identifier for a branch, commit or repository,\n * similar to a URN. Most functions in the API will us a URN but the\n * Guid is used to traverse the commit graph.\n * @return {string} The GUID\n */\n getGuid() {\n var guid = this.get('guid', { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });\n return guid ? guid.getValue() : '';\n }\n\n // THIS IS DISABLED FOR THE MOMENT, UNTIL WE BETTER UNDERSTAND HOW REFERENCES WORK IN FLUID\n /**\n * Return the URN for this named property\n * @return {string} The URN\n */\n /* NamedProperty.prototype.getUrn = function() {\n\n }; */\n}\nNamedProperty.prototype._typeid = 'NamedProperty';\n"]}
@@ -23,17 +23,14 @@ export class NodeProperty extends ContainerProperty {
23
23
  super(in_params);
24
24
  this._dynamicChildren = {};
25
25
  }
26
- ;
27
26
  /**
28
27
  * @inheritdoc
29
28
  */
30
29
  isDynamic() { return true; }
31
- ;
32
30
  /**
33
31
  * @inheritdoc
34
32
  */
35
33
  _validateInsert(in_id, in_property) { }
36
- ;
37
34
  }
38
35
  NodeProperty.prototype._typeid = 'NodeProperty';
39
36
  //# sourceMappingURL=nodeProperty.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nodeProperty.js","sourceRoot":"","sources":["../../src/properties/nodeProperty.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,iBAAiB;IAE/C;;;;;;;;OAQG;IACH,YAAY,SAAS;QACjB,KAAK,CAAE,SAAS,CAAE,CAAC;QACnB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAC/B,CAAC;IAAA,CAAC;IAEF;;OAEG;IACH,SAAS,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAAA,CAAC;IAE7B;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,WAAW,IAAI,CAAC;IAAA,CAAC;CAE3C;AACD,YAAY,CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview This file contains the implementation of the NodeProperty class\n */\nconst { ContainerProperty } = require('./containerProperty');\n\n/**\n * A property object that allows to add child properties dynamically.\n */\nexport class NodeProperty extends ContainerProperty {\n\n /**\n * @param {Object} in_params - Input parameters for property creation\n *\n * @constructor\n * @protected\n * @extends property-properties.ContainerProperty\n * @alias property-properties.NodeProperty\n * @category Other Collections\n */\n constructor(in_params) {\n super( in_params );\n this._dynamicChildren = {};\n };\n\n /**\n * @inheritdoc\n */\n isDynamic() { return true; };\n\n /**\n * @inheritdoc\n */\n _validateInsert(in_id, in_property) { };\n\n}\nNodeProperty.prototype._typeid = 'NodeProperty';\n"]}
1
+ {"version":3,"file":"nodeProperty.js","sourceRoot":"","sources":["../../src/properties/nodeProperty.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,iBAAiB;IAC/C;;;;;;;;OAQG;IACH,YAAY,SAAS;QACjB,KAAK,CAAC,SAAS,CAAC,CAAC;QACjB,IAAI,CAAC,gBAAgB,GAAG,EAAE,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,SAAS,KAAK,OAAO,IAAI,CAAC,CAAC,CAAC;IAE5B;;OAEG;IACH,eAAe,CAAC,KAAK,EAAE,WAAW,IAAI,CAAC;CAC1C;AACD,YAAY,CAAC,SAAS,CAAC,OAAO,GAAG,cAAc,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview This file contains the implementation of the NodeProperty class\n */\nconst { ContainerProperty } = require('./containerProperty');\n\n/**\n * A property object that allows to add child properties dynamically.\n */\nexport class NodeProperty extends ContainerProperty {\n /**\n * @param {Object} in_params - Input parameters for property creation\n *\n * @constructor\n * @protected\n * @extends property-properties.ContainerProperty\n * @alias property-properties.NodeProperty\n * @category Other Collections\n */\n constructor(in_params) {\n super(in_params);\n this._dynamicChildren = {};\n }\n\n /**\n * @inheritdoc\n */\n isDynamic() { return true; }\n\n /**\n * @inheritdoc\n */\n _validateInsert(in_id, in_property) { }\n}\nNodeProperty.prototype._typeid = 'NodeProperty';\n"]}
@@ -16,7 +16,7 @@ var castArrays = {
16
16
  Int16: new Int16Array(1),
17
17
  Int8: new Int8Array(1),
18
18
  Float32: new Float32Array(1),
19
- Float64: new Float64Array(1)
19
+ Float64: new Float64Array(1),
20
20
  };
21
21
  /**
22
22
  * Performs a cast of a value by assigning it into the given data array and returning the resulting value. The
@@ -150,7 +150,7 @@ const _castFunctors = {
150
150
  */
151
151
  Boolean: function (in_value) {
152
152
  return !!in_value;
153
- }
153
+ },
154
154
  };
155
155
  export { _castFunctors };
156
156
  //# sourceMappingURL=primitiveTypeCasts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"primitiveTypeCasts.js","sourceRoot":"","sources":["../../src/properties/primitiveTypeCasts.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,KAAK,EAAE,M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KG;IACH,MAAM,EAAE,UAAU,QAAQ;QACtB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD;;;;;OAKG;IACH,OAAO,EAAE,UAAU,QAAQ;QACvB,OAAO,CAAC,CAAC,QAAQ,CAAC;IACtB,CAAC;CACJ,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to cast a JavaScript type to a value that is compatible with a given primitive type\n */\nconst _ = require('lodash');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { Int64, Uint64 } = require('@fluid-experimental/property-common');\n\nvar castArrays = {\n Uint32: new Uint32Array(1),\n Uint16: new Uint16Array(1),\n Uint8: new Uint8Array(1),\n Int32: new Int32Array(1),\n Int16: new Int16Array(1),\n Int8: new Int8Array(1),\n Float32: new Float32Array(1),\n Float64: new Float64Array(1)\n};\n\n/**\n * Performs a cast of a value by assigning it into the given data array and returning the resulting value. The\n * result is a native JavaScript datatype, that is compatible with the supplied typed array.\n *\n * @param {TypedArray} in_array - The data array to use for the cast\n * @param {number|string|boolean} in_value - The value to use in the cast\n * @return {number|string|boolean} The casted value\n * @private\n */\nvar _simpleCastFunctor = function (in_array, in_value) {\n in_array[0] = in_value;\n return in_array[0];\n};\n\n\n/**\n * Helper functions to cast the input value to the given type\n * @protected\n * @alias property-properties._castFunctors\n */\nconst _castFunctors = {\n /**\n * Casts the input value to a Uint64\n * @param {number} in_value - The value to use in the cast\n * @param {number} [in_radix = 10] An integer between 2 and 36 that represents the\n * radix (the base in mathematical numeral systems) of the above in_value if it is a string.\n * @return {number} The casted value\n * @protected\n */\n Uint64: function (in_value, in_radix) {\n if (in_value instanceof Uint64) {\n return in_value;\n }\n if (typeof in_value === 'string') {\n return Uint64.fromString(in_value, in_radix);\n }\n if (typeof in_value === 'number') {\n return Uint64.fromString(String(in_value), in_radix);\n }\n throw new Error(MSG.INT_64_NON_INT64_TYPE + ' , value: ' + in_value);\n },\n /**\n * Casts the input value to a Uint32\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Uint32: _simpleCastFunctor.bind(undefined, castArrays.Uint32),\n /**\n * Casts the input value to a Uint16\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Uint16: _simpleCastFunctor.bind(undefined, castArrays.Uint16),\n /**\n * Casts the input value to a Uint8\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Uint8: _simpleCastFunctor.bind(undefined, castArrays.Uint8),\n /**\n * Casts the input value to a Int64\n * @param {number} in_value - The value to use in the cast\n * @param {number} [in_radix = 10] An integer between 2 and 36 that represents the\n * radix (the base in mathematical numeral systems) of the above in_value if it is a string.\n * @return {number} The casted value\n * @protected\n */\n Int64: function (in_value, in_radix) {\n if (in_value instanceof Int64) {\n return in_value;\n }\n if (typeof in_value === 'string') {\n return Int64.fromString(in_value, in_radix);\n }\n if (typeof in_value === 'number') {\n return Int64.fromString(String(in_value), in_radix);\n }\n throw new Error(MSG.INT_64_NON_INT64_TYPE + ' , value: ' + in_value);\n },\n /**\n * Casts the input value to a Int32\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Int32: _simpleCastFunctor.bind(undefined, castArrays.Int32),\n /**\n * Casts the input value to a Int16\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Int16: _simpleCastFunctor.bind(undefined, castArrays.Int16),\n /**\n * Casts the input value to a Int8\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Int8: _simpleCastFunctor.bind(undefined, castArrays.Int8),\n /**\n * Casts the input value to a Float32\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Float32: _simpleCastFunctor.bind(undefined, castArrays.Float32),\n /**\n * Casts the input value to a Float64\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Float64: _simpleCastFunctor.bind(undefined, castArrays.Float64),\n /**\n * Casts the input value to a String\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n String: function (in_value) {\n return String(in_value);\n },\n /**\n * Casts the input value to a Boolean value\n * @param {boolean} in_value - The value to use in the cast\n * @return {boolean} The casted value\n * @protected\n */\n Boolean: function (in_value) {\n return !!in_value;\n }\n};\n\nexport { _castFunctors };\n"]}
1
+ {"version":3,"file":"primitiveTypeCasts.js","sourceRoot":"","sources":["../../src/properties/primitiveTypeCasts.js"],"names":[],"mappings":"AAAA;;;GAGG;AACH;;GAEG;AACH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AAEzE,IAAI,UAAU,GAAG;IACb,MAAM,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC;IAC1B,MAAM,EAAE,IAAI,WAAW,CAAC,CAAC,CAAC;IAC1B,KAAK,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;IACxB,KAAK,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;IACxB,KAAK,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC;IACxB,IAAI,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;IACtB,OAAO,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC;IAC5B,OAAO,EAAE,IAAI,YAAY,CAAC,CAAC,CAAC;CAC/B,CAAC;AAEF;;;;;;;;GAQG;AACH,IAAI,kBAAkB,GAAG,UAAS,QAAQ,EAAE,QAAQ;IAChD,QAAQ,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC;IACvB,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;AACvB,CAA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I,KAAK,CAAC,GAAG,CAAC,qBAAqB,GAAG,YAAY,GAAG,QAAQ,CAAC,CAAC;IACzE,CAAC;IACD;;;;;OAKG;IACH,KAAK,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC;IAC3D;;;;;OAKG;IACH,KAAK,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,KAAK,CAAC;IAC3D;;;;;OAKG;IACH,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC;IACzD;;;;;OAKG;IACH,OAAO,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC;IAC/D;;;;;OAKG;IACH,OAAO,EAAE,kBAAkB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,CAAC;IAC/D;;;;;OAKG;IACH,MAAM,EAAE,UAAS,QAAQ;QACrB,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC5B,CAAC;IACD;;;;;OAKG;IACH,OAAO,EAAE,UAAS,QAAQ;QACtB,OAAO,CAAC,CAAC,QAAQ,CAAC;IACtB,CAAC;CACJ,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview Helper functions to cast a JavaScript type to a value that is compatible with a given primitive type\n */\nconst _ = require('lodash');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { Int64, Uint64 } = require('@fluid-experimental/property-common');\n\nvar castArrays = {\n Uint32: new Uint32Array(1),\n Uint16: new Uint16Array(1),\n Uint8: new Uint8Array(1),\n Int32: new Int32Array(1),\n Int16: new Int16Array(1),\n Int8: new Int8Array(1),\n Float32: new Float32Array(1),\n Float64: new Float64Array(1),\n};\n\n/**\n * Performs a cast of a value by assigning it into the given data array and returning the resulting value. The\n * result is a native JavaScript datatype, that is compatible with the supplied typed array.\n *\n * @param {TypedArray} in_array - The data array to use for the cast\n * @param {number|string|boolean} in_value - The value to use in the cast\n * @return {number|string|boolean} The casted value\n * @private\n */\nvar _simpleCastFunctor = function(in_array, in_value) {\n in_array[0] = in_value;\n return in_array[0];\n};\n\n/**\n * Helper functions to cast the input value to the given type\n * @protected\n * @alias property-properties._castFunctors\n */\nconst _castFunctors = {\n /**\n * Casts the input value to a Uint64\n * @param {number} in_value - The value to use in the cast\n * @param {number} [in_radix = 10] An integer between 2 and 36 that represents the\n * radix (the base in mathematical numeral systems) of the above in_value if it is a string.\n * @return {number} The casted value\n * @protected\n */\n Uint64: function(in_value, in_radix) {\n if (in_value instanceof Uint64) {\n return in_value;\n }\n if (typeof in_value === 'string') {\n return Uint64.fromString(in_value, in_radix);\n }\n if (typeof in_value === 'number') {\n return Uint64.fromString(String(in_value), in_radix);\n }\n throw new Error(MSG.INT_64_NON_INT64_TYPE + ' , value: ' + in_value);\n },\n /**\n * Casts the input value to a Uint32\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Uint32: _simpleCastFunctor.bind(undefined, castArrays.Uint32),\n /**\n * Casts the input value to a Uint16\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Uint16: _simpleCastFunctor.bind(undefined, castArrays.Uint16),\n /**\n * Casts the input value to a Uint8\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Uint8: _simpleCastFunctor.bind(undefined, castArrays.Uint8),\n /**\n * Casts the input value to a Int64\n * @param {number} in_value - The value to use in the cast\n * @param {number} [in_radix = 10] An integer between 2 and 36 that represents the\n * radix (the base in mathematical numeral systems) of the above in_value if it is a string.\n * @return {number} The casted value\n * @protected\n */\n Int64: function(in_value, in_radix) {\n if (in_value instanceof Int64) {\n return in_value;\n }\n if (typeof in_value === 'string') {\n return Int64.fromString(in_value, in_radix);\n }\n if (typeof in_value === 'number') {\n return Int64.fromString(String(in_value), in_radix);\n }\n throw new Error(MSG.INT_64_NON_INT64_TYPE + ' , value: ' + in_value);\n },\n /**\n * Casts the input value to a Int32\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Int32: _simpleCastFunctor.bind(undefined, castArrays.Int32),\n /**\n * Casts the input value to a Int16\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Int16: _simpleCastFunctor.bind(undefined, castArrays.Int16),\n /**\n * Casts the input value to a Int8\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Int8: _simpleCastFunctor.bind(undefined, castArrays.Int8),\n /**\n * Casts the input value to a Float32\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Float32: _simpleCastFunctor.bind(undefined, castArrays.Float32),\n /**\n * Casts the input value to a Float64\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n Float64: _simpleCastFunctor.bind(undefined, castArrays.Float64),\n /**\n * Casts the input value to a String\n * @param {number} in_value - The value to use in the cast\n * @return {number} The casted value\n * @protected\n */\n String: function(in_value) {\n return String(in_value);\n },\n /**\n * Casts the input value to a Boolean value\n * @param {boolean} in_value - The value to use in the cast\n * @return {boolean} The casted value\n * @protected\n */\n Boolean: function(in_value) {\n return !!in_value;\n },\n};\n\nexport { _castFunctors };\n"]}
@@ -5,14 +5,14 @@
5
5
  /**
6
6
  * @fileoverview Definition of the reference array property class
7
7
  */
8
- const _ = require('lodash');
9
- const { ValueArrayProperty } = require('./valueArrayProperty');
10
8
  const { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');
11
- const { BaseProperty } = require('./baseProperty');
12
9
  const { MSG } = require('@fluid-experimental/property-common').constants;
13
10
  const { UniversalDataArray, ConsoleUtils } = require('@fluid-experimental/property-common');
11
+ const _ = require('lodash');
14
12
  const { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');
13
+ const { BaseProperty } = require('./baseProperty');
15
14
  const { ReferenceProperty } = require('./referenceProperty');
15
+ const { ValueArrayProperty } = require('./valueArrayProperty');
16
16
  /**
17
17
  * An ArrayProperty which stores reference values
18
18
  */
@@ -29,7 +29,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
29
29
  constructor(in_params) {
30
30
  super(in_params);
31
31
  }
32
- ;
33
32
  /**
34
33
  * Returns the typeid for the target of this reference
35
34
  *
@@ -41,7 +40,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
41
40
  getReferenceTargetTypeId() {
42
41
  return TypeIdHelper.extractReferenceTargetTypeIdFromReference(this.getTypeid());
43
42
  }
44
- ;
45
43
  /**
46
44
  * Resolves the referenced property for the given key
47
45
  *
@@ -75,7 +73,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
75
73
  return this.getParent().resolvePath(value, in_options);
76
74
  }
77
75
  }
78
- ;
79
76
  /**
80
77
  * Checks whether the reference is valid. This is either the case when it is empty or when the referenced
81
78
  * property exists.
@@ -87,7 +84,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
87
84
  return ValueArrayProperty.prototype.get.call(this, in_position) === '' ||
88
85
  this.get(in_position) !== undefined;
89
86
  }
90
- ;
91
87
  /**
92
88
  * Sets the range in the array to point to the given property objects or to be equal to the given paths
93
89
  *
@@ -103,7 +99,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
103
99
  var arr = ReferenceArrayProperty._convertInputToPaths(in_array, 'setRange');
104
100
  ValueArrayProperty.prototype.setRange.call(this, in_offset, arr);
105
101
  }
106
- ;
107
102
  /**
108
103
  * Insert a range which points to the given property objects into the array
109
104
  *
@@ -119,7 +114,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
119
114
  var arr = ReferenceArrayProperty._convertInputToPaths(in_array, 'insertRange');
120
115
  ValueArrayProperty.prototype.insertRange.call(this, in_offset, arr);
121
116
  }
122
- ;
123
117
  /**
124
118
  * returns the path value of a reference.
125
119
  * @param {number} in_id the index of the property
@@ -128,7 +122,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
128
122
  getValue(in_id) {
129
123
  return this._dataArrayRef.getValue(in_id);
130
124
  }
131
- ;
132
125
  /**
133
126
  * Returns an object with all the nested values contained in this property
134
127
  * @return {array<String>} an array of strings representing the paths listed in this array
@@ -142,7 +135,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
142
135
  }
143
136
  return result;
144
137
  }
145
- ;
146
138
  /**
147
139
  * Removes the last element of the array
148
140
  * @throws if trying to modify a referenced property
@@ -158,7 +150,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
158
150
  return undefined;
159
151
  }
160
152
  }
161
- ;
162
153
  /**
163
154
  * Removes an element of the array and shift remaining elements to the left
164
155
  * @param {number} in_position the index that will be removed
@@ -172,7 +163,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
172
163
  this.removeRange(in_position, 1);
173
164
  return value;
174
165
  }
175
- ;
176
166
  /**
177
167
  * Removes a given number of elements from the array and shifts remaining values to the left.
178
168
  * @param {number} in_offset target start index
@@ -196,7 +186,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
196
186
  this._setDirty();
197
187
  return result;
198
188
  }
199
- ;
200
189
  /**
201
190
  * @inheritdoc
202
191
  */
@@ -210,7 +199,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
210
199
  return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);
211
200
  }
212
201
  }
213
- ;
214
202
  /**
215
203
  * Creates and initializes the data array
216
204
  * @param {Number} in_length the initial length of the array
@@ -221,7 +209,6 @@ export class ReferenceArrayProperty extends ValueArrayProperty {
221
209
  this._dataArraySetValue(i, '');
222
210
  }
223
211
  }
224
- ;
225
212
  }
226
213
  /**
227
214
  * Validates the array and returns a sanitized version of it containing only strings.
@@ -1 +1 @@
1
- {"version":3,"file":"referenceArrayProperty.js","sourceRoot":"","sources":["../../src/properties/referenceArrayProperty.js"],"names":[],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;QACvD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;YAChC,IAAI,CAAC,kBAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SAClC;IACL,CAAC;IAAA,CAAC;;AAEF;;;;;;;;;;;GAWG;AACI,2CAAoB,GAAG,UAAU,QAAQ,EAAE,aAAa;IAC3D,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QACtB,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,kBAAkB,GAAG,yBAAyB,GAAG,aAAa,CAAC,CAAC;KACvF;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;QAC1B,GAAG,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;KAC/D;IACD,OAAO,GAAG,CAAC;AACf,CAAC,CAAC;AAGN,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 _ = require('lodash');\nconst { ValueArrayProperty } = require('./valueArrayProperty');\nconst { PathHelper, TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst { BaseProperty } = require('./baseProperty');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst { UniversalDataArray, ConsoleUtils } = require('@fluid-experimental/property-common');\nconst { AbstractStaticCollectionProperty } = require('./abstractStaticCollectionProperty');\nconst { ReferenceProperty } = require('./referenceProperty');\n\n/**\n * An ArrayProperty which stores reference values\n */\nexport class ReferenceArrayProperty extends ValueArrayProperty {\n\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 * @return {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\n * if an array is passed, the .get function will be performed on each id in sequence\n * for example .get([0, 'position','x']) is equivalent to .get(0).get('position').get('x').\n * If .get resolves to a ReferenceProperty, it will, by default, 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]\n * How should this function behave during reference resolution?\n *\n * @return {property-properties.BaseProperty|undefined} The property object the reference points to or undefined if it\n * 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 * @return {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 * @return {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 * @return {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 * @return {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 * @return {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 * @return {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\n // Array tokens are automatically resolved\n if (in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN) {\n return this.get(in_segment, { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });\n } else {\n // Everything else is handled by the implementation in the base property\n return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\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 * @return {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 Error(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\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,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,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AAC,CAAC;AAEN,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 /**\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 * @return {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\n * if an array is passed, the .get function will be performed on each id in sequence\n * for example .get([0, 'position','x']) is equivalent to .get(0).get('position').get('x').\n * If .get resolves to a ReferenceProperty, it will, by default, 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]\n * How should this function behave during reference resolution?\n *\n * @return {property-properties.BaseProperty|undefined} The property object the reference points to or undefined if it\n * 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 * @return {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 * @return {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 * @return {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 * @return {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 * @return {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 * @return {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 if (in_segmentType === PathHelper.TOKEN_TYPES.ARRAY_TOKEN) {\n return this.get(in_segment, { referenceResolutionMode: BaseProperty.REFERENCE_RESOLUTION.NEVER });\n } else {\n // Everything else is handled by the implementation in the base property\n return AbstractStaticCollectionProperty.prototype._resolvePathSegment.call(this, in_segment, in_segmentType);\n }\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 * @return {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 Error(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"]}