@sumaris-net/ngx-components 2.6.4-alpha4 → 2.6.4-alpha5

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 (1179) hide show
  1. package/.editorconfig +24 -0
  2. package/.eslintrc.json +74 -0
  3. package/.gitattribute +1 -0
  4. package/.github/CONTRIBUTING.md +10 -0
  5. package/.github/ISSUE_TEMPLATE.md +6 -0
  6. package/.github/PULL_REQUEST_TEMPLATE.md +10 -0
  7. package/.github/github_disclaimer.md +14 -0
  8. package/.gitlab-ci.yml +46 -0
  9. package/.graphqlconfig +15 -0
  10. package/angular.json +230 -0
  11. package/capacitor.config.json +9 -0
  12. package/ionic.config.json +7 -0
  13. package/karma.conf.js +32 -0
  14. package/ng-package.json +19 -0
  15. package/ngcc.config.js +14 -0
  16. package/package.json +137 -23
  17. package/public_api.ts +343 -0
  18. package/resources/android/build/tools/android-accept-licenses.sh +14 -0
  19. package/resources/android/icon/drawable-hdpi-icon.png +0 -0
  20. package/resources/android/icon/drawable-ldpi-icon.png +0 -0
  21. package/resources/android/icon/drawable-mdpi-icon.png +0 -0
  22. package/resources/android/icon/drawable-xhdpi-icon.png +0 -0
  23. package/resources/android/icon/drawable-xxhdpi-icon.png +0 -0
  24. package/resources/android/icon/drawable-xxxhdpi-icon.png +0 -0
  25. package/resources/android/splash/drawable-land-hdpi-screen.png +0 -0
  26. package/resources/android/splash/drawable-land-ldpi-screen.png +0 -0
  27. package/resources/android/splash/drawable-land-mdpi-screen.png +0 -0
  28. package/resources/android/splash/drawable-land-xhdpi-screen.png +0 -0
  29. package/resources/android/splash/drawable-land-xxhdpi-screen.png +0 -0
  30. package/resources/android/splash/drawable-land-xxxhdpi-screen.png +0 -0
  31. package/resources/android/splash/drawable-port-hdpi-screen.png +0 -0
  32. package/resources/android/splash/drawable-port-ldpi-screen.png +0 -0
  33. package/resources/android/splash/drawable-port-mdpi-screen.png +0 -0
  34. package/resources/android/splash/drawable-port-xhdpi-screen.png +0 -0
  35. package/resources/android/splash/drawable-port-xxhdpi-screen.png +0 -0
  36. package/resources/android/splash/drawable-port-xxxhdpi-screen.png +0 -0
  37. package/resources/android/splash/drawable-xxxhdpi-screen.png +0 -0
  38. package/resources/icon/TODO.md +11 -0
  39. package/resources/icon.png +0 -0
  40. package/resources/icon.png.md5 +1 -0
  41. package/resources/icon.xcf +0 -0
  42. package/resources/ios/icon/icon-1024.png +0 -0
  43. package/resources/ios/icon/icon-108@2x.png +0 -0
  44. package/resources/ios/icon/icon-20.png +0 -0
  45. package/resources/ios/icon/icon-20@2x.png +0 -0
  46. package/resources/ios/icon/icon-20@3x.png +0 -0
  47. package/resources/ios/icon/icon-24@2x.png +0 -0
  48. package/resources/ios/icon/icon-27.5@2x.png +0 -0
  49. package/resources/ios/icon/icon-29.png +0 -0
  50. package/resources/ios/icon/icon-29@2x.png +0 -0
  51. package/resources/ios/icon/icon-29@3x.png +0 -0
  52. package/resources/ios/icon/icon-40.png +0 -0
  53. package/resources/ios/icon/icon-40@2x.png +0 -0
  54. package/resources/ios/icon/icon-40@3x.png +0 -0
  55. package/resources/ios/icon/icon-44@2x.png +0 -0
  56. package/resources/ios/icon/icon-50.png +0 -0
  57. package/resources/ios/icon/icon-50@2x.png +0 -0
  58. package/resources/ios/icon/icon-60.png +0 -0
  59. package/resources/ios/icon/icon-60@2x.png +0 -0
  60. package/resources/ios/icon/icon-60@3x.png +0 -0
  61. package/resources/ios/icon/icon-72.png +0 -0
  62. package/resources/ios/icon/icon-72@2x.png +0 -0
  63. package/resources/ios/icon/icon-76.png +0 -0
  64. package/resources/ios/icon/icon-76@2x.png +0 -0
  65. package/resources/ios/icon/icon-83.5@2x.png +0 -0
  66. package/resources/ios/icon/icon-86@2x.png +0 -0
  67. package/resources/ios/icon/icon-98@2x.png +0 -0
  68. package/resources/ios/icon/icon-small.png +0 -0
  69. package/resources/ios/icon/icon-small@2x.png +0 -0
  70. package/resources/ios/icon/icon-small@3x.png +0 -0
  71. package/resources/ios/icon/icon.png +0 -0
  72. package/resources/ios/icon/icon@2x.png +0 -0
  73. package/resources/ios/splash/Default-1792h~iphone.png +0 -0
  74. package/resources/ios/splash/Default-2436h.png +0 -0
  75. package/resources/ios/splash/Default-2688h~iphone.png +0 -0
  76. package/resources/ios/splash/Default-568h@2x~iphone.png +0 -0
  77. package/resources/ios/splash/Default-667h.png +0 -0
  78. package/resources/ios/splash/Default-736h.png +0 -0
  79. package/resources/ios/splash/Default-Landscape-1792h~iphone.png +0 -0
  80. package/resources/ios/splash/Default-Landscape-2436h.png +0 -0
  81. package/resources/ios/splash/Default-Landscape-2688h~iphone.png +0 -0
  82. package/resources/ios/splash/Default-Landscape-736h.png +0 -0
  83. package/resources/ios/splash/Default-Landscape@2x~ipad.png +0 -0
  84. package/resources/ios/splash/Default-Landscape@~ipadpro.png +0 -0
  85. package/resources/ios/splash/Default-Landscape~ipad.png +0 -0
  86. package/resources/ios/splash/Default-Portrait@2x~ipad.png +0 -0
  87. package/resources/ios/splash/Default-Portrait@~ipadpro.png +0 -0
  88. package/resources/ios/splash/Default-Portrait~ipad.png +0 -0
  89. package/resources/ios/splash/Default@2x~iphone.png +0 -0
  90. package/resources/ios/splash/Default@2x~universal~anyany.png +0 -0
  91. package/resources/ios/splash/Default~iphone.png +0 -0
  92. package/resources/splash.png +0 -0
  93. package/resources/splash.png.md5 +1 -0
  94. package/scripts/build-android.sh +18 -0
  95. package/scripts/build-i18n.js +24 -0
  96. package/scripts/docker-start.sh +6 -0
  97. package/scripts/emulate-android.sh +17 -0
  98. package/scripts/env-android.sh +83 -0
  99. package/scripts/env-clean.sh +23 -0
  100. package/scripts/env-global.sh +156 -0
  101. package/scripts/install-android-sdk-tools.sh +73 -0
  102. package/scripts/ionic-update.sh +24 -0
  103. package/scripts/node/playground.ts +9 -0
  104. package/scripts/node/resources.js +90 -0
  105. package/scripts/release.sh +149 -0
  106. package/scripts/run-android.sh +59 -0
  107. package/scripts/test.sh +19 -0
  108. package/src/app/admin/admin-routing.module.ts +30 -0
  109. package/src/app/admin/admin.module.ts +23 -0
  110. package/src/app/admin/services/filter/person.filter.ts +77 -0
  111. package/src/app/admin/services/person.service.ts +212 -0
  112. package/src/app/admin/services/validator/person.validator.ts +37 -0
  113. package/src/app/admin/users/users.html +427 -0
  114. package/src/app/admin/users/users.module.ts +34 -0
  115. package/src/app/admin/users/users.scss +59 -0
  116. package/src/app/admin/users/users.ts +257 -0
  117. package/src/app/app-routing.module.ts +126 -0
  118. package/src/app/app.component.html +12 -0
  119. package/src/app/app.component.scss +4 -0
  120. package/src/app/app.component.ts +205 -0
  121. package/src/app/app.module.ts +326 -0
  122. package/src/app/core/about/about.modal.html +140 -0
  123. package/src/app/core/about/about.modal.scss +23 -0
  124. package/src/app/core/about/about.modal.ts +71 -0
  125. package/src/app/core/about/about.module.ts +24 -0
  126. package/src/app/core/account/account.module.ts +38 -0
  127. package/src/app/core/account/account.page.html +241 -0
  128. package/src/app/core/account/account.page.scss +21 -0
  129. package/src/app/core/account/account.page.ts +366 -0
  130. package/src/app/core/account/new-token.modal.html +120 -0
  131. package/src/app/core/account/new-token.modal.ts +138 -0
  132. package/src/app/core/account/token.table.html +177 -0
  133. package/src/app/core/account/token.table.scss +7 -0
  134. package/src/app/core/account/token.table.ts +141 -0
  135. package/src/app/core/auth/auth.form.html +77 -0
  136. package/src/app/core/auth/auth.form.scss +1 -0
  137. package/src/app/core/auth/auth.form.ts +145 -0
  138. package/src/app/core/auth/auth.modal.html +57 -0
  139. package/src/app/core/auth/auth.modal.scss +1 -0
  140. package/src/app/core/auth/auth.modal.ts +80 -0
  141. package/src/app/core/auth/auth.module.ts +33 -0
  142. package/src/app/core/core.module.ts +100 -0
  143. package/src/app/core/core.testing.module.ts +64 -0
  144. package/src/app/core/form/buttons/form-buttons-bar.component.html +59 -0
  145. package/src/app/core/form/buttons/form-buttons-bar.component.scss +14 -0
  146. package/src/app/core/form/buttons/form-buttons-bar.component.ts +70 -0
  147. package/src/app/core/form/buttons/form-buttons-bar.module.ts +24 -0
  148. package/src/app/core/form/entity/editor.class.ts +803 -0
  149. package/src/app/core/form/entity/entity-editor-modal.class.ts +537 -0
  150. package/src/app/core/form/entity/entity-editor.class.ts +885 -0
  151. package/src/app/core/form/entity/entity-metadata.component.html +53 -0
  152. package/src/app/core/form/entity/entity-metadata.component.scss +28 -0
  153. package/src/app/core/form/entity/entity-metadata.component.ts +19 -0
  154. package/src/app/core/form/entity/entity.module.ts +25 -0
  155. package/src/app/core/form/form.class.ts +401 -0
  156. package/src/app/core/form/form.module.ts +37 -0
  157. package/src/app/core/form/form.utils.ts +639 -0
  158. package/src/app/core/form/list/list.form.html +67 -0
  159. package/src/app/core/form/list/list.form.scss +40 -0
  160. package/src/app/core/form/list/list.form.ts +278 -0
  161. package/src/app/core/form/list/list.module.ts +25 -0
  162. package/src/app/core/form/properties/properties.form.html +129 -0
  163. package/src/app/core/form/properties/properties.form.ts +147 -0
  164. package/src/app/core/form/properties/properties.module.ts +30 -0
  165. package/src/app/core/form/properties/properties.table.html +219 -0
  166. package/src/app/core/form/properties/properties.table.scss +0 -0
  167. package/src/app/core/form/properties/properties.table.ts +291 -0
  168. package/src/app/core/form/properties/property.validator.ts +22 -0
  169. package/src/app/core/form/properties/testing/properties-form.test.html +21 -0
  170. package/src/app/core/form/properties/testing/properties-form.test.ts +102 -0
  171. package/src/app/core/form/properties/testing/properties-form.testing.module.ts +25 -0
  172. package/src/app/core/form/text-popover/testing/text-popover.testing.html +45 -0
  173. package/src/app/core/form/text-popover/testing/text-popover.testing.module.ts +32 -0
  174. package/src/app/core/form/text-popover/testing/text-popover.testing.ts +77 -0
  175. package/src/app/core/form/text-popover/text-form.component.html +44 -0
  176. package/src/app/core/form/text-popover/text-form.component.scss +8 -0
  177. package/src/app/core/form/text-popover/text-form.component.ts +65 -0
  178. package/src/app/core/form/text-popover/text-popover.component.html +86 -0
  179. package/src/app/core/form/text-popover/text-popover.component.scss +7 -0
  180. package/src/app/core/form/text-popover/text-popover.component.ts +165 -0
  181. package/src/app/core/form/text-popover/text-popover.module.ts +27 -0
  182. package/src/app/core/graphql/graphql.module.ts +17 -0
  183. package/src/app/core/graphql/graphql.service.ts +969 -0
  184. package/src/app/core/graphql/graphql.utils.ts +167 -0
  185. package/src/app/core/home/home.html +211 -0
  186. package/src/app/core/home/home.module.ts +32 -0
  187. package/src/app/core/home/home.scss +242 -0
  188. package/src/app/core/home/home.ts +298 -0
  189. package/src/app/core/icon/icon.component.html +15 -0
  190. package/src/app/core/icon/icon.component.ts +23 -0
  191. package/src/app/core/icon/icon.module.ts +22 -0
  192. package/src/app/core/install/install-upgrade-card.component.html +144 -0
  193. package/src/app/core/install/install-upgrade-card.component.scss +4 -0
  194. package/src/app/core/install/install-upgrade-card.component.ts +412 -0
  195. package/src/app/core/install/install-upgrade-card.module.ts +23 -0
  196. package/src/app/core/menu/menu.component.html +135 -0
  197. package/src/app/core/menu/menu.component.scss +225 -0
  198. package/src/app/core/menu/menu.component.ts +352 -0
  199. package/src/app/core/menu/menu.model.ts +64 -0
  200. package/src/app/core/menu/menu.module.ts +27 -0
  201. package/src/app/core/menu/menu.service.ts +62 -0
  202. package/src/app/core/offline/update-offline-mode-card.component.html +45 -0
  203. package/src/app/core/offline/update-offline-mode-card.component.scss +4 -0
  204. package/src/app/core/offline/update-offline-mode-card.component.ts +28 -0
  205. package/src/app/core/offline/update-offline-mode-card.module.ts +24 -0
  206. package/src/app/core/peer/select-peer.modal.html +123 -0
  207. package/src/app/core/peer/select-peer.modal.scss +20 -0
  208. package/src/app/core/peer/select-peer.modal.ts +197 -0
  209. package/src/app/core/peer/select-peer.module.ts +28 -0
  210. package/src/app/core/register/register-confirm.page.html +55 -0
  211. package/src/app/core/register/register-confirm.page.scss +121 -0
  212. package/src/app/core/register/register-confirm.page.ts +94 -0
  213. package/src/app/core/register/register.form.html +125 -0
  214. package/src/app/core/register/register.form.scss +10 -0
  215. package/src/app/core/register/register.form.ts +213 -0
  216. package/src/app/core/register/register.modal.html +70 -0
  217. package/src/app/core/register/register.modal.ts +52 -0
  218. package/src/app/core/register/register.module.ts +31 -0
  219. package/src/app/core/services/account.service.ts +1431 -0
  220. package/src/app/core/services/auth-guard.service.ts +70 -0
  221. package/src/app/core/services/base-entity-service.class.ts +598 -0
  222. package/src/app/core/services/base-graphql-service.class.ts +298 -0
  223. package/src/app/core/services/base58.ts +83 -0
  224. package/src/app/core/services/config/account.config.ts +35 -0
  225. package/src/app/core/services/config/core.config.ts +180 -0
  226. package/src/app/core/services/config.service.ts +414 -0
  227. package/src/app/core/services/crypto.service.ts +126 -0
  228. package/src/app/core/services/errors.ts +67 -0
  229. package/src/app/core/services/local-settings.service.spec.ts +32 -0
  230. package/src/app/core/services/local-settings.service.ts +548 -0
  231. package/src/app/core/services/model/account.model.ts +141 -0
  232. package/src/app/core/services/model/config.model.ts +122 -0
  233. package/src/app/core/services/model/department.model.ts +34 -0
  234. package/src/app/core/services/model/entity.decorators.ts +112 -0
  235. package/src/app/core/services/model/entity.model.ts +326 -0
  236. package/src/app/core/services/model/filter.model.ts +139 -0
  237. package/src/app/core/services/model/history.model.ts +25 -0
  238. package/src/app/core/services/model/model.enum.ts +11 -0
  239. package/src/app/core/services/model/peer.model.ts +86 -0
  240. package/src/app/core/services/model/person.model.ts +112 -0
  241. package/src/app/core/services/model/referential.model.ts +244 -0
  242. package/src/app/core/services/model/settings.model.ts +32 -0
  243. package/src/app/core/services/model/token.model.ts +54 -0
  244. package/src/app/core/services/network.service.spec.ts +49 -0
  245. package/src/app/core/services/network.service.ts +729 -0
  246. package/src/app/core/services/network.types.ts +26 -0
  247. package/src/app/core/services/network.utils.ts +57 -0
  248. package/src/app/core/services/pipes/account.pipes.ts +25 -0
  249. package/src/app/core/services/pipes/department-to-string.pipe.ts +15 -0
  250. package/src/app/core/services/pipes/person-to-string.pipe.ts +15 -0
  251. package/src/app/core/services/pipes/usage-mode.pipes.ts +26 -0
  252. package/src/app/core/services/platform.service.spec.ts +56 -0
  253. package/src/app/core/services/platform.service.ts +605 -0
  254. package/src/app/core/services/storage/entities-storage.service.ts +542 -0
  255. package/src/app/core/services/storage/entity-store.class.ts +598 -0
  256. package/src/app/core/services/testing/referential-filter.model.ts +28 -0
  257. package/src/app/core/services/testing/referential.validator.ts +57 -0
  258. package/src/app/core/services/validator/account.validator.ts +58 -0
  259. package/src/app/core/services/validator/base.validator.class.ts +54 -0
  260. package/src/app/core/services/validator/local-settings.validator.ts +72 -0
  261. package/src/app/core/services/validator/user-settings.validator.ts +25 -0
  262. package/src/app/core/services/validator/user-token.validator.ts +55 -0
  263. package/src/app/core/settings/settings.module.ts +24 -0
  264. package/src/app/core/settings/settings.page.html +264 -0
  265. package/src/app/core/settings/settings.page.ts +365 -0
  266. package/src/app/core/table/actions-column.component.html +91 -0
  267. package/src/app/core/table/actions-column.component.ts +70 -0
  268. package/src/app/core/table/async-table.class.ts +1934 -0
  269. package/src/app/core/table/entities-async-table-datasource.class.ts +482 -0
  270. package/src/app/core/table/entities-table-datasource.class.ts +496 -0
  271. package/src/app/core/table/memory-table.class.ts +65 -0
  272. package/src/app/core/table/table-select-columns.component.html +58 -0
  273. package/src/app/core/table/table-select-columns.component.ts +50 -0
  274. package/src/app/core/table/table.class.ts +1973 -0
  275. package/src/app/core/table/table.model.ts +35 -0
  276. package/src/app/core/table/table.module.ts +26 -0
  277. package/src/app/core/table/table.utils.ts +38 -0
  278. package/src/app/core/table/testing/multi-table.testing.ts +261 -0
  279. package/src/app/core/table/testing/table-validator.service.ts +25 -0
  280. package/src/app/core/table/testing/table.testing.html +396 -0
  281. package/src/app/core/table/testing/table.testing.module.ts +25 -0
  282. package/src/app/core/table/testing/table.testing.scss +23 -0
  283. package/src/app/core/table/testing/table.testing.ts +292 -0
  284. package/src/app/shared/alerts.ts +292 -0
  285. package/src/app/shared/audio/audio.testing.html +33 -0
  286. package/src/app/shared/audio/audio.testing.module.ts +32 -0
  287. package/src/app/shared/audio/audio.testing.ts +31 -0
  288. package/src/app/shared/audio/audio.ts +278 -0
  289. package/src/app/shared/base64.utils.ts +66 -0
  290. package/src/app/shared/capacitor/keyboard.ts +40 -0
  291. package/src/app/shared/capacitor/plugins.ts +12 -0
  292. package/src/app/shared/constants.ts +12 -0
  293. package/src/app/shared/dates.ts +163 -0
  294. package/src/app/shared/debug/debug-service.class.ts +8 -0
  295. package/src/app/shared/debug/debug.component.html +13 -0
  296. package/src/app/shared/debug/debug.component.scss +24 -0
  297. package/src/app/shared/debug/debug.component.spec.ts +25 -0
  298. package/src/app/shared/debug/debug.component.ts +27 -0
  299. package/src/app/shared/debug/debug.module.ts +28 -0
  300. package/src/app/shared/directives/autofocus.directive.ts +109 -0
  301. package/src/app/shared/directives/autotitle.directive.ts +24 -0
  302. package/src/app/shared/directives/directives.module.ts +29 -0
  303. package/src/app/shared/directives/drag-and-drop.directive.ts +47 -0
  304. package/src/app/shared/directives/ng-var.directive.ts +32 -0
  305. package/src/app/shared/directives/resizable/resizable.component.ts +47 -0
  306. package/src/app/shared/directives/resizable/resizable.directive.ts +43 -0
  307. package/src/app/shared/directives/resizable/resizable.module.ts +9 -0
  308. package/src/app/shared/directives/resizable/resizable.style.scss +44 -0
  309. package/src/app/shared/directives/resizable/resizable.template.html +6 -0
  310. package/src/app/shared/events.ts +96 -0
  311. package/src/app/shared/file/csv.utils.ts +94 -0
  312. package/src/app/shared/file/file.service.ts +132 -0
  313. package/src/app/shared/file/file.utils.ts +138 -0
  314. package/src/app/shared/file/images.utils.ts +198 -0
  315. package/src/app/shared/file/json.utils.ts +73 -0
  316. package/src/app/shared/file/uri.utils.ts +25 -0
  317. package/src/app/shared/focusable.ts +10 -0
  318. package/src/app/shared/form/field.component.html +261 -0
  319. package/src/app/shared/form/field.component.scss +7 -0
  320. package/src/app/shared/form/field.component.ts +318 -0
  321. package/src/app/shared/form/field.model.ts +64 -0
  322. package/src/app/shared/form/loading-spinner.ts +16 -0
  323. package/src/app/shared/forms.ts +458 -0
  324. package/src/app/shared/functions.ts +492 -0
  325. package/src/app/shared/geolocation/geolocation.utils.ts +101 -0
  326. package/src/app/shared/gesture/gesture-config.ts +45 -0
  327. package/src/app/shared/gesture/hammer.utils.ts +14 -0
  328. package/src/app/shared/graph/colors.utils.ts +74 -0
  329. package/src/app/shared/graph/graph-colors.ts +295 -0
  330. package/src/app/shared/guard/component-dirty.guard.ts +70 -0
  331. package/src/app/shared/help/help.modal.html +42 -0
  332. package/src/app/shared/help/help.modal.ts +61 -0
  333. package/src/app/shared/hotkeys/dialog/hotkeys-dialog.component.html +11 -0
  334. package/src/app/shared/hotkeys/dialog/hotkeys-dialog.component.scss +39 -0
  335. package/src/app/shared/hotkeys/dialog/hotkeys-dialog.component.ts +16 -0
  336. package/src/app/shared/hotkeys/hotkeys.service.ts +89 -0
  337. package/src/app/shared/hotkeys/shared-hotkeys.module.ts +27 -0
  338. package/src/app/shared/http/http.utils.ts +89 -0
  339. package/src/app/shared/image/gallery/image-gallery.component.html +231 -0
  340. package/src/app/shared/image/gallery/image-gallery.component.scss +196 -0
  341. package/src/app/shared/image/gallery/image-gallery.component.ts +389 -0
  342. package/src/app/shared/image/gallery/image-gallery.module.ts +34 -0
  343. package/src/app/shared/image/gallery/testing/gallegry.model.testing.ts +27 -0
  344. package/src/app/shared/image/gallery/testing/gallery.service.testing.ts +102 -0
  345. package/src/app/shared/image/gallery/testing/gallery.testing.html +15 -0
  346. package/src/app/shared/image/gallery/testing/gallery.testing.module.ts +39 -0
  347. package/src/app/shared/image/gallery/testing/gallery.testing.ts +38 -0
  348. package/src/app/shared/image/image.model.ts +6 -0
  349. package/src/app/shared/image/image.module.ts +16 -0
  350. package/src/app/shared/image/image.service.ts +94 -0
  351. package/src/app/shared/image/image.testing.module.ts +23 -0
  352. package/src/app/shared/inputs.ts +282 -0
  353. package/src/app/shared/interceptors/progess.interceptor.ts +25 -0
  354. package/src/app/shared/logging/log-level.model.ts +53 -0
  355. package/src/app/shared/logging/logger.model.ts +120 -0
  356. package/src/app/shared/logging/logging-service.class.ts +134 -0
  357. package/src/app/shared/logging/logging-service.config.ts +29 -0
  358. package/src/app/shared/logging/logging-service.module.ts +22 -0
  359. package/src/app/shared/material/autocomplete/material.autocomplete.config.ts +83 -0
  360. package/src/app/shared/material/autocomplete/material.autocomplete.html +262 -0
  361. package/src/app/shared/material/autocomplete/material.autocomplete.module.ts +45 -0
  362. package/src/app/shared/material/autocomplete/material.autocomplete.scss +21 -0
  363. package/src/app/shared/material/autocomplete/material.autocomplete.ts +1022 -0
  364. package/src/app/shared/material/autocomplete/material.autocomplete.utils.ts +20 -0
  365. package/src/app/shared/material/autocomplete/testing/autocomplete.test.html +876 -0
  366. package/src/app/shared/material/autocomplete/testing/autocomplete.test.spec.ts +38 -0
  367. package/src/app/shared/material/autocomplete/testing/autocomplete.test.ts +247 -0
  368. package/src/app/shared/material/badge/badge.directive.ts +164 -0
  369. package/src/app/shared/material/badge/badge.module.ts +22 -0
  370. package/src/app/shared/material/badge/badge.test.html +261 -0
  371. package/src/app/shared/material/badge/badge.test.ts +36 -0
  372. package/src/app/shared/material/boolean/boolean.module.ts +40 -0
  373. package/src/app/shared/material/boolean/material.boolean.html +155 -0
  374. package/src/app/shared/material/boolean/material.boolean.scss +34 -0
  375. package/src/app/shared/material/boolean/material.boolean.ts +239 -0
  376. package/src/app/shared/material/chips/chips.module.ts +44 -0
  377. package/src/app/shared/material/chips/material.chips.html +146 -0
  378. package/src/app/shared/material/chips/material.chips.scss +65 -0
  379. package/src/app/shared/material/chips/material.chips.ts +768 -0
  380. package/src/app/shared/material/chips/testing/chips.test.html +137 -0
  381. package/src/app/shared/material/chips/testing/chips.test.ts +175 -0
  382. package/src/app/shared/material/datetime/datetime.module.ts +52 -0
  383. package/src/app/shared/material/datetime/material.date.html +132 -0
  384. package/src/app/shared/material/datetime/material.date.scss +17 -0
  385. package/src/app/shared/material/datetime/material.date.ts +408 -0
  386. package/src/app/shared/material/datetime/material.dateshort.html +134 -0
  387. package/src/app/shared/material/datetime/material.dateshort.scss +23 -0
  388. package/src/app/shared/material/datetime/material.dateshort.ts +422 -0
  389. package/src/app/shared/material/datetime/material.datetime.html +224 -0
  390. package/src/app/shared/material/datetime/material.datetime.scss +90 -0
  391. package/src/app/shared/material/datetime/material.datetime.ts +575 -0
  392. package/src/app/shared/material/datetime/testing/mat-date-time.test.html +354 -0
  393. package/src/app/shared/material/datetime/testing/mat-date-time.test.ts +134 -0
  394. package/src/app/shared/material/datetime/testing/mat-date.test.html +418 -0
  395. package/src/app/shared/material/datetime/testing/mat-date.test.ts +135 -0
  396. package/src/app/shared/material/datetime/testing/mat-dateshort.test.html +370 -0
  397. package/src/app/shared/material/datetime/testing/mat-dateshort.test.ts +127 -0
  398. package/src/app/shared/material/duration/duration.module.ts +39 -0
  399. package/src/app/shared/material/duration/duration.utils.ts +41 -0
  400. package/src/app/shared/material/duration/material.duration.html +44 -0
  401. package/src/app/shared/material/duration/material.duration.scss +28 -0
  402. package/src/app/shared/material/duration/material.duration.ts +294 -0
  403. package/src/app/shared/material/latlong/latlong.utils.ts +300 -0
  404. package/src/app/shared/material/latlong/material.latlong.html +127 -0
  405. package/src/app/shared/material/latlong/material.latlong.module.ts +40 -0
  406. package/src/app/shared/material/latlong/material.latlong.scss +48 -0
  407. package/src/app/shared/material/latlong/material.latlong.ts +421 -0
  408. package/src/app/shared/material/latlong/testing/latlong.test.html +341 -0
  409. package/src/app/shared/material/latlong/testing/latlong.test.ts +121 -0
  410. package/src/app/shared/material/material.animations.ts +129 -0
  411. package/src/app/shared/material/material.module.ts +94 -0
  412. package/src/app/shared/material/material.testing.module.ts +135 -0
  413. package/src/app/shared/material/memory/memory.utils.ts +54 -0
  414. package/src/app/shared/material/numpad/numpad.animation.ts +1 -0
  415. package/src/app/shared/material/numpad/numpad.append-to-input.directive.ts +109 -0
  416. package/src/app/shared/material/numpad/numpad.component.ts +78 -0
  417. package/src/app/shared/material/numpad/numpad.container.html +32 -0
  418. package/src/app/shared/material/numpad/numpad.container.scss +50 -0
  419. package/src/app/shared/material/numpad/numpad.container.ts +176 -0
  420. package/src/app/shared/material/numpad/numpad.content.html +13 -0
  421. package/src/app/shared/material/numpad/numpad.content.ts +10 -0
  422. package/src/app/shared/material/numpad/numpad.directive.ts +173 -0
  423. package/src/app/shared/material/numpad/numpad.dom-service.ts +46 -0
  424. package/src/app/shared/material/numpad/numpad.model.ts +55 -0
  425. package/src/app/shared/material/numpad/numpad.module.ts +38 -0
  426. package/src/app/shared/material/numpad/testing/numpad.test.html +146 -0
  427. package/src/app/shared/material/numpad/testing/numpad.test.ts +55 -0
  428. package/src/app/shared/material/paginator/material.paginator-i18n.ts +49 -0
  429. package/src/app/shared/material/stepper/material.stepper-i18n.ts +18 -0
  430. package/src/app/shared/material/swipe/material.swipe.html +63 -0
  431. package/src/app/shared/material/swipe/material.swipe.scss +39 -0
  432. package/src/app/shared/material/swipe/material.swipe.ts +350 -0
  433. package/src/app/shared/material/swipe/swipe.module.ts +33 -0
  434. package/src/app/shared/material/swipe/testing/swipe.test.html +128 -0
  435. package/src/app/shared/material/swipe/testing/swipe.test.ts +81 -0
  436. package/src/app/shared/modules.ts +11 -0
  437. package/src/app/shared/observables.ts +132 -0
  438. package/src/app/shared/pipes/arrays.pipe.ts +111 -0
  439. package/src/app/shared/pipes/colors.pipe.ts +19 -0
  440. package/src/app/shared/pipes/date-diff-duration.pipe.ts +48 -0
  441. package/src/app/shared/pipes/date-format.pipe.ts +78 -0
  442. package/src/app/shared/pipes/date-from-now.pipe.ts +20 -0
  443. package/src/app/shared/pipes/duration.pipe.spec.ts +51 -0
  444. package/src/app/shared/pipes/duration.pipe.ts +34 -0
  445. package/src/app/shared/pipes/file-size.pipe.ts +58 -0
  446. package/src/app/shared/pipes/form.pipes.ts +204 -0
  447. package/src/app/shared/pipes/highlight.pipe.ts +37 -0
  448. package/src/app/shared/pipes/latlong-format.pipe.ts +30 -0
  449. package/src/app/shared/pipes/maps.pipe.ts +39 -0
  450. package/src/app/shared/pipes/math.pipes.ts +39 -0
  451. package/src/app/shared/pipes/ng-init.pipe.ts +14 -0
  452. package/src/app/shared/pipes/number-format.pipe.ts +21 -0
  453. package/src/app/shared/pipes/pipes.module.ts +134 -0
  454. package/src/app/shared/pipes/property.pipes.ts +87 -0
  455. package/src/app/shared/pipes/string.pipes.ts +85 -0
  456. package/src/app/shared/pipes/translate-context.pipe.ts +33 -0
  457. package/src/app/shared/pipes/types.pipes.ts +31 -0
  458. package/src/app/shared/platforms.ts +58 -0
  459. package/src/app/shared/services/entity-service.class.ts +127 -0
  460. package/src/app/shared/services/job.utils.ts +121 -0
  461. package/src/app/shared/services/memory-entity-service.class.ts +447 -0
  462. package/src/app/shared/services/progress-bar.service.ts +42 -0
  463. package/src/app/shared/services/startable-observable-service.class.ts +137 -0
  464. package/src/app/shared/services/startable-service.class.ts +131 -0
  465. package/src/app/shared/services/storage.utils.ts +47 -0
  466. package/src/app/shared/services/translate-context.service.ts +116 -0
  467. package/src/app/shared/services/validator-service.class.ts +14 -0
  468. package/src/app/shared/services.ts +91 -0
  469. package/src/app/shared/shared-routing.module.ts +66 -0
  470. package/src/app/shared/shared.module.spec.ts +13 -0
  471. package/src/app/shared/shared.module.ts +146 -0
  472. package/src/app/shared/shared.testing.module.ts +50 -0
  473. package/src/app/shared/storage/storage-explorer.component.html +175 -0
  474. package/src/app/shared/storage/storage-explorer.component.scss +39 -0
  475. package/src/app/shared/storage/storage-explorer.component.spec.ts +24 -0
  476. package/src/app/shared/storage/storage-explorer.component.ts +292 -0
  477. package/src/app/shared/storage/storage-explorer.module.ts +44 -0
  478. package/src/app/shared/storage/storage.service.ts +133 -0
  479. package/src/app/shared/storage/storage.utils.ts +25 -0
  480. package/src/app/shared/testing/observable.test.html +53 -0
  481. package/src/app/shared/testing/observable.test.scss +3 -0
  482. package/src/app/shared/testing/observable.test.ts +117 -0
  483. package/src/app/shared/testing/tests.page.html +30 -0
  484. package/src/app/shared/testing/tests.page.ts +34 -0
  485. package/src/app/shared/toast/toast.testing.html +42 -0
  486. package/src/app/shared/toast/toast.testing.module.ts +32 -0
  487. package/src/app/shared/toast/toast.testing.ts +58 -0
  488. package/src/app/shared/toast/toasts.ts +183 -0
  489. package/src/app/shared/toolbar/modal-toolbar.html +32 -0
  490. package/src/app/shared/toolbar/modal-toolbar.scss +0 -0
  491. package/src/app/shared/toolbar/modal-toolbar.ts +63 -0
  492. package/src/app/shared/toolbar/toolbar.html +71 -0
  493. package/src/app/shared/toolbar/toolbar.module.ts +35 -0
  494. package/src/app/shared/toolbar/toolbar.scss +0 -0
  495. package/src/app/shared/toolbar/toolbar.ts +254 -0
  496. package/src/app/shared/types.ts +31 -0
  497. package/src/app/shared/upload-file/testing/upload-file.testing.html +25 -0
  498. package/src/app/shared/upload-file/testing/upload-file.testing.module.ts +32 -0
  499. package/src/app/shared/upload-file/testing/upload-file.testing.ts +68 -0
  500. package/src/app/shared/upload-file/upload-file-popover.component.html +43 -0
  501. package/src/app/shared/upload-file/upload-file-popover.component.scss +6 -0
  502. package/src/app/shared/upload-file/upload-file-popover.component.ts +115 -0
  503. package/src/app/shared/upload-file/upload-file.component.html +46 -0
  504. package/src/app/shared/upload-file/upload-file.component.scss +130 -0
  505. package/src/app/shared/upload-file/upload-file.component.ts +218 -0
  506. package/src/app/shared/upload-file/upload-file.model.ts +41 -0
  507. package/src/app/shared/validator/form-error-adapter.class.ts +123 -0
  508. package/src/app/shared/validator/validators.ts +639 -0
  509. package/src/app/shared/version/versions.ts +91 -0
  510. package/src/app/social/job/job.module.ts +26 -0
  511. package/src/app/social/job/progression/job-progression.component.html +22 -0
  512. package/src/app/social/job/progression/job-progression.component.scss +15 -0
  513. package/src/app/social/job/progression/job-progression.component.ts +17 -0
  514. package/src/app/social/job/progression/job-progression.icon.html +28 -0
  515. package/src/app/social/job/progression/job-progression.icon.scss +5 -0
  516. package/src/app/social/job/progression/job-progression.icon.ts +238 -0
  517. package/src/app/social/job/progression/job-progression.list.html +21 -0
  518. package/src/app/social/job/progression/job-progression.list.scss +17 -0
  519. package/src/app/social/job/progression/job-progression.list.ts +49 -0
  520. package/src/app/social/job/progression/job-progression.model.ts +28 -0
  521. package/src/app/social/job/progression/job-progression.service.ts +86 -0
  522. package/src/app/social/job/testing/job-progression.testing.html +20 -0
  523. package/src/app/social/job/testing/job-progression.testing.service.ts +60 -0
  524. package/src/app/social/job/testing/job-progression.testing.ts +51 -0
  525. package/src/app/social/job/testing/job.testing.module.ts +22 -0
  526. package/src/app/social/message/message.form.html +60 -0
  527. package/src/app/social/message/message.form.scss +6 -0
  528. package/src/app/social/message/message.form.ts +79 -0
  529. package/src/app/social/message/message.modal.html +65 -0
  530. package/src/app/social/message/message.modal.ts +118 -0
  531. package/src/app/social/message/message.model.ts +81 -0
  532. package/src/app/social/message/message.module.ts +22 -0
  533. package/src/app/social/message/message.service.ts +88 -0
  534. package/src/app/social/social.errors.ts +11 -0
  535. package/src/app/social/social.module.ts +36 -0
  536. package/src/app/social/social.testing.module.ts +40 -0
  537. package/src/app/social/user-event/notification/user-event-notification.icon.html +16 -0
  538. package/src/app/social/user-event/notification/user-event-notification.icon.ts +108 -0
  539. package/src/app/social/user-event/notification/user-event-notification.list.html +135 -0
  540. package/src/app/social/user-event/notification/user-event-notification.list.scss +73 -0
  541. package/src/app/social/user-event/notification/user-event-notification.list.ts +287 -0
  542. package/src/app/social/user-event/testing/user-event.testing.html +27 -0
  543. package/src/app/social/user-event/testing/user-event.testing.model.ts +146 -0
  544. package/src/app/social/user-event/testing/user-event.testing.module.ts +22 -0
  545. package/src/app/social/user-event/testing/user-event.testing.service.ts +141 -0
  546. package/src/app/social/user-event/testing/user-event.testing.ts +253 -0
  547. package/src/app/social/user-event/user-event.model.ts +73 -0
  548. package/src/app/social/user-event/user-event.module.ts +25 -0
  549. package/src/app/social/user-event/user-event.service.ts +679 -0
  550. package/src/browserslist +9 -0
  551. package/src/environments/environment.class.ts +83 -0
  552. package/src/environments/environment.prod.ts +47 -0
  553. package/src/environments/environment.test.ts +90 -0
  554. package/src/environments/environment.ts +108 -0
  555. package/src/favicon.ico +0 -0
  556. package/src/global.scss +27 -0
  557. package/src/index.html +80 -0
  558. package/src/main.ts +17 -0
  559. package/src/polyfills.ts +68 -0
  560. package/src/schema.graphql +3112 -0
  561. package/src/service-worker.js +31 -0
  562. package/src/zone-flags.ts +31 -0
  563. package/tsconfig.app.json +15 -0
  564. package/tsconfig.json +47 -0
  565. package/tsconfig.spec.json +19 -0
  566. package/esm2020/public_api.mjs +0 -313
  567. package/esm2020/src/app/admin/admin-routing.module.mjs +0 -41
  568. package/esm2020/src/app/admin/admin.module.mjs +0 -34
  569. package/esm2020/src/app/admin/services/filter/person.filter.mjs +0 -59
  570. package/esm2020/src/app/admin/services/person.service.mjs +0 -161
  571. package/esm2020/src/app/admin/services/validator/person.validator.mjs +0 -34
  572. package/esm2020/src/app/admin/users/users.mjs +0 -234
  573. package/esm2020/src/app/admin/users/users.module.mjs +0 -54
  574. package/esm2020/src/app/core/about/about.modal.mjs +0 -71
  575. package/esm2020/src/app/core/about/about.module.mjs +0 -34
  576. package/esm2020/src/app/core/account/account.module.mjs +0 -61
  577. package/esm2020/src/app/core/account/account.page.mjs +0 -316
  578. package/esm2020/src/app/core/account/new-token.modal.mjs +0 -115
  579. package/esm2020/src/app/core/account/token.table.mjs +0 -137
  580. package/esm2020/src/app/core/auth/auth.form.mjs +0 -131
  581. package/esm2020/src/app/core/auth/auth.modal.mjs +0 -72
  582. package/esm2020/src/app/core/auth/auth.module.mjs +0 -47
  583. package/esm2020/src/app/core/core.module.mjs +0 -184
  584. package/esm2020/src/app/core/core.testing.module.mjs +0 -86
  585. package/esm2020/src/app/core/form/buttons/form-buttons-bar.component.mjs +0 -71
  586. package/esm2020/src/app/core/form/buttons/form-buttons-bar.module.mjs +0 -35
  587. package/esm2020/src/app/core/form/entity/editor.class.mjs +0 -679
  588. package/esm2020/src/app/core/form/entity/entity-editor-modal.class.mjs +0 -421
  589. package/esm2020/src/app/core/form/entity/entity-editor.class.mjs +0 -687
  590. package/esm2020/src/app/core/form/entity/entity-metadata.component.mjs +0 -25
  591. package/esm2020/src/app/core/form/entity/entity.module.mjs +0 -38
  592. package/esm2020/src/app/core/form/form.class.mjs +0 -340
  593. package/esm2020/src/app/core/form/form.module.mjs +0 -66
  594. package/esm2020/src/app/core/form/form.utils.mjs +0 -473
  595. package/esm2020/src/app/core/form/list/list.form.mjs +0 -222
  596. package/esm2020/src/app/core/form/list/list.module.mjs +0 -35
  597. package/esm2020/src/app/core/form/properties/properties.form.mjs +0 -132
  598. package/esm2020/src/app/core/form/properties/properties.module.mjs +0 -43
  599. package/esm2020/src/app/core/form/properties/properties.table.mjs +0 -264
  600. package/esm2020/src/app/core/form/properties/property.validator.mjs +0 -23
  601. package/esm2020/src/app/core/form/properties/testing/properties-form.test.mjs +0 -90
  602. package/esm2020/src/app/core/form/properties/testing/properties-form.testing.module.mjs +0 -39
  603. package/esm2020/src/app/core/form/text-popover/testing/text-popover.testing.mjs +0 -70
  604. package/esm2020/src/app/core/form/text-popover/testing/text-popover.testing.module.mjs +0 -45
  605. package/esm2020/src/app/core/form/text-popover/text-form.component.mjs +0 -89
  606. package/esm2020/src/app/core/form/text-popover/text-popover.component.mjs +0 -146
  607. package/esm2020/src/app/core/form/text-popover/text-popover.module.mjs +0 -40
  608. package/esm2020/src/app/core/graphql/graphql.module.mjs +0 -22
  609. package/esm2020/src/app/core/graphql/graphql.service.mjs +0 -762
  610. package/esm2020/src/app/core/graphql/graphql.utils.mjs +0 -117
  611. package/esm2020/src/app/core/home/home.mjs +0 -257
  612. package/esm2020/src/app/core/home/home.module.mjs +0 -48
  613. package/esm2020/src/app/core/icon/icon.component.mjs +0 -41
  614. package/esm2020/src/app/core/icon/icon.module.mjs +0 -29
  615. package/esm2020/src/app/core/install/install-upgrade-card.component.mjs +0 -343
  616. package/esm2020/src/app/core/install/install-upgrade-card.module.mjs +0 -35
  617. package/esm2020/src/app/core/menu/menu.component.mjs +0 -329
  618. package/esm2020/src/app/core/menu/menu.model.mjs +0 -35
  619. package/esm2020/src/app/core/menu/menu.module.mjs +0 -44
  620. package/esm2020/src/app/core/menu/menu.service.mjs +0 -55
  621. package/esm2020/src/app/core/offline/update-offline-mode-card.component.mjs +0 -27
  622. package/esm2020/src/app/core/offline/update-offline-mode-card.module.mjs +0 -35
  623. package/esm2020/src/app/core/peer/select-peer.modal.mjs +0 -182
  624. package/esm2020/src/app/core/peer/select-peer.module.mjs +0 -42
  625. package/esm2020/src/app/core/register/register-confirm.page.mjs +0 -81
  626. package/esm2020/src/app/core/register/register.form.mjs +0 -181
  627. package/esm2020/src/app/core/register/register.modal.mjs +0 -52
  628. package/esm2020/src/app/core/register/register.module.mjs +0 -44
  629. package/esm2020/src/app/core/services/account.service.mjs +0 -1212
  630. package/esm2020/src/app/core/services/auth-guard.service.mjs +0 -71
  631. package/esm2020/src/app/core/services/base-entity-service.class.mjs +0 -444
  632. package/esm2020/src/app/core/services/base-graphql-service.class.mjs +0 -219
  633. package/esm2020/src/app/core/services/base58.mjs +0 -78
  634. package/esm2020/src/app/core/services/config/core.config.mjs +0 -175
  635. package/esm2020/src/app/core/services/config.service.mjs +0 -354
  636. package/esm2020/src/app/core/services/crypto.service.mjs +0 -114
  637. package/esm2020/src/app/core/services/errors.mjs +0 -50
  638. package/esm2020/src/app/core/services/local-settings.service.mjs +0 -449
  639. package/esm2020/src/app/core/services/model/account.model.mjs +0 -122
  640. package/esm2020/src/app/core/services/model/config.model.mjs +0 -92
  641. package/esm2020/src/app/core/services/model/department.model.mjs +0 -30
  642. package/esm2020/src/app/core/services/model/entity.decorators.mjs +0 -97
  643. package/esm2020/src/app/core/services/model/entity.model.mjs +0 -240
  644. package/esm2020/src/app/core/services/model/filter.model.mjs +0 -94
  645. package/esm2020/src/app/core/services/model/history.model.mjs +0 -2
  646. package/esm2020/src/app/core/services/model/model.enum.mjs +0 -11
  647. package/esm2020/src/app/core/services/model/peer.model.mjs +0 -68
  648. package/esm2020/src/app/core/services/model/person.model.mjs +0 -83
  649. package/esm2020/src/app/core/services/model/referential.model.mjs +0 -164
  650. package/esm2020/src/app/core/services/model/settings.model.mjs +0 -3
  651. package/esm2020/src/app/core/services/model/token.model.mjs +0 -48
  652. package/esm2020/src/app/core/services/network.service.mjs +0 -589
  653. package/esm2020/src/app/core/services/network.types.mjs +0 -20
  654. package/esm2020/src/app/core/services/network.utils.mjs +0 -15
  655. package/esm2020/src/app/core/services/pipes/account.pipes.mjs +0 -38
  656. package/esm2020/src/app/core/services/pipes/department-to-string.pipe.mjs +0 -23
  657. package/esm2020/src/app/core/services/pipes/person-to-string.pipe.mjs +0 -23
  658. package/esm2020/src/app/core/services/pipes/usage-mode.pipes.mjs +0 -37
  659. package/esm2020/src/app/core/services/platform.service.mjs +0 -525
  660. package/esm2020/src/app/core/services/storage/entities-storage.service.mjs +0 -428
  661. package/esm2020/src/app/core/services/storage/entity-store.class.mjs +0 -449
  662. package/esm2020/src/app/core/services/testing/referential-filter.model.mjs +0 -23
  663. package/esm2020/src/app/core/services/testing/referential.validator.mjs +0 -45
  664. package/esm2020/src/app/core/services/validator/account.validator.mjs +0 -56
  665. package/esm2020/src/app/core/services/validator/base.validator.class.mjs +0 -47
  666. package/esm2020/src/app/core/services/validator/local-settings.validator.mjs +0 -66
  667. package/esm2020/src/app/core/services/validator/user-settings.validator.mjs +0 -27
  668. package/esm2020/src/app/core/services/validator/user-token.validator.mjs +0 -52
  669. package/esm2020/src/app/core/settings/settings.module.mjs +0 -34
  670. package/esm2020/src/app/core/settings/settings.page.mjs +0 -312
  671. package/esm2020/src/app/core/table/actions-column.component.mjs +0 -102
  672. package/esm2020/src/app/core/table/async-table.class.mjs +0 -1697
  673. package/esm2020/src/app/core/table/entities-async-table-datasource.class.mjs +0 -384
  674. package/esm2020/src/app/core/table/entities-table-datasource.class.mjs +0 -399
  675. package/esm2020/src/app/core/table/memory-table.class.mjs +0 -53
  676. package/esm2020/src/app/core/table/table-select-columns.component.mjs +0 -43
  677. package/esm2020/src/app/core/table/table.class.mjs +0 -1728
  678. package/esm2020/src/app/core/table/table.model.mjs +0 -12
  679. package/esm2020/src/app/core/table/table.module.mjs +0 -40
  680. package/esm2020/src/app/core/table/table.utils.mjs +0 -30
  681. package/esm2020/src/app/core/table/testing/table-validator.service.mjs +0 -27
  682. package/esm2020/src/app/core/table/testing/table.testing.mjs +0 -280
  683. package/esm2020/src/app/core/table/testing/table.testing.module.mjs +0 -38
  684. package/esm2020/src/app/shared/alerts.mjs +0 -239
  685. package/esm2020/src/app/shared/audio/audio.mjs +0 -248
  686. package/esm2020/src/app/shared/audio/audio.testing.mjs +0 -31
  687. package/esm2020/src/app/shared/audio/audio.testing.module.mjs +0 -45
  688. package/esm2020/src/app/shared/capacitor/keyboard.mjs +0 -40
  689. package/esm2020/src/app/shared/capacitor/plugins.mjs +0 -9
  690. package/esm2020/src/app/shared/constants.mjs +0 -10
  691. package/esm2020/src/app/shared/dates.mjs +0 -148
  692. package/esm2020/src/app/shared/debug/debug-service.class.mjs +0 -3
  693. package/esm2020/src/app/shared/debug/debug.component.mjs +0 -39
  694. package/esm2020/src/app/shared/debug/debug.module.mjs +0 -44
  695. package/esm2020/src/app/shared/directives/autofocus.directive.mjs +0 -92
  696. package/esm2020/src/app/shared/directives/autotitle.directive.mjs +0 -30
  697. package/esm2020/src/app/shared/directives/directives.module.mjs +0 -43
  698. package/esm2020/src/app/shared/directives/drag-and-drop.directive.mjs +0 -53
  699. package/esm2020/src/app/shared/directives/ng-var.directive.mjs +0 -31
  700. package/esm2020/src/app/shared/directives/resizable/resizable.component.mjs +0 -59
  701. package/esm2020/src/app/shared/directives/resizable/resizable.directive.mjs +0 -40
  702. package/esm2020/src/app/shared/directives/resizable/resizable.module.mjs +0 -17
  703. package/esm2020/src/app/shared/events.mjs +0 -64
  704. package/esm2020/src/app/shared/file/csv.utils.mjs +0 -74
  705. package/esm2020/src/app/shared/file/file.service.mjs +0 -117
  706. package/esm2020/src/app/shared/file/file.utils.mjs +0 -113
  707. package/esm2020/src/app/shared/file/images.utils.mjs +0 -161
  708. package/esm2020/src/app/shared/file/json.utils.mjs +0 -51
  709. package/esm2020/src/app/shared/file/uri.utils.mjs +0 -23
  710. package/esm2020/src/app/shared/focusable.mjs +0 -6
  711. package/esm2020/src/app/shared/form/field.component.mjs +0 -307
  712. package/esm2020/src/app/shared/form/field.model.mjs +0 -25
  713. package/esm2020/src/app/shared/form/loading-spinner.mjs +0 -36
  714. package/esm2020/src/app/shared/forms.mjs +0 -391
  715. package/esm2020/src/app/shared/functions.mjs +0 -477
  716. package/esm2020/src/app/shared/geolocation/geolocation.utils.mjs +0 -80
  717. package/esm2020/src/app/shared/gesture/gesture-config.mjs +0 -49
  718. package/esm2020/src/app/shared/gesture/hammer.utils.mjs +0 -2
  719. package/esm2020/src/app/shared/graph/colors.utils.mjs +0 -64
  720. package/esm2020/src/app/shared/graph/graph-colors.mjs +0 -212
  721. package/esm2020/src/app/shared/guard/component-dirty.guard.mjs +0 -57
  722. package/esm2020/src/app/shared/help/help.modal.mjs +0 -53
  723. package/esm2020/src/app/shared/hotkeys/dialog/hotkeys-dialog.component.mjs +0 -23
  724. package/esm2020/src/app/shared/hotkeys/hotkeys.service.mjs +0 -84
  725. package/esm2020/src/app/shared/hotkeys/shared-hotkeys.module.mjs +0 -42
  726. package/esm2020/src/app/shared/http/http.utils.mjs +0 -52
  727. package/esm2020/src/app/shared/image/gallery/image-gallery.component.mjs +0 -365
  728. package/esm2020/src/app/shared/image/gallery/image-gallery.module.mjs +0 -59
  729. package/esm2020/src/app/shared/image/gallery/testing/gallegry.model.testing.mjs +0 -27
  730. package/esm2020/src/app/shared/image/gallery/testing/gallery.service.testing.mjs +0 -90
  731. package/esm2020/src/app/shared/image/gallery/testing/gallery.testing.mjs +0 -39
  732. package/esm2020/src/app/shared/image/gallery/testing/gallery.testing.module.mjs +0 -56
  733. package/esm2020/src/app/shared/image/image.model.mjs +0 -2
  734. package/esm2020/src/app/shared/image/image.module.mjs +0 -29
  735. package/esm2020/src/app/shared/image/image.service.mjs +0 -98
  736. package/esm2020/src/app/shared/inputs.mjs +0 -231
  737. package/esm2020/src/app/shared/interceptors/progess.interceptor.mjs +0 -27
  738. package/esm2020/src/app/shared/logging/log-level.model.mjs +0 -48
  739. package/esm2020/src/app/shared/logging/logger.model.mjs +0 -47
  740. package/esm2020/src/app/shared/logging/logging-service.class.mjs +0 -121
  741. package/esm2020/src/app/shared/logging/logging-service.config.mjs +0 -2
  742. package/esm2020/src/app/shared/logging/logging-service.module.mjs +0 -30
  743. package/esm2020/src/app/shared/material/autocomplete/material.autocomplete.config.mjs +0 -47
  744. package/esm2020/src/app/shared/material/autocomplete/material.autocomplete.mjs +0 -916
  745. package/esm2020/src/app/shared/material/autocomplete/material.autocomplete.module.mjs +0 -78
  746. package/esm2020/src/app/shared/material/autocomplete/material.autocomplete.utils.mjs +0 -19
  747. package/esm2020/src/app/shared/material/autocomplete/testing/autocomplete.test.mjs +0 -209
  748. package/esm2020/src/app/shared/material/badge/badge.directive.mjs +0 -194
  749. package/esm2020/src/app/shared/material/badge/badge.module.mjs +0 -32
  750. package/esm2020/src/app/shared/material/badge/badge.test.mjs +0 -41
  751. package/esm2020/src/app/shared/material/boolean/boolean.module.mjs +0 -68
  752. package/esm2020/src/app/shared/material/boolean/material.boolean.mjs +0 -253
  753. package/esm2020/src/app/shared/material/chips/chips.module.mjs +0 -76
  754. package/esm2020/src/app/shared/material/chips/material.chips.mjs +0 -697
  755. package/esm2020/src/app/shared/material/chips/testing/chips.test.mjs +0 -143
  756. package/esm2020/src/app/shared/material/datetime/datetime.module.mjs +0 -91
  757. package/esm2020/src/app/shared/material/datetime/material.date.mjs +0 -376
  758. package/esm2020/src/app/shared/material/datetime/material.dateshort.mjs +0 -385
  759. package/esm2020/src/app/shared/material/datetime/material.datetime.mjs +0 -499
  760. package/esm2020/src/app/shared/material/datetime/testing/mat-date-time.test.mjs +0 -108
  761. package/esm2020/src/app/shared/material/datetime/testing/mat-date.test.mjs +0 -110
  762. package/esm2020/src/app/shared/material/datetime/testing/mat-dateshort.test.mjs +0 -103
  763. package/esm2020/src/app/shared/material/duration/duration.module.mjs +0 -67
  764. package/esm2020/src/app/shared/material/duration/duration.utils.mjs +0 -36
  765. package/esm2020/src/app/shared/material/duration/material.duration.mjs +0 -257
  766. package/esm2020/src/app/shared/material/latlong/latlong.utils.mjs +0 -266
  767. package/esm2020/src/app/shared/material/latlong/material.latlong.mjs +0 -381
  768. package/esm2020/src/app/shared/material/latlong/material.latlong.module.mjs +0 -67
  769. package/esm2020/src/app/shared/material/latlong/testing/latlong.test.mjs +0 -102
  770. package/esm2020/src/app/shared/material/material.animations.mjs +0 -104
  771. package/esm2020/src/app/shared/material/material.module.mjs +0 -224
  772. package/esm2020/src/app/shared/material/material.testing.module.mjs +0 -168
  773. package/esm2020/src/app/shared/material/numpad/numpad.append-to-input.directive.mjs +0 -98
  774. package/esm2020/src/app/shared/material/numpad/numpad.component.mjs +0 -80
  775. package/esm2020/src/app/shared/material/numpad/numpad.container.mjs +0 -190
  776. package/esm2020/src/app/shared/material/numpad/numpad.content.mjs +0 -17
  777. package/esm2020/src/app/shared/material/numpad/numpad.directive.mjs +0 -162
  778. package/esm2020/src/app/shared/material/numpad/numpad.dom-service.mjs +0 -37
  779. package/esm2020/src/app/shared/material/numpad/numpad.model.mjs +0 -15
  780. package/esm2020/src/app/shared/material/numpad/numpad.module.mjs +0 -60
  781. package/esm2020/src/app/shared/material/numpad/testing/numpad.test.mjs +0 -46
  782. package/esm2020/src/app/shared/material/paginator/material.paginator-i18n.mjs +0 -46
  783. package/esm2020/src/app/shared/material/stepper/material.stepper-i18n.mjs +0 -22
  784. package/esm2020/src/app/shared/material/swipe/material.swipe.mjs +0 -344
  785. package/esm2020/src/app/shared/material/swipe/swipe.module.mjs +0 -52
  786. package/esm2020/src/app/shared/material/swipe/testing/swipe.test.mjs +0 -64
  787. package/esm2020/src/app/shared/modules.mjs +0 -11
  788. package/esm2020/src/app/shared/observables.mjs +0 -103
  789. package/esm2020/src/app/shared/pipes/arrays.pipe.mjs +0 -141
  790. package/esm2020/src/app/shared/pipes/colors.pipe.mjs +0 -23
  791. package/esm2020/src/app/shared/pipes/date-diff-duration.pipe.mjs +0 -48
  792. package/esm2020/src/app/shared/pipes/date-format.pipe.mjs +0 -66
  793. package/esm2020/src/app/shared/pipes/date-from-now.pipe.mjs +0 -27
  794. package/esm2020/src/app/shared/pipes/duration.pipe.mjs +0 -34
  795. package/esm2020/src/app/shared/pipes/file-size.pipe.mjs +0 -62
  796. package/esm2020/src/app/shared/pipes/form.pipes.mjs +0 -187
  797. package/esm2020/src/app/shared/pipes/highlight.pipe.mjs +0 -48
  798. package/esm2020/src/app/shared/pipes/latlong-format.pipe.mjs +0 -46
  799. package/esm2020/src/app/shared/pipes/maps.pipe.mjs +0 -63
  800. package/esm2020/src/app/shared/pipes/math.pipes.mjs +0 -59
  801. package/esm2020/src/app/shared/pipes/ng-init.pipe.mjs +0 -21
  802. package/esm2020/src/app/shared/pipes/number-format.pipe.mjs +0 -30
  803. package/esm2020/src/app/shared/pipes/pipes.module.mjs +0 -239
  804. package/esm2020/src/app/shared/pipes/property.pipes.mjs +0 -93
  805. package/esm2020/src/app/shared/pipes/string.pipes.mjs +0 -121
  806. package/esm2020/src/app/shared/pipes/translate-context.pipe.mjs +0 -43
  807. package/esm2020/src/app/shared/pipes/types.pipes.mjs +0 -45
  808. package/esm2020/src/app/shared/platforms.mjs +0 -43
  809. package/esm2020/src/app/shared/services/entity-service.class.mjs +0 -7
  810. package/esm2020/src/app/shared/services/job.utils.mjs +0 -92
  811. package/esm2020/src/app/shared/services/memory-entity-service.class.mjs +0 -337
  812. package/esm2020/src/app/shared/services/progress-bar.service.mjs +0 -33
  813. package/esm2020/src/app/shared/services/startable-observable-service.class.mjs +0 -119
  814. package/esm2020/src/app/shared/services/startable-service.class.mjs +0 -110
  815. package/esm2020/src/app/shared/services/translate-context.service.mjs +0 -105
  816. package/esm2020/src/app/shared/services/validator-service.class.mjs +0 -2
  817. package/esm2020/src/app/shared/services.mjs +0 -62
  818. package/esm2020/src/app/shared/shared-routing.module.mjs +0 -70
  819. package/esm2020/src/app/shared/shared.module.mjs +0 -208
  820. package/esm2020/src/app/shared/shared.testing.module.mjs +0 -84
  821. package/esm2020/src/app/shared/storage/storage-explorer.component.mjs +0 -268
  822. package/esm2020/src/app/shared/storage/storage-explorer.module.mjs +0 -60
  823. package/esm2020/src/app/shared/storage/storage.service.mjs +0 -132
  824. package/esm2020/src/app/shared/storage/storage.utils.mjs +0 -13
  825. package/esm2020/src/app/shared/testing/observable.test.mjs +0 -95
  826. package/esm2020/src/app/shared/testing/tests.page.mjs +0 -33
  827. package/esm2020/src/app/shared/toast/toast.testing.mjs +0 -51
  828. package/esm2020/src/app/shared/toast/toast.testing.module.mjs +0 -45
  829. package/esm2020/src/app/shared/toast/toasts.mjs +0 -144
  830. package/esm2020/src/app/shared/toolbar/modal-toolbar.mjs +0 -58
  831. package/esm2020/src/app/shared/toolbar/toolbar.mjs +0 -251
  832. package/esm2020/src/app/shared/toolbar/toolbar.module.mjs +0 -53
  833. package/esm2020/src/app/shared/types.mjs +0 -2
  834. package/esm2020/src/app/shared/upload-file/testing/upload-file.testing.mjs +0 -57
  835. package/esm2020/src/app/shared/upload-file/testing/upload-file.testing.module.mjs +0 -45
  836. package/esm2020/src/app/shared/upload-file/upload-file-popover.component.mjs +0 -97
  837. package/esm2020/src/app/shared/upload-file/upload-file.component.mjs +0 -204
  838. package/esm2020/src/app/shared/upload-file/upload-file.model.mjs +0 -20
  839. package/esm2020/src/app/shared/validator/form-error-adapter.class.mjs +0 -104
  840. package/esm2020/src/app/shared/validator/validators.mjs +0 -573
  841. package/esm2020/src/app/shared/version/versions.mjs +0 -81
  842. package/esm2020/src/app/social/job/job.module.mjs +0 -42
  843. package/esm2020/src/app/social/job/progression/job-progression.component.mjs +0 -20
  844. package/esm2020/src/app/social/job/progression/job-progression.icon.mjs +0 -216
  845. package/esm2020/src/app/social/job/progression/job-progression.list.mjs +0 -43
  846. package/esm2020/src/app/social/job/progression/job-progression.model.mjs +0 -23
  847. package/esm2020/src/app/social/job/progression/job-progression.service.mjs +0 -71
  848. package/esm2020/src/app/social/job/testing/job-progression.testing.mjs +0 -52
  849. package/esm2020/src/app/social/job/testing/job-progression.testing.service.mjs +0 -55
  850. package/esm2020/src/app/social/job/testing/job.testing.module.mjs +0 -35
  851. package/esm2020/src/app/social/message/message.form.mjs +0 -81
  852. package/esm2020/src/app/social/message/message.modal.mjs +0 -93
  853. package/esm2020/src/app/social/message/message.model.mjs +0 -65
  854. package/esm2020/src/app/social/message/message.module.mjs +0 -35
  855. package/esm2020/src/app/social/message/message.service.mjs +0 -84
  856. package/esm2020/src/app/social/social.errors.mjs +0 -10
  857. package/esm2020/src/app/social/social.module.mjs +0 -47
  858. package/esm2020/src/app/social/social.testing.module.mjs +0 -51
  859. package/esm2020/src/app/social/user-event/notification/user-event-notification.icon.mjs +0 -114
  860. package/esm2020/src/app/social/user-event/notification/user-event-notification.list.mjs +0 -246
  861. package/esm2020/src/app/social/user-event/testing/user-event.testing.mjs +0 -227
  862. package/esm2020/src/app/social/user-event/testing/user-event.testing.model.mjs +0 -112
  863. package/esm2020/src/app/social/user-event/testing/user-event.testing.module.mjs +0 -35
  864. package/esm2020/src/app/social/user-event/testing/user-event.testing.service.mjs +0 -111
  865. package/esm2020/src/app/social/user-event/user-event.model.mjs +0 -2
  866. package/esm2020/src/app/social/user-event/user-event.module.mjs +0 -39
  867. package/esm2020/src/app/social/user-event/user-event.service.mjs +0 -487
  868. package/esm2020/src/environments/environment.class.mjs +0 -5
  869. package/esm2020/src/environments/environment.mjs +0 -94
  870. package/esm2020/sumaris-net.ngx-components.mjs +0 -5
  871. package/fesm2015/sumaris-net.ngx-components.mjs +0 -38843
  872. package/fesm2015/sumaris-net.ngx-components.mjs.map +0 -1
  873. package/fesm2020/sumaris-net.ngx-components.mjs +0 -37942
  874. package/fesm2020/sumaris-net.ngx-components.mjs.map +0 -1
  875. package/index.d.ts +0 -5
  876. package/public_api.d.ts +0 -286
  877. package/src/app/admin/admin-routing.module.d.ts +0 -9
  878. package/src/app/admin/admin.module.d.ts +0 -10
  879. package/src/app/admin/services/filter/person.filter.d.ts +0 -21
  880. package/src/app/admin/services/person.service.d.ts +0 -44
  881. package/src/app/admin/services/validator/person.validator.d.ts +0 -14
  882. package/src/app/admin/users/users.d.ts +0 -44
  883. package/src/app/admin/users/users.module.d.ts +0 -13
  884. package/src/app/core/about/about.modal.d.ts +0 -32
  885. package/src/app/core/about/about.module.d.ts +0 -10
  886. package/src/app/core/account/account.module.d.ts +0 -15
  887. package/src/app/core/account/account.page.d.ts +0 -68
  888. package/src/app/core/account/new-token.modal.d.ts +0 -41
  889. package/src/app/core/account/token.table.d.ts +0 -25
  890. package/src/app/core/auth/auth.form.d.ts +0 -36
  891. package/src/app/core/auth/auth.modal.d.ts +0 -24
  892. package/src/app/core/auth/auth.module.d.ts +0 -11
  893. package/src/app/core/core.module.d.ts +0 -31
  894. package/src/app/core/core.testing.module.d.ts +0 -14
  895. package/src/app/core/form/buttons/form-buttons-bar.component.d.ts +0 -26
  896. package/src/app/core/form/buttons/form-buttons-bar.module.d.ts +0 -9
  897. package/src/app/core/form/entity/editor.class.d.ts +0 -243
  898. package/src/app/core/form/entity/entity-editor-modal.class.d.ts +0 -128
  899. package/src/app/core/form/entity/entity-editor.class.d.ts +0 -205
  900. package/src/app/core/form/entity/entity-metadata.component.d.ts +0 -13
  901. package/src/app/core/form/entity/entity.module.d.ts +0 -10
  902. package/src/app/core/form/form.class.d.ts +0 -155
  903. package/src/app/core/form/form.module.d.ts +0 -13
  904. package/src/app/core/form/form.utils.d.ts +0 -336
  905. package/src/app/core/form/list/list.form.d.ts +0 -81
  906. package/src/app/core/form/list/list.module.d.ts +0 -9
  907. package/src/app/core/form/properties/properties.form.d.ts +0 -44
  908. package/src/app/core/form/properties/properties.module.d.ts +0 -11
  909. package/src/app/core/form/properties/properties.table.d.ts +0 -78
  910. package/src/app/core/form/properties/property.validator.d.ts +0 -13
  911. package/src/app/core/form/properties/testing/properties-form.test.d.ts +0 -19
  912. package/src/app/core/form/properties/testing/properties-form.testing.module.d.ts +0 -12
  913. package/src/app/core/form/text-popover/testing/text-popover.testing.d.ts +0 -14
  914. package/src/app/core/form/text-popover/testing/text-popover.testing.module.d.ts +0 -11
  915. package/src/app/core/form/text-popover/text-form.component.d.ts +0 -32
  916. package/src/app/core/form/text-popover/text-popover.component.d.ts +0 -70
  917. package/src/app/core/form/text-popover/text-popover.module.d.ts +0 -10
  918. package/src/app/core/graphql/graphql.module.d.ts +0 -8
  919. package/src/app/core/graphql/graphql.service.d.ts +0 -148
  920. package/src/app/core/graphql/graphql.utils.d.ts +0 -42
  921. package/src/app/core/home/home.d.ts +0 -74
  922. package/src/app/core/home/home.module.d.ts +0 -12
  923. package/src/app/core/icon/icon.component.d.ts +0 -13
  924. package/src/app/core/icon/icon.module.d.ts +0 -9
  925. package/src/app/core/install/install-upgrade-card.component.d.ts +0 -63
  926. package/src/app/core/install/install-upgrade-card.module.d.ts +0 -9
  927. package/src/app/core/menu/menu.component.d.ts +0 -62
  928. package/src/app/core/menu/menu.model.d.ts +0 -28
  929. package/src/app/core/menu/menu.module.d.ts +0 -10
  930. package/src/app/core/menu/menu.service.d.ts +0 -21
  931. package/src/app/core/offline/update-offline-mode-card.component.d.ts +0 -11
  932. package/src/app/core/offline/update-offline-mode-card.module.d.ts +0 -9
  933. package/src/app/core/peer/select-peer.modal.d.ts +0 -53
  934. package/src/app/core/peer/select-peer.module.d.ts +0 -11
  935. package/src/app/core/register/register-confirm.page.d.ts +0 -24
  936. package/src/app/core/register/register.form.d.ts +0 -48
  937. package/src/app/core/register/register.modal.d.ts +0 -14
  938. package/src/app/core/register/register.module.d.ts +0 -12
  939. package/src/app/core/services/account.service.d.ts +0 -191
  940. package/src/app/core/services/auth-guard.service.d.ts +0 -17
  941. package/src/app/core/services/base-entity-service.class.d.ts +0 -104
  942. package/src/app/core/services/base-graphql-service.class.d.ts +0 -77
  943. package/src/app/core/services/base58.d.ts +0 -7
  944. package/src/app/core/services/config/core.config.d.ts +0 -29
  945. package/src/app/core/services/config.service.d.ts +0 -60
  946. package/src/app/core/services/crypto.service.d.ts +0 -44
  947. package/src/app/core/services/errors.d.ts +0 -51
  948. package/src/app/core/services/local-settings.service.d.ts +0 -90
  949. package/src/app/core/services/model/account.model.d.ts +0 -35
  950. package/src/app/core/services/model/config.model.d.ts +0 -36
  951. package/src/app/core/services/model/department.model.d.ts +0 -11
  952. package/src/app/core/services/model/entity.decorators.d.ts +0 -17
  953. package/src/app/core/services/model/entity.model.d.ts +0 -89
  954. package/src/app/core/services/model/filter.model.d.ts +0 -45
  955. package/src/app/core/services/model/history.model.d.ts +0 -20
  956. package/src/app/core/services/model/model.enum.d.ts +0 -7
  957. package/src/app/core/services/model/peer.model.d.ts +0 -29
  958. package/src/app/core/services/model/person.model.d.ts +0 -31
  959. package/src/app/core/services/model/referential.model.d.ts +0 -77
  960. package/src/app/core/services/model/settings.model.d.ts +0 -26
  961. package/src/app/core/services/model/token.model.d.ts +0 -21
  962. package/src/app/core/services/network.service.d.ts +0 -149
  963. package/src/app/core/services/network.types.d.ts +0 -5
  964. package/src/app/core/services/network.utils.d.ts +0 -31
  965. package/src/app/core/services/pipes/account.pipes.d.ts +0 -15
  966. package/src/app/core/services/pipes/department-to-string.pipe.d.ts +0 -9
  967. package/src/app/core/services/pipes/person-to-string.pipe.d.ts +0 -9
  968. package/src/app/core/services/pipes/usage-mode.pipes.d.ts +0 -15
  969. package/src/app/core/services/platform.service.d.ts +0 -96
  970. package/src/app/core/services/storage/entities-storage.service.d.ts +0 -108
  971. package/src/app/core/services/storage/entity-store.class.d.ts +0 -113
  972. package/src/app/core/services/testing/referential-filter.model.d.ts +0 -9
  973. package/src/app/core/services/testing/referential.validator.d.ts +0 -22
  974. package/src/app/core/services/validator/account.validator.d.ts +0 -17
  975. package/src/app/core/services/validator/base.validator.class.d.ts +0 -21
  976. package/src/app/core/services/validator/local-settings.validator.d.ts +0 -18
  977. package/src/app/core/services/validator/user-settings.validator.d.ts +0 -10
  978. package/src/app/core/services/validator/user-token.validator.d.ts +0 -13
  979. package/src/app/core/settings/settings.module.d.ts +0 -10
  980. package/src/app/core/settings/settings.page.d.ts +0 -68
  981. package/src/app/core/table/actions-column.component.d.ts +0 -48
  982. package/src/app/core/table/async-table.class.d.ts +0 -383
  983. package/src/app/core/table/entities-async-table-datasource.class.d.ts +0 -80
  984. package/src/app/core/table/entities-table-datasource.class.d.ts +0 -94
  985. package/src/app/core/table/memory-table.class.d.ts +0 -25
  986. package/src/app/core/table/table-select-columns.component.d.ts +0 -22
  987. package/src/app/core/table/table.class.d.ts +0 -386
  988. package/src/app/core/table/table.model.d.ts +0 -26
  989. package/src/app/core/table/table.module.d.ts +0 -10
  990. package/src/app/core/table/table.utils.d.ts +0 -11
  991. package/src/app/core/table/testing/table-validator.service.d.ts +0 -17
  992. package/src/app/core/table/testing/table.testing.d.ts +0 -53
  993. package/src/app/core/table/testing/table.testing.module.d.ts +0 -11
  994. package/src/app/shared/alerts.d.ts +0 -53
  995. package/src/app/shared/audio/audio.d.ts +0 -44
  996. package/src/app/shared/audio/audio.testing.d.ts +0 -13
  997. package/src/app/shared/audio/audio.testing.module.d.ts +0 -11
  998. package/src/app/shared/capacitor/keyboard.d.ts +0 -16
  999. package/src/app/shared/capacitor/plugins.d.ts +0 -7
  1000. package/src/app/shared/constants.d.ts +0 -7
  1001. package/src/app/shared/dates.d.ts +0 -39
  1002. package/src/app/shared/debug/debug-service.class.d.ts +0 -5
  1003. package/src/app/shared/debug/debug.component.d.ts +0 -13
  1004. package/src/app/shared/debug/debug.module.d.ts +0 -12
  1005. package/src/app/shared/directives/autofocus.directive.d.ts +0 -19
  1006. package/src/app/shared/directives/autotitle.directive.d.ts +0 -10
  1007. package/src/app/shared/directives/directives.module.d.ts +0 -12
  1008. package/src/app/shared/directives/drag-and-drop.directive.d.ts +0 -17
  1009. package/src/app/shared/directives/ng-var.directive.d.ts +0 -12
  1010. package/src/app/shared/directives/resizable/resizable.component.d.ts +0 -21
  1011. package/src/app/shared/directives/resizable/resizable.directive.d.ts +0 -12
  1012. package/src/app/shared/directives/resizable/resizable.module.d.ts +0 -8
  1013. package/src/app/shared/events.d.ts +0 -27
  1014. package/src/app/shared/file/csv.utils.d.ts +0 -19
  1015. package/src/app/shared/file/file.service.d.ts +0 -23
  1016. package/src/app/shared/file/file.utils.d.ts +0 -20
  1017. package/src/app/shared/file/images.utils.d.ts +0 -19
  1018. package/src/app/shared/file/json.utils.d.ts +0 -16
  1019. package/src/app/shared/file/uri.utils.d.ts +0 -7
  1020. package/src/app/shared/focusable.d.ts +0 -4
  1021. package/src/app/shared/form/field.component.d.ts +0 -71
  1022. package/src/app/shared/form/field.model.d.ts +0 -37
  1023. package/src/app/shared/form/loading-spinner.d.ts +0 -8
  1024. package/src/app/shared/forms.d.ts +0 -89
  1025. package/src/app/shared/functions.d.ts +0 -132
  1026. package/src/app/shared/geolocation/geolocation.utils.d.ts +0 -19
  1027. package/src/app/shared/gesture/gesture-config.d.ts +0 -15
  1028. package/src/app/shared/gesture/hammer.utils.d.ts +0 -16
  1029. package/src/app/shared/graph/colors.utils.d.ts +0 -17
  1030. package/src/app/shared/graph/graph-colors.d.ts +0 -63
  1031. package/src/app/shared/guard/component-dirty.guard.d.ts +0 -19
  1032. package/src/app/shared/help/help.modal.d.ts +0 -33
  1033. package/src/app/shared/hotkeys/dialog/hotkeys-dialog.component.d.ts +0 -10
  1034. package/src/app/shared/hotkeys/hotkeys.service.d.ts +0 -28
  1035. package/src/app/shared/hotkeys/shared-hotkeys.module.d.ts +0 -11
  1036. package/src/app/shared/http/http.utils.d.ts +0 -27
  1037. package/src/app/shared/image/gallery/image-gallery.component.d.ts +0 -98
  1038. package/src/app/shared/image/gallery/image-gallery.module.d.ts +0 -14
  1039. package/src/app/shared/image/gallery/testing/gallegry.model.testing.d.ts +0 -12
  1040. package/src/app/shared/image/gallery/testing/gallery.service.testing.d.ts +0 -33
  1041. package/src/app/shared/image/gallery/testing/gallery.testing.d.ts +0 -16
  1042. package/src/app/shared/image/gallery/testing/gallery.testing.module.d.ts +0 -12
  1043. package/src/app/shared/image/image.model.d.ts +0 -5
  1044. package/src/app/shared/image/image.module.d.ts +0 -8
  1045. package/src/app/shared/image/image.service.d.ts +0 -32
  1046. package/src/app/shared/inputs.d.ts +0 -32
  1047. package/src/app/shared/interceptors/progess.interceptor.d.ts +0 -8
  1048. package/src/app/shared/logging/log-level.model.d.ts +0 -38
  1049. package/src/app/shared/logging/logger.model.d.ts +0 -68
  1050. package/src/app/shared/logging/logging-service.class.d.ts +0 -39
  1051. package/src/app/shared/logging/logging-service.config.d.ts +0 -25
  1052. package/src/app/shared/logging/logging-service.module.d.ts +0 -9
  1053. package/src/app/shared/material/autocomplete/material.autocomplete.config.d.ts +0 -36
  1054. package/src/app/shared/material/autocomplete/material.autocomplete.d.ts +0 -138
  1055. package/src/app/shared/material/autocomplete/material.autocomplete.module.d.ts +0 -21
  1056. package/src/app/shared/material/autocomplete/material.autocomplete.utils.d.ts +0 -4
  1057. package/src/app/shared/material/autocomplete/testing/autocomplete.test.d.ts +0 -45
  1058. package/src/app/shared/material/badge/badge.directive.d.ts +0 -37
  1059. package/src/app/shared/material/badge/badge.module.d.ts +0 -10
  1060. package/src/app/shared/material/badge/badge.test.d.ts +0 -21
  1061. package/src/app/shared/material/boolean/boolean.module.d.ts +0 -19
  1062. package/src/app/shared/material/boolean/material.boolean.d.ts +0 -66
  1063. package/src/app/shared/material/chips/chips.module.d.ts +0 -21
  1064. package/src/app/shared/material/chips/material.chips.d.ts +0 -126
  1065. package/src/app/shared/material/chips/testing/chips.test.d.ts +0 -31
  1066. package/src/app/shared/material/datetime/datetime.module.d.ts +0 -24
  1067. package/src/app/shared/material/datetime/material.date.d.ts +0 -74
  1068. package/src/app/shared/material/datetime/material.dateshort.d.ts +0 -75
  1069. package/src/app/shared/material/datetime/material.datetime.d.ts +0 -100
  1070. package/src/app/shared/material/datetime/testing/mat-date-time.test.d.ts +0 -31
  1071. package/src/app/shared/material/datetime/testing/mat-date.test.d.ts +0 -30
  1072. package/src/app/shared/material/datetime/testing/mat-dateshort.test.d.ts +0 -29
  1073. package/src/app/shared/material/duration/duration.module.d.ts +0 -18
  1074. package/src/app/shared/material/duration/duration.utils.d.ts +0 -3
  1075. package/src/app/shared/material/duration/material.duration.d.ts +0 -57
  1076. package/src/app/shared/material/latlong/latlong.utils.d.ts +0 -13
  1077. package/src/app/shared/material/latlong/material.latlong.d.ts +0 -65
  1078. package/src/app/shared/material/latlong/material.latlong.module.d.ts +0 -19
  1079. package/src/app/shared/material/latlong/testing/latlong.test.d.ts +0 -21
  1080. package/src/app/shared/material/material.animations.d.ts +0 -4
  1081. package/src/app/shared/material/material.module.d.ts +0 -45
  1082. package/src/app/shared/material/material.testing.module.d.ts +0 -25
  1083. package/src/app/shared/material/numpad/numpad.append-to-input.directive.d.ts +0 -22
  1084. package/src/app/shared/material/numpad/numpad.component.d.ts +0 -26
  1085. package/src/app/shared/material/numpad/numpad.container.d.ts +0 -40
  1086. package/src/app/shared/material/numpad/numpad.content.d.ts +0 -7
  1087. package/src/app/shared/material/numpad/numpad.directive.d.ts +0 -35
  1088. package/src/app/shared/material/numpad/numpad.dom-service.d.ts +0 -16
  1089. package/src/app/shared/material/numpad/numpad.model.d.ts +0 -30
  1090. package/src/app/shared/material/numpad/numpad.module.d.ts +0 -16
  1091. package/src/app/shared/material/numpad/testing/numpad.test.d.ts +0 -13
  1092. package/src/app/shared/material/paginator/material.paginator-i18n.d.ts +0 -15
  1093. package/src/app/shared/material/stepper/material.stepper-i18n.d.ts +0 -10
  1094. package/src/app/shared/material/swipe/material.swipe.d.ts +0 -89
  1095. package/src/app/shared/material/swipe/swipe.module.d.ts +0 -15
  1096. package/src/app/shared/material/swipe/testing/swipe.test.d.ts +0 -22
  1097. package/src/app/shared/modules.d.ts +0 -8
  1098. package/src/app/shared/observables.d.ts +0 -29
  1099. package/src/app/shared/pipes/arrays.pipe.d.ts +0 -54
  1100. package/src/app/shared/pipes/colors.pipe.d.ts +0 -9
  1101. package/src/app/shared/pipes/date-diff-duration.pipe.d.ts +0 -23
  1102. package/src/app/shared/pipes/date-format.pipe.d.ts +0 -34
  1103. package/src/app/shared/pipes/date-from-now.pipe.d.ts +0 -12
  1104. package/src/app/shared/pipes/duration.pipe.d.ts +0 -13
  1105. package/src/app/shared/pipes/file-size.pipe.d.ts +0 -30
  1106. package/src/app/shared/pipes/form.pipes.d.ts +0 -59
  1107. package/src/app/shared/pipes/highlight.pipe.d.ts +0 -11
  1108. package/src/app/shared/pipes/latlong-format.pipe.d.ts +0 -20
  1109. package/src/app/shared/pipes/maps.pipe.d.ts +0 -22
  1110. package/src/app/shared/pipes/math.pipes.d.ts +0 -20
  1111. package/src/app/shared/pipes/ng-init.pipe.d.ts +0 -8
  1112. package/src/app/shared/pipes/number-format.pipe.d.ts +0 -10
  1113. package/src/app/shared/pipes/pipes.module.d.ts +0 -27
  1114. package/src/app/shared/pipes/property.pipes.d.ts +0 -26
  1115. package/src/app/shared/pipes/string.pipes.d.ts +0 -47
  1116. package/src/app/shared/pipes/translate-context.pipe.d.ts +0 -17
  1117. package/src/app/shared/pipes/types.pipes.d.ts +0 -18
  1118. package/src/app/shared/platforms.d.ts +0 -8
  1119. package/src/app/shared/services/entity-service.class.d.ts +0 -73
  1120. package/src/app/shared/services/job.utils.d.ts +0 -20
  1121. package/src/app/shared/services/memory-entity-service.class.d.ts +0 -71
  1122. package/src/app/shared/services/progress-bar.service.d.ts +0 -20
  1123. package/src/app/shared/services/startable-observable-service.class.d.ts +0 -33
  1124. package/src/app/shared/services/startable-service.class.d.ts +0 -34
  1125. package/src/app/shared/services/translate-context.service.d.ts +0 -29
  1126. package/src/app/shared/services/validator-service.class.d.ts +0 -10
  1127. package/src/app/shared/services.d.ts +0 -9
  1128. package/src/app/shared/shared-routing.module.d.ts +0 -22
  1129. package/src/app/shared/shared.module.d.ts +0 -31
  1130. package/src/app/shared/shared.testing.module.d.ts +0 -17
  1131. package/src/app/shared/storage/storage-explorer.component.d.ts +0 -58
  1132. package/src/app/shared/storage/storage-explorer.module.d.ts +0 -16
  1133. package/src/app/shared/storage/storage.service.d.ts +0 -23
  1134. package/src/app/shared/storage/storage.utils.d.ts +0 -19
  1135. package/src/app/shared/testing/observable.test.d.ts +0 -25
  1136. package/src/app/shared/testing/tests.page.d.ts +0 -20
  1137. package/src/app/shared/toast/toast.testing.d.ts +0 -15
  1138. package/src/app/shared/toast/toast.testing.module.d.ts +0 -11
  1139. package/src/app/shared/toast/toasts.d.ts +0 -17
  1140. package/src/app/shared/toolbar/modal-toolbar.d.ts +0 -21
  1141. package/src/app/shared/toolbar/toolbar.d.ts +0 -63
  1142. package/src/app/shared/toolbar/toolbar.module.d.ts +0 -15
  1143. package/src/app/shared/types.d.ts +0 -26
  1144. package/src/app/shared/upload-file/testing/upload-file.testing.d.ts +0 -20
  1145. package/src/app/shared/upload-file/testing/upload-file.testing.module.d.ts +0 -11
  1146. package/src/app/shared/upload-file/upload-file-popover.component.d.ts +0 -39
  1147. package/src/app/shared/upload-file/upload-file.component.d.ts +0 -48
  1148. package/src/app/shared/upload-file/upload-file.model.d.ts +0 -30
  1149. package/src/app/shared/validator/form-error-adapter.class.d.ts +0 -27
  1150. package/src/app/shared/validator/validators.d.ts +0 -115
  1151. package/src/app/shared/version/versions.d.ts +0 -26
  1152. package/src/app/social/job/job.module.d.ts +0 -12
  1153. package/src/app/social/job/progression/job-progression.component.d.ts +0 -9
  1154. package/src/app/social/job/progression/job-progression.icon.d.ts +0 -49
  1155. package/src/app/social/job/progression/job-progression.list.d.ts +0 -21
  1156. package/src/app/social/job/progression/job-progression.model.d.ts +0 -11
  1157. package/src/app/social/job/progression/job-progression.service.d.ts +0 -34
  1158. package/src/app/social/job/testing/job-progression.testing.d.ts +0 -17
  1159. package/src/app/social/job/testing/job-progression.testing.service.d.ts +0 -17
  1160. package/src/app/social/job/testing/job.testing.module.d.ts +0 -11
  1161. package/src/app/social/message/message.form.d.ts +0 -30
  1162. package/src/app/social/message/message.modal.d.ts +0 -39
  1163. package/src/app/social/message/message.model.d.ts +0 -31
  1164. package/src/app/social/message/message.module.d.ts +0 -11
  1165. package/src/app/social/message/message.service.d.ts +0 -27
  1166. package/src/app/social/social.errors.d.ts +0 -9
  1167. package/src/app/social/social.module.d.ts +0 -20
  1168. package/src/app/social/social.testing.module.d.ts +0 -13
  1169. package/src/app/social/user-event/notification/user-event-notification.icon.d.ts +0 -31
  1170. package/src/app/social/user-event/notification/user-event-notification.list.d.ts +0 -71
  1171. package/src/app/social/user-event/testing/user-event.testing.d.ts +0 -34
  1172. package/src/app/social/user-event/testing/user-event.testing.model.d.ts +0 -44
  1173. package/src/app/social/user-event/testing/user-event.testing.module.d.ts +0 -11
  1174. package/src/app/social/user-event/testing/user-event.testing.service.d.ts +0 -41
  1175. package/src/app/social/user-event/user-event.model.d.ts +0 -45
  1176. package/src/app/social/user-event/user-event.module.d.ts +0 -12
  1177. package/src/app/social/user-event/user-event.service.d.ts +0 -124
  1178. package/src/environments/environment.class.d.ts +0 -57
  1179. package/src/environments/environment.d.ts +0 -3
