@ironcode/vas-lib 0.0.1 → 1.0.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 (274) hide show
  1. package/lib/entity/{vas-report-request.dto.d.ts → report-request.model.d.ts} +2 -1
  2. package/lib/entity/report-request.model.js +2 -0
  3. package/lib/entity/report-request.model.js.map +1 -0
  4. package/lib/entity/vas-account-object.dto.js +2 -0
  5. package/lib/entity/vas-account-object.dto.js.map +1 -0
  6. package/lib/entity/vas-base.dto.js +2 -0
  7. package/lib/entity/vas-base.dto.js.map +1 -0
  8. package/{cjs/lib → lib}/entity/vas-base.model.js +1 -5
  9. package/lib/entity/vas-base.model.js.map +1 -0
  10. package/lib/entity/vas-control-type.dto.js +2 -0
  11. package/lib/entity/vas-control-type.dto.js.map +1 -0
  12. package/{cjs/lib → lib}/entity/vas-control-type.model.js +4 -8
  13. package/lib/entity/vas-control-type.model.js.map +1 -0
  14. package/lib/entity/vas-control.dto.js +2 -0
  15. package/lib/entity/vas-control.dto.js.map +1 -0
  16. package/lib/entity/vas-control.model.d.ts +1 -8
  17. package/{cjs/lib → lib}/entity/vas-control.model.js +7 -20
  18. package/lib/entity/vas-control.model.js.map +1 -0
  19. package/lib/entity/vas-field.dto.d.ts +1 -2
  20. package/lib/entity/vas-field.dto.js +2 -0
  21. package/lib/entity/vas-field.dto.js.map +1 -0
  22. package/lib/entity/vas-file.dto.js +2 -0
  23. package/lib/entity/vas-file.dto.js.map +1 -0
  24. package/lib/entity/vas-form.dto.js +2 -0
  25. package/lib/entity/vas-form.dto.js.map +1 -0
  26. package/{cjs/lib → lib}/entity/vas-form.model.js +6 -10
  27. package/lib/entity/vas-form.model.js.map +1 -0
  28. package/lib/entity/vas-group.dto.d.ts +1 -1
  29. package/lib/entity/vas-group.dto.js +2 -0
  30. package/lib/entity/vas-group.dto.js.map +1 -0
  31. package/lib/entity/vas-group.model.d.ts +3 -3
  32. package/{cjs/lib → lib}/entity/vas-group.model.js +10 -14
  33. package/lib/entity/vas-group.model.js.map +1 -0
  34. package/lib/entity/vas-job-data.dto.js +2 -0
  35. package/lib/entity/vas-job-data.dto.js.map +1 -0
  36. package/lib/entity/vas-job.dto.js +2 -0
  37. package/lib/entity/vas-job.dto.js.map +1 -0
  38. package/lib/entity/vas-job.model.d.ts +7 -28
  39. package/{cjs/lib → lib}/entity/vas-job.model.js +21 -60
  40. package/lib/entity/vas-job.model.js.map +1 -0
  41. package/lib/entity/vas-report-layout.dto.js +2 -0
  42. package/lib/entity/vas-report-layout.dto.js.map +1 -0
  43. package/lib/entity/vas-restricted-account-object.dto.js +2 -0
  44. package/lib/entity/vas-restricted-account-object.dto.js.map +1 -0
  45. package/lib/entity/vas-user.dto.js +2 -0
  46. package/lib/entity/vas-user.dto.js.map +1 -0
  47. package/lib/entity/vas-user.model.d.ts +2 -2
  48. package/{cjs/lib → lib}/entity/vas-user.model.js +7 -11
  49. package/lib/entity/vas-user.model.js.map +1 -0
  50. package/lib/ng-models/ng-control.model.d.ts +14 -0
  51. package/lib/ng-models/ng-control.model.js +14 -0
  52. package/lib/ng-models/ng-control.model.js.map +1 -0
  53. package/lib/ng-models/ng-form.model.d.ts +27 -0
  54. package/lib/ng-models/ng-form.model.js +54 -0
  55. package/lib/ng-models/ng-form.model.js.map +1 -0
  56. package/lib/ng-models/ng-group.model.d.ts +36 -0
  57. package/lib/ng-models/ng-group.model.js +59 -0
  58. package/lib/ng-models/ng-group.model.js.map +1 -0
  59. package/{cjs/lib/entity/vas-report-request.dto.d.ts → lib/report-request.model.d.ts} +2 -2
  60. package/lib/report-request.model.js +2 -0
  61. package/lib/report-request.model.js.map +1 -0
  62. package/{cjs/lib → lib}/utils/find-form-control.d.ts +0 -1
  63. package/lib/utils/find-form-control.js +20 -0
  64. package/lib/utils/find-form-control.js.map +1 -0
  65. package/{cjs/lib/entity → lib}/vas-account-object.dto.d.ts +0 -1
  66. package/lib/vas-account-object.dto.js +2 -0
  67. package/lib/vas-account-object.dto.js.map +1 -0
  68. package/{cjs/lib/entity → lib}/vas-base.dto.d.ts +0 -1
  69. package/lib/vas-base.dto.js +2 -0
  70. package/lib/vas-base.dto.js.map +1 -0
  71. package/{cjs/lib/entity → lib}/vas-base.model.d.ts +0 -1
  72. package/lib/vas-base.model.js +24 -0
  73. package/lib/vas-base.model.js.map +1 -0
  74. package/{cjs/lib/entity → lib}/vas-control-type.dto.d.ts +0 -1
  75. package/lib/vas-control-type.dto.js +2 -0
  76. package/lib/vas-control-type.dto.js.map +1 -0
  77. package/{cjs/lib/entity → lib}/vas-control-type.model.d.ts +0 -1
  78. package/lib/vas-control-type.model.js +53 -0
  79. package/lib/vas-control-type.model.js.map +1 -0
  80. package/{cjs/lib/entity → lib}/vas-control.dto.d.ts +0 -1
  81. package/lib/vas-control.dto.js +2 -0
  82. package/lib/vas-control.dto.js.map +1 -0
  83. package/{cjs/lib/entity → lib}/vas-control.model.d.ts +1 -9
  84. package/lib/vas-control.model.js +132 -0
  85. package/lib/vas-control.model.js.map +1 -0
  86. package/lib/vas-field.dto.d.ts +8 -0
  87. package/lib/vas-field.dto.js +2 -0
  88. package/lib/vas-field.dto.js.map +1 -0
  89. package/{cjs/lib/entity → lib}/vas-file.dto.d.ts +0 -1
  90. package/lib/vas-file.dto.js +2 -0
  91. package/lib/vas-file.dto.js.map +1 -0
  92. package/{cjs/lib/entity → lib}/vas-form.dto.d.ts +0 -1
  93. package/lib/vas-form.dto.js +2 -0
  94. package/lib/vas-form.dto.js.map +1 -0
  95. package/{cjs/lib/entity → lib}/vas-form.model.d.ts +0 -1
  96. package/lib/vas-form.model.js +144 -0
  97. package/lib/vas-form.model.js.map +1 -0
  98. package/{cjs/lib/entity → lib}/vas-group.dto.d.ts +1 -2
  99. package/lib/vas-group.dto.js +2 -0
  100. package/lib/vas-group.dto.js.map +1 -0
  101. package/{cjs/lib/entity → lib}/vas-group.model.d.ts +3 -4
  102. package/lib/vas-group.model.js +105 -0
  103. package/lib/vas-group.model.js.map +1 -0
  104. package/{cjs/lib/entity → lib}/vas-job-data.dto.d.ts +0 -1
  105. package/lib/vas-job-data.dto.js +2 -0
  106. package/lib/vas-job-data.dto.js.map +1 -0
  107. package/{cjs/lib/entity → lib}/vas-job.dto.d.ts +0 -1
  108. package/lib/vas-job.dto.js +2 -0
  109. package/lib/vas-job.dto.js.map +1 -0
  110. package/{cjs/lib/entity → lib}/vas-job.model.d.ts +7 -29
  111. package/lib/vas-job.model.js +170 -0
  112. package/lib/vas-job.model.js.map +1 -0
  113. package/lib/vas-job.model.spec.d.ts +1 -0
  114. package/lib/vas-job.model.spec.js +18 -0
  115. package/{cjs/lib/entity → lib}/vas-report-layout.dto.d.ts +0 -1
  116. package/lib/vas-report-layout.dto.js +2 -0
  117. package/lib/vas-report-layout.dto.js.map +1 -0
  118. package/{cjs/lib/entity → lib}/vas-restricted-account-object.dto.d.ts +0 -1
  119. package/lib/vas-restricted-account-object.dto.js +2 -0
  120. package/lib/vas-restricted-account-object.dto.js.map +1 -0
  121. package/{cjs/lib/entity → lib}/vas-user.dto.d.ts +0 -1
  122. package/lib/vas-user.dto.js +2 -0
  123. package/lib/vas-user.dto.js.map +1 -0
  124. package/{cjs/lib/entity → lib}/vas-user.model.d.ts +2 -3
  125. package/lib/vas-user.model.js +46 -0
  126. package/lib/vas-user.model.js.map +1 -0
  127. package/package.json +26 -29
  128. package/README.md +0 -24
  129. package/cjs/lib/control-value/index.d.ts +0 -2
  130. package/cjs/lib/control-value/index.d.ts.map +0 -1
  131. package/cjs/lib/control-value/index.js +0 -5
  132. package/cjs/lib/control-value/index.js.map +0 -1
  133. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts +0 -7
  134. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +0 -1
  135. package/cjs/lib/control-value/vas-camera-control-value.model.js +0 -3
  136. package/cjs/lib/control-value/vas-camera-control-value.model.js.map +0 -1
  137. package/cjs/lib/controls-config/index.d.ts +0 -4
  138. package/cjs/lib/controls-config/index.d.ts.map +0 -1
  139. package/cjs/lib/controls-config/index.js +0 -7
  140. package/cjs/lib/controls-config/index.js.map +0 -1
  141. package/cjs/lib/controls-config/vas-control-config-direction.enum.d.ts +0 -5
  142. package/cjs/lib/controls-config/vas-control-config-direction.enum.d.ts.map +0 -1
  143. package/cjs/lib/controls-config/vas-control-config-direction.enum.js +0 -11
  144. package/cjs/lib/controls-config/vas-control-config-direction.enum.js.map +0 -1
  145. package/cjs/lib/controls-config/vas-control-config.model.d.ts +0 -8
  146. package/cjs/lib/controls-config/vas-control-config.model.d.ts.map +0 -1
  147. package/cjs/lib/controls-config/vas-control-config.model.js +0 -3
  148. package/cjs/lib/controls-config/vas-control-config.model.js.map +0 -1
  149. package/cjs/lib/controls-config/vas-select-control-config.model.d.ts +0 -10
  150. package/cjs/lib/controls-config/vas-select-control-config.model.d.ts.map +0 -1
  151. package/cjs/lib/controls-config/vas-select-control-config.model.js +0 -3
  152. package/cjs/lib/controls-config/vas-select-control-config.model.js.map +0 -1
  153. package/cjs/lib/entity/index.d.ts +0 -23
  154. package/cjs/lib/entity/index.d.ts.map +0 -1
  155. package/cjs/lib/entity/index.js +0 -26
  156. package/cjs/lib/entity/index.js.map +0 -1
  157. package/cjs/lib/entity/vas-account-object.dto.d.ts.map +0 -1
  158. package/cjs/lib/entity/vas-account-object.dto.js +0 -3
  159. package/cjs/lib/entity/vas-account-object.dto.js.map +0 -1
  160. package/cjs/lib/entity/vas-base.dto.d.ts.map +0 -1
  161. package/cjs/lib/entity/vas-base.dto.js +0 -3
  162. package/cjs/lib/entity/vas-base.dto.js.map +0 -1
  163. package/cjs/lib/entity/vas-base.model.d.ts.map +0 -1
  164. package/cjs/lib/entity/vas-base.model.js.map +0 -1
  165. package/cjs/lib/entity/vas-control-type.dto.d.ts.map +0 -1
  166. package/cjs/lib/entity/vas-control-type.dto.js +0 -3
  167. package/cjs/lib/entity/vas-control-type.dto.js.map +0 -1
  168. package/cjs/lib/entity/vas-control-type.model.d.ts.map +0 -1
  169. package/cjs/lib/entity/vas-control-type.model.js.map +0 -1
  170. package/cjs/lib/entity/vas-control.dto.d.ts.map +0 -1
  171. package/cjs/lib/entity/vas-control.dto.js +0 -3
  172. package/cjs/lib/entity/vas-control.dto.js.map +0 -1
  173. package/cjs/lib/entity/vas-control.model.d.ts.map +0 -1
  174. package/cjs/lib/entity/vas-control.model.js.map +0 -1
  175. package/cjs/lib/entity/vas-field.dto.d.ts +0 -10
  176. package/cjs/lib/entity/vas-field.dto.d.ts.map +0 -1
  177. package/cjs/lib/entity/vas-field.dto.js +0 -3
  178. package/cjs/lib/entity/vas-field.dto.js.map +0 -1
  179. package/cjs/lib/entity/vas-file.dto.d.ts.map +0 -1
  180. package/cjs/lib/entity/vas-file.dto.js +0 -3
  181. package/cjs/lib/entity/vas-file.dto.js.map +0 -1
  182. package/cjs/lib/entity/vas-form.dto.d.ts.map +0 -1
  183. package/cjs/lib/entity/vas-form.dto.js +0 -3
  184. package/cjs/lib/entity/vas-form.dto.js.map +0 -1
  185. package/cjs/lib/entity/vas-form.model.d.ts.map +0 -1
  186. package/cjs/lib/entity/vas-form.model.js.map +0 -1
  187. package/cjs/lib/entity/vas-group.dto.d.ts.map +0 -1
  188. package/cjs/lib/entity/vas-group.dto.js +0 -3
  189. package/cjs/lib/entity/vas-group.dto.js.map +0 -1
  190. package/cjs/lib/entity/vas-group.model.d.ts.map +0 -1
  191. package/cjs/lib/entity/vas-group.model.js.map +0 -1
  192. package/cjs/lib/entity/vas-job-data.dto.d.ts.map +0 -1
  193. package/cjs/lib/entity/vas-job-data.dto.js +0 -3
  194. package/cjs/lib/entity/vas-job-data.dto.js.map +0 -1
  195. package/cjs/lib/entity/vas-job.dto.d.ts.map +0 -1
  196. package/cjs/lib/entity/vas-job.dto.js +0 -3
  197. package/cjs/lib/entity/vas-job.dto.js.map +0 -1
  198. package/cjs/lib/entity/vas-job.model.d.ts.map +0 -1
  199. package/cjs/lib/entity/vas-job.model.js.map +0 -1
  200. package/cjs/lib/entity/vas-job.model.spec-data.d.ts +0 -3
  201. package/cjs/lib/entity/vas-job.model.spec-data.d.ts.map +0 -1
  202. package/cjs/lib/entity/vas-job.model.spec-data.js +0 -63
  203. package/cjs/lib/entity/vas-job.model.spec-data.js.map +0 -1
  204. package/cjs/lib/entity/vas-report-layout.dto.d.ts.map +0 -1
  205. package/cjs/lib/entity/vas-report-layout.dto.js +0 -3
  206. package/cjs/lib/entity/vas-report-layout.dto.js.map +0 -1
  207. package/cjs/lib/entity/vas-report-request.dto.d.ts.map +0 -1
  208. package/cjs/lib/entity/vas-report-request.dto.js +0 -3
  209. package/cjs/lib/entity/vas-report-request.dto.js.map +0 -1
  210. package/cjs/lib/entity/vas-report-request.model.d.ts +0 -19
  211. package/cjs/lib/entity/vas-report-request.model.d.ts.map +0 -1
  212. package/cjs/lib/entity/vas-report-request.model.js +0 -42
  213. package/cjs/lib/entity/vas-report-request.model.js.map +0 -1
  214. package/cjs/lib/entity/vas-restricted-account-object.dto.d.ts.map +0 -1
  215. package/cjs/lib/entity/vas-restricted-account-object.dto.js +0 -3
  216. package/cjs/lib/entity/vas-restricted-account-object.dto.js.map +0 -1
  217. package/cjs/lib/entity/vas-user.dto.d.ts.map +0 -1
  218. package/cjs/lib/entity/vas-user.dto.js +0 -3
  219. package/cjs/lib/entity/vas-user.dto.js.map +0 -1
  220. package/cjs/lib/entity/vas-user.model.d.ts.map +0 -1
  221. package/cjs/lib/entity/vas-user.model.js.map +0 -1
  222. package/cjs/lib/utils/find-form-control.d.ts.map +0 -1
  223. package/cjs/lib/utils/find-form-control.js +0 -25
  224. package/cjs/lib/utils/find-form-control.js.map +0 -1
  225. package/cjs/package.json +0 -47
  226. package/cjs/public-api.d.ts +0 -4
  227. package/cjs/public-api.d.ts.map +0 -1
  228. package/cjs/public-api.js +0 -7
  229. package/cjs/public-api.js.map +0 -1
  230. package/esm2020/ironcode-vas-lib.mjs +0 -5
  231. package/esm2020/lib/control-value/index.mjs +0 -2
  232. package/esm2020/lib/control-value/vas-camera-control-value.model.mjs +0 -2
  233. package/esm2020/lib/controls-config/index.mjs +0 -4
  234. package/esm2020/lib/controls-config/vas-control-config-direction.enum.mjs +0 -8
  235. package/esm2020/lib/controls-config/vas-control-config.model.mjs +0 -2
  236. package/esm2020/lib/controls-config/vas-select-control-config.model.mjs +0 -2
  237. package/esm2020/lib/entity/index.mjs +0 -23
  238. package/esm2020/lib/entity/vas-account-object.dto.mjs +0 -2
  239. package/esm2020/lib/entity/vas-base.dto.mjs +0 -2
  240. package/esm2020/lib/entity/vas-base.model.mjs +0 -24
  241. package/esm2020/lib/entity/vas-control-type.dto.mjs +0 -2
  242. package/esm2020/lib/entity/vas-control-type.model.mjs +0 -53
  243. package/esm2020/lib/entity/vas-control.dto.mjs +0 -2
  244. package/esm2020/lib/entity/vas-control.model.mjs +0 -141
  245. package/esm2020/lib/entity/vas-field.dto.mjs +0 -2
  246. package/esm2020/lib/entity/vas-file.dto.mjs +0 -2
  247. package/esm2020/lib/entity/vas-form.dto.mjs +0 -2
  248. package/esm2020/lib/entity/vas-form.model.mjs +0 -143
  249. package/esm2020/lib/entity/vas-group.dto.mjs +0 -2
  250. package/esm2020/lib/entity/vas-group.model.mjs +0 -105
  251. package/esm2020/lib/entity/vas-job-data.dto.mjs +0 -2
  252. package/esm2020/lib/entity/vas-job.dto.mjs +0 -2
  253. package/esm2020/lib/entity/vas-job.model.mjs +0 -205
  254. package/esm2020/lib/entity/vas-report-layout.dto.mjs +0 -2
  255. package/esm2020/lib/entity/vas-report-request.dto.mjs +0 -2
  256. package/esm2020/lib/entity/vas-report-request.model.mjs +0 -38
  257. package/esm2020/lib/entity/vas-restricted-account-object.dto.mjs +0 -2
  258. package/esm2020/lib/entity/vas-user.dto.mjs +0 -2
  259. package/esm2020/lib/entity/vas-user.model.mjs +0 -46
  260. package/esm2020/public-api.mjs +0 -4
  261. package/fesm2015/ironcode-vas-lib.mjs +0 -756
  262. package/fesm2015/ironcode-vas-lib.mjs.map +0 -1
  263. package/fesm2020/ironcode-vas-lib.mjs +0 -755
  264. package/fesm2020/ironcode-vas-lib.mjs.map +0 -1
  265. package/ironcode-vas-lib.d.ts +0 -5
  266. package/lib/control-value/index.d.ts +0 -1
  267. package/lib/control-value/vas-camera-control-value.model.d.ts +0 -6
  268. package/lib/controls-config/index.d.ts +0 -3
  269. package/lib/controls-config/vas-control-config-direction.enum.d.ts +0 -4
  270. package/lib/controls-config/vas-control-config.model.d.ts +0 -7
  271. package/lib/controls-config/vas-select-control-config.model.d.ts +0 -9
  272. package/lib/entity/index.d.ts +0 -22
  273. package/lib/entity/vas-report-request.model.d.ts +0 -18
  274. package/public-api.d.ts +0 -3
