@fluid-experimental/property-properties 2.0.0-internal.3.0.2 → 2.0.0-internal.3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (266) hide show
  1. package/README.md +1 -0
  2. package/dist/containerSerializer.d.ts.map +1 -1
  3. package/dist/containerSerializer.js +5 -5
  4. package/dist/containerSerializer.js.map +1 -1
  5. package/dist/enableValidations.js.map +1 -1
  6. package/dist/index.d.ts +19 -19
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js.map +1 -1
  9. package/dist/properties/abstractStaticCollectionProperty.d.ts +10 -10
  10. package/dist/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
  11. package/dist/properties/abstractStaticCollectionProperty.js +70 -53
  12. package/dist/properties/abstractStaticCollectionProperty.js.map +1 -1
  13. package/dist/properties/arrayProperty.d.ts.map +1 -1
  14. package/dist/properties/arrayProperty.js +152 -103
  15. package/dist/properties/arrayProperty.js.map +1 -1
  16. package/dist/properties/baseProperty.d.ts +4 -4
  17. package/dist/properties/baseProperty.d.ts.map +1 -1
  18. package/dist/properties/baseProperty.js +69 -47
  19. package/dist/properties/baseProperty.js.map +1 -1
  20. package/dist/properties/boolProperty.d.ts.map +1 -1
  21. package/dist/properties/boolProperty.js +3 -3
  22. package/dist/properties/boolProperty.js.map +1 -1
  23. package/dist/properties/containerProperty.d.ts +8 -8
  24. package/dist/properties/containerProperty.d.ts.map +1 -1
  25. package/dist/properties/containerProperty.js +33 -26
  26. package/dist/properties/containerProperty.js.map +1 -1
  27. package/dist/properties/enumArrayProperty.d.ts.map +1 -1
  28. package/dist/properties/enumArrayProperty.js +14 -14
  29. package/dist/properties/enumArrayProperty.js.map +1 -1
  30. package/dist/properties/enumProperty.d.ts.map +1 -1
  31. package/dist/properties/enumProperty.js +17 -17
  32. package/dist/properties/enumProperty.js.map +1 -1
  33. package/dist/properties/floatProperties.js +4 -4
  34. package/dist/properties/floatProperties.js.map +1 -1
  35. package/dist/properties/index.d.ts +23 -23
  36. package/dist/properties/index.d.ts.map +1 -1
  37. package/dist/properties/index.js.map +1 -1
  38. package/dist/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
  39. package/dist/properties/indexedCollectionBaseProperty.js +47 -37
  40. package/dist/properties/indexedCollectionBaseProperty.js.map +1 -1
  41. package/dist/properties/intProperties.d.ts.map +1 -1
  42. package/dist/properties/intProperties.js +10 -10
  43. package/dist/properties/intProperties.js.map +1 -1
  44. package/dist/properties/lazyLoadedProperties.js.map +1 -1
  45. package/dist/properties/mapProperty.d.ts.map +1 -1
  46. package/dist/properties/mapProperty.js +21 -17
  47. package/dist/properties/mapProperty.js.map +1 -1
  48. package/dist/properties/namedNodeProperty.d.ts.map +1 -1
  49. package/dist/properties/namedNodeProperty.js +3 -3
  50. package/dist/properties/namedNodeProperty.js.map +1 -1
  51. package/dist/properties/namedProperty.d.ts.map +1 -1
  52. package/dist/properties/namedProperty.js +7 -5
  53. package/dist/properties/namedProperty.js.map +1 -1
  54. package/dist/properties/nodeProperty.d.ts.map +1 -1
  55. package/dist/properties/nodeProperty.js +5 -3
  56. package/dist/properties/nodeProperty.js.map +1 -1
  57. package/dist/properties/primitiveTypeCasts.d.ts.map +1 -1
  58. package/dist/properties/primitiveTypeCasts.js +9 -9
  59. package/dist/properties/primitiveTypeCasts.js.map +1 -1
  60. package/dist/properties/referenceArrayProperty.d.ts.map +1 -1
  61. package/dist/properties/referenceArrayProperty.js +31 -25
  62. package/dist/properties/referenceArrayProperty.js.map +1 -1
  63. package/dist/properties/referenceMapProperty.d.ts.map +1 -1
  64. package/dist/properties/referenceMapProperty.js +18 -18
  65. package/dist/properties/referenceMapProperty.js.map +1 -1
  66. package/dist/properties/referenceProperty.d.ts.map +1 -1
  67. package/dist/properties/referenceProperty.js +33 -29
  68. package/dist/properties/referenceProperty.js.map +1 -1
  69. package/dist/properties/setProperty.d.ts.map +1 -1
  70. package/dist/properties/setProperty.js +31 -29
  71. package/dist/properties/setProperty.js.map +1 -1
  72. package/dist/properties/stringProperty.d.ts.map +1 -1
  73. package/dist/properties/stringProperty.js +56 -40
  74. package/dist/properties/stringProperty.js.map +1 -1
  75. package/dist/properties/uintProperties.js +5 -5
  76. package/dist/properties/uintProperties.js.map +1 -1
  77. package/dist/properties/valueArrayProperty.d.ts +1 -1
  78. package/dist/properties/valueArrayProperty.d.ts.map +1 -1
  79. package/dist/properties/valueArrayProperty.js +30 -29
  80. package/dist/properties/valueArrayProperty.js.map +1 -1
  81. package/dist/properties/valueMapProperty.d.ts.map +1 -1
  82. package/dist/properties/valueMapProperty.js +31 -29
  83. package/dist/properties/valueMapProperty.js.map +1 -1
  84. package/dist/properties/valueProperty.d.ts.map +1 -1
  85. package/dist/properties/valueProperty.js +11 -9
  86. package/dist/properties/valueProperty.js.map +1 -1
  87. package/dist/propertyFactory.d.ts.map +1 -1
  88. package/dist/propertyFactory.js +309 -252
  89. package/dist/propertyFactory.js.map +1 -1
  90. package/dist/propertyTemplate.d.ts +17 -17
  91. package/dist/propertyTemplate.d.ts.map +1 -1
  92. package/dist/propertyTemplate.js +64 -45
  93. package/dist/propertyTemplate.js.map +1 -1
  94. package/dist/propertyTemplateWrapper.d.ts.map +1 -1
  95. package/dist/propertyTemplateWrapper.js +40 -25
  96. package/dist/propertyTemplateWrapper.js.map +1 -1
  97. package/dist/propertyUtils.d.ts.map +1 -1
  98. package/dist/propertyUtils.js.map +1 -1
  99. package/dist/test/properties/arrayProperty.spec.js +566 -490
  100. package/dist/test/properties/arrayProperty.spec.js.map +1 -1
  101. package/dist/test/properties/baseProperty.spec.js +293 -280
  102. package/dist/test/properties/baseProperty.spec.js.map +1 -1
  103. package/dist/test/properties/containerProperty.spec.js +100 -94
  104. package/dist/test/properties/containerProperty.spec.js.map +1 -1
  105. package/dist/test/properties/customArrayProperty.spec.js +174 -147
  106. package/dist/test/properties/customArrayProperty.spec.js.map +1 -1
  107. package/dist/test/properties/enumArrayProperty.spec.js +67 -63
  108. package/dist/test/properties/enumArrayProperty.spec.js.map +1 -1
  109. package/dist/test/properties/enumProperty.spec.js +115 -97
  110. package/dist/test/properties/enumProperty.spec.js.map +1 -1
  111. package/dist/test/properties/float32.spec.js +5 -5
  112. package/dist/test/properties/float32.spec.js.map +1 -1
  113. package/dist/test/properties/int64ArrayProperty.spec.js +157 -93
  114. package/dist/test/properties/int64ArrayProperty.spec.js.map +1 -1
  115. package/dist/test/properties/int64MapProperty.spec.js +185 -166
  116. package/dist/test/properties/int64MapProperty.spec.js.map +1 -1
  117. package/dist/test/properties/int64Property.spec.js +109 -109
  118. package/dist/test/properties/int64Property.spec.js.map +1 -1
  119. package/dist/test/properties/isLeafNode.spec.js +75 -76
  120. package/dist/test/properties/isLeafNode.spec.js.map +1 -1
  121. package/dist/test/properties/mapProperty.spec.js +571 -531
  122. package/dist/test/properties/mapProperty.spec.js.map +1 -1
  123. package/dist/test/properties/namedNodeProperty.spec.js +31 -31
  124. package/dist/test/properties/namedNodeProperty.spec.js.map +1 -1
  125. package/dist/test/properties/nodeProperty.spec.js +805 -795
  126. package/dist/test/properties/nodeProperty.spec.js.map +1 -1
  127. package/dist/test/properties/referenceProperty.spec.js +729 -679
  128. package/dist/test/properties/referenceProperty.spec.js.map +1 -1
  129. package/dist/test/properties/relationshipProperty.spec.js +16 -16
  130. package/dist/test/properties/relationshipProperty.spec.js.map +1 -1
  131. package/dist/test/properties/setProperty.spec.js +288 -227
  132. package/dist/test/properties/setProperty.spec.js.map +1 -1
  133. package/dist/test/properties/stringProperty.spec.js +326 -318
  134. package/dist/test/properties/stringProperty.spec.js.map +1 -1
  135. package/dist/test/properties/uint64Property.spec.js +46 -36
  136. package/dist/test/properties/uint64Property.spec.js.map +1 -1
  137. package/dist/test/properties/valueMapProperty.spec.js +259 -246
  138. package/dist/test/properties/valueMapProperty.spec.js.map +1 -1
  139. package/dist/test/properties/valueProperty.spec.js +49 -43
  140. package/dist/test/properties/valueProperty.spec.js.map +1 -1
  141. package/dist/test/propertyFactory.spec.js +2038 -1631
  142. package/dist/test/propertyFactory.spec.js.map +1 -1
  143. package/dist/test/propertyTemplateWrapper.spec.js +72 -102
  144. package/dist/test/propertyTemplateWrapper.spec.js.map +1 -1
  145. package/dist/test/propertyUtils.spec.js +22 -21
  146. package/dist/test/propertyUtils.spec.js.map +1 -1
  147. package/dist/test/reversibleChangeset.spec.js +857 -703
  148. package/dist/test/reversibleChangeset.spec.js.map +1 -1
  149. package/dist/test/setup.js +5 -5
  150. package/dist/test/setup.js.map +1 -1
  151. package/dist/test/tsconfig.tsbuildinfo +1 -1
  152. package/dist/test/utils.spec.js +1334 -1144
  153. package/dist/test/utils.spec.js.map +1 -1
  154. package/dist/test/validation/badMissingSemverInTypeid.js +20 -20
  155. package/dist/test/validation/badMissingSemverInTypeid.js.map +1 -1
  156. package/dist/test/validation/badPrimitiveTypeid.js +12 -12
  157. package/dist/test/validation/badPrimitiveTypeid.js.map +1 -1
  158. package/dist/test/validation/goodColorId.js +91 -91
  159. package/dist/test/validation/goodColorId.js.map +1 -1
  160. package/dist/test/validation/goodColorPalette.js +4 -4
  161. package/dist/test/validation/goodColorPalette.js.map +1 -1
  162. package/dist/test/validation/goodPointId.js +20 -20
  163. package/dist/test/validation/goodPointId.js.map +1 -1
  164. package/dist/test/validation/reversibleChangeSetTestData.js +23841 -2
  165. package/dist/test/validation/reversibleChangeSetTestData.js.map +1 -1
  166. package/lib/containerSerializer.d.ts.map +1 -1
  167. package/lib/containerSerializer.js +5 -5
  168. package/lib/containerSerializer.js.map +1 -1
  169. package/lib/enableValidations.js.map +1 -1
  170. package/lib/index.d.ts +19 -19
  171. package/lib/index.d.ts.map +1 -1
  172. package/lib/index.js +19 -19
  173. package/lib/index.js.map +1 -1
  174. package/lib/properties/abstractStaticCollectionProperty.d.ts +10 -10
  175. package/lib/properties/abstractStaticCollectionProperty.d.ts.map +1 -1
  176. package/lib/properties/abstractStaticCollectionProperty.js +70 -53
  177. package/lib/properties/abstractStaticCollectionProperty.js.map +1 -1
  178. package/lib/properties/arrayProperty.d.ts.map +1 -1
  179. package/lib/properties/arrayProperty.js +152 -103
  180. package/lib/properties/arrayProperty.js.map +1 -1
  181. package/lib/properties/baseProperty.d.ts +4 -4
  182. package/lib/properties/baseProperty.d.ts.map +1 -1
  183. package/lib/properties/baseProperty.js +73 -51
  184. package/lib/properties/baseProperty.js.map +1 -1
  185. package/lib/properties/boolProperty.d.ts.map +1 -1
  186. package/lib/properties/boolProperty.js +3 -3
  187. package/lib/properties/boolProperty.js.map +1 -1
  188. package/lib/properties/containerProperty.d.ts +8 -8
  189. package/lib/properties/containerProperty.d.ts.map +1 -1
  190. package/lib/properties/containerProperty.js +33 -26
  191. package/lib/properties/containerProperty.js.map +1 -1
  192. package/lib/properties/enumArrayProperty.d.ts.map +1 -1
  193. package/lib/properties/enumArrayProperty.js +14 -14
  194. package/lib/properties/enumArrayProperty.js.map +1 -1
  195. package/lib/properties/enumProperty.d.ts.map +1 -1
  196. package/lib/properties/enumProperty.js +17 -17
  197. package/lib/properties/enumProperty.js.map +1 -1
  198. package/lib/properties/floatProperties.js +4 -4
  199. package/lib/properties/floatProperties.js.map +1 -1
  200. package/lib/properties/index.d.ts +23 -23
  201. package/lib/properties/index.d.ts.map +1 -1
  202. package/lib/properties/index.js +23 -23
  203. package/lib/properties/index.js.map +1 -1
  204. package/lib/properties/indexedCollectionBaseProperty.d.ts.map +1 -1
  205. package/lib/properties/indexedCollectionBaseProperty.js +47 -37
  206. package/lib/properties/indexedCollectionBaseProperty.js.map +1 -1
  207. package/lib/properties/intProperties.d.ts.map +1 -1
  208. package/lib/properties/intProperties.js +10 -10
  209. package/lib/properties/intProperties.js.map +1 -1
  210. package/lib/properties/lazyLoadedProperties.js.map +1 -1
  211. package/lib/properties/mapProperty.d.ts.map +1 -1
  212. package/lib/properties/mapProperty.js +21 -17
  213. package/lib/properties/mapProperty.js.map +1 -1
  214. package/lib/properties/namedNodeProperty.d.ts.map +1 -1
  215. package/lib/properties/namedNodeProperty.js +3 -3
  216. package/lib/properties/namedNodeProperty.js.map +1 -1
  217. package/lib/properties/namedProperty.d.ts.map +1 -1
  218. package/lib/properties/namedProperty.js +7 -5
  219. package/lib/properties/namedProperty.js.map +1 -1
  220. package/lib/properties/nodeProperty.d.ts.map +1 -1
  221. package/lib/properties/nodeProperty.js +5 -3
  222. package/lib/properties/nodeProperty.js.map +1 -1
  223. package/lib/properties/primitiveTypeCasts.d.ts.map +1 -1
  224. package/lib/properties/primitiveTypeCasts.js +9 -9
  225. package/lib/properties/primitiveTypeCasts.js.map +1 -1
  226. package/lib/properties/referenceArrayProperty.d.ts.map +1 -1
  227. package/lib/properties/referenceArrayProperty.js +31 -25
  228. package/lib/properties/referenceArrayProperty.js.map +1 -1
  229. package/lib/properties/referenceMapProperty.d.ts.map +1 -1
  230. package/lib/properties/referenceMapProperty.js +18 -18
  231. package/lib/properties/referenceMapProperty.js.map +1 -1
  232. package/lib/properties/referenceProperty.d.ts.map +1 -1
  233. package/lib/properties/referenceProperty.js +33 -29
  234. package/lib/properties/referenceProperty.js.map +1 -1
  235. package/lib/properties/setProperty.d.ts.map +1 -1
  236. package/lib/properties/setProperty.js +31 -29
  237. package/lib/properties/setProperty.js.map +1 -1
  238. package/lib/properties/stringProperty.d.ts.map +1 -1
  239. package/lib/properties/stringProperty.js +56 -40
  240. package/lib/properties/stringProperty.js.map +1 -1
  241. package/lib/properties/uintProperties.js +5 -5
  242. package/lib/properties/uintProperties.js.map +1 -1
  243. package/lib/properties/valueArrayProperty.d.ts +1 -1
  244. package/lib/properties/valueArrayProperty.d.ts.map +1 -1
  245. package/lib/properties/valueArrayProperty.js +30 -29
  246. package/lib/properties/valueArrayProperty.js.map +1 -1
  247. package/lib/properties/valueMapProperty.d.ts.map +1 -1
  248. package/lib/properties/valueMapProperty.js +31 -29
  249. package/lib/properties/valueMapProperty.js.map +1 -1
  250. package/lib/properties/valueProperty.d.ts.map +1 -1
  251. package/lib/properties/valueProperty.js +11 -9
  252. package/lib/properties/valueProperty.js.map +1 -1
  253. package/lib/propertyFactory.d.ts.map +1 -1
  254. package/lib/propertyFactory.js +309 -252
  255. package/lib/propertyFactory.js.map +1 -1
  256. package/lib/propertyTemplate.d.ts +17 -17
  257. package/lib/propertyTemplate.d.ts.map +1 -1
  258. package/lib/propertyTemplate.js +64 -45
  259. package/lib/propertyTemplate.js.map +1 -1
  260. package/lib/propertyTemplateWrapper.d.ts.map +1 -1
  261. package/lib/propertyTemplateWrapper.js +40 -25
  262. package/lib/propertyTemplateWrapper.js.map +1 -1
  263. package/lib/propertyUtils.d.ts.map +1 -1
  264. package/lib/propertyUtils.js.map +1 -1
  265. package/package.json +28 -28
  266. package/src/index.d.ts +2750 -2681
