@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
@@ -1 +1 @@
1
- {"version":3,"file":"propertyTemplate.d.ts","sourceRoot":"","sources":["../src/propertyTemplate.js"],"names":[],"mappings":"AAgBA;IA6SI;;;;;;;QAOI;IACJ,mCAJY,MAAM,WASjB;IAED;;;;;;;MAOE;IACF,4CAJU,MAAM,SAiFf;IAhZD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,wBAwCC;IAtCG,qCAAqC;IACrC,QAAmB;IACnB,0CAA0C;IAC1C,YAA2B;IAKnB,eAA2B;IASnC,kCAAkC;IAClC,aAA6B;IAE7B,gCAAgC;IAChC,gBAAmC;IAEnC,4BAA4B;IAC5B,gBAAyC;IAEzC,qCAAqC;IACrC,eAAiC;IAEjC,wDAAwD;IACxD,cAAiF;IAG7E,oBAAwD;IAI5D;YAzDO,MAAM;cACN,MAAM;gBACN,MAAM;iBACN,MAAM;iBAEN,MAAM;oBAEN,MAAO,MAAM,CAAC;mBAEd,MAAO,MAAM,CAAC;kBAEd,MAAO,MAAM,CAAC;MA8Ca;IAGtC,+BAEC;IAED,8BAEC;IAED;;;OAGG;IACH,2DAFW,EAAE,QAcZ;IAED;;;;;OAKG;IACH,uCAFY,EAAE,CAyBb;IAED;;;;OAIG;IACH,aAEC;IAED;;;;OAIG;IACH,gBAFY,OAAO,CAYlB;IAED;;;OAGG;IACH,cAFY,MAAM,CAWjB;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,yCAVW,WAAY,YACZ,MAAM,iBAEN,OAAO,OA8FjB;IAED;;;OAGG;IACH,aAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,sBAFY,MAAM,CAIjB;IAED;;;;;OAKG;IACH,2BAHY,MAAM,CAUjB;CAwGJ"}
1
+ {"version":3,"file":"propertyTemplate.d.ts","sourceRoot":"","sources":["../src/propertyTemplate.js"],"names":[],"mappings":"AAgBA;IA2SI;;;;;;;QAOI;IACJ,mCAJY,MAAM,WASjB;IAED;;;;;;;MAOE;IACF,4CAJU,MAAM,SAiFf;IA9YD;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,wBAwCC;IAtCG,qCAAqC;IACrC,QAAmB;IACnB,0CAA0C;IAC1C,YAA2B;IAKnB,eAA2B;IASnC,kCAAkC;IAClC,aAA6B;IAE7B,gCAAgC;IAChC,gBAAmC;IAEnC,4BAA4B;IAC5B,gBAAyC;IAEzC,qCAAqC;IACrC,eAAiC;IAEjC,wDAAwD;IACxD,cAAiF;IAG7E,oBAAwD;IAI5D;YAzDO,MAAM;cACN,MAAM;gBACN,MAAM;iBACN,MAAM;iBAEN,MAAM;oBAEN,MAAO,MAAM,CAAC;mBAEd,MAAO,MAAM,CAAC;kBAEd,MAAO,MAAM,CAAC;MA8Ca;IAGtC,+BAEC;IAED,8BAEC;IAED;;;OAGG;IACH,2DAFW,EAAE,QAcZ;IAED;;;;;OAKG;IACH,uCAFY,EAAE,CAyBb;IAED;;;;OAIG;IACH,aAEC;IAED;;;;OAIG;IACH,gBAFY,OAAO,CAYlB;IAED;;;OAGG;IACH,cAFY,MAAM,CAWjB;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,yCAVW,WAAY,YACZ,MAAM,iBAEN,OAAO,OA4FjB;IAED;;;OAGG;IACH,aAFY,MAAM,CAIjB;IAED;;;OAGG;IACH,sBAFY,MAAM,CAIjB;IAED;;;;;OAKG;IACH,2BAHY,MAAM,CAUjB;CAuGJ"}
@@ -74,15 +74,12 @@ class PropertyTemplate {
74
74
  this._digestNestedInlineEnumProperties(this);
75
75
  this._serializedParams = in_params;
76
76
  }
77
- ;
78
77
  hasNestedProperties() {
79
78
  return (this.properties && this.properties.length > 0);
80
79
  }
81
- ;
82
80
  hasNestedConstants() {
83
81
  return (this.constants && this.constants.length > 0);
84
82
  }
