@jrmc/adonis-attachment 5.2.0 → 6.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (404) hide show
  1. package/README.md +10 -73
  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 +23 -8
  19. package/build/index.d.ts.map +1 -1
  20. package/build/index.js +13 -7
  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 +35 -0
  43. package/build/src/core/attachment.d.ts.map +1 -0
  44. package/build/src/core/attachment.js +47 -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_repository.d.ts +15 -0
  51. package/build/src/core/attachment_repository.d.ts.map +1 -0
  52. package/build/src/core/attachment_repository.js +8 -0
  53. package/build/src/core/attachment_repository.js.map +1 -0
  54. package/build/src/core/attachment_service.d.ts +28 -0
  55. package/build/src/core/attachment_service.d.ts.map +1 -0
  56. package/build/src/core/attachment_service.js +47 -0
  57. package/build/src/core/attachment_service.js.map +1 -0
  58. package/build/src/core/attachment_state.d.ts +11 -0
  59. package/build/src/core/attachment_state.d.ts.map +1 -0
  60. package/build/src/core/attachment_state.js +17 -0
  61. package/build/src/core/attachment_state.js.map +1 -0
  62. package/build/src/core/index.d.ts +13 -0
  63. package/build/src/core/index.d.ts.map +1 -0
  64. package/build/src/core/index.js +10 -0
  65. package/build/src/core/index.js.map +1 -0
  66. package/build/src/core/queue.d.ts +20 -0
  67. package/build/src/core/queue.d.ts.map +1 -0
  68. package/build/src/{types/event.js → core/queue.js} +1 -0
  69. package/build/src/core/queue.js.map +1 -0
  70. package/build/src/core/storage.d.ts +23 -0
  71. package/build/src/core/storage.d.ts.map +1 -0
  72. package/build/src/{types/config.js → core/storage.js} +1 -0
  73. package/build/src/core/storage.js.map +1 -0
  74. package/build/src/define_config.d.ts +35 -20
  75. package/build/src/define_config.d.ts.map +1 -1
  76. package/build/src/define_config.js +45 -24
  77. package/build/src/define_config.js.map +1 -0
  78. package/build/src/integrations/lucid/attachment_column.d.ts +11 -0
  79. package/build/src/integrations/lucid/attachment_column.d.ts.map +1 -0
  80. package/build/src/integrations/lucid/attachment_column.js +138 -0
  81. package/build/src/integrations/lucid/attachment_column.js.map +1 -0
  82. package/build/src/integrations/lucid/attachment_model.d.ts +36 -0
  83. package/build/src/integrations/lucid/attachment_model.d.ts.map +1 -0
  84. package/build/src/integrations/lucid/attachment_model.js +96 -0
  85. package/build/src/integrations/lucid/attachment_model.js.map +1 -0
  86. package/build/src/integrations/lucid/attachment_owner.d.ts +17 -0
  87. package/build/src/integrations/lucid/attachment_owner.d.ts.map +1 -0
  88. package/build/src/integrations/lucid/attachment_owner.js +15 -0
  89. package/build/src/integrations/lucid/attachment_owner.js.map +1 -0
  90. package/build/src/integrations/lucid/attachments_table_stub.d.ts +21 -0
  91. package/build/src/integrations/lucid/attachments_table_stub.d.ts.map +1 -0
  92. package/build/src/integrations/lucid/attachments_table_stub.js +26 -0
  93. package/build/src/integrations/lucid/attachments_table_stub.js.map +1 -0
  94. package/build/src/integrations/lucid/create_legacy_attachment_migration_script.d.ts +13 -0
  95. package/build/src/integrations/lucid/create_legacy_attachment_migration_script.d.ts.map +1 -0
  96. package/build/src/integrations/lucid/create_legacy_attachment_migration_script.js +20 -0
  97. package/build/src/integrations/lucid/create_legacy_attachment_migration_script.js.map +1 -0
  98. package/build/src/integrations/lucid/index.d.ts +19 -0
  99. package/build/src/integrations/lucid/index.d.ts.map +1 -0
  100. package/build/src/integrations/lucid/index.js +19 -0
  101. package/build/src/integrations/lucid/index.js.map +1 -0
  102. package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.d.ts +21 -0
  103. package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.d.ts.map +1 -0
  104. package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.js +68 -0
  105. package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.js.map +1 -0
  106. package/build/src/integrations/lucid/lucid_attachment_repository.d.ts +18 -0
  107. package/build/src/integrations/lucid/lucid_attachment_repository.d.ts.map +1 -0
  108. package/build/src/integrations/lucid/lucid_attachment_repository.js +21 -0
  109. package/build/src/integrations/lucid/lucid_attachment_repository.js.map +1 -0
  110. package/build/src/integrations/lucid/lucid_attachment_store.d.ts +27 -0
  111. package/build/src/integrations/lucid/lucid_attachment_store.d.ts.map +1 -0
  112. package/build/src/integrations/lucid/lucid_attachment_store.js +84 -0
  113. package/build/src/integrations/lucid/lucid_attachment_store.js.map +1 -0
  114. package/build/src/integrations/lucid/lucid_variant_generation_service.d.ts +24 -0
  115. package/build/src/integrations/lucid/lucid_variant_generation_service.d.ts.map +1 -0
  116. package/build/src/integrations/lucid/lucid_variant_generation_service.js +42 -0
  117. package/build/src/integrations/lucid/lucid_variant_generation_service.js.map +1 -0
  118. package/build/src/integrations/lucid/migrate_legacy_attachment.d.ts +57 -0
  119. package/build/src/integrations/lucid/migrate_legacy_attachment.d.ts.map +1 -0
  120. package/build/src/integrations/lucid/migrate_legacy_attachment.js +67 -0
  121. package/build/src/integrations/lucid/migrate_legacy_attachment.js.map +1 -0
  122. package/build/src/integrations/lucid/migrate_legacy_attachment_records.d.ts +34 -0
  123. package/build/src/integrations/lucid/migrate_legacy_attachment_records.d.ts.map +1 -0
  124. package/build/src/integrations/lucid/migrate_legacy_attachment_records.js +47 -0
  125. package/build/src/integrations/lucid/migrate_legacy_attachment_records.js.map +1 -0
  126. package/build/src/integrations/lucid/render_legacy_attachment_migration_script.d.ts +11 -0
  127. package/build/src/integrations/lucid/render_legacy_attachment_migration_script.d.ts.map +1 -0
  128. package/build/src/integrations/lucid/render_legacy_attachment_migration_script.js +41 -0
  129. package/build/src/integrations/lucid/render_legacy_attachment_migration_script.js.map +1 -0
  130. package/build/src/queues/adonis_queue.d.ts +27 -0
  131. package/build/src/queues/adonis_queue.d.ts.map +1 -0
  132. package/build/src/queues/adonis_queue.js +22 -0
  133. package/build/src/queues/adonis_queue.js.map +1 -0
  134. package/build/src/queues/memory_queue.d.ts +22 -0
  135. package/build/src/queues/memory_queue.d.ts.map +1 -0
  136. package/build/src/queues/memory_queue.js +67 -0
  137. package/build/src/queues/memory_queue.js.map +1 -0
  138. package/build/src/sources/attachment_manager.d.ts +51 -0
  139. package/build/src/sources/attachment_manager.d.ts.map +1 -0
  140. package/build/src/sources/attachment_manager.js +169 -0
  141. package/build/src/sources/attachment_manager.js.map +1 -0
  142. package/build/src/variants/variant_converter.d.ts +23 -0
  143. package/build/src/variants/variant_converter.d.ts.map +1 -0
  144. package/build/src/{types/converter.js → variants/variant_converter.js} +1 -0
  145. package/build/src/variants/variant_converter.js.map +1 -0
  146. package/build/src/variants/variant_generation_service.d.ts +28 -0
  147. package/build/src/variants/variant_generation_service.d.ts.map +1 -0
  148. package/build/src/variants/variant_generation_service.js +44 -0
  149. package/build/src/variants/variant_generation_service.js.map +1 -0
  150. package/build/stubs/config/attachment.stub +12 -0
  151. package/build/stubs/main.d.ts.map +1 -1
  152. package/build/stubs/main.js +1 -0
  153. package/build/stubs/main.js.map +1 -0
  154. package/build/stubs/migrations/attachments_table.stub +38 -0
  155. package/build/tests/adonis_drive_storage.spec.d.ts +8 -0
  156. package/build/tests/adonis_drive_storage.spec.d.ts.map +1 -0
  157. package/build/tests/adonis_drive_storage.spec.js +69 -0
  158. package/build/tests/adonis_drive_storage.spec.js.map +1 -0
  159. package/build/{src/types/attachment.js → tests/adonis_queue.spec.d.ts} +1 -0
  160. package/build/tests/adonis_queue.spec.d.ts.map +1 -0
  161. package/build/tests/adonis_queue.spec.js +52 -0
  162. package/build/tests/adonis_queue.spec.js.map +1 -0
  163. package/build/tests/attachment_job_processor.spec.d.ts +8 -0
  164. package/build/tests/attachment_job_processor.spec.d.ts.map +1 -0
  165. package/build/tests/attachment_job_processor.spec.js +89 -0
  166. package/build/tests/attachment_job_processor.spec.js.map +1 -0
  167. package/build/tests/attachment_manager.spec.d.ts +8 -0
  168. package/build/tests/attachment_manager.spec.d.ts.map +1 -0
  169. package/build/tests/attachment_manager.spec.js +128 -0
  170. package/build/tests/attachment_manager.spec.js.map +1 -0
  171. package/build/tests/attachment_manager_service.spec.d.ts +8 -0
  172. package/build/tests/attachment_manager_service.spec.d.ts.map +1 -0
  173. package/build/tests/attachment_manager_service.spec.js +47 -0
  174. package/build/tests/attachment_manager_service.spec.js.map +1 -0
  175. package/build/tests/attachment_provider.spec.d.ts +8 -0
  176. package/build/tests/attachment_provider.spec.d.ts.map +1 -0
  177. package/build/tests/attachment_provider.spec.js +71 -0
  178. package/build/tests/attachment_provider.spec.js.map +1 -0
  179. package/build/tests/attachment_service.spec.d.ts +8 -0
  180. package/build/tests/attachment_service.spec.d.ts.map +1 -0
  181. package/build/tests/attachment_service.spec.js +91 -0
  182. package/build/tests/attachment_service.spec.js.map +1 -0
  183. package/build/tests/attachments_controller.spec.d.ts +8 -0
  184. package/build/tests/attachments_controller.spec.d.ts.map +1 -0
  185. package/build/tests/attachments_controller.spec.js +34 -0
  186. package/build/tests/attachments_controller.spec.js.map +1 -0
  187. package/build/tests/attachments_table_stub.spec.d.ts +2 -0
  188. package/build/tests/attachments_table_stub.spec.d.ts.map +1 -0
  189. package/build/tests/attachments_table_stub.spec.js +65 -0
  190. package/build/tests/attachments_table_stub.spec.js.map +1 -0
  191. package/build/tests/configure.spec.d.ts +2 -0
  192. package/build/tests/configure.spec.d.ts.map +1 -0
  193. package/build/tests/configure.spec.js +38 -0
  194. package/build/tests/configure.spec.js.map +1 -0
  195. package/build/tests/container_bindings.types.d.ts +8 -0
  196. package/build/tests/container_bindings.types.d.ts.map +1 -0
  197. package/build/tests/container_bindings.types.js +9 -0
  198. package/build/tests/container_bindings.types.js.map +1 -0
  199. package/build/tests/create_legacy_attachment_migration_script.spec.d.ts +8 -0
  200. package/build/tests/create_legacy_attachment_migration_script.spec.d.ts.map +1 -0
  201. package/build/tests/create_legacy_attachment_migration_script.spec.js +31 -0
  202. package/build/tests/create_legacy_attachment_migration_script.spec.js.map +1 -0
  203. package/build/tests/define_config.spec.d.ts +8 -0
  204. package/build/tests/define_config.spec.d.ts.map +1 -0
  205. package/build/tests/define_config.spec.js +191 -0
  206. package/build/tests/define_config.spec.js.map +1 -0
  207. package/build/tests/helpers/lucid_test_database.d.ts +9 -0
  208. package/build/tests/helpers/lucid_test_database.d.ts.map +1 -0
  209. package/build/tests/helpers/lucid_test_database.js +51 -0
  210. package/build/tests/helpers/lucid_test_database.js.map +1 -0
  211. package/build/tests/local_file_storage.spec.d.ts +8 -0
  212. package/build/tests/local_file_storage.spec.d.ts.map +1 -0
  213. package/build/tests/local_file_storage.spec.js +44 -0
  214. package/build/tests/local_file_storage.spec.js.map +1 -0
  215. package/build/tests/lucid_attachment_column.spec.d.ts +8 -0
  216. package/build/tests/lucid_attachment_column.spec.d.ts.map +1 -0
  217. package/build/tests/lucid_attachment_column.spec.js +137 -0
  218. package/build/tests/lucid_attachment_column.spec.js.map +1 -0
  219. package/build/tests/lucid_attachment_lifecycle_service.spec.d.ts +8 -0
  220. package/build/tests/lucid_attachment_lifecycle_service.spec.d.ts.map +1 -0
  221. package/build/tests/lucid_attachment_lifecycle_service.spec.js +206 -0
  222. package/build/tests/lucid_attachment_lifecycle_service.spec.js.map +1 -0
  223. package/build/tests/lucid_attachment_repository.spec.d.ts +8 -0
  224. package/build/tests/lucid_attachment_repository.spec.d.ts.map +1 -0
  225. package/build/tests/lucid_attachment_repository.spec.js +50 -0
  226. package/build/tests/lucid_attachment_repository.spec.js.map +1 -0
  227. package/build/tests/lucid_attachment_store.spec.d.ts +8 -0
  228. package/build/tests/lucid_attachment_store.spec.d.ts.map +1 -0
  229. package/build/tests/lucid_attachment_store.spec.js +71 -0
  230. package/build/tests/lucid_attachment_store.spec.js.map +1 -0
  231. package/build/tests/lucid_sqlite_integration.spec.d.ts +8 -0
  232. package/build/tests/lucid_sqlite_integration.spec.d.ts.map +1 -0
  233. package/build/tests/lucid_sqlite_integration.spec.js +103 -0
  234. package/build/tests/lucid_sqlite_integration.spec.js.map +1 -0
  235. package/build/tests/lucid_variant_generation_service.spec.d.ts +8 -0
  236. package/build/tests/lucid_variant_generation_service.spec.d.ts.map +1 -0
  237. package/build/tests/lucid_variant_generation_service.spec.js +56 -0
  238. package/build/tests/lucid_variant_generation_service.spec.js.map +1 -0
  239. package/build/tests/memory_queue.spec.d.ts +8 -0
  240. package/build/tests/memory_queue.spec.d.ts.map +1 -0
  241. package/build/tests/memory_queue.spec.js +52 -0
  242. package/build/tests/memory_queue.spec.js.map +1 -0
  243. package/build/tests/migrate_legacy_attachment.spec.d.ts +8 -0
  244. package/build/tests/migrate_legacy_attachment.spec.d.ts.map +1 -0
  245. package/build/tests/migrate_legacy_attachment.spec.js +91 -0
  246. package/build/tests/migrate_legacy_attachment.spec.js.map +1 -0
  247. package/build/tests/migrate_legacy_attachment_records.spec.d.ts +8 -0
  248. package/build/tests/migrate_legacy_attachment_records.spec.d.ts.map +1 -0
  249. package/build/tests/migrate_legacy_attachment_records.spec.js +66 -0
  250. package/build/tests/migrate_legacy_attachment_records.spec.js.map +1 -0
  251. package/build/tests/package_exports.spec.d.ts +8 -0
  252. package/build/tests/package_exports.spec.d.ts.map +1 -0
  253. package/build/tests/package_exports.spec.js +31 -0
  254. package/build/tests/package_exports.spec.js.map +1 -0
  255. package/build/tests/variant_generation_service.spec.d.ts +8 -0
  256. package/build/tests/variant_generation_service.spec.d.ts.map +1 -0
  257. package/build/tests/variant_generation_service.spec.js +79 -0
  258. package/build/tests/variant_generation_service.spec.js.map +1 -0
  259. package/package.json +82 -78
  260. package/build/commands/make/converter.d.ts.map +0 -1
  261. package/build/commands/make/converter.js +0 -28
  262. package/build/services/regenerate_service.d.ts +0 -9
  263. package/build/services/regenerate_service.d.ts.map +0 -1
  264. package/build/services/regenerate_service.js +0 -29
  265. package/build/src/adapters/blurhash.d.ts +0 -11
  266. package/build/src/adapters/blurhash.d.ts.map +0 -1
  267. package/build/src/adapters/blurhash.js +0 -12
  268. package/build/src/adapters/exif.d.ts +0 -15
  269. package/build/src/adapters/exif.d.ts.map +0 -1
  270. package/build/src/adapters/exif.js +0 -165
  271. package/build/src/adapters/ffmpeg.d.ts +0 -19
  272. package/build/src/adapters/ffmpeg.d.ts.map +0 -1
  273. package/build/src/adapters/ffmpeg.js +0 -115
  274. package/build/src/adapters/lock.d.ts +0 -9
  275. package/build/src/adapters/lock.d.ts.map +0 -1
  276. package/build/src/adapters/lock.js +0 -21
  277. package/build/src/adapters/meta.d.ts +0 -10
  278. package/build/src/adapters/meta.d.ts.map +0 -1
  279. package/build/src/adapters/meta.js +0 -49
  280. package/build/src/adapters/poppler.d.ts +0 -20
  281. package/build/src/adapters/poppler.d.ts.map +0 -1
  282. package/build/src/adapters/poppler.js +0 -117
  283. package/build/src/adapters/soffice.d.ts +0 -14
  284. package/build/src/adapters/soffice.d.ts.map +0 -1
  285. package/build/src/adapters/soffice.js +0 -64
  286. package/build/src/attachment_manager.d.ts +0 -50
  287. package/build/src/attachment_manager.d.ts.map +0 -1
  288. package/build/src/attachment_manager.js +0 -145
  289. package/build/src/attachments/attachment.d.ts +0 -42
  290. package/build/src/attachments/attachment.d.ts.map +0 -1
  291. package/build/src/attachments/attachment.js +0 -233
  292. package/build/src/attachments/attachment_base.d.ts +0 -59
  293. package/build/src/attachments/attachment_base.d.ts.map +0 -1
  294. package/build/src/attachments/attachment_base.js +0 -211
  295. package/build/src/attachments/variant_attachment.d.ts +0 -27
  296. package/build/src/attachments/variant_attachment.d.ts.map +0 -1
  297. package/build/src/attachments/variant_attachment.js +0 -40
  298. package/build/src/converters/autodetect_converter.d.ts +0 -13
  299. package/build/src/converters/autodetect_converter.d.ts.map +0 -1
  300. package/build/src/converters/autodetect_converter.js +0 -77
  301. package/build/src/converters/converter.d.ts +0 -14
  302. package/build/src/converters/converter.d.ts.map +0 -1
  303. package/build/src/converters/converter.js +0 -14
  304. package/build/src/converters/document_thumbnail_converter.d.ts +0 -14
  305. package/build/src/converters/document_thumbnail_converter.d.ts.map +0 -1
  306. package/build/src/converters/document_thumbnail_converter.js +0 -36
  307. package/build/src/converters/image_converter.d.ts +0 -13
  308. package/build/src/converters/image_converter.d.ts.map +0 -1
  309. package/build/src/converters/image_converter.js +0 -27
  310. package/build/src/converters/pdf_thumbnail_converter.d.ts +0 -14
  311. package/build/src/converters/pdf_thumbnail_converter.d.ts.map +0 -1
  312. package/build/src/converters/pdf_thumbnail_converter.js +0 -39
  313. package/build/src/converters/video_thumbnail_converter.d.ts +0 -14
  314. package/build/src/converters/video_thumbnail_converter.d.ts.map +0 -1
  315. package/build/src/converters/video_thumbnail_converter.js +0 -40
  316. package/build/src/decorators/attachment.d.ts +0 -15
  317. package/build/src/decorators/attachment.d.ts.map +0 -1
  318. package/build/src/decorators/attachment.js +0 -103
  319. package/build/src/errors.d.ts +0 -67
  320. package/build/src/errors.d.ts.map +0 -1
  321. package/build/src/errors.js +0 -68
  322. package/build/src/services/attachment/attachment_detachment_service.d.ts +0 -19
  323. package/build/src/services/attachment/attachment_detachment_service.d.ts.map +0 -1
  324. package/build/src/services/attachment/attachment_detachment_service.js +0 -66
  325. package/build/src/services/attachment/attachment_persister_service.d.ts +0 -22
  326. package/build/src/services/attachment/attachment_persister_service.d.ts.map +0 -1
  327. package/build/src/services/attachment/attachment_persister_service.js +0 -96
  328. package/build/src/services/attachment/attachment_recorder_service.d.ts +0 -68
  329. package/build/src/services/attachment/attachment_recorder_service.d.ts.map +0 -1
  330. package/build/src/services/attachment/attachment_recorder_service.js +0 -121
  331. package/build/src/services/attachment/attachment_transaction_service.d.ts +0 -26
  332. package/build/src/services/attachment/attachment_transaction_service.d.ts.map +0 -1
  333. package/build/src/services/attachment/attachment_transaction_service.js +0 -46
  334. package/build/src/services/attachment/attachment_utils.d.ts +0 -35
  335. package/build/src/services/attachment/attachment_utils.d.ts.map +0 -1
  336. package/build/src/services/attachment/attachment_utils.js +0 -71
  337. package/build/src/services/attachment/attachment_variant_service.d.ts +0 -17
  338. package/build/src/services/attachment/attachment_variant_service.d.ts.map +0 -1
  339. package/build/src/services/attachment/attachment_variant_service.js +0 -99
  340. package/build/src/services/attachment/index.d.ts +0 -15
  341. package/build/src/services/attachment/index.d.ts.map +0 -1
  342. package/build/src/services/attachment/index.js +0 -15
  343. package/build/src/services/attachment_service.d.ts +0 -8
  344. package/build/src/services/attachment_service.d.ts.map +0 -1
  345. package/build/src/services/attachment_service.js +0 -7
  346. package/build/src/services/variant/variant_generator_service.d.ts +0 -24
  347. package/build/src/services/variant/variant_generator_service.d.ts.map +0 -1
  348. package/build/src/services/variant/variant_generator_service.js +0 -101
  349. package/build/src/services/variant/variant_persister_service.d.ts +0 -24
  350. package/build/src/services/variant/variant_persister_service.d.ts.map +0 -1
  351. package/build/src/services/variant/variant_persister_service.js +0 -59
  352. package/build/src/services/variant/variant_purger_service.d.ts +0 -15
  353. package/build/src/services/variant/variant_purger_service.d.ts.map +0 -1
  354. package/build/src/services/variant/variant_purger_service.js +0 -47
  355. package/build/src/services/variant_service.d.ts +0 -13
  356. package/build/src/services/variant_service.d.ts.map +0 -1
  357. package/build/src/services/variant_service.js +0 -63
  358. package/build/src/types/attachment.d.ts +0 -100
  359. package/build/src/types/attachment.d.ts.map +0 -1
  360. package/build/src/types/config.d.ts +0 -58
  361. package/build/src/types/config.d.ts.map +0 -1
  362. package/build/src/types/converter.d.ts +0 -144
  363. package/build/src/types/converter.d.ts.map +0 -1
  364. package/build/src/types/drive.d.ts +0 -6
  365. package/build/src/types/drive.d.ts.map +0 -1
  366. package/build/src/types/drive.js +0 -1
  367. package/build/src/types/event.d.ts +0 -16
  368. package/build/src/types/event.d.ts.map +0 -1
  369. package/build/src/types/index.d.ts +0 -15
  370. package/build/src/types/index.d.ts.map +0 -1
  371. package/build/src/types/index.js +0 -14
  372. package/build/src/types/input.d.ts +0 -35
  373. package/build/src/types/input.d.ts.map +0 -1
  374. package/build/src/types/input.js +0 -7
  375. package/build/src/types/lock.d.ts +0 -14
  376. package/build/src/types/lock.d.ts.map +0 -1
  377. package/build/src/types/lock.js +0 -7
  378. package/build/src/types/metadata.d.ts +0 -24
  379. package/build/src/types/metadata.d.ts.map +0 -1
  380. package/build/src/types/metadata.js +0 -7
  381. package/build/src/types/mixin.d.ts +0 -17
  382. package/build/src/types/mixin.d.ts.map +0 -1
  383. package/build/src/types/mixin.js +0 -7
  384. package/build/src/types/regenerate.d.ts +0 -12
  385. package/build/src/types/regenerate.d.ts.map +0 -1
  386. package/build/src/types/regenerate.js +0 -7
  387. package/build/src/types/service.d.ts +0 -25
  388. package/build/src/types/service.d.ts.map +0 -1
  389. package/build/src/types/service.js +0 -7
  390. package/build/src/utils/default_values.d.ts +0 -20
  391. package/build/src/utils/default_values.d.ts.map +0 -1
  392. package/build/src/utils/default_values.js +0 -19
  393. package/build/src/utils/helpers.d.ts +0 -19
  394. package/build/src/utils/helpers.d.ts.map +0 -1
  395. package/build/src/utils/helpers.js +0 -131
  396. package/build/src/utils/hooks.d.ts +0 -12
  397. package/build/src/utils/hooks.d.ts.map +0 -1
  398. package/build/src/utils/hooks.js +0 -42
  399. package/build/src/utils/symbols.d.ts +0 -8
  400. package/build/src/utils/symbols.d.ts.map +0 -1
  401. package/build/src/utils/symbols.js +0 -7
  402. package/build/stubs/config.stub +0 -140
  403. package/build/stubs/make/converter/main.stub +0 -20
  404. package/build/tsconfig.tsbuildinfo +0 -1
