@jrmc/adonis-attachment 5.2.1 → 6.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (424) hide show
  1. package/README.md +10 -81
  2. package/build/bin/test.d.ts +2 -0
  3. package/build/bin/test.d.ts.map +1 -0
  4. package/build/bin/test.js +9 -0
  5. package/build/bin/test.js.map +1 -0
  6. package/build/commands/commands.json +1 -1
  7. package/build/commands/make/attachment_v5_migration.d.ts +17 -0
  8. package/build/commands/make/attachment_v5_migration.d.ts.map +1 -0
  9. package/build/commands/make/attachment_v5_migration.js +26 -0
  10. package/build/commands/make/attachment_v5_migration.js.map +1 -0
  11. package/build/commands/make/{converter.d.ts → attachments_table.d.ts} +6 -4
  12. package/build/commands/make/attachments_table.d.ts.map +1 -0
  13. package/build/commands/make/attachments_table.js +30 -0
  14. package/build/commands/make/attachments_table.js.map +1 -0
  15. package/build/configure.d.ts.map +1 -1
  16. package/build/configure.js +2 -1
  17. package/build/configure.js.map +1 -0
  18. package/build/index.d.ts +26 -10
  19. package/build/index.d.ts.map +1 -1
  20. package/build/index.js +16 -9
  21. package/build/index.js.map +1 -0
  22. package/build/providers/attachment_provider.d.ts +0 -19
  23. package/build/providers/attachment_provider.d.ts.map +1 -1
  24. package/build/providers/attachment_provider.js +30 -26
  25. package/build/providers/attachment_provider.js.map +1 -0
  26. package/build/services/main.d.ts +3 -3
  27. package/build/services/main.d.ts.map +1 -1
  28. package/build/services/main.js +42 -5
  29. package/build/services/main.js.map +1 -0
  30. package/build/src/adapters/adonis_drive_storage.d.ts +33 -0
  31. package/build/src/adapters/adonis_drive_storage.d.ts.map +1 -0
  32. package/build/src/adapters/adonis_drive_storage.js +35 -0
  33. package/build/src/adapters/adonis_drive_storage.js.map +1 -0
  34. package/build/src/adapters/local_file_storage.d.ts +25 -0
  35. package/build/src/adapters/local_file_storage.d.ts.map +1 -0
  36. package/build/src/adapters/local_file_storage.js +54 -0
  37. package/build/src/adapters/local_file_storage.js.map +1 -0
  38. package/build/src/controllers/attachments_controller.d.ts +13 -2
  39. package/build/src/controllers/attachments_controller.d.ts.map +1 -1
  40. package/build/src/controllers/attachments_controller.js +20 -107
  41. package/build/src/controllers/attachments_controller.js.map +1 -0
  42. package/build/src/core/attachment.d.ts +70 -0
  43. package/build/src/core/attachment.d.ts.map +1 -0
  44. package/build/src/core/attachment.js +150 -0
  45. package/build/src/core/attachment.js.map +1 -0
  46. package/build/src/core/attachment_job_processor.d.ts +30 -0
  47. package/build/src/core/attachment_job_processor.d.ts.map +1 -0
  48. package/build/src/core/attachment_job_processor.js +47 -0
  49. package/build/src/core/attachment_job_processor.js.map +1 -0
  50. package/build/src/core/attachment_options.d.ts +32 -0
  51. package/build/src/core/attachment_options.d.ts.map +1 -0
  52. package/build/src/core/attachment_options.js +24 -0
  53. package/build/src/core/attachment_options.js.map +1 -0
  54. package/build/src/core/attachment_repository.d.ts +15 -0
  55. package/build/src/core/attachment_repository.d.ts.map +1 -0
  56. package/build/src/core/attachment_repository.js +8 -0
  57. package/build/src/core/attachment_repository.js.map +1 -0
  58. package/build/src/core/attachment_service.d.ts +34 -0
  59. package/build/src/core/attachment_service.d.ts.map +1 -0
  60. package/build/src/core/attachment_service.js +93 -0
  61. package/build/src/core/attachment_service.js.map +1 -0
  62. package/build/src/core/attachment_state.d.ts +11 -0
  63. package/build/src/core/attachment_state.d.ts.map +1 -0
  64. package/build/src/core/attachment_state.js +17 -0
  65. package/build/src/core/attachment_state.js.map +1 -0
  66. package/build/src/core/index.d.ts +14 -0
  67. package/build/src/core/index.d.ts.map +1 -0
  68. package/build/src/core/index.js +11 -0
  69. package/build/src/core/index.js.map +1 -0
  70. package/build/src/core/queue.d.ts +20 -0
  71. package/build/src/core/queue.d.ts.map +1 -0
  72. package/build/src/{types/event.js → core/queue.js} +1 -0
  73. package/build/src/core/queue.js.map +1 -0
  74. package/build/src/core/storage.d.ts +23 -0
  75. package/build/src/core/storage.d.ts.map +1 -0
  76. package/build/src/{types/config.js → core/storage.js} +1 -0
  77. package/build/src/core/storage.js.map +1 -0
  78. package/build/src/define_config.d.ts +39 -20
  79. package/build/src/define_config.d.ts.map +1 -1
  80. package/build/src/define_config.js +46 -24
  81. package/build/src/define_config.js.map +1 -0
  82. package/build/src/integrations/lucid/attachment_column.d.ts +18 -0
  83. package/build/src/integrations/lucid/attachment_column.d.ts.map +1 -0
  84. package/build/src/integrations/lucid/attachment_column.js +151 -0
  85. package/build/src/integrations/lucid/attachment_column.js.map +1 -0
  86. package/build/src/integrations/lucid/attachment_model.d.ts +37 -0
  87. package/build/src/integrations/lucid/attachment_model.d.ts.map +1 -0
  88. package/build/src/integrations/lucid/attachment_model.js +99 -0
  89. package/build/src/integrations/lucid/attachment_model.js.map +1 -0
  90. package/build/src/integrations/lucid/attachment_owner.d.ts +18 -0
  91. package/build/src/integrations/lucid/attachment_owner.d.ts.map +1 -0
  92. package/build/src/integrations/lucid/attachment_owner.js +15 -0
  93. package/build/src/integrations/lucid/attachment_owner.js.map +1 -0
  94. package/build/src/integrations/lucid/attachment_relation.d.ts +60 -0
  95. package/build/src/integrations/lucid/attachment_relation.d.ts.map +1 -0
  96. package/build/src/integrations/lucid/attachment_relation.js +163 -0
  97. package/build/src/integrations/lucid/attachment_relation.js.map +1 -0
  98. package/build/src/integrations/lucid/attachments_table_stub.d.ts +21 -0
  99. package/build/src/integrations/lucid/attachments_table_stub.d.ts.map +1 -0
  100. package/build/src/integrations/lucid/attachments_table_stub.js +26 -0
  101. package/build/src/integrations/lucid/attachments_table_stub.js.map +1 -0
  102. package/build/src/integrations/lucid/create_legacy_attachment_migration_script.d.ts +13 -0
  103. package/build/src/integrations/lucid/create_legacy_attachment_migration_script.d.ts.map +1 -0
  104. package/build/src/integrations/lucid/create_legacy_attachment_migration_script.js +20 -0
  105. package/build/src/integrations/lucid/create_legacy_attachment_migration_script.js.map +1 -0
  106. package/build/src/integrations/lucid/index.d.ts +20 -0
  107. package/build/src/integrations/lucid/index.d.ts.map +1 -0
  108. package/build/src/integrations/lucid/index.js +20 -0
  109. package/build/src/integrations/lucid/index.js.map +1 -0
  110. package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.d.ts +30 -0
  111. package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.d.ts.map +1 -0
  112. package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.js +188 -0
  113. package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.js.map +1 -0
  114. package/build/src/integrations/lucid/lucid_attachment_repository.d.ts +18 -0
  115. package/build/src/integrations/lucid/lucid_attachment_repository.d.ts.map +1 -0
  116. package/build/src/integrations/lucid/lucid_attachment_repository.js +21 -0
  117. package/build/src/integrations/lucid/lucid_attachment_repository.js.map +1 -0
  118. package/build/src/integrations/lucid/lucid_attachment_store.d.ts +36 -0
  119. package/build/src/integrations/lucid/lucid_attachment_store.d.ts.map +1 -0
  120. package/build/src/integrations/lucid/lucid_attachment_store.js +179 -0
  121. package/build/src/integrations/lucid/lucid_attachment_store.js.map +1 -0
  122. package/build/src/integrations/lucid/lucid_variant_generation_service.d.ts +24 -0
  123. package/build/src/integrations/lucid/lucid_variant_generation_service.d.ts.map +1 -0
  124. package/build/src/integrations/lucid/lucid_variant_generation_service.js +42 -0
  125. package/build/src/integrations/lucid/lucid_variant_generation_service.js.map +1 -0
  126. package/build/src/integrations/lucid/migrate_legacy_attachment.d.ts +64 -0
  127. package/build/src/integrations/lucid/migrate_legacy_attachment.d.ts.map +1 -0
  128. package/build/src/integrations/lucid/migrate_legacy_attachment.js +89 -0
  129. package/build/src/integrations/lucid/migrate_legacy_attachment.js.map +1 -0
  130. package/build/src/integrations/lucid/migrate_legacy_attachment_records.d.ts +34 -0
  131. package/build/src/integrations/lucid/migrate_legacy_attachment_records.d.ts.map +1 -0
  132. package/build/src/integrations/lucid/migrate_legacy_attachment_records.js +47 -0
  133. package/build/src/integrations/lucid/migrate_legacy_attachment_records.js.map +1 -0
  134. package/build/src/integrations/lucid/render_legacy_attachment_migration_script.d.ts +11 -0
  135. package/build/src/integrations/lucid/render_legacy_attachment_migration_script.d.ts.map +1 -0
  136. package/build/src/integrations/lucid/render_legacy_attachment_migration_script.js +41 -0
  137. package/build/src/integrations/lucid/render_legacy_attachment_migration_script.js.map +1 -0
  138. package/build/src/queues/adonis_queue.d.ts +27 -0
  139. package/build/src/queues/adonis_queue.d.ts.map +1 -0
  140. package/build/src/queues/adonis_queue.js +22 -0
  141. package/build/src/queues/adonis_queue.js.map +1 -0
  142. package/build/src/queues/memory_queue.d.ts +22 -0
  143. package/build/src/queues/memory_queue.d.ts.map +1 -0
  144. package/build/src/queues/memory_queue.js +67 -0
  145. package/build/src/queues/memory_queue.js.map +1 -0
  146. package/build/src/sources/attachment_manager.d.ts +53 -0
  147. package/build/src/sources/attachment_manager.d.ts.map +1 -0
  148. package/build/src/sources/attachment_manager.js +177 -0
  149. package/build/src/sources/attachment_manager.js.map +1 -0
  150. package/build/src/variants/variant_converter.d.ts +23 -0
  151. package/build/src/variants/variant_converter.d.ts.map +1 -0
  152. package/build/src/{types/converter.js → variants/variant_converter.js} +1 -0
  153. package/build/src/variants/variant_converter.js.map +1 -0
  154. package/build/src/variants/variant_generation_service.d.ts +28 -0
  155. package/build/src/variants/variant_generation_service.d.ts.map +1 -0
  156. package/build/src/variants/variant_generation_service.js +44 -0
  157. package/build/src/variants/variant_generation_service.js.map +1 -0
  158. package/build/stubs/config/attachment.stub +12 -0
  159. package/build/stubs/main.d.ts.map +1 -1
  160. package/build/stubs/main.js +1 -0
  161. package/build/stubs/main.js.map +1 -0
  162. package/build/stubs/migrations/attachments_table.stub +39 -0
  163. package/build/tests/adonis_drive_storage.spec.d.ts +8 -0
  164. package/build/tests/adonis_drive_storage.spec.d.ts.map +1 -0
  165. package/build/tests/adonis_drive_storage.spec.js +69 -0
  166. package/build/tests/adonis_drive_storage.spec.js.map +1 -0
  167. package/build/{src/types/attachment.js → tests/adonis_queue.spec.d.ts} +1 -0
  168. package/build/tests/adonis_queue.spec.d.ts.map +1 -0
  169. package/build/tests/adonis_queue.spec.js +52 -0
  170. package/build/tests/adonis_queue.spec.js.map +1 -0
  171. package/build/tests/attachment_job_processor.spec.d.ts +8 -0
  172. package/build/tests/attachment_job_processor.spec.d.ts.map +1 -0
  173. package/build/tests/attachment_job_processor.spec.js +89 -0
  174. package/build/tests/attachment_job_processor.spec.js.map +1 -0
  175. package/build/tests/attachment_manager.spec.d.ts +8 -0
  176. package/build/tests/attachment_manager.spec.d.ts.map +1 -0
  177. package/build/tests/attachment_manager.spec.js +131 -0
  178. package/build/tests/attachment_manager.spec.js.map +1 -0
  179. package/build/tests/attachment_manager_service.spec.d.ts +8 -0
  180. package/build/tests/attachment_manager_service.spec.d.ts.map +1 -0
  181. package/build/tests/attachment_manager_service.spec.js +47 -0
  182. package/build/tests/attachment_manager_service.spec.js.map +1 -0
  183. package/build/tests/attachment_options.spec.d.ts +2 -0
  184. package/build/tests/attachment_options.spec.d.ts.map +1 -0
  185. package/build/tests/attachment_options.spec.js +31 -0
  186. package/build/tests/attachment_options.spec.js.map +1 -0
  187. package/build/tests/attachment_provider.spec.d.ts +8 -0
  188. package/build/tests/attachment_provider.spec.d.ts.map +1 -0
  189. package/build/tests/attachment_provider.spec.js +71 -0
  190. package/build/tests/attachment_provider.spec.js.map +1 -0
  191. package/build/tests/attachment_service.spec.d.ts +8 -0
  192. package/build/tests/attachment_service.spec.d.ts.map +1 -0
  193. package/build/tests/attachment_service.spec.js +146 -0
  194. package/build/tests/attachment_service.spec.js.map +1 -0
  195. package/build/tests/attachments_controller.spec.d.ts +8 -0
  196. package/build/tests/attachments_controller.spec.d.ts.map +1 -0
  197. package/build/tests/attachments_controller.spec.js +34 -0
  198. package/build/tests/attachments_controller.spec.js.map +1 -0
  199. package/build/tests/attachments_table_stub.spec.d.ts +2 -0
  200. package/build/tests/attachments_table_stub.spec.d.ts.map +1 -0
  201. package/build/tests/attachments_table_stub.spec.js +66 -0
  202. package/build/tests/attachments_table_stub.spec.js.map +1 -0
  203. package/build/tests/configure.spec.d.ts +2 -0
  204. package/build/tests/configure.spec.d.ts.map +1 -0
  205. package/build/tests/configure.spec.js +38 -0
  206. package/build/tests/configure.spec.js.map +1 -0
  207. package/build/tests/container_bindings.types.d.ts +8 -0
  208. package/build/tests/container_bindings.types.d.ts.map +1 -0
  209. package/build/tests/container_bindings.types.js +9 -0
  210. package/build/tests/container_bindings.types.js.map +1 -0
  211. package/build/tests/create_legacy_attachment_migration_script.spec.d.ts +8 -0
  212. package/build/tests/create_legacy_attachment_migration_script.spec.d.ts.map +1 -0
  213. package/build/tests/create_legacy_attachment_migration_script.spec.js +31 -0
  214. package/build/tests/create_legacy_attachment_migration_script.spec.js.map +1 -0
  215. package/build/tests/define_config.spec.d.ts +8 -0
  216. package/build/tests/define_config.spec.d.ts.map +1 -0
  217. package/build/tests/define_config.spec.js +203 -0
  218. package/build/tests/define_config.spec.js.map +1 -0
  219. package/build/tests/helpers/lucid_test_database.d.ts +9 -0
  220. package/build/tests/helpers/lucid_test_database.d.ts.map +1 -0
  221. package/build/tests/helpers/lucid_test_database.js +52 -0
  222. package/build/tests/helpers/lucid_test_database.js.map +1 -0
  223. package/build/tests/local_file_storage.spec.d.ts +8 -0
  224. package/build/tests/local_file_storage.spec.d.ts.map +1 -0
  225. package/build/tests/local_file_storage.spec.js +44 -0
  226. package/build/tests/local_file_storage.spec.js.map +1 -0
  227. package/build/tests/lucid_attachment_collection_store.spec.d.ts +2 -0
  228. package/build/tests/lucid_attachment_collection_store.spec.d.ts.map +1 -0
  229. package/build/tests/lucid_attachment_collection_store.spec.js +52 -0
  230. package/build/tests/lucid_attachment_collection_store.spec.js.map +1 -0
  231. package/build/tests/lucid_attachment_column.spec.d.ts +8 -0
  232. package/build/tests/lucid_attachment_column.spec.d.ts.map +1 -0
  233. package/build/tests/lucid_attachment_column.spec.js +193 -0
  234. package/build/tests/lucid_attachment_column.spec.js.map +1 -0
  235. package/build/tests/lucid_attachment_lifecycle_service.spec.d.ts +8 -0
  236. package/build/tests/lucid_attachment_lifecycle_service.spec.d.ts.map +1 -0
  237. package/build/tests/lucid_attachment_lifecycle_service.spec.js +378 -0
  238. package/build/tests/lucid_attachment_lifecycle_service.spec.js.map +1 -0
  239. package/build/tests/lucid_attachment_relation.spec.d.ts +8 -0
  240. package/build/tests/lucid_attachment_relation.spec.d.ts.map +1 -0
  241. package/build/tests/lucid_attachment_relation.spec.js +216 -0
  242. package/build/tests/lucid_attachment_relation.spec.js.map +1 -0
  243. package/build/tests/lucid_attachment_repository.spec.d.ts +8 -0
  244. package/build/tests/lucid_attachment_repository.spec.d.ts.map +1 -0
  245. package/build/tests/lucid_attachment_repository.spec.js +50 -0
  246. package/build/tests/lucid_attachment_repository.spec.js.map +1 -0
  247. package/build/tests/lucid_attachment_store.spec.d.ts +8 -0
  248. package/build/tests/lucid_attachment_store.spec.d.ts.map +1 -0
  249. package/build/tests/lucid_attachment_store.spec.js +73 -0
  250. package/build/tests/lucid_attachment_store.spec.js.map +1 -0
  251. package/build/tests/lucid_sqlite_integration.spec.d.ts +8 -0
  252. package/build/tests/lucid_sqlite_integration.spec.d.ts.map +1 -0
  253. package/build/tests/lucid_sqlite_integration.spec.js +103 -0
  254. package/build/tests/lucid_sqlite_integration.spec.js.map +1 -0
  255. package/build/tests/lucid_variant_generation_service.spec.d.ts +8 -0
  256. package/build/tests/lucid_variant_generation_service.spec.d.ts.map +1 -0
  257. package/build/tests/lucid_variant_generation_service.spec.js +56 -0
  258. package/build/tests/lucid_variant_generation_service.spec.js.map +1 -0
  259. package/build/tests/memory_queue.spec.d.ts +8 -0
  260. package/build/tests/memory_queue.spec.d.ts.map +1 -0
  261. package/build/tests/memory_queue.spec.js +52 -0
  262. package/build/tests/memory_queue.spec.js.map +1 -0
  263. package/build/tests/migrate_legacy_attachment.spec.d.ts +8 -0
  264. package/build/tests/migrate_legacy_attachment.spec.d.ts.map +1 -0
  265. package/build/tests/migrate_legacy_attachment.spec.js +133 -0
  266. package/build/tests/migrate_legacy_attachment.spec.js.map +1 -0
  267. package/build/tests/migrate_legacy_attachment_records.spec.d.ts +8 -0
  268. package/build/tests/migrate_legacy_attachment_records.spec.d.ts.map +1 -0
  269. package/build/tests/migrate_legacy_attachment_records.spec.js +66 -0
  270. package/build/tests/migrate_legacy_attachment_records.spec.js.map +1 -0
  271. package/build/tests/package_exports.spec.d.ts +8 -0
  272. package/build/tests/package_exports.spec.d.ts.map +1 -0
  273. package/build/tests/package_exports.spec.js +31 -0
  274. package/build/tests/package_exports.spec.js.map +1 -0
  275. package/build/tests/variant_generation_service.spec.d.ts +8 -0
  276. package/build/tests/variant_generation_service.spec.d.ts.map +1 -0
  277. package/build/tests/variant_generation_service.spec.js +79 -0
  278. package/build/tests/variant_generation_service.spec.js.map +1 -0
  279. package/package.json +82 -76
  280. package/build/commands/make/converter.d.ts.map +0 -1
  281. package/build/commands/make/converter.js +0 -28
  282. package/build/services/regenerate_service.d.ts +0 -9
  283. package/build/services/regenerate_service.d.ts.map +0 -1
  284. package/build/services/regenerate_service.js +0 -29
  285. package/build/src/adapters/blurhash.d.ts +0 -11
  286. package/build/src/adapters/blurhash.d.ts.map +0 -1
  287. package/build/src/adapters/blurhash.js +0 -12
  288. package/build/src/adapters/exif.d.ts +0 -15
  289. package/build/src/adapters/exif.d.ts.map +0 -1
  290. package/build/src/adapters/exif.js +0 -165
  291. package/build/src/adapters/ffmpeg.d.ts +0 -19
  292. package/build/src/adapters/ffmpeg.d.ts.map +0 -1
  293. package/build/src/adapters/ffmpeg.js +0 -115
  294. package/build/src/adapters/lock.d.ts +0 -9
  295. package/build/src/adapters/lock.d.ts.map +0 -1
  296. package/build/src/adapters/lock.js +0 -21
  297. package/build/src/adapters/meta.d.ts +0 -10
  298. package/build/src/adapters/meta.d.ts.map +0 -1
  299. package/build/src/adapters/meta.js +0 -49
  300. package/build/src/adapters/poppler.d.ts +0 -20
  301. package/build/src/adapters/poppler.d.ts.map +0 -1
  302. package/build/src/adapters/poppler.js +0 -117
  303. package/build/src/adapters/soffice.d.ts +0 -14
  304. package/build/src/adapters/soffice.d.ts.map +0 -1
  305. package/build/src/adapters/soffice.js +0 -64
  306. package/build/src/attachment_manager.d.ts +0 -50
  307. package/build/src/attachment_manager.d.ts.map +0 -1
  308. package/build/src/attachment_manager.js +0 -145
  309. package/build/src/attachments/attachment.d.ts +0 -42
  310. package/build/src/attachments/attachment.d.ts.map +0 -1
  311. package/build/src/attachments/attachment.js +0 -233
  312. package/build/src/attachments/attachment_base.d.ts +0 -59
  313. package/build/src/attachments/attachment_base.d.ts.map +0 -1
  314. package/build/src/attachments/attachment_base.js +0 -211
  315. package/build/src/attachments/variant_attachment.d.ts +0 -27
  316. package/build/src/attachments/variant_attachment.d.ts.map +0 -1
  317. package/build/src/attachments/variant_attachment.js +0 -40
  318. package/build/src/converters/autodetect_converter.d.ts +0 -13
  319. package/build/src/converters/autodetect_converter.d.ts.map +0 -1
  320. package/build/src/converters/autodetect_converter.js +0 -77
  321. package/build/src/converters/converter.d.ts +0 -14
  322. package/build/src/converters/converter.d.ts.map +0 -1
  323. package/build/src/converters/converter.js +0 -14
  324. package/build/src/converters/document_thumbnail_converter.d.ts +0 -14
  325. package/build/src/converters/document_thumbnail_converter.d.ts.map +0 -1
  326. package/build/src/converters/document_thumbnail_converter.js +0 -36
  327. package/build/src/converters/image_converter.d.ts +0 -13
  328. package/build/src/converters/image_converter.d.ts.map +0 -1
  329. package/build/src/converters/image_converter.js +0 -27
  330. package/build/src/converters/pdf_thumbnail_converter.d.ts +0 -14
  331. package/build/src/converters/pdf_thumbnail_converter.d.ts.map +0 -1
  332. package/build/src/converters/pdf_thumbnail_converter.js +0 -39
  333. package/build/src/converters/video_thumbnail_converter.d.ts +0 -14
  334. package/build/src/converters/video_thumbnail_converter.d.ts.map +0 -1
  335. package/build/src/converters/video_thumbnail_converter.js +0 -40
  336. package/build/src/decorators/attachment.d.ts +0 -15
  337. package/build/src/decorators/attachment.d.ts.map +0 -1
  338. package/build/src/decorators/attachment.js +0 -103
  339. package/build/src/errors.d.ts +0 -67
  340. package/build/src/errors.d.ts.map +0 -1
  341. package/build/src/errors.js +0 -68
  342. package/build/src/services/attachment/attachment_detachment_service.d.ts +0 -19
  343. package/build/src/services/attachment/attachment_detachment_service.d.ts.map +0 -1
  344. package/build/src/services/attachment/attachment_detachment_service.js +0 -66
  345. package/build/src/services/attachment/attachment_persister_service.d.ts +0 -22
  346. package/build/src/services/attachment/attachment_persister_service.d.ts.map +0 -1
  347. package/build/src/services/attachment/attachment_persister_service.js +0 -96
  348. package/build/src/services/attachment/attachment_recorder_service.d.ts +0 -68
  349. package/build/src/services/attachment/attachment_recorder_service.d.ts.map +0 -1
  350. package/build/src/services/attachment/attachment_recorder_service.js +0 -121
  351. package/build/src/services/attachment/attachment_transaction_service.d.ts +0 -26
  352. package/build/src/services/attachment/attachment_transaction_service.d.ts.map +0 -1
  353. package/build/src/services/attachment/attachment_transaction_service.js +0 -46
  354. package/build/src/services/attachment/attachment_utils.d.ts +0 -35
  355. package/build/src/services/attachment/attachment_utils.d.ts.map +0 -1
  356. package/build/src/services/attachment/attachment_utils.js +0 -71
  357. package/build/src/services/attachment/attachment_variant_service.d.ts +0 -17
  358. package/build/src/services/attachment/attachment_variant_service.d.ts.map +0 -1
  359. package/build/src/services/attachment/attachment_variant_service.js +0 -99
  360. package/build/src/services/attachment/index.d.ts +0 -15
  361. package/build/src/services/attachment/index.d.ts.map +0 -1
  362. package/build/src/services/attachment/index.js +0 -15
  363. package/build/src/services/attachment_service.d.ts +0 -8
  364. package/build/src/services/attachment_service.d.ts.map +0 -1
  365. package/build/src/services/attachment_service.js +0 -7
  366. package/build/src/services/variant/variant_generator_service.d.ts +0 -24
  367. package/build/src/services/variant/variant_generator_service.d.ts.map +0 -1
  368. package/build/src/services/variant/variant_generator_service.js +0 -101
  369. package/build/src/services/variant/variant_persister_service.d.ts +0 -24
  370. package/build/src/services/variant/variant_persister_service.d.ts.map +0 -1
  371. package/build/src/services/variant/variant_persister_service.js +0 -59
  372. package/build/src/services/variant/variant_purger_service.d.ts +0 -15
  373. package/build/src/services/variant/variant_purger_service.d.ts.map +0 -1
  374. package/build/src/services/variant/variant_purger_service.js +0 -47
  375. package/build/src/services/variant_service.d.ts +0 -13
  376. package/build/src/services/variant_service.d.ts.map +0 -1
  377. package/build/src/services/variant_service.js +0 -63
  378. package/build/src/types/attachment.d.ts +0 -100
  379. package/build/src/types/attachment.d.ts.map +0 -1
  380. package/build/src/types/config.d.ts +0 -58
  381. package/build/src/types/config.d.ts.map +0 -1
  382. package/build/src/types/converter.d.ts +0 -144
  383. package/build/src/types/converter.d.ts.map +0 -1
  384. package/build/src/types/drive.d.ts +0 -6
  385. package/build/src/types/drive.d.ts.map +0 -1
  386. package/build/src/types/drive.js +0 -1
  387. package/build/src/types/event.d.ts +0 -16
  388. package/build/src/types/event.d.ts.map +0 -1
  389. package/build/src/types/index.d.ts +0 -15
  390. package/build/src/types/index.d.ts.map +0 -1
  391. package/build/src/types/index.js +0 -14
  392. package/build/src/types/input.d.ts +0 -35
  393. package/build/src/types/input.d.ts.map +0 -1
  394. package/build/src/types/input.js +0 -7
  395. package/build/src/types/lock.d.ts +0 -14
  396. package/build/src/types/lock.d.ts.map +0 -1
  397. package/build/src/types/lock.js +0 -7
  398. package/build/src/types/metadata.d.ts +0 -24
  399. package/build/src/types/metadata.d.ts.map +0 -1
  400. package/build/src/types/metadata.js +0 -7
  401. package/build/src/types/mixin.d.ts +0 -17
  402. package/build/src/types/mixin.d.ts.map +0 -1
  403. package/build/src/types/mixin.js +0 -7
  404. package/build/src/types/regenerate.d.ts +0 -12
  405. package/build/src/types/regenerate.d.ts.map +0 -1
  406. package/build/src/types/regenerate.js +0 -7
  407. package/build/src/types/service.d.ts +0 -25
  408. package/build/src/types/service.d.ts.map +0 -1
  409. package/build/src/types/service.js +0 -7
  410. package/build/src/utils/default_values.d.ts +0 -20
  411. package/build/src/utils/default_values.d.ts.map +0 -1
  412. package/build/src/utils/default_values.js +0 -19
  413. package/build/src/utils/helpers.d.ts +0 -19
  414. package/build/src/utils/helpers.d.ts.map +0 -1
  415. package/build/src/utils/helpers.js +0 -131
  416. package/build/src/utils/hooks.d.ts +0 -12
  417. package/build/src/utils/hooks.d.ts.map +0 -1
  418. package/build/src/utils/hooks.js +0 -42
  419. package/build/src/utils/symbols.d.ts +0 -8
  420. package/build/src/utils/symbols.d.ts.map +0 -1
  421. package/build/src/utils/symbols.js +0 -7
  422. package/build/stubs/config.stub +0 -140
  423. package/build/stubs/make/converter/main.stub +0 -20
  424. package/build/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,216 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
