@sync-in/server 1.11.0 → 2.0.0

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 (1040) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/LICENSE +1 -1
  3. package/README.md +3 -11
  4. package/environment/environment.dist.min.yaml +1 -1
  5. package/environment/environment.dist.yaml +173 -28
  6. package/package.json +17 -16
  7. package/server/app.bootstrap.js +1 -5
  8. package/server/app.bootstrap.js.map +1 -1
  9. package/server/app.constants.js +1 -5
  10. package/server/app.constants.js.map +1 -1
  11. package/server/app.e2e-spec.js +1 -5
  12. package/server/app.e2e-spec.js.map +1 -1
  13. package/server/app.functions.js +1 -5
  14. package/server/app.functions.js.map +1 -1
  15. package/server/app.module.js +1 -5
  16. package/server/app.module.js.map +1 -1
  17. package/server/app.service.js +1 -5
  18. package/server/app.service.js.map +1 -1
  19. package/server/app.service.spec.js +2 -6
  20. package/server/app.service.spec.js.map +1 -1
  21. package/server/applications/admin/admin.module.js +1 -5
  22. package/server/applications/admin/admin.module.js.map +1 -1
  23. package/server/applications/admin/constants/routes.js +1 -5
  24. package/server/applications/admin/constants/routes.js.map +1 -1
  25. package/server/applications/admin/interfaces/check-update.interfaces.js +1 -5
  26. package/server/applications/admin/interfaces/check-update.interfaces.js.map +1 -1
  27. package/server/applications/admin/services/admin-scheduler.service.js +1 -5
  28. package/server/applications/admin/services/admin-scheduler.service.js.map +1 -1
  29. package/server/applications/admin/services/admin.service.js +13 -8
  30. package/server/applications/admin/services/admin.service.js.map +1 -1
  31. package/server/applications/admin/services/admin.service.spec.js +1 -5
  32. package/server/applications/admin/services/admin.service.spec.js.map +1 -1
  33. package/server/applications/admin/utils/check-update.js +1 -5
  34. package/server/applications/admin/utils/check-update.js.map +1 -1
  35. package/server/applications/applications.config.js +1 -5
  36. package/server/applications/applications.config.js.map +1 -1
  37. package/server/applications/applications.constants.js +5 -5
  38. package/server/applications/applications.constants.js.map +1 -1
  39. package/server/applications/applications.module.js +1 -5
  40. package/server/applications/applications.module.js.map +1 -1
  41. package/server/applications/comments/comments.controller.js +1 -5
  42. package/server/applications/comments/comments.controller.js.map +1 -1
  43. package/server/applications/comments/comments.controller.spec.js +1 -5
  44. package/server/applications/comments/comments.controller.spec.js.map +1 -1
  45. package/server/applications/comments/comments.module.js +1 -5
  46. package/server/applications/comments/comments.module.js.map +1 -1
  47. package/server/applications/comments/constants/routes.js +1 -5
  48. package/server/applications/comments/constants/routes.js.map +1 -1
  49. package/server/applications/comments/dto/comment.dto.js +1 -5
  50. package/server/applications/comments/dto/comment.dto.js.map +1 -1
  51. package/server/applications/comments/interfaces/comment-recent.interface.js +1 -5
  52. package/server/applications/comments/interfaces/comment-recent.interface.js.map +1 -1
  53. package/server/applications/comments/schemas/comment.interface.js +1 -5
  54. package/server/applications/comments/schemas/comment.interface.js.map +1 -1
  55. package/server/applications/comments/schemas/comments.schema.js +1 -5
  56. package/server/applications/comments/schemas/comments.schema.js.map +1 -1
  57. package/server/applications/comments/services/comments-manager.service.js +9 -7
  58. package/server/applications/comments/services/comments-manager.service.js.map +1 -1
  59. package/server/applications/comments/services/comments-manager.service.spec.js +10 -8
  60. package/server/applications/comments/services/comments-manager.service.spec.js.map +1 -1
  61. package/server/applications/comments/services/comments-queries.service.js +1 -5
  62. package/server/applications/comments/services/comments-queries.service.js.map +1 -1
  63. package/server/applications/files/adapters/files-indexer-mysql.service.js +29 -12
  64. package/server/applications/files/adapters/files-indexer-mysql.service.js.map +1 -1
  65. package/server/applications/files/adapters/files-indexer-mysql.service.spec.js +1 -5
  66. package/server/applications/files/adapters/files-indexer-mysql.service.spec.js.map +1 -1
  67. package/server/applications/files/constants/cache.js +1 -5
  68. package/server/applications/files/constants/cache.js.map +1 -1
  69. package/server/applications/files/constants/compress.js +1 -5
  70. package/server/applications/files/constants/compress.js.map +1 -1
  71. package/server/applications/files/constants/files.js +1 -5
  72. package/server/applications/files/constants/files.js.map +1 -1
  73. package/server/applications/files/constants/indexing.js +1 -5
  74. package/server/applications/files/constants/indexing.js.map +1 -1
  75. package/server/applications/files/constants/operations.js +1 -5
  76. package/server/applications/files/constants/operations.js.map +1 -1
  77. package/server/applications/files/constants/routes.js +1 -5
  78. package/server/applications/files/constants/routes.js.map +1 -1
  79. package/server/applications/files/constants/samples.js +1 -5
  80. package/server/applications/files/constants/samples.js.map +1 -1
  81. package/server/applications/files/dto/file-operations.dto.js +1 -5
  82. package/server/applications/files/dto/file-operations.dto.js.map +1 -1
  83. package/server/applications/files/events/file-task-event.js +1 -5
  84. package/server/applications/files/events/file-task-event.js.map +1 -1
  85. package/server/applications/files/files-tasks.controller.js +1 -5
  86. package/server/applications/files/files-tasks.controller.js.map +1 -1
  87. package/server/applications/files/files-tasks.controller.spec.js +1 -5
  88. package/server/applications/files/files-tasks.controller.spec.js.map +1 -1
  89. package/server/applications/files/files.config.js +1 -5
  90. package/server/applications/files/files.config.js.map +1 -1
  91. package/server/applications/files/files.controller.js +1 -5
  92. package/server/applications/files/files.controller.js.map +1 -1
  93. package/server/applications/files/files.controller.spec.js +1 -5
  94. package/server/applications/files/files.controller.spec.js.map +1 -1
  95. package/server/applications/files/files.module.js +1 -5
  96. package/server/applications/files/files.module.js.map +1 -1
  97. package/server/applications/files/interfaces/file-db-props.interface.js +1 -5
  98. package/server/applications/files/interfaces/file-db-props.interface.js.map +1 -1
  99. package/server/applications/files/interfaces/file-lock.interface.js +1 -5
  100. package/server/applications/files/interfaces/file-lock.interface.js.map +1 -1
  101. package/server/applications/files/interfaces/file-parse-index.js +1 -5
  102. package/server/applications/files/interfaces/file-parse-index.js.map +1 -1
  103. package/server/applications/files/interfaces/file-props.interface.js +1 -5
  104. package/server/applications/files/interfaces/file-props.interface.js.map +1 -1
  105. package/server/applications/files/interfaces/file-recent-location.interface.js +1 -5
  106. package/server/applications/files/interfaces/file-recent-location.interface.js.map +1 -1
  107. package/server/applications/files/interfaces/file-space.interface.js +1 -5
  108. package/server/applications/files/interfaces/file-space.interface.js.map +1 -1
  109. package/server/applications/files/interfaces/file-tree.interface.js +1 -5
  110. package/server/applications/files/interfaces/file-tree.interface.js.map +1 -1
  111. package/server/applications/files/models/file-error.js +1 -5
  112. package/server/applications/files/models/file-error.js.map +1 -1
  113. package/server/applications/files/models/file-lock-error.js +1 -5
  114. package/server/applications/files/models/file-lock-error.js.map +1 -1
  115. package/server/applications/files/models/file-task.js +1 -5
  116. package/server/applications/files/models/file-task.js.map +1 -1
  117. package/server/applications/files/models/files-indexer.js +1 -5
  118. package/server/applications/files/models/files-indexer.js.map +1 -1
  119. package/server/applications/files/modules/collabora-online/collabora-online-environment.decorator.js +1 -5
  120. package/server/applications/files/modules/collabora-online/collabora-online-environment.decorator.js.map +1 -1
  121. package/server/applications/files/modules/collabora-online/collabora-online-manager.service.js +21 -10
  122. package/server/applications/files/modules/collabora-online/collabora-online-manager.service.js.map +1 -1
  123. package/server/applications/files/modules/collabora-online/collabora-online-manager.service.spec.js +1 -5
  124. package/server/applications/files/modules/collabora-online/collabora-online-manager.service.spec.js.map +1 -1
  125. package/server/applications/files/modules/collabora-online/collabora-online.config.js +1 -5
  126. package/server/applications/files/modules/collabora-online/collabora-online.config.js.map +1 -1
  127. package/server/applications/files/modules/collabora-online/collabora-online.constants.js +1 -5
  128. package/server/applications/files/modules/collabora-online/collabora-online.constants.js.map +1 -1
  129. package/server/applications/files/modules/collabora-online/collabora-online.controller.js +1 -5
  130. package/server/applications/files/modules/collabora-online/collabora-online.controller.js.map +1 -1
  131. package/server/applications/files/modules/collabora-online/collabora-online.controller.spec.js +1 -5
  132. package/server/applications/files/modules/collabora-online/collabora-online.controller.spec.js.map +1 -1
  133. package/server/applications/files/modules/collabora-online/collabora-online.dtos.js +1 -5
  134. package/server/applications/files/modules/collabora-online/collabora-online.dtos.js.map +1 -1
  135. package/server/applications/files/modules/collabora-online/collabora-online.guard.js +1 -5
  136. package/server/applications/files/modules/collabora-online/collabora-online.guard.js.map +1 -1
  137. package/server/applications/files/modules/collabora-online/collabora-online.guard.spec.js +1 -5
  138. package/server/applications/files/modules/collabora-online/collabora-online.guard.spec.js.map +1 -1
  139. package/server/applications/files/modules/collabora-online/collabora-online.interface.js +1 -5
  140. package/server/applications/files/modules/collabora-online/collabora-online.interface.js.map +1 -1
  141. package/server/applications/files/modules/collabora-online/collabora-online.module.js +1 -5
  142. package/server/applications/files/modules/collabora-online/collabora-online.module.js.map +1 -1
  143. package/server/applications/files/modules/collabora-online/collabora-online.routes.js +1 -5
  144. package/server/applications/files/modules/collabora-online/collabora-online.routes.js.map +1 -1
  145. package/server/applications/files/modules/collabora-online/collabora-online.strategy.js +1 -5
  146. package/server/applications/files/modules/collabora-online/collabora-online.strategy.js.map +1 -1
  147. package/server/applications/files/modules/collabora-online/collabora-online.utils.js +1 -5
  148. package/server/applications/files/modules/collabora-online/collabora-online.utils.js.map +1 -1
  149. package/server/applications/files/modules/file-editor-providers.interface.js +6 -0
  150. package/server/applications/files/modules/file-editor-providers.interface.js.map +1 -0
  151. package/server/applications/files/modules/only-office/only-office-environment.decorator.js +1 -5
  152. package/server/applications/files/modules/only-office/only-office-environment.decorator.js.map +1 -1
  153. package/server/applications/files/modules/only-office/only-office-manager.service.js +57 -19
  154. package/server/applications/files/modules/only-office/only-office-manager.service.js.map +1 -1
  155. package/server/applications/files/modules/only-office/only-office-manager.service.spec.js +1 -5
  156. package/server/applications/files/modules/only-office/only-office-manager.service.spec.js.map +1 -1
  157. package/server/applications/files/modules/only-office/only-office.config.js +1 -5
  158. package/server/applications/files/modules/only-office/only-office.config.js.map +1 -1
  159. package/server/applications/files/modules/only-office/only-office.constants.js +1 -5
  160. package/server/applications/files/modules/only-office/only-office.constants.js.map +1 -1
  161. package/server/applications/files/modules/only-office/only-office.controller.js +1 -5
  162. package/server/applications/files/modules/only-office/only-office.controller.js.map +1 -1
  163. package/server/applications/files/modules/only-office/only-office.controller.spec.js +1 -5
  164. package/server/applications/files/modules/only-office/only-office.controller.spec.js.map +1 -1
  165. package/server/applications/files/modules/only-office/only-office.dtos.js +1 -5
  166. package/server/applications/files/modules/only-office/only-office.dtos.js.map +1 -1
  167. package/server/applications/files/modules/only-office/only-office.guard.js +1 -5
  168. package/server/applications/files/modules/only-office/only-office.guard.js.map +1 -1
  169. package/server/applications/files/modules/only-office/only-office.guard.spec.js +1 -5
  170. package/server/applications/files/modules/only-office/only-office.guard.spec.js.map +1 -1
  171. package/server/applications/files/modules/only-office/only-office.interface.js +1 -5
  172. package/server/applications/files/modules/only-office/only-office.interface.js.map +1 -1
  173. package/server/applications/files/modules/only-office/only-office.module.js +1 -5
  174. package/server/applications/files/modules/only-office/only-office.module.js.map +1 -1
  175. package/server/applications/files/modules/only-office/only-office.routes.js +1 -5
  176. package/server/applications/files/modules/only-office/only-office.routes.js.map +1 -1
  177. package/server/applications/files/modules/only-office/only-office.strategy.js +1 -5
  178. package/server/applications/files/modules/only-office/only-office.strategy.js.map +1 -1
  179. package/server/applications/files/schemas/file-content.interface.js +1 -5
  180. package/server/applications/files/schemas/file-content.interface.js.map +1 -1
  181. package/server/applications/files/schemas/file-recent.interface.js +1 -5
  182. package/server/applications/files/schemas/file-recent.interface.js.map +1 -1
  183. package/server/applications/files/schemas/file.interface.js +1 -5
  184. package/server/applications/files/schemas/file.interface.js.map +1 -1
  185. package/server/applications/files/schemas/files-content.schema.js +1 -5
  186. package/server/applications/files/schemas/files-content.schema.js.map +1 -1
  187. package/server/applications/files/schemas/files-recents.schema.js +1 -5
  188. package/server/applications/files/schemas/files-recents.schema.js.map +1 -1
  189. package/server/applications/files/schemas/files.schema.js +1 -5
  190. package/server/applications/files/schemas/files.schema.js.map +1 -1
  191. package/server/applications/files/services/files-content-manager.service.js +45 -16
  192. package/server/applications/files/services/files-content-manager.service.js.map +1 -1
  193. package/server/applications/files/services/files-lock-manager.service.js +53 -18
  194. package/server/applications/files/services/files-lock-manager.service.js.map +1 -1
  195. package/server/applications/files/services/files-lock-manager.service.spec.js +1 -5
  196. package/server/applications/files/services/files-lock-manager.service.spec.js.map +1 -1
  197. package/server/applications/files/services/files-manager.service.js +77 -24
  198. package/server/applications/files/services/files-manager.service.js.map +1 -1
  199. package/server/applications/files/services/files-manager.service.spec.js +1 -5
  200. package/server/applications/files/services/files-manager.service.spec.js.map +1 -1
  201. package/server/applications/files/services/files-methods.service.js +5 -6
  202. package/server/applications/files/services/files-methods.service.js.map +1 -1
  203. package/server/applications/files/services/files-methods.service.spec.js +1 -5
  204. package/server/applications/files/services/files-methods.service.spec.js.map +1 -1
  205. package/server/applications/files/services/files-parser.service.js +13 -8
  206. package/server/applications/files/services/files-parser.service.js.map +1 -1
  207. package/server/applications/files/services/files-parser.service.spec.js +1 -5
  208. package/server/applications/files/services/files-parser.service.spec.js.map +1 -1
  209. package/server/applications/files/services/files-queries.service.js +29 -12
  210. package/server/applications/files/services/files-queries.service.js.map +1 -1
  211. package/server/applications/files/services/files-recents.service.js +1 -5
  212. package/server/applications/files/services/files-recents.service.js.map +1 -1
  213. package/server/applications/files/services/files-recents.service.spec.js +1 -5
  214. package/server/applications/files/services/files-recents.service.spec.js.map +1 -1
  215. package/server/applications/files/services/files-scheduler.service.js +77 -24
  216. package/server/applications/files/services/files-scheduler.service.js.map +1 -1
  217. package/server/applications/files/services/files-search-manager.service.js +9 -7
  218. package/server/applications/files/services/files-search-manager.service.js.map +1 -1
  219. package/server/applications/files/services/files-search-manager.service.spec.js +1 -5
  220. package/server/applications/files/services/files-search-manager.service.spec.js.map +1 -1
  221. package/server/applications/files/services/files-tasks-manager.service.js +77 -24
  222. package/server/applications/files/services/files-tasks-manager.service.js.map +1 -1
  223. package/server/applications/files/services/files-tasks-manager.service.spec.js +1 -5
  224. package/server/applications/files/services/files-tasks-manager.service.spec.js.map +1 -1
  225. package/server/applications/files/utils/doc-textify/adapters/excel.js +1 -5
  226. package/server/applications/files/utils/doc-textify/adapters/excel.js.map +1 -1
  227. package/server/applications/files/utils/doc-textify/adapters/html.js +1 -5
  228. package/server/applications/files/utils/doc-textify/adapters/html.js.map +1 -1
  229. package/server/applications/files/utils/doc-textify/adapters/open-office.js +1 -5
  230. package/server/applications/files/utils/doc-textify/adapters/open-office.js.map +1 -1
  231. package/server/applications/files/utils/doc-textify/adapters/pdf.js +1 -5
  232. package/server/applications/files/utils/doc-textify/adapters/pdf.js.map +1 -1
  233. package/server/applications/files/utils/doc-textify/adapters/power-point.js +1 -5
  234. package/server/applications/files/utils/doc-textify/adapters/power-point.js.map +1 -1
  235. package/server/applications/files/utils/doc-textify/adapters/text.js +1 -5
  236. package/server/applications/files/utils/doc-textify/adapters/text.js.map +1 -1
  237. package/server/applications/files/utils/doc-textify/adapters/word.js +1 -5
  238. package/server/applications/files/utils/doc-textify/adapters/word.js.map +1 -1
  239. package/server/applications/files/utils/doc-textify/doc-textify.js +1 -5
  240. package/server/applications/files/utils/doc-textify/doc-textify.js.map +1 -1
  241. package/server/applications/files/utils/doc-textify/interfaces/doc-textify.interfaces.js +1 -5
  242. package/server/applications/files/utils/doc-textify/interfaces/doc-textify.interfaces.js.map +1 -1
  243. package/server/applications/files/utils/doc-textify/utils/clean.js +1 -5
  244. package/server/applications/files/utils/doc-textify/utils/clean.js.map +1 -1
  245. package/server/applications/files/utils/files-search.js +1 -5
  246. package/server/applications/files/utils/files-search.js.map +1 -1
  247. package/server/applications/files/utils/files-tree.js +1 -5
  248. package/server/applications/files/utils/files-tree.js.map +1 -1
  249. package/server/applications/files/utils/files.js +1 -5
  250. package/server/applications/files/utils/files.js.map +1 -1
  251. package/server/applications/files/utils/send-file.js +1 -5
  252. package/server/applications/files/utils/send-file.js.map +1 -1
  253. package/server/applications/files/utils/unzip-file.js +1 -5
  254. package/server/applications/files/utils/unzip-file.js.map +1 -1
  255. package/server/applications/files/utils/url-file.js +1 -5
  256. package/server/applications/files/utils/url-file.js.map +1 -1
  257. package/server/applications/links/constants/cache.js +1 -5
  258. package/server/applications/links/constants/cache.js.map +1 -1
  259. package/server/applications/links/constants/links.js +1 -5
  260. package/server/applications/links/constants/links.js.map +1 -1
  261. package/server/applications/links/constants/routes.js +1 -5
  262. package/server/applications/links/constants/routes.js.map +1 -1
  263. package/server/applications/links/dto/create-or-update-link.dto.js +1 -5
  264. package/server/applications/links/dto/create-or-update-link.dto.js.map +1 -1
  265. package/server/applications/links/interfaces/link-guest.interface.js +1 -5
  266. package/server/applications/links/interfaces/link-guest.interface.js.map +1 -1
  267. package/server/applications/links/interfaces/link-space.interface.js +1 -5
  268. package/server/applications/links/interfaces/link-space.interface.js.map +1 -1
  269. package/server/applications/links/links.controller.js +1 -5
  270. package/server/applications/links/links.controller.js.map +1 -1
  271. package/server/applications/links/links.controller.spec.js +1 -5
  272. package/server/applications/links/links.controller.spec.js.map +1 -1
  273. package/server/applications/links/schemas/link.interface.js +1 -5
  274. package/server/applications/links/schemas/link.interface.js.map +1 -1
  275. package/server/applications/links/schemas/links.schema.js +1 -5
  276. package/server/applications/links/schemas/links.schema.js.map +1 -1
  277. package/server/applications/links/services/links-manager.service.js +55 -20
  278. package/server/applications/links/services/links-manager.service.js.map +1 -1
  279. package/server/applications/links/services/links-manager.service.spec.js +3 -7
  280. package/server/applications/links/services/links-manager.service.spec.js.map +1 -1
  281. package/server/applications/links/services/links-queries.service.js +1 -5
  282. package/server/applications/links/services/links-queries.service.js.map +1 -1
  283. package/server/applications/notifications/constants/notifications.js +1 -5
  284. package/server/applications/notifications/constants/notifications.js.map +1 -1
  285. package/server/applications/notifications/constants/routes.js +1 -5
  286. package/server/applications/notifications/constants/routes.js.map +1 -1
  287. package/server/applications/notifications/constants/websocket.js +1 -5
  288. package/server/applications/notifications/constants/websocket.js.map +1 -1
  289. package/server/applications/notifications/i18n/de.js +1 -9
  290. package/server/applications/notifications/i18n/de.js.map +1 -1
  291. package/server/applications/notifications/i18n/es.js +1 -5
  292. package/server/applications/notifications/i18n/es.js.map +1 -1
  293. package/server/applications/notifications/i18n/fr.js +1 -5
  294. package/server/applications/notifications/i18n/fr.js.map +1 -1
  295. package/server/applications/notifications/i18n/hi.js +1 -5
  296. package/server/applications/notifications/i18n/hi.js.map +1 -1
  297. package/server/applications/notifications/i18n/index.js +1 -5
  298. package/server/applications/notifications/i18n/index.js.map +1 -1
  299. package/server/applications/notifications/i18n/it.js +1 -5
  300. package/server/applications/notifications/i18n/it.js.map +1 -1
  301. package/server/applications/notifications/i18n/ja.js +1 -5
  302. package/server/applications/notifications/i18n/ja.js.map +1 -1
  303. package/server/applications/notifications/i18n/ko.js +1 -5
  304. package/server/applications/notifications/i18n/ko.js.map +1 -1
  305. package/server/applications/notifications/i18n/pl.js +1 -5
  306. package/server/applications/notifications/i18n/pl.js.map +1 -1
  307. package/server/applications/notifications/i18n/pt.js +1 -5
  308. package/server/applications/notifications/i18n/pt.js.map +1 -1
  309. package/server/applications/notifications/i18n/pt_br.js +1 -5
  310. package/server/applications/notifications/i18n/pt_br.js.map +1 -1
  311. package/server/applications/notifications/i18n/ru.js +1 -5
  312. package/server/applications/notifications/i18n/ru.js.map +1 -1
  313. package/server/applications/notifications/i18n/tr.js +1 -5
  314. package/server/applications/notifications/i18n/tr.js.map +1 -1
  315. package/server/applications/notifications/i18n/zh.js +1 -5
  316. package/server/applications/notifications/i18n/zh.js.map +1 -1
  317. package/server/applications/notifications/interfaces/notification-properties.interface.js +1 -5
  318. package/server/applications/notifications/interfaces/notification-properties.interface.js.map +1 -1
  319. package/server/applications/notifications/interfaces/user-mail-notification.interface.js +1 -5
  320. package/server/applications/notifications/interfaces/user-mail-notification.interface.js.map +1 -1
  321. package/server/applications/notifications/mails/models.js +1 -5
  322. package/server/applications/notifications/mails/models.js.map +1 -1
  323. package/server/applications/notifications/mails/templates.js +1 -5
  324. package/server/applications/notifications/mails/templates.js.map +1 -1
  325. package/server/applications/notifications/mails/urls.js +1 -5
  326. package/server/applications/notifications/mails/urls.js.map +1 -1
  327. package/server/applications/notifications/notifications.controller.js +1 -5
  328. package/server/applications/notifications/notifications.controller.js.map +1 -1
  329. package/server/applications/notifications/notifications.controller.spec.js +1 -5
  330. package/server/applications/notifications/notifications.controller.spec.js.map +1 -1
  331. package/server/applications/notifications/notifications.gateway.js +1 -5
  332. package/server/applications/notifications/notifications.gateway.js.map +1 -1
  333. package/server/applications/notifications/notifications.module.js +1 -5
  334. package/server/applications/notifications/notifications.module.js.map +1 -1
  335. package/server/applications/notifications/schemas/notification.interface.js +1 -5
  336. package/server/applications/notifications/schemas/notification.interface.js.map +1 -1
  337. package/server/applications/notifications/schemas/notifications.schema.js +1 -5
  338. package/server/applications/notifications/schemas/notifications.schema.js.map +1 -1
  339. package/server/applications/notifications/services/notifications-manager.service.js +25 -11
  340. package/server/applications/notifications/services/notifications-manager.service.js.map +1 -1
  341. package/server/applications/notifications/services/notifications-manager.service.spec.js +20 -11
  342. package/server/applications/notifications/services/notifications-manager.service.spec.js.map +1 -1
  343. package/server/applications/notifications/services/notifications-queries.service.js +1 -5
  344. package/server/applications/notifications/services/notifications-queries.service.js.map +1 -1
  345. package/server/applications/shares/constants/routes.js +1 -5
  346. package/server/applications/shares/constants/routes.js.map +1 -1
  347. package/server/applications/shares/constants/shares.js +1 -5
  348. package/server/applications/shares/constants/shares.js.map +1 -1
  349. package/server/applications/shares/dto/create-or-update-share.dto.js +1 -5
  350. package/server/applications/shares/dto/create-or-update-share.dto.js.map +1 -1
  351. package/server/applications/shares/interfaces/share-child.interface.js +1 -5
  352. package/server/applications/shares/interfaces/share-child.interface.js.map +1 -1
  353. package/server/applications/shares/interfaces/share-env.interface.js +1 -5
  354. package/server/applications/shares/interfaces/share-env.interface.js.map +1 -1
  355. package/server/applications/shares/interfaces/share-file.interface.js +1 -5
  356. package/server/applications/shares/interfaces/share-file.interface.js.map +1 -1
  357. package/server/applications/shares/interfaces/share-link.interface.js +1 -5
  358. package/server/applications/shares/interfaces/share-link.interface.js.map +1 -1
  359. package/server/applications/shares/interfaces/share-props.interface.js +1 -5
  360. package/server/applications/shares/interfaces/share-props.interface.js.map +1 -1
  361. package/server/applications/shares/models/share-child.model.js +1 -5
  362. package/server/applications/shares/models/share-child.model.js.map +1 -1
  363. package/server/applications/shares/schemas/share-members.interface.js +1 -5
  364. package/server/applications/shares/schemas/share-members.interface.js.map +1 -1
  365. package/server/applications/shares/schemas/share.interface.js +1 -5
  366. package/server/applications/shares/schemas/share.interface.js.map +1 -1
  367. package/server/applications/shares/schemas/shares-members.schema.js +1 -5
  368. package/server/applications/shares/schemas/shares-members.schema.js.map +1 -1
  369. package/server/applications/shares/schemas/shares.schema.js +1 -5
  370. package/server/applications/shares/schemas/shares.schema.js.map +1 -1
  371. package/server/applications/shares/services/shares-manager.service.js +214 -68
  372. package/server/applications/shares/services/shares-manager.service.js.map +1 -1
  373. package/server/applications/shares/services/shares-manager.service.spec.js +1 -5
  374. package/server/applications/shares/services/shares-manager.service.spec.js.map +1 -1
  375. package/server/applications/shares/services/shares-queries.service.js +49 -17
  376. package/server/applications/shares/services/shares-queries.service.js.map +1 -1
  377. package/server/applications/shares/shares.controller.js +1 -5
  378. package/server/applications/shares/shares.controller.js.map +1 -1
  379. package/server/applications/shares/shares.controller.spec.js +1 -5
  380. package/server/applications/shares/shares.controller.spec.js.map +1 -1
  381. package/server/applications/shares/shares.module.js +1 -5
  382. package/server/applications/shares/shares.module.js.map +1 -1
  383. package/server/applications/spaces/constants/cache.js +1 -5
  384. package/server/applications/spaces/constants/cache.js.map +1 -1
  385. package/server/applications/spaces/constants/routes.js +1 -5
  386. package/server/applications/spaces/constants/routes.js.map +1 -1
  387. package/server/applications/spaces/constants/spaces.js +1 -5
  388. package/server/applications/spaces/constants/spaces.js.map +1 -1
  389. package/server/applications/spaces/decorators/space-override-permission.decorator.js +1 -5
  390. package/server/applications/spaces/decorators/space-override-permission.decorator.js.map +1 -1
  391. package/server/applications/spaces/decorators/space-skip-guard.decorator.js +1 -5
  392. package/server/applications/spaces/decorators/space-skip-guard.decorator.js.map +1 -1
  393. package/server/applications/spaces/decorators/space-skip-permissions.decorator.js +1 -5
  394. package/server/applications/spaces/decorators/space-skip-permissions.decorator.js.map +1 -1
  395. package/server/applications/spaces/decorators/space.decorator.js +1 -5
  396. package/server/applications/spaces/decorators/space.decorator.js.map +1 -1
  397. package/server/applications/spaces/dto/create-or-update-space.dto.js +1 -5
  398. package/server/applications/spaces/dto/create-or-update-space.dto.js.map +1 -1
  399. package/server/applications/spaces/dto/delete-space.dto.js +1 -5
  400. package/server/applications/spaces/dto/delete-space.dto.js.map +1 -1
  401. package/server/applications/spaces/dto/search-space.dto.js +1 -5
  402. package/server/applications/spaces/dto/search-space.dto.js.map +1 -1
  403. package/server/applications/spaces/dto/space-roots.dto.js +1 -5
  404. package/server/applications/spaces/dto/space-roots.dto.js.map +1 -1
  405. package/server/applications/spaces/guards/space.guard.js +17 -9
  406. package/server/applications/spaces/guards/space.guard.js.map +1 -1
  407. package/server/applications/spaces/guards/space.guard.spec.js +1 -5
  408. package/server/applications/spaces/guards/space.guard.spec.js.map +1 -1
  409. package/server/applications/spaces/interfaces/space-diff.interface.js +1 -5
  410. package/server/applications/spaces/interfaces/space-diff.interface.js.map +1 -1
  411. package/server/applications/spaces/interfaces/space-files.interface.js +1 -5
  412. package/server/applications/spaces/interfaces/space-files.interface.js.map +1 -1
  413. package/server/applications/spaces/interfaces/space-request.interface.js +1 -5
  414. package/server/applications/spaces/interfaces/space-request.interface.js.map +1 -1
  415. package/server/applications/spaces/interfaces/space-trash.interface.js +1 -5
  416. package/server/applications/spaces/interfaces/space-trash.interface.js.map +1 -1
  417. package/server/applications/spaces/models/space-env.model.js +1 -5
  418. package/server/applications/spaces/models/space-env.model.js.map +1 -1
  419. package/server/applications/spaces/models/space-props.model.js +1 -5
  420. package/server/applications/spaces/models/space-props.model.js.map +1 -1
  421. package/server/applications/spaces/models/space-root-props.model.js +1 -5
  422. package/server/applications/spaces/models/space-root-props.model.js.map +1 -1
  423. package/server/applications/spaces/models/space.model.js +1 -5
  424. package/server/applications/spaces/models/space.model.js.map +1 -1
  425. package/server/applications/spaces/schemas/space-members.interface.js +1 -5
  426. package/server/applications/spaces/schemas/space-members.interface.js.map +1 -1
  427. package/server/applications/spaces/schemas/space-root.interface.js +1 -5
  428. package/server/applications/spaces/schemas/space-root.interface.js.map +1 -1
  429. package/server/applications/spaces/schemas/space.interface.js +1 -5
  430. package/server/applications/spaces/schemas/space.interface.js.map +1 -1
  431. package/server/applications/spaces/schemas/spaces-members.schema.js +1 -5
  432. package/server/applications/spaces/schemas/spaces-members.schema.js.map +1 -1
  433. package/server/applications/spaces/schemas/spaces-roots.schema.js +1 -5
  434. package/server/applications/spaces/schemas/spaces-roots.schema.js.map +1 -1
  435. package/server/applications/spaces/schemas/spaces.schema.js +1 -5
  436. package/server/applications/spaces/schemas/spaces.schema.js.map +1 -1
  437. package/server/applications/spaces/services/spaces-browser.service.js +77 -24
  438. package/server/applications/spaces/services/spaces-browser.service.js.map +1 -1
  439. package/server/applications/spaces/services/spaces-browser.service.spec.js +1 -5
  440. package/server/applications/spaces/services/spaces-browser.service.spec.js.map +1 -1
  441. package/server/applications/spaces/services/spaces-manager.service.js +193 -53
  442. package/server/applications/spaces/services/spaces-manager.service.js.map +1 -1
  443. package/server/applications/spaces/services/spaces-manager.service.spec.js +1 -5
  444. package/server/applications/spaces/services/spaces-manager.service.spec.js.map +1 -1
  445. package/server/applications/spaces/services/spaces-queries.service.js +65 -21
  446. package/server/applications/spaces/services/spaces-queries.service.js.map +1 -1
  447. package/server/applications/spaces/services/spaces-scheduler.service.js +49 -17
  448. package/server/applications/spaces/services/spaces-scheduler.service.js.map +1 -1
  449. package/server/applications/spaces/spaces.controller.js +1 -5
  450. package/server/applications/spaces/spaces.controller.js.map +1 -1
  451. package/server/applications/spaces/spaces.controller.spec.js +1 -5
  452. package/server/applications/spaces/spaces.controller.spec.js.map +1 -1
  453. package/server/applications/spaces/spaces.module.js +1 -5
  454. package/server/applications/spaces/spaces.module.js.map +1 -1
  455. package/server/applications/spaces/utils/paths.js +1 -5
  456. package/server/applications/spaces/utils/paths.js.map +1 -1
  457. package/server/applications/spaces/utils/permissions.js +1 -5
  458. package/server/applications/spaces/utils/permissions.js.map +1 -1
  459. package/server/applications/spaces/utils/routes.js +1 -5
  460. package/server/applications/spaces/utils/routes.js.map +1 -1
  461. package/server/applications/sync/constants/auth.js +1 -5
  462. package/server/applications/sync/constants/auth.js.map +1 -1
  463. package/server/applications/sync/constants/routes.js +6 -5
  464. package/server/applications/sync/constants/routes.js.map +1 -1
  465. package/server/applications/sync/constants/store.js +1 -9
  466. package/server/applications/sync/constants/store.js.map +1 -1
  467. package/server/applications/sync/constants/sync.js +2 -6
  468. package/server/applications/sync/constants/sync.js.map +1 -1
  469. package/server/applications/sync/decorators/sync-context.decorator.js +1 -5
  470. package/server/applications/sync/decorators/sync-context.decorator.js.map +1 -1
  471. package/server/applications/sync/decorators/sync-environment.decorator.js +1 -5
  472. package/server/applications/sync/decorators/sync-environment.decorator.js.map +1 -1
  473. package/server/applications/sync/dtos/sync-client-auth.dto.js +12 -8
  474. package/server/applications/sync/dtos/sync-client-auth.dto.js.map +1 -1
  475. package/server/applications/sync/dtos/sync-client-info.dto.js +49 -0
  476. package/server/applications/sync/dtos/sync-client-info.dto.js.map +1 -0
  477. package/server/applications/sync/dtos/sync-client-registration.dto.js +34 -11
  478. package/server/applications/sync/dtos/sync-client-registration.dto.js.map +1 -1
  479. package/server/applications/sync/dtos/sync-operations.dto.js +1 -5
  480. package/server/applications/sync/dtos/sync-operations.dto.js.map +1 -1
  481. package/server/applications/sync/dtos/sync-path.dto.js +1 -5
  482. package/server/applications/sync/dtos/sync-path.dto.js.map +1 -1
  483. package/server/applications/sync/dtos/sync-upload.dto.js +1 -5
  484. package/server/applications/sync/dtos/sync-upload.dto.js.map +1 -1
  485. package/server/applications/sync/interceptors/sync-diff-gzip-body.interceptor.js +1 -5
  486. package/server/applications/sync/interceptors/sync-diff-gzip-body.interceptor.js.map +1 -1
  487. package/server/applications/sync/interceptors/sync-diff-gzip-body.interceptor.spec.js +1 -5
  488. package/server/applications/sync/interceptors/sync-diff-gzip-body.interceptor.spec.js.map +1 -1
  489. package/server/applications/sync/interfaces/store-manifest.interface.js +1 -5
  490. package/server/applications/sync/interfaces/store-manifest.interface.js.map +1 -1
  491. package/server/applications/sync/interfaces/sync-client-auth.interface.js +1 -25
  492. package/server/applications/sync/interfaces/sync-client-auth.interface.js.map +1 -1
  493. package/server/applications/sync/interfaces/sync-client-paths.interface.js +1 -5
  494. package/server/applications/sync/interfaces/sync-client-paths.interface.js.map +1 -1
  495. package/server/applications/sync/interfaces/sync-client.interface.js +1 -5
  496. package/server/applications/sync/interfaces/sync-client.interface.js.map +1 -1
  497. package/server/applications/sync/interfaces/sync-diff.interface.js +1 -5
  498. package/server/applications/sync/interfaces/sync-diff.interface.js.map +1 -1
  499. package/server/applications/sync/interfaces/sync-path.interface.js +1 -5
  500. package/server/applications/sync/interfaces/sync-path.interface.js.map +1 -1
  501. package/server/applications/sync/schemas/sync-client.interface.js +1 -5
  502. package/server/applications/sync/schemas/sync-client.interface.js.map +1 -1
  503. package/server/applications/sync/schemas/sync-clients.schema.js +1 -5
  504. package/server/applications/sync/schemas/sync-clients.schema.js.map +1 -1
  505. package/server/applications/sync/schemas/sync-path.interface.js +1 -5
  506. package/server/applications/sync/schemas/sync-path.interface.js.map +1 -1
  507. package/server/applications/sync/schemas/sync-paths.schema.js +1 -5
  508. package/server/applications/sync/schemas/sync-paths.schema.js.map +1 -1
  509. package/server/applications/sync/services/sync-clients-manager.service.js +108 -44
  510. package/server/applications/sync/services/sync-clients-manager.service.js.map +1 -1
  511. package/server/applications/sync/services/sync-clients-manager.service.spec.js +14 -17
  512. package/server/applications/sync/services/sync-clients-manager.service.spec.js.map +1 -1
  513. package/server/applications/sync/services/sync-manager.service.js +29 -12
  514. package/server/applications/sync/services/sync-manager.service.js.map +1 -1
  515. package/server/applications/sync/services/sync-manager.service.spec.js +1 -5
  516. package/server/applications/sync/services/sync-manager.service.spec.js.map +1 -1
  517. package/server/applications/sync/services/sync-paths-manager.service.js +27 -17
  518. package/server/applications/sync/services/sync-paths-manager.service.js.map +1 -1
  519. package/server/applications/sync/services/sync-paths-manager.service.spec.js +11 -15
  520. package/server/applications/sync/services/sync-paths-manager.service.spec.js.map +1 -1
  521. package/server/applications/sync/services/sync-queries.service.js +1 -5
  522. package/server/applications/sync/services/sync-queries.service.js.map +1 -1
  523. package/server/applications/sync/sync.config.js +1 -5
  524. package/server/applications/sync/sync.config.js.map +1 -1
  525. package/server/applications/sync/sync.controller.js +21 -6
  526. package/server/applications/sync/sync.controller.js.map +1 -1
  527. package/server/applications/sync/sync.controller.spec.js +1 -5
  528. package/server/applications/sync/sync.controller.spec.js.map +1 -1
  529. package/server/applications/sync/sync.module.js +1 -5
  530. package/server/applications/sync/sync.module.js.map +1 -1
  531. package/server/applications/sync/utils/functions.js +1 -5
  532. package/server/applications/sync/utils/functions.js.map +1 -1
  533. package/server/applications/sync/utils/normalizedMap.js +1 -5
  534. package/server/applications/sync/utils/normalizedMap.js.map +1 -1
  535. package/server/applications/sync/utils/routes.js +1 -5
  536. package/server/applications/sync/utils/routes.js.map +1 -1
  537. package/server/applications/users/admin-users.controller.js +2 -6
  538. package/server/applications/users/admin-users.controller.js.map +1 -1
  539. package/server/applications/users/admin-users.controller.spec.js +6 -10
  540. package/server/applications/users/admin-users.controller.spec.js.map +1 -1
  541. package/server/applications/users/constants/group.js +1 -5
  542. package/server/applications/users/constants/group.js.map +1 -1
  543. package/server/applications/users/constants/member.js +1 -5
  544. package/server/applications/users/constants/member.js.map +1 -1
  545. package/server/applications/users/constants/routes.js +1 -5
  546. package/server/applications/users/constants/routes.js.map +1 -1
  547. package/server/applications/users/constants/user.js +1 -5
  548. package/server/applications/users/constants/user.js.map +1 -1
  549. package/server/applications/users/constants/websocket.js +1 -5
  550. package/server/applications/users/constants/websocket.js.map +1 -1
  551. package/server/applications/users/decorators/permissions.decorator.js +1 -5
  552. package/server/applications/users/decorators/permissions.decorator.js.map +1 -1
  553. package/server/applications/users/decorators/roles.decorator.js +1 -5
  554. package/server/applications/users/decorators/roles.decorator.js.map +1 -1
  555. package/server/applications/users/decorators/user.decorator.js +1 -5
  556. package/server/applications/users/decorators/user.decorator.js.map +1 -1
  557. package/server/applications/users/dto/create-or-update-group.dto.js +1 -5
  558. package/server/applications/users/dto/create-or-update-group.dto.js.map +1 -1
  559. package/server/applications/users/dto/create-or-update-user.dto.js +1 -5
  560. package/server/applications/users/dto/create-or-update-user.dto.js.map +1 -1
  561. package/server/applications/users/dto/delete-user.dto.js +1 -5
  562. package/server/applications/users/dto/delete-user.dto.js.map +1 -1
  563. package/server/applications/users/dto/search-members.dto.js +1 -5
  564. package/server/applications/users/dto/search-members.dto.js.map +1 -1
  565. package/server/applications/users/dto/user-properties.dto.js +1 -5
  566. package/server/applications/users/dto/user-properties.dto.js.map +1 -1
  567. package/server/applications/users/guards/permissions.guard.js +1 -5
  568. package/server/applications/users/guards/permissions.guard.js.map +1 -1
  569. package/server/applications/users/guards/permissions.guard.spec.js +1 -5
  570. package/server/applications/users/guards/permissions.guard.spec.js.map +1 -1
  571. package/server/applications/users/guards/roles.guard.js +1 -5
  572. package/server/applications/users/guards/roles.guard.js.map +1 -1
  573. package/server/applications/users/guards/roles.guard.spec.js +1 -5
  574. package/server/applications/users/guards/roles.guard.spec.js.map +1 -1
  575. package/server/applications/users/interfaces/admin-group.interface.js +1 -5
  576. package/server/applications/users/interfaces/admin-group.interface.js.map +1 -1
  577. package/server/applications/users/interfaces/admin-user.interface.js +1 -5
  578. package/server/applications/users/interfaces/admin-user.interface.js.map +1 -1
  579. package/server/applications/users/interfaces/group-browse.interface.js +1 -5
  580. package/server/applications/users/interfaces/group-browse.interface.js.map +1 -1
  581. package/server/applications/users/interfaces/group-member.js +1 -5
  582. package/server/applications/users/interfaces/group-member.js.map +1 -1
  583. package/server/applications/users/interfaces/guest-user.interface.js +1 -5
  584. package/server/applications/users/interfaces/guest-user.interface.js.map +1 -1
  585. package/server/applications/users/interfaces/member.interface.js +1 -5
  586. package/server/applications/users/interfaces/member.interface.js.map +1 -1
  587. package/server/applications/users/interfaces/owner.interface.js +1 -5
  588. package/server/applications/users/interfaces/owner.interface.js.map +1 -1
  589. package/server/applications/users/interfaces/user-secrets.interface.js +1 -5
  590. package/server/applications/users/interfaces/user-secrets.interface.js.map +1 -1
  591. package/server/applications/users/interfaces/websocket.interface.js +1 -5
  592. package/server/applications/users/interfaces/websocket.interface.js.map +1 -1
  593. package/server/applications/users/models/user.model.js +1 -5
  594. package/server/applications/users/models/user.model.js.map +1 -1
  595. package/server/applications/users/schemas/group.interface.js +1 -5
  596. package/server/applications/users/schemas/group.interface.js.map +1 -1
  597. package/server/applications/users/schemas/groups.schema.js +1 -5
  598. package/server/applications/users/schemas/groups.schema.js.map +1 -1
  599. package/server/applications/users/schemas/user-group.interface.js +1 -5
  600. package/server/applications/users/schemas/user-group.interface.js.map +1 -1
  601. package/server/applications/users/schemas/user.interface.js +1 -5
  602. package/server/applications/users/schemas/user.interface.js.map +1 -1
  603. package/server/applications/users/schemas/users-groups.schema.js +1 -5
  604. package/server/applications/users/schemas/users-groups.schema.js.map +1 -1
  605. package/server/applications/users/schemas/users-guests.schema.js +1 -5
  606. package/server/applications/users/schemas/users-guests.schema.js.map +1 -1
  607. package/server/applications/users/schemas/users.schema.js +1 -5
  608. package/server/applications/users/schemas/users.schema.js.map +1 -1
  609. package/server/applications/users/services/admin-users-manager.service.js +67 -23
  610. package/server/applications/users/services/admin-users-manager.service.js.map +1 -1
  611. package/server/applications/users/services/admin-users-manager.service.spec.js +3 -7
  612. package/server/applications/users/services/admin-users-manager.service.spec.js.map +1 -1
  613. package/server/applications/users/services/admin-users-queries.service.js +65 -21
  614. package/server/applications/users/services/admin-users-queries.service.js.map +1 -1
  615. package/server/applications/users/services/users-manager.service.js +81 -25
  616. package/server/applications/users/services/users-manager.service.js.map +1 -1
  617. package/server/applications/users/services/users-manager.service.spec.js +14 -12
  618. package/server/applications/users/services/users-manager.service.spec.js.map +1 -1
  619. package/server/applications/users/services/users-queries.service.js +49 -17
  620. package/server/applications/users/services/users-queries.service.js.map +1 -1
  621. package/server/applications/users/users.controller.js +2 -6
  622. package/server/applications/users/users.controller.js.map +1 -1
  623. package/server/applications/users/users.controller.spec.js +5 -9
  624. package/server/applications/users/users.controller.spec.js.map +1 -1
  625. package/server/applications/users/users.e2e-spec.js +3 -7
  626. package/server/applications/users/users.e2e-spec.js.map +1 -1
  627. package/server/applications/users/users.gateway.js +29 -12
  628. package/server/applications/users/users.gateway.js.map +1 -1
  629. package/server/applications/users/users.gateway.spec.js +1 -5
  630. package/server/applications/users/users.gateway.spec.js.map +1 -1
  631. package/server/applications/users/users.module.js +1 -5
  632. package/server/applications/users/users.module.js.map +1 -1
  633. package/server/applications/users/utils/avatar.js +1 -5
  634. package/server/applications/users/utils/avatar.js.map +1 -1
  635. package/server/applications/users/utils/test.js +1 -5
  636. package/server/applications/users/utils/test.js.map +1 -1
  637. package/server/applications/webdav/constants/routes.js +1 -5
  638. package/server/applications/webdav/constants/routes.js.map +1 -1
  639. package/server/applications/webdav/constants/webdav.js +1 -5
  640. package/server/applications/webdav/constants/webdav.js.map +1 -1
  641. package/server/applications/webdav/decorators/if-header.decorator.js +1 -5
  642. package/server/applications/webdav/decorators/if-header.decorator.js.map +1 -1
  643. package/server/applications/webdav/decorators/webdav-context.decorator.js +1 -5
  644. package/server/applications/webdav/decorators/webdav-context.decorator.js.map +1 -1
  645. package/server/applications/webdav/filters/webdav.filter.js +1 -5
  646. package/server/applications/webdav/filters/webdav.filter.js.map +1 -1
  647. package/server/applications/webdav/filters/webdav.filter.spec.js +1 -5
  648. package/server/applications/webdav/filters/webdav.filter.spec.js.map +1 -1
  649. package/server/applications/webdav/guards/webdav-protocol.guard.js +54 -20
  650. package/server/applications/webdav/guards/webdav-protocol.guard.js.map +1 -1
  651. package/server/applications/webdav/guards/webdav-protocol.guard.spec.js +54 -0
  652. package/server/applications/webdav/guards/webdav-protocol.guard.spec.js.map +1 -1
  653. package/server/applications/webdav/interfaces/if-header.interface.js +1 -5
  654. package/server/applications/webdav/interfaces/if-header.interface.js.map +1 -1
  655. package/server/applications/webdav/interfaces/webdav.interface.js +1 -5
  656. package/server/applications/webdav/interfaces/webdav.interface.js.map +1 -1
  657. package/server/applications/webdav/models/webdav-file.model.js +1 -5
  658. package/server/applications/webdav/models/webdav-file.model.js.map +1 -1
  659. package/server/applications/webdav/services/webdav-methods.service.js +74 -26
  660. package/server/applications/webdav/services/webdav-methods.service.js.map +1 -1
  661. package/server/applications/webdav/services/webdav-methods.service.spec.js +15 -18
  662. package/server/applications/webdav/services/webdav-methods.service.spec.js.map +1 -1
  663. package/server/applications/webdav/services/webdav-spaces.service.js +17 -9
  664. package/server/applications/webdav/services/webdav-spaces.service.js.map +1 -1
  665. package/server/applications/webdav/services/webdav-spaces.service.spec.js +1 -5
  666. package/server/applications/webdav/services/webdav-spaces.service.spec.js.map +1 -1
  667. package/server/applications/webdav/utils/bootstrap.js +1 -5
  668. package/server/applications/webdav/utils/bootstrap.js.map +1 -1
  669. package/server/applications/webdav/utils/if-header.js +1 -5
  670. package/server/applications/webdav/utils/if-header.js.map +1 -1
  671. package/server/applications/webdav/utils/routes.js +1 -5
  672. package/server/applications/webdav/utils/routes.js.map +1 -1
  673. package/server/applications/webdav/utils/webdav.js +1 -5
  674. package/server/applications/webdav/utils/webdav.js.map +1 -1
  675. package/server/applications/webdav/utils/xml.js +1 -5
  676. package/server/applications/webdav/utils/xml.js.map +1 -1
  677. package/server/applications/webdav/webdav.controller.js +1 -5
  678. package/server/applications/webdav/webdav.controller.js.map +1 -1
  679. package/server/applications/webdav/webdav.controller.spec.js +1 -5
  680. package/server/applications/webdav/webdav.controller.spec.js.map +1 -1
  681. package/server/applications/webdav/webdav.e2e-spec.js +1 -5
  682. package/server/applications/webdav/webdav.e2e-spec.js.map +1 -1
  683. package/server/applications/webdav/webdav.module.js +1 -5
  684. package/server/applications/webdav/webdav.module.js.map +1 -1
  685. package/server/authentication/auth.config.js +23 -123
  686. package/server/authentication/auth.config.js.map +1 -1
  687. package/server/authentication/auth.controller.js +27 -21
  688. package/server/authentication/auth.controller.js.map +1 -1
  689. package/server/authentication/auth.controller.spec.js +6 -10
  690. package/server/authentication/auth.controller.spec.js.map +1 -1
  691. package/server/authentication/auth.e2e-spec.js +1 -5
  692. package/server/authentication/auth.e2e-spec.js.map +1 -1
  693. package/server/authentication/auth.module.js +17 -20
  694. package/server/authentication/auth.module.js.map +1 -1
  695. package/server/authentication/{services/auth-manager.service.js → auth.service.js} +41 -18
  696. package/server/authentication/auth.service.js.map +1 -0
  697. package/server/authentication/{services/auth-manager.service.spec.js → auth.service.spec.js} +6 -10
  698. package/server/authentication/auth.service.spec.js.map +1 -0
  699. package/server/authentication/constants/auth.js +1 -5
  700. package/server/authentication/constants/auth.js.map +1 -1
  701. package/server/authentication/constants/routes.js +41 -30
  702. package/server/authentication/constants/routes.js.map +1 -1
  703. package/server/authentication/constants/scope.js +2 -5
  704. package/server/authentication/constants/scope.js.map +1 -1
  705. package/server/authentication/decorators/auth-token-optional.decorator.js +1 -5
  706. package/server/authentication/decorators/auth-token-optional.decorator.js.map +1 -1
  707. package/server/authentication/decorators/auth-token-skip.decorator.js +1 -5
  708. package/server/authentication/decorators/auth-token-skip.decorator.js.map +1 -1
  709. package/server/authentication/dto/login-response.dto.js +1 -10
  710. package/server/authentication/dto/login-response.dto.js.map +1 -1
  711. package/server/authentication/dto/token-response.dto.js +1 -5
  712. package/server/authentication/dto/token-response.dto.js.map +1 -1
  713. package/server/authentication/guards/auth-anonymous.guard.js +1 -5
  714. package/server/authentication/guards/auth-anonymous.guard.js.map +1 -1
  715. package/server/authentication/guards/auth-anonymous.guard.spec.js +1 -5
  716. package/server/authentication/guards/auth-anonymous.guard.spec.js.map +1 -1
  717. package/server/authentication/guards/auth-anonymous.strategy.js +1 -5
  718. package/server/authentication/guards/auth-anonymous.strategy.js.map +1 -1
  719. package/server/authentication/guards/auth-basic.guard.js +1 -5
  720. package/server/authentication/guards/auth-basic.guard.js.map +1 -1
  721. package/server/authentication/guards/auth-basic.guard.spec.js +13 -14
  722. package/server/authentication/guards/auth-basic.guard.spec.js.map +1 -1
  723. package/server/authentication/guards/auth-basic.strategy.js +10 -11
  724. package/server/authentication/guards/auth-basic.strategy.js.map +1 -1
  725. package/server/authentication/guards/auth-digest.guard.js +1 -5
  726. package/server/authentication/guards/auth-digest.guard.js.map +1 -1
  727. package/server/authentication/guards/auth-digest.strategy.js +1 -5
  728. package/server/authentication/guards/auth-digest.strategy.js.map +1 -1
  729. package/server/authentication/guards/auth-local.guard.js +1 -5
  730. package/server/authentication/guards/auth-local.guard.js.map +1 -1
  731. package/server/authentication/guards/auth-local.guard.spec.js +9 -13
  732. package/server/authentication/guards/auth-local.guard.spec.js.map +1 -1
  733. package/server/authentication/guards/auth-local.strategy.js +6 -10
  734. package/server/authentication/guards/auth-local.strategy.js.map +1 -1
  735. package/server/authentication/guards/auth-token-access.guard.js +1 -5
  736. package/server/authentication/guards/auth-token-access.guard.js.map +1 -1
  737. package/server/authentication/guards/auth-token-access.guard.spec.js +3 -7
  738. package/server/authentication/guards/auth-token-access.guard.spec.js.map +1 -1
  739. package/server/authentication/guards/auth-token-access.strategy.js +3 -7
  740. package/server/authentication/guards/auth-token-access.strategy.js.map +1 -1
  741. package/server/authentication/guards/auth-token-refresh.guard.js +1 -5
  742. package/server/authentication/guards/auth-token-refresh.guard.js.map +1 -1
  743. package/server/authentication/guards/auth-token-refresh.guard.spec.js +3 -7
  744. package/server/authentication/guards/auth-token-refresh.guard.spec.js.map +1 -1
  745. package/server/authentication/guards/auth-token-refresh.strategy.js +3 -7
  746. package/server/authentication/guards/auth-token-refresh.strategy.js.map +1 -1
  747. package/server/authentication/guards/implementations/http-basic.strategy.js +1 -5
  748. package/server/authentication/guards/implementations/http-basic.strategy.js.map +1 -1
  749. package/server/authentication/guards/implementations/http-digest.strategy.js +1 -5
  750. package/server/authentication/guards/implementations/http-digest.strategy.js.map +1 -1
  751. package/server/authentication/interfaces/auth-request.interface.js +1 -5
  752. package/server/authentication/interfaces/auth-request.interface.js.map +1 -1
  753. package/server/authentication/interfaces/jwt-payload.interface.js +1 -5
  754. package/server/authentication/interfaces/jwt-payload.interface.js.map +1 -1
  755. package/server/authentication/interfaces/token.interface.js +1 -5
  756. package/server/authentication/interfaces/token.interface.js.map +1 -1
  757. package/server/authentication/providers/auth-providers.constants.js +18 -0
  758. package/server/authentication/providers/auth-providers.constants.js.map +1 -0
  759. package/server/authentication/providers/auth-providers.models.js +14 -0
  760. package/server/authentication/providers/auth-providers.models.js.map +1 -0
  761. package/server/authentication/providers/auth-providers.utils.js +42 -0
  762. package/server/authentication/providers/auth-providers.utils.js.map +1 -0
  763. package/server/authentication/providers/ldap/auth-ldap.config.js +143 -0
  764. package/server/authentication/providers/ldap/auth-ldap.config.js.map +1 -0
  765. package/server/authentication/{constants/auth-ldap.js → providers/ldap/auth-ldap.constants.js} +12 -6
  766. package/server/authentication/providers/ldap/auth-ldap.constants.js.map +1 -0
  767. package/server/authentication/providers/ldap/auth-provider-ldap.service.js +506 -0
  768. package/server/authentication/providers/ldap/auth-provider-ldap.service.js.map +1 -0
  769. package/server/authentication/providers/ldap/auth-provider-ldap.service.spec.js +674 -0
  770. package/server/authentication/providers/ldap/auth-provider-ldap.service.spec.js.map +1 -0
  771. package/server/authentication/{services/auth-methods/auth-method-database.service.js → providers/mysql/auth-provider-mysql.service.js} +16 -14
  772. package/server/authentication/providers/mysql/auth-provider-mysql.service.js.map +1 -0
  773. package/server/authentication/{services/auth-methods/auth-method-database.service.spec.js → providers/mysql/auth-provider-mysql.service.spec.js} +15 -19
  774. package/server/authentication/providers/mysql/auth-provider-mysql.service.spec.js.map +1 -0
  775. package/server/authentication/providers/oidc/auth-oidc-desktop.constants.js +30 -0
  776. package/server/authentication/providers/oidc/auth-oidc-desktop.constants.js.map +1 -0
  777. package/server/authentication/providers/oidc/auth-oidc.config.js +149 -0
  778. package/server/authentication/providers/oidc/auth-oidc.config.js.map +1 -0
  779. package/server/authentication/providers/oidc/auth-oidc.constants.js +39 -0
  780. package/server/authentication/providers/oidc/auth-oidc.constants.js.map +1 -0
  781. package/server/authentication/providers/oidc/auth-oidc.controller.js +83 -0
  782. package/server/authentication/providers/oidc/auth-oidc.controller.js.map +1 -0
  783. package/server/authentication/providers/oidc/auth-oidc.interfaces.js +6 -0
  784. package/server/authentication/providers/oidc/auth-oidc.interfaces.js.map +1 -0
  785. package/server/authentication/providers/oidc/auth-provider-oidc.module.js +36 -0
  786. package/server/authentication/providers/oidc/auth-provider-oidc.module.js.map +1 -0
  787. package/server/authentication/providers/oidc/auth-provider-oidc.service.js +373 -0
  788. package/server/authentication/providers/oidc/auth-provider-oidc.service.js.map +1 -0
  789. package/server/authentication/providers/oidc/auth-provider-oidc.service.spec.js +270 -0
  790. package/server/authentication/providers/oidc/auth-provider-oidc.service.spec.js.map +1 -0
  791. package/server/authentication/{services/auth-methods/auth-method-two-fa.service.js → providers/two-fa/auth-provider-two-fa.service.js} +56 -38
  792. package/server/authentication/providers/two-fa/auth-provider-two-fa.service.js.map +1 -0
  793. package/server/authentication/{services/auth-methods/auth-method-two-fa.service.spec.js → providers/two-fa/auth-provider-two-fa.service.spec.js} +6 -10
  794. package/server/authentication/providers/two-fa/auth-provider-two-fa.service.spec.js.map +1 -0
  795. package/server/authentication/{guards → providers/two-fa}/auth-two-fa-guard.js +10 -14
  796. package/server/authentication/providers/two-fa/auth-two-fa-guard.js.map +1 -0
  797. package/server/authentication/providers/two-fa/auth-two-fa.config.js +57 -0
  798. package/server/authentication/providers/two-fa/auth-two-fa.config.js.map +1 -0
  799. package/server/authentication/{dto/two-fa-verify.dto.js → providers/two-fa/auth-two-fa.dtos.js} +8 -6
  800. package/server/authentication/providers/two-fa/auth-two-fa.dtos.js.map +1 -0
  801. package/server/authentication/providers/two-fa/auth-two-fa.interfaces.js +6 -0
  802. package/server/authentication/providers/two-fa/auth-two-fa.interfaces.js.map +1 -0
  803. package/server/authentication/utils/crypt-secret.js +1 -5
  804. package/server/authentication/utils/crypt-secret.js.map +1 -1
  805. package/server/common/constants.js +1 -5
  806. package/server/common/constants.js.map +1 -1
  807. package/server/common/decorators.js +1 -5
  808. package/server/common/decorators.js.map +1 -1
  809. package/server/common/functions.js +25 -9
  810. package/server/common/functions.js.map +1 -1
  811. package/server/common/i18n.js +1 -5
  812. package/server/common/i18n.js.map +1 -1
  813. package/server/common/image.js +1 -5
  814. package/server/common/image.js.map +1 -1
  815. package/server/common/interfaces.js +1 -5
  816. package/server/common/interfaces.js.map +1 -1
  817. package/server/common/qrcode.js +1 -5
  818. package/server/common/qrcode.js.map +1 -1
  819. package/server/common/shared.js +6 -6
  820. package/server/common/shared.js.map +1 -1
  821. package/server/configuration/config.constants.js +1 -5
  822. package/server/configuration/config.constants.js.map +1 -1
  823. package/server/configuration/config.environment.js +2 -6
  824. package/server/configuration/config.environment.js.map +1 -1
  825. package/server/configuration/config.interfaces.js +1 -5
  826. package/server/configuration/config.interfaces.js.map +1 -1
  827. package/server/configuration/config.loader.js +1 -5
  828. package/server/configuration/config.loader.js.map +1 -1
  829. package/server/configuration/config.logger.js +4 -8
  830. package/server/configuration/config.logger.js.map +1 -1
  831. package/server/configuration/config.validation.js +7 -5
  832. package/server/configuration/config.validation.js.map +1 -1
  833. package/server/infrastructure/cache/adapters/mysql-cache.adapter.js +9 -7
  834. package/server/infrastructure/cache/adapters/mysql-cache.adapter.js.map +1 -1
  835. package/server/infrastructure/cache/adapters/redis-cache.adapter.js +1 -5
  836. package/server/infrastructure/cache/adapters/redis-cache.adapter.js.map +1 -1
  837. package/server/infrastructure/cache/cache.config.js +1 -5
  838. package/server/infrastructure/cache/cache.config.js.map +1 -1
  839. package/server/infrastructure/cache/cache.decorator.js +9 -7
  840. package/server/infrastructure/cache/cache.decorator.js.map +1 -1
  841. package/server/infrastructure/cache/cache.e2e-spec.js +1 -5
  842. package/server/infrastructure/cache/cache.e2e-spec.js.map +1 -1
  843. package/server/infrastructure/cache/cache.module.js +1 -5
  844. package/server/infrastructure/cache/cache.module.js.map +1 -1
  845. package/server/infrastructure/cache/schemas/mysql-cache.interface.js +1 -5
  846. package/server/infrastructure/cache/schemas/mysql-cache.interface.js.map +1 -1
  847. package/server/infrastructure/cache/schemas/mysql-cache.schema.js +1 -5
  848. package/server/infrastructure/cache/schemas/mysql-cache.schema.js.map +1 -1
  849. package/server/infrastructure/cache/services/cache.service.js +1 -5
  850. package/server/infrastructure/cache/services/cache.service.js.map +1 -1
  851. package/server/infrastructure/context/context.module.js +1 -5
  852. package/server/infrastructure/context/context.module.js.map +1 -1
  853. package/server/infrastructure/context/interceptors/context.interceptor.js +1 -5
  854. package/server/infrastructure/context/interceptors/context.interceptor.js.map +1 -1
  855. package/server/infrastructure/context/interceptors/context.interceptor.spec.js +2 -6
  856. package/server/infrastructure/context/interceptors/context.interceptor.spec.js.map +1 -1
  857. package/server/infrastructure/context/interfaces/context-store.interface.js +1 -5
  858. package/server/infrastructure/context/interfaces/context-store.interface.js.map +1 -1
  859. package/server/infrastructure/context/services/context-manager.service.js +1 -5
  860. package/server/infrastructure/context/services/context-manager.service.js.map +1 -1
  861. package/server/infrastructure/context/services/context-manager.service.spec.js +1 -5
  862. package/server/infrastructure/context/services/context-manager.service.spec.js.map +1 -1
  863. package/server/infrastructure/database/columns.js +1 -5
  864. package/server/infrastructure/database/columns.js.map +1 -1
  865. package/server/infrastructure/database/configuration.js +1 -5
  866. package/server/infrastructure/database/configuration.js.map +1 -1
  867. package/server/infrastructure/database/constants.js +2 -6
  868. package/server/infrastructure/database/constants.js.map +1 -1
  869. package/server/infrastructure/database/database.config.js +1 -5
  870. package/server/infrastructure/database/database.config.js.map +1 -1
  871. package/server/infrastructure/database/database.logger.js +1 -5
  872. package/server/infrastructure/database/database.logger.js.map +1 -1
  873. package/server/infrastructure/database/database.module.js +1 -5
  874. package/server/infrastructure/database/database.module.js.map +1 -1
  875. package/server/infrastructure/database/interfaces/database.interface.js +1 -5
  876. package/server/infrastructure/database/interfaces/database.interface.js.map +1 -1
  877. package/server/infrastructure/database/schema.js +1 -5
  878. package/server/infrastructure/database/schema.js.map +1 -1
  879. package/server/infrastructure/database/scripts/create-user.js +1 -5
  880. package/server/infrastructure/database/scripts/create-user.js.map +1 -1
  881. package/server/infrastructure/database/scripts/db.js +1 -5
  882. package/server/infrastructure/database/scripts/db.js.map +1 -1
  883. package/server/infrastructure/database/scripts/seed/main.js +1 -5
  884. package/server/infrastructure/database/scripts/seed/main.js.map +1 -1
  885. package/server/infrastructure/database/scripts/seed/usersgroups.js +1 -5
  886. package/server/infrastructure/database/scripts/seed/usersgroups.js.map +1 -1
  887. package/server/infrastructure/database/utils.js +1 -5
  888. package/server/infrastructure/database/utils.js.map +1 -1
  889. package/server/infrastructure/mailer/interfaces/mail.interface.js +1 -5
  890. package/server/infrastructure/mailer/interfaces/mail.interface.js.map +1 -1
  891. package/server/infrastructure/mailer/mailer.config.js +1 -5
  892. package/server/infrastructure/mailer/mailer.config.js.map +1 -1
  893. package/server/infrastructure/mailer/mailer.module.js +1 -5
  894. package/server/infrastructure/mailer/mailer.module.js.map +1 -1
  895. package/server/infrastructure/mailer/mailer.service.js +1 -5
  896. package/server/infrastructure/mailer/mailer.service.js.map +1 -1
  897. package/server/infrastructure/mailer/mailer.service.spec.js +2 -6
  898. package/server/infrastructure/mailer/mailer.service.spec.js.map +1 -1
  899. package/server/infrastructure/scheduler/scheduler.constants.js +1 -5
  900. package/server/infrastructure/scheduler/scheduler.constants.js.map +1 -1
  901. package/server/infrastructure/scheduler/scheduler.module.js +1 -5
  902. package/server/infrastructure/scheduler/scheduler.module.js.map +1 -1
  903. package/server/infrastructure/websocket/adapters/cluster.adapter.js +1 -5
  904. package/server/infrastructure/websocket/adapters/cluster.adapter.js.map +1 -1
  905. package/server/infrastructure/websocket/adapters/redis.adapter.js +1 -5
  906. package/server/infrastructure/websocket/adapters/redis.adapter.js.map +1 -1
  907. package/server/infrastructure/websocket/adapters/web-socket.adapter.js +1 -5
  908. package/server/infrastructure/websocket/adapters/web-socket.adapter.js.map +1 -1
  909. package/server/infrastructure/websocket/decorators/web-socket-user.decorator.js +1 -5
  910. package/server/infrastructure/websocket/decorators/web-socket-user.decorator.js.map +1 -1
  911. package/server/infrastructure/websocket/interfaces/auth-socket-io.interface.js +1 -5
  912. package/server/infrastructure/websocket/interfaces/auth-socket-io.interface.js.map +1 -1
  913. package/server/infrastructure/websocket/utils.js +1 -5
  914. package/server/infrastructure/websocket/utils.js.map +1 -1
  915. package/server/infrastructure/websocket/web-socket.config.js +1 -5
  916. package/server/infrastructure/websocket/web-socket.config.js.map +1 -1
  917. package/server/main.js +5 -0
  918. package/server/main.js.map +1 -1
  919. package/static/assets/pdfjs/build/pdf.mjs +724 -745
  920. package/static/assets/pdfjs/build/pdf.mjs.map +1 -1
  921. package/static/assets/pdfjs/build/pdf.sandbox.mjs +2 -2
  922. package/static/assets/pdfjs/build/pdf.worker.mjs +706 -193
  923. package/static/assets/pdfjs/build/pdf.worker.mjs.map +1 -1
  924. package/static/assets/pdfjs/version +1 -1
  925. package/static/assets/pdfjs/web/locale/dsb/viewer.ftl +5 -5
  926. package/static/assets/pdfjs/web/locale/en-US/viewer.ftl +1 -0
  927. package/static/assets/pdfjs/web/locale/fur/viewer.ftl +5 -0
  928. package/static/assets/pdfjs/web/locale/kk/viewer.ftl +28 -0
  929. package/static/assets/pdfjs/web/locale/ml/viewer.ftl +4 -0
  930. package/static/assets/pdfjs/web/locale/ru/viewer.ftl +3 -3
  931. package/static/assets/pdfjs/web/viewer.css +207 -65
  932. package/static/assets/pdfjs/web/viewer.html +11 -10
  933. package/static/assets/pdfjs/web/viewer.mjs +850 -270
  934. package/static/assets/pdfjs/web/viewer.mjs.map +1 -1
  935. package/static/assets/pdfjs/web/wasm/LICENSE_JBIG2 +196 -0
  936. package/static/assets/pdfjs/web/wasm/LICENSE_PDFJS_JBIG2 +13 -0
  937. package/static/assets/pdfjs/web/wasm/jbig2.wasm +0 -0
  938. package/static/chunk-22TZP6HW.js +1 -0
  939. package/static/{chunk-G7TLKY5X.js → chunk-27ATUHBH.js} +1 -1
  940. package/static/{chunk-CQOQXVYG.js → chunk-2CKLZ3FM.js} +1 -1
  941. package/static/{chunk-FVFOX6OP.js → chunk-2QZPX7LO.js} +1 -1
  942. package/static/{chunk-32AVRWC3.js → chunk-2R6IBBPZ.js} +1 -1
  943. package/static/{chunk-76JDXKD7.js → chunk-4FIGEBNL.js} +1 -1
  944. package/static/{chunk-ACCGBDUZ.js → chunk-4P3JABAP.js} +4 -4
  945. package/static/chunk-5CZOSAMZ.js +1 -0
  946. package/static/{chunk-2PDTP6N4.js → chunk-677WUBCT.js} +1 -1
  947. package/static/{chunk-K5VO5XTG.js → chunk-74CAHBFM.js} +1 -1
  948. package/static/{chunk-WTWGBCFO.js → chunk-7GWW6MJO.js} +1 -1
  949. package/static/{chunk-JXZOYX4N.js → chunk-A4UGPSWX.js} +1 -1
  950. package/static/{chunk-44D7RWET.js → chunk-AHO37FKW.js} +1 -1
  951. package/static/{chunk-WB2DECOA.js → chunk-AQCXMKP3.js} +1 -1
  952. package/static/chunk-B6PDYCRO.js +3 -0
  953. package/static/{chunk-JVGN5V5E.js → chunk-CU76ATCF.js} +1 -1
  954. package/static/{chunk-Q5K4ZUHK.js → chunk-CWYHOPOP.js} +1 -1
  955. package/static/{chunk-IOX3ANJR.js → chunk-E5WI5725.js} +1 -1
  956. package/static/{chunk-NUG54Y65.js → chunk-FC5HTKVM.js} +1 -1
  957. package/static/{chunk-LRK6RNPR.js → chunk-FOSM7EYI.js} +1 -1
  958. package/static/{chunk-B4UP2EQM.js → chunk-GAZO25PI.js} +1 -1
  959. package/static/{chunk-3WBCGTYW.js → chunk-GB7ABR5N.js} +1 -1
  960. package/static/{chunk-XFZ37WVK.js → chunk-GEHFKZQ5.js} +1 -1
  961. package/static/{chunk-4CQLN5HL.js → chunk-GQFMWVFD.js} +1 -1
  962. package/static/{chunk-YBEH442D.js → chunk-GVNTC564.js} +1 -1
  963. package/static/{chunk-WO6GBHBZ.js → chunk-HGL3NYP2.js} +2 -2
  964. package/static/{chunk-IAWRRL6J.js → chunk-HLIWPWRA.js} +1 -1
  965. package/static/{chunk-6LHJBXUE.js → chunk-HNYB3M4S.js} +1 -1
  966. package/static/{chunk-5WTIUYFF.js → chunk-HUXAUQMN.js} +1 -1
  967. package/static/{chunk-VBH3Y2M5.js → chunk-I2XA6PPK.js} +1 -1
  968. package/static/{chunk-I3XI72AV.js → chunk-ISV3BO6R.js} +1 -1
  969. package/static/{chunk-P7X53PEP.js → chunk-JV3AGU5B.js} +1 -1
  970. package/static/{chunk-ZFAXICUH.js → chunk-K25E7YGG.js} +1 -1
  971. package/static/{chunk-CAD3RHAY.js → chunk-K46PUTZB.js} +1 -1
  972. package/static/{chunk-GYFLVCFN.js → chunk-KERFLJ56.js} +1 -7
  973. package/static/{chunk-WSTGWBVW.js → chunk-KJD3KFF3.js} +1 -1
  974. package/static/{chunk-R4P4NBUL.js → chunk-KPKSI23S.js} +1 -1
  975. package/static/{chunk-M7IFVC5D.js → chunk-KZS7CTNR.js} +1 -1
  976. package/static/{chunk-P2IJCGWD.js → chunk-L5IHUVXL.js} +1 -1
  977. package/static/{chunk-DXESTGOH.js → chunk-L7RRX2M3.js} +1 -1
  978. package/static/{chunk-WE3ISL7O.js → chunk-LGWJ2WKU.js} +1 -1
  979. package/static/{chunk-OKI3N5AI.js → chunk-MLC7JK2H.js} +2 -2
  980. package/static/{chunk-NG7QWUFM.js → chunk-MOHNYW2A.js} +1 -1
  981. package/static/{chunk-SQYWQUL4.js → chunk-NCDUOVMW.js} +1 -1
  982. package/static/chunk-NGUAJIGI.js +1 -0
  983. package/static/{chunk-OYPJUVD6.js → chunk-NIPP6JDI.js} +1 -1
  984. package/static/{chunk-Y433XOAJ.js → chunk-NMTBMHUL.js} +1 -1
  985. package/static/chunk-O4XXMZFX.js +4 -0
  986. package/static/{chunk-IOP3ON2H.js → chunk-OANZITPM.js} +1 -1
  987. package/static/{chunk-WJFKUJJX.js → chunk-OGE4SAHU.js} +1 -1
  988. package/static/{chunk-7EHP6HO3.js → chunk-OI3ME22C.js} +1 -1
  989. package/static/{chunk-D4XDSS6P.js → chunk-Q3EGCMF5.js} +1 -1
  990. package/static/{chunk-TQBCGNFG.js → chunk-QF2NSHZA.js} +1 -1
  991. package/static/{chunk-RBBMH2FM.js → chunk-QKN6LAAA.js} +1 -1
  992. package/static/{chunk-J45SD6RC.js → chunk-QRFESU5O.js} +2 -2
  993. package/static/chunk-QVRVFYJH.js +1 -0
  994. package/static/{chunk-BAHNSFET.js → chunk-RFJIPIOK.js} +1 -1
  995. package/static/{chunk-IZ7TCHUW.js → chunk-RLL634K4.js} +1 -1
  996. package/static/{chunk-MOWL3ILT.js → chunk-RS2OFKWP.js} +1 -1
  997. package/static/{chunk-WM56LPJ3.js → chunk-RWAAC3A4.js} +1 -1
  998. package/static/{chunk-F3GMI6OL.js → chunk-S5Y64DDS.js} +1 -1
  999. package/static/{chunk-VNNLMUK7.js → chunk-SLG5KDU6.js} +1 -1
  1000. package/static/chunk-TJ4CVFEL.js +1 -0
  1001. package/static/{chunk-SAN35XTD.js → chunk-TWCGKSYE.js} +1 -1
  1002. package/static/{chunk-EUKVDBBK.js → chunk-UMDRE4S7.js} +1 -1
  1003. package/static/{chunk-YKCUUBZP.js → chunk-VRIOLRYR.js} +4 -4
  1004. package/static/chunk-VS4O2XDP.js +1 -0
  1005. package/static/{chunk-2MRTBCSV.js → chunk-VSBFNFOM.js} +1 -1
  1006. package/static/{chunk-CTPKDDVI.js → chunk-WN4WXCVK.js} +1 -1
  1007. package/static/{chunk-2AA3WMW5.js → chunk-WX7RXW7K.js} +1 -1
  1008. package/static/{chunk-J2BUPRCZ.js → chunk-XC4POKR3.js} +2 -2
  1009. package/static/{chunk-AXLDYLIO.js → chunk-Y4AUYQTG.js} +1 -1
  1010. package/static/{chunk-RPHWIW7S.js → chunk-YMIXHRJQ.js} +1 -7
  1011. package/static/{chunk-AFNUBQMD.js → chunk-ZUNKFAKP.js} +1 -1
  1012. package/static/index.html +3 -3
  1013. package/static/main-QN4UCOC5.js +5 -0
  1014. package/static/{styles-PD6764CP.css → styles-46GLIE7Y.css} +1 -1
  1015. package/server/authentication/constants/auth-ldap.js.map +0 -1
  1016. package/server/authentication/dto/two-fa-verify.dto.js.map +0 -1
  1017. package/server/authentication/guards/auth-two-fa-guard.js.map +0 -1
  1018. package/server/authentication/interfaces/two-fa-setup.interface.js +0 -10
  1019. package/server/authentication/interfaces/two-fa-setup.interface.js.map +0 -1
  1020. package/server/authentication/models/auth-method.js +0 -18
  1021. package/server/authentication/models/auth-method.js.map +0 -1
  1022. package/server/authentication/services/auth-manager.service.js.map +0 -1
  1023. package/server/authentication/services/auth-manager.service.spec.js.map +0 -1
  1024. package/server/authentication/services/auth-methods/auth-method-database.service.js.map +0 -1
  1025. package/server/authentication/services/auth-methods/auth-method-database.service.spec.js.map +0 -1
  1026. package/server/authentication/services/auth-methods/auth-method-ldap.service.js +0 -326
  1027. package/server/authentication/services/auth-methods/auth-method-ldap.service.js.map +0 -1
  1028. package/server/authentication/services/auth-methods/auth-method-ldap.service.spec.js +0 -534
  1029. package/server/authentication/services/auth-methods/auth-method-ldap.service.spec.js.map +0 -1
  1030. package/server/authentication/services/auth-methods/auth-method-two-fa.service.js.map +0 -1
  1031. package/server/authentication/services/auth-methods/auth-method-two-fa.service.spec.js.map +0 -1
  1032. package/static/chunk-3I6NPM62.js +0 -1
  1033. package/static/chunk-GCPX3EFC.js +0 -1
  1034. package/static/chunk-KBUIDMCK.js +0 -1
  1035. package/static/chunk-KY6MNZLC.js +0 -1
  1036. package/static/chunk-MPWD4VMY.js +0 -1
  1037. package/static/chunk-QQAF3MLL.js +0 -1
  1038. package/static/chunk-VHZKPUWE.js +0 -4
  1039. package/static/chunk-YWLMFOB4.js +0 -3
  1040. package/static/main-ZXEMCBMI.js +0 -11
