@ironcode/vas-lib 1.0.0 → 1.0.2

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