85
- ;
86
83
  /**
87
84
  * internal function to recursivly traverse a property template and create dictionaries for found inline enums
88
85
  * @param {{}} in_currentPropertyLevel the current level in the template hierarchie
@@ -101,7 +98,6 @@ class PropertyTemplate {
101
98
  }
102
99
  }
103
100
  }
104
- ;
105
101
  /**
106
102
  * read the enum types list of a template and create a dictionary [value->enum] and [enum->value] for it
107
103
  * to efficiently lookup enums/values when setting/getting them from the property
@@ -131,7 +127,6 @@ class PropertyTemplate {
131
127
  }
132
128
  return enumDictionary;
133
129
  }
134
- ;
135
130
  /**
136
131
  * Clones the PropertyTemplate
137
132
  *
@@ -140,7 +135,6 @@ class PropertyTemplate {
140
135
  clone() {
141
136
  return new PropertyTemplate(deepCopy(this._serializedParams));
142
137
  }
143
- ;
144
138
  /**
145
139
  * Method used to check whether the template is versioned.
146
140
  * A versioned template is of the form `xxxx-1.0.0`
@@ -154,7 +148,6 @@ class PropertyTemplate {
154
148
  var version = splitTypeId.version;
155
149
  return /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)$/.test(version);
156
150
  }
157
- ;
158
151
  /**
159
152
  * Return the version number of the template.
160
153
  * @return {string} The version string is returned.
@@ -170,7 +163,6 @@ class PropertyTemplate {
170
163
  return undefined;
171
164
  }
172
165
  }
173
- ;
174
166
  /**
175
167
  * Canonical representation of a PropertyTemplate.
176
168
  * This is similar to a deep copy but with adjustments so that the target is in
@@ -270,7 +262,6 @@ class PropertyTemplate {
270
262
  }
271
263
  return in_target_;
272
264
  }
273
- ;
274
265
  /**
275
266
  * Return the serialized parameters passed in the constructor
276
267
  * @return {object} Serialized parameters
@@ -278,7 +269,6 @@ class PropertyTemplate {
278
269
  serialize() {
279
270
  return deepCopy(this._serializedParams);
280
271
  }
281
- ;
282
272
  /**
283
273
  * Return the serialized parameters passed in the constructor, in a template canonical form
284
274
  * @return {object} canonical serialized parameters
@@ -286,7 +276,6 @@ class PropertyTemplate {
286
276
  serializeCanonical() {
287
277
  return PropertyTemplate.prototype._canonicalForm(this._serializedParams);
288
278
  }
289
- ;
290
279
  /**
291
280
  * Return the typeid of the template without the version number
292
281
  * i.e. autodesk.core:color instead of autodesk.core:color-1.0.0
@@ -302,7 +291,6 @@ class PropertyTemplate {
302
291
  return this.typeid;
303
292
  }
304
293
  }
305
- ;
306
294
  /**
307
295
  * Determines if the argument is a template structure
308
296
  *
@@ -317,7 +305,6 @@ class PropertyTemplate {
317
305
  }
318
306
  return false;
319
307
  }
320
- ;
321
308
  /**
322
309
  * Extracts typeids directly referred to in a template
323
310
  *
@@ -402,7 +389,6 @@ class PropertyTemplate {
402
389
  }
403
390
  return Object.keys(dependencies);
404
391
  }
405
- ;
406
392
  }
407
393
  exports.PropertyTemplate = PropertyTemplate;
408
394
  //# sourceMappingURL=propertyTemplate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"propertyTemplate.js","sourceRoot":"","sources":["../src/propertyTemplate.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;;;GAIG;AACH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC;AACtC,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AAEzE,MAAa,gBAAgB;IACzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,SAAS,GAAG,EAAE;QACtB,IAAI,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;QACjC,qCAAqC;QACrC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,0CAA0C;QAC1C,IAAI,CAAC,MAAM,GA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AAC,UAAU,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BACjD,IAAI,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;4BACxC,YAAY,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;yBAC1C;wBACD,cAAc;qBACjB;yBAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE;wBACnC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;wBAChD,WAAW;qBACd;yBAAM;wBACH,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;wBAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BAClC,IAAI,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;4BACjD,IAAI,MAAM,EAAE;gCACR,YAAY,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;6BAC/B;yBACJ;qBACJ;iBACJ;aACJ;SACJ;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACrC,CAAC;IAAA,CAAC;CAEL;AAnZD,4CAmZC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview\n * Declaration of the PropertyTemplate module\n * PropertyTemplate is used to describe a static property\n */\nconst _ = require('lodash');\nconst { TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst fastestJSONCopy = require('fastest-json-copy');\nconst deepCopy = fastestJSONCopy.copy;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\n\nexport class PropertyTemplate {\n /**\n * Constructor for creating a PropertyTemplate based on the given parameters.\n * @param {object} in_params List of parameters\n * @param {string} in_params.id id of the property\n * @param {string} in_params.name Name of the property\n * @param {string} in_params.typeid The type identifier\n * @param {number=} [in_params.length=1] The length of the property. Only valid if\n * the property is an array, otherwise the length defaults to 1\n * @param {string} in_params.context The type of property this template represents\n * i.e. array, hash, etc.\n * @param {Array.<object>} in_params.properties List of property templates that\n * are used to define children properties\n * @param {Array.<object>} in_params.constants List of property templates that\n * are used to define constant properties and their values\n * @param {Array.<string>} in_params.inherits List of property template typeids that this\n * PropertyTemplate inherits from\n *\n * @constructor\n * @protected\n * @category Properties\n */\n constructor(in_params = {}) {\n let params = deepCopy(in_params);\n /** The identifier of the property */\n this.id = params.id;\n /** The type identifier of the property */\n this.typeid = params.typeid;\n\n /** Size of the property (if this is an array) */\n if (params.context === 'array') {\n if (params.length !== undefined) {\n this.length = params.length;\n } else {\n this.length = 0;\n }\n } else {\n this.length = 1;\n }\n ConsoleUtils.assert(_.isNumber(this.length), MSG.LENGTH_MUST_BE_NUMBER + this.length);\n\n /** The context of the property */\n this.context = params.context;\n\n /** Array with sub-properties */\n this.properties = params.properties;\n\n /** The annotation object */\n this.annotation = params.annotation || {};\n\n /** Array with constant properties */\n this.constants = params.constants;\n\n /** Typeids of properties this property inherits from */\n this.inherits = _.isString(params.inherits) ? [params.inherits] : params.inherits;\n\n if (_.includes(this.inherits, 'Enum')) {\n this._enumDictionary = this._parseEnums(this.properties);\n }\n // check for inlined enums and parse them:\n this._digestNestedInlineEnumProperties(this);\n this._serializedParams = in_params;\n };\n\n hasNestedProperties() {\n return (this.properties && this.properties.length > 0);\n };\n\n hasNestedConstants() {\n return (this.constants && this.constants.length > 0);\n };\n\n /**\n * internal function to recursivly traverse a property template and create dictionaries for found inline enums\n * @param {{}} in_currentPropertyLevel the current level in the template hierarchie\n */\n _digestNestedInlineEnumProperties(in_currentPropertyLevel) {\n if (in_currentPropertyLevel.properties) {\n for (var i = 0; i < in_currentPropertyLevel.properties.length; i++) {\n if (in_currentPropertyLevel.properties[i].typeid === 'Enum') {\n var dictionary = this._parseEnums(in_currentPropertyLevel.properties[i].properties);\n in_currentPropertyLevel.properties[i]._enumDictionary = dictionary;\n } else if (in_currentPropertyLevel.properties[i].properties) {\n // call self\n this._digestNestedInlineEnumProperties(in_currentPropertyLevel.properties[i]);\n }\n }\n }\n };\n\n /**\n * read the enum types list of a template and create a dictionary [value->enum] and [enum->value] for it\n * to efficiently lookup enums/values when setting/getting them from the property\n * @param {Array} in_enumProperties - the list of enums and their values and annotations\n * @return {{}} a dictionary [value->enum] and [enum->value]\n */\n _parseEnums(in_enumProperties) {\n var enumDictionary = { enumEntriesById: {}, enumEntriesByValue: {}, defaultValue: undefined };\n var minValue;\n if (in_enumProperties.length !== 0) {\n minValue = in_enumProperties[0].value;\n }\n for (var i = 0; i < in_enumProperties.length; i++) {\n var enumEntry = in_enumProperties[i];\n var value = enumEntry.value;\n ConsoleUtils.assert(enumEntry.id, MSG.ENUM_TYPEID_MISSING);\n ConsoleUtils.assert(!_.isNaN(enumEntry.value), MSG.ENUM_VALUE_NOT_NUMBER + value);\n enumDictionary.enumEntriesById[enumEntry.id] = { value: value, annotation: enumEntry.annotation };\n enumDictionary.enumEntriesByValue[value] = { id: enumEntry.id, annotation: enumEntry.annotation };\n minValue = value < minValue ? value : minValue;\n }\n\n if (enumDictionary.enumEntriesByValue.hasOwnProperty(0)) {\n enumDictionary.defaultValue = 0;\n } else {\n enumDictionary.defaultValue = minValue;\n }\n\n return enumDictionary;\n };\n\n /**\n * Clones the PropertyTemplate\n *\n * @return {property-properties.PropertyTemplate} The cloned template\n */\n clone() {\n return new PropertyTemplate(deepCopy(this._serializedParams));\n };\n\n /**\n * Method used to check whether the template is versioned.\n * A versioned template is of the form `xxxx-1.0.0`\n * @return {boolean} Returns true if the template is versioned, false otherwise\n */\n _isVersioned() {\n var splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n\n if (!splitTypeId.version) {\n return false;\n }\n\n var version = splitTypeId.version;\n\n return /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/.test(version);\n };\n\n /**\n * Return the version number of the template.\n * @return {string} The version string is returned.\n */\n getVersion() {\n if (this._isVersioned()) {\n var splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n var version = splitTypeId.version;\n return version;\n } else {\n console.warn(MSG.TEMPLATE_NOT_VERSIONED, this.typeid);\n return undefined;\n }\n };\n\n /**\n * Canonical representation of a PropertyTemplate.\n * This is similar to a deep copy but with adjustments so that the target is in\n * canonical form for a template property i.e. a) if array length\n * is not specified it is set to 0 in the target, b) string value\n * for 'inherits' property is converted to single-value array\n * Deep copy an object.\n *\n * @param {*} in_obj - the object to create a canonical copy of.\n * @param {Object|Array} [in_target_] - copy into this object.\n * @param {string} [in_key_] - key in in_target_ at which to place\n * the copied object.\n * @param {boolean} [in_preserve_ = false] - do not overwrite structs / arrays in\n * in an existing object\n *\n * @return {*} in_target_ if specified, new object containing canonical copy of @obj\n * otherwise.\n * @return {string} The version string is returned.\n */\n _canonicalForm(in_obj, in_target_, in_key_, in_preserve_) {\n\n in_preserve_ = in_preserve_ === undefined ? false : in_preserve_;\n\n var target, copyMembers;\n var copyDirectlyIntoKey = false;\n if (in_target_ && (in_key_ === undefined ||\n (in_key_ &&\n in_target_.hasOwnProperty(in_key_) &&\n _.isObject(in_target_[in_key_]) &&\n in_preserve_))) {\n // If no key is given, we directly copy into the\n // target object. Additionally, when a key is given, the member already exists\n // in the target object and preserve is set, we also keep the target object.\n // This is only possible if the target is already an\n // object.\n target = in_key_ ? in_target_[in_key_] : in_target_;\n\n if (_.isFunction(in_obj) ||\n _.isDate(in_obj) ||\n _.isRegExp(in_obj) ||\n (_.isObject(in_obj) !== _.isObject(target)) ||\n (_.isArray(in_obj) !== _.isArray(target)) ||\n !_.isObject(target)) {\n throw new Error(\n MSG.INVALID_TARGET_PROPERTY_TEMPLATE + this.typeid\n );\n }\n copyMembers = true;\n copyDirectlyIntoKey = true;\n\n } else {\n // If no existing target object, we create a new object.\n\n // literals are directly assigned to the target\n if (!in_obj || !_.isObject(in_obj) || _.isFunction(in_obj)) {\n target = in_obj;\n // Special case handlers for dates and regexps\n // (https://github.com/jashkenas/underscore/pull/595)\n } else if (_.isDate(in_obj)) {\n target = new Date(in_obj.getTime());\n } else if (_.isRegExp(in_obj)) {\n target = new RegExp(in_obj.source, in_obj.toString().replace(/.*\\//, ''));\n // For objects and arrays we create a new object/array\n } else if (_.isObject(in_obj)) {\n target = _.isArray(in_obj) ? [] : {};\n copyMembers = true;\n } else {\n throw new Error(\n MSG.MISSING_CASE_IN_TEMPLATE_SERIALIZATION + this.typeid\n );\n }\n }\n\n // If this is either an object or an array, we have to do a 'normalized' deep copy\n // and recursively copy all members. Normalized means the target will be a normalized\n // representation of the input property with respect to the canonical representation\n // of a template i.e. : if array length is not specified it is set to 0.\n // Other rules will follow\n if (copyMembers) {\n var keys = _.keys(in_obj);\n var l = keys.length;\n for (var i = 0; i < l; i++) {\n var key = keys[i];\n this._canonicalForm(in_obj[key], target, key, in_preserve_);\n }\n\n // If context is array and length is absent set it to 0\n if (_.includes(keys, 'context') && in_obj['context'] === 'array' && !_.includes(keys, 'length')) {\n target['length'] = 0;\n }\n\n // If inherit value is present and is a single string convert it to single element array\n if (_.includes(keys, 'inherits') && in_obj['inherits'] && !_.isObject(in_obj['inherits'])) {\n target['inherits'] = [in_obj['inherits']];\n }\n }\n\n if (!in_key_) {\n // If you don't give a path, then we return the original or copied object\n return target;\n } else if (!copyDirectlyIntoKey) {\n // If you give a path, we use the path as a key.\n in_target_[in_key_] = target;\n }\n\n return in_target_;\n };\n\n /**\n * Return the serialized parameters passed in the constructor\n * @return {object} Serialized parameters\n */\n serialize() {\n return deepCopy(this._serializedParams);\n };\n\n /**\n * Return the serialized parameters passed in the constructor, in a template canonical form\n * @return {object} canonical serialized parameters\n */\n serializeCanonical() {\n return PropertyTemplate.prototype._canonicalForm(this._serializedParams);\n };\n\n /**\n * Return the typeid of the template without the version number\n * i.e. autodesk.core:color instead of autodesk.core:color-1.0.0\n * @return {string} The typeid without the version is returned.\n * If the template is not versioned, the typeid is return.\n */\n getTypeidWithoutVersion() {\n if (this._isVersioned()) {\n var splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n return splitTypeId.typeidWithoutVersion;\n } else {\n return this.typeid;\n }\n };\n\n /**\n * Determines if the argument is a template structure\n *\n * @public\n * @param {object} in_param parameter to assess\n *\n * @return {Boolean} returns true if in_param is a template\n */\n static isTemplate(in_param) {\n if (in_param.typeid && in_param.typeid.indexOf(':') !== -1) {\n return true;\n }\n return false;\n };\n\n /**\n * Extracts typeids directly referred to in a template\n *\n * @public\n * @param {object} template structure from which to extract dependencies\n *\n * @return {Array} list of typeids this template refers directly to\n */\n static extractDependencies(template) {\n var dependencies = {};\n\n if (template.inherits) {\n var inherits = (typeof template.inherits === 'string') ? [template.inherits] : template.inherits;\n for (var i = 0; i < inherits.length; i++) {\n var elem = TypeIdHelper.extractTypeId(inherits[i]);\n dependencies[elem] = true;\n }\n }\n\n if (template.properties) {\n var properties = template.properties;\n for (var i = 0; i < properties.length; i++) {\n var property = properties[i];\n if (PropertyTemplate.isTemplate(property)) {\n var typeid = TypeIdHelper.extractTypeId(property.typeid);\n dependencies[typeid] = true;\n\n if (property.typedValue) {\n for (var t = 0; t < property.typedValue.length; t++) {\n var typedValue = property.typedValue[t];\n dependencies[typedValue.typeid] = true;\n }\n }\n } else if (property.properties) {\n var deps = PropertyTemplate.extractDependencies(property);\n for (var j = 0; j < deps.length; j++) {\n var typeid = TypeIdHelper.extractTypeId(deps[j]);\n dependencies[typeid] = true;\n }\n }\n }\n }\n\n if (template.constants) {\n var constants = template.constants;\n for (var i = 0; i < constants.length; i++) {\n var constant = constants[i];\n if (PropertyTemplate.isTemplate(constant)) {\n var typeid = TypeIdHelper.extractTypeId(constant.typeid);\n dependencies[typeid] = true;\n } else if (constant.context === 'map' && constant.contextKeyType === 'typeid' && constant.value) {\n var keys = Object.keys(constant.value);\n for (var k = 0; k < keys.length; k++) {\n var typeid = TypeIdHelper.extractTypeId(keys[k]);\n dependencies[typeid] = true;\n }\n }\n\n // Search for typeid hidden in typedValue\n // the context could be inherited and therefore missing, so we have to try them all.\n if (constant.typedValue) {\n // for arrays\n if (_.isArray(constant.typedValue)) {\n for (var t = 0; t < constant.typedValue.length; t++) {\n var typedValue = constant.typedValue[t];\n dependencies[typedValue.typeid] = true;\n }\n // for singles\n } else if (constant.typedValue.typeid) {\n dependencies[constant.typedValue.typeid] = true;\n // for maps\n } else {\n var keys = Object.keys(constant.typedValue);\n for (var k = 0; k < keys.length; k++) {\n var typeid = constant.typedValue[keys[k]].typeid;\n if (typeid) {\n dependencies[typeid] = true;\n }\n }\n }\n }\n }\n }\n\n return Object.keys(dependencies);\n };\n\n}\n"]}
1
+ {"version":3,"file":"propertyTemplate.js","sourceRoot":"","sources":["../src/propertyTemplate.js"],"names":[],"mappings":";;;AAAA;;;GAGG;AACH;;;;GAIG;AACH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,wCAAwC,CAAC,CAAC;AAC3E,MAAM,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;AACrD,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC;AACtC,MAAM,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACxE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AAEzE,MAAa,gBAAgB;IACzB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,YAAY,SAAS,GAAG,EAAE;QACtB,IAAI,MAAM,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;QACjC,qCAAqC;QACrC,IAAI,CAAC,EAAE,GAAG,MAAM,CAAC,EAAE,CAAC;QACpB,0CAA0C;QAC1C,IAAI,CAAC,MAAM,G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AAC;yBAC1C;wBACD,cAAc;qBACjB;yBAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,MAAM,EAAE;wBACnC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;wBAChD,WAAW;qBACd;yBAAM;wBACH,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;wBAC5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;4BAClC,IAAI,MAAM,GAAG,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;4BACjD,IAAI,MAAM,EAAE;gCACR,YAAY,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC;6BAC/B;yBACJ;qBACJ;iBACJ;aACJ;SACJ;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACrC,CAAC;CACJ;AAhZD,4CAgZC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n/**\n * @fileoverview\n * Declaration of the PropertyTemplate module\n * PropertyTemplate is used to describe a static property\n */\nconst _ = require('lodash');\nconst { TypeIdHelper } = require('@fluid-experimental/property-changeset');\nconst fastestJSONCopy = require('fastest-json-copy');\nconst deepCopy = fastestJSONCopy.copy;\nconst { ConsoleUtils } = require('@fluid-experimental/property-common');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\n\nexport class PropertyTemplate {\n /**\n * Constructor for creating a PropertyTemplate based on the given parameters.\n * @param {object} in_params List of parameters\n * @param {string} in_params.id id of the property\n * @param {string} in_params.name Name of the property\n * @param {string} in_params.typeid The type identifier\n * @param {number=} [in_params.length=1] The length of the property. Only valid if\n * the property is an array, otherwise the length defaults to 1\n * @param {string} in_params.context The type of property this template represents\n * i.e. array, hash, etc.\n * @param {Array.<object>} in_params.properties List of property templates that\n * are used to define children properties\n * @param {Array.<object>} in_params.constants List of property templates that\n * are used to define constant properties and their values\n * @param {Array.<string>} in_params.inherits List of property template typeids that this\n * PropertyTemplate inherits from\n *\n * @constructor\n * @protected\n * @category Properties\n */\n constructor(in_params = {}) {\n let params = deepCopy(in_params);\n /** The identifier of the property */\n this.id = params.id;\n /** The type identifier of the property */\n this.typeid = params.typeid;\n\n /** Size of the property (if this is an array) */\n if (params.context === 'array') {\n if (params.length !== undefined) {\n this.length = params.length;\n } else {\n this.length = 0;\n }\n } else {\n this.length = 1;\n }\n ConsoleUtils.assert(_.isNumber(this.length), MSG.LENGTH_MUST_BE_NUMBER + this.length);\n\n /** The context of the property */\n this.context = params.context;\n\n /** Array with sub-properties */\n this.properties = params.properties;\n\n /** The annotation object */\n this.annotation = params.annotation || {};\n\n /** Array with constant properties */\n this.constants = params.constants;\n\n /** Typeids of properties this property inherits from */\n this.inherits = _.isString(params.inherits) ? [params.inherits] : params.inherits;\n\n if (_.includes(this.inherits, 'Enum')) {\n this._enumDictionary = this._parseEnums(this.properties);\n }\n // check for inlined enums and parse them:\n this._digestNestedInlineEnumProperties(this);\n this._serializedParams = in_params;\n }\n\n hasNestedProperties() {\n return (this.properties && this.properties.length > 0);\n }\n\n hasNestedConstants() {\n return (this.constants && this.constants.length > 0);\n }\n\n /**\n * internal function to recursivly traverse a property template and create dictionaries for found inline enums\n * @param {{}} in_currentPropertyLevel the current level in the template hierarchie\n */\n _digestNestedInlineEnumProperties(in_currentPropertyLevel) {\n if (in_currentPropertyLevel.properties) {\n for (var i = 0; i < in_currentPropertyLevel.properties.length; i++) {\n if (in_currentPropertyLevel.properties[i].typeid === 'Enum') {\n var dictionary = this._parseEnums(in_currentPropertyLevel.properties[i].properties);\n in_currentPropertyLevel.properties[i]._enumDictionary = dictionary;\n } else if (in_currentPropertyLevel.properties[i].properties) {\n // call self\n this._digestNestedInlineEnumProperties(in_currentPropertyLevel.properties[i]);\n }\n }\n }\n }\n\n /**\n * read the enum types list of a template and create a dictionary [value->enum] and [enum->value] for it\n * to efficiently lookup enums/values when setting/getting them from the property\n * @param {Array} in_enumProperties - the list of enums and their values and annotations\n * @return {{}} a dictionary [value->enum] and [enum->value]\n */\n _parseEnums(in_enumProperties) {\n var enumDictionary = { enumEntriesById: {}, enumEntriesByValue: {}, defaultValue: undefined };\n var minValue;\n if (in_enumProperties.length !== 0) {\n minValue = in_enumProperties[0].value;\n }\n for (var i = 0; i < in_enumProperties.length; i++) {\n var enumEntry = in_enumProperties[i];\n var value = enumEntry.value;\n ConsoleUtils.assert(enumEntry.id, MSG.ENUM_TYPEID_MISSING);\n ConsoleUtils.assert(!_.isNaN(enumEntry.value), MSG.ENUM_VALUE_NOT_NUMBER + value);\n enumDictionary.enumEntriesById[enumEntry.id] = { value: value, annotation: enumEntry.annotation };\n enumDictionary.enumEntriesByValue[value] = { id: enumEntry.id, annotation: enumEntry.annotation };\n minValue = value < minValue ? value : minValue;\n }\n\n if (enumDictionary.enumEntriesByValue.hasOwnProperty(0)) {\n enumDictionary.defaultValue = 0;\n } else {\n enumDictionary.defaultValue = minValue;\n }\n\n return enumDictionary;\n }\n\n /**\n * Clones the PropertyTemplate\n *\n * @return {property-properties.PropertyTemplate} The cloned template\n */\n clone() {\n return new PropertyTemplate(deepCopy(this._serializedParams));\n }\n\n /**\n * Method used to check whether the template is versioned.\n * A versioned template is of the form `xxxx-1.0.0`\n * @return {boolean} Returns true if the template is versioned, false otherwise\n */\n _isVersioned() {\n var splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n\n if (!splitTypeId.version) {\n return false;\n }\n\n var version = splitTypeId.version;\n\n return /^(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)\\.(?:0|[1-9]\\d*)$/.test(version);\n }\n\n /**\n * Return the version number of the template.\n * @return {string} The version string is returned.\n */\n getVersion() {\n if (this._isVersioned()) {\n var splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n var version = splitTypeId.version;\n return version;\n } else {\n console.warn(MSG.TEMPLATE_NOT_VERSIONED, this.typeid);\n return undefined;\n }\n }\n\n /**\n * Canonical representation of a PropertyTemplate.\n * This is similar to a deep copy but with adjustments so that the target is in\n * canonical form for a template property i.e. a) if array length\n * is not specified it is set to 0 in the target, b) string value\n * for 'inherits' property is converted to single-value array\n * Deep copy an object.\n *\n * @param {*} in_obj - the object to create a canonical copy of.\n * @param {Object|Array} [in_target_] - copy into this object.\n * @param {string} [in_key_] - key in in_target_ at which to place\n * the copied object.\n * @param {boolean} [in_preserve_ = false] - do not overwrite structs / arrays in\n * in an existing object\n *\n * @return {*} in_target_ if specified, new object containing canonical copy of @obj\n * otherwise.\n * @return {string} The version string is returned.\n */\n _canonicalForm(in_obj, in_target_, in_key_, in_preserve_) {\n in_preserve_ = in_preserve_ === undefined ? false : in_preserve_;\n\n var target, copyMembers;\n var copyDirectlyIntoKey = false;\n if (in_target_ && (in_key_ === undefined ||\n (in_key_ &&\n in_target_.hasOwnProperty(in_key_) &&\n _.isObject(in_target_[in_key_]) &&\n in_preserve_))) {\n // If no key is given, we directly copy into the\n // target object. Additionally, when a key is given, the member already exists\n // in the target object and preserve is set, we also keep the target object.\n // This is only possible if the target is already an\n // object.\n target = in_key_ ? in_target_[in_key_] : in_target_;\n\n if (_.isFunction(in_obj) ||\n _.isDate(in_obj) ||\n _.isRegExp(in_obj) ||\n (_.isObject(in_obj) !== _.isObject(target)) ||\n (_.isArray(in_obj) !== _.isArray(target)) ||\n !_.isObject(target)) {\n throw new Error(\n MSG.INVALID_TARGET_PROPERTY_TEMPLATE + this.typeid,\n );\n }\n copyMembers = true;\n copyDirectlyIntoKey = true;\n } else {\n // If no existing target object, we create a new object.\n\n // literals are directly assigned to the target\n if (!in_obj || !_.isObject(in_obj) || _.isFunction(in_obj)) {\n target = in_obj;\n // Special case handlers for dates and regexps\n // (https://github.com/jashkenas/underscore/pull/595)\n } else if (_.isDate(in_obj)) {\n target = new Date(in_obj.getTime());\n } else if (_.isRegExp(in_obj)) {\n target = new RegExp(in_obj.source, in_obj.toString().replace(/.*\\//, ''));\n // For objects and arrays we create a new object/array\n } else if (_.isObject(in_obj)) {\n target = _.isArray(in_obj) ? [] : {};\n copyMembers = true;\n } else {\n throw new Error(\n MSG.MISSING_CASE_IN_TEMPLATE_SERIALIZATION + this.typeid,\n );\n }\n }\n\n // If this is either an object or an array, we have to do a 'normalized' deep copy\n // and recursively copy all members. Normalized means the target will be a normalized\n // representation of the input property with respect to the canonical representation\n // of a template i.e. : if array length is not specified it is set to 0.\n // Other rules will follow\n if (copyMembers) {\n var keys = _.keys(in_obj);\n var l = keys.length;\n for (var i = 0; i < l; i++) {\n var key = keys[i];\n this._canonicalForm(in_obj[key], target, key, in_preserve_);\n }\n\n // If context is array and length is absent set it to 0\n if (_.includes(keys, 'context') && in_obj['context'] === 'array' && !_.includes(keys, 'length')) {\n target['length'] = 0;\n }\n\n // If inherit value is present and is a single string convert it to single element array\n if (_.includes(keys, 'inherits') && in_obj['inherits'] && !_.isObject(in_obj['inherits'])) {\n target['inherits'] = [in_obj['inherits']];\n }\n }\n\n if (!in_key_) {\n // If you don't give a path, then we return the original or copied object\n return target;\n } else if (!copyDirectlyIntoKey) {\n // If you give a path, we use the path as a key.\n in_target_[in_key_] = target;\n }\n\n return in_target_;\n }\n\n /**\n * Return the serialized parameters passed in the constructor\n * @return {object} Serialized parameters\n */\n serialize() {\n return deepCopy(this._serializedParams);\n }\n\n /**\n * Return the serialized parameters passed in the constructor, in a template canonical form\n * @return {object} canonical serialized parameters\n */\n serializeCanonical() {\n return PropertyTemplate.prototype._canonicalForm(this._serializedParams);\n }\n\n /**\n * Return the typeid of the template without the version number\n * i.e. autodesk.core:color instead of autodesk.core:color-1.0.0\n * @return {string} The typeid without the version is returned.\n * If the template is not versioned, the typeid is return.\n */\n getTypeidWithoutVersion() {\n if (this._isVersioned()) {\n var splitTypeId = TypeIdHelper.extractVersion(this.typeid);\n return splitTypeId.typeidWithoutVersion;\n } else {\n return this.typeid;\n }\n }\n\n /**\n * Determines if the argument is a template structure\n *\n * @public\n * @param {object} in_param parameter to assess\n *\n * @return {Boolean} returns true if in_param is a template\n */\n static isTemplate(in_param) {\n if (in_param.typeid && in_param.typeid.indexOf(':') !== -1) {\n return true;\n }\n return false;\n }\n\n /**\n * Extracts typeids directly referred to in a template\n *\n * @public\n * @param {object} template structure from which to extract dependencies\n *\n * @return {Array} list of typeids this template refers directly to\n */\n static extractDependencies(template) {\n var dependencies = {};\n\n if (template.inherits) {\n var inherits = (typeof template.inherits === 'string') ? [template.inherits] : template.inherits;\n for (var i = 0; i < inherits.length; i++) {\n var elem = TypeIdHelper.extractTypeId(inherits[i]);\n dependencies[elem] = true;\n }\n }\n\n if (template.properties) {\n var properties = template.properties;\n for (var i = 0; i < properties.length; i++) {\n var property = properties[i];\n if (PropertyTemplate.isTemplate(property)) {\n var typeid = TypeIdHelper.extractTypeId(property.typeid);\n dependencies[typeid] = true;\n\n if (property.typedValue) {\n for (var t = 0; t < property.typedValue.length; t++) {\n var typedValue = property.typedValue[t];\n dependencies[typedValue.typeid] = true;\n }\n }\n } else if (property.properties) {\n var deps = PropertyTemplate.extractDependencies(property);\n for (var j = 0; j < deps.length; j++) {\n var typeid = TypeIdHelper.extractTypeId(deps[j]);\n dependencies[typeid] = true;\n }\n }\n }\n }\n\n if (template.constants) {\n var constants = template.constants;\n for (var i = 0; i < constants.length; i++) {\n var constant = constants[i];\n if (PropertyTemplate.isTemplate(constant)) {\n var typeid = TypeIdHelper.extractTypeId(constant.typeid);\n dependencies[typeid] = true;\n } else if (constant.context === 'map' && constant.contextKeyType === 'typeid' && constant.value) {\n var keys = Object.keys(constant.value);\n for (var k = 0; k < keys.length; k++) {\n var typeid = TypeIdHelper.extractTypeId(keys[k]);\n dependencies[typeid] = true;\n }\n }\n\n // Search for typeid hidden in typedValue\n // the context could be inherited and therefore missing, so we have to try them all.\n if (constant.typedValue) {\n // for arrays\n if (_.isArray(constant.typedValue)) {\n for (var t = 0; t < constant.typedValue.length; t++) {\n var typedValue = constant.typedValue[t];\n dependencies[typedValue.typeid] = true;\n }\n // for singles\n } else if (constant.typedValue.typeid) {\n dependencies[constant.typedValue.typeid] = true;\n // for maps\n } else {\n var keys = Object.keys(constant.typedValue);\n for (var k = 0; k < keys.length; k++) {\n var typeid = constant.typedValue[keys[k]].typeid;\n if (typeid) {\n dependencies[typeid] = true;\n }\n }\n }\n }\n }\n }\n\n return Object.keys(dependencies);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"propertyTemplateWrapper.d.ts","sourceRoot":"","sources":["../src/propertyTemplateWrapper.js"],"names":[],"mappings":"AA6BA;IAEI;;;;;;;;;OASG;IACH,8CAPW,MAAM,EAqBhB;IAbG,oDAAoD;IACpD,uBAA0C;IAE1C;;OAEG;IACH,+BAA0C;IAG1C,4BAAoC;IAGpC,eAAsB;IAI1B;;;;OAIG;IACH,2BAEC;IAED;;;;;;;OAOG;IACH,kDAKC;IAED;;;;OAIG;IACH,uBAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,mBAHY,MAAM,CAKjB;IAED;;;;;;OAMG;IACH,2BAHW,MAAM,QAmBhB;IAED;;;;;;;OAOG;IACH,wDAuHC;IAED;;;;;;OAMG;IACH,iCAJW,MAAM,qBACN,MAAM,QAqEhB;CACJ"}
1
+ {"version":3,"file":"propertyTemplateWrapper.d.ts","sourceRoot":"","sources":["../src/propertyTemplateWrapper.js"],"names":[],"mappings":"AA6BA;IACI;;;;;;;;;OASG;IACH,8CAPW,MAAM,EAqBhB;IAbG,oDAAoD;IACpD,uBAA0C;IAE1C;;OAEG;IACH,+BAA0C;IAG1C,4BAAoC;IAGpC,eAAsB;IAG1B;;;;OAIG;IACH,2BAEC;IAED;;;;;;;OAOG;IACH,kDAKC;IAED;;;;OAIG;IACH,uBAHY,OAAO,CAKlB;IAED;;;;OAIG;IACH,mBAHY,MAAM,CAKjB;IAED;;;;;;OAMG;IACH,2BAHW,MAAM,QAmBhB;IAED;;;;;;;OAOG;IACH,wDAuHC;IAED;;;;;;OAMG;IACH,iCAJW,MAAM,qBACN,MAAM,QAqEhB;CACJ"}
@@ -10,14 +10,14 @@ exports.PropertyTemplateWrapper = void 0;
10
10
  * Declaration of the PropertyTemplateWrapper module
11
11
  * PropertyTemplateWrapper is used to wrap a property template and perform internal optimizations
12
12
  */
13
+ const { MSG } = require('@fluid-experimental/property-common').constants;
13
14
  const _ = require('lodash');
14
15
  const { ContainerProperty } = require('./properties/containerProperty');
15
- const { MSG } = require('@fluid-experimental/property-common').constants;
16
16
  const reservedTypesWithoutTemplates = {
17
17
  'BaseProperty': true,
18
18
  'ContainerProperty': true,
19
19
  'NodeProperty': true,
20
- 'Enum': true
20
+ 'Enum': true,
21
21
  };
22
22
  /**
23
23
  * Utility function that validates if the typeid is a reserved type without a template.
@@ -45,12 +45,11 @@ class PropertyTemplateWrapper {
45
45
  * from templates this template inherits from.
46
46
  */
47
47
  this._compiledPropertyTemplate = undefined;
48
- /* What type of base object is created for this template*/
48
+ /* What type of base object is created for this template */
49
49
  this._objectCreationType = undefined;
50
- /* The scope of this template*/
50
+ /* The scope of this template */
51
51
  this._scope = in_scope;
52
52
  }
53
- ;
54
53
  /**
55
54
  * To get the property template that this is wrapping.
56
55
  * @return {property-properties.PropertyTemplate} The template this wrapper contains
@@ -59,7 +58,6 @@ class PropertyTemplateWrapper {
59
58
  getPropertyTemplate() {
60
59
  return this._propertyTemplate;
61
60
  }
62
- ;
63
61
  /**
64
62
  * Gets the compiled template or creates it then returns it.
65
63
  * @param {property-properties.PropertyFactory} in_propertyFactory The assosiated PropertyFactory.
@@ -74,7 +72,6 @@ class PropertyTemplateWrapper {
74
72
  }
75
73
  return this._compiledPropertyTemplate;
76
74
  }
77
- ;
78
75
  /**
79
76
  * Returns if the compiled template has been created.
80
77
  * @return {boolean} if the compiled template has been created
@@ -83,7 +80,6 @@ class PropertyTemplateWrapper {
83
80
  hasCompiledTemplate() {
84
81
  return !!this._compiledPropertyTemplate;
85
82
  }
86
- ;
87
83
  /**
88
84
  * To get the creation type of the template this wraps.
89
85
  * @return {string} A typeid which represents the creation type of this template
@@ -92,7 +88,6 @@ class PropertyTemplateWrapper {
92
88
  getCreationType() {
93
89
  return this._objectCreationType;
94
90
  }
95
- ;
96
91
  /**
97
92
  * If current creation type is undefined, sets it to in_typeid if in_typeid is a creation type.
98
93
  * If current creation type is defined, throws if in_typeid is a creation type.
@@ -116,7 +111,6 @@ class PropertyTemplateWrapper {
116
111
  }
117
112
  }
118
113
  }
119
- ;
120
114
  /**
121
115
  * Contructs the compiled template from the template this wraps
122
116
  * @param {property-properties.PropertyFactory} in_propertyFactory The associated PropertyFactory.
@@ -222,7 +216,6 @@ class PropertyTemplateWrapper {
222
216
  }
223
217
  return template;
224
218
  }
225
- ;
226
219
  /**
227
220
  * A helper function which merges a child and parent property.
228
221
  * The changes are applied directly to the in_childProperty.
@@ -290,7 +283,6 @@ class PropertyTemplateWrapper {
290
283
  mergeSubProperties(in_childProperty, in_parentProperty, 'properties');
291
284
  mergeSubProperties(in_childProperty, in_parentProperty, 'constants');
292
285
  }
293
- ;
294
286
  }
295
287
  exports.PropertyTemplateWrapper = PropertyTemplateWrapper;
296
288
  //# sourceMappingURL=propertyTemplateWrapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"propertyTemplateWrapper.js","sourceRoot":"","sources":["../src/propertyTemplateWrapper.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AACH,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC5B,MAAM,EAAE,iBAAiB,EAAE,GAAG,OAAO,CAAC,gCAAgC,CAAC,CAAC;AACxE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AAEzE,MAAM,6BAA6B,GAAG;IAClC,cAAc,EAAE,IAAI;IACpB,mBAAmB,EAAE,IAAI;IACzB,cAAc,EAAE,IAAI;IAC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AM,GAAG,CAAC,EAAE;gBACvB,KAAK,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;aACjC;QACL,CAAC,CAAC;QAEF,kBAAkB,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC;QACtE,kBAAkB,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,CAAC,CAAC;IACzE,CAAC;IAAA,CAAC;CACL;AA3SD,0DA2SC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview\n * Declaration of the PropertyTemplateWrapper module\n * PropertyTemplateWrapper is used to wrap a property template and perform internal optimizations\n */\nconst _ = require('lodash');\nconst { ContainerProperty } = require('./properties/containerProperty');\nconst { MSG } = require('@fluid-experimental/property-common').constants;\n\nconst reservedTypesWithoutTemplates = {\n 'BaseProperty': true,\n 'ContainerProperty': true,\n 'NodeProperty': true,\n 'Enum': true\n};\n/**\n * Utility function that validates if the typeid is a reserved type without a template.\n * @param {string} in_typeid The typeid to validate.\n * @return {boolean} True if the typeid is a reserved type without a template, false otherwise.\n */\nconst hasAssociatedTemplate = (in_typeid) => {\n return !reservedTypesWithoutTemplates[in_typeid];\n};\n\nexport class PropertyTemplateWrapper {\n\n /**\n * Constructor for creating a PropertyTemplateWrapper based on the given template.\n * @param {PropertyTemplate} in_remoteTemplate A property template\n * @param {string} in_scope The scope of the template\n *\n * @constructor\n * @package\n * @alias property-properties.PropertyTemplateWrapper\n * @category Properties\n */\n constructor(in_remoteTemplate, in_scope) {\n /** The property template this object is wrapping */\n this._propertyTemplate = in_remoteTemplate;\n\n /** A property template created from this.propertyTemplate with the addition of all information\n * from templates this template inherits from.\n */\n this._compiledPropertyTemplate = undefined;\n\n /* What type of base object is created for this template*/\n this._objectCreationType = undefined;\n\n /* The scope of this template*/\n this._scope = in_scope;\n };\n\n\n /**\n * To get the property template that this is wrapping.\n * @return {property-properties.PropertyTemplate} The template this wrapper contains\n * @package\n */\n getPropertyTemplate() {\n return this._propertyTemplate;\n };\n\n /**\n * Gets the compiled template or creates it then returns it.\n * @param {property-properties.PropertyFactory} in_propertyFactory The assosiated PropertyFactory.\n * @return {property-properties.PropertyTemplate} The compiled template\n * A compiled template is the template which is actually used for creating objects.\n * It has all information from parent Templates, and other changes.\n * @package\n */\n getCompiledTemplate(in_propertyFactory) {\n if (this._compiledPropertyTemplate === undefined) {\n this._compiledPropertyTemplate = this._contructCompiledTemplate(in_propertyFactory);\n }\n return this._compiledPropertyTemplate;\n };\n\n /**\n * Returns if the compiled template has been created.\n * @return {boolean} if the compiled template has been created\n * @package\n */\n hasCompiledTemplate() {\n return !!this._compiledPropertyTemplate;\n };\n\n /**\n * To get the creation type of the template this wraps.\n * @return {string} A typeid which represents the creation type of this template\n * @package\n */\n getCreationType() {\n return this._objectCreationType;\n };\n\n /**\n * If current creation type is undefined, sets it to in_typeid if in_typeid is a creation type.\n * If current creation type is defined, throws if in_typeid is a creation type.\n *\n * @param {string} in_typeid A typeid\n * @package\n */\n setCreationType(in_typeid) {\n // This function could be moved somewhere else, an enum could be made if this information is widely needed.\n const isCreationType = (typeid) => {\n const creationTypes =\n ['ContainerProperty', 'NodeProperty', 'Enum', 'BinaryProperty', 'Binary', 'RepositoryReferenceProperty'];\n return creationTypes.indexOf(typeid) !== -1;\n };\n\n if (isCreationType(in_typeid)) {\n const currentCreationType = this._objectCreationType;\n if (currentCreationType === undefined) {\n this._objectCreationType = in_typeid;\n } else if (currentCreationType !== in_typeid) {\n throw new Error(MSG.ONLY_ONE_CREATION_TYPE + currentCreationType + ', ' + in_typeid);\n }\n }\n };\n\n /**\n * Contructs the compiled template from the template this wraps\n * @param {property-properties.PropertyFactory} in_propertyFactory The associated PropertyFactory.\n * @return {property-properties.PropertyTemplate} The compiled template\n * A compiled template is the template which is actually used for creating objects.\n * It has all information from parent Templates, and other changes.\n * @package\n */\n _contructCompiledTemplate(in_propertyFactory) {\n const originalTemplate = this.getPropertyTemplate();\n\n this.setCreationType(originalTemplate.typeid);\n\n /* Because we treat templates and contructor functions for base types the same way :( */\n if (_.isFunction(originalTemplate)) {\n return originalTemplate;\n }\n\n let parentTemplateIds = originalTemplate.inherits;\n\n /* template.inherits can be a string, if so convert it to array of strings */\n if (typeof parentTemplateIds === 'string') {\n parentTemplateIds = [parentTemplateIds];\n }\n\n /* Cloning the original template to avoid modifying it */\n const template = originalTemplate.clone();\n\n /* Copy the proccesed list of parents to not modify the original */\n const typeInheritence = parentTemplateIds ? parentTemplateIds.slice() : [];\n\n /* Look ups to efficiently check what properties/constants parents have */\n const parentsPropertiesById = {};\n const parentsConstantsById = {};\n\n if (parentTemplateIds !== undefined) {\n for (let i = 0; i < parentTemplateIds.length; ++i) {\n const parentTemplateId = parentTemplateIds[i];\n this.setCreationType(parentTemplateId);\n\n if (hasAssociatedTemplate(parentTemplateId)) {\n const parentTemplateWrapper = in_propertyFactory._getWrapper(parentTemplateId, undefined, this._scope);\n if (parentTemplateWrapper) {\n const parentTemplate = parentTemplateWrapper.getCompiledTemplate(in_propertyFactory);\n const parentCreationType = parentTemplateWrapper.getCreationType();\n\n if (parentCreationType !== 'ContainerProperty') {\n this.setCreationType(parentCreationType);\n }\n\n if (parentTemplate.inherits) {\n typeInheritence.concat(parentTemplateId);\n }\n\n /* Fills parentsPropertiesById and makes sure there are no two properties or constants with the same id */\n if (parentTemplate.hasNestedProperties()) {\n const parentProperties = parentTemplate.properties;\n for (let j = 0; j < parentProperties.length; ++j) {\n const parentProperty = parentProperties[j];\n /* Two parents has child property with same id */\n if (parentsPropertiesById[parentProperty.id] || parentsConstantsById[parentProperty.id]) {\n throw new Error(MSG.OVERWRITING_ID + parentProperty.id);\n }\n parentsPropertiesById[parentProperty.id] = parentProperty;\n }\n }\n\n /* Fills parentsConsantsById and makes sure there are no two properties or constants with the same id */\n if (parentTemplate.hasNestedConstants()) {\n const parentConstants = parentTemplate.constants;\n for (let j = 0; j < parentConstants.length; ++j) {\n const parentConstant = parentConstants[j];\n /* Two parents has child property with same id */\n if (parentsConstantsById[parentConstant.id] || parentsPropertiesById[parentConstant.id]) {\n throw new Error(MSG.OVERWRITING_ID + parentConstant.id);\n }\n parentsConstantsById[parentConstant.id] = parentConstant;\n }\n }\n }\n }\n }\n }\n\n if (this._objectCreationType === undefined) {\n this.setCreationType('ContainerProperty');\n }\n\n /* Merges properties from parents into the properties of the child */\n const constructSubProperties = (in_template, in_parentsPropertiesById, fieldName) => {\n const propertyKeys = Object.keys(in_parentsPropertiesById);\n\n if (in_template[fieldName] === undefined && propertyKeys.length !== 0) {\n in_template[fieldName] = [];\n }\n\n const properties = in_template[fieldName] || [];\n\n for (let i = 0; i < properties.length; ++i) {\n const property = properties[i];\n const id = property.id;\n if (in_parentsPropertiesById[id]) {\n this._mergeProperty(property, in_parentsPropertiesById[id]);\n delete in_parentsPropertiesById[id];\n }\n }\n\n for (let i = 0; i < propertyKeys.length; ++i) {\n const insertProperty = in_parentsPropertiesById[propertyKeys[i]];\n if (insertProperty) {\n properties.push(insertProperty);\n }\n }\n\n if (properties.length > 0) {\n template[fieldName] = properties;\n }\n };\n\n constructSubProperties(template, parentsPropertiesById, 'properties');\n constructSubProperties(template, parentsConstantsById, 'constants');\n\n if (typeInheritence.length > 0) {\n template.inherits = typeInheritence;\n }\n\n return template;\n };\n\n /**\n * A helper function which merges a child and parent property.\n * The changes are applied directly to the in_childProperty.\n * @param {object} in_childProperty The child's property defition.\n * @param {object} in_parentProperty The parent's property defition.\n * @package\n */\n _mergeProperty(in_childProperty, in_parentProperty) {\n const mergeField = (child, parent, fieldName, defaultValue) => {\n if (child[fieldName] === undefined) {\n if (parent[fieldName] !== undefined) {\n child[fieldName] = parent[fieldName];\n }\n } else if (child[fieldName] !== parent[fieldName] &&\n (child[fieldName] !== defaultValue || parent[fieldName] !== undefined)) {\n throw new Error(MSG.OVERRIDEN_PROP_MUST_HAVE_SAME_FIELD_VALUES_AS_BASE_TYPE + fieldName +\n ' as the base type: ' + child.id + ': ' + child[fieldName] + ' != ' + parent[fieldName]);\n }\n };\n\n mergeField(in_childProperty, in_parentProperty, 'context', 'single');\n mergeField(in_childProperty, in_parentProperty, 'contextKeyType', 'string');\n mergeField(in_childProperty, in_parentProperty, 'length', 0);\n mergeField(in_childProperty, in_parentProperty, 'optional', false);\n mergeField(in_childProperty, in_parentProperty, 'typeid', undefined);\n\n if (in_parentProperty.typedValue !== undefined) {\n if (in_childProperty.typedValue === undefined) {\n in_childProperty.typedValue = in_parentProperty.typedValue;\n }\n }\n\n if (in_parentProperty.value !== undefined) {\n if (in_childProperty.value === undefined) {\n in_childProperty.value = in_parentProperty.value;\n }\n }\n\n const mergeSubProperties = (child, parent, fieldName) => {\n const parentPropertiesById = {};\n let parentProperties = parent[fieldName];\n let properties = child[fieldName] || [];\n if (parentProperties) {\n for (let j = 0; j < parentProperties.length; ++j) {\n const parentProperty = parentProperties[j];\n parentPropertiesById[parentProperty.id] = parentProperty;\n }\n\n for (let i = 0; i < properties.length; ++i) {\n const property = properties[i];\n const id = property.id;\n if (parentPropertiesById[id]) {\n this._mergeProperty(property, parentPropertiesById[id]);\n delete parentPropertiesById[id];\n }\n }\n\n const propertyKeys = Object.keys(parentPropertiesById);\n for (let i = 0; i < propertyKeys.length; ++i) {\n const insertProperty = parentPropertiesById[propertyKeys[i]];\n if (insertProperty) {\n properties.push(insertProperty);\n }\n }\n }\n\n if (properties.length > 0) {\n child[fieldName] = properties;\n }\n };\n\n mergeSubProperties(in_childProperty, in_parentProperty, 'properties');\n mergeSubProperties(in_childProperty, in_parentProperty, 'constants');\n };\n}\n"]}
1
+ {"version":3,"file":"propertyTemplateWrapper.js","sourceRoot":"","sources":["../src/propertyTemplateWrapper.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;GAIG;AACH,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC,qCAAqC,CAAC,CAAC,SAAS,CAAC;AACzE,MAAM,CAAC,GAAG,OAAO,CAAC,QAAQ,C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ChB,UAAU,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;qBACnC;iBACJ;aACJ;YAED,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;gBACvB,KAAK,CAAC,SAAS,CAAC,GAAG,UAAU,CAAC;aACjC;QACL,CAAC,CAAC;QAEF,kBAAkB,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC;QACtE,kBAAkB,CAAC,gBAAgB,EAAE,iBAAiB,EAAE,WAAW,CAAC,CAAC;IACzE,CAAC;CACJ;AAzSD,0DAySC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n/**\n * @fileoverview\n * Declaration of the PropertyTemplateWrapper module\n * PropertyTemplateWrapper is used to wrap a property template and perform internal optimizations\n */\nconst { MSG } = require('@fluid-experimental/property-common').constants;\nconst _ = require('lodash');\nconst { ContainerProperty } = require('./properties/containerProperty');\n\nconst reservedTypesWithoutTemplates = {\n 'BaseProperty': true,\n 'ContainerProperty': true,\n 'NodeProperty': true,\n 'Enum': true,\n};\n/**\n * Utility function that validates if the typeid is a reserved type without a template.\n * @param {string} in_typeid The typeid to validate.\n * @return {boolean} True if the typeid is a reserved type without a template, false otherwise.\n */\nconst hasAssociatedTemplate = (in_typeid) => {\n return !reservedTypesWithoutTemplates[in_typeid];\n};\n\nexport class PropertyTemplateWrapper {\n /**\n * Constructor for creating a PropertyTemplateWrapper based on the given template.\n * @param {PropertyTemplate} in_remoteTemplate A property template\n * @param {string} in_scope The scope of the template\n *\n * @constructor\n * @package\n * @alias property-properties.PropertyTemplateWrapper\n * @category Properties\n */\n constructor(in_remoteTemplate, in_scope) {\n /** The property template this object is wrapping */\n this._propertyTemplate = in_remoteTemplate;\n\n /** A property template created from this.propertyTemplate with the addition of all information\n * from templates this template inherits from.\n */\n this._compiledPropertyTemplate = undefined;\n\n /* What type of base object is created for this template */\n this._objectCreationType = undefined;\n\n /* The scope of this template */\n this._scope = in_scope;\n }\n\n /**\n * To get the property template that this is wrapping.\n * @return {property-properties.PropertyTemplate} The template this wrapper contains\n * @package\n */\n getPropertyTemplate() {\n return this._propertyTemplate;\n }\n\n /**\n * Gets the compiled template or creates it then returns it.\n * @param {property-properties.PropertyFactory} in_propertyFactory The assosiated PropertyFactory.\n * @return {property-properties.PropertyTemplate} The compiled template\n * A compiled template is the template which is actually used for creating objects.\n * It has all information from parent Templates, and other changes.\n * @package\n */\n getCompiledTemplate(in_propertyFactory) {\n if (this._compiledPropertyTemplate === undefined) {\n this._compiledPropertyTemplate = this._contructCompiledTemplate(in_propertyFactory);\n }\n return this._compiledPropertyTemplate;\n }\n\n /**\n * Returns if the compiled template has been created.\n * @return {boolean} if the compiled template has been created\n * @package\n */\n hasCompiledTemplate() {\n return !!this._compiledPropertyTemplate;\n }\n\n /**\n * To get the creation type of the template this wraps.\n * @return {string} A typeid which represents the creation type of this template\n * @package\n */\n getCreationType() {\n return this._objectCreationType;\n }\n\n /**\n * If current creation type is undefined, sets it to in_typeid if in_typeid is a creation type.\n * If current creation type is defined, throws if in_typeid is a creation type.\n *\n * @param {string} in_typeid A typeid\n * @package\n */\n setCreationType(in_typeid) {\n // This function could be moved somewhere else, an enum could be made if this information is widely needed.\n const isCreationType = (typeid) => {\n const creationTypes =\n ['ContainerProperty', 'NodeProperty', 'Enum', 'BinaryProperty', 'Binary', 'RepositoryReferenceProperty'];\n return creationTypes.indexOf(typeid) !== -1;\n };\n\n if (isCreationType(in_typeid)) {\n const currentCreationType = this._objectCreationType;\n if (currentCreationType === undefined) {\n this._objectCreationType = in_typeid;\n } else if (currentCreationType !== in_typeid) {\n throw new Error(MSG.ONLY_ONE_CREATION_TYPE + currentCreationType + ', ' + in_typeid);\n }\n }\n }\n\n /**\n * Contructs the compiled template from the template this wraps\n * @param {property-properties.PropertyFactory} in_propertyFactory The associated PropertyFactory.\n * @return {property-properties.PropertyTemplate} The compiled template\n * A compiled template is the template which is actually used for creating objects.\n * It has all information from parent Templates, and other changes.\n * @package\n */\n _contructCompiledTemplate(in_propertyFactory) {\n const originalTemplate = this.getPropertyTemplate();\n\n this.setCreationType(originalTemplate.typeid);\n\n /* Because we treat templates and contructor functions for base types the same way :( */\n if (_.isFunction(originalTemplate)) {\n return originalTemplate;\n }\n\n let parentTemplateIds = originalTemplate.inherits;\n\n /* template.inherits can be a string, if so convert it to array of strings */\n if (typeof parentTemplateIds === 'string') {\n parentTemplateIds = [parentTemplateIds];\n }\n\n /* Cloning the original template to avoid modifying it */\n const template = originalTemplate.clone();\n\n /* Copy the proccesed list of parents to not modify the original */\n const typeInheritence = parentTemplateIds ? parentTemplateIds.slice() : [];\n\n /* Look ups to efficiently check what properties/constants parents have */\n const parentsPropertiesById = {};\n const parentsConstantsById = {};\n\n if (parentTemplateIds !== undefined) {\n for (let i = 0; i < parentTemplateIds.length; ++i) {\n const parentTemplateId = parentTemplateIds[i];\n this.setCreationType(parentTemplateId);\n\n if (hasAssociatedTemplate(parentTemplateId)) {\n const parentTemplateWrapper = in_propertyFactory._getWrapper(parentTemplateId, undefined, this._scope);\n if (parentTemplateWrapper) {\n const parentTemplate = parentTemplateWrapper.getCompiledTemplate(in_propertyFactory);\n const parentCreationType = parentTemplateWrapper.getCreationType();\n\n if (parentCreationType !== 'ContainerProperty') {\n this.setCreationType(parentCreationType);\n }\n\n if (parentTemplate.inherits) {\n typeInheritence.concat(parentTemplateId);\n }\n\n /* Fills parentsPropertiesById and makes sure there are no two properties or constants with the same id */\n if (parentTemplate.hasNestedProperties()) {\n const parentProperties = parentTemplate.properties;\n for (let j = 0; j < parentProperties.length; ++j) {\n const parentProperty = parentProperties[j];\n /* Two parents has child property with same id */\n if (parentsPropertiesById[parentProperty.id] || parentsConstantsById[parentProperty.id]) {\n throw new Error(MSG.OVERWRITING_ID + parentProperty.id);\n }\n parentsPropertiesById[parentProperty.id] = parentProperty;\n }\n }\n\n /* Fills parentsConsantsById and makes sure there are no two properties or constants with the same id */\n if (parentTemplate.hasNestedConstants()) {\n const parentConstants = parentTemplate.constants;\n for (let j = 0; j < parentConstants.length; ++j) {\n const parentConstant = parentConstants[j];\n /* Two parents has child property with same id */\n if (parentsConstantsById[parentConstant.id] || parentsPropertiesById[parentConstant.id]) {\n throw new Error(MSG.OVERWRITING_ID + parentConstant.id);\n }\n parentsConstantsById[parentConstant.id] = parentConstant;\n }\n }\n }\n }\n }\n }\n\n if (this._objectCreationType === undefined) {\n this.setCreationType('ContainerProperty');\n }\n\n /* Merges properties from parents into the properties of the child */\n const constructSubProperties = (in_template, in_parentsPropertiesById, fieldName) => {\n const propertyKeys = Object.keys(in_parentsPropertiesById);\n\n if (in_template[fieldName] === undefined && propertyKeys.length !== 0) {\n in_template[fieldName] = [];\n }\n\n const properties = in_template[fieldName] || [];\n\n for (let i = 0; i < properties.length; ++i) {\n const property = properties[i];\n const id = property.id;\n if (in_parentsPropertiesById[id]) {\n this._mergeProperty(property, in_parentsPropertiesById[id]);\n delete in_parentsPropertiesById[id];\n }\n }\n\n for (let i = 0; i < propertyKeys.length; ++i) {\n const insertProperty = in_parentsPropertiesById[propertyKeys[i]];\n if (insertProperty) {\n properties.push(insertProperty);\n }\n }\n\n if (properties.length > 0) {\n template[fieldName] = properties;\n }\n };\n\n constructSubProperties(template, parentsPropertiesById, 'properties');\n constructSubProperties(template, parentsConstantsById, 'constants');\n\n if (typeInheritence.length > 0) {\n template.inherits = typeInheritence;\n }\n\n return template;\n }\n\n /**\n * A helper function which merges a child and parent property.\n * The changes are applied directly to the in_childProperty.\n * @param {object} in_childProperty The child's property defition.\n * @param {object} in_parentProperty The parent's property defition.\n * @package\n */\n _mergeProperty(in_childProperty, in_parentProperty) {\n const mergeField = (child, parent, fieldName, defaultValue) => {\n if (child[fieldName] === undefined) {\n if (parent[fieldName] !== undefined) {\n child[fieldName] = parent[fieldName];\n }\n } else if (child[fieldName] !== parent[fieldName] &&\n (child[fieldName] !== defaultValue || parent[fieldName] !== undefined)) {\n throw new Error(MSG.OVERRIDEN_PROP_MUST_HAVE_SAME_FIELD_VALUES_AS_BASE_TYPE + fieldName +\n ' as the base type: ' + child.id + ': ' + child[fieldName] + ' != ' + parent[fieldName]);\n }\n };\n\n mergeField(in_childProperty, in_parentProperty, 'context', 'single');\n mergeField(in_childProperty, in_parentProperty, 'contextKeyType', 'string');\n mergeField(in_childProperty, in_parentProperty, 'length', 0);\n mergeField(in_childProperty, in_parentProperty, 'optional', false);\n mergeField(in_childProperty, in_parentProperty, 'typeid', undefined);\n\n if (in_parentProperty.typedValue !== undefined) {\n if (in_childProperty.typedValue === undefined) {\n in_childProperty.typedValue = in_parentProperty.typedValue;\n }\n }\n\n if (in_parentProperty.value !== undefined) {\n if (in_childProperty.value === undefined) {\n in_childProperty.value = in_parentProperty.value;\n }\n }\n\n const mergeSubProperties = (child, parent, fieldName) => {\n const parentPropertiesById = {};\n let parentProperties = parent[fieldName];\n let properties = child[fieldName] || [];\n if (parentProperties) {\n for (let j = 0; j < parentProperties.length; ++j) {\n const parentProperty = parentProperties[j];\n parentPropertiesById[parentProperty.id] = parentProperty;\n }\n\n for (let i = 0; i < properties.length; ++i) {\n const property = properties[i];\n const id = property.id;\n if (parentPropertiesById[id]) {\n this._mergeProperty(property, parentPropertiesById[id]);\n delete parentPropertiesById[id];\n }\n }\n\n const propertyKeys = Object.keys(parentPropertiesById);\n for (let i = 0; i < propertyKeys.length; ++i) {\n const insertProperty = parentPropertiesById[propertyKeys[i]];\n if (insertProperty) {\n properties.push(insertProperty);\n }\n }\n }\n\n if (properties.length > 0) {\n child[fieldName] = properties;\n }\n };\n\n mergeSubProperties(in_childProperty, in_parentProperty, 'properties');\n mergeSubProperties(in_childProperty, in_parentProperty, 'constants');\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"propertyUtils.d.ts","sourceRoot":"","sources":["../src/propertyUtils.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;IAEI;;;;;;OAMG;IACH,2EAHY,UAAe,CAYzB;CAEL"}
1
+ {"version":3,"file":"propertyUtils.d.ts","sourceRoot":"","sources":["../src/propertyUtils.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;IACI;;;;;;OAMG;IACH,2EAHY,UAAe,CAYzB;CACL"}
@@ -1 +1 @@
1
- {"version":3,"file":"propertyUtils.js","sourceRoot":"","sources":["../src/propertyUtils.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,MAAa,aAAa;;AAA1B,sCAoBC;AAlBG;;;;;;GAMG;AACI,8BAAgB,GAAG,UAAU,eAAe,EAAE,YAAY;IAC7D,IAAI,kBAAkB,GAAG,EAAE,CAAC;IAC5B,eAAe,CAAC,YAAY,CAAC,UAAU,QAAQ,EAAE,IAAI;QACjD,IAAI,YAAY,CAAC,QAAQ,CAAC,EAAE;YACxB,kBAAkB,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;SACvC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,kBAAkB,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport class PropertyUtils {\n\n /**\n * Gather all properties that pass an arbitrary predicate function\n * @param {property-properties.NodeProperty} in_rootProperty The root property to traverse from\n * @param {function} in_predicate The predicate function\n * @return {Array.<property-properties.BasePropertyy>} The list of properties that passed the predicate\n * function\n */\n static gatherProperties = function (in_rootProperty, in_predicate) {\n var gatheredProperties = {};\n in_rootProperty.traverseDown(function (property, path) {\n if (in_predicate(property)) {\n gatheredProperties[path] = property;\n }\n });\n\n return gatheredProperties;\n };\n\n}\n"]}
1
+ {"version":3,"file":"propertyUtils.js","sourceRoot":"","sources":["../src/propertyUtils.js"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,MAAa,aAAa;;AAA1B,sCAkBC;AAjBG;;;;;;GAMG;AACI,8BAAgB,GAAG,UAAS,eAAe,EAAE,YAAY;IAC5D,IAAI,kBAAkB,GAAG,EAAE,CAAC;IAC5B,eAAe,CAAC,YAAY,CAAC,UAAS,QAAQ,EAAE,IAAI;QAChD,IAAI,YAAY,CAAC,QAAQ,CAAC,EAAE;YACxB,kBAAkB,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC;SACvC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,kBAAkB,CAAC;AAC9B,CAAC,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport class PropertyUtils {\n /**\n * Gather all properties that pass an arbitrary predicate function\n * @param {property-properties.NodeProperty} in_rootProperty The root property to traverse from\n * @param {function} in_predicate The predicate function\n * @return {Array.<property-properties.BasePropertyy>} The list of properties that passed the predicate\n * function\n */\n static gatherProperties = function(in_rootProperty, in_predicate) {\n var gatheredProperties = {};\n in_rootProperty.traverseDown(function(property, path) {\n if (in_predicate(property)) {\n gatheredProperties[path] = property;\n }\n });\n\n return gatheredProperties;\n };\n}\n"]}