@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,13 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ export type CreateLegacyAttachmentMigrationScriptOptions = {
8
+ directory: string;
9
+ defaultDisk?: string;
10
+ timestamp?: number;
11
+ };
12
+ export declare function createLegacyAttachmentMigrationScript(options: CreateLegacyAttachmentMigrationScriptOptions): Promise<string>;
13
+ //# sourceMappingURL=create_legacy_attachment_migration_script.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_legacy_attachment_migration_script.d.ts","sourceRoot":"","sources":["../../../../src/integrations/lucid/create_legacy_attachment_migration_script.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,MAAM,4CAA4C,GAAG;IACzD,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,wBAAsB,qCAAqC,CACzD,OAAO,EAAE,4CAA4C,GACpD,OAAO,CAAC,MAAM,CAAC,CAWjB"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { mkdir, writeFile } from 'node:fs/promises';
8
+ import { dirname, join } from 'node:path';
9
+ import { renderLegacyAttachmentMigrationScript } from './render_legacy_attachment_migration_script.js';
10
+ export async function createLegacyAttachmentMigrationScript(options) {
11
+ const timestamp = options.timestamp ?? Date.now();
12
+ const filePath = join(options.directory, `${timestamp}_migrate_v5_attachments.ts`);
13
+ const contents = renderLegacyAttachmentMigrationScript({
14
+ ...(options.defaultDisk ? { defaultDisk: options.defaultDisk } : {}),
15
+ });
16
+ await mkdir(dirname(filePath), { recursive: true });
17
+ await writeFile(filePath, contents, 'utf8');
18
+ return filePath;
19
+ }
20
+ //# sourceMappingURL=create_legacy_attachment_migration_script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create_legacy_attachment_migration_script.js","sourceRoot":"","sources":["../../../../src/integrations/lucid/create_legacy_attachment_migration_script.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAE,qCAAqC,EAAE,MAAM,gDAAgD,CAAA;AAQtG,MAAM,CAAC,KAAK,UAAU,qCAAqC,CACzD,OAAqD;IAErD,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,CAAA;IACjD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,SAAS,4BAA4B,CAAC,CAAA;IAClF,MAAM,QAAQ,GAAG,qCAAqC,CAAC;QACrD,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACrE,CAAC,CAAA;IAEF,MAAM,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACnD,MAAM,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAA;IAE3C,OAAO,QAAQ,CAAA;AACjB,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ export { AttachmentModel } from "./attachment_model.js";
8
+ export { attachment, type LucidAttachmentOptions, } from "./attachment_column.js";
9
+ export { attachmentRelation, attachmentsRelation, AttachmentRelation, AttachmentCollectionRelation, type AttachmentRelationOptions, } from "./attachment_relation.js";
10
+ export { LucidAttachmentRepository } from "./lucid_attachment_repository.js";
11
+ export { LucidAttachmentStore, type LucidAttachmentWithVariants, type LucidAttachmentStoreOptions, } from "./lucid_attachment_store.js";
12
+ export { LucidAttachmentLifecycleService, type AttachmentFileService, type LucidAttachmentPersistence, } from "./lucid_attachment_lifecycle_service.js";
13
+ export { LucidVariantGenerationService, PersistedAttachmentNotFoundError, type LucidVariantGenerationServiceOptions, } from "./lucid_variant_generation_service.js";
14
+ export { createAttachmentOwnerKey, type AttachmentOwner, } from "./attachment_owner.js";
15
+ export { createAttachmentsTableStubState, type AttachmentsTableStubOptions, type AttachmentsTableStubState, } from "./attachments_table_stub.js";
16
+ export { migrateLegacyAttachment, migrateLegacyAttachmentColumn, type LegacyAttachment, type LegacyVariant, type MigrateLegacyAttachmentOptions, type MigrateLegacyAttachmentColumnOptions, type MigratedAttachmentRow, } from "./migrate_legacy_attachment.js";
17
+ export { migrateLegacyAttachmentRecords, type LegacyAttachmentMigrationRecord, type LegacyAttachmentMigrationResult, type LegacyAttachmentMigrationWriter, type MigrateLegacyAttachmentRecordsOptions, } from "./migrate_legacy_attachment_records.js";
18
+ export { createLegacyAttachmentMigrationScript, type CreateLegacyAttachmentMigrationScriptOptions, } from "./create_legacy_attachment_migration_script.js";
19
+ export { renderLegacyAttachmentMigrationScript, type RenderLegacyAttachmentMigrationScriptOptions, } from "./render_legacy_attachment_migration_script.js";
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/integrations/lucid/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,UAAU,EACV,KAAK,sBAAsB,GAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,EAC5B,KAAK,yBAAyB,GAC/B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,+BAA+B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,GAChC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,EAChC,KAAK,oCAAoC,GAC1C,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,wBAAwB,EACxB,KAAK,eAAe,GACrB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,+BAA+B,EAC/B,KAAK,2BAA2B,EAChC,KAAK,yBAAyB,GAC/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,uBAAuB,EACvB,6BAA6B,EAC7B,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,8BAA8B,EACnC,KAAK,oCAAoC,EACzC,KAAK,qBAAqB,GAC3B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,8BAA8B,EAC9B,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACpC,KAAK,qCAAqC,GAC3C,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,qCAAqC,EACrC,KAAK,4CAA4C,GAClD,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,qCAAqC,EACrC,KAAK,4CAA4C,GAClD,MAAM,gDAAgD,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ export { AttachmentModel } from "./attachment_model.js";
8
+ export { attachment, } from "./attachment_column.js";
9
+ export { attachmentRelation, attachmentsRelation, AttachmentRelation, AttachmentCollectionRelation, } from "./attachment_relation.js";
10
+ export { LucidAttachmentRepository } from "./lucid_attachment_repository.js";
11
+ export { LucidAttachmentStore, } from "./lucid_attachment_store.js";
12
+ export { LucidAttachmentLifecycleService, } from "./lucid_attachment_lifecycle_service.js";
13
+ export { LucidVariantGenerationService, PersistedAttachmentNotFoundError, } from "./lucid_variant_generation_service.js";
14
+ export { createAttachmentOwnerKey, } from "./attachment_owner.js";
15
+ export { createAttachmentsTableStubState, } from "./attachments_table_stub.js";
16
+ export { migrateLegacyAttachment, migrateLegacyAttachmentColumn, } from "./migrate_legacy_attachment.js";
17
+ export { migrateLegacyAttachmentRecords, } from "./migrate_legacy_attachment_records.js";
18
+ export { createLegacyAttachmentMigrationScript, } from "./create_legacy_attachment_migration_script.js";
19
+ export { renderLegacyAttachmentMigrationScript, } from "./render_legacy_attachment_migration_script.js";
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/integrations/lucid/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EACL,UAAU,GAEX,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,4BAA4B,GAE7B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAC7E,OAAO,EACL,oBAAoB,GAGrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,+BAA+B,GAGhC,MAAM,yCAAyC,CAAC;AACjD,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,GAEjC,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACL,wBAAwB,GAEzB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,+BAA+B,GAGhC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,uBAAuB,EACvB,6BAA6B,GAM9B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,8BAA8B,GAK/B,MAAM,wCAAwC,CAAC;AAChD,OAAO,EACL,qCAAqC,GAEtC,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,qCAAqC,GAEtC,MAAM,gDAAgD,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { type AttachmentDraft, type CreateAttachmentInput } from '../../core/attachment.js';
8
+ import type { AttachmentService } from '../../core/attachment_service.js';
9
+ import type { AttachmentPersistenceOptions } from '../../core/attachment_options.js';
10
+ import type { AttachmentOwner } from './attachment_owner.js';
11
+ import { AttachmentModel } from './attachment_model.js';
12
+ import { LucidAttachmentStore } from './lucid_attachment_store.js';
13
+ export type AttachmentFileService = Pick<AttachmentService, 'create' | 'remove'> & Partial<Pick<AttachmentService, 'createDraft'>>;
14
+ export type LucidAttachmentPersistence = Pick<LucidAttachmentStore, 'createOriginal' | 'findOriginal' | 'listVariants' | 'releaseOwner' | 'restoreOwner' | 'remove'> & Partial<Pick<LucidAttachmentStore, 'createCollectionItem' | 'findCollectionItem' | 'listCollection' | 'moveCollectionItem' | 'removeCollectionItem'>>;
15
+ export declare class LucidAttachmentLifecycleService {
16
+ #private;
17
+ constructor(attachments: AttachmentFileService, store: LucidAttachmentPersistence);
18
+ get(owner: AttachmentOwner): Promise<AttachmentModel | null>;
19
+ attach(owner: AttachmentOwner, input: CreateAttachmentInput | AttachmentDraft, options?: AttachmentPersistenceOptions<any>): Promise<AttachmentModel>;
20
+ replace(owner: AttachmentOwner, input: CreateAttachmentInput | AttachmentDraft, options?: AttachmentPersistenceOptions<any>): Promise<AttachmentModel>;
21
+ detach(owner: AttachmentOwner): Promise<void>;
22
+ listVariants(owner: AttachmentOwner): Promise<AttachmentModel[]>;
23
+ add(owner: AttachmentOwner, input: CreateAttachmentInput | AttachmentDraft, position?: number, options?: AttachmentPersistenceOptions<any>): Promise<AttachmentModel>;
24
+ listCollection(owner: AttachmentOwner): Promise<AttachmentModel[]>;
25
+ removeCollectionItem(owner: AttachmentOwner, id: string): Promise<boolean>;
26
+ clearCollection(owner: AttachmentOwner): Promise<void>;
27
+ replaceCollection(owner: AttachmentOwner, inputs: readonly (CreateAttachmentInput | AttachmentDraft)[], options?: AttachmentPersistenceOptions<any>): Promise<AttachmentModel[]>;
28
+ moveCollectionItem(owner: AttachmentOwner, id: string, position: number): Promise<AttachmentModel[]>;
29
+ }
30
+ //# sourceMappingURL=lucid_attachment_lifecycle_service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_lifecycle_service.d.ts","sourceRoot":"","sources":["../../../../src/integrations/lucid/lucid_attachment_lifecycle_service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC3B,MAAM,0BAA0B,CAAA;AACjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAA;AACzE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAA;AACpF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAA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AAO,CAAC,eAAe,CAAC;IAa3B,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAI5D,oBAAoB,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAW1E,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAMtD,iBAAiB,CACrB,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,SAAS,CAAC,qBAAqB,GAAG,eAAe,CAAC,EAAE,EAC5D,OAAO,CAAC,EAAE,4BAA4B,CAAC,GAAG,CAAC,GAC1C,OAAO,CAAC,eAAe,EAAE,CAAC;IAoB7B,kBAAkB,CAAC,KAAK,EAAE,eAAe,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;CAoGrG"}
@@ -0,0 +1,188 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { isAttachmentDraft, } from '../../core/attachment.js';
8
+ export class LucidAttachmentLifecycleService {
9
+ #attachments;
10
+ #store;
11
+ constructor(attachments, store) {
12
+ this.#attachments = attachments;
13
+ this.#store = store;
14
+ }
15
+ get(owner) {
16
+ return this.#store.findOriginal(owner);
17
+ }
18
+ async attach(owner, input, options) {
19
+ const attachment = await this.#persist(owner, input, options);
20
+ try {
21
+ const original = await this.#store.createOriginal(owner, attachment);
22
+ this.#removeOnRollback(owner, [attachment]);
23
+ return original;
24
+ }
25
+ catch (error) {
26
+ await this.#removeStoredFile(attachment);
27
+ throw error;
28
+ }
29
+ }
30
+ async replace(owner, input, options) {
31
+ const previous = await this.#store.findOriginal(owner);
32
+ if (!previous) {
33
+ return this.attach(owner, input, options);
34
+ }
35
+ const previousVariants = await this.#store.listVariants(previous.id);
36
+ const attachment = await this.#persist(owner, input, options);
37
+ let current;
38
+ try {
39
+ await this.#store.releaseOwner(previous);
40
+ current = await this.#store.createOriginal(owner, attachment);
41
+ }
42
+ catch (error) {
43
+ await this.#store.restoreOwner(previous).catch(() => undefined);
44
+ await this.#removeStoredFile(attachment);
45
+ throw error;
46
+ }
47
+ try {
48
+ await this.#store.remove(previous);
49
+ }
50
+ catch (error) {
51
+ await this.#store.remove(current).catch(() => undefined);
52
+ await this.#store.restoreOwner(previous).catch(() => undefined);
53
+ await this.#removeStoredFile(current.toAttachment());
54
+ throw error;
55
+ }
56
+ await this.#removeOnCommit(owner, [
57
+ previous.toAttachment(),
58
+ ...previousVariants.map((variant) => variant.toAttachment()),
59
+ ]);
60
+ this.#removeOnRollback(owner, [current.toAttachment()]);
61
+ return current;
62
+ }
63
+ async detach(owner) {
64
+ const original = await this.#store.findOriginal(owner);
65
+ if (!original) {
66
+ return;
67
+ }
68
+ const variants = await this.#store.listVariants(original.id);
69
+ await this.#store.remove(original);
70
+ await this.#removeOnCommit(owner, [
71
+ original.toAttachment(),
72
+ ...variants.map((variant) => variant.toAttachment()),
73
+ ]);
74
+ }
75
+ async listVariants(owner) {
76
+ const original = await this.#store.findOriginal(owner);
77
+ return original ? this.#store.listVariants(original.id) : [];
78
+ }
79
+ async add(owner, input, position, options) {
80
+ const attachment = await this.#persist(owner, input, options);
81
+ try {
82
+ const item = await this.#collectionStore().createCollectionItem(owner, attachment, position);
83
+ this.#removeOnRollback(owner, [attachment]);
84
+ return item;
85
+ }
86
+ catch (error) {
87
+ await this.#removeStoredFile(attachment);
88
+ throw error;
89
+ }
90
+ }
91
+ listCollection(owner) {
92
+ return this.#collectionStore().listCollection(owner);
93
+ }
94
+ async removeCollectionItem(owner, id) {
95
+ const item = await this.#collectionStore().findCollectionItem(owner, id);
96
+ if (!item) {
97
+ return false;
98
+ }
99
+ await this.#detachCollectionItem(owner, item);
100
+ return true;
101
+ }
102
+ async clearCollection(owner) {
103
+ for (const item of await this.#collectionStore().listCollection(owner)) {
104
+ await this.#detachCollectionItem(owner, item);
105
+ }
106
+ }
107
+ async replaceCollection(owner, inputs, options) {
108
+ const previous = await this.#collectionStore().listCollection(owner);
109
+ const created = [];
110
+ try {
111
+ for (const input of inputs) {
112
+ created.push(await this.add(owner, input, undefined, options));
113
+ }
114
+ }
115
+ catch (error) {
116
+ await Promise.all(created.map((item) => this.#detachCollectionItem(owner, item)));
117
+ throw error;
118
+ }
119
+ for (const item of previous) {
120
+ await this.#detachCollectionItem(owner, item);
121
+ }
122
+ return this.#collectionStore().listCollection(owner);
123
+ }
124
+ moveCollectionItem(owner, id, position) {
125
+ return this.#collectionStore().moveCollectionItem(owner, id, position);
126
+ }
127
+ async #removeStoredFile(attachment) {
128
+ await this.#attachments.remove(attachment);
129
+ }
130
+ async #removeOnCommit(owner, attachments) {
131
+ const transaction = getOwnerTransaction(owner);
132
+ if (transaction) {
133
+ transaction.after('commit', () => this.#removeStoredFiles(attachments));
134
+ return;
135
+ }
136
+ await this.#removeStoredFiles(attachments);
137
+ }
138
+ #removeOnRollback(owner, attachments) {
139
+ const transaction = getOwnerTransaction(owner);
140
+ if (transaction) {
141
+ transaction.after('rollback', () => this.#removeStoredFiles(attachments));
142
+ }
143
+ }
144
+ #removeStoredFiles(attachments) {
145
+ return Promise.all(attachments.map((attachment) => this.#removeStoredFile(attachment))).then(() => undefined);
146
+ }
147
+ async #detachCollectionItem(owner, item) {
148
+ const variants = await this.#store.listVariants(item.id);
149
+ await this.#collectionStore().removeCollectionItem(owner, item);
150
+ await this.#removeOnCommit(owner, [
151
+ item.toAttachment(),
152
+ ...variants.map((variant) => variant.toAttachment()),
153
+ ]);
154
+ }
155
+ #collectionStore() {
156
+ const store = this.#store;
157
+ if (!store.createCollectionItem ||
158
+ !store.findCollectionItem ||
159
+ !store.listCollection ||
160
+ !store.moveCollectionItem ||
161
+ !store.removeCollectionItem) {
162
+ throw new Error('Lucid attachment collection operations require a collection-capable store');
163
+ }
164
+ return store;
165
+ }
166
+ async #persist(owner, input, options) {
167
+ if (isAttachmentDraft(input)) {
168
+ return input.persist({
169
+ ...(options ? { options } : {}),
170
+ context: { model: owner.model, field: owner.field },
171
+ });
172
+ }
173
+ if (this.#attachments.createDraft) {
174
+ return this.#attachments
175
+ .createDraft(input)
176
+ .persist({
177
+ ...(options ? { options } : {}),
178
+ context: { model: owner.model, field: owner.field },
179
+ });
180
+ }
181
+ return this.#attachments.create(input);
182
+ }
183
+ }
184
+ function getOwnerTransaction(owner) {
185
+ const model = owner.model;
186
+ return model?.$trx ?? null;
187
+ }
188
+ //# sourceMappingURL=lucid_attachment_lifecycle_service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_lifecycle_service.js","sourceRoot":"","sources":["../../../../src/integrations/lucid/lucid_attachment_lifecycle_service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,iBAAiB,GAIlB,MAAM,0BAA0B,CAAA;AAwBjC,MAAM,OAAO,+BAA+B;IACjC,YAAY,CAAuB;IACnC,MAAM,CAA4B;IAE3C,YAAY,WAAkC,EAAE,KAAiC;QAC/E,IAAI,CAAC,YAAY,GAAG,WAAW,CAAA;QAC/B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,CAAC;IAED,GAAG,CAAC,KAAsB;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAA;IACxC,CAAC;IAED,KAAK,CAAC,MAAM,CACV,KAAsB,EACtB,KAA8C,EAC9C,OAA2C;QAE3C,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;QAE7D,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,CAAA;YACpE,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC,UAAU,CA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,KAAK,EAAE;aACpD,CAAC,CAAA;QACN,CAAC;QAED,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACxC,CAAC;CACF;AAED,SAAS,mBAAmB,CAAC,KAAsB;IAGjD,MAAM,KAAK,GAAG,KAAK,CAAC,KAMP,CAAA;IAEb,OAAO,KAAK,EAAE,IAAI,IAAI,IAAI,CAAA;AAC5B,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import type { Attachment } from '../../core/attachment.js';
8
+ import type { AttachmentRepository } from '../../core/attachment_repository.js';
9
+ import { AttachmentModel } from './attachment_model.js';
10
+ /**
11
+ * Attachment repository used by workers when attachments are persisted by Lucid.
12
+ */
13
+ export declare class LucidAttachmentRepository implements AttachmentRepository {
14
+ #private;
15
+ constructor(model?: typeof AttachmentModel);
16
+ findById(id: string): Promise<Attachment | null>;
17
+ }
18
+ //# sourceMappingURL=lucid_attachment_repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_repository.d.ts","sourceRoot":"","sources":["../../../../src/integrations/lucid/lucid_attachment_repository.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAA;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD;;GAEG;AACH,qBAAa,yBAA0B,YAAW,oBAAoB;;gBAGxD,KAAK,GAAE,OAAO,eAAiC;IAIrD,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC;CAKvD"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { AttachmentModel } from './attachment_model.js';
8
+ /**
9
+ * Attachment repository used by workers when attachments are persisted by Lucid.
10
+ */
11
+ export class LucidAttachmentRepository {
12
+ #model;
13
+ constructor(model = AttachmentModel) {
14
+ this.#model = model;
15
+ }
16
+ async findById(id) {
17
+ const row = await this.#model.find(id);
18
+ return row?.toAttachment() ?? null;
19
+ }
20
+ }
21
+ //# sourceMappingURL=lucid_attachment_repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_repository.js","sourceRoot":"","sources":["../../../../src/integrations/lucid/lucid_attachment_repository.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD;;GAEG;AACH,MAAM,OAAO,yBAAyB;IAC3B,MAAM,CAAwB;IAEvC,YAAY,QAAgC,eAAe;QACzD,IAAI,CAAC,MAAM,GAAG,KAAK,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,EAAU;QACvB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAEtC,OAAO,GAAG,EAAE,YAAY,EAAE,IAAI,IAAI,CAAA;IACpC,CAAC;CACF"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import type { Attachment } from '../../core/attachment.js';
8
+ import type { TransactionClientContract } from '@adonisjs/lucid/types/database';
9
+ import { type AttachmentOwner } from './attachment_owner.js';
10
+ import { AttachmentModel } from './attachment_model.js';
11
+ export type LucidAttachmentWithVariants = {
12
+ original: AttachmentModel;
13
+ variants: AttachmentModel[];
14
+ };
15
+ export type LucidAttachmentStoreOptions = {
16
+ client?: TransactionClientContract;
17
+ };
18
+ export declare class LucidAttachmentStore {
19
+ #private;
20
+ constructor(model?: typeof AttachmentModel, options?: LucidAttachmentStoreOptions);
21
+ createOriginal(owner: AttachmentOwner, attachment: Attachment): Promise<AttachmentModel>;
22
+ createCollectionItem(owner: AttachmentOwner, attachment: Attachment, position?: number): Promise<AttachmentModel>;
23
+ createVariant(original: AttachmentModel, key: string, attachment: Attachment): Promise<AttachmentModel>;
24
+ releaseOwner(original: AttachmentModel): Promise<void>;
25
+ restoreOwner(original: AttachmentModel): Promise<void>;
26
+ findOriginal(owner: AttachmentOwner): Promise<AttachmentModel | null>;
27
+ listCollection(owner: AttachmentOwner): Promise<AttachmentModel[]>;
28
+ findCollectionItem(owner: AttachmentOwner, id: string): Promise<AttachmentModel | null>;
29
+ removeCollectionItem(owner: AttachmentOwner, item: AttachmentModel): Promise<void>;
30
+ moveCollectionItem(owner: AttachmentOwner, id: string, position: number): Promise<AttachmentModel[]>;
31
+ findById(id: string): Promise<AttachmentModel | null>;
32
+ findByOwner(owner: AttachmentOwner): Promise<LucidAttachmentWithVariants | null>;
33
+ listVariants(originalId: string): Promise<AttachmentModel[]>;
34
+ remove(original: AttachmentModel): Promise<void>;
35
+ }
36
+ //# sourceMappingURL=lucid_attachment_store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_store.d.ts","sourceRoot":"","sources":["../../../../src/integrations/lucid/lucid_attachment_store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAE/E,OAAO,EAA4B,KAAK,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,EAAE,eAAe,CAAA;IACzB,QAAQ,EAAE,eAAe,EAAE,CAAA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K,EAAE,eAAe,GAAG,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC;IAatF,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAItD,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;CAwCvD"}
@@ -0,0 +1,179 @@
1
+ /**
2
+ * @jrmc/adonis-attachment
3
+ *
4
+ * @license MIT
5
+ * @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
6
+ */
7
+ import { markAttachmentPersisted } from '../../core/attachment_state.js';
8
+ import { createAttachmentOwnerKey } from './attachment_owner.js';
9
+ import { AttachmentModel } from './attachment_model.js';
10
+ export class LucidAttachmentStore {
11
+ #model;
12
+ #client;
13
+ constructor(model = AttachmentModel, options = {}) {
14
+ this.#model = model;
15
+ this.#client = options.client;
16
+ }
17
+ async createOriginal(owner, attachment) {
18
+ const row = await this.#model.create({
19
+ ...attachment,
20
+ attachableType: owner.type,
21
+ attachableId: owner.id,
22
+ field: owner.field,
23
+ ownerKey: createAttachmentOwnerKey(owner),
24
+ position: null,
25
+ parentId: null,
26
+ variantKey: null,
27
+ metadata: attachment.metadata ?? null,
28
+ }, this.#client ? { client: this.#client } : undefined);
29
+ markAttachmentPersisted(attachment);
30
+ return row;
31
+ }
32
+ async createCollectionItem(owner, attachment, position) {
33
+ const items = await this.listCollection(owner);
34
+ const target = normalizePosition(position, items.length);
35
+ await this.#shiftCollection(items, target, 1);
36
+ const row = await this.#model.create({
37
+ ...attachment,
38
+ attachableType: owner.type,
39
+ attachableId: owner.id,
40
+ field: owner.field,
41
+ ownerKey: null,
42
+ position: target,
43
+ parentId: null,
44
+ variantKey: null,
45
+ metadata: attachment.metadata ?? null,
46
+ }, this.#client ? { client: this.#client } : undefined);
47
+ markAttachmentPersisted(attachment);
48
+ return row;
49
+ }
50
+ async createVariant(original, key, attachment) {
51
+ const row = await this.#model.create({
52
+ ...attachment,
53
+ attachableType: original.attachableType,
54
+ attachableId: original.attachableId,
55
+ field: original.field,
56
+ ownerKey: null,
57
+ position: null,
58
+ parentId: original.id,
59
+ variantKey: key,
60
+ metadata: attachment.metadata ?? null,
61
+ }, this.#client ? { client: this.#client } : undefined);
62
+ markAttachmentPersisted(attachment);
63
+ return row;
64
+ }
65
+ async releaseOwner(original) {
66
+ original.ownerKey = null;
67
+ await original.save();
68
+ }
69
+ async restoreOwner(original) {
70
+ original.ownerKey = createAttachmentOwnerKey({
71
+ type: original.attachableType,
72
+ id: original.attachableId,
73
+ field: original.field,
74
+ });
75
+ await original.save();
76
+ }
77
+ findOriginal(owner) {
78
+ return this.#query()
79
+ .where('attachable_type', owner.type)
80
+ .where('attachable_id', owner.id)
81
+ .where('field', owner.field)
82
+ .whereNotNull('owner_key')
83
+ .whereNull('parent_id')
84
+ .first();
85
+ }
86
+ listCollection(owner) {
87
+ return this.#query()
88
+ .where('attachable_type', owner.type)
89
+ .where('attachable_id', owner.id)
90
+ .where('field', owner.field)
91
+ .whereNull('owner_key')
92
+ .whereNull('parent_id')
93
+ .orderBy('position', 'asc');
94
+ }
95
+ findCollectionItem(owner, id) {
96
+ return this.#query()
97
+ .where('id', id)
98
+ .where('attachable_type', owner.type)
99
+ .where('attachable_id', owner.id)
100
+ .where('field', owner.field)
101
+ .whereNull('owner_key')
102
+ .whereNull('parent_id')
103
+ .first();
104
+ }
105
+ async removeCollectionItem(owner, item) {
106
+ await this.remove(item);
107
+ await this.#normalizeCollection(owner);
108
+ }
109
+ async moveCollectionItem(owner, id, position) {
110
+ const items = await this.listCollection(owner);
111
+ const source = items.findIndex((item) => item.id === id);
112
+ if (source === -1) {
113
+ throw new Error(`Attachment "${id}" does not belong to this collection`);
114
+ }
115
+ const target = normalizePosition(position, items.length - 1);
116
+ if (source === target) {
117
+ return items;
118
+ }
119
+ const [item] = items.splice(source, 1);
120
+ items.splice(target, 0, item);
121
+ await this.#reorderCollection(items);
122
+ return items;
123
+ }
124
+ findById(id) {
125
+ return this.#query().where('id', id).first();
126
+ }
127
+ async findByOwner(owner) {
128
+ const original = await this.findOriginal(owner);
129
+ if (!original) {
130
+ return null;
131
+ }
132
+ return {
133
+ original,
134
+ variants: await this.listVariants(original.id),
135
+ };
136
+ }
137
+ listVariants(originalId) {
138
+ return this.#query().where('parent_id', originalId);
139
+ }
140
+ async remove(original) {
141
+ await original.delete();
142
+ }
143
+ async #normalizeCollection(owner) {
144
+ await this.#reorderCollection(await this.listCollection(owner));
145
+ }
146
+ #query() {
147
+ return this.#model.query(this.#client ? { client: this.#client } : undefined);
148
+ }
149
+ async #shiftCollection(items, from, amount) {
150
+ for (const item of [...items].reverse()) {
151
+ if ((item.position ?? 0) < from) {
152
+ continue;
153
+ }
154
+ item.position = (item.position ?? 0) + amount;
155
+ await item.save();
156
+ }
157
+ }
158
+ async #reorderCollection(items) {
159
+ const offset = items.length + 1;
160
+ for (const item of items) {
161
+ item.position = (item.position ?? 0) + offset;
162
+ await item.save();
163
+ }
164
+ for (const [position, item] of items.entries()) {
165
+ item.position = position;
166
+ await item.save();
167
+ }
168
+ }
169
+ }
170
+ function normalizePosition(position, maximum) {
171
+ if (position === undefined) {
172
+ return maximum;
173
+ }
174
+ if (!Number.isSafeInteger(position) || position < 0) {
175
+ throw new Error('Attachment collection positions must be non-negative integers');
176
+ }
177
+ return Math.min(position, maximum);
178
+ }
179
+ //# sourceMappingURL=lucid_attachment_store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lucid_attachment_store.js","sourceRoot":"","sources":["../../../../src/integrations/lucid/lucid_attachment_store.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAA;AACxE,OAAO,EAAE,wBAAwB,EAAwB,MAAM,uBAAuB,CAAA;AACtF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAWvD,MAAM,OAAO,oBAAoB;IACtB,MAAM,CAAwB;IAC9B,OAAO,CAAuC;IA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