@@ -9,44 +9,44 @@ exports.PropertyFactory = void 0;
9
9
  * @fileoverview Declaration of the PropertyFactory class.
10
10
  * Responsible for creating property sets and registering property templates
11
11
  */
12
- const _ = require('lodash');
13
- const fastestJSONCopy = require('fastest-json-copy');
12
+ const _ = require("lodash");
13
+ const fastestJSONCopy = require("fastest-json-copy");
14
14
  const deepCopy = fastestJSONCopy.copy;
15
- const { Collection, ConsoleUtils, EventEmitter, SortedCollection, constants, GuidUtils, } = require('@fluid-experimental/property-common');
15
+ const { Collection, ConsoleUtils, EventEmitter, SortedCollection, constants, GuidUtils, } = require("@fluid-experimental/property-common");
16
16
  const { MSG } = constants;
17
- const { TypeIdHelper, TemplateValidator, PathHelper, ChangeSet, } = require('@fluid-experimental/property-changeset');
18
- const semver = require('semver');
19
- const async = require('async');
20
- const { PropertyTemplate } = require('./propertyTemplate');
21
- const { PropertyTemplateWrapper } = require('./propertyTemplateWrapper');
17
+ const { TypeIdHelper, TemplateValidator, PathHelper, ChangeSet, } = require("@fluid-experimental/property-changeset");
18
+ const semver = require("semver");
19
+ const async = require("async");
20
+ const { PropertyTemplate } = require("./propertyTemplate");
21
+ const { PropertyTemplateWrapper } = require("./propertyTemplateWrapper");
22
22
  // Include the property classes
23
- const { BaseProperty } = require('./properties/baseProperty');
24
- const { NamedProperty } = require('./properties/namedProperty');
25
- const { NodeProperty } = require('./properties/nodeProperty');
26
- const { NamedNodeProperty } = require('./properties/namedNodeProperty');
27
- const { ContainerProperty } = require('./properties/containerProperty');
28
- const { ValueProperty } = require('./properties/valueProperty');
23
+ const { BaseProperty } = require("./properties/baseProperty");
24
+ const { NamedProperty } = require("./properties/namedProperty");
25
+ const { NodeProperty } = require("./properties/nodeProperty");
26
+ const { NamedNodeProperty } = require("./properties/namedNodeProperty");
27
+ const { ContainerProperty } = require("./properties/containerProperty");
28
+ const { ValueProperty } = require("./properties/valueProperty");
29
29
  // Include all primitive properties –- will register at the end.
30
- const { Uint8Property, Uint16Property, Uint32Property, } = require('./properties/uintProperties');
31
- const { Float32Property, Float64Property, } = require('./properties/floatProperties');
32
- const { Int8Property, Int16Property, Int32Property, Int64Property, Uint64Property, } = require('./properties/intProperties');
33
- const { StringProperty } = require('./properties/stringProperty');
34
- const { BoolProperty } = require('./properties/boolProperty');
35
- const { ReferenceProperty } = require('./properties/referenceProperty');
36
- const { EnumProperty } = require('./properties/enumProperty');
30
+ const { Uint8Property, Uint16Property, Uint32Property } = require("./properties/uintProperties");
31
+ const { Float32Property, Float64Property } = require("./properties/floatProperties");
32
+ const { Int8Property, Int16Property, Int32Property, Int64Property, Uint64Property, } = require("./properties/intProperties");
33
+ const { StringProperty } = require("./properties/stringProperty");
34
+ const { BoolProperty } = require("./properties/boolProperty");
35
+ const { ReferenceProperty } = require("./properties/referenceProperty");
36
+ const { EnumProperty } = require("./properties/enumProperty");
37
37
  // Include collection properties
