@ironcode/vas-lib 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (547) hide show
  1. package/README.md +24 -0
  2. package/cjs/lib/control-value/index.d.ts +2 -0
  3. package/cjs/lib/control-value/index.d.ts.map +1 -0
  4. package/cjs/lib/control-value/index.js +5 -0
  5. package/cjs/lib/control-value/index.js.map +1 -0
  6. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts +8 -0
  7. package/cjs/lib/control-value/vas-camera-control-value.model.d.ts.map +1 -0
  8. package/cjs/lib/control-value/vas-camera-control-value.model.js +12 -0
  9. package/cjs/lib/control-value/vas-camera-control-value.model.js.map +1 -0
  10. package/cjs/lib/controls-config/index.d.ts +4 -0
  11. package/cjs/lib/controls-config/index.d.ts.map +1 -0
  12. package/cjs/lib/controls-config/index.js +7 -0
  13. package/cjs/lib/controls-config/index.js.map +1 -0
  14. package/cjs/lib/controls-config/vas-control-config-direction.enum.d.ts +5 -0
  15. package/cjs/lib/controls-config/vas-control-config-direction.enum.d.ts.map +1 -0
  16. package/cjs/lib/controls-config/vas-control-config-direction.enum.js +11 -0
  17. package/cjs/lib/controls-config/vas-control-config-direction.enum.js.map +1 -0
  18. package/cjs/lib/controls-config/vas-control-config.model.d.ts +8 -0
  19. package/cjs/lib/controls-config/vas-control-config.model.d.ts.map +1 -0
  20. package/cjs/lib/controls-config/vas-control-config.model.js +3 -0
  21. package/cjs/lib/controls-config/vas-control-config.model.js.map +1 -0
  22. package/cjs/lib/controls-config/vas-select-control-config.model.d.ts +10 -0
  23. package/cjs/lib/controls-config/vas-select-control-config.model.d.ts.map +1 -0
  24. package/cjs/lib/controls-config/vas-select-control-config.model.js +3 -0
  25. package/cjs/lib/controls-config/vas-select-control-config.model.js.map +1 -0
  26. package/cjs/lib/entity/index.d.ts +60 -0
  27. package/cjs/lib/entity/index.d.ts.map +1 -0
  28. package/cjs/lib/entity/index.js +63 -0
  29. package/cjs/lib/entity/index.js.map +1 -0
  30. package/cjs/lib/entity/vas-access-group.dto.d.ts +7 -0
  31. package/cjs/lib/entity/vas-access-group.dto.d.ts.map +1 -0
  32. package/cjs/lib/entity/vas-access-group.dto.js +3 -0
  33. package/cjs/lib/entity/vas-access-group.dto.js.map +1 -0
  34. package/cjs/lib/entity/vas-account-config.dto.d.ts +8 -0
  35. package/cjs/lib/entity/vas-account-config.dto.d.ts.map +1 -0
  36. package/cjs/lib/entity/vas-account-config.dto.js +3 -0
  37. package/cjs/lib/entity/vas-account-config.dto.js.map +1 -0
  38. package/{lib → cjs/lib/entity}/vas-account-object.dto.d.ts +1 -0
  39. package/cjs/lib/entity/vas-account-object.dto.d.ts.map +1 -0
  40. package/cjs/lib/entity/vas-account-object.dto.js +3 -0
  41. package/cjs/lib/entity/vas-account-object.dto.js.map +1 -0
  42. package/cjs/lib/entity/vas-account-object.model.d.ts +16 -0
  43. package/cjs/lib/entity/vas-account-object.model.d.ts.map +1 -0
  44. package/cjs/lib/entity/vas-account-object.model.js +28 -0
  45. package/cjs/lib/entity/vas-account-object.model.js.map +1 -0
  46. package/cjs/lib/entity/vas-account.dto.d.ts +55 -0
  47. package/cjs/lib/entity/vas-account.dto.d.ts.map +1 -0
  48. package/cjs/lib/entity/vas-account.dto.js +10 -0
  49. package/cjs/lib/entity/vas-account.dto.js.map +1 -0
  50. package/{lib → cjs/lib/entity}/vas-base.dto.d.ts +3 -0
  51. package/cjs/lib/entity/vas-base.dto.d.ts.map +1 -0
  52. package/cjs/lib/entity/vas-base.dto.js +3 -0
  53. package/cjs/lib/entity/vas-base.dto.js.map +1 -0
  54. package/{lib → cjs/lib/entity}/vas-base.model.d.ts +4 -10
  55. package/cjs/lib/entity/vas-base.model.d.ts.map +1 -0
  56. package/cjs/lib/entity/vas-base.model.js +21 -0
  57. package/cjs/lib/entity/vas-base.model.js.map +1 -0
  58. package/cjs/lib/entity/vas-branch.dto.d.ts +22 -0
  59. package/cjs/lib/entity/vas-branch.dto.d.ts.map +1 -0
  60. package/cjs/lib/entity/vas-branch.dto.js +3 -0
  61. package/cjs/lib/entity/vas-branch.dto.js.map +1 -0
  62. package/cjs/lib/entity/vas-branch.model.d.ts +37 -0
  63. package/cjs/lib/entity/vas-branch.model.d.ts.map +1 -0
  64. package/cjs/lib/entity/vas-branch.model.js +72 -0
  65. package/cjs/lib/entity/vas-branch.model.js.map +1 -0
  66. package/cjs/lib/entity/vas-contact-type.dto.d.ts +8 -0
  67. package/cjs/lib/entity/vas-contact-type.dto.d.ts.map +1 -0
  68. package/cjs/lib/entity/vas-contact-type.dto.js +3 -0
  69. package/cjs/lib/entity/vas-contact-type.dto.js.map +1 -0
  70. package/cjs/lib/entity/vas-contact.dto.d.ts +17 -0
  71. package/cjs/lib/entity/vas-contact.dto.d.ts.map +1 -0
  72. package/cjs/lib/entity/vas-contact.dto.js +3 -0
  73. package/cjs/lib/entity/vas-contact.dto.js.map +1 -0
  74. package/cjs/lib/entity/vas-contact.model.d.ts +33 -0
  75. package/cjs/lib/entity/vas-contact.model.d.ts.map +1 -0
  76. package/cjs/lib/entity/vas-contact.model.js +69 -0
  77. package/cjs/lib/entity/vas-contact.model.js.map +1 -0
  78. package/{lib → cjs/lib/entity}/vas-control-type.dto.d.ts +1 -0
  79. package/cjs/lib/entity/vas-control-type.dto.d.ts.map +1 -0
  80. package/cjs/lib/entity/vas-control-type.dto.js +3 -0
  81. package/cjs/lib/entity/vas-control-type.dto.js.map +1 -0
  82. package/{lib → cjs/lib/entity}/vas-control-type.model.d.ts +6 -9
  83. package/cjs/lib/entity/vas-control-type.model.d.ts.map +1 -0
  84. package/cjs/lib/entity/vas-control-type.model.js +57 -0
  85. package/cjs/lib/entity/vas-control-type.model.js.map +1 -0
  86. package/{lib → cjs/lib/entity}/vas-control.dto.d.ts +5 -1
  87. package/cjs/lib/entity/vas-control.dto.d.ts.map +1 -0
  88. package/cjs/lib/entity/vas-control.dto.js +3 -0
  89. package/cjs/lib/entity/vas-control.dto.js.map +1 -0
  90. package/{lib → cjs/lib/entity}/vas-control.model.d.ts +19 -32
  91. package/cjs/lib/entity/vas-control.model.d.ts.map +1 -0
  92. package/cjs/lib/entity/vas-control.model.js +163 -0
  93. package/cjs/lib/entity/vas-control.model.js.map +1 -0
  94. package/cjs/lib/entity/vas-field.dto.d.ts +11 -0
  95. package/cjs/lib/entity/vas-field.dto.d.ts.map +1 -0
  96. package/cjs/lib/entity/vas-field.dto.js +3 -0
  97. package/cjs/lib/entity/vas-field.dto.js.map +1 -0
  98. package/cjs/lib/entity/vas-field.model.d.ts +46 -0
  99. package/cjs/lib/entity/vas-field.model.d.ts.map +1 -0
  100. package/cjs/lib/entity/vas-field.model.js +92 -0
  101. package/cjs/lib/entity/vas-field.model.js.map +1 -0
  102. package/cjs/lib/entity/vas-file.dto.d.ts +23 -0
  103. package/cjs/lib/entity/vas-file.dto.d.ts.map +1 -0
  104. package/cjs/lib/entity/vas-file.dto.js +13 -0
  105. package/cjs/lib/entity/vas-file.dto.js.map +1 -0
  106. package/cjs/lib/entity/vas-file.model.d.ts +43 -0
  107. package/cjs/lib/entity/vas-file.model.d.ts.map +1 -0
  108. package/cjs/lib/entity/vas-file.model.js +124 -0
  109. package/cjs/lib/entity/vas-file.model.js.map +1 -0
  110. package/cjs/lib/entity/vas-fire-user.dto.d.ts +16 -0
  111. package/cjs/lib/entity/vas-fire-user.dto.d.ts.map +1 -0
  112. package/cjs/lib/entity/vas-fire-user.dto.js +3 -0
  113. package/cjs/lib/entity/vas-fire-user.dto.js.map +1 -0
  114. package/cjs/lib/entity/vas-fire-user.model.d.ts +56 -0
  115. package/cjs/lib/entity/vas-fire-user.model.d.ts.map +1 -0
  116. package/cjs/lib/entity/vas-fire-user.model.js +107 -0
  117. package/cjs/lib/entity/vas-fire-user.model.js.map +1 -0
  118. package/cjs/lib/entity/vas-form-config.dto.d.ts +9 -0
  119. package/cjs/lib/entity/vas-form-config.dto.d.ts.map +1 -0
  120. package/cjs/lib/entity/vas-form-config.dto.js +3 -0
  121. package/cjs/lib/entity/vas-form-config.dto.js.map +1 -0
  122. package/{lib → cjs/lib/entity}/vas-form.dto.d.ts +7 -0
  123. package/cjs/lib/entity/vas-form.dto.d.ts.map +1 -0
  124. package/cjs/lib/entity/vas-form.dto.js +3 -0
  125. package/cjs/lib/entity/vas-form.dto.js.map +1 -0
  126. package/{lib → cjs/lib/entity}/vas-form.model.d.ts +28 -19
  127. package/cjs/lib/entity/vas-form.model.d.ts.map +1 -0
  128. package/cjs/lib/entity/vas-form.model.js +189 -0
  129. package/cjs/lib/entity/vas-form.model.js.map +1 -0
  130. package/{lib → cjs/lib/entity}/vas-group.dto.d.ts +2 -1
  131. package/cjs/lib/entity/vas-group.dto.d.ts.map +1 -0
  132. package/cjs/lib/entity/vas-group.dto.js +3 -0
  133. package/cjs/lib/entity/vas-group.dto.js.map +1 -0
  134. package/{lib → cjs/lib/entity}/vas-group.model.d.ts +5 -23
  135. package/cjs/lib/entity/vas-group.model.d.ts.map +1 -0
  136. package/{lib → cjs/lib}/entity/vas-group.model.js +19 -31
  137. package/cjs/lib/entity/vas-group.model.js.map +1 -0
  138. package/cjs/lib/entity/vas-instruction-job-field.dto.d.ts +6 -0
  139. package/cjs/lib/entity/vas-instruction-job-field.dto.d.ts.map +1 -0
  140. package/cjs/lib/entity/vas-instruction-job-field.dto.js +3 -0
  141. package/cjs/lib/entity/vas-instruction-job-field.dto.js.map +1 -0
  142. package/cjs/lib/entity/vas-instruction-job-field.model.d.ts +23 -0
  143. package/cjs/lib/entity/vas-instruction-job-field.model.d.ts.map +1 -0
  144. package/cjs/lib/entity/vas-instruction-job-field.model.js +46 -0
  145. package/cjs/lib/entity/vas-instruction-job-field.model.js.map +1 -0
  146. package/cjs/lib/entity/vas-instruction-job.dto.d.ts +16 -0
  147. package/cjs/lib/entity/vas-instruction-job.dto.d.ts.map +1 -0
  148. package/cjs/lib/entity/vas-instruction-job.dto.js +3 -0
  149. package/cjs/lib/entity/vas-instruction-job.dto.js.map +1 -0
  150. package/cjs/lib/entity/vas-instruction-job.model.d.ts +58 -0
  151. package/cjs/lib/entity/vas-instruction-job.model.d.ts.map +1 -0
  152. package/cjs/lib/entity/vas-instruction-job.model.js +85 -0
  153. package/cjs/lib/entity/vas-instruction-job.model.js.map +1 -0
  154. package/cjs/lib/entity/vas-instruction-provider.dto.d.ts +9 -0
  155. package/cjs/lib/entity/vas-instruction-provider.dto.d.ts.map +1 -0
  156. package/cjs/lib/entity/vas-instruction-provider.dto.js +3 -0
  157. package/cjs/lib/entity/vas-instruction-provider.dto.js.map +1 -0
  158. package/cjs/lib/entity/vas-instruction-provider.model.d.ts +34 -0
  159. package/cjs/lib/entity/vas-instruction-provider.model.d.ts.map +1 -0
  160. package/cjs/lib/entity/vas-instruction-provider.model.js +62 -0
  161. package/cjs/lib/entity/vas-instruction-provider.model.js.map +1 -0
  162. package/cjs/lib/entity/vas-instruction.dto.d.ts +6 -0
  163. package/cjs/lib/entity/vas-instruction.dto.d.ts.map +1 -0
  164. package/cjs/lib/entity/vas-instruction.dto.js +3 -0
  165. package/cjs/lib/entity/vas-instruction.dto.js.map +1 -0
  166. package/cjs/lib/entity/vas-instruction.model.d.ts +30 -0
  167. package/cjs/lib/entity/vas-instruction.model.d.ts.map +1 -0
  168. package/cjs/lib/entity/vas-instruction.model.js +53 -0
  169. package/cjs/lib/entity/vas-instruction.model.js.map +1 -0
  170. package/cjs/lib/entity/vas-invitation.d.ts +53 -0
  171. package/cjs/lib/entity/vas-invitation.d.ts.map +1 -0
  172. package/cjs/lib/entity/vas-invitation.js +89 -0
  173. package/cjs/lib/entity/vas-invitation.js.map +1 -0
  174. package/{lib → cjs/lib/entity}/vas-job-data.dto.d.ts +1 -0
  175. package/cjs/lib/entity/vas-job-data.dto.d.ts.map +1 -0
  176. package/cjs/lib/entity/vas-job-data.dto.js +3 -0
  177. package/cjs/lib/entity/vas-job-data.dto.js.map +1 -0
  178. package/cjs/lib/entity/vas-job-data.model.d.ts +19 -0
  179. package/cjs/lib/entity/vas-job-data.model.d.ts.map +1 -0
  180. package/cjs/lib/entity/vas-job-data.model.js +25 -0
  181. package/cjs/lib/entity/vas-job-data.model.js.map +1 -0
  182. package/cjs/lib/entity/vas-job-status.dto.d.ts +8 -0
  183. package/cjs/lib/entity/vas-job-status.dto.d.ts.map +1 -0
  184. package/cjs/lib/entity/vas-job-status.dto.js +3 -0
  185. package/cjs/lib/entity/vas-job-status.dto.js.map +1 -0
  186. package/cjs/lib/entity/vas-job-type.dto.d.ts +8 -0
  187. package/cjs/lib/entity/vas-job-type.dto.d.ts.map +1 -0
  188. package/cjs/lib/entity/vas-job-type.dto.js +3 -0
  189. package/cjs/lib/entity/vas-job-type.dto.js.map +1 -0
  190. package/cjs/lib/entity/vas-job.dto.d.ts +23 -0
  191. package/cjs/lib/entity/vas-job.dto.d.ts.map +1 -0
  192. package/cjs/lib/entity/vas-job.dto.js +3 -0
  193. package/cjs/lib/entity/vas-job.dto.js.map +1 -0
  194. package/cjs/lib/entity/vas-job.model.d.ts +232 -0
  195. package/cjs/lib/entity/vas-job.model.d.ts.map +1 -0
  196. package/cjs/lib/entity/vas-job.model.js +465 -0
  197. package/cjs/lib/entity/vas-job.model.js.map +1 -0
  198. package/cjs/lib/entity/vas-job.model.spec-data.d.ts +2 -0
  199. package/cjs/lib/entity/vas-job.model.spec-data.d.ts.map +1 -0
  200. package/cjs/lib/entity/vas-job.model.spec-data.js +29 -0
  201. package/cjs/lib/entity/vas-job.model.spec-data.js.map +1 -0
  202. package/cjs/lib/entity/vas-lookup-type.dto.d.ts +7 -0
  203. package/cjs/lib/entity/vas-lookup-type.dto.d.ts.map +1 -0
  204. package/cjs/lib/entity/vas-lookup-type.dto.js +3 -0
  205. package/cjs/lib/entity/vas-lookup-type.dto.js.map +1 -0
  206. package/cjs/lib/entity/vas-lookup.dto.d.ts +16 -0
  207. package/cjs/lib/entity/vas-lookup.dto.d.ts.map +1 -0
  208. package/cjs/lib/entity/vas-lookup.dto.js +3 -0
  209. package/cjs/lib/entity/vas-lookup.dto.js.map +1 -0
  210. package/cjs/lib/entity/vas-membership.dto.d.ts +12 -0
  211. package/cjs/lib/entity/vas-membership.dto.d.ts.map +1 -0
  212. package/cjs/lib/entity/vas-membership.dto.js +3 -0
  213. package/cjs/lib/entity/vas-membership.dto.js.map +1 -0
  214. package/cjs/lib/entity/vas-membership.model.d.ts +30 -0
  215. package/cjs/lib/entity/vas-membership.model.d.ts.map +1 -0
  216. package/cjs/lib/entity/vas-membership.model.js +66 -0
  217. package/cjs/lib/entity/vas-membership.model.js.map +1 -0
  218. package/cjs/lib/entity/vas-note.dto.d.ts +7 -0
  219. package/cjs/lib/entity/vas-note.dto.d.ts.map +1 -0
  220. package/cjs/lib/entity/vas-note.dto.js +3 -0
  221. package/cjs/lib/entity/vas-note.dto.js.map +1 -0
  222. package/cjs/lib/entity/vas-note.model.d.ts +31 -0
  223. package/cjs/lib/entity/vas-note.model.d.ts.map +1 -0
  224. package/cjs/lib/entity/vas-note.model.js +54 -0
  225. package/cjs/lib/entity/vas-note.model.js.map +1 -0
  226. package/{lib → cjs/lib/entity}/vas-report-layout.dto.d.ts +1 -0
  227. package/cjs/lib/entity/vas-report-layout.dto.d.ts.map +1 -0
  228. package/cjs/lib/entity/vas-report-layout.dto.js +3 -0
  229. package/cjs/lib/entity/vas-report-layout.dto.js.map +1 -0
  230. package/cjs/lib/entity/vas-report-layout.model.d.ts +20 -0
  231. package/cjs/lib/entity/vas-report-layout.model.d.ts.map +1 -0
  232. package/cjs/lib/entity/vas-report-layout.model.js +26 -0
  233. package/cjs/lib/entity/vas-report-layout.model.js.map +1 -0
  234. package/cjs/lib/entity/vas-report-request.dto.d.ts +9 -0
  235. package/cjs/lib/entity/vas-report-request.dto.d.ts.map +1 -0
  236. package/cjs/lib/entity/vas-report-request.dto.js +3 -0
  237. package/cjs/lib/entity/vas-report-request.dto.js.map +1 -0
  238. package/cjs/lib/entity/vas-report-request.model.d.ts +23 -0
  239. package/cjs/lib/entity/vas-report-request.model.d.ts.map +1 -0
  240. package/cjs/lib/entity/vas-report-request.model.js +51 -0
  241. package/cjs/lib/entity/vas-report-request.model.js.map +1 -0
  242. package/cjs/lib/entity/vas-report.dto.d.ts +13 -0
  243. package/cjs/lib/entity/vas-report.dto.d.ts.map +1 -0
  244. package/cjs/lib/entity/vas-report.dto.js +3 -0
  245. package/cjs/lib/entity/vas-report.dto.js.map +1 -0
  246. package/cjs/lib/entity/vas-report.model.d.ts +29 -0
  247. package/cjs/lib/entity/vas-report.model.d.ts.map +1 -0
  248. package/cjs/lib/entity/vas-report.model.js +61 -0
  249. package/cjs/lib/entity/vas-report.model.js.map +1 -0
  250. package/{lib → cjs/lib/entity}/vas-restricted-account-object.dto.d.ts +1 -0
  251. package/cjs/lib/entity/vas-restricted-account-object.dto.d.ts.map +1 -0
  252. package/cjs/lib/entity/vas-restricted-account-object.dto.js +3 -0
  253. package/cjs/lib/entity/vas-restricted-account-object.dto.js.map +1 -0
  254. package/cjs/lib/entity/vas-restricted-account-object.model.d.ts +16 -0
  255. package/cjs/lib/entity/vas-restricted-account-object.model.d.ts.map +1 -0
  256. package/cjs/lib/entity/vas-restricted-account-object.model.js +22 -0
  257. package/cjs/lib/entity/vas-restricted-account-object.model.js.map +1 -0
  258. package/cjs/lib/entity/vas-task-type.dto.d.ts +7 -0
  259. package/cjs/lib/entity/vas-task-type.dto.d.ts.map +1 -0
  260. package/cjs/lib/entity/vas-task-type.dto.js +3 -0
  261. package/cjs/lib/entity/vas-task-type.dto.js.map +1 -0
  262. package/cjs/lib/entity/vas-user.dto.d.ts +9 -0
  263. package/cjs/lib/entity/vas-user.dto.d.ts.map +1 -0
  264. package/cjs/lib/entity/vas-user.dto.js +3 -0
  265. package/cjs/lib/entity/vas-user.dto.js.map +1 -0
  266. package/{lib → cjs/lib/entity}/vas-user.model.d.ts +8 -3
  267. package/cjs/lib/entity/vas-user.model.d.ts.map +1 -0
  268. package/cjs/lib/entity/vas-user.model.js +46 -0
  269. package/cjs/lib/entity/vas-user.model.js.map +1 -0
  270. package/cjs/lib/model/geo-location.d.ts +13 -0
  271. package/cjs/lib/model/geo-location.d.ts.map +1 -0
  272. package/cjs/lib/model/geo-location.js +16 -0
  273. package/cjs/lib/model/geo-location.js.map +1 -0
  274. package/cjs/lib/model/index.d.ts +3 -0
  275. package/cjs/lib/model/index.d.ts.map +1 -0
  276. package/cjs/lib/model/index.js +6 -0
  277. package/cjs/lib/model/index.js.map +1 -0
  278. package/cjs/lib/model/vas-time-range.model.d.ts +5 -0
  279. package/cjs/lib/model/vas-time-range.model.d.ts.map +1 -0
  280. package/cjs/lib/model/vas-time-range.model.js +3 -0
  281. package/cjs/lib/model/vas-time-range.model.js.map +1 -0
  282. package/{lib → cjs/lib}/utils/find-form-control.d.ts +1 -0
  283. package/cjs/lib/utils/find-form-control.d.ts.map +1 -0
  284. package/cjs/lib/utils/find-form-control.js +25 -0
  285. package/cjs/lib/utils/find-form-control.js.map +1 -0
  286. package/cjs/lib/utils/get-value-by-path.d.ts +20 -0
  287. package/cjs/lib/utils/get-value-by-path.d.ts.map +1 -0
  288. package/cjs/lib/utils/get-value-by-path.js +68 -0
  289. package/cjs/lib/utils/get-value-by-path.js.map +1 -0
  290. package/cjs/lib/utils/is-array-string.d.ts +2 -0
  291. package/cjs/lib/utils/is-array-string.d.ts.map +1 -0
  292. package/cjs/lib/utils/is-array-string.js +8 -0
  293. package/cjs/lib/utils/is-array-string.js.map +1 -0
  294. package/cjs/package.json +61 -0
  295. package/cjs/public-api.d.ts +5 -0
  296. package/cjs/public-api.d.ts.map +1 -0
  297. package/cjs/public-api.js +8 -0
  298. package/cjs/public-api.js.map +1 -0
  299. package/esm2020/ironcode-vas-lib.mjs +5 -0
  300. package/esm2020/lib/control-value/index.mjs +2 -0
  301. package/esm2020/lib/control-value/vas-camera-control-value.model.mjs +8 -0
  302. package/esm2020/lib/controls-config/index.mjs +4 -0
  303. package/esm2020/lib/controls-config/vas-control-config-direction.enum.mjs +8 -0
  304. package/esm2020/lib/controls-config/vas-control-config.model.mjs +2 -0
  305. package/esm2020/lib/controls-config/vas-select-control-config.model.mjs +2 -0
  306. package/esm2020/lib/entity/index.mjs +60 -0
  307. package/esm2020/lib/entity/vas-access-group.dto.mjs +2 -0
  308. package/esm2020/lib/entity/vas-account-config.dto.mjs +2 -0
  309. package/esm2020/lib/entity/vas-account-object.dto.mjs +2 -0
  310. package/esm2020/lib/entity/vas-account-object.model.mjs +24 -0
  311. package/esm2020/lib/entity/vas-account.dto.mjs +7 -0
  312. package/esm2020/lib/entity/vas-base.dto.mjs +2 -0
  313. package/esm2020/lib/entity/vas-base.model.mjs +17 -0
  314. package/esm2020/lib/entity/vas-branch.dto.mjs +2 -0
  315. package/esm2020/lib/entity/vas-branch.model.mjs +68 -0
  316. package/esm2020/lib/entity/vas-contact-type.dto.mjs +2 -0
  317. package/esm2020/lib/entity/vas-contact.dto.mjs +2 -0
  318. package/esm2020/lib/entity/vas-contact.model.mjs +84 -0
  319. package/esm2020/lib/entity/vas-control-type.dto.mjs +2 -0
  320. package/esm2020/lib/entity/vas-control-type.model.mjs +53 -0
  321. package/esm2020/lib/entity/vas-control.dto.mjs +2 -0
  322. package/esm2020/lib/entity/vas-control.model.mjs +163 -0
  323. package/esm2020/lib/entity/vas-field.dto.mjs +2 -0
  324. package/esm2020/lib/entity/vas-field.model.mjs +92 -0
  325. package/esm2020/lib/entity/vas-file.dto.mjs +9 -0
  326. package/esm2020/lib/entity/vas-file.model.mjs +126 -0
  327. package/esm2020/lib/entity/vas-fire-user.dto.mjs +2 -0
  328. package/esm2020/lib/entity/vas-fire-user.model.mjs +102 -0
  329. package/esm2020/lib/entity/vas-form-config.dto.mjs +2 -0
  330. package/esm2020/lib/entity/vas-form.dto.mjs +2 -0
  331. package/esm2020/lib/entity/vas-form.model.mjs +185 -0
  332. package/esm2020/lib/entity/vas-group.dto.mjs +2 -0
  333. package/esm2020/lib/entity/vas-group.model.mjs +89 -0
  334. package/esm2020/lib/entity/vas-instruction-job-field.dto.mjs +2 -0
  335. package/esm2020/lib/entity/vas-instruction-job-field.model.mjs +42 -0
  336. package/esm2020/lib/entity/vas-instruction-job.dto.mjs +2 -0
  337. package/esm2020/lib/entity/vas-instruction-job.model.mjs +81 -0
  338. package/esm2020/lib/entity/vas-instruction-provider.dto.mjs +2 -0
  339. package/esm2020/lib/entity/vas-instruction-provider.model.mjs +63 -0
  340. package/esm2020/lib/entity/vas-instruction.dto.mjs +2 -0
  341. package/esm2020/lib/entity/vas-instruction.model.mjs +49 -0
  342. package/esm2020/lib/entity/vas-invitation.mjs +88 -0
  343. package/esm2020/lib/entity/vas-job-data.dto.mjs +2 -0
  344. package/esm2020/lib/entity/vas-job-data.model.mjs +21 -0
  345. package/esm2020/lib/entity/vas-job-status.dto.mjs +2 -0
  346. package/esm2020/lib/entity/vas-job-type.dto.mjs +2 -0
  347. package/esm2020/lib/entity/vas-job.dto.mjs +2 -0
  348. package/esm2020/lib/entity/vas-job.model.mjs +471 -0
  349. package/esm2020/lib/entity/vas-lookup-type.dto.mjs +2 -0
  350. package/esm2020/lib/entity/vas-lookup.dto.mjs +2 -0
  351. package/esm2020/lib/entity/vas-membership.dto.mjs +2 -0
  352. package/esm2020/lib/entity/vas-membership.model.mjs +62 -0
  353. package/esm2020/lib/entity/vas-note.dto.mjs +2 -0
  354. package/esm2020/lib/entity/vas-note.model.mjs +50 -0
  355. package/esm2020/lib/entity/vas-report-layout.dto.mjs +2 -0
  356. package/esm2020/lib/entity/vas-report-layout.model.mjs +22 -0
  357. package/esm2020/lib/entity/vas-report-request.dto.mjs +2 -0
  358. package/esm2020/lib/entity/vas-report-request.model.mjs +46 -0
  359. package/esm2020/lib/entity/vas-report.dto.mjs +2 -0
  360. package/esm2020/lib/entity/vas-report.model.mjs +57 -0
  361. package/esm2020/lib/entity/vas-restricted-account-object.dto.mjs +2 -0
  362. package/esm2020/lib/entity/vas-restricted-account-object.model.mjs +18 -0
  363. package/esm2020/lib/entity/vas-task-type.dto.mjs +2 -0
  364. package/esm2020/lib/entity/vas-user.dto.mjs +2 -0
  365. package/esm2020/lib/entity/vas-user.model.mjs +42 -0
  366. package/esm2020/lib/model/geo-location.mjs +12 -0
  367. package/esm2020/lib/model/index.mjs +3 -0
  368. package/esm2020/lib/model/vas-time-range.model.mjs +2 -0
  369. package/esm2020/lib/utils/get-value-by-path.mjs +64 -0
  370. package/esm2020/lib/utils/is-array-string.mjs +4 -0
  371. package/esm2020/public-api.mjs +5 -0
  372. package/fesm2015/ironcode-vas-lib.mjs +2134 -0
  373. package/fesm2015/ironcode-vas-lib.mjs.map +1 -0
  374. package/fesm2020/ironcode-vas-lib.mjs +2186 -0
  375. package/fesm2020/ironcode-vas-lib.mjs.map +1 -0
  376. package/index.d.ts +5 -0
  377. package/lib/control-value/index.d.ts +1 -0
  378. package/lib/control-value/vas-camera-control-value.model.d.ts +7 -0
  379. package/lib/controls-config/index.d.ts +3 -0
  380. package/lib/controls-config/vas-control-config-direction.enum.d.ts +4 -0
  381. package/lib/controls-config/vas-control-config.model.d.ts +7 -0
  382. package/lib/controls-config/vas-select-control-config.model.d.ts +9 -0
  383. package/lib/entity/index.d.ts +59 -0
  384. package/lib/entity/vas-access-group.dto.d.ts +6 -0
  385. package/lib/entity/vas-account-config.dto.d.ts +7 -0
  386. package/lib/entity/vas-account-object.model.d.ts +15 -0
  387. package/lib/entity/vas-account.dto.d.ts +54 -0
  388. package/lib/entity/vas-base.dto.d.ts +2 -0
  389. package/lib/entity/vas-base.model.d.ts +3 -10
  390. package/lib/entity/vas-branch.dto.d.ts +21 -0
  391. package/lib/entity/vas-branch.model.d.ts +36 -0
  392. package/lib/entity/vas-contact-type.dto.d.ts +7 -0
  393. package/lib/entity/vas-contact.dto.d.ts +16 -0
  394. package/lib/entity/vas-contact.model.d.ts +32 -0
  395. package/lib/entity/vas-control-type.model.d.ts +5 -9
  396. package/lib/entity/vas-control.dto.d.ts +4 -1
  397. package/lib/entity/vas-control.model.d.ts +18 -32
  398. package/lib/entity/vas-field.dto.d.ts +4 -2
  399. package/lib/entity/vas-field.model.d.ts +45 -0
  400. package/lib/entity/vas-file.dto.d.ts +16 -7
  401. package/lib/entity/vas-file.model.d.ts +42 -0
  402. package/lib/entity/vas-fire-user.dto.d.ts +15 -0
  403. package/lib/entity/vas-fire-user.model.d.ts +55 -0
  404. package/lib/entity/vas-form-config.dto.d.ts +8 -0
  405. package/lib/entity/vas-form.dto.d.ts +6 -0
  406. package/lib/entity/vas-form.model.d.ts +27 -19
  407. package/lib/entity/vas-group.dto.d.ts +1 -1
  408. package/lib/entity/vas-group.model.d.ts +4 -23
  409. package/lib/entity/vas-instruction-job-field.dto.d.ts +5 -0
  410. package/lib/entity/vas-instruction-job-field.model.d.ts +22 -0
  411. package/lib/entity/vas-instruction-job.dto.d.ts +15 -0
  412. package/lib/entity/vas-instruction-job.model.d.ts +57 -0
  413. package/lib/entity/vas-instruction-provider.dto.d.ts +8 -0
  414. package/lib/entity/vas-instruction-provider.model.d.ts +33 -0
  415. package/lib/entity/vas-instruction.dto.d.ts +5 -0
  416. package/lib/entity/vas-instruction.model.d.ts +29 -0
  417. package/lib/entity/vas-invitation.d.ts +52 -0
  418. package/lib/entity/vas-job-data.model.d.ts +18 -0
  419. package/lib/entity/vas-job-status.dto.d.ts +7 -0
  420. package/lib/entity/vas-job-type.dto.d.ts +7 -0
  421. package/lib/entity/vas-job.dto.d.ts +13 -2
  422. package/lib/entity/vas-job.model.d.ts +169 -40
  423. package/lib/entity/vas-lookup-type.dto.d.ts +6 -0
  424. package/lib/entity/vas-lookup.dto.d.ts +15 -0
  425. package/lib/entity/vas-membership.dto.d.ts +11 -0
  426. package/lib/entity/vas-membership.model.d.ts +29 -0
  427. package/lib/entity/vas-note.dto.d.ts +6 -0
  428. package/lib/entity/vas-note.model.d.ts +30 -0
  429. package/lib/entity/vas-report-layout.model.d.ts +19 -0
  430. package/lib/entity/vas-report-request.dto.d.ts +8 -0
  431. package/lib/entity/vas-report-request.model.d.ts +22 -0
  432. package/lib/entity/vas-report.dto.d.ts +12 -0
  433. package/lib/entity/vas-report.model.d.ts +28 -0
  434. package/lib/entity/vas-restricted-account-object.model.d.ts +15 -0
  435. package/lib/entity/vas-task-type.dto.d.ts +6 -0
  436. package/lib/entity/vas-user.dto.d.ts +4 -1
  437. package/lib/entity/vas-user.model.d.ts +7 -3
  438. package/lib/model/geo-location.d.ts +12 -0
  439. package/lib/model/index.d.ts +2 -0
  440. package/lib/model/vas-time-range.model.d.ts +4 -0
  441. package/lib/utils/get-value-by-path.d.ts +19 -0
  442. package/lib/utils/is-array-string.d.ts +1 -0
  443. package/package.json +25 -26
  444. package/public-api.d.ts +4 -0
  445. package/lib/entity/report-request.model.d.ts +0 -8
  446. package/lib/entity/report-request.model.js +0 -2
  447. package/lib/entity/report-request.model.js.map +0 -1
  448. package/lib/entity/vas-account-object.dto.js +0 -2
  449. package/lib/entity/vas-account-object.dto.js.map +0 -1
  450. package/lib/entity/vas-base.dto.js +0 -2
  451. package/lib/entity/vas-base.dto.js.map +0 -1
  452. package/lib/entity/vas-base.model.js +0 -24
  453. package/lib/entity/vas-base.model.js.map +0 -1
  454. package/lib/entity/vas-control-type.dto.js +0 -2
  455. package/lib/entity/vas-control-type.dto.js.map +0 -1
  456. package/lib/entity/vas-control-type.model.js +0 -53
  457. package/lib/entity/vas-control-type.model.js.map +0 -1
  458. package/lib/entity/vas-control.dto.js +0 -2
  459. package/lib/entity/vas-control.dto.js.map +0 -1
  460. package/lib/entity/vas-control.model.js +0 -132
  461. package/lib/entity/vas-control.model.js.map +0 -1
  462. package/lib/entity/vas-field.dto.js +0 -2
  463. package/lib/entity/vas-field.dto.js.map +0 -1
  464. package/lib/entity/vas-file.dto.js +0 -2
  465. package/lib/entity/vas-file.dto.js.map +0 -1
  466. package/lib/entity/vas-form.dto.js +0 -2
  467. package/lib/entity/vas-form.dto.js.map +0 -1
  468. package/lib/entity/vas-form.model.js +0 -144
  469. package/lib/entity/vas-form.model.js.map +0 -1
  470. package/lib/entity/vas-group.dto.js +0 -2
  471. package/lib/entity/vas-group.dto.js.map +0 -1
  472. package/lib/entity/vas-group.model.js.map +0 -1
  473. package/lib/entity/vas-job-data.dto.js +0 -2
  474. package/lib/entity/vas-job-data.dto.js.map +0 -1
  475. package/lib/entity/vas-job.dto.js +0 -2
  476. package/lib/entity/vas-job.dto.js.map +0 -1
  477. package/lib/entity/vas-job.model.js +0 -170
  478. package/lib/entity/vas-job.model.js.map +0 -1
  479. package/lib/entity/vas-report-layout.dto.js +0 -2
  480. package/lib/entity/vas-report-layout.dto.js.map +0 -1
  481. package/lib/entity/vas-restricted-account-object.dto.js +0 -2
  482. package/lib/entity/vas-restricted-account-object.dto.js.map +0 -1
  483. package/lib/entity/vas-user.dto.js +0 -2
  484. package/lib/entity/vas-user.dto.js.map +0 -1
  485. package/lib/entity/vas-user.model.js +0 -46
  486. package/lib/entity/vas-user.model.js.map +0 -1
  487. package/lib/ng-models/ng-control.model.d.ts +0 -14
  488. package/lib/ng-models/ng-control.model.js +0 -14
  489. package/lib/ng-models/ng-control.model.js.map +0 -1
  490. package/lib/ng-models/ng-form.model.d.ts +0 -27
  491. package/lib/ng-models/ng-form.model.js +0 -54
  492. package/lib/ng-models/ng-form.model.js.map +0 -1
  493. package/lib/ng-models/ng-group.model.d.ts +0 -36
  494. package/lib/ng-models/ng-group.model.js +0 -59
  495. package/lib/ng-models/ng-group.model.js.map +0 -1
  496. package/lib/report-request.model.d.ts +0 -8
  497. package/lib/report-request.model.js +0 -2
  498. package/lib/report-request.model.js.map +0 -1
  499. package/lib/utils/find-form-control.js +0 -20
  500. package/lib/utils/find-form-control.js.map +0 -1
  501. package/lib/vas-account-object.dto.js +0 -2
  502. package/lib/vas-account-object.dto.js.map +0 -1
  503. package/lib/vas-base.dto.js +0 -2
  504. package/lib/vas-base.dto.js.map +0 -1
  505. package/lib/vas-base.model.js +0 -24
  506. package/lib/vas-base.model.js.map +0 -1
  507. package/lib/vas-control-type.dto.js +0 -2
  508. package/lib/vas-control-type.dto.js.map +0 -1
  509. package/lib/vas-control-type.model.js +0 -53
  510. package/lib/vas-control-type.model.js.map +0 -1
  511. package/lib/vas-control.dto.js +0 -2
  512. package/lib/vas-control.dto.js.map +0 -1
  513. package/lib/vas-control.model.js +0 -132
  514. package/lib/vas-control.model.js.map +0 -1
  515. package/lib/vas-field.dto.d.ts +0 -8
  516. package/lib/vas-field.dto.js +0 -2
  517. package/lib/vas-field.dto.js.map +0 -1
  518. package/lib/vas-file.dto.d.ts +0 -13
  519. package/lib/vas-file.dto.js +0 -2
  520. package/lib/vas-file.dto.js.map +0 -1
  521. package/lib/vas-form.dto.js +0 -2
  522. package/lib/vas-form.dto.js.map +0 -1
  523. package/lib/vas-form.model.js +0 -144
  524. package/lib/vas-form.model.js.map +0 -1
  525. package/lib/vas-group.dto.js +0 -2
  526. package/lib/vas-group.dto.js.map +0 -1
  527. package/lib/vas-group.model.js +0 -105
  528. package/lib/vas-group.model.js.map +0 -1
  529. package/lib/vas-job-data.dto.js +0 -2
  530. package/lib/vas-job-data.dto.js.map +0 -1
  531. package/lib/vas-job.dto.d.ts +0 -11
  532. package/lib/vas-job.dto.js +0 -2
  533. package/lib/vas-job.dto.js.map +0 -1
  534. package/lib/vas-job.model.d.ts +0 -102
  535. package/lib/vas-job.model.js +0 -170
  536. package/lib/vas-job.model.js.map +0 -1
  537. package/lib/vas-job.model.spec.d.ts +0 -1
  538. package/lib/vas-job.model.spec.js +0 -18
  539. package/lib/vas-report-layout.dto.js +0 -2
  540. package/lib/vas-report-layout.dto.js.map +0 -1
  541. package/lib/vas-restricted-account-object.dto.js +0 -2
  542. package/lib/vas-restricted-account-object.dto.js.map +0 -1
  543. package/lib/vas-user.dto.d.ts +0 -5
  544. package/lib/vas-user.dto.js +0 -2
  545. package/lib/vas-user.dto.js.map +0 -1
  546. package/lib/vas-user.model.js +0 -46
  547. package/lib/vas-user.model.js.map +0 -1
