pigallery2-extension-kit 3.5.2 → 3.6.0-edge

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 (420) hide show
  1. package/README.md +11 -5
  2. package/index.d.ts +1 -0
  3. package/index.js +2 -3
  4. package/lib/backend/Logger.d.ts +7 -7
  5. package/lib/backend/Logger.js +104 -0
  6. package/lib/backend/ProjectPath.d.ts +12 -0
  7. package/lib/backend/ProjectPath.js +28 -2
  8. package/lib/backend/exceptions/DirectoryNotFound.d.ts +2 -0
  9. package/lib/backend/exceptions/DirectoryNotFound.js +7 -0
  10. package/lib/backend/exceptions/FileAlreadyExists.js +10 -0
  11. package/lib/backend/exceptions/FolderNotWritable.d.ts +2 -0
  12. package/lib/backend/exceptions/FolderNotWritable.js +7 -0
  13. package/lib/backend/exceptions/LocationLookupException.js +10 -0
  14. package/lib/backend/index.d.ts +1 -1
  15. package/lib/backend/middlewares/AlbumMWs.js +61 -0
  16. package/lib/backend/middlewares/GalleryMWs.d.ts +4 -0
  17. package/lib/backend/middlewares/GalleryMWs.js +380 -0
  18. package/lib/backend/middlewares/MetaFileMWs.js +41 -0
  19. package/lib/backend/middlewares/NotificationMWs.js +21 -0
  20. package/lib/backend/middlewares/PersonMWs.d.ts +1 -1
  21. package/lib/backend/middlewares/PersonMWs.js +64 -0
  22. package/lib/backend/middlewares/RenderingMWs.d.ts +24 -0
  23. package/lib/backend/middlewares/RenderingMWs.js +182 -0
  24. package/lib/backend/middlewares/RequestParams.d.ts +13 -0
  25. package/lib/backend/middlewares/RequestParams.js +25 -0
  26. package/lib/backend/middlewares/RequestSession.d.ts +9 -0
  27. package/lib/backend/middlewares/RequestSession.js +16 -0
  28. package/lib/backend/middlewares/ServerTimingMWs.d.ts +6 -6
  29. package/lib/backend/middlewares/ServerTimingMWs.js +108 -0
  30. package/lib/backend/middlewares/SharingMWs.d.ts +2 -1
  31. package/lib/backend/middlewares/SharingMWs.js +240 -0
  32. package/lib/backend/middlewares/UploadMWs.js +95 -0
  33. package/lib/backend/middlewares/VersionMWs.d.ts +1 -1
  34. package/lib/backend/middlewares/VersionMWs.js +41 -0
  35. package/lib/backend/middlewares/admin/AdminMWs.js +115 -0
  36. package/lib/backend/middlewares/admin/ExtensionMWs.js +85 -0
  37. package/lib/backend/middlewares/admin/SettingsMWs.js +54 -0
  38. package/lib/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.d.ts +1 -1
  39. package/lib/backend/middlewares/thumbnail/ThumbnailGeneratorMWs.js +153 -0
  40. package/lib/backend/middlewares/user/AuthenticationMWs.d.ts +37 -0
  41. package/lib/backend/middlewares/user/AuthenticationMWs.js +346 -0
  42. package/lib/backend/middlewares/user/OIDCAuthService.d.ts +36 -5
  43. package/lib/backend/middlewares/user/OIDCAuthService.js +216 -0
  44. package/lib/backend/middlewares/user/OIDCMWs.d.ts +10 -0
  45. package/lib/backend/middlewares/user/OIDCMWs.js +30 -0
  46. package/lib/backend/middlewares/user/UserMWs.d.ts +1 -0
  47. package/lib/backend/middlewares/user/UserMWs.js +120 -0
  48. package/lib/backend/middlewares/user/UserRequestConstrainsMWs.d.ts +0 -1
  49. package/lib/backend/middlewares/user/UserRequestConstrainsMWs.js +29 -0
  50. package/lib/backend/model/DirectoryAccess.d.ts +78 -0
  51. package/lib/backend/model/DirectoryAccess.js +222 -0
  52. package/lib/backend/model/EventLoopHandler.d.ts +1 -1
  53. package/lib/backend/model/EventLoopHandler.js +24 -0
  54. package/lib/backend/model/FFmpeg.d.ts +47 -0
  55. package/lib/backend/model/FFmpeg.js +75 -0
  56. package/lib/backend/model/FFmpegFactory.d.ts +11 -2
  57. package/lib/backend/model/FFmpegFactory.js +28 -0
  58. package/lib/backend/model/Localizations.js +19 -0
  59. package/lib/backend/model/ObjectManagers.d.ts +1 -1
  60. package/lib/backend/model/ObjectManagers.js +253 -0
  61. package/lib/backend/model/PasswordHelper.d.ts +1 -1
  62. package/lib/backend/model/PasswordHelper.js +6 -2
  63. package/lib/backend/model/SessionContext.d.ts +16 -6
  64. package/lib/backend/model/SessionContext.js +11 -0
  65. package/lib/backend/model/UploadManager.d.ts +6 -3
  66. package/lib/backend/model/UploadManager.js +101 -0
  67. package/lib/backend/model/database/AlbumManager.js +122 -0
  68. package/lib/backend/model/database/CoverManager.d.ts +8 -2
  69. package/lib/backend/model/database/CoverManager.js +169 -0
  70. package/lib/backend/model/database/GalleryManager.d.ts +15 -9
  71. package/lib/backend/model/database/GalleryManager.js +363 -0
  72. package/lib/backend/model/database/IObjectManager.js +2 -0
  73. package/lib/backend/model/database/IndexingManager.d.ts +7 -7
  74. package/lib/backend/model/database/IndexingManager.js +452 -0
  75. package/lib/backend/model/database/LocationManager.d.ts +2 -3
  76. package/lib/backend/model/database/LocationManager.js +39 -0
  77. package/lib/backend/model/database/PersonManager.d.ts +5 -3
  78. package/lib/backend/model/database/PersonManager.js +248 -0
  79. package/lib/backend/model/database/ProjectedCacheManager.d.ts +9 -8
  80. package/lib/backend/model/database/ProjectedCacheManager.js +297 -0
  81. package/lib/backend/model/database/ProjectionAwareManager.d.ts +4 -4
  82. package/lib/backend/model/database/ProjectionAwareManager.js +56 -0
  83. package/lib/backend/model/database/SQLConnection.d.ts +4 -2
  84. package/lib/backend/model/database/SQLConnection.js +295 -0
  85. package/lib/backend/model/database/SearchManager.d.ts +23 -8
  86. package/lib/backend/model/database/SearchManager.js +1032 -0
  87. package/lib/backend/model/database/SessionManager.d.ts +41 -4
  88. package/lib/backend/model/database/SessionManager.js +228 -0
  89. package/lib/backend/model/database/SharingManager.d.ts +11 -6
  90. package/lib/backend/model/database/SharingManager.js +160 -0
  91. package/lib/backend/model/database/UserManager.d.ts +8 -1
  92. package/lib/backend/model/database/UserManager.js +148 -0
  93. package/lib/backend/model/database/VersionManager.js +60 -0
  94. package/lib/backend/model/database/enitites/DirectoryEntity.d.ts +1 -1
  95. package/lib/backend/model/database/enitites/DirectoryEntity.js +76 -0
  96. package/lib/backend/model/database/enitites/EntityUtils.d.ts +22 -1
  97. package/lib/backend/model/database/enitites/EntityUtils.js +66 -0
  98. package/lib/backend/model/database/enitites/FileEntity.js +31 -0
  99. package/lib/backend/model/database/enitites/MDFileEntity.js +21 -0
  100. package/lib/backend/model/database/enitites/MediaEntity.d.ts +5 -2
  101. package/lib/backend/model/database/enitites/MediaEntity.js +223 -0
  102. package/lib/backend/model/database/enitites/PhotoEntity.js +19 -0
  103. package/lib/backend/model/database/enitites/ProjectedDirectoryCacheEntity.d.ts +2 -2
  104. package/lib/backend/model/database/enitites/ProjectedDirectoryCacheEntity.js +61 -0
  105. package/lib/backend/model/database/enitites/SharingEntity.d.ts +11 -5
  106. package/lib/backend/model/database/enitites/SharingEntity.js +100 -0
  107. package/lib/backend/model/database/enitites/UserEntity.d.ts +8 -5
  108. package/lib/backend/model/database/enitites/UserEntity.js +97 -0
  109. package/lib/backend/model/database/enitites/VersionEntity.js +19 -0
  110. package/lib/backend/model/database/enitites/VideoEntity.d.ts +2 -2
  111. package/lib/backend/model/database/enitites/VideoEntity.js +38 -0
  112. package/lib/backend/model/database/enitites/album/AlbumBaseEntity.js +32 -0
  113. package/lib/backend/model/database/enitites/album/ProjectedAlbumCacheEntity.d.ts +2 -2
  114. package/lib/backend/model/database/enitites/album/ProjectedAlbumCacheEntity.js +52 -0
  115. package/lib/backend/model/database/enitites/album/SavedSearchEntity.js +29 -0
  116. package/lib/backend/model/database/enitites/person/PersonEntry.js +36 -0
  117. package/lib/backend/model/database/enitites/person/PersonJunctionTable.js +37 -0
  118. package/lib/backend/model/database/enitites/person/ProjectedPersonCacheEntity.d.ts +1 -1
  119. package/lib/backend/model/database/enitites/person/ProjectedPersonCacheEntity.js +49 -0
  120. package/lib/backend/model/diagnostics/ConfigDiagnostics.d.ts +31 -12
  121. package/lib/backend/model/diagnostics/ConfigDiagnostics.js +537 -0
  122. package/lib/backend/model/extension/ExpressRouterWrapper.d.ts +10 -4
  123. package/lib/backend/model/extension/ExpressRouterWrapper.js +113 -0
  124. package/lib/backend/model/extension/ExtensionApp.d.ts +2 -3
  125. package/lib/backend/model/extension/ExtensionApp.js +18 -0
  126. package/lib/backend/model/extension/ExtensionConfig.js +17 -0
  127. package/lib/backend/model/extension/ExtensionConfigTemplateLoader.js +4 -3
  128. package/lib/backend/model/extension/ExtensionConfigWrapper.js +6 -5
  129. package/lib/backend/model/extension/ExtensionDB.d.ts +2 -2
  130. package/lib/backend/model/extension/ExtensionDB.js +22 -0
  131. package/lib/backend/model/extension/ExtensionDecorator.js +33 -0
  132. package/lib/backend/model/extension/ExtensionEvent.d.ts +12 -1
  133. package/lib/backend/model/extension/ExtensionEvent.js +81 -0
  134. package/lib/backend/model/extension/ExtensionManager.d.ts +22 -4
  135. package/lib/backend/model/extension/ExtensionManager.js +424 -0
  136. package/lib/backend/model/extension/ExtensionMessengerHandler.js +28 -0
  137. package/lib/backend/model/extension/ExtensionObject.d.ts +6 -3
  138. package/lib/backend/model/extension/ExtensionObject.js +45 -0
  139. package/lib/backend/model/extension/ExtensionRepository.js +69 -0
  140. package/lib/backend/model/extension/IExtension.d.ts +35 -18
  141. package/lib/backend/model/extension/IExtension.js +2 -0
  142. package/lib/backend/model/extension/UIExtension.js +23 -0
  143. package/lib/backend/model/fileaccess/DiskManager.d.ts +3 -1
  144. package/lib/backend/model/fileaccess/DiskManager.js +313 -0
  145. package/lib/backend/model/fileaccess/MetadataCreationDate.js +27 -0
  146. package/lib/backend/model/fileaccess/MetadataLoader.d.ts +17 -0
  147. package/lib/backend/model/fileaccess/MetadataLoader.js +765 -0
  148. package/lib/backend/model/fileaccess/PhotoWorker.js +159 -0
  149. package/lib/backend/model/fileaccess/TaskExecuter.js +41 -0
  150. package/lib/backend/model/fileaccess/TaskQue.d.ts +4 -4
  151. package/lib/backend/model/fileaccess/TaskQue.js +50 -0
  152. package/lib/backend/model/fileaccess/VideoConverterWorker.d.ts +4 -1
  153. package/lib/backend/model/fileaccess/VideoConverterWorker.js +59 -0
  154. package/lib/backend/model/fileaccess/fileprocessing/GPXProcessing.js +136 -0
  155. package/lib/backend/model/fileaccess/fileprocessing/PhotoProcessing.d.ts +3 -2
  156. package/lib/backend/model/fileaccess/fileprocessing/PhotoProcessing.js +251 -0
  157. package/lib/backend/model/fileaccess/fileprocessing/VideoProcessing.js +97 -0
  158. package/lib/backend/model/jobs/JobManager.d.ts +2 -4
  159. package/lib/backend/model/jobs/JobManager.js +129 -0
  160. package/lib/backend/model/jobs/JobProgressManager.d.ts +5 -3
  161. package/lib/backend/model/jobs/JobProgressManager.js +94 -0
  162. package/lib/backend/model/jobs/JobRepository.d.ts +1 -3
  163. package/lib/backend/model/jobs/JobRepository.js +50 -0
  164. package/lib/backend/model/jobs/jobs/AlbumCoverFillingJob.d.ts +1 -1
  165. package/lib/backend/model/jobs/jobs/AlbumCoverFillingJob.js +91 -0
  166. package/lib/backend/model/jobs/jobs/AlbumCoverResetJob.js +32 -0
  167. package/lib/backend/model/jobs/jobs/AlbumResetJob.js +30 -0
  168. package/lib/backend/model/jobs/jobs/FileJob.js +243 -0
  169. package/lib/backend/model/jobs/jobs/GPXCompressionJob.js +35 -0
  170. package/lib/backend/model/jobs/jobs/GPXCompressionResetJob.js +23 -0
  171. package/lib/backend/model/jobs/jobs/GalleryResetJob.js +30 -0
  172. package/lib/backend/model/jobs/jobs/IJob.js +2 -0
  173. package/lib/backend/model/jobs/jobs/IJobListener.d.ts +2 -2
  174. package/lib/backend/model/jobs/jobs/IJobListener.js +2 -0
  175. package/lib/backend/model/jobs/jobs/IndexingJob.js +99 -0
  176. package/lib/backend/model/jobs/jobs/Job.d.ts +4 -1
  177. package/lib/backend/model/jobs/jobs/Job.js +135 -0
  178. package/lib/backend/model/jobs/jobs/JobProgress.js +100 -0
  179. package/lib/backend/model/jobs/jobs/PhotoConvertingJob.js +78 -0
  180. package/lib/backend/model/jobs/jobs/TempFolderCleaningJob.js +122 -0
  181. package/lib/backend/model/jobs/jobs/TopPickSendJob.js +113 -0
  182. package/lib/backend/model/jobs/jobs/VideoConvertingJob.js +31 -0
  183. package/lib/backend/model/messenger/EmailMessenger.d.ts +1 -1
  184. package/lib/backend/model/messenger/EmailMessenger.js +87 -0
  185. package/lib/backend/model/messenger/ExtensionMessenger.js +16 -0
  186. package/lib/backend/model/messenger/Messenger.d.ts +1 -2
  187. package/lib/backend/model/messenger/Messenger.js +36 -0
  188. package/lib/backend/model/messenger/MessengerRepository.d.ts +1 -3
  189. package/lib/backend/model/messenger/MessengerRepository.js +38 -0
  190. package/lib/backend/model/messenger/StdoutMessenger.js +16 -0
  191. package/lib/backend/routes/AlbumRouter.js +39 -0
  192. package/lib/backend/routes/ErrorRouter.d.ts +1 -0
  193. package/lib/backend/routes/ErrorRouter.js +39 -0
  194. package/lib/backend/routes/GalleryRouter.d.ts +8 -0
  195. package/lib/backend/routes/GalleryRouter.js +165 -0
  196. package/lib/backend/routes/LoggerRouter.js +43 -0
  197. package/lib/backend/routes/NotificationRouter.js +19 -0
  198. package/lib/backend/routes/OIDCRouter.js +20 -0
  199. package/lib/backend/routes/PersonRouter.js +41 -0
  200. package/lib/backend/routes/PublicRouter.d.ts +3 -6
  201. package/lib/backend/routes/PublicRouter.js +301 -0
  202. package/lib/backend/routes/Router.js +36 -0
  203. package/lib/backend/routes/SharingRouter.d.ts +1 -1
  204. package/lib/backend/routes/SharingRouter.js +55 -0
  205. package/lib/backend/routes/UploadRouter.js +18 -0
  206. package/lib/backend/routes/UserRouter.d.ts +1 -0
  207. package/lib/backend/routes/UserRouter.js +53 -0
  208. package/lib/backend/routes/admin/AdminRouter.js +32 -0
  209. package/lib/backend/routes/admin/ExtensionRouter.js +30 -0
  210. package/lib/backend/routes/admin/SettingsRouter.js +18 -0
  211. package/lib/backend/server.d.ts +3 -3
  212. package/lib/backend/server.js +176 -0
  213. package/lib/common/CookieNames.js +10 -0
  214. package/lib/common/CustomHeaders.js +8 -0
  215. package/lib/common/DataStructureVersion.d.ts +1 -1
  216. package/lib/common/DataStructureVersion.js +7 -0
  217. package/lib/common/PG2ConfMap.js +36 -0
  218. package/lib/common/QueryParams.js +45 -0
  219. package/lib/common/SearchQueryParser.d.ts +2 -2
  220. package/lib/common/SearchQueryParser.js +611 -0
  221. package/lib/common/SearchQueryUtils.d.ts +71 -4
  222. package/lib/common/SearchQueryUtils.js +443 -0
  223. package/lib/common/SupportedFormats.d.ts +11 -1
  224. package/lib/common/SupportedFormats.js +13 -19
  225. package/lib/common/TextFold.d.ts +6 -0
  226. package/lib/common/TextFold.js +19 -0
  227. package/lib/common/UploadUtils.d.ts +4 -0
  228. package/lib/common/UploadUtils.js +20 -0
  229. package/lib/common/Utils.d.ts +23 -24
  230. package/lib/common/Utils.js +37 -97
  231. package/lib/common/config/private/Config.d.ts +1 -1
  232. package/lib/common/config/private/Config.js +2 -0
  233. package/lib/common/config/private/PrivateConfig.d.ts +17 -4
  234. package/lib/common/config/private/PrivateConfig.js +262 -33
  235. package/lib/common/config/private/PrivateConfigClass.js +10 -13
  236. package/lib/common/config/private/WebConfig.d.ts +1 -2
  237. package/lib/common/config/private/WebConfig.js +0 -2
  238. package/lib/common/config/private/subconfigs/MessagingConfig.js +8 -0
  239. package/lib/common/config/private/subconfigs/ServerExtensionsConfig.d.ts +2 -3
  240. package/lib/common/config/private/subconfigs/ServerExtensionsConfig.js +7 -3
  241. package/lib/common/config/public/ClientConfig.d.ts +55 -17
  242. package/lib/common/config/public/ClientConfig.js +291 -20
  243. package/lib/common/config/public/Config.js +5 -4
  244. package/lib/common/entities/AutoCompleteItem.d.ts +3 -3
  245. package/lib/common/entities/ContentWrapper.d.ts +21 -8
  246. package/lib/common/entities/ContentWrapper.js +286 -318
  247. package/lib/common/entities/DirectoryDTO.d.ts +7 -6
  248. package/lib/common/entities/DirectoryDTO.js +10 -5
  249. package/lib/common/entities/Error.d.ts +12 -7
  250. package/lib/common/entities/Error.js +15 -3
  251. package/lib/common/entities/MediaDTO.d.ts +13 -0
  252. package/lib/common/entities/MediaDTO.js +10 -7
  253. package/lib/common/entities/Message.d.ts +3 -3
  254. package/lib/common/entities/NotificationDTO.d.ts +2 -2
  255. package/lib/common/entities/SearchQueryDTO.d.ts +9 -1
  256. package/lib/common/entities/SearchQueryDTO.js +1 -0
  257. package/lib/common/entities/SharingDTO.d.ts +39 -5
  258. package/lib/common/entities/SortingMethods.d.ts +26 -2
  259. package/lib/common/entities/SortingMethods.js +14 -1
  260. package/lib/common/entities/UserDTO.d.ts +5 -2
  261. package/lib/common/entities/UserSettingsDTO.d.ts +3 -1
  262. package/lib/common/entities/VideoDTO.d.ts +2 -5
  263. package/lib/common/entities/album/AlbumBaseDTO.d.ts +2 -2
  264. package/lib/common/entities/extension/ExtensionListItem.d.ts +1 -1
  265. package/lib/common/entities/extension/IClientUIConfig.d.ts +19 -12
  266. package/lib/common/entities/job/JobDTO.d.ts +1 -1
  267. package/lib/common/entities/job/JobProgressDTO.d.ts +1 -1
  268. package/lib/common/entities/job/JobScheduleDTO.d.ts +5 -5
  269. package/lib/common/entities/job/JobScheduleDTO.js +9 -5
  270. package/lib/common/event/Event.js +49 -0
  271. package/lib/common/event/EventLimit.d.ts +1 -1
  272. package/package.json +21 -8
  273. package/REPOSITORY.md +0 -13
  274. package/events.drawio +0 -1
  275. package/events.png +0 -0
  276. package/index.js.map +0 -1
  277. package/index.ts +0 -2
  278. package/lib/backend/model/database/enitites/PersonEntry.d.ts +0 -11
  279. package/lib/backend/model/database/enitites/PersonJunctionTable.d.ts +0 -10
  280. package/lib/common/entities/ConentWrapper.d.ts +0 -18
  281. package/lib/common/entities/ConentWrapper.js +0 -490
  282. package/lib/frontend/app/app.component.d.ts +0 -18
  283. package/lib/frontend/app/app.module.d.ts +0 -23
  284. package/lib/frontend/app/app.routing.d.ts +0 -4
  285. package/lib/frontend/app/icon.component.d.ts +0 -7
  286. package/lib/frontend/app/model/IRenderable.d.ts +0 -17
  287. package/lib/frontend/app/model/backendtext.service.d.ts +0 -7
  288. package/lib/frontend/app/model/backendtext.service.spec.d.ts +0 -1
  289. package/lib/frontend/app/model/extension.service.d.ts +0 -5
  290. package/lib/frontend/app/model/navigation.service.d.ts +0 -12
  291. package/lib/frontend/app/model/network/autehentication.service.spec.d.ts +0 -1
  292. package/lib/frontend/app/model/network/authentication.service.d.ts +0 -22
  293. package/lib/frontend/app/model/network/helper/auth.guard.d.ts +0 -9
  294. package/lib/frontend/app/model/network/helper/csrf.interceptor.d.ts +0 -8
  295. package/lib/frontend/app/model/network/helper/error.interceptor.d.ts +0 -8
  296. package/lib/frontend/app/model/network/network.service.d.ts +0 -29
  297. package/lib/frontend/app/model/network/network.service.spec.d.ts +0 -1
  298. package/lib/frontend/app/model/network/user.service.d.ts +0 -13
  299. package/lib/frontend/app/model/network/user.service.spec.d.ts +0 -1
  300. package/lib/frontend/app/model/notification.service.d.ts +0 -28
  301. package/lib/frontend/app/model/page.helper.d.ts +0 -15
  302. package/lib/frontend/app/model/pi-title.service.d.ts +0 -15
  303. package/lib/frontend/app/model/query.service.d.ts +0 -19
  304. package/lib/frontend/app/model/seededRandom.service.d.ts +0 -7
  305. package/lib/frontend/app/model/theme.service.d.ts +0 -16
  306. package/lib/frontend/app/model/version.service.d.ts +0 -10
  307. package/lib/frontend/app/pipes/DurationPipe.d.ts +0 -4
  308. package/lib/frontend/app/pipes/FileDTOToPathPipe.d.ts +0 -5
  309. package/lib/frontend/app/pipes/FileDTOToRelativePathPipe.d.ts +0 -5
  310. package/lib/frontend/app/pipes/FileSizePipe.d.ts +0 -4
  311. package/lib/frontend/app/pipes/GPXFilesFilterPipe.d.ts +0 -5
  312. package/lib/frontend/app/pipes/MDFilesFilterPipe.d.ts +0 -6
  313. package/lib/frontend/app/pipes/ParseIntPipe.d.ts +0 -4
  314. package/lib/frontend/app/pipes/PhotoFilterPipe.d.ts +0 -6
  315. package/lib/frontend/app/pipes/SafeHTMLPipe.d.ts +0 -7
  316. package/lib/frontend/app/pipes/StringifyEnum.d.ts +0 -4
  317. package/lib/frontend/app/pipes/StringifyGridSize.d.ts +0 -5
  318. package/lib/frontend/app/pipes/StringifyRolePipe.d.ts +0 -4
  319. package/lib/frontend/app/pipes/StringifySearchQuery.d.ts +0 -8
  320. package/lib/frontend/app/pipes/StringifySearchType.d.ts +0 -5
  321. package/lib/frontend/app/pipes/StringifySortingMethod.d.ts +0 -4
  322. package/lib/frontend/app/ui/EnumTranslations.d.ts +0 -5
  323. package/lib/frontend/app/ui/admin/admin.component.d.ts +0 -36
  324. package/lib/frontend/app/ui/albums/album/album.component.d.ts +0 -26
  325. package/lib/frontend/app/ui/albums/albums.component.d.ts +0 -31
  326. package/lib/frontend/app/ui/albums/albums.service.d.ts +0 -12
  327. package/lib/frontend/app/ui/albums/saved-search-popup/saved-search-popup.component.d.ts +0 -15
  328. package/lib/frontend/app/ui/duplicates/duplicates.component.d.ts +0 -36
  329. package/lib/frontend/app/ui/duplicates/duplicates.service.d.ts +0 -9
  330. package/lib/frontend/app/ui/duplicates/photo/photo.duplicates.component.d.ts +0 -11
  331. package/lib/frontend/app/ui/faces/Person.d.ts +0 -9
  332. package/lib/frontend/app/ui/faces/face/face.component.d.ts +0 -22
  333. package/lib/frontend/app/ui/faces/faces.component.d.ts +0 -18
  334. package/lib/frontend/app/ui/faces/faces.service.d.ts +0 -14
  335. package/lib/frontend/app/ui/faces/navigator/navigator.faces.component.d.ts +0 -15
  336. package/lib/frontend/app/ui/frame/frame.component.d.ts +0 -60
  337. package/lib/frontend/app/ui/gallery/Media.d.ts +0 -15
  338. package/lib/frontend/app/ui/gallery/MediaIcon.d.ts +0 -29
  339. package/lib/frontend/app/ui/gallery/blog/blog.gallery.component.d.ts +0 -16
  340. package/lib/frontend/app/ui/gallery/blog/blog.service.d.ts +0 -85
  341. package/lib/frontend/app/ui/gallery/blog/blog.service.spec.d.ts +0 -1
  342. package/lib/frontend/app/ui/gallery/cache.gallery.service.d.ts +0 -51
  343. package/lib/frontend/app/ui/gallery/content.service.d.ts +0 -11
  344. package/lib/frontend/app/ui/gallery/contentLoader.service.d.ts +0 -37
  345. package/lib/frontend/app/ui/gallery/directories/directories.component.d.ts +0 -14
  346. package/lib/frontend/app/ui/gallery/directories/directory/directory.gallery.component.d.ts +0 -20
  347. package/lib/frontend/app/ui/gallery/filter/filter.gallery.component.d.ts +0 -32
  348. package/lib/frontend/app/ui/gallery/filter/filter.service.d.ts +0 -51
  349. package/lib/frontend/app/ui/gallery/filter/filter.service.spec.d.ts +0 -1
  350. package/lib/frontend/app/ui/gallery/fullscreen.service.d.ts +0 -7
  351. package/lib/frontend/app/ui/gallery/gallery.component.d.ts +0 -64
  352. package/lib/frontend/app/ui/gallery/gallery.component.spec.d.ts +0 -1
  353. package/lib/frontend/app/ui/gallery/gallery.service.d.ts +0 -13
  354. package/lib/frontend/app/ui/gallery/grid/GridMedia.d.ts +0 -13
  355. package/lib/frontend/app/ui/gallery/grid/GridRowBuilder.d.ts +0 -16
  356. package/lib/frontend/app/ui/gallery/grid/grid.gallery.component.d.ts +0 -88
  357. package/lib/frontend/app/ui/gallery/grid/grid.gallery.component.spec.d.ts +0 -1
  358. package/lib/frontend/app/ui/gallery/grid/photo/loading/loading.photo.grid.gallery.component.d.ts +0 -4
  359. package/lib/frontend/app/ui/gallery/grid/photo/media-button-modal/media-button-modal.component.d.ts +0 -20
  360. package/lib/frontend/app/ui/gallery/grid/photo/media-button-modal/media-button-modal.service.d.ts +0 -27
  361. package/lib/frontend/app/ui/gallery/grid/photo/photo.grid.gallery.component.d.ts +0 -53
  362. package/lib/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.d.ts +0 -103
  363. package/lib/frontend/app/ui/gallery/lightbox/infopanel/info-panel.lightbox.gallery.component.d.ts +0 -51
  364. package/lib/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.d.ts +0 -95
  365. package/lib/frontend/app/ui/gallery/lightbox/lightbox.gallery.component.spec.d.ts +0 -1
  366. package/lib/frontend/app/ui/gallery/lightbox/lightbox.service.d.ts +0 -45
  367. package/lib/frontend/app/ui/gallery/lightbox/media/media.lightbox.gallery.component.d.ts +0 -71
  368. package/lib/frontend/app/ui/gallery/map/MarkerFactory.d.ts +0 -12
  369. package/lib/frontend/app/ui/gallery/map/lightbox/lightbox.map.gallery.component.d.ts +0 -80
  370. package/lib/frontend/app/ui/gallery/map/map.gallery.component.d.ts +0 -36
  371. package/lib/frontend/app/ui/gallery/map/map.service.d.ts +0 -30
  372. package/lib/frontend/app/ui/gallery/navigator/navigator.gallery.component.d.ts +0 -81
  373. package/lib/frontend/app/ui/gallery/navigator/navigator.service.d.ts +0 -14
  374. package/lib/frontend/app/ui/gallery/navigator/sorting.service.d.ts +0 -38
  375. package/lib/frontend/app/ui/gallery/overlay.service.d.ts +0 -9
  376. package/lib/frontend/app/ui/gallery/photo-frame-builder/photo-frame-builder.gallery.component.d.ts +0 -40
  377. package/lib/frontend/app/ui/gallery/random-query-builder/random-query-builder.gallery.component.d.ts +0 -30
  378. package/lib/frontend/app/ui/gallery/search/AutoCompleteRenderItem.d.ts +0 -11
  379. package/lib/frontend/app/ui/gallery/search/autocomplete.service.d.ts +0 -33
  380. package/lib/frontend/app/ui/gallery/search/query-builder/query-bulder.gallery.component.d.ts +0 -22
  381. package/lib/frontend/app/ui/gallery/search/query-enrty/query-entry.search.gallery.component.d.ts +0 -43
  382. package/lib/frontend/app/ui/gallery/search/search-field/search-field.gallery.component.d.ts +0 -31
  383. package/lib/frontend/app/ui/gallery/search/search-field-base/search-field-base.gallery.component.d.ts +0 -57
  384. package/lib/frontend/app/ui/gallery/search/search-query-parser.service.d.ts +0 -7
  385. package/lib/frontend/app/ui/gallery/search/search.gallery.component.d.ts +0 -39
  386. package/lib/frontend/app/ui/gallery/share/share.gallery.component.d.ts +0 -67
  387. package/lib/frontend/app/ui/gallery/share.service.d.ts +0 -35
  388. package/lib/frontend/app/ui/gallery/thumbnailLoader.service.d.ts +0 -41
  389. package/lib/frontend/app/ui/gallery/thumbnailManager.service.d.ts +0 -46
  390. package/lib/frontend/app/ui/gallery/uploader/uploader.gallery.component.d.ts +0 -15
  391. package/lib/frontend/app/ui/gallery/uploader/uploader.service.d.ts +0 -36
  392. package/lib/frontend/app/ui/gallery/wakelock.service.d.ts +0 -19
  393. package/lib/frontend/app/ui/language/language.component.d.ts +0 -10
  394. package/lib/frontend/app/ui/login/login.component.d.ts +0 -18
  395. package/lib/frontend/app/ui/settings/extension-installer/extension-installer.component.d.ts +0 -18
  396. package/lib/frontend/app/ui/settings/extension-installer/extension-installer.service.d.ts +0 -10
  397. package/lib/frontend/app/ui/settings/gallery-statistic/gallery-statistic.component.d.ts +0 -5
  398. package/lib/frontend/app/ui/settings/scheduled-jobs.service.d.ts +0 -41
  399. package/lib/frontend/app/ui/settings/settings.service.d.ts +0 -27
  400. package/lib/frontend/app/ui/settings/sharings-list/sharings-list.component.d.ts +0 -14
  401. package/lib/frontend/app/ui/settings/template/CustomSettingsEntries.d.ts +0 -57
  402. package/lib/frontend/app/ui/settings/template/ISettingsComponent.d.ts +0 -13
  403. package/lib/frontend/app/ui/settings/template/settings-entry/settings-entry.component.d.ts +0 -118
  404. package/lib/frontend/app/ui/settings/template/settings-entry/sorting-method/sorting-method.settings-entry.component.d.ts +0 -28
  405. package/lib/frontend/app/ui/settings/template/template.component.d.ts +0 -97
  406. package/lib/frontend/app/ui/settings/users/users.component.d.ts +0 -47
  407. package/lib/frontend/app/ui/settings/users/users.service.d.ts +0 -12
  408. package/lib/frontend/app/ui/settings/workflow/button/job-button.settings.component.d.ts +0 -32
  409. package/lib/frontend/app/ui/settings/workflow/progress/job-progress.settings.component.d.ts +0 -25
  410. package/lib/frontend/app/ui/settings/workflow/workflow.component.d.ts +0 -68
  411. package/lib/frontend/app/ui/sharelogin/share-login.component.d.ts +0 -16
  412. package/lib/frontend/app/ui/utils/grid-size-icon/grid-size-icon.component.d.ts +0 -5
  413. package/lib/frontend/app/ui/utils/sorting-method-icon/sorting-method-icon.component.d.ts +0 -13
  414. package/lib/frontend/app/ui/utils/timestamp-datepicker/datepicker.component.d.ts +0 -10
  415. package/lib/frontend/app/ui/utils/timestamp-timepicker/timepicker.component.d.ts +0 -11
  416. package/lib/frontend/environments/environment.d.ts +0 -3
  417. package/lib/frontend/environments/environment.prod.d.ts +0 -3
  418. package/lib/frontend/main.d.ts +0 -21
  419. package/lib/frontend/polyfills.d.ts +0 -60
  420. package/lib/frontend/test.d.ts +0 -1