38
- const { ArrayProperty } = require('./properties/arrayProperty');
39
- const { SetProperty } = require('./properties/setProperty');
40
- const { MapProperty } = require('./properties/mapProperty');
41
- const { ValueMapProperty } = require('./properties/valueMapProperty');
42
- const { IndexedCollectionBaseProperty } = require('./properties/indexedCollectionBaseProperty');
43
- const { AbstractStaticCollectionProperty } = require('./properties/abstractStaticCollectionProperty');
44
- const { Float32ArrayProperty, Float64ArrayProperty, Uint32ArrayProperty, Int32ArrayProperty, Uint64ArrayProperty, Int64ArrayProperty, Uint16ArrayProperty, Int16ArrayProperty, Uint8ArrayProperty, Int8ArrayProperty, StringArrayProperty, BoolArrayProperty, } = require('./properties/valueArrayProperty');
45
- const { ReferenceMapProperty } = require('./properties/referenceMapProperty');
46
- const { ReferenceArrayProperty } = require('./properties/referenceArrayProperty');
47
- const { EnumArrayProperty } = require('./properties/enumArrayProperty');
48
- const { Float64MapProperty, Float32MapProperty, Uint32MapProperty, Uint64MapProperty, Uint16MapProperty, Uint8MapProperty, Int32MapProperty, Int64MapProperty, Int16MapProperty, Int8MapProperty, StringMapProperty, BoolMapProperty, } = require('./properties/valueMapProperty');
49
- const { LazyLoadedProperties } = require('./properties/lazyLoadedProperties');
38
+ const { ArrayProperty } = require("./properties/arrayProperty");
39
+ const { SetProperty } = require("./properties/setProperty");
40
+ const { MapProperty } = require("./properties/mapProperty");
41
+ const { ValueMapProperty } = require("./properties/valueMapProperty");
42
+ const { IndexedCollectionBaseProperty } = require("./properties/indexedCollectionBaseProperty");
43
+ const { AbstractStaticCollectionProperty, } = require("./properties/abstractStaticCollectionProperty");
44
+ const { Float32ArrayProperty, Float64ArrayProperty, Uint32ArrayProperty, Int32ArrayProperty, Uint64ArrayProperty, Int64ArrayProperty, Uint16ArrayProperty, Int16ArrayProperty, Uint8ArrayProperty, Int8ArrayProperty, StringArrayProperty, BoolArrayProperty, } = require("./properties/valueArrayProperty");
45
+ const { ReferenceMapProperty } = require("./properties/referenceMapProperty");
46
+ const { ReferenceArrayProperty } = require("./properties/referenceArrayProperty");
47
+ const { EnumArrayProperty } = require("./properties/enumArrayProperty");
48
+ const { Float64MapProperty, Float32MapProperty, Uint32MapProperty, Uint64MapProperty, Uint16MapProperty, Uint8MapProperty, Int32MapProperty, Int64MapProperty, Int16MapProperty, Int8MapProperty, StringMapProperty, BoolMapProperty, } = require("./properties/valueMapProperty");
49
+ const { LazyLoadedProperties } = require("./properties/lazyLoadedProperties");
50
50
  /**
51
51
  * Creates an instance of the TemplateValidator
52
52
  *
@@ -100,7 +100,9 @@ var registerLocal = function (in_template) {
100
100
  var serializedInTemplate = in_template.serializeCanonical();
101
101
  var localValidationResults = { isValid: true };
102
102
  if (this._localPrimitivePropertiesAndTemplates.has(typeid)) {
103
- var localRegisteredTemplate = this._localPrimitivePropertiesAndTemplates.item(typeid).getPropertyTemplate();
103
+ var localRegisteredTemplate = this._localPrimitivePropertiesAndTemplates
104
+ .item(typeid)
105
+ .getPropertyTemplate();
104
106
  localValidationResults = templateValidator.validate(localRegisteredTemplate.serializeCanonical(), serializedInTemplate);
105
107
  }
106
108
  if (localValidationResults.isValid) {
@@ -113,12 +115,16 @@ var registerLocal = function (in_template) {
113
115
  }
114
116
  }
115
117
  if (!localValidationResults.isValid) {
116
- throw new Error(MSG.TEMPLATE_MISMATCH + typeid +
117
- '\n errors = ' + JSON.stringify(_extractErrorMessage(localValidationResults.errors), 0, 2));
118
+ throw new Error(MSG.TEMPLATE_MISMATCH +
119
+ typeid +
120
+ "\n errors = " +
121
+ JSON.stringify(_extractErrorMessage(localValidationResults.errors), 0, 2));
118
122
  }
119
123
  else if (!remoteValidationResults.isValid) {
120
- throw new Error(MSG.REMOTE_TEMPLATE_MISMATCH + typeid +
121
- '\n errors = ' + JSON.stringify(_extractErrorMessage(remoteValidationResults.errors), 0, 2));
124
+ throw new Error(MSG.REMOTE_TEMPLATE_MISMATCH +
125
+ typeid +
126
+ "\n errors = " +
127
+ JSON.stringify(_extractErrorMessage(remoteValidationResults.errors), 0, 2));
122
128
  }
123
129
  else if (this._localPrimitivePropertiesAndTemplates.has(typeid)) {
124
130
  // Template is already registered. Do nothing.
@@ -133,7 +139,9 @@ var registerLocal = function (in_template) {
133
139
  this._validateSemver(in_template, true);
134
140
  // Semver validation passed. Add the template to the local versioned templates collection
135
141
  if (this._localVersionedTemplates.has(typeidWithoutVersion)) {
136
- this._localVersionedTemplates.item(typeidWithoutVersion).add(version, in_template);
142
+ this._localVersionedTemplates
143
+ .item(typeidWithoutVersion)
144
+ .add(version, in_template);
137
145
  }
138
146
  else {
139
147
  var collection = _createVersionedSortedCollection();
@@ -142,12 +150,17 @@ var registerLocal = function (in_template) {
142
150
  }
143
151
  }
144
152
  else {
145
- throw new Error(MSG.FAILED_TO_REGISTER + typeid +
146
- '\n errors = ' + JSON.stringify(_extractErrorMessage(validationResult.errors), 0, 2));
153
+ throw new Error(MSG.FAILED_TO_REGISTER +
154
+ typeid +
155
+ "\n errors = " +
156
+ JSON.stringify(_extractErrorMessage(validationResult.errors), 0, 2));
147
157
  }
148
158
  }
149
159
  else {
150
- throw new Error(MSG.UNVERSIONED_TEMPLATE + ' Template with typeid = ' + typeid + ' is not versioned.');
160
+ throw new Error(MSG.UNVERSIONED_TEMPLATE +
161
+ " Template with typeid = " +
162
+ typeid +
163
+ " is not versioned.");
151
164
  }
152
165
  // Forward to the internal function
153
166
  this._registerTypeId(typeid, in_template);
@@ -296,26 +309,26 @@ class PropertyFactory {
296
309
  this._init();
297
310
  }
298
311
  /**
299
- * Add a listener for a given type of event.
300
- *
301
- * @param {string} eventName - A string representing the type of event upon which the
302
- * listener will be notified.
303
- * @param {function} eventListener - The function to call when the "type" of event
304
- * is emitted.
305
- * @public
306
- */
312
+ * Add a listener for a given type of event.
313
+ *
314
+ * @param {string} eventName - A string representing the type of event upon which the
315
+ * listener will be notified.
316
+ * @param {function} eventListener - The function to call when the "type" of event
317
+ * is emitted.
318
+ * @public
319
+ */
307
320
  addListener(eventName, eventListener) {
308
321
  this._eventEmitter.addListener(eventName, eventListener);
309
322
  }
310
323
  /**
311
- * Remove a listener for a given type of event. Iff a listener was removed,
312
- * an event 'removeListener' will be emitted.
313
- *
314
- * @param {string} eventName - A string representing the type of event on which the
315
- * listener was attached.
316
- * @param {function} eventListener - The function to remove from the list of functions
317
- * @public
318
- */
324
+ * Remove a listener for a given type of event. Iff a listener was removed,
325
+ * an event 'removeListener' will be emitted.
326
+ *
327
+ * @param {string} eventName - A string representing the type of event on which the
328
+ * listener was attached.
329
+ * @param {function} eventListener - The function to remove from the list of functions
330
+ * @public
331
+ */
319
332
  removeListener(eventName, eventListener) {
320
333
  this._eventEmitter.removeListener(eventName, eventListener);
321
334
  }
