@sync-in/server 1.10.1 → 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 (1057) hide show
  1. package/CHANGELOG.md +47 -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 +18 -17
  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-U5E5H2DD.js → chunk-27ATUHBH.js} +1 -1
  940. package/static/{chunk-HZAB6F4Q.js → chunk-2CKLZ3FM.js} +1 -1
  941. package/static/{chunk-XZHWESIY.js → chunk-2QZPX7LO.js} +1 -1
  942. package/static/{chunk-UOK3LKSX.js → chunk-2R6IBBPZ.js} +1 -1
  943. package/static/{chunk-DVCN3P7Q.js → chunk-4FIGEBNL.js} +1 -1
  944. package/static/chunk-4P3JABAP.js +13 -0
  945. package/static/chunk-5CZOSAMZ.js +1 -0
  946. package/static/{chunk-RBTLSPYJ.js → chunk-677WUBCT.js} +1 -1
  947. package/static/{chunk-KEZNIIFH.js → chunk-74CAHBFM.js} +1 -1
  948. package/static/{chunk-WRK2FTKU.js → chunk-7GWW6MJO.js} +1 -1
  949. package/static/{chunk-EKWB5W72.js → chunk-7WOPGQXB.js} +1 -1
  950. package/static/{chunk-IMFO2MI7.js → chunk-A4UGPSWX.js} +1 -1
  951. package/static/{chunk-KDUAB76O.js → chunk-AHO37FKW.js} +1 -1
  952. package/static/chunk-AQCXMKP3.js +1 -0
  953. package/static/chunk-B6PDYCRO.js +3 -0
  954. package/static/{chunk-PPJCVBJH.js → chunk-CU76ATCF.js} +1 -1
  955. package/static/{chunk-ARS47O5X.js → chunk-CWYHOPOP.js} +1 -1
  956. package/static/{chunk-CSVPAZHK.js → chunk-E5WI5725.js} +1 -1
  957. package/static/{chunk-XX3JPJUM.js → chunk-FC5HTKVM.js} +1 -1
  958. package/static/{chunk-QGHNJVJ6.js → chunk-FOSM7EYI.js} +1 -1
  959. package/static/{chunk-JAJ7VXMB.js → chunk-GAZO25PI.js} +1 -1
  960. package/static/{chunk-IHS5LSJJ.js → chunk-GB7ABR5N.js} +1 -1
  961. package/static/{chunk-27V66YJV.js → chunk-GEHFKZQ5.js} +2 -2
  962. package/static/{chunk-3QTROEHV.js → chunk-GQFMWVFD.js} +1 -1
  963. package/static/{chunk-FWQJ4ZCD.js → chunk-GVNTC564.js} +1 -1
  964. package/static/{chunk-4NIYCYRS.js → chunk-HGL3NYP2.js} +2 -2
  965. package/static/chunk-HLIWPWRA.js +1 -0
  966. package/static/{chunk-3VRUIWQG.js → chunk-HNYB3M4S.js} +1 -1
  967. package/static/{chunk-7HJFIMNF.js → chunk-HUXAUQMN.js} +1 -1
  968. package/static/chunk-I2XA6PPK.js +1 -0
  969. package/static/{chunk-RJULB733.js → chunk-ISV3BO6R.js} +1 -1
  970. package/static/{chunk-R4VYKZVJ.js → chunk-IWWBV6EM.js} +1 -1
  971. package/static/{chunk-TTWMFWEC.js → chunk-JV3AGU5B.js} +1 -1
  972. package/static/{chunk-X7NHX5C7.js → chunk-K25E7YGG.js} +1 -1
  973. package/static/chunk-K46PUTZB.js +1 -0
  974. package/static/{chunk-D2MLAO5N.js → chunk-KERFLJ56.js} +1 -7
  975. package/static/{chunk-LZUHREOF.js → chunk-KJD3KFF3.js} +1 -1
  976. package/static/chunk-KPKSI23S.js +1 -0
  977. package/static/{chunk-CMNMPG6Z.js → chunk-KZS7CTNR.js} +1 -1
  978. package/static/{chunk-RNVPQQKT.js → chunk-L5IHUVXL.js} +1 -1
  979. package/static/{chunk-2GXOVGTD.js → chunk-L7RRX2M3.js} +1 -1
  980. package/static/{chunk-WFMEUST4.js → chunk-LGWJ2WKU.js} +1 -1
  981. package/static/{chunk-ZOMRIN3G.js → chunk-MLC7JK2H.js} +2 -2
  982. package/static/{chunk-76REYAEA.js → chunk-MOHNYW2A.js} +1 -1
  983. package/static/{chunk-ZHUBWKA2.js → chunk-MTRXBVWZ.js} +1 -1
  984. package/static/{chunk-QJ22N76V.js → chunk-MZQK6LNV.js} +1 -1
  985. package/static/{chunk-SDJNZULP.js → chunk-NCDUOVMW.js} +1 -1
  986. package/static/chunk-NGUAJIGI.js +1 -0
  987. package/static/chunk-NIPP6JDI.js +1 -0
  988. package/static/{chunk-VD5JHSDS.js → chunk-NMTBMHUL.js} +1 -1
  989. package/static/chunk-O4XXMZFX.js +4 -0
  990. package/static/{chunk-WZPF4LS2.js → chunk-OANZITPM.js} +1 -1
  991. package/static/{chunk-JNTNMIUH.js → chunk-OGE4SAHU.js} +1 -1
  992. package/static/{chunk-S6H2ELRY.js → chunk-OI3ME22C.js} +1 -1
  993. package/static/{chunk-7KAYOR3A.js → chunk-Q3EGCMF5.js} +1 -1
  994. package/static/chunk-QF2NSHZA.js +1 -0
  995. package/static/{chunk-3ZBAQTHJ.js → chunk-QIGUDEZF.js} +1 -1
  996. package/static/{chunk-76M3BMK6.js → chunk-QJVC3SRJ.js} +11 -11
  997. package/static/{chunk-VBTZDHZ3.js → chunk-QKN6LAAA.js} +1 -1
  998. package/static/{chunk-JRXG43AA.js → chunk-QRFESU5O.js} +2 -2
  999. package/static/chunk-QVRVFYJH.js +1 -0
  1000. package/static/{chunk-BCN4T5DO.js → chunk-RFJIPIOK.js} +2 -2
  1001. package/static/{chunk-2RWLNKZH.js → chunk-RLL634K4.js} +1 -1
  1002. package/static/{chunk-D5FQ72R4.js → chunk-RS2OFKWP.js} +1 -1
  1003. package/static/{chunk-CN5YVRFT.js → chunk-RWAAC3A4.js} +1 -1
  1004. package/static/{chunk-LWSCODLD.js → chunk-RWCNTCU5.js} +1 -1
  1005. package/static/{chunk-FTFEQDWH.js → chunk-S5Y64DDS.js} +1 -1
  1006. package/static/{chunk-J7474P3L.js → chunk-SLG5KDU6.js} +1 -1
  1007. package/static/chunk-TJ4CVFEL.js +1 -0
  1008. package/static/{chunk-KAUCN24H.js → chunk-TWCGKSYE.js} +1 -1
  1009. package/static/{chunk-PDG7DOEF.js → chunk-UMDRE4S7.js} +1 -1
  1010. package/static/chunk-VRIOLRYR.js +5 -0
  1011. package/static/chunk-VS4O2XDP.js +1 -0
  1012. package/static/{chunk-ZEJLIGAY.js → chunk-VSBFNFOM.js} +1 -1
  1013. package/static/{chunk-XSURUW7C.js → chunk-WN4WXCVK.js} +1 -1
  1014. package/static/{chunk-S44QIK3G.js → chunk-WX7RXW7K.js} +1 -1
  1015. package/static/{chunk-3ZLBVUCX.js → chunk-XC4POKR3.js} +2 -2
  1016. package/static/{chunk-TNCKNU6I.js → chunk-Y4AUYQTG.js} +1 -1
  1017. package/static/{chunk-3MVPXC3U.js → chunk-Y67J3BOL.js} +1 -1
  1018. package/static/{chunk-QTPIEEZW.js → chunk-YMIXHRJQ.js} +1 -7
  1019. package/static/{chunk-VZFZUI6D.js → chunk-ZUNKFAKP.js} +1 -1
  1020. package/static/index.html +3 -3
  1021. package/static/main-QN4UCOC5.js +5 -0
  1022. package/static/{styles-XLLEY5Y3.css → styles-46GLIE7Y.css} +1 -1
  1023. package/server/authentication/constants/auth-ldap.js.map +0 -1
  1024. package/server/authentication/dto/two-fa-verify.dto.js.map +0 -1
  1025. package/server/authentication/guards/auth-two-fa-guard.js.map +0 -1
  1026. package/server/authentication/interfaces/two-fa-setup.interface.js +0 -10
  1027. package/server/authentication/interfaces/two-fa-setup.interface.js.map +0 -1
  1028. package/server/authentication/models/auth-method.js +0 -18
  1029. package/server/authentication/models/auth-method.js.map +0 -1
  1030. package/server/authentication/services/auth-manager.service.js.map +0 -1
  1031. package/server/authentication/services/auth-manager.service.spec.js.map +0 -1
  1032. package/server/authentication/services/auth-methods/auth-method-database.service.js.map +0 -1
  1033. package/server/authentication/services/auth-methods/auth-method-database.service.spec.js.map +0 -1
  1034. package/server/authentication/services/auth-methods/auth-method-ldap.service.js +0 -326
  1035. package/server/authentication/services/auth-methods/auth-method-ldap.service.js.map +0 -1
  1036. package/server/authentication/services/auth-methods/auth-method-ldap.service.spec.js +0 -534
  1037. package/server/authentication/services/auth-methods/auth-method-ldap.service.spec.js.map +0 -1
  1038. package/server/authentication/services/auth-methods/auth-method-two-fa.service.js.map +0 -1
  1039. package/server/authentication/services/auth-methods/auth-method-two-fa.service.spec.js.map +0 -1
  1040. package/static/chunk-2YQ4SX3A.js +0 -13
  1041. package/static/chunk-46TJLPJY.js +0 -1
  1042. package/static/chunk-6OEOADR6.js +0 -1
  1043. package/static/chunk-AALPWGPB.js +0 -3
  1044. package/static/chunk-CVXLHSO5.js +0 -1
  1045. package/static/chunk-G7RZN7HN.js +0 -1
  1046. package/static/chunk-LTJNLOX2.js +0 -1
  1047. package/static/chunk-NIKNG2FX.js +0 -1
  1048. package/static/chunk-NNZWSNAW.js +0 -1
  1049. package/static/chunk-NWKBB7J4.js +0 -1
  1050. package/static/chunk-PVYVY3GD.js +0 -1
  1051. package/static/chunk-Q5X5TPAG.js +0 -1
  1052. package/static/chunk-R4VMWCM5.js +0 -1
  1053. package/static/chunk-SNOOCDJD.js +0 -1
  1054. package/static/chunk-SPQH3ATC.js +0 -5
  1055. package/static/chunk-ZCSHU3D7.js +0 -1
  1056. package/static/chunk-ZU5MQTFN.js +0 -4
  1057. package/static/main-5O3KLGIR.js +0 -11
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-parser.service.spec.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 { Test, TestingModule } from '@nestjs/testing'\nimport { DB_TOKEN_PROVIDER } from '../../../infrastructure/database/constants'\nimport { FilesParser } from './files-parser.service'\n\ndescribe(FilesParser.name, () => {\n let service: FilesParser\n\n beforeAll(async () => {\n const module: TestingModule = await Test.createTestingModule({\n providers: [FilesParser, { provide: DB_TOKEN_PROVIDER, useValue: {} }]\n }).compile()\n\n service = module.get<FilesParser>(FilesParser)\n })\n\n it('should be defined', () => {\n expect(service).toBeDefined()\n })\n})\n"],"names":["describe","FilesParser","name","service","beforeAll","module","Test","createTestingModule","providers","provide","DB_TOKEN_PROVIDER","useValue","compile","get","it","expect","toBeDefined"],"mappings":"AAAA;;;;CAIC;;;;yBAEmC;2BACF;oCACN;AAE5BA,SAASC,+BAAW,CAACC,IAAI,EAAE;IACzB,IAAIC;IAEJC,UAAU;QACR,MAAMC,SAAwB,MAAMC,aAAI,CAACC,mBAAmB,CAAC;YAC3DC,WAAW;gBAACP,+BAAW;gBAAE;oBAAEQ,SAASC,4BAAiB;oBAAEC,UAAU,CAAC;gBAAE;aAAE;QACxE,GAAGC,OAAO;QAEVT,UAAUE,OAAOQ,GAAG,CAAcZ,+BAAW;IAC/C;IAEAa,GAAG,qBAAqB;QACtBC,OAAOZ,SAASa,WAAW;IAC7B;AACF"}
1
+ {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-parser.service.spec.ts"],"sourcesContent":["import { Test, TestingModule } from '@nestjs/testing'\nimport { DB_TOKEN_PROVIDER } from '../../../infrastructure/database/constants'\nimport { FilesParser } from './files-parser.service'\n\ndescribe(FilesParser.name, () => {\n let service: FilesParser\n\n beforeAll(async () => {\n const module: TestingModule = await Test.createTestingModule({\n providers: [FilesParser, { provide: DB_TOKEN_PROVIDER, useValue: {} }]\n }).compile()\n\n service = module.get<FilesParser>(FilesParser)\n })\n\n it('should be defined', () => {\n expect(service).toBeDefined()\n })\n})\n"],"names":["describe","FilesParser","name","service","beforeAll","module","Test","createTestingModule","providers","provide","DB_TOKEN_PROVIDER","useValue","compile","get","it","expect","toBeDefined"],"mappings":";;;;yBAAoC;2BACF;oCACN;AAE5BA,SAASC,+BAAW,CAACC,IAAI,EAAE;IACzB,IAAIC;IAEJC,UAAU;QACR,MAAMC,SAAwB,MAAMC,aAAI,CAACC,mBAAmB,CAAC;YAC3DC,WAAW;gBAACP,+BAAW;gBAAE;oBAAEQ,SAASC,4BAAiB;oBAAEC,UAAU,CAAC;gBAAE;aAAE;QACxE,GAAGC,OAAO;QAEVT,UAAUE,OAAOQ,GAAG,CAAcZ,+BAAW;IAC/C;IAEAa,GAAG,qBAAqB;QACtBC,OAAOZ,SAASa,WAAW;IAC7B;AACF"}
@@ -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
  });