@@ -1,20 +1,87 @@
1
- import { SearchQueryDTO } from './entities/SearchQueryDTO';
1
+ import { DirectorySearch, SearchQueryDTO, SearchQueryTypes } from './entities/SearchQueryDTO';
2
2
  export declare const SearchQueryUtils: {
3
3
  negate: (query: SearchQueryDTO) => SearchQueryDTO;
4
4
  sortQuery(queryIN: SearchQueryDTO): SearchQueryDTO;
5
5
  stringifyForComparison(queryIN: SearchQueryDTO): string;
6
- isQueryEmpty(query: SearchQueryDTO): boolean;
7
- stripDefault: (val: any) => any;
6
+ isQueryEmpty(query: SearchQueryDTO | null | undefined): boolean;
7
+ stripDefault: <T>(val: T) => T;
8
+ /**
9
+ * False if a part of the query has a type that this version does not know, e.g. a hand-edited or outdated search link.
10
+ */
11
+ isKnownQuery: (query: SearchQueryDTO) => boolean;
8
12
  validateSearchQuery: (query: SearchQueryDTO, what?: string) => void;
13
+ /**
14
+ * Validates a directory allow / block list.
15
+ * Every entry has to be a directory TextSearch (type: SearchQueryTypes.directory).
16
+ */
17
+ validateDirectoryList: (list: DirectorySearch[] | null | undefined, what?: string) => void;
18
+ /**
19
+ * Validates that the query is a single directory TextSearch (type: SearchQueryTypes.directory).
20
+ */
21
+ validateDirectorySearch: (d: DirectorySearch, what?: string) => void;
22
+ /**
23
+ * Normalizes a relative directory path for matching:
24
+ * '/' separators, no leading './' or '/', no trailing '/'. Root is ''.
25
+ */
26
+ normalizeDirectoryPath: (dirPath: string) => string;
27
+ /**
28
+ * The directory path as the directory searches compare it: normalized, lower case and with runs of spaces collapsed
29
+ * (the SQL search collapses them too, see SearchManager; a double space in a name is usually a typo #1309).
30
+ * @param foldAccents also removes the accents, where the SQL search ignores them (see sqlIgnoresAccents of the backend)
31
+ */
32
+ comparableDirectoryPath: (dirPath: string, foldAccents?: boolean) => string;
33
+ /**
34
+ * Matches a relative directory path against a directory search, without any DB access.
35
+ * It follows the semantic of the SQL directory search (see SearchManager):
36
+ * - exact_match: the path equals to the value
37
+ * - like (default): the path contains the value
38
+ * - globMatch: the whole path matches the glob (* matches any characters, including '/', ? matches one character)
39
+ * A trailing '/*' means the directory itself and everything below it (e.g.: 'a/*' matches 'a', 'a/b', 'a/b/c').
40
+ * Use '/?*' to match only below a directory.
41
+ * Matching is case-insensitive, and ignores the accents with foldAccents.
42
+ */
43
+ matchDirectorySearch: (dirPath: string, search: DirectorySearch, foldAccents?: boolean) => boolean;
44
+ /**
45
+ * Returns the fixed path segments at the beginning of a directory search, that every match starts with.
46
+ * E.g.: exact 'a/b' -> ['a', 'b'], glob 'a/b/*' -> ['a', 'b'], glob 'a/b*' -> ['a'].
47
+ * Returns null if the matches can be anywhere (like and negated searches).
48
+ */
49
+ getDirectorySearchAnchor: (search: DirectorySearch, foldAccents?: boolean) => string[] | null;
50
+ /**
51
+ * True if all matches of the search can be found from its path alone: exact match, or a glob that has no wildcard
52
+ * other than a trailing '/*'. For other searches, the parents of the matching directories can only be found in the DB.
53
+ */
54
+ isDirectorySearchAnchored: (search: DirectorySearch) => boolean;
55
+ /**
56
+ * Returns true if the directory is a parent of the fixed part of any entry of the list.
57
+ * These parents are known from the path alone, without DB access.
58
+ * For globs it can be true for a directory that also matches the entry itself (e.g.: 'a' for 'a/*'),
59
+ * so check if the directory is allowed first.
60
+ */
61
+ isDirectoryAnchoredParent: (dirPath: string, list: DirectorySearch[], foldAccents?: boolean) => boolean;
62
+ /**
63
+ * Returns true if the directory matches any entry of the list.
64
+ */
65
+ matchDirectoryList: (dirPath: string, list: DirectorySearch[], foldAccents?: boolean) => boolean;
66
+ /**
67
+ * Converts a directory allow / block list to a single search query.
68
+ * A directory matches the list if it matches any of its entries.
69
+ * Returns null for an empty list.
70
+ */
71
+ directoryListToQuery: (list: DirectorySearch[]) => SearchQueryDTO | null;
9
72
  URLMap: Record<string, string>;
10
73
  /**
11
74
  * Make the SearchQuery URL friendly and shorter
12
75
  * @param query
13
76
  */
14
77
  urlify: (query: SearchQueryDTO) => string;
78
+ /**
79
+ * The urlified exact match text search (e.g. for a keyword, a person or a place link)
80
+ */
81
+ urlifyExactMatch: (type: SearchQueryTypes, value: string) => string;
15
82
  /**
16
83
  * Pareses the shortened urls and returns with the original SearchQueryDTO
17
84
  * @param urlQuery
18
85
  */
19
- parseURLifiedQuery: (urlQuery: string) => SearchQueryDTO;
86
+ parseURLifiedQuery: (urlQuery: string) => SearchQueryDTO | null;
20
87
  };