@@ -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=attachment_service.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment_service.spec.d.ts","sourceRoot":"","sources":["../../tests/attachment_service.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,91 @@
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 { AttachmentService, } from '../index.js';
9
+ class FakeStorage {
10
+ writes = [];
11
+ removals = [];
12
+ reads = [];
13
+ async write(input) {
14
+ this.writes.push(input);
15
+ }
16
+ async read(location) {
17
+ this.reads.push(location);
18
+ return new Uint8Array([1, 2, 3]);
19
+ }
20
+ async remove(location) {
21
+ this.removals.push(location);
22
+ }
23
+ }
24
+ class FakeQueue {
25
+ jobs = [];
26
+ async enqueue(job) {
27
+ this.jobs.push(job);
28
+ }
29
+ }
30
+ test('creates a standalone attachment and delegates its content to storage', async ({ assert }) => {
31
+ const storage = new FakeStorage();
32
+ const queue = new FakeQueue();
33
+ const service = new AttachmentService({
34
+ storage,
35
+ queue,
36
+ defaultDisk: 'public',
37
+ createId: () => 'attachment-id',
38
+ });
39
+ const attachment = await service.create({
40
+ body: new Uint8Array([1, 2, 3]),
41
+ originalName: 'avatar.JPG',
42
+ mimeType: 'image/jpeg',
43
+ folder: 'users/42',
44
+ });
45
+ assert.deepEqual(attachment, {
46
+ id: 'attachment-id',
47
+ disk: 'public',
48
+ name: 'attachment-id.jpg',
49
+ originalName: 'avatar.JPG',
50
+ path: 'users/42/attachment-id.jpg',
51
+ size: 3,
52
+ extname: 'jpg',
53
+ mimeType: 'image/jpeg',
54
+ });
55
+ assert.equal(storage.writes.length, 1);
56
+ assert.deepEqual(storage.writes[0], {
57
+ disk: 'public',
58
+ path: 'users/42/attachment-id.jpg',
59
+ body: new Uint8Array([1, 2, 3]),
60
+ mimeType: 'image/jpeg',
61
+ });
62
+ });
63
+ test('schedules variant generation without requiring a database or Lucid', async ({ assert }) => {
64
+ const storage = new FakeStorage();
65
+ const queue = new FakeQueue();
66
+ const service = new AttachmentService({
67
+ storage,
68
+ queue,
69
+ defaultDisk: 'public',
70
+ createId: () => 'attachment-id',
71
+ });
72
+ const attachment = await service.create({ body: new Uint8Array(), originalName: 'report.pdf' });
73
+ await service.scheduleVariantGeneration(attachment, ['thumbnail']);
74
+ assert.deepEqual(queue.jobs, [
75
+ { type: 'generate-variants', attachmentId: 'attachment-id', variantKeys: ['thumbnail'] },
76
+ ]);
77
+ });
78
+ test('reads an attachment from the configured storage', async ({ assert }) => {
79
+ const storage = new FakeStorage();
80
+ const queue = new FakeQueue();
81
+ const service = new AttachmentService({
82
+ storage,
83
+ queue,
84
+ defaultDisk: 'public',
85
+ createId: () => 'attachment-id',
86
+ });
87
+ const attachment = await service.create({ body: new Uint8Array(), originalName: 'report.pdf' });
88
+ assert.deepEqual(await service.read(attachment), new Uint8Array([1, 2, 3]));
89
+ assert.deepEqual(storage.reads, [{ disk: 'public', path: 'attachment-id.pdf' }]);
90
+ });
91
+ //# sourceMappingURL=attachment_service.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment_service.spec.js","sourceRoot":"","sources":["../../tests/attachment_service.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EACL,iBAAiB,GAKlB,MAAM,aAAa,CAAA;AAEpB,MAAM,WAAW;IACf,MAAM,GAA2B,EAAE,CAAA;IACnC,QAAQ,GAAsB,EAAE,CAAA;IAChC,KAAK,GAAsB,EAAE,CAAA;IAE7B,KAAK,CAAC,KAAK,CAAC,KAA2B;QACrC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,QAAyB;QAClC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACzB,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IAClC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,QAAyB;QACpC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAC9B,CAAC;CACF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EAAE,IAAI,UAAU,EAAE,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAA;IAE/F,MAAM,CAAC,SAAS,CAAC,MAAM,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3E,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAA;AAClF,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=attachments_controller.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments_controller.spec.d.ts","sourceRoot":"","sources":["../../tests/attachments_controller.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,34 @@
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 { AttachmentsController } from '../src/controllers/attachments_controller.js';
9
+ test.group('AttachmentsController', () => {
10
+ test('returns attachment bytes with their MIME type', async ({ assert }) => {
11
+ const headers = {};
12
+ let body;
13
+ const controller = new AttachmentsController({ async read() { return new Uint8Array([1, 2, 3]); } }, {
14
+ async findById(id) {
15
+ assert.equal(id, 'attachment-id');
16
+ return {
17
+ id, disk: 'public', path: 'avatar.jpg', name: 'avatar.jpg', originalName: 'avatar.jpg',
18
+ mimeType: 'image/jpeg', extname: 'jpg', size: 3,
19
+ };
20
+ },
21
+ });
22
+ await controller.handle({
23
+ request: { param: () => 'attachment-id' },
24
+ response: {
25
+ header(name, value) { headers[name] = value; },
26
+ send(value) { body = value; },
27
+ notFound() { throw new Error('not found'); },
28
+ },
29
+ });
30
+ assert.equal(headers['content-type'], 'image/jpeg');
31
+ assert.deepEqual(body, new Uint8Array([1, 2, 3]));
32
+ });
33
+ });
34
+ //# sourceMappingURL=attachments_controller.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments_controller.spec.js","sourceRoot":"","sources":["../../tests/attachments_controller.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAA;AAEpF,IAAI,CAAC,KAAK,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACvC,IAAI,CAAC,+CAA+C,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACzE,MAAM,OAAO,GAA2B,EAAE,CAAA;QAC1C,IAAI,IAA4B,CAAA;QAChC,MAAM,UAAU,GAAG,IAAI,qBAAqB,CAC1C,EAAE,KAAK,CAAC,IAAI,KAAK,OAAO,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,EAAE,EACrD;YACE,KAAK,CAAC,QAAQ,CAAC,EAAE;gBACf,MAAM,CAAC,KAAK,CAAC,EAAE,EAAE,eAAe,CAAC,CAAA;gBACjC,OAAO;oBACL,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY;oBACtF,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;iBAChD,CAAA;YACH,CAAC;SACF,CACF,CAAA;QAED,MAAM,UAAU,CAAC,MAAM,CAAC;YACtB,OAAO,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,eAAe,EAAE;YACzC,QAAQ,EAAE;gBACR,MAAM,CAAC,IAAY,EAAE,KAAa,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA,CAAC,CAAC;gBAC7D,IAAI,CAAC,KAAiB,IAAI,IAAI,GAAG,KAAK,CAAA,CAAC,CAAC;gBACxC,QAAQ,KAAK,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAA,CAAC,CAAC;aAC5C;SACO,CAAC,CAAA;QAEX,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,YAAY,CAAC,CAAA;QACnD,MAAM,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;IACnD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=attachments_table_stub.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments_table_stub.spec.d.ts","sourceRoot":"","sources":["../../tests/attachments_table_stub.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,65 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { test } from '@japa/runner';
4
+ import MakeAttachmentsTable from '../commands/make/attachments_table.js';
5
+ import { stubsRoot } from '../stubs/main.js';
6
+ import { createAttachmentsTableStubState } from '../src/integrations/lucid/attachments_table_stub.js';
7
+ test.group('attachments table migration stub', () => {
8
+ test('prepares a timestamped destination and template state', ({ assert }) => {
9
+ const state = createAttachmentsTableStubState({
10
+ directory: '/app/database/migrations',
11
+ tableName: 'media_attachments',
12
+ timestamp: 1700000000000,
13
+ });
14
+ assert.deepEqual(state, {
15
+ destination: '/app/database/migrations/1700000000000_create_media_attachments_table.ts',
16
+ tableName: 'media_attachments',
17
+ className: 'MediaAttachments',
18
+ });
19
+ });
20
+ test('rejects unsafe table names', ({ assert }) => {
21
+ assert.throws(() => createAttachmentsTableStubState({ directory: '/app', tableName: 'attachments; drop table users' }), 'Lucid attachment table names must be snake_case identifiers');
22
+ });
23
+ test('contains the polymorphic attachment schema', async ({ assert }) => {
24
+ const stub = await readFile(join(stubsRoot, 'migrations/attachments_table.stub'), 'utf8');
25
+ assert.include(stub, 'exports({ to: destination })');
26
+ assert.include(stub, 'Create{{ className }}Table');
27
+ assert.include(stub, "protected tableName = '{{ tableName }}'");
28
+ assert.include(stub, "table.string('attachable_type').notNullable()");
29
+ assert.include(stub, "table.uuid('parent_id').nullable()");
30
+ assert.include(stub, "table.unique(['parent_id', 'variant_key'])");
31
+ });
32
+ test('uses the package stub from the Ace command', async ({ assert }) => {
33
+ const generated = [];
34
+ const messages = [];
35
+ await MakeAttachmentsTable.prototype.run.call({
36
+ parsed: { flags: { table: 'media_attachments', folder: 'database/migrations' } },
37
+ app: { makePath: (path) => `/app/${path}` },
38
+ async createCodemods() {
39
+ return {
40
+ async makeUsingStub(root, path, state) {
41
+ generated.push({ root, path, state });
42
+ },
43
+ };
44
+ },
45
+ logger: {
46
+ success(message) {
47
+ messages.push(message);
48
+ },
49
+ },
50
+ });
51
+ assert.lengthOf(generated, 1);
52
+ const stub = generated[0];
53
+ const message = messages[0];
54
+ if (!stub || !message) {
55
+ throw new Error('The command must generate one migration and report its path');
56
+ }
57
+ assert.equal(stub.root, stubsRoot);
58
+ assert.equal(stub.path, 'migrations/attachments_table.stub');
59
+ assert.equal(stub.state.tableName, 'media_attachments');
60
+ assert.equal(stub.state.className, 'MediaAttachments');
61
+ assert.match(String(stub.state.destination), /^\/app\/database\/migrations\/\d+_create_media_attachments_table\.ts$/);
62
+ assert.match(message, /^Created \/app\/database\/migrations\//);
63
+ });
64
+ });
65
+ //# sourceMappingURL=attachments_table_stub.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachments_table_stub.spec.js","sourceRoot":"","sources":["../../tests/attachments_table_stub.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EA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A;QAE3B,IAAI,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAA;QAChF,CAAC;QAED,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;QAClC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,mCAAmC,CAAC,CAAA;QAC5D,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAAA;QACvD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAA;QACtD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,EAAE,uEAAuE,CAAC,CAAA;QACrH,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,wCAAwC,CAAC,CAAA;IACjE,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=configure.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.spec.d.ts","sourceRoot":"","sources":["../../tests/configure.spec.ts"],"names":[],"mappings":""}
@@ -0,0 +1,38 @@
1
+ import { access, readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { test } from '@japa/runner';
4
+ import { configure } from '../configure.js';
5
+ import { stubsRoot } from '../stubs/main.js';
6
+ test.group('configure', () => {
7
+ test('generates the default attachment config and registers package integrations', async ({ assert }) => {
8
+ const stubs = [];
9
+ const providers = [];
10
+ const commands = [];
11
+ await configure({
12
+ async createCodemods() {
13
+ return {
14
+ async makeUsingStub(root, path, state) {
15
+ stubs.push({ root, path, state });
16
+ },
17
+ async updateRcFile(callback) {
18
+ callback({
19
+ addProvider(value) {
20
+ providers.push(value);
21
+ },
22
+ addCommand(value) {
23
+ commands.push(value);
24
+ },
25
+ });
26
+ },
27
+ };
28
+ },
29
+ });
30
+ assert.deepEqual(stubs, [{ root: stubsRoot, path: 'config/attachment.stub', state: {} }]);
31
+ assert.deepEqual(providers, ['@jrmc/adonis-attachment/attachment_provider']);
32
+ assert.deepEqual(commands, ['@jrmc/adonis-attachment/commands']);
33
+ await access(join(stubsRoot, 'config/attachment.stub'));
34
+ assert.include(await readFile(join(stubsRoot, 'config/attachment.stub'), 'utf8'), 'storage: LocalFileStorage.fromApp');
35
+ assert.notInclude(await readFile(join(stubsRoot, 'config/attachment.stub'), 'utf8'), 'maxBytes');
36
+ });
37
+ });
38
+ //# sourceMappingURL=configure.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.spec.js","sourceRoot":"","sources":["../../tests/configure.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,GAAG,EAAE;IAC3B,IAAI,CAAC,4EAA4E,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QACtG,MAAM,KAAK,GAA0E,EAAE,CAAA;QACvF,MAAM,SAAS,GAAa,EAAE,CAAA;QAC9B,MAAM,QAAQ,GAAa,EAAE,CAAA;QAE7B,MAAM,SAAS,CAAC;YACd,KAAK,CAAC,cAAc;gBAClB,OAAO;oBACL,KAAK,CAAC,aAAa,CAAC,IAAY,EAAE,IAAY,EAAE,KAA8B;wBAC5E,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;oBACnC,CAAC;oBACD,KAAK,CAAC,YAAY,CAAC,QAAiG;wBAClH,QAAQ,CAAC;4BACP,WAAW,CAAC,KAAK;gCACf,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;4BACvB,CAAC;4BACD,UAAU,CAAC,KAAK;gCACd,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;4BACtB,CAAC;yBACF,CAAC,CAAA;oBACJ,CAAC;iBACF,CAAA;YACH,CAAC;SACO,CAAC,CAAA;QAEX,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,wBAAwB,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;QACzF,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,6CAA6C,CAAC,CAAC,CAAA;QAC5E,MAAM,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC,kCAAkC,CAAC,CAAC,CAAA;QAChE,MAAM,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,CAAC,CAAA;QACvD,MAAM,CAAC,OAAO,CACZ,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,EAAE,MAAM,CAAC,EACjE,mCAAmC,CACpC,CAAA;QACD,MAAM,CAAC,UAAU,CAAC,MAAM,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,wBAAwB,CAAC,EAAE,MAAM,CAAC,EAAE,UAAU,CAAC,CAAA;IAClG,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=container_bindings.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container_bindings.types.d.ts","sourceRoot":"","sources":["../../tests/container_bindings.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH,OAAO,EAAE,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ const resolvedManager = app.container.make('jrmc.attachment.manager');
8
+ export {};
9
+ //# sourceMappingURL=container_bindings.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"container_bindings.types.js","sourceRoot":"","sources":["../../tests/container_bindings.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,MAAM,eAAe,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,yBAAyB,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=create_legacy_attachment_migration_script.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_legacy_attachment_migration_script.spec.d.ts","sourceRoot":"","sources":["../../tests/create_legacy_attachment_migration_script.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { mkdtemp, readFile, rm } from 'node:fs/promises';
8
+ import { tmpdir } from 'node:os';
9
+ import { join } from 'node:path';
10
+ import { test } from '@japa/runner';
11
+ import { createLegacyAttachmentMigrationScript } from '../src/integrations/lucid/index.js';
12
+ test.group('createLegacyAttachmentMigrationScript', () => {
13
+ test('writes a timestamped migration script template', async ({ assert }) => {
14
+ const directory = await mkdtemp(join(tmpdir(), 'adonis-attachment-'));
15
+ try {
16
+ const filePath = await createLegacyAttachmentMigrationScript({
17
+ directory,
18
+ defaultDisk: 's3',
19
+ timestamp: 1700000000000,
20
+ });
21
+ assert.equal(filePath, join(directory, '1700000000000_migrate_v5_attachments.ts'));
22
+ const contents = await readFile(filePath, 'utf8');
23
+ assert.include(contents, "defaultDisk: 's3'");
24
+ assert.include(contents, 'migrateLegacyAttachmentRecords');
25
+ }
26
+ finally {
27
+ await rm(directory, { recursive: true, force: true });
28
+ }
29
+ });
30
+ });
31
+ //# sourceMappingURL=create_legacy_attachment_migration_script.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_legacy_attachment_migration_script.spec.js","sourceRoot":"","sources":["../../tests/create_legacy_attachment_migration_script.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EAAE,qCAAqC,EAAE,MAAM,oCAAoC,CAAA;AAE1F,IAAI,CAAC,KAAK,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACvD,IAAI,CAAC,gDAAgD,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAC1E,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,oBAAoB,CAAC,CAAC,CAAA;QAErE,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,qCAAqC,CAAC;gBAC3D,SAAS;gBACT,WAAW,EAAE,IAAI;gBACjB,SAAS,EAAE,aAAa;aACzB,CAAC,CAAA;YAEF,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,EAAE,yCAAyC,CAAC,CAAC,CAAA;YAClF,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAA;YACjD,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAA;YAC7C,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,gCAAgC,CAAC,CAAA;QAC5D,CAAC;gBAAS,CAAC;YACT,MAAM,EAAE,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QACvD,CAAC;IACH,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=define_config.spec.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define_config.spec.d.ts","sourceRoot":"","sources":["../../tests/define_config.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
@@ -0,0 +1,191 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { configProvider } from '@adonisjs/core';
8
+ import { test } from '@japa/runner';
9
+ import { AdonisDriveStorage, AttachmentJobProcessor, defineConfig, MemoryAttachmentQueue, } from '../index.js';
10
+ test.group('defineConfig', () => {
11
+ test('uses the default disk resolved from Drive config', async ({ assert }) => {
12
+ const disks = [];
13
+ const drive = {
14
+ use(disk) {
15
+ disks.push(disk ?? 'default');
16
+ return {
17
+ async put() { },
18
+ async getBytes() {
19
+ return new Uint8Array();
20
+ },
21
+ async delete() { },
22
+ };
23
+ },
24
+ };
25
+ const config = defineConfig({
26
+ storage: AdonisDriveStorage.fromApp,
27
+ });
28
+ const resolved = await config.resolver({
29
+ config: {
30
+ get(binding) {
31
+ assert.equal(binding, 'drive');
32
+ return configProvider.create(async () => ({ config: { default: 's3' } }));
33
+ },
34
+ },
35
+ container: {
36
+ async make(binding) {
37
+ assert.equal(binding, 'drive.manager');
38
+ return drive;
39
+ },
40
+ },
41
+ });
42
+ assert.equal(resolved.defaultDisk, 's3');
43
+ await resolved.storage.write({
44
+ disk: resolved.defaultDisk,
45
+ path: 'attachments/avatar.png',
46
+ body: new Uint8Array(),
47
+ mimeType: 'image/png',
48
+ });
49
+ assert.deepEqual(disks, ['s3']);
50
+ });
51
+ test('uses fs when storage does not define a default disk', async ({ assert }) => {
52
+ const storage = {
53
+ async write() { },
54
+ async read() {
55
+ return new Uint8Array();
56
+ },
57
+ async remove() { },
58
+ };
59
+ const resolved = await defineConfig({ storage }).resolver({});
60
+ assert.equal(resolved.defaultDisk, 'fs');
61
+ });
62
+ test('resolves direct storage and queue integrations', async ({ assert }) => {
63
+ const storage = {
64
+ async write() { },
65
+ async read() {
66
+ return new Uint8Array();
67
+ },
68
+ async remove() { },
69
+ };
70
+ const queue = {
71
+ async enqueue(_job) { },
72
+ };
73
+ const config = defineConfig({ defaultDisk: 'public', storage, queue });
74
+ const resolved = await config.resolver({});
75
+ assert.equal(resolved.defaultDisk, 'public');
76
+ assert.equal(resolved.storage, storage);
77
+ assert.equal(resolved.queue, queue);
78
+ assert.deepEqual(resolved.route, { path: '/attachments/:id' });
79
+ });
80
+ test('resolves integrations from the application at boot time', async ({ assert }) => {
81
+ const storage = {
82
+ async write() { },
83
+ async read() {
84
+ return new Uint8Array();
85
+ },
86
+ async remove() { },
87
+ };
88
+ const queue = {
89
+ async enqueue(_job) { },
90
+ };
91
+ const app = { marker: 'application' };
92
+ const config = defineConfig({
93
+ defaultDisk: 'public',
94
+ storage(resolvedApp) {
95
+ assert.equal(resolvedApp, app);
96
+ return storage;
97
+ },
98
+ async queue(resolvedApp) {
99
+ assert.equal(resolvedApp, app);
100
+ return queue;
101
+ },
102
+ });
103
+ const resolved = await config.resolver(app);
104
+ assert.equal(resolved.storage, storage);
105
+ assert.equal(resolved.queue, queue);
106
+ });
107
+ test('uses the in-memory queue by default', async ({ assert }) => {
108
+ const storage = {
109
+ async write() { },
110
+ async read() {
111
+ return new Uint8Array();
112
+ },
113
+ async remove() { },
114
+ };
115
+ const config = defineConfig({ defaultDisk: 'public', storage, queueConcurrency: 2 });
116
+ const resolved = await config.resolver({});
117
+ assert.instanceOf(resolved.queue, MemoryAttachmentQueue);
118
+ });
119
+ test('allows applications to disable or prefix the read route', async ({ assert }) => {
120
+ const storage = {
121
+ async write() { },
122
+ async read() {
123
+ return new Uint8Array();
124
+ },
125
+ async remove() { },
126
+ };
127
+ const disabled = await defineConfig({
128
+ defaultDisk: 'public',
129
+ storage,
130
+ route: false,
131
+ }).resolver({});
132
+ const prefixed = await defineConfig({
133
+ defaultDisk: 'public',
134
+ storage,
135
+ route: { prefix: '/media/files/' },
136
+ }).resolver({});
137
+ assert.isFalse(disabled.route);
138
+ assert.deepEqual(prefixed.route, { path: '/media/files/:id' });
139
+ });
140
+ test('preserves source-manager options', async ({ assert }) => {
141
+ const storage = {
142
+ async write() { },
143
+ async read() {
144
+ return new Uint8Array();
145
+ },
146
+ async remove() { },
147
+ };
148
+ const sources = { maxBytes: 10 * 1024 * 1024 };
149
+ const resolved = await defineConfig({ defaultDisk: 'public', storage, sources }).resolver({});
150
+ assert.equal(resolved.sources, sources);
151
+ });
152
+ test('rejects invalid route prefixes', async ({ assert }) => {
153
+ const storage = {
154
+ async write() { },
155
+ async read() {
156
+ return new Uint8Array();
157
+ },
158
+ async remove() { },
159
+ };
160
+ await assert.rejects(() => defineConfig({ defaultDisk: 'public', storage, route: { prefix: 'attachments/:id' } }).resolver({}), 'Attachment route prefix must start with "/" and cannot contain parameters');
161
+ });
162
+ test('uses the configured processor as the memory queue handler', async ({ assert }) => {
163
+ const storage = {
164
+ async write() { },
165
+ async read() {
166
+ return new Uint8Array();
167
+ },
168
+ async remove() { },
169
+ };
170
+ const processed = [];
171
+ const processor = new AttachmentJobProcessor({
172
+ attachments: {
173
+ async findById() {
174
+ return null;
175
+ },
176
+ },
177
+ variants: {
178
+ async generate() { },
179
+ },
180
+ });
181
+ processor.process = async (job) => {
182
+ processed.push(job);
183
+ };
184
+ const config = defineConfig({ defaultDisk: 'public', storage, processor });
185
+ const resolved = await config.resolver({});
186
+ await resolved.queue.enqueue({ type: 'generate-variants', attachmentId: 'attachment-id' });
187
+ await resolved.queue.drain();
188
+ assert.deepEqual(processed, [{ type: 'generate-variants', attachmentId: 'attachment-id' }]);
189
+ });
190
+ });
191
+ //# sourceMappingURL=define_config.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"define_config.spec.js","sourceRoot":"","sources":["../../tests/define_config.spec.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,GAItB,MAAM,aAAa,CAAA;AAEpB,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,EAAE;IAC9B,IAAI,CAAC,kDAAkD,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;QAC5E,MAAM,KAAK,GAAa,EAAE,CAAA;QAC1B,MAAM,KAAK,GAAG;YACZ,GAAG,CAAC,IAAa;gBACf,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,SAAS,CAAC,CAAA;gBAC7B,OAAO;oBACL,KAAK,CAAC,GAAG,KAAI,CAAC;oBACd,KAAK,CAAC,QAAQ;wBACZ,OAAO,IAAI,UAAU,EAAE,CAAA;oBACzB,CAAC;oBACD,KAAK,CAAC,MAAM,KAAI,CAAC;iBAClB,CAAA;YACH,CAAC;SACF,CAAA;QACD,MAAM,MAAM,GAAG,YAAY,CAAC;YAC1B,OAAO,EAAE,kBAAkB,CAAC,OAAO;SACpC,CAAC,CAAA;QAEF,MAAM,QAAQ,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AAA;QACrB,CAAC,CAAA;QACD,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAA;QAC1E,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAW,CAAC,CAAA;QAEnD,MAAM,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC,CAAA;QAC1F,MAAO,QAAQ,CAAC,KAA+B,CAAC,KAAK,EAAE,CAAA;QAEvD,MAAM,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,YAAY,EAAE,eAAe,EAAE,CAAC,CAAC,CAAA;IAC7F,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { Database } from '@adonisjs/lucid/database';
8
+ export declare function createLucidTestDatabase(): Promise<Database>;
9
+ //# sourceMappingURL=lucid_test_database.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_test_database.d.ts","sourceRoot":"","sources":["../../../tests/helpers/lucid_test_database.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAA;AAInD,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,QAAQ,CAAC,CAgDjE"}