@@ -1,8 +1,4 @@
1
- /*
2
- * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
3
- * This file is part of Sync-in | The open source file sync and share solution
4
- * See the LICENSE file for licensing details
5
- */ "use strict";
1
+ "use strict";
6
2
  Object.defineProperty(exports, "__esModule", {
7
3
  value: true
8
4
  });
@@ -17,9 +13,10 @@ const _common = require("@nestjs/common");
17
13
  const _nodecrypto = /*#__PURE__*/ _interop_require_default(require("node:crypto"));
18
14
  const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises"));
19
15
  const _nodepath = /*#__PURE__*/ _interop_require_default(require("node:path"));
20
- const _authmethod = require("../../../authentication/models/auth-method");
21
- const _authmanagerservice = require("../../../authentication/services/auth-manager.service");
22
- const _authmethodtwofaservice = require("../../../authentication/services/auth-methods/auth-method-two-fa.service");
16
+ const _authservice = require("../../../authentication/auth.service");
17
+ const _scope = require("../../../authentication/constants/scope");
18
+ const _authprovidersmodels = require("../../../authentication/providers/auth-providers.models");
19
+ const _authprovidertwofaservice = require("../../../authentication/providers/two-fa/auth-provider-two-fa.service");
23
20
  const _functions = require("../../../common/functions");