@@ -0,0 +1,443 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SearchQueryUtils = void 0;
4
+ const SearchQueryDTO_1 = require("./entities/SearchQueryDTO");
5
+ const SearchQueryParser_1 = require("./SearchQueryParser");
6
+ const Utils_1 = require("./Utils");
7
+ const TextFold_1 = require("./TextFold");
8
+ exports.SearchQueryUtils = {
9
+ negate: (query) => {
10
+ query = Utils_1.Utils.clone(query);
11
+ switch (query.type) {
12
+ case SearchQueryDTO_1.SearchQueryTypes.AND:
13
+ query.type = SearchQueryDTO_1.SearchQueryTypes.OR;
14
+ query.list = query.list.map((q) => exports.SearchQueryUtils.negate(q));
15
+ return query;
16
+ case SearchQueryDTO_1.SearchQueryTypes.OR:
17
+ query.type = SearchQueryDTO_1.SearchQueryTypes.AND;
18
+ query.list = query.list.map((q) => exports.SearchQueryUtils.negate(q));
19
+ return query;
20
+ case SearchQueryDTO_1.SearchQueryTypes.orientation:
21
+ query.landscape = !query.landscape;
22
+ return query;
23
+ case SearchQueryDTO_1.SearchQueryTypes.date:
24
+ case SearchQueryDTO_1.SearchQueryTypes.rating:
25
+ case SearchQueryDTO_1.SearchQueryTypes.resolution:
26
+ case SearchQueryDTO_1.SearchQueryTypes.person_count:
27
+ case SearchQueryDTO_1.SearchQueryTypes.distance:
28
+ case SearchQueryDTO_1.SearchQueryTypes.any_text:
29
+ case SearchQueryDTO_1.SearchQueryTypes.person:
30
+ case SearchQueryDTO_1.SearchQueryTypes.position:
31
+ case SearchQueryDTO_1.SearchQueryTypes.keyword:
32
+ case SearchQueryDTO_1.SearchQueryTypes.caption:
33
+ case SearchQueryDTO_1.SearchQueryTypes.file_name:
34
+ case SearchQueryDTO_1.SearchQueryTypes.directory:
35
+ query.negate = !query.negate;
36
+ return query;
37
+ case SearchQueryDTO_1.SearchQueryTypes.SOME_OF:
38
+ throw new Error('Some of not supported');
39
+ default:
40
+ throw new Error('Unknown type' + (query).type);
41
+ }
42
+ },
43
+ sortQuery(queryIN) {
44
+ const canonicalize = (value) => {
45
+ if (Array.isArray(value)) {
46
+ return value.map((v) => canonicalize(v));
47
+ }
48
+ if (value && typeof value === 'object') {
49
+ const obj = value;
50
+ const out = {};
51
+ const keys = Object.keys(obj).sort();
52
+ for (const k of keys) {
53
+ const v = canonicalize(obj[k]);
54
+ if (v !== undefined) {
55
+ out[k] = v;
56
+ }
57
+ }
58
+ return out;
59
+ }
60
+ return value;
61
+ };
62
+ if (!queryIN || (queryIN).type === undefined) {
63
+ return queryIN;
64
+ }
65
+ if (queryIN.type === SearchQueryDTO_1.SearchQueryTypes.AND ||
66
+ queryIN.type === SearchQueryDTO_1.SearchQueryTypes.OR ||
67
+ queryIN.type === SearchQueryDTO_1.SearchQueryTypes.SOME_OF) {
68
+ const ql = queryIN;
69
+ const children = (ql.list || []).map((c) => exports.SearchQueryUtils.sortQuery(c));
70
+ const withKeys = children.map((c) => ({ key: JSON.stringify(c), value: c }));
71
+ withKeys.sort((a, b) => a.key.localeCompare(b.key));
72
+ if (queryIN.type === SearchQueryDTO_1.SearchQueryTypes.SOME_OF) {
73
+ const so = queryIN;
74
+ const res = { type: queryIN.type };
75
+ if (so.min !== undefined) {
76
+ res['min'] = so.min;
77
+ }
78
+ res['list'] = withKeys.map((kv) => kv.value);
79
+ return canonicalize(res);
80
+ }
81
+ else {
82
+ const res = { type: queryIN.type };
83
+ res['list'] = withKeys.map((kv) => kv.value);
84
+ return canonicalize(res);
85
+ }
86
+ }
87
+ return canonicalize(queryIN);
88
+ },
89
+ stringifyForComparison(queryIN) {
90
+ return JSON.stringify(exports.SearchQueryUtils.sortQuery(queryIN));
91
+ },
92
+ isQueryEmpty(query) {
93
+ return !query ||
94
+ query.type === undefined ||
95
+ (query.type === SearchQueryDTO_1.SearchQueryTypes.any_text && !query.value);
96
+ },
97
+ // Recursively strip negate:false and matchType:like so that optional/default flags do not break validation
98
+ stripDefault: (val) => {
99
+ if (Array.isArray(val)) {
100
+ return val.map((v) => exports.SearchQueryUtils.stripDefault(v));
101
+ }
102
+ if (val && typeof val === 'object') {
103
+ const out = {};
104
+ for (const [k, value] of Object.entries(val)) {
105
+ const v = exports.SearchQueryUtils.stripDefault(value);
106
+ if (k === 'negate' && v === false) {
107
+ // drop negate:false
108
+ continue;
109
+ }
110
+ if (k === 'matchType' && v === SearchQueryDTO_1.TextSearchQueryMatchTypes.like) {
111
+ // drop matchType:like (this is the default)
112
+ continue;
113
+ }
114
+ // keep everything else, including negate:true and undefined-handled by equalsFilter
115
+ out[k] = v;
116
+ }
117
+ return out;
118
+ }
119
+ return val;
120
+ },
121
+ /**
122
+ * False if a part of the query has a type that this version does not know, e.g. a hand-edited or outdated search link.
123
+ */
124
+ isKnownQuery: (query) => {
125
+ if (!query || typeof query !== 'object' || query.type === SearchQueryDTO_1.SearchQueryTypes.UNKNOWN_RELATION ||
126
+ !Object.values(SearchQueryDTO_1.SearchQueryTypes).includes(query.type)) {
127
+ return false;
128
+ }
129
+ if (SearchQueryDTO_1.ListSearchQueryTypes.includes(query.type)) {
130
+ const list = query.list;
131
+ return Array.isArray(list) && list.every(exports.SearchQueryUtils.isKnownQuery);
132
+ }
133
+ return true;
134
+ },
135
+ validateSearchQuery: (query, what = 'SearchQuery') => {
136
+ if (!query) {
137
+ return;
138
+ }
139
+ const sp = new SearchQueryParser_1.SearchQueryParser();
140
+ try {
141
+ const parsed = sp.parse(sp.stringify(query));
142
+ const normParsed = exports.SearchQueryUtils.stripDefault(parsed);
143
+ const normQuery = exports.SearchQueryUtils.stripDefault(query);
144
+ if (!Utils_1.Utils.equalsFilter(normParsed, normQuery) || !Utils_1.Utils.equalsFilter(normQuery, normParsed)) {
145
+ throw new Error(`${what} is set to '${sp.stringify(query)}' and it is not valid. It fails on this validation test: Expected: ${JSON.stringify(parsed)} to equal: ${JSON.stringify(query)}`);
146
+ }
147
+ }
148
+ catch (e) {
149
+ if (e && e.message && e.message.startsWith(what)) {
150
+ throw e;
151
+ }
152
+ throw new Error(`${what} is not valid. ${e?.message ?? e}`, { cause: e });
153
+ }
154
+ },
155
+ /**
156
+ * Validates a directory allow / block list.
157
+ * Every entry has to be a directory TextSearch (type: SearchQueryTypes.directory).
158
+ */
159
+ validateDirectoryList: (list, what = 'Directory list') => {
160
+ if (list === null || typeof list === 'undefined') {
161
+ return;
162
+ }
163
+ if (!Array.isArray(list)) {
164
+ throw new Error(`${what} is not valid. It should be an array of directory searches. Got: ${JSON.stringify(list)}`);
165
+ }
166
+ for (const d of list) {
167
+ exports.SearchQueryUtils.validateDirectorySearch(d, what);
168
+ }
169
+ },
170
+ /**
171
+ * Validates that the query is a single directory TextSearch (type: SearchQueryTypes.directory).
172
+ */
173
+ validateDirectorySearch: (d, what = 'Directory search') => {
174
+ if (!d || d.type !== SearchQueryDTO_1.SearchQueryTypes.directory) {
175
+ throw new Error(`${what} is not valid. Only directory searches are allowed. Got: ${JSON.stringify(d)}`);
176
+ }
177
+ if (typeof d.value !== 'string' || d.value.trim() === '') {
178
+ throw new Error(`${what} is not valid. Directory search needs a non empty value. Got: ${JSON.stringify(d)}`);
179
+ }
180
+ if (typeof d.matchType !== 'undefined' && d.matchType !== null &&
181
+ !Object.values(SearchQueryDTO_1.TextSearchQueryMatchTypes).includes(d.matchType)) {
182
+ throw new Error(`${what} is not valid. Unknown match type: ${JSON.stringify(d)}`);
183
+ }
184
+ if (typeof d.negate !== 'undefined' && d.negate !== null && typeof d.negate !== 'boolean') {
185
+ throw new Error(`${what} is not valid. negate should be boolean: ${JSON.stringify(d)}`);
186
+ }
187
+ },
188
+ /**
189
+ * Normalizes a relative directory path for matching:
190
+ * '/' separators, no leading './' or '/', no trailing '/'. Root is ''.
191
+ */
192
+ normalizeDirectoryPath: (dirPath) => {
193
+ const parts = (dirPath || '').replace(/\\/g, '/').split('/')
194
+ .filter(p => p !== '' && p !== '.');
195
+ return parts.join('/');
196
+ },
197
+ /**
198
+ * The directory path as the directory searches compare it: normalized, lower case and with runs of spaces collapsed
199
+ * (the SQL search collapses them too, see SearchManager; a double space in a name is usually a typo #1309).
200
+ * @param foldAccents also removes the accents, where the SQL search ignores them (see sqlIgnoresAccents of the backend)
201
+ */
202
+ comparableDirectoryPath: (dirPath, foldAccents = false) => {
203
+ const p = exports.SearchQueryUtils.normalizeDirectoryPath(dirPath).toLowerCase().replace(/ {2,}/g, ' ');
204
+ return foldAccents ? p.replace(/\P{ASCII}/gu, TextFold_1.foldChar) : p;
205
+ },
206
+ /**
207
+ * Matches a relative directory path against a directory search, without any DB access.
208
+ * It follows the semantic of the SQL directory search (see SearchManager):
209
+ * - exact_match: the path equals to the value
210
+ * - like (default): the path contains the value
211
+ * - globMatch: the whole path matches the glob (* matches any characters, including '/', ? matches one character)
212
+ * A trailing '/*' means the directory itself and everything below it (e.g.: 'a/*' matches 'a', 'a/b', 'a/b/c').
213
+ * Use '/?*' to match only below a directory.
214
+ * Matching is case-insensitive, and ignores the accents with foldAccents.
215
+ */
216
+ matchDirectorySearch: (dirPath, search, foldAccents = false) => {
217
+ const p = exports.SearchQueryUtils.comparableDirectoryPath(dirPath, foldAccents);
218
+ const value = exports.SearchQueryUtils.comparableDirectoryPath(search.value, foldAccents);
219
+ let match;
220
+ switch (search.matchType ?? SearchQueryDTO_1.TextSearchQueryMatchTypes.like) {
221
+ case SearchQueryDTO_1.TextSearchQueryMatchTypes.exact_match:
222
+ match = p === value;
223
+ break;
224
+ case SearchQueryDTO_1.TextSearchQueryMatchTypes.globMatch: {
225
+ const regex = value.split('').map(c => {
226
+ if (c === '*') {
227
+ return '.*';
228
+ }
229
+ if (c === '?') {
230
+ return '.';
231
+ }
232
+ return c.replace(/[.+^${}()|[\]\\]/g, '\\$&');
233
+ }).join('');
234
+ match = new RegExp('^' + regex + '$', 's').test(p) ||
235
+ (value.endsWith('/*') && p === value.slice(0, -2));
236
+ break;
237
+ }
238
+ default:
239
+ match = p.includes(value);
240
+ }
241
+ return search.negate ? !match : match;
242
+ },
243
+ /**
244
+ * Returns the fixed path segments at the beginning of a directory search, that every match starts with.
245
+ * E.g.: exact 'a/b' -> ['a', 'b'], glob 'a/b/*' -> ['a', 'b'], glob 'a/b*' -> ['a'].
246
+ * Returns null if the matches can be anywhere (like and negated searches).
247
+ */
248
+ getDirectorySearchAnchor: (search, foldAccents = false) => {
249
+ if (search.negate) {
250
+ return null;
251
+ }
252
+ const segments = exports.SearchQueryUtils.comparableDirectoryPath(search.value, foldAccents).split('/')
253
+ .filter(s => s !== '');
254
+ switch (search.matchType ?? SearchQueryDTO_1.TextSearchQueryMatchTypes.like) {
255
+ case SearchQueryDTO_1.TextSearchQueryMatchTypes.exact_match:
256
+ return segments;
257
+ case SearchQueryDTO_1.TextSearchQueryMatchTypes.globMatch: {
258
+ const firstWildcard = segments.findIndex(s => s.includes('*') || s.includes('?'));
259
+ return firstWildcard === -1 ? segments : segments.slice(0, firstWildcard);
260
+ }
261
+ default:
262
+ return null;
263
+ }
264
+ },
265
+ /**
266
+ * True if all matches of the search can be found from its path alone: exact match, or a glob that has no wildcard
267
+ * other than a trailing '/*'. For other searches, the parents of the matching directories can only be found in the DB.
268
+ */
269
+ isDirectorySearchAnchored: (search) => {
270
+ if (search.negate) {
271
+ return false;
272
+ }
273
+ const value = exports.SearchQueryUtils.normalizeDirectoryPath(search.value);
274
+ switch (search.matchType ?? SearchQueryDTO_1.TextSearchQueryMatchTypes.like) {
275
+ case SearchQueryDTO_1.TextSearchQueryMatchTypes.exact_match:
276
+ return true;
277
+ case SearchQueryDTO_1.TextSearchQueryMatchTypes.globMatch: {
278
+ const fixedPart = value.endsWith('/*') ? value.slice(0, -2) : (value === '*' ? '' : value);
279
+ return !fixedPart.includes('*') && !fixedPart.includes('?');
280
+ }
281
+ default:
282
+ return false;
283
+ }
284
+ },
285
+ /**
286
+ * Returns true if the directory is a parent of the fixed part of any entry of the list.
287
+ * These parents are known from the path alone, without DB access.
288
+ * For globs it can be true for a directory that also matches the entry itself (e.g.: 'a' for 'a/*'),
289
+ * so check if the directory is allowed first.
290
+ */
291
+ isDirectoryAnchoredParent: (dirPath, list, foldAccents = false) => {
292
+ const p = exports.SearchQueryUtils.comparableDirectoryPath(dirPath, foldAccents).split('/')
293
+ .filter(s => s !== '');
294
+ return (list || []).some(d => {
295
+ const anchor = exports.SearchQueryUtils.getDirectorySearchAnchor(d, foldAccents);
296
+ if (anchor === null || p.length > anchor.length) {
297
+ return false;
298
+ }
299
+ if (!p.every((s, i) => s === anchor[i])) {
300
+ return false;
301
+ }
302
+ // an exact search (or a glob without wildcards) only has parents above its own path
303
+ const hasWildcard = d.matchType === SearchQueryDTO_1.TextSearchQueryMatchTypes.globMatch &&
304
+ (d.value.includes('*') || d.value.includes('?'));
305
+ return p.length < anchor.length || hasWildcard;
306
+ });
307
+ },
308
+ /**
309
+ * Returns true if the directory matches any entry of the list.
310
+ */
311
+ matchDirectoryList: (dirPath, list, foldAccents = false) => {
312
+ return (list || []).some(d => exports.SearchQueryUtils.matchDirectorySearch(dirPath, d, foldAccents));
313
+ },
314
+ /**
315
+ * Converts a directory allow / block list to a single search query.
316
+ * A directory matches the list if it matches any of its entries.
317
+ * Returns null for an empty list.
318
+ */
319
+ directoryListToQuery: (list) => {
320
+ exports.SearchQueryUtils.validateDirectoryList(list);
321
+ if (!list || list.length === 0) {
322
+ return null;
323
+ }
324
+ // plain copies, so config objects do not end up in the query
325
+ const queries = list.map(d => {
326
+ const q = { type: SearchQueryDTO_1.SearchQueryTypes.directory, value: d.value };
327
+ if (typeof d.matchType !== 'undefined' && d.matchType !== null) {
328
+ q.matchType = d.matchType;
329
+ }
330
+ if (d.negate) {
331
+ q.negate = true;
332
+ }
333
+ return q;
334
+ });
335
+ if (queries.length === 1) {
336
+ return queries[0];
337
+ }
338
+ return { type: SearchQueryDTO_1.SearchQueryTypes.OR, list: queries };
339
+ },
340
+ URLMap: {
341
+ type: 't',
342
+ list: 'l',
343
+ negate: 'n',
344
+ matchType: 'mt',
345
+ distance: 'd',
346
+ from: 'f',
347
+ value: 'v',
348
+ min: 'm',
349
+ max: 'x',
350
+ landscape: 'ls',
351
+ daysLength: 'dl',
352
+ frequency: 'fq',
353
+ agoNumber: 'an',
354
+ GPSData: 'g',
355
+ latitude: 'lat',
356
+ longitude: 'lng',
357
+ },
358
+ /**
359
+ * Make the SearchQuery URL friendly and shorter
360
+ * @param query
361
+ */
362
+ urlify: (query) => {
363
+ if (!query) {
364
+ return '';
365
+ }
366
+ query = exports.SearchQueryUtils.stripDefault(query);
367
+ const shorten = (obj) => {
368
+ if (Array.isArray(obj)) {
369
+ return obj.map(shorten);
370
+ }
371
+ if (obj && typeof obj === 'object') {
372
+ const o = obj;
373
+ const res = {};
374
+ for (const key of Object.keys(o)) {
375
+ if (key === 'negate' && o[key] === false) {
376
+ continue;
377
+ }
378
+ res[exports.SearchQueryUtils.URLMap[key] || key] = shorten(o[key]);
379
+ }
380
+ return res;
381
+ }
382
+ return obj;
383
+ };
384
+ return JSON.stringify(shorten(query));
385
+ },
386
+ /**
387
+ * The urlified exact match text search (e.g. for a keyword, a person or a place link)
388
+ */
389
+ urlifyExactMatch: (type, value) => {
390
+ return exports.SearchQueryUtils.urlify({
391
+ type,
392
+ matchType: SearchQueryDTO_1.TextSearchQueryMatchTypes.exact_match,
393
+ value,
394
+ });
395
+ },
396
+ /**
397
+ * Pareses the shortened urls and returns with the original SearchQueryDTO
398
+ * @param urlQuery
399
+ */
400
+ parseURLifiedQuery: (urlQuery) => {
401
+ if (!urlQuery || urlQuery === '') {
402
+ return null;
403
+ }
404
+ const map = {};
405
+ Object.keys(exports.SearchQueryUtils.URLMap).forEach(key => {
406
+ map[exports.SearchQueryUtils.URLMap[key]] = key;
407
+ });
408
+ const unshorten = (obj) => {
409
+ if (Array.isArray(obj)) {
410
+ return obj.map(unshorten);
411
+ }
412
+ if (obj && typeof obj === 'object') {
413
+ const o = obj;
414
+ const type = o['t'];
415
+ const res = {};
416
+ for (const key of Object.keys(o)) {
417
+ let unshortenedKey = map[key] || key;
418
+ if (unshortenedKey === 'text' && type !== undefined && !SearchQueryDTO_1.TextSearchQueryTypes.includes(type)) {
419
+ // If it's not a text search, 'v' should map to 'value'
420
+ if (SearchQueryDTO_1.RangeSearchQueryTypes.includes(type)) {
421
+ unshortenedKey = 'value';
422
+ }
423
+ }
424
+ res[unshortenedKey] = unshorten(o[key]);
425
+ }
426
+ return res;
427
+ }
428
+ return obj;
429
+ };
430
+ let parsed = null;
431
+ try {
432
+ parsed = JSON.parse(urlQuery);
433
+ }
434
+ catch {
435
+ // not JSON, handled below
436
+ }
437
+ // Not a query object, e.g. a hand-typed /search/cat url: search for it as text
438
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
439
+ return { type: SearchQueryDTO_1.SearchQueryTypes.any_text, value: urlQuery };
440
+ }
441
+ return unshorten(parsed);
442
+ }
443
+ };
@@ -1,3 +1,13 @@
1
+ import type { ClientConfig } from './config/public/ClientConfig';
2
+ /**
3
+ * The part of the config the formats are read from.
4
+ * Both the public (frontend) and the private (backend) config have it.
5
+ */
6
+ export type SupportedFormatsConfig = Pick<ClientConfig, 'Media' | 'MetaFile'>;
7
+ /**
8
+ * Lists the supported file formats.
9
+ * Empty until init() is called: the public config calls it in the frontend, the private config in the backend.
10
+ */
1
11
  export declare class SupportedFormats {
2
12
  static Photos: string[];
3
13
  static Videos: string[];
@@ -15,5 +25,5 @@ export declare class SupportedFormats {
15
25
  Videos: string[];
16
26
  };
17
27
  };
