@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,756 +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
- var _a;
421
- if (((_a = control.controlTypeModel) === null || _a === void 0 ? void 0 : _a.name) !== 'camera') {
422
- return;
423
- }
424
- paths.push([group.name, control.safeName]);
425
- });
426
- });
427
- return paths;
428
- }
429
- /**
430
- * @param {VasJobModel} jobModel
431
- * @return {Array<{id: string, value: VasFieldDtoValue}>}
432
- */
433
- getValuesByControlId(jobModel) {
434
- const items = [];
435
- this.groups
436
- .forEach(group => {
437
- group.controls
438
- .forEach(control => {
439
- items.push({
440
- id: control.id,
441
- value: jobModel.getValueByPath([group.name, control.safeName])
442
- });
443
- });
444
- });
445
- return items;
446
- }
447
- /**
448
- * @return {VasFormDto}
449
- */
450
- toDto() {
451
- return {
452
- id: this.id,
453
- created: this.created,
454
- serverCreated: this.serverCreated,
455
- createdBy: this.createdBy,
456
- modified: this.modified,
457
- serverModified: this.serverModified,
458
- modifiedBy: this.modifiedBy,
459
- account: this.account,
460
- accessGroup: this.accessGroup,
461
- jobType: this.jobType,
462
- title: this.title,
463
- description: this.description,
464
- groups: this.groups.map(group => group.toDto()),
465
- };
466
- }
467
- }
468
-
469
- /**
470
- * JobModel
471
- */
472
- class VasJobModel extends VasBaseModel {
473
- /**
474
- * @param {string} id
475
- * @param {string} created
476
- * @param {string} serverCreated
477
- * @param {string} createdBy
478
- * @param {string} modified
479
- * @param {string} serverModified
480
- * @param {string} modifiedBy
481
- * @param {string} account
482
- * @param {string} accessGroup
483
- * @param {string} reference
484
- * @param {string} jobDate
485
- * @param {string} jobStatus
486
- * @param {string} jobType
487
- * @param {string} assignee
488
- * @param {string} formId
489
- */
490
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, account, accessGroup, reference, jobDate, jobStatus, jobType, assignee, formId) {
491
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
492
- this.id = id;
493
- this.created = created;
494
- this.serverCreated = serverCreated;
495
- this.createdBy = createdBy;
496
- this.modified = modified;
497
- this.serverModified = serverModified;
498
- this.modifiedBy = modifiedBy;
499
- this.account = account;
500
- this.accessGroup = accessGroup;
501
- this.reference = reference;
502
- this.jobDate = jobDate;
503
- this.jobStatus = jobStatus;
504
- this.jobType = jobType;
505
- this.assignee = assignee;
506
- this.formId = formId;
507
- }
508
- /**
509
- * Returns this with the dynamic interface
510
- * @return {VasJobModelDynamicInterface}
511
- */
512
- get $this() {
513
- // eslint-disable-next-line @typescript-eslint/no-this-alias
514
- const $this = this;
515
- return this;
516
- }
517
- /**
518
- * Returns a list of Job dynamic properties i.e. those that are added by the
519
- * dynamic forms
520
- */
521
- get dynamicProperties() {
522
- const nativeProps = this.staticProperties;
523
- return Object
524
- .getOwnPropertyNames(this)
525
- .filter(prop => !nativeProps.includes(prop));
526
- }
527
- /**
528
- * Returns a list of Job static properties i.e. those that are declared by
529
- * the type
530
- */
531
- get staticProperties() {
532
- return Object.getOwnPropertyNames(VasJobModel.empty());
533
- }
534
- /**
535
- * @return {VasJobModel}
536
- */
537
- static empty() {
538
- return new VasJobModel(
539
- // eslint-disable-next-line new-cap
540
- UUID.UUID(), '', '', '', '', '', '', '', '', '', '', '', '', '', '');
541
- }
542
- /**
543
- * @param {VasJobDto} jobDto
544
- * @return {VasJobModel}
545
- */
546
- static fromDto(jobDto) {
547
- const model = new VasJobModel(
548
- // eslint-disable-next-line new-cap
549
- 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 || '');
550
- const emptyKeys = model.staticProperties;
551
- Object
552
- .keys(jobDto)
553
- .filter(key => emptyKeys.indexOf(key) === -1)
554
- .forEach((key) => model.$this[key] = jobDto[key]);
555
- return model;
556
- }
557
- /**
558
- * @param {VasFormModel} formModel
559
- * @return {Record<string, VasFieldDtoValue>}
560
- */
561
- getFields(formModel) {
562
- const fields = {};
563
- formModel.groups
564
- .forEach(group => {
565
- group.controls.forEach(control => {
566
- (fields)[control.reportTemplateName] =
567
- this.getValueByPath([group.name, control.name]);
568
- });
569
- });
570
- return fields;
571
- }
572
- /**
573
- * A very non sophisticated way to get values from the job via paths
574
- *
575
- * For example:
576
- *
577
- * getValueByPath(['foo', 'bar']);
578
- *
579
- * if job is
580
- * {
581
- * foo: {
582
- * bar: 'value'
583
- * }
584
- * }
585
- *
586
- * will return "value"
587
- *
588
- * @param {string[]} path path segments
589
- * @return {void}
590
- */
591
- getValueByPath(path = []) {
592
- switch (path.length) {
593
- case 0: {
594
- return;
595
- }
596
- case 1: {
597
- return (this.$this)[path[0]];
598
- }
599
- case 2: {
600
- const val0 = this.$this[path[0]];
601
- return val0[path[1]];
602
- }
603
- case 3: {
604
- const val0 = this.$this[path[0]];
605
- const val1 = val0[path[1]];
606
- return val1[path[2]];
607
- }
608
- default: {
609
- throw Error('path has too many segments');
610
- }
611
- }
612
- }
613
- /**
614
- * A very non sophisticated way to set values in the job via paths
615
- *
616
- * For example:
617
- *
618
- * setValueByPath('value', ['foo', 'bar']);
619
- *
620
- * will make results in job
621
- * {
622
- * foo: {
623
- * bar: 'value'
624
- * }
625
- * }
626
- *
627
- * @param {any} value the value to set
628
- * @param {string[]} path path segments
629
- */
630
- setValueByPath(value, path = []) {
631
- switch (path.length) {
632
- case 0: {
633
- return;
634
- }
635
- case 1: {
636
- (this.$this)[path[0]] = value;
637
- return;
638
- }
639
- case 2: {
640
- // eslint-disable-next-line max-len
641
- this.$this[path[0]][path[1]] = value;
642
- return;
643
- }
644
- case 3: {
645
- // eslint-disable-next-line max-len
646
- this.$this[path[0]][path[1]][path[2]] = value;
647
- return;
648
- }
649
- default: {
650
- throw Error('path has too many segments');
651
- }
652
- }
653
- }
654
- /**
655
- * @param {boolean} staticOnly if true, will only output values for the static
656
- * properties in the dto
657
- * @return {VasJobDto}
658
- */
659
- toDto(staticOnly = false) {
660
- const dto = {};
661
- this.staticProperties
662
- .forEach(prop => (dto)[prop] = this.$this[prop]);
663
- if (staticOnly) {
664
- return dto;
665
- }
666
- this.dynamicProperties
667
- .forEach(prop => dto[prop] = this.$this[prop]);
668
- return dto;
669
- }
670
- }
671
-
672
- class VasReportRequestModel extends VasBaseModel {
673
- constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, error, jobId, title, url) {
674
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
675
- this.id = id;
676
- this.created = created;
677
- this.serverCreated = serverCreated;
678
- this.createdBy = createdBy;
679
- this.modified = modified;
680
- this.serverModified = serverModified;
681
- this.modifiedBy = modifiedBy;
682
- this.error = error;
683
- this.jobId = jobId;
684
- this.title = title;
685
- this.url = url;
686
- }
687
- static fromDto(dto) {
688
- 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 || '');
689
- }
690
- toDto() {
691
- return {
692
- id: this.id,
693
- created: this.created,
694
- serverCreated: this.serverCreated,
695
- createdBy: this.createdBy,
696
- modified: this.modified,
697
- serverModified: this.serverModified,
698
- modifiedBy: this.modifiedBy,
699
- error: this.error,
700
- jobId: this.jobId,
701
- title: this.title,
702
- url: this.url
703
- };
704
- }
705
- }
706
-
707
- class VasUserModel extends VasBaseModel {
708
- constructor(id, created = '', serverCreated = '', createdBy = '', modified = '', serverModified = '', modifiedBy = '', email, username) {
709
- super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy);
710
- this.id = id;
711
- this.created = created;
712
- this.serverCreated = serverCreated;
713
- this.createdBy = createdBy;
714
- this.modified = modified;
715
- this.serverModified = serverModified;
716
- this.modifiedBy = modifiedBy;
717
- this.email = email;
718
- this.username = username;
719
- }
720
- static fromDto(dto) {
721
- return new VasUserModel(dto.id, dto.created, dto.serverCreated, dto.createdBy, dto.modified, dto.serverModified, dto.modifiedBy, dto.email, dto.username);
722
- }
723
- static newUser(uid, displayName, email) {
724
- return {
725
- id: uid,
726
- created: moment_().toISOString(),
727
- createdBy: uid,
728
- modified: moment_().toISOString(),
729
- modifiedBy: uid,
730
- serverCreated: moment_().toISOString(),
731
- serverModified: moment_().toISOString(),
732
- email: email,
733
- username: displayName,
734
- };
735
- }
736
- toDto() {
737
- return {
738
- id: this.id,
739
- created: this.created,
740
- serverCreated: this.serverCreated,
741
- createdBy: this.createdBy,
742
- modified: this.modified,
743
- serverModified: this.serverModified,
744
- modifiedBy: this.modifiedBy,
745
- email: this.email,
746
- username: this.username
747
- };
748
- }
749
- }
750
-
751
- /**
752
- * Generated bundle index. Do not edit.
753
- */
754
-
755
- export { VasBaseModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFormModel, VasGroupModel, VasJobModel, VasReportRequestModel, VasUserModel };
756
- //# sourceMappingURL=ironcode-vas-lib.mjs.map