@ironcode/vas-lib 1.0.0 → 1.0.2

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 (547) hide show
  1. package/README.md +24 -0
  2. package/cjs/lib/control-value/index.d.ts +2 -0
  3. package/cjs/lib/control-value/index.d.ts.map +1 -0
  4. package/cjs/lib/control-value/index.js +5 -0
  5. package/cjs/lib/control-value/index.js.map +1 -0
  6. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts +8 -0
  7. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -0
  8. package/cjs/lib/control-value/vas-camera-control-value.model.js +12 -0
  9. package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -0
  10. package/cjs/lib/controls-config/index.d.ts +4 -0
  11. package/cjs/lib/controls-config/index.d.ts.map +1 -0
  12. package/cjs/lib/controls-config/index.js +7 -0
  13. package/cjs/lib/controls-config/index.js.map +1 -0
  14. package/cjs/lib/controls-config/vas-control-config-direction.enum.d.ts +5 -0
  15. package/cjs/lib/controls-config/vas-control-config-direction.enum.d.ts.map +1 -0
  16. package/cjs/lib/controls-config/vas-control-config-direction.enum.js +11 -0
  17. package/cjs/lib/controls-config/vas-control-config-direction.enum.js.map +1 -0
  18. package/cjs/lib/controls-config/vas-control-config.model.d.ts +8 -0
  19. package/cjs/lib/controls-config/vas-control-config.model.d.ts.map +1 -0
  20. package/cjs/lib/controls-config/vas-control-config.model.js +3 -0
  21. package/cjs/lib/controls-config/vas-control-config.model.js.map +1 -0
  22. package/cjs/lib/controls-config/vas-select-control-config.model.d.ts +10 -0
  23. package/cjs/lib/controls-config/vas-select-control-config.model.d.ts.map +1 -0
  24. package/cjs/lib/controls-config/vas-select-control-config.model.js +3 -0
  25. package/cjs/lib/controls-config/vas-select-control-config.model.js.map +1 -0
  26. package/cjs/lib/entity/index.d.ts +60 -0
  27. package/cjs/lib/entity/index.d.ts.map +1 -0
  28. package/cjs/lib/entity/index.js +63 -0
  29. package/cjs/lib/entity/index.js.map +1 -0
  30. package/cjs/lib/entity/vas-access-group.dto.d.ts +7 -0
  31. package/cjs/lib/entity/vas-access-group.dto.d.ts.map +1 -0
  32. package/cjs/lib/entity/vas-access-group.dto.js +3 -0
  33. package/cjs/lib/entity/vas-access-group.dto.js.map +1 -0
  34. package/cjs/lib/entity/vas-account-config.dto.d.ts +8 -0
  35. package/cjs/lib/entity/vas-account-config.dto.d.ts.map +1 -0
  36. package/cjs/lib/entity/vas-account-config.dto.js +3 -0
  37. package/cjs/lib/entity/vas-account-config.dto.js.map +1 -0
  38. package/{lib → cjs/lib/entity}/vas-account-object.dto.d.ts +1 -0
  39. package/cjs/lib/entity/vas-account-object.dto.d.ts.map +1 -0
  40. package/cjs/lib/entity/vas-account-object.dto.js +3 -0
  41. package/cjs/lib/entity/vas-account-object.dto.js.map +1 -0
  42. package/cjs/lib/entity/vas-account-object.model.d.ts +16 -0
  43. package/cjs/lib/entity/vas-account-object.model.d.ts.map +1 -0
  44. package/cjs/lib/entity/vas-account-object.model.js +28 -0
  45. package/cjs/lib/entity/vas-account-object.model.js.map +1 -0
  46. package/cjs/lib/entity/vas-account.dto.d.ts +55 -0
  47. package/cjs/lib/entity/vas-account.dto.d.ts.map +1 -0
  48. package/cjs/lib/entity/vas-account.dto.js +10 -0
  49. package/cjs/lib/entity/vas-account.dto.js.map +1 -0
  50. package/{lib → cjs/lib/entity}/vas-base.dto.d.ts +3 -0
  51. package/cjs/lib/entity/vas-base.dto.d.ts.map +1 -0
  52. package/cjs/lib/entity/vas-base.dto.js +3 -0
  53. package/cjs/lib/entity/vas-base.dto.js.map +1 -0
  54. package/{lib → cjs/lib/entity}/vas-base.model.d.ts +4 -10
  55. package/cjs/lib/entity/vas-base.model.d.ts.map +1 -0
  56. package/cjs/lib/entity/vas-base.model.js +21 -0
  57. package/cjs/lib/entity/vas-base.model.js.map +1 -0
  58. package/cjs/lib/entity/vas-branch.dto.d.ts +22 -0
  59. package/cjs/lib/entity/vas-branch.dto.d.ts.map +1 -0
  60. package/cjs/lib/entity/vas-branch.dto.js +3 -0
  61. package/cjs/lib/entity/vas-branch.dto.js.map +1 -0
  62. package/cjs/lib/entity/vas-branch.model.d.ts +37 -0
  63. package/cjs/lib/entity/vas-branch.model.d.ts.map +1 -0
  64. package/cjs/lib/entity/vas-branch.model.js +72 -0
  65. package/cjs/lib/entity/vas-branch.model.js.map +1 -0
  66. package/cjs/lib/entity/vas-contact-type.dto.d.ts +8 -0
  67. package/cjs/lib/entity/vas-contact-type.dto.d.ts.map +1 -0
  68. package/cjs/lib/entity/vas-contact-type.dto.js +3 -0
  69. package/cjs/lib/entity/vas-contact-type.dto.js.map +1 -0
  70. package/cjs/lib/entity/vas-contact.dto.d.ts +17 -0
  71. package/cjs/lib/entity/vas-contact.dto.d.ts.map +1 -0
  72. package/cjs/lib/entity/vas-contact.dto.js +3 -0
  73. package/cjs/lib/entity/vas-contact.dto.js.map +1 -0
  74. package/cjs/lib/entity/vas-contact.model.d.ts +33 -0
  75. package/cjs/lib/entity/vas-contact.model.d.ts.map +1 -0
  76. package/cjs/lib/entity/vas-contact.model.js +69 -0
  77. package/cjs/lib/entity/vas-contact.model.js.map +1 -0
  78. package/{lib → cjs/lib/entity}/vas-control-type.dto.d.ts +1 -0
  79. package/cjs/lib/entity/vas-control-type.dto.d.ts.map +1 -0
  80. package/cjs/lib/entity/vas-control-type.dto.js +3 -0
  81. package/cjs/lib/entity/vas-control-type.dto.js.map +1 -0
  82. package/{lib → cjs/lib/entity}/vas-control-type.model.d.ts +6 -9
  83. package/cjs/lib/entity/vas-control-type.model.d.ts.map +1 -0
  84. package/cjs/lib/entity/vas-control-type.model.js +57 -0
  85. package/cjs/lib/entity/vas-control-type.model.js.map +1 -0
  86. package/{lib → cjs/lib/entity}/vas-control.dto.d.ts +5 -1
  87. package/cjs/lib/entity/vas-control.dto.d.ts.map +1 -0
  88. package/cjs/lib/entity/vas-control.dto.js +3 -0
  89. package/cjs/lib/entity/vas-control.dto.js.map +1 -0
  90. package/{lib → cjs/lib/entity}/vas-control.model.d.ts +19 -32
  91. package/cjs/lib/entity/vas-control.model.d.ts.map +1 -0
  92. package/cjs/lib/entity/vas-control.model.js +163 -0
  93. package/cjs/lib/entity/vas-control.model.js.map +1 -0
  94. package/cjs/lib/entity/vas-field.dto.d.ts +11 -0
  95. package/cjs/lib/entity/vas-field.dto.d.ts.map +1 -0
  96. package/cjs/lib/entity/vas-field.dto.js +3 -0
  97. package/cjs/lib/entity/vas-field.dto.js.map +1 -0
  98. package/cjs/lib/entity/vas-field.model.d.ts +46 -0
  99. package/cjs/lib/entity/vas-field.model.d.ts.map +1 -0
  100. package/cjs/lib/entity/vas-field.model.js +92 -0
  101. package/cjs/lib/entity/vas-field.model.js.map +1 -0
  102. package/cjs/lib/entity/vas-file.dto.d.ts +23 -0
  103. package/cjs/lib/entity/vas-file.dto.d.ts.map +1 -0
  104. package/cjs/lib/entity/vas-file.dto.js +13 -0
  105. package/cjs/lib/entity/vas-file.dto.js.map +1 -0
  106. package/cjs/lib/entity/vas-file.model.d.ts +43 -0
  107. package/cjs/lib/entity/vas-file.model.d.ts.map +1 -0
  108. package/cjs/lib/entity/vas-file.model.js +124 -0
  109. package/cjs/lib/entity/vas-file.model.js.map +1 -0
  110. package/cjs/lib/entity/vas-fire-user.dto.d.ts +16 -0
  111. package/cjs/lib/entity/vas-fire-user.dto.d.ts.map +1 -0
  112. package/cjs/lib/entity/vas-fire-user.dto.js +3 -0
  113. package/cjs/lib/entity/vas-fire-user.dto.js.map +1 -0
  114. package/cjs/lib/entity/vas-fire-user.model.d.ts +56 -0
  115. package/cjs/lib/entity/vas-fire-user.model.d.ts.map +1 -0
  116. package/cjs/lib/entity/vas-fire-user.model.js +107 -0
  117. package/cjs/lib/entity/vas-fire-user.model.js.map +1 -0
  118. package/cjs/lib/entity/vas-form-config.dto.d.ts +9 -0
  119. package/cjs/lib/entity/vas-form-config.dto.d.ts.map +1 -0
  120. package/cjs/lib/entity/vas-form-config.dto.js +3 -0
  121. package/cjs/lib/entity/vas-form-config.dto.js.map +1 -0
  122. package/{lib → cjs/lib/entity}/vas-form.dto.d.ts +7 -0
  123. package/cjs/lib/entity/vas-form.dto.d.ts.map +1 -0
  124. package/cjs/lib/entity/vas-form.dto.js +3 -0
  125. package/cjs/lib/entity/vas-form.dto.js.map +1 -0
  126. package/{lib → cjs/lib/entity}/vas-form.model.d.ts +28 -19
  127. package/cjs/lib/entity/vas-form.model.d.ts.map +1 -0
  128. package/cjs/lib/entity/vas-form.model.js +189 -0
  129. package/cjs/lib/entity/vas-form.model.js.map +1 -0
  130. package/{lib → cjs/lib/entity}/vas-group.dto.d.ts +2 -1
  131. package/cjs/lib/entity/vas-group.dto.d.ts.map +1 -0
  132. package/cjs/lib/entity/vas-group.dto.js +3 -0
  133. package/cjs/lib/entity/vas-group.dto.js.map +1 -0
  134. package/{lib → cjs/lib/entity}/vas-group.model.d.ts +5 -23
  135. package/cjs/lib/entity/vas-group.model.d.ts.map +1 -0
  136. package/{lib → cjs/lib}/entity/vas-group.model.js +19 -31
  137. package/cjs/lib/entity/vas-group.model.js.map +1 -0
  138. package/cjs/lib/entity/vas-instruction-job-field.dto.d.ts +9 -0
  139. package/cjs/lib/entity/vas-instruction-job-field.dto.d.ts.map +1 -0
  140. package/cjs/lib/entity/vas-instruction-job-field.dto.js +3 -0
  141. package/cjs/lib/entity/vas-instruction-job-field.dto.js.map +1 -0
  142. package/cjs/lib/entity/vas-instruction-job-field.model.d.ts +26 -0
  143. package/cjs/lib/entity/vas-instruction-job-field.model.d.ts.map +1 -0
  144. package/cjs/lib/entity/vas-instruction-job-field.model.js +52 -0
  145. package/cjs/lib/entity/vas-instruction-job-field.model.js.map +1 -0
  146. package/cjs/lib/entity/vas-instruction-job.dto.d.ts +16 -0
  147. package/cjs/lib/entity/vas-instruction-job.dto.d.ts.map +1 -0
  148. package/cjs/lib/entity/vas-instruction-job.dto.js +3 -0
  149. package/cjs/lib/entity/vas-instruction-job.dto.js.map +1 -0
  150. package/cjs/lib/entity/vas-instruction-job.model.d.ts +58 -0
  151. package/cjs/lib/entity/vas-instruction-job.model.d.ts.map +1 -0
  152. package/cjs/lib/entity/vas-instruction-job.model.js +85 -0
  153. package/cjs/lib/entity/vas-instruction-job.model.js.map +1 -0
  154. package/cjs/lib/entity/vas-instruction-provider.dto.d.ts +9 -0
  155. package/cjs/lib/entity/vas-instruction-provider.dto.d.ts.map +1 -0
  156. package/cjs/lib/entity/vas-instruction-provider.dto.js +3 -0
  157. package/cjs/lib/entity/vas-instruction-provider.dto.js.map +1 -0
  158. package/cjs/lib/entity/vas-instruction-provider.model.d.ts +34 -0
  159. package/cjs/lib/entity/vas-instruction-provider.model.d.ts.map +1 -0
  160. package/cjs/lib/entity/vas-instruction-provider.model.js +62 -0
  161. package/cjs/lib/entity/vas-instruction-provider.model.js.map +1 -0
  162. package/cjs/lib/entity/vas-instruction.dto.d.ts +8 -0
  163. package/cjs/lib/entity/vas-instruction.dto.d.ts.map +1 -0
  164. package/cjs/lib/entity/vas-instruction.dto.js +3 -0
  165. package/cjs/lib/entity/vas-instruction.dto.js.map +1 -0
  166. package/cjs/lib/entity/vas-instruction.model.d.ts +32 -0
  167. package/cjs/lib/entity/vas-instruction.model.d.ts.map +1 -0
  168. package/cjs/lib/entity/vas-instruction.model.js +56 -0
  169. package/cjs/lib/entity/vas-instruction.model.js.map +1 -0
  170. package/cjs/lib/entity/vas-invitation.d.ts +53 -0
  171. package/cjs/lib/entity/vas-invitation.d.ts.map +1 -0
  172. package/cjs/lib/entity/vas-invitation.js +89 -0
  173. package/cjs/lib/entity/vas-invitation.js.map +1 -0
  174. package/{lib → cjs/lib/entity}/vas-job-data.dto.d.ts +1 -0
  175. package/cjs/lib/entity/vas-job-data.dto.d.ts.map +1 -0
  176. package/cjs/lib/entity/vas-job-data.dto.js +3 -0
  177. package/cjs/lib/entity/vas-job-data.dto.js.map +1 -0
  178. package/cjs/lib/entity/vas-job-data.model.d.ts +19 -0
  179. package/cjs/lib/entity/vas-job-data.model.d.ts.map +1 -0
  180. package/cjs/lib/entity/vas-job-data.model.js +25 -0
  181. package/cjs/lib/entity/vas-job-data.model.js.map +1 -0
  182. package/cjs/lib/entity/vas-job-status.dto.d.ts +8 -0
  183. package/cjs/lib/entity/vas-job-status.dto.d.ts.map +1 -0
  184. package/cjs/lib/entity/vas-job-status.dto.js +3 -0
  185. package/cjs/lib/entity/vas-job-status.dto.js.map +1 -0
  186. package/cjs/lib/entity/vas-job-type.dto.d.ts +8 -0
  187. package/cjs/lib/entity/vas-job-type.dto.d.ts.map +1 -0
  188. package/cjs/lib/entity/vas-job-type.dto.js +3 -0
  189. package/cjs/lib/entity/vas-job-type.dto.js.map +1 -0
  190. package/cjs/lib/entity/vas-job.dto.d.ts +23 -0
  191. package/cjs/lib/entity/vas-job.dto.d.ts.map +1 -0
  192. package/cjs/lib/entity/vas-job.dto.js +3 -0
  193. package/cjs/lib/entity/vas-job.dto.js.map +1 -0
  194. package/cjs/lib/entity/vas-job.model.d.ts +232 -0
  195. package/cjs/lib/entity/vas-job.model.d.ts.map +1 -0
  196. package/cjs/lib/entity/vas-job.model.js +465 -0
  197. package/cjs/lib/entity/vas-job.model.js.map +1 -0
  198. package/cjs/lib/entity/vas-job.model.spec-data.d.ts +2 -0
  199. package/cjs/lib/entity/vas-job.model.spec-data.d.ts.map +1 -0
  200. package/cjs/lib/entity/vas-job.model.spec-data.js +29 -0
  201. package/cjs/lib/entity/vas-job.model.spec-data.js.map +1 -0
  202. package/cjs/lib/entity/vas-lookup-type.dto.d.ts +7 -0
  203. package/cjs/lib/entity/vas-lookup-type.dto.d.ts.map +1 -0
  204. package/cjs/lib/entity/vas-lookup-type.dto.js +3 -0
  205. package/cjs/lib/entity/vas-lookup-type.dto.js.map +1 -0
  206. package/cjs/lib/entity/vas-lookup.dto.d.ts +16 -0
  207. package/cjs/lib/entity/vas-lookup.dto.d.ts.map +1 -0
  208. package/cjs/lib/entity/vas-lookup.dto.js +3 -0
  209. package/cjs/lib/entity/vas-lookup.dto.js.map +1 -0
  210. package/cjs/lib/entity/vas-membership.dto.d.ts +12 -0
  211. package/cjs/lib/entity/vas-membership.dto.d.ts.map +1 -0
  212. package/cjs/lib/entity/vas-membership.dto.js +3 -0
  213. package/cjs/lib/entity/vas-membership.dto.js.map +1 -0
  214. package/cjs/lib/entity/vas-membership.model.d.ts +30 -0
  215. package/cjs/lib/entity/vas-membership.model.d.ts.map +1 -0
  216. package/cjs/lib/entity/vas-membership.model.js +66 -0
  217. package/cjs/lib/entity/vas-membership.model.js.map +1 -0
  218. package/cjs/lib/entity/vas-note.dto.d.ts +7 -0
  219. package/cjs/lib/entity/vas-note.dto.d.ts.map +1 -0
  220. package/cjs/lib/entity/vas-note.dto.js +3 -0
  221. package/cjs/lib/entity/vas-note.dto.js.map +1 -0
  222. package/cjs/lib/entity/vas-note.model.d.ts +31 -0
  223. package/cjs/lib/entity/vas-note.model.d.ts.map +1 -0
  224. package/cjs/lib/entity/vas-note.model.js +54 -0
  225. package/cjs/lib/entity/vas-note.model.js.map +1 -0
  226. package/{lib → cjs/lib/entity}/vas-report-layout.dto.d.ts +1 -0
  227. package/cjs/lib/entity/vas-report-layout.dto.d.ts.map +1 -0
  228. package/cjs/lib/entity/vas-report-layout.dto.js +3 -0
  229. package/cjs/lib/entity/vas-report-layout.dto.js.map +1 -0
  230. package/cjs/lib/entity/vas-report-layout.model.d.ts +20 -0
  231. package/cjs/lib/entity/vas-report-layout.model.d.ts.map +1 -0
  232. package/cjs/lib/entity/vas-report-layout.model.js +26 -0
  233. package/cjs/lib/entity/vas-report-layout.model.js.map +1 -0
  234. package/cjs/lib/entity/vas-report-request.dto.d.ts +9 -0
  235. package/cjs/lib/entity/vas-report-request.dto.d.ts.map +1 -0
  236. package/cjs/lib/entity/vas-report-request.dto.js +3 -0
  237. package/cjs/lib/entity/vas-report-request.dto.js.map +1 -0
  238. package/cjs/lib/entity/vas-report-request.model.d.ts +23 -0
  239. package/cjs/lib/entity/vas-report-request.model.d.ts.map +1 -0
  240. package/cjs/lib/entity/vas-report-request.model.js +51 -0
  241. package/cjs/lib/entity/vas-report-request.model.js.map +1 -0
  242. package/cjs/lib/entity/vas-report.dto.d.ts +13 -0
  243. package/cjs/lib/entity/vas-report.dto.d.ts.map +1 -0
  244. package/cjs/lib/entity/vas-report.dto.js +3 -0
  245. package/cjs/lib/entity/vas-report.dto.js.map +1 -0
  246. package/cjs/lib/entity/vas-report.model.d.ts +29 -0
  247. package/cjs/lib/entity/vas-report.model.d.ts.map +1 -0
  248. package/cjs/lib/entity/vas-report.model.js +61 -0
  249. package/cjs/lib/entity/vas-report.model.js.map +1 -0
  250. package/{lib → cjs/lib/entity}/vas-restricted-account-object.dto.d.ts +1 -0
  251. package/cjs/lib/entity/vas-restricted-account-object.dto.d.ts.map +1 -0
  252. package/cjs/lib/entity/vas-restricted-account-object.dto.js +3 -0
  253. package/cjs/lib/entity/vas-restricted-account-object.dto.js.map +1 -0
  254. package/cjs/lib/entity/vas-restricted-account-object.model.d.ts +16 -0
  255. package/cjs/lib/entity/vas-restricted-account-object.model.d.ts.map +1 -0
  256. package/cjs/lib/entity/vas-restricted-account-object.model.js +22 -0
  257. package/cjs/lib/entity/vas-restricted-account-object.model.js.map +1 -0
  258. package/cjs/lib/entity/vas-task-type.dto.d.ts +7 -0
  259. package/cjs/lib/entity/vas-task-type.dto.d.ts.map +1 -0
  260. package/cjs/lib/entity/vas-task-type.dto.js +3 -0
  261. package/cjs/lib/entity/vas-task-type.dto.js.map +1 -0
  262. package/cjs/lib/entity/vas-user.dto.d.ts +9 -0
  263. package/cjs/lib/entity/vas-user.dto.d.ts.map +1 -0
  264. package/cjs/lib/entity/vas-user.dto.js +3 -0
  265. package/cjs/lib/entity/vas-user.dto.js.map +1 -0
  266. package/{lib → cjs/lib/entity}/vas-user.model.d.ts +8 -3
  267. package/cjs/lib/entity/vas-user.model.d.ts.map +1 -0
  268. package/cjs/lib/entity/vas-user.model.js +46 -0
  269. package/cjs/lib/entity/vas-user.model.js.map +1 -0
  270. package/cjs/lib/model/geo-location.d.ts +13 -0
  271. package/cjs/lib/model/geo-location.d.ts.map +1 -0
  272. package/cjs/lib/model/geo-location.js +16 -0
  273. package/cjs/lib/model/geo-location.js.map +1 -0
  274. package/cjs/lib/model/index.d.ts +3 -0
  275. package/cjs/lib/model/index.d.ts.map +1 -0
  276. package/cjs/lib/model/index.js +6 -0
  277. package/cjs/lib/model/index.js.map +1 -0
  278. package/cjs/lib/model/vas-time-range.model.d.ts +5 -0
  279. package/cjs/lib/model/vas-time-range.model.d.ts.map +1 -0
  280. package/cjs/lib/model/vas-time-range.model.js +3 -0
  281. package/cjs/lib/model/vas-time-range.model.js.map +1 -0
  282. package/{lib → cjs/lib}/utils/find-form-control.d.ts +1 -0
  283. package/cjs/lib/utils/find-form-control.d.ts.map +1 -0
  284. package/cjs/lib/utils/find-form-control.js +25 -0
  285. package/cjs/lib/utils/find-form-control.js.map +1 -0
  286. package/cjs/lib/utils/get-value-by-path.d.ts +20 -0
  287. package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -0
  288. package/cjs/lib/utils/get-value-by-path.js +68 -0
  289. package/cjs/lib/utils/get-value-by-path.js.map +1 -0
  290. package/cjs/lib/utils/is-array-string.d.ts +2 -0
  291. package/cjs/lib/utils/is-array-string.d.ts.map +1 -0
  292. package/cjs/lib/utils/is-array-string.js +8 -0
  293. package/cjs/lib/utils/is-array-string.js.map +1 -0
  294. package/cjs/package.json +61 -0
  295. package/cjs/public-api.d.ts +5 -0
  296. package/cjs/public-api.d.ts.map +1 -0
  297. package/cjs/public-api.js +8 -0
  298. package/cjs/public-api.js.map +1 -0
  299. package/esm2020/ironcode-vas-lib.mjs +5 -0
  300. package/esm2020/lib/control-value/index.mjs +2 -0
  301. package/esm2020/lib/control-value/vas-camera-control-value.model.mjs +8 -0
  302. package/esm2020/lib/controls-config/index.mjs +4 -0
  303. package/esm2020/lib/controls-config/vas-control-config-direction.enum.mjs +8 -0
  304. package/esm2020/lib/controls-config/vas-control-config.model.mjs +2 -0
  305. package/esm2020/lib/controls-config/vas-select-control-config.model.mjs +2 -0
  306. package/esm2020/lib/entity/index.mjs +60 -0
  307. package/esm2020/lib/entity/vas-access-group.dto.mjs +2 -0
  308. package/esm2020/lib/entity/vas-account-config.dto.mjs +2 -0
  309. package/esm2020/lib/entity/vas-account-object.dto.mjs +2 -0
  310. package/esm2020/lib/entity/vas-account-object.model.mjs +24 -0
  311. package/esm2020/lib/entity/vas-account.dto.mjs +7 -0
  312. package/esm2020/lib/entity/vas-base.dto.mjs +2 -0
  313. package/esm2020/lib/entity/vas-base.model.mjs +17 -0
  314. package/esm2020/lib/entity/vas-branch.dto.mjs +2 -0
  315. package/esm2020/lib/entity/vas-branch.model.mjs +68 -0
  316. package/esm2020/lib/entity/vas-contact-type.dto.mjs +2 -0
  317. package/esm2020/lib/entity/vas-contact.dto.mjs +2 -0
  318. package/esm2020/lib/entity/vas-contact.model.mjs +84 -0
  319. package/esm2020/lib/entity/vas-control-type.dto.mjs +2 -0
  320. package/esm2020/lib/entity/vas-control-type.model.mjs +53 -0
  321. package/esm2020/lib/entity/vas-control.dto.mjs +2 -0
  322. package/esm2020/lib/entity/vas-control.model.mjs +163 -0
  323. package/esm2020/lib/entity/vas-field.dto.mjs +2 -0
  324. package/esm2020/lib/entity/vas-field.model.mjs +92 -0
  325. package/esm2020/lib/entity/vas-file.dto.mjs +9 -0
  326. package/esm2020/lib/entity/vas-file.model.mjs +126 -0
  327. package/esm2020/lib/entity/vas-fire-user.dto.mjs +2 -0
  328. package/esm2020/lib/entity/vas-fire-user.model.mjs +102 -0
  329. package/esm2020/lib/entity/vas-form-config.dto.mjs +2 -0
  330. package/esm2020/lib/entity/vas-form.dto.mjs +2 -0
  331. package/esm2020/lib/entity/vas-form.model.mjs +185 -0
  332. package/esm2020/lib/entity/vas-group.dto.mjs +2 -0
  333. package/esm2020/lib/entity/vas-group.model.mjs +89 -0
  334. package/esm2020/lib/entity/vas-instruction-job-field.dto.mjs +2 -0
  335. package/esm2020/lib/entity/vas-instruction-job-field.model.mjs +48 -0
  336. package/esm2020/lib/entity/vas-instruction-job.dto.mjs +2 -0
  337. package/esm2020/lib/entity/vas-instruction-job.model.mjs +81 -0
  338. package/esm2020/lib/entity/vas-instruction-provider.dto.mjs +2 -0
  339. package/esm2020/lib/entity/vas-instruction-provider.model.mjs +63 -0
  340. package/esm2020/lib/entity/vas-instruction.dto.mjs +2 -0
  341. package/esm2020/lib/entity/vas-instruction.model.mjs +52 -0
  342. package/esm2020/lib/entity/vas-invitation.mjs +88 -0
  343. package/esm2020/lib/entity/vas-job-data.dto.mjs +2 -0
  344. package/esm2020/lib/entity/vas-job-data.model.mjs +21 -0
  345. package/esm2020/lib/entity/vas-job-status.dto.mjs +2 -0
  346. package/esm2020/lib/entity/vas-job-type.dto.mjs +2 -0
  347. package/esm2020/lib/entity/vas-job.dto.mjs +2 -0
  348. package/esm2020/lib/entity/vas-job.model.mjs +471 -0
  349. package/esm2020/lib/entity/vas-lookup-type.dto.mjs +2 -0
  350. package/esm2020/lib/entity/vas-lookup.dto.mjs +2 -0
  351. package/esm2020/lib/entity/vas-membership.dto.mjs +2 -0
  352. package/esm2020/lib/entity/vas-membership.model.mjs +62 -0
  353. package/esm2020/lib/entity/vas-note.dto.mjs +2 -0
  354. package/esm2020/lib/entity/vas-note.model.mjs +50 -0
  355. package/esm2020/lib/entity/vas-report-layout.dto.mjs +2 -0
  356. package/esm2020/lib/entity/vas-report-layout.model.mjs +22 -0
  357. package/esm2020/lib/entity/vas-report-request.dto.mjs +2 -0
  358. package/esm2020/lib/entity/vas-report-request.model.mjs +46 -0
  359. package/esm2020/lib/entity/vas-report.dto.mjs +2 -0
  360. package/esm2020/lib/entity/vas-report.model.mjs +57 -0
  361. package/esm2020/lib/entity/vas-restricted-account-object.dto.mjs +2 -0
  362. package/esm2020/lib/entity/vas-restricted-account-object.model.mjs +18 -0
  363. package/esm2020/lib/entity/vas-task-type.dto.mjs +2 -0
  364. package/esm2020/lib/entity/vas-user.dto.mjs +2 -0
  365. package/esm2020/lib/entity/vas-user.model.mjs +42 -0
  366. package/esm2020/lib/model/geo-location.mjs +12 -0
  367. package/esm2020/lib/model/index.mjs +3 -0
  368. package/esm2020/lib/model/vas-time-range.model.mjs +2 -0
  369. package/esm2020/lib/utils/get-value-by-path.mjs +64 -0
  370. package/esm2020/lib/utils/is-array-string.mjs +4 -0
  371. package/esm2020/public-api.mjs +5 -0
  372. package/fesm2015/ironcode-vas-lib.mjs +2142 -0
  373. package/fesm2015/ironcode-vas-lib.mjs.map +1 -0
  374. package/fesm2020/ironcode-vas-lib.mjs +2194 -0
  375. package/fesm2020/ironcode-vas-lib.mjs.map +1 -0
  376. package/index.d.ts +5 -0
  377. package/lib/control-value/index.d.ts +1 -0
  378. package/lib/control-value/vas-camera-control-value.model.d.ts +7 -0
  379. package/lib/controls-config/index.d.ts +3 -0
  380. package/lib/controls-config/vas-control-config-direction.enum.d.ts +4 -0
  381. package/lib/controls-config/vas-control-config.model.d.ts +7 -0
  382. package/lib/controls-config/vas-select-control-config.model.d.ts +9 -0
  383. package/lib/entity/index.d.ts +59 -0
  384. package/lib/entity/vas-access-group.dto.d.ts +6 -0
  385. package/lib/entity/vas-account-config.dto.d.ts +7 -0
  386. package/lib/entity/vas-account-object.model.d.ts +15 -0
  387. package/lib/entity/vas-account.dto.d.ts +54 -0
  388. package/lib/entity/vas-base.dto.d.ts +2 -0
  389. package/lib/entity/vas-base.model.d.ts +3 -10
  390. package/lib/entity/vas-branch.dto.d.ts +21 -0
  391. package/lib/entity/vas-branch.model.d.ts +36 -0
  392. package/lib/entity/vas-contact-type.dto.d.ts +7 -0
  393. package/lib/entity/vas-contact.dto.d.ts +16 -0
  394. package/lib/entity/vas-contact.model.d.ts +32 -0
  395. package/lib/entity/vas-control-type.model.d.ts +5 -9
  396. package/lib/entity/vas-control.dto.d.ts +4 -1
  397. package/lib/entity/vas-control.model.d.ts +18 -32
  398. package/lib/entity/vas-field.dto.d.ts +4 -2
  399. package/lib/entity/vas-field.model.d.ts +45 -0
  400. package/lib/entity/vas-file.dto.d.ts +16 -7
  401. package/lib/entity/vas-file.model.d.ts +42 -0
  402. package/lib/entity/vas-fire-user.dto.d.ts +15 -0
  403. package/lib/entity/vas-fire-user.model.d.ts +55 -0
  404. package/lib/entity/vas-form-config.dto.d.ts +8 -0
  405. package/lib/entity/vas-form.dto.d.ts +6 -0
  406. package/lib/entity/vas-form.model.d.ts +27 -19
  407. package/lib/entity/vas-group.dto.d.ts +1 -1
  408. package/lib/entity/vas-group.model.d.ts +4 -23
  409. package/lib/entity/vas-instruction-job-field.dto.d.ts +8 -0
  410. package/lib/entity/vas-instruction-job-field.model.d.ts +25 -0
  411. package/lib/entity/vas-instruction-job.dto.d.ts +15 -0
  412. package/lib/entity/vas-instruction-job.model.d.ts +57 -0
  413. package/lib/entity/vas-instruction-provider.dto.d.ts +8 -0
  414. package/lib/entity/vas-instruction-provider.model.d.ts +33 -0
  415. package/lib/entity/vas-instruction.dto.d.ts +7 -0
  416. package/lib/entity/vas-instruction.model.d.ts +31 -0
  417. package/lib/entity/vas-invitation.d.ts +52 -0
  418. package/lib/entity/vas-job-data.model.d.ts +18 -0
  419. package/lib/entity/vas-job-status.dto.d.ts +7 -0
  420. package/lib/entity/vas-job-type.dto.d.ts +7 -0
  421. package/lib/entity/vas-job.dto.d.ts +13 -2
  422. package/lib/entity/vas-job.model.d.ts +169 -40
  423. package/lib/entity/vas-lookup-type.dto.d.ts +6 -0
  424. package/lib/entity/vas-lookup.dto.d.ts +15 -0
  425. package/lib/entity/vas-membership.dto.d.ts +11 -0
  426. package/lib/entity/vas-membership.model.d.ts +29 -0
  427. package/lib/entity/vas-note.dto.d.ts +6 -0
  428. package/lib/entity/vas-note.model.d.ts +30 -0
  429. package/lib/entity/vas-report-layout.model.d.ts +19 -0
  430. package/lib/entity/vas-report-request.dto.d.ts +8 -0
  431. package/lib/entity/vas-report-request.model.d.ts +22 -0
  432. package/lib/entity/vas-report.dto.d.ts +12 -0
  433. package/lib/entity/vas-report.model.d.ts +28 -0
  434. package/lib/entity/vas-restricted-account-object.model.d.ts +15 -0
  435. package/lib/entity/vas-task-type.dto.d.ts +6 -0
  436. package/lib/entity/vas-user.dto.d.ts +4 -1
  437. package/lib/entity/vas-user.model.d.ts +7 -3
  438. package/lib/model/geo-location.d.ts +12 -0
  439. package/lib/model/index.d.ts +2 -0
  440. package/lib/model/vas-time-range.model.d.ts +4 -0
  441. package/lib/utils/get-value-by-path.d.ts +19 -0
  442. package/lib/utils/is-array-string.d.ts +1 -0
  443. package/package.json +25 -26
  444. package/public-api.d.ts +4 -0
  445. package/lib/entity/report-request.model.d.ts +0 -8
  446. package/lib/entity/report-request.model.js +0 -2
  447. package/lib/entity/report-request.model.js.map +0 -1
  448. package/lib/entity/vas-account-object.dto.js +0 -2
  449. package/lib/entity/vas-account-object.dto.js.map +0 -1
  450. package/lib/entity/vas-base.dto.js +0 -2
  451. package/lib/entity/vas-base.dto.js.map +0 -1
  452. package/lib/entity/vas-base.model.js +0 -24
  453. package/lib/entity/vas-base.model.js.map +0 -1
  454. package/lib/entity/vas-control-type.dto.js +0 -2
  455. package/lib/entity/vas-control-type.dto.js.map +0 -1
  456. package/lib/entity/vas-control-type.model.js +0 -53
  457. package/lib/entity/vas-control-type.model.js.map +0 -1
  458. package/lib/entity/vas-control.dto.js +0 -2
  459. package/lib/entity/vas-control.dto.js.map +0 -1
  460. package/lib/entity/vas-control.model.js +0 -132
  461. package/lib/entity/vas-control.model.js.map +0 -1
  462. package/lib/entity/vas-field.dto.js +0 -2
  463. package/lib/entity/vas-field.dto.js.map +0 -1
  464. package/lib/entity/vas-file.dto.js +0 -2
  465. package/lib/entity/vas-file.dto.js.map +0 -1
  466. package/lib/entity/vas-form.dto.js +0 -2
  467. package/lib/entity/vas-form.dto.js.map +0 -1
  468. package/lib/entity/vas-form.model.js +0 -144
  469. package/lib/entity/vas-form.model.js.map +0 -1
  470. package/lib/entity/vas-group.dto.js +0 -2
  471. package/lib/entity/vas-group.dto.js.map +0 -1
  472. package/lib/entity/vas-group.model.js.map +0 -1
  473. package/lib/entity/vas-job-data.dto.js +0 -2
  474. package/lib/entity/vas-job-data.dto.js.map +0 -1
  475. package/lib/entity/vas-job.dto.js +0 -2
  476. package/lib/entity/vas-job.dto.js.map +0 -1
  477. package/lib/entity/vas-job.model.js +0 -170
  478. package/lib/entity/vas-job.model.js.map +0 -1
  479. package/lib/entity/vas-report-layout.dto.js +0 -2
  480. package/lib/entity/vas-report-layout.dto.js.map +0 -1
  481. package/lib/entity/vas-restricted-account-object.dto.js +0 -2
  482. package/lib/entity/vas-restricted-account-object.dto.js.map +0 -1
  483. package/lib/entity/vas-user.dto.js +0 -2
  484. package/lib/entity/vas-user.dto.js.map +0 -1
  485. package/lib/entity/vas-user.model.js +0 -46
  486. package/lib/entity/vas-user.model.js.map +0 -1
  487. package/lib/ng-models/ng-control.model.d.ts +0 -14
  488. package/lib/ng-models/ng-control.model.js +0 -14
  489. package/lib/ng-models/ng-control.model.js.map +0 -1
  490. package/lib/ng-models/ng-form.model.d.ts +0 -27
  491. package/lib/ng-models/ng-form.model.js +0 -54
  492. package/lib/ng-models/ng-form.model.js.map +0 -1
  493. package/lib/ng-models/ng-group.model.d.ts +0 -36
  494. package/lib/ng-models/ng-group.model.js +0 -59
  495. package/lib/ng-models/ng-group.model.js.map +0 -1
  496. package/lib/report-request.model.d.ts +0 -8
  497. package/lib/report-request.model.js +0 -2
  498. package/lib/report-request.model.js.map +0 -1
  499. package/lib/utils/find-form-control.js +0 -20
  500. package/lib/utils/find-form-control.js.map +0 -1
  501. package/lib/vas-account-object.dto.js +0 -2
  502. package/lib/vas-account-object.dto.js.map +0 -1
  503. package/lib/vas-base.dto.js +0 -2
  504. package/lib/vas-base.dto.js.map +0 -1
  505. package/lib/vas-base.model.js +0 -24
  506. package/lib/vas-base.model.js.map +0 -1
  507. package/lib/vas-control-type.dto.js +0 -2
  508. package/lib/vas-control-type.dto.js.map +0 -1
  509. package/lib/vas-control-type.model.js +0 -53
  510. package/lib/vas-control-type.model.js.map +0 -1
  511. package/lib/vas-control.dto.js +0 -2
  512. package/lib/vas-control.dto.js.map +0 -1
  513. package/lib/vas-control.model.js +0 -132
  514. package/lib/vas-control.model.js.map +0 -1
  515. package/lib/vas-field.dto.d.ts +0 -8
  516. package/lib/vas-field.dto.js +0 -2
  517. package/lib/vas-field.dto.js.map +0 -1
  518. package/lib/vas-file.dto.d.ts +0 -13
  519. package/lib/vas-file.dto.js +0 -2
  520. package/lib/vas-file.dto.js.map +0 -1
  521. package/lib/vas-form.dto.js +0 -2
  522. package/lib/vas-form.dto.js.map +0 -1
  523. package/lib/vas-form.model.js +0 -144
  524. package/lib/vas-form.model.js.map +0 -1
  525. package/lib/vas-group.dto.js +0 -2
  526. package/lib/vas-group.dto.js.map +0 -1
  527. package/lib/vas-group.model.js +0 -105
  528. package/lib/vas-group.model.js.map +0 -1
  529. package/lib/vas-job-data.dto.js +0 -2
  530. package/lib/vas-job-data.dto.js.map +0 -1
  531. package/lib/vas-job.dto.d.ts +0 -11
  532. package/lib/vas-job.dto.js +0 -2
  533. package/lib/vas-job.dto.js.map +0 -1
  534. package/lib/vas-job.model.d.ts +0 -102
  535. package/lib/vas-job.model.js +0 -170
  536. package/lib/vas-job.model.js.map +0 -1
  537. package/lib/vas-job.model.spec.d.ts +0 -1
  538. package/lib/vas-job.model.spec.js +0 -18
  539. package/lib/vas-report-layout.dto.js +0 -2
  540. package/lib/vas-report-layout.dto.js.map +0 -1
  541. package/lib/vas-restricted-account-object.dto.js +0 -2
  542. package/lib/vas-restricted-account-object.dto.js.map +0 -1
  543. package/lib/vas-user.dto.d.ts +0 -5
  544. package/lib/vas-user.dto.js +0 -2
  545. package/lib/vas-user.dto.js.map +0 -1
  546. package/lib/vas-user.model.js +0 -46
  547. package/lib/vas-user.model.js.map +0 -1
