@ironcode/vas-lib 1.0.0 → 1.0.1

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 +6 -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 +23 -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 +46 -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 +6 -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 +30 -0
  167. package/cjs/lib/entity/vas-instruction.model.d.ts.map +1 -0
  168. package/cjs/lib/entity/vas-instruction.model.js +53 -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 +42 -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 +49 -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 +2134 -0
  373. package/fesm2015/ironcode-vas-lib.mjs.map +1 -0
  374. package/fesm2020/ironcode-vas-lib.mjs +2186 -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 +5 -0
  410. package/lib/entity/vas-instruction-job-field.model.d.ts +22 -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 +5 -0
  416. package/lib/entity/vas-instruction.model.d.ts +29 -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,2186 @@
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) {
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
+ }
1252
+ static empty() {
1253
+ return new VasInstructionJobFieldModel('', '', '', '', '', '', '', '', '', '', '');
1254
+ }
1255
+ static fromDto(dto) {
1256
+ 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 || '');
1257
+ }
1258
+ toDto() {
1259
+ return {
1260
+ id: this.id,
1261
+ created: this.created,
1262
+ serverCreated: this.serverCreated,
1263
+ createdBy: this.createdBy,
1264
+ modified: this.modified,
1265
+ serverModified: this.serverModified,
1266
+ modifiedBy: this.modifiedBy,
1267
+ createdByName: this.createdByName,
1268
+ modifiedByName: this.modifiedByName,
1269
+ value: this.value,
1270
+ name: this.name,
1271
+ };
1272
+ }
1273
+ }
1274
+
1275
+ class VasReportModel extends VasJobDataModel {
1276
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, reportLayoutId, title, sendEmail, message, attempted, completed, succeeded, attempts, notificationId) {
1277
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
1278
+ this.id = id;
1279
+ this.created = created;
1280
+ this.serverCreated = serverCreated;
1281
+ this.createdBy = createdBy;
1282
+ this.modified = modified;
1283
+ this.serverModified = serverModified;
1284
+ this.modifiedBy = modifiedBy;
1285
+ this.createdByName = createdByName;
1286
+ this.modifiedByName = modifiedByName;
1287
+ this.account = account;
1288
+ this.job = job;
1289
+ this.reportLayoutId = reportLayoutId;
1290
+ this.title = title;
1291
+ this.sendEmail = sendEmail;
1292
+ this.message = message;
1293
+ this.attempted = attempted;
1294
+ this.completed = completed;
1295
+ this.succeeded = succeeded;
1296
+ this.attempts = attempts;
1297
+ this.notificationId = notificationId;
1298
+ }
1299
+ static empty() {
1300
+ return VasReportModel.fromDto({});
1301
+ }
1302
+ static fromDto(dto) {
1303
+ 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 || '');
1304
+ }
1305
+ toDto() {
1306
+ return {
1307
+ id: this.id,
1308
+ created: this.created,
1309
+ serverCreated: this.serverCreated,
1310
+ createdBy: this.createdBy,
1311
+ modified: this.modified,
1312
+ serverModified: this.serverModified,
1313
+ modifiedBy: this.modifiedBy,
1314
+ createdByName: this.createdByName,
1315
+ modifiedByName: this.modifiedByName,
1316
+ account: this.account,
1317
+ job: this.job,
1318
+ reportLayoutId: this.reportLayoutId,
1319
+ title: this.title,
1320
+ sendEmail: this.sendEmail,
1321
+ message: this.message,
1322
+ attempted: this.attempted,
1323
+ completed: this.completed,
1324
+ succeeded: this.succeeded,
1325
+ attempts: this.attempts,
1326
+ notificationId: this.notificationId,
1327
+ };
1328
+ }
1329
+ }
1330
+
1331
+ /**
1332
+ * VasNoteModel
1333
+ */
1334
+ class VasInstructionJobModel extends VasBaseModel {
1335
+ /**
1336
+ * @param id id
1337
+ * @param created created
1338
+ * @param serverCreated serverCreated
1339
+ * @param createdBy createdBy
1340
+ * @param modified modified
1341
+ * @param serverModified serverModified
1342
+ * @param modifiedBy modifiedBy
1343
+ * @param reference reference
1344
+ * @param jobStatus jobStatus
1345
+ * @param createdByName createdByName
1346
+ * @param modifiedByName modifiedByName
1347
+ * @param notes notes
1348
+ * @param fields fields
1349
+ * @param files files
1350
+ * @param reports reports
1351
+ */
1352
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, reference, jobStatus, notes, fields, files, reports) {
1353
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
1354
+ this.id = id;
1355
+ this.created = created;
1356
+ this.serverCreated = serverCreated;
1357
+ this.createdBy = createdBy;
1358
+ this.modified = modified;
1359
+ this.serverModified = serverModified;
1360
+ this.modifiedBy = modifiedBy;
1361
+ this.createdByName = createdByName;
1362
+ this.modifiedByName = modifiedByName;
1363
+ this.reference = reference;
1364
+ this.jobStatus = jobStatus;
1365
+ this.notes = notes;
1366
+ this.fields = fields;
1367
+ this.files = files;
1368
+ this.reports = reports;
1369
+ }
1370
+ /**
1371
+ * @return empty VasInstructionJobModel
1372
+ */
1373
+ static empty() {
1374
+ return new VasInstructionJobModel('', '', '', '', '', '', '', '', '', '', '', [], [], [], []);
1375
+ }
1376
+ /**
1377
+ * @param dto VasInstructionDto
1378
+ * @return VasInstructionModel
1379
+ */
1380
+ static fromDto(dto) {
1381
+ 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)));
1382
+ }
1383
+ /**
1384
+ * @returns VasNoteDto
1385
+ */
1386
+ toDto() {
1387
+ return {
1388
+ id: this.id,
1389
+ created: this.created,
1390
+ serverCreated: this.serverCreated,
1391
+ createdBy: this.createdBy,
1392
+ modified: this.modified,
1393
+ serverModified: this.serverModified,
1394
+ modifiedBy: this.modifiedBy,
1395
+ reference: this.reference,
1396
+ jobStatus: this.jobStatus,
1397
+ createdByName: this.createdByName,
1398
+ modifiedByName: this.modifiedByName,
1399
+ notes: this.notes.map(m => m.toDto()),
1400
+ fields: this.fields.map(m => m.toDto()),
1401
+ files: this.files.map(m => m.toDto()),
1402
+ reports: this.reports.map(m => m.toDto()),
1403
+ };
1404
+ }
1405
+ }
1406
+
1407
+ /**
1408
+ * VasNoteModel
1409
+ */
1410
+ class VasInstructionModel extends VasAccountObjectModel {
1411
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job) {
1412
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
1413
+ this.id = id;
1414
+ this.created = created;
1415
+ this.serverCreated = serverCreated;
1416
+ this.createdBy = createdBy;
1417
+ this.modified = modified;
1418
+ this.serverModified = serverModified;
1419
+ this.modifiedBy = modifiedBy;
1420
+ this.createdByName = createdByName;
1421
+ this.modifiedByName = modifiedByName;
1422
+ this.account = account;
1423
+ this.job = job;
1424
+ }
1425
+ /**
1426
+ * @param dto VasInstructionDto
1427
+ * @return VasInstructionModel
1428
+ */
1429
+ static fromDto(dto) {
1430
+ 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 ?
1431
+ VasInstructionJobModel.fromDto(dto.job) :
1432
+ VasInstructionJobModel.empty());
1433
+ }
1434
+ /**
1435
+ * @returns VasNoteDto
1436
+ */
1437
+ toDto() {
1438
+ return {
1439
+ id: this.id,
1440
+ created: this.created,
1441
+ serverCreated: this.serverCreated,
1442
+ createdBy: this.createdBy,
1443
+ modified: this.modified,
1444
+ serverModified: this.serverModified,
1445
+ modifiedBy: this.modifiedBy,
1446
+ createdByName: this.createdByName,
1447
+ modifiedByName: this.modifiedByName,
1448
+ account: this.account,
1449
+ job: this.job.toDto()
1450
+ };
1451
+ }
1452
+ }
1453
+
1454
+ /**
1455
+ * VasInstructionProviderModel
1456
+ */
1457
+ class VasInstructionProviderModel extends VasAccountObjectModel {
1458
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, form, title, secret, portalEnabled) {
1459
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
1460
+ this.id = id;
1461
+ this.created = created;
1462
+ this.serverCreated = serverCreated;
1463
+ this.createdBy = createdBy;
1464
+ this.modified = modified;
1465
+ this.serverModified = serverModified;
1466
+ this.modifiedBy = modifiedBy;
1467
+ this.createdByName = createdByName;
1468
+ this.modifiedByName = modifiedByName;
1469
+ this.account = account;
1470
+ this.form = form;
1471
+ this.title = title;
1472
+ this.secret = secret;
1473
+ this.portalEnabled = portalEnabled;
1474
+ }
1475
+ /**
1476
+ * @param dto VasInstructionDto
1477
+ * @return VasInstructionModel
1478
+ */
1479
+ static fromDto(dto) {
1480
+ 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 ?
1481
+ VasFormModel.fromDto(dto.form) :
1482
+ VasFormModel.empty(), dto.title || '', dto.secret || '', dto.portalEnabled || false);
1483
+ }
1484
+ /**
1485
+ * @returns VasNoteDto
1486
+ */
1487
+ toDto() {
1488
+ return {
1489
+ id: this.id,
1490
+ created: this.created,
1491
+ serverCreated: this.serverCreated,
1492
+ createdBy: this.createdBy,
1493
+ modified: this.modified,
1494
+ serverModified: this.serverModified,
1495
+ modifiedBy: this.modifiedBy,
1496
+ createdByName: this.createdByName,
1497
+ modifiedByName: this.modifiedByName,
1498
+ account: this.account,
1499
+ form: this.form.toDto(),
1500
+ title: this.title,
1501
+ secret: this.secret,
1502
+ portalEnabled: this.portalEnabled
1503
+ };
1504
+ }
1505
+ toApiDto(options) {
1506
+ return {
1507
+ ...super.toApiDto(options),
1508
+ title: this.title,
1509
+ form: this.form.id,
1510
+ portalEnabled: this.portalEnabled
1511
+ };
1512
+ }
1513
+ }
1514
+
1515
+ /**
1516
+ * A non sophisticated way to get values from the job via paths. For example:
1517
+ *
1518
+ * getValueByPath(
1519
+ * ['foo', 'bar'],
1520
+ * {
1521
+ * foo: {
1522
+ * bar: 'value'
1523
+ * }
1524
+ * }
1525
+ * );
1526
+ *
1527
+ * will return "value"
1528
+ * @param {string[]} path
1529
+ * @param {Record<string, VasFieldDtoValue>} object
1530
+ * @return {T | undefined}
1531
+ */
1532
+ const getValueByPath = (path, object) => {
1533
+ switch (path.length) {
1534
+ case 0: {
1535
+ return;
1536
+ }
1537
+ case 1: {
1538
+ return (object)[path[0]];
1539
+ }
1540
+ case 2: {
1541
+ const val0 = object[path[0]];
1542
+ if (!val0) {
1543
+ return undefined;
1544
+ }
1545
+ return val0[path[1]];
1546
+ }
1547
+ case 3: {
1548
+ const val0 = object[path[0]];
1549
+ if (!val0) {
1550
+ return undefined;
1551
+ }
1552
+ const val1 = val0[path[1]];
1553
+ if (!val1) {
1554
+ return undefined;
1555
+ }
1556
+ return val1[path[2]];
1557
+ }
1558
+ case 4: {
1559
+ const val0 = object[path[0]];
1560
+ if (!val0) {
1561
+ return undefined;
1562
+ }
1563
+ const val1 = val0[path[1]];
1564
+ if (!val1) {
1565
+ return undefined;
1566
+ }
1567
+ const val2 = val1[path[2]];
1568
+ if (!val2) {
1569
+ return undefined;
1570
+ }
1571
+ return val2[path[3]];
1572
+ }
1573
+ default: {
1574
+ throw Error('path has too many segments');
1575
+ }
1576
+ }
1577
+ };
1578
+
1579
+ const getEmptyGeoLocation = () => ({
1580
+ accuracy: 0,
1581
+ altitude: 0,
1582
+ altitudeAccuracy: 0,
1583
+ geoPoint: [],
1584
+ lonLat: {
1585
+ lon: 0,
1586
+ lat: 0,
1587
+ },
1588
+ timestamp: ''
1589
+ });
1590
+
1591
+ const isArrayString = (value) => {
1592
+ return Array.isArray(value) && value.every(i => typeof i === 'string');
1593
+ };
1594
+
1595
+ /**
1596
+ * JobModel
1597
+ */
1598
+ class VasJobModel extends VasRestrictedAccountObjectModel {
1599
+ 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) {
1600
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
1601
+ this.id = id;
1602
+ this.created = created;
1603
+ this.serverCreated = serverCreated;
1604
+ this.createdBy = createdBy;
1605
+ this.modified = modified;
1606
+ this.serverModified = serverModified;
1607
+ this.modifiedBy = modifiedBy;
1608
+ this.createdByName = createdByName;
1609
+ this.modifiedByName = modifiedByName;
1610
+ this.account = account;
1611
+ this.accessGroup = accessGroup;
1612
+ this.reference = reference;
1613
+ this.jobDate = jobDate;
1614
+ this.jobStatus = jobStatus;
1615
+ this.jobType = jobType;
1616
+ this.assigneeId = assigneeId;
1617
+ this.formId = formId;
1618
+ this.timeZoneOffset = timeZoneOffset;
1619
+ this.pendingFields = pendingFields;
1620
+ this.childModified = childModified;
1621
+ this.version = version;
1622
+ this.fields = fields;
1623
+ this.files = files;
1624
+ this.createdByDisplayName = createdByDisplayName;
1625
+ this.modifiedByDisplayName = modifiedByDisplayName;
1626
+ this.geoLocation = geoLocation;
1627
+ }
1628
+ /**
1629
+ * Returns this with the dynamic interface
1630
+ * @return {VasJobModelDynamicInterface}
1631
+ */
1632
+ get $this() {
1633
+ return this;
1634
+ }
1635
+ /**
1636
+ * Returns a list of Job dynamic properties i.e. those that are added by the
1637
+ * dynamic forms
1638
+ */
1639
+ get dynamicProperties() {
1640
+ const nativeProps = this.staticProperties;
1641
+ return Object
1642
+ .getOwnPropertyNames(this)
1643
+ .filter(prop => !nativeProps.includes(prop));
1644
+ }
1645
+ /**
1646
+ * Returns a list of Job static properties i.e. those that are declared by
1647
+ * the type
1648
+ */
1649
+ get staticProperties() {
1650
+ return Object.getOwnPropertyNames(VasJobModel.empty());
1651
+ }
1652
+ /**
1653
+ * @return {VasJobModel}
1654
+ */
1655
+ static empty() {
1656
+ return new VasJobModel('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', moment$1().utcOffset(), 0, '', 0, [], [], '', '', getEmptyGeoLocation());
1657
+ }
1658
+ static fromDto(dto) {
1659
+ 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());
1660
+ const emptyKeys = model.staticProperties;
1661
+ Object
1662
+ .keys(dto)
1663
+ .filter(key => emptyKeys.indexOf(key) === -1)
1664
+ .forEach((key) => model.$this[key] = dto[key]);
1665
+ return model;
1666
+ }
1667
+ /**
1668
+ * @param {VasFormModel} formModel
1669
+ * @return {Record<string, VasFieldDtoValue>}
1670
+ */
1671
+ getFields(formModel) {
1672
+ const fields = {};
1673
+ formModel.groups
1674
+ .forEach(group => {
1675
+ group.controls.forEach(control => {
1676
+ (fields)[control.reportTemplateName] =
1677
+ this.getValueByPath([group.name, control.name]);
1678
+ });
1679
+ });
1680
+ return fields;
1681
+ }
1682
+ /**
1683
+ * Will return an object whose keys are the names of all fields in the job.
1684
+ * This method is similar to `getFields` except that this method will only
1685
+ * return values where a value was set, as opposed to `getFields` which
1686
+ * return a property regardless (because it uses the form to drive the logic)
1687
+ * @return {Record<string, VasFieldDtoValue>}
1688
+ */
1689
+ getFields2() {
1690
+ let fields = {};
1691
+ this.dynamicProperties
1692
+ .forEach((groupName) => {
1693
+ Object
1694
+ .keys(this.$this[groupName])
1695
+ .forEach(controlName => {
1696
+ fields[controlName] = this.getValueByPath([groupName, controlName]);
1697
+ });
1698
+ }, {});
1699
+ return fields;
1700
+ }
1701
+ /**
1702
+ * Returns an object describing how many attachments were added to this job
1703
+ * (camera controls and files), and how many have not been uploaded yet.
1704
+ *
1705
+ * @param formModel instance of {@link VasFormModel} that was used when the
1706
+ * job was created
1707
+ */
1708
+ getFilesUploadStatus(formModel) {
1709
+ const pathsWithValue = formModel
1710
+ .getCameraControlPaths()
1711
+ .map(path => {
1712
+ const value = this.getValueByPath(path);
1713
+ if (value && !!value.id) {
1714
+ return path;
1715
+ }
1716
+ return null;
1717
+ })
1718
+ .filter(path => path !== null ? path : null)
1719
+ .filter(isArrayString);
1720
+ let total = pathsWithValue.length;
1721
+ total += this.files.length;
1722
+ // calculate the number of camera images still to upload
1723
+ let pending = pathsWithValue
1724
+ .map(path => this.getValueByPath(path))
1725
+ .map((value) => {
1726
+ if (isFileDto(value)) {
1727
+ return value.id && value.status !== 'COMPLETE';
1728
+ }
1729
+ else if (isCameraControlValueV1(value)) {
1730
+ // if url is not set, it hasn't been uploaded
1731
+ return value.id && !value.url;
1732
+ }
1733
+ return false;
1734
+ })
1735
+ .filter(hasUploaded => hasUploaded)
1736
+ .length;
1737
+ // add total from files that are pending
1738
+ pending += this.files
1739
+ .filter(value => value.status !== 'COMPLETED')
1740
+ .length;
1741
+ return {
1742
+ pending,
1743
+ total
1744
+ };
1745
+ }
1746
+ /**
1747
+ * This method will hydrate the `fields` property of the model. The reason for
1748
+ * this is that we have different ways to store the field data. One way, is
1749
+ * we store them as dynamic properties of the job. For example job.foo.bar,
1750
+ * where `foo` is the name of a Group, and `bar` is the name of a control.
1751
+ * Thus, when we create a job using a form in the client, the job object will
1752
+ * have its static properties (id, account, reference etc), and also a number
1753
+ * of dynamic properties determined by the Groups and Controls. This kind of
1754
+ * object is nice to work with in certain circumstances. However, the api
1755
+ * works differently. In the API a Job is a record, and references a number of
1756
+ * Field records. Each Field stores the value. Comparing these two models we
1757
+ * have:
1758
+ * A) job with dynamic properties, e.g.
1759
+ * {
1760
+ * id: <guid>,
1761
+ * reference: "something"
1762
+ * <other static job properties>...
1763
+ * foo: {
1764
+ * bar: "value"
1765
+ * }
1766
+ * }
1767
+ *
1768
+ * B) job with fields
1769
+ * {
1770
+ * id: <guid>,
1771
+ * reference: "something"
1772
+ * <other static job properties>...
1773
+ * <will not have dynamic properties>...
1774
+ * fields: [
1775
+ * {
1776
+ * id: <guid>,
1777
+ * <other field properties>,
1778
+ * value: "value"
1779
+ * }
1780
+ * ]
1781
+ * }
1782
+ *
1783
+ * So, what this method does is given a JobModel in the form of A, read all
1784
+ * of those dynamic properties and set them into `fields`. Doing this requires
1785
+ * knowledge of the Form that was used to create the job. Moreover, since the
1786
+ * dynamic properties do not contain the ids of the fields, we also allow to
1787
+ * pass in a `controlFieldIdMap`. This map stores the mapping between Control
1788
+ * and the Field that was created in the Job to store the value for that
1789
+ * Control. This is useful, if for example you want to compare a Job in form A
1790
+ * with a Job in form B, for example if you want to update the Job on the API
1791
+ * with a Job that was saved by a client in form A.
1792
+ *
1793
+ * E.g.
1794
+ * Client -> API: client requests form
1795
+ * User -> Client: user fills in the form and submits
1796
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1797
+ * Firestore -> Function: A function is triggered to sync the job to the API
1798
+ * Function -> API: Function checks if job already exists, it receives 404
1799
+ * Function -> Function: The function calls `hydrateFields(...)`
1800
+ * Function -> API: The function POST the Job to /jobs
1801
+ * Function -> API: The function POST each field to /fields
1802
+ *
1803
+ * Similarly, if the user updates the job
1804
+ * Client -> API: client requests form
1805
+ * User -> Client: user fills in the form and submits an update
1806
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1807
+ * Firestore -> Function: A function is triggered to sync the job to the API
1808
+ * Function -> API: Function checks if job already exists, it receives 200
1809
+ * Function -> Function: The function calls `hydrateFields(...)` passing in
1810
+ * the map is made by iterating over the fields it
1811
+ * received from the API and storing the mappings
1812
+ * between controlId and fieldId for each field
1813
+ * Function -> API: The function PATCH the Job to /jobs
1814
+ * Function -> API: The function POST/PATCH each field to /fields
1815
+ * treated as new
1816
+ *
1817
+ * @param {VasFormModel} formModel the VasFormModel that was used to create
1818
+ * the job
1819
+ * @param {Map<string, string>} controlFieldIdMap a mapping of control to
1820
+ * field ids. This is used to determine whether a new id for the field should
1821
+ * be generated, or to reuse an existing one from the map.
1822
+ * @param {Array<string>} controlNames if a value is provided, it will be used
1823
+ * to filter the fields that are returned.
1824
+ * @return {Array<VasFieldDto>}
1825
+ */
1826
+ hydrateFields(formModel, controlFieldIdMap = new Map(), controlNames) {
1827
+ const fields = [];
1828
+ formModel.groups
1829
+ .forEach(group => {
1830
+ group.controls.forEach(control => {
1831
+ if (!control.name.startsWith('fields.')) {
1832
+ return;
1833
+ }
1834
+ if (controlNames && !controlNames.includes(control.name)) {
1835
+ return;
1836
+ }
1837
+ fields.push(VasFieldModel.fromDto({
1838
+ // if the controlId exists in the map, use the associated fieldId,
1839
+ // otherwise generate a new id for the field.
1840
+ id: controlFieldIdMap.get(control.id) || UUID.UUID(),
1841
+ account: this.account,
1842
+ job: this.id,
1843
+ createdBy: this.createdBy,
1844
+ created: this.created,
1845
+ modifiedBy: this.modifiedBy,
1846
+ modified: this.modified,
1847
+ control: control.id,
1848
+ value: this.getValueByPath([group.name, control.name])
1849
+ }));
1850
+ });
1851
+ });
1852
+ this.fields = fields;
1853
+ }
1854
+ /**
1855
+ * @param {string[]} path path segments
1856
+ * @return {void}
1857
+ */
1858
+ getValueByPath(path = []) {
1859
+ return getValueByPath(path, this.$this);
1860
+ }
1861
+ /**
1862
+ * A very non sophisticated way to set values in the job via paths
1863
+ *
1864
+ * For example:
1865
+ *
1866
+ * setValueByPath('value', ['foo', 'bar']);
1867
+ *
1868
+ * will make results in job
1869
+ * {
1870
+ * foo: {
1871
+ * bar: 'value'
1872
+ * }
1873
+ * }
1874
+ *
1875
+ * @param {any} value the value to set
1876
+ * @param {string[]} path path segments
1877
+ */
1878
+ setValueByPath(value, path = []) {
1879
+ switch (path.length) {
1880
+ case 0: {
1881
+ return;
1882
+ }
1883
+ case 1: {
1884
+ this[path[0]] = value;
1885
+ return;
1886
+ }
1887
+ case 2: {
1888
+ // eslint-disable-next-line max-len
1889
+ this.$this[path[0]][path[1]] = value;
1890
+ return;
1891
+ }
1892
+ case 3: {
1893
+ // eslint-disable-next-line max-len
1894
+ this.$this[path[0]][path[1]][path[2]] = value;
1895
+ return;
1896
+ }
1897
+ default: {
1898
+ throw Error('path has too many segments');
1899
+ }
1900
+ }
1901
+ }
1902
+ /**
1903
+ * @param {boolean} staticOnly if true, will only output values for the static
1904
+ * properties in the dto
1905
+ * @return {VasJobDto}
1906
+ */
1907
+ toDto(staticOnly = false) {
1908
+ if (staticOnly) {
1909
+ return {
1910
+ id: this.id,
1911
+ created: this.created,
1912
+ createdBy: this.createdBy,
1913
+ modified: this.modified,
1914
+ modifiedBy: this.modifiedBy,
1915
+ serverCreated: this.serverCreated,
1916
+ serverModified: this.serverModified,
1917
+ createdByName: this.createdByName,
1918
+ modifiedByName: this.modifiedByName,
1919
+ account: this.account,
1920
+ accessGroup: this.accessGroup,
1921
+ reference: this.reference,
1922
+ jobDate: this.jobDate,
1923
+ jobStatus: this.jobStatus,
1924
+ jobType: this.jobType,
1925
+ assigneeId: this.assigneeId,
1926
+ formId: this.formId,
1927
+ timeZoneOffset: this.timeZoneOffset,
1928
+ pendingFields: this.pendingFields,
1929
+ childModified: this.childModified,
1930
+ version: this.version,
1931
+ fields: this.fields,
1932
+ files: this.files,
1933
+ createdByDisplayName: this.createdByDisplayName,
1934
+ modifiedByDisplayName: this.modifiedByDisplayName,
1935
+ geoLocation: this.geoLocation
1936
+ };
1937
+ }
1938
+ const dto = {};
1939
+ [...this.staticProperties, ...this.dynamicProperties]
1940
+ .forEach(prop => (dto)[prop] = this.$this[prop]);
1941
+ return dto;
1942
+ }
1943
+ /**
1944
+ * This method will parse a syntax that allows us to build strings from the
1945
+ * values of from the job model. For example if the job model was:
1946
+ *
1947
+ * {
1948
+ * foo: 'bar'
1949
+ * }
1950
+ *
1951
+ * and we pass "i am foo {foo}", the result would be:
1952
+ *
1953
+ * "i am foo bar"
1954
+ *
1955
+ * we can also use moment to parse dates, for example if the job model was:
1956
+ *
1957
+ * {
1958
+ * created: "2022-01-01T00:00:00+0000"
1959
+ * }
1960
+ *
1961
+ * and we pass "{created|date:YY-MM-DD}", the result would be:
1962
+ *
1963
+ * "2022-01-01"
1964
+ *
1965
+ * @param {string} value a string with the syntax
1966
+ * @param {ParseSyntaxOptions} options
1967
+ * @return {string} the results of parsing the syntax on this job
1968
+ */
1969
+ parseSyntax(value, options = {
1970
+ timeZoneOffset: 0
1971
+ }) {
1972
+ if (!value || typeof value !== 'string') {
1973
+ return '';
1974
+ }
1975
+ return value.replace(/({[^}]*})/g, (match, token) => {
1976
+ const syntax = token.substring(1, token.length - 1);
1977
+ let [key, filter] = syntax.split('|');
1978
+ key = (key || '').trim();
1979
+ filter = (filter || '').trim();
1980
+ let filterName, filterArg = '';
1981
+ if (filter) {
1982
+ const splitIndex = filter.indexOf(':');
1983
+ if (splitIndex !== -1) {
1984
+ filterName = filter.substring(0, splitIndex);
1985
+ filterArg = filter.substring(splitIndex + 1);
1986
+ }
1987
+ else {
1988
+ filterName = filter;
1989
+ filterArg = '';
1990
+ }
1991
+ filterName = (filterName || '').trim();
1992
+ filterArg = (filterArg || '').trim();
1993
+ }
1994
+ const path = key.split('.');
1995
+ const objectKey = path.shift() || '';
1996
+ let result = '';
1997
+ if (objectKey === 'job') {
1998
+ result = (this.getValueByPath(path) || '').toString();
1999
+ }
2000
+ else if (objectKey === 'fields') {
2001
+ result = (getValueByPath(path, this.getFields2()) || '').toString();
2002
+ }
2003
+ else if (objectKey.length) {
2004
+ if (options.objects) {
2005
+ if (options.objects[objectKey] === undefined) {
2006
+ console.debug(`objectKey ${objectKey} is not present in options.object`);
2007
+ result = '';
2008
+ }
2009
+ else {
2010
+ result = (getValueByPath(path, options.objects[objectKey]) || '')
2011
+ .toString();
2012
+ }
2013
+ }
2014
+ else {
2015
+ console.debug(`objectKey ${objectKey} was used but options.object is not set`);
2016
+ return '';
2017
+ }
2018
+ }
2019
+ else {
2020
+ return '';
2021
+ }
2022
+ if (filterName && result) {
2023
+ switch (filterName) {
2024
+ case 'date': {
2025
+ return moment$1(result)
2026
+ .utcOffset(options.timeZoneOffset)
2027
+ .format(filterArg || '');
2028
+ }
2029
+ default: {
2030
+ console.warn('unknown filter %s', filterName);
2031
+ }
2032
+ }
2033
+ }
2034
+ return result;
2035
+ }).trim();
2036
+ }
2037
+ ;
2038
+ /**
2039
+ * @return {object}
2040
+ */
2041
+ toApiDto() {
2042
+ return {
2043
+ ...super.toApiDto(),
2044
+ reference: this.reference || '~',
2045
+ jobDate: this.jobDate || '~',
2046
+ jobType: this.jobType || '~',
2047
+ accessGroup: this.accessGroup || '~',
2048
+ jobStatus: this.jobStatus || '~',
2049
+ assigneeId: this.assigneeId || '~',
2050
+ timeZoneOffset: this.timeZoneOffset || 0,
2051
+ pendingFields: this.pendingFields || 0,
2052
+ lastForm: this.formId || '~'
2053
+ };
2054
+ }
2055
+ }
2056
+
2057
+ /**
2058
+ * VasMembershipModel
2059
+ */
2060
+ class VasMembershipModel extends VasAccountObjectModel {
2061
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, user, admin, lookupTypes, contactTypes, accessGroups, jobStatuses, jobTypes, taskTypes) {
2062
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
2063
+ this.id = id;
2064
+ this.created = created;
2065
+ this.serverCreated = serverCreated;
2066
+ this.createdBy = createdBy;
2067
+ this.modified = modified;
2068
+ this.serverModified = serverModified;
2069
+ this.modifiedBy = modifiedBy;
2070
+ this.createdByName = createdByName;
2071
+ this.modifiedByName = modifiedByName;
2072
+ this.account = account;
2073
+ this.user = user;
2074
+ this.admin = admin;
2075
+ this.lookupTypes = lookupTypes;
2076
+ this.contactTypes = contactTypes;
2077
+ this.accessGroups = accessGroups;
2078
+ this.jobStatuses = jobStatuses;
2079
+ this.jobTypes = jobTypes;
2080
+ this.taskTypes = taskTypes;
2081
+ }
2082
+ static empty() {
2083
+ return VasMembershipModel.fromDto({
2084
+ // eslint-disable-next-line new-cap
2085
+ id: UUID.UUID()
2086
+ });
2087
+ }
2088
+ static fromDto(dto) {
2089
+ return new VasMembershipModel(
2090
+ // eslint-disable-next-line new-cap
2091
+ 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 || []);
2092
+ }
2093
+ toDto() {
2094
+ return {
2095
+ id: this.id,
2096
+ created: this.created,
2097
+ serverCreated: this.serverCreated,
2098
+ createdBy: this.createdBy,
2099
+ modified: this.modified,
2100
+ serverModified: this.serverModified,
2101
+ modifiedBy: this.modifiedBy,
2102
+ createdByName: this.createdByName,
2103
+ modifiedByName: this.modifiedByName,
2104
+ account: this.account,
2105
+ user: this.user,
2106
+ admin: this.admin,
2107
+ lookupTypes: this.lookupTypes,
2108
+ contactTypes: this.contactTypes,
2109
+ accessGroups: this.accessGroups,
2110
+ jobStatuses: this.jobStatuses,
2111
+ jobTypes: this.jobTypes,
2112
+ taskTypes: this.taskTypes
2113
+ };
2114
+ }
2115
+ }
2116
+
2117
+ class VasReportLayoutModel extends VasRestrictedAccountObjectModel {
2118
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, jobType, title, description, entryPoint) {
2119
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
2120
+ this.id = id;
2121
+ this.created = created;
2122
+ this.serverCreated = serverCreated;
2123
+ this.createdBy = createdBy;
2124
+ this.modified = modified;
2125
+ this.serverModified = serverModified;
2126
+ this.modifiedBy = modifiedBy;
2127
+ this.createdByName = createdByName;
2128
+ this.modifiedByName = modifiedByName;
2129
+ this.account = account;
2130
+ this.accessGroup = accessGroup;
2131
+ this.jobType = jobType;
2132
+ this.title = title;
2133
+ this.description = description;
2134
+ this.entryPoint = entryPoint;
2135
+ }
2136
+ }
2137
+
2138
+ class VasReportRequestModel extends VasAccountObjectModel {
2139
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, error, jobId, title, url, reportId) {
2140
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
2141
+ this.id = id;
2142
+ this.created = created;
2143
+ this.serverCreated = serverCreated;
2144
+ this.createdBy = createdBy;
2145
+ this.modified = modified;
2146
+ this.serverModified = serverModified;
2147
+ this.modifiedBy = modifiedBy;
2148
+ this.createdByName = createdByName;
2149
+ this.modifiedByName = modifiedByName;
2150
+ this.account = account;
2151
+ this.error = error;
2152
+ this.jobId = jobId;
2153
+ this.title = title;
2154
+ this.url = url;
2155
+ this.reportId = reportId;
2156
+ }
2157
+ static fromDto(dto) {
2158
+ 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 || '');
2159
+ }
2160
+ toDto() {
2161
+ return {
2162
+ id: this.id,
2163
+ created: this.created,
2164
+ serverCreated: this.serverCreated,
2165
+ createdBy: this.createdBy,
2166
+ modified: this.modified,
2167
+ serverModified: this.serverModified,
2168
+ modifiedBy: this.modifiedBy,
2169
+ createdByName: this.createdByName,
2170
+ modifiedByName: this.modifiedByName,
2171
+ account: this.account,
2172
+ error: this.error,
2173
+ jobId: this.jobId,
2174
+ title: this.title,
2175
+ url: this.url,
2176
+ reportId: this.reportId
2177
+ };
2178
+ }
2179
+ }
2180
+
2181
+ /**
2182
+ * Generated bundle index. Do not edit.
2183
+ */
2184
+
2185
+ 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 };
2186
+ //# sourceMappingURL=ironcode-vas-lib.mjs.map