@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.
- package/README.md +10 -81
- package/build/bin/test.d.ts +2 -0
- package/build/bin/test.d.ts.map +1 -0
- package/build/bin/test.js +9 -0
- package/build/bin/test.js.map +1 -0
- package/build/commands/commands.json +1 -1
- package/build/commands/make/attachment_v5_migration.d.ts +17 -0
- package/build/commands/make/attachment_v5_migration.d.ts.map +1 -0
- package/build/commands/make/attachment_v5_migration.js +26 -0
- package/build/commands/make/attachment_v5_migration.js.map +1 -0
- package/build/commands/make/{converter.d.ts → attachments_table.d.ts} +6 -4
- package/build/commands/make/attachments_table.d.ts.map +1 -0
- package/build/commands/make/attachments_table.js +30 -0
- package/build/commands/make/attachments_table.js.map +1 -0
- package/build/configure.d.ts.map +1 -1
- package/build/configure.js +2 -1
- package/build/configure.js.map +1 -0
- package/build/index.d.ts +26 -10
- package/build/index.d.ts.map +1 -1
- package/build/index.js +16 -9
- package/build/index.js.map +1 -0
- package/build/providers/attachment_provider.d.ts +0 -19
- package/build/providers/attachment_provider.d.ts.map +1 -1
- package/build/providers/attachment_provider.js +30 -26
- package/build/providers/attachment_provider.js.map +1 -0
- package/build/services/main.d.ts +3 -3
- package/build/services/main.d.ts.map +1 -1
- package/build/services/main.js +42 -5
- package/build/services/main.js.map +1 -0
- package/build/src/adapters/adonis_drive_storage.d.ts +33 -0
- package/build/src/adapters/adonis_drive_storage.d.ts.map +1 -0
- package/build/src/adapters/adonis_drive_storage.js +35 -0
- package/build/src/adapters/adonis_drive_storage.js.map +1 -0
- package/build/src/adapters/local_file_storage.d.ts +25 -0
- package/build/src/adapters/local_file_storage.d.ts.map +1 -0
- package/build/src/adapters/local_file_storage.js +54 -0
- package/build/src/adapters/local_file_storage.js.map +1 -0
- package/build/src/controllers/attachments_controller.d.ts +13 -2
- package/build/src/controllers/attachments_controller.d.ts.map +1 -1
- package/build/src/controllers/attachments_controller.js +20 -107
- package/build/src/controllers/attachments_controller.js.map +1 -0
- package/build/src/core/attachment.d.ts +70 -0
- package/build/src/core/attachment.d.ts.map +1 -0
- package/build/src/core/attachment.js +150 -0
- package/build/src/core/attachment.js.map +1 -0
- package/build/src/core/attachment_job_processor.d.ts +30 -0
- package/build/src/core/attachment_job_processor.d.ts.map +1 -0
- package/build/src/core/attachment_job_processor.js +47 -0
- package/build/src/core/attachment_job_processor.js.map +1 -0
- package/build/src/core/attachment_options.d.ts +32 -0
- package/build/src/core/attachment_options.d.ts.map +1 -0
- package/build/src/core/attachment_options.js +24 -0
- package/build/src/core/attachment_options.js.map +1 -0
- package/build/src/core/attachment_repository.d.ts +15 -0
- package/build/src/core/attachment_repository.d.ts.map +1 -0
- package/build/src/core/attachment_repository.js +8 -0
- package/build/src/core/attachment_repository.js.map +1 -0
- package/build/src/core/attachment_service.d.ts +34 -0
- package/build/src/core/attachment_service.d.ts.map +1 -0
- package/build/src/core/attachment_service.js +93 -0
- package/build/src/core/attachment_service.js.map +1 -0
- package/build/src/core/attachment_state.d.ts +11 -0
- package/build/src/core/attachment_state.d.ts.map +1 -0
- package/build/src/core/attachment_state.js +17 -0
- package/build/src/core/attachment_state.js.map +1 -0
- package/build/src/core/index.d.ts +14 -0
- package/build/src/core/index.d.ts.map +1 -0
- package/build/src/core/index.js +11 -0
- package/build/src/core/index.js.map +1 -0
- package/build/src/core/queue.d.ts +20 -0
- package/build/src/core/queue.d.ts.map +1 -0
- package/build/src/{types/event.js → core/queue.js} +1 -0
- package/build/src/core/queue.js.map +1 -0
- package/build/src/core/storage.d.ts +23 -0
- package/build/src/core/storage.d.ts.map +1 -0
- package/build/src/{types/config.js → core/storage.js} +1 -0
- package/build/src/core/storage.js.map +1 -0
- package/build/src/define_config.d.ts +39 -20
- package/build/src/define_config.d.ts.map +1 -1
- package/build/src/define_config.js +46 -24
- package/build/src/define_config.js.map +1 -0
- package/build/src/integrations/lucid/attachment_column.d.ts +18 -0
- package/build/src/integrations/lucid/attachment_column.d.ts.map +1 -0
- package/build/src/integrations/lucid/attachment_column.js +151 -0
- package/build/src/integrations/lucid/attachment_column.js.map +1 -0
- package/build/src/integrations/lucid/attachment_model.d.ts +37 -0
- package/build/src/integrations/lucid/attachment_model.d.ts.map +1 -0
- package/build/src/integrations/lucid/attachment_model.js +99 -0
- package/build/src/integrations/lucid/attachment_model.js.map +1 -0
- package/build/src/integrations/lucid/attachment_owner.d.ts +18 -0
- package/build/src/integrations/lucid/attachment_owner.d.ts.map +1 -0
- package/build/src/integrations/lucid/attachment_owner.js +15 -0
- package/build/src/integrations/lucid/attachment_owner.js.map +1 -0
- package/build/src/integrations/lucid/attachment_relation.d.ts +60 -0
- package/build/src/integrations/lucid/attachment_relation.d.ts.map +1 -0
- package/build/src/integrations/lucid/attachment_relation.js +163 -0
- package/build/src/integrations/lucid/attachment_relation.js.map +1 -0
- package/build/src/integrations/lucid/attachments_table_stub.d.ts +21 -0
- package/build/src/integrations/lucid/attachments_table_stub.d.ts.map +1 -0
- package/build/src/integrations/lucid/attachments_table_stub.js +26 -0
- package/build/src/integrations/lucid/attachments_table_stub.js.map +1 -0
- package/build/src/integrations/lucid/create_legacy_attachment_migration_script.d.ts +13 -0
- package/build/src/integrations/lucid/create_legacy_attachment_migration_script.d.ts.map +1 -0
- package/build/src/integrations/lucid/create_legacy_attachment_migration_script.js +20 -0
- package/build/src/integrations/lucid/create_legacy_attachment_migration_script.js.map +1 -0
- package/build/src/integrations/lucid/index.d.ts +20 -0
- package/build/src/integrations/lucid/index.d.ts.map +1 -0
- package/build/src/integrations/lucid/index.js +20 -0
- package/build/src/integrations/lucid/index.js.map +1 -0
- package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.d.ts +30 -0
- package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.d.ts.map +1 -0
- package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.js +188 -0
- package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.js.map +1 -0
- package/build/src/integrations/lucid/lucid_attachment_repository.d.ts +18 -0
- package/build/src/integrations/lucid/lucid_attachment_repository.d.ts.map +1 -0
- package/build/src/integrations/lucid/lucid_attachment_repository.js +21 -0
- package/build/src/integrations/lucid/lucid_attachment_repository.js.map +1 -0
- package/build/src/integrations/lucid/lucid_attachment_store.d.ts +36 -0
- package/build/src/integrations/lucid/lucid_attachment_store.d.ts.map +1 -0
- package/build/src/integrations/lucid/lucid_attachment_store.js +179 -0
- package/build/src/integrations/lucid/lucid_attachment_store.js.map +1 -0
- package/build/src/integrations/lucid/lucid_variant_generation_service.d.ts +24 -0
- package/build/src/integrations/lucid/lucid_variant_generation_service.d.ts.map +1 -0
- package/build/src/integrations/lucid/lucid_variant_generation_service.js +42 -0
- package/build/src/integrations/lucid/lucid_variant_generation_service.js.map +1 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment.d.ts +64 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment.d.ts.map +1 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment.js +89 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment.js.map +1 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment_records.d.ts +34 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment_records.d.ts.map +1 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment_records.js +47 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment_records.js.map +1 -0
- package/build/src/integrations/lucid/render_legacy_attachment_migration_script.d.ts +11 -0
- package/build/src/integrations/lucid/render_legacy_attachment_migration_script.d.ts.map +1 -0
- package/build/src/integrations/lucid/render_legacy_attachment_migration_script.js +41 -0
- package/build/src/integrations/lucid/render_legacy_attachment_migration_script.js.map +1 -0
- package/build/src/queues/adonis_queue.d.ts +27 -0
- package/build/src/queues/adonis_queue.d.ts.map +1 -0
- package/build/src/queues/adonis_queue.js +22 -0
- package/build/src/queues/adonis_queue.js.map +1 -0
- package/build/src/queues/memory_queue.d.ts +22 -0
- package/build/src/queues/memory_queue.d.ts.map +1 -0
- package/build/src/queues/memory_queue.js +67 -0
- package/build/src/queues/memory_queue.js.map +1 -0
- package/build/src/sources/attachment_manager.d.ts +53 -0
- package/build/src/sources/attachment_manager.d.ts.map +1 -0
- package/build/src/sources/attachment_manager.js +177 -0
- package/build/src/sources/attachment_manager.js.map +1 -0
- package/build/src/variants/variant_converter.d.ts +23 -0
- package/build/src/variants/variant_converter.d.ts.map +1 -0
- package/build/src/{types/converter.js → variants/variant_converter.js} +1 -0
- package/build/src/variants/variant_converter.js.map +1 -0
- package/build/src/variants/variant_generation_service.d.ts +28 -0
- package/build/src/variants/variant_generation_service.d.ts.map +1 -0
- package/build/src/variants/variant_generation_service.js +44 -0
- package/build/src/variants/variant_generation_service.js.map +1 -0
- package/build/stubs/config/attachment.stub +12 -0
- package/build/stubs/main.d.ts.map +1 -1
- package/build/stubs/main.js +1 -0
- package/build/stubs/main.js.map +1 -0
- package/build/stubs/migrations/attachments_table.stub +39 -0
- package/build/tests/adonis_drive_storage.spec.d.ts +8 -0
- package/build/tests/adonis_drive_storage.spec.d.ts.map +1 -0
- package/build/tests/adonis_drive_storage.spec.js +69 -0
- package/build/tests/adonis_drive_storage.spec.js.map +1 -0
- package/build/{src/types/attachment.js → tests/adonis_queue.spec.d.ts} +1 -0
- package/build/tests/adonis_queue.spec.d.ts.map +1 -0
- package/build/tests/adonis_queue.spec.js +52 -0
- package/build/tests/adonis_queue.spec.js.map +1 -0
- package/build/tests/attachment_job_processor.spec.d.ts +8 -0
- package/build/tests/attachment_job_processor.spec.d.ts.map +1 -0
- package/build/tests/attachment_job_processor.spec.js +89 -0
- package/build/tests/attachment_job_processor.spec.js.map +1 -0
- package/build/tests/attachment_manager.spec.d.ts +8 -0
- package/build/tests/attachment_manager.spec.d.ts.map +1 -0
- package/build/tests/attachment_manager.spec.js +131 -0
- package/build/tests/attachment_manager.spec.js.map +1 -0
- package/build/tests/attachment_manager_service.spec.d.ts +8 -0
- package/build/tests/attachment_manager_service.spec.d.ts.map +1 -0
- package/build/tests/attachment_manager_service.spec.js +47 -0
- package/build/tests/attachment_manager_service.spec.js.map +1 -0
- package/build/tests/attachment_options.spec.d.ts +2 -0
- package/build/tests/attachment_options.spec.d.ts.map +1 -0
- package/build/tests/attachment_options.spec.js +31 -0
- package/build/tests/attachment_options.spec.js.map +1 -0
- package/build/tests/attachment_provider.spec.d.ts +8 -0
- package/build/tests/attachment_provider.spec.d.ts.map +1 -0
- package/build/tests/attachment_provider.spec.js +71 -0
- package/build/tests/attachment_provider.spec.js.map +1 -0
- package/build/tests/attachment_service.spec.d.ts +8 -0
- package/build/tests/attachment_service.spec.d.ts.map +1 -0
- package/build/tests/attachment_service.spec.js +146 -0
- package/build/tests/attachment_service.spec.js.map +1 -0
- package/build/tests/attachments_controller.spec.d.ts +8 -0
- package/build/tests/attachments_controller.spec.d.ts.map +1 -0
- package/build/tests/attachments_controller.spec.js +34 -0
- package/build/tests/attachments_controller.spec.js.map +1 -0
- package/build/tests/attachments_table_stub.spec.d.ts +2 -0
- package/build/tests/attachments_table_stub.spec.d.ts.map +1 -0
- package/build/tests/attachments_table_stub.spec.js +66 -0
- package/build/tests/attachments_table_stub.spec.js.map +1 -0
- package/build/tests/configure.spec.d.ts +2 -0
- package/build/tests/configure.spec.d.ts.map +1 -0
- package/build/tests/configure.spec.js +38 -0
- package/build/tests/configure.spec.js.map +1 -0
- package/build/tests/container_bindings.types.d.ts +8 -0
- package/build/tests/container_bindings.types.d.ts.map +1 -0
- package/build/tests/container_bindings.types.js +9 -0
- package/build/tests/container_bindings.types.js.map +1 -0
- package/build/tests/create_legacy_attachment_migration_script.spec.d.ts +8 -0
- package/build/tests/create_legacy_attachment_migration_script.spec.d.ts.map +1 -0
- package/build/tests/create_legacy_attachment_migration_script.spec.js +31 -0
- package/build/tests/create_legacy_attachment_migration_script.spec.js.map +1 -0
- package/build/tests/define_config.spec.d.ts +8 -0
- package/build/tests/define_config.spec.d.ts.map +1 -0
- package/build/tests/define_config.spec.js +203 -0
- package/build/tests/define_config.spec.js.map +1 -0
- package/build/tests/helpers/lucid_test_database.d.ts +9 -0
- package/build/tests/helpers/lucid_test_database.d.ts.map +1 -0
- package/build/tests/helpers/lucid_test_database.js +52 -0
- package/build/tests/helpers/lucid_test_database.js.map +1 -0
- package/build/tests/local_file_storage.spec.d.ts +8 -0
- package/build/tests/local_file_storage.spec.d.ts.map +1 -0
- package/build/tests/local_file_storage.spec.js +44 -0
- package/build/tests/local_file_storage.spec.js.map +1 -0
- package/build/tests/lucid_attachment_collection_store.spec.d.ts +2 -0
- package/build/tests/lucid_attachment_collection_store.spec.d.ts.map +1 -0
- package/build/tests/lucid_attachment_collection_store.spec.js +52 -0
- package/build/tests/lucid_attachment_collection_store.spec.js.map +1 -0
- package/build/tests/lucid_attachment_column.spec.d.ts +8 -0
- package/build/tests/lucid_attachment_column.spec.d.ts.map +1 -0
- package/build/tests/lucid_attachment_column.spec.js +193 -0
- package/build/tests/lucid_attachment_column.spec.js.map +1 -0
- package/build/tests/lucid_attachment_lifecycle_service.spec.d.ts +8 -0
- package/build/tests/lucid_attachment_lifecycle_service.spec.d.ts.map +1 -0
- package/build/tests/lucid_attachment_lifecycle_service.spec.js +378 -0
- package/build/tests/lucid_attachment_lifecycle_service.spec.js.map +1 -0
- package/build/tests/lucid_attachment_relation.spec.d.ts +8 -0
- package/build/tests/lucid_attachment_relation.spec.d.ts.map +1 -0
- package/build/tests/lucid_attachment_relation.spec.js +216 -0
- package/build/tests/lucid_attachment_relation.spec.js.map +1 -0
- package/build/tests/lucid_attachment_repository.spec.d.ts +8 -0
- package/build/tests/lucid_attachment_repository.spec.d.ts.map +1 -0
- package/build/tests/lucid_attachment_repository.spec.js +50 -0
- package/build/tests/lucid_attachment_repository.spec.js.map +1 -0
- package/build/tests/lucid_attachment_store.spec.d.ts +8 -0
- package/build/tests/lucid_attachment_store.spec.d.ts.map +1 -0
- package/build/tests/lucid_attachment_store.spec.js +73 -0
- package/build/tests/lucid_attachment_store.spec.js.map +1 -0
- package/build/tests/lucid_sqlite_integration.spec.d.ts +8 -0
- package/build/tests/lucid_sqlite_integration.spec.d.ts.map +1 -0
- package/build/tests/lucid_sqlite_integration.spec.js +103 -0
- package/build/tests/lucid_sqlite_integration.spec.js.map +1 -0
- package/build/tests/lucid_variant_generation_service.spec.d.ts +8 -0
- package/build/tests/lucid_variant_generation_service.spec.d.ts.map +1 -0
- package/build/tests/lucid_variant_generation_service.spec.js +56 -0
- package/build/tests/lucid_variant_generation_service.spec.js.map +1 -0
- package/build/tests/memory_queue.spec.d.ts +8 -0
- package/build/tests/memory_queue.spec.d.ts.map +1 -0
- package/build/tests/memory_queue.spec.js +52 -0
- package/build/tests/memory_queue.spec.js.map +1 -0
- package/build/tests/migrate_legacy_attachment.spec.d.ts +8 -0
- package/build/tests/migrate_legacy_attachment.spec.d.ts.map +1 -0
- package/build/tests/migrate_legacy_attachment.spec.js +133 -0
- package/build/tests/migrate_legacy_attachment.spec.js.map +1 -0
- package/build/tests/migrate_legacy_attachment_records.spec.d.ts +8 -0
- package/build/tests/migrate_legacy_attachment_records.spec.d.ts.map +1 -0
- package/build/tests/migrate_legacy_attachment_records.spec.js +66 -0
- package/build/tests/migrate_legacy_attachment_records.spec.js.map +1 -0
- package/build/tests/package_exports.spec.d.ts +8 -0
- package/build/tests/package_exports.spec.d.ts.map +1 -0
- package/build/tests/package_exports.spec.js +31 -0
- package/build/tests/package_exports.spec.js.map +1 -0
- package/build/tests/variant_generation_service.spec.d.ts +8 -0
- package/build/tests/variant_generation_service.spec.d.ts.map +1 -0
- package/build/tests/variant_generation_service.spec.js +79 -0
- package/build/tests/variant_generation_service.spec.js.map +1 -0
- package/package.json +82 -76
- package/build/commands/make/converter.d.ts.map +0 -1
- package/build/commands/make/converter.js +0 -28
- package/build/services/regenerate_service.d.ts +0 -9
- package/build/services/regenerate_service.d.ts.map +0 -1
- package/build/services/regenerate_service.js +0 -29
- package/build/src/adapters/blurhash.d.ts +0 -11
- package/build/src/adapters/blurhash.d.ts.map +0 -1
- package/build/src/adapters/blurhash.js +0 -12
- package/build/src/adapters/exif.d.ts +0 -15
- package/build/src/adapters/exif.d.ts.map +0 -1
- package/build/src/adapters/exif.js +0 -165
- package/build/src/adapters/ffmpeg.d.ts +0 -19
- package/build/src/adapters/ffmpeg.d.ts.map +0 -1
- package/build/src/adapters/ffmpeg.js +0 -115
- package/build/src/adapters/lock.d.ts +0 -9
- package/build/src/adapters/lock.d.ts.map +0 -1
- package/build/src/adapters/lock.js +0 -21
- package/build/src/adapters/meta.d.ts +0 -10
- package/build/src/adapters/meta.d.ts.map +0 -1
- package/build/src/adapters/meta.js +0 -49
- package/build/src/adapters/poppler.d.ts +0 -20
- package/build/src/adapters/poppler.d.ts.map +0 -1
- package/build/src/adapters/poppler.js +0 -117
- package/build/src/adapters/soffice.d.ts +0 -14
- package/build/src/adapters/soffice.d.ts.map +0 -1
- package/build/src/adapters/soffice.js +0 -64
- package/build/src/attachment_manager.d.ts +0 -50
- package/build/src/attachment_manager.d.ts.map +0 -1
- package/build/src/attachment_manager.js +0 -145
- package/build/src/attachments/attachment.d.ts +0 -42
- package/build/src/attachments/attachment.d.ts.map +0 -1
- package/build/src/attachments/attachment.js +0 -233
- package/build/src/attachments/attachment_base.d.ts +0 -59
- package/build/src/attachments/attachment_base.d.ts.map +0 -1
- package/build/src/attachments/attachment_base.js +0 -211
- package/build/src/attachments/variant_attachment.d.ts +0 -27
- package/build/src/attachments/variant_attachment.d.ts.map +0 -1
- package/build/src/attachments/variant_attachment.js +0 -40
- package/build/src/converters/autodetect_converter.d.ts +0 -13
- package/build/src/converters/autodetect_converter.d.ts.map +0 -1
- package/build/src/converters/autodetect_converter.js +0 -77
- package/build/src/converters/converter.d.ts +0 -14
- package/build/src/converters/converter.d.ts.map +0 -1
- package/build/src/converters/converter.js +0 -14
- package/build/src/converters/document_thumbnail_converter.d.ts +0 -14
- package/build/src/converters/document_thumbnail_converter.d.ts.map +0 -1
- package/build/src/converters/document_thumbnail_converter.js +0 -36
- package/build/src/converters/image_converter.d.ts +0 -13
- package/build/src/converters/image_converter.d.ts.map +0 -1
- package/build/src/converters/image_converter.js +0 -27
- package/build/src/converters/pdf_thumbnail_converter.d.ts +0 -14
- package/build/src/converters/pdf_thumbnail_converter.d.ts.map +0 -1
- package/build/src/converters/pdf_thumbnail_converter.js +0 -39
- package/build/src/converters/video_thumbnail_converter.d.ts +0 -14
- package/build/src/converters/video_thumbnail_converter.d.ts.map +0 -1
- package/build/src/converters/video_thumbnail_converter.js +0 -40
- package/build/src/decorators/attachment.d.ts +0 -15
- package/build/src/decorators/attachment.d.ts.map +0 -1
- package/build/src/decorators/attachment.js +0 -103
- package/build/src/errors.d.ts +0 -67
- package/build/src/errors.d.ts.map +0 -1
- package/build/src/errors.js +0 -68
- package/build/src/services/attachment/attachment_detachment_service.d.ts +0 -19
- package/build/src/services/attachment/attachment_detachment_service.d.ts.map +0 -1
- package/build/src/services/attachment/attachment_detachment_service.js +0 -66
- package/build/src/services/attachment/attachment_persister_service.d.ts +0 -22
- package/build/src/services/attachment/attachment_persister_service.d.ts.map +0 -1
- package/build/src/services/attachment/attachment_persister_service.js +0 -96
- package/build/src/services/attachment/attachment_recorder_service.d.ts +0 -68
- package/build/src/services/attachment/attachment_recorder_service.d.ts.map +0 -1
- package/build/src/services/attachment/attachment_recorder_service.js +0 -121
- package/build/src/services/attachment/attachment_transaction_service.d.ts +0 -26
- package/build/src/services/attachment/attachment_transaction_service.d.ts.map +0 -1
- package/build/src/services/attachment/attachment_transaction_service.js +0 -46
- package/build/src/services/attachment/attachment_utils.d.ts +0 -35
- package/build/src/services/attachment/attachment_utils.d.ts.map +0 -1
- package/build/src/services/attachment/attachment_utils.js +0 -71
- package/build/src/services/attachment/attachment_variant_service.d.ts +0 -17
- package/build/src/services/attachment/attachment_variant_service.d.ts.map +0 -1
- package/build/src/services/attachment/attachment_variant_service.js +0 -99
- package/build/src/services/attachment/index.d.ts +0 -15
- package/build/src/services/attachment/index.d.ts.map +0 -1
- package/build/src/services/attachment/index.js +0 -15
- package/build/src/services/attachment_service.d.ts +0 -8
- package/build/src/services/attachment_service.d.ts.map +0 -1
- package/build/src/services/attachment_service.js +0 -7
- package/build/src/services/variant/variant_generator_service.d.ts +0 -24
- package/build/src/services/variant/variant_generator_service.d.ts.map +0 -1
- package/build/src/services/variant/variant_generator_service.js +0 -101
- package/build/src/services/variant/variant_persister_service.d.ts +0 -24
- package/build/src/services/variant/variant_persister_service.d.ts.map +0 -1
- package/build/src/services/variant/variant_persister_service.js +0 -59
- package/build/src/services/variant/variant_purger_service.d.ts +0 -15
- package/build/src/services/variant/variant_purger_service.d.ts.map +0 -1
- package/build/src/services/variant/variant_purger_service.js +0 -47
- package/build/src/services/variant_service.d.ts +0 -13
- package/build/src/services/variant_service.d.ts.map +0 -1
- package/build/src/services/variant_service.js +0 -63
- package/build/src/types/attachment.d.ts +0 -100
- package/build/src/types/attachment.d.ts.map +0 -1
- package/build/src/types/config.d.ts +0 -58
- package/build/src/types/config.d.ts.map +0 -1
- package/build/src/types/converter.d.ts +0 -144
- package/build/src/types/converter.d.ts.map +0 -1
- package/build/src/types/drive.d.ts +0 -6
- package/build/src/types/drive.d.ts.map +0 -1
- package/build/src/types/drive.js +0 -1
- package/build/src/types/event.d.ts +0 -16
- package/build/src/types/event.d.ts.map +0 -1
- package/build/src/types/index.d.ts +0 -15
- package/build/src/types/index.d.ts.map +0 -1
- package/build/src/types/index.js +0 -14
- package/build/src/types/input.d.ts +0 -35
- package/build/src/types/input.d.ts.map +0 -1
- package/build/src/types/input.js +0 -7
- package/build/src/types/lock.d.ts +0 -14
- package/build/src/types/lock.d.ts.map +0 -1
- package/build/src/types/lock.js +0 -7
- package/build/src/types/metadata.d.ts +0 -24
- package/build/src/types/metadata.d.ts.map +0 -1
- package/build/src/types/metadata.js +0 -7
- package/build/src/types/mixin.d.ts +0 -17
- package/build/src/types/mixin.d.ts.map +0 -1
- package/build/src/types/mixin.js +0 -7
- package/build/src/types/regenerate.d.ts +0 -12
- package/build/src/types/regenerate.d.ts.map +0 -1
- package/build/src/types/regenerate.js +0 -7
- package/build/src/types/service.d.ts +0 -25
- package/build/src/types/service.d.ts.map +0 -1
- package/build/src/types/service.js +0 -7
- package/build/src/utils/default_values.d.ts +0 -20
- package/build/src/utils/default_values.d.ts.map +0 -1
- package/build/src/utils/default_values.js +0 -19
- package/build/src/utils/helpers.d.ts +0 -19
- package/build/src/utils/helpers.d.ts.map +0 -1
- package/build/src/utils/helpers.js +0 -131
- package/build/src/utils/hooks.d.ts +0 -12
- package/build/src/utils/hooks.d.ts.map +0 -1
- package/build/src/utils/hooks.js +0 -42
- package/build/src/utils/symbols.d.ts +0 -8
- package/build/src/utils/symbols.d.ts.map +0 -1
- package/build/src/utils/symbols.js +0 -7
- package/build/stubs/config.stub +0 -140
- package/build/stubs/make/converter/main.stub +0 -20
- package/build/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import type { Attachment } from './attachment.js';
|
|
8
|
+
/**
|
|
9
|
+
* Read boundary used by asynchronous workers. Lucid, another ORM, or no database
|
|
10
|
+
* can implement it according to the application's persistence model.
|
|
11
|
+
*/
|
|
12
|
+
export interface AttachmentRepository {
|
|
13
|
+
findById(id: string): Promise<Attachment | null>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=attachment_repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_repository.d.ts","sourceRoot":"","sources":["../../../src/core/attachment_repository.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAAA;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_repository.js","sourceRoot":"","sources":["../../../src/core/attachment_repository.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 { AttachmentDraft, type Attachment, type CreateAttachmentInput } from './attachment.js';
|
|
8
|
+
import { type AttachmentPersistenceOptions } from './attachment_options.js';
|
|
9
|
+
import type { AttachmentQueue } from './queue.js';
|
|
10
|
+
import type { AttachmentStorage } from './storage.js';
|
|
11
|
+
export type AttachmentServiceOptions = {
|
|
12
|
+
storage: AttachmentStorage;
|
|
13
|
+
queue: AttachmentQueue;
|
|
14
|
+
defaultDisk: string;
|
|
15
|
+
createId?: () => string;
|
|
16
|
+
defaults?: AttachmentPersistenceOptions;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Creates files and delegates persistence to the configured storage backend.
|
|
20
|
+
* Database persistence deliberately remains the responsibility of the caller.
|
|
21
|
+
*/
|
|
22
|
+
export declare class AttachmentService {
|
|
23
|
+
#private;
|
|
24
|
+
constructor(options: AttachmentServiceOptions);
|
|
25
|
+
createDraft(input: CreateAttachmentInput, options?: AttachmentPersistenceOptions): AttachmentDraft;
|
|
26
|
+
/**
|
|
27
|
+
* Backward-compatible immediate persistence for direct service consumers.
|
|
28
|
+
*/
|
|
29
|
+
create(input: CreateAttachmentInput): Promise<Attachment>;
|
|
30
|
+
remove(attachment: Attachment): Promise<void>;
|
|
31
|
+
read(attachment: Attachment): Promise<Uint8Array>;
|
|
32
|
+
scheduleVariantGeneration(attachment: Attachment, variantKeys?: readonly string[]): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=attachment_service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_service.d.ts","sourceRoot":"","sources":["../../../src/core/attachment_service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,eAAe,EAEf,KAAK,UAAU,EAEf,KAAK,qBAAqB,EAC3B,MAAM,iBAAiB,CAAA;AAExB,OAAO,EAIL,KAAK,4BAA4B,EAElC,MAAM,yBAAyB,CAAA;AAChC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAErD,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,iBAAiB,CAAA;IAC1B,KAAK,EAAE,eAAe,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,4BAA4B,CAAA;CACxC,CAAA;AAED;;;GAGG;AACH,qBAAa,iBAAiB;;gBAMhB,OAAO,EAAE,wBAAwB;IAO7C,WAAW,CACT,KAAK,EAAE,qBAAqB,EAC5B,OAAO,GAAE,4BAAiC,GACzC,eAAe;IAgBlB;;OAEG;IACG,MAAM,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC;IAmC/D,MAAM,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7C,IAAI,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAIjD,yBAAyB,CACvB,UAAU,EAAE,UAAU,EACtB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,GAC9B,OAAO,CAAC,IAAI,CAAC;CAOjB"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import { AttachmentDraft, AttachmentFactory, } from './attachment.js';
|
|
8
|
+
import { markAttachmentPending } from './attachment_state.js';
|
|
9
|
+
import { resolveAttachmentPersistenceOptions, } from './attachment_options.js';
|
|
10
|
+
/**
|
|
11
|
+
* Creates files and delegates persistence to the configured storage backend.
|
|
12
|
+
* Database persistence deliberately remains the responsibility of the caller.
|
|
13
|
+
*/
|
|
14
|
+
export class AttachmentService {
|
|
15
|
+
#storage;
|
|
16
|
+
#queue;
|
|
17
|
+
#factory;
|
|
18
|
+
#defaults;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.#storage = options.storage;
|
|
21
|
+
this.#queue = options.queue;
|
|
22
|
+
this.#factory = new AttachmentFactory(options);
|
|
23
|
+
this.#defaults = options.defaults ?? {};
|
|
24
|
+
}
|
|
25
|
+
createDraft(input, options = {}) {
|
|
26
|
+
const draftOptions = {
|
|
27
|
+
...(input.disk !== undefined ? { disk: input.disk } : {}),
|
|
28
|
+
...(input.folder !== undefined ? { folder: input.folder } : {}),
|
|
29
|
+
...options,
|
|
30
|
+
};
|
|
31
|
+
const provisional = this.#factory.create(input, {
|
|
32
|
+
...(typeof draftOptions.disk === 'string' ? { disk: draftOptions.disk } : {}),
|
|
33
|
+
...(typeof draftOptions.folder === 'string' ? { folder: draftOptions.folder } : {}),
|
|
34
|
+
});
|
|
35
|
+
return new AttachmentDraft(input, provisional, draftOptions, (draft, request) => this.#persistDraft(draft, request));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Backward-compatible immediate persistence for direct service consumers.
|
|
39
|
+
*/
|
|
40
|
+
async create(input) {
|
|
41
|
+
return this.createDraft(input).persist();
|
|
42
|
+
}
|
|
43
|
+
async #persistDraft(draft, request) {
|
|
44
|
+
const source = draft.source;
|
|
45
|
+
const context = {
|
|
46
|
+
...request?.context,
|
|
47
|
+
originalName: source.originalName,
|
|
48
|
+
};
|
|
49
|
+
const options = resolveAttachmentPersistenceOptions(this.#defaults, request?.options, draft.options);
|
|
50
|
+
const folder = await resolveFolder(options.folder, context);
|
|
51
|
+
const name = await resolveName(options.rename, context);
|
|
52
|
+
const attachment = this.#factory.create(source, {
|
|
53
|
+
id: draft.id,
|
|
54
|
+
...(options.disk ? { disk: options.disk } : {}),
|
|
55
|
+
...(folder ? { folder } : {}),
|
|
56
|
+
...(name ? { name } : {}),
|
|
57
|
+
});
|
|
58
|
+
await this.#storage.write({
|
|
59
|
+
disk: attachment.disk,
|
|
60
|
+
path: attachment.path,
|
|
61
|
+
body: source.body,
|
|
62
|
+
mimeType: attachment.mimeType,
|
|
63
|
+
});
|
|
64
|
+
markAttachmentPending(draft);
|
|
65
|
+
return attachment;
|
|
66
|
+
}
|
|
67
|
+
remove(attachment) {
|
|
68
|
+
return this.#storage.remove(attachment);
|
|
69
|
+
}
|
|
70
|
+
read(attachment) {
|
|
71
|
+
return this.#storage.read({ disk: attachment.disk, path: attachment.path });
|
|
72
|
+
}
|
|
73
|
+
scheduleVariantGeneration(attachment, variantKeys) {
|
|
74
|
+
return this.#queue.enqueue({
|
|
75
|
+
type: 'generate-variants',
|
|
76
|
+
attachmentId: attachment.id,
|
|
77
|
+
...(variantKeys ? { variantKeys } : {}),
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async function resolveFolder(folder, context) {
|
|
82
|
+
if (typeof folder === 'function') {
|
|
83
|
+
return folder(context);
|
|
84
|
+
}
|
|
85
|
+
return folder;
|
|
86
|
+
}
|
|
87
|
+
async function resolveName(rename, context) {
|
|
88
|
+
if (typeof rename === 'function') {
|
|
89
|
+
return rename(context);
|
|
90
|
+
}
|
|
91
|
+
return rename === false ? context.originalName : undefined;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=attachment_service.js.map
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CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC;AAED,KAAK,UAAU,WAAW,CACxB,MAAoC,EACpC,OAAqC;IAErC,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,MAAM,CAAC,OAAO,CAAC,CAAA;IACxB,CAAC;IAED,OAAO,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import type { Attachment } from './attachment.js';
|
|
8
|
+
export declare function markAttachmentPending(attachment: Attachment): void;
|
|
9
|
+
export declare function markAttachmentPersisted(attachment: Attachment): void;
|
|
10
|
+
export declare function isAttachmentPending(attachment: Attachment): boolean;
|
|
11
|
+
//# sourceMappingURL=attachment_state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_state.d.ts","sourceRoot":"","sources":["../../../src/core/attachment_state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAIjD,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAElE;AAED,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAEpE;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,OAAO,CAEnE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
const pendingAttachments = new WeakSet();
|
|
8
|
+
export function markAttachmentPending(attachment) {
|
|
9
|
+
pendingAttachments.add(attachment);
|
|
10
|
+
}
|
|
11
|
+
export function markAttachmentPersisted(attachment) {
|
|
12
|
+
pendingAttachments.delete(attachment);
|
|
13
|
+
}
|
|
14
|
+
export function isAttachmentPending(attachment) {
|
|
15
|
+
return pendingAttachments.has(attachment);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=attachment_state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_state.js","sourceRoot":"","sources":["../../../src/core/attachment_state.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,kBAAkB,GAAG,IAAI,OAAO,EAAc,CAAA;AAEpD,MAAM,UAAU,qBAAqB,CAAC,UAAsB;IAC1D,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;AACpC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,UAAsB;IAC5D,kBAAkB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;AACvC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,UAAsB;IACxD,OAAO,kBAAkB,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;AAC3C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
export { AttachmentFactory, AttachmentDraft, isAttachmentDraft, type Attachment, type AttachmentDraftPersistence, type AttachmentFactoryOptions, type AttachmentPersistRequest, type CreateAttachmentInput, } from './attachment.js';
|
|
8
|
+
export { resolveAttachmentPersistenceOptions, type AttachmentFolder, type AttachmentPersistenceContext, type AttachmentPersistenceOptions, type AttachmentRename, type ResolvedAttachmentPersistenceOptions, } from './attachment_options.js';
|
|
9
|
+
export { AttachmentService, type AttachmentServiceOptions } from './attachment_service.js';
|
|
10
|
+
export { AttachmentJobProcessor, AttachmentNotFoundError, type AttachmentJobProcessorOptions, type VariantGenerationRequest, type VariantGenerator, type VariantGeneratorFactory, } from './attachment_job_processor.js';
|
|
11
|
+
export { type AttachmentRepository } from './attachment_repository.js';
|
|
12
|
+
export { type AttachmentJob, type AttachmentJobHandler, type AttachmentQueue, type GenerateVariantsJob, } from './queue.js';
|
|
13
|
+
export { type AttachmentStorage, type StorageLocation, type WriteAttachmentInput, } from './storage.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,iBAAiB,EACjB,KAAK,UAAU,EACf,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,qBAAqB,GAC3B,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,mCAAmC,EACnC,KAAK,gBAAgB,EACrB,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,gBAAgB,EACrB,KAAK,oCAAoC,GAC1C,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAA;AAC1F,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,6BAA6B,EAClC,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,mBAAmB,GACzB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,cAAc,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
export { AttachmentFactory, AttachmentDraft, isAttachmentDraft, } from './attachment.js';
|
|
8
|
+
export { resolveAttachmentPersistenceOptions, } from './attachment_options.js';
|
|
9
|
+
export { AttachmentService } from './attachment_service.js';
|
|
10
|
+
export { AttachmentJobProcessor, AttachmentNotFoundError, } from './attachment_job_processor.js';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,iBAAiB,GAMlB,MAAM,iBAAiB,CAAA;AACxB,OAAO,EACL,mCAAmC,GAMpC,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,iBAAiB,EAAiC,MAAM,yBAAyB,CAAA;AAC1F,OAAO,EACL,sBAAsB,EACtB,uBAAuB,GAKxB,MAAM,+BAA+B,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
export type GenerateVariantsJob = {
|
|
8
|
+
type: 'generate-variants';
|
|
9
|
+
attachmentId: string;
|
|
10
|
+
variantKeys?: readonly string[];
|
|
11
|
+
};
|
|
12
|
+
export type AttachmentJob = GenerateVariantsJob;
|
|
13
|
+
/**
|
|
14
|
+
* Dispatch boundary. External queues only need to accept an AttachmentJob.
|
|
15
|
+
*/
|
|
16
|
+
export interface AttachmentQueue {
|
|
17
|
+
enqueue(job: AttachmentJob): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
export type AttachmentJobHandler = (job: AttachmentJob) => Promise<void>;
|
|
20
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../src/core/queue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,mBAAmB,GAAG;IAChC,IAAI,EAAE,mBAAmB,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,aAAa,GAAG,mBAAmB,CAAA;AAE/C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3C;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,GAAG,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../src/core/queue.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import type { Attachment } from './attachment.js';
|
|
8
|
+
export type StorageLocation = Pick<Attachment, 'disk' | 'path'>;
|
|
9
|
+
export type WriteAttachmentInput = StorageLocation & {
|
|
10
|
+
body: Uint8Array;
|
|
11
|
+
mimeType: string;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Storage boundary implemented by Adonis Drive or any application-specific backend.
|
|
15
|
+
*/
|
|
16
|
+
export interface AttachmentStorage {
|
|
17
|
+
/** Disk selected when an attachment source does not override it. */
|
|
18
|
+
defaultDisk?: string | undefined;
|
|
19
|
+
write(input: WriteAttachmentInput): Promise<void>;
|
|
20
|
+
read(location: StorageLocation): Promise<Uint8Array>;
|
|
21
|
+
remove(location: StorageLocation): Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/core/storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAEjD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAAC,CAAA;AAE/D,MAAM,MAAM,oBAAoB,GAAG,eAAe,GAAG;IACnD,IAAI,EAAE,UAAU,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB,CAAA;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,KAAK,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACjD,IAAI,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;IACpD,MAAM,CAAC,QAAQ,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACjD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../../src/core/storage.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -4,26 +4,45 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
7
|
+
import type { ApplicationService, ConfigProvider } from '@adonisjs/core/types';
|
|
8
|
+
import type { AttachmentServiceOptions } from './core/attachment_service.js';
|
|
9
|
+
import type { AttachmentJobProcessor } from './core/attachment_job_processor.js';
|
|
10
|
+
import type { AttachmentRepository } from './core/attachment_repository.js';
|
|
11
|
+
import type { AttachmentJobHandler, AttachmentQueue } from './core/queue.js';
|
|
12
|
+
import type { AttachmentStorage } from './core/storage.js';
|
|
13
|
+
import type { AttachmentManagerOptions } from './sources/attachment_manager.js';
|
|
14
|
+
import type { AttachmentPersistenceOptions } from './core/attachment_options.js';
|
|
15
|
+
type Integration<T> = T | ((app: ApplicationService) => T | Promise<T>);
|
|
16
|
+
export type AttachmentRouteConfig = false | {
|
|
17
|
+
prefix?: string;
|
|
18
|
+
};
|
|
19
|
+
export type ResolvedAttachmentRouteConfig = {
|
|
20
|
+
path: string;
|
|
21
|
+
};
|
|
22
|
+
export type AttachmentConfig = {
|
|
23
|
+
/** Overrides the storage default. Falls back to `fs` when no adapter provides one. */
|
|
24
|
+
defaultDisk?: string;
|
|
25
|
+
storage: Integration<AttachmentStorage>;
|
|
26
|
+
queue?: Integration<AttachmentQueue>;
|
|
27
|
+
jobHandler?: Integration<AttachmentJobHandler>;
|
|
28
|
+
processor?: Integration<AttachmentJobProcessor>;
|
|
29
|
+
repository?: Integration<AttachmentRepository>;
|
|
30
|
+
/** Lowest-priority defaults for file persistence. */
|
|
31
|
+
defaults?: AttachmentPersistenceOptions;
|
|
32
|
+
sources?: AttachmentManagerOptions;
|
|
33
|
+
route?: AttachmentRouteConfig;
|
|
34
|
+
queueConcurrency?: number;
|
|
35
|
+
createId?: () => string;
|
|
36
|
+
};
|
|
37
|
+
export type ResolvedAttachmentConfig = AttachmentServiceOptions & {
|
|
38
|
+
repository?: AttachmentRepository;
|
|
39
|
+
defaults?: AttachmentPersistenceOptions;
|
|
40
|
+
sources?: AttachmentManagerOptions;
|
|
41
|
+
route: ResolvedAttachmentRouteConfig | false;
|
|
42
|
+
};
|
|
10
43
|
/**
|
|
11
|
-
*
|
|
44
|
+
* Defers resolution of optional Adonis integrations until application boot.
|
|
12
45
|
*/
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
meta?: boolean;
|
|
16
|
-
rename?: boolean;
|
|
17
|
-
preComputeUrl?: boolean;
|
|
18
|
-
timeout?: number;
|
|
19
|
-
converters?: {
|
|
20
|
-
[K in keyof KnownConverters]: KnownConverters[K];
|
|
21
|
-
};
|
|
22
|
-
queue?: Queue;
|
|
23
|
-
variant?: {
|
|
24
|
-
basePath?: string;
|
|
25
|
-
ignoreFolder?: boolean;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
export declare function defineConfig<KnownConverter extends Record<string, ConverterConfig>>(config: AttachmentConfig<KnownConverter>): ConfigProvider<ResolvedAttachmentConfig<KnownConverter>>;
|
|
46
|
+
export declare function defineConfig(config: AttachmentConfig): ConfigProvider<ResolvedAttachmentConfig>;
|
|
47
|
+
export {};
|
|
29
48
|
//# sourceMappingURL=define_config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"define_config.d.ts","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC9E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAA;AAC5E,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAA;AAChF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iCAAiC,CAAA;AA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,QAAQ,CAAC,EAAE,4BAA4B,CAAA;IACvC,OAAO,CAAC,EAAE,wBAAwB,CAAA;IAClC,KAAK,EAAE,6BAA6B,GAAG,KAAK,CAAA;CAC7C,CAAA;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,cAAc,CAAC,wBAAwB,CAAC,CA8B/F"}
|
|
@@ -5,32 +5,54 @@
|
|
|
5
5
|
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
6
|
*/
|
|
7
7
|
import { configProvider } from '@adonisjs/core';
|
|
8
|
+
import { MemoryAttachmentQueue } from './queues/memory_queue.js';
|
|
9
|
+
/**
|
|
10
|
+
* Defers resolution of optional Adonis integrations until application boot.
|
|
11
|
+
*/
|
|
8
12
|
export function defineConfig(config) {
|
|
9
|
-
return configProvider.create(async (
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
converters[converterName] = new Converter(options, binConfig);
|
|
25
|
-
}
|
|
26
|
-
catch (error) {
|
|
27
|
-
console.error(`Failed to load converter ${converterName}:`, error);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
13
|
+
return configProvider.create(async (app) => {
|
|
14
|
+
const storage = await resolveIntegration(config.storage, app);
|
|
15
|
+
const processor = config.processor
|
|
16
|
+
? await resolveIntegration(config.processor, app)
|
|
17
|
+
: undefined;
|
|
18
|
+
const queue = config.queue
|
|
19
|
+
? await resolveIntegration(config.queue, app)
|
|
20
|
+
: new MemoryAttachmentQueue({
|
|
21
|
+
handler: config.jobHandler
|
|
22
|
+
? await resolveIntegration(config.jobHandler, app)
|
|
23
|
+
: processor
|
|
24
|
+
? (job) => processor.process(job)
|
|
25
|
+
: async () => { },
|
|
26
|
+
...(config.queueConcurrency ? { concurrency: config.queueConcurrency } : {}),
|
|
27
|
+
});
|
|
31
28
|
return {
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
defaultDisk: config.defaultDisk ?? storage.defaultDisk ?? 'fs',
|
|
30
|
+
storage,
|
|
31
|
+
queue,
|
|
32
|
+
route: resolveRoute(config.route),
|
|
33
|
+
...(config.repository
|
|
34
|
+
? { repository: await resolveIntegration(config.repository, app) }
|
|
35
|
+
: {}),
|
|
36
|
+
...(config.defaults ? { defaults: config.defaults } : {}),
|
|
37
|
+
...(config.sources ? { sources: config.sources } : {}),
|
|
38
|
+
...(config.createId ? { createId: config.createId } : {}),
|
|
34
39
|
};
|
|
35
40
|
});
|
|
36
41
|
}
|
|
42
|
+
function resolveRoute(route) {
|
|
43
|
+
if (route === false) {
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
const prefix = route?.prefix ?? '/attachments';
|
|
47
|
+
if (!prefix.startsWith('/') || prefix.includes(':')) {
|
|
48
|
+
throw new Error('Attachment route prefix must start with "/" and cannot contain parameters');
|
|
49
|
+
}
|
|
50
|
+
return { path: `${prefix.replace(/\/+$/, '') || ''}/:id` };
|
|
51
|
+
}
|
|
52
|
+
async function resolveIntegration(integration, app) {
|
|
53
|
+
if (typeof integration === 'function') {
|
|
54
|
+
return integration(app);
|
|
55
|
+
}
|
|
56
|
+
return integration;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=define_config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define_config.js","sourceRoot":"","sources":["../../src/define_config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AA0ChE;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,MAAwB;IACnD,OAAO,cAAc,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,E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model';
|
|
8
|
+
import { type Attachment } from '../../core/attachment.js';
|
|
9
|
+
import type { AttachmentPersistenceOptions } from '../../core/attachment_options.js';
|
|
10
|
+
export type LucidAttachmentOptions<Model = any> = AttachmentPersistenceOptions<Model> & {
|
|
11
|
+
serialize?: (value: Attachment | null | undefined) => unknown;
|
|
12
|
+
serializeAs?: string | null;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Persists one Attachment JSON value in a Lucid column and coordinates file cleanup.
|
|
16
|
+
*/
|
|
17
|
+
export declare function attachment<Model = LucidRow>(options?: LucidAttachmentOptions<Model>): PropertyDecorator;
|
|
18
|
+
//# sourceMappingURL=attachment_column.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_column.d.ts","sourceRoot":"","sources":["../../../../src/integrations/lucid/attachment_column.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAc,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAEvE,OAAO,EAAqB,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAE7E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,kCAAkC,CAAA;AAoBpF,MAAM,MAAM,sBAAsB,CAAC,KAAK,GAAG,GAAG,IAAI,4BAA4B,CAAC,KAAK,CAAC,GAAG;IACtF,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI,GAAG,SAAS,KAAK,OAAO,CAAA;IAC7D,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B,CAAA;AAOD;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,GAAG,QAAQ,EAAE,OAAO,GAAE,sBAAsB,CAAC,KAAK,CAAM,GAAG,iBAAiB,CAoB3G"}
|