@@ -0,0 +1,2134 @@
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) {
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
+ }
1216
+ static empty() {
1217
+ return new VasInstructionJobFieldModel('', '', '', '', '', '', '', '', '', '', '');
1218
+ }
1219
+ static fromDto(dto) {
1220
+ 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 || '');
1221
+ }
1222
+ toDto() {
1223
+ return {
1224
+ id: this.id,
1225
+ created: this.created,
1226
+ serverCreated: this.serverCreated,
1227
+ createdBy: this.createdBy,
1228
+ modified: this.modified,
1229
+ serverModified: this.serverModified,
1230
+ modifiedBy: this.modifiedBy,
1231
+ createdByName: this.createdByName,
1232
+ modifiedByName: this.modifiedByName,
1233
+ value: this.value,
1234
+ name: this.name,
1235
+ };
1236
+ }
1237
+ }
1238
+
1239
+ class VasReportModel extends VasJobDataModel {
1240
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job, reportLayoutId, title, sendEmail, message, attempted, completed, succeeded, attempts, notificationId) {
1241
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job);
1242
+ this.id = id;
1243
+ this.created = created;
1244
+ this.serverCreated = serverCreated;
1245
+ this.createdBy = createdBy;
1246
+ this.modified = modified;
1247
+ this.serverModified = serverModified;
1248
+ this.modifiedBy = modifiedBy;
1249
+ this.createdByName = createdByName;
1250
+ this.modifiedByName = modifiedByName;
1251
+ this.account = account;
1252
+ this.job = job;
1253
+ this.reportLayoutId = reportLayoutId;
1254
+ this.title = title;
1255
+ this.sendEmail = sendEmail;
1256
+ this.message = message;
1257
+ this.attempted = attempted;
1258
+ this.completed = completed;
1259
+ this.succeeded = succeeded;
1260
+ this.attempts = attempts;
1261
+ this.notificationId = notificationId;
1262
+ }
1263
+ static empty() {
1264
+ return VasReportModel.fromDto({});
1265
+ }
1266
+ static fromDto(dto) {
1267
+ 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 || '');
1268
+ }
1269
+ toDto() {
1270
+ return {
1271
+ id: this.id,
1272
+ created: this.created,
1273
+ serverCreated: this.serverCreated,
1274
+ createdBy: this.createdBy,
1275
+ modified: this.modified,
1276
+ serverModified: this.serverModified,
1277
+ modifiedBy: this.modifiedBy,
1278
+ createdByName: this.createdByName,
1279
+ modifiedByName: this.modifiedByName,
1280
+ account: this.account,
1281
+ job: this.job,
1282
+ reportLayoutId: this.reportLayoutId,
1283
+ title: this.title,
1284
+ sendEmail: this.sendEmail,
1285
+ message: this.message,
1286
+ attempted: this.attempted,
1287
+ completed: this.completed,
1288
+ succeeded: this.succeeded,
1289
+ attempts: this.attempts,
1290
+ notificationId: this.notificationId,
1291
+ };
1292
+ }
1293
+ }
1294
+
1295
+ /**
1296
+ * VasNoteModel
1297
+ */
1298
+ class VasInstructionJobModel extends VasBaseModel {
1299
+ /**
1300
+ * @param id id
1301
+ * @param created created
1302
+ * @param serverCreated serverCreated
1303
+ * @param createdBy createdBy
1304
+ * @param modified modified
1305
+ * @param serverModified serverModified
1306
+ * @param modifiedBy modifiedBy
1307
+ * @param reference reference
1308
+ * @param jobStatus jobStatus
1309
+ * @param createdByName createdByName
1310
+ * @param modifiedByName modifiedByName
1311
+ * @param notes notes
1312
+ * @param fields fields
1313
+ * @param files files
1314
+ * @param reports reports
1315
+ */
1316
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, reference, jobStatus, notes, fields, files, reports) {
1317
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName);
1318
+ this.id = id;
1319
+ this.created = created;
1320
+ this.serverCreated = serverCreated;
1321
+ this.createdBy = createdBy;
1322
+ this.modified = modified;
1323
+ this.serverModified = serverModified;
1324
+ this.modifiedBy = modifiedBy;
1325
+ this.createdByName = createdByName;
1326
+ this.modifiedByName = modifiedByName;
1327
+ this.reference = reference;
1328
+ this.jobStatus = jobStatus;
1329
+ this.notes = notes;
1330
+ this.fields = fields;
1331
+ this.files = files;
1332
+ this.reports = reports;
1333
+ }
1334
+ /**
1335
+ * @return empty VasInstructionJobModel
1336
+ */
1337
+ static empty() {
1338
+ return new VasInstructionJobModel('', '', '', '', '', '', '', '', '', '', '', [], [], [], []);
1339
+ }
1340
+ /**
1341
+ * @param dto VasInstructionDto
1342
+ * @return VasInstructionModel
1343
+ */
1344
+ static fromDto(dto) {
1345
+ 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)));
1346
+ }
1347
+ /**
1348
+ * @returns VasNoteDto
1349
+ */
1350
+ toDto() {
1351
+ return {
1352
+ id: this.id,
1353
+ created: this.created,
1354
+ serverCreated: this.serverCreated,
1355
+ createdBy: this.createdBy,
1356
+ modified: this.modified,
1357
+ serverModified: this.serverModified,
1358
+ modifiedBy: this.modifiedBy,
1359
+ reference: this.reference,
1360
+ jobStatus: this.jobStatus,
1361
+ createdByName: this.createdByName,
1362
+ modifiedByName: this.modifiedByName,
1363
+ notes: this.notes.map(m => m.toDto()),
1364
+ fields: this.fields.map(m => m.toDto()),
1365
+ files: this.files.map(m => m.toDto()),
1366
+ reports: this.reports.map(m => m.toDto()),
1367
+ };
1368
+ }
1369
+ }
1370
+
1371
+ /**
1372
+ * VasNoteModel
1373
+ */
1374
+ class VasInstructionModel extends VasAccountObjectModel {
1375
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, job) {
1376
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
1377
+ this.id = id;
1378
+ this.created = created;
1379
+ this.serverCreated = serverCreated;
1380
+ this.createdBy = createdBy;
1381
+ this.modified = modified;
1382
+ this.serverModified = serverModified;
1383
+ this.modifiedBy = modifiedBy;
1384
+ this.createdByName = createdByName;
1385
+ this.modifiedByName = modifiedByName;
1386
+ this.account = account;
1387
+ this.job = job;
1388
+ }
1389
+ /**
1390
+ * @param dto VasInstructionDto
1391
+ * @return VasInstructionModel
1392
+ */
1393
+ static fromDto(dto) {
1394
+ 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 ?
1395
+ VasInstructionJobModel.fromDto(dto.job) :
1396
+ VasInstructionJobModel.empty());
1397
+ }
1398
+ /**
1399
+ * @returns VasNoteDto
1400
+ */
1401
+ toDto() {
1402
+ return {
1403
+ id: this.id,
1404
+ created: this.created,
1405
+ serverCreated: this.serverCreated,
1406
+ createdBy: this.createdBy,
1407
+ modified: this.modified,
1408
+ serverModified: this.serverModified,
1409
+ modifiedBy: this.modifiedBy,
1410
+ createdByName: this.createdByName,
1411
+ modifiedByName: this.modifiedByName,
1412
+ account: this.account,
1413
+ job: this.job.toDto()
1414
+ };
1415
+ }
1416
+ }
1417
+
1418
+ /**
1419
+ * VasInstructionProviderModel
1420
+ */
1421
+ class VasInstructionProviderModel extends VasAccountObjectModel {
1422
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, form, title, secret, portalEnabled) {
1423
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
1424
+ this.id = id;
1425
+ this.created = created;
1426
+ this.serverCreated = serverCreated;
1427
+ this.createdBy = createdBy;
1428
+ this.modified = modified;
1429
+ this.serverModified = serverModified;
1430
+ this.modifiedBy = modifiedBy;
1431
+ this.createdByName = createdByName;
1432
+ this.modifiedByName = modifiedByName;
1433
+ this.account = account;
1434
+ this.form = form;
1435
+ this.title = title;
1436
+ this.secret = secret;
1437
+ this.portalEnabled = portalEnabled;
1438
+ }
1439
+ /**
1440
+ * @param dto VasInstructionDto
1441
+ * @return VasInstructionModel
1442
+ */
1443
+ static fromDto(dto) {
1444
+ 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 ?
1445
+ VasFormModel.fromDto(dto.form) :
1446
+ VasFormModel.empty(), dto.title || '', dto.secret || '', dto.portalEnabled || false);
1447
+ }
1448
+ /**
1449
+ * @returns VasNoteDto
1450
+ */
1451
+ toDto() {
1452
+ return {
1453
+ id: this.id,
1454
+ created: this.created,
1455
+ serverCreated: this.serverCreated,
1456
+ createdBy: this.createdBy,
1457
+ modified: this.modified,
1458
+ serverModified: this.serverModified,
1459
+ modifiedBy: this.modifiedBy,
1460
+ createdByName: this.createdByName,
1461
+ modifiedByName: this.modifiedByName,
1462
+ account: this.account,
1463
+ form: this.form.toDto(),
1464
+ title: this.title,
1465
+ secret: this.secret,
1466
+ portalEnabled: this.portalEnabled
1467
+ };
1468
+ }
1469
+ toApiDto(options) {
1470
+ return Object.assign(Object.assign({}, super.toApiDto(options)), { title: this.title, form: this.form.id, portalEnabled: this.portalEnabled });
1471
+ }
1472
+ }
1473
+
1474
+ /**
1475
+ * A non sophisticated way to get values from the job via paths. For example:
1476
+ *
1477
+ * getValueByPath(
1478
+ * ['foo', 'bar'],
1479
+ * {
1480
+ * foo: {
1481
+ * bar: 'value'
1482
+ * }
1483
+ * }
1484
+ * );
1485
+ *
1486
+ * will return "value"
1487
+ * @param {string[]} path
1488
+ * @param {Record<string, VasFieldDtoValue>} object
1489
+ * @return {T | undefined}
1490
+ */
1491
+ const getValueByPath = (path, object) => {
1492
+ switch (path.length) {
1493
+ case 0: {
1494
+ return;
1495
+ }
1496
+ case 1: {
1497
+ return (object)[path[0]];
1498
+ }
1499
+ case 2: {
1500
+ const val0 = object[path[0]];
1501
+ if (!val0) {
1502
+ return undefined;
1503
+ }
1504
+ return val0[path[1]];
1505
+ }
1506
+ case 3: {
1507
+ const val0 = object[path[0]];
1508
+ if (!val0) {
1509
+ return undefined;
1510
+ }
1511
+ const val1 = val0[path[1]];
1512
+ if (!val1) {
1513
+ return undefined;
1514
+ }
1515
+ return val1[path[2]];
1516
+ }
1517
+ case 4: {
1518
+ const val0 = object[path[0]];
1519
+ if (!val0) {
1520
+ return undefined;
1521
+ }
1522
+ const val1 = val0[path[1]];
1523
+ if (!val1) {
1524
+ return undefined;
1525
+ }
1526
+ const val2 = val1[path[2]];
1527
+ if (!val2) {
1528
+ return undefined;
1529
+ }
1530
+ return val2[path[3]];
1531
+ }
1532
+ default: {
1533
+ throw Error('path has too many segments');
1534
+ }
1535
+ }
1536
+ };
1537
+
1538
+ const getEmptyGeoLocation = () => ({
1539
+ accuracy: 0,
1540
+ altitude: 0,
1541
+ altitudeAccuracy: 0,
1542
+ geoPoint: [],
1543
+ lonLat: {
1544
+ lon: 0,
1545
+ lat: 0,
1546
+ },
1547
+ timestamp: ''
1548
+ });
1549
+
1550
+ const isArrayString = (value) => {
1551
+ return Array.isArray(value) && value.every(i => typeof i === 'string');
1552
+ };
1553
+
1554
+ /**
1555
+ * JobModel
1556
+ */
1557
+ class VasJobModel extends VasRestrictedAccountObjectModel {
1558
+ 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) {
1559
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
1560
+ this.id = id;
1561
+ this.created = created;
1562
+ this.serverCreated = serverCreated;
1563
+ this.createdBy = createdBy;
1564
+ this.modified = modified;
1565
+ this.serverModified = serverModified;
1566
+ this.modifiedBy = modifiedBy;
1567
+ this.createdByName = createdByName;
1568
+ this.modifiedByName = modifiedByName;
1569
+ this.account = account;
1570
+ this.accessGroup = accessGroup;
1571
+ this.reference = reference;
1572
+ this.jobDate = jobDate;
1573
+ this.jobStatus = jobStatus;
1574
+ this.jobType = jobType;
1575
+ this.assigneeId = assigneeId;
1576
+ this.formId = formId;
1577
+ this.timeZoneOffset = timeZoneOffset;
1578
+ this.pendingFields = pendingFields;
1579
+ this.childModified = childModified;
1580
+ this.version = version;
1581
+ this.fields = fields;
1582
+ this.files = files;
1583
+ this.createdByDisplayName = createdByDisplayName;
1584
+ this.modifiedByDisplayName = modifiedByDisplayName;
1585
+ this.geoLocation = geoLocation;
1586
+ }
1587
+ /**
1588
+ * Returns this with the dynamic interface
1589
+ * @return {VasJobModelDynamicInterface}
1590
+ */
1591
+ get $this() {
1592
+ return this;
1593
+ }
1594
+ /**
1595
+ * Returns a list of Job dynamic properties i.e. those that are added by the
1596
+ * dynamic forms
1597
+ */
1598
+ get dynamicProperties() {
1599
+ const nativeProps = this.staticProperties;
1600
+ return Object
1601
+ .getOwnPropertyNames(this)
1602
+ .filter(prop => !nativeProps.includes(prop));
1603
+ }
1604
+ /**
1605
+ * Returns a list of Job static properties i.e. those that are declared by
1606
+ * the type
1607
+ */
1608
+ get staticProperties() {
1609
+ return Object.getOwnPropertyNames(VasJobModel.empty());
1610
+ }
1611
+ /**
1612
+ * @return {VasJobModel}
1613
+ */
1614
+ static empty() {
1615
+ return new VasJobModel('', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', moment$1().utcOffset(), 0, '', 0, [], [], '', '', getEmptyGeoLocation());
1616
+ }
1617
+ static fromDto(dto) {
1618
+ 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());
1619
+ const emptyKeys = model.staticProperties;
1620
+ Object
1621
+ .keys(dto)
1622
+ .filter(key => emptyKeys.indexOf(key) === -1)
1623
+ .forEach((key) => model.$this[key] = dto[key]);
1624
+ return model;
1625
+ }
1626
+ /**
1627
+ * @param {VasFormModel} formModel
1628
+ * @return {Record<string, VasFieldDtoValue>}
1629
+ */
1630
+ getFields(formModel) {
1631
+ const fields = {};
1632
+ formModel.groups
1633
+ .forEach(group => {
1634
+ group.controls.forEach(control => {
1635
+ (fields)[control.reportTemplateName] =
1636
+ this.getValueByPath([group.name, control.name]);
1637
+ });
1638
+ });
1639
+ return fields;
1640
+ }
1641
+ /**
1642
+ * Will return an object whose keys are the names of all fields in the job.
1643
+ * This method is similar to `getFields` except that this method will only
1644
+ * return values where a value was set, as opposed to `getFields` which
1645
+ * return a property regardless (because it uses the form to drive the logic)
1646
+ * @return {Record<string, VasFieldDtoValue>}
1647
+ */
1648
+ getFields2() {
1649
+ let fields = {};
1650
+ this.dynamicProperties
1651
+ .forEach((groupName) => {
1652
+ Object
1653
+ .keys(this.$this[groupName])
1654
+ .forEach(controlName => {
1655
+ fields[controlName] = this.getValueByPath([groupName, controlName]);
1656
+ });
1657
+ }, {});
1658
+ return fields;
1659
+ }
1660
+ /**
1661
+ * Returns an object describing how many attachments were added to this job
1662
+ * (camera controls and files), and how many have not been uploaded yet.
1663
+ *
1664
+ * @param formModel instance of {@link VasFormModel} that was used when the
1665
+ * job was created
1666
+ */
1667
+ getFilesUploadStatus(formModel) {
1668
+ const pathsWithValue = formModel
1669
+ .getCameraControlPaths()
1670
+ .map(path => {
1671
+ const value = this.getValueByPath(path);
1672
+ if (value && !!value.id) {
1673
+ return path;
1674
+ }
1675
+ return null;
1676
+ })
1677
+ .filter(path => path !== null ? path : null)
1678
+ .filter(isArrayString);
1679
+ let total = pathsWithValue.length;
1680
+ total += this.files.length;
1681
+ // calculate the number of camera images still to upload
1682
+ let pending = pathsWithValue
1683
+ .map(path => this.getValueByPath(path))
1684
+ .map((value) => {
1685
+ if (isFileDto(value)) {
1686
+ return value.id && value.status !== 'COMPLETE';
1687
+ }
1688
+ else if (isCameraControlValueV1(value)) {
1689
+ // if url is not set, it hasn't been uploaded
1690
+ return value.id && !value.url;
1691
+ }
1692
+ return false;
1693
+ })
1694
+ .filter(hasUploaded => hasUploaded)
1695
+ .length;
1696
+ // add total from files that are pending
1697
+ pending += this.files
1698
+ .filter(value => value.status !== 'COMPLETED')
1699
+ .length;
1700
+ return {
1701
+ pending,
1702
+ total
1703
+ };
1704
+ }
1705
+ /**
1706
+ * This method will hydrate the `fields` property of the model. The reason for
1707
+ * this is that we have different ways to store the field data. One way, is
1708
+ * we store them as dynamic properties of the job. For example job.foo.bar,
1709
+ * where `foo` is the name of a Group, and `bar` is the name of a control.
1710
+ * Thus, when we create a job using a form in the client, the job object will
1711
+ * have its static properties (id, account, reference etc), and also a number
1712
+ * of dynamic properties determined by the Groups and Controls. This kind of
1713
+ * object is nice to work with in certain circumstances. However, the api
1714
+ * works differently. In the API a Job is a record, and references a number of
1715
+ * Field records. Each Field stores the value. Comparing these two models we
1716
+ * have:
1717
+ * A) job with dynamic properties, e.g.
1718
+ * {
1719
+ * id: <guid>,
1720
+ * reference: "something"
1721
+ * <other static job properties>...
1722
+ * foo: {
1723
+ * bar: "value"
1724
+ * }
1725
+ * }
1726
+ *
1727
+ * B) job with fields
1728
+ * {
1729
+ * id: <guid>,
1730
+ * reference: "something"
1731
+ * <other static job properties>...
1732
+ * <will not have dynamic properties>...
1733
+ * fields: [
1734
+ * {
1735
+ * id: <guid>,
1736
+ * <other field properties>,
1737
+ * value: "value"
1738
+ * }
1739
+ * ]
1740
+ * }
1741
+ *
1742
+ * So, what this method does is given a JobModel in the form of A, read all
1743
+ * of those dynamic properties and set them into `fields`. Doing this requires
1744
+ * knowledge of the Form that was used to create the job. Moreover, since the
1745
+ * dynamic properties do not contain the ids of the fields, we also allow to
1746
+ * pass in a `controlFieldIdMap`. This map stores the mapping between Control
1747
+ * and the Field that was created in the Job to store the value for that
1748
+ * Control. This is useful, if for example you want to compare a Job in form A
1749
+ * with a Job in form B, for example if you want to update the Job on the API
1750
+ * with a Job that was saved by a client in form A.
1751
+ *
1752
+ * E.g.
1753
+ * Client -> API: client requests form
1754
+ * User -> Client: user fills in the form and submits
1755
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1756
+ * Firestore -> Function: A function is triggered to sync the job to the API
1757
+ * Function -> API: Function checks if job already exists, it receives 404
1758
+ * Function -> Function: The function calls `hydrateFields(...)`
1759
+ * Function -> API: The function POST the Job to /jobs
1760
+ * Function -> API: The function POST each field to /fields
1761
+ *
1762
+ * Similarly, if the user updates the job
1763
+ * Client -> API: client requests form
1764
+ * User -> Client: user fills in the form and submits an update
1765
+ * Client -> Firestore: client saves the Job in form A i.e. dynamic props
1766
+ * Firestore -> Function: A function is triggered to sync the job to the API
1767
+ * Function -> API: Function checks if job already exists, it receives 200
1768
+ * Function -> Function: The function calls `hydrateFields(...)` passing in
1769
+ * the map is made by iterating over the fields it
1770
+ * received from the API and storing the mappings
1771
+ * between controlId and fieldId for each field
1772
+ * Function -> API: The function PATCH the Job to /jobs
1773
+ * Function -> API: The function POST/PATCH each field to /fields
1774
+ * treated as new
1775
+ *
1776
+ * @param {VasFormModel} formModel the VasFormModel that was used to create
1777
+ * the job
1778
+ * @param {Map<string, string>} controlFieldIdMap a mapping of control to
1779
+ * field ids. This is used to determine whether a new id for the field should
1780
+ * be generated, or to reuse an existing one from the map.
1781
+ * @param {Array<string>} controlNames if a value is provided, it will be used
1782
+ * to filter the fields that are returned.
1783
+ * @return {Array<VasFieldDto>}
1784
+ */
1785
+ hydrateFields(formModel, controlFieldIdMap = new Map(), controlNames) {
1786
+ const fields = [];
1787
+ formModel.groups
1788
+ .forEach(group => {
1789
+ group.controls.forEach(control => {
1790
+ if (!control.name.startsWith('fields.')) {
1791
+ return;
1792
+ }
1793
+ if (controlNames && !controlNames.includes(control.name)) {
1794
+ return;
1795
+ }
1796
+ fields.push(VasFieldModel.fromDto({
1797
+ // if the controlId exists in the map, use the associated fieldId,
1798
+ // otherwise generate a new id for the field.
1799
+ id: controlFieldIdMap.get(control.id) || UUID.UUID(),
1800
+ account: this.account,
1801
+ job: this.id,
1802
+ createdBy: this.createdBy,
1803
+ created: this.created,
1804
+ modifiedBy: this.modifiedBy,
1805
+ modified: this.modified,
1806
+ control: control.id,
1807
+ value: this.getValueByPath([group.name, control.name])
1808
+ }));
1809
+ });
1810
+ });
1811
+ this.fields = fields;
1812
+ }
1813
+ /**
1814
+ * @param {string[]} path path segments
1815
+ * @return {void}
1816
+ */
1817
+ getValueByPath(path = []) {
1818
+ return getValueByPath(path, this.$this);
1819
+ }
1820
+ /**
1821
+ * A very non sophisticated way to set values in the job via paths
1822
+ *
1823
+ * For example:
1824
+ *
1825
+ * setValueByPath('value', ['foo', 'bar']);
1826
+ *
1827
+ * will make results in job
1828
+ * {
1829
+ * foo: {
1830
+ * bar: 'value'
1831
+ * }
1832
+ * }
1833
+ *
1834
+ * @param {any} value the value to set
1835
+ * @param {string[]} path path segments
1836
+ */
1837
+ setValueByPath(value, path = []) {
1838
+ switch (path.length) {
1839
+ case 0: {
1840
+ return;
1841
+ }
1842
+ case 1: {
1843
+ this[path[0]] = value;
1844
+ return;
1845
+ }
1846
+ case 2: {
1847
+ // eslint-disable-next-line max-len
1848
+ this.$this[path[0]][path[1]] = value;
1849
+ return;
1850
+ }
1851
+ case 3: {
1852
+ // eslint-disable-next-line max-len
1853
+ this.$this[path[0]][path[1]][path[2]] = value;
1854
+ return;
1855
+ }
1856
+ default: {
1857
+ throw Error('path has too many segments');
1858
+ }
1859
+ }
1860
+ }
1861
+ /**
1862
+ * @param {boolean} staticOnly if true, will only output values for the static
1863
+ * properties in the dto
1864
+ * @return {VasJobDto}
1865
+ */
1866
+ toDto(staticOnly = false) {
1867
+ if (staticOnly) {
1868
+ return {
1869
+ id: this.id,
1870
+ created: this.created,
1871
+ createdBy: this.createdBy,
1872
+ modified: this.modified,
1873
+ modifiedBy: this.modifiedBy,
1874
+ serverCreated: this.serverCreated,
1875
+ serverModified: this.serverModified,
1876
+ createdByName: this.createdByName,
1877
+ modifiedByName: this.modifiedByName,
1878
+ account: this.account,
1879
+ accessGroup: this.accessGroup,
1880
+ reference: this.reference,
1881
+ jobDate: this.jobDate,
1882
+ jobStatus: this.jobStatus,
1883
+ jobType: this.jobType,
1884
+ assigneeId: this.assigneeId,
1885
+ formId: this.formId,
1886
+ timeZoneOffset: this.timeZoneOffset,
1887
+ pendingFields: this.pendingFields,
1888
+ childModified: this.childModified,
1889
+ version: this.version,
1890
+ fields: this.fields,
1891
+ files: this.files,
1892
+ createdByDisplayName: this.createdByDisplayName,
1893
+ modifiedByDisplayName: this.modifiedByDisplayName,
1894
+ geoLocation: this.geoLocation
1895
+ };
1896
+ }
1897
+ const dto = {};
1898
+ [...this.staticProperties, ...this.dynamicProperties]
1899
+ .forEach(prop => (dto)[prop] = this.$this[prop]);
1900
+ return dto;
1901
+ }
1902
+ /**
1903
+ * This method will parse a syntax that allows us to build strings from the
1904
+ * values of from the job model. For example if the job model was:
1905
+ *
1906
+ * {
1907
+ * foo: 'bar'
1908
+ * }
1909
+ *
1910
+ * and we pass "i am foo {foo}", the result would be:
1911
+ *
1912
+ * "i am foo bar"
1913
+ *
1914
+ * we can also use moment to parse dates, for example if the job model was:
1915
+ *
1916
+ * {
1917
+ * created: "2022-01-01T00:00:00+0000"
1918
+ * }
1919
+ *
1920
+ * and we pass "{created|date:YY-MM-DD}", the result would be:
1921
+ *
1922
+ * "2022-01-01"
1923
+ *
1924
+ * @param {string} value a string with the syntax
1925
+ * @param {ParseSyntaxOptions} options
1926
+ * @return {string} the results of parsing the syntax on this job
1927
+ */
1928
+ parseSyntax(value, options = {
1929
+ timeZoneOffset: 0
1930
+ }) {
1931
+ if (!value || typeof value !== 'string') {
1932
+ return '';
1933
+ }
1934
+ return value.replace(/({[^}]*})/g, (match, token) => {
1935
+ const syntax = token.substring(1, token.length - 1);
1936
+ let [key, filter] = syntax.split('|');
1937
+ key = (key || '').trim();
1938
+ filter = (filter || '').trim();
1939
+ let filterName, filterArg = '';
1940
+ if (filter) {
1941
+ const splitIndex = filter.indexOf(':');
1942
+ if (splitIndex !== -1) {
1943
+ filterName = filter.substring(0, splitIndex);
1944
+ filterArg = filter.substring(splitIndex + 1);
1945
+ }
1946
+ else {
1947
+ filterName = filter;
1948
+ filterArg = '';
1949
+ }
1950
+ filterName = (filterName || '').trim();
1951
+ filterArg = (filterArg || '').trim();
1952
+ }
1953
+ const path = key.split('.');
1954
+ const objectKey = path.shift() || '';
1955
+ let result = '';
1956
+ if (objectKey === 'job') {
1957
+ result = (this.getValueByPath(path) || '').toString();
1958
+ }
1959
+ else if (objectKey === 'fields') {
1960
+ result = (getValueByPath(path, this.getFields2()) || '').toString();
1961
+ }
1962
+ else if (objectKey.length) {
1963
+ if (options.objects) {
1964
+ if (options.objects[objectKey] === undefined) {
1965
+ console.debug(`objectKey ${objectKey} is not present in options.object`);
1966
+ result = '';
1967
+ }
1968
+ else {
1969
+ result = (getValueByPath(path, options.objects[objectKey]) || '')
1970
+ .toString();
1971
+ }
1972
+ }
1973
+ else {
1974
+ console.debug(`objectKey ${objectKey} was used but options.object is not set`);
1975
+ return '';
1976
+ }
1977
+ }
1978
+ else {
1979
+ return '';
1980
+ }
1981
+ if (filterName && result) {
1982
+ switch (filterName) {
1983
+ case 'date': {
1984
+ return moment$1(result)
1985
+ .utcOffset(options.timeZoneOffset)
1986
+ .format(filterArg || '');
1987
+ }
1988
+ default: {
1989
+ console.warn('unknown filter %s', filterName);
1990
+ }
1991
+ }
1992
+ }
1993
+ return result;
1994
+ }).trim();
1995
+ }
1996
+ ;
1997
+ /**
1998
+ * @return {object}
1999
+ */
2000
+ toApiDto() {
2001
+ 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 || '~' });
2002
+ }
2003
+ }
2004
+
2005
+ /**
2006
+ * VasMembershipModel
2007
+ */
2008
+ class VasMembershipModel extends VasAccountObjectModel {
2009
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, user, admin, lookupTypes, contactTypes, accessGroups, jobStatuses, jobTypes, taskTypes) {
2010
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
2011
+ this.id = id;
2012
+ this.created = created;
2013
+ this.serverCreated = serverCreated;
2014
+ this.createdBy = createdBy;
2015
+ this.modified = modified;
2016
+ this.serverModified = serverModified;
2017
+ this.modifiedBy = modifiedBy;
2018
+ this.createdByName = createdByName;
2019
+ this.modifiedByName = modifiedByName;
2020
+ this.account = account;
2021
+ this.user = user;
2022
+ this.admin = admin;
2023
+ this.lookupTypes = lookupTypes;
2024
+ this.contactTypes = contactTypes;
2025
+ this.accessGroups = accessGroups;
2026
+ this.jobStatuses = jobStatuses;
2027
+ this.jobTypes = jobTypes;
2028
+ this.taskTypes = taskTypes;
2029
+ }
2030
+ static empty() {
2031
+ return VasMembershipModel.fromDto({
2032
+ // eslint-disable-next-line new-cap
2033
+ id: UUID.UUID()
2034
+ });
2035
+ }
2036
+ static fromDto(dto) {
2037
+ return new VasMembershipModel(
2038
+ // eslint-disable-next-line new-cap
2039
+ 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 || []);
2040
+ }
2041
+ toDto() {
2042
+ return {
2043
+ id: this.id,
2044
+ created: this.created,
2045
+ serverCreated: this.serverCreated,
2046
+ createdBy: this.createdBy,
2047
+ modified: this.modified,
2048
+ serverModified: this.serverModified,
2049
+ modifiedBy: this.modifiedBy,
2050
+ createdByName: this.createdByName,
2051
+ modifiedByName: this.modifiedByName,
2052
+ account: this.account,
2053
+ user: this.user,
2054
+ admin: this.admin,
2055
+ lookupTypes: this.lookupTypes,
2056
+ contactTypes: this.contactTypes,
2057
+ accessGroups: this.accessGroups,
2058
+ jobStatuses: this.jobStatuses,
2059
+ jobTypes: this.jobTypes,
2060
+ taskTypes: this.taskTypes
2061
+ };
2062
+ }
2063
+ }
2064
+
2065
+ class VasReportLayoutModel extends VasRestrictedAccountObjectModel {
2066
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup, jobType, title, description, entryPoint) {
2067
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, accessGroup);
2068
+ this.id = id;
2069
+ this.created = created;
2070
+ this.serverCreated = serverCreated;
2071
+ this.createdBy = createdBy;
2072
+ this.modified = modified;
2073
+ this.serverModified = serverModified;
2074
+ this.modifiedBy = modifiedBy;
2075
+ this.createdByName = createdByName;
2076
+ this.modifiedByName = modifiedByName;
2077
+ this.account = account;
2078
+ this.accessGroup = accessGroup;
2079
+ this.jobType = jobType;
2080
+ this.title = title;
2081
+ this.description = description;
2082
+ this.entryPoint = entryPoint;
2083
+ }
2084
+ }
2085
+
2086
+ class VasReportRequestModel extends VasAccountObjectModel {
2087
+ constructor(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account, error, jobId, title, url, reportId) {
2088
+ super(id, created, serverCreated, createdBy, modified, serverModified, modifiedBy, createdByName, modifiedByName, account);
2089
+ this.id = id;
2090
+ this.created = created;
2091
+ this.serverCreated = serverCreated;
2092
+ this.createdBy = createdBy;
2093
+ this.modified = modified;
2094
+ this.serverModified = serverModified;
2095
+ this.modifiedBy = modifiedBy;
2096
+ this.createdByName = createdByName;
2097
+ this.modifiedByName = modifiedByName;
2098
+ this.account = account;
2099
+ this.error = error;
2100
+ this.jobId = jobId;
2101
+ this.title = title;
2102
+ this.url = url;
2103
+ this.reportId = reportId;
2104
+ }
2105
+ static fromDto(dto) {
2106
+ 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 || '');
2107
+ }
2108
+ toDto() {
2109
+ return {
2110
+ id: this.id,
2111
+ created: this.created,
2112
+ serverCreated: this.serverCreated,
2113
+ createdBy: this.createdBy,
2114
+ modified: this.modified,
2115
+ serverModified: this.serverModified,
2116
+ modifiedBy: this.modifiedBy,
2117
+ createdByName: this.createdByName,
2118
+ modifiedByName: this.modifiedByName,
2119
+ account: this.account,
2120
+ error: this.error,
2121
+ jobId: this.jobId,
2122
+ title: this.title,
2123
+ url: this.url,
2124
+ reportId: this.reportId
2125
+ };
2126
+ }
2127
+ }
2128
+
2129
+ /**
2130
+ * Generated bundle index. Do not edit.
2131
+ */
2132
+
2133
+ 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 };
2134
+ //# sourceMappingURL=ironcode-vas-lib.mjs.map