18
- static init(): void;
28
+ static init(config: SupportedFormatsConfig): void;
19
29
  }
@@ -1,29 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SupportedFormats = void 0;
4
- let Config;
5
- if (typeof window !== 'undefined') {
6
- // eslint-disable-next-line @typescript-eslint/no-require-imports
7
- Config = require('./config/public/Config').Config;
8
- }
9
- else {
10
- // eslint-disable-next-line @typescript-eslint/no-require-imports
11
- Config = require('./config/private/Config').Config;
12
- }
4
+ /**
5
+ * Lists the supported file formats.
6
+ * Empty until init() is called: the public config calls it in the frontend, the private config in the backend.
7
+ */
13
8
  class SupportedFormats {
14
- static { this.Photos = Config.Media.Photo.supportedFormats; }
9
+ static { this.Photos = []; }
15
10
  // Browser-supported video formats
16
11
  // Read more: https://www.w3schools.com/html/html5_video.asp
17
- static { this.Videos = Config.Media.Video.supportedFormats; }
18
- static { this.MetaFiles = Config.MetaFile.supportedFormats; }
12
+ static { this.Videos = []; }
13
+ static { this.MetaFiles = []; }
19
14
  // These formats need to be transcoded (with the built-in ffmpeg support)
20
15
  static { this.TranscodeNeed = {
21
16
  // based on libvips, all supported formats for sharp: https://github.com/libvips/libvips
22
17
  Photos: [],
23
- Videos: Config.Media.Video.supportedFormatsWithTranscoding,
18
+ Videos: [],
24
19
  }; }
25
- // --------------------------------------------
26
- // Below this, it is autogenerated, DO NOT EDIT
27
20
  static { this.WithDots = {
28
21
  Photos: [],
29
22
  Videos: [],
@@ -33,9 +26,11 @@ class SupportedFormats {
33
26
  Videos: [],
34
27
  }
35
28
  }; }
36
- static init() {
37
- SupportedFormats.Photos = SupportedFormats.Photos.concat(SupportedFormats.TranscodeNeed.Photos);
38
- SupportedFormats.Videos = SupportedFormats.Videos.concat(SupportedFormats.TranscodeNeed.Videos);
29
+ static init(config) {
30
+ SupportedFormats.TranscodeNeed.Videos = config.Media.Video.supportedFormatsWithTranscoding;
31
+ SupportedFormats.Photos = config.Media.Photo.supportedFormats.concat(SupportedFormats.TranscodeNeed.Photos);
32
+ SupportedFormats.Videos = config.Media.Video.supportedFormats.concat(SupportedFormats.TranscodeNeed.Videos);
33
+ SupportedFormats.MetaFiles = config.MetaFile.supportedFormats;
39
34
  SupportedFormats.WithDots.Photos = SupportedFormats.Photos.map((f) => '.' + f);
40
35
  SupportedFormats.WithDots.Videos = SupportedFormats.Videos.map((f) => '.' + f);
41
36
  SupportedFormats.WithDots.MetaFiles = SupportedFormats.MetaFiles.map((f) => '.' + f);
@@ -46,4 +41,3 @@ class SupportedFormats {
46
41
  }
47
42
  }
48
43
  exports.SupportedFormats = SupportedFormats;
49
- SupportedFormats.init();
@@ -0,0 +1,6 @@
1
+ /**
2
+ * One letter in lowercase and without its accents ("Á" -> "a"), to compare texts the way MySQL's utf8mb4_general_ci does (#1309).
3
+ * Used by the SQLite search (fold()) and by the autocomplete of the client, which bolds the typed text.
4
+ * NFD only splits letters that carry a combining mark: ø, ł or ß stay as they are.
5
+ */
6
+ export declare const foldChar: (char: string) => string;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.foldChar = void 0;
4
+ const foldedChars = new Map();
5
+ /**
6
+ * One letter in lowercase and without its accents ("Á" -> "a"), to compare texts the way MySQL's utf8mb4_general_ci does (#1309).
7
+ * Used by the SQLite search (fold()) and by the autocomplete of the client, which bolds the typed text.
8
+ * NFD only splits letters that carry a combining mark: ø, ł or ß stay as they are.
9
+ */
10
+ const foldChar = (char) => {
11
+ let folded = foldedChars.get(char);
12
+ if (folded === undefined) {
13
+ // ς is how a word-final σ is written: toLowerCase() makes it from Σ depending on what follows
14
+ folded = char.toLowerCase().normalize('NFD').replace(/\p{M}/gu, '').replace('ς', 'σ');
15
+ foldedChars.set(char, folded);
16
+ }
17
+ return folded;
18
+ };
19
+ exports.foldChar = foldChar;
@@ -0,0 +1,4 @@
1
+ export declare class UploadUtils {
2
+ static getExtension(filename: string): string;
3
+ static isUploadableExtension(ext: string, blockedExtensions: string[]): boolean;
4
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UploadUtils = void 0;
4
+ const SupportedFormats_1 = require("./SupportedFormats");
5
+ class UploadUtils {
6
+ static getExtension(filename) {
7
+ const dot = filename.lastIndexOf('.');
8
+ return dot === -1 ? '' : filename.substring(dot + 1).toLowerCase();
9
+ }
10
+ static isUploadableExtension(ext, blockedExtensions) {
11
+ ext = ext.toLowerCase();
12
+ if (blockedExtensions.some(b => b.toLowerCase() === ext)) {
13
+ return false;
14
+ }
15
+ return SupportedFormats_1.SupportedFormats.Photos.includes(ext) ||
16
+ SupportedFormats_1.SupportedFormats.Videos.includes(ext) ||
17
+ SupportedFormats_1.SupportedFormats.MetaFiles.includes(ext);
18
+ }
19
+ }
20
+ exports.UploadUtils = UploadUtils;