@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
@@ -6,18 +6,18 @@
6
6
  /**
7
7
  * @fileoverview In this file, we will test the utils described in /src/utils.js
8
8
  */
9
- const { ChangeSet } = require('@fluid-experimental/property-changeset');
10
- const { Utils } = require('@fluid-experimental/property-changeset');
11
- const { MSG } = require('@fluid-experimental/property-common').constants;
12
- const _ = require('lodash');
13
- const { PropertyFactory } = require('..');
14
- const { BaseProperty } = require('..');
15
- const { NodeProperty } = require('../properties/nodeProperty');
16
- describe('Utils', function () {
9
+ const { ChangeSet } = require("@fluid-experimental/property-changeset");
10
+ const { Utils } = require("@fluid-experimental/property-changeset");
11
+ const { MSG } = require("@fluid-experimental/property-common").constants;
12
+ const _ = require("lodash");
13
+ const { PropertyFactory } = require("..");
14
+ const { BaseProperty } = require("..");
15
+ const { NodeProperty } = require("../properties/nodeProperty");
16
+ describe("Utils", function () {
17
17
  before(function () {
18
18
  var TaskStatus = {
19
19
  // inherits : 'Enum',
20
- typeid: 'autodesk.test:utils.spec.task.status-1.0.0',
20
+ typeid: "autodesk.test:utils.spec.task.status-1.0.0",
21
21
  /* values : {
22
22
  running : 'running',
23
23
  created : 'created',
@@ -29,113 +29,129 @@ describe('Utils', function () {
29
29
  };
30
30
  // The subject property template to be tracked
31
31
  var TaskSubject = {
32
- inherits: ['NodeProperty'],
33
- typeid: 'autodesk.test:utils.spec.task.subject-1.0.0',
32
+ inherits: ["NodeProperty"],
33
+ typeid: "autodesk.test:utils.spec.task.subject-1.0.0",
34
34
  properties: [
35
35
  // {id: 'status', typeid: 'autodesk.test:utils_spec_status-1.0.0'},
36
- { id: 'errorMsg', typeid: 'String' },
36
+ { id: "errorMsg", typeid: "String" },
37
37
  // {id: 'result', typeid: 'BaseProperty'},
38
- { id: 'progress', typeid: 'Uint32', annotation: { min: 0, max: 100 } },
38
+ { id: "progress", typeid: "Uint32", annotation: { min: 0, max: 100 } },
39
39
  // {id: 'timeRemaining' , typeid : 'autodesk.test:utils_spec_datedelta-1.0.0'}
40
40
  ],
41
41
  };
42
42
  // The observer tracking subject(s)
43
43
  var TaskObserver = {
44
- inherits: 'autodesk.test:utils.spec.task.subject-1.0.0',
45
- typeid: 'autodesk.test:utils.spec.task.observer-1.0.0',
44
+ inherits: "autodesk.test:utils.spec.task.subject-1.0.0",
45
+ typeid: "autodesk.test:utils.spec.task.observer-1.0.0",
46
46
  properties: [
47
- { id: 'name', typeid: 'String' },
48
- { id: 'creator', typeid: 'autodesk.test:utils.spec.user-1.0.0' },
49
- { id: 'subjects', typeid: 'autodesk.test:utils.spec.task.subjectentry-1.0.0', context: 'array' },
50
- { id: 'startTime', typeid: 'autodesk.test:utils.spec.date-1.0.0' },
51
- { id: 'endTime', typeid: 'autodesk.test:utils.spec.date-1.0.0' },
47
+ { id: "name", typeid: "String" },
48
+ { id: "creator", typeid: "autodesk.test:utils.spec.user-1.0.0" },
49
+ {
50
+ id: "subjects",
51
+ typeid: "autodesk.test:utils.spec.task.subjectentry-1.0.0",
52
+ context: "array",
53
+ },
54
+ { id: "startTime", typeid: "autodesk.test:utils.spec.date-1.0.0" },
55
+ { id: "endTime", typeid: "autodesk.test:utils.spec.date-1.0.0" },
52
56
  ],
53
57
  };
54
58
  // Subject entries passed in to the 'subjects' field of the task observer
55
59
  var TaskSubjectEntries = {
56
- typeid: 'autodesk.test:utils.spec.task.subjectentry-1.0.0',
57
- properties: [
58
- { id: 'path', typeid: 'String' },
59
- ],
60
+ typeid: "autodesk.test:utils.spec.task.subjectentry-1.0.0",
61
+ properties: [{ id: "path", typeid: "String" }],
60
62
  };
61
63
  // Example usage of task subjects to be tracked
62
64
  var Sim = {
63
- inherits: ['NodeProperty'],
64
- typeid: 'autodesk.test:utils.spec.pan.sim-1.0.0',
65
+ inherits: ["NodeProperty"],
66
+ typeid: "autodesk.test:utils.spec.pan.sim-1.0.0",
65
67
  properties: [
66
- { id: 'costEstimated', typeid: 'autodesk.test:utils.spec.task.subject-1.0.0' },
67
- { id: 'costFinal', typeid: 'autodesk.test:utils.spec.task.subject-1.0.0' },
68
+ { id: "costEstimated", typeid: "autodesk.test:utils.spec.task.subject-1.0.0" },
69
+ { id: "costFinal", typeid: "autodesk.test:utils.spec.task.subject-1.0.0" },
68
70
  // set by client to start or cancel the simulation
69
- { id: 'start', typeid: 'Bool', 'default': false },
70
- { id: 'cancel', typeid: 'Bool', 'default': false },
71
+ { id: "start", typeid: "Bool", default: false },
72
+ { id: "cancel", typeid: "Bool", default: false },
71
73
  // { id: 'inputs' , typeid: 'autodesk.test:utils_spec_pan.input-1.0.0' },
72
- { id: 'thermalResults', typeid: 'autodesk.test:utils.spec.task.subject-1.0.0' },
73
- { id: 'mechanicalResults', typeid: 'autodesk.test:utils.spec.task.subject-1.0.0' },
74
+ { id: "thermalResults", typeid: "autodesk.test:utils.spec.task.subject-1.0.0" },
75
+ { id: "mechanicalResults", typeid: "autodesk.test:utils.spec.task.subject-1.0.0" },
74
76
  ],
75
77
  };
76
78
  var nestedTemplate = {
77
- typeid: 'autodesk.tests:nestedTemplate-1.0.0',
78
- properties: [{
79
- id: 'a',
80
- typeid: 'String',
81
- }, {
82
- id: 'b',
83
- typeid: 'String',
84
- }, {
85
- id: 'c',
86
- properties: [{
87
- id: 'myNestedProp',
88
- typeid: 'autodesk.test:utils.spec.task.subject-1.0.0',
89
- }],
90
- }],
79
+ typeid: "autodesk.tests:nestedTemplate-1.0.0",
80
+ properties: [
81
+ {
82
+ id: "a",
83
+ typeid: "String",
84
+ },
85
+ {
86
+ id: "b",
87
+ typeid: "String",
88
+ },
89
+ {
90
+ id: "c",
91
+ properties: [
92
+ {
93
+ id: "myNestedProp",
94
+ typeid: "autodesk.test:utils.spec.task.subject-1.0.0",
95
+ },
96
+ ],
97
+ },
98
+ ],
91
99
  };
92
100
  var QuoatablePropertyObject = {
93
- typeid: 'autodesk.tests:property.with.quotable.characters-1.0.0',
94
- properties: [{
95
- id: 'simple_property',
96
- typeid: 'String',
97
- }, {
98
- id: 'test.property',
99
- typeid: 'String',
100
- }, {
101
+ typeid: "autodesk.tests:property.with.quotable.characters-1.0.0",
102
+ properties: [
103
+ {
104
+ id: "simple_property",
105
+ typeid: "String",
106
+ },
107
+ {
108
+ id: "test.property",
109
+ typeid: "String",
110
+ },
111
+ {
101
112
  id: 'test"property"',
102
- typeid: 'String',
103
- }, {
104
- id: 'test[property]',
105
- properties: [{
106
- id: '.property.',
107
- properties: [{
108
- id: 'test',
109
- typeid: 'String',
110
- }],
111
- }],
112
- }],
113
+ typeid: "String",
114
+ },
115
+ {
116
+ id: "test[property]",
117
+ properties: [
118
+ {
119
+ id: ".property.",
120
+ properties: [
121
+ {
122
+ id: "test",
123
+ typeid: "String",
124
+ },
125
+ ],
126
+ },
127
+ ],
128
+ },
129
+ ],
113
130
  };
114
131
  var ContainedTemplate = {
115
- typeid: 'autodesk.test:utilsTestContained-1.0.0',
116
- properties: [
117
- { id: 'error"Msg"', typeid: 'String' },
118
- ],
132
+ typeid: "autodesk.test:utilsTestContained-1.0.0",
133
+ properties: [{ id: 'error"Msg"', typeid: "String" }],
119
134
  };
120
135
  var StaticNodeChild = {
121
- typeid: 'autodesk.test:staticNodeChild-1.0.0',
122
- inherits: ['NodeProperty'],
123
- properties: [
124
- { id: 'nodeProperty', typeid: 'NodeProperty' },
125
- ],
136
+ typeid: "autodesk.test:staticNodeChild-1.0.0",
137
+ inherits: ["NodeProperty"],
138
+ properties: [{ id: "nodeProperty", typeid: "NodeProperty" }],
126
139
  };
127
140
  var ParentTemplate = {
128
- typeid: 'autodesk.test:utilsTestParent-1.0.0',
141
+ typeid: "autodesk.test:utilsTestParent-1.0.0",
129
142
  properties: [
130
- { id: 'errorMsg', typeid: 'String' },
131
- { id: 'progress', typeid: 'Uint32' },
143
+ { id: "errorMsg", typeid: "String" },
144
+ { id: "progress", typeid: "Uint32" },
132
145
  {
133
- id: 'nested', properties: [
134
- { id: 'en"t"ry', typeid: 'String' },
135
- ],
146
+ id: "nested",
147
+ properties: [{ id: 'en"t"ry', typeid: "String" }],
148
+ },
149
+ { id: "contained", typeid: "autodesk.test:utilsTestContained-1.0.0" },
150
+ {
151
+ id: "containedMap",
152
+ typeid: "autodesk.test:utilsTestContained-1.0.0",
153
+ context: "map",
136
154
  },
137
- { id: 'contained', typeid: 'autodesk.test:utilsTestContained-1.0.0' },
138
- { id: 'containedMap', typeid: 'autodesk.test:utilsTestContained-1.0.0', context: 'map' },
139
155
  ],
140
156
  };
141
157
  PropertyFactory._reregister(TaskStatus);
@@ -149,108 +165,114 @@ describe('Utils', function () {
149
165
  PropertyFactory._reregister(ContainedTemplate);
150
166
  PropertyFactory._reregister(StaticNodeChild);
151
167
  });
152
- describe('Utils.traverseChangeSetRecursively', function () {
168
+ describe("Utils.traverseChangeSetRecursively", function () {
153
169
  var testRoot, contexts, namedNodePropForSet;
154
- it('should report correctly for inserts', function () {
155
- testRoot = PropertyFactory.create('NodeProperty');
156
- testRoot.insert('string', PropertyFactory.create('String'));
157
- testRoot.insert('test"Templated"Property', PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0'));
158
- testRoot.resolvePath('"test\\"Templated\\"Property".containedMap').insert('entry', PropertyFactory.create('autodesk.test:utilsTestContained-1.0.0'));
159
- testRoot.insert('reference', PropertyFactory.create('Reference<String>'));
170
+ it("should report correctly for inserts", function () {
171
+ testRoot = PropertyFactory.create("NodeProperty");
172
+ testRoot.insert("string", PropertyFactory.create("String"));
173
+ testRoot.insert('test"Templated"Property', PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0"));
174
+ testRoot
175
+ .resolvePath('"test\\"Templated\\"Property".containedMap')
176
+ .insert("entry", PropertyFactory.create("autodesk.test:utilsTestContained-1.0.0"));
177
+ testRoot.insert("reference", PropertyFactory.create("Reference<String>"));
160
178
  // Test an array with a primitive
161
- testRoot.insert('floatArray', PropertyFactory.create('Float32', 'array'));
179
+ testRoot.insert("floatArray", PropertyFactory.create("Float32", "array"));
162
180
  testRoot._properties.floatArray.insertRange(0, [1, 2, 3, 4, 5]);
163
181
  // Test an array with a complex type
164
- testRoot.insert('array', PropertyFactory.create('array<>'));
165
- var arrayNode = PropertyFactory.create('NodeProperty');
182
+ testRoot.insert("array", PropertyFactory.create("array<>"));
183
+ var arrayNode = PropertyFactory.create("NodeProperty");
166
184
  testRoot._properties.array.push(arrayNode);
167
- arrayNode.insert('string', PropertyFactory.create('String'));
185
+ arrayNode.insert("string", PropertyFactory.create("String"));
168
186
  // Test a map with a primitive
169
- testRoot.insert('floatMap', PropertyFactory.create('Float32', 'map'));
170
- testRoot._properties.floatMap.insert('test', 1);
171
- testRoot._properties.floatMap.insert('test2', 2);
172
- testRoot._properties.floatMap.insert('test3', 3);
187
+ testRoot.insert("floatMap", PropertyFactory.create("Float32", "map"));
188
+ testRoot._properties.floatMap.insert("test", 1);
189
+ testRoot._properties.floatMap.insert("test2", 2);
190
+ testRoot._properties.floatMap.insert("test3", 3);
173
191
  // Test a map with complex types
174
- testRoot.insert('map', PropertyFactory.create('map<>'));
192
+ testRoot.insert("map", PropertyFactory.create("map<>"));
175
193
  // add members
176
194
  // Simple string
177
- testRoot._properties.map.insert('string', PropertyFactory.create('String'));
195
+ testRoot._properties.map.insert("string", PropertyFactory.create("String"));
178
196
  // String with name that has to be escaped
179
- testRoot._properties.map.insert('s"tr"ing', PropertyFactory.create('String'));
197
+ testRoot._properties.map.insert('s"tr"ing', PropertyFactory.create("String"));
180
198
  // A map in a map
181
- testRoot._properties.map.insert('map', PropertyFactory.create('map<>'));
182
- testRoot._properties.map.get('map').insert('string', PropertyFactory.create('String'));
199
+ testRoot._properties.map.insert("map", PropertyFactory.create("map<>"));
200
+ testRoot._properties.map.get("map").insert("string", PropertyFactory.create("String"));
183
201
  // An array in a map
184
- testRoot._properties.map.insert('array', PropertyFactory.create('array<>'));
185
- testRoot._properties.map.get('array').insert(0, PropertyFactory.create('NodeProperty'));
186
- testRoot._properties.map.get('array').get(0).insert('string', PropertyFactory.create('String'));
202
+ testRoot._properties.map.insert("array", PropertyFactory.create("array<>"));
203
+ testRoot._properties.map.get("array").insert(0, PropertyFactory.create("NodeProperty"));
204
+ testRoot._properties.map
205
+ .get("array")
206
+ .get(0)
207
+ .insert("string", PropertyFactory.create("String"));
187
208
  // A composed property
188
- testRoot._properties.map.insert('testParent', PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0'));
209
+ testRoot._properties.map.insert("testParent", PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0"));
189
210
  // A NodeProperty
190
- testRoot._properties.map.insert('nodeProperty', PropertyFactory.create('NodeProperty'));
191
- testRoot._properties.map.get('nodeProperty').insert('string', PropertyFactory.create('String'));
211
+ testRoot._properties.map.insert("nodeProperty", PropertyFactory.create("NodeProperty"));
212
+ testRoot._properties.map
213
+ .get("nodeProperty")
214
+ .insert("string", PropertyFactory.create("String"));
192
215
  // Test a set property
193
- testRoot.insert('set', PropertyFactory.create('set<>'));
194
- namedNodePropForSet = PropertyFactory.create('NamedNodeProperty');
216
+ testRoot.insert("set", PropertyFactory.create("set<>"));
217
+ namedNodePropForSet = PropertyFactory.create("NamedNodeProperty");
195
218
  testRoot._properties.set.insert(namedNodePropForSet);
196
- namedNodePropForSet.insert('string', PropertyFactory.create('String'));
219
+ namedNodePropForSet.insert("string", PropertyFactory.create("String"));
197
220
  contexts = [];
198
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': false }), {
221
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: false }), {
199
222
  preCallback: function (in_context) {
200
223
  // Do some basic sanity checks
201
- var node = testRoot.resolvePath(in_context.getFullPath() + '*');
224
+ var node = testRoot.resolvePath(in_context.getFullPath() + "*");
202
225
  expect(node).to.be.instanceof(BaseProperty);
203
226
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
204
- if (in_context._fullPath !== '') {
205
- expect(in_context.getOperationType()).to.equal('insert');
227
+ if (in_context._fullPath !== "") {
228
+ expect(in_context.getOperationType()).to.equal("insert");
206
229
  }
207
230
  else {
208
- expect(in_context.getOperationType()).to.equal('modify');
231
+ expect(in_context.getOperationType()).to.equal("modify");
209
232
  }
210
233
  contexts.push(in_context.clone());
211
234
  },
212
235
  });
213
236
  expect(contexts.length).to.equal(38);
214
237
  });
215
- it('should work for modifications of primitive types', function () {
238
+ it("should work for modifications of primitive types", function () {
216
239
  // Clean the old modifications
217
240
  testRoot.cleanDirty();
218
241
  var modifiedStringCount = 0;
219
242
  for (var i = 0; i < contexts.length; i++) {
220
243
  var modifyNode = testRoot.resolvePath(contexts[i].getFullPath());
221
244
  // modify strings
222
- if (contexts[i].getTypeid() === 'String' &&
223
- modifyNode.getId() !== 'guid') {
224
- modifyNode.setValue('modified');
245
+ if (contexts[i].getTypeid() === "String" && modifyNode.getId() !== "guid") {
246
+ modifyNode.setValue("modified");
225
247
  modifiedStringCount++;
226
248
  }
227
249
  // modify float arrays
228
- if (contexts[i].getTypeid() === 'array<Float32>') {
250
+ if (contexts[i].getTypeid() === "array<Float32>") {
229
251
  modifyNode.push(15);
230
252
  }
231
253
  }
232
254
  // modify a float map
233
255
  // note: set removed, setValue not implemented yet
234
- testRoot._properties.floatMap.set('test', 5);
235
- testRoot._properties.floatMap.set('new_test', 7);
256
+ testRoot._properties.floatMap.set("test", 5);
257
+ testRoot._properties.floatMap.set("new_test", 7);
236
258
  var reportedStringModifiedCount = 0;
237
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
259
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
238
260
  preCallback: function (in_context) {
239
261
  // Do some basic sanity checks
240
262
  var node = testRoot.resolvePath(in_context.getFullPath());
241
263
  expect(node).to.be.instanceof(BaseProperty);
242
264
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
243
- expect(in_context.getOperationType()).to.equal('modify');
244
- if (node.getTypeid() === 'String') {
265
+ expect(in_context.getOperationType()).to.equal("modify");
266
+ if (node.getTypeid() === "String") {
245
267
  reportedStringModifiedCount++;
246
- expect(in_context.getNestedChangeSet()).to.equal('modified');
268
+ expect(in_context.getNestedChangeSet()).to.equal("modified");
247
269
  }
248
- if (in_context.getTypeid() === 'array<Float32>') {
270
+ if (in_context.getTypeid() === "array<Float32>") {
249
271
  expect(in_context.getNestedChangeSet()).to.deep.equal({
250
272
  insert: [[5, [15]]],
251
273
  });
252
274
  }
253
- if (in_context.getTypeid() === 'map<Float32>') {
275
+ if (in_context.getTypeid() === "map<Float32>") {
254
276
  expect(in_context.getNestedChangeSet()).to.deep.equal({
255
277
  insert: {
256
278
  new_test: 7,
@@ -265,179 +287,174 @@ describe('Utils', function () {
265
287
  // Make sure all modified strings have been reported
266
288
  expect(reportedStringModifiedCount).to.equal(modifiedStringCount);
267
289
  });
268
- it('should work for inserts in strings', function () {
290
+ it("should work for inserts in strings", function () {
269
291
  // Clean the old modifications
270
292
  testRoot.cleanDirty();
271
293
  for (var i = 0; i < contexts.length; i++) {
272
- if (contexts[i].getTypeid() === 'String') {
294
+ if (contexts[i].getTypeid() === "String") {
273
295
  var modifyNode = testRoot.resolvePath(contexts[i].getFullPath());
274
- if (modifyNode.getId() !== 'guid') {
275
- modifyNode.insert(3, '_inserted_');
296
+ if (modifyNode.getId() !== "guid") {
297
+ modifyNode.insert(3, "_inserted_");
276
298
  }
277
299
  }
278
300
  }
279
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
301
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
280
302
  preCallback: function (in_context) {
281
303
  // Do some basic sanity checks
282
304
  var node = testRoot.resolvePath(in_context.getFullPath());
283
305
  expect(node).to.be.instanceof(BaseProperty);
284
306
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
285
- expect(in_context.getOperationType()).to.equal('modify');
286
- if (node.getTypeid() === 'String') {
307
+ expect(in_context.getOperationType()).to.equal("modify");
308
+ if (node.getTypeid() === "String") {
287
309
  expect(in_context.getNestedChangeSet()).to.deep.equal({
288
- insert: [[3, '_inserted_']],
310
+ insert: [[3, "_inserted_"]],
289
311
  });
290
312
  }
291
313
  },
292
314
  });
293
315
  });
294
- it('should work for inserts in arrays', function () {
316
+ it("should work for inserts in arrays", function () {
295
317
  // Clean the old modifications
296
318
  testRoot.cleanDirty();
297
- var newArrayNode = PropertyFactory.create('NodeProperty');
319
+ var newArrayNode = PropertyFactory.create("NodeProperty");
298
320
  testRoot._properties.array.push(newArrayNode);
299
- newArrayNode.insert('string', PropertyFactory.create('String'));
300
- newArrayNode._properties.string.value = 'test';
301
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
321
+ newArrayNode.insert("string", PropertyFactory.create("String"));
322
+ newArrayNode._properties.string.value = "test";
323
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
302
324
  preCallback: function (in_context) {
303
325
  // Do some basic sanity checks
304
326
  var node = testRoot.resolvePath(in_context.getFullPath());
305
327
  expect(node).to.be.instanceof(BaseProperty);
306
328
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
307
- if (in_context.getFullPath() !== '' &&
308
- in_context.getFullPath() !== 'array') {
309
- expect(in_context.getOperationType()).to.equal('insert');
329
+ if (in_context.getFullPath() !== "" && in_context.getFullPath() !== "array") {
330
+ expect(in_context.getOperationType()).to.equal("insert");
310
331
  }
311
332
  else {
312
- expect(in_context.getOperationType()).to.equal('modify');
333
+ expect(in_context.getOperationType()).to.equal("modify");
313
334
  }
314
- if (node.getTypeid() === 'String') {
315
- expect(in_context.getNestedChangeSet()).to.equal('test');
335
+ if (node.getTypeid() === "String") {
336
+ expect(in_context.getNestedChangeSet()).to.equal("test");
316
337
  }
317
338
  },
318
339
  });
319
340
  });
320
- it('should work for inserts in sets', function () {
341
+ it("should work for inserts in sets", function () {
321
342
  // Clean the old modifications
322
343
  testRoot.cleanDirty();
323
- var newSetNode = PropertyFactory.create('NamedNodeProperty');
344
+ var newSetNode = PropertyFactory.create("NamedNodeProperty");
324
345
  testRoot._properties.set.insert(newSetNode);
325
- newSetNode.insert('string', PropertyFactory.create('String'));
326
- newSetNode._properties.string.setValue('test');
327
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
346
+ newSetNode.insert("string", PropertyFactory.create("String"));
347
+ newSetNode._properties.string.setValue("test");
348
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
328
349
  preCallback: function (in_context) {
329
350
  // Do some basic sanity checks
330
351
  var node = testRoot.resolvePath(in_context.getFullPath());
331
352
  expect(node).to.be.instanceof(BaseProperty);
332
353
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
333
- if (in_context.getFullPath() !== '' &&
334
- in_context.getFullPath() !== 'set') {
335
- expect(in_context.getOperationType()).to.equal('insert');
354
+ if (in_context.getFullPath() !== "" && in_context.getFullPath() !== "set") {
355
+ expect(in_context.getOperationType()).to.equal("insert");
336
356
  }
337
357
  else {
338
- expect(in_context.getOperationType()).to.equal('modify');
358
+ expect(in_context.getOperationType()).to.equal("modify");
339
359
  }
340
- if (node.getTypeid() === 'String') {
360
+ if (node.getTypeid() === "String") {
341
361
  expect(in_context.getNestedChangeSet()).to.equal(node.value);
342
362
  }
343
363
  },
344
364
  });
345
365
  });
346
- it('should work for node property removals', function () {
366
+ it("should work for node property removals", function () {
347
367
  // Clean the old modifications
348
368
  testRoot.cleanDirty();
349
369
  var removedStrings = [];
350
370
  for (var i = 0; i < contexts.length; i++) {
351
- if (contexts[i].getTypeid() === 'NodeProperty') {
371
+ if (contexts[i].getTypeid() === "NodeProperty") {
352
372
  var modifyNode = testRoot.resolvePath(contexts[i].getFullPath());
353
373
  removedStrings.push(modifyNode._properties.string.getAbsolutePath());
354
- modifyNode.remove('string');
374
+ modifyNode.remove("string");
355
375
  }
356
376
  }
357
377
  var actualStringRemoveCount = 0;
358
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
378
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
359
379
  preCallback: function (in_context) {
360
380
  var node = testRoot.resolvePath(in_context.getFullPath());
361
381
  if (node) {
362
- expect(in_context.getOperationType()).to.equal('modify');
382
+ expect(in_context.getOperationType()).to.equal("modify");
363
383
  }
364
384
  else {
365
- expect(in_context.getOperationType()).to.equal('remove');
366
- expect(removedStrings.indexOf('/' + in_context.getFullPath())).to.not.equal(-1);
385
+ expect(in_context.getOperationType()).to.equal("remove");
386
+ expect(removedStrings.indexOf("/" + in_context.getFullPath())).to.not.equal(-1);
367
387
  actualStringRemoveCount++;
368
388
  }
369
389
  },
370
390
  });
371
391
  expect(removedStrings.length).to.equal(actualStringRemoveCount);
372
392
  });
373
- it('should work for array removals', function () {
393
+ it("should work for array removals", function () {
374
394
  // Clean the old modifications
375
395
  testRoot.cleanDirty();
376
396
  testRoot._properties.array.removeRange(0, 2);
377
397
  var arrayRemovalCount = 0;
378
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
398
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
379
399
  preCallback: function (in_context) {
380
- if (in_context.getFullPath() === '' ||
381
- in_context.getFullPath() === 'array') {
382
- expect(in_context.getOperationType()).to.equal('modify');
400
+ if (in_context.getFullPath() === "" || in_context.getFullPath() === "array") {
401
+ expect(in_context.getOperationType()).to.equal("modify");
383
402
  }
384
403
  else {
385
- expect(in_context.getOperationType()).to.equal('remove');
404
+ expect(in_context.getOperationType()).to.equal("remove");
386
405
  arrayRemovalCount++;
387
406
  }
388
407
  },
389
408
  });
390
409
  expect(arrayRemovalCount).to.equal(2);
391
410
  });
392
- it('should work for map removals', function () {
411
+ it("should work for map removals", function () {
393
412
  // Clean the old modifications
394
413
  testRoot.cleanDirty();
395
- testRoot._properties.map.remove('string');
414
+ testRoot._properties.map.remove("string");
396
415
  var mapRemovalCount = 0;
397
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
416
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
398
417
  preCallback: function (in_context) {
399
- if (in_context.getFullPath() === '' ||
400
- in_context.getFullPath() === 'map') {
401
- expect(in_context.getOperationType()).to.equal('modify');
418
+ if (in_context.getFullPath() === "" || in_context.getFullPath() === "map") {
419
+ expect(in_context.getOperationType()).to.equal("modify");
402
420
  }
403
421
  else {
404
- expect(in_context.getOperationType()).to.equal('remove');
422
+ expect(in_context.getOperationType()).to.equal("remove");
405
423
  mapRemovalCount++;
406
424
  }
407
425
  },
408
426
  });
409
427
  expect(mapRemovalCount).to.equal(1);
410
428
  });
411
- it('should work for set removals', function () {
429
+ it("should work for set removals", function () {
412
430
  // Clean the old modifications
413
431
  testRoot.cleanDirty();
414
432
  testRoot._properties.set.remove(namedNodePropForSet);
415
433
  var setRemovalCount = 0;
416
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
434
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
417
435
  preCallback: function (in_context) {
418
- if (in_context.getFullPath() === '' ||
419
- in_context.getFullPath() === 'set') {
420
- expect(in_context.getOperationType()).to.equal('modify');
436
+ if (in_context.getFullPath() === "" || in_context.getFullPath() === "set") {
437
+ expect(in_context.getOperationType()).to.equal("modify");
421
438
  }
422
439
  else {
423
- expect(in_context.getOperationType()).to.equal('remove');
440
+ expect(in_context.getOperationType()).to.equal("remove");
424
441
  setRemovalCount++;
425
442
  }
426
443
  },
427
444
  });
428
445
  expect(setRemovalCount).to.equal(1);
429
446
  });
430
- it('should clone the context correctly', function () {
431
- testRoot.insert('setClone', PropertyFactory.create('set<>'));
432
- var namedNodePropForSet1 = PropertyFactory.create('NamedNodeProperty');
433
- var namedNodePropForSet2 = PropertyFactory.create('NamedNodeProperty');
434
- var namedNodePropForSet3 = PropertyFactory.create('NamedNodeProperty');
447
+ it("should clone the context correctly", function () {
448
+ testRoot.insert("setClone", PropertyFactory.create("set<>"));
449
+ var namedNodePropForSet1 = PropertyFactory.create("NamedNodeProperty");
450
+ var namedNodePropForSet2 = PropertyFactory.create("NamedNodeProperty");
451
+ var namedNodePropForSet3 = PropertyFactory.create("NamedNodeProperty");
435
452
  testRoot._properties.setClone.insert(namedNodePropForSet1);
436
453
  testRoot._properties.setClone.insert(namedNodePropForSet2);
437
454
  testRoot._properties.setClone.insert(namedNodePropForSet3);
438
- namedNodePropForSet1.insert('string1', PropertyFactory.create('String'));
439
- namedNodePropForSet2.insert('string2', PropertyFactory.create('String'));
440
- namedNodePropForSet3.insert('string3', PropertyFactory.create('String'));
455
+ namedNodePropForSet1.insert("string1", PropertyFactory.create("String"));
456
+ namedNodePropForSet2.insert("string2", PropertyFactory.create("String"));
457
+ namedNodePropForSet3.insert("string3", PropertyFactory.create("String"));
441
458
  // Clean the old modifications
442
459
  testRoot.cleanDirty();
443
460
  testRoot._properties.setClone.remove(namedNodePropForSet1);
@@ -445,14 +462,14 @@ describe('Utils', function () {
445
462
  testRoot._properties.setClone.remove(namedNodePropForSet3);
446
463
  var setRemovalCount = 0;
447
464
  var contextCloneCount = 0;
448
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
465
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
449
466
  preCallback: function (in_context) {
450
- if (in_context.getFullPath() === '' ||
451
- in_context.getFullPath() === 'setClone') {
452
- expect(in_context.getOperationType()).to.equal('modify');
467
+ if (in_context.getFullPath() === "" ||
468
+ in_context.getFullPath() === "setClone") {
469
+ expect(in_context.getOperationType()).to.equal("modify");
453
470
  }
454
471
  else {
455
- expect(in_context.getOperationType()).to.equal('remove');
472
+ expect(in_context.getOperationType()).to.equal("remove");
456
473
  setRemovalCount++;
457
474
  }
458
475
  var cloneContext = in_context.clone();
@@ -463,79 +480,86 @@ describe('Utils', function () {
463
480
  expect(setRemovalCount).to.equal(3);
464
481
  expect(contextCloneCount >= 3).to.be.true; // we should clone at least 3 times (probably more)
465
482
  });
466
- it('@regression should work when replacing a map element', function () {
483
+ it("@regression should work when replacing a map element", function () {
467
484
  // Clean the old modifications
468
485
  testRoot.cleanDirty();
469
- testRoot._properties.map.set('nodeProperty', PropertyFactory.create('NamedNodeProperty'));
486
+ testRoot._properties.map.set("nodeProperty", PropertyFactory.create("NamedNodeProperty"));
470
487
  var operationtypes = [];
471
- Utils.traverseChangeSetRecursively(testRoot.serialize({ 'dirtyOnly': true }), {
488
+ Utils.traverseChangeSetRecursively(testRoot.serialize({ dirtyOnly: true }), {
472
489
  preCallback: function (in_context) {
473
490
  // expect operations to be 'remove' and 'insert'
474
- if (in_context.getFullPath() === 'map[nodeProperty]') {
491
+ if (in_context.getFullPath() === "map[nodeProperty]") {
475
492
  operationtypes.push(in_context.getOperationType());
476
493
  }
477
494
  },
478
495
  });
479
- expect(operationtypes).to.deep.equal(['remove', 'insert']);
496
+ expect(operationtypes).to.deep.equal(["remove", "insert"]);
480
497
  });
481
498
  });
482
- describe('Utils.traverseChangeSetRecursivelyAsync', function () {
499
+ describe("Utils.traverseChangeSetRecursivelyAsync", function () {
483
500
  var testRoot, contexts, namedNodePropForSet;
484
- it('should report correctly for inserts', function (done) {
485
- testRoot = PropertyFactory.create('NodeProperty');
486
- testRoot.insert('string', PropertyFactory.create('String'));
487
- testRoot.insert('test"Templated"Property', PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0'));
488
- testRoot.resolvePath('"test\\"Templated\\"Property".containedMap').insert('entry', PropertyFactory.create('autodesk.test:utilsTestContained-1.0.0'));
489
- testRoot.insert('reference', PropertyFactory.create('Reference<String>'));
501
+ it("should report correctly for inserts", function (done) {
502
+ testRoot = PropertyFactory.create("NodeProperty");
503
+ testRoot.insert("string", PropertyFactory.create("String"));
504
+ testRoot.insert('test"Templated"Property', PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0"));
505
+ testRoot
506
+ .resolvePath('"test\\"Templated\\"Property".containedMap')
507
+ .insert("entry", PropertyFactory.create("autodesk.test:utilsTestContained-1.0.0"));
508
+ testRoot.insert("reference", PropertyFactory.create("Reference<String>"));
490
509
  // Test an array with a primitive
491
- testRoot.insert('floatArray', PropertyFactory.create('Float32', 'array'));
510
+ testRoot.insert("floatArray", PropertyFactory.create("Float32", "array"));
492
511
  testRoot._properties.floatArray.insertRange(0, [1, 2, 3, 4, 5]);
493
512
  // Test an array with a complex type
494
- testRoot.insert('array', PropertyFactory.create('array<>'));
495
- var arrayNode = PropertyFactory.create('NodeProperty');
513
+ testRoot.insert("array", PropertyFactory.create("array<>"));
514
+ var arrayNode = PropertyFactory.create("NodeProperty");
496
515
  testRoot._properties.array.push(arrayNode);
497
- arrayNode.insert('string', PropertyFactory.create('String'));
516
+ arrayNode.insert("string", PropertyFactory.create("String"));
498
517
  // Test a map with a primitive
499
- testRoot.insert('floatMap', PropertyFactory.create('Float32', 'map'));
500
- testRoot._properties.floatMap.insert('test', 1);
501
- testRoot._properties.floatMap.insert('test2', 2);
502
- testRoot._properties.floatMap.insert('test3', 3);
518
+ testRoot.insert("floatMap", PropertyFactory.create("Float32", "map"));
519
+ testRoot._properties.floatMap.insert("test", 1);
520
+ testRoot._properties.floatMap.insert("test2", 2);
521
+ testRoot._properties.floatMap.insert("test3", 3);
503
522
  // Test a map with complex types
504
- testRoot.insert('map', PropertyFactory.create('map<>'));
523
+ testRoot.insert("map", PropertyFactory.create("map<>"));
505
524
  // add members
506
525
  // Simple string
507
- testRoot._properties.map.insert('string', PropertyFactory.create('String'));
526
+ testRoot._properties.map.insert("string", PropertyFactory.create("String"));
508
527
  // String with name that has to be escaped
509
- testRoot._properties.map.insert('s"tr"ing', PropertyFactory.create('String'));
528
+ testRoot._properties.map.insert('s"tr"ing', PropertyFactory.create("String"));
510
529
  // A map in a map
511
- testRoot._properties.map.insert('map', PropertyFactory.create('map<>'));
512
- testRoot._properties.map.get('map').insert('string', PropertyFactory.create('String'));
530
+ testRoot._properties.map.insert("map", PropertyFactory.create("map<>"));
531
+ testRoot._properties.map.get("map").insert("string", PropertyFactory.create("String"));
513
532
  // An array in a map
514
- testRoot._properties.map.insert('array', PropertyFactory.create('array<>'));
515
- testRoot._properties.map.get('array').insert(0, PropertyFactory.create('NodeProperty'));
516
- testRoot._properties.map.get('array').get(0).insert('string', PropertyFactory.create('String'));
533
+ testRoot._properties.map.insert("array", PropertyFactory.create("array<>"));
534
+ testRoot._properties.map.get("array").insert(0, PropertyFactory.create("NodeProperty"));
535
+ testRoot._properties.map
536
+ .get("array")
537
+ .get(0)
538
+ .insert("string", PropertyFactory.create("String"));
517
539
  // A composed property
518
- testRoot._properties.map.insert('testParent', PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0'));
540
+ testRoot._properties.map.insert("testParent", PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0"));
519
541
  // A NodeProperty
520
- testRoot._properties.map.insert('nodeProperty', PropertyFactory.create('NodeProperty'));
521
- testRoot._properties.map.get('nodeProperty').insert('string', PropertyFactory.create('String'));
542
+ testRoot._properties.map.insert("nodeProperty", PropertyFactory.create("NodeProperty"));
543
+ testRoot._properties.map
544
+ .get("nodeProperty")
545
+ .insert("string", PropertyFactory.create("String"));
522
546
  // Test a set property
523
- testRoot.insert('set', PropertyFactory.create('set<>'));
524
- namedNodePropForSet = PropertyFactory.create('NamedNodeProperty');
547
+ testRoot.insert("set", PropertyFactory.create("set<>"));
548
+ namedNodePropForSet = PropertyFactory.create("NamedNodeProperty");
525
549
  testRoot._properties.set.insert(namedNodePropForSet);
526
- namedNodePropForSet.insert('string', PropertyFactory.create('String'));
550
+ namedNodePropForSet.insert("string", PropertyFactory.create("String"));
527
551
  contexts = [];
528
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': false }), {
552
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: false }), {
529
553
  preCallback: function (in_context, cb) {
530
554
  // Do some basic sanity checks
531
- var node = testRoot.resolvePath(in_context.getFullPath() + '*');
555
+ var node = testRoot.resolvePath(in_context.getFullPath() + "*");
532
556
  expect(node).to.be.instanceof(BaseProperty);
533
557
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
534
- if (in_context._fullPath !== '') {
535
- expect(in_context.getOperationType()).to.equal('insert');
558
+ if (in_context._fullPath !== "") {
559
+ expect(in_context.getOperationType()).to.equal("insert");
536
560
  }
537
561
  else {
538
- expect(in_context.getOperationType()).to.equal('modify');
562
+ expect(in_context.getOperationType()).to.equal("modify");
539
563
  }
540
564
  contexts.push(in_context.clone());
541
565
  setImmediate(cb);
@@ -545,45 +569,44 @@ describe('Utils', function () {
545
569
  done();
546
570
  });
547
571
  });
548
- it('should work for modifications of primitive types', function (done) {
572
+ it("should work for modifications of primitive types", function (done) {
549
573
  // Clean the old modifications
550
574
  testRoot.cleanDirty();
551
575
  var modifiedStringCount = 0;
552
576
  for (var i = 0; i < contexts.length; i++) {
553
577
  var modifyNode = testRoot.resolvePath(contexts[i].getFullPath());
554
578
  // modify strings
555
- if (contexts[i].getTypeid() === 'String' &&
556
- modifyNode.getId() !== 'guid') {
557
- modifyNode.setValue('modified');
579
+ if (contexts[i].getTypeid() === "String" && modifyNode.getId() !== "guid") {
580
+ modifyNode.setValue("modified");
558
581
  modifiedStringCount++;
559
582
  }
560
583
  // modify float arrays
561
- if (contexts[i].getTypeid() === 'array<Float32>') {
584
+ if (contexts[i].getTypeid() === "array<Float32>") {
562
585
  modifyNode.push(15);
563
586
  }
564
587
  }
565
588
  // modify a float map
566
589
  // note: set removed, setValue not implemented yet
567
- testRoot._properties.floatMap.set('test', 5);
568
- testRoot._properties.floatMap.set('new_test', 7);
590
+ testRoot._properties.floatMap.set("test", 5);
591
+ testRoot._properties.floatMap.set("new_test", 7);
569
592
  var reportedStringModifiedCount = 0;
570
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
593
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
571
594
  preCallback: function (in_context, cb) {
572
595
  // Do some basic sanity checks
573
596
  var node = testRoot.resolvePath(in_context.getFullPath());
574
597
  expect(node).to.be.instanceof(BaseProperty);
575
598
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
576
- expect(in_context.getOperationType()).to.equal('modify');
577
- if (node.getTypeid() === 'String') {
599
+ expect(in_context.getOperationType()).to.equal("modify");
600
+ if (node.getTypeid() === "String") {
578
601
  reportedStringModifiedCount++;
579
- expect(in_context.getNestedChangeSet()).to.equal('modified');
602
+ expect(in_context.getNestedChangeSet()).to.equal("modified");
580
603
  }
581
- if (in_context.getTypeid() === 'array<Float32>') {
604
+ if (in_context.getTypeid() === "array<Float32>") {
582
605
  expect(in_context.getNestedChangeSet()).to.deep.equal({
583
606
  insert: [[5, [15]]],
584
607
  });
585
608
  }
586
- if (in_context.getTypeid() === 'map<Float32>') {
609
+ if (in_context.getTypeid() === "map<Float32>") {
587
610
  expect(in_context.getNestedChangeSet()).to.deep.equal({
588
611
  insert: {
589
612
  new_test: 7,
@@ -601,27 +624,27 @@ describe('Utils', function () {
601
624
  done();
602
625
  });
603
626
  });
604
- it('should work for inserts in strings', function (done) {
627
+ it("should work for inserts in strings", function (done) {
605
628
  // Clean the old modifications
606
629
  testRoot.cleanDirty();
607
630
  for (var i = 0; i < contexts.length; i++) {
608
- if (contexts[i].getTypeid() === 'String') {
631
+ if (contexts[i].getTypeid() === "String") {
609
632
  var modifyNode = testRoot.resolvePath(contexts[i].getFullPath());
610
- if (modifyNode.getId() !== 'guid') {
611
- modifyNode.insert(3, '_inserted_');
633
+ if (modifyNode.getId() !== "guid") {
634
+ modifyNode.insert(3, "_inserted_");
612
635
  }
613
636
  }
614
637
  }
615
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
638
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
616
639
  preCallback: function (in_context, cb) {
617
640
  // Do some basic sanity checks
618
641
  var node = testRoot.resolvePath(in_context.getFullPath());
619
642
  expect(node).to.be.instanceof(BaseProperty);
620
643
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
621
- expect(in_context.getOperationType()).to.equal('modify');
622
- if (node.getTypeid() === 'String') {
644
+ expect(in_context.getOperationType()).to.equal("modify");
645
+ if (node.getTypeid() === "String") {
623
646
  expect(in_context.getNestedChangeSet()).to.deep.equal({
624
- insert: [[3, '_inserted_']],
647
+ insert: [[3, "_inserted_"]],
625
648
  });
626
649
  }
627
650
  setImmediate(cb);
@@ -630,28 +653,28 @@ describe('Utils', function () {
630
653
  done();
631
654
  });
632
655
  });
633
- it('should work for inserts in arrays', function (done) {
656
+ it("should work for inserts in arrays", function (done) {
634
657
  // Clean the old modifications
635
658
  testRoot.cleanDirty();
636
- var newArrayNode = PropertyFactory.create('NodeProperty');
659
+ var newArrayNode = PropertyFactory.create("NodeProperty");
637
660
  testRoot._properties.array.push(newArrayNode);
638
- newArrayNode.insert('string', PropertyFactory.create('String'));
639
- newArrayNode._properties.string.value = 'test';
640
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
661
+ newArrayNode.insert("string", PropertyFactory.create("String"));
662
+ newArrayNode._properties.string.value = "test";
663
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
641
664
  preCallback: function (in_context, cb) {
642
665
  // Do some basic sanity checks
643
666
  var node = testRoot.resolvePath(in_context.getFullPath());
644
667
  expect(node).to.be.instanceof(BaseProperty);
645
668
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
646
- if (in_context.getFullPath() !== '' &&
647
- in_context.getFullPath() !== 'array') {
648
- expect(in_context.getOperationType()).to.equal('insert');
669
+ if (in_context.getFullPath() !== "" &&
670
+ in_context.getFullPath() !== "array") {
671
+ expect(in_context.getOperationType()).to.equal("insert");
649
672
  }
650
673
  else {
651
- expect(in_context.getOperationType()).to.equal('modify');
674
+ expect(in_context.getOperationType()).to.equal("modify");
652
675
  }
653
- if (node.getTypeid() === 'String') {
654
- expect(in_context.getNestedChangeSet()).to.equal('test');
676
+ if (node.getTypeid() === "String") {
677
+ expect(in_context.getNestedChangeSet()).to.equal("test");
655
678
  }
656
679
  setImmediate(cb);
657
680
  },
@@ -659,54 +682,53 @@ describe('Utils', function () {
659
682
  done();
660
683
  });
661
684
  });
662
- it('should work for inserts in sets', function (done) {
685
+ it("should work for inserts in sets", function (done) {
663
686
  // Clean the old modifications
664
687
  testRoot.cleanDirty();
665
- var newSetNode = PropertyFactory.create('NamedNodeProperty');
688
+ var newSetNode = PropertyFactory.create("NamedNodeProperty");
666
689
  testRoot._properties.set.insert(newSetNode);
667
- newSetNode.insert('string', PropertyFactory.create('String'));
668
- newSetNode._properties.string.setValue('test');
669
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
690
+ newSetNode.insert("string", PropertyFactory.create("String"));
691
+ newSetNode._properties.string.setValue("test");
692
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
670
693
  preCallback: function (in_context, cb) {
671
694
  // Do some basic sanity checks
672
695
  var node = testRoot.resolvePath(in_context.getFullPath());
673
696
  expect(node).to.be.instanceof(BaseProperty);
674
697
  expect(node.getTypeid()).to.equal(in_context._splitTypeId.typeid);
675
- if (in_context.getFullPath() !== '' &&
676
- in_context.getFullPath() !== 'set') {
677
- expect(in_context.getOperationType()).to.equal('insert');
698
+ if (in_context.getFullPath() !== "" && in_context.getFullPath() !== "set") {
699
+ expect(in_context.getOperationType()).to.equal("insert");
678
700
  }
679
701
  else {
680
- expect(in_context.getOperationType()).to.equal('modify');
702
+ expect(in_context.getOperationType()).to.equal("modify");
681
703
  }
682
- if (node.getTypeid() === 'String') {
704
+ if (node.getTypeid() === "String") {
683
705
  expect(in_context.getNestedChangeSet()).to.equal(node.value);
684
706
  }
685
707
  setImmediate(cb);
686
708
  },
687
709
  }, done);
688
710
  });
689
- it('should work for node property removals', function (done) {
711
+ it("should work for node property removals", function (done) {
690
712
  // Clean the old modifications
691
713
  testRoot.cleanDirty();
692
714
  var removedStrings = [];
693
715
  for (var i = 0; i < contexts.length; i++) {
694
- if (contexts[i].getTypeid() === 'NodeProperty') {
716
+ if (contexts[i].getTypeid() === "NodeProperty") {
695
717
  var modifyNode = testRoot.resolvePath(contexts[i].getFullPath());
696
718
  removedStrings.push(modifyNode._properties.string.getAbsolutePath());
697
- modifyNode.remove('string');
719
+ modifyNode.remove("string");
698
720
  }
699
721
  }
700
722
  var actualStringRemoveCount = 0;
701
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
723
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
702
724
  preCallback: function (in_context, cb) {
703
725
  var node = testRoot.resolvePath(in_context.getFullPath());
704
726
  if (node) {
705
- expect(in_context.getOperationType()).to.equal('modify');
727
+ expect(in_context.getOperationType()).to.equal("modify");
706
728
  }
707
729
  else {
708
- expect(in_context.getOperationType()).to.equal('remove');
709
- expect(removedStrings.indexOf('/' + in_context.getFullPath())).to.not.equal(-1);
730
+ expect(in_context.getOperationType()).to.equal("remove");
731
+ expect(removedStrings.indexOf("/" + in_context.getFullPath())).to.not.equal(-1);
710
732
  actualStringRemoveCount++;
711
733
  }
712
734
  setImmediate(cb);
@@ -716,19 +738,19 @@ describe('Utils', function () {
716
738
  done();
717
739
  });
718
740
  });
719
- it('should work for array removals', function (done) {
741
+ it("should work for array removals", function (done) {
720
742
  // Clean the old modifications
721
743
  testRoot.cleanDirty();
722
744
  testRoot._properties.array.removeRange(0, 2);
723
745
  var arrayRemovalCount = 0;
724
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
746
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
725
747
  preCallback: function (in_context, cb) {
726
- if (in_context.getFullPath() === '' ||
727
- in_context.getFullPath() === 'array') {
728
- expect(in_context.getOperationType()).to.equal('modify');
748
+ if (in_context.getFullPath() === "" ||
749
+ in_context.getFullPath() === "array") {
750
+ expect(in_context.getOperationType()).to.equal("modify");
729
751
  }
730
752
  else {
731
- expect(in_context.getOperationType()).to.equal('remove');
753
+ expect(in_context.getOperationType()).to.equal("remove");
732
754
  arrayRemovalCount++;
733
755
  }
734
756
  setImmediate(cb);
@@ -738,19 +760,18 @@ describe('Utils', function () {
738
760
  done();
739
761
  });
740
762
  });
741
- it('should work for map removals', function (done) {
763
+ it("should work for map removals", function (done) {
742
764
  // Clean the old modifications
743
765
  testRoot.cleanDirty();
744
- testRoot._properties.map.remove('string');
766
+ testRoot._properties.map.remove("string");
745
767
  var mapRemovalCount = 0;
746
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
768
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
747
769
  preCallback: function (in_context, cb) {
748
- if (in_context.getFullPath() === '' ||
749
- in_context.getFullPath() === 'map') {
750
- expect(in_context.getOperationType()).to.equal('modify');
770
+ if (in_context.getFullPath() === "" || in_context.getFullPath() === "map") {
771
+ expect(in_context.getOperationType()).to.equal("modify");
751
772
  }
752
773
  else {
753
- expect(in_context.getOperationType()).to.equal('remove');
774
+ expect(in_context.getOperationType()).to.equal("remove");
754
775
  mapRemovalCount++;
755
776
  }
756
777
  setImmediate(cb);
@@ -760,19 +781,18 @@ describe('Utils', function () {
760
781
  done();
761
782
  });
762
783
  });
763
- it('should work for set removals', function (done) {
784
+ it("should work for set removals", function (done) {
764
785
  // Clean the old modifications
765
786
  testRoot.cleanDirty();
766
787
  testRoot._properties.set.remove(namedNodePropForSet);
767
788
  var setRemovalCount = 0;
768
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
789
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
769
790
  preCallback: function (in_context, cb) {
770
- if (in_context.getFullPath() === '' ||
771
- in_context.getFullPath() === 'set') {
772
- expect(in_context.getOperationType()).to.equal('modify');
791
+ if (in_context.getFullPath() === "" || in_context.getFullPath() === "set") {
792
+ expect(in_context.getOperationType()).to.equal("modify");
773
793
  }
774
794
  else {
775
- expect(in_context.getOperationType()).to.equal('remove');
795
+ expect(in_context.getOperationType()).to.equal("remove");
776
796
  setRemovalCount++;
777
797
  }
778
798
  setImmediate(cb);
@@ -782,17 +802,17 @@ describe('Utils', function () {
782
802
  done();
783
803
  });
784
804
  });
785
- it('should clone the context correctly', function (done) {
786
- testRoot.insert('setClone', PropertyFactory.create('set<>'));
787
- var namedNodePropForSet1 = PropertyFactory.create('NamedNodeProperty');
788
- var namedNodePropForSet2 = PropertyFactory.create('NamedNodeProperty');
789
- var namedNodePropForSet3 = PropertyFactory.create('NamedNodeProperty');
805
+ it("should clone the context correctly", function (done) {
806
+ testRoot.insert("setClone", PropertyFactory.create("set<>"));
807
+ var namedNodePropForSet1 = PropertyFactory.create("NamedNodeProperty");
808
+ var namedNodePropForSet2 = PropertyFactory.create("NamedNodeProperty");
809
+ var namedNodePropForSet3 = PropertyFactory.create("NamedNodeProperty");
790
810
  testRoot._properties.setClone.insert(namedNodePropForSet1);
791
811
  testRoot._properties.setClone.insert(namedNodePropForSet2);
792
812
  testRoot._properties.setClone.insert(namedNodePropForSet3);
793
- namedNodePropForSet1.insert('string1', PropertyFactory.create('String'));
794
- namedNodePropForSet2.insert('string2', PropertyFactory.create('String'));
795
- namedNodePropForSet3.insert('string3', PropertyFactory.create('String'));
813
+ namedNodePropForSet1.insert("string1", PropertyFactory.create("String"));
814
+ namedNodePropForSet2.insert("string2", PropertyFactory.create("String"));
815
+ namedNodePropForSet3.insert("string3", PropertyFactory.create("String"));
796
816
  // Clean the old modifications
797
817
  testRoot.cleanDirty();
798
818
  testRoot._properties.setClone.remove(namedNodePropForSet1);
@@ -800,14 +820,14 @@ describe('Utils', function () {
800
820
  testRoot._properties.setClone.remove(namedNodePropForSet3);
801
821
  var setRemovalCount = 0;
802
822
  var contextCloneCount = 0;
803
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
823
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
804
824
  preCallback: function (in_context, cb) {
805
- if (in_context.getFullPath() === '' ||
806
- in_context.getFullPath() === 'setClone') {
807
- expect(in_context.getOperationType()).to.equal('modify');
825
+ if (in_context.getFullPath() === "" ||
826
+ in_context.getFullPath() === "setClone") {
827
+ expect(in_context.getOperationType()).to.equal("modify");
808
828
  }
809
829
  else {
810
- expect(in_context.getOperationType()).to.equal('remove');
830
+ expect(in_context.getOperationType()).to.equal("remove");
811
831
  setRemovalCount++;
812
832
  }
813
833
  var cloneContext = in_context.clone();
@@ -821,34 +841,34 @@ describe('Utils', function () {
821
841
  done();
822
842
  });
823
843
  });
824
- it('@regression should work for mixed modifications and removals', function (done) {
844
+ it("@regression should work for mixed modifications and removals", function (done) {
825
845
  // This test uses its own property sets tree
826
- var ownRoot = PropertyFactory.create('NodeProperty');
827
- var userInfo = PropertyFactory.create('NodeProperty');
828
- userInfo.insert('name', PropertyFactory.create('String', 'single', 'John Doe'));
829
- userInfo.insert('isResident', PropertyFactory.create('Bool', 'single', true));
830
- ownRoot.insert('userInfo', userInfo);
831
- var numberOfResidents = PropertyFactory.create('Int32', 'single', 1);
832
- ownRoot.insert('numberOfResidents', numberOfResidents);
846
+ var ownRoot = PropertyFactory.create("NodeProperty");
847
+ var userInfo = PropertyFactory.create("NodeProperty");
848
+ userInfo.insert("name", PropertyFactory.create("String", "single", "John Doe"));
849
+ userInfo.insert("isResident", PropertyFactory.create("Bool", "single", true));
850
+ ownRoot.insert("userInfo", userInfo);
851
+ var numberOfResidents = PropertyFactory.create("Int32", "single", 1);
852
+ ownRoot.insert("numberOfResidents", numberOfResidents);
833
853
  ownRoot.cleanDirty();
834
- ownRoot.get(['userInfo', 'name']).setValue('Johnny B. Goode');
835
- ownRoot.get('userInfo').remove('isResident');
836
- ownRoot.get('numberOfResidents').setValue(0);
854
+ ownRoot.get(["userInfo", "name"]).setValue("Johnny B. Goode");
855
+ ownRoot.get("userInfo").remove("isResident");
856
+ ownRoot.get("numberOfResidents").setValue(0);
837
857
  var modifiedCount = 0;
838
- var serializedCS = ownRoot.serialize({ 'dirtyOnly': true });
858
+ var serializedCS = ownRoot.serialize({ dirtyOnly: true });
839
859
  Utils.traverseChangeSetRecursivelyAsync(serializedCS, {
840
860
  preCallback: function (in_context, cb) {
841
861
  var node = ownRoot.resolvePath(in_context.getFullPath());
842
862
  if (node) {
843
- expect(in_context.getOperationType()).to.equal('modify');
844
- if (in_context.getLastSegment() === 'name' ||
845
- in_context.getLastSegment() === 'numberOfResidents') {
863
+ expect(in_context.getOperationType()).to.equal("modify");
864
+ if (in_context.getLastSegment() === "name" ||
865
+ in_context.getLastSegment() === "numberOfResidents") {
846
866
  modifiedCount++;
847
867
  }
848
868
  }
849
869
  else {
850
- expect(in_context.getOperationType()).to.equal('remove');
851
- expect(in_context.getLastSegment()).to.equal('isResident');
870
+ expect(in_context.getOperationType()).to.equal("remove");
871
+ expect(in_context.getLastSegment()).to.equal("isResident");
852
872
  }
853
873
  setImmediate(cb);
854
874
  },
@@ -857,60 +877,63 @@ describe('Utils', function () {
857
877
  done();
858
878
  });
859
879
  });
860
- it('@regression should work when replacing a map element', function (done) {
880
+ it("@regression should work when replacing a map element", function (done) {
861
881
  // Clean the old modifications
862
882
  testRoot.cleanDirty();
863
- testRoot._properties.map.set('testParent', PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0', 'single', { errorMsg: 'another element', progress: 99 }));
883
+ testRoot._properties.map.set("testParent", PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0", "single", {
884
+ errorMsg: "another element",
885
+ progress: 99,
886
+ }));
864
887
  var operations = [];
865
- Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ 'dirtyOnly': true }), {
888
+ Utils.traverseChangeSetRecursivelyAsync(testRoot.serialize({ dirtyOnly: true }), {
866
889
  preCallback: function (in_context, cb) {
867
- if (in_context.getFullPath() === 'map[testParent]') {
890
+ if (in_context.getFullPath() === "map[testParent]") {
868
891
  operations.push(in_context.getOperationType());
869
892
  }
870
- else if (in_context.getFullPath() === 'map[testParent].errorMsg') {
871
- expect(in_context.getNestedChangeSet() === 'another element');
893
+ else if (in_context.getFullPath() === "map[testParent].errorMsg") {
894
+ expect(in_context.getNestedChangeSet() === "another element");
872
895
  }
873
- else if (in_context.getFullPath() === 'map[testParent].progress') {
896
+ else if (in_context.getFullPath() === "map[testParent].progress") {
874
897
  expect(in_context.getNestedChangeSet() === 99);
875
898
  }
876
899
  setImmediate(cb);
877
900
  },
878
901
  }, function () {
879
- expect(operations).to.deep.equal(['remove', 'insert']);
902
+ expect(operations).to.deep.equal(["remove", "insert"]);
880
903
  done();
881
904
  });
882
905
  });
883
906
  });
884
- describe('Utils.enumerateSchemas', function () {
907
+ describe("Utils.enumerateSchemas", function () {
885
908
  var serializedChangeSet = {
886
- 'insertTemplates': {
887
- 'autodesk.tests:property.set.SimpleNamedPoint-1.0.0': {
888
- typeid: 'autodesk.tests:property.set.SimpleNamedPoint-1.0.0',
889
- inherits: 'NamedProperty',
909
+ insertTemplates: {
910
+ "autodesk.tests:property.set.SimpleNamedPoint-1.0.0": {
911
+ typeid: "autodesk.tests:property.set.SimpleNamedPoint-1.0.0",
912
+ inherits: "NamedProperty",
890
913
  properties: [
891
- { id: 'x', typeid: 'Uint32' },
892
- { id: 'y', typeid: 'Uint32' },
914
+ { id: "x", typeid: "Uint32" },
915
+ { id: "y", typeid: "Uint32" },
893
916
  ],
894
917
  },
895
- 'autodesk.tests:property.set.SimpleNamedPoint-1.2.0': {
896
- typeid: 'autodesk.tests:property.set.SimpleNamedPoint-1.0.0',
897
- inherits: 'NamedProperty',
918
+ "autodesk.tests:property.set.SimpleNamedPoint-1.2.0": {
919
+ typeid: "autodesk.tests:property.set.SimpleNamedPoint-1.0.0",
920
+ inherits: "NamedProperty",
898
921
  properties: [
899
- { id: 'x', typeid: 'Uint64' },
900
- { id: 'y', typeid: 'Uint64' },
922
+ { id: "x", typeid: "Uint64" },
923
+ { id: "y", typeid: "Uint64" },
901
924
  ],
902
925
  },
903
926
  },
904
927
  };
905
- it('should return the schemas, and then call the finalizer', function (done) {
928
+ it("should return the schemas, and then call the finalizer", function (done) {
906
929
  var countedTemplates = 0;
907
930
  Utils.enumerateSchemas(serializedChangeSet, function (t, cb) {
908
931
  countedTemplates++;
909
- if (t.key === 'autodesk.tests:property.set.SimpleNamedPoint-1.0.0') {
910
- expect(t.value).to.eql(serializedChangeSet.insertTemplates['autodesk.tests:property.set.SimpleNamedPoint-1.0.0']);
932
+ if (t.key === "autodesk.tests:property.set.SimpleNamedPoint-1.0.0") {
933
+ expect(t.value).to.eql(serializedChangeSet.insertTemplates["autodesk.tests:property.set.SimpleNamedPoint-1.0.0"]);
911
934
  }
912
- if (t.key === 'autodesk.tests:property.set.SimpleNamedPoint-1.2.0') {
913
- expect(t.value).to.eql(serializedChangeSet.insertTemplates['autodesk.tests:property.set.SimpleNamedPoint-1.2.0']);
935
+ if (t.key === "autodesk.tests:property.set.SimpleNamedPoint-1.2.0") {
936
+ expect(t.value).to.eql(serializedChangeSet.insertTemplates["autodesk.tests:property.set.SimpleNamedPoint-1.2.0"]);
914
937
  }
915
938
  setImmediate(cb);
916
939
  }, function () {
@@ -919,135 +942,160 @@ describe('Utils', function () {
919
942
  });
920
943
  });
921
944
  });
922
- describe('Utils.extractTypeids', function () {
923
- it('Should work for a simple templated property', function () {
924
- var property = PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0');
925
- var typeids = Utils.extractTypeids(property.serialize({ 'dirtyOnly': false, 'includeRootTypeid': true }));
945
+ describe("Utils.extractTypeids", function () {
946
+ it("Should work for a simple templated property", function () {
947
+ var property = PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0");
948
+ var typeids = Utils.extractTypeids(property.serialize({ dirtyOnly: false, includeRootTypeid: true }));
926
949
  typeids.sort();
927
950
  // Note the map from the template isn't included in the ChangeSet since it is empty
928
- expect(typeids).to.deep.equal(['String', 'Uint32', 'autodesk.test:utilsTestContained-1.0.0',
929
- 'autodesk.test:utilsTestParent-1.0.0',
930
- 'map<autodesk.test:utilsTestContained-1.0.0>']);
951
+ expect(typeids).to.deep.equal([
952
+ "String",
953
+ "Uint32",
954
+ "autodesk.test:utilsTestContained-1.0.0",
955
+ "autodesk.test:utilsTestParent-1.0.0",
956
+ "map<autodesk.test:utilsTestContained-1.0.0>",
957
+ ]);
931
958
  });
932
- it('Should work for inserts into a NodePropertý', function () {
933
- var property = PropertyFactory.create('NodeProperty');
934
- var child = PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0');
935
- property.insert('child', child);
936
- var typeids = Utils.extractTypeids(property.serialize({ 'dirtyOnly': false, 'includeRootTypeid': true }));
959
+ it("Should work for inserts into a NodePropertý", function () {
960
+ var property = PropertyFactory.create("NodeProperty");
961
+ var child = PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0");
962
+ property.insert("child", child);
963
+ var typeids = Utils.extractTypeids(property.serialize({ dirtyOnly: false, includeRootTypeid: true }));
937
964
  typeids.sort();
938
- expect(typeids).to.deep.equal(['NodeProperty', 'String', 'Uint32', 'autodesk.test:utilsTestContained-1.0.0',
939
- 'autodesk.test:utilsTestParent-1.0.0',
940
- 'map<autodesk.test:utilsTestContained-1.0.0>']);
965
+ expect(typeids).to.deep.equal([
966
+ "NodeProperty",
967
+ "String",
968
+ "Uint32",
969
+ "autodesk.test:utilsTestContained-1.0.0",
970
+ "autodesk.test:utilsTestParent-1.0.0",
971
+ "map<autodesk.test:utilsTestContained-1.0.0>",
972
+ ]);
941
973
  });
942
- it('Should work for inserts into a map', function () {
943
- var property = PropertyFactory.create('map<>');
944
- var child = PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0');
945
- property.insert('child', child);
974
+ it("Should work for inserts into a map", function () {
975
+ var property = PropertyFactory.create("map<>");
976
+ var child = PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0");
977
+ property.insert("child", child);
946
978
  var typeids = Utils.extractTypeids(property._serialize(false, true));
947
979
  typeids.sort();
948
- expect(typeids).to.deep.equal(['String', 'Uint32', 'autodesk.test:utilsTestContained-1.0.0',
949
- 'autodesk.test:utilsTestParent-1.0.0', 'map<>',
950
- 'map<autodesk.test:utilsTestContained-1.0.0>']);
980
+ expect(typeids).to.deep.equal([
981
+ "String",
982
+ "Uint32",
983
+ "autodesk.test:utilsTestContained-1.0.0",
984
+ "autodesk.test:utilsTestParent-1.0.0",
985
+ "map<>",
986
+ "map<autodesk.test:utilsTestContained-1.0.0>",
987
+ ]);
951
988
  });
952
- it('Should work for inserts into an array', function () {
953
- var property = PropertyFactory.create('array<>');
954
- var child = PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0');
989
+ it("Should work for inserts into an array", function () {
990
+ var property = PropertyFactory.create("array<>");
991
+ var child = PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0");
955
992
  property.push(child);
956
993
  var typeids = Utils.extractTypeids(property._serialize(false, true));
957
994
  typeids.sort();
958
- expect(typeids).to.deep.equal(['String', 'Uint32', 'array<>', 'autodesk.test:utilsTestContained-1.0.0',
959
- 'autodesk.test:utilsTestParent-1.0.0',
960
- 'map<autodesk.test:utilsTestContained-1.0.0>']);
995
+ expect(typeids).to.deep.equal([
996
+ "String",
997
+ "Uint32",
998
+ "array<>",
999
+ "autodesk.test:utilsTestContained-1.0.0",
1000
+ "autodesk.test:utilsTestParent-1.0.0",
1001
+ "map<autodesk.test:utilsTestContained-1.0.0>",
1002
+ ]);
961
1003
  });
962
- it('Should work for modifications of a NodeProperty', function () {
963
- var property = PropertyFactory.create('NodeProperty');
964
- var child = PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0');
965
- property.insert('child', child);
1004
+ it("Should work for modifications of a NodeProperty", function () {
1005
+ var property = PropertyFactory.create("NodeProperty");
1006
+ var child = PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0");
1007
+ property.insert("child", child);
966
1008
  property.cleanDirty();
967
- property.resolvePath('child.contained."error\\"Msg\\""').value = 'modified';
968
- var typeids = Utils.extractTypeids(property.serialize({ 'dirtyOnly': true, 'in_includeRootTypeid': true }));
1009
+ property.resolvePath('child.contained."error\\"Msg\\""').value = "modified";
1010
+ var typeids = Utils.extractTypeids(property.serialize({ dirtyOnly: true, in_includeRootTypeid: true }));
969
1011
  typeids.sort();
970
1012
  expect(typeids).to.deep.equal([
971
- 'NodeProperty', 'String', 'autodesk.test:utilsTestContained-1.0.0', 'autodesk.test:utilsTestParent-1.0.0',
1013
+ "NodeProperty",
1014
+ "String",
1015
+ "autodesk.test:utilsTestContained-1.0.0",
1016
+ "autodesk.test:utilsTestParent-1.0.0",
972
1017
  ]);
973
1018
  });
974
- it('Should work for modifications of a map', function () {
975
- var property = PropertyFactory.create('map<>');
976
- var child = PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0');
977
- property.insert('child', child);
1019
+ it("Should work for modifications of a map", function () {
1020
+ var property = PropertyFactory.create("map<>");
1021
+ var child = PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0");
1022
+ property.insert("child", child);
978
1023
  property.cleanDirty();
979
- property.resolvePath('[child].contained."error\\"Msg\\""').value = 'modified';
1024
+ property.resolvePath('[child].contained."error\\"Msg\\""').value = "modified";
980
1025
  var typeids = Utils.extractTypeids(property._serialize(true, true));
981
1026
  typeids.sort();
982
1027
  expect(typeids).to.deep.equal([
983
- 'String', 'autodesk.test:utilsTestContained-1.0.0', 'autodesk.test:utilsTestParent-1.0.0', 'map<>',
1028
+ "String",
1029
+ "autodesk.test:utilsTestContained-1.0.0",
1030
+ "autodesk.test:utilsTestParent-1.0.0",
1031
+ "map<>",
984
1032
  ]);
985
1033
  });
986
- it('Should work for modifications of an array', function () {
987
- var property = PropertyFactory.create('array<>');
988
- var child = PropertyFactory.create('autodesk.test:utilsTestParent-1.0.0');
1034
+ it("Should work for modifications of an array", function () {
1035
+ var property = PropertyFactory.create("array<>");
1036
+ var child = PropertyFactory.create("autodesk.test:utilsTestParent-1.0.0");
989
1037
  property.push(child);
990
1038
  property.cleanDirty();
991
- property.resolvePath('[0].contained."error\\"Msg\\""').setValue('modified');
1039
+ property.resolvePath('[0].contained."error\\"Msg\\""').setValue("modified");
992
1040
  var typeids = Utils.extractTypeids(property._serialize(true, true));
993
1041
  typeids.sort();
994
1042
  expect(typeids).to.deep.equal([
995
- 'String', 'array<>', 'autodesk.test:utilsTestContained-1.0.0', 'autodesk.test:utilsTestParent-1.0.0',
1043
+ "String",
1044
+ "array<>",
1045
+ "autodesk.test:utilsTestContained-1.0.0",
1046
+ "autodesk.test:utilsTestParent-1.0.0",
996
1047
  ]);
997
1048
  });
998
- it('Should work for removals', function () {
999
- var typeids = Utils.extractTypeids({ remove: ['xxx-yyy-zzz'] });
1049
+ it("Should work for removals", function () {
1050
+ var typeids = Utils.extractTypeids({ remove: ["xxx-yyy-zzz"] });
1000
1051
  expect(typeids).to.have.lengthOf(1);
1001
- expect(typeids[0]).to.equal('NodeProperty');
1052
+ expect(typeids[0]).to.equal("NodeProperty");
1002
1053
  });
1003
1054
  });
1004
- describe('Change set helper functions', function () {
1055
+ describe("Change set helper functions", function () {
1005
1056
  var root, sim, subject1, subject2, subject3;
1006
1057
  // Create a simple test data-set
1007
1058
  before(function () {
1008
- root = PropertyFactory.create('NodeProperty');
1009
- sim = PropertyFactory.create('autodesk.test:utils.spec.pan.sim-1.0.0');
1010
- subject1 = PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0');
1011
- subject2 = PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0');
1012
- root.insert('simulation', sim);
1013
- sim.insert('subject1', subject1);
1014
- sim.insert('subject2', subject2);
1015
- var arrayProp = PropertyFactory.create('array<>');
1016
- root.insert('array', arrayProp);
1017
- arrayProp.push(PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0'));
1018
- arrayProp.push(PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0'));
1059
+ root = PropertyFactory.create("NodeProperty");
1060
+ sim = PropertyFactory.create("autodesk.test:utils.spec.pan.sim-1.0.0");
1061
+ subject1 = PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0");
1062
+ subject2 = PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0");
1063
+ root.insert("simulation", sim);
1064
+ sim.insert("subject1", subject1);
1065
+ sim.insert("subject2", subject2);
1066
+ var arrayProp = PropertyFactory.create("array<>");
1067
+ root.insert("array", arrayProp);
1068
+ arrayProp.push(PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0"));
1069
+ arrayProp.push(PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0"));
1019
1070
  arrayProp.get(1)._properties.progress.value = 1;
1020
- var mapProp = PropertyFactory.create('map<>');
1021
- root.insert('map', mapProp);
1022
- mapProp.insert('entry', PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0'));
1071
+ var mapProp = PropertyFactory.create("map<>");
1072
+ root.insert("map", mapProp);
1073
+ mapProp.insert("entry", PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0"));
1023
1074
  });
1024
- it('should work correctly for inserts', function () {
1025
- var insertedResults = Utils.getChangesByType('autodesk.test:utils.spec.task.subject-1.0.0', root.serialize({ 'dirtyOnly': true }));
1075
+ it("should work correctly for inserts", function () {
1076
+ var insertedResults = Utils.getChangesByType("autodesk.test:utils.spec.task.subject-1.0.0", root.serialize({ dirtyOnly: true }));
1026
1077
  assert(_.keys(insertedResults.insert).length === 9);
1027
1078
  for (var i = 0; i < 9; i++) {
1028
1079
  assert(root.resolvePath(_.keys(insertedResults.insert)[i]) !== undefined);
1029
- assert(Utils.getChangesByPath(_.keys(insertedResults.insert)[i], root, root.serialize(), false).insert !==
1030
- undefined);
1080
+ assert(Utils.getChangesByPath(_.keys(insertedResults.insert)[i], root, root.serialize(), false).insert !== undefined);
1031
1081
  }
1032
1082
  });
1033
- it('should work correctly for the root path', function () {
1083
+ it("should work correctly for the root path", function () {
1034
1084
  var AnonymousTestPropertyTemplate = {
1035
- typeid: 'autodesk.tests:AnonymousMapTestPropertyID-1.0.0',
1036
- properties: [
1037
- { id: 'stringProperty', typeid: 'String' },
1038
- ],
1085
+ typeid: "autodesk.tests:AnonymousMapTestPropertyID-1.0.0",
1086
+ properties: [{ id: "stringProperty", typeid: "String" }],
1039
1087
  };
1040
1088
  PropertyFactory._reregister(AnonymousTestPropertyTemplate);
1041
- var prop = PropertyFactory.create('NodeProperty');
1042
- prop.insert('A', PropertyFactory.create('autodesk.tests:AnonymousMapTestPropertyID-1.0.0'));
1043
- var result = Utils.getChangesByPath('', null, prop.serialize());
1089
+ var prop = PropertyFactory.create("NodeProperty");
1090
+ prop.insert("A", PropertyFactory.create("autodesk.tests:AnonymousMapTestPropertyID-1.0.0"));
1091
+ var result = Utils.getChangesByPath("", null, prop.serialize());
1044
1092
  expect(result).to.deep.equal({
1045
- 'modify': {
1046
- 'insert': {
1047
- 'autodesk.tests:AnonymousMapTestPropertyID-1.0.0': {
1048
- 'A': {
1049
- 'String': {
1050
- 'stringProperty': '',
1093
+ modify: {
1094
+ insert: {
1095
+ "autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
1096
+ A: {
1097
+ String: {
1098
+ stringProperty: "",
1051
1099
  },
1052
1100
  },
1053
1101
  },
@@ -1055,251 +1103,283 @@ describe('Utils', function () {
1055
1103
  },
1056
1104
  });
1057
1105
  });
1058
- it('should correctly strip typeids in insertions', function () {
1059
- var insertionChangeSet = root.serialize({ 'dirtyOnly': true });
1106
+ it("should correctly strip typeids in insertions", function () {
1107
+ var insertionChangeSet = root.serialize({ dirtyOnly: true });
1060
1108
  Utils._stripTypeids(insertionChangeSet);
1061
1109
  expect(insertionChangeSet).to.deep.equal({
1062
- 'insert': {
1063
- 'simulation': {
1064
- 'insert': {
1065
- 'subject1': {
1066
- 'errorMsg': '',
1067
- 'progress': 0,
1110
+ insert: {
1111
+ simulation: {
1112
+ insert: {
1113
+ subject1: {
1114
+ errorMsg: "",
1115
+ progress: 0,
1068
1116
  },
1069
- 'subject2': {
1070
- 'errorMsg': '',
1071
- 'progress': 0,
1117
+ subject2: {
1118
+ errorMsg: "",
1119
+ progress: 0,
1072
1120
  },
1073
1121
  },
1074
- 'costEstimated': {
1075
- 'errorMsg': '',
1076
- 'progress': 0,
1122
+ costEstimated: {
1123
+ errorMsg: "",
1124
+ progress: 0,
1077
1125
  },
1078
- 'costFinal': {
1079
- 'errorMsg': '',
1080
- 'progress': 0,
1126
+ costFinal: {
1127
+ errorMsg: "",
1128
+ progress: 0,
1081
1129
  },
1082
- 'thermalResults': {
1083
- 'errorMsg': '',
1084
- 'progress': 0,
1130
+ thermalResults: {
1131
+ errorMsg: "",
1132
+ progress: 0,
1085
1133
  },
1086
- 'mechanicalResults': {
1087
- 'errorMsg': '',
1088
- 'progress': 0,
1134
+ mechanicalResults: {
1135
+ errorMsg: "",
1136
+ progress: 0,
1089
1137
  },
1090
- 'start': false,
1091
- 'cancel': false,
1138
+ start: false,
1139
+ cancel: false,
1092
1140
  },
1093
- 'map': {
1094
- 'insert': {
1095
- 'entry': {
1096
- 'errorMsg': '',
1097
- 'progress': 0,
1141
+ map: {
1142
+ insert: {
1143
+ entry: {
1144
+ errorMsg: "",
1145
+ progress: 0,
1098
1146
  },
1099
1147
  },
1100
1148
  },
1101
- 'array': {
1102
- 'insert': [[0, [{
1103
- 'errorMsg': '',
1104
- 'progress': 0,
1105
- }, {
1106
- 'errorMsg': '',
1107
- 'progress': 1,
1108
- }]]],
1149
+ array: {
1150
+ insert: [
1151
+ [
1152
+ 0,
1153
+ [
1154
+ {
1155
+ errorMsg: "",
1156
+ progress: 0,
1157
+ },
1158
+ {
1159
+ errorMsg: "",
1160
+ progress: 1,
1161
+ },
1162
+ ],
1163
+ ],
1164
+ ],
1109
1165
  },
1110
1166
  },
1111
1167
  });
1112
1168
  });
1113
- it('should work correctly for modifies', function () {
1114
- root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE | BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
1115
- subject3 = PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0');
1116
- subject2.insert('subject3', subject3);
1117
- subject1._properties.errorMsg.value = 'test';
1118
- subject2._properties.errorMsg.value = 'test';
1119
- sim._properties.thermalResults.errorMsg.value = 'test44';
1169
+ it("should work correctly for modifies", function () {
1170
+ root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE |
1171
+ BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
1172
+ subject3 = PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0");
1173
+ subject2.insert("subject3", subject3);
1174
+ subject1._properties.errorMsg.value = "test";
1175
+ subject2._properties.errorMsg.value = "test";
1176
+ sim._properties.thermalResults.errorMsg.value = "test44";
1120
1177
  // Test array modification
1121
- root.resolvePath('array[1].errorMsg').value = 'test';
1178
+ root.resolvePath("array[1].errorMsg").value = "test";
1122
1179
  // Test array insertion
1123
- root.resolvePath('array').insertRange(1, [
1124
- PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0'),
1125
- PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0'),
1180
+ root.resolvePath("array").insertRange(1, [
1181
+ PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0"),
1182
+ PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0"),
1126
1183
  ]);
1127
- root.resolvePath('array').insertRange(0, [
1128
- PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0'),
1184
+ root.resolvePath("array").insertRange(0, [
1185
+ PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0"),
1129
1186
  ]);
1130
1187
  // Test map modification
1131
- root.resolvePath('map[entry].errorMsg').value = 'test';
1188
+ root.resolvePath("map[entry].errorMsg").value = "test";
1132
1189
  // Test map insertion
1133
- root.resolvePath('map').insert('entry2', PropertyFactory.create('autodesk.test:utils.spec.task.subject-1.0.0'));
1134
- var modifiedResults = Utils.getChangesByType('autodesk.test:utils.spec.task.subject-1.0.0', root.serialize({ 'dirtyOnly': true }), true);
1190
+ root.resolvePath("map").insert("entry2", PropertyFactory.create("autodesk.test:utils.spec.task.subject-1.0.0"));
1191
+ var modifiedResults = Utils.getChangesByType("autodesk.test:utils.spec.task.subject-1.0.0", root.serialize({ dirtyOnly: true }), true);
1135
1192
  assert(_.keys(modifiedResults.insert).length === 5);
1136
1193
  assert(_.keys(modifiedResults.modify).length === 5);
1137
1194
  for (var i = 0; i < 5; i++) {
1138
- assert(Utils.getChangesByPath(_.keys(modifiedResults.modify)[i], root, root.serialize({ 'dirtyOnly': true }), false).modify !== undefined);
1195
+ assert(Utils.getChangesByPath(_.keys(modifiedResults.modify)[i], root, root.serialize({ dirtyOnly: true }), false).modify !== undefined);
1139
1196
  }
1140
1197
  for (var i = 0; i < 5; i++) {
1141
- assert(Utils.getChangesByPath(_.keys(modifiedResults.insert)[i], root, root.serialize({ 'dirtyOnly': true }), false).insert !== undefined);
1198
+ assert(Utils.getChangesByPath(_.keys(modifiedResults.insert)[i], root, root.serialize({ dirtyOnly: true }), false).insert !== undefined);
1142
1199
  }
1143
1200
  });
1144
- it('should correctly strip typeids in modifies', function () {
1145
- var modifyChangeSet = root.serialize({ 'dirtyOnly': true });
1201
+ it("should correctly strip typeids in modifies", function () {
1202
+ var modifyChangeSet = root.serialize({ dirtyOnly: true });
1146
1203
  Utils._stripTypeids(modifyChangeSet);
1147
1204
  expect(modifyChangeSet).to.deep.equal({
1148
- 'modify': {
1149
- 'simulation': {
1150
- 'modify': {
1151
- 'subject1': {
1152
- 'errorMsg': 'test',
1153
- },
1154
- 'subject2': {
1155
- 'insert': {
1156
- 'subject3': {
1157
- 'errorMsg': '',
1158
- 'progress': 0,
1205
+ modify: {
1206
+ simulation: {
1207
+ modify: {
1208
+ subject1: {
1209
+ errorMsg: "test",
1210
+ },
1211
+ subject2: {
1212
+ insert: {
1213
+ subject3: {
1214
+ errorMsg: "",
1215
+ progress: 0,
1159
1216
  },
1160
1217
  },
1161
- 'errorMsg': 'test',
1218
+ errorMsg: "test",
1162
1219
  },
1163
1220
  },
1164
- 'thermalResults': {
1165
- 'errorMsg': 'test44',
1221
+ thermalResults: {
1222
+ errorMsg: "test44",
1166
1223
  },
1167
1224
  },
1168
- 'array': {
1169
- insert: [[0, [
1225
+ array: {
1226
+ insert: [
1227
+ [
1228
+ 0,
1229
+ [
1230
+ {
1231
+ errorMsg: "",
1232
+ progress: 0,
1233
+ },
1234
+ ],
1235
+ ],
1236
+ [
1237
+ 1,
1238
+ [
1170
1239
  {
1171
- 'errorMsg': '',
1172
- 'progress': 0,
1240
+ errorMsg: "",
1241
+ progress: 0,
1173
1242
  },
1174
- ]], [1, [
1175
1243
  {
1176
- 'errorMsg': '',
1177
- 'progress': 0,
1178
- }, {
1179
- 'errorMsg': '',
1180
- 'progress': 0,
1244
+ errorMsg: "",
1245
+ progress: 0,
1246
+ },
1247
+ ],
1248
+ ],
1249
+ ],
1250
+ modify: [
1251
+ [
1252
+ 1,
1253
+ [
1254
+ {
1255
+ errorMsg: "test",
1181
1256
  },
1182
- ]]],
1183
- modify: [[1, [{
1184
- 'errorMsg': 'test',
1185
- }]]],
1257
+ ],
1258
+ ],
1259
+ ],
1186
1260
  },
1187
- 'map': {
1188
- 'insert': {
1189
- 'entry2': {
1190
- 'errorMsg': '',
1191
- 'progress': 0,
1261
+ map: {
1262
+ insert: {
1263
+ entry2: {
1264
+ errorMsg: "",
1265
+ progress: 0,
1192
1266
  },
1193
1267
  },
1194
- 'modify': {
1195
- 'entry': {
1196
- 'errorMsg': 'test',
1268
+ modify: {
1269
+ entry: {
1270
+ errorMsg: "test",
1197
1271
  },
1198
1272
  },
1199
1273
  },
1200
1274
  },
1201
1275
  });
1202
1276
  });
1203
- it('should correctly work for removes', function () {
1204
- root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE | BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
1277
+ it("should correctly work for removes", function () {
1278
+ root.cleanDirty(BaseProperty.MODIFIED_STATE_FLAGS.PENDING_CHANGE |
1279
+ BaseProperty.MODIFIED_STATE_FLAGS.DIRTY);
1205
1280
  subject2.remove(subject3.getId());
1206
- assert(Utils.getChangesByPath(sim.getId() + '.' + subject2.getId() + '.' + subject3.getId(), root, root.serialize({ 'dirtyOnly': true }), false).removed === true);
1281
+ assert(Utils.getChangesByPath(sim.getId() + "." + subject2.getId() + "." + subject3.getId(), root, root.serialize({ dirtyOnly: true }), false).removed === true);
1207
1282
  root.remove(sim.getId());
1208
- assert(Utils.getChangesByPath(sim.getId() + '.' + subject2.getId() + '.' + subject3.getId(), root, root.serialize({ 'dirtyOnly': true }), false).removed === true);
1209
- assert(Utils.getChangesByPath(sim.getId() + '.' + subject2.getId(), root, root.serialize({ 'dirtyOnly': true }), false).removed === true);
1210
- assert(Utils.getChangesByPath(sim.getId(), root, root.serialize({ 'dirtyOnly': true }), false).removed === true);
1211
- root.resolvePath('map').remove('entry2');
1212
- root.resolvePath('array').remove(0);
1213
- root.resolvePath('array').removeRange(1, 2);
1283
+ assert(Utils.getChangesByPath(sim.getId() + "." + subject2.getId() + "." + subject3.getId(), root, root.serialize({ dirtyOnly: true }), false).removed === true);
1284
+ assert(Utils.getChangesByPath(sim.getId() + "." + subject2.getId(), root, root.serialize({ dirtyOnly: true }), false).removed === true);
1285
+ assert(Utils.getChangesByPath(sim.getId(), root, root.serialize({ dirtyOnly: true }), false).removed === true);
1286
+ root.resolvePath("map").remove("entry2");
1287
+ root.resolvePath("array").remove(0);
1288
+ root.resolvePath("array").removeRange(1, 2);
1214
1289
  });
1215
- it('should correctly strip typeids in removes', function () {
1290
+ it("should correctly strip typeids in removes", function () {
1216
1291
  var modifyChangeSet = root._serialize(true);
1217
1292
  Utils._stripTypeids(modifyChangeSet);
1218
1293
  expect(modifyChangeSet).to.deep.equal({
1219
- 'modify': {
1220
- 'array': {
1221
- 'remove': [[0, 1], [2, 2]],
1294
+ modify: {
1295
+ array: {
1296
+ remove: [
1297
+ [0, 1],
1298
+ [2, 2],
1299
+ ],
1222
1300
  },
1223
- 'map': {
1224
- 'remove': ['entry2'],
1301
+ map: {
1302
+ remove: ["entry2"],
1225
1303
  },
1226
1304
  },
1227
- 'remove': ['simulation'],
1305
+ remove: ["simulation"],
1228
1306
  });
1229
1307
  });
1230
- it('should work for nested templates', function () {
1231
- var nestedTemplate = PropertyFactory.create('autodesk.tests:nestedTemplate-1.0.0');
1232
- nestedTemplate._properties.c.myNestedProp.errorMsg.value = 'testString';
1308
+ it("should work for nested templates", function () {
1309
+ var nestedTemplate = PropertyFactory.create("autodesk.tests:nestedTemplate-1.0.0");
1310
+ nestedTemplate._properties.c.myNestedProp.errorMsg.value = "testString";
1233
1311
  var changeSet = nestedTemplate._serialize(true);
1234
- var changes = Utils.getChangesByType('String', changeSet);
1235
- expect(changes.modify['c.myNestedProp.errorMsg']).to.equal('testString');
1236
- expect(Utils.getChangesByPath('c.myNestedProp.errorMsg', nestedTemplate, changeSet, false)).to.have.keys('modify');
1312
+ var changes = Utils.getChangesByType("String", changeSet);
1313
+ expect(changes.modify["c.myNestedProp.errorMsg"]).to.equal("testString");
1314
+ expect(Utils.getChangesByPath("c.myNestedProp.errorMsg", nestedTemplate, changeSet, false)).to.have.keys("modify");
1237
1315
  });
1238
- it('should work for an object with characters that have to be quoted', function () {
1239
- var node = PropertyFactory.create('autodesk.tests:property.with.quotable.characters-1.0.0');
1240
- node.get('simple_property').value = 'test';
1241
- node.get('test.property').value = 'test';
1242
- node.get('test"property"').value = 'test';
1243
- node.get('test[property]').get('.property.').get('test').value = 'test';
1316
+ it("should work for an object with characters that have to be quoted", function () {
1317
+ var node = PropertyFactory.create("autodesk.tests:property.with.quotable.characters-1.0.0");
1318
+ node.get("simple_property").value = "test";
1319
+ node.get("test.property").value = "test";
1320
+ node.get('test"property"').value = "test";
1321
+ node.get("test[property]").get(".property.").get("test").value = "test";
1244
1322
  var changeSet = node._serialize(true);
1245
- var changes = Utils.getChangesByType('String', changeSet);
1246
- expect(changes.modify).to.have.keys('simple_property', '"test.property"', '"test\\"property\\""', '"test[property]".".property.".test');
1247
- expect(Utils.getChangesByPath('simple_property', node, changeSet, false)).to.have.keys('modify');
1248
- expect(Utils.getChangesByPath('"test.property"', node, changeSet, false)).to.have.keys('modify');
1249
- expect(Utils.getChangesByPath('"test\\"property\\""', node, changeSet, false)).to.have.keys('modify');
1250
- expect(Utils.getChangesByPath('"test[property]".".property.".test', node, changeSet, false)).to.have.keys('modify');
1323
+ var changes = Utils.getChangesByType("String", changeSet);
1324
+ expect(changes.modify).to.have.keys("simple_property", '"test.property"', '"test\\"property\\""', '"test[property]".".property.".test');
1325
+ expect(Utils.getChangesByPath("simple_property", node, changeSet, false)).to.have.keys("modify");
1326
+ expect(Utils.getChangesByPath('"test.property"', node, changeSet, false)).to.have.keys("modify");
1327
+ expect(Utils.getChangesByPath('"test\\"property\\""', node, changeSet, false)).to.have.keys("modify");
1328
+ expect(Utils.getChangesByPath('"test[property]".".property.".test', node, changeSet, false)).to.have.keys("modify");
1251
1329
  });
1252
- it('should work for a node property with characters that have to be quoted', function () {
1253
- var node = PropertyFactory.create('NodeProperty');
1254
- node.insert('simple_property', PropertyFactory.create('String', undefined, 'test'));
1255
- node.insert('test.property', PropertyFactory.create('String', undefined, 'test'));
1256
- node.insert('test"property"', PropertyFactory.create('String', undefined, 'test'));
1257
- node.insert('test[property]', PropertyFactory.create('NodeProperty'));
1258
- node.get('test[property]').insert('.property.', PropertyFactory.create('NodeProperty'));
1259
- node.get('test[property]').get('.property.').insert('test', PropertyFactory.create('String', undefined, 'test'));
1330
+ it("should work for a node property with characters that have to be quoted", function () {
1331
+ var node = PropertyFactory.create("NodeProperty");
1332
+ node.insert("simple_property", PropertyFactory.create("String", undefined, "test"));
1333
+ node.insert("test.property", PropertyFactory.create("String", undefined, "test"));
1334
+ node.insert('test"property"', PropertyFactory.create("String", undefined, "test"));
1335
+ node.insert("test[property]", PropertyFactory.create("NodeProperty"));
1336
+ node.get("test[property]").insert(".property.", PropertyFactory.create("NodeProperty"));
1337
+ node.get("test[property]")
1338
+ .get(".property.")
1339
+ .insert("test", PropertyFactory.create("String", undefined, "test"));
1260
1340
  var changeSet = node._serialize(true);
1261
- var changes = Utils.getChangesByType('String', changeSet);
1262
- expect(changes.insert).to.have.keys('simple_property', '"test.property"', '"test\\"property\\""', '"test[property]".".property.".test');
1263
- expect(Utils.getChangesByPath('simple_property', node, changeSet, false)).to.have.keys('insert');
1264
- expect(Utils.getChangesByPath('"test.property"', node, changeSet, false)).to.have.keys('insert');
1265
- expect(Utils.getChangesByPath('"test\\"property\\""', node, changeSet, false)).to.have.keys('insert');
1266
- expect(Utils.getChangesByPath('"test[property]".".property.".test', node, changeSet, false)).to.have.keys('insert');
1341
+ var changes = Utils.getChangesByType("String", changeSet);
1342
+ expect(changes.insert).to.have.keys("simple_property", '"test.property"', '"test\\"property\\""', '"test[property]".".property.".test');
1343
+ expect(Utils.getChangesByPath("simple_property", node, changeSet, false)).to.have.keys("insert");
1344
+ expect(Utils.getChangesByPath('"test.property"', node, changeSet, false)).to.have.keys("insert");
1345
+ expect(Utils.getChangesByPath('"test\\"property\\""', node, changeSet, false)).to.have.keys("insert");
1346
+ expect(Utils.getChangesByPath('"test[property]".".property.".test', node, changeSet, false)).to.have.keys("insert");
1267
1347
  });
1268
1348
  });
1269
- describe('Utils.getChangesToTokenizedPaths', function () {
1349
+ describe("Utils.getChangesToTokenizedPaths", function () {
1270
1350
  var CS = {
1271
- 'insert': {
1272
- 'NodeProperty': {
1273
- 'nested1': {
1274
- 'insert': {
1275
- 'NodeProperty': {
1276
- 'nested2': {
1277
- 'insert': {
1278
- 'String': {
1279
- 'string': 'text',
1280
- '__doubleUnderscore': 'text',
1351
+ insert: {
1352
+ "NodeProperty": {
1353
+ nested1: {
1354
+ insert: {
1355
+ NodeProperty: {
1356
+ nested2: {
1357
+ insert: {
1358
+ String: {
1359
+ string: "text",
1360
+ __doubleUnderscore: "text",
1281
1361
  },
1282
1362
  },
1283
1363
  },
1284
1364
  },
1285
1365
  },
1286
1366
  },
1287
- 'nested2': {},
1367
+ nested2: {},
1288
1368
  },
1289
- 'array<>': {
1290
- 'nestedArray': {
1291
- 'insert': [
1369
+ "array<>": {
1370
+ nestedArray: {
1371
+ insert: [
1292
1372
  [
1293
1373
  0,
1294
1374
  [
1295
1375
  {
1296
- 'typeid': 'NodeProperty',
1376
+ typeid: "NodeProperty",
1297
1377
  },
1298
1378
  {
1299
- 'typeid': 'NodeProperty',
1300
- 'insert': {
1301
- 'String': {
1302
- 'text': '',
1379
+ typeid: "NodeProperty",
1380
+ insert: {
1381
+ String: {
1382
+ text: "",
1303
1383
  },
1304
1384
  },
1305
1385
  },
@@ -1308,103 +1388,137 @@ describe('Utils', function () {
1308
1388
  ],
1309
1389
  },
1310
1390
  },
1311
- 'String': {
1312
- 'string': 'text',
1391
+ "String": {
1392
+ string: "text",
1313
1393
  },
1314
1394
  },
1315
1395
  };
1316
- it('should work using objects', function () {
1396
+ it("should work using objects", function () {
1317
1397
  var visitedPaths = [];
1318
1398
  Utils.getChangesToTokenizedPaths({
1319
- 'String': {},
1320
- 'nested1': {
1321
- 'nested2': {
1322
- 'string': {
1323
- '__hidden': {
1324
- 'myCallback': function () { return 'hello'; },
1325
- 'myValue': 1,
1399
+ String: {},
1400
+ nested1: {
1401
+ nested2: {
1402
+ string: {
1403
+ __hidden: {
1404
+ myCallback: function () {
1405
+ return "hello";
1406
+ },
1407
+ myValue: 1,
1326
1408
  },
1327
1409
  },
1328
- '___doubleUnderscore': {}, // Yes, there are 3 '_', as escapeLeadingDoubleUnderscore = true
1410
+ ___doubleUnderscore: {}, // Yes, there are 3 '_', as escapeLeadingDoubleUnderscore = true
1329
1411
  },
1330
1412
  },
1331
- 'nestedArray': {
1332
- '1': {
1333
- 'String': {},
1413
+ nestedArray: {
1414
+ 1: {
1415
+ String: {},
1334
1416
  },
1335
1417
  },
1336
1418
  }, CS, function (in_context, in_nested, in_tokenizedPath) {
1337
- var currentPath = in_tokenizedPath.join('.');
1419
+ var currentPath = in_tokenizedPath.join(".");
1338
1420
  visitedPaths.push(currentPath);
1339
- if (currentPath === 'nested1.nested2.string') {
1421
+ if (currentPath === "nested1.nested2.string") {
1340
1422
  expect(in_nested).to.exist;
1341
1423
  expect(in_nested.__hidden).to.exist;
1342
1424
  expect(in_nested.__hidden.myCallback).to.exist;
1343
- expect(in_nested.__hidden.myCallback()).to.eql('hello');
1425
+ expect(in_nested.__hidden.myCallback()).to.eql("hello");
1344
1426
  expect(in_nested.__hidden.myValue).to.eql(1);
1345
1427
  }
1346
1428
  }, {
1347
- rootOperation: 'modify',
1348
- rootTypeid: 'NodeProperty',
1429
+ rootOperation: "modify",
1430
+ rootTypeid: "NodeProperty",
1349
1431
  escapeLeadingDoubleUnderscore: true,
1350
1432
  });
1351
- expect(visitedPaths).to.deep.equal(['', 'nested1', 'nested1.nested2', 'nested1.nested2.string',
1352
- 'nested1.nested2.__doubleUnderscore', 'nestedArray', 'nestedArray.1']);
1433
+ expect(visitedPaths).to.deep.equal([
1434
+ "",
1435
+ "nested1",
1436
+ "nested1.nested2",
1437
+ "nested1.nested2.string",
1438
+ "nested1.nested2.__doubleUnderscore",
1439
+ "nestedArray",
1440
+ "nestedArray.1",
1441
+ ]);
1353
1442
  });
1354
- it('should work using maps', function () {
1443
+ it("should work using maps", function () {
1355
1444
  var visitedPaths = [];
1356
1445
  Utils.getChangesToTokenizedPaths(new Map([
1357
- ['String', new Map()],
1358
- ['nested1', new Map([
1359
- ['nested2', new Map([
1360
- ['string', new Map([
1361
- ['__hidden', new Map([
1362
- ['myCallback', function () { return 'hello'; }],
1363
- ['myValue', 1],
1364
- ])],
1365
- ])],
1366
- ['___doubleUnderscore', new Map()], // Yes, there are 3 '_', as escapeLeadingDoubleUnderscore = true
1367
- ])],
1368
- ])],
1369
- ['nestedArray', new Map([
1370
- ['1', new Map([
1371
- ['String', new Map()],
1372
- ])],
1373
- ])],
1446
+ ["String", new Map()],
1447
+ [
1448
+ "nested1",
1449
+ new Map([
1450
+ [
1451
+ "nested2",
1452
+ new Map([
1453
+ [
1454
+ "string",
1455
+ new Map([
1456
+ [
1457
+ "__hidden",
1458
+ new Map([
1459
+ [
1460
+ "myCallback",
1461
+ function () {
1462
+ return "hello";
1463
+ },
1464
+ ],
1465
+ ["myValue", 1],
1466
+ ]),
1467
+ ],
1468
+ ]),
1469
+ ],
1470
+ ["___doubleUnderscore", new Map()], // Yes, there are 3 '_', as escapeLeadingDoubleUnderscore = true
1471
+ ]),
1472
+ ],
1473
+ ]),
1474
+ ],
1475
+ ["nestedArray", new Map([["1", new Map([["String", new Map()]])]])],
1374
1476
  ]), CS, function (in_context, in_nested, in_tokenizedPath) {
1375
- var currentPath = in_tokenizedPath.join('.');
1477
+ var currentPath = in_tokenizedPath.join(".");
1376
1478
  visitedPaths.push(currentPath);
1377
- if (currentPath === 'nested1.nested2.string') {
1479
+ if (currentPath === "nested1.nested2.string") {
1378
1480
  expect(in_nested).to.exist;
1379
- expect(in_nested).to.have.key('__hidden');
1380
- expect(in_nested.get('__hidden')).to.have.all.keys('myCallback', 'myValue');
1381
- expect(in_nested.get('__hidden').get('myCallback')()).to.eql('hello');
1382
- expect(in_nested.get('__hidden').get('myValue')).to.eql(1);
1481
+ expect(in_nested).to.have.key("__hidden");
1482
+ expect(in_nested.get("__hidden")).to.have.all.keys("myCallback", "myValue");
1483
+ expect(in_nested.get("__hidden").get("myCallback")()).to.eql("hello");
1484
+ expect(in_nested.get("__hidden").get("myValue")).to.eql(1);
1383
1485
  }
1384
1486
  }, {
1385
- rootOperation: 'modify',
1386
- rootTypeid: 'NodeProperty',
1487
+ rootOperation: "modify",
1488
+ rootTypeid: "NodeProperty",
1387
1489
  escapeLeadingDoubleUnderscore: true,
1388
1490
  });
1389
- expect(visitedPaths).to.deep.equal(['', 'nested1', 'nested1.nested2', 'nested1.nested2.string',
1390
- 'nested1.nested2.__doubleUnderscore', 'nestedArray', 'nestedArray.1']);
1491
+ expect(visitedPaths).to.deep.equal([
1492
+ "",
1493
+ "nested1",
1494
+ "nested1.nested2",
1495
+ "nested1.nested2.string",
1496
+ "nested1.nested2.__doubleUnderscore",
1497
+ "nestedArray",
1498
+ "nestedArray.1",
1499
+ ]);
1391
1500
  });
1392
- it('should assume paths as literal when the escapeLeadingDoubleUnderscore flag is off ', function () {
1501
+ it("should assume paths as literal when the escapeLeadingDoubleUnderscore flag is off ", function () {
1393
1502
  var visitedPaths = [];
1394
1503
  Utils.getChangesToTokenizedPaths({
1395
- 'nested1': {
1396
- 'nested2': {
1397
- '__doubleUnderscore': {}, // The amount of underscores is the same as in the changeSet
1504
+ nested1: {
1505
+ nested2: {
1506
+ __doubleUnderscore: {}, // The amount of underscores is the same as in the changeSet
1398
1507
  },
1399
1508
  },
1400
1509
  }, CS, function (in_context, in_nested, in_tokenizedPath) {
1401
- visitedPaths.push(in_tokenizedPath.join('.'));
1510
+ visitedPaths.push(in_tokenizedPath.join("."));
1402
1511
  }, {
1403
- rootOperation: 'modify',
1404
- rootTypeid: 'NodeProperty',
1512
+ rootOperation: "modify",
1513
+ rootTypeid: "NodeProperty",
1405
1514
  escapeLeadingDoubleUnderscore: false,
1406
1515
  });
1407
- expect(visitedPaths).to.deep.equal(['', 'nested1', 'nested1.nested2', 'nested1.nested2.__doubleUnderscore']);
1516
+ expect(visitedPaths).to.deep.equal([
1517
+ "",
1518
+ "nested1",
1519
+ "nested1.nested2",
1520
+ "nested1.nested2.__doubleUnderscore",
1521
+ ]);
1408
1522
  });
1409
1523
  });
1410
1524
  /* describe('Utils.insertPropertyChangeIntoChangeset', function() {
@@ -1558,35 +1672,35 @@ describe('Utils', function () {
1558
1672
  expect(result.insert).to.be.false;
1559
1673
  });
1560
1674
  }); */
1561
- describe('Utils.getFilteredChangeSetByPaths', function () {
1675
+ describe("Utils.getFilteredChangeSetByPaths", function () {
1562
1676
  var changeSet = {
1563
- 'insert': {
1564
- 'NodeProperty': {
1565
- 'nested1': {
1566
- 'insert': {
1567
- 'NodeProperty': {
1568
- 'nested2': {
1569
- 'insert': {
1570
- 'String': {
1571
- 'string': 'text',
1677
+ insert: {
1678
+ "NodeProperty": {
1679
+ nested1: {
1680
+ insert: {
1681
+ "NodeProperty": {
1682
+ nested2: {
1683
+ insert: {
1684
+ String: {
1685
+ string: "text",
1572
1686
  },
1573
1687
  },
1574
1688
  },
1575
1689
  },
1576
- 'array<>': {
1577
- 'nestedArray': {
1578
- 'insert': [
1690
+ "array<>": {
1691
+ nestedArray: {
1692
+ insert: [
1579
1693
  [
1580
1694
  0,
1581
1695
  [
1582
1696
  {
1583
- 'typeid': 'NodeProperty',
1697
+ typeid: "NodeProperty",
1584
1698
  },
1585
1699
  {
1586
- 'typeid': 'NodeProperty',
1587
- 'insert': {
1588
- 'String': {
1589
- 'text': '',
1700
+ typeid: "NodeProperty",
1701
+ insert: {
1702
+ String: {
1703
+ text: "",
1590
1704
  },
1591
1705
  },
1592
1706
  },
@@ -1595,101 +1709,101 @@ describe('Utils', function () {
1595
1709
  ],
1596
1710
  },
1597
1711
  },
1598
- 'map<>': {
1599
- 'trulyNestedMap': {
1600
- 'insert': {
1601
- 'String': {
1602
- 'key1': 'The value is 1',
1712
+ "map<>": {
1713
+ trulyNestedMap: {
1714
+ insert: {
1715
+ String: {
1716
+ key1: "The value is 1",
1603
1717
  },
1604
1718
  },
1605
1719
  },
1606
1720
  },
1607
1721
  },
1608
1722
  },
1609
- 'nested3': {},
1723
+ nested3: {},
1610
1724
  },
1611
- 'map<>': {
1612
- 'nestedMap': {
1613
- 'insert': {
1614
- 'String': {
1615
- 'nestedMapString': 'Sirius',
1725
+ "map<>": {
1726
+ nestedMap: {
1727
+ insert: {
1728
+ String: {
1729
+ nestedMapString: "Sirius",
1616
1730
  },
1617
- 'Bool': {
1618
- 'nestedMapBoolean': true,
1731
+ Bool: {
1732
+ nestedMapBoolean: true,
1619
1733
  },
1620
1734
  },
1621
1735
  },
1622
1736
  },
1623
- 'map<mysample:asset-1.0.0>': {
1624
- 'assetMap': {
1625
- 'insert': {
1626
- 'mysample:asset-1.0.0': {
1627
- '1': {
1628
- 'String': {
1629
- 'name': 'test asset 1',
1737
+ "map<mysample:asset-1.0.0>": {
1738
+ assetMap: {
1739
+ insert: {
1740
+ "mysample:asset-1.0.0": {
1741
+ 1: {
1742
+ String: {
1743
+ name: "test asset 1",
1630
1744
  },
1631
- 'NodeProperty': {
1632
- 'components': {},
1745
+ NodeProperty: {
1746
+ components: {},
1633
1747
  },
1634
1748
  },
1635
1749
  },
1636
1750
  },
1637
1751
  },
1638
1752
  },
1639
- 'Reference<String>': {
1640
- 'refProp': '/test.prop',
1753
+ "Reference<String>": {
1754
+ refProp: "/test.prop",
1641
1755
  },
1642
- 'RepositoryReferenceProperty': {
1643
- 'refRepoProp': {
1644
- 'Bool': {
1645
- 'followBranch': false,
1756
+ "RepositoryReferenceProperty": {
1757
+ refRepoProp: {
1758
+ Bool: {
1759
+ followBranch: false,
1646
1760
  },
1647
- 'String': {
1648
- 'branchGUID': '846fe4a1-e595-44bf-8cc0-f1d8f6d104a6',
1649
- 'commitGUID': '4c611c89-8241-4764-958e-77470bba3b9b',
1650
- 'repositoryGUID': 'f438bed5-d8f2-4c70-a7e0-aa52b8929d2a',
1761
+ String: {
1762
+ branchGUID: "846fe4a1-e595-44bf-8cc0-f1d8f6d104a6",
1763
+ commitGUID: "4c611c89-8241-4764-958e-77470bba3b9b",
1764
+ repositoryGUID: "f438bed5-d8f2-4c70-a7e0-aa52b8929d2a",
1651
1765
  },
1652
1766
  },
1653
1767
  },
1654
- 'NamedProperty': {
1655
- 'namedProp': {
1656
- 'String': {
1657
- 'guid': 'e763527c-7f49-417c-8df3-9fb7f90a1932',
1768
+ "NamedProperty": {
1769
+ namedProp: {
1770
+ String: {
1771
+ guid: "e763527c-7f49-417c-8df3-9fb7f90a1932",
1658
1772
  },
1659
1773
  },
1660
1774
  },
1661
- 'NamedNodeProperty': {
1662
- 'namedNodeProp': {
1663
- 'String': {
1664
- 'guid': 'efc68477-53b1-49ac-bd3f-e05a21f85a32',
1775
+ "NamedNodeProperty": {
1776
+ namedNodeProp: {
1777
+ String: {
1778
+ guid: "efc68477-53b1-49ac-bd3f-e05a21f85a32",
1665
1779
  },
1666
- 'insert': {
1667
- 'enum<autodesk.core:UnitsEnum-1.0.0>': {
1668
- 'enumProp': 0,
1780
+ insert: {
1781
+ "enum<autodesk.core:UnitsEnum-1.0.0>": {
1782
+ enumProp: 0,
1669
1783
  },
1670
- 'String': {
1671
- 'test': 'blah',
1784
+ "String": {
1785
+ test: "blah",
1672
1786
  },
1673
1787
  },
1674
1788
  },
1675
1789
  },
1676
- 'autodesk.test:testProp-1.0.0': {
1677
- 'customTemplate': {
1678
- 'Uint32': {
1679
- 'a': 922337203685,
1790
+ "autodesk.test:testProp-1.0.0": {
1791
+ customTemplate: {
1792
+ "Uint32": {
1793
+ a: 922337203685,
1680
1794
  },
1681
- 'String': {
1682
- 'b': 'hello',
1683
- 'nested.c.d.e': 'world',
1684
- 'nested.c.d.f': 'hello',
1795
+ "String": {
1796
+ "b": "hello",
1797
+ "nested.c.d.e": "world",
1798
+ "nested.c.d.f": "hello",
1685
1799
  },
1686
- 'set<NamedProperty>': {
1687
- 'nestedSet': {
1688
- 'insert': {
1689
- 'NamedProperty': {
1690
- '91a59cb6-9881-2b5f-2366-84dbdc8b6838': {
1691
- 'String': {
1692
- 'guid': '91a59cb6-9881-2b5f-2366-84dbdc8b6838',
1800
+ "set<NamedProperty>": {
1801
+ nestedSet: {
1802
+ insert: {
1803
+ NamedProperty: {
1804
+ "91a59cb6-9881-2b5f-2366-84dbdc8b6838": {
1805
+ String: {
1806
+ guid: "91a59cb6-9881-2b5f-2366-84dbdc8b6838",
1693
1807
  },
1694
1808
  },
1695
1809
  },
@@ -1698,61 +1812,63 @@ describe('Utils', function () {
1698
1812
  },
1699
1813
  },
1700
1814
  },
1701
- 'String': {
1702
- 'emptyString': '',
1815
+ "String": {
1816
+ emptyString: "",
1703
1817
  },
1704
1818
  },
1705
- 'modify': {
1706
- 'NodeProperty': {
1707
- 'nested4': {
1708
- 'insert': {
1709
- 'Uint32': {
1710
- 'number': 4,
1819
+ modify: {
1820
+ "NodeProperty": {
1821
+ nested4: {
1822
+ insert: {
1823
+ Uint32: {
1824
+ number: 4,
1711
1825
  },
1712
1826
  },
1713
- 'remove': ['nested5', 'nested6'],
1827
+ remove: ["nested5", "nested6"],
1714
1828
  },
1715
1829
  },
1716
- 'array<Float32>': {
1717
- 'nestedArray2': {
1718
- 'modify': [[0, [0.707, 0.707, 0], [0, 0, 1]]],
1830
+ "array<Float32>": {
1831
+ nestedArray2: {
1832
+ modify: [[0, [0.707, 0.707, 0], [0, 0, 1]]],
1719
1833
  },
1720
1834
  },
1721
1835
  },
1722
- 'remove': [
1723
- 'nested7',
1724
- ],
1836
+ remove: ["nested7"],
1725
1837
  };
1726
- it('should filter change sets by paths resolving to all types (NodeProperty, array, map, set, NamedNodeProperty, Reference, Primitive types)', function () {
1727
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['nested1', 'nested4.nested5', 'nested4.number']);
1838
+ it("should filter change sets by paths resolving to all types (NodeProperty, array, map, set, NamedNodeProperty, Reference, Primitive types)", function () {
1839
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
1840
+ "nested1",
1841
+ "nested4.nested5",
1842
+ "nested4.number",
1843
+ ]);
1728
1844
  expect(filteredCS).to.eql({
1729
- 'insert': {
1730
- 'NodeProperty': {
1731
- 'nested1': {
1732
- 'insert': {
1733
- 'NodeProperty': {
1734
- 'nested2': {
1735
- 'insert': {
1736
- 'String': {
1737
- 'string': 'text',
1845
+ insert: {
1846
+ NodeProperty: {
1847
+ nested1: {
1848
+ insert: {
1849
+ "NodeProperty": {
1850
+ nested2: {
1851
+ insert: {
1852
+ String: {
1853
+ string: "text",
1738
1854
  },
1739
1855
  },
1740
1856
  },
1741
1857
  },
1742
- 'array<>': {
1743
- 'nestedArray': {
1744
- 'insert': [
1858
+ "array<>": {
1859
+ nestedArray: {
1860
+ insert: [
1745
1861
  [
1746
1862
  0,
1747
1863
  [
1748
1864
  {
1749
- 'typeid': 'NodeProperty',
1865
+ typeid: "NodeProperty",
1750
1866
  },
1751
1867
  {
1752
- 'typeid': 'NodeProperty',
1753
- 'insert': {
1754
- 'String': {
1755
- 'text': '',
1868
+ typeid: "NodeProperty",
1869
+ insert: {
1870
+ String: {
1871
+ text: "",
1756
1872
  },
1757
1873
  },
1758
1874
  },
@@ -1761,11 +1877,11 @@ describe('Utils', function () {
1761
1877
  ],
1762
1878
  },
1763
1879
  },
1764
- 'map<>': {
1765
- 'trulyNestedMap': {
1766
- 'insert': {
1767
- 'String': {
1768
- 'key1': 'The value is 1',
1880
+ "map<>": {
1881
+ trulyNestedMap: {
1882
+ insert: {
1883
+ String: {
1884
+ key1: "The value is 1",
1769
1885
  },
1770
1886
  },
1771
1887
  },
@@ -1774,30 +1890,34 @@ describe('Utils', function () {
1774
1890
  },
1775
1891
  },
1776
1892
  },
1777
- 'modify': {
1778
- 'NodeProperty': {
1779
- 'nested4': {
1780
- 'remove': ['nested5'],
1781
- 'insert': {
1782
- 'Uint32': {
1783
- 'number': 4,
1893
+ modify: {
1894
+ NodeProperty: {
1895
+ nested4: {
1896
+ remove: ["nested5"],
1897
+ insert: {
1898
+ Uint32: {
1899
+ number: 4,
1784
1900
  },
1785
1901
  },
1786
1902
  },
1787
1903
  },
1788
1904
  },
1789
1905
  });
1790
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['nested7', 'nested4', 'nested1.nested2']);
1906
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
1907
+ "nested7",
1908
+ "nested4",
1909
+ "nested1.nested2",
1910
+ ]);
1791
1911
  expect(filteredCS).to.eql({
1792
- 'insert': {
1793
- 'NodeProperty': {
1794
- 'nested1': {
1795
- 'insert': {
1796
- 'NodeProperty': {
1797
- 'nested2': {
1798
- 'insert': {
1799
- 'String': {
1800
- 'string': 'text',
1912
+ insert: {
1913
+ NodeProperty: {
1914
+ nested1: {
1915
+ insert: {
1916
+ NodeProperty: {
1917
+ nested2: {
1918
+ insert: {
1919
+ String: {
1920
+ string: "text",
1801
1921
  },
1802
1922
  },
1803
1923
  },
@@ -1806,42 +1926,44 @@ describe('Utils', function () {
1806
1926
  },
1807
1927
  },
1808
1928
  },
1809
- 'modify': {
1810
- 'NodeProperty': {
1811
- 'nested4': {
1812
- 'insert': {
1813
- 'Uint32': {
1814
- 'number': 4,
1929
+ modify: {
1930
+ NodeProperty: {
1931
+ nested4: {
1932
+ insert: {
1933
+ Uint32: {
1934
+ number: 4,
1815
1935
  },
1816
1936
  },
1817
- 'remove': ['nested5', 'nested6'],
1937
+ remove: ["nested5", "nested6"],
1818
1938
  },
1819
1939
  },
1820
1940
  },
1821
- 'remove': [
1822
- 'nested7',
1823
- ],
1941
+ remove: ["nested7"],
1824
1942
  });
1825
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['nested1.nestedArray', 'nestedMap.nestedMapBoolean', 'nestedArray2']);
1943
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
1944
+ "nested1.nestedArray",
1945
+ "nestedMap.nestedMapBoolean",
1946
+ "nestedArray2",
1947
+ ]);
1826
1948
  expect(filteredCS).to.eql({
1827
- 'insert': {
1828
- 'NodeProperty': {
1829
- 'nested1': {
1830
- 'insert': {
1831
- 'array<>': {
1832
- 'nestedArray': {
1833
- 'insert': [
1949
+ insert: {
1950
+ "NodeProperty": {
1951
+ nested1: {
1952
+ insert: {
1953
+ "array<>": {
1954
+ nestedArray: {
1955
+ insert: [
1834
1956
  [
1835
1957
  0,
1836
1958
  [
1837
1959
  {
1838
- 'typeid': 'NodeProperty',
1960
+ typeid: "NodeProperty",
1839
1961
  },
1840
1962
  {
1841
- 'typeid': 'NodeProperty',
1842
- 'insert': {
1843
- 'String': {
1844
- 'text': '',
1963
+ typeid: "NodeProperty",
1964
+ insert: {
1965
+ String: {
1966
+ text: "",
1845
1967
  },
1846
1968
  },
1847
1969
  },
@@ -1853,66 +1975,74 @@ describe('Utils', function () {
1853
1975
  },
1854
1976
  },
1855
1977
  },
1856
- 'map<>': {
1857
- 'nestedMap': {
1858
- 'insert': {
1859
- 'Bool': {
1860
- 'nestedMapBoolean': true,
1978
+ "map<>": {
1979
+ nestedMap: {
1980
+ insert: {
1981
+ Bool: {
1982
+ nestedMapBoolean: true,
1861
1983
  },
1862
1984
  },
1863
1985
  },
1864
1986
  },
1865
1987
  },
1866
- 'modify': {
1867
- 'array<Float32>': {
1868
- 'nestedArray2': {
1869
- 'modify': [[0, [0.707, 0.707, 0], [0, 0, 1]]],
1988
+ modify: {
1989
+ "array<Float32>": {
1990
+ nestedArray2: {
1991
+ modify: [[0, [0.707, 0.707, 0], [0, 0, 1]]],
1870
1992
  },
1871
1993
  },
1872
1994
  },
1873
1995
  });
1874
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['namedProp.guid', 'namedNodeProp.enumProp', 'namedNodeProp.guid']);
1996
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
1997
+ "namedProp.guid",
1998
+ "namedNodeProp.enumProp",
1999
+ "namedNodeProp.guid",
2000
+ ]);
1875
2001
  expect(filteredCS).to.eql({
1876
- 'insert': {
1877
- 'NamedProperty': {
1878
- 'namedProp': {
1879
- 'String': {
1880
- 'guid': 'e763527c-7f49-417c-8df3-9fb7f90a1932',
2002
+ insert: {
2003
+ NamedProperty: {
2004
+ namedProp: {
2005
+ String: {
2006
+ guid: "e763527c-7f49-417c-8df3-9fb7f90a1932",
1881
2007
  },
1882
2008
  },
1883
2009
  },
1884
- 'NamedNodeProperty': {
1885
- 'namedNodeProp': {
1886
- 'String': {
1887
- 'guid': 'efc68477-53b1-49ac-bd3f-e05a21f85a32',
1888
- },
1889
- 'insert': {
1890
- 'enum<autodesk.core:UnitsEnum-1.0.0>': {
1891
- 'enumProp': 0,
2010
+ NamedNodeProperty: {
2011
+ namedNodeProp: {
2012
+ String: {
2013
+ guid: "efc68477-53b1-49ac-bd3f-e05a21f85a32",
2014
+ },
2015
+ insert: {
2016
+ "enum<autodesk.core:UnitsEnum-1.0.0>": {
2017
+ enumProp: 0,
1892
2018
  },
1893
2019
  },
1894
2020
  },
1895
2021
  },
1896
2022
  },
1897
2023
  });
1898
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['customTemplate.a', 'customTemplate.nested.c.d.e', 'customTemplate.nestedSet']);
2024
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2025
+ "customTemplate.a",
2026
+ "customTemplate.nested.c.d.e",
2027
+ "customTemplate.nestedSet",
2028
+ ]);
1899
2029
  expect(filteredCS).to.eql({
1900
- 'insert': {
1901
- 'autodesk.test:testProp-1.0.0': {
1902
- 'customTemplate': {
1903
- 'Uint32': {
1904
- 'a': 922337203685,
1905
- },
1906
- 'String': {
1907
- 'nested.c.d.e': 'world',
1908
- },
1909
- 'set<NamedProperty>': {
1910
- 'nestedSet': {
1911
- 'insert': {
1912
- 'NamedProperty': {
1913
- '91a59cb6-9881-2b5f-2366-84dbdc8b6838': {
1914
- 'String': {
1915
- 'guid': '91a59cb6-9881-2b5f-2366-84dbdc8b6838',
2030
+ insert: {
2031
+ "autodesk.test:testProp-1.0.0": {
2032
+ customTemplate: {
2033
+ "Uint32": {
2034
+ a: 922337203685,
2035
+ },
2036
+ "String": {
2037
+ "nested.c.d.e": "world",
2038
+ },
2039
+ "set<NamedProperty>": {
2040
+ nestedSet: {
2041
+ insert: {
2042
+ NamedProperty: {
2043
+ "91a59cb6-9881-2b5f-2366-84dbdc8b6838": {
2044
+ String: {
2045
+ guid: "91a59cb6-9881-2b5f-2366-84dbdc8b6838",
1916
2046
  },
1917
2047
  },
1918
2048
  },
@@ -1923,36 +2053,36 @@ describe('Utils', function () {
1923
2053
  },
1924
2054
  },
1925
2055
  });
1926
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, new Map([[
1927
- 'customTemplate', new Map([
1928
- ['a', new Map()],
1929
- ['nested', new Map([[
1930
- 'c', new Map([[
1931
- 'd', new Map([[
1932
- 'e', new Map(),
1933
- ]]),
1934
- ]]),
1935
- ]])],
1936
- ['nestedSet', new Map()],
2056
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, new Map([
2057
+ [
2058
+ "customTemplate",
2059
+ new Map([
2060
+ ["a", new Map()],
2061
+ [
2062
+ "nested",
2063
+ new Map([["c", new Map([["d", new Map([["e", new Map()]])]])]]),
2064
+ ],
2065
+ ["nestedSet", new Map()],
1937
2066
  ]),
1938
- ]]));
2067
+ ],
2068
+ ]));
1939
2069
  expect(filteredCS).to.eql({
1940
- 'insert': {
1941
- 'autodesk.test:testProp-1.0.0': {
1942
- 'customTemplate': {
1943
- 'Uint32': {
1944
- 'a': 922337203685,
1945
- },
1946
- 'String': {
1947
- 'nested.c.d.e': 'world',
1948
- },
1949
- 'set<NamedProperty>': {
1950
- 'nestedSet': {
1951
- 'insert': {
1952
- 'NamedProperty': {
1953
- '91a59cb6-9881-2b5f-2366-84dbdc8b6838': {
1954
- 'String': {
1955
- 'guid': '91a59cb6-9881-2b5f-2366-84dbdc8b6838',
2070
+ insert: {
2071
+ "autodesk.test:testProp-1.0.0": {
2072
+ customTemplate: {
2073
+ "Uint32": {
2074
+ a: 922337203685,
2075
+ },
2076
+ "String": {
2077
+ "nested.c.d.e": "world",
2078
+ },
2079
+ "set<NamedProperty>": {
2080
+ nestedSet: {
2081
+ insert: {
2082
+ NamedProperty: {
2083
+ "91a59cb6-9881-2b5f-2366-84dbdc8b6838": {
2084
+ String: {
2085
+ guid: "91a59cb6-9881-2b5f-2366-84dbdc8b6838",
1956
2086
  },
1957
2087
  },
1958
2088
  },
@@ -1963,60 +2093,68 @@ describe('Utils', function () {
1963
2093
  },
1964
2094
  },
1965
2095
  });
1966
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['customTemplate.nested.c']);
2096
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2097
+ "customTemplate.nested.c",
2098
+ ]);
1967
2099
  expect(filteredCS).to.eql({
1968
- 'insert': {
1969
- 'autodesk.test:testProp-1.0.0': {
1970
- 'customTemplate': {
1971
- 'String': {
1972
- 'nested.c.d.e': 'world',
1973
- 'nested.c.d.f': 'hello',
2100
+ insert: {
2101
+ "autodesk.test:testProp-1.0.0": {
2102
+ customTemplate: {
2103
+ String: {
2104
+ "nested.c.d.e": "world",
2105
+ "nested.c.d.f": "hello",
1974
2106
  },
1975
2107
  },
1976
2108
  },
1977
2109
  },
1978
2110
  });
1979
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['customTemplate.nested.c.d']);
2111
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2112
+ "customTemplate.nested.c.d",
2113
+ ]);
1980
2114
  expect(filteredCS).to.eql({
1981
- 'insert': {
1982
- 'autodesk.test:testProp-1.0.0': {
1983
- 'customTemplate': {
1984
- 'String': {
1985
- 'nested.c.d.e': 'world',
1986
- 'nested.c.d.f': 'hello',
2115
+ insert: {
2116
+ "autodesk.test:testProp-1.0.0": {
2117
+ customTemplate: {
2118
+ String: {
2119
+ "nested.c.d.e": "world",
2120
+ "nested.c.d.f": "hello",
1987
2121
  },
1988
2122
  },
1989
2123
  },
1990
2124
  },
1991
2125
  });
1992
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['refProp', 'refRepoProp.commitGUID', 'refRepoProp.followBranch']);
2126
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2127
+ "refProp",
2128
+ "refRepoProp.commitGUID",
2129
+ "refRepoProp.followBranch",
2130
+ ]);
1993
2131
  expect(filteredCS).to.eql({
1994
- 'insert': {
1995
- 'Reference<String>': {
1996
- 'refProp': '/test.prop',
2132
+ insert: {
2133
+ "Reference<String>": {
2134
+ refProp: "/test.prop",
1997
2135
  },
1998
- 'RepositoryReferenceProperty': {
1999
- 'refRepoProp': {
2000
- 'Bool': {
2001
- 'followBranch': false,
2136
+ "RepositoryReferenceProperty": {
2137
+ refRepoProp: {
2138
+ Bool: {
2139
+ followBranch: false,
2002
2140
  },
2003
- 'String': {
2004
- 'commitGUID': '4c611c89-8241-4764-958e-77470bba3b9b',
2141
+ String: {
2142
+ commitGUID: "4c611c89-8241-4764-958e-77470bba3b9b",
2005
2143
  },
2006
2144
  },
2007
2145
  },
2008
2146
  },
2009
2147
  });
2010
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['assetMap[1].name']);
2148
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ["assetMap[1].name"]);
2011
2149
  expect(filteredCS).to.eql({
2012
- 'insert': {
2013
- 'map<mysample:asset-1.0.0>': {
2014
- 'assetMap': {
2015
- 'insert': {
2016
- 'mysample:asset-1.0.0': {
2017
- '1': {
2018
- 'String': {
2019
- 'name': 'test asset 1',
2150
+ insert: {
2151
+ "map<mysample:asset-1.0.0>": {
2152
+ assetMap: {
2153
+ insert: {
2154
+ "mysample:asset-1.0.0": {
2155
+ 1: {
2156
+ String: {
2157
+ name: "test asset 1",
2020
2158
  },
2021
2159
  },
2022
2160
  },
@@ -2026,16 +2164,16 @@ describe('Utils', function () {
2026
2164
  },
2027
2165
  });
2028
2166
  // For maps, using dots as separators, instead of brackets, is also supported.
2029
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['assetMap.1.name']);
2167
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ["assetMap.1.name"]);
2030
2168
  expect(filteredCS).to.eql({
2031
- 'insert': {
2032
- 'map<mysample:asset-1.0.0>': {
2033
- 'assetMap': {
2034
- 'insert': {
2035
- 'mysample:asset-1.0.0': {
2036
- '1': {
2037
- 'String': {
2038
- 'name': 'test asset 1',
2169
+ insert: {
2170
+ "map<mysample:asset-1.0.0>": {
2171
+ assetMap: {
2172
+ insert: {
2173
+ "mysample:asset-1.0.0": {
2174
+ 1: {
2175
+ String: {
2176
+ name: "test asset 1",
2039
2177
  },
2040
2178
  },
2041
2179
  },
@@ -2045,27 +2183,32 @@ describe('Utils', function () {
2045
2183
  },
2046
2184
  });
2047
2185
  });
2048
- it('should ignore overlapping paths', function () {
2049
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['customTemplate', 'customTemplate.a', 'customTemplate.nested.c.d.e', 'customTemplate.nestedSet']);
2186
+ it("should ignore overlapping paths", function () {
2187
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2188
+ "customTemplate",
2189
+ "customTemplate.a",
2190
+ "customTemplate.nested.c.d.e",
2191
+ "customTemplate.nestedSet",
2192
+ ]);
2050
2193
  expect(filteredCS).to.eql({
2051
- 'insert': {
2052
- 'autodesk.test:testProp-1.0.0': {
2053
- 'customTemplate': {
2054
- 'Uint32': {
2055
- 'a': 922337203685,
2056
- },
2057
- 'String': {
2058
- 'b': 'hello',
2059
- 'nested.c.d.e': 'world',
2060
- 'nested.c.d.f': 'hello',
2061
- },
2062
- 'set<NamedProperty>': {
2063
- 'nestedSet': {
2064
- 'insert': {
2065
- 'NamedProperty': {
2066
- '91a59cb6-9881-2b5f-2366-84dbdc8b6838': {
2067
- 'String': {
2068
- 'guid': '91a59cb6-9881-2b5f-2366-84dbdc8b6838',
2194
+ insert: {
2195
+ "autodesk.test:testProp-1.0.0": {
2196
+ customTemplate: {
2197
+ "Uint32": {
2198
+ a: 922337203685,
2199
+ },
2200
+ "String": {
2201
+ "b": "hello",
2202
+ "nested.c.d.e": "world",
2203
+ "nested.c.d.f": "hello",
2204
+ },
2205
+ "set<NamedProperty>": {
2206
+ nestedSet: {
2207
+ insert: {
2208
+ NamedProperty: {
2209
+ "91a59cb6-9881-2b5f-2366-84dbdc8b6838": {
2210
+ String: {
2211
+ guid: "91a59cb6-9881-2b5f-2366-84dbdc8b6838",
2069
2212
  },
2070
2213
  },
2071
2214
  },
@@ -2076,18 +2219,20 @@ describe('Utils', function () {
2076
2219
  },
2077
2220
  },
2078
2221
  });
2079
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['customTemplate.nestedSet[91a59cb6-9881-2b5f-2366-84dbdc8b6838].guid']);
2222
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2223
+ "customTemplate.nestedSet[91a59cb6-9881-2b5f-2366-84dbdc8b6838].guid",
2224
+ ]);
2080
2225
  expect(filteredCS).to.eql({
2081
- 'insert': {
2082
- 'autodesk.test:testProp-1.0.0': {
2083
- 'customTemplate': {
2084
- 'set<NamedProperty>': {
2085
- 'nestedSet': {
2086
- 'insert': {
2087
- 'NamedProperty': {
2088
- '91a59cb6-9881-2b5f-2366-84dbdc8b6838': {
2089
- 'String': {
2090
- 'guid': '91a59cb6-9881-2b5f-2366-84dbdc8b6838',
2226
+ insert: {
2227
+ "autodesk.test:testProp-1.0.0": {
2228
+ customTemplate: {
2229
+ "set<NamedProperty>": {
2230
+ nestedSet: {
2231
+ insert: {
2232
+ NamedProperty: {
2233
+ "91a59cb6-9881-2b5f-2366-84dbdc8b6838": {
2234
+ String: {
2235
+ guid: "91a59cb6-9881-2b5f-2366-84dbdc8b6838",
2091
2236
  },
2092
2237
  },
2093
2238
  },
@@ -2099,26 +2244,31 @@ describe('Utils', function () {
2099
2244
  },
2100
2245
  });
2101
2246
  // Flip order
2102
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['customTemplate.a', 'customTemplate.nested.c.d.e', 'customTemplate', 'customTemplate.nestedSet']);
2247
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2248
+ "customTemplate.a",
2249
+ "customTemplate.nested.c.d.e",
2250
+ "customTemplate",
2251
+ "customTemplate.nestedSet",
2252
+ ]);
2103
2253
  expect(filteredCS).to.eql({
2104
- 'insert': {
2105
- 'autodesk.test:testProp-1.0.0': {
2106
- 'customTemplate': {
2107
- 'Uint32': {
2108
- 'a': 922337203685,
2109
- },
2110
- 'String': {
2111
- 'b': 'hello',
2112
- 'nested.c.d.e': 'world',
2113
- 'nested.c.d.f': 'hello',
2114
- },
2115
- 'set<NamedProperty>': {
2116
- 'nestedSet': {
2117
- 'insert': {
2118
- 'NamedProperty': {
2119
- '91a59cb6-9881-2b5f-2366-84dbdc8b6838': {
2120
- 'String': {
2121
- 'guid': '91a59cb6-9881-2b5f-2366-84dbdc8b6838',
2254
+ insert: {
2255
+ "autodesk.test:testProp-1.0.0": {
2256
+ customTemplate: {
2257
+ "Uint32": {
2258
+ a: 922337203685,
2259
+ },
2260
+ "String": {
2261
+ "b": "hello",
2262
+ "nested.c.d.e": "world",
2263
+ "nested.c.d.f": "hello",
2264
+ },
2265
+ "set<NamedProperty>": {
2266
+ nestedSet: {
2267
+ insert: {
2268
+ NamedProperty: {
2269
+ "91a59cb6-9881-2b5f-2366-84dbdc8b6838": {
2270
+ String: {
2271
+ guid: "91a59cb6-9881-2b5f-2366-84dbdc8b6838",
2122
2272
  },
2123
2273
  },
2124
2274
  },
@@ -2130,26 +2280,32 @@ describe('Utils', function () {
2130
2280
  },
2131
2281
  });
2132
2282
  // Duplicate paths
2133
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['customTemplate.a', 'customTemplate', 'customTemplate.nested.c.d.e', 'customTemplate', 'customTemplate.nestedSet']);
2283
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2284
+ "customTemplate.a",
2285
+ "customTemplate",
2286
+ "customTemplate.nested.c.d.e",
2287
+ "customTemplate",
2288
+ "customTemplate.nestedSet",
2289
+ ]);
2134
2290
  expect(filteredCS).to.eql({
2135
- 'insert': {
2136
- 'autodesk.test:testProp-1.0.0': {
2137
- 'customTemplate': {
2138
- 'Uint32': {
2139
- 'a': 922337203685,
2140
- },
2141
- 'String': {
2142
- 'b': 'hello',
2143
- 'nested.c.d.e': 'world',
2144
- 'nested.c.d.f': 'hello',
2145
- },
2146
- 'set<NamedProperty>': {
2147
- 'nestedSet': {
2148
- 'insert': {
2149
- 'NamedProperty': {
2150
- '91a59cb6-9881-2b5f-2366-84dbdc8b6838': {
2151
- 'String': {
2152
- 'guid': '91a59cb6-9881-2b5f-2366-84dbdc8b6838',
2291
+ insert: {
2292
+ "autodesk.test:testProp-1.0.0": {
2293
+ customTemplate: {
2294
+ "Uint32": {
2295
+ a: 922337203685,
2296
+ },
2297
+ "String": {
2298
+ "b": "hello",
2299
+ "nested.c.d.e": "world",
2300
+ "nested.c.d.f": "hello",
2301
+ },
2302
+ "set<NamedProperty>": {
2303
+ nestedSet: {
2304
+ insert: {
2305
+ NamedProperty: {
2306
+ "91a59cb6-9881-2b5f-2366-84dbdc8b6838": {
2307
+ String: {
2308
+ guid: "91a59cb6-9881-2b5f-2366-84dbdc8b6838",
2153
2309
  },
2154
2310
  },
2155
2311
  },
@@ -2160,29 +2316,40 @@ describe('Utils', function () {
2160
2316
  },
2161
2317
  },
2162
2318
  });
2163
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['emptyString']);
2319
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ["emptyString"]);
2164
2320
  expect(filteredCS).to.eql({
2165
- 'insert': {
2166
- 'String': {
2167
- 'emptyString': '',
2321
+ insert: {
2322
+ String: {
2323
+ emptyString: "",
2168
2324
  },
2169
2325
  },
2170
2326
  });
2171
2327
  });
2172
- it('should return an empty change set when filtering by a path that does not exist', function () {
2173
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['path.that.does.not.exist', 'dontExist', 'does.not.exist']);
2328
+ it("should return an empty change set when filtering by a path that does not exist", function () {
2329
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2330
+ "path.that.does.not.exist",
2331
+ "dontExist",
2332
+ "does.not.exist",
2333
+ ]);
2174
2334
  expect(filteredCS).to.be.eql({});
2175
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['nested7', 'nested4', 'nested1.nested2', 'path.that.does.not.exist', 'dontExist', 'does.not.exist']);
2335
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2336
+ "nested7",
2337
+ "nested4",
2338
+ "nested1.nested2",
2339
+ "path.that.does.not.exist",
2340
+ "dontExist",
2341
+ "does.not.exist",
2342
+ ]);
2176
2343
  expect(filteredCS).to.eql({
2177
- 'insert': {
2178
- 'NodeProperty': {
2179
- 'nested1': {
2180
- 'insert': {
2181
- 'NodeProperty': {
2182
- 'nested2': {
2183
- 'insert': {
2184
- 'String': {
2185
- 'string': 'text',
2344
+ insert: {
2345
+ NodeProperty: {
2346
+ nested1: {
2347
+ insert: {
2348
+ NodeProperty: {
2349
+ nested2: {
2350
+ insert: {
2351
+ String: {
2352
+ string: "text",
2186
2353
  },
2187
2354
  },
2188
2355
  },
@@ -2191,33 +2358,34 @@ describe('Utils', function () {
2191
2358
  },
2192
2359
  },
2193
2360
  },
2194
- 'modify': {
2195
- 'NodeProperty': {
2196
- 'nested4': {
2197
- 'insert': {
2198
- 'Uint32': {
2199
- 'number': 4,
2361
+ modify: {
2362
+ NodeProperty: {
2363
+ nested4: {
2364
+ insert: {
2365
+ Uint32: {
2366
+ number: 4,
2200
2367
  },
2201
2368
  },
2202
- 'remove': ['nested5', 'nested6'],
2369
+ remove: ["nested5", "nested6"],
2203
2370
  },
2204
2371
  },
2205
2372
  },
2206
- 'remove': [
2207
- 'nested7',
2208
- ],
2373
+ remove: ["nested7"],
2209
2374
  });
2210
- filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['nested1.nested2', 'nested1.nested6']);
2375
+ filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2376
+ "nested1.nested2",
2377
+ "nested1.nested6",
2378
+ ]);
2211
2379
  expect(filteredCS).to.eql({
2212
- 'insert': {
2213
- 'NodeProperty': {
2214
- 'nested1': {
2215
- 'insert': {
2216
- 'NodeProperty': {
2217
- 'nested2': {
2218
- 'insert': {
2219
- 'String': {
2220
- 'string': 'text',
2380
+ insert: {
2381
+ NodeProperty: {
2382
+ nested1: {
2383
+ insert: {
2384
+ NodeProperty: {
2385
+ nested2: {
2386
+ insert: {
2387
+ String: {
2388
+ string: "text",
2221
2389
  },
2222
2390
  },
2223
2391
  },
@@ -2228,32 +2396,36 @@ describe('Utils', function () {
2228
2396
  },
2229
2397
  });
2230
2398
  // Partially matched paths are included
2231
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['assetMap[2]']);
2399
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ["assetMap[2]"]);
2232
2400
  expect(filteredCS).to.eql({
2233
- 'insert': {
2234
- 'map<mysample:asset-1.0.0>': {
2235
- 'assetMap': {},
2401
+ insert: {
2402
+ "map<mysample:asset-1.0.0>": {
2403
+ assetMap: {},
2236
2404
  },
2237
2405
  },
2238
2406
  });
2239
2407
  // Closest partially matched path 'customTemplate.nested.c.d' cannot be included
2240
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['customTemplate.nested.c.d.g']);
2408
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2409
+ "customTemplate.nested.c.d.g",
2410
+ ]);
2241
2411
  expect(filteredCS).to.eql({
2242
- 'insert': {
2243
- 'autodesk.test:testProp-1.0.0': {
2244
- 'customTemplate': {},
2412
+ insert: {
2413
+ "autodesk.test:testProp-1.0.0": {
2414
+ customTemplate: {},
2245
2415
  },
2246
2416
  },
2247
2417
  });
2248
2418
  // Partial match should also work with nested properties
2249
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['nested1.trulyNestedMap[newKey]']);
2419
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2420
+ "nested1.trulyNestedMap[newKey]",
2421
+ ]);
2250
2422
  expect(filteredCS).to.eql({
2251
- 'insert': {
2252
- 'NodeProperty': {
2253
- 'nested1': {
2254
- 'insert': {
2255
- 'map<>': {
2256
- 'trulyNestedMap': {},
2423
+ insert: {
2424
+ NodeProperty: {
2425
+ nested1: {
2426
+ insert: {
2427
+ "map<>": {
2428
+ trulyNestedMap: {},
2257
2429
  },
2258
2430
  },
2259
2431
  },
@@ -2261,105 +2433,120 @@ describe('Utils', function () {
2261
2433
  },
2262
2434
  });
2263
2435
  // Filter a nested non existing entry from a templated property
2264
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['customTemplate.nestedSet.nonExisting', 'customTemplate.a']);
2436
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, [
2437
+ "customTemplate.nestedSet.nonExisting",
2438
+ "customTemplate.a",
2439
+ ]);
2265
2440
  expect(filteredCS).to.eql({
2266
2441
  insert: {
2267
- 'autodesk.test:testProp-1.0.0': {
2268
- 'customTemplate': {
2269
- 'Uint32': {
2270
- 'a': 922337203685,
2442
+ "autodesk.test:testProp-1.0.0": {
2443
+ customTemplate: {
2444
+ "Uint32": {
2445
+ a: 922337203685,
2271
2446
  },
2272
- 'set<NamedProperty>': {
2273
- 'nestedSet': {},
2447
+ "set<NamedProperty>": {
2448
+ nestedSet: {},
2274
2449
  },
2275
2450
  },
2276
2451
  },
2277
2452
  },
2278
2453
  });
2279
2454
  // Make sure, nested removes are treated correctly
2280
- var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ['nested7.abcd']);
2455
+ var filteredCS = Utils.getFilteredChangeSetByPaths(changeSet, ["nested7.abcd"]);
2281
2456
  expect(filteredCS).to.eql({
2282
- 'remove': ['nested7'],
2457
+ remove: ["nested7"],
2283
2458
  });
2284
2459
  });
2285
- it('should fail filtering change sets with paths that resolve into arrays and sets', function () {
2286
- var failedFilteredFunc = Utils.getFilteredChangeSetByPaths.bind(null, changeSet, ['nested1.nestedArray[0]']);
2460
+ it("should fail filtering change sets with paths that resolve into arrays and sets", function () {
2461
+ var failedFilteredFunc = Utils.getFilteredChangeSetByPaths.bind(null, changeSet, [
2462
+ "nested1.nestedArray[0]",
2463
+ ]);
2287
2464
  expect(failedFilteredFunc).to.throw(Error, MSG.FILTER_PATH_WITHIN_ARRAY);
2288
2465
  // With valid paths
2289
- failedFilteredFunc = Utils.getFilteredChangeSetByPaths.bind(null, changeSet, ['customTemplate', 'nested1.nestedArray[0]']);
2466
+ failedFilteredFunc = Utils.getFilteredChangeSetByPaths.bind(null, changeSet, [
2467
+ "customTemplate",
2468
+ "nested1.nestedArray[0]",
2469
+ ]);
2290
2470
  expect(failedFilteredFunc).to.throw(Error, MSG.FILTER_PATH_WITHIN_ARRAY);
2291
2471
  });
2292
- it('should work for ChangeSet with segments requiring escapes for NodeProperties', function () {
2293
- var node = PropertyFactory.create('NodeProperty');
2294
- node.insert('."test".', PropertyFactory.create('NodeProperty'));
2295
- node.get('."test".').insert('[abcd]', PropertyFactory.create('String', undefined, 'test'));
2472
+ it("should work for ChangeSet with segments requiring escapes for NodeProperties", function () {
2473
+ var node = PropertyFactory.create("NodeProperty");
2474
+ node.insert('."test".', PropertyFactory.create("NodeProperty"));
2475
+ node.get('."test".').insert("[abcd]", PropertyFactory.create("String", undefined, "test"));
2296
2476
  var CS = node.serialize();
2297
2477
  var filteredCS = Utils.getFilteredChangeSetByPaths(CS, ['".\\"test\\"."."[abcd]"']);
2298
2478
  expect(filteredCS).to.deep.equal(CS);
2299
2479
  node.cleanDirty();
2300
- node.get('."test".').get('[abcd]').setValue('test2');
2480
+ node.get('."test".').get("[abcd]").setValue("test2");
2301
2481
  // Test a modification
2302
2482
  CS = node.serialize({ dirtyOnly: true });
2303
2483
  filteredCS = Utils.getFilteredChangeSetByPaths(CS, ['".\\"test\\"."."[abcd]"']);
2304
2484
  expect(filteredCS).to.deep.equal(CS);
2305
2485
  // Test a removal
2306
2486
  node.cleanDirty();
2307
- node.get('."test".').remove('[abcd]');
2487
+ node.get('."test".').remove("[abcd]");
2308
2488
  CS = node.serialize({ dirtyOnly: true });
2309
2489
  filteredCS = Utils.getFilteredChangeSetByPaths(CS, ['".\\"test\\"."']);
2310
2490
  expect(filteredCS).to.deep.equal(CS);
2311
2491
  });
2312
- it('should work for ChangeSet with segments requiring escapes in template', function () {
2313
- var node = PropertyFactory.create('autodesk.tests:property.with.quotable.characters-1.0.0');
2492
+ it("should work for ChangeSet with segments requiring escapes in template", function () {
2493
+ var node = PropertyFactory.create("autodesk.tests:property.with.quotable.characters-1.0.0");
2314
2494
  node.cleanDirty();
2315
- node.get(['test[property]', '.property.']).get('test').value = 'test';
2495
+ node.get(["test[property]", ".property."]).get("test").value = "test";
2316
2496
  var CS = node.serialize({ dirtyOnly: true });
2317
- var filteredCS = Utils.getFilteredChangeSetByPaths(CS, ['"test[property]".".property."']);
2497
+ var filteredCS = Utils.getFilteredChangeSetByPaths(CS, [
2498
+ '"test[property]".".property."',
2499
+ ]);
2318
2500
  expect(filteredCS).to.deep.equal(CS);
2319
2501
  });
2320
- it('should work for reversible ChangeSet', function () {
2502
+ it("should work for reversible ChangeSet", function () {
2321
2503
  var originalChangeSet = {
2322
- 'insert': {
2323
- 'autodesk.tests:AnonymousMapTestPropertyID-1.0.0': {
2324
- 'F': { 'String': { 'stringProperty': '' } },
2504
+ insert: {
2505
+ "autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
2506
+ F: { String: { stringProperty: "" } },
2325
2507
  },
2326
2508
  },
2327
- 'remove': ['B', 'C'],
2328
- 'modify': {
2329
- 'autodesk.tests:AnonymousMapTestPropertyID-1.0.0': {
2330
- 'A': { 'String': { 'stringProperty': 'hello' } },
2509
+ remove: ["B", "C"],
2510
+ modify: {
2511
+ "autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
2512
+ A: { String: { stringProperty: "hello" } },
2331
2513
  },
2332
2514
  },
2333
2515
  };
2334
2516
  var parentChangeSet = {
2335
- 'insert': {
2336
- 'autodesk.tests:AnonymousMapTestPropertyID-1.0.0': {
2337
- 'A': { 'String': { 'stringProperty': '' } },
2338
- 'B': { 'String': { 'stringProperty': '' } },
2339
- 'C': { 'String': { 'stringProperty': '' } },
2517
+ insert: {
2518
+ "autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
2519
+ A: { String: { stringProperty: "" } },
2520
+ B: { String: { stringProperty: "" } },
2521
+ C: { String: { stringProperty: "" } },
2340
2522
  },
2341
2523
  },
2342
2524
  };
2343
2525
  var cs = new ChangeSet(originalChangeSet);
2344
2526
  cs._toReversibleChangeSet(parentChangeSet);
2345
- var filteredCS = Utils.getFilteredChangeSetByPaths(cs.getSerializedChangeSet(), ['A', 'B', 'F']);
2527
+ var filteredCS = Utils.getFilteredChangeSetByPaths(cs.getSerializedChangeSet(), [
2528
+ "A",
2529
+ "B",
2530
+ "F",
2531
+ ]);
2346
2532
  expect(filteredCS).to.eql({
2347
- 'insert': {
2348
- 'autodesk.tests:AnonymousMapTestPropertyID-1.0.0': {
2349
- 'F': { 'String': { 'stringProperty': '' } },
2533
+ insert: {
2534
+ "autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
2535
+ F: { String: { stringProperty: "" } },
2350
2536
  },
2351
2537
  },
2352
- 'remove': {
2353
- 'autodesk.tests:AnonymousMapTestPropertyID-1.0.0': {
2354
- 'B': { 'String': { 'stringProperty': '' } },
2538
+ remove: {
2539
+ "autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
2540
+ B: { String: { stringProperty: "" } },
2355
2541
  },
2356
- }, 'modify': {
2357
- 'autodesk.tests:AnonymousMapTestPropertyID-1.0.0': {
2358
- 'A': {
2359
- 'String': {
2360
- 'stringProperty': {
2361
- 'value': 'hello',
2362
- 'oldValue': '',
2542
+ },
2543
+ modify: {
2544
+ "autodesk.tests:AnonymousMapTestPropertyID-1.0.0": {
2545
+ A: {
2546
+ String: {
2547
+ stringProperty: {
2548
+ value: "hello",
2549
+ oldValue: "",
2363
2550
  },
2364
2551
  },
2365
2552
  },
@@ -2368,26 +2555,26 @@ describe('Utils', function () {
2368
2555
  });
2369
2556
  });
2370
2557
  });
2371
- describe('Utils.getFilteredOutChangeSetByPaths', () => {
2558
+ describe("Utils.getFilteredOutChangeSetByPaths", () => {
2372
2559
  const changeset = {
2373
- 'insert': {
2374
- 'map<NodeProperty>': {
2375
- 'assets': {
2376
- 'insert': {
2377
- 'autodesk.test:sample-1.0.0': {
2378
- 'Prop1': {
2379
- 'String': {
2380
- 'guid': 'Prop1',
2560
+ insert: {
2561
+ "map<NodeProperty>": {
2562
+ assets: {
2563
+ insert: {
2564
+ "autodesk.test:sample-1.0.0": {
2565
+ Prop1: {
2566
+ String: {
2567
+ guid: "Prop1",
2381
2568
  },
2382
2569
  },
2383
- 'Prop2': {
2384
- 'String': {
2385
- 'guid': 'Prop2',
2570
+ Prop2: {
2571
+ String: {
2572
+ guid: "Prop2",
2386
2573
  },
2387
2574
  },
2388
- 'Prop3': {
2389
- 'String': {
2390
- 'guid': 'Prop3',
2575
+ Prop3: {
2576
+ String: {
2577
+ guid: "Prop3",
2391
2578
  },
2392
2579
  },
2393
2580
  },
@@ -2397,19 +2584,19 @@ describe('Utils', function () {
2397
2584
  },
2398
2585
  };
2399
2586
  const singleExclusion = {
2400
- 'insert': {
2401
- 'map<NodeProperty>': {
2402
- 'assets': {
2403
- 'insert': {
2404
- 'autodesk.test:sample-1.0.0': {
2405
- 'Prop1': {
2406
- 'String': {
2407
- 'guid': 'Prop1',
2587
+ insert: {
2588
+ "map<NodeProperty>": {
2589
+ assets: {
2590
+ insert: {
2591
+ "autodesk.test:sample-1.0.0": {
2592
+ Prop1: {
2593
+ String: {
2594
+ guid: "Prop1",
2408
2595
  },
2409
2596
  },
2410
- 'Prop2': {
2411
- 'String': {
2412
- 'guid': 'Prop2',
2597
+ Prop2: {
2598
+ String: {
2599
+ guid: "Prop2",
2413
2600
  },
2414
2601
  },
2415
2602
  },
@@ -2419,14 +2606,14 @@ describe('Utils', function () {
2419
2606
  },
2420
2607
  };
2421
2608
  const multiExclusion = {
2422
- 'insert': {
2423
- 'map<NodeProperty>': {
2424
- 'assets': {
2425
- 'insert': {
2426
- 'autodesk.test:sample-1.0.0': {
2427
- 'Prop1': {
2428
- 'String': {
2429
- 'guid': 'Prop1',
2609
+ insert: {
2610
+ "map<NodeProperty>": {
2611
+ assets: {
2612
+ insert: {
2613
+ "autodesk.test:sample-1.0.0": {
2614
+ Prop1: {
2615
+ String: {
2616
+ guid: "Prop1",
2430
2617
  },
2431
2618
  },
2432
2619
  },
@@ -2435,32 +2622,35 @@ describe('Utils', function () {
2435
2622
  },
2436
2623
  },
2437
2624
  };
2438
- it('should exclude single given path', () => {
2439
- let res = Utils.excludePathsFromChangeSet(changeset, 'assets[Prop3]');
2625
+ it("should exclude single given path", () => {
2626
+ let res = Utils.excludePathsFromChangeSet(changeset, "assets[Prop3]");
2440
2627
  expect(res).to.be.deep.equal(singleExclusion);
2441
2628
  });
2442
- it('should exclude single given path in array', () => {
2443
- let res = Utils.excludePathsFromChangeSet(changeset, ['assets[Prop3]']);
2629
+ it("should exclude single given path in array", () => {
2630
+ let res = Utils.excludePathsFromChangeSet(changeset, ["assets[Prop3]"]);
2444
2631
  expect(res).to.be.deep.equal(singleExclusion);
2445
2632
  });
2446
- it('should exclude every given path in array', () => {
2447
- let res = Utils.excludePathsFromChangeSet(changeset, ['assets[Prop3]', 'assets[Prop2]']);
2633
+ it("should exclude every given path in array", () => {
2634
+ let res = Utils.excludePathsFromChangeSet(changeset, [
2635
+ "assets[Prop3]",
2636
+ "assets[Prop2]",
2637
+ ]);
2448
2638
  expect(res).to.be.deep.equal(multiExclusion);
2449
2639
  });
2450
- it('should return undefined if no changeset is passed', () => {
2451
- let res = Utils.excludePathsFromChangeSet(undefined, ['assets[Prop3]']);
2640
+ it("should return undefined if no changeset is passed", () => {
2641
+ let res = Utils.excludePathsFromChangeSet(undefined, ["assets[Prop3]"]);
2452
2642
  expect(res).to.be.undefined;
2453
2643
  });
2454
- it('should not exclude if no paths are passed', () => {
2644
+ it("should not exclude if no paths are passed", () => {
2455
2645
  expect(Utils.excludePathsFromChangeSet(changeset)).to.be.deep.equal(changeset);
2456
- expect(Utils.excludePathsFromChangeSet(changeset, '')).to.be.deep.equal(changeset);
2646
+ expect(Utils.excludePathsFromChangeSet(changeset, "")).to.be.deep.equal(changeset);
2457
2647
  expect(Utils.excludePathsFromChangeSet(changeset, [])).to.be.deep.equal(changeset);
2458
2648
  });
2459
- it('should not exclude if an invalid path is passed', () => {
2460
- expect(Utils.excludePathsFromChangeSet(changeset, ['a.b.c'])).to.be.deep.equal(changeset);
2649
+ it("should not exclude if an invalid path is passed", () => {
2650
+ expect(Utils.excludePathsFromChangeSet(changeset, ["a.b.c"])).to.be.deep.equal(changeset);
2461
2651
  });
2462
- it('should copy the changeset', () => {
2463
- expect(Utils.excludePathsFromChangeSet(changeset, ['assets[prop3]'])).to.not.be.equal(changeset);
2652
+ it("should copy the changeset", () => {
2653
+ expect(Utils.excludePathsFromChangeSet(changeset, ["assets[prop3]"])).to.not.be.equal(changeset);
2464
2654
  });
2465
2655
  });
2466
2656
  });