@@ -324,70 +337,66 @@ class PropertyFactory {
324
337
  */
325
338
  _init() {
326
339
  // Register all primitive properties
327
- this._registerTypeId('BaseProperty', BaseProperty, 'all');
328
- this._registerTypeId('NodeProperty', NodeProperty, 'all');
329
- this._registerTypeId('ContainerProperty', ContainerProperty, 'all');
340
+ this._registerTypeId("BaseProperty", BaseProperty, "all");
341
+ this._registerTypeId("NodeProperty", NodeProperty, "all");
342
+ this._registerTypeId("ContainerProperty", ContainerProperty, "all");
330
343
  // Register the primitive types for the context single
331
- this._registerTypeId('Int8', Int8Property);
332
- this._registerTypeId('Uint8', Uint8Property);
333
- this._registerTypeId('Int16', Int16Property);
334
- this._registerTypeId('Uint16', Uint16Property);
335
- this._registerTypeId('Int32', Int32Property);
336
- this._registerTypeId('Int64', Int64Property);
337
- this._registerTypeId('Uint64', Uint64Property);
338
- this._registerTypeId('Uint32', Uint32Property);
339
- this._registerTypeId('Float32', Float32Property);
340
- this._registerTypeId('Float64', Float64Property);
341
- this._registerTypeId('Bool', BoolProperty);
342
- this._registerTypeId('String', StringProperty);
343
- this._registerTypeId('Reference', ReferenceProperty);
344
- this._registerTypeId('Enum', EnumProperty);
344
+ this._registerTypeId("Int8", Int8Property);
345
+ this._registerTypeId("Uint8", Uint8Property);
346
+ this._registerTypeId("Int16", Int16Property);
347
+ this._registerTypeId("Uint16", Uint16Property);
348
+ this._registerTypeId("Int32", Int32Property);
349
+ this._registerTypeId("Int64", Int64Property);
350
+ this._registerTypeId("Uint64", Uint64Property);
351
+ this._registerTypeId("Uint32", Uint32Property);
352
+ this._registerTypeId("Float32", Float32Property);
353
+ this._registerTypeId("Float64", Float64Property);
354
+ this._registerTypeId("Bool", BoolProperty);
355
+ this._registerTypeId("String", StringProperty);
356
+ this._registerTypeId("Reference", ReferenceProperty);
357
+ this._registerTypeId("Enum", EnumProperty);
345
358
  // Register the primitive types for the context array
346
- this._registerTypeId('Int8', Int8ArrayProperty, 'array');
347
- this._registerTypeId('Uint8', Uint8ArrayProperty, 'array');
348
- this._registerTypeId('Int16', Int16ArrayProperty, 'array');
349
- this._registerTypeId('Uint16', Uint16ArrayProperty, 'array');
350
- this._registerTypeId('Int32', Int32ArrayProperty, 'array');
351
- this._registerTypeId('Uint32', Uint32ArrayProperty, 'array');
352
- this._registerTypeId('Int64', Int64ArrayProperty, 'array');
353
- this._registerTypeId('Uint64', Uint64ArrayProperty, 'array');
354
- this._registerTypeId('Float32', Float32ArrayProperty, 'array');
355
- this._registerTypeId('Float64', Float64ArrayProperty, 'array');
356
- this._registerTypeId('String', StringArrayProperty, 'array');
357
- this._registerTypeId('Bool', BoolArrayProperty, 'array');
358
- this._registerTypeId('Reference', ReferenceArrayProperty, 'array');
359
- this._registerTypeId('Enum', EnumArrayProperty, 'array');
359
+ this._registerTypeId("Int8", Int8ArrayProperty, "array");
360
+ this._registerTypeId("Uint8", Uint8ArrayProperty, "array");
361
+ this._registerTypeId("Int16", Int16ArrayProperty, "array");
362
+ this._registerTypeId("Uint16", Uint16ArrayProperty, "array");
363
+ this._registerTypeId("Int32", Int32ArrayProperty, "array");
364
+ this._registerTypeId("Uint32", Uint32ArrayProperty, "array");
365
+ this._registerTypeId("Int64", Int64ArrayProperty, "array");
366
+ this._registerTypeId("Uint64", Uint64ArrayProperty, "array");
367
+ this._registerTypeId("Float32", Float32ArrayProperty, "array");
368
+ this._registerTypeId("Float64", Float64ArrayProperty, "array");
369
+ this._registerTypeId("String", StringArrayProperty, "array");
370
+ this._registerTypeId("Bool", BoolArrayProperty, "array");
371
+ this._registerTypeId("Reference", ReferenceArrayProperty, "array");
372
+ this._registerTypeId("Enum", EnumArrayProperty, "array");
360
373
  // Register the primitive types for the context map
361
- this._registerTypeId('Int8', Int8MapProperty, 'map');
362
- this._registerTypeId('Uint8', Uint8MapProperty, 'map');
363
- this._registerTypeId('Int16', Int16MapProperty, 'map');
364
- this._registerTypeId('Uint16', Uint16MapProperty, 'map');
365
- this._registerTypeId('Int32', Int32MapProperty, 'map');
366
- this._registerTypeId('Uint32', Uint32MapProperty, 'map');
367
- this._registerTypeId('Int64', Int64MapProperty, 'map');
368
- this._registerTypeId('Uint64', Uint64MapProperty, 'map');
369
- this._registerTypeId('Float32', Float32MapProperty, 'map');
370
- this._registerTypeId('Float64', Float64MapProperty, 'map');
371
- this._registerTypeId('Bool', BoolMapProperty, 'map');
372
- this._registerTypeId('String', StringMapProperty, 'map');
373
- this._registerTypeId('Reference', ReferenceMapProperty, 'map');
374
+ this._registerTypeId("Int8", Int8MapProperty, "map");
375
+ this._registerTypeId("Uint8", Uint8MapProperty, "map");
376
+ this._registerTypeId("Int16", Int16MapProperty, "map");
377
+ this._registerTypeId("Uint16", Uint16MapProperty, "map");
378
+ this._registerTypeId("Int32", Int32MapProperty, "map");
379
+ this._registerTypeId("Uint32", Uint32MapProperty, "map");
380
+ this._registerTypeId("Int64", Int64MapProperty, "map");
381
+ this._registerTypeId("Uint64", Uint64MapProperty, "map");
382
+ this._registerTypeId("Float32", Float32MapProperty, "map");
383
+ this._registerTypeId("Float64", Float64MapProperty, "map");
384
+ this._registerTypeId("Bool", BoolMapProperty, "map");
385
+ this._registerTypeId("String", StringMapProperty, "map");
386
+ this._registerTypeId("Reference", ReferenceMapProperty, "map");
374
387
  // Register the default templates
375
388
  var NamedPropertyTemplate = {
376
- typeid: 'NamedProperty',
377
- properties: [
378
- { id: 'guid', typeid: 'String' },
379
- ],
389
+ typeid: "NamedProperty",
390
+ properties: [{ id: "guid", typeid: "String" }],
380
391
  };
381
392
  var NamedNodePropertyTemplate = {
382
- typeid: 'NamedNodeProperty',
383
- inherits: ['NodeProperty', 'NamedProperty'],
393
+ typeid: "NamedNodeProperty",
394
+ inherits: ["NodeProperty", "NamedProperty"],
384
395
  };
385
396
  var RelationshipPropertyTemplate = {
386
- typeid: 'RelationshipProperty',
387
- inherits: ['NodeProperty', 'NamedProperty'],
388
- properties: [
389
- { id: 'to', typeid: 'Reference' },
390
- ],
397
+ typeid: "RelationshipProperty",
398
+ inherits: ["NodeProperty", "NamedProperty"],
399
+ properties: [{ id: "to", typeid: "Reference" }],
391
400
  };
392
401
  this._registerTypeId(NamedPropertyTemplate.typeid, NamedPropertyTemplate);
393
402
  this._registerTypeId(NamedNodePropertyTemplate.typeid, NamedNodePropertyTemplate);
@@ -426,21 +435,21 @@ class PropertyFactory {
426
435
  return !isInvalid;
427
436
  };
428
437
  var input_array = undefined;
429
- if (PropertyTemplate.isTemplate(in_input) || typeof in_input === 'string') {
438
+ if (PropertyTemplate.isTemplate(in_input) || typeof in_input === "string") {
430
439
  input_array = [in_input];
431
440
  }
432
441
  else if (_.isArray(in_input)) {
433
442
  input_array = in_input;
434
443
  }
435
444
  else {
436
- throw (new TypeError(MSG.ATTEMPT_TO_REGISTER_WITH_BAD_ARGUMENT));
445
+ throw new TypeError(MSG.ATTEMPT_TO_REGISTER_WITH_BAD_ARGUMENT);
437
446
  }
438
447
  if (!validateArray(input_array)) {
439
- throw (new Error(MSG.ATTEMPT_TO_REGISTER_WITH_BAD_ARGUMENT));
448
+ throw new Error(MSG.ATTEMPT_TO_REGISTER_WITH_BAD_ARGUMENT);
440
449
  }
441
450
  for (var i = 0; i < input_array.length; i++) {
442
451
  var elem = input_array[i];
443
- if (typeof elem === 'string') {
452
+ if (typeof elem === "string") {
444
453
  if (!this._localPrimitivePropertiesAndTemplates.has(elem)) {
445
454
  if (this.missingDependencies[elem] === undefined) {
446
455
  this.missingDependencies[elem] = { requested: false };
@@ -522,18 +531,19 @@ class PropertyFactory {
522
531
  var validationResults;
523
532
  var warnings = [];
524
533
  if (this._localVersionedTemplates.has(typeidWithoutVersion)) {
525
- var previousLocalVersion = this._localVersionedTemplates.item(typeidWithoutVersion)
534
+ var previousLocalVersion = this._localVersionedTemplates
535
+ .item(typeidWithoutVersion)
526
536
  .getNearestPreviousItem(version);
527
537
  if (previousLocalVersion) {
528
- validationResults = this._templateValidator
529
- .validate(in_template.serializeCanonical(), previousLocalVersion.serializeCanonical());
538
+ validationResults = this._templateValidator.validate(in_template.serializeCanonical(), previousLocalVersion.serializeCanonical());
530
539
  warnings.push.apply(warnings, validationResults.warnings);
531
540
  }
532
541
  else {
533
- var nextLocalVersion = this._localVersionedTemplates.item(typeidWithoutVersion).getNearestNextItem(version);
542
+ var nextLocalVersion = this._localVersionedTemplates
543
+ .item(typeidWithoutVersion)
544
+ .getNearestNextItem(version);
534
545
  if (nextLocalVersion) {
535
- validationResults = this._templateValidator
536
- .validate(nextLocalVersion.serializeCanonical(), in_template.serializeCanonical());
546
+ validationResults = this._templateValidator.validate(nextLocalVersion.serializeCanonical(), in_template.serializeCanonical());
537
547
  warnings.push.apply(warnings, validationResults.warnings);
538
548
  }
539
549
  }
@@ -542,14 +552,17 @@ class PropertyFactory {
542
552
  var that = this;
543
553
  this._remoteScopedAndVersionedTemplates.iterate(function (scope, remoteVersionedTemplates) {
544
554
  if (remoteVersionedTemplates.has(typeidWithoutVersion)) {
545
- var previousRemoteVersion = remoteVersionedTemplates.item(typeidWithoutVersion)
555
+ var previousRemoteVersion = remoteVersionedTemplates
556
+ .item(typeidWithoutVersion)
546
557
  .getNearestPreviousItem(version);
547
558
  if (previousRemoteVersion) {
548
559
  validationResults = that._templateValidator.validate(in_template.serializeCanonical(), previousRemoteVersion.getPropertyTemplate().serializeCanonical());
549
560
  warnings.push.apply(warnings, validationResults.warnings);
550
561
  }
551
562
  else {
552
- var nextRemoteVersion = remoteVersionedTemplates.item(typeidWithoutVersion).getNearestNextItem(version);
563
+ var nextRemoteVersion = remoteVersionedTemplates
564
+ .item(typeidWithoutVersion)
565
+ .getNearestNextItem(version);
553
566
  if (nextRemoteVersion) {
554
567
  validationResults = that._templateValidator.validate(nextRemoteVersion.getPropertyTemplate().serializeCanonical(), in_template.serializeCanonical());
555
568
  warnings.push.apply(warnings, validationResults.warnings);
@@ -559,8 +572,10 @@ class PropertyFactory {
559
572
  });
560
573
  }
561
574
  if (!_.isEmpty(warnings)) {
562
- console.warn('Template with typeid = ' + typeid +
563
- ' is valid but with the following warnings = ' + JSON.stringify(warnings, 0, 2));
575
+ console.warn("Template with typeid = " +
576
+ typeid +
577
+ " is valid but with the following warnings = " +
578
+ JSON.stringify(warnings, 0, 2));
564
579
  }
565
580
  }
566
581
  /**
@@ -582,12 +597,16 @@ class PropertyFactory {
582
597
  // Template already exists. The incoming template MUST match what is registered.
583
598
  // If they do not match, throw an error letting the user know that the templates are incompatible.
584
599
  // This is likely due to the fact that the developer did not bump its version.
585
- var registeredTemplate = this._localPrimitivePropertiesAndTemplates.item(typeid).getPropertyTemplate();
600
+ var registeredTemplate = this._localPrimitivePropertiesAndTemplates
601
+ .item(typeid)
602
+ .getPropertyTemplate();
586
603
  var templateValidator = _createTemplateValidator.call(this);
587
604
  var validationResults = templateValidator.validate(registeredTemplate.serializeCanonical(), in_remoteTemplate.serializeCanonical());
588
605
  if (!validationResults.isValid) {
589
- throw new Error(MSG.TEMPLATE_MISMATCH + typeid +
590
- '\n errors = ' + JSON.stringify(_extractErrorMessage(validationResults.errors), 0, 2));
606
+ throw new Error(MSG.TEMPLATE_MISMATCH +
607
+ typeid +
608
+ "\n errors = " +
609
+ JSON.stringify(_extractErrorMessage(validationResults.errors), 0, 2));
591
610
  }
592
611
  }
593
612
  else if (in_remoteTemplate._isVersioned()) {
@@ -595,8 +614,12 @@ class PropertyFactory {
595
614
  var wrappedTemplate = new PropertyTemplateWrapper(in_remoteTemplate, in_scope);
596
615
  if (this._remoteScopedAndVersionedTemplates.has(in_scope)) {
597
616
  if (this._remoteScopedAndVersionedTemplates.item(in_scope).has(typeidWithoutVersion)) {
598
- if (!this._remoteScopedAndVersionedTemplates.item(in_scope).item(typeidWithoutVersion).has(version)) {
599
- this._remoteScopedAndVersionedTemplates.item(in_scope)
617
+ if (!this._remoteScopedAndVersionedTemplates
618
+ .item(in_scope)
619
+ .item(typeidWithoutVersion)
620
+ .has(version)) {
621
+ this._remoteScopedAndVersionedTemplates
622
+ .item(in_scope)
600
623
  .item(typeidWithoutVersion)
601
624
  .add(version, wrappedTemplate);
602
625
  }
@@ -604,7 +627,9 @@ class PropertyFactory {
604
627
  else {
605
628
  var versionCollection = _createVersionedSortedCollection();
606
629
  versionCollection.add(version, wrappedTemplate);
607
- this._remoteScopedAndVersionedTemplates.item(in_scope).add(typeidWithoutVersion, versionCollection);
630
+ this._remoteScopedAndVersionedTemplates
631
+ .item(in_scope)
632
+ .add(typeidWithoutVersion, versionCollection);
608
633
  }
609
634
  }
610
635
  else {
@@ -616,7 +641,7 @@ class PropertyFactory {
616
641
  }
617
642
  }
618
643
  else {
619
- throw new Error(MSG.UNVERSIONED_REMOTE_TEMPLATE + ' \n' + JSON.stringify(in_remoteTemplate, 0, 2));
644
+ throw new Error(MSG.UNVERSIONED_REMOTE_TEMPLATE + " \n" + JSON.stringify(in_remoteTemplate, 0, 2));
620
645
  }
621
646
  }
622
647
  /**
@@ -665,19 +690,21 @@ class PropertyFactory {
665
690
  // If no context is specified we assign one
666
691
  if (!in_context) {
667
692
  // By default templates are registered for all contexts together, BaseProperties are registered separately
668
- in_context = in_templateOrProperty instanceof PropertyTemplate ? 'all' : 'single';
693
+ in_context = in_templateOrProperty instanceof PropertyTemplate ? "all" : "single";
669
694
  }
670
- if (in_context !== 'all') {
695
+ if (in_context !== "all") {
671
696
  if (!this._localPrimitivePropertiesAndTemplates.has(in_typeid)) {
672
697
  this._localPrimitivePropertiesAndTemplates.add(in_typeid, new Collection());
673
698
  }
674
- this._localPrimitivePropertiesAndTemplates.item(in_typeid).add(in_context, in_templateOrProperty);
699
+ this._localPrimitivePropertiesAndTemplates
700
+ .item(in_typeid)
701
+ .add(in_context, in_templateOrProperty);
675
702
  }
676
703
  else if (!this._localPrimitivePropertiesAndTemplates.has(in_typeid)) {
677
704
  var wrapper = new PropertyTemplateWrapper(in_templateOrProperty);
678
705
  this._localPrimitivePropertiesAndTemplates.add(in_typeid, wrapper);
679
706
  }
680
- this._eventEmitter.emit('registered', in_templateOrProperty);
707
+ this._eventEmitter.emit("registered", in_templateOrProperty);
681
708
  }
682
709
  /**
683
710
  * Validate a template.
@@ -741,7 +768,7 @@ class PropertyFactory {
741
768
  return typeidItem;
742
769
  }
743
770
  else {
744
- var context = in_context || 'single';
771
+ var context = in_context || "single";
745
772
  return this._localPrimitivePropertiesAndTemplates.item(in_typeid).item(context);
746
773
  }
747
774
  }
@@ -750,9 +777,17 @@ class PropertyFactory {
750
777
  if (splitTypeId.version) {
751
778
  var typeidWithoutVersion = splitTypeId.typeidWithoutVersion;
752
779
  var version = splitTypeId.version;
753
- if (this._remoteScopedAndVersionedTemplates.item(in_scope).has(typeidWithoutVersion) &&
754
- this._remoteScopedAndVersionedTemplates.item(in_scope).item(typeidWithoutVersion).has(version)) {
755
- return this._remoteScopedAndVersionedTemplates.item(in_scope).item(typeidWithoutVersion).item(version);
780
+ if (this._remoteScopedAndVersionedTemplates
781
+ .item(in_scope)
782
+ .has(typeidWithoutVersion) &&
783
+ this._remoteScopedAndVersionedTemplates
784
+ .item(in_scope)
785
+ .item(typeidWithoutVersion)
786
+ .has(version)) {
787
+ return this._remoteScopedAndVersionedTemplates
788
+ .item(in_scope)
789
+ .item(typeidWithoutVersion)
790
+ .item(version);
756
791
  }
757
792
  }
758
793
  }
@@ -765,7 +800,8 @@ class PropertyFactory {
765
800
  * @returns {property-properties.PropertyTemplate|undefined} Template identified by the typeid.
766
801
  */
767
802
  getTemplate(in_typeid) {
768
- return this._localPrimitivePropertiesAndTemplates.has(in_typeid) && !TypeIdHelper.isPrimitiveType(in_typeid)
803
+ return this._localPrimitivePropertiesAndTemplates.has(in_typeid) &&
804
+ !TypeIdHelper.isPrimitiveType(in_typeid)
769
805
  ? this._localPrimitivePropertiesAndTemplates.item(in_typeid).getPropertyTemplate()
770
806
  : undefined;
771
807
  }
@@ -783,7 +819,10 @@ class PropertyFactory {
783
819
  this._remoteScopedAndVersionedTemplates.iterate(function (scope, remoteVersionedTemplates) {
784
820
  if (remoteVersionedTemplates.has(typeidWithoutVersion) &&
785
821
  remoteVersionedTemplates.item(typeidWithoutVersion).item(version)) {
786
- templatesFound.push(remoteVersionedTemplates.item(typeidWithoutVersion).item(version).getPropertyTemplate());
822
+ templatesFound.push(remoteVersionedTemplates
823
+ .item(typeidWithoutVersion)
824
+ .item(version)
825
+ .getPropertyTemplate());
787
826
  }
788
827
  });
789
828
  return templatesFound;
@@ -801,7 +840,7 @@ class PropertyFactory {
801
840
  * @private
802
841
  */
803
842
  _createProperty(in_typeid, in_context, in_initialProperties, in_scope) {
804
- const ifNotSingleOrUndefined = (in_context || 'single') !== 'single';
843
+ const ifNotSingleOrUndefined = (in_context || "single") !== "single";
805
844
  ConsoleUtils.assert(ifNotSingleOrUndefined || _.isString(in_typeid), MSG.UNKNOWN_TYPEID_SPECIFIED + in_typeid);
806
845
  let context = in_context;
807
846
  if (!context) {
@@ -827,14 +866,15 @@ class PropertyFactory {
827
866
  propertyDef = {};
828
867
  this._createDefFromPropertyDeclaration({
829
868
  typeid: in_typeid,
830
- context: context || 'single',
869
+ context: context || "single",
831
870
  }, in_scope, propertyDef);
832
871
  }
833
872
  let property;
834
873
  if (!this._forceInstantion) {
835
874
  // If we don't yet have a creation function, we will create one here
836
- propertyCreationFunction = propertyCreationFunction ||
837
- this._definePropertyCreationFunction(propertyDef, in_typeid, in_scope, context);
875
+ propertyCreationFunction =
876
+ propertyCreationFunction ||
877
+ this._definePropertyCreationFunction(propertyDef, in_typeid, in_scope, context);
838
878
  // Create the property by invoking the precompiled creation function
839
879
  property = propertyCreationFunction();
840
880
  // If initial properties have been provided, we will assign them to the
@@ -869,11 +909,13 @@ class PropertyFactory {
869
909
  _instantiatePropertyDef(propertyDef, in_scope, in_initialProperties) {
870
910
  let rootProperty = undefined;
871
911
  // This stack is used to recursively iterate over the property definition
872
- const creationStack = [{
912
+ const creationStack = [
913
+ {
873
914
  id: undefined,
874
915
  entry: propertyDef,
875
916
  parent: undefined,
876
- }];
917
+ },
918
+ ];
877
919
  while (creationStack.length > 0) {
878
920
  const currentEntry = creationStack.pop();
879
921
  // We have an entry on the stack that is just waiting for its children to finish, but has already
@@ -886,7 +928,7 @@ class PropertyFactory {
886
928
  continue;
887
929
  }
888
930
  // Create the property instance
889
- let property = new (currentEntry.entry.constructorFunction)(currentEntry.entry.entry);
931
+ let property = new currentEntry.entry.constructorFunction(currentEntry.entry.entry);
890
932
  // Insert / append the property to the parent
891
933
  if (currentEntry.parent) {
892
934
  if (currentEntry.entry.optional) {
@@ -926,8 +968,7 @@ class PropertyFactory {
926
968
  parent: property,
927
969
  id: id,
928
970
  entry: child,
929
- setGuid: currentEntry.entry.assignGuid && id ===
930
- 'guid',
971
+ setGuid: currentEntry.entry.assignGuid && id === "guid",
931
972
  });
932
973
  }
933
974
  }
@@ -959,11 +1000,13 @@ class PropertyFactory {
959
1000
  */
960
1001
  _definePropertyCreationFunction(propertyDef, in_typeid, in_scope, in_context) {
961
1002
  // This stack is used to recursively iterate over the property definition
962
- const creationStack = [{
1003
+ const creationStack = [
1004
+ {
963
1005
  id: null,
964
1006
  def: propertyDef,
965
1007
  parent: undefined,
966
- }];
1008
+ },
1009
+ ];
967
1010
  let creationFunctionSource = "";
968
1011
  let currentParameterIndex = 0;
969
1012
  let parameters = [];
@@ -976,14 +1019,13 @@ class PropertyFactory {
976
1019
  // been created
977
1020
  if (currentEntry.signalChildrenFinished) {
978
1021
  // Add the signalling function
979
- creationFunctionSource +=
980
- `${currentEntry.propertyVarname}._signalAllStaticMembersHaveBeenAdded(${JSON.stringify(in_scope)});\n`;
1022
+ creationFunctionSource += `${currentEntry.propertyVarname}._signalAllStaticMembersHaveBeenAdded(${JSON.stringify(in_scope)});\n`;
981
1023
  continue;
982
1024
  }
983
1025
  // Determine the initial value for this property
984
- let initialValue = currentEntry.def.initialValue !== undefined ?
985
- currentEntry.def.initialValue :
986
- undefined;
1026
+ let initialValue = currentEntry.def.initialValue !== undefined
1027
+ ? currentEntry.def.initialValue
1028
+ : undefined;
987
1029
  if (currentEntry.def.entry.id) {
988
1030
  let parentEntry = currentEntry.parentStackEntry;
989
1031
  let path = [currentEntry.def.entry.id];
@@ -1009,7 +1051,7 @@ class PropertyFactory {
1009
1051
  Object.assign(initialValue.value, filteredChangeSet);
1010
1052
  }
1011
1053
  else {
1012
- throw new TypeError('Invalid default values specified');
1054
+ throw new TypeError("Invalid default values specified");
1013
1055
  }
1014
1056
  }
1015
1057
  else if (filteredChangeSet !== undefined) {
@@ -1040,8 +1082,7 @@ class PropertyFactory {
1040
1082
  // we use this flag to indicate that for all nested properties, we do not want to use
1041
1083
  // the precompiled instantiation functions.
1042
1084
  this._forceInstantion = true;
1043
- instantiatedChild =
1044
- this._instantiatePropertyDef(currentEntry.def, in_scope, currentEntry.def.initialValue);
1085
+ instantiatedChild = this._instantiatePropertyDef(currentEntry.def, in_scope, currentEntry.def.initialValue);
1045
1086
  }
1046
1087
  finally {
1047
1088
  this._forceInstantion = false;
@@ -1063,8 +1104,7 @@ class PropertyFactory {
1063
1104
  // and add the instantiation call to the generated function
1064
1105
  currentPropertyNumber++;
1065
1106
  currentPropertyVarName = `property${currentPropertyNumber}`;
1066
- creationFunctionSource +=
1067
- `const ${currentPropertyVarName} =
1107
+ creationFunctionSource += `const ${currentPropertyVarName} =
1068
1108
  new parameters[${currentParameterIndex}](parameters[${currentParameterIndex + 1}]);\n`;
1069
1109
  currentParameterIndex += 2;
1070
1110
  // Insert / append the property to the parent
@@ -1113,7 +1153,7 @@ class PropertyFactory {
1113
1153
  id: id,
1114
1154
  def: child,
1115
1155
  signalParent: false,
1116
- setGuid: currentEntry.def.assignGuid && id === 'guid',
1156
+ setGuid: currentEntry.def.assignGuid && id === "guid",
1117
1157
  parentStackEntry,
1118
1158
  });
1119
1159
  }
@@ -1123,12 +1163,12 @@ class PropertyFactory {
1123
1163
  // we directly assign it here
1124
1164
  if (initialValue !== undefined) {
1125
1165
  creationFunctionSource += !_.isObject(initialValue.value)
1126
- // We have a primitive property and thus direclty invoke the setValue function
1127
- ? `${currentPropertyVarName}.setValue(${JSON.stringify(initialValue.value)})\n`
1128
- // For non primitive properties, we currently use the member on the property factory,
1129
- // probably we could further optimize this to directly call the correct function on the
1130
- // property
1131
- : `this._setInitialValue(${currentPropertyVarName},
1166
+ ? // We have a primitive property and thus direclty invoke the setValue function
1167
+ `${currentPropertyVarName}.setValue(${JSON.stringify(initialValue.value)})\n`
1168
+ : // For non primitive properties, we currently use the member on the property factory,
1169
+ // probably we could further optimize this to directly call the correct function on the
1170
+ // property
1171
+ `this._setInitialValue(${currentPropertyVarName},
1132
1172
  ${JSON.stringify(initialValue)},
1133
1173
  false);\n`;
1134
1174
  }
@@ -1148,7 +1188,7 @@ class PropertyFactory {
1148
1188
  // Add the return statement at the end of the function
1149
1189
  creationFunctionSource += ` return ${resultVarName};`;
1150
1190
  // Finally, create the actual JS function with the source we compiled above
1151
- let creationFunction = new Function('parameters', ' GuidUtils', creationFunctionSource).bind(this, parameters, GuidUtils);
1191
+ let creationFunction = new Function("parameters", " GuidUtils", creationFunctionSource).bind(this, parameters, GuidUtils);
1152
1192
  // Add the created function to the cache
1153
1193
  let scopesFunction = this._cachedCreationFunctions.get(in_typeid);
1154
1194
  if (!scopesFunction) {
@@ -1183,11 +1223,12 @@ class PropertyFactory {
1183
1223
  else if (valueParsed.typed) {
1184
1224
  property._setValues(valueParsed.value, true, true);
1185
1225
  }
1186
- else if ((property.getTypeid() !== 'ContainerProperty') || (property._getChildrenCount() > 0)) {
1226
+ else if (property.getTypeid() !== "ContainerProperty" ||
1227
+ property._getChildrenCount() > 0) {
1187
1228
  property._setValues(valueParsed.value, false, true);
1188
1229
  }
1189
1230
  else if (!valueParsed.typeid) {
1190
- throw new Error(MSG.FIELD_TYPEID_IS_REQUIRED + property._id + '.typeid');
1231
+ throw new Error(MSG.FIELD_TYPEID_IS_REQUIRED + property._id + ".typeid");
1191
1232
  }
1192
1233
  else {
1193
1234
  property._setValues(valueParsed.value, false, true);
@@ -1223,14 +1264,12 @@ class PropertyFactory {
1223
1264
  */
1224
1265
  _getConstructorFunctionForTypeidAndID(in_context, in_typeid, in_baseConstructor, in_id, in_scope) {
1225
1266
  // Create a unique key for this constructor
1226
- let key = in_context === 'single' ?
1227
- in_typeid :
1228
- in_context + '<' + in_typeid + '>';
1267
+ let key = in_context === "single" ? in_typeid : in_context + "<" + in_typeid + ">";
1229
1268
  if (in_id !== undefined) {
1230
- key = key + '-' + in_id;
1269
+ key = key + "-" + in_id;
1231
1270
  }
1232
1271
  if (in_scope && !this._localPrimitivePropertiesAndTemplates.has(in_typeid)) {
1233
- key += '-' + in_scope;
1272
+ key += "-" + in_scope;
1234
1273
  }
1235
1274
  // Check, whether we already have this function in the cache
1236
1275
  if (this._typedPropertyConstructorCache[key]) {
@@ -1244,7 +1283,9 @@ class PropertyFactory {
1244
1283
  var propertyConstructorFunction = class extends in_baseConstructor {
1245
1284
  };
1246
1285
  propertyConstructorFunction.prototype._typeid = in_typeid;
1247
- Object.defineProperty(propertyConstructorFunction, 'name', { value: in_baseConstructor.name });
1286
+ Object.defineProperty(propertyConstructorFunction, "name", {
1287
+ value: in_baseConstructor.name,
1288
+ });
1248
1289
  if (in_id !== undefined) {
1249
1290
  propertyConstructorFunction.prototype._id = in_id;
1250
1291
  }
@@ -1270,34 +1311,34 @@ class PropertyFactory {
1270
1311
  typeid: in_typeid,
1271
1312
  id: in_id,
1272
1313
  };
1273
- if (this.inheritsFrom(in_typeid, 'NamedProperty', { scope: in_scope })) {
1314
+ if (this.inheritsFrom(in_typeid, "NamedProperty", { scope: in_scope })) {
1274
1315
  // An id of NULL means that the GUID of the property is used if it is a named property
1275
1316
  params.id = in_id || null;
1276
1317
  }
1277
1318
  const wrapper = this._getWrapper(in_typeid, undefined, in_scope);
1278
1319
  const creationType = wrapper.getCreationType();
1279
1320
  switch (creationType) {
1280
- case 'Enum':
1321
+ case "Enum":
1281
1322
  params._enumDictionary = in_templateOrConstructor._enumDictionary;
1282
1323
  ConstructorFunction = EnumProperty;
1283
1324
  break;
1284
- case 'NodeProperty':
1325
+ case "NodeProperty":
1285
1326
  ConstructorFunction = NodeProperty;
1286
- params.typeid = params.typeid || 'NodeProperty';
1327
+ params.typeid = params.typeid || "NodeProperty";
1287
1328
  break;
1288
- case 'NamedProperty':
1329
+ case "NamedProperty":
1289
1330
  ConstructorFunction = NamedProperty;
1290
- params.typeid = params.typeid || 'NamedProperty';
1331
+ params.typeid = params.typeid || "NamedProperty";
1291
1332
  break;
1292
1333
  default:
1293
1334
  ConstructorFunction = ContainerProperty;
1294
- params.typeid = params.typeid || 'ContainerProperty';
1335
+ params.typeid = params.typeid || "ContainerProperty";
1295
1336
  }
1296
- ConstructorFunction = this._getConstructorFunctionForTypeidAndID('single', in_typeid, ConstructorFunction, in_id, in_scope);
1337
+ ConstructorFunction = this._getConstructorFunctionForTypeidAndID("single", in_typeid, ConstructorFunction, in_id, in_scope);
1297
1338
  propertyDef.constructorFunction = ConstructorFunction;
1298
1339
  propertyDef.signal = true;
1299
1340
  propertyDef.entry = params;
1300
- propertyDef.context = 'single';
1341
+ propertyDef.context = "single";
1301
1342
  propertyDef.typeid = in_typeid;
1302
1343
  }
1303
1344
  /**
@@ -1320,7 +1361,7 @@ class PropertyFactory {
1320
1361
  * @private
1321
1362
  */
1322
1363
  _hasCorrespondingRegisteredTypeid(in_typeid, in_scope) {
1323
- if (in_typeid.includes('-')) {
1364
+ if (in_typeid.includes("-")) {
1324
1365
  return this._isRegisteredTypeid(in_typeid, in_scope);
1325
1366
  }
1326
1367
  var registered = this._localVersionedTemplates.has(in_typeid) ||
@@ -1356,19 +1397,20 @@ class PropertyFactory {
1356
1397
  */
1357
1398
  _computeTypeid(in_propertiesEntry, in_scope, context) {
1358
1399
  var typeid = in_propertiesEntry.typeid;
1359
- if (context === 'single') {
1400
+ if (context === "single") {
1360
1401
  var valueParsed = this._parseTypedValue(in_propertiesEntry, in_scope, context);
1361
- if ((valueParsed.typed) && (valueParsed.typeid)) {
1402
+ if (valueParsed.typed && valueParsed.typeid) {
1362
1403
  typeid = in_propertiesEntry.typedValue.typeid;
1363
1404
  }
1364
1405
  }
1365
1406
  // We create a polymorphic collection (one inheriting from BaseProperty), if no typeid is specified
1366
1407
  // but a context is given
1367
- if (!typeid && context !== 'single') {
1368
- typeid = context !== 'set' ? 'ContainerProperty' : 'NamedProperty';
1408
+ if (!typeid && context !== "single") {
1409
+ typeid = context !== "set" ? "ContainerProperty" : "NamedProperty";
1369
1410
  }
1370
- if (in_propertiesEntry.typeid && TypeIdHelper.isReferenceTypeId(in_propertiesEntry.typeid)) {
1371
- typeid = 'Reference';
1411
+ if (in_propertiesEntry.typeid &&
1412
+ TypeIdHelper.isReferenceTypeId(in_propertiesEntry.typeid)) {
1413
+ typeid = "Reference";
1372
1414
  }
1373
1415
  return typeid;
1374
1416
  }
@@ -1385,18 +1427,21 @@ class PropertyFactory {
1385
1427
  * @param {Object} out_propertyDef - The created property definition
1386
1428
  */
1387
1429
  _createDefFromPropertyDeclaration(in_propertiesEntry, in_scope, out_propertyDef) {
1388
- var context = in_propertiesEntry.context !== undefined ? in_propertiesEntry.context : 'single';
1430
+ var context = in_propertiesEntry.context !== undefined ? in_propertiesEntry.context : "single";
1389
1431
  var typeid = this._computeTypeid(in_propertiesEntry, in_scope, context);
1390
- var referenceTarget = typeid === 'Reference' ?
1391
- TypeIdHelper.extractReferenceTargetTypeIdFromReference(in_propertiesEntry.typeid) : undefined;
1432
+ var referenceTarget = typeid === "Reference"
1433
+ ? TypeIdHelper.extractReferenceTargetTypeIdFromReference(in_propertiesEntry.typeid)
1434
+ : undefined;
1392
1435
  if (typeid) {
1393
1436
  if (this._isRegisteredTypeid(typeid, in_scope) &&
1394
- (!referenceTarget || this._hasCorrespondingRegisteredTypeid(referenceTarget, in_scope))) {
1437
+ (!referenceTarget ||
1438
+ this._hasCorrespondingRegisteredTypeid(referenceTarget, in_scope))) {
1395
1439
  var templateOrConstructor = this._get(typeid, context, in_scope);
1396
1440
  var isSpecializedConstructor = this._isSpecializedConstructor(typeid);
1397
1441
  if (this._isNativePropertyConstructor(templateOrConstructor) &&
1398
- (isSpecializedConstructor || context === 'single')) {
1399
- if (TypeIdHelper.isReferenceTypeId(typeid) || in_propertiesEntry.id !== undefined) {
1442
+ (isSpecializedConstructor || context === "single")) {
1443
+ if (TypeIdHelper.isReferenceTypeId(typeid) ||
1444
+ in_propertiesEntry.id !== undefined) {
1400
1445
  templateOrConstructor = this._getConstructorFunctionForTypeidAndID(in_propertiesEntry.context, in_propertiesEntry.typeid, templateOrConstructor, in_propertiesEntry.id, in_scope);
1401
1446
  }
1402
1447
  out_propertyDef.constructorFunction = templateOrConstructor;
@@ -1411,22 +1456,23 @@ class PropertyFactory {
1411
1456
  else {
1412
1457
  const templateWrapper = this._getWrapper(typeid, context, in_scope);
1413
1458
  templateOrConstructor = templateWrapper.getCompiledTemplate(this);
1414
- if (context === 'single') {
1459
+ if (context === "single") {
1415
1460
  // If we have a template in a single context, we create it directly here
1416
1461
  // Create the base object
1417
1462
  this._createNonCollectionPropertyDef(typeid, in_propertiesEntry.id, templateOrConstructor, in_scope, out_propertyDef);
1418
- this._parseTemplate(templateOrConstructor, in_scope, !!(templateOrConstructor.inherits), out_propertyDef);
1463
+ this._parseTemplate(templateOrConstructor, in_scope, !!templateOrConstructor.inherits, out_propertyDef);
1419
1464
  }
1420
1465
  else {
1421
1466
  // If we have other contexts, we have to create the corresponding property object for that context
1422
1467
  // check if a specialized collection is needed
1423
- var isEnum = this.inheritsFrom(typeid, 'Enum', { scope: in_scope });
1468
+ var isEnum = this.inheritsFrom(typeid, "Enum", { scope: in_scope });
1424
1469
  var constructorFunction;
1425
1470
  switch (context) {
1426
- case 'array':
1471
+ case "array":
1427
1472
  if (isEnum) {
1428
1473
  var enumPropertyEntry = deepCopy(in_propertiesEntry);
1429
- enumPropertyEntry._enumDictionary = templateOrConstructor._enumDictionary;
1474
+ enumPropertyEntry._enumDictionary =
1475
+ templateOrConstructor._enumDictionary;
1430
1476
  in_propertiesEntry = enumPropertyEntry;
1431
1477
  constructorFunction = EnumArrayProperty;
1432
1478
  }
@@ -1434,15 +1480,15 @@ class PropertyFactory {
1434
1480
  constructorFunction = ArrayProperty;
1435
1481
  }
1436
1482
  break;
1437
- case 'set':
1483
+ case "set":
1438
1484
  // Validate that a set inherit from a NamedProperty
1439
1485
  var typeid = in_propertiesEntry.typeid;
1440
- if (!this.inheritsFrom(typeid, 'NamedProperty', { scope: in_scope })) {
1486
+ if (!this.inheritsFrom(typeid, "NamedProperty", { scope: in_scope })) {
1441
1487
  throw new Error(MSG.SET_ONLY_NAMED_PROPS + typeid);
1442
1488
  }
1443
1489
  constructorFunction = SetProperty;
1444
1490
  break;
1445
- case 'map':
1491
+ case "map":
1446
1492
  constructorFunction = MapProperty;
1447
1493
  break;
1448
1494
  default:
@@ -1469,17 +1515,17 @@ class PropertyFactory {
1469
1515
  in_propertiesEntry.properties = [];
1470
1516
  }
1471
1517
  // If this is a declaration which contains a properties list, we have to create a new container property for it
1472
- let copiedPropertyEntry = Object.assign({ typeid: 'ContainerProperty' }, in_propertiesEntry);
1518
+ let copiedPropertyEntry = Object.assign({ typeid: "ContainerProperty" }, in_propertiesEntry);
1473
1519
  out_propertyDef.constructorFunction = ContainerProperty;
1474
1520
  out_propertyDef.entry = copiedPropertyEntry;
1475
1521
  out_propertyDef.signal = false;
1476
1522
  out_propertyDef.typeid = copiedPropertyEntry.typeid;
1477
- out_propertyDef.context = 'single';
1523
+ out_propertyDef.context = "single";
1478
1524
  // And then parse the entry like a template
1479
1525
  this._parseTemplate(in_propertiesEntry, in_scope, false, out_propertyDef);
1480
1526
  }
1481
1527
  // If this property inherits from NamedProperty we assign a random GUID
1482
- if (typeid && this.inheritsFrom(typeid, 'NamedProperty', { scope: in_scope })) {
1528
+ if (typeid && this.inheritsFrom(typeid, "NamedProperty", { scope: in_scope })) {
1483
1529
  out_propertyDef.assignGuid = true;
1484
1530
  }
1485
1531
  }
@@ -1493,7 +1539,7 @@ class PropertyFactory {
1493
1539
  _isNativePropertyConstructor(in_obj) {
1494
1540
  // TODO: This tests seems dangerous. I think it is based on the assumption that constructor is not
1495
1541
  // overwritten in the derived classes (which it probably should be)
1496
- return (in_obj.constructor && in_obj.constructor === ContainerProperty.constructor);
1542
+ return in_obj.constructor && in_obj.constructor === ContainerProperty.constructor;
1497
1543
  }
1498
1544
  /**
1499
1545
  * Checks whether the property has a typedValue and replaces the value and the typeid
@@ -1512,19 +1558,21 @@ class PropertyFactory {
1512
1558
  typeid: in_property.typeid,
1513
1559
  };
1514
1560
  if (in_property.typedValue) {
1515
- var typeid = in_property.typeid || 'ContainerProperty';
1561
+ var typeid = in_property.typeid || "ContainerProperty";
1516
1562
  // Setting typedValue to a primitive is not supported
1517
1563
  if (TypeIdHelper.isPrimitiveType(typeid)) {
1518
1564
  throw new Error(MSG.TYPED_VALUES_FOR_PRIMITIVES_NOT_SUPPORTED + in_property.id);
1519
1565
  }
1520
1566
  res.typed = true;
1521
- if (in_context === 'single') {
1567
+ if (in_context === "single") {
1522
1568
  if (!in_property.typedValue.typeid) {
1523
- throw new Error(MSG.FIELD_TYPEID_IS_REQUIRED + 'typedValue ' + typeid);
1569
+ throw new Error(MSG.FIELD_TYPEID_IS_REQUIRED + "typedValue " + typeid);
1524
1570
  }
1525
1571
  if (!this.inheritsFrom(in_property.typedValue.typeid, typeid, { scope: in_scope })) {
1526
1572
  throw new Error(MSG.TYPED_VALUES_MUST_DERIVE_FROM_BASE_TYPE +
1527
- in_property.typedValue.typeid + ' must be a subclass of ' + typeid);
1573
+ in_property.typedValue.typeid +
1574
+ " must be a subclass of " +
1575
+ typeid);
1528
1576
  }
1529
1577
  res.value = in_property.typedValue.value;
1530
1578
  res.typeid = in_property.typedValue.typeid;
@@ -1547,13 +1595,13 @@ class PropertyFactory {
1547
1595
  */
1548
1596
  _parseTemplate(in_template, in_scope, in_allowChildMerges, propertyDef) {
1549
1597
  // Check if there are nested property arrays
1550
- if (!(in_template.inherits && in_template.inherits.indexOf('Enum') !== -1)) {
1598
+ if (!(in_template.inherits && in_template.inherits.indexOf("Enum") !== -1)) {
1551
1599
  if (in_template.properties) {
1552
1600
  const properties = in_template.properties;
1553
1601
  for (let i = 0; i < properties.length; i++) {
1554
1602
  const id = properties[i].id;
1555
- const typeid = properties[i].typeid || 'ContainerProperty';
1556
- const context = properties[i].context || 'single';
1603
+ const typeid = properties[i].typeid || "ContainerProperty";
1604
+ const context = properties[i].context || "single";
1557
1605
  const optional = properties[i].optional || false;
1558
1606
  const valueParsed = this._parseTypedValue(properties[i], in_scope, context);
1559
1607
  if (optional) {
@@ -1584,7 +1632,7 @@ class PropertyFactory {
1584
1632
  if (in_template.constants) {
1585
1633
  const constants = in_template.constants;
1586
1634
  for (let i = 0; i < constants.length; i++) {
1587
- const context = constants[i].context || 'single';
1635
+ const context = constants[i].context || "single";
1588
1636
  const valueParsed = this._parseTypedValue(constants[i], in_scope, context);
1589
1637
  const newChildEntry = {
1590
1638
  initialValue: undefined,
@@ -1665,9 +1713,9 @@ class PropertyFactory {
1665
1713
  in_options = in_options || {};
1666
1714
  // We just forward the request to the internal function
1667
1715
  var parents = {};
1668
- var scope = in_options.workspace ?
1669
- in_options.workspace.getRoot()._getCheckedOutRepositoryInfo().getScope() :
1670
- in_options.scope;
1716
+ var scope = in_options.workspace
1717
+ ? in_options.workspace.getRoot()._getCheckedOutRepositoryInfo().getScope()
1718
+ : in_options.scope;
1671
1719
  this._getAllParentsForTemplateInternal(in_typeid, parents, !!in_options.includeBaseProperty, scope);
1672
1720
  return _.keys(parents);
1673
1721
  }
@@ -1684,8 +1732,8 @@ class PropertyFactory {
1684
1732
  if (TypeIdHelper.isPrimitiveType(in_typeid)) {
1685
1733
  // Everything inherits from BaseProperty.
1686
1734
  if (in_includeBaseProperty) {
1687
- out_parents['AbstractStaticCollectionProperty'] = true;
1688
- out_parents['BaseProperty'] = true;
1735
+ out_parents["AbstractStaticCollectionProperty"] = true;
1736
+ out_parents["BaseProperty"] = true;
1689
1737
  }
1690
1738
  return;
1691
1739
  }
@@ -1695,8 +1743,8 @@ class PropertyFactory {
1695
1743
  }
1696
1744
  // Everything inherits from BaseProperty.
1697
1745
  if (in_includeBaseProperty) {
1698
- out_parents['AbstractStaticCollectionProperty'] = true;
1699
- out_parents['BaseProperty'] = true;
1746
+ out_parents["AbstractStaticCollectionProperty"] = true;
1747
+ out_parents["BaseProperty"] = true;
1700
1748
  }
1701
1749
  // Run over all parents and insert them into the parents array
1702
1750
  if (template.inherits) {
@@ -1761,26 +1809,29 @@ class PropertyFactory {
1761
1809
  registerLocal.call(this, in_template);
1762
1810
  }
1763
1811
  /**
1764
- * Initializes the schema store.
1765
- * @public
1766
- * @param {Object} in_options - the store settings.
1767
- * @param {getBearerTokenFn} in_options.getBearerToken - Function that accepts a callback.
1768
- * Function that should be called with an error or the OAuth2 bearer token representing the user.
1769
- * @param {string} in_options.url - The root of the url used in the request to retrieve PropertySet schemas.
1770
- *
1771
- * @returns {Promise} Return an empty promise when checkout resolve or reject with error.
1772
- */
1812
+ * Initializes the schema store.
1813
+ * @public
1814
+ * @param {Object} in_options - the store settings.
1815
+ * @param {getBearerTokenFn} in_options.getBearerToken - Function that accepts a callback.
1816
+ * Function that should be called with an error or the OAuth2 bearer token representing the user.
1817
+ * @param {string} in_options.url - The root of the url used in the request to retrieve PropertySet schemas.
1818
+ *
1819
+ * @returns {Promise} Return an empty promise when checkout resolve or reject with error.
1820
+ */
1773
1821
  async initializeSchemaStore(in_options) {
1774
1822
  // https://regex101.com/r/TlgGJp/2
1775
1823
  var regexBaseUrl = /^(https?:)?\/\/((.[-a-zA-Z0-9@:%_+~#=.]{2,256}){1,2}\.[a-z]{2,6}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(:\d{1,5})?(\/[-a-zA-Z0-9@:%_+.~#?&/=]*)*$/;
1776
- if (!in_options || !in_options.getBearerToken || !_.isFunction(in_options.getBearerToken) || !in_options.url) {
1824
+ if (!in_options ||
1825
+ !in_options.getBearerToken ||
1826
+ !_.isFunction(in_options.getBearerToken) ||
1827
+ !in_options.url) {
1777
1828
  return Promise.reject(new Error(MSG.MISSING_FSS_INIT_OPTIONS));
1778
1829
  }
1779
1830
  if (!regexBaseUrl.test(in_options.url)) {
1780
1831
  return Promise.reject(new Error(MSG.FSS_BASEURL_WRONG));
1781
1832
  }
1782
- if (in_options.url.slice(-1) !== '/') {
1783
- in_options.url = in_options.url + '/';
1833
+ if (in_options.url.slice(-1) !== "/") {
1834
+ in_options.url = in_options.url + "/";
1784
1835
  }
1785
1836
  this._templateStore = new ForgeSchemaStore(in_options);
1786
1837
  return Promise.resolve();
@@ -1796,9 +1847,12 @@ class PropertyFactory {
1796
1847
  _retrieveTemplateRequestWorker(in_task, in_callback) {
1797
1848
  var store = in_task.context;
1798
1849
  if (store) {
1799
- store.retrieveTemplate(in_task.typeid).then(function (response) {
1850
+ store
1851
+ .retrieveTemplate(in_task.typeid)
1852
+ .then(function (response) {
1800
1853
  in_callback(response);
1801
- }).catch(function (error) {
1854
+ })
1855
+ .catch(function (error) {
1802
1856
  in_callback({ error: error });
1803
1857
  });
1804
1858
  }
@@ -1837,7 +1891,8 @@ class PropertyFactory {
1837
1891
  var that = this;
1838
1892
  // 0. Inspect locally registered templates for unknown dependencies
1839
1893
  this._localPrimitivePropertiesAndTemplates.iterate(function (key, type) {
1840
- if (!that._isSpecializedConstructor(key) && PropertyTemplate.isTemplate(type.getPropertyTemplate())) {
1894
+ if (!that._isSpecializedConstructor(key) &&
1895
+ PropertyTemplate.isTemplate(type.getPropertyTemplate())) {
1841
1896
  var unknownDeps = _extractUnknownDependencies.call(that, type.getPropertyTemplate());
1842
1897
  for (var d = 0; d < unknownDeps.length; d++) {
1843
1898
  var dep = unknownDeps[d];
@@ -1867,7 +1922,7 @@ class PropertyFactory {
1867
1922
  }
1868
1923
  else {
1869
1924
  that.templateRequestsQueue.drain = function () {
1870
- var errors = _.compact(_.pluck(that.templateRequestsResults.errors, 'typeid'));
1925
+ var errors = _.compact(_.pluck(that.templateRequestsResults.errors, "typeid"));
1871
1926
  var results = that.templateRequestsResults;
1872
1927
  var resultsKeys = Object.keys(that.templateRequestsResults.schemas);
1873
1928
  var tempMissingDependencies = [];
@@ -1880,14 +1935,15 @@ class PropertyFactory {
1880
1935
  if (compiledTemplate.constants) {
1881
1936
  for (var s = 0; s < compiledTemplate.constants.length; s++) {
1882
1937
  tempConstant = compiledTemplate.constants[s];
1883
- if (tempConstant.contextKeyType === 'typeid' &&
1884
- tempConstant.context === 'map' &&
1938
+ if (tempConstant.contextKeyType === "typeid" &&
1939
+ tempConstant.context === "map" &&
1885
1940
  tempConstant.value) {
1886
1941
  var valueKeys = Object.keys(tempConstant.value);
1887
1942
  for (var z = 0; z < valueKeys.length; z++) {
1888
1943
  if (TypeIdHelper.isTemplateTypeid(valueKeys[z]) &&
1889
- !(valueKeys[z] in that.templateRequestsResults.schemas) &&
1890
- !(tempMissingDependencies.includes(valueKeys[z]))) {
1944
+ !(valueKeys[z] in
1945
+ that.templateRequestsResults.schemas) &&
1946
+ !tempMissingDependencies.includes(valueKeys[z])) {
1891
1947
  tempMissingDependencies.push(valueKeys[z]);
1892
1948
  }
1893
1949
  }
@@ -1904,7 +1960,8 @@ class PropertyFactory {
1904
1960
  if (that.templateRequestsResults.errors[missingTypeid] === undefined) {
1905
1961
  that.templateRequestsResults.errors[missingTypeid] = {};
1906
1962
  }
1907
- if (that.templateRequestsResults.schemas[missingTypeid] === undefined) {
1963
+ if (that.templateRequestsResults.schemas[missingTypeid] ===
1964
+ undefined) {
1908
1965
  that.templateRequestsResults.schemas[missingTypeid] = {};
1909
1966
  }
1910
1967
  }
@@ -1914,7 +1971,7 @@ class PropertyFactory {
1914
1971
  if (that.templateRequestsQueue.length() === 0) {
1915
1972
  that.templateRequestsResults = { errors: {}, schemas: {} };
1916
1973
  if (errors.length && errors.length > 0) {
1917
- reject(new Error('Some errors occured'));
1974
+ reject(new Error("Some errors occured"));
1918
1975
  }
1919
1976
  else {
1920
1977
  that.missingDependencies = {};