@@ -0,0 +1,2194 @@
1
+ import moment from 'moment/moment';
2
+ import { UUID } from 'angular2-uuid';
3
+ import moment$1 from 'moment';
4
+
5
+ function isCameraControlValueV1(object) {
6
+ return object instanceof Object
7
+ && 'webPath' in object
8
+ && 'path' in object
9
+ && 'url' in object
10
+ && 'id' in object;
11
+ }
12
+
13
+ var VasControlConfigDirection;
14
+ (function (VasControlConfigDirection) {
15
+ // eslint-disable-next-line @typescript-eslint/naming-convention
16
+ VasControlConfigDirection[VasControlConfigDirection["ROW"] = 0] = "ROW";
17
+ // eslint-disable-next-line @typescript-eslint/naming-convention
18
+ VasControlConfigDirection[VasControlConfigDirection["COLUMN"] = 1] = "COLUMN";
19
+ })(VasControlConfigDirection || (VasControlConfigDirection = {}));
20
+
21
+ /**
22
+ * BaseEntityModel
23
+ */
24
+ class VasBaseModel {
25
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName) {
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
+ this.createdByName = createdByName;
34
+ this.modifiedByName = modifiedByName;
35
+ }
36
+ }
37
+
38
+ class VasUserModel extends VasBaseModel {
39
+ constructor(id, created = '', serverCreated = '', createdBy = '', modified = '', serverModified = '', modifiedBy = '', createdByName, modifiedByName, email, name, username, memberships, instructionProviders) {
40
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
41
+ this.id = id;
42
+ this.created = created;
43
+ this.serverCreated = serverCreated;
44
+ this.createdBy = createdBy;
45
+ this.modified = modified;
46
+ this.serverModified = serverModified;
47
+ this.modifiedBy = modifiedBy;
48
+ this.createdByName = createdByName;
49
+ this.modifiedByName = modifiedByName;
50
+ this.email = email;
51
+ this.name = name;
52
+ this.username = username;
53
+ this.memberships = memberships;
54
+ this.instructionProviders = instructionProviders;
55
+ }
56
+ static fromDto(dto) {
57
+ return new VasUserModel(dto.id, dto.created, dto.serverCreated, dto.createdBy, dto.modified, dto.serverModified, dto.modifiedBy, dto.createdByName || '', dto.modifiedByName || '', dto.email, dto.name, dto.username, dto.memberships, dto.instructionProviders);
58
+ }
59
+ toDto() {
60
+ return {
61
+ id: this.id,
62
+ created: this.created,
63
+ serverCreated: this.serverCreated,
64
+ createdBy: this.createdBy,
65
+ modified: this.modified,
66
+ serverModified: this.serverModified,
67
+ modifiedBy: this.modifiedBy,
68
+ createdByName: this.createdByName,
69
+ modifiedByName: this.modifiedByName,
70
+ email: this.email,
71
+ name: this.name,
72
+ username: this.username,
73
+ memberships: this.memberships,
74
+ instructionProviders: this.instructionProviders
75
+ };
76
+ }
77
+ }
78
+
79
+ class VasFireUserModel extends VasUserModel {
80
+ constructor(id, created = '', serverCreated = '', createdBy = '', modified = '', serverModified = '', modifiedBy = '', createdByName, modifiedByName, email, name, username, memberships, instructionProviders, accounts, tokens, topics, language, displayName) {
81
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, email, name, username, memberships, instructionProviders);
82
+ this.id = id;
83
+ this.created = created;
84
+ this.serverCreated = serverCreated;
85
+ this.createdBy = createdBy;
86
+ this.modified = modified;
87
+ this.serverModified = serverModified;
88
+ this.modifiedBy = modifiedBy;
89
+ this.createdByName = createdByName;
90
+ this.modifiedByName = modifiedByName;
91
+ this.email = email;
92
+ this.name = name;
93
+ this.username = username;
94
+ this.memberships = memberships;
95
+ this.instructionProviders = instructionProviders;
96
+ this.accounts = accounts;
97
+ this.tokens = tokens;
98
+ this.topics = topics;
99
+ this.language = language;
100
+ this.displayName = displayName;
101
+ }
102
+ static fromDto(dto) {
103
+ return new VasFireUserModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.email || '', dto.name || '', dto.username || '', dto.memberships || [], dto.instructionProviders || [], dto.accounts || {}, dto.tokens || [], dto.topics || [], dto.language || '', dto.displayName || '');
104
+ }
105
+ static newUser(uid, displayName, email) {
106
+ return new VasFireUserModel(uid, moment().toISOString(), moment().toISOString(), uid, moment().toISOString(), moment().toISOString(), uid, '', '', email, displayName, email, [], [], {}, [], [], '', displayName);
107
+ }
108
+ toDto() {
109
+ return {
110
+ id: this.id,
111
+ created: this.created,
112
+ serverCreated: this.serverCreated,
113
+ createdBy: this.createdBy,
114
+ modified: this.modified,
115
+ serverModified: this.serverModified,
116
+ modifiedBy: this.modifiedBy,
117
+ createdByName: this.createdByName,
118
+ modifiedByName: this.modifiedByName,
119
+ email: this.email,
120
+ name: this.name,
121
+ username: this.username,
122
+ memberships: this.memberships,
123
+ instructionProviders: this.instructionProviders,
124
+ accounts: this.accounts,
125
+ tokens: this.tokens,
126
+ topics: this.topics,
127
+ language: this.language,
128
+ displayName: this.displayName
129
+ };
130
+ }
131
+ /**
132
+ * Adds token to tokens list if it is not already present
133
+ * @param token the new token
134
+ */
135
+ addToken(token) {
136
+ if (this.tokens.includes(token)) {
137
+ return;
138
+ }
139
+ this.tokens.push(token);
140
+ }
141
+ /**
142
+ * Remove token from tokens list
143
+ * @param token the token to remove
144
+ */
145
+ removeToken(token) {
146
+ this.tokens = this.tokens.filter(t => t !== token);
147
+ }
148
+ /**
149
+ * Resets the tokens list
150
+ */
151
+ resetTokens() {
152
+ this.tokens = [];
153
+ }
154
+ /**
155
+ * Adds topic to topics list if it is not already present
156
+ * @param topic the new token
157
+ */
158
+ addTopic(topic) {
159
+ if (this.topics.includes(topic)) {
160
+ return;
161
+ }
162
+ this.topics.push(topic);
163
+ }
164
+ /**
165
+ * Remove topic from topic list
166
+ * @param topic the topic to remove
167
+ */
168
+ removeTopic(topic) {
169
+ this.topics = this.topics.filter(t => t !== topic);
170
+ }
171
+ /**
172
+ * Resets the topic list
173
+ */
174
+ resetTopics() {
175
+ this.topics = [];
176
+ }
177
+ }
178
+
179
+ var VasAccountIndexingMode;
180
+ (function (VasAccountIndexingMode) {
181
+ VasAccountIndexingMode[VasAccountIndexingMode["DISABLED"] = 0] = "DISABLED";
182
+ VasAccountIndexingMode[VasAccountIndexingMode["ON_CHANGE"] = 1] = "ON_CHANGE";
183
+ VasAccountIndexingMode[VasAccountIndexingMode["ON_REPORT"] = 2] = "ON_REPORT";
184
+ })(VasAccountIndexingMode || (VasAccountIndexingMode = {}));
185
+
186
+ class VasAccountObjectModel extends VasBaseModel {
187
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account) {
188
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
189
+ this.id = id;
190
+ this.created = created;
191
+ this.serverCreated = serverCreated;
192
+ this.createdBy = createdBy;
193
+ this.modified = modified;
194
+ this.serverModified = serverModified;
195
+ this.modifiedBy = modifiedBy;
196
+ this.createdByName = createdByName;
197
+ this.modifiedByName = modifiedByName;
198
+ this.account = account;
199
+ }
200
+ toApiDto(options) {
201
+ return {
202
+ id: this.id,
203
+ created: this.created,
204
+ modified: this.modified
205
+ };
206
+ }
207
+ }
208
+
209
+ class VasRestrictedAccountObjectModel extends VasAccountObjectModel {
210
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup) {
211
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
212
+ this.id = id;
213
+ this.created = created;
214
+ this.serverCreated = serverCreated;
215
+ this.createdBy = createdBy;
216
+ this.modified = modified;
217
+ this.serverModified = serverModified;
218
+ this.modifiedBy = modifiedBy;
219
+ this.createdByName = createdByName;
220
+ this.modifiedByName = modifiedByName;
221
+ this.account = account;
222
+ this.accessGroup = accessGroup;
223
+ }
224
+ }
225
+
226
+ class VasBranchModel extends VasRestrictedAccountObjectModel {
227
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, branchType, storeCode, address, city, postcode, email, locationManager, areaManager, regionalDirector, salesManager, cluster, hourWeekdays, hourSaturday, hourSunday, exceptions, active) {
228
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
229
+ this.id = id;
230
+ this.created = created;
231
+ this.serverCreated = serverCreated;
232
+ this.createdBy = createdBy;
233
+ this.modified = modified;
234
+ this.serverModified = serverModified;
235
+ this.modifiedBy = modifiedBy;
236
+ this.createdByName = createdByName;
237
+ this.modifiedByName = modifiedByName;
238
+ this.account = account;
239
+ this.accessGroup = accessGroup;
240
+ this.branchType = branchType;
241
+ this.storeCode = storeCode;
242
+ this.address = address;
243
+ this.city = city;
244
+ this.postcode = postcode;
245
+ this.email = email;
246
+ this.locationManager = locationManager;
247
+ this.areaManager = areaManager;
248
+ this.regionalDirector = regionalDirector;
249
+ this.salesManager = salesManager;
250
+ this.cluster = cluster;
251
+ this.hourWeekdays = hourWeekdays;
252
+ this.hourSaturday = hourSaturday;
253
+ this.hourSunday = hourSunday;
254
+ this.exceptions = exceptions;
255
+ this.active = active;
256
+ }
257
+ static fromDto(dto) {
258
+ return new VasBranchModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.branchType || '', dto.storeCode || '', dto.address || '', dto.city || '', dto.postcode || '', dto.email || '', dto.locationManager || undefined, dto.areaManager || undefined, dto.regionalDirector || undefined, dto.salesManager || undefined, dto.cluster || '', dto.hourWeekdays || [], dto.hourSaturday || [], dto.hourSunday || [], dto.exceptions || '', dto.active || true);
259
+ }
260
+ toDto() {
261
+ return {
262
+ id: this.id,
263
+ created: this.created,
264
+ serverCreated: this.serverCreated,
265
+ createdBy: this.createdBy,
266
+ modified: this.modified,
267
+ serverModified: this.serverModified,
268
+ modifiedBy: this.modifiedBy,
269
+ createdByName: this.createdByName,
270
+ modifiedByName: this.modifiedByName,
271
+ account: this.account,
272
+ accessGroup: this.accessGroup,
273
+ branchType: this.branchType,
274
+ storeCode: this.storeCode,
275
+ address: this.address,
276
+ city: this.city,
277
+ postcode: this.postcode,
278
+ email: this.email,
279
+ locationManager: this.locationManager,
280
+ areaManager: this.areaManager,
281
+ regionalDirector: this.regionalDirector,
282
+ salesManager: this.salesManager,
283
+ cluster: this.cluster,
284
+ hourWeekdays: this.hourWeekdays,
285
+ hourSaturday: this.hourSaturday,
286
+ hourSunday: this.hourSunday,
287
+ exceptions: this.exceptions,
288
+ active: this.active
289
+ };
290
+ }
291
+ }
292
+
293
+ class VasContactModel extends VasRestrictedAccountObjectModel {
294
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, contactType, name, email, mobile, phone, address, address2, address3, billingCode, business, fax, vatNumber, website) {
295
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
296
+ this.id = id;
297
+ this.created = created;
298
+ this.serverCreated = serverCreated;
299
+ this.createdBy = createdBy;
300
+ this.modified = modified;
301
+ this.serverModified = serverModified;
302
+ this.modifiedBy = modifiedBy;
303
+ this.createdByName = createdByName;
304
+ this.modifiedByName = modifiedByName;
305
+ this.account = account;
306
+ this.accessGroup = accessGroup;
307
+ this.contactType = contactType;
308
+ this.name = name;
309
+ this.email = email;
310
+ this.mobile = mobile;
311
+ this.phone = phone;
312
+ this.address = address;
313
+ this.address2 = address2;
314
+ this.address3 = address3;
315
+ this.billingCode = billingCode;
316
+ this.business = business;
317
+ this.fax = fax;
318
+ this.vatNumber = vatNumber;
319
+ this.website = website;
320
+ }
321
+ static fromDto(dto) {
322
+ return new VasContactModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.contactType || '', dto.name || '', dto.email || '', dto.mobile || '', dto.phone || '', dto.address || '', dto.address2 || '', dto.address3 || '', dto.billingCode || '', dto.business || '', dto.fax || '', dto.vatNumber || '', dto.website || '');
323
+ }
324
+ toDto() {
325
+ return {
326
+ id: this.id,
327
+ created: this.created,
328
+ serverCreated: this.serverCreated,
329
+ createdBy: this.createdBy,
330
+ modified: this.modified,
331
+ serverModified: this.serverModified,
332
+ modifiedBy: this.modifiedBy,
333
+ createdByName: this.createdByName,
334
+ modifiedByName: this.modifiedByName,
335
+ account: this.account,
336
+ accessGroup: this.accessGroup,
337
+ contactType: this.contactType,
338
+ name: this.name,
339
+ email: this.email,
340
+ mobile: this.mobile,
341
+ phone: this.phone,
342
+ address: this.address,
343
+ address2: this.address2,
344
+ address3: this.address3,
345
+ billingCode: this.billingCode,
346
+ business: this.business,
347
+ fax: this.fax,
348
+ vatNumber: this.vatNumber,
349
+ website: this.website,
350
+ };
351
+ }
352
+ toApiDto(options) {
353
+ return {
354
+ ...super.toApiDto(),
355
+ id: this.id,
356
+ created: this.created || '~',
357
+ modified: this.modified || '~',
358
+ accessGroup: this.accessGroup || '~',
359
+ contactType: this.contactType || '~',
360
+ name: this.name || '~',
361
+ email: this.email || '~',
362
+ mobile: this.mobile || '~',
363
+ phone: this.phone || '~',
364
+ address: this.address || '~',
365
+ address2: this.address2 || '~',
366
+ address3: this.address3 || '~',
367
+ billingCode: this.billingCode || '~',
368
+ business: this.business || '~',
369
+ fax: this.fax || '~',
370
+ vatNumber: this.vatNumber || '~',
371
+ website: this.website || '~',
372
+ };
373
+ }
374
+ }
375
+
376
+ /**
377
+ * VasControlTypeModel
378
+ */
379
+ class VasControlTypeModel extends VasBaseModel {
380
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, name) {
381
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
382
+ this.id = id;
383
+ this.created = created;
384
+ this.serverCreated = serverCreated;
385
+ this.createdBy = createdBy;
386
+ this.modified = modified;
387
+ this.serverModified = serverModified;
388
+ this.modifiedBy = modifiedBy;
389
+ this.createdByName = createdByName;
390
+ this.modifiedByName = modifiedByName;
391
+ this.name = name;
392
+ }
393
+ /**
394
+ * @return VasControlTypeModel
395
+ */
396
+ static empty() {
397
+ return new VasControlTypeModel('', '', '', '', '', '', '', '', '', '');
398
+ }
399
+ /**
400
+ * @param {VasControlTypeDto} dto
401
+ * @return {VasControlTypeModel}
402
+ */
403
+ static fromDto(dto) {
404
+ return new VasControlTypeModel(
405
+ // eslint-disable-next-line new-cap
406
+ dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.name || '');
407
+ }
408
+ /**
409
+ * @return {VasControlTypeDto}
410
+ */
411
+ toDto() {
412
+ return {
413
+ id: this.id,
414
+ created: this.created,
415
+ serverCreated: this.serverCreated,
416
+ createdBy: this.createdBy,
417
+ modified: this.modified,
418
+ serverModified: this.serverModified,
419
+ modifiedBy: this.modifiedBy,
420
+ createdByName: this.createdByName,
421
+ modifiedByName: this.modifiedByName,
422
+ name: this.name
423
+ };
424
+ }
425
+ }
426
+
427
+ /**
428
+ * ControlModel
429
+ */
430
+ class VasControlModel extends VasAccountObjectModel {
431
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, controlType, group, validators, name, title, linkable, sequence, description, defaultValue, config, descriptionImage, portalEnabled) {
432
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
433
+ this.id = id;
434
+ this.created = created;
435
+ this.serverCreated = serverCreated;
436
+ this.createdBy = createdBy;
437
+ this.modified = modified;
438
+ this.serverModified = serverModified;
439
+ this.modifiedBy = modifiedBy;
440
+ this.createdByName = createdByName;
441
+ this.modifiedByName = modifiedByName;
442
+ this.account = account;
443
+ this.accessGroup = accessGroup;
444
+ this.controlType = controlType;
445
+ this.group = group;
446
+ this.validators = validators;
447
+ this.name = name;
448
+ this.title = title;
449
+ this.linkable = linkable;
450
+ this.sequence = sequence;
451
+ this.description = description;
452
+ this.defaultValue = defaultValue;
453
+ this.config = config;
454
+ this.descriptionImage = descriptionImage;
455
+ this.portalEnabled = portalEnabled;
456
+ this.controlTypeId = '';
457
+ if (typeof controlType === 'string') {
458
+ this.controlTypeId = controlType;
459
+ }
460
+ else {
461
+ this.controlTypeId = controlType.id;
462
+ }
463
+ }
464
+ get controlTypeName() {
465
+ return this.controlType?.name || '';
466
+ }
467
+ /**
468
+ * The defaultValue property is returned from the api as a string or number,
469
+ * in the case of string, it maybe a json. This getter will return an
470
+ * object if the value is a json string
471
+ */
472
+ get defaultValueDecoded() {
473
+ if (this.defaultValue === '' && this.controlType) {
474
+ switch (this.controlTypeName) {
475
+ case 'branch':
476
+ case 'camera':
477
+ case 'contact': {
478
+ return {};
479
+ }
480
+ case 'toggle': {
481
+ return {
482
+ checked: false, comment: ''
483
+ };
484
+ }
485
+ }
486
+ }
487
+ return this.parseMaybeJson(this.defaultValue);
488
+ }
489
+ /**
490
+ * Returns the name of this control to be used in the report templates
491
+ * i.e. fields.foo -> foo
492
+ * @return {string}
493
+ */
494
+ get reportTemplateName() {
495
+ return this.name.replace(/^fields\./, '');
496
+ }
497
+ /**
498
+ * @return {string}
499
+ */
500
+ get safeName() {
501
+ return this.name;
502
+ }
503
+ /**
504
+ * @return {VasControlModel}
505
+ */
506
+ static empty() {
507
+ return VasControlModel.fromDto({
508
+ // eslint-disable-next-line new-cap
509
+ id: UUID.UUID()
510
+ });
511
+ }
512
+ /**
513
+ * @param {VasControlDto} dto
514
+ * @return {VasControlModel}
515
+ */
516
+ static fromDto(dto) {
517
+ const handleControlType = (c) => {
518
+ if (c === undefined) {
519
+ return VasControlTypeModel.empty();
520
+ }
521
+ else if (typeof c === 'string') {
522
+ return c;
523
+ }
524
+ else {
525
+ return VasControlTypeModel.fromDto(c);
526
+ }
527
+ };
528
+ return new VasControlModel(
529
+ // eslint-disable-next-line new-cap
530
+ dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', handleControlType(dto.controlType), dto.group || '', dto.validators || [], dto.name || '', dto.title || '', dto.linkable || false, dto.sequence || 0, dto.description || '', dto.defaultValue || '', JSON.parse(dto.config || '{}'), dto.descriptionImage || '', dto.portalEnabled || false);
531
+ }
532
+ /**
533
+ * @param {string} value
534
+ * @return {VasControlModelDefaultValueType}
535
+ */
536
+ parseMaybeJson(value) {
537
+ if (typeof value !== 'string') {
538
+ return value;
539
+ }
540
+ try {
541
+ return JSON.parse(value);
542
+ }
543
+ catch (e) {
544
+ return value;
545
+ }
546
+ }
547
+ /**
548
+ * @return {VasControlDto}
549
+ */
550
+ toDto() {
551
+ return {
552
+ id: this.id,
553
+ created: this.created,
554
+ serverCreated: this.serverCreated,
555
+ createdBy: this.createdBy,
556
+ modified: this.modified,
557
+ serverModified: this.serverModified,
558
+ modifiedBy: this.modifiedBy,
559
+ createdByName: this.createdByName,
560
+ modifiedByName: this.modifiedByName,
561
+ account: this.account,
562
+ accessGroup: this.accessGroup,
563
+ controlType: this.controlType.toDto(),
564
+ group: this.group,
565
+ validators: this.validators,
566
+ name: this.name,
567
+ title: this.title,
568
+ linkable: this.linkable,
569
+ sequence: this.sequence,
570
+ description: this.description,
571
+ defaultValue: this.defaultValue,
572
+ config: JSON.stringify(this.config),
573
+ descriptionImage: this.descriptionImage,
574
+ portalEnabled: this.portalEnabled
575
+ };
576
+ }
577
+ toApiDto(options) {
578
+ return {
579
+ ...super.toApiDto(),
580
+ title: this.title || '~',
581
+ name: this.title || '~',
582
+ portalEnabled: this.portalEnabled,
583
+ };
584
+ }
585
+ }
586
+
587
+ /**
588
+ * VasJobDataModel
589
+ */
590
+ class VasJobDataModel extends VasAccountObjectModel {
591
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job) {
592
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
593
+ this.id = id;
594
+ this.created = created;
595
+ this.serverCreated = serverCreated;
596
+ this.createdBy = createdBy;
597
+ this.modified = modified;
598
+ this.serverModified = serverModified;
599
+ this.modifiedBy = modifiedBy;
600
+ this.createdByName = createdByName;
601
+ this.modifiedByName = modifiedByName;
602
+ this.account = account;
603
+ this.job = job;
604
+ }
605
+ }
606
+
607
+ /**
608
+ * VasFieldModel
609
+ */
610
+ class VasFieldModel extends VasJobDataModel {
611
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, control, fieldJobPointers, value, version) {
612
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
613
+ this.id = id;
614
+ this.created = created;
615
+ this.serverCreated = serverCreated;
616
+ this.createdBy = createdBy;
617
+ this.modified = modified;
618
+ this.serverModified = serverModified;
619
+ this.modifiedBy = modifiedBy;
620
+ this.createdByName = createdByName;
621
+ this.modifiedByName = modifiedByName;
622
+ this.account = account;
623
+ this.job = job;
624
+ this.control = control;
625
+ this.fieldJobPointers = fieldJobPointers;
626
+ this.value = value;
627
+ this.version = version;
628
+ }
629
+ /**
630
+ * @param {VasFieldDto} fieldDto
631
+ * @return {VasFieldModel}
632
+ */
633
+ static fromDto(fieldDto) {
634
+ return new VasFieldModel(fieldDto.id || UUID.UUID(), fieldDto.created || '', fieldDto.serverCreated || '', fieldDto.createdBy || '', fieldDto.modified || '', fieldDto.serverModified || '', fieldDto.modifiedBy || '', fieldDto.createdByName || '', fieldDto.modifiedByName || '', fieldDto.account || '', fieldDto.job || '', fieldDto.control || '', fieldDto.fieldJobPointers || [], fieldDto.value || '', fieldDto.version || 0);
635
+ }
636
+ /**
637
+ * @return {VasFieldDto}
638
+ */
639
+ toDto() {
640
+ return {
641
+ id: this.id,
642
+ created: this.created,
643
+ serverCreated: this.serverCreated,
644
+ createdBy: this.createdBy,
645
+ modified: this.modified,
646
+ serverModified: this.serverModified,
647
+ modifiedBy: this.modifiedBy,
648
+ createdByName: this.createdByName,
649
+ modifiedByName: this.modifiedByName,
650
+ account: this.account,
651
+ job: this.job,
652
+ control: this.control,
653
+ fieldJobPointers: this.fieldJobPointers,
654
+ value: this.value,
655
+ version: this.version,
656
+ };
657
+ }
658
+ /**
659
+ * @return {object}
660
+ */
661
+ toApiDto() {
662
+ return {
663
+ ...super.toApiDto(),
664
+ control: this.control,
665
+ value: this.prepareApiValue(this.value)
666
+ };
667
+ }
668
+ /**
669
+ * Prepares the value to be sent to the API. The api will only accept strings,
670
+ * numbers and booleans, thus if we have an array or object, we need to JSON
671
+ * encode it
672
+ * @param {VasFieldDto} value
673
+ * @return {string | number | boolean}
674
+ * @protected
675
+ */
676
+ prepareApiValue(value) {
677
+ switch (typeof value) {
678
+ case 'object': {
679
+ return JSON.stringify(value);
680
+ }
681
+ case 'boolean': {
682
+ return value;
683
+ }
684
+ case 'string': {
685
+ return value;
686
+ }
687
+ case 'number': {
688
+ return value;
689
+ }
690
+ default: {
691
+ return '';
692
+ }
693
+ }
694
+ }
695
+ }
696
+
697
+ function isFileDto(object) {
698
+ return object instanceof Object
699
+ && 'url' in object
700
+ && 'uri' in object
701
+ && 'message' in object
702
+ && 'status' in object
703
+ && 'controlPath' in object;
704
+ }
705
+
706
+ /**
707
+ * VasFileDto
708
+ */
709
+ class VasFileModel extends VasJobDataModel {
710
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, name, fileSize, mimeType, sequence, config, url, controlPath, message, status, uri) {
711
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
712
+ this.id = id;
713
+ this.created = created;
714
+ this.serverCreated = serverCreated;
715
+ this.createdBy = createdBy;
716
+ this.modified = modified;
717
+ this.serverModified = serverModified;
718
+ this.modifiedBy = modifiedBy;
719
+ this.createdByName = createdByName;
720
+ this.modifiedByName = modifiedByName;
721
+ this.account = account;
722
+ this.job = job;
723
+ this.name = name;
724
+ this.fileSize = fileSize;
725
+ this.mimeType = mimeType;
726
+ this.sequence = sequence;
727
+ this.config = config;
728
+ this.url = url;
729
+ this.controlPath = controlPath;
730
+ this.message = message;
731
+ this.status = status;
732
+ this.uri = uri;
733
+ }
734
+ static empty() {
735
+ return new VasFileModel('', '', '', '', '', '', '', '', '', '', '', '', 0, '', 0, {
736
+ displayAs: 'grid',
737
+ embedLink: false,
738
+ group: 'photo',
739
+ description: '',
740
+ displayedName: '',
741
+ rotation: 0
742
+ }, '', '', '', '', '');
743
+ }
744
+ static fromDto(dto) {
745
+ return new VasFileModel(dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job || '', dto.name || '', dto.fileSize || 0, dto.mimeType || '', dto.sequence || 0, VasFileModel.parseConfig(dto.config), dto.url || '', dto.controlPath || '', dto.message || '', dto.status || '', dto.uri || '');
746
+ }
747
+ static parseConfig(config = '') {
748
+ try {
749
+ return JSON.parse(config);
750
+ }
751
+ catch (e) {
752
+ return {
753
+ displayAs: 'grid',
754
+ embedLink: false,
755
+ group: 'photo',
756
+ description: '',
757
+ displayedName: '',
758
+ rotation: 0
759
+ };
760
+ }
761
+ }
762
+ /**
763
+ * @return {VasFileDto}
764
+ */
765
+ toDto() {
766
+ return {
767
+ id: this.id,
768
+ created: this.created,
769
+ serverCreated: this.serverCreated,
770
+ createdBy: this.createdBy,
771
+ modified: this.modified,
772
+ serverModified: this.serverModified,
773
+ modifiedBy: this.modifiedBy,
774
+ createdByName: this.createdByName,
775
+ modifiedByName: this.modifiedByName,
776
+ account: this.account,
777
+ job: this.job,
778
+ name: this.name,
779
+ fileSize: this.fileSize,
780
+ mimeType: this.mimeType,
781
+ sequence: this.sequence,
782
+ config: this.stringifyConfig(this.config),
783
+ url: this.url,
784
+ controlPath: this.controlPath,
785
+ message: this.message,
786
+ status: this.status,
787
+ uri: this.uri,
788
+ };
789
+ }
790
+ stringifyConfig(config) {
791
+ if (!config) {
792
+ return JSON.stringify({
793
+ displayAs: 'grid',
794
+ embedLink: false,
795
+ group: 'photo',
796
+ description: '',
797
+ displayedName: '',
798
+ rotation: 0
799
+ });
800
+ }
801
+ try {
802
+ return JSON.stringify(config);
803
+ }
804
+ catch (e) {
805
+ console.warn(e);
806
+ return '';
807
+ }
808
+ }
809
+ toApiDto(options = { contentUploaded: false }) {
810
+ const apiDto = {
811
+ ...super.toApiDto(),
812
+ name: this.name || '~',
813
+ mimeType: this.mimeType || '~',
814
+ sequence: this.safeNumber(this.sequence),
815
+ config: JSON.stringify(this.config)
816
+ };
817
+ if (options.contentUploaded) {
818
+ apiDto['original'] = this.id;
819
+ }
820
+ return apiDto;
821
+ }
822
+ safeNumber(value) {
823
+ if (!Number.isFinite(value)) {
824
+ return 0;
825
+ }
826
+ return value;
827
+ }
828
+ }
829
+
830
+ /**
831
+ * GroupModel
832
+ */
833
+ class VasGroupModel extends VasBaseModel {
834
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, name, title, description, sequence, includeInSummary, forms, visibilityControl, visibleIfEquals, controls, scoreWeight) {
835
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
836
+ this.id = id;
837
+ this.created = created;
838
+ this.serverCreated = serverCreated;
839
+ this.createdBy = createdBy;
840
+ this.modified = modified;
841
+ this.serverModified = serverModified;
842
+ this.modifiedBy = modifiedBy;
843
+ this.createdByName = createdByName;
844
+ this.modifiedByName = modifiedByName;
845
+ this.account = account;
846
+ this.accessGroup = accessGroup;
847
+ this.name = name;
848
+ this.title = title;
849
+ this.description = description;
850
+ this.sequence = sequence;
851
+ this.includeInSummary = includeInSummary;
852
+ this.forms = forms;
853
+ this.visibilityControl = visibilityControl;
854
+ this.visibleIfEquals = visibleIfEquals;
855
+ this.controls = controls;
856
+ this.scoreWeight = scoreWeight;
857
+ }
858
+ /**
859
+ * @param {VasGroupDto} dto
860
+ * @return {VasGroupModel}
861
+ */
862
+ static fromDto(dto) {
863
+ return new VasGroupModel(
864
+ // eslint-disable-next-line new-cap
865
+ dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.name || '', dto.title || '', dto.description || '', dto.sequence || 0, dto.includeInSummary || false, dto.forms || [], dto.visibilityControl || '', dto.visibleIfEquals || '', (dto.controls || [])
866
+ .filter(control => control.name.startsWith('fields.'))
867
+ .sort((a, b) => a.sequence - b.sequence)
868
+ .map(c => VasControlModel.fromDto(c)), dto.scoreWeight || 1);
869
+ }
870
+ /**
871
+ * @param {Array<VasControlModel>} valuesByControlId
872
+ * @return {boolean}
873
+ */
874
+ isVisible(valuesByControlId) {
875
+ if (!this.visibilityControl || !this.visibleIfEquals) {
876
+ return true;
877
+ }
878
+ const control = valuesByControlId
879
+ .find(c => c.id === this.visibilityControl);
880
+ if (!control) {
881
+ console.warn(`control with id ${this.visibilityControl} not found`);
882
+ return true;
883
+ }
884
+ return (control.value || '').toString() === this.visibleIfEquals;
885
+ }
886
+ /**
887
+ * @return {VasGroupDto}
888
+ */
889
+ toDto() {
890
+ return {
891
+ id: this.id,
892
+ created: this.created,
893
+ serverCreated: this.serverCreated,
894
+ createdBy: this.createdBy,
895
+ modified: this.modified,
896
+ serverModified: this.serverModified,
897
+ modifiedBy: this.modifiedBy,
898
+ createdByName: this.createdByName,
899
+ modifiedByName: this.modifiedByName,
900
+ account: this.account,
901
+ accessGroup: this.accessGroup,
902
+ name: this.name,
903
+ title: this.title,
904
+ description: this.description,
905
+ sequence: this.sequence,
906
+ includeInSummary: this.includeInSummary,
907
+ forms: this.forms,
908
+ visibilityControl: this.visibilityControl,
909
+ visibleIfEquals: this.visibleIfEquals,
910
+ controls: this.controls.map(control => control.toDto()),
911
+ scoreWeight: this.scoreWeight
912
+ };
913
+ }
914
+ }
915
+
916
+ /**
917
+ * VasFormModel
918
+ */
919
+ class VasFormModel extends VasRestrictedAccountObjectModel {
920
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, jobType, title, description, groups, dynamicDescriptor, indexName, pipelineName, config, geoLocationEnabled, filesEnabled) {
921
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
922
+ this.id = id;
923
+ this.created = created;
924
+ this.serverCreated = serverCreated;
925
+ this.createdBy = createdBy;
926
+ this.modified = modified;
927
+ this.serverModified = serverModified;
928
+ this.modifiedBy = modifiedBy;
929
+ this.createdByName = createdByName;
930
+ this.modifiedByName = modifiedByName;
931
+ this.account = account;
932
+ this.accessGroup = accessGroup;
933
+ this.jobType = jobType;
934
+ this.title = title;
935
+ this.description = description;
936
+ this.groups = groups;
937
+ this.dynamicDescriptor = dynamicDescriptor;
938
+ this.indexName = indexName;
939
+ this.pipelineName = pipelineName;
940
+ this.config = config;
941
+ this.geoLocationEnabled = geoLocationEnabled;
942
+ this.filesEnabled = filesEnabled;
943
+ }
944
+ /**
945
+ * Returns the name of this form in a "safe" way, i.e. no spaces, special
946
+ * characters
947
+ * @return {string}
948
+ */
949
+ get safeTitle() {
950
+ return this.title
951
+ .replace(/[^a-z0-9]/gi, '-')
952
+ .replace(/-+/g, '-')
953
+ .toLowerCase();
954
+ }
955
+ /**
956
+ * The VAS API response for Form will inline Group and Control but not
957
+ * ControlType. This method is a help which will allows us to construct an
958
+ * instance of VasFormModel with the ControlType model set appropriately into
959
+ * each VasControlModel
960
+ * @param {VasFormDto} formDto
961
+ * @param {Array<VasControlTypeDto>} controlTypeDtos
962
+ * @return {VasFormModel}
963
+ * @deprecated vas-rest has been updated to inline control types into the
964
+ * control so this method is no longer required. use VasFormModel.fromDto()
965
+ */
966
+ static fromApiResponse(formDto, controlTypeDtos) {
967
+ const controlTypeModels = controlTypeDtos
968
+ .map(ctDto => VasControlTypeModel.fromDto(ctDto));
969
+ const formModel = VasFormModel.fromDto(formDto);
970
+ formModel.groups
971
+ .forEach(group => {
972
+ group.controls
973
+ .forEach(control => {
974
+ // Note that we are forcing types here. This is because we have
975
+ // updated the typings for ControlModel and ControlDto to reflect
976
+ // the fact that VASREST is updating the response from certain
977
+ // controllers to inline ControlType into the Control. Consumers of
978
+ // the library will know what version of the API they are consuming
979
+ // so can decide when to migrate away from fromApiResponse, and can
980
+ // use fromDto instead
981
+ control.controlType = controlTypeModels
982
+ .find(ct => ct.id === (control.controlTypeId));
983
+ });
984
+ });
985
+ return formModel;
986
+ }
987
+ static empty() {
988
+ return VasFormModel.fromDto({});
989
+ }
990
+ /**
991
+ * @param {VasFormDto} dto
992
+ * @return {VasFormModel}
993
+ */
994
+ static fromDto(dto) {
995
+ return new VasFormModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.jobType || '', dto.title || '', dto.description || '', (dto.groups || [])
996
+ .sort((a, b) => a.sequence - b.sequence)
997
+ .map(g => VasGroupModel.fromDto(g)), dto.dynamicDescriptor || '', dto.indexName || '', dto.pipelineName || '', dto.config || '', dto.geoLocationEnabled || false, dto.filesEnabled || false);
998
+ }
999
+ /**
1000
+ * @param {string} id
1001
+ * @return {VasControlModel | undefined}
1002
+ */
1003
+ findControlModelById(id) {
1004
+ let result;
1005
+ this.groups
1006
+ .find(group => group.controls
1007
+ .find(control => {
1008
+ if (control.id !== id) {
1009
+ return;
1010
+ }
1011
+ result = control;
1012
+ return true;
1013
+ }));
1014
+ return result;
1015
+ }
1016
+ /**
1017
+ *
1018
+ * @param {string} name
1019
+ * @return {VasControlModel | undefined}
1020
+ */
1021
+ findControlModelByName(name) {
1022
+ let result;
1023
+ this.groups
1024
+ .find(group => group.controls
1025
+ .find(control => {
1026
+ if (control.name !== name) {
1027
+ return;
1028
+ }
1029
+ result = control;
1030
+ return true;
1031
+ }));
1032
+ return result;
1033
+ }
1034
+ /**
1035
+ *
1036
+ * @return {Array<Array<string>>}
1037
+ */
1038
+ getCameraControlPaths() {
1039
+ const paths = [];
1040
+ this.groups.forEach(group => {
1041
+ group.controls.forEach(control => {
1042
+ if (control.controlTypeName !== 'camera') {
1043
+ return;
1044
+ }
1045
+ paths.push([group.name, control.safeName]);
1046
+ });
1047
+ });
1048
+ return paths;
1049
+ }
1050
+ /**
1051
+ * @param {VasJobModel} jobModel
1052
+ * @return {Array<{id: string, value: VasFieldDtoValue}>}
1053
+ */
1054
+ getValuesByControlId(jobModel) {
1055
+ const items = [];
1056
+ this.groups
1057
+ .forEach(group => {
1058
+ group.controls
1059
+ .forEach(control => {
1060
+ items.push({
1061
+ id: control.id,
1062
+ value: jobModel.getValueByPath([group.name, control.safeName])
1063
+ });
1064
+ });
1065
+ });
1066
+ return items;
1067
+ }
1068
+ /**
1069
+ * @return {VasFormDto}
1070
+ */
1071
+ toDto() {
1072
+ return {
1073
+ id: this.id,
1074
+ created: this.created,
1075
+ serverCreated: this.serverCreated,
1076
+ createdBy: this.createdBy,
1077
+ modified: this.modified,
1078
+ serverModified: this.serverModified,
1079
+ modifiedBy: this.modifiedBy,
1080
+ createdByName: this.createdByName,
1081
+ modifiedByName: this.modifiedByName,
1082
+ account: this.account,
1083
+ accessGroup: this.accessGroup,
1084
+ jobType: this.jobType,
1085
+ title: this.title,
1086
+ description: this.description,
1087
+ groups: this.groups.map(group => group.toDto()),
1088
+ dynamicDescriptor: this.dynamicDescriptor,
1089
+ indexName: this.indexName,
1090
+ pipelineName: this.pipelineName,
1091
+ config: this.config,
1092
+ geoLocationEnabled: this.geoLocationEnabled,
1093
+ filesEnabled: this.filesEnabled
1094
+ };
1095
+ }
1096
+ }
1097
+
1098
+ var VasInvitationTypeEnum;
1099
+ (function (VasInvitationTypeEnum) {
1100
+ VasInvitationTypeEnum["TYPE_VAS_DESKTOP"] = "vas-desktop";
1101
+ VasInvitationTypeEnum["TYPE_VAS_MOBILE"] = "vas-mobile";
1102
+ VasInvitationTypeEnum["TYPE_VAS_PORTAL"] = "vas-portal";
1103
+ VasInvitationTypeEnum["TYPE_P2C_DESKTOP"] = "p2c-desktop";
1104
+ VasInvitationTypeEnum["TYPE_P2C_MOBILE"] = "p2c-mobile";
1105
+ })(VasInvitationTypeEnum || (VasInvitationTypeEnum = {}));
1106
+ class VasInvitationModel extends VasAccountObjectModel {
1107
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, secret, type, accessGroups, contactTypes, jobStatuses, jobTypes, lookupTypes, taskTypes, instructionProviders) {
1108
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
1109
+ this.id = id;
1110
+ this.created = created;
1111
+ this.serverCreated = serverCreated;
1112
+ this.createdBy = createdBy;
1113
+ this.modified = modified;
1114
+ this.serverModified = serverModified;
1115
+ this.modifiedBy = modifiedBy;
1116
+ this.createdByName = createdByName;
1117
+ this.modifiedByName = modifiedByName;
1118
+ this.account = account;
1119
+ this.secret = secret;
1120
+ this.type = type;
1121
+ this.accessGroups = accessGroups;
1122
+ this.contactTypes = contactTypes;
1123
+ this.jobStatuses = jobStatuses;
1124
+ this.jobTypes = jobTypes;
1125
+ this.lookupTypes = lookupTypes;
1126
+ this.taskTypes = taskTypes;
1127
+ this.instructionProviders = instructionProviders;
1128
+ }
1129
+ toDto() {
1130
+ return {
1131
+ id: this.id,
1132
+ created: this.created,
1133
+ serverCreated: this.serverCreated,
1134
+ createdBy: this.createdBy,
1135
+ modified: this.modified,
1136
+ serverModified: this.serverModified,
1137
+ modifiedBy: this.modifiedBy,
1138
+ createdByName: this.createdByName,
1139
+ modifiedByName: this.modifiedByName,
1140
+ account: this.account,
1141
+ secret: this.secret,
1142
+ type: this.type,
1143
+ accessGroups: this.accessGroups,
1144
+ contactTypes: this.contactTypes,
1145
+ jobStatuses: this.jobStatuses,
1146
+ jobTypes: this.jobTypes,
1147
+ lookupTypes: this.lookupTypes,
1148
+ taskTypes: this.taskTypes,
1149
+ instructionProviders: this.instructionProviders,
1150
+ };
1151
+ }
1152
+ static fromDto(dto) {
1153
+ return new VasInvitationModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.secret || '', dto.type || VasInvitationTypeEnum.TYPE_VAS_PORTAL, dto.accessGroups || [], dto.contactTypes || [], dto.jobStatuses || [], dto.jobTypes || [], dto.lookupTypes || [], dto.taskTypes || [], dto.instructionProviders || []);
1154
+ }
1155
+ toApiDto(options) {
1156
+ const dto = {
1157
+ ...super.toApiDto(),
1158
+ type: this.type
1159
+ };
1160
+ if (this.accessGroups.length) {
1161
+ dto['accessGroups'] = this.accessGroups.map(d => d.id);
1162
+ }
1163
+ if (this.contactTypes.length) {
1164
+ dto['contactTypes'] = this.contactTypes.map(d => d.id);
1165
+ }
1166
+ if (this.jobStatuses.length) {
1167
+ dto['jobStatuses'] = this.jobStatuses.map(d => d.id);
1168
+ }
1169
+ if (this.jobTypes.length) {
1170
+ dto['jobTypes'] = this.jobTypes.map(d => d.id);
1171
+ }
1172
+ if (this.lookupTypes.length) {
1173
+ dto['lookupTypes'] = this.lookupTypes.map(d => d.id);
1174
+ }
1175
+ if (this.taskTypes.length) {
1176
+ dto['taskTypes'] = this.taskTypes.map(d => d.id);
1177
+ }
1178
+ if (this.instructionProviders.length) {
1179
+ dto['instructionProviders'] = this.instructionProviders.map(d => d.id);
1180
+ }
1181
+ return dto;
1182
+ }
1183
+ }
1184
+
1185
+ /**
1186
+ * VasNoteModel
1187
+ */
1188
+ class VasNoteModel extends VasJobDataModel {
1189
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, content, sensitive) {
1190
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
1191
+ this.id = id;
1192
+ this.created = created;
1193
+ this.serverCreated = serverCreated;
1194
+ this.createdBy = createdBy;
1195
+ this.modified = modified;
1196
+ this.serverModified = serverModified;
1197
+ this.modifiedBy = modifiedBy;
1198
+ this.createdByName = createdByName;
1199
+ this.modifiedByName = modifiedByName;
1200
+ this.account = account;
1201
+ this.job = job;
1202
+ this.content = content;
1203
+ this.sensitive = sensitive;
1204
+ }
1205
+ /**
1206
+ * @param dto VasNoteDto
1207
+ * @return VasNoteModel
1208
+ */
1209
+ static fromDto(dto) {
1210
+ return new VasNoteModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job || '', dto.content || '', dto.sensitive || false);
1211
+ }
1212
+ /**
1213
+ * @returns VasNoteDto
1214
+ */
1215
+ toDto() {
1216
+ return {
1217
+ id: this.id,
1218
+ created: this.created,
1219
+ serverCreated: this.serverCreated,
1220
+ createdBy: this.createdBy,
1221
+ modified: this.modified,
1222
+ serverModified: this.serverModified,
1223
+ modifiedBy: this.modifiedBy,
1224
+ createdByName: this.createdByName,
1225
+ modifiedByName: this.modifiedByName,
1226
+ account: this.account,
1227
+ job: this.job,
1228
+ content: this.content,
1229
+ sensitive: this.sensitive,
1230
+ };
1231
+ }
1232
+ }
1233
+
1234
+ /**
1235
+ * VasInstructionJobFieldModel
1236
+ */
1237
+ class VasInstructionJobFieldModel extends VasBaseModel {
1238
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, value, name, title, sequence, controlType) {
1239
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
1240
+ this.id = id;
1241
+ this.created = created;
1242
+ this.serverCreated = serverCreated;
1243
+ this.createdBy = createdBy;
1244
+ this.modified = modified;
1245
+ this.serverModified = serverModified;
1246
+ this.modifiedBy = modifiedBy;
1247
+ this.createdByName = createdByName;
1248
+ this.modifiedByName = modifiedByName;
1249
+ this.value = value;
1250
+ this.name = name;
1251
+ this.title = title;
1252
+ this.sequence = sequence;
1253
+ this.controlType = controlType;
1254
+ }
1255
+ static empty() {
1256
+ return new VasInstructionJobFieldModel('', '', '', '', '', '', '', '', '', '', '', '', 0, '');
1257
+ }
1258
+ static fromDto(dto) {
1259
+ return new VasInstructionJobFieldModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.value || '', dto.name || '', dto.title || '', dto.sequence || 0, dto.controlType || '');
1260
+ }
1261
+ toDto() {
1262
+ return {
1263
+ id: this.id,
1264
+ created: this.created,
1265
+ serverCreated: this.serverCreated,
1266
+ createdBy: this.createdBy,
1267
+ modified: this.modified,
1268
+ serverModified: this.serverModified,
1269
+ modifiedBy: this.modifiedBy,
1270
+ createdByName: this.createdByName,
1271
+ modifiedByName: this.modifiedByName,
1272
+ value: this.value,
1273
+ name: this.name,
1274
+ title: this.title,
1275
+ sequence: this.sequence,
1276
+ controlType: this.controlType
1277
+ };
1278
+ }
1279
+ }
1280
+
1281
+ class VasReportModel extends VasJobDataModel {
1282
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, reportLayoutId, title, sendEmail, message, attempted, completed, succeeded, attempts, notificationId) {
1283
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
1284
+ this.id = id;
1285
+ this.created = created;
1286
+ this.serverCreated = serverCreated;
1287
+ this.createdBy = createdBy;
1288
+ this.modified = modified;
1289
+ this.serverModified = serverModified;
1290
+ this.modifiedBy = modifiedBy;
1291
+ this.createdByName = createdByName;
1292
+ this.modifiedByName = modifiedByName;
1293
+ this.account = account;
1294
+ this.job = job;
1295
+ this.reportLayoutId = reportLayoutId;
1296
+ this.title = title;
1297
+ this.sendEmail = sendEmail;
1298
+ this.message = message;
1299
+ this.attempted = attempted;
1300
+ this.completed = completed;
1301
+ this.succeeded = succeeded;
1302
+ this.attempts = attempts;
1303
+ this.notificationId = notificationId;
1304
+ }
1305
+ static empty() {
1306
+ return VasReportModel.fromDto({});
1307
+ }
1308
+ static fromDto(dto) {
1309
+ return new VasReportModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job || '', dto.reportLayoutId || '', dto.title || '', dto.sendEmail || '', dto.message || '', dto.attempted || '', dto.completed || '', dto.succeeded || '', dto.attempts || 0, dto.notificationId || '');
1310
+ }
1311
+ toDto() {
1312
+ return {
1313
+ id: this.id,
1314
+ created: this.created,
1315
+ serverCreated: this.serverCreated,
1316
+ createdBy: this.createdBy,
1317
+ modified: this.modified,
1318
+ serverModified: this.serverModified,
1319
+ modifiedBy: this.modifiedBy,
1320
+ createdByName: this.createdByName,
1321
+ modifiedByName: this.modifiedByName,
1322
+ account: this.account,
1323
+ job: this.job,
1324
+ reportLayoutId: this.reportLayoutId,
1325
+ title: this.title,
1326
+ sendEmail: this.sendEmail,
1327
+ message: this.message,
1328
+ attempted: this.attempted,
1329
+ completed: this.completed,
1330
+ succeeded: this.succeeded,
1331
+ attempts: this.attempts,
1332
+ notificationId: this.notificationId,
1333
+ };
1334
+ }
1335
+ }
1336
+
1337
+ /**
1338
+ * VasNoteModel
1339
+ */
1340
+ class VasInstructionJobModel extends VasBaseModel {
1341
+ /**
1342
+ * @param id id
1343
+ * @param created created
1344
+ * @param serverCreated serverCreated
1345
+ * @param createdBy createdBy
1346
+ * @param modified modified
1347
+ * @param serverModified serverModified
1348
+ * @param modifiedBy modifiedBy
1349
+ * @param reference reference
1350
+ * @param jobStatus jobStatus
1351
+ * @param createdByName createdByName
1352
+ * @param modifiedByName modifiedByName
1353
+ * @param notes notes
1354
+ * @param fields fields
1355
+ * @param files files
1356
+ * @param reports reports
1357
+ */
1358
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, reference, jobStatus, notes, fields, files, reports) {
1359
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
1360
+ this.id = id;
1361
+ this.created = created;
1362
+ this.serverCreated = serverCreated;
1363
+ this.createdBy = createdBy;
1364
+ this.modified = modified;
1365
+ this.serverModified = serverModified;
1366
+ this.modifiedBy = modifiedBy;
1367
+ this.createdByName = createdByName;
1368
+ this.modifiedByName = modifiedByName;
1369
+ this.reference = reference;
1370
+ this.jobStatus = jobStatus;
1371
+ this.notes = notes;
1372
+ this.fields = fields;
1373
+ this.files = files;
1374
+ this.reports = reports;
1375
+ }
1376
+ /**
1377
+ * @return empty VasInstructionJobModel
1378
+ */
1379
+ static empty() {
1380
+ return new VasInstructionJobModel('', '', '', '', '', '', '', '', '', '', '', [], [], [], []);
1381
+ }
1382
+ /**
1383
+ * @param dto VasInstructionDto
1384
+ * @return VasInstructionModel
1385
+ */
1386
+ static fromDto(dto) {
1387
+ return new VasInstructionJobModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.reference || '', dto.jobStatus || '', dto.createdByName || '', dto.modifiedByName || '', (dto.notes || []).map(d => VasNoteModel.fromDto(d)), (dto.fields || []).map(d => VasInstructionJobFieldModel.fromDto(d)), (dto.files || []).map(d => VasFileModel.fromDto(d)), (dto.reports || []).map(d => VasReportModel.fromDto(d)));
1388
+ }
1389
+ /**
1390
+ * @returns VasNoteDto
1391
+ */
1392
+ toDto() {
1393
+ return {
1394
+ id: this.id,
1395
+ created: this.created,
1396
+ serverCreated: this.serverCreated,
1397
+ createdBy: this.createdBy,
1398
+ modified: this.modified,
1399
+ serverModified: this.serverModified,
1400
+ modifiedBy: this.modifiedBy,
1401
+ reference: this.reference,
1402
+ jobStatus: this.jobStatus,
1403
+ createdByName: this.createdByName,
1404
+ modifiedByName: this.modifiedByName,
1405
+ notes: this.notes.map(m => m.toDto()),
1406
+ fields: this.fields.map(m => m.toDto()),
1407
+ files: this.files.map(m => m.toDto()),
1408
+ reports: this.reports.map(m => m.toDto()),
1409
+ };
1410
+ }
1411
+ }
1412
+
1413
+ /**
1414
+ * VasInstructionProviderModel
1415
+ */
1416
+ class VasInstructionProviderModel extends VasAccountObjectModel {
1417
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, form, title, secret, portalEnabled) {
1418
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
1419
+ this.id = id;
1420
+ this.created = created;
1421
+ this.serverCreated = serverCreated;
1422
+ this.createdBy = createdBy;
1423
+ this.modified = modified;
1424
+ this.serverModified = serverModified;
1425
+ this.modifiedBy = modifiedBy;
1426
+ this.createdByName = createdByName;
1427
+ this.modifiedByName = modifiedByName;
1428
+ this.account = account;
1429
+ this.form = form;
1430
+ this.title = title;
1431
+ this.secret = secret;
1432
+ this.portalEnabled = portalEnabled;
1433
+ }
1434
+ /**
1435
+ * @param dto VasInstructionDto
1436
+ * @return VasInstructionModel
1437
+ */
1438
+ static fromDto(dto) {
1439
+ return new VasInstructionProviderModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.form ?
1440
+ VasFormModel.fromDto(dto.form) :
1441
+ VasFormModel.empty(), dto.title || '', dto.secret || '', dto.portalEnabled || false);
1442
+ }
1443
+ /**
1444
+ * @returns VasNoteDto
1445
+ */
1446
+ toDto() {
1447
+ return {
1448
+ id: this.id,
1449
+ created: this.created,
1450
+ serverCreated: this.serverCreated,
1451
+ createdBy: this.createdBy,
1452
+ modified: this.modified,
1453
+ serverModified: this.serverModified,
1454
+ modifiedBy: this.modifiedBy,
1455
+ createdByName: this.createdByName,
1456
+ modifiedByName: this.modifiedByName,
1457
+ account: this.account,
1458
+ form: this.form.toDto(),
1459
+ title: this.title,
1460
+ secret: this.secret,
1461
+ portalEnabled: this.portalEnabled
1462
+ };
1463
+ }
1464
+ toApiDto(options) {
1465
+ return {
1466
+ ...super.toApiDto(options),
1467
+ title: this.title,
1468
+ form: this.form.id,
1469
+ portalEnabled: this.portalEnabled
1470
+ };
1471
+ }
1472
+ }
1473
+
1474
+ /**
1475
+ * VasNoteModel
1476
+ */
1477
+ class VasInstructionModel extends VasAccountObjectModel {
1478
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, instructionProvider) {
1479
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
1480
+ this.id = id;
1481
+ this.created = created;
1482
+ this.serverCreated = serverCreated;
1483
+ this.createdBy = createdBy;
1484
+ this.modified = modified;
1485
+ this.serverModified = serverModified;
1486
+ this.modifiedBy = modifiedBy;
1487
+ this.createdByName = createdByName;
1488
+ this.modifiedByName = modifiedByName;
1489
+ this.account = account;
1490
+ this.job = job;
1491
+ this.instructionProvider = instructionProvider;
1492
+ }
1493
+ /**
1494
+ * @param dto VasInstructionDto
1495
+ * @return VasInstructionModel
1496
+ */
1497
+ static fromDto(dto) {
1498
+ return new VasInstructionModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.job ?
1499
+ VasInstructionJobModel.fromDto(dto.job) :
1500
+ VasInstructionJobModel.empty(), VasInstructionProviderModel.fromDto(dto.instructionProvider || {}));
1501
+ }
1502
+ /**
1503
+ * @returns VasNoteDto
1504
+ */
1505
+ toDto() {
1506
+ return {
1507
+ id: this.id,
1508
+ created: this.created,
1509
+ serverCreated: this.serverCreated,
1510
+ createdBy: this.createdBy,
1511
+ modified: this.modified,
1512
+ serverModified: this.serverModified,
1513
+ modifiedBy: this.modifiedBy,
1514
+ createdByName: this.createdByName,
1515
+ modifiedByName: this.modifiedByName,
1516
+ account: this.account,
1517
+ job: this.job.toDto(),
1518
+ instructionProvider: this.instructionProvider.toDto()
1519
+ };
1520
+ }
1521
+ }
1522
+
1523
+ /**
1524
+ * A non sophisticated way to get values from the job via paths. For example:
1525
+ *
1526
+ * getValueByPath(
1527
+ * ['foo', 'bar'],
1528
+ * {
1529
+ * foo: {
1530
+ * bar: 'value'
1531
+ * }
1532
+ * }
1533
+ * );
1534
+ *
1535
+ * will return "value"
1536
+ * @param {string[]} path
1537
+ * @param {Record<string, VasFieldDtoValue>} object
1538
+ * @return {T | undefined}
1539
+ */
1540
+ const getValueByPath = (path, object) => {
1541
+ switch (path.length) {
1542
+ case 0: {
1543
+ return;
1544
+ }
1545
+ case 1: {
1546
+ return (object)[path[0]];
1547
+ }
1548
+ case 2: {
1549
+ const val0 = object[path[0]];
1550
+ if (!val0) {
1551
+ return undefined;
1552
+ }
1553
+ return val0[path[1]];
1554
+ }
1555
+ case 3: {
1556
+ const val0 = object[path[0]];
1557
+ if (!val0) {
1558
+ return undefined;
1559
+ }
1560
+ const val1 = val0[path[1]];
1561
+ if (!val1) {
1562
+ return undefined;
1563
+ }
1564
+ return val1[path[2]];
1565
+ }
1566
+ case 4: {
1567
+ const val0 = object[path[0]];
1568
+ if (!val0) {
1569
+ return undefined;
1570
+ }
1571
+ const val1 = val0[path[1]];
1572
+ if (!val1) {
1573
+ return undefined;
1574
+ }
1575
+ const val2 = val1[path[2]];
1576
+ if (!val2) {
1577
+ return undefined;
1578
+ }
1579
+ return val2[path[3]];
1580
+ }
1581
+ default: {
1582
+ throw Error('path has too many segments');
1583
+ }
1584
+ }
1585
+ };
1586
+
1587
+ const getEmptyGeoLocation = () => ({
1588
+ accuracy: 0,
1589
+ altitude: 0,
1590
+ altitudeAccuracy: 0,
1591
+ geoPoint: [],
1592
+ lonLat: {
1593
+ lon: 0,
1594
+ lat: 0,
1595
+ },
1596
+ timestamp: ''
1597
+ });
1598
+
1599
+ const isArrayString = (value) => {
1600
+ return Array.isArray(value) && value.every(i => typeof i === 'string');
1601
+ };
1602
+
1603
+ /**
1604
+ * JobModel
1605
+ */
1606
+ class VasJobModel extends VasRestrictedAccountObjectModel {
1607
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, reference, jobDate, jobStatus, jobType, assigneeId, formId, timeZoneOffset, pendingFields, childModified, version, fields, files, createdByDisplayName, modifiedByDisplayName, geoLocation) {
1608
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
1609
+ this.id = id;
1610
+ this.created = created;
1611
+ this.serverCreated = serverCreated;
1612
+ this.createdBy = createdBy;
1613
+ this.modified = modified;
1614
+ this.serverModified = serverModified;
1615
+ this.modifiedBy = modifiedBy;
1616
+ this.createdByName = createdByName;
1617
+ this.modifiedByName = modifiedByName;
1618
+ this.account = account;
1619
+ this.accessGroup = accessGroup;
1620
+ this.reference = reference;
1621
+ this.jobDate = jobDate;
1622
+ this.jobStatus = jobStatus;
1623
+ this.jobType = jobType;
1624
+ this.assigneeId = assigneeId;
1625
+ this.formId = formId;
1626
+ this.timeZoneOffset = timeZoneOffset;
1627
+ this.pendingFields = pendingFields;
1628
+ this.childModified = childModified;
1629
+ this.version = version;
1630
+ this.fields = fields;
1631
+ this.files = files;
1632
+ this.createdByDisplayName = createdByDisplayName;
1633
+ this.modifiedByDisplayName = modifiedByDisplayName;
1634
+ this.geoLocation = geoLocation;
1635
+ }
1636
+ /**
1637
+ * Returns this with the dynamic interface
1638
+ * @return {VasJobModelDynamicInterface}
1639
+ */
1640
+ get $this() {
1641
+ return this;
1642
+ }
1643
+ /**
1644
+ * Returns a list of Job dynamic properties i.e. those that are added by the
1645
+ * dynamic forms
1646
+ */
1647
+ get dynamicProperties() {
1648
+ const nativeProps = this.staticProperties;
1649
+ return Object
1650
+ .getOwnPropertyNames(this)
1651
+ .filter(prop => !nativeProps.includes(prop));
1652
+ }
1653
+ /**
1654
+ * Returns a list of Job static properties i.e. those that are declared by
1655
+ * the type
1656
+ */
1657
+ get staticProperties() {
1658
+ return Object.getOwnPropertyNames(VasJobModel.empty());
1659
+ }
1660
+ /**
1661
+ * @return {VasJobModel}
1662
+ */
1663
+ static empty() {
1664
+ return new VasJobModel('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', moment$1().utcOffset(), 0, '', 0, [], [], '', '', getEmptyGeoLocation());
1665
+ }
1666
+ static fromDto(dto) {
1667
+ const model = new VasJobModel(dto.id || '', dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.accessGroup || '', dto.reference || '', dto.jobDate || '', dto.jobStatus || '', dto.jobType || '', dto.assigneeId || '', dto.formId || '', dto.timeZoneOffset || moment$1().utcOffset(), dto.pendingFields || 0, dto.childModified || '', dto.version || 0, dto.fields || [], dto.files || [], dto.createdByDisplayName || '', dto.modifiedByDisplayName || '', dto.geoLocation || getEmptyGeoLocation());
1668
+ const emptyKeys = model.staticProperties;
1669
+ Object
1670
+ .keys(dto)
1671
+ .filter(key => emptyKeys.indexOf(key) === -1)
1672
+ .forEach((key) => model.$this[key] = dto[key]);
1673
+ return model;
1674
+ }
1675
+ /**
1676
+ * @param {VasFormModel} formModel
1677
+ * @return {Record<string, VasFieldDtoValue>}
1678
+ */
1679
+ getFields(formModel) {
1680
+ const fields = {};
1681
+ formModel.groups
1682
+ .forEach(group => {
1683
+ group.controls.forEach(control => {
1684
+ (fields)[control.reportTemplateName] =
1685
+ this.getValueByPath([group.name, control.name]);
1686
+ });
1687
+ });
1688
+ return fields;
1689
+ }
1690
+ /**
1691
+ * Will return an object whose keys are the names of all fields in the job.
1692
+ * This method is similar to `getFields` except that this method will only
1693
+ * return values where a value was set, as opposed to `getFields` which
1694
+ * return a property regardless (because it uses the form to drive the logic)
1695
+ * @return {Record<string, VasFieldDtoValue>}
1696
+ */
1697
+ getFields2() {
1698
+ let fields = {};
1699
+ this.dynamicProperties
1700
+ .forEach((groupName) => {
1701
+ Object
1702
+ .keys(this.$this[groupName])
1703
+ .forEach(controlName => {
1704
+ fields[controlName] = this.getValueByPath([groupName, controlName]);
1705
+ });
1706
+ }, {});
1707
+ return fields;
1708
+ }
1709
+ /**
1710
+ * Returns an object describing how many attachments were added to this job
1711
+ * (camera controls and files), and how many have not been uploaded yet.
1712
+ *
1713
+ * @param formModel instance of {@link VasFormModel} that was used when the
1714
+ * job was created
1715
+ */
1716
+ getFilesUploadStatus(formModel) {
1717
+ const pathsWithValue = formModel
1718
+ .getCameraControlPaths()
1719
+ .map(path => {
1720
+ const value = this.getValueByPath(path);
1721
+ if (value && !!value.id) {
1722
+ return path;
1723
+ }
1724
+ return null;
1725
+ })
1726
+ .filter(path => path !== null ? path : null)
1727
+ .filter(isArrayString);
1728
+ let total = pathsWithValue.length;
1729
+ total += this.files.length;
1730
+ // calculate the number of camera images still to upload
1731
+ let pending = pathsWithValue
1732
+ .map(path => this.getValueByPath(path))
1733
+ .map((value) => {
1734
+ if (isFileDto(value)) {
1735
+ return value.id && value.status !== 'COMPLETE';
1736
+ }
1737
+ else if (isCameraControlValueV1(value)) {
1738
+ // if url is not set, it hasn't been uploaded
1739
+ return value.id && !value.url;
1740
+ }
1741
+ return false;
1742
+ })
1743
+ .filter(hasUploaded => hasUploaded)
1744
+ .length;
1745
+ // add total from files that are pending
1746
+ pending += this.files
1747
+ .filter(value => value.status !== 'COMPLETED')
1748
+ .length;
1749
+ return {
1750
+ pending,
1751
+ total
1752
+ };
1753
+ }
1754
+ /**
1755
+ * This method will hydrate the `fields` property of the model. The reason for
1756
+ * this is that we have different ways to store the field data. One way, is
1757
+ * we store them as dynamic properties of the job. For example job.foo.bar,
1758
+ * where `foo` is the name of a Group, and `bar` is the name of a control.
1759
+ * Thus, when we create a job using a form in the client, the job object will
1760
+ * have its static properties (id, account, reference etc), and also a number
1761
+ * of dynamic properties determined by the Groups and Controls. This kind of
1762
+ * object is nice to work with in certain circumstances. However, the api
1763
+ * works differently. In the API a Job is a record, and references a number of
1764
+ * Field records. Each Field stores the value. Comparing these two models we
1765
+ * have:
1766
+ * A) job with dynamic properties, e.g.
1767
+ * {
1768
+ * id: <guid>,
1769
+ * reference: "something"
1770
+ * <other static job properties>...
1771
+ * foo: {
1772
+ * bar: "value"
1773
+ * }
1774
+ * }
1775
+ *
1776
+ * B) job with fields
1777
+ * {
1778
+ * id: <guid>,
1779
+ * reference: "something"
1780
+ * <other static job properties>...
1781
+ * <will not have dynamic properties>...
1782
+ * fields: [
1783
+ * {
1784
+ * id: <guid>,
1785
+ * <other field properties>,
1786
+ * value: "value"
1787
+ * }
1788
+ * ]
1789
+ * }
1790
+ *
1791
+ * So, what this method does is given a JobModel in the form of A, read all
1792
+ * of those dynamic properties and set them into `fields`. Doing this requires
1793
+ * knowledge of the Form that was used to create the job. Moreover, since the
1794
+ * dynamic properties do not contain the ids of the fields, we also allow to
1795
+ * pass in a `controlFieldIdMap`. This map stores the mapping between Control
1796
+ * and the Field that was created in the Job to store the value for that
1797
+ * Control. This is useful, if for example you want to compare a Job in form A
1798
+ * with a Job in form B, for example if you want to update the Job on the API
1799
+ * with a Job that was saved by a client in form A.
1800
+ *
1801
+ * E.g.
1802
+ * Client -> API: client requests form
1803
+ * User -> Client: user fills in the form and submits
1804
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1805
+ * Firestore -> Function: A function is triggered to sync the job to the API
1806
+ * Function -> API: Function checks if job already exists, it receives 404
1807
+ * Function -> Function: The function calls `hydrateFields(...)`
1808
+ * Function -> API: The function POST the Job to /jobs
1809
+ * Function -> API: The function POST each field to /fields
1810
+ *
1811
+ * Similarly, if the user updates the job
1812
+ * Client -> API: client requests form
1813
+ * User -> Client: user fills in the form and submits an update
1814
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1815
+ * Firestore -> Function: A function is triggered to sync the job to the API
1816
+ * Function -> API: Function checks if job already exists, it receives 200
1817
+ * Function -> Function: The function calls `hydrateFields(...)` passing in
1818
+ * the map is made by iterating over the fields it
1819
+ * received from the API and storing the mappings
1820
+ * between controlId and fieldId for each field
1821
+ * Function -> API: The function PATCH the Job to /jobs
1822
+ * Function -> API: The function POST/PATCH each field to /fields
1823
+ * treated as new
1824
+ *
1825
+ * @param {VasFormModel} formModel the VasFormModel that was used to create
1826
+ * the job
1827
+ * @param {Map<string, string>} controlFieldIdMap a mapping of control to
1828
+ * field ids. This is used to determine whether a new id for the field should
1829
+ * be generated, or to reuse an existing one from the map.
1830
+ * @param {Array<string>} controlNames if a value is provided, it will be used
1831
+ * to filter the fields that are returned.
1832
+ * @return {Array<VasFieldDto>}
1833
+ */
1834
+ hydrateFields(formModel, controlFieldIdMap = new Map(), controlNames) {
1835
+ const fields = [];
1836
+ formModel.groups
1837
+ .forEach(group => {
1838
+ group.controls.forEach(control => {
1839
+ if (!control.name.startsWith('fields.')) {
1840
+ return;
1841
+ }
1842
+ if (controlNames && !controlNames.includes(control.name)) {
1843
+ return;
1844
+ }
1845
+ fields.push(VasFieldModel.fromDto({
1846
+ // if the controlId exists in the map, use the associated fieldId,
1847
+ // otherwise generate a new id for the field.
1848
+ id: controlFieldIdMap.get(control.id) || UUID.UUID(),
1849
+ account: this.account,
1850
+ job: this.id,
1851
+ createdBy: this.createdBy,
1852
+ created: this.created,
1853
+ modifiedBy: this.modifiedBy,
1854
+ modified: this.modified,
1855
+ control: control.id,
1856
+ value: this.getValueByPath([group.name, control.name])
1857
+ }));
1858
+ });
1859
+ });
1860
+ this.fields = fields;
1861
+ }
1862
+ /**
1863
+ * @param {string[]} path path segments
1864
+ * @return {void}
1865
+ */
1866
+ getValueByPath(path = []) {
1867
+ return getValueByPath(path, this.$this);
1868
+ }
1869
+ /**
1870
+ * A very non sophisticated way to set values in the job via paths
1871
+ *
1872
+ * For example:
1873
+ *
1874
+ * setValueByPath('value', ['foo', 'bar']);
1875
+ *
1876
+ * will make results in job
1877
+ * {
1878
+ * foo: {
1879
+ * bar: 'value'
1880
+ * }
1881
+ * }
1882
+ *
1883
+ * @param {any} value the value to set
1884
+ * @param {string[]} path path segments
1885
+ */
1886
+ setValueByPath(value, path = []) {
1887
+ switch (path.length) {
1888
+ case 0: {
1889
+ return;
1890
+ }
1891
+ case 1: {
1892
+ this[path[0]] = value;
1893
+ return;
1894
+ }
1895
+ case 2: {
1896
+ // eslint-disable-next-line max-len
1897
+ this.$this[path[0]][path[1]] = value;
1898
+ return;
1899
+ }
1900
+ case 3: {
1901
+ // eslint-disable-next-line max-len
1902
+ this.$this[path[0]][path[1]][path[2]] = value;
1903
+ return;
1904
+ }
1905
+ default: {
1906
+ throw Error('path has too many segments');
1907
+ }
1908
+ }
1909
+ }
1910
+ /**
1911
+ * @param {boolean} staticOnly if true, will only output values for the static
1912
+ * properties in the dto
1913
+ * @return {VasJobDto}
1914
+ */
1915
+ toDto(staticOnly = false) {
1916
+ if (staticOnly) {
1917
+ return {
1918
+ id: this.id,
1919
+ created: this.created,
1920
+ createdBy: this.createdBy,
1921
+ modified: this.modified,
1922
+ modifiedBy: this.modifiedBy,
1923
+ serverCreated: this.serverCreated,
1924
+ serverModified: this.serverModified,
1925
+ createdByName: this.createdByName,
1926
+ modifiedByName: this.modifiedByName,
1927
+ account: this.account,
1928
+ accessGroup: this.accessGroup,
1929
+ reference: this.reference,
1930
+ jobDate: this.jobDate,
1931
+ jobStatus: this.jobStatus,
1932
+ jobType: this.jobType,
1933
+ assigneeId: this.assigneeId,
1934
+ formId: this.formId,
1935
+ timeZoneOffset: this.timeZoneOffset,
1936
+ pendingFields: this.pendingFields,
1937
+ childModified: this.childModified,
1938
+ version: this.version,
1939
+ fields: this.fields,
1940
+ files: this.files,
1941
+ createdByDisplayName: this.createdByDisplayName,
1942
+ modifiedByDisplayName: this.modifiedByDisplayName,
1943
+ geoLocation: this.geoLocation
1944
+ };
1945
+ }
1946
+ const dto = {};
1947
+ [...this.staticProperties, ...this.dynamicProperties]
1948
+ .forEach(prop => (dto)[prop] = this.$this[prop]);
1949
+ return dto;
1950
+ }
1951
+ /**
1952
+ * This method will parse a syntax that allows us to build strings from the
1953
+ * values of from the job model. For example if the job model was:
1954
+ *
1955
+ * {
1956
+ * foo: 'bar'
1957
+ * }
1958
+ *
1959
+ * and we pass "i am foo {foo}", the result would be:
1960
+ *
1961
+ * "i am foo bar"
1962
+ *
1963
+ * we can also use moment to parse dates, for example if the job model was:
1964
+ *
1965
+ * {
1966
+ * created: "2022-01-01T00:00:00+0000"
1967
+ * }
1968
+ *
1969
+ * and we pass "{created|date:YY-MM-DD}", the result would be:
1970
+ *
1971
+ * "2022-01-01"
1972
+ *
1973
+ * @param {string} value a string with the syntax
1974
+ * @param {ParseSyntaxOptions} options
1975
+ * @return {string} the results of parsing the syntax on this job
1976
+ */
1977
+ parseSyntax(value, options = {
1978
+ timeZoneOffset: 0
1979
+ }) {
1980
+ if (!value || typeof value !== 'string') {
1981
+ return '';
1982
+ }
1983
+ return value.replace(/({[^}]*})/g, (match, token) => {
1984
+ const syntax = token.substring(1, token.length - 1);
1985
+ let [key, filter] = syntax.split('|');
1986
+ key = (key || '').trim();
1987
+ filter = (filter || '').trim();
1988
+ let filterName, filterArg = '';
1989
+ if (filter) {
1990
+ const splitIndex = filter.indexOf(':');
1991
+ if (splitIndex !== -1) {
1992
+ filterName = filter.substring(0, splitIndex);
1993
+ filterArg = filter.substring(splitIndex + 1);
1994
+ }
1995
+ else {
1996
+ filterName = filter;
1997
+ filterArg = '';
1998
+ }
1999
+ filterName = (filterName || '').trim();
2000
+ filterArg = (filterArg || '').trim();
2001
+ }
2002
+ const path = key.split('.');
2003
+ const objectKey = path.shift() || '';
2004
+ let result = '';
2005
+ if (objectKey === 'job') {
2006
+ result = (this.getValueByPath(path) || '').toString();
2007
+ }
2008
+ else if (objectKey === 'fields') {
2009
+ result = (getValueByPath(path, this.getFields2()) || '').toString();
2010
+ }
2011
+ else if (objectKey.length) {
2012
+ if (options.objects) {
2013
+ if (options.objects[objectKey] === undefined) {
2014
+ console.debug(`objectKey ${objectKey} is not present in options.object`);
2015
+ result = '';
2016
+ }
2017
+ else {
2018
+ result = (getValueByPath(path, options.objects[objectKey]) || '')
2019
+ .toString();
2020
+ }
2021
+ }
2022
+ else {
2023
+ console.debug(`objectKey ${objectKey} was used but options.object is not set`);
2024
+ return '';
2025
+ }
2026
+ }
2027
+ else {
2028
+ return '';
2029
+ }
2030
+ if (filterName && result) {
2031
+ switch (filterName) {
2032
+ case 'date': {
2033
+ return moment$1(result)
2034
+ .utcOffset(options.timeZoneOffset)
2035
+ .format(filterArg || '');
2036
+ }
2037
+ default: {
2038
+ console.warn('unknown filter %s', filterName);
2039
+ }
2040
+ }
2041
+ }
2042
+ return result;
2043
+ }).trim();
2044
+ }
2045
+ ;
2046
+ /**
2047
+ * @return {object}
2048
+ */
2049
+ toApiDto() {
2050
+ return {
2051
+ ...super.toApiDto(),
2052
+ reference: this.reference || '~',
2053
+ jobDate: this.jobDate || '~',
2054
+ jobType: this.jobType || '~',
2055
+ accessGroup: this.accessGroup || '~',
2056
+ jobStatus: this.jobStatus || '~',
2057
+ assigneeId: this.assigneeId || '~',
2058
+ timeZoneOffset: this.timeZoneOffset || 0,
2059
+ pendingFields: this.pendingFields || 0,
2060
+ lastForm: this.formId || '~'
2061
+ };
2062
+ }
2063
+ }
2064
+
2065
+ /**
2066
+ * VasMembershipModel
2067
+ */
2068
+ class VasMembershipModel extends VasAccountObjectModel {
2069
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, user, admin, lookupTypes, contactTypes, accessGroups, jobStatuses, jobTypes, taskTypes) {
2070
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
2071
+ this.id = id;
2072
+ this.created = created;
2073
+ this.serverCreated = serverCreated;
2074
+ this.createdBy = createdBy;
2075
+ this.modified = modified;
2076
+ this.serverModified = serverModified;
2077
+ this.modifiedBy = modifiedBy;
2078
+ this.createdByName = createdByName;
2079
+ this.modifiedByName = modifiedByName;
2080
+ this.account = account;
2081
+ this.user = user;
2082
+ this.admin = admin;
2083
+ this.lookupTypes = lookupTypes;
2084
+ this.contactTypes = contactTypes;
2085
+ this.accessGroups = accessGroups;
2086
+ this.jobStatuses = jobStatuses;
2087
+ this.jobTypes = jobTypes;
2088
+ this.taskTypes = taskTypes;
2089
+ }
2090
+ static empty() {
2091
+ return VasMembershipModel.fromDto({
2092
+ // eslint-disable-next-line new-cap
2093
+ id: UUID.UUID()
2094
+ });
2095
+ }
2096
+ static fromDto(dto) {
2097
+ return new VasMembershipModel(
2098
+ // eslint-disable-next-line new-cap
2099
+ dto.id || UUID.UUID(), dto.created || '', dto.serverCreated || '', dto.createdBy || '', dto.modified || '', dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.user || '', dto.admin || false, dto.lookupTypes || [], dto.contactTypes || [], dto.accessGroups || [], dto.jobStatuses || [], dto.jobTypes || [], dto.taskTypes || []);
2100
+ }
2101
+ toDto() {
2102
+ return {
2103
+ id: this.id,
2104
+ created: this.created,
2105
+ serverCreated: this.serverCreated,
2106
+ createdBy: this.createdBy,
2107
+ modified: this.modified,
2108
+ serverModified: this.serverModified,
2109
+ modifiedBy: this.modifiedBy,
2110
+ createdByName: this.createdByName,
2111
+ modifiedByName: this.modifiedByName,
2112
+ account: this.account,
2113
+ user: this.user,
2114
+ admin: this.admin,
2115
+ lookupTypes: this.lookupTypes,
2116
+ contactTypes: this.contactTypes,
2117
+ accessGroups: this.accessGroups,
2118
+ jobStatuses: this.jobStatuses,
2119
+ jobTypes: this.jobTypes,
2120
+ taskTypes: this.taskTypes
2121
+ };
2122
+ }
2123
+ }
2124
+
2125
+ class VasReportLayoutModel extends VasRestrictedAccountObjectModel {
2126
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, jobType, title, description, entryPoint) {
2127
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
2128
+ this.id = id;
2129
+ this.created = created;
2130
+ this.serverCreated = serverCreated;
2131
+ this.createdBy = createdBy;
2132
+ this.modified = modified;
2133
+ this.serverModified = serverModified;
2134
+ this.modifiedBy = modifiedBy;
2135
+ this.createdByName = createdByName;
2136
+ this.modifiedByName = modifiedByName;
2137
+ this.account = account;
2138
+ this.accessGroup = accessGroup;
2139
+ this.jobType = jobType;
2140
+ this.title = title;
2141
+ this.description = description;
2142
+ this.entryPoint = entryPoint;
2143
+ }
2144
+ }
2145
+
2146
+ class VasReportRequestModel extends VasAccountObjectModel {
2147
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, error, jobId, title, url, reportId) {
2148
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
2149
+ this.id = id;
2150
+ this.created = created;
2151
+ this.serverCreated = serverCreated;
2152
+ this.createdBy = createdBy;
2153
+ this.modified = modified;
2154
+ this.serverModified = serverModified;
2155
+ this.modifiedBy = modifiedBy;
2156
+ this.createdByName = createdByName;
2157
+ this.modifiedByName = modifiedByName;
2158
+ this.account = account;
2159
+ this.error = error;
2160
+ this.jobId = jobId;
2161
+ this.title = title;
2162
+ this.url = url;
2163
+ this.reportId = reportId;
2164
+ }
2165
+ static fromDto(dto) {
2166
+ return new VasReportRequestModel(dto.id || UUID.UUID(), dto.created || moment$1().toISOString(), dto.serverCreated || '', dto.createdBy || '', dto.modified || moment$1().toISOString(), dto.serverModified || '', dto.modifiedBy || '', dto.createdByName || '', dto.modifiedByName || '', dto.account || '', dto.error || '', dto.jobId || '', dto.title || '', dto.url || '', dto.reportId || '');
2167
+ }
2168
+ toDto() {
2169
+ return {
2170
+ id: this.id,
2171
+ created: this.created,
2172
+ serverCreated: this.serverCreated,
2173
+ createdBy: this.createdBy,
2174
+ modified: this.modified,
2175
+ serverModified: this.serverModified,
2176
+ modifiedBy: this.modifiedBy,
2177
+ createdByName: this.createdByName,
2178
+ modifiedByName: this.modifiedByName,
2179
+ account: this.account,
2180
+ error: this.error,
2181
+ jobId: this.jobId,
2182
+ title: this.title,
2183
+ url: this.url,
2184
+ reportId: this.reportId
2185
+ };
2186
+ }
2187
+ }
2188
+
2189
+ /**
2190
+ * Generated bundle index. Do not edit.
2191
+ */
2192
+
2193
+ export { VasAccountIndexingMode, VasAccountObjectModel, VasBaseModel, VasBranchModel, VasContactModel, VasControlConfigDirection, VasControlModel, VasControlTypeModel, VasFieldModel, VasFileModel, VasFireUserModel, VasFormModel, VasGroupModel, VasInstructionJobFieldModel, VasInstructionJobModel, VasInstructionModel, VasInstructionProviderModel, VasInvitationModel, VasInvitationTypeEnum, VasJobDataModel, VasJobModel, VasMembershipModel, VasNoteModel, VasReportLayoutModel, VasReportModel, VasReportRequestModel, VasRestrictedAccountObjectModel, VasUserModel, getEmptyGeoLocation, isCameraControlValueV1, isFileDto };
2194
+ //# sourceMappingURL=ironcode-vas-lib.mjs.map