@@ -115,7 +111,10 @@ let FilesQueries = class FilesQueries {
115
111
  if (searchFileInDB?.id === file.id) {
116
112
  return file.id;
117
113
  } else {
118
- this.logger.warn(`${this.getOrCreateUserFile.name} - file mismatch : ${JSON.stringify(searchFileInDB)} !== ${JSON.stringify(file)}`);
114
+ this.logger.warn({
115
+ tag: this.getOrCreateUserFile.name,
116
+ msg: `file mismatch : ${JSON.stringify(searchFileInDB)} !== ${JSON.stringify(file)}`
117
+ });
119
118
  }
120
119
  }
121
120
  return (0, _utils.dbGetInsertedId)(await this.db.insert(_filesschema.files).values({
@@ -138,7 +137,10 @@ let FilesQueries = class FilesQueries {
138
137
  if (searchFileInDB?.id === fileId) {
139
138
  return fileId;
140
139
  } else {
141
- this.logger.warn(`${this.getOrCreateSpaceFile.name} - file mismatch : ${JSON.stringify(dbFile)} -> ${fileId} !== ${searchFileInDB?.id}`);
140
+ this.logger.warn({
141
+ tag: this.getOrCreateSpaceFile.name,
142
+ msg: `file mismatch : ${JSON.stringify(dbFile)} -> ${fileId} !== ${searchFileInDB?.id}`
143
+ });
142
144
  }
143
145
  }
144
146
  // order is important, path is replaced by the FileProps.path
@@ -163,7 +165,10 @@ let FilesQueries = class FilesQueries {
163
165
  try {
164
166
  (0, _utils.dbCheckAffectedRows)(await this.db.update(_filesschema.files).set(file).where((0, _drizzleorm.eq)(_filesschema.files.id, id)), 1);
165
167
  } catch (e) {
166
- this.logger.error(`${this.updateFile.name} - file (${id}) properties was not updated : ${e}`);
168
+ this.logger.error({
169
+ tag: this.updateFile.name,
170
+ msg: `file (${id}) properties was not updated : ${e}`
171
+ });
167
172
  }
168
173
  }
169
174
  async deleteFiles(props, isDir, force = false) {
@@ -249,7 +254,10 @@ let FilesQueries = class FilesQueries {
249
254
  }
250
255
  async compareAndUpdateFileProps(dbFile, fsFile) {
251
256
  if (dbFile.isDir !== fsFile.isDir || dbFile.size !== fsFile.size || dbFile.ctime !== fsFile.ctime || dbFile.mtime !== fsFile.mtime || dbFile.mime !== fsFile.mime) {
252
- this.logger.verbose(`${this.compareAndUpdateFileProps.name} - ${dbFile.path} (${dbFile.id})`);
257
+ this.logger.verbose({
258
+ tag: this.compareAndUpdateFileProps.name,
259
+ msg: `${dbFile.path} (${dbFile.id})`
260
+ });
253
261
  await this.updateFile(dbFile.id, {
254
262
  isDir: fsFile.isDir,
255
263
  size: fsFile.size,
@@ -282,7 +290,10 @@ let FilesQueries = class FilesQueries {
282
290
  try {
283
291
  await this.db.insert(_filesrecentsschema.filesRecents).values(add);
284
292
  } catch (e) {
285
- this.logger.error(`${this.updateRecents.name} - ${e}`);
293
+ this.logger.error({
294
+ tag: this.updateRecents.name,
295
+ msg: `${e}`
296
+ });
286
297
  }
287
298
  }
288
299
  // update
@@ -294,7 +305,10 @@ let FilesQueries = class FilesQueries {
294
305
  ...props
295
306
  }).where((0, _drizzleorm.and)(...where, (0, _drizzleorm.eq)(_filesrecentsschema.filesRecents.id, f.id))).limit(1);
296
307
  } catch (e) {
297
- this.logger.error(`${this.updateRecents.name} - ${e}`);
308
+ this.logger.error({
309
+ tag: this.updateRecents.name,
310
+ msg: `${e}`
311
+ });
298
312
  }
299
313
  }
300
314
  }
@@ -303,7 +317,10 @@ let FilesQueries = class FilesQueries {
303
317
  try {
304
318
  await this.db.delete(_filesrecentsschema.filesRecents).where((0, _drizzleorm.and)(...where, (0, _drizzleorm.inArray)(_filesrecentsschema.filesRecents.id, remove)));
305
319
  } catch (e) {
306
- this.logger.error(`${this.updateRecents.name} - ${e}`);
320
+ this.logger.error({
321
+ tag: this.updateRecents.name,
322
+ msg: `${e}`
323
+ });
307
324
  }
308
325
  }
309
326
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-queries.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 { Inject, Injectable, Logger } from '@nestjs/common'\nimport { and, desc, eq, getTableColumns, inArray, isNull, or, SelectedFields, sql, SQL } from 'drizzle-orm'\nimport { popFromObject } from '../../../common/shared'\nimport { DB_TOKEN_PROVIDER } from '../../../infrastructure/database/constants'\nimport { DBSchema } from '../../../infrastructure/database/interfaces/database.interface'\nimport { concatDistinctObjectsInArray, convertToWhere, dbCheckAffectedRows, dbGetInsertedId } from '../../../infrastructure/database/utils'\nimport { fileHasCommentsSubquerySQL } from '../../comments/schemas/comments.schema'\nimport { shares } from '../../shares/schemas/shares.schema'\nimport { spacesRoots } from '../../spaces/schemas/spaces-roots.schema'\nimport { spaces } from '../../spaces/schemas/spaces.schema'\nimport { syncClients } from '../../sync/schemas/sync-clients.schema'\nimport { syncPaths } from '../../sync/schemas/sync-paths.schema'\nimport { FileDBProps } from '../interfaces/file-db-props.interface'\nimport { FileProps } from '../interfaces/file-props.interface'\nimport { FileRecentLocation } from '../interfaces/file-recent-location.interface'\nimport { FileRecent } from '../schemas/file-recent.interface'\nimport { File } from '../schemas/file.interface'\nimport { filesRecents } from '../schemas/files-recents.schema'\nimport { childFilesFindRegexp, childFilesReplaceRegexp, filePathSQL, files } from '../schemas/files.schema'\nimport { dirName, fileName } from '../utils/files'\n\n@Injectable()\nexport class FilesQueries {\n private readonly logger = new Logger(FilesQueries.name)\n\n constructor(@Inject(DB_TOKEN_PROVIDER) private readonly db: DBSchema) {}\n\n browseFiles(\n userId: number,\n dbFile: FileDBProps,\n options: {\n withSpaces?: boolean\n withShares?: boolean\n withSyncs?: boolean\n withHasComments?: boolean\n ignoreChildShares?: boolean\n }\n ): Promise<FileProps[]> {\n const q = this.db\n .select({\n id: files.id,\n path: files.path,\n name: files.name,\n isDir: files.isDir,\n mime: files.mime,\n size: files.size,\n mtime: files.mtime,\n ctime: files.ctime,\n ...(options.withSpaces && { spaces: concatDistinctObjectsInArray(spaces.id, { id: spaces.id, alias: spaces.alias, name: spaces.name }) }),\n ...(options.withShares && {\n shares: concatDistinctObjectsInArray(shares.id, {\n id: shares.id,\n alias: shares.alias,\n name: shares.name,\n type: shares.type\n })\n }),\n ...(options.withSyncs && {\n syncs: concatDistinctObjectsInArray(syncPaths.id, {\n id: syncPaths.id,\n clientId: syncClients.id,\n clientName: sql`JSON_VALUE(${syncClients.info}, '$.node')`\n })\n }),\n ...(options.withHasComments && { hasComments: sql`${fileHasCommentsSubquerySQL(files.id)}`.mapWith(Boolean) })\n })\n .from(files)\n .where(and(...convertToWhere(files, dbFile)))\n .groupBy(files.id)\n if (options.withSpaces) {\n // show spaces for files in personal space\n q.leftJoin(spacesRoots, eq(spacesRoots.fileId, files.id))\n q.leftJoin(spaces, eq(spaces.id, spacesRoots.spaceId))\n }\n if (options.withShares) {\n q.leftJoin(\n shares,\n and(...[eq(shares.ownerId, userId), eq(shares.fileId, files.id)], ...(options.ignoreChildShares ? [isNull(shares.parentId)] : []))\n )\n }\n if (options.withSyncs) {\n q.leftJoin(syncClients, eq(syncClients.ownerId, userId))\n q.leftJoin(syncPaths, and(eq(syncPaths.clientId, syncClients.id), eq(syncPaths.fileId, files.id)))\n }\n return q\n }\n\n async getUserFile(userId: number, fileId: number): Promise<Pick<File, 'id' | 'path'>> {\n if (fileId > 0) {\n const [fileInDB] = await this.db\n .select({ id: files.id, path: filePathSQL(files) })\n .from(files)\n .where(and(eq(files.ownerId, userId), eq(files.id, fileId)))\n .limit(1)\n return fileInDB\n }\n return null\n }\n\n async getOrCreateUserFile(userId: number, file: FileProps): Promise<number> {\n if (file.id && file.id > 0) {\n const [searchFileInDB] = await this.db\n .select({ id: files.id })\n .from(files)\n .where(and(eq(files.ownerId, userId), eq(files.id, file.id)))\n .limit(1)\n if (searchFileInDB?.id === file.id) {\n return file.id\n } else {\n this.logger.warn(`${this.getOrCreateUserFile.name} - file mismatch : ${JSON.stringify(searchFileInDB)} !== ${JSON.stringify(file)}`)\n }\n }\n return dbGetInsertedId(await this.db.insert(files).values({ ...file, id: undefined, ownerId: userId } as File))\n }\n\n async getOrCreateSpaceFile(fileId: number, file: FileProps, dbFile: FileDBProps): Promise<number> {\n if (fileId && fileId > 0) {\n const fileInDB = {\n ...dbFile,\n name: file.name,\n path: file.path,\n isDir: file.isDir\n }\n const [searchFileInDB] = await this.db\n .select({ id: files.id })\n .from(files)\n .where(and(...convertToWhere(files, fileInDB), eq(files.id, fileId)))\n .limit(1)\n if (searchFileInDB?.id === fileId) {\n return fileId\n } else {\n this.logger.warn(`${this.getOrCreateSpaceFile.name} - file mismatch : ${JSON.stringify(dbFile)} -> ${fileId} !== ${searchFileInDB?.id}`)\n }\n }\n // order is important, path is replaced by the FileProps.path\n return dbGetInsertedId(await this.db.insert(files).values({ ...dbFile, ...file }))\n }\n\n async getSpaceFileId(file: FileProps, dbFile: FileDBProps): Promise<number> {\n const fileInDB = {\n ...dbFile,\n name: file.name,\n path: file.path,\n isDir: file.isDir\n }\n const [searchFileInDB] = await this.db\n .select({ id: files.id })\n .from(files)\n .where(and(...convertToWhere(files, fileInDB)))\n .limit(1)\n return searchFileInDB?.id\n }\n\n async updateFile(id: number, file: Partial<FileProps>): Promise<void> {\n try {\n dbCheckAffectedRows(await this.db.update(files).set(file).where(eq(files.id, id)), 1)\n } catch (e) {\n this.logger.error(`${this.updateFile.name} - file (${id}) properties was not updated : ${e}`)\n }\n }\n\n async deleteFiles(props: FileDBProps, isDir: boolean, force = false): Promise<void> {\n const commonProps: Omit<FileDBProps, 'path'> = {\n ownerId: props.ownerId || null,\n spaceId: props.spaceId || null,\n spaceExternalRootId: props.spaceExternalRootId || null,\n shareExternalId: props.shareExternalId || null,\n inTrash: props.inTrash\n }\n\n // prepare file update/delete\n const fileProps: FileDBProps & { name: string; isDir: boolean } = {\n ...commonProps,\n path: dirName(props.path),\n name: fileName(props.path),\n isDir: isDir\n }\n\n // prepare (or not) the child files update/delete\n const childFiles = isDir ? childFilesFindRegexp(props.path) : null\n if (fileProps.inTrash || force) {\n // delete file\n await this.db.delete(files).where(and(...convertToWhere(files, fileProps)))\n if (childFiles) {\n // delete child files\n await this.db.delete(files).where(and(...[...convertToWhere(files, commonProps), childFiles]))\n }\n } else {\n // move file to trash\n await this.db\n .update(files)\n .set({ inTrash: true } as File)\n .where(and(...convertToWhere(files, fileProps)))\n if (childFiles) {\n // move child files to trash\n await this.db\n .update(files)\n .set({ inTrash: true } as File)\n .where(and(...convertToWhere(files, commonProps), childFiles))\n }\n }\n }\n\n async moveFiles(srcProps: FileDBProps, dstProps: FileDBProps, isDir: boolean): Promise<void> {\n const srcCommonProps: Omit<FileDBProps, 'path'> = {\n ownerId: srcProps.ownerId || null,\n spaceId: srcProps.spaceId || null,\n spaceExternalRootId: srcProps.spaceExternalRootId || null,\n shareExternalId: srcProps.shareExternalId || null,\n inTrash: srcProps.inTrash\n }\n const dstCommonProps: Omit<FileDBProps, 'path'> = {\n ownerId: dstProps.ownerId || null,\n spaceId: dstProps.spaceId || null,\n spaceExternalRootId: dstProps.spaceExternalRootId || null,\n shareExternalId: dstProps.shareExternalId || null,\n inTrash: dstProps.inTrash\n }\n\n // prepare file props update\n const srcFileDB: FileDBProps & { name: string; isDir: boolean } = {\n ...srcCommonProps,\n path: dirName(srcProps.path),\n name: fileName(srcProps.path),\n isDir: isDir\n }\n const dstFileDB: FileDBProps & { name: string; isDir: boolean } = {\n ...dstCommonProps,\n path: dirName(dstProps.path),\n name: fileName(dstProps.path),\n isDir: isDir\n }\n\n // update file props\n await this.db\n .update(files)\n .set(dstFileDB)\n .where(and(...convertToWhere(files, srcFileDB)))\n if (isDir) {\n // prepare child file props update\n const childFiles: SQL<string> = childFilesFindRegexp(srcProps.path)\n const childProps: Omit<FileDBProps, 'path'> & { path: SQL<string> } = {\n ...dstCommonProps,\n path: childFilesReplaceRegexp(srcProps.path, dstProps.path)\n }\n // update child file props\n await this.db\n .update(files)\n .set(childProps)\n .where(and(...convertToWhere(files, srcCommonProps), childFiles))\n }\n }\n\n async compareAndUpdateFileProps(dbFile: FileProps, fsFile: FileProps): Promise<void> {\n if (\n dbFile.isDir !== fsFile.isDir ||\n dbFile.size !== fsFile.size ||\n dbFile.ctime !== fsFile.ctime ||\n dbFile.mtime !== fsFile.mtime ||\n dbFile.mime !== fsFile.mime\n ) {\n this.logger.verbose(`${this.compareAndUpdateFileProps.name} - ${dbFile.path} (${dbFile.id})`)\n await this.updateFile(dbFile.id, {\n isDir: fsFile.isDir,\n size: fsFile.size,\n ctime: fsFile.ctime,\n mtime: fsFile.mtime,\n mime: fsFile.mime\n })\n }\n }\n\n getRecentsFromUser(userId: number, spaceIds: number[], shareIds: number[], limit = 10): Promise<FileRecent[]> {\n return this.db\n .select({\n id: filesRecents.id,\n ownerId: sql<number>`IF(${filesRecents.ownerId} IS NULL, 0, 1)`.as('ownerId'),\n spaceId: sql<number>`IF(${filesRecents.spaceId} IS NULL, 0, 1)`.as('spaceId'),\n shareId: sql<number>`IF(${filesRecents.shareId} IS NULL, 0, 1)`.as('shareId'),\n path: filesRecents.path,\n name: filesRecents.name,\n mime: filesRecents.mime,\n mtime: filesRecents.mtime\n } satisfies FileRecent | SelectedFields<any, any>)\n .from(filesRecents)\n .where(or(eq(filesRecents.ownerId, userId), inArray(filesRecents.spaceId, spaceIds), inArray(filesRecents.shareId, shareIds)))\n .groupBy(filesRecents.id)\n .orderBy(desc(filesRecents.mtime))\n .limit(limit)\n }\n\n getRecentsFromLocation(location: Partial<Record<keyof FileRecent, any>>): Promise<FileRecent[]> {\n const where: SQL[] = convertToWhere(filesRecents, location)\n return this.db\n .select(getTableColumns(filesRecents))\n .from(filesRecents)\n .where(and(...where))\n }\n\n async updateRecents(\n location: FileRecentLocation,\n add: Partial<FileRecent>[] | FileRecent[],\n update: Record<string | 'object', Partial<FileProps> | FileProps>[],\n remove: FileRecent['id'][]\n ): Promise<void> {\n const where: SQL[] = convertToWhere(filesRecents, location)\n // add\n if (add.length) {\n try {\n await this.db.insert(filesRecents).values(add as FileRecent[])\n } catch (e) {\n this.logger.error(`${this.updateRecents.name} - ${e}`)\n }\n }\n // update\n if (update.length) {\n for (const props of update) {\n const f: FileProps = popFromObject('object', props)\n try {\n await this.db\n .update(filesRecents)\n .set({ ...props })\n .where(and(...where, eq(filesRecents.id, f.id)))\n .limit(1)\n } catch (e) {\n this.logger.error(`${this.updateRecents.name} - ${e}`)\n }\n }\n }\n // remove\n if (remove.length) {\n try {\n await this.db.delete(filesRecents).where(and(...where, inArray(filesRecents.id, remove)))\n } catch (e) {\n this.logger.error(`${this.updateRecents.name} - ${e}`)\n }\n }\n }\n}\n"],"names":["FilesQueries","browseFiles","userId","dbFile","options","q","db","select","id","files","path","name","isDir","mime","size","mtime","ctime","withSpaces","spaces","concatDistinctObjectsInArray","alias","withShares","shares","type","withSyncs","syncs","syncPaths","clientId","syncClients","clientName","sql","info","withHasComments","hasComments","fileHasCommentsSubquerySQL","mapWith","Boolean","from","where","and","convertToWhere","groupBy","leftJoin","spacesRoots","eq","fileId","spaceId","ownerId","ignoreChildShares","isNull","parentId","getUserFile","fileInDB","filePathSQL","limit","getOrCreateUserFile","file","searchFileInDB","logger","warn","JSON","stringify","dbGetInsertedId","insert","values","undefined","getOrCreateSpaceFile","getSpaceFileId","updateFile","dbCheckAffectedRows","update","set","e","error","deleteFiles","props","force","commonProps","spaceExternalRootId","shareExternalId","inTrash","fileProps","dirName","fileName","childFiles","childFilesFindRegexp","delete","moveFiles","srcProps","dstProps","srcCommonProps","dstCommonProps","srcFileDB","dstFileDB","childProps","childFilesReplaceRegexp","compareAndUpdateFileProps","fsFile","verbose","getRecentsFromUser","spaceIds","shareIds","filesRecents","as","shareId","or","inArray","orderBy","desc","getRecentsFromLocation","location","getTableColumns","updateRecents","add","remove","length","f","popFromObject","Logger"],"mappings":"AAAA;;;;CAIC;;;;+BAwBYA;;;eAAAA;;;wBAtB8B;4BACmD;wBAChE;2BACI;mCACT;uBAC0E;gCACxD;8BACpB;mCACK;8BACL;mCACK;iCACF;oCAMG;6BACqD;u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AAC;wBAAE,GAAGI,KAAK;oBAAC,GACfrC,KAAK,CAACC,IAAAA,eAAG,KAAID,OAAOM,IAAAA,cAAE,EAAC0D,gCAAY,CAAC9F,EAAE,EAAE4G,EAAE5G,EAAE,IAC5C8C,KAAK,CAAC;gBACX,EAAE,OAAOkB,GAAG;oBACV,IAAI,CAACd,MAAM,CAACe,KAAK,CAAC,GAAG,IAAI,CAACuC,aAAa,CAACrG,IAAI,CAAC,GAAG,EAAE6D,GAAG;gBACvD;YACF;QACF;QACA,SAAS;QACT,IAAI0C,OAAOC,MAAM,EAAE;YACjB,IAAI;gBACF,MAAM,IAAI,CAAC7G,EAAE,CAACgF,MAAM,CAACgB,gCAAY,EAAEhE,KAAK,CAACC,IAAAA,eAAG,KAAID,OAAOoE,IAAAA,mBAAO,EAACJ,gCAAY,CAAC9F,EAAE,EAAE0G;YAClF,EAAE,OAAO1C,GAAG;gBACV,IAAI,CAACd,MAAM,CAACe,KAAK,CAAC,GAAG,IAAI,CAACuC,aAAa,CAACrG,IAAI,CAAC,GAAG,EAAE6D,GAAG;YACvD;QACF;IACF;IAxTA,YAAY,AAA4ClE,EAAY,CAAE;aAAdA,KAAAA;aAFvCoD,SAAS,IAAI4D,cAAM,CAACtH,aAAaW,IAAI;IAEiB;AAyTzE"}
1
+ {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-queries.service.ts"],"sourcesContent":["import { Inject, Injectable, Logger } from '@nestjs/common'\nimport { and, desc, eq, getTableColumns, inArray, isNull, or, SelectedFields, sql, SQL } from 'drizzle-orm'\nimport { popFromObject } from '../../../common/shared'\nimport { DB_TOKEN_PROVIDER } from '../../../infrastructure/database/constants'\nimport { DBSchema } from '../../../infrastructure/database/interfaces/database.interface'\nimport { concatDistinctObjectsInArray, convertToWhere, dbCheckAffectedRows, dbGetInsertedId } from '../../../infrastructure/database/utils'\nimport { fileHasCommentsSubquerySQL } from '../../comments/schemas/comments.schema'\nimport { shares } from '../../shares/schemas/shares.schema'\nimport { spacesRoots } from '../../spaces/schemas/spaces-roots.schema'\nimport { spaces } from '../../spaces/schemas/spaces.schema'\nimport { syncClients } from '../../sync/schemas/sync-clients.schema'\nimport { syncPaths } from '../../sync/schemas/sync-paths.schema'\nimport { FileDBProps } from '../interfaces/file-db-props.interface'\nimport { FileProps } from '../interfaces/file-props.interface'\nimport { FileRecentLocation } from '../interfaces/file-recent-location.interface'\nimport { FileRecent } from '../schemas/file-recent.interface'\nimport { File } from '../schemas/file.interface'\nimport { filesRecents } from '../schemas/files-recents.schema'\nimport { childFilesFindRegexp, childFilesReplaceRegexp, filePathSQL, files } from '../schemas/files.schema'\nimport { dirName, fileName } from '../utils/files'\n\n@Injectable()\nexport class FilesQueries {\n private readonly logger = new Logger(FilesQueries.name)\n\n constructor(@Inject(DB_TOKEN_PROVIDER) private readonly db: DBSchema) {}\n\n browseFiles(\n userId: number,\n dbFile: FileDBProps,\n options: {\n withSpaces?: boolean\n withShares?: boolean\n withSyncs?: boolean\n withHasComments?: boolean\n ignoreChildShares?: boolean\n }\n ): Promise<FileProps[]> {\n const q = this.db\n .select({\n id: files.id,\n path: files.path,\n name: files.name,\n isDir: files.isDir,\n mime: files.mime,\n size: files.size,\n mtime: files.mtime,\n ctime: files.ctime,\n ...(options.withSpaces && { spaces: concatDistinctObjectsInArray(spaces.id, { id: spaces.id, alias: spaces.alias, name: spaces.name }) }),\n ...(options.withShares && {\n shares: concatDistinctObjectsInArray(shares.id, {\n id: shares.id,\n alias: shares.alias,\n name: shares.name,\n type: shares.type\n })\n }),\n ...(options.withSyncs && {\n syncs: concatDistinctObjectsInArray(syncPaths.id, {\n id: syncPaths.id,\n clientId: syncClients.id,\n clientName: sql`JSON_VALUE(${syncClients.info}, '$.node')`\n })\n }),\n ...(options.withHasComments && { hasComments: sql`${fileHasCommentsSubquerySQL(files.id)}`.mapWith(Boolean) })\n })\n .from(files)\n .where(and(...convertToWhere(files, dbFile)))\n .groupBy(files.id)\n if (options.withSpaces) {\n // show spaces for files in personal space\n q.leftJoin(spacesRoots, eq(spacesRoots.fileId, files.id))\n q.leftJoin(spaces, eq(spaces.id, spacesRoots.spaceId))\n }\n if (options.withShares) {\n q.leftJoin(\n shares,\n and(...[eq(shares.ownerId, userId), eq(shares.fileId, files.id)], ...(options.ignoreChildShares ? [isNull(shares.parentId)] : []))\n )\n }\n if (options.withSyncs) {\n q.leftJoin(syncClients, eq(syncClients.ownerId, userId))\n q.leftJoin(syncPaths, and(eq(syncPaths.clientId, syncClients.id), eq(syncPaths.fileId, files.id)))\n }\n return q\n }\n\n async getUserFile(userId: number, fileId: number): Promise<Pick<File, 'id' | 'path'>> {\n if (fileId > 0) {\n const [fileInDB] = await this.db\n .select({ id: files.id, path: filePathSQL(files) })\n .from(files)\n .where(and(eq(files.ownerId, userId), eq(files.id, fileId)))\n .limit(1)\n return fileInDB\n }\n return null\n }\n\n async getOrCreateUserFile(userId: number, file: FileProps): Promise<number> {\n if (file.id && file.id > 0) {\n const [searchFileInDB] = await this.db\n .select({ id: files.id })\n .from(files)\n .where(and(eq(files.ownerId, userId), eq(files.id, file.id)))\n .limit(1)\n if (searchFileInDB?.id === file.id) {\n return file.id\n } else {\n this.logger.warn({ tag: this.getOrCreateUserFile.name, msg: `file mismatch : ${JSON.stringify(searchFileInDB)} !== ${JSON.stringify(file)}` })\n }\n }\n return dbGetInsertedId(await this.db.insert(files).values({ ...file, id: undefined, ownerId: userId } as File))\n }\n\n async getOrCreateSpaceFile(fileId: number, file: FileProps, dbFile: FileDBProps): Promise<number> {\n if (fileId && fileId > 0) {\n const fileInDB = {\n ...dbFile,\n name: file.name,\n path: file.path,\n isDir: file.isDir\n }\n const [searchFileInDB] = await this.db\n .select({ id: files.id })\n .from(files)\n .where(and(...convertToWhere(files, fileInDB), eq(files.id, fileId)))\n .limit(1)\n if (searchFileInDB?.id === fileId) {\n return fileId\n } else {\n this.logger.warn({\n tag: this.getOrCreateSpaceFile.name,\n msg: `file mismatch : ${JSON.stringify(dbFile)} -> ${fileId} !== ${searchFileInDB?.id}`\n })\n }\n }\n // order is important, path is replaced by the FileProps.path\n return dbGetInsertedId(await this.db.insert(files).values({ ...dbFile, ...file }))\n }\n\n async getSpaceFileId(file: FileProps, dbFile: FileDBProps): Promise<number> {\n const fileInDB = {\n ...dbFile,\n name: file.name,\n path: file.path,\n isDir: file.isDir\n }\n const [searchFileInDB] = await this.db\n .select({ id: files.id })\n .from(files)\n .where(and(...convertToWhere(files, fileInDB)))\n .limit(1)\n return searchFileInDB?.id\n }\n\n async updateFile(id: number, file: Partial<FileProps>): Promise<void> {\n try {\n dbCheckAffectedRows(await this.db.update(files).set(file).where(eq(files.id, id)), 1)\n } catch (e) {\n this.logger.error({ tag: this.updateFile.name, msg: `file (${id}) properties was not updated : ${e}` })\n }\n }\n\n async deleteFiles(props: FileDBProps, isDir: boolean, force = false): Promise<void> {\n const commonProps: Omit<FileDBProps, 'path'> = {\n ownerId: props.ownerId || null,\n spaceId: props.spaceId || null,\n spaceExternalRootId: props.spaceExternalRootId || null,\n shareExternalId: props.shareExternalId || null,\n inTrash: props.inTrash\n }\n\n // prepare file update/delete\n const fileProps: FileDBProps & { name: string; isDir: boolean } = {\n ...commonProps,\n path: dirName(props.path),\n name: fileName(props.path),\n isDir: isDir\n }\n\n // prepare (or not) the child files update/delete\n const childFiles = isDir ? childFilesFindRegexp(props.path) : null\n if (fileProps.inTrash || force) {\n // delete file\n await this.db.delete(files).where(and(...convertToWhere(files, fileProps)))\n if (childFiles) {\n // delete child files\n await this.db.delete(files).where(and(...[...convertToWhere(files, commonProps), childFiles]))\n }\n } else {\n // move file to trash\n await this.db\n .update(files)\n .set({ inTrash: true } as File)\n .where(and(...convertToWhere(files, fileProps)))\n if (childFiles) {\n // move child files to trash\n await this.db\n .update(files)\n .set({ inTrash: true } as File)\n .where(and(...convertToWhere(files, commonProps), childFiles))\n }\n }\n }\n\n async moveFiles(srcProps: FileDBProps, dstProps: FileDBProps, isDir: boolean): Promise<void> {\n const srcCommonProps: Omit<FileDBProps, 'path'> = {\n ownerId: srcProps.ownerId || null,\n spaceId: srcProps.spaceId || null,\n spaceExternalRootId: srcProps.spaceExternalRootId || null,\n shareExternalId: srcProps.shareExternalId || null,\n inTrash: srcProps.inTrash\n }\n const dstCommonProps: Omit<FileDBProps, 'path'> = {\n ownerId: dstProps.ownerId || null,\n spaceId: dstProps.spaceId || null,\n spaceExternalRootId: dstProps.spaceExternalRootId || null,\n shareExternalId: dstProps.shareExternalId || null,\n inTrash: dstProps.inTrash\n }\n\n // prepare file props update\n const srcFileDB: FileDBProps & { name: string; isDir: boolean } = {\n ...srcCommonProps,\n path: dirName(srcProps.path),\n name: fileName(srcProps.path),\n isDir: isDir\n }\n const dstFileDB: FileDBProps & { name: string; isDir: boolean } = {\n ...dstCommonProps,\n path: dirName(dstProps.path),\n name: fileName(dstProps.path),\n isDir: isDir\n }\n\n // update file props\n await this.db\n .update(files)\n .set(dstFileDB)\n .where(and(...convertToWhere(files, srcFileDB)))\n if (isDir) {\n // prepare child file props update\n const childFiles: SQL<string> = childFilesFindRegexp(srcProps.path)\n const childProps: Omit<FileDBProps, 'path'> & { path: SQL<string> } = {\n ...dstCommonProps,\n path: childFilesReplaceRegexp(srcProps.path, dstProps.path)\n }\n // update child file props\n await this.db\n .update(files)\n .set(childProps)\n .where(and(...convertToWhere(files, srcCommonProps), childFiles))\n }\n }\n\n async compareAndUpdateFileProps(dbFile: FileProps, fsFile: FileProps): Promise<void> {\n if (\n dbFile.isDir !== fsFile.isDir ||\n dbFile.size !== fsFile.size ||\n dbFile.ctime !== fsFile.ctime ||\n dbFile.mtime !== fsFile.mtime ||\n dbFile.mime !== fsFile.mime\n ) {\n this.logger.verbose({ tag: this.compareAndUpdateFileProps.name, msg: `${dbFile.path} (${dbFile.id})` })\n await this.updateFile(dbFile.id, {\n isDir: fsFile.isDir,\n size: fsFile.size,\n ctime: fsFile.ctime,\n mtime: fsFile.mtime,\n mime: fsFile.mime\n })\n }\n }\n\n getRecentsFromUser(userId: number, spaceIds: number[], shareIds: number[], limit = 10): Promise<FileRecent[]> {\n return this.db\n .select({\n id: filesRecents.id,\n ownerId: sql<number>`IF(${filesRecents.ownerId} IS NULL, 0, 1)`.as('ownerId'),\n spaceId: sql<number>`IF(${filesRecents.spaceId} IS NULL, 0, 1)`.as('spaceId'),\n shareId: sql<number>`IF(${filesRecents.shareId} IS NULL, 0, 1)`.as('shareId'),\n path: filesRecents.path,\n name: filesRecents.name,\n mime: filesRecents.mime,\n mtime: filesRecents.mtime\n } satisfies FileRecent | SelectedFields<any, any>)\n .from(filesRecents)\n .where(or(eq(filesRecents.ownerId, userId), inArray(filesRecents.spaceId, spaceIds), inArray(filesRecents.shareId, shareIds)))\n .groupBy(filesRecents.id)\n .orderBy(desc(filesRecents.mtime))\n .limit(limit)\n }\n\n getRecentsFromLocation(location: Partial<Record<keyof FileRecent, any>>): Promise<FileRecent[]> {\n const where: SQL[] = convertToWhere(filesRecents, location)\n return this.db\n .select(getTableColumns(filesRecents))\n .from(filesRecents)\n .where(and(...where))\n }\n\n async updateRecents(\n location: FileRecentLocation,\n add: Partial<FileRecent>[] | FileRecent[],\n update: Record<string | 'object', Partial<FileProps> | FileProps>[],\n remove: FileRecent['id'][]\n ): Promise<void> {\n const where: SQL[] = convertToWhere(filesRecents, location)\n // add\n if (add.length) {\n try {\n await this.db.insert(filesRecents).values(add as FileRecent[])\n } catch (e) {\n this.logger.error({ tag: this.updateRecents.name, msg: `${e}` })\n }\n }\n // update\n if (update.length) {\n for (const props of update) {\n const f: FileProps = popFromObject('object', props)\n try {\n await this.db\n .update(filesRecents)\n .set({ ...props })\n .where(and(...where, eq(filesRecents.id, f.id)))\n .limit(1)\n } catch (e) {\n this.logger.error({ tag: this.updateRecents.name, msg: `${e}` })\n }\n }\n }\n // remove\n if (remove.length) {\n try {\n await this.db.delete(filesRecents).where(and(...where, inArray(filesRecents.id, remove)))\n } catch (e) {\n this.logger.error({ tag: this.updateRecents.name, msg: `${e}` })\n }\n }\n }\n}\n"],"names":["FilesQueries","browseFiles","userId","dbFile","options","q","db","select","id","files","path","name","isDir","mime","size","mtime","ctime","withSpaces","spaces","concatDistinctObjectsInArray","alias","withShares","shares","type","withSyncs","syncs","syncPaths","clientId","syncClients","clientName","sql","info","withHasComments","hasComments","fileHasCommentsSubquerySQL","mapWith","Boolean","from","where","and","convertToWhere","groupBy","leftJoin","spacesRoots","eq","fileId","spaceId","ownerId","ignoreChildShares","isNull","parentId","getUserFile","fileInDB","filePathSQL","limit","getOrCreateUserFile","file","searchFileInDB","logger","warn","tag","msg","JSON","stringify","dbGetInsertedId","insert","values","undefined","getOrCreateSpaceFile","getSpaceFileId","updateFile","dbCheckAffectedRows","update","set","e","error","deleteFiles","props","force","commonProps","spaceExternalRootId","shareExternalId","inTrash","fileProps","dirName","fileName","childFiles","childFilesFindRegexp","delete","moveFiles","srcProps","dstProps","srcCommonProps","dstCommonProps","srcFileDB","dstFileDB","childProps","childFilesReplaceRegexp","compareAndUpdateFileProps","fsFile","verbose","getRecentsFromUser","spaceIds","shareIds","filesRecents","as","shareId","or","inArray","orderBy","desc","getRecentsFromLocation","location","getTableColumns","updateRecents","add","remove","length","f","popFromObject","Logger"],"mappings":";;;;+BAsBaA;;;eAAAA;;;wBAtB8B;4BACmD;wBAChE;2BACI;mCACT;uBAC0E;gCACxD;8BACpB;mCACK;8BACL;mCACK;iCACF;oCAMG;6BACqD;uBAChD;;;;;;;;;;;;;;;AAG3B,IAAA,AAAMA,eAAN,MAAMA;IAKXC,YACEC,MAAc,EACdC,MAAmB,EACnBC,OAMC,EACqB;QACtB,MAAMC,IAAI,IAAI,CAACC,EAAE,CACdC,MAAM,CAAC;YACNC,IAAIC,kBAAK,CAACD,EAAE;YACZE,MAAMD,kBAAK,CAACC,IAAI;YAChBC,MAAMF,kBAAK,CAACE,IAAI;YAChBC,OAAOH,kBAAK,CAACG,KAAK;YAClBC,MAAMJ,kBAAK,CAACI,IAAI;YAChBC,MAAML,kBAAK,CAACK,IAAI;YAChBC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BAAEf,KAAK,IAAI,CAACsD,aAAa,CAACvG,IAAI;wBAAEkD,KAAK,GAAGa,GAAG;oBAAC;gBAChE;YACF;QACF;QACA,SAAS;QACT,IAAI0C,OAAOC,MAAM,EAAE;YACjB,IAAI;gBACF,MAAM,IAAI,CAAC/G,EAAE,CAACkF,MAAM,CAACgB,gCAAY,EAAElE,KAAK,CAACC,IAAAA,eAAG,KAAID,OAAOsE,IAAAA,mBAAO,EAACJ,gCAAY,CAAChG,EAAE,EAAE4G;YAClF,EAAE,OAAO1C,GAAG;gBACV,IAAI,CAAChB,MAAM,CAACiB,KAAK,CAAC;oBAAEf,KAAK,IAAI,CAACsD,aAAa,CAACvG,IAAI;oBAAEkD,KAAK,GAAGa,GAAG;gBAAC;YAChE;QACF;IACF;IA3TA,YAAY,AAA4CpE,EAAY,CAAE;aAAdA,KAAAA;aAFvCoD,SAAS,IAAI8D,cAAM,CAACxH,aAAaW,IAAI;IAEiB;AA4TzE"}
@@ -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
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-recents.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 { Injectable } from '@nestjs/common'\nimport { convertDiffUpdate, convertHumanTimeToMs, diffCollection } from '../../../common/functions'\nimport { currentTimeStamp } from '../../../common/shared'\nimport { SharesQueries } from '../../shares/services/shares-queries.service'\nimport { SpaceEnv } from '../../spaces/models/space-env.model'\nimport { SpacesQueries } from '../../spaces/services/spaces-queries.service'\nimport { UserModel } from '../../users/models/user.model'\nimport { FileProps } from '../interfaces/file-props.interface'\nimport { FileRecentLocation } from '../interfaces/file-recent-location.interface'\nimport { FileRecent } from '../schemas/file-recent.interface'\nimport { FilesQueries } from './files-queries.service'\n\n@Injectable()\nexport class FilesRecents {\n private readonly keepTime = '14d'\n\n constructor(\n private readonly filesQueries: FilesQueries,\n private readonly spacesQueries: SpacesQueries,\n private readonly sharesQueries: SharesQueries\n ) {}\n\n async getRecents(user: UserModel, limit: number): Promise<FileRecent[]> {\n const [spaceIds, shareIds] = await Promise.all([this.spacesQueries.spaceIds(user.id), this.sharesQueries.shareIds(user.id, +user.isAdmin)])\n return this.filesQueries.getRecentsFromUser(user.id, spaceIds, shareIds, limit)\n }\n\n async updateRecents(user: UserModel, space: SpaceEnv, files: FileProps[]): Promise<void> {\n if (space.inTrashRepository) {\n // Ignore trashed files\n return\n }\n const timestamp = currentTimeStamp(null, true) - convertHumanTimeToMs(this.keepTime)\n const location = this.getLocation(user, space, files)\n // only store files, ignore dirs\n const fsRecents = files.filter((f) => !f.isDir && f.size > 0 && f.mtime > timestamp)\n const dbRecents = await this.filesQueries.getRecentsFromLocation(location)\n if (!fsRecents.length && !dbRecents.length) {\n return\n }\n const [add, update, remove] = diffCollection(dbRecents as any, fsRecents as any, ['mtime', 'name'])\n const toAdd: Partial<FileRecent>[] = add.map(\n (f: FileProps): Partial<FileRecent> =>\n ({\n id: f.id,\n name: f.name,\n mtime: f.mtime,\n mime: f.mime,\n ...location,\n ...(space.inSharesList && { shareId: f.root.id })\n }) as FileRecent\n )\n const toUpdate: Record<string | 'object', Partial<FileProps> | FileProps>[] = convertDiffUpdate(update)\n const toRemove: number[] = remove.map((f: FileRecent) => f.id)\n await this.filesQueries.updateRecents(location, toAdd, toUpdate, toRemove)\n }\n\n private getLocation(user: UserModel, space: SpaceEnv, files: FileProps[]): FileRecentLocation {\n const location: FileRecentLocation = { path: space.url }\n if (space.inPersonalSpace) {\n location.ownerId = user.id\n } else if (space.inSharesList) {\n location.shareId = files.map((f) => f.root.id)\n } else if (space.inSharesRepository) {\n location.shareId = space.id\n } else {\n location.spaceId = space.id\n }\n return location\n }\n}\n"],"names":["FilesRecents","getRecents","user","limit","spaceIds","shareIds","Promise","all","spacesQueries","id","sharesQueries","isAdmin","filesQueries","getRecentsFromUser","updateRecents","space","files","inTrashRepository","timestamp","currentTimeStamp","convertHumanTimeToMs","keepTime","location","getLocation","fsRecents","filter","f","isDir","size","mtime","dbRecents","getRecentsFromLocation","length","add","update","remove","diffCollection","toAdd","map","name","mime","inSharesList","shareId","root","toUpdate","convertDiffUpdate","toRemove","path","url","inPersonalSpace","ownerId","inSharesRepository","spaceId"],"mappings":"AAAA;;;;CAIC;;;;+BAeYA;;;eAAAA;;;wBAbc;2BAC6C;wBACvC;sCACH;sCAEA;qCAKD;;;;;;;;;;AAGtB,IAAA,AAAMA,eAAN,MAAMA;IASX,MAAMC,WAAWC,IAAe,EAAEC,KAAa,EAAyB;QACtE,MAAM,CAACC,UAAUC,SAAS,GAAG,MAAMC,QAAQC,GAAG,CAAC;YAAC,IAAI,CAACC,aAAa,CAACJ,QAAQ,CAACF,KAAKO,EAAE;YAAG,IAAI,CAACC,aAAa,CAACL,QAAQ,CAACH,KAAKO,EAAE,EAAE,CAACP,KAAKS,OAAO;SAAE;QAC1I,OAAO,IAAI,CAACC,YAAY,CAACC,kBAAkB,CAACX,KAAKO,EAAE,EAAEL,UAAUC,UAAUF;IAC3E;IAEA,MAAMW,cAAcZ,IAAe,EAAEa,KAAe,EAAEC,KAAkB,EAAiB;QACvF,IAAID,MAAME,iBAAiB,EAAE;YAC3B,uBAAuB;YACvB;QACF;QACA,MAAMC,YAAYC,IAAAA,wBAAgB,EAAC,MAAM,QAAQC,IAAAA,+BAAoB,EAAC,IAAI,CAACC,QAAQ;QACnF,MAAMC,WAAW,IAAI,CAACC,WAAW,CAACrB,MAAMa,OAAOC;QAC/C,gCAAgC;QAChC,MAAMQ,YAAYR,MAAMS,MAAM,CAAC,CAACC,IAAM,CAACA,EAAEC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La,SAAS8B,OAAO,GAAGrC,MAAMN,EAAE;QAC7B;QACA,OAAOa;IACT;IArDA,YACE,AAAiBV,YAA0B,EAC3C,AAAiBJ,aAA4B,EAC7C,AAAiBE,aAA4B,CAC7C;aAHiBE,eAAAA;aACAJ,gBAAAA;aACAE,gBAAAA;aALFW,WAAW;IAMzB;AAkDL"}
1
+ {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-recents.service.ts"],"sourcesContent":["import { Injectable } from '@nestjs/common'\nimport { convertDiffUpdate, convertHumanTimeToMs, diffCollection } from '../../../common/functions'\nimport { currentTimeStamp } from '../../../common/shared'\nimport { SharesQueries } from '../../shares/services/shares-queries.service'\nimport { SpaceEnv } from '../../spaces/models/space-env.model'\nimport { SpacesQueries } from '../../spaces/services/spaces-queries.service'\nimport { UserModel } from '../../users/models/user.model'\nimport { FileProps } from '../interfaces/file-props.interface'\nimport { FileRecentLocation } from '../interfaces/file-recent-location.interface'\nimport { FileRecent } from '../schemas/file-recent.interface'\nimport { FilesQueries } from './files-queries.service'\n\n@Injectable()\nexport class FilesRecents {\n private readonly keepTime = '14d'\n\n constructor(\n private readonly filesQueries: FilesQueries,\n private readonly spacesQueries: SpacesQueries,\n private readonly sharesQueries: SharesQueries\n ) {}\n\n async getRecents(user: UserModel, limit: number): Promise<FileRecent[]> {\n const [spaceIds, shareIds] = await Promise.all([this.spacesQueries.spaceIds(user.id), this.sharesQueries.shareIds(user.id, +user.isAdmin)])\n return this.filesQueries.getRecentsFromUser(user.id, spaceIds, shareIds, limit)\n }\n\n async updateRecents(user: UserModel, space: SpaceEnv, files: FileProps[]): Promise<void> {\n if (space.inTrashRepository) {\n // Ignore trashed files\n return\n }\n const timestamp = currentTimeStamp(null, true) - convertHumanTimeToMs(this.keepTime)\n const location = this.getLocation(user, space, files)\n // only store files, ignore dirs\n const fsRecents = files.filter((f) => !f.isDir && f.size > 0 && f.mtime > timestamp)\n const dbRecents = await this.filesQueries.getRecentsFromLocation(location)\n if (!fsRecents.length && !dbRecents.length) {\n return\n }\n const [add, update, remove] = diffCollection(dbRecents as any, fsRecents as any, ['mtime', 'name'])\n const toAdd: Partial<FileRecent>[] = add.map(\n (f: FileProps): Partial<FileRecent> =>\n ({\n id: f.id,\n name: f.name,\n mtime: f.mtime,\n mime: f.mime,\n ...location,\n ...(space.inSharesList && { shareId: f.root.id })\n }) as FileRecent\n )\n const toUpdate: Record<string | 'object', Partial<FileProps> | FileProps>[] = convertDiffUpdate(update)\n const toRemove: number[] = remove.map((f: FileRecent) => f.id)\n await this.filesQueries.updateRecents(location, toAdd, toUpdate, toRemove)\n }\n\n private getLocation(user: UserModel, space: SpaceEnv, files: FileProps[]): FileRecentLocation {\n const location: FileRecentLocation = { path: space.url }\n if (space.inPersonalSpace) {\n location.ownerId = user.id\n } else if (space.inSharesList) {\n location.shareId = files.map((f) => f.root.id)\n } else if (space.inSharesRepository) {\n location.shareId = space.id\n } else {\n location.spaceId = space.id\n }\n return location\n }\n}\n"],"names":["FilesRecents","getRecents","user","limit","spaceIds","shareIds","Promise","all","spacesQueries","id","sharesQueries","isAdmin","filesQueries","getRecentsFromUser","updateRecents","space","files","inTrashRepository","timestamp","currentTimeStamp","convertHumanTimeToMs","keepTime","location","getLocation","fsRecents","filter","f","isDir","size","mtime","dbRecents","getRecentsFromLocation","length","add","update","remove","diffCollection","toAdd","map","name","mime","inSharesList","shareId","root","toUpdate","convertDiffUpdate","toRemove","path","url","inPersonalSpace","ownerId","inSharesRepository","spaceId"],"mappings":";;;;+BAaaA;;;eAAAA;;;wBAbc;2BAC6C;wBACvC;sCACH;sCAEA;qCAKD;;;;;;;;;;AAGtB,IAAA,AAAMA,eAAN,MAAMA;IASX,MAAMC,WAAWC,IAAe,EAAEC,KAAa,EAAyB;QACtE,MAAM,CAACC,UAAUC,SAAS,GAAG,MAAMC,QAAQC,GAAG,CAAC;YAAC,IAAI,CAACC,aAAa,CAACJ,QAAQ,CAACF,KAAKO,EAAE;YAAG,IAAI,CAACC,aAAa,C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;QAC7D,MAAM,IAAI,CAACG,YAAY,CAACE,aAAa,CAACQ,UAAUe,OAAOO,UAAUE;IACnE;IAEQvB,YAAYrB,IAAe,EAAEa,KAAe,EAAEC,KAAkB,EAAsB;QAC5F,MAAMM,WAA+B;YAAEyB,MAAMhC,MAAMiC,GAAG;QAAC;QACvD,IAAIjC,MAAMkC,eAAe,EAAE;YACzB3B,SAAS4B,OAAO,GAAGhD,KAAKO,EAAE;QAC5B,OAAO,IAAIM,MAAM0B,YAAY,EAAE;YAC7BnB,SAASoB,OAAO,GAAG1B,MAAMsB,GAAG,CAAC,CAACZ,IAAMA,EAAEiB,IAAI,CAAClC,EAAE;QAC/C,OAAO,IAAIM,MAAMoC,kBAAkB,EAAE;YACnC7B,SAASoB,OAAO,GAAG3B,MAAMN,EAAE;QAC7B,OAAO;YACLa,SAAS8B,OAAO,GAAGrC,MAAMN,EAAE;QAC7B;QACA,OAAOa;IACT;IArDA,YACE,AAAiBV,YAA0B,EAC3C,AAAiBJ,aAA4B,EAC7C,AAAiBE,aAA4B,CAC7C;aAHiBE,eAAAA;aACAJ,gBAAAA;aACAE,gBAAAA;aALFW,WAAW;IAMzB;AAkDL"}
@@ -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
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-recents.service.spec.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 { Test, TestingModule } from '@nestjs/testing'\nimport { SharesQueries } from '../../shares/services/shares-queries.service'\nimport { SpacesQueries } from '../../spaces/services/spaces-queries.service'\nimport { FilesQueries } from './files-queries.service'\nimport { FilesRecents } from './files-recents.service'\n\ndescribe(FilesRecents.name, () => {\n let service: FilesRecents\n\n beforeAll(async () => {\n const module: TestingModule = await Test.createTestingModule({\n providers: [\n FilesRecents,\n { provide: FilesQueries, useValue: {} },\n { provide: SpacesQueries, useValue: {} },\n {\n provide: SharesQueries,\n useValue: {}\n }\n ]\n }).compile()\n\n service = module.get<FilesRecents>(FilesRecents)\n })\n\n it('should be defined', () => {\n expect(service).toBeDefined()\n })\n})\n"],"names":["describe","FilesRecents","name","service","beforeAll","module","Test","createTestingModule","providers","provide","FilesQueries","useValue","SpacesQueries","SharesQueries","compile","get","it","expect","toBeDefined"],"mappings":"AAAA;;;;CAIC;;;;yBAEmC;sCACN;sCACA;qCACD;qCACA;AAE7BA,SAASC,iCAAY,CAACC,IAAI,EAAE;IAC1B,IAAIC;IAEJC,UAAU;QACR,MAAMC,SAAwB,MAAMC,aAAI,CAACC,mBAAmB,CAAC;YAC3DC,WAAW;gBACTP,iCAAY;gBACZ;oBAAEQ,SAASC,iCAAY;oBAAEC,UAAU,CAAC;gBAAE;gBACtC;oBAAEF,SAASG,mCAAa;oBAAED,UAAU,CAAC;gBAAE;gBACvC;oBACEF,SAASI,mCAAa;oBACtBF,UAAU,CAAC;gBACb;aACD;QACH,GAAGG,OAAO;QAEVX,UAAUE,OAAOU,GAAG,CAAed,iCAAY;IACjD;IAEAe,GAAG,qBAAqB;QACtBC,OAAOd,SAASe,WAAW;IAC7B;AACF"}
1
+ {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-recents.service.spec.ts"],"sourcesContent":["import { Test, TestingModule } from '@nestjs/testing'\nimport { SharesQueries } from '../../shares/services/shares-queries.service'\nimport { SpacesQueries } from '../../spaces/services/spaces-queries.service'\nimport { FilesQueries } from './files-queries.service'\nimport { FilesRecents } from './files-recents.service'\n\ndescribe(FilesRecents.name, () => {\n let service: FilesRecents\n\n beforeAll(async () => {\n const module: TestingModule = await Test.createTestingModule({\n providers: [\n FilesRecents,\n { provide: FilesQueries, useValue: {} },\n { provide: SpacesQueries, useValue: {} },\n {\n provide: SharesQueries,\n useValue: {}\n }\n ]\n }).compile()\n\n service = module.get<FilesRecents>(FilesRecents)\n })\n\n it('should be defined', () => {\n expect(service).toBeDefined()\n })\n})\n"],"names":["describe","FilesRecents","name","service","beforeAll","module","Test","createTestingModule","providers","provide","FilesQueries","useValue","SpacesQueries","SharesQueries","compile","get","it","expect","toBeDefined"],"mappings":";;;;yBAAoC;sCACN;sCACA;qCACD;qCACA;AAE7BA,SAASC,iCAAY,CAACC,IAAI,EAAE;IAC1B,IAAIC;IAEJC,UAAU;QACR,MAAMC,SAAwB,MAAMC,aAAI,CAACC,mBAAmB,CAAC;YAC3DC,WAAW;gBACTP,iCAAY;gBACZ;oBAAEQ,SAASC,iCAAY;oBAAEC,UAAU,CAAC;gBAAE;gBACtC;oBAAEF,SAASG,mCAAa;oBAAED,UAAU,CAAC;gBAAE;gBACvC;oBACEF,SAASI,mCAAa;oBACtBF,UAAU,CAAC;gBACb;aACD;QACH,GAAGG,OAAO;QAEVX,UAAUE,OAAOU,GAAG,CAAed,iCAAY;IACjD;IAEAe,GAAG,qBAAqB;QACtBC,OAAOd,SAASe,WAAW;IAC7B;AACF"}
@@ -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
  });
@@ -69,7 +65,10 @@ let FilesScheduler = class FilesScheduler {
69
65
  }
70
66
  }
71
67
  async cleanupInterruptedTasks() {
72
- this.logger.log(`${this.cleanupInterruptedTasks.name} - START`);
68
+ this.logger.log({
69
+ tag: this.cleanupInterruptedTasks.name,
70
+ msg: `START`
71
+ });
73
72
  try {
74
73
  let nb = 0;
75
74
  const keys = await this.cache.keys(`${_cache.CACHE_TASK_PREFIX}-*`);
@@ -79,16 +78,28 @@ let FilesScheduler = class FilesScheduler {
79
78
  task.status = _filetask.FileTaskStatus.ERROR;
80
79
  task.result = 'Interrupted';
81
80
  nb++;
82
- this.cache.set(key, task).catch((e)=>this.logger.error(`${this.cleanupInterruptedTasks.name} - ${e}`));
81
+ this.cache.set(key, task).catch((e)=>this.logger.error({
82
+ tag: this.cleanupInterruptedTasks.name,
83
+ msg: `${e}`
84
+ }));
83
85
  }
84
86
  }
85
- this.logger.log(`${this.cleanupInterruptedTasks.name} - ${nb} tasks cleaned : END`);
87
+ this.logger.log({
88
+ tag: this.cleanupInterruptedTasks.name,
89
+ msg: `${nb} tasks cleaned : END`
90
+ });
86
91
  } catch (e) {
87
- this.logger.error(`${this.cleanupInterruptedTasks.name} - ${e}`);
92
+ this.logger.error({
93
+ tag: this.cleanupInterruptedTasks.name,
94
+ msg: `${e}`
95
+ });
88
96
  }
89
97
  }
90
98
  async cleanupUserTaskFiles() {
91
- this.logger.log(`${this.cleanupUserTaskFiles.name} - START`);
99
+ this.logger.log({
100
+ tag: this.cleanupUserTaskFiles.name,
101
+ msg: `START`
102
+ });
92
103
  try {
93
104
  for (const user of (await this.db.select({
94
105
  id: _usersschema.users.id,
@@ -105,20 +116,35 @@ let FilesScheduler = class FilesScheduler {
105
116
  const excludeFiles = (await this.cache.mget(keys)).filter((task)=>task && task.status === _filetask.FileTaskStatus.PENDING && task.props.compressInDirectory === false).map((task)=>task.name);
106
117
  for (const f of (await _promises.default.readdir(userTasksPath)).filter((f)=>excludeFiles.indexOf(f) === -1)){
107
118
  try {
108
- (0, _files.removeFiles)(_nodepath.default.join(userTasksPath, f)).catch((e)=>this.logger.error(`${this.cleanupUserTaskFiles.name} - ${e}`));
119
+ (0, _files.removeFiles)(_nodepath.default.join(userTasksPath, f)).catch((e)=>this.logger.error({
120
+ tag: this.cleanupUserTaskFiles.name,
121
+ msg: `${e}`
122
+ }));
109
123
  } catch (e) {
110
- this.logger.error(`${this.cleanupUserTaskFiles.name} - unable to remove ${_nodepath.default.join(userTasksPath, f)} : ${e}`);
124
+ this.logger.error({
125
+ tag: this.cleanupUserTaskFiles.name,
126
+ msg: `unable to remove ${_nodepath.default.join(userTasksPath, f)} : ${e}`
127
+ });
111
128
  }
112
129
  }
113
130
  }
114
131
  }
115
132
  } catch (e) {
116
- this.logger.error(`${this.cleanupUserTaskFiles.name} - ${e}`);
133
+ this.logger.error({
134
+ tag: this.cleanupUserTaskFiles.name,
135
+ msg: `${e}`
136
+ });
117
137
  }
118
- this.logger.log(`${this.cleanupUserTaskFiles.name} - END`);
138
+ this.logger.log({
139
+ tag: this.cleanupUserTaskFiles.name,
140
+ msg: `END`
141
+ });
119
142
  }
120
143
  async clearRecentFiles() {
121
- this.logger.log(`${this.clearRecentFiles.name} - START`);
144
+ this.logger.log({
145
+ tag: this.clearRecentFiles.name,
146
+ msg: `START`
147
+ });
122
148
  const keepNumber = 100;
123
149
  let nbCleared = 0;
124
150
  try {
@@ -141,19 +167,34 @@ let FilesScheduler = class FilesScheduler {
141
167
  nbCleared += r.affectedRows;
142
168
  }
143
169
  } catch (e) {
144
- this.logger.error(`${this.clearRecentFiles.name} - ${e}`);
170
+ this.logger.error({
171
+ tag: this.clearRecentFiles.name,
172
+ msg: `${e}`
173
+ });
145
174
  }
146
- this.logger.log(`${this.clearRecentFiles.name} - ${nbCleared} records cleared - END`);
175
+ this.logger.log({
176
+ tag: this.clearRecentFiles.name,
177
+ msg: `${nbCleared} records cleared - END`
178
+ });
147
179
  }
148
180
  async indexContentFiles() {
149
181
  // Conditional loading of file content indexing
150
182
  if (!_configenvironment.configuration.applications.files.contentIndexing) return;
151
- this.logger.log(`${this.indexContentFiles.name} - START`);
183
+ this.logger.log({
184
+ tag: this.indexContentFiles.name,
185
+ msg: `START`
186
+ });
152
187
  await this.filesContentManager.parseAndIndexAllFiles();
153
- this.logger.log(`${this.indexContentFiles.name} - END`);
188
+ this.logger.log({
189
+ tag: this.indexContentFiles.name,
190
+ msg: `END`
191
+ });
154
192
  }
155
193
  async deleteOrphanFiles() {
156
- this.logger.log(`${this.deleteOrphanFiles.name} - START`);
194
+ this.logger.log({
195
+ tag: this.deleteOrphanFiles.name,
196
+ msg: `START`
197
+ });
157
198
  const selects = [];
158
199
  for (const table of (0, _utils.getTablesWithFileIdColumn)()){
159
200
  selects.push(this.db.selectDistinct({
@@ -161,7 +202,10 @@ let FilesScheduler = class FilesScheduler {
161
202
  }).from(table).where((0, _drizzleorm.isNotNull)(table.fileId)));
162
203
  }
163
204
  if (selects.length === 0) {
164
- this.logger.warn(`${this.deleteOrphanFiles.name} - no tables with fileId column`);
205
+ this.logger.warn({
206
+ tag: this.deleteOrphanFiles.name,
207
+ msg: `no tables with fileId column`
208
+ });
165
209
  return;
166
210
  }
167
211
  const unionSub = (selects.length === 1 ? selects[0] : (0, _mysqlcore.unionAll)(...selects)).as('u');
@@ -182,12 +226,21 @@ let FilesScheduler = class FilesScheduler {
182
226
  try {
183
227
  await this.db.transaction(async (tx)=>{
184
228
  const [r] = await tx.execute(deleteQuery);
185
- this.logger.log(`${this.deleteOrphanFiles.name} - files: ${r.affectedRows}`);
229
+ this.logger.log({
230
+ tag: this.deleteOrphanFiles.name,
231
+ msg: `files: ${r.affectedRows}`
232
+ });
186
233
  });
187
234
  } catch (e) {
188
- this.logger.log(`${this.deleteOrphanFiles.name} - ${e}`);
235
+ this.logger.log({
236
+ tag: this.deleteOrphanFiles.name,
237
+ msg: `${e}`
238
+ });
189
239
  }
190
- this.logger.log(`${this.deleteOrphanFiles.name} - END`);
240
+ this.logger.log({
241
+ tag: this.deleteOrphanFiles.name,
242
+ msg: `END`
243
+ });
191
244
  }
192
245
  constructor(db, cache, filesContentManager){
193
246
  this.db = db;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-scheduler.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 { Inject, Injectable, Logger } from '@nestjs/common'\nimport { Cron, CronExpression, Timeout } from '@nestjs/schedule'\nimport { isNotNull, sql } from 'drizzle-orm'\nimport { unionAll } from 'drizzle-orm/mysql-core'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { configuration } from '../../../configuration/config.environment'\nimport { Cache } from '../../../infrastructure/cache/services/cache.service'\nimport { DB_TOKEN_PROVIDER } from '../../../infrastructure/database/constants'\nimport { DBSchema } from '../../../infrastructure/database/interfaces/database.interface'\nimport { getTablesWithFileIdColumn } from '../../../infrastructure/database/utils'\nimport { USER_ROLE } from '../../users/constants/user'\nimport { UserModel } from '../../users/models/user.model'\nimport { users } from '../../users/schemas/users.schema'\nimport { CACHE_TASK_PREFIX } from '../constants/cache'\nimport { FileTask, FileTaskStatus } from '../models/file-task'\nimport { filesRecents } from '../schemas/files-recents.schema'\nimport { files } from '../schemas/files.schema'\nimport { dirHasChildren, isPathExists, removeFiles } from '../utils/files'\nimport { FilesContentManager } from './files-content-manager.service'\nimport { FilesTasksManager } from './files-tasks-manager.service'\n\n@Injectable()\nexport class FilesScheduler {\n private readonly logger = new Logger(FilesScheduler.name)\n\n constructor(\n @Inject(DB_TOKEN_PROVIDER) private readonly db: DBSchema,\n private readonly cache: Cache,\n private readonly filesContentManager: FilesContentManager\n ) {}\n\n @Timeout(10_000)\n async onStartup(): Promise<void> {\n try {\n await this.cleanupInterruptedTasks()\n await this.clearRecentFiles()\n } catch (e) {\n this.logger.error(e)\n }\n }\n\n @Timeout(180_000)\n async afterStartup(): Promise<void> {\n try {\n await this.indexContentFiles()\n } catch (e) {\n this.logger.error(e)\n }\n }\n\n async cleanupInterruptedTasks(): Promise<void> {\n this.logger.log(`${this.cleanupInterruptedTasks.name} - START`)\n try {\n let nb = 0\n const keys = await this.cache.keys(`${CACHE_TASK_PREFIX}-*`)\n for (const key of keys) {\n const task = await this.cache.get(key)\n if (task && task.status === FileTaskStatus.PENDING) {\n task.status = FileTaskStatus.ERROR\n task.result = 'Interrupted'\n nb++\n this.cache.set(key, task).catch((e: Error) => this.logger.error(`${this.cleanupInterruptedTasks.name} - ${e}`))\n }\n }\n this.logger.log(`${this.cleanupInterruptedTasks.name} - ${nb} tasks cleaned : END`)\n } catch (e) {\n this.logger.error(`${this.cleanupInterruptedTasks.name} - ${e}`)\n }\n }\n\n @Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT)\n async cleanupUserTaskFiles(): Promise<void> {\n this.logger.log(`${this.cleanupUserTaskFiles.name} - START`)\n try {\n for (const user of await this.db\n .select({\n id: users.id,\n login: users.login,\n role: users.role\n })\n .from(users)) {\n const userTasksPath = UserModel.getTasksPath(user.login, user.role === USER_ROLE.GUEST, user.role === USER_ROLE.LINK)\n if (!(await isPathExists(userTasksPath))) {\n continue\n }\n if (await dirHasChildren(userTasksPath, false)) {\n const cacheKey = FilesTasksManager.getCacheKey(user.id)\n const keys = await this.cache.keys(cacheKey)\n const excludeFiles = (await this.cache.mget(keys))\n .filter((task: FileTask) => task && task.status === FileTaskStatus.PENDING && task.props.compressInDirectory === false)\n .map((task: FileTask) => task.name)\n for (const f of (await fs.readdir(userTasksPath)).filter((f: string) => excludeFiles.indexOf(f) === -1)) {\n try {\n removeFiles(path.join(userTasksPath, f)).catch((e: Error) => this.logger.error(`${this.cleanupUserTaskFiles.name} - ${e}`))\n } catch (e) {\n this.logger.error(`${this.cleanupUserTaskFiles.name} - unable to remove ${path.join(userTasksPath, f)} : ${e}`)\n }\n }\n }\n }\n } catch (e) {\n this.logger.error(`${this.cleanupUserTaskFiles.name} - ${e}`)\n }\n this.logger.log(`${this.cleanupUserTaskFiles.name} - END`)\n }\n\n @Cron(CronExpression.EVERY_8_HOURS)\n async clearRecentFiles(): Promise<void> {\n this.logger.log(`${this.clearRecentFiles.name} - START`)\n const keepNumber = 100\n let nbCleared = 0\n try {\n for (const fk of [filesRecents.ownerId, filesRecents.spaceId, filesRecents.shareId]) {\n const [r] = await this.db.execute(sql`\n DELETE\n FROM ${filesRecents}\n WHERE ${fk} IS NOT NULL\n AND id NOT IN (SELECT id\n FROM (SELECT id,\n ROW_NUMBER() OVER (PARTITION BY ${fk} ORDER BY ${filesRecents.mtime} DESC) AS rn\n FROM ${filesRecents}\n WHERE ${fk} IS NOT NULL) AS ranked\n WHERE ranked.rn <= ${keepNumber})\n `)\n nbCleared += r.affectedRows\n }\n } catch (e) {\n this.logger.error(`${this.clearRecentFiles.name} - ${e}`)\n }\n this.logger.log(`${this.clearRecentFiles.name} - ${nbCleared} records cleared - END`)\n }\n\n @Cron(CronExpression.EVERY_4_HOURS)\n async indexContentFiles(): Promise<void> {\n // Conditional loading of file content indexing\n if (!configuration.applications.files.contentIndexing) return\n this.logger.log(`${this.indexContentFiles.name} - START`)\n await this.filesContentManager.parseAndIndexAllFiles()\n this.logger.log(`${this.indexContentFiles.name} - END`)\n }\n\n @Cron(CronExpression.EVERY_DAY_AT_4AM)\n async deleteOrphanFiles() {\n this.logger.log(`${this.deleteOrphanFiles.name} - START`)\n const selects: any[] = []\n for (const table of getTablesWithFileIdColumn()) {\n selects.push(this.db.selectDistinct({ id: table.fileId }).from(table).where(isNotNull(table.fileId)))\n }\n if (selects.length === 0) {\n this.logger.warn(`${this.deleteOrphanFiles.name} - no tables with fileId column`)\n return\n }\n const unionSub = (selects.length === 1 ? selects[0] : unionAll(...(selects as [any, any, ...any[]]))).as('u')\n // Debug\n // const [preview] = (await this.db.execute(sql`\n // SELECT f.id\n // FROM ${files} AS f\n // LEFT JOIN ${unionSub} ON ${unionSub.id} = f.id\n // WHERE ${unionSub.id} IS NULL\n // `)) as any[]\n // console.log(preview.length, preview)\n const deleteQuery = sql`\n DELETE f\n FROM ${files} AS f\n LEFT JOIN ${unionSub} ON ${unionSub.id} = f.id\n WHERE ${unionSub.id} IS NULL\n `\n try {\n await this.db.transaction(async (tx) => {\n const [r] = await tx.execute(deleteQuery)\n this.logger.log(`${this.deleteOrphanFiles.name} - files: ${r.affectedRows}`)\n })\n } catch (e) {\n this.logger.log(`${this.deleteOrphanFiles.name} - ${e}`)\n }\n this.logger.log(`${this.deleteOrphanFiles.name} - END`)\n }\n}\n"],"names":["FilesScheduler","onStartup","cleanupInterruptedTasks","clearRecentFiles","e","logger","error","afterStartup","indexContentFiles","log","name","nb","keys","cache","CACHE_TASK_PREFIX","key","task","get","status","FileTaskStatus","PENDING","ERROR","result","set","catch","cleanupUserTaskFiles","user","db","select","id","users","login","role","from","userTasksPath","UserModel","getTasksPath","USER_ROLE","GUEST","LINK","isPathExists","dirHasChildren","cacheKey","FilesTasksManager","getCacheKey","excludeFiles","mget","filter","props","compressInDirectory","map","f","fs","readdir","indexOf","removeFiles","path","join","keepNumber","nbCleared","fk","filesRecents","ownerId","spaceId","shareId","r","execute","sql","mtime","affectedRows","configuration","applications","files","contentIndexing","filesContentManager","parseAndIndexAllFiles","deleteOrphanFiles","selects","table","getTablesWithFileIdColumn","push","selectDistinct","fileId","where","isNotNull","length","warn","unionSub","unionAll","as","deleteQuery","transaction","tx","Logger","EVERY_DAY_AT_MIDNIGHT","EVERY_8_HOURS","EVERY_4_HOURS","EVERY_DAY_AT_4AM"],"mappings":"AAAA;;;;CAIC;;;;+BAyBYA;;;eAAAA;;;wBAvB8B;0BACG;4BACf;2BACN;iEACV;iEACE;mCACa;8BACR;2BACY;mCACT;uBACiB;sBAChB;2BACA;6BACJ;uBACY;0BACO;oCACZ;6BACP;uBACoC;4CACtB;0CACF;;;;;;;;;;;;;;;;;;;;AAG3B,IAAA,AAAMA,iBAAN,MAAMA;IASX,MACMC,YAA2B;QAC/B,IAAI;YACF,MAAM,IAAI,CAACC,uBAAuB;YAClC,MAAM,IAAI,CAACC,gBAAgB;QAC7B,EAAE,OAAOC,GAAG;YACV,IAAI,CAACC,MAAM,CAACC,KAAK,CAACF;QACpB;IACF;IAEA,MACMG,eAA8B;QAClC,IAAI;YACF,MAAM,IAAI,CAACC,iBAAiB;QAC9B,EAAE,OA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AAA,CAAC;;WAEjB,EAAEK,kBAAK,CAAC;gBACH,EAAEe,SAAS,IAAI,EAAEA,SAAS1D,EAAE,CAAC;YACjC,EAAE0D,SAAS1D,EAAE,CAAC;IACtB,CAAC;QACD,IAAI;YACF,MAAM,IAAI,CAACF,EAAE,CAACgE,WAAW,CAAC,OAAOC;gBAC/B,MAAM,CAAC3B,EAAE,GAAG,MAAM2B,GAAG1B,OAAO,CAACwB;gBAC7B,IAAI,CAACrF,MAAM,CAACI,GAAG,CAAC,GAAG,IAAI,CAACmE,iBAAiB,CAAClE,IAAI,CAAC,UAAU,EAAEuD,EAAEI,YAAY,EAAE;YAC7E;QACF,EAAE,OAAOjE,GAAG;YACV,IAAI,CAACC,MAAM,CAACI,GAAG,CAAC,GAAG,IAAI,CAACmE,iBAAiB,CAAClE,IAAI,CAAC,GAAG,EAAEN,GAAG;QACzD;QACA,IAAI,CAACC,MAAM,CAACI,GAAG,CAAC,GAAG,IAAI,CAACmE,iBAAiB,CAAClE,IAAI,CAAC,MAAM,CAAC;IACxD;IAvJA,YACE,AAA4CiB,EAAY,EACxD,AAAiBd,KAAY,EAC7B,AAAiB6D,mBAAwC,CACzD;aAH4C/C,KAAAA;aAC3Bd,QAAAA;aACA6D,sBAAAA;aALFrE,SAAS,IAAIwF,cAAM,CAAC7F,eAAeU,IAAI;IAMrD;AAoJL;;;;;;;;;;;;;;iDA3GuBoF;;;;;;iDAoCAC;;;;;;iDA0BAC;;;;;;iDASAC"}
1
+ {"version":3,"sources":["../../../../../backend/src/applications/files/services/files-scheduler.service.ts"],"sourcesContent":["import { Inject, Injectable, Logger } from '@nestjs/common'\nimport { Cron, CronExpression, Timeout } from '@nestjs/schedule'\nimport { isNotNull, sql } from 'drizzle-orm'\nimport { unionAll } from 'drizzle-orm/mysql-core'\nimport fs from 'node:fs/promises'\nimport path from 'node:path'\nimport { configuration } from '../../../configuration/config.environment'\nimport { Cache } from '../../../infrastructure/cache/services/cache.service'\nimport { DB_TOKEN_PROVIDER } from '../../../infrastructure/database/constants'\nimport { DBSchema } from '../../../infrastructure/database/interfaces/database.interface'\nimport { getTablesWithFileIdColumn } from '../../../infrastructure/database/utils'\nimport { USER_ROLE } from '../../users/constants/user'\nimport { UserModel } from '../../users/models/user.model'\nimport { users } from '../../users/schemas/users.schema'\nimport { CACHE_TASK_PREFIX } from '../constants/cache'\nimport { FileTask, FileTaskStatus } from '../models/file-task'\nimport { filesRecents } from '../schemas/files-recents.schema'\nimport { files } from '../schemas/files.schema'\nimport { dirHasChildren, isPathExists, removeFiles } from '../utils/files'\nimport { FilesContentManager } from './files-content-manager.service'\nimport { FilesTasksManager } from './files-tasks-manager.service'\n\n@Injectable()\nexport class FilesScheduler {\n private readonly logger = new Logger(FilesScheduler.name)\n\n constructor(\n @Inject(DB_TOKEN_PROVIDER) private readonly db: DBSchema,\n private readonly cache: Cache,\n private readonly filesContentManager: FilesContentManager\n ) {}\n\n @Timeout(10_000)\n async onStartup(): Promise<void> {\n try {\n await this.cleanupInterruptedTasks()\n await this.clearRecentFiles()\n } catch (e) {\n this.logger.error(e)\n }\n }\n\n @Timeout(180_000)\n async afterStartup(): Promise<void> {\n try {\n await this.indexContentFiles()\n } catch (e) {\n this.logger.error(e)\n }\n }\n\n async cleanupInterruptedTasks(): Promise<void> {\n this.logger.log({ tag: this.cleanupInterruptedTasks.name, msg: `START` })\n try {\n let nb = 0\n const keys = await this.cache.keys(`${CACHE_TASK_PREFIX}-*`)\n for (const key of keys) {\n const task = await this.cache.get(key)\n if (task && task.status === FileTaskStatus.PENDING) {\n task.status = FileTaskStatus.ERROR\n task.result = 'Interrupted'\n nb++\n this.cache.set(key, task).catch((e: Error) => this.logger.error({ tag: this.cleanupInterruptedTasks.name, msg: `${e}` }))\n }\n }\n this.logger.log({ tag: this.cleanupInterruptedTasks.name, msg: `${nb} tasks cleaned : END` })\n } catch (e) {\n this.logger.error({ tag: this.cleanupInterruptedTasks.name, msg: `${e}` })\n }\n }\n\n @Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT)\n async cleanupUserTaskFiles(): Promise<void> {\n this.logger.log({ tag: this.cleanupUserTaskFiles.name, msg: `START` })\n try {\n for (const user of await this.db\n .select({\n id: users.id,\n login: users.login,\n role: users.role\n })\n .from(users)) {\n const userTasksPath = UserModel.getTasksPath(user.login, user.role === USER_ROLE.GUEST, user.role === USER_ROLE.LINK)\n if (!(await isPathExists(userTasksPath))) {\n continue\n }\n if (await dirHasChildren(userTasksPath, false)) {\n const cacheKey = FilesTasksManager.getCacheKey(user.id)\n const keys = await this.cache.keys(cacheKey)\n const excludeFiles = (await this.cache.mget(keys))\n .filter((task: FileTask) => task && task.status === FileTaskStatus.PENDING && task.props.compressInDirectory === false)\n .map((task: FileTask) => task.name)\n for (const f of (await fs.readdir(userTasksPath)).filter((f: string) => excludeFiles.indexOf(f) === -1)) {\n try {\n removeFiles(path.join(userTasksPath, f)).catch((e: Error) => this.logger.error({ tag: this.cleanupUserTaskFiles.name, msg: `${e}` }))\n } catch (e) {\n this.logger.error({ tag: this.cleanupUserTaskFiles.name, msg: `unable to remove ${path.join(userTasksPath, f)} : ${e}` })\n }\n }\n }\n }\n } catch (e) {\n this.logger.error({ tag: this.cleanupUserTaskFiles.name, msg: `${e}` })\n }\n this.logger.log({ tag: this.cleanupUserTaskFiles.name, msg: `END` })\n }\n\n @Cron(CronExpression.EVERY_8_HOURS)\n async clearRecentFiles(): Promise<void> {\n this.logger.log({ tag: this.clearRecentFiles.name, msg: `START` })\n const keepNumber = 100\n let nbCleared = 0\n try {\n for (const fk of [filesRecents.ownerId, filesRecents.spaceId, filesRecents.shareId]) {\n const [r] = await this.db.execute(sql`\n DELETE\n FROM ${filesRecents}\n WHERE ${fk} IS NOT NULL\n AND id NOT IN (SELECT id\n FROM (SELECT id,\n ROW_NUMBER() OVER (PARTITION BY ${fk} ORDER BY ${filesRecents.mtime} DESC) AS rn\n FROM ${filesRecents}\n WHERE ${fk} IS NOT NULL) AS ranked\n WHERE ranked.rn <= ${keepNumber})\n `)\n nbCleared += r.affectedRows\n }\n } catch (e) {\n this.logger.error({ tag: this.clearRecentFiles.name, msg: `${e}` })\n }\n this.logger.log({ tag: this.clearRecentFiles.name, msg: `${nbCleared} records cleared - END` })\n }\n\n @Cron(CronExpression.EVERY_4_HOURS)\n async indexContentFiles(): Promise<void> {\n // Conditional loading of file content indexing\n if (!configuration.applications.files.contentIndexing) return\n this.logger.log({ tag: this.indexContentFiles.name, msg: `START` })\n await this.filesContentManager.parseAndIndexAllFiles()\n this.logger.log({ tag: this.indexContentFiles.name, msg: `END` })\n }\n\n @Cron(CronExpression.EVERY_DAY_AT_4AM)\n async deleteOrphanFiles() {\n this.logger.log({ tag: this.deleteOrphanFiles.name, msg: `START` })\n const selects: any[] = []\n for (const table of getTablesWithFileIdColumn()) {\n selects.push(this.db.selectDistinct({ id: table.fileId }).from(table).where(isNotNull(table.fileId)))\n }\n if (selects.length === 0) {\n this.logger.warn({ tag: this.deleteOrphanFiles.name, msg: `no tables with fileId column` })\n return\n }\n const unionSub = (selects.length === 1 ? selects[0] : unionAll(...(selects as [any, any, ...any[]]))).as('u')\n // Debug\n // const [preview] = (await this.db.execute(sql`\n // SELECT f.id\n // FROM ${files} AS f\n // LEFT JOIN ${unionSub} ON ${unionSub.id} = f.id\n // WHERE ${unionSub.id} IS NULL\n // `)) as any[]\n // console.log(preview.length, preview)\n const deleteQuery = sql`\n DELETE f\n FROM ${files} AS f\n LEFT JOIN ${unionSub} ON ${unionSub.id} = f.id\n WHERE ${unionSub.id} IS NULL\n `\n try {\n await this.db.transaction(async (tx) => {\n const [r] = await tx.execute(deleteQuery)\n this.logger.log({ tag: this.deleteOrphanFiles.name, msg: `files: ${r.affectedRows}` })\n })\n } catch (e) {\n this.logger.log({ tag: this.deleteOrphanFiles.name, msg: `${e}` })\n }\n this.logger.log({ tag: this.deleteOrphanFiles.name, msg: `END` })\n }\n}\n"],"names":["FilesScheduler","onStartup","cleanupInterruptedTasks","clearRecentFiles","e","logger","error","afterStartup","indexContentFiles","log","tag","name","msg","nb","keys","cache","CACHE_TASK_PREFIX","key","task","get","status","FileTaskStatus","PENDING","ERROR","result","set","catch","cleanupUserTaskFiles","user","db","select","id","users","login","role","from","userTasksPath","UserModel","getTasksPath","USER_ROLE","GUEST","LINK","isPathExists","dirHasChildren","cacheKey","FilesTasksManager","getCacheKey","excludeFiles","mget","filter","props","compressInDirectory","map","f","fs","readdir","indexOf","removeFiles","path","join","keepNumber","nbCleared","fk","filesRecents","ownerId","spaceId","shareId","r","execute","sql","mtime","affectedRows","configuration","applications","files","contentIndexing","filesContentManager","parseAndIndexAllFiles","deleteOrphanFiles","selects","table","getTablesWithFileIdColumn","push","selectDistinct","fileId","where","isNotNull","length","warn","unionSub","unionAll","as","deleteQuery","transaction","tx","Logger","EVERY_DAY_AT_MIDNIGHT","EVERY_8_HOURS","EVERY_4_HOURS","EVERY_DAY_AT_4AM"],"mappings":";;;;+BAuBaA;;;eAAAA;;;wBAvB8B;0BACG;4BACf;2BACN;iEACV;iEACE;mCACa;8BACR;2BACY;mCACT;uBACiB;sBAChB;2BACA;6BACJ;uBACY;0BACO;oCACZ;6BACP;uBACoC;4CACtB;0CACF;;;;;;;;;;;;;;;;;;;;AAG3B,IAAA,AAAMA,iBAAN,MAAMA;IASX,MACMC,YAA2B;QAC/B,IAAI;YACF,MAAM,IAAI,CAACC,uBAAuB;YAClC,MAAM,IAAI,CAACC,gBAAgB;QAC7B,EAAE,OAAOC,GAAG;YACV,IAAI,CAACC,MAAM,CAACC,KAAK,CAACF;QACpB;IACF;IAEA,MACMG,eAA8B;QAClC,IAAI;YACF,MAAM,IAAI,CAACC,iBAAiB;QAC9B,EAAE,OAAOJ,GAAG;YACV,IAAI,CAACC,MAAM,CAACC,KAAK,CAACF;QACpB;IACF;IAEA,MAAMF,0BAAyC;QAC7C,IAAI,CAACG,MAAM,CAACI,GAAG,CAAC;YAAEC,KAAK,IAAI,CAACR,uBAAuB,CAACS,IAAI;YAAEC,KAAK,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
- * 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
  });
@@ -64,7 +60,10 @@ let FilesSearchManager = class FilesSearchManager {
64
60
  try {
65
61
  return await this.filesIndexer.searchRecords(indexNames, search, limit);
66
62
  } catch (e) {
67
- this.logger.error(`${this.searchFullText.name} - ${JSON.stringify(indexNames)} - ${search} : ${e}`);
63
+ this.logger.error({
64
+ tag: this.searchFullText.name,
65
+ msg: `${JSON.stringify(indexNames)} - ${search} : ${e}`
66
+ });
68
67
  let msg;
69
68
  if (/Invalid regular expression/.test(e.message)) {
70
69
  msg = 'SyntaxError (check special characters)';
@@ -112,7 +111,10 @@ let FilesSearchManager = class FilesSearchManager {
112
111
  }
113
112
  }
114
113
  } catch (e) {
115
- this.logger.warn(`${this.parseFileNames.name} - unable to parse: ${dir} (${e})`);
114
+ this.logger.warn({
115
+ tag: this.parseFileNames.name,
116
+ msg: `unable to parse: ${dir} (${e})`
117
+ });
116
118
  }
117
119
  }
118
120
  async analyzeFile(realPath, pathPrefix, regexBasePath, regexpTerms) {