@@ -0,0 +1,1431 @@
1
+ import {Inject, Injectable, InjectionToken, Optional} from '@angular/core';
2
+ import {CryptoService, Keypair} from './crypto.service';
3
+ import {Department} from './model/department.model';
4
+ import {Account, UserSettings} from './model/account.model';
5
+ import {Person, PersonUtils, UserProfileLabel} from './model/person.model';
6
+ import {LocalSettings, UsageMode} from './model/settings.model';
7
+ import {BehaviorSubject, from, Observable, Subject, Subscription} from 'rxjs';
8
+ import {FetchPolicy, gql} from '@apollo/client/core';
9
+ import {Storage} from '@ionic/storage-angular';
10
+
11
+ import {isEmptyArray, isNil, sleep, toNumber} from '../../shared/functions';
12
+ import {BaseGraphqlService} from './base-graphql-service.class';
13
+ import {ErrorCodes, ServerErrorCodes} from './errors';
14
+ import {GraphqlService} from '../graphql/graphql.service';
15
+ import {LocalSettingsService} from './local-settings.service';
16
+ import {FormFieldDefinition, FormFieldDefinitionMap} from '../../shared/form/field.model';
17
+ import {NetworkService} from './network.service';
18
+ import {AuthTokenType} from './network.types';
19
+ import {FileService} from '../../shared/file/file.service';
20
+ import {MINIFY_ENTITY_FOR_POD, Referential, ReferentialUtils} from './model/referential.model';
21
+ import {StatusIds} from './model/model.enum';
22
+ import {Base58} from './base58';
23
+ import {ENVIRONMENT} from '../../../environments/environment.class';
24
+ import {fromDateISOString} from '../../shared/dates';
25
+ import {firstNotNilPromise} from '../../shared/observables';
26
+ import {debounceTime, filter, map, switchMap} from 'rxjs/operators';
27
+ import {BaseEntityGraphqlMutations, BaseEntityGraphqlSubscriptions} from './base-entity-service.class';
28
+ import {Moment} from 'moment';
29
+ import {ShowToastOptions, Toasts} from '../../shared/toast/toasts';
30
+ import {OverlayEventDetail} from '@ionic/core';
31
+ import {ToastController} from '@ionic/angular';
32
+ import {TranslateService} from '@ngx-translate/core';
33
+ import {TokenScope, UserToken} from './model/token.model';
34
+
35
+
36
+ export declare interface AccountDetails {
37
+ loaded: boolean;
38
+ keypair: Keypair;
39
+ authToken: string;
40
+ authBasic?: string;
41
+ pubkey: string;
42
+ person: Person;
43
+ department: Department;
44
+ mainProfile: string;
45
+ }
46
+ export interface AuthData {
47
+ username: string;
48
+ password: string;
49
+ offline?: boolean;
50
+ }
51
+ export interface RegisterData extends AuthData {
52
+ account: Account;
53
+ }
54
+
55
+ const TOKEN_STORAGE_KEY = 'token';
56
+ const PUBKEY_STORAGE_KEY = 'pubkey';
57
+ const SECKEY_STORAGE_KEY = 'seckey';
58
+ const ACCOUNT_STORAGE_KEY = 'account';
59
+
60
+ const DEFAULT_AVATAR_IMAGE = 'assets/img/person.png';
61
+
62
+ export interface UserSettingsOptions {
63
+ options: FormFieldDefinitionMap;
64
+ }
65
+ export const APP_USER_SETTINGS_OPTIONS = new InjectionToken<UserSettingsOptions>('UserSettingsOptions');
66
+ export const APP_USER_TOKEN_SCOPES = new InjectionToken<TokenScope[]>('UserTokenScopes');
67
+
68
+
69
+ /* ------------------------------------
70
+ * GraphQL queries
71
+ * ------------------------------------*/
72
+ const Fragments = {
73
+ account: gql`
74
+ fragment AccountFragment on AccountVO {
75
+ id
76
+ firstName
77
+ lastName
78
+ email
79
+ pubkey
80
+ # username
81
+ # usernameExtranet
82
+ avatar
83
+ statusId
84
+ updateDate
85
+ creationDate
86
+ profiles
87
+ settings {
88
+ ...UserSettingsFragment
89
+ }
90
+ tokens {
91
+ ...UserTokenFragment
92
+ }
93
+ department {
94
+ id
95
+ label
96
+ name
97
+ __typename
98
+ }
99
+ __typename
100
+ }`,
101
+
102
+ settings: gql`fragment UserSettingsFragment on UserSettingsVO {
103
+ id
104
+ locale
105
+ latLongFormat
106
+ content
107
+ nonce
108
+ updateDate
109
+ __typename
110
+ }`,
111
+
112
+ token: gql`fragment UserTokenFragment on UserTokenVO {
113
+ id
114
+ pubkey
115
+ token
116
+ name
117
+ flags
118
+ expirationDate
119
+ lastUsedDate
120
+ creationDate
121
+ updateDate
122
+ __typename
123
+ }`
124
+ };
125
+
126
+ // Load account query
127
+ const LoadQuery: any = gql`
128
+ query Account {
129
+ data: account {
130
+ ...AccountFragment
131
+ }
132
+ }
133
+ ${Fragments.account}
134
+ ${Fragments.settings}
135
+ ${Fragments.token}
136
+ `;
137
+
138
+ // Check email query
139
+ const IsEmailExistsQuery: any = gql`
140
+ query IsEmailExists($email: String, $hash: String){
141
+ isEmailExists(email: $email, hash: $hash)
142
+ }
143
+ `;
144
+ export declare interface IsEmailExistsVariables {
145
+ email: string;
146
+ hash: string;
147
+ }
148
+
149
+ // Save (create or update) account mutation
150
+ const AccountMutations: Partial<BaseEntityGraphqlMutations> & { create: any; saveSettings: any } = {
151
+ save: gql` mutation SaveAccount($data:AccountVOInput){
152
+ data: saveAccount(account: $data){
153
+ ...AccountFragment
154
+ }
155
+ }
156
+ ${Fragments.account}
157
+ ${Fragments.token}
158
+ ${Fragments.settings}
159
+ `,
160
+
161
+ create: gql`mutation CreateAccount($data:AccountVOInput){
162
+ data: createAccount(account: $data){
163
+ ...AccountFragment
164
+ }
165
+ }
166
+ ${Fragments.account}
167
+ ${Fragments.settings}
168
+ ${Fragments.token}
169
+ `,
170
+
171
+ saveSettings: gql`mutation SaveSettings($data:UserSettingsVOInput){
172
+ data: saveSettings(settings: $data){
173
+ ...UserSettingsFragment
174
+ }
175
+ }
176
+ ${Fragments.settings}`
177
+ };
178
+
179
+ // Sent confirmation email
180
+ const SendConfirmEmailMutation: any = gql`
181
+ mutation sendAccountConfirmationEmail($email:String, $locale:String){
182
+ sendAccountConfirmationEmail(email: $email, locale: $locale)
183
+ }
184
+ `;
185
+
186
+ // Confirm account email
187
+ const ConfirmEmailMutation: any = gql`
188
+ mutation confirmAccountEmail($email:String, $code:String){
189
+ confirmAccountEmail(email: $email, code: $code)
190
+ }
191
+ `;
192
+
193
+ // Authentication query
194
+ const AuthQuery: any = gql`
195
+ query Auth($token: String){
196
+ authenticate(token: $token)
197
+ }
198
+ `;
199
+
200
+ // New auth challenge query
201
+ const AuthChallengeQuery: any = gql`
202
+ query AuthChallenge{
203
+ authChallenge{
204
+ challenge
205
+ pubkey
206
+ signature
207
+ }
208
+ }
209
+ `;
210
+
211
+ interface IAuthChallenge {
212
+ pubkey: string;
213
+ challenge: string;
214
+ signature: string;
215
+ }
216
+
217
+ const AccountSubscriptions: BaseEntityGraphqlSubscriptions = {
218
+ listenChanges: gql`subscription updateAccount($interval: Int){
219
+ data: updateAccount(interval: $interval) {
220
+ id
221
+ updateDate
222
+ }
223
+ }`
224
+ };
225
+
226
+ export interface AccountWatchOptions {
227
+ intervalInSeconds?: number;
228
+ }
229
+
230
+ @Injectable({providedIn: 'root', deps: [ ENVIRONMENT ]})
231
+ export class AccountService extends BaseGraphqlService<Account, any, number, Account> {
232
+
233
+ onLogin = new Subject<Account>();
234
+ onLogout = new Subject<void>();
235
+ onChange = new Subject<Account>();
236
+ onAuthTokenChange = new BehaviorSubject<string | undefined>(undefined);
237
+ onAuthBasicChange = new BehaviorSubject<string | undefined>(undefined);
238
+
239
+ private _listenChangesSubscription: Subscription = null;
240
+ private readonly _enableListenChanges: boolean;
241
+ private readonly _listenIntervalInSeconds: number;
242
+ private _cache: AccountDetails = {
243
+ loaded: false,
244
+ keypair: null,
245
+ authToken: null,
246
+ authBasic: null,
247
+ pubkey: null,
248
+ mainProfile: null,
249
+ person: null,
250
+ department: null
251
+ };
252
+ private readonly _optionDefs: FormFieldDefinition[];
253
+ private _$additionalFields = new BehaviorSubject<FormFieldDefinition[]>([]);
254
+ private _tokenType$ = new BehaviorSubject<AuthTokenType>(undefined);
255
+
256
+ get account(): Account {
257
+ return this._cache.loaded ? this._data : undefined;
258
+ }
259
+
260
+ get person(): Person {
261
+ if (this._cache.loaded && !this._cache.person) {
262
+ this._cache.person = this._cache.loaded ? this._data.asPerson() : undefined;
263
+ }
264
+ return this._cache.person;
265
+ }
266
+
267
+ get department(): Department {
268
+ if (this._cache.loaded && !this._cache.department) {
269
+ this._cache.department = this._cache.loaded ? this._data.asPerson().department : undefined;
270
+ }
271
+ return this._cache.department;
272
+ }
273
+
274
+ get tokenType(): AuthTokenType {
275
+ return this._tokenType$.value;
276
+ }
277
+
278
+ set tokenType(value: AuthTokenType) {
279
+ if (this._tokenType$.value !== value) {
280
+ console.info('[account] Using authentication token type: ' + value);
281
+ this._tokenType$.next(value);
282
+ // Reset values
283
+ this._cache.authToken = undefined;
284
+ this.onAuthTokenChange.next(undefined);
285
+ this._cache.authBasic = undefined;
286
+ this.onAuthBasicChange.next(undefined);
287
+ }
288
+ }
289
+
290
+ constructor(
291
+ protected network: NetworkService,
292
+ protected graphql: GraphqlService,
293
+ protected settings: LocalSettingsService,
294
+ protected storage: Storage,
295
+ protected file: FileService,
296
+ @Optional() private translate: TranslateService,
297
+ @Optional() private toastController: ToastController,
298
+ @Inject(ENVIRONMENT) protected environment,
299
+ @Optional() @Inject(APP_USER_SETTINGS_OPTIONS) options: UserSettingsOptions
300
+ ) {
301
+ super(graphql, environment);
302
+ this._enableListenChanges = (!environment.account || environment.account.enableListenChanges !== false); // True by default
303
+ this._listenIntervalInSeconds = toNumber(environment.account && environment.account.listenIntervalInSeconds, 0); // no timer by default
304
+
305
+ this._debug = !environment.production;
306
+ if (this._debug) console.debug('[account-service] Creating service');
307
+ this._optionDefs = Object.values(options?.options || {});
308
+
309
+ this.resetData();
310
+
311
+ // Send auth token to the graphql layer, when changed
312
+ this.onAuthTokenChange.subscribe((token) => this.graphql.setAuthToken(token));
313
+ this.onAuthBasicChange.subscribe((basic) => this.graphql.setAuthBasic(basic));
314
+
315
+ // Force network to wait account service, after getting connection to the peer
316
+ this.network.on('beforeTryOnlineFinish', async (online) => {
317
+ // If online, wait a full restart, because it can force offline mode
318
+ if (online && (!this.started || this.isLogin())) {
319
+ console.debug('[account] Force networkService.tryOnline() to wait, that graphql and account service is restarted...');
320
+ await sleep(500); // wait graphql service to be restarted
321
+ if (!this.started) await this.ready();
322
+ }
323
+ });
324
+ }
325
+
326
+
327
+ async ngOnStart(): Promise<Account> {
328
+
329
+ await Promise.all([
330
+ this.settings.ready(),
331
+ // Wait token type to be set
332
+ firstNotNilPromise(this._tokenType$)
333
+ ]);
334
+
335
+ // Listen graphql start (or restart)
336
+ this.registerSubscription(
337
+ this.graphql.stopSubject.subscribe(() => {
338
+ if (this.started && this.isLogin()) {
339
+ console.debug('[account] Restarting, to retry to authenticate...');
340
+ this.restart();
341
+ }
342
+ })
343
+ );
344
+
345
+ await this.restoreLocally();
346
+ await this.listenSettings();
347
+
348
+ return this._data;
349
+ }
350
+
351
+ protected async ngOnStop(): Promise<void> {
352
+ const hadAuthToken = this._cache.authToken && true;
353
+ const hadAuthBasic = this._cache.authBasic && true;
354
+ const hadAuth = hadAuthToken || hadAuthBasic;
355
+ this.resetData();
356
+ if (hadAuth) {
357
+ this.onLogout.next();
358
+ this.onChange.next(undefined);
359
+ if (hadAuthToken) this.onAuthTokenChange.next(undefined);
360
+ if (hadAuthBasic) this.onAuthBasicChange.next(undefined);
361
+ }
362
+ }
363
+
364
+ isLogin(): boolean {
365
+ return !!(this._cache.pubkey && this._cache.loaded);
366
+ }
367
+
368
+ isAuth(): boolean {
369
+ return !!(this._cache.pubkey && this._cache.keypair && this._cache.keypair.secretKey);
370
+ }
371
+
372
+ hasMinProfile(userProfile: UserProfileLabel): boolean {
373
+ // should be login, and status ENABLE or TEMPORARY
374
+ if (!this._data || !this._data.pubkey ||
375
+ (this._data.statusId !== StatusIds.ENABLE && this._data.statusId !== StatusIds.TEMPORARY)) {
376
+ return false;
377
+ }
378
+ return PersonUtils.hasUpperOrEqualsProfile(this._data.profiles, userProfile);
379
+ }
380
+
381
+ hasExactProfile(label: UserProfileLabel): boolean {
382
+ // should be login, and status ENABLE or TEMPORARY
383
+ if (!this._data || !this._data.pubkey ||
384
+ (this._data.statusId !== StatusIds.ENABLE && this._data.statusId !== StatusIds.TEMPORARY))
385
+ return false;
386
+ return this._data.profiles.some(profile => profile === label);
387
+ }
388
+
389
+ hasProfileAndIsEnable(userProfile: UserProfileLabel): boolean {
390
+ // should be login, and status ENABLE
391
+ if (!this._data || !this._data.pubkey || this._data.statusId !== StatusIds.ENABLE) return false;
392
+ return PersonUtils.hasUpperOrEqualsProfile(this._data.profiles, userProfile);
393
+ }
394
+
395
+ isAdmin(): boolean {
396
+ return this.hasProfileAndIsEnable('ADMIN');
397
+ }
398
+
399
+ isSupervisor(): boolean {
400
+ return this.hasProfileAndIsEnable('SUPERVISOR');
401
+ }
402
+
403
+ isUser(): boolean {
404
+ return this.hasProfileAndIsEnable('USER');
405
+ }
406
+
407
+ /**
408
+ * @deprecated
409
+ * @param mode
410
+ */
411
+ isUsageMode(mode: UsageMode): boolean {
412
+ return this.settings.isUsageMode(mode);
413
+ }
414
+
415
+ isOnlyGuest(): boolean {
416
+ // Should be login, and status ENABLE or TEMPORARY
417
+ if (!this._data || !this._data.pubkey ||
418
+ (this._data.statusId !== StatusIds.ENABLE && this._data.statusId !== StatusIds.TEMPORARY))
419
+ return false;
420
+ // Profile less then user
421
+ return !PersonUtils.hasUpperOrEqualsProfile(this._data.profiles, 'USER');
422
+ }
423
+
424
+ /**
425
+ *
426
+ * @param recorderDepartment
427
+ * @deprecated use ProgramRefService.canUserWriteDataForDepartment() instead
428
+ */
429
+ canUserWriteDataForDepartment(recorderDepartment: Referential | any): boolean {
430
+ if (ReferentialUtils.isEmpty(recorderDepartment)) {
431
+ return this.isAdmin();
432
+ }
433
+
434
+ // Should be login, and status ENABLE
435
+ if (!this._data || !this._data.pubkey || this._data.statusId !== StatusIds.ENABLE) return false;
436
+
437
+ if (!this._data.department || !this._data.department.id) {
438
+ console.warn('User account has no department ! Unable to check write right against recorderDepartment');
439
+ return false;
440
+ }
441
+
442
+ // Same recorder department: OK, user can write
443
+ if (this._data.department.id === recorderDepartment.id) return true;
444
+
445
+ // Else, check if supervisor (or more)
446
+ return PersonUtils.hasUpperOrEqualsProfile(this._data.profiles, 'SUPERVISOR');
447
+ }
448
+
449
+ async register(data: RegisterData): Promise<Account> {
450
+ if (this.isLogin()) {
451
+ throw new Error('User already login. Please logout before register.');
452
+ }
453
+ if (!data.username || !data.password) throw new Error('Missing required username or password');
454
+
455
+ if (this._debug) console.debug('[account] Register new user account...', data.account);
456
+ this._cache.loaded = false;
457
+ const now = Date.now();
458
+
459
+ try {
460
+ const keypair = await CryptoService.scryptKeypair(data.username, data.password);
461
+ data.account.pubkey = Base58.encode(keypair.publicKey);
462
+
463
+ // Default values
464
+ data.account.settings = data.account.settings || new UserSettings();
465
+ data.account.settings.locale = this.settings.locale;
466
+ data.account.settings.latLongFormat = this.settings.latLongFormat;
467
+ data.account.settings.content = data.account.settings.content || {};
468
+ data.account.department.id = data.account.department.id || this.environment.defaultDepartmentId;
469
+
470
+ this._cache.keypair = keypair;
471
+ const account = await this.saveRemotely(data.account, keypair);
472
+
473
+ // Default values
474
+ account.avatar = account.avatar || (this.environment.baseUrl + DEFAULT_AVATAR_IMAGE);
475
+ this._cache.mainProfile = PersonUtils.getMainProfile(account.profiles);
476
+
477
+ this._data = account;
478
+ this._cache.pubkey = account.pubkey;
479
+
480
+ // Try to auth on pod
481
+ await this.authenticate(data);
482
+
483
+ this._cache.loaded = true;
484
+
485
+ await this.saveLocally();
486
+
487
+ console.debug(`[account] Account successfully registered in ${Date.now() - now}ms`);
488
+
489
+ // Emit events
490
+ this.onLogin.next(this._data);
491
+ this.onChange.next(this._data);
492
+
493
+ // Listen remote changes
494
+ if (this._enableListenChanges) this.startListenRemoteChanges();
495
+
496
+ return this._data;
497
+ }
498
+ catch (error) {
499
+ console.error(error && error.message || error);
500
+ this.resetData();
501
+ throw error;
502
+ }
503
+ }
504
+
505
+ async authenticate(data?: AuthData) {
506
+ // Wait the auth token, then continue
507
+ const tokenType = await firstNotNilPromise(this._tokenType$);
508
+
509
+ // Basic auth
510
+ if (tokenType === 'basic' || tokenType === 'basic-and-token') {
511
+
512
+ // Generate the authBasic, if used
513
+ if (!this._cache.authBasic) {
514
+ // Skip if token already provided
515
+ if (!(this._cache.authToken && tokenType === 'basic-and-token')) {
516
+ if (!data || !data.username || !data.password) throw new Error('Missing username and password');
517
+ this._cache.authBasic = CryptoService.encodeBase64(`${data.username}:${data.password}`);
518
+ }
519
+ }
520
+ this.onAuthBasicChange.next(this._cache.authBasic);
521
+ }
522
+
523
+ // Generate the authToken, if used
524
+ if (tokenType === 'token' || tokenType === 'basic-and-token') {
525
+ try {
526
+ this._cache.authToken = await this.authenticateAndGetToken(this._cache.authToken);
527
+ } catch (error) {
528
+ // Never authenticate, or not ready for offline mode => exit
529
+ console.error(error);
530
+ this.resetData();
531
+ throw error;
532
+ }
533
+ }
534
+
535
+ // Forget authBasic, to switch to authToken
536
+ if (tokenType === 'basic-and-token') {
537
+ this._cache.authBasic = undefined;
538
+ this.onAuthBasicChange.next(undefined);
539
+ }
540
+ }
541
+
542
+ async login(data: AuthData): Promise<Account> {
543
+ if (!data || !data.username || !data.password) throw new Error('Missing required username or password');
544
+
545
+ console.debug('[account] Login...');
546
+
547
+ let keypair;
548
+ try {
549
+ keypair = await CryptoService.scryptKeypair(data.username, data.password);
550
+ } catch (error) {
551
+ console.error(error);
552
+ this.resetData();
553
+ throw { code: ErrorCodes.UNKNOWN_ERROR, message: 'ERROR.SCRYPT_ERROR' };
554
+ }
555
+
556
+ // Store pubkey+keypair
557
+ this._cache.pubkey = Base58.encode(keypair.publicKey);
558
+ this._cache.keypair = keypair;
559
+
560
+ // Try to load previous token
561
+ let previousToken: string = await this.storage.get(TOKEN_STORAGE_KEY);
562
+ previousToken = previousToken && previousToken.startsWith(this._cache.pubkey) && previousToken || null;
563
+
564
+ // Offline mode
565
+ const offline = this.settings.hasOfflineFeature() && (this.network.offline || data.offline === true);
566
+ if (offline) {
567
+ this._cache.authToken = previousToken;
568
+
569
+ // Make sure network if set as offline
570
+ this.network.setForceOffline(true, {showToast: false});
571
+ console.info(`[account] Login [OK] {pubkey: ${this._cache.pubkey.substr(0, 8)}}, {offline: true}`);
572
+ }
573
+
574
+ // Online mode: try to auth on pod
575
+ else {
576
+
577
+ try {
578
+ await this.authenticate(data);
579
+ } catch (error) {
580
+ // Never authenticate, or not ready for offline mode => exit
581
+ console.error(error);
582
+ this.resetData();
583
+ throw error;
584
+ }
585
+ }
586
+
587
+ // Load account data
588
+ try {
589
+ await this.loadData({offline, fetchPolicy: 'network-only'});
590
+ }
591
+ catch (err) {
592
+ // If account not found, check if email is valid
593
+ if (err && +(err.code) === ErrorCodes.LOAD_ACCOUNT_ERROR) {
594
+
595
+ // Check email exists
596
+ if (data.username.indexOf('@') !== -1) {
597
+ let isEmailExists;
598
+ try {
599
+ isEmailExists = await this.isEmailExists(data.username);
600
+ } catch (otherError) {
601
+ throw err; // resend the first error
602
+ }
603
+
604
+ // Email not exists (no account)
605
+ if (!isEmailExists) {
606
+ throw { code: ErrorCodes.UNKNOWN_ACCOUNT_EMAIL, message: 'ERROR.UNKNOWN_ACCOUNT_EMAIL' };
607
+ }
608
+ }
609
+
610
+ // Email exists, so error = 'bad password'
611
+ throw { code: ErrorCodes.BAD_PASSWORD, message: 'ERROR.BAD_PASSWORD' };
612
+ }
613
+
614
+ throw err; // resend the first error
615
+ }
616
+
617
+ try {
618
+ // Store to local storage
619
+ await this.saveLocally();
620
+ }
621
+ catch (error) {
622
+ console.error(error);
623
+ this.resetData();
624
+ throw error;
625
+ }
626
+
627
+ // Emit event to observers
628
+ this.onLogin.next(this._data);
629
+ this.onChange.next(this._data);
630
+
631
+ if (this._enableListenChanges) this.startListenRemoteChanges();
632
+
633
+ return this._data;
634
+ }
635
+
636
+ async reload(opts?: {showToast?: boolean}): Promise<Account> {
637
+ if (!this._cache.pubkey) throw new Error('User not logged');
638
+ if (this.network.offline) throw new Error('Cannot check account in offline mode');
639
+
640
+ const now = Date.now();
641
+ console.debug(`[account] Reloading account...`);
642
+ const wasLogin = this.isLogin();
643
+
644
+ try {
645
+
646
+ await this.loadData();
647
+ await this.saveLocally();
648
+
649
+ console.debug(`[account] Reloading account [OK] in ${Date.now() - now}ms`);
650
+
651
+ // Emit login event to subscribers
652
+ this.onLogin.next(this._data);
653
+ this.onChange.next(this._data);
654
+
655
+ // Display toast (without await, because not need to wait toast close event)
656
+ if (!opts || opts.showToast !== false) {
657
+ this.showToast({message: 'ACCOUNT.INFO.RELOADED', type: 'info'});
658
+ }
659
+
660
+ return this._data;
661
+ }
662
+ catch (error) {
663
+ // Cannot reload but was login: force to logout
664
+ if (wasLogin && !this.isLogin()) {
665
+ console.error(`[account] Reloading account failed. Will force logout...`, error);
666
+ await this.logout();
667
+ }
668
+ else {
669
+ throw error;
670
+ }
671
+ }
672
+ }
673
+
674
+ /**
675
+ * Create or update an user account, to the remote storage
676
+ *
677
+ * @param account
678
+ */
679
+ async save(account: Account): Promise<Account> {
680
+ if (!this._cache.pubkey) return Promise.reject('User not logged');
681
+ if (this._cache.pubkey !== account.pubkey) return Promise.reject('Not user account');
682
+
683
+ account = await this.saveRemotely(account, this._cache.keypair);
684
+
685
+ // Set defaults
686
+ account.avatar = account.avatar || (this.environment.baseUrl + DEFAULT_AVATAR_IMAGE);
687
+ this._cache.mainProfile = PersonUtils.getMainProfile(account.profiles);
688
+
689
+ this._data = account;
690
+ this._cache.loaded = true;
691
+
692
+ // Save locally (in storage)
693
+ await this.saveLocally();
694
+
695
+ // Send event
696
+ this.onLogin.next(this._data);
697
+ this.onChange.next(this._data);
698
+
699
+ return this._data;
700
+ }
701
+
702
+ async logout(): Promise<void> {
703
+
704
+ const hadAuthToken = this._cache.authToken && true;
705
+ const hadAuthBasic = this._cache.authBasic && true;
706
+ const pubkey = this._cache && this._cache.pubkey;
707
+
708
+ this.resetData();
709
+
710
+ if (!this.settings.hasOfflineFeature()) {
711
+
712
+ // Remove all data from the local storage
713
+ await Promise.all([
714
+ this.storage.remove(PUBKEY_STORAGE_KEY),
715
+ this.storage.remove(TOKEN_STORAGE_KEY),
716
+ this.storage.remove(ACCOUNT_STORAGE_KEY),
717
+ pubkey && this.storage.remove(ACCOUNT_STORAGE_KEY + '#' + pubkey) || Promise.resolve(),
718
+ this.storage.remove(SECKEY_STORAGE_KEY)
719
+ ]);
720
+ }
721
+
722
+ // Offline features enable: need to keep some data
723
+ else {
724
+ // Always remove only secret key
725
+ // But keep:
726
+ // - account by pubkey
727
+ // - auth token
728
+ await Promise.all([
729
+ this.storage.remove(PUBKEY_STORAGE_KEY),
730
+ this.storage.remove(ACCOUNT_STORAGE_KEY),
731
+ this.storage.remove(SECKEY_STORAGE_KEY)
732
+ ]);
733
+ }
734
+
735
+ // Clean page history, in local settings
736
+ await this.settings.clearPageHistory();
737
+
738
+ // Notify observers
739
+ this.onLogout.next();
740
+ if (hadAuthToken) this.onAuthTokenChange.next(undefined);
741
+ if (hadAuthBasic) this.onAuthBasicChange.next(undefined);
742
+ this.onChange.next(undefined);
743
+ }
744
+
745
+ /**
746
+ * Load a account
747
+ *
748
+ * @param opts
749
+ */
750
+ async load(opts?: {
751
+ offline?: boolean;
752
+ fetchPolicy?: FetchPolicy;
753
+ }): Promise<Account | undefined> {
754
+
755
+ const now = this._debug && Date.now();
756
+ if (this._debug) console.debug(`[account] Loading account...`);
757
+ let json: any;
758
+
759
+ // Load locally
760
+ const offline = this.network.offline
761
+ && (!opts || (opts.fetchPolicy !== 'network-only' && opts.fetchPolicy !== 'no-cache'))
762
+ || (opts && opts.offline === true);
763
+ if (offline) {
764
+ json = await this.storage.get(ACCOUNT_STORAGE_KEY);
765
+ json = json && (typeof json === 'string') && JSON.parse(json) || json;
766
+ json = json && this._cache.pubkey && (json.pubkey === this._cache.pubkey) && json || null;
767
+ if (!json && this._cache.pubkey) {
768
+ json = await this.storage.get(ACCOUNT_STORAGE_KEY + '#' + this._cache.pubkey);
769
+ json = json && (typeof json === 'string') && JSON.parse(json) || json;
770
+ }
771
+ }
772
+
773
+ // Load remotely
774
+ else {
775
+ const {data} = await this.graphql.query<{ data: any }>({
776
+ query: LoadQuery,
777
+ error: { code: ErrorCodes.LOAD_ACCOUNT_ERROR, message: 'ERROR.LOAD_ACCOUNT_ERROR' },
778
+ fetchPolicy: opts && opts.fetchPolicy || 'no-cache' || undefined
779
+ });
780
+ json = data;
781
+ }
782
+
783
+ if (json) {
784
+ const account = Account.fromObject(json);
785
+ if (this._debug) console.debug(`[account] Account loaded in ${Date.now() - now}ms`, account);
786
+ return account;
787
+ }
788
+ else {
789
+ console.warn(`[account] Account not found !`);
790
+ return undefined;
791
+ }
792
+ }
793
+
794
+ async generateToken(flags: number): Promise<string | undefined> {
795
+
796
+ const now = this._debug && Date.now();
797
+ if (this._debug) console.debug(`[account] Generate token...`);
798
+
799
+ const authChallenge = await this.getAuthChallenge();
800
+ // Add Flags to challenge
801
+ const challenge = `${authChallenge.challenge}:${flags}`;
802
+ const signature = await CryptoService.sign(challenge, this._cache.keypair);
803
+ const newToken = `${this._cache.pubkey}:${challenge}|${signature}`;
804
+
805
+ if (newToken) {
806
+ if (this._debug) console.debug(`[account] Token generated in ${Date.now() - now}ms`);
807
+ } else {
808
+ console.warn(`[account] Token generation failed !`);
809
+ }
810
+
811
+ return newToken;
812
+ }
813
+
814
+ /**
815
+ * Check if email is available for new account registration.
816
+ * Throw an error if not available
817
+ *
818
+ * @param email
819
+ */
820
+ async checkEmailAvailable(email: string): Promise<void> {
821
+ const isEmailExists = await this.isEmailExists(email);
822
+ if (isEmailExists) {
823
+ throw { code: ErrorCodes.EMAIL_ALREADY_REGISTERED, message: 'ERROR.EMAIL_ALREADY_REGISTERED' };
824
+ }
825
+ }
826
+
827
+ /**
828
+ * Check if email is exists in server.
829
+ *
830
+ * @param email
831
+ */
832
+ async isEmailExists(email: string): Promise<boolean> {
833
+
834
+ if (this._debug) console.debug('[account] Checking if {' + email + '} exists...');
835
+
836
+ const data = await this.graphql.query<{ isEmailExists: boolean }, IsEmailExistsVariables>({
837
+ query: IsEmailExistsQuery,
838
+ variables: {
839
+ email,
840
+ hash: undefined
841
+ }
842
+ });
843
+
844
+ if (this._debug) console.debug('[account] Email exist: ' + (data && data.isEmailExists));
845
+
846
+ return data && data.isEmailExists;
847
+ }
848
+
849
+ async sendConfirmationEmail(email: string, locale?: string): Promise<boolean> {
850
+
851
+ locale = locale || this.settings.locale;
852
+ console.debug('[account] Sending confirmation email to {' + email + '} with locale {' + locale + '}...');
853
+
854
+ return await this.graphql.mutate<boolean>({
855
+ mutation: SendConfirmEmailMutation,
856
+ variables: {
857
+ email,
858
+ locale
859
+ },
860
+ error: {
861
+ code: ErrorCodes.SENT_CONFIRMATION_EMAIL_FAILED,
862
+ message: 'ERROR.SENT_ACCOUNT_CONFIRMATION_EMAIL_FAILED'
863
+ }
864
+ });
865
+ }
866
+
867
+ async confirmEmail(email: string, code: string): Promise<boolean> {
868
+
869
+ console.debug('[account] Sending confirm request for email {' + email + '} with code {' + code + '}...');
870
+
871
+ const res = await this.graphql.mutate<{ confirmAccountEmail: boolean }>({
872
+ mutation: ConfirmEmailMutation,
873
+ variables: {
874
+ email,
875
+ code
876
+ },
877
+ error: {
878
+ code: ErrorCodes.CONFIRM_EMAIL_FAILED,
879
+ message: 'ERROR.CONFIRM_ACCOUNT_EMAIL_FAILED'
880
+ }
881
+ });
882
+ return res && res.confirmAccountEmail;
883
+ }
884
+
885
+ listenChanges(opts?: AccountWatchOptions): Subscription {
886
+ if (this._enableListenChanges) return new Subscription(); // Already started: skip
887
+
888
+ return this.startListenRemoteChanges(opts);
889
+ }
890
+
891
+ get additionalFields(): FormFieldDefinition[] {
892
+ return this._$additionalFields.getValue();
893
+ }
894
+
895
+ get $additionalFields(): Observable<FormFieldDefinition[]> {
896
+ return this._$additionalFields.asObservable();
897
+ }
898
+
899
+ getAdditionalField(key: string): FormFieldDefinition | undefined {
900
+ return this._$additionalFields.getValue().find(f => f.key === key);
901
+ }
902
+
903
+ registerAdditionalField(field: FormFieldDefinition) {
904
+ const values = this._$additionalFields.getValue();
905
+ if (!!values.find(f => f.key === field.key)) {
906
+ throw new Error(`Additional account field {key: ${field.key}} already define.`);
907
+ }
908
+ if (this._debug) console.debug(`[account] Found additional account's field {key: ${field.key}}`);
909
+ this._$additionalFields.next(values.concat(field));
910
+ }
911
+
912
+ get optionDefs(): FormFieldDefinition[] {
913
+ return this._optionDefs;
914
+ }
915
+
916
+ registerOption(def: FormFieldDefinition) {
917
+ if (this._optionDefs.findIndex(f => f.key === def.key) !== -1) {
918
+ throw new Error(`Additional option {${def.key}} already define.`);
919
+ }
920
+ if (this._debug) console.debug(`[account] Adding additional option {${def.key}}`, def);
921
+ this._optionDefs.push(def);
922
+ }
923
+
924
+ registerOptions(defs: FormFieldDefinition[]) {
925
+ (defs || []).forEach(def => this.registerOption(def));
926
+ }
927
+
928
+
929
+ /* -- protected method -- */
930
+
931
+ protected resetData() {
932
+ this.stopListenRemoteChanges();
933
+ this._cache.loaded = false;
934
+ this._cache.keypair = null;
935
+ this._cache.authToken = null;
936
+ this._cache.authBasic = null;
937
+ this._cache.pubkey = null;
938
+ this._cache.mainProfile = null;
939
+ this._cache.person = null;
940
+ this._cache.department = null;
941
+ this._data = new Account();
942
+ }
943
+
944
+ protected async loadData(opts?: {
945
+ offline?: boolean;
946
+ fetchPolicy?: FetchPolicy;
947
+ }): Promise<Account> {
948
+ if (!this._cache.pubkey) throw new Error('User not logged');
949
+
950
+ this._cache.loaded = false;
951
+
952
+ try {
953
+ const account = (await this.load(opts)) || new Account();
954
+
955
+ // Set defaults
956
+ account.avatar = account.avatar || (this.environment.baseUrl + DEFAULT_AVATAR_IMAGE);
957
+ account.settings = account.settings || new UserSettings();
958
+ account.settings.locale = account.settings.locale || this.settings.locale;
959
+ account.settings.latLongFormat = account.settings.latLongFormat || this.settings.latLongFormat || 'DDMM';
960
+ account.settings.content = account.settings.content || {};
961
+
962
+ // Read main profile
963
+ this._cache.mainProfile = PersonUtils.getMainProfile(account.profiles);
964
+
965
+ // Update, instead of replace it
966
+ if (this._data) {
967
+ this._data.fromObject(account);
968
+ }
969
+ else {
970
+ this._data = account;
971
+ }
972
+ this._cache.loaded = true;
973
+
974
+ // Apply settings, found in remote account
975
+ if (account.settings) {
976
+ const settings = {
977
+ ...this.settings.settings,
978
+ ...account.settings.asLocalSettings()
979
+ };
980
+ await this.settings.apply(settings);
981
+ }
982
+
983
+ return this._data;
984
+ }
985
+ catch (error) {
986
+ this.resetData();
987
+ if (error.code && error.message) throw error;
988
+
989
+ console.error(error);
990
+ throw {
991
+ code: ErrorCodes.LOAD_ACCOUNT_ERROR,
992
+ message: 'ERROR.LOAD_ACCOUNT_ERROR'
993
+ };
994
+ }
995
+ }
996
+
997
+ protected async listenSettings(): Promise<void>{
998
+ // When settings changed: save it remotely
999
+ this.registerSubscription(
1000
+ this.settings.onChange
1001
+ .pipe(
1002
+ debounceTime(1000),
1003
+ filter(() => this.isLogin() && this.network.online)
1004
+ )
1005
+ .subscribe(settings => this.saveLocalSettingsRemotely(settings)));
1006
+ }
1007
+
1008
+ protected async restoreLocally(): Promise<Account | undefined> {
1009
+
1010
+ // Restore from storage
1011
+ const values = await Promise.all([
1012
+ this.storage.get(PUBKEY_STORAGE_KEY),
1013
+ this.storage.get(TOKEN_STORAGE_KEY),
1014
+ this.storage.get(SECKEY_STORAGE_KEY)
1015
+ ]);
1016
+ let pubkey = values[0];
1017
+ let token = values[1];
1018
+ const seckey = values[2];
1019
+
1020
+ // DEV only - auth by token
1021
+ if (!this.environment.production && this.environment.defaultAuthValues?.token) {
1022
+ token = token || this.environment.defaultAuthValues.token;
1023
+ pubkey = pubkey || token?.split(':', 2)[0];
1024
+ }
1025
+
1026
+ // Quit if no pubkey (not logged)
1027
+ if (!pubkey) return;
1028
+
1029
+ // Quit if could not auth on pod
1030
+ const canRemoteAuth = token || seckey || false;
1031
+ if (!canRemoteAuth) return;
1032
+
1033
+ if (this._debug) console.debug(`[account] Account restoration...`);
1034
+
1035
+ this._cache.authToken = token;
1036
+ this._cache.pubkey = pubkey;
1037
+ this._cache.keypair = seckey && {
1038
+ publicKey: Base58.decode(pubkey),
1039
+ secretKey: Base58.decode(seckey)
1040
+ } || null;
1041
+
1042
+ // Online mode: try to connect to pod
1043
+ if (this.network.online) {
1044
+ try {
1045
+ await this.authenticate();
1046
+ if (!this._cache.authToken && !this._cache.authBasic) throw new Error('Authentication failed');
1047
+ }
1048
+ catch (error) {
1049
+ // Offline feature are enable: continue in offline mode
1050
+ if (this.settings.hasOfflineFeature()) {
1051
+ console.warn('[account] Unable to authenticate on pod: forcing offline mode');
1052
+ this.network.setForceOffline(true, {showToast: false});
1053
+ // Continue
1054
+ }
1055
+ // No offline features enable (=offline mode not allowed)
1056
+ else {
1057
+ console.error(error);
1058
+ this.logout();
1059
+ return;
1060
+ }
1061
+
1062
+ }
1063
+ }
1064
+
1065
+ // Get the account, from pubkey
1066
+ let jsonAccount = await this.storage.get(`${ACCOUNT_STORAGE_KEY}#${pubkey}`);
1067
+ if (!jsonAccount) {
1068
+ // Try using the old storage key
1069
+ const accountStr = await this.storage.get(ACCOUNT_STORAGE_KEY);
1070
+ jsonAccount = accountStr && ((typeof accountStr === 'string') && JSON.parse(jsonAccount) || accountStr);
1071
+ }
1072
+
1073
+ // Invalid account: do not use it
1074
+ if (!jsonAccount || jsonAccount.pubkey !== pubkey) {
1075
+
1076
+ // DEV only: create a fake account with given username
1077
+ if (!this.environment.production && this.environment.defaultAuthValues.username) {
1078
+ const username = this.environment.defaultAuthValues.username;
1079
+ jsonAccount = {pubkey, username, firstName: username, lastName: username};
1080
+ }
1081
+ else {
1082
+ return;
1083
+ }
1084
+ }
1085
+
1086
+ // Transform to entity
1087
+ const account = Account.fromObject(jsonAccount);
1088
+
1089
+ // Update data
1090
+ this._data = account;
1091
+ this._cache.mainProfile = PersonUtils.getMainProfile(account.profiles);
1092
+ this._cache.loaded = true;
1093
+
1094
+ // Emit event
1095
+ this.onLogin.next(this._data);
1096
+ this.onChange.next(this._data);
1097
+
1098
+ if (this._enableListenChanges) this.startListenRemoteChanges();
1099
+
1100
+ if (this._debug) console.debug(`[account] Account restoration [OK] {pubkey: ${pubkey.substr(0, 8)}}, {profile: ${this._cache.mainProfile}}`);
1101
+
1102
+ return account;
1103
+ }
1104
+
1105
+ /**
1106
+ * Save account into the local storage
1107
+ */
1108
+ protected async saveLocally(): Promise<void> {
1109
+ if (!this._cache.pubkey) throw new Error('User not logged');
1110
+
1111
+ if (this._debug) console.debug(`[account] Saving account {${this._cache.pubkey.substring(0, 6)}} in local storage...`);
1112
+
1113
+ // Convert account to json
1114
+ const json = this._data.asObject({keepTypename: true});
1115
+ const seckey = this._cache.keypair && this._cache.keypair.secretKey && Base58.encode(this._cache.keypair.secretKey) || null;
1116
+
1117
+ // Convert avatar URL to dataUrl (e.g. 'data:image/png:<base64 content>')
1118
+ const hasAvatarUrl = json.avatar && !json.avatar.endsWith(DEFAULT_AVATAR_IMAGE) &&
1119
+ (json.avatar.startsWith('http://') || (json.avatar.startsWith('https://')));
1120
+ if (hasAvatarUrl && this.network.online) {
1121
+ await this.file.getImage(json.avatar, {
1122
+ thumbnail: true,
1123
+ outputType: 'dataUrl'
1124
+ })
1125
+ .then(dataUrl => {
1126
+ if (dataUrl && this._debug) console.debug('[account] Image fetched: ', dataUrl.substring(0, 50));
1127
+
1128
+ // TODO: make sure to display Base64 image in the menu top header
1129
+ //jsonAccount.avatar = dataUrl;
1130
+ })
1131
+ .catch(err => {
1132
+ console.error(`[account] Error while fetching image: ${json.avatar}: ${err}`);
1133
+ });
1134
+ }
1135
+
1136
+ try {
1137
+ await Promise.all([
1138
+ this.storage.set(PUBKEY_STORAGE_KEY, this._cache.pubkey),
1139
+ this.storage.set(TOKEN_STORAGE_KEY, this._cache.authToken),
1140
+ this.storage.set(`${ACCOUNT_STORAGE_KEY}#${this._cache.pubkey}`, json),
1141
+ // Secret key (optional)
1142
+ seckey && this.storage.set(SECKEY_STORAGE_KEY, seckey) || this.storage.remove(SECKEY_STORAGE_KEY),
1143
+ // Remove old storage key
1144
+ this.storage.remove(ACCOUNT_STORAGE_KEY)
1145
+ ]);
1146
+
1147
+ if (this._debug) console.debug('[account] Account saved in local storage');
1148
+ }
1149
+ catch(err) {
1150
+ console.error('[account] Error while saving account locally: ' + (err && err.message || err), err);
1151
+ }
1152
+ }
1153
+
1154
+ async saveLocalSettingsRemotely(source: LocalSettings){
1155
+ if (!source || !this.isLogin() || source.accountInheritance === false) return; // Skip
1156
+ const account = this.account;
1157
+
1158
+ // Merge local settings into account's settings
1159
+ const settings = UserSettings.fromObject(account.settings) || new UserSettings();
1160
+ const changed = settings.merge(source, ['locale', 'latLongFormat', 'properties']);
1161
+
1162
+ if (!changed) return; // Skip if unchanged
1163
+
1164
+ // Save remotely
1165
+ this.account.settings = settings;
1166
+ await this.saveSettingsRemotely(settings);
1167
+ }
1168
+
1169
+ /**
1170
+ * Create or update an user account
1171
+ *
1172
+ * @param account
1173
+ * @param keyPair
1174
+ */
1175
+ protected async saveRemotely(account: Account, keyPair?: Keypair): Promise<Account> {
1176
+ account.pubkey = account.pubkey || (keyPair && Base58.encode(keyPair.publicKey));
1177
+ if (!account.pubkey) throw new Error('Missing account pubkey');
1178
+
1179
+ const now = this._debug && Date.now();
1180
+ if (this._debug) console.debug(`[account] Saving account remotely...`);
1181
+
1182
+ const isNew = isNil(account.id);
1183
+
1184
+ // If this is an update: get existing account's updateDate, to avoid 'version error' when saving
1185
+ if (!isNew) {
1186
+ const existingAccount = await this.load({ fetchPolicy: 'network-only' });
1187
+ if (!existingAccount || !existingAccount.updateDate) {
1188
+ throw { code: ErrorCodes.ACCOUNT_NOT_EXISTS, message: 'ERROR.ACCOUNT_NOT_EXISTS' };
1189
+ }
1190
+ this.copyIdAndUpdateDate(existingAccount, account);
1191
+ }
1192
+
1193
+ // Merging settings
1194
+ account.settings.content['pages'] = this.settings.settings.pages;
1195
+ account.settings.content['pageHistory'] = this.settings.settings.pageHistory;
1196
+
1197
+ // Convert to json
1198
+ const json = account.asObject(MINIFY_ENTITY_FOR_POD);
1199
+
1200
+ // User not allow to change his profiles
1201
+ delete json.profiles;
1202
+
1203
+ // Execute mutation
1204
+ const { data } = await this.graphql.mutate<{ data: Account }>({
1205
+ mutation: isNew ? AccountMutations.create : AccountMutations.save,
1206
+ variables: { data: json },
1207
+ error: {
1208
+ code: ErrorCodes.SAVE_ACCOUNT_ERROR,
1209
+ message: 'ERROR.SAVE_ACCOUNT_ERROR'
1210
+ }
1211
+ });
1212
+
1213
+ // Copy update properties
1214
+ this.copyIdAndUpdateDate(data, account);
1215
+
1216
+ if (this._debug) console.debug(`[account] Account remotely saved in ${Date.now() - now}ms`);
1217
+
1218
+ return account;
1219
+ }
1220
+
1221
+ /**
1222
+ * Create or update user settings
1223
+ *
1224
+ * @param settings
1225
+ */
1226
+ protected async saveSettingsRemotely(settings: UserSettings) {
1227
+
1228
+ const now = this._debug && Date.now();
1229
+ if (this._debug) console.debug(`[account] Saving settings remotely...`);
1230
+
1231
+ const json = settings.asObject(MINIFY_ENTITY_FOR_POD);
1232
+
1233
+ // Execute mutation
1234
+ const { data } = await this.graphql.mutate<{ data: UserSettings }>({
1235
+ mutation: AccountMutations.saveSettings,
1236
+ variables: { data: json },
1237
+ error: {
1238
+ code: ErrorCodes.SAVE_SETTINGS_ERROR,
1239
+ message: 'ERROR.SAVE_SETTINGS_ERROR'
1240
+ }
1241
+ });
1242
+
1243
+ // Copy update properties
1244
+ this.copyIdAndUpdateDateSettings(data, settings);
1245
+
1246
+ if (this._debug) console.debug(`[account] Settings remotely saved in ${Date.now() - now}ms`);
1247
+
1248
+ // Save into account
1249
+ if (this.account) this.account.settings = settings;
1250
+ }
1251
+
1252
+ protected async authenticateAndGetToken(token?: string, counter?: number): Promise<string> {
1253
+ if (!this._cache.pubkey) throw new Error('User not logged');
1254
+
1255
+ if (!counter) console.info('[account] Authentication on pod...');
1256
+
1257
+ if (counter > 4) {
1258
+ if (this._debug) console.debug(`[account] Failed to authentication on pod (after ${counter} attempts)`);
1259
+ throw { code: ErrorCodes.AUTH_SERVER_ERROR, message: 'ERROR.AUTH_SERVER_ERROR' };
1260
+ }
1261
+
1262
+ // Check if valid
1263
+ if (token) {
1264
+ const data = await this.graphql.query<{ authenticate: boolean }, { token: string }>({
1265
+ query: AuthQuery,
1266
+ variables: {
1267
+ token
1268
+ },
1269
+ error: {
1270
+ code: ErrorCodes.UNAUTHORIZED,
1271
+ message: 'ERROR.UNAUTHORIZED'
1272
+ },
1273
+ fetchPolicy: 'no-cache'
1274
+ });
1275
+
1276
+ // Token is accepted by the server
1277
+ if (data && data.authenticate) {
1278
+ // Store the token
1279
+ this.onAuthTokenChange.next(token);
1280
+
1281
+ console.info(`[account] Authentication on pod [OK] {pubkey: '${this._cache.pubkey.substr(0, 8)}'}`);
1282
+ return token; // return the token
1283
+ }
1284
+
1285
+ // Continue (will retry with another challenge)
1286
+ }
1287
+
1288
+ // Generate a new token
1289
+ const authChallenge = await this.getAuthChallenge();
1290
+ // TODO: check server pubkey as a valid certificate
1291
+
1292
+ // Do the challenge
1293
+ const signature = await CryptoService.sign(authChallenge.challenge, this._cache.keypair);
1294
+ const newToken = `${this._cache.pubkey}:${authChallenge.challenge}|${signature}`;
1295
+
1296
+ // iterate with the new token
1297
+ return await this.authenticateAndGetToken(newToken, (counter || 1) + 1 /* increment */);
1298
+ }
1299
+
1300
+ protected async getAuthChallenge(): Promise<IAuthChallenge> {
1301
+ const challengeError = {
1302
+ code: ErrorCodes.AUTH_CHALLENGE_ERROR,
1303
+ message: 'ERROR.AUTH_CHALLENGE_ERROR'
1304
+ };
1305
+ const { authChallenge} = await this.graphql.query<{
1306
+ authChallenge: IAuthChallenge;
1307
+ }>({
1308
+ query: AuthChallengeQuery,
1309
+ variables: {},
1310
+ error: challengeError,
1311
+ fetchPolicy: 'network-only'
1312
+ });
1313
+
1314
+ // Check challenge
1315
+ if (!authChallenge) throw challengeError; // Should never occur
1316
+
1317
+ // Check server signature
1318
+ const signatureOK = await CryptoService.verify(
1319
+ authChallenge.challenge,
1320
+ authChallenge.signature,
1321
+ authChallenge.pubkey
1322
+ );
1323
+ if (!signatureOK) {
1324
+ console.warn('FIXME: Bad peer signature on auth challenge !', authChallenge);
1325
+ }
1326
+ return authChallenge;
1327
+ }
1328
+
1329
+ protected startListenRemoteChanges(opts?: AccountWatchOptions): Subscription {
1330
+ if (this._listenChangesSubscription) this.stopListenRemoteChanges(); // Stop previous subscription
1331
+ if (this.network.offline) return new Subscription(); // Offline: skip
1332
+
1333
+ this._listenChangesSubscription = this.watchChanges(opts)
1334
+ .subscribe({
1335
+ next: (data) => {
1336
+ console.debug(`[account] Remote update detected at ${data.updateDate}`);
1337
+ this.reload();
1338
+ },
1339
+ error: (err) => {
1340
+ if (err && +err.code === ServerErrorCodes.NOT_FOUND) {
1341
+ console.info('[account] [WS] Account not exists anymore: force user to logout...', err);
1342
+ this.logout();
1343
+ } else if (err && +err.code === ServerErrorCodes.UNAUTHORIZED) {
1344
+ console.info('[account] [WS] Account not authorized: force user to logout...', err);
1345
+ this.logout();
1346
+ } else {
1347
+ console.warn('[account] [WS] Received error:', err);
1348
+ }
1349
+ }
1350
+ });
1351
+ this._listenChangesSubscription.add(() => {
1352
+ console.debug(`[account] Stop watching remote changes`);
1353
+ this._listenChangesSubscription = null;
1354
+ });
1355
+ return this._listenChangesSubscription;
1356
+ }
1357
+
1358
+ protected stopListenRemoteChanges() {
1359
+ this._listenChangesSubscription?.unsubscribe();
1360
+ }
1361
+
1362
+ protected watchChanges(opts?: AccountWatchOptions): Observable<Account> {
1363
+
1364
+ if (!this.started) {
1365
+ // Wait service ready, then loop
1366
+ return from(this.ready())
1367
+ .pipe(switchMap(() => this.watchChanges(opts)));
1368
+ }
1369
+
1370
+ if (!this._cache.pubkey) throw new Error('Not logged in');
1371
+ if (this.network.offline) throw new Error('Cannot watch account changes: network is offline.');
1372
+
1373
+ const variables = {
1374
+ interval: toNumber(opts && opts.intervalInSeconds, this._listenIntervalInSeconds)
1375
+ };
1376
+
1377
+ console.debug(`[account] Watching remote changes, every ${variables.interval}s`);
1378
+
1379
+ return this.graphql.subscribe<{data: any}>({
1380
+ query: AccountSubscriptions.listenChanges,
1381
+ variables,
1382
+ error: {
1383
+ code: ErrorCodes.SUBSCRIBE_ACCOUNT_ERROR,
1384
+ message: 'ERROR.ACCOUNT.SUBSCRIBE_ERROR'
1385
+ }
1386
+ }).pipe(
1387
+ map(({data}) => data),
1388
+ // Keep only if newer
1389
+ filter(data => {
1390
+ const currentUpdateDate: Moment = fromDateISOString(this._data?.updateDate);
1391
+ const remoteUpdateDate: Moment = fromDateISOString(data?.updateDate);
1392
+ return (remoteUpdateDate && (!currentUpdateDate || !remoteUpdateDate.isSame(currentUpdateDate, 'millisecond')));
1393
+ })
1394
+ );
1395
+ }
1396
+
1397
+ protected copyIdAndUpdateDate(source: Account | undefined, target: Account) {
1398
+ if (!source) return;
1399
+
1400
+ target.id = source.id || target.id;
1401
+ target.updateDate = source.updateDate || target.updateDate;
1402
+
1403
+ this.copyIdAndUpdateDateSettings(source.settings, target.settings);
1404
+ this.copyIdAndUpdateDateToken(source.tokens, target.tokens);
1405
+ }
1406
+
1407
+ protected copyIdAndUpdateDateSettings(source: UserSettings | undefined, target: UserSettings) {
1408
+ if (!source) return;
1409
+
1410
+ target.id = source.id || target.id;
1411
+ target.updateDate = source.updateDate || target.updateDate;
1412
+ }
1413
+
1414
+ protected copyIdAndUpdateDateToken(sources: UserToken[] | undefined, targets: UserToken[]) {
1415
+ if (isEmptyArray(sources)) return;
1416
+
1417
+ sources.forEach(source => {
1418
+ const target = targets.find(value => value.id === source.id || value.name === source.name);
1419
+ if (target) {
1420
+ target.id = source.id || target.id;
1421
+ target.creationDate = source.creationDate || target.creationDate;
1422
+ target.updateDate = source.updateDate || target.updateDate;
1423
+ target.token = undefined;
1424
+ }
1425
+ });
1426
+ }
1427
+
1428
+ protected showToast<T = any>(opts: ShowToastOptions): Promise<OverlayEventDetail<T>> {
1429
+ return Toasts.show(this.toastController, this.translate, opts);
1430
+ }
1431
+ }