@@ -1,755 +0,0 @@
1
- import { UUID } from 'angular2-uuid';
2
- import * as moment_ from 'moment';
3
-
4
- var VasControlConfigDirection;
5
- (function (VasControlConfigDirection) {
6
- // eslint-disable-next-line @typescript-eslint/naming-convention
7
- VasControlConfigDirection[VasControlConfigDirection["ROW"] = 0] = "ROW";
8
- // eslint-disable-next-line @typescript-eslint/naming-convention
9
- VasControlConfigDirection[VasControlConfigDirection["COLUMN"] = 1] = "COLUMN";
10
- })(VasControlConfigDirection || (VasControlConfigDirection = {}));
11
-
12
- /**
13
- * BaseEntityModel
14
- */
15
- class VasBaseModel {
16
- /**
17
- * @param {string} id
18
- * @param {string} created
19
- * @param {string} serverCreated
20
- * @param {string} createdBy
21
- * @param {string} modified
22
- * @param {string} serverModified
23
- * @param {string} modifiedBy
24
- */
25
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy) {
26
- this.id = id;
27
- this.created = created;
28
- this.serverCreated = serverCreated;
29
- this.createdBy = createdBy;
30
- this.modified = modified;
31
- this.serverModified = serverModified;
32
- this.modifiedBy = modifiedBy;
33
- }
34
- }
35
-
36
- /**
37
- * ControlModel
38
- */
39
- class VasControlModel extends VasBaseModel {
40
- /**
41
- * @param {string} id
42
- * @param {string} created
43
- * @param {string} serverCreated
44
- * @param {string} createdBy
45
- * @param {string} modified
46
- * @param {string} serverModified
47
- * @param {string} modifiedBy
48
- * @param {string} account
49
- * @param {string} accessGroup
50
- * @param {string} controlType
51
- * @param {string} group
52
- * @param {string[]} validators
53
- * @param {string} name
54
- * @param {string} title
55
- * @param {boolean} linkable
56
- * @param {number} sequence
57
- * @param {string} description
58
- * @param {string} defaultValue
59
- * @param {object} config
60
- */
61
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, controlType, group, validators, name, title, linkable, sequence, description, defaultValue, config) {
62
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
63
- this.id = id;
64
- this.created = created;
65
- this.serverCreated = serverCreated;
66
- this.createdBy = createdBy;
67
- this.modified = modified;
68
- this.serverModified = serverModified;
69
- this.modifiedBy = modifiedBy;
70
- this.account = account;
71
- this.accessGroup = accessGroup;
72
- this.controlType = controlType;
73
- this.group = group;
74
- this.validators = validators;
75
- this.name = name;
76
- this.title = title;
77
- this.linkable = linkable;
78
- this.sequence = sequence;
79
- this.description = description;
80
- this.defaultValue = defaultValue;
81
- this.config = config;
82
- this.controlTypeModel = undefined;
83
- }
84
- /**
85
- * The config property is returned from the api as a json string, this getter
86
- * will deserialize it
87
- * @return {T}
88
- */
89
- getConfigModel() {
90
- return JSON.parse(this.config);
91
- }
92
- /**
93
- * The defaultValue property is returned from the api as a string or number,
94
- * in the case of string, it maybe a json. This getter will return an
95
- * object if the value is a json string
96
- */
97
- get defaultValueDecoded() {
98
- return this.parseMaybeJson(this.defaultValue);
99
- }
100
- /**
101
- * Returns the name of this control to be used in the report templates
102
- * i.e. field.foo -> foo
103
- * @return {string}
104
- */
105
- get reportTemplateName() {
106
- return this.name.replace(/^fields\./, '');
107
- }
108
- /**
109
- * @return {string}
110
- */
111
- get safeName() {
112
- return this.name;
113
- }
114
- /**
115
- * @return {VasControlModel}
116
- */
117
- static empty() {
118
- return VasControlModel.fromDto({
119
- // eslint-disable-next-line new-cap
120
- id: UUID.UUID()
121
- });
122
- }
123
- /**
124
- * @param {VasControlDto} dto
125
- * @return {VasControlModel}
126
- */
127
- static fromDto(dto) {
128
- return new VasControlModel(
129
- // eslint-disable-next-line new-cap
130
- dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.account || '', dto.accessGroup || '', dto.controlType || '', dto.group || '', dto.validators || [], dto.name || '', dto.title || '', dto.linkable || false, dto.sequence || 0, dto.description || '', dto.defaultValue || '', dto.config || '{}');
131
- }
132
- /**
133
- * @param {string} value
134
- * @return {VasControlModelDefaultValueType}
135
- */
136
- parseMaybeJson(value) {
137
- if (typeof value !== 'string') {
138
- return value;
139
- }
140
- try {
141
- return JSON.parse(value);
142
- }
143
- catch (e) {
144
- return value;
145
- }
146
- }
147
- /**
148
- * @return {VasControlDto}
149
- */
150
- toDto() {
151
- return {
152
- id: this.id,
153
- created: this.created,
154
- serverCreated: this.serverCreated,
155
- createdBy: this.createdBy,
156
- modified: this.modified,
157
- serverModified: this.serverModified,
158
- modifiedBy: this.modifiedBy,
159
- account: this.account,
160
- accessGroup: this.accessGroup,
161
- controlType: this.controlType,
162
- group: this.group,
163
- validators: this.validators,
164
- name: this.name,
165
- title: this.title,
166
- linkable: this.linkable,
167
- sequence: this.sequence,
168
- description: this.description,
169
- defaultValue: this.defaultValue,
170
- config: this.config
171
- };
172
- }
173
- }
174
-
175
- /**
176
- * VasControlTypeModel
177
- */
178
- class VasControlTypeModel extends VasBaseModel {
179
- /**
180
- * @param {string} id
181
- * @param {string} created
182
- * @param {string} serverCreated
183
- * @param {string} createdBy
184
- * @param {string} modified
185
- * @param {string} serverModified
186
- * @param {string} modifiedBy
187
- * @param {string} name
188
- */
189
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, name) {
190
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
191
- this.id = id;
192
- this.created = created;
193
- this.serverCreated = serverCreated;
194
- this.createdBy = createdBy;
195
- this.modified = modified;
196
- this.serverModified = serverModified;
197
- this.modifiedBy = modifiedBy;
198
- this.name = name;
199
- }
200
- /**
201
- * @param {VasControlTypeDto} dto
202
- * @return {VasControlTypeModel}
203
- */
204
- static fromDto(dto) {
205
- return new VasControlTypeModel(
206
- // eslint-disable-next-line new-cap
207
- dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.name || '');
208
- }
209
- /**
210
- * @return {VasControlTypeDto}
211
- */
212
- toDto() {
213
- return {
214
- id: this.id,
215
- created: this.created,
216
- serverCreated: this.serverCreated,
217
- createdBy: this.createdBy,
218
- modified: this.modified,
219
- serverModified: this.serverModified,
220
- modifiedBy: this.modifiedBy,
221
- name: this.name
222
- };
223
- }
224
- }
225
-
226
- /**
227
- * GroupModel
228
- */
229
- class VasGroupModel extends VasBaseModel {
230
- /**
231
- * @param {string} id
232
- * @param {string} created
233
- * @param {string} serverCreated
234
- * @param {string} createdBy
235
- * @param {string} modified
236
- * @param {string} serverModified
237
- * @param {string} modifiedBy
238
- * @param {string} account
239
- * @param {string} accessGroup
240
- * @param {string} name
241
- * @param {string} title
242
- * @param {string} description
243
- * @param {number} sequence
244
- * @param {boolean} includeInSummary
245
- * @param {string[]} forms
246
- * @param {string} visibilityControl
247
- * @param {string} visibleIfEquals
248
- * @param {VasControlModel[]} controls
249
- * @param {number} scoreWeight
250
- */
251
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, name, title, description, sequence, includeInSummary, forms, visibilityControl, visibleIfEquals, controls, scoreWeight) {
252
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
253
- this.id = id;
254
- this.created = created;
255
- this.serverCreated = serverCreated;
256
- this.createdBy = createdBy;
257
- this.modified = modified;
258
- this.serverModified = serverModified;
259
- this.modifiedBy = modifiedBy;
260
- this.account = account;
261
- this.accessGroup = accessGroup;
262
- this.name = name;
263
- this.title = title;
264
- this.description = description;
265
- this.sequence = sequence;
266
- this.includeInSummary = includeInSummary;
267
- this.forms = forms;
268
- this.visibilityControl = visibilityControl;
269
- this.visibleIfEquals = visibleIfEquals;
270
- this.controls = controls;
271
- this.scoreWeight = scoreWeight;
272
- }
273
- /**
274
- * @param {VasGroupDto} dto
275
- * @return {VasGroupModel}
276
- */
277
- static fromDto(dto) {
278
- return new VasGroupModel(
279
- // eslint-disable-next-line new-cap
280
- dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.account || '', dto.accessGroup || '', dto.name || '', dto.title || '', dto.description || '', dto.sequence || 0, dto.includeInSummary || false, dto.forms || [], dto.visibilityControl || '', dto.visibleIfEquals || '', (dto.controls || [])
281
- .sort((a, b) => a.sequence - b.sequence)
282
- .map(c => VasControlModel.fromDto(c)), dto.scoreWeight || 1);
283
- }
284
- /**
285
- * @param {Array<VasControlModel>} valuesByControlId
286
- * @return {boolean}
287
- */
288
- isVisible(valuesByControlId) {
289
- if (!this.visibilityControl || !this.visibleIfEquals) {
290
- return true;
291
- }
292
- const control = valuesByControlId
293
- .find(c => c.id === this.visibilityControl);
294
- if (!control) {
295
- console.warn(`control with id ${this.visibilityControl} not found`);
296
- return true;
297
- }
298
- return (control.value || '').toString() === this.visibleIfEquals;
299
- }
300
- /**
301
- * @return {VasGroupDto}
302
- */
303
- toDto() {
304
- return {
305
- id: this.id,
306
- created: this.created,
307
- serverCreated: this.serverCreated,
308
- createdBy: this.createdBy,
309
- modified: this.modified,
310
- serverModified: this.serverModified,
311
- modifiedBy: this.modifiedBy,
312
- account: this.account,
313
- accessGroup: this.accessGroup,
314
- name: this.name,
315
- title: this.title,
316
- description: this.description,
317
- sequence: this.sequence,
318
- includeInSummary: this.includeInSummary,
319
- forms: this.forms,
320
- visibilityControl: this.visibilityControl,
321
- visibleIfEquals: this.visibleIfEquals,
322
- controls: this.controls.map(control => control.toDto()),
323
- scoreWeight: this.scoreWeight
324
- };
325
- }
326
- }
327
-
328
- /**
329
- * VasFormModel
330
- */
331
- class VasFormModel extends VasBaseModel {
332
- /**
333
- * @param {string} id
334
- * @param {string} created
335
- * @param {string} serverCreated
336
- * @param {string} createdBy
337
- * @param {string} modified
338
- * @param {string} serverModified
339
- * @param {string} modifiedBy
340
- * @param {string} account
341
- * @param {string} accessGroup
342
- * @param {string} jobType
343
- * @param {string} title
344
- * @param {string} description
345
- * @param {VasGroupModel[]} groups
346
- */
347
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, jobType, title, description, groups) {
348
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
349
- this.id = id;
350
- this.created = created;
351
- this.serverCreated = serverCreated;
352
- this.createdBy = createdBy;
353
- this.modified = modified;
354
- this.serverModified = serverModified;
355
- this.modifiedBy = modifiedBy;
356
- this.account = account;
357
- this.accessGroup = accessGroup;
358
- this.jobType = jobType;
359
- this.title = title;
360
- this.description = description;
361
- this.groups = groups;
362
- }
363
- /**
364
- * The VAS API response for Form will inline Group and Control but not
365
- * ControlType. This method is a help which will allows us to construct an
366
- * instance of VasFormModel with the ControlType model set appropriately into
367
- * each VasControlModel
368
- * @param {VasFormDto} formDto
369
- * @param {Array<VasControlTypeDto>} controlTypeDtos
370
- * @return {VasFormModel}
371
- */
372
- static fromApiResponse(formDto, controlTypeDtos) {
373
- const controlTypeModels = controlTypeDtos
374
- .map(ctDto => VasControlTypeModel.fromDto(ctDto));
375
- const formModel = VasFormModel.fromDto(formDto);
376
- formModel.groups
377
- .forEach(group => {
378
- group.controls
379
- .forEach(control => {
380
- control.controlTypeModel = controlTypeModels
381
- .find(ct => ct.id === control.controlType);
382
- });
383
- });
384
- return formModel;
385
- }
386
- /**
387
- * @param {VasFormDto} dto
388
- * @return {VasFormModel}
389
- */
390
- static fromDto(dto) {
391
- return new VasFormModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.account || '', dto.accessGroup || '', dto.jobType || '', dto.title || '', dto.description || '', (dto.groups || [])
392
- .sort((a, b) => a.sequence - b.sequence)
393
- .map(g => VasGroupModel.fromDto(g)));
394
- }
395
- /**
396
- * @param {string} id
397
- * @return {VasControlModel | undefined}
398
- */
399
- findControlModelById(id) {
400
- let result;
401
- this.groups
402
- .find(group => group.controls
403
- .find(control => {
404
- if (control.id !== id) {
405
- return;
406
- }
407
- result = control;
408
- return true;
409
- }));
410
- return result;
411
- }
412
- /**
413
- *
414
- * @return {Array<Array<string>>}
415
- */
416
- getCameraControlPaths() {
417
- const paths = [];
418
- this.groups.forEach(group => {
419
- group.controls.forEach(control => {
420
- if (control.controlTypeModel?.name !== 'camera') {
421
- return;
422
- }
423
- paths.push([group.name, control.safeName]);
424
- });
425
- });
426
- return paths;
427
- }
428
- /**
429
- * @param {VasJobModel} jobModel
430
- * @return {Array<{id: string, value: VasFieldDtoValue}>}
431
- */
432
- getValuesByControlId(jobModel) {
433
- const items = [];
434
- this.groups
435
- .forEach(group => {
436
- group.controls
437
- .forEach(control => {
438
- items.push({
439
- id: control.id,
440
- value: jobModel.getValueByPath([group.name, control.safeName])
441
- });
442
- });
443
- });
444
- return items;
445
- }
446
- /**
447
- * @return {VasFormDto}
448
- */
449
- toDto() {
450
- return {
451
- id: this.id,
452
- created: this.created,
453
- serverCreated: this.serverCreated,
454
- createdBy: this.createdBy,
455
- modified: this.modified,
456
- serverModified: this.serverModified,
457
- modifiedBy: this.modifiedBy,
458
- account: this.account,
459
- accessGroup: this.accessGroup,
460
- jobType: this.jobType,
461
- title: this.title,
462
- description: this.description,
463
- groups: this.groups.map(group => group.toDto()),
464
- };
465
- }
466
- }
467
-
468
- /**
469
- * JobModel
470
- */
471
- class VasJobModel extends VasBaseModel {
472
- /**
473
- * @param {string} id
474
- * @param {string} created
475
- * @param {string} serverCreated
476
- * @param {string} createdBy
477
- * @param {string} modified
478
- * @param {string} serverModified
479
- * @param {string} modifiedBy
480
- * @param {string} account
481
- * @param {string} accessGroup
482
- * @param {string} reference
483
- * @param {string} jobDate
484
- * @param {string} jobStatus
485
- * @param {string} jobType
486
- * @param {string} assignee
487
- * @param {string} formId
488
- */
489
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, reference, jobDate, jobStatus, jobType, assignee, formId) {
490
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
491
- this.id = id;
492
- this.created = created;
493
- this.serverCreated = serverCreated;
494
- this.createdBy = createdBy;
495
- this.modified = modified;
496
- this.serverModified = serverModified;
497
- this.modifiedBy = modifiedBy;
498
- this.account = account;
499
- this.accessGroup = accessGroup;
500
- this.reference = reference;
501
- this.jobDate = jobDate;
502
- this.jobStatus = jobStatus;
503
- this.jobType = jobType;
504
- this.assignee = assignee;
505
- this.formId = formId;
506
- }
507
- /**
508
- * Returns this with the dynamic interface
509
- * @return {VasJobModelDynamicInterface}
510
- */
511
- get $this() {
512
- // eslint-disable-next-line @typescript-eslint/no-this-alias
513
- const $this = this;
514
- return this;
515
- }
516
- /**
517
- * Returns a list of Job dynamic properties i.e. those that are added by the
518
- * dynamic forms
519
- */
520
- get dynamicProperties() {
521
- const nativeProps = this.staticProperties;
522
- return Object
523
- .getOwnPropertyNames(this)
524
- .filter(prop => !nativeProps.includes(prop));
525
- }
526
- /**
527
- * Returns a list of Job static properties i.e. those that are declared by
528
- * the type
529
- */
530
- get staticProperties() {
531
- return Object.getOwnPropertyNames(VasJobModel.empty());
532
- }
533
- /**
534
- * @return {VasJobModel}
535
- */
536
- static empty() {
537
- return new VasJobModel(
538
- // eslint-disable-next-line new-cap
539
- UUID.UUID(), '', '', '', '', '', '', '', '', '', '', '', '', '', '');
540
- }
541
- /**
542
- * @param {VasJobDto} jobDto
543
- * @return {VasJobModel}
544
- */
545
- static fromDto(jobDto) {
546
- const model = new VasJobModel(
547
- // eslint-disable-next-line new-cap
548
- jobDto.id || UUID.UUID(), jobDto.created || '', jobDto.serverCreated || '', jobDto.createdBy || '', jobDto.modified || '', jobDto.serverModified || '', jobDto.modifiedBy || '', jobDto.account || '', jobDto.accessGroup || '', jobDto.reference || '', jobDto.jobDate || '', jobDto.jobStatus || '', jobDto.jobType || '', jobDto.assignee || '', jobDto.formId || '');
549
- const emptyKeys = model.staticProperties;
550
- Object
551
- .keys(jobDto)
552
- .filter(key => emptyKeys.indexOf(key) === -1)
553
- .forEach((key) => model.$this[key] = jobDto[key]);
554
- return model;
555
- }
556
- /**
557
- * @param {VasFormModel} formModel
558
- * @return {Record<string, VasFieldDtoValue>}
559
- */
560
- getFields(formModel) {
561
- const fields = {};
562
- formModel.groups
563
- .forEach(group => {
564
- group.controls.forEach(control => {
565
- (fields)[control.reportTemplateName] =
566
- this.getValueByPath([group.name, control.name]);
567
- });
568
- });
569
- return fields;
570
- }
571
- /**
572
- * A very non sophisticated way to get values from the job via paths
573
- *
574
- * For example:
575
- *
576
- * getValueByPath(['foo', 'bar']);
577
- *
578
- * if job is
579
- * {
580
- * foo: {
581
- * bar: 'value'
582
- * }
583
- * }
584
- *
585
- * will return "value"
586
- *
587
- * @param {string[]} path path segments
588
- * @return {void}
589
- */
590
- getValueByPath(path = []) {
591
- switch (path.length) {
592
- case 0: {
593
- return;
594
- }
595
- case 1: {
596
- return (this.$this)[path[0]];
597
- }
598
- case 2: {
599
- const val0 = this.$this[path[0]];
600
- return val0[path[1]];
601
- }
602
- case 3: {
603
- const val0 = this.$this[path[0]];
604
- const val1 = val0[path[1]];
605
- return val1[path[2]];
606
- }
607
- default: {
608
- throw Error('path has too many segments');
609
- }
610
- }
611
- }
612
- /**
613
- * A very non sophisticated way to set values in the job via paths
614
- *
615
- * For example:
616
- *
617
- * setValueByPath('value', ['foo', 'bar']);
618
- *
619
- * will make results in job
620
- * {
621
- * foo: {
622
- * bar: 'value'
623
- * }
624
- * }
625
- *
626
- * @param {any} value the value to set
627
- * @param {string[]} path path segments
628
- */
629
- setValueByPath(value, path = []) {
630
- switch (path.length) {
631
- case 0: {
632
- return;
633
- }
634
- case 1: {
635
- (this.$this)[path[0]] = value;
636
- return;
637
- }
638
- case 2: {
639
- // eslint-disable-next-line max-len
640
- this.$this[path[0]][path[1]] = value;
641
- return;
642
- }
643
- case 3: {
644
- // eslint-disable-next-line max-len
645
- this.$this[path[0]][path[1]][path[2]] = value;
646
- return;
647
- }
648
- default: {
649
- throw Error('path has too many segments');
650
- }
651
- }
652
- }
653
- /**
654
- * @param {boolean} staticOnly if true, will only output values for the static
655
- * properties in the dto
656
- * @return {VasJobDto}
657
- */
658
- toDto(staticOnly = false) {
659
- const dto = {};
660
- this.staticProperties
661
- .forEach(prop => (dto)[prop] = this.$this[prop]);
662
- if (staticOnly) {
663
- return dto;
664
- }
665
- this.dynamicProperties
666
- .forEach(prop => dto[prop] = this.$this[prop]);
667
- return dto;
668
- }
669
- }
670
-
671
- class VasReportRequestModel extends VasBaseModel {
672
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, error, jobId, title, url) {
673
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
674
- this.id = id;
675
- this.created = created;
676
- this.serverCreated = serverCreated;
677
- this.createdBy = createdBy;
678
- this.modified = modified;
679
- this.serverModified = serverModified;
680
- this.modifiedBy = modifiedBy;
681
- this.error = error;
682
- this.jobId = jobId;
683
- this.title = title;
684
- this.url = url;
685
- }
686
- static fromDto(dto) {
687
- return new VasReportRequestModel(dto.id || UUID.UUID(), dto.created || moment_().toISOString(), dto.serverCreated || '', dto.createdBy || '', dto.modified || moment_().toISOString(), dto.serverModified || '', dto.modifiedBy || '', dto.error || '', dto.jobId || '', dto.title || '', dto.url || '');
688
- }
689
- toDto() {
690
- return {
691
- id: this.id,
692
- created: this.created,
693
- serverCreated: this.serverCreated,
694
- createdBy: this.createdBy,
695
- modified: this.modified,
696
- serverModified: this.serverModified,
697
- modifiedBy: this.modifiedBy,
698
- error: this.error,
699
- jobId: this.jobId,
700
- title: this.title,
701
- url: this.url
702
- };
703
- }
704
- }
705
-
706
- class VasUserModel extends VasBaseModel {
707
- constructor(id, created = '', serverCreated = '', createdBy = '', modified = '', serverModified = '', modifiedBy = '', email, username) {
708
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
709
- this.id = id;
710
- this.created = created;
711
- this.serverCreated = serverCreated;
712
- this.createdBy = createdBy;
713
- this.modified = modified;
714
- this.serverModified = serverModified;
715
- this.modifiedBy = modifiedBy;
716
- this.email = email;
717
- this.username = username;
718
- }
719
- static fromDto(dto) {
720
- return new VasUserModel(dto.id, dto.created, dto.serverCreated, dto.createdBy, dto.modified, dto.serverModified, dto.modifiedBy, dto.email, dto.username);
721
- }
722
- static newUser(uid, displayName, email) {
723
- return {
724
- id: uid,
725
- created: moment_().toISOString(),
726
- createdBy: uid,
727
- modified: moment_().toISOString(),
728
- modifiedBy: uid,
729
- serverCreated: moment_().toISOString(),
730
- serverModified: moment_().toISOString(),
731
- email: email,
732
- username: displayName,
733
- };
734
- }
735
- toDto() {
736
- return {
737
- id: this.id,
738
- created: this.created,
739
- serverCreated: this.serverCreated,
740
- createdBy: this.createdBy,
741
- modified: this.modified,
742
- serverModified: this.serverModified,
743
- modifiedBy: this.modifiedBy,
744
- email: this.email,
745
- username: this.username
746
- };
747
- }
748
- }
749
-
750
- /**
751
- * Generated bundle index. Do not edit.
752
- */
753
-
754
- export { VasBaseModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFormModel, VasGroupModel, VasJobModel, VasReportRequestModel, VasUserModel };
755
- //# sourceMappingURL=ironcode-vas-lib.mjs.map