8
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
9
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
10
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
11
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
12
+ };
13
+ import { setApp } from "@adonisjs/core/services/app";
14
+ import { BaseModel, column } from "@adonisjs/lucid/orm";
15
+ import { test } from "@japa/runner";
16
+ import { attachmentRelation, attachmentsRelation, } from "../index.js";
17
+ import { AttachmentService } from "../src/core/attachment_service.js";
18
+ import { LucidAttachmentStore } from "../src/integrations/lucid/lucid_attachment_store.js";
19
+ import { createLucidTestDatabase } from "./helpers/lucid_test_database.js";
20
+ class RelationUser extends BaseModel {
21
+ static table = "relation_users";
22
+ static selfAssignPrimaryKey = true;
23
+ }
24
+ __decorate([
25
+ column({ isPrimary: true })
26
+ ], RelationUser.prototype, "id", void 0);
27
+ __decorate([
28
+ column()
29
+ ], RelationUser.prototype, "name", void 0);
30
+ __decorate([
31
+ attachmentRelation({
32
+ disk: "decorator",
33
+ folder: ({ model }) => `avatars/${model.id}`,
34
+ rename: false,
35
+ })
36
+ ], RelationUser.prototype, "avatar", void 0);
37
+ __decorate([
38
+ attachmentsRelation({
39
+ folder: ({ model }) => `gallery/${model.id}`,
40
+ rename: false,
41
+ })
42
+ ], RelationUser.prototype, "gallery", void 0);
43
+ let database;
44
+ let attachments;
45
+ let removed;
46
+ let writes;
47
+ let queued;
48
+ let nextId = 0;
49
+ function createDraft(name, options = {}) {
50
+ return attachments.createDraft({
51
+ body: Buffer.from(name),
52
+ originalName: name,
53
+ mimeType: "text/plain",
54
+ }, options);
55
+ }
56
+ async function createUser(id = "user-1") {
57
+ const user = new RelationUser();
58
+ user.id = id;
59
+ user.name = id;
60
+ await user.save();
61
+ return user;
62
+ }
63
+ test.group("Lucid attachment relations", (group) => {
64
+ group.setup(async () => {
65
+ database = await createLucidTestDatabase();
66
+ RelationUser.useAdapter(database.modelAdapter());
67
+ await database
68
+ .connection()
69
+ .schema.createTable("relation_users", (table) => {
70
+ table.string("id").primary();
71
+ table.string("name").notNullable().unique();
72
+ });
73
+ });
74
+ group.each.setup(async () => {
75
+ await database.from("attachments").delete();
76
+ await database.from("relation_users").delete();
77
+ removed = [];
78
+ writes = [];
79
+ queued = [];
80
+ nextId = 0;
81
+ attachments = new AttachmentService({
82
+ defaultDisk: "fs",
83
+ defaults: { disk: "config", folder: "config" },
84
+ createId: () => `attachment-${++nextId}`,
85
+ queue: {
86
+ async enqueue(job) {
87
+ queued.push(job.attachmentId);
88
+ },
89
+ },
90
+ storage: {
91
+ async write(input) {
92
+ writes.push({ disk: input.disk, path: input.path });
93
+ },
94
+ async read() {
95
+ return new Uint8Array();
96
+ },
97
+ async remove(location) {
98
+ removed.push(location.path);
99
+ },
100
+ },
101
+ });
102
+ setApp({
103
+ container: {
104
+ async make(binding) {
105
+ if (binding !== "jrmc.attachment") {
106
+ throw new Error(`Unexpected binding: ${binding}`);
107
+ }
108
+ return attachments;
109
+ },
110
+ },
111
+ });
112
+ });
113
+ group.teardown(async () => {
114
+ await database.manager.closeAll();
115
+ });
116
+ test("attaches, replaces, reads, schedules variants, and detaches a singular relation", async ({ assert, }) => {
117
+ const user = await createUser();
118
+ const first = createDraft("first.txt");
119
+ const original = await user.avatar.attach(first);
120
+ assert.isTrue(first.isPersisted);
121
+ assert.equal(original.attachableType, "relation_users");
122
+ assert.equal(original.attachableId, user.id);
123
+ assert.equal(original.field, "avatar");
124
+ assert.equal(first.disk, "decorator");
125
+ assert.equal(first.path, "avatars/user-1/first.txt");
126
+ assert.equal((await user.avatar.get())?.id, original.id);
127
+ await assert.rejects(() => user.avatar.attach(createDraft("duplicate.txt")), /already has an attachment/);
128
+ const replacement = createDraft("replacement.txt", {
129
+ disk: "manager",
130
+ folder: "imports",
131
+ });
132
+ const current = await user.avatar.set(replacement);
133
+ await new LucidAttachmentStore().createVariant(current, "thumbnail", {
134
+ id: "variant-id",
135
+ disk: "manager",
136
+ path: "imports/thumbnail.txt",
137
+ name: "thumbnail.txt",
138
+ originalName: "replacement.txt",
139
+ mimeType: "text/plain",
140
+ extname: "txt",
141
+ size: 1,
142
+ });
143
+ assert.equal(replacement.path, "imports/replacement.txt");
144
+ assert.deepEqual((await user.avatar.variants()).map((variant) => variant.id), ["variant-id"]);
145
+ assert.isTrue(await user.avatar.regenerateVariants(["thumbnail"]));
146
+ assert.deepEqual(queued, [current.id]);
147
+ await user.avatar.detach();
148
+ assert.isNull(await user.avatar.get());
149
+ assert.sameDeepMembers(removed, [
150
+ first.path,
151
+ replacement.path,
152
+ "imports/thumbnail.txt",
153
+ ]);
154
+ assert.deepEqual(writes, [
155
+ { disk: "decorator", path: "avatars/user-1/first.txt" },
156
+ { disk: "manager", path: "imports/replacement.txt" },
157
+ ]);
158
+ });
159
+ test("manages an ordered attachment collection from its Lucid model", async ({ assert, }) => {
160
+ const user = await createUser();
161
+ const first = await user.gallery.add(createDraft("first.txt"));
162
+ const second = await user.gallery.add(createDraft("second.txt"));
163
+ const before = await user.gallery.add(createDraft("before.txt"), 0);
164
+ assert.deepEqual((await user.gallery.all()).map((item) => item.id), [before.id, first.id, second.id]);
165
+ await user.gallery.move(second.id, 0);
166
+ assert.deepEqual((await user.gallery.all()).map((item) => item.id), [second.id, before.id, first.id]);
167
+ assert.isTrue(await user.gallery.remove(before.id));
168
+ assert.isFalse(await user.gallery.remove("missing-id"));
169
+ const replacement = await user.gallery.replaceAll([
170
+ createDraft("replacement-1.txt"),
171
+ createDraft("replacement-2.txt"),
172
+ ]);
173
+ assert.deepEqual(replacement.map((item) => item.position), [0, 1]);
174
+ await user.gallery.clear();
175
+ assert.deepEqual(await user.gallery.all(), []);
176
+ assert.equal(removed.length, 5);
177
+ });
178
+ test("requires the Lucid owner to be persisted", async ({ assert }) => {
179
+ const user = new RelationUser();
180
+ user.id = "user-1";
181
+ await assert.rejects(() => user.avatar.get(), /require a persisted Lucid model/);
182
+ });
183
+ test("uses the owner transaction and cleans up a new file after rollback", async ({ assert, }) => {
184
+ const user = await createUser();
185
+ const draft = createDraft("rollback.txt");
186
+ await assert.rejects(() => database.transaction(async (trx) => {
187
+ const transactionalUser = await RelationUser.query({ client: trx })
188
+ .where("id", user.id)
189
+ .firstOrFail();
190
+ transactionalUser.useTransaction(trx);
191
+ await transactionalUser.avatar.attach(draft);
192
+ assert.isNotNull(await transactionalUser.avatar.get());
193
+ throw new Error("Rollback requested");
194
+ }), /Rollback requested/);
195
+ assert.isNull(await user.avatar.get());
196
+ assert.deepEqual(removed, [draft.path]);
197
+ });
198
+ test("defers file deletion until an owner transaction commits", async ({ assert }) => {
199
+ const user = await createUser();
200
+ const draft = createDraft("avatar.txt");
201
+ await user.avatar.attach(draft);
202
+ removed = [];
203
+ await assert.rejects(() => database.transaction(async (trx) => {
204
+ const transactionalUser = await RelationUser.query({ client: trx })
205
+ .where("id", user.id)
206
+ .firstOrFail();
207
+ transactionalUser.useTransaction(trx);
208
+ await transactionalUser.avatar.detach();
209
+ assert.isNull(await transactionalUser.avatar.get());
210
+ throw new Error("Rollback requested");
211
+ }), /Rollback requested/);
212
+ assert.equal((await user.avatar.get())?.id, draft.id);
213
+ assert.deepEqual(removed, []);
214
+ });
215
+ });
216
+ //# sourceMappingURL=lucid_attachment_relation.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_relation.spec.js","sourceRoot":"","sources":["../../tests/lucid_attachment_relation.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GAGpB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,YAAa,SAAQ,SAAS;IAClC,MAAM,CAAC,KAAK,GAAG,gBAAgB,CAAC;IAChC,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAC;;AAG3B;IADP,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;wCACT;AAGX;IADP,MAAM,EAAE;0CACY;AAOb;IALP,kBAAkB,CAAC;QAClB,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,WAAY,KAAsB,CAAC,EAAE,EAAE;QAC9D,MAAM,EAAE,KAAK;KACd,CAAC;4CACiC;AAM3B;IAJP,mBAAmB,CAAC;QACnB,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,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CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;iBAChE,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC;iBACpB,WAAW,EAAE,CAAC;YACjB,iBAAiB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YAEtC,MAAM,iBAAiB,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACxC,MAAM,CAAC,MAAM,CAAC,MAAM,iBAAiB,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC;YAEpD,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC,CAAC,EACJ,oBAAoB,CACrB,CAAC;QAEF,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC;QACtD,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=lucid_attachment_repository.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_repository.spec.d.ts","sourceRoot":"","sources":["../../tests/lucid_attachment_repository.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { test } from '@japa/runner';
8
+ import { LucidAttachmentRepository } from '../src/integrations/lucid/lucid_attachment_repository.js';
9
+ test.group('LucidAttachmentRepository', () => {
10
+ test('maps the configured Lucid model to a core attachment', async ({ assert }) => {
11
+ const repository = new LucidAttachmentRepository({
12
+ async find(id) {
13
+ assert.equal(id, 'attachment-id');
14
+ return {
15
+ toAttachment() {
16
+ return {
17
+ id,
18
+ disk: 'public',
19
+ path: 'users/42/avatar.jpg',
20
+ name: 'avatar.jpg',
21
+ originalName: 'profile.jpg',
22
+ mimeType: 'image/jpeg',
23
+ extname: 'jpg',
24
+ size: 42,
25
+ };
26
+ },
27
+ };
28
+ },
29
+ });
30
+ assert.deepEqual(await repository.findById('attachment-id'), {
31
+ id: 'attachment-id',
32
+ disk: 'public',
33
+ path: 'users/42/avatar.jpg',
34
+ name: 'avatar.jpg',
35
+ originalName: 'profile.jpg',
36
+ mimeType: 'image/jpeg',
37
+ extname: 'jpg',
38
+ size: 42,
39
+ });
40
+ });
41
+ test('returns null when the attachment cannot be found', async ({ assert }) => {
42
+ const repository = new LucidAttachmentRepository({
43
+ async find() {
44
+ return null;
45
+ },
46
+ });
47
+ assert.isNull(await repository.findById('missing'));
48
+ });
49
+ });
50
+ //# sourceMappingURL=lucid_attachment_repository.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_repository.spec.js","sourceRoot":"","sources":["../../tests/lucid_attachment_repository.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAA;AAGpG,IAAI,CAAC,KAAK,CAAC,2BAA2B,EAAE,GAAG,EAAE;IAC3C,IAAI,CAAC,sDAAsD,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAChF,MAAM,UAAU,GAAG,IAAI,yBAAyB,CAAC;YAC/C,KAAK,CAAC,IAAI,CAAC,EAAU;gBACnB,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,eAAe,CAAC,CAAA;gBACjC,OAAO;oBACL,YAAY;wBACV,OAAO;4BACL,EAAE;4BACF,IAAI,EAAE,QAAQ;4BACd,IAAI,EAAE,qBAAqB;4BAC3B,IAAI,EAAE,YAAY;4BAClB,YAAY,EAAE,aAAa;4BAC3B,QAAQ,EAAE,YAAY;4BACtB,OAAO,EAAE,KAAK;4BACd,IAAI,EAAE,EAAE;yBACT,CAAA;oBACH,CAAC;iBACF,CAAA;YACH,CAAC;SACmC,CAAC,CAAA;QAEvC,MAAM,CAAC,SAAS,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE;YAC3D,EAAE,EAAE,eAAe;YACnB,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,qBAAqB;YAC3B,IAAI,EAAE,YAAY;YAClB,YAAY,EAAE,aAAa;YAC3B,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,EAAE;SACT,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,IAAI,CAAC,kDAAkD,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAC5E,MAAM,UAAU,GAAG,IAAI,yBAAyB,CAAC;YAC/C,KAAK,CAAC,IAAI;gBACR,OAAO,IAAI,CAAA;YACb,CAAC;SACmC,CAAC,CAAA;QAEvC,MAAM,CAAC,MAAM,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAA;IACrD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=lucid_attachment_store.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_store.spec.d.ts","sourceRoot":"","sources":["../../tests/lucid_attachment_store.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { test } from '@japa/runner';
8
+ import { createAttachmentOwnerKey } from '../src/integrations/lucid/attachment_owner.js';
9
+ import { LucidAttachmentStore } from '../src/integrations/lucid/lucid_attachment_store.js';
10
+ const attachment = {
11
+ id: 'attachment-id',
12
+ disk: 'public',
13
+ path: 'users/42/avatar.jpg',
14
+ name: 'avatar.jpg',
15
+ originalName: 'profile.jpg',
16
+ mimeType: 'image/jpeg',
17
+ extname: 'jpg',
18
+ size: 42,
19
+ };
20
+ test.group('LucidAttachmentStore', () => {
21
+ test('creates an original polymorphic attachment row', async ({ assert }) => {
22
+ const created = [];
23
+ const store = new LucidAttachmentStore({
24
+ async create(attributes) {
25
+ created.push(attributes);
26
+ return attributes;
27
+ },
28
+ });
29
+ await store.createOriginal({ type: 'users', id: '42', field: 'avatar' }, attachment);
30
+ assert.deepEqual(created, [
31
+ {
32
+ ...attachment,
33
+ attachableType: 'users',
34
+ attachableId: '42',
35
+ field: 'avatar',
36
+ ownerKey: createAttachmentOwnerKey({ type: 'users', id: '42', field: 'avatar' }),
37
+ position: null,
38
+ parentId: null,
39
+ variantKey: null,
40
+ metadata: null,
41
+ },
42
+ ]);
43
+ });
44
+ test('creates a variant linked to its original attachment', async ({ assert }) => {
45
+ const created = [];
46
+ const store = new LucidAttachmentStore({
47
+ async create(attributes) {
48
+ created.push(attributes);
49
+ return attributes;
50
+ },
51
+ });
52
+ const original = {
53
+ id: 'original-id',
54
+ attachableType: 'users',
55
+ attachableId: '42',
56
+ field: 'avatar',
57
+ };
58
+ await store.createVariant(original, 'thumbnail', { ...attachment, id: 'variant-id' });
59
+ assert.deepEqual(created[0], {
60
+ ...attachment,
61
+ id: 'variant-id',
62
+ attachableType: 'users',
63
+ attachableId: '42',
64
+ field: 'avatar',
65
+ ownerKey: null,
66
+ position: null,
67
+ parentId: 'original-id',
68
+ variantKey: 'thumbnail',
69
+ metadata: null,
70
+ });
71
+ });
72
+ });
73
+ //# sourceMappingURL=lucid_attachment_store.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_store.spec.js","sourceRoot":"","sources":["../../tests/lucid_attachment_store.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAGnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAA;AACxF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAA;AAE1F,MAAM,UAAU,GAAG;IACjB,EAAE,EAAE,eAAe;IACnB,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,YAAY;IAClB,YAAY,EAAE,aAAa;IAC3B,QAAQ,EAAE,YAAY;IACtB,OAAO,EAAE,KAAK;IACd,IAAI,EAAE,EAAE;CACA,CAAA;AAEV,IAAI,CAAC,KAAK,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACtC,IAAI,CAAC,gDAAgD,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAC1E,MAAM,OAAO,GAA8B,EAAE,CAAA;QAC7C,MAAM,KAAK,GAAG,IAAI,oBAAoB,CAAC;YACrC,KAAK,CAAC,MAAM,CAAC,UAAmC;gBAC9C,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;gBACxB,OAAO,UAAU,CAAA;YACnB,CAAC;SACmC,CAAC,CAAA;QAEvC,MAAM,KAAK,CAAC,cAAc,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,UAAU,CAAC,CAAA;QAEpF,MAAM,CAAC,SAAS,CAAC,OAAO,EAAE;YACxB;gBACE,GAAG,UAAU;gBACb,cAAc,EAAE,OAAO;gBACvB,YAAY,EAAE,IAAI;gBAClB,KAAK,EAAE,QAAQ;gB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attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=lucid_sqlite_integration.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_sqlite_integration.spec.d.ts","sourceRoot":"","sources":["../../tests/lucid_sqlite_integration.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { test } from '@japa/runner';
8
+ import { AttachmentModel } from '../src/integrations/lucid/attachment_model.js';
9
+ import { LucidAttachmentLifecycleService } from '../src/integrations/lucid/lucid_attachment_lifecycle_service.js';
10
+ import { LucidAttachmentRepository } from '../src/integrations/lucid/lucid_attachment_repository.js';
11
+ import { LucidAttachmentStore } from '../src/integrations/lucid/lucid_attachment_store.js';
12
+ import { createLucidTestDatabase } from './helpers/lucid_test_database.js';
13
+ const owner = { type: 'users', id: '42', field: 'avatar' };
14
+ let database;
15
+ function makeAttachment(id, path, metadata) {
16
+ return {
17
+ id,
18
+ disk: 'public',
19
+ path,
20
+ name: path.split('/').at(-1),
21
+ originalName: 'profile.jpg',
22
+ mimeType: 'image/jpeg',
23
+ extname: 'jpg',
24
+ size: 42,
25
+ ...(metadata ? { metadata } : {}),
26
+ };
27
+ }
28
+ test.group('Lucid SQLite integration', (group) => {
29
+ group.setup(async () => {
30
+ database = await createLucidTestDatabase();
31
+ });
32
+ group.each.setup(async () => {
33
+ await database.from('attachments').delete();
34
+ });
35
+ group.teardown(async () => {
36
+ await database.manager.closeAll();
37
+ });
38
+ test('persists original rows and variants using the generated table schema', async ({ assert }) => {
39
+ const store = new LucidAttachmentStore();
40
+ const original = await store.createOriginal(owner, makeAttachment('original-id', 'users/42/avatar.jpg', { width: 800 }));
41
+ const variant = await store.createVariant(original, 'thumbnail', makeAttachment('variant-id', 'users/42/thumbnail.jpg'));
42
+ const reloaded = await AttachmentModel.findOrFail(original.id);
43
+ const persisted = await store.findByOwner(owner);
44
+ assert.equal(reloaded.attachableType, 'users');
45
+ assert.equal(reloaded.attachableId, '42');
46
+ assert.equal(reloaded.field, 'avatar');
47
+ assert.deepEqual(reloaded.metadata, { width: 800 });
48
+ assert.isNotNull(reloaded.createdAt);
49
+ assert.isNotNull(reloaded.updatedAt);
50
+ assert.equal(variant.parentId, original.id);
51
+ assert.equal(variant.variantKey, 'thumbnail');
52
+ assert.equal(persisted?.original.id, original.id);
53
+ assert.deepEqual(persisted?.variants.map((row) => row.id), ['variant-id']);
54
+ });
55
+ test('returns null when no attachment exists for the owner field', async ({ assert }) => {
56
+ const result = await new LucidAttachmentStore().findByOwner(owner);
57
+ assert.isNull(result);
58
+ });
59
+ test('prevents two original attachments for the same owner field', async ({ assert }) => {
60
+ const store = new LucidAttachmentStore();
61
+ await store.createOriginal(owner, makeAttachment('first-id', 'users/42/first.jpg'));
62
+ await assert.rejects(() => store.createOriginal(owner, makeAttachment('second-id', 'users/42/second.jpg')), /UNIQUE constraint failed/);
63
+ });
64
+ test('prevents duplicate variant keys for the same original', async ({ assert }) => {
65
+ const store = new LucidAttachmentStore();
66
+ const original = await store.createOriginal(owner, makeAttachment('original-id', 'users/42/avatar.jpg'));
67
+ await store.createVariant(original, 'thumbnail', makeAttachment('first-variant-id', 'users/42/thumbnail.jpg'));
68
+ await assert.rejects(() => store.createVariant(original, 'thumbnail', makeAttachment('second-variant-id', 'users/42/thumbnail-2.jpg')), /UNIQUE constraint failed/);
69
+ });
70
+ test('uses persisted rows for lifecycle replacement, deletion, and repository reads', async ({ assert }) => {
71
+ const removed = [];
72
+ const attachments = [
73
+ makeAttachment('first-id', 'users/42/first.jpg'),
74
+ makeAttachment('second-id', 'users/42/second.jpg'),
75
+ ];
76
+ const lifecycle = new LucidAttachmentLifecycleService({
77
+ async create() {
78
+ return attachments.shift();
79
+ },
80
+ async remove(attachment) {
81
+ removed.push(attachment.id);
82
+ },
83
+ }, new LucidAttachmentStore());
84
+ const first = await lifecycle.attach(owner, {
85
+ body: new Uint8Array(),
86
+ originalName: 'profile.jpg',
87
+ });
88
+ const replacement = await lifecycle.replace(owner, {
89
+ body: new Uint8Array(),
90
+ originalName: 'profile.jpg',
91
+ });
92
+ await new LucidAttachmentStore().createVariant(replacement, 'thumbnail', makeAttachment('variant-id', 'users/42/thumbnail.jpg'));
93
+ const repository = new LucidAttachmentRepository();
94
+ assert.equal((await repository.findById(replacement.id))?.path, 'users/42/second.jpg');
95
+ assert.isNull(await AttachmentModel.find(first.id));
96
+ assert.deepEqual(removed, [first.id]);
97
+ await lifecycle.detach(owner);
98
+ assert.isNull(await AttachmentModel.find(replacement.id));
99
+ assert.isNull(await AttachmentModel.find('variant-id'));
100
+ assert.sameDeepMembers(removed, [first.id, replacement.id, 'variant-id']);
101
+ });
102
+ });
103
+ //# sourceMappingURL=lucid_sqlite_integration.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_sqlite_integration.spec.js","sourceRoot":"","sources":["../../tests/lucid_sqlite_integration.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAGnC,OAAO,EAAE,eAAe,EAAE,MAAM,+CAA+C,CAAA;AAC/E,OAAO,EAAE,+BAA+B,EAAE,MAAM,iEAAiE,CAAA;AACjH,OAAO,EAAE,yBAAyB,EAAE,MAAM,0DAA0D,CAAA;AACpG,OAAO,EAAE,oBAAoB,EAAE,MAAM,qDAAqD,CAAA;AAC1F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAA;AAE1E,MAAM,KAAK,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAA;AAC1D,IAAI,QAAkB,CAAA;AAEtB,SAAS,cAAc,CAAC,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AAC,EAAE,CAAC,CAAC,CAAA;QACzD,MAAM,CAAC,MAAM,CAAC,MAAM,eAAe,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAA;QACvD,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,WAAW,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAAA;IAC3E,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=lucid_variant_generation_service.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_variant_generation_service.spec.d.ts","sourceRoot":"","sources":["../../tests/lucid_variant_generation_service.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { test } from '@japa/runner';
8
+ import { LucidVariantGenerationService, PersistedAttachmentNotFoundError, } from '../src/integrations/lucid/lucid_variant_generation_service.js';
9
+ const original = {
10
+ id: 'original-id', disk: 'public', path: 'users/42/avatar.jpg', name: 'avatar.jpg',
11
+ originalName: 'profile.jpg', mimeType: 'image/jpeg', extname: 'jpg', size: 42,
12
+ };
13
+ const variant = { ...original, id: 'variant-id', name: 'thumbnail.webp', extname: 'webp' };
14
+ test.group('LucidVariantGenerationService', () => {
15
+ test('persists generated variants under their original attachment', async ({ assert }) => {
16
+ const persisted = [];
17
+ const service = new LucidVariantGenerationService({
18
+ generator: { async generateAll() { return [{ key: 'thumbnail', attachment: variant }]; } },
19
+ attachments: { async remove() { } },
20
+ store: {
21
+ async findById() { return { id: original.id }; },
22
+ async createVariant(row, key, attachment) {
23
+ persisted.push(`${row.id}:${key}:${attachment.id}`);
24
+ return {};
25
+ },
26
+ },
27
+ });
28
+ await service.generate({ attachment: original });
29
+ assert.deepEqual(persisted, ['original-id:thumbnail:variant-id']);
30
+ });
31
+ test('removes a generated file when variant persistence fails', async ({ assert }) => {
32
+ const removed = [];
33
+ const service = new LucidVariantGenerationService({
34
+ generator: { async generateAll() { return [{ key: 'thumbnail', attachment: variant }]; } },
35
+ attachments: { async remove(attachment) { removed.push(attachment.id); } },
36
+ store: {
37
+ async findById() { return { id: original.id }; },
38
+ async createVariant() { throw new Error('database unavailable'); },
39
+ },
40
+ });
41
+ await assert.rejects(() => service.generate({ attachment: original }), 'database unavailable');
42
+ assert.deepEqual(removed, ['variant-id']);
43
+ });
44
+ test('fails when the original is no longer persisted', async ({ assert }) => {
45
+ const service = new LucidVariantGenerationService({
46
+ generator: { async generateAll() { return []; } },
47
+ attachments: { async remove() { } },
48
+ store: {
49
+ async findById() { return null; },
50
+ async createVariant() { return {}; },
51
+ },
52
+ });
53
+ await assert.rejects(() => service.generate({ attachment: original }), PersistedAttachmentNotFoundError);
54
+ });
55
+ });
56
+ //# sourceMappingURL=lucid_variant_generation_service.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_variant_generation_service.spec.js","sourceRoot":"","sources":["../../tests/lucid_variant_generation_service.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAInC,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,GACjC,MAAM,+DAA+D,CAAA;AAEtE,MAAM,QAAQ,GAAe;IAC3B,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,YAAY;IAClF,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;CAC9E,CAAA;AACD,MA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AC,QAAQ,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,EAAE,gCAAgC,CAAC,CAAA;IAC1G,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=memory_queue.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory_queue.spec.d.ts","sourceRoot":"","sources":["../../tests/memory_queue.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}