24
21
  const _shared = require("../../../common/shared");
25
22
  const _configconstants = require("../../../configuration/config.constants");
@@ -49,43 +46,64 @@ function _ts_metadata(k, v) {
49
46
  }
50
47
  let SyncClientsManager = class SyncClientsManager {
51
48
  async register(clientRegistrationDto, ip) {
52
- const user = await this.authMethod.validateUser(clientRegistrationDto.login, clientRegistrationDto.password);
49
+ const user = await this.authProvider.validateUser(clientRegistrationDto.login, clientRegistrationDto.password, ip, _scope.AUTH_SCOPE.CLIENT);
53
50
  if (!user) {
54
- this.logger.warn(`${this.register.name} - auth failed for user *${clientRegistrationDto.login}*`);
51
+ this.logger.warn({
52
+ tag: this.register.name,
53
+ msg: `auth failed for user *${clientRegistrationDto.login}*`
54
+ });
55
55
  throw new _common.HttpException('Wrong login or password', _common.HttpStatus.UNAUTHORIZED);
56
56
  }
57
57
  if (!user.havePermission(_user.USER_PERMISSION.DESKTOP_APP)) {
58
- this.logger.warn(`${this.register.name} - user *${user.login}* (${user.id}) does not have permission : ${_user.USER_PERMISSION.DESKTOP_APP}`);
58
+ this.logger.warn({
59
+ tag: this.register.name,
60
+ msg: `user *${user.login}* (${user.id}) does not have permission : ${_user.USER_PERMISSION.DESKTOP_APP}`
61
+ });
59
62
  throw new _common.HttpException('Missing permission', _common.HttpStatus.FORBIDDEN);
60
63
  }
61
64
  if (_configenvironment.configuration.auth.mfa.totp.enabled && user.twoFaEnabled) {
65
+ // Checking TOTP code and recovery code
62
66
  if (!clientRegistrationDto.code) {
63
- this.logger.warn(`${this.register.name} - missing two-fa code for user *${user.login}* (${user.id})`);
67
+ this.logger.warn({
68
+ tag: this.register.name,
69
+ msg: `missing two-fa code for user *${user.login}* (${user.id})`
70
+ });
64
71
  throw new _common.HttpException('Missing TWO-FA code', _common.HttpStatus.UNAUTHORIZED);
65
72
  }
66
- const auth = this.authMethod2Fa.validateTwoFactorCode(clientRegistrationDto.code, user.secrets.twoFaSecret);
67
- if (!auth.success) {
68
- this.logger.warn(`${this.register.name} - wrong two-fa code for user *${user.login}* (${user.id})`);
69
- this.usersManager.updateAccesses(user, ip, false).catch((e)=>this.logger.error(`${this.register.name} - ${e}`));
70
- throw new _common.HttpException(auth.message, _common.HttpStatus.UNAUTHORIZED);
73
+ const authCode = this.authProvider2FA.validateTwoFactorCode(clientRegistrationDto.code, user.secrets.twoFaSecret);
74
+ if (!authCode.success) {
75
+ this.logger.warn({
76
+ tag: this.register.name,
77
+ msg: `two-fa code for *${user.login}* (${user.id}) - ${authCode.message}`
78
+ });
79
+ const authRCode = await this.authProvider2FA.validateRecoveryCode(user.id, clientRegistrationDto.code, user.secrets.recoveryCodes);
80
+ if (!authRCode.success) {
81
+ this.logger.warn({
82
+ tag: this.register.name,
83
+ msg: `two-fa recovery code for *${user.login}* (${user.id}) - ${authRCode.message}`
84
+ });
85
+ this.usersManager.updateAccesses(user, ip, false).catch((e)=>this.logger.error({
86
+ tag: this.register.name,
87
+ msg: `${e}`
88
+ }));
89
+ throw new _common.HttpException(authCode.message, _common.HttpStatus.UNAUTHORIZED);
90
+ }
71
91
  }
72
92
  }
73
- try {
74
- const token = await this.syncQueries.getOrCreateClient(user.id, clientRegistrationDto.clientId, clientRegistrationDto.info, ip);
75
- this.logger.log(`${this.register.name} - client *${clientRegistrationDto.info.type}* was registered for user *${user.login}* (${user.id})`);
76
- return {
77
- clientToken: token
78
- };
79
- } catch (e) {
80
- this.logger.error(`${this.register.name} - ${e}`);
81
- throw new _common.HttpException('Error during the client registration', _common.HttpStatus.INTERNAL_SERVER_ERROR);
82
- }
93
+ return this.getOrCreateClient(user, clientRegistrationDto.clientId, clientRegistrationDto.info, ip);
94
+ }
95
+ async registerWithAuth(clientAuthenticatedRegistrationDto, req) {
96
+ const clientId = clientAuthenticatedRegistrationDto.clientId || _nodecrypto.default.randomUUID();
97
+ return this.getOrCreateClient(req.user, clientId, clientAuthenticatedRegistrationDto.info, req.ip);
83
98
  }
84
99
  async unregister(user) {
85
100
  try {
86
101
  await this.syncQueries.deleteClient(user.id, user.clientId);
87
102
  } catch (e) {
88
- this.logger.error(`${this.unregister.name} - ${e}`);
103
+ this.logger.error({
104
+ tag: this.unregister.name,
105
+ msg: `${e}`
106
+ });
89
107
  throw new _common.HttpException('Error during the removing of client registration', _common.HttpStatus.INTERNAL_SERVER_ERROR);
90
108
  }
91
109
  }
@@ -100,7 +118,10 @@ let SyncClientsManager = class SyncClientsManager {
100
118
  if ((0, _shared.currentTimeStamp)() >= client.tokenExpiration) {
101
119
  throw new _common.HttpException(_auth.CLIENT_TOKEN_EXPIRED_ERROR, _common.HttpStatus.FORBIDDEN);
102
120
  }
103
- this.syncQueries.updateClientInfo(client, client.info, ip).catch((e)=>this.logger.error(`${this.authenticate.name} - ${e}`));
121
+ this.syncQueries.updateClientInfo(client, client.info, ip).catch((e)=>this.logger.error({
122
+ tag: this.authenticate.name,
123
+ msg: `${e}`
124
+ }));
104
125
  const user = await this.usersManager.fromUserId(client.ownerId);
105
126
  if (!user) {
106
127
  throw new _common.HttpException('User does not exist', _common.HttpStatus.FORBIDDEN);
@@ -109,13 +130,19 @@ let SyncClientsManager = class SyncClientsManager {
109
130
  throw new _common.HttpException('Account suspended or not authorized', _common.HttpStatus.FORBIDDEN);
110
131
  }
111
132
  if (!user.havePermission(_user.USER_PERMISSION.DESKTOP_APP)) {
112
- this.logger.warn(`${this.register.name} - does not have permission : ${_user.USER_PERMISSION.DESKTOP_APP}`);
133
+ this.logger.warn({
134
+ tag: this.authenticate.name,
135
+ msg: `does not have permission : ${_user.USER_PERMISSION.DESKTOP_APP}`
136
+ });
113
137
  throw new _common.HttpException('Missing permission', _common.HttpStatus.FORBIDDEN);
114
138
  }
115
139
  // set clientId
116
140
  user.clientId = client.id;
117
141
  // update accesses
118
- this.usersManager.updateAccesses(user, ip, true).catch((e)=>this.logger.error(`${this.authenticate.name} - ${e}`));
142
+ this.usersManager.updateAccesses(user, ip, true).catch((e)=>this.logger.error({
143
+ tag: this.authenticate.name,
144
+ msg: `${e}`
145
+ }));
119
146
  let r;
120
147
  if (authType === _auth.CLIENT_AUTH_TYPE.COOKIE) {
121
148
  // used by the desktop app to perform the login setup using cookies
@@ -138,11 +165,17 @@ let SyncClientsManager = class SyncClientsManager {
138
165
  }
139
166
  const token = _nodecrypto.default.randomUUID();
140
167
  const expiration = (0, _shared.currentTimeStamp)() + (0, _functions.convertHumanTimeToSeconds)(_auth.CLIENT_TOKEN_EXPIRATION_TIME);
141
- this.logger.log(`${this.renewTokenAndExpiration.name} - renew token for user *${owner.login}* and client *${client.id}*`);
168
+ this.logger.log({
169
+ tag: this.renewTokenAndExpiration.name,
170
+ msg: `renew token for user *${owner.login}* and client *${client.id}*`
171
+ });
142
172
  try {
143
173
  await this.syncQueries.renewClientTokenAndExpiration(client.id, token, expiration);
144
174
  } catch (e) {
145
- this.logger.error(`${this.renewTokenAndExpiration.name} - unable to renew token for user *${owner.login}* and client *${client.id}* : ${e}`);
175
+ this.logger.error({
176
+ tag: this.renewTokenAndExpiration.name,
177
+ msg: `unable to renew token for user *${owner.login}* and client *${client.id}* : ${e}`
178
+ });
146
179
  throw new _common.HttpException('Unable to update client token', _common.HttpStatus.BAD_REQUEST);
147
180
  }
148
181
  return token;
@@ -151,14 +184,17 @@ let SyncClientsManager = class SyncClientsManager {
151
184
  try {
152
185
  await this.syncQueries.deleteClient(user.id, clientId);
153
186
  } catch (e) {
154
- this.logger.error(`${this.deleteClient.name} - ${e}`);
187
+ this.logger.error({
188
+ tag: this.deleteClient.name,
189
+ msg: `${e}`
190
+ });
155
191
  throw new _common.HttpException('Unable to delete client', _common.HttpStatus.INTERNAL_SERVER_ERROR);
156
192
  }
157
193
  }
158
194
  async checkAppStore() {
159
195
  let manifest = null;
160
196
  if (_configenvironment.configuration.applications.appStore.repository === _store.APP_STORE_REPOSITORY.PUBLIC) {
161
- const url = `${_store.APP_STORE_URL}/${_store.APP_STORE_MANIFEST_FILE}`;
197
+ const url = `${_shared.RELEASES_URL}/${_store.APP_STORE_MANIFEST_FILE}`;
162
198
  try {
163
199
  const res = await this.http.axiosRef({
164
200
  method: _applicationsconstants.HTTP_METHOD.GET,
@@ -167,12 +203,18 @@ let SyncClientsManager = class SyncClientsManager {
167
203
  manifest = res.data;
168
204
  manifest.repository = _store.APP_STORE_REPOSITORY.PUBLIC;
169
205
  } catch (e) {
170
- this.logger.warn(`${this.checkAppStore.name} - unable to retrieve ${url} : ${e}`);
206
+ this.logger.warn({
207
+ tag: this.checkAppStore.name,
208
+ msg: `unable to retrieve ${url} : ${e}`
209
+ });
171
210
  }
172
211
  } else {
173
212
  const latestFile = _nodepath.default.join(_configconstants.STATIC_PATH, _store.APP_STORE_DIRNAME, _store.APP_STORE_MANIFEST_FILE);
174
213
  if (!await (0, _files.isPathExists)(latestFile)) {
175
- this.logger.warn(`${this.checkAppStore.name} - ${latestFile} does not exist`);
214
+ this.logger.warn({
215
+ tag: this.checkAppStore.name,
216
+ msg: `${latestFile} does not exist`
217
+ });
176
218
  } else {
177
219
  try {
178
220
  manifest = JSON.parse(await _promises.default.readFile(latestFile, 'utf8'));
@@ -188,17 +230,39 @@ let SyncClientsManager = class SyncClientsManager {
188
230
  }
189
231
  }
190
232
  } catch (e) {
191
- this.logger.error(`${this.checkAppStore.name} - ${latestFile} : ${e}`);
233
+ this.logger.error({
234
+ tag: this.checkAppStore.name,
235
+ msg: `${latestFile} : ${e}`
236
+ });
192
237
  }
193
238
  }
194
239
  }
195
240
  return manifest;
196
241
  }
197
- constructor(http, authManager, authMethod, authMethod2Fa, usersManager, syncQueries){
242
+ async getOrCreateClient(user, clientId, clientInfo, ip) {
243
+ try {
244
+ const token = await this.syncQueries.getOrCreateClient(user.id, clientId, clientInfo, ip);
245
+ this.logger.log({
246
+ tag: this.getOrCreateClient.name,
247
+ msg: `client *${clientInfo.type}* was registered for user *${user.login}* (${user.id})`
248
+ });
249
+ return {
250
+ clientId: clientId,
251
+ clientToken: token
252
+ };
253
+ } catch (e) {
254
+ this.logger.error({
255
+ tag: this.getOrCreateClient.name,
256
+ msg: `${e}`
257
+ });
258
+ throw new _common.HttpException('Error during the client registration', _common.HttpStatus.INTERNAL_SERVER_ERROR);
259
+ }
260
+ }
261
+ constructor(http, authManager, authProvider, authProvider2FA, usersManager, syncQueries){
198
262
  this.http = http;
199
263
  this.authManager = authManager;
200
- this.authMethod = authMethod;
201
- this.authMethod2Fa = authMethod2Fa;
264
+ this.authProvider = authProvider;
265
+ this.authProvider2FA = authProvider2FA;
202
266
  this.usersManager = usersManager;
203
267
  this.syncQueries = syncQueries;
204
268
  this.logger = new _common.Logger(SyncClientsManager.name);
@@ -215,9 +279,9 @@ SyncClientsManager = _ts_decorate([
215
279
  _ts_metadata("design:type", Function),
216
280
  _ts_metadata("design:paramtypes", [
217
281
  typeof _axios.HttpService === "undefined" ? Object : _axios.HttpService,
218
- typeof _authmanagerservice.AuthManager === "undefined" ? Object : _authmanagerservice.AuthManager,
219
- typeof _authmethod.AuthMethod === "undefined" ? Object : _authmethod.AuthMethod,
220
- typeof _authmethodtwofaservice.AuthMethod2FA === "undefined" ? Object : _authmethodtwofaservice.AuthMethod2FA,
282
+ typeof _authservice.AuthManager === "undefined" ? Object : _authservice.AuthManager,
283
+ typeof _authprovidersmodels.AuthProvider === "undefined" ? Object : _authprovidersmodels.AuthProvider,
284
+ typeof _authprovidertwofaservice.AuthProvider2FA === "undefined" ? Object : _authprovidertwofaservice.AuthProvider2FA,
221
285
  typeof _usersmanagerservice.UsersManager === "undefined" ? Object : _usersmanagerservice.UsersManager,
222
286
  typeof _syncqueriesservice.SyncQueries === "undefined" ? Object : _syncqueriesservice.SyncQueries
223
287
  ])
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../backend/src/applications/sync/services/sync-clients-manager.service.ts"],"sourcesContent":["/*\n * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>\n * This file is part of Sync-in | The open source file sync and share solution\n * See the LICENSE file for licensing details\n */\n\nimport { HttpService } from '@nestjs/axios'\nimport { HttpException, HttpStatus, Injectable, Logger } from '@nestjs/common'\nimport { AxiosResponse } from 'axios'\nimport { FastifyReply } from 'fastify'\nimport crypto from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { AuthMethod } from '../../../authentication/models/auth-method'\nimport { AuthManager } from '../../../authentication/services/auth-manager.service'\nimport { AuthMethod2FA } from '../../../authentication/services/auth-methods/auth-method-two-fa.service'\nimport { convertHumanTimeToSeconds } from '../../../common/functions'\nimport { currentTimeStamp } from '../../../common/shared'\nimport { STATIC_PATH } from '../../../configuration/config.constants'\nimport { configuration } from '../../../configuration/config.environment'\nimport { CacheDecorator } from '../../../infrastructure/cache/cache.decorator'\nimport { HTTP_METHOD } from '../../applications.constants'\nimport { isPathExists } from '../../files/utils/files'\nimport { USER_PERMISSION } from '../../users/constants/user'\nimport { UserModel } from '../../users/models/user.model'\nimport { UsersManager } from '../../users/services/users-manager.service'\nimport { CLIENT_AUTH_TYPE, CLIENT_TOKEN_EXPIRATION_TIME, CLIENT_TOKEN_EXPIRED_ERROR, CLIENT_TOKEN_RENEW_TIME } from '../constants/auth'\nimport { APP_STORE_DIRNAME, APP_STORE_MANIFEST_FILE, APP_STORE_REPOSITORY, APP_STORE_URL } from '../constants/store'\nimport { SYNC_CLIENT_TYPE } from '../constants/sync'\nimport type { SyncClientAuthDto } from '../dtos/sync-client-auth.dto'\nimport type { SyncClientRegistrationDto } from '../dtos/sync-client-registration.dto'\nimport { AppStoreManifest } from '../interfaces/store-manifest.interface'\nimport { ClientAuthCookieDto, ClientAuthTokenDto } from '../interfaces/sync-client-auth.interface'\nimport { SyncClientPaths } from '../interfaces/sync-client-paths.interface'\nimport { SyncClient } from '../schemas/sync-client.interface'\nimport { SyncQueries } from './sync-queries.service'\n\n@Injectable()\nexport class SyncClientsManager {\n private readonly logger = new Logger(SyncClientsManager.name)\n\n constructor(\n private readonly http: HttpService,\n private readonly authManager: AuthManager,\n private readonly authMethod: AuthMethod,\n private readonly authMethod2Fa: AuthMethod2FA,\n private readonly usersManager: UsersManager,\n private readonly syncQueries: SyncQueries\n ) {}\n\n async register(clientRegistrationDto: SyncClientRegistrationDto, ip: string): Promise<{ clientToken: string }> {\n const user: UserModel = await this.authMethod.validateUser(clientRegistrationDto.login, clientRegistrationDto.password)\n if (!user) {\n this.logger.warn(`${this.register.name} - auth failed for user *${clientRegistrationDto.login}*`)\n throw new HttpException('Wrong login or password', HttpStatus.UNAUTHORIZED)\n }\n if (!user.havePermission(USER_PERMISSION.DESKTOP_APP)) {\n this.logger.warn(`${this.register.name} - user *${user.login}* (${user.id}) does not have permission : ${USER_PERMISSION.DESKTOP_APP}`)\n throw new HttpException('Missing permission', HttpStatus.FORBIDDEN)\n }\n if (configuration.auth.mfa.totp.enabled && user.twoFaEnabled) {\n if (!clientRegistrationDto.code) {\n this.logger.warn(`${this.register.name} - missing two-fa code for user *${user.login}* (${user.id})`)\n throw new HttpException('Missing TWO-FA code', HttpStatus.UNAUTHORIZED)\n }\n const auth = this.authMethod2Fa.validateTwoFactorCode(clientRegistrationDto.code, user.secrets.twoFaSecret)\n if (!auth.success) {\n this.logger.warn(`${this.register.name} - wrong two-fa code for user *${user.login}* (${user.id})`)\n this.usersManager.updateAccesses(user, ip, false).catch((e: Error) => this.logger.error(`${this.register.name} - ${e}`))\n throw new HttpException(auth.message, HttpStatus.UNAUTHORIZED)\n }\n }\n try {\n const token = await this.syncQueries.getOrCreateClient(user.id, clientRegistrationDto.clientId, clientRegistrationDto.info, ip)\n this.logger.log(`${this.register.name} - client *${clientRegistrationDto.info.type}* was registered for user *${user.login}* (${user.id})`)\n return { clientToken: token }\n } catch (e) {\n this.logger.error(`${this.register.name} - ${e}`)\n throw new HttpException('Error during the client registration', HttpStatus.INTERNAL_SERVER_ERROR)\n }\n }\n\n async unregister(user: UserModel): Promise<void> {\n try {\n await this.syncQueries.deleteClient(user.id, user.clientId)\n } catch (e) {\n this.logger.error(`${this.unregister.name} - ${e}`)\n throw new HttpException('Error during the removing of client registration', HttpStatus.INTERNAL_SERVER_ERROR)\n }\n }\n\n async authenticate(\n authType: CLIENT_AUTH_TYPE,\n syncClientAuthDto: SyncClientAuthDto,\n ip: string,\n res: FastifyReply\n ): Promise<ClientAuthTokenDto | ClientAuthCookieDto> {\n const client = await this.syncQueries.getClient(syncClientAuthDto.clientId, null, syncClientAuthDto.token)\n if (!client) {\n throw new HttpException('Client is unknown', HttpStatus.FORBIDDEN)\n }\n if (!client.enabled) {\n throw new HttpException('Client is disabled', HttpStatus.FORBIDDEN)\n }\n if (currentTimeStamp() >= client.tokenExpiration) {\n throw new HttpException(CLIENT_TOKEN_EXPIRED_ERROR, HttpStatus.FORBIDDEN)\n }\n this.syncQueries.updateClientInfo(client, client.info, ip).catch((e: Error) => this.logger.error(`${this.authenticate.name} - ${e}`))\n const user: UserModel = await this.usersManager.fromUserId(client.ownerId)\n if (!user) {\n throw new HttpException('User does not exist', HttpStatus.FORBIDDEN)\n }\n if (!user.isActive) {\n throw new HttpException('Account suspended or not authorized', HttpStatus.FORBIDDEN)\n }\n if (!user.havePermission(USER_PERMISSION.DESKTOP_APP)) {\n this.logger.warn(`${this.register.name} - does not have permission : ${USER_PERMISSION.DESKTOP_APP}`)\n throw new HttpException('Missing permission', HttpStatus.FORBIDDEN)\n }\n // set clientId\n user.clientId = client.id\n // update accesses\n this.usersManager.updateAccesses(user, ip, true).catch((e: Error) => this.logger.error(`${this.authenticate.name} - ${e}`))\n let r: ClientAuthTokenDto | ClientAuthCookieDto\n if (authType === CLIENT_AUTH_TYPE.COOKIE) {\n // used by the desktop app to perform the login setup using cookies\n r = await this.authManager.setCookies(user, res)\n } else if (authType === CLIENT_AUTH_TYPE.TOKEN) {\n // used by the cli app and the sync core\n r = await this.authManager.getTokens(user)\n }\n // check if the client token must be updated\n r.client_token_update = await this.renewTokenAndExpiration(client, user)\n return r\n }\n\n getClients(user: UserModel): Promise<SyncClientPaths[]> {\n return this.syncQueries.getClients(user)\n }\n\n async renewTokenAndExpiration(client: SyncClient, owner: UserModel): Promise<string | undefined> {\n if (currentTimeStamp() + convertHumanTimeToSeconds(CLIENT_TOKEN_RENEW_TIME) < client.tokenExpiration) {\n // client token expiration is not close enough\n return undefined\n }\n const token = crypto.randomUUID()\n const expiration = currentTimeStamp() + convertHumanTimeToSeconds(CLIENT_TOKEN_EXPIRATION_TIME)\n this.logger.log(`${this.renewTokenAndExpiration.name} - renew token for user *${owner.login}* and client *${client.id}*`)\n try {\n await this.syncQueries.renewClientTokenAndExpiration(client.id, token, expiration)\n } catch (e) {\n this.logger.error(`${this.renewTokenAndExpiration.name} - unable to renew token for user *${owner.login}* and client *${client.id}* : ${e}`)\n throw new HttpException('Unable to update client token', HttpStatus.BAD_REQUEST)\n }\n return token\n }\n\n async deleteClient(user: UserModel, clientId: string): Promise<void> {\n try {\n await this.syncQueries.deleteClient(user.id, clientId)\n } catch (e) {\n this.logger.error(`${this.deleteClient.name} - ${e}`)\n throw new HttpException('Unable to delete client', HttpStatus.INTERNAL_SERVER_ERROR)\n }\n }\n\n @CacheDecorator(3600)\n async checkAppStore(): Promise<AppStoreManifest> {\n let manifest: AppStoreManifest = null\n if (configuration.applications.appStore.repository === APP_STORE_REPOSITORY.PUBLIC) {\n const url = `${APP_STORE_URL}/${APP_STORE_MANIFEST_FILE}`\n try {\n const res: AxiosResponse = await this.http.axiosRef({\n method: HTTP_METHOD.GET,\n url: url\n })\n manifest = res.data\n manifest.repository = APP_STORE_REPOSITORY.PUBLIC\n } catch (e) {\n this.logger.warn(`${this.checkAppStore.name} - unable to retrieve ${url} : ${e}`)\n }\n } else {\n const latestFile = path.join(STATIC_PATH, APP_STORE_DIRNAME, APP_STORE_MANIFEST_FILE)\n if (!(await isPathExists(latestFile))) {\n this.logger.warn(`${this.checkAppStore.name} - ${latestFile} does not exist`)\n } else {\n try {\n manifest = JSON.parse(await fs.readFile(latestFile, 'utf8'))\n manifest.repository = APP_STORE_REPOSITORY.LOCAL\n // rewrite urls to local repository\n for (const [os, packages] of Object.entries(manifest.platform)) {\n for (const p of packages) {\n if (p.package.toLowerCase().startsWith(SYNC_CLIENT_TYPE.DESKTOP)) {\n p.url = `${APP_STORE_DIRNAME}/${SYNC_CLIENT_TYPE.DESKTOP}/${os}/${p.package}`\n } else {\n p.url = `${APP_STORE_DIRNAME}/${SYNC_CLIENT_TYPE.CLI}/${p.package}`\n }\n }\n }\n } catch (e) {\n this.logger.error(`${this.checkAppStore.name} - ${latestFile} : ${e}`)\n }\n }\n }\n return manifest\n }\n}\n"],"names":["SyncClientsManager","register","clientRegistrationDto","ip","user","authMethod","validateUser","login","password","logger","warn","name","HttpException","HttpStatus","UNAUTHORIZED","havePermission","USER_PERMISSION","DESKTOP_APP","id","FORBIDDEN","configuration","auth","mfa","totp","enabled","twoFaEnabled","code","authMethod2Fa","validateTwoFactorCode","secrets","twoFaSecret","success","usersManager","updateAccesses","catch","e","error","message","token","syncQueries","getOrCreateClient","clientId","info","log","type","clientToken","INTERNAL_SERVER_ERROR","unregister","deleteClient","authenticate","authType","syncClientAuthDto","res","client","getClient","currentTimeStamp","tokenExpiration","CLIENT_TOKEN_EXPIRED_ERROR","updateClientInfo","fromUserId","ownerId","isActive","r","CLIENT_AUTH_TYPE","COOKIE","authManager","setCookies","TOKEN","getTokens","client_token_update","renewTokenAndExpiration","getClients","owner","convertHumanTimeToSeconds","CLIENT_TOKEN_RENEW_TIME","undefined","crypto","randomUUID","expiration","CLIENT_TOKEN_EXPIRATION_TIME","renewClientTokenAndExpiration","BAD_REQUEST","checkAppStore","manifest","applications","appStore","repository","APP_STORE_REPOSITORY","PUBLIC","url","APP_STORE_URL","APP_STORE_MANIFEST_FILE","http","axiosRef","method","HTTP_METHOD","GET","data","latestFile","path","join","STATIC_PATH","APP_STORE_DIRNAME","isPathExists","JSON","parse","fs","readFile","LOCAL","os","packages","Object","entries","platform","p","package","toLowerCase","startsWith","SYNC_CLIENT_TYPE","DESKTOP","CLI","Logger"],"mappings":"AAAA;;;;CAIC;;;;+BAkCYA;;;eAAAA;;;uBAhCe;wBACkC;mEAG3C;iEACJ;iEACE;4BACU;oCACC;wCACE;2BACY;wBACT;iCACL;mCACE;gCACC;uCACH;uBACC;sBACG;qCAEH;sBACuF;uBACpB;sBAC/D;oCAOL;;;;;;;;;;;;;;;AAGrB,IAAA,AAAMA,qBAAN,MAAMA;IAYX,MAAMC,SAASC,qBAAgD,EAAEC,EAAU,EAAoC;QAC7G,MAAMC,OAAkB,MAAM,IAAI,CAACC,UAAU,CAACC,YAAY,CAACJ,sBAAsBK,KAAK,EAAEL,sBAAsBM,QAAQ;QACtH,IAAI,CAACJ,MAAM;YACT,IAAI,CAACK,MAAM,CAACC,IAAI,CAAC,GAAG,IAAI,CAACT,QAAQ,CAACU,IAAI,CAAC,yBAAyB,EAAET,sBAAsBK,KAAK,CAAC,CAAC,CAAC;YAChG,MAAM,IAAIK,qBAAa,CAAC,2BAA2BC,kBAAU,CAACC,YAAY;QAC5E;QACA,IAAI,CAACV,KAAKW,cAAc,CAACC,qBAAe,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AAA;aARF9B,SAAS,IAAIgH,cAAM,CAACzH,mBAAmBW,IAAI;IASzD;AA8JL"}
1
+ {"version":3,"sources":["../../../../../backend/src/applications/sync/services/sync-clients-manager.service.ts"],"sourcesContent":["import { HttpService } from '@nestjs/axios'\nimport { HttpException, HttpStatus, Injectable, Logger } from '@nestjs/common'\nimport { AxiosResponse } from 'axios'\nimport { FastifyReply } from 'fastify'\nimport crypto from 'node:crypto'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { AuthManager } from '../../../authentication/auth.service'\nimport { AUTH_SCOPE } from '../../../authentication/constants/scope'\nimport { FastifyAuthenticatedRequest } from '../../../authentication/interfaces/auth-request.interface'\nimport { AuthProvider } from '../../../authentication/providers/auth-providers.models'\nimport { AuthProvider2FA } from '../../../authentication/providers/two-fa/auth-provider-two-fa.service'\nimport { convertHumanTimeToSeconds } from '../../../common/functions'\nimport { currentTimeStamp, RELEASES_URL } from '../../../common/shared'\nimport { STATIC_PATH } from '../../../configuration/config.constants'\nimport { configuration } from '../../../configuration/config.environment'\nimport { CacheDecorator } from '../../../infrastructure/cache/cache.decorator'\nimport { HTTP_METHOD } from '../../applications.constants'\nimport { isPathExists } from '../../files/utils/files'\nimport { USER_PERMISSION } from '../../users/constants/user'\nimport { UserModel } from '../../users/models/user.model'\nimport { UsersManager } from '../../users/services/users-manager.service'\nimport { CLIENT_AUTH_TYPE, CLIENT_TOKEN_EXPIRATION_TIME, CLIENT_TOKEN_EXPIRED_ERROR, CLIENT_TOKEN_RENEW_TIME } from '../constants/auth'\nimport { APP_STORE_DIRNAME, APP_STORE_MANIFEST_FILE, APP_STORE_REPOSITORY } from '../constants/store'\nimport { SYNC_CLIENT_TYPE } from '../constants/sync'\nimport type { SyncClientAuthDto } from '../dtos/sync-client-auth.dto'\nimport { SyncClientAuthRegistrationDto, SyncClientRegistrationDto } from '../dtos/sync-client-registration.dto'\nimport { AppStoreManifest } from '../interfaces/store-manifest.interface'\nimport { SyncClientAuthCookie, SyncClientAuthRegistration, SyncClientAuthToken } from '../interfaces/sync-client-auth.interface'\nimport { SyncClientPaths } from '../interfaces/sync-client-paths.interface'\nimport { SyncClientInfo } from '../interfaces/sync-client.interface'\nimport { SyncClient } from '../schemas/sync-client.interface'\nimport { SyncQueries } from './sync-queries.service'\n\n@Injectable()\nexport class SyncClientsManager {\n private readonly logger = new Logger(SyncClientsManager.name)\n\n constructor(\n private readonly http: HttpService,\n private readonly authManager: AuthManager,\n private readonly authProvider: AuthProvider,\n private readonly authProvider2FA: AuthProvider2FA,\n private readonly usersManager: UsersManager,\n private readonly syncQueries: SyncQueries\n ) {}\n\n async register(clientRegistrationDto: SyncClientRegistrationDto, ip: string): Promise<SyncClientAuthRegistration> {\n const user: UserModel = await this.authProvider.validateUser(clientRegistrationDto.login, clientRegistrationDto.password, ip, AUTH_SCOPE.CLIENT)\n if (!user) {\n this.logger.warn({ tag: this.register.name, msg: `auth failed for user *${clientRegistrationDto.login}*` })\n throw new HttpException('Wrong login or password', HttpStatus.UNAUTHORIZED)\n }\n if (!user.havePermission(USER_PERMISSION.DESKTOP_APP)) {\n this.logger.warn({\n tag: this.register.name,\n msg: `user *${user.login}* (${user.id}) does not have permission : ${USER_PERMISSION.DESKTOP_APP}`\n })\n throw new HttpException('Missing permission', HttpStatus.FORBIDDEN)\n }\n if (configuration.auth.mfa.totp.enabled && user.twoFaEnabled) {\n // Checking TOTP code and recovery code\n if (!clientRegistrationDto.code) {\n this.logger.warn({ tag: this.register.name, msg: `missing two-fa code for user *${user.login}* (${user.id})` })\n throw new HttpException('Missing TWO-FA code', HttpStatus.UNAUTHORIZED)\n }\n const authCode = this.authProvider2FA.validateTwoFactorCode(clientRegistrationDto.code, user.secrets.twoFaSecret)\n if (!authCode.success) {\n this.logger.warn({ tag: this.register.name, msg: `two-fa code for *${user.login}* (${user.id}) - ${authCode.message}` })\n const authRCode = await this.authProvider2FA.validateRecoveryCode(user.id, clientRegistrationDto.code, user.secrets.recoveryCodes)\n if (!authRCode.success) {\n this.logger.warn({ tag: this.register.name, msg: `two-fa recovery code for *${user.login}* (${user.id}) - ${authRCode.message}` })\n this.usersManager.updateAccesses(user, ip, false).catch((e: Error) => this.logger.error({ tag: this.register.name, msg: `${e}` }))\n throw new HttpException(authCode.message, HttpStatus.UNAUTHORIZED)\n }\n }\n }\n return this.getOrCreateClient(user, clientRegistrationDto.clientId, clientRegistrationDto.info, ip)\n }\n\n async registerWithAuth(\n clientAuthenticatedRegistrationDto: SyncClientAuthRegistrationDto,\n req: FastifyAuthenticatedRequest\n ): Promise<SyncClientAuthRegistration> {\n const clientId = clientAuthenticatedRegistrationDto.clientId || crypto.randomUUID()\n return this.getOrCreateClient(req.user, clientId, clientAuthenticatedRegistrationDto.info, req.ip)\n }\n\n async unregister(user: UserModel): Promise<void> {\n try {\n await this.syncQueries.deleteClient(user.id, user.clientId)\n } catch (e) {\n this.logger.error({ tag: this.unregister.name, msg: `${e}` })\n throw new HttpException('Error during the removing of client registration', HttpStatus.INTERNAL_SERVER_ERROR)\n }\n }\n\n async authenticate(\n authType: CLIENT_AUTH_TYPE,\n syncClientAuthDto: SyncClientAuthDto,\n ip: string,\n res: FastifyReply\n ): Promise<SyncClientAuthToken | SyncClientAuthCookie> {\n const client = await this.syncQueries.getClient(syncClientAuthDto.clientId, null, syncClientAuthDto.token)\n if (!client) {\n throw new HttpException('Client is unknown', HttpStatus.FORBIDDEN)\n }\n if (!client.enabled) {\n throw new HttpException('Client is disabled', HttpStatus.FORBIDDEN)\n }\n if (currentTimeStamp() >= client.tokenExpiration) {\n throw new HttpException(CLIENT_TOKEN_EXPIRED_ERROR, HttpStatus.FORBIDDEN)\n }\n this.syncQueries.updateClientInfo(client, client.info, ip).catch((e: Error) => this.logger.error({ tag: this.authenticate.name, msg: `${e}` }))\n const user: UserModel = await this.usersManager.fromUserId(client.ownerId)\n if (!user) {\n throw new HttpException('User does not exist', HttpStatus.FORBIDDEN)\n }\n if (!user.isActive) {\n throw new HttpException('Account suspended or not authorized', HttpStatus.FORBIDDEN)\n }\n if (!user.havePermission(USER_PERMISSION.DESKTOP_APP)) {\n this.logger.warn({ tag: this.authenticate.name, msg: `does not have permission : ${USER_PERMISSION.DESKTOP_APP}` })\n throw new HttpException('Missing permission', HttpStatus.FORBIDDEN)\n }\n // set clientId\n user.clientId = client.id\n // update accesses\n this.usersManager.updateAccesses(user, ip, true).catch((e: Error) => this.logger.error({ tag: this.authenticate.name, msg: `${e}` }))\n let r: SyncClientAuthToken | SyncClientAuthCookie\n if (authType === CLIENT_AUTH_TYPE.COOKIE) {\n // used by the desktop app to perform the login setup using cookies\n r = await this.authManager.setCookies(user, res)\n } else if (authType === CLIENT_AUTH_TYPE.TOKEN) {\n // used by the cli app and the sync core\n r = await this.authManager.getTokens(user)\n }\n // check if the client token must be updated\n r.client_token_update = await this.renewTokenAndExpiration(client, user)\n return r\n }\n\n getClients(user: UserModel): Promise<SyncClientPaths[]> {\n return this.syncQueries.getClients(user)\n }\n\n async renewTokenAndExpiration(client: SyncClient, owner: UserModel): Promise<string | undefined> {\n if (currentTimeStamp() + convertHumanTimeToSeconds(CLIENT_TOKEN_RENEW_TIME) < client.tokenExpiration) {\n // client token expiration is not close enough\n return undefined\n }\n const token = crypto.randomUUID()\n const expiration = currentTimeStamp() + convertHumanTimeToSeconds(CLIENT_TOKEN_EXPIRATION_TIME)\n this.logger.log({ tag: this.renewTokenAndExpiration.name, msg: `renew token for user *${owner.login}* and client *${client.id}*` })\n try {\n await this.syncQueries.renewClientTokenAndExpiration(client.id, token, expiration)\n } catch (e) {\n this.logger.error({\n tag: this.renewTokenAndExpiration.name,\n msg: `unable to renew token for user *${owner.login}* and client *${client.id}* : ${e}`\n })\n throw new HttpException('Unable to update client token', HttpStatus.BAD_REQUEST)\n }\n return token\n }\n\n async deleteClient(user: UserModel, clientId: string): Promise<void> {\n try {\n await this.syncQueries.deleteClient(user.id, clientId)\n } catch (e) {\n this.logger.error({ tag: this.deleteClient.name, msg: `${e}` })\n throw new HttpException('Unable to delete client', HttpStatus.INTERNAL_SERVER_ERROR)\n }\n }\n\n @CacheDecorator(3600)\n async checkAppStore(): Promise<AppStoreManifest> {\n let manifest: AppStoreManifest = null\n if (configuration.applications.appStore.repository === APP_STORE_REPOSITORY.PUBLIC) {\n const url = `${RELEASES_URL}/${APP_STORE_MANIFEST_FILE}`\n try {\n const res: AxiosResponse = await this.http.axiosRef({\n method: HTTP_METHOD.GET,\n url: url\n })\n manifest = res.data\n manifest.repository = APP_STORE_REPOSITORY.PUBLIC\n } catch (e) {\n this.logger.warn({ tag: this.checkAppStore.name, msg: `unable to retrieve ${url} : ${e}` })\n }\n } else {\n const latestFile = path.join(STATIC_PATH, APP_STORE_DIRNAME, APP_STORE_MANIFEST_FILE)\n if (!(await isPathExists(latestFile))) {\n this.logger.warn({ tag: this.checkAppStore.name, msg: `${latestFile} does not exist` })\n } else {\n try {\n manifest = JSON.parse(await fs.readFile(latestFile, 'utf8'))\n manifest.repository = APP_STORE_REPOSITORY.LOCAL\n // rewrite urls to local repository\n for (const [os, packages] of Object.entries(manifest.platform)) {\n for (const p of packages) {\n if (p.package.toLowerCase().startsWith(SYNC_CLIENT_TYPE.DESKTOP)) {\n p.url = `${APP_STORE_DIRNAME}/${SYNC_CLIENT_TYPE.DESKTOP}/${os}/${p.package}`\n } else {\n p.url = `${APP_STORE_DIRNAME}/${SYNC_CLIENT_TYPE.CLI}/${p.package}`\n }\n }\n }\n } catch (e) {\n this.logger.error({ tag: this.checkAppStore.name, msg: `${latestFile} : ${e}` })\n }\n }\n }\n return manifest\n }\n\n private async getOrCreateClient(user: UserModel, clientId: string, clientInfo: SyncClientInfo, ip: string): Promise<SyncClientAuthRegistration> {\n try {\n const token = await this.syncQueries.getOrCreateClient(user.id, clientId, clientInfo, ip)\n this.logger.log({ tag: this.getOrCreateClient.name, msg: `client *${clientInfo.type}* was registered for user *${user.login}* (${user.id})` })\n return { clientId: clientId, clientToken: token } satisfies SyncClientAuthRegistration\n } catch (e) {\n this.logger.error({ tag: this.getOrCreateClient.name, msg: `${e}` })\n throw new HttpException('Error during the client registration', HttpStatus.INTERNAL_SERVER_ERROR)\n }\n }\n}\n"],"names":["SyncClientsManager","register","clientRegistrationDto","ip","user","authProvider","validateUser","login","password","AUTH_SCOPE","CLIENT","logger","warn","tag","name","msg","HttpException","HttpStatus","UNAUTHORIZED","havePermission","USER_PERMISSION","DESKTOP_APP","id","FORBIDDEN","configuration","auth","mfa","totp","enabled","twoFaEnabled","code","authCode","authProvider2FA","validateTwoFactorCode","secrets","twoFaSecret","success","message","authRCode","validateRecoveryCode","recoveryCodes","usersManager","updateAccesses","catch","e","error","getOrCreateClient","clientId","info","registerWithAuth","clientAuthenticatedRegistrationDto","req","crypto","randomUUID","unregister","syncQueries","deleteClient","INTERNAL_SERVER_ERROR","authenticate","authType","syncClientAuthDto","res","client","getClient","token","currentTimeStamp","tokenExpiration","CLIENT_TOKEN_EXPIRED_ERROR","updateClientInfo","fromUserId","ownerId","isActive","r","CLIENT_AUTH_TYPE","COOKIE","authManager","setCookies","TOKEN","getTokens","client_token_update","renewTokenAndExpiration","getClients","owner","convertHumanTimeToSeconds","CLIENT_TOKEN_RENEW_TIME","undefined","expiration","CLIENT_TOKEN_EXPIRATION_TIME","log","renewClientTokenAndExpiration","BAD_REQUEST","checkAppStore","manifest","applications","appStore","repository","APP_STORE_REPOSITORY","PUBLIC","url","RELEASES_URL","APP_STORE_MANIFEST_FILE","http","axiosRef","method","HTTP_METHOD","GET","data","latestFile","path","join","STATIC_PATH","APP_STORE_DIRNAME","isPathExists","JSON","parse","fs","readFile","LOCAL","os","packages","Object","entries","platform","p","package","toLowerCase","startsWith","SYNC_CLIENT_TYPE","DESKTOP","CLI","clientInfo","type","clientToken","Logger"],"mappings":";;;;+BAmCaA;;;eAAAA;;;uBAnCe;wBACkC;mEAG3C;iEACJ;iEACE;6BACW;uBACD;qCAEE;0CACG;2BACU;wBACK;iCACnB;mCACE;gCACC;uCACH;uBACC;sBACG;qCAEH;s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,GAAG,EAAEH,KAAKkB,EAAE,CAAC,CAAC,CAAC;YAAC;YAC5I,OAAO;gBAAEyB,UAAUA;gBAAUqF,aAAapE;YAAM;QAClD,EAAE,OAAOpB,GAAG;YACV,IAAI,CAACjC,MAAM,CAACkC,KAAK,CAAC;gBAAEhC,KAAK,IAAI,CAACiC,iBAAiB,CAAChC,IAAI;gBAAEC,KAAK,GAAG6B,GAAG;YAAC;YAClE,MAAM,IAAI5B,qBAAa,CAAC,wCAAwCC,kBAAU,CAACwC,qBAAqB;QAClG;IACF;IA3LA,YACE,AAAiB4C,IAAiB,EAClC,AAAiB1B,WAAwB,EACzC,AAAiBtE,YAA0B,EAC3C,AAAiB2B,eAAgC,EACjD,AAAiBS,YAA0B,EAC3C,AAAiBc,WAAwB,CACzC;aANiB8C,OAAAA;aACA1B,cAAAA;aACAtE,eAAAA;aACA2B,kBAAAA;aACAS,eAAAA;aACAc,cAAAA;aARF5C,SAAS,IAAI0H,cAAM,CAACrI,mBAAmBc,IAAI;IASzD;AAqLL"}
@@ -1,8 +1,4 @@
1
- /*
2
- * Copyright (C) 2012-2025 Johan Legrand <johan.legrand@sync-in.com>
3
- * This file is part of Sync-in | The open source file sync and share solution
4
- * See the LICENSE file for licensing details
5
- */ "use strict";
1
+ "use strict";
6
2
  Object.defineProperty(exports, "__esModule", {
7
3
  value: true
8
4
  });
@@ -11,9 +7,9 @@ const _common = require("@nestjs/common");
11
7
  const _testing = require("@nestjs/testing");
12
8
  const _nodecrypto = /*#__PURE__*/ _interop_require_default(require("node:crypto"));
13
9
  const _promises = /*#__PURE__*/ _interop_require_default(require("node:fs/promises"));
14
- const _authmethod = require("../../../authentication/models/auth-method");
15
- const _authmanagerservice = require("../../../authentication/services/auth-manager.service");
16
- const _authmethodtwofaservice = require("../../../authentication/services/auth-methods/auth-method-two-fa.service");
10
+ const _authservice = require("../../../authentication/auth.service");
11
+ const _authprovidersmodels = require("../../../authentication/providers/auth-providers.models");
12
+ const _authprovidertwofaservice = require("../../../authentication/providers/two-fa/auth-provider-two-fa.service");
17
13
  const _functions = /*#__PURE__*/ _interop_require_wildcard(require("../../../common/functions"));
18
14
  const _shared = /*#__PURE__*/ _interop_require_wildcard(require("../../../common/shared"));
19
15
  const _configenvironment = require("../../../configuration/config.environment");
@@ -104,7 +100,7 @@ describe(_syncclientsmanagerservice.SyncClientsManager.name, ()=>{
104
100
  // Mocks
105
101
  let http;
106
102
  let authManager;
107
- let authMethod;
103
+ let authProvider;
108
104
  let usersManager;
109
105
  let syncQueries;
110
106
  let cacheMock;
@@ -142,7 +138,7 @@ describe(_syncclientsmanagerservice.SyncClientsManager.name, ()=>{
142
138
  setCookies: jest.fn(),
143
139
  getTokens: jest.fn()
144
140
  };
145
- authMethod = {
141
+ authProvider = {
146
142
  validateUser: jest.fn()
147
143
  };
148
144
  usersManager = {
@@ -183,15 +179,15 @@ describe(_syncclientsmanagerservice.SyncClientsManager.name, ()=>{
183
179
  useValue: usersManager
184
180
  },
185
181
  {
186
- provide: _authmanagerservice.AuthManager,
182
+ provide: _authservice.AuthManager,
187
183
  useValue: authManager
188
184
  },
189
185
  {
190
- provide: _authmethod.AuthMethod,
191
- useValue: authMethod
186
+ provide: _authprovidersmodels.AuthProvider,
187
+ useValue: authProvider
192
188
  },
193
189
  {
194
- provide: _authmethodtwofaservice.AuthMethod2FA,
190
+ provide: _authprovidertwofaservice.AuthProvider2FA,
195
191
  useValue: {}
196
192
  }
197
193
  ]
@@ -252,13 +248,13 @@ describe(_syncclientsmanagerservice.SyncClientsManager.name, ()=>{
252
248
  _common.HttpStatus.FORBIDDEN
253
249
  ]
254
250
  ])('should throw %s', async (_label, user, status)=>{
255
- authMethod.validateUser.mockResolvedValue(user);
251
+ authProvider.validateUser.mockResolvedValue(user);
256
252
  await expect(service.register(baseDto, '1.2.3.4')).rejects.toMatchObject({
257
253
  status
258
254
  });
259
255
  });
260
256
  it('should return client token when registration succeeds', async ()=>{
261
- authMethod.validateUser.mockResolvedValue({
257
+ authProvider.validateUser.mockResolvedValue({
262
258
  id: 10,
263
259
  login: 'john',
264
260
  havePermission: ()=>true
@@ -266,12 +262,13 @@ describe(_syncclientsmanagerservice.SyncClientsManager.name, ()=>{
266
262
  syncQueries.getOrCreateClient.mockResolvedValue('token-abc');
267
263
  const r = await service.register(baseDto, '1.2.3.4');
268
264
  expect(r).toEqual({
265
+ clientId: 'client-1',
269
266
  clientToken: 'token-abc'
270
267
  });
271
268
  expect(syncQueries.getOrCreateClient).toHaveBeenCalledWith(10, 'client-1', baseDto.info, '1.2.3.4');
272
269
  });
273
270
  it('should throw Internal Server Error when persistence fails', async ()=>{
274
- authMethod.validateUser.mockResolvedValue({
271
+ authProvider.validateUser.mockResolvedValue({
275
272
  id: 10,
276
273
  login: 'john',
277
274
  havePermission: ()=>true