@jrmc/adonis-attachment 5.2.0 → 6.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -73
- 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 +23 -8
- package/build/index.d.ts.map +1 -1
- package/build/index.js +13 -7
- 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 +35 -0
- package/build/src/core/attachment.d.ts.map +1 -0
- package/build/src/core/attachment.js +47 -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_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 +28 -0
- package/build/src/core/attachment_service.d.ts.map +1 -0
- package/build/src/core/attachment_service.js +47 -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 +13 -0
- package/build/src/core/index.d.ts.map +1 -0
- package/build/src/core/index.js +10 -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 +35 -20
- package/build/src/define_config.d.ts.map +1 -1
- package/build/src/define_config.js +45 -24
- package/build/src/define_config.js.map +1 -0
- package/build/src/integrations/lucid/attachment_column.d.ts +11 -0
- package/build/src/integrations/lucid/attachment_column.d.ts.map +1 -0
- package/build/src/integrations/lucid/attachment_column.js +138 -0
- package/build/src/integrations/lucid/attachment_column.js.map +1 -0
- package/build/src/integrations/lucid/attachment_model.d.ts +36 -0
- package/build/src/integrations/lucid/attachment_model.d.ts.map +1 -0
- package/build/src/integrations/lucid/attachment_model.js +96 -0
- package/build/src/integrations/lucid/attachment_model.js.map +1 -0
- package/build/src/integrations/lucid/attachment_owner.d.ts +17 -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/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 +19 -0
- package/build/src/integrations/lucid/index.d.ts.map +1 -0
- package/build/src/integrations/lucid/index.js +19 -0
- package/build/src/integrations/lucid/index.js.map +1 -0
- package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.d.ts +21 -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 +68 -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 +27 -0
- package/build/src/integrations/lucid/lucid_attachment_store.d.ts.map +1 -0
- package/build/src/integrations/lucid/lucid_attachment_store.js +84 -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 +57 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment.d.ts.map +1 -0
- package/build/src/integrations/lucid/migrate_legacy_attachment.js +67 -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 +51 -0
- package/build/src/sources/attachment_manager.d.ts.map +1 -0
- package/build/src/sources/attachment_manager.js +169 -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 +38 -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 +128 -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_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 +91 -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 +65 -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 +191 -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 +51 -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_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 +137 -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 +206 -0
- package/build/tests/lucid_attachment_lifecycle_service.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 +71 -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 +91 -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 -78
- 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,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import { test } from '@japa/runner';
|
|
8
|
+
import { UnknownVariantConverterError, VariantGenerationService } from '../index.js';
|
|
9
|
+
const sourceAttachment = {
|
|
10
|
+
id: 'original-id',
|
|
11
|
+
disk: 'public',
|
|
12
|
+
path: 'users/42/avatar.jpg',
|
|
13
|
+
name: 'avatar.jpg',
|
|
14
|
+
originalName: 'profile.jpg',
|
|
15
|
+
mimeType: 'image/jpeg',
|
|
16
|
+
extname: 'jpg',
|
|
17
|
+
size: 42,
|
|
18
|
+
};
|
|
19
|
+
test.group('VariantGenerationService', () => {
|
|
20
|
+
test('converts and writes selected variants', async ({ assert }) => {
|
|
21
|
+
const generated = [];
|
|
22
|
+
const service = new VariantGenerationService({
|
|
23
|
+
attachments: {
|
|
24
|
+
async read() {
|
|
25
|
+
return new Uint8Array([1, 2, 3]);
|
|
26
|
+
},
|
|
27
|
+
async create(input) {
|
|
28
|
+
const attachment = {
|
|
29
|
+
...sourceAttachment,
|
|
30
|
+
id: 'thumbnail-id',
|
|
31
|
+
name: 'thumbnail.webp',
|
|
32
|
+
path: 'users/42/variants/thumbnail.webp',
|
|
33
|
+
originalName: input.originalName,
|
|
34
|
+
mimeType: input.mimeType ?? 'application/octet-stream',
|
|
35
|
+
extname: 'webp',
|
|
36
|
+
size: input.body.byteLength,
|
|
37
|
+
};
|
|
38
|
+
generated.push(attachment);
|
|
39
|
+
return attachment;
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
converters: [
|
|
43
|
+
{
|
|
44
|
+
key: 'thumbnail',
|
|
45
|
+
async convert(input) {
|
|
46
|
+
assert.deepEqual(input.body, new Uint8Array([1, 2, 3]));
|
|
47
|
+
return {
|
|
48
|
+
body: new Uint8Array([4, 5]),
|
|
49
|
+
fileName: 'thumbnail.webp',
|
|
50
|
+
mimeType: 'image/webp',
|
|
51
|
+
folder: 'users/42/variants',
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
const variants = await service.generateAll({
|
|
58
|
+
attachment: sourceAttachment,
|
|
59
|
+
variantKeys: ['thumbnail'],
|
|
60
|
+
});
|
|
61
|
+
assert.deepEqual(variants.map((variant) => variant.key), ['thumbnail']);
|
|
62
|
+
assert.equal(generated[0]?.mimeType, 'image/webp');
|
|
63
|
+
});
|
|
64
|
+
test('fails when a requested converter does not exist', async ({ assert }) => {
|
|
65
|
+
const service = new VariantGenerationService({
|
|
66
|
+
attachments: {
|
|
67
|
+
async read() {
|
|
68
|
+
return new Uint8Array();
|
|
69
|
+
},
|
|
70
|
+
async create() {
|
|
71
|
+
return sourceAttachment;
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
converters: [],
|
|
75
|
+
});
|
|
76
|
+
await assert.rejects(() => service.generateAll({ attachment: sourceAttachment, variantKeys: ['thumbnail'] }), UnknownVariantConverterError);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=variant_generation_service.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"variant_generation_service.spec.js","sourceRoot":"","sources":["../../tests/variant_generation_service.spec.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jrmc/adonis-attachment",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-alpha.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "
|
|
6
|
-
"engines": {
|
|
7
|
-
"node": ">=20.12.0"
|
|
8
|
-
},
|
|
9
|
-
"main": "build/index.js",
|
|
5
|
+
"description": "Next-generation attachment primitives for AdonisJS and standalone TypeScript applications",
|
|
10
6
|
"repository": {
|
|
11
7
|
"type": "git",
|
|
12
8
|
"url": "https://github.com/batosai/adonis-attachment.git"
|
|
@@ -23,6 +19,8 @@
|
|
|
23
19
|
"image-manipulation",
|
|
24
20
|
"responsive-images",
|
|
25
21
|
"upload",
|
|
22
|
+
"storage",
|
|
23
|
+
"queue",
|
|
26
24
|
"resize-images",
|
|
27
25
|
"optimize-images",
|
|
28
26
|
"image",
|
|
@@ -32,108 +30,114 @@
|
|
|
32
30
|
"word",
|
|
33
31
|
"sharp"
|
|
34
32
|
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=24.0.0"
|
|
35
|
+
},
|
|
35
36
|
"files": [
|
|
36
37
|
"build"
|
|
37
38
|
],
|
|
39
|
+
"main": "./build/index.js",
|
|
40
|
+
"types": "./build/index.d.ts",
|
|
41
|
+
"exports": {
|
|
42
|
+
".": {
|
|
43
|
+
"types": "./build/index.d.ts",
|
|
44
|
+
"default": "./build/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./core": {
|
|
47
|
+
"types": "./build/src/core/index.d.ts",
|
|
48
|
+
"default": "./build/src/core/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./queues/memory": {
|
|
51
|
+
"types": "./build/src/queues/memory_queue.d.ts",
|
|
52
|
+
"default": "./build/src/queues/memory_queue.js"
|
|
53
|
+
},
|
|
54
|
+
"./queues/adonis": {
|
|
55
|
+
"types": "./build/src/queues/adonis_queue.d.ts",
|
|
56
|
+
"default": "./build/src/queues/adonis_queue.js"
|
|
57
|
+
},
|
|
58
|
+
"./adapters/adonis-drive": {
|
|
59
|
+
"types": "./build/src/adapters/adonis_drive_storage.d.ts",
|
|
60
|
+
"default": "./build/src/adapters/adonis_drive_storage.js"
|
|
61
|
+
},
|
|
62
|
+
"./adapters/local-file": {
|
|
63
|
+
"types": "./build/src/adapters/local_file_storage.d.ts",
|
|
64
|
+
"default": "./build/src/adapters/local_file_storage.js"
|
|
65
|
+
},
|
|
66
|
+
"./lucid": {
|
|
67
|
+
"types": "./build/src/integrations/lucid/index.d.ts",
|
|
68
|
+
"default": "./build/src/integrations/lucid/index.js"
|
|
69
|
+
},
|
|
70
|
+
"./attachment_provider": {
|
|
71
|
+
"types": "./build/providers/attachment_provider.d.ts",
|
|
72
|
+
"default": "./build/providers/attachment_provider.js"
|
|
73
|
+
},
|
|
74
|
+
"./configure": {
|
|
75
|
+
"types": "./build/configure.d.ts",
|
|
76
|
+
"default": "./build/configure.js"
|
|
77
|
+
},
|
|
78
|
+
"./commands": {
|
|
79
|
+
"types": "./build/commands/main.d.ts",
|
|
80
|
+
"default": "./build/commands/main.js"
|
|
81
|
+
},
|
|
82
|
+
"./commands/make/attachments_table": {
|
|
83
|
+
"types": "./build/commands/make/attachments_table.d.ts",
|
|
84
|
+
"default": "./build/commands/make/attachments_table.js"
|
|
85
|
+
},
|
|
86
|
+
"./commands/make/attachment_v5_migration": {
|
|
87
|
+
"types": "./build/commands/make/attachment_v5_migration.d.ts",
|
|
88
|
+
"default": "./build/commands/make/attachment_v5_migration.js"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
38
91
|
"scripts": {
|
|
39
92
|
"typecheck": "tsc --noEmit",
|
|
40
93
|
"build": "npm run clean && tsc",
|
|
41
94
|
"postbuild": "npm run copyfiles && npm run index:commands",
|
|
42
|
-
"prepublishOnly": "npm run build",
|
|
43
95
|
"clean": "del-cli build",
|
|
44
96
|
"copyfiles": "copyfiles \"stubs/**/**/*.stub\" build",
|
|
45
97
|
"index:commands": "adonis-kit index build/commands",
|
|
46
98
|
"format": "prettier --write .",
|
|
99
|
+
"test": "rm -rf build && tsc -p tsconfig.json && npm run copyfiles && node build/bin/test.js",
|
|
100
|
+
"prepack": "npm run build",
|
|
101
|
+
"prepublishOnly": "npm run typecheck && npm test",
|
|
47
102
|
"docs:dev": "vitepress dev docs",
|
|
48
103
|
"docs:build": "vitepress build docs",
|
|
49
|
-
"docs:preview": "vitepress preview docs"
|
|
50
|
-
"test": "c8 npm run quick:test",
|
|
51
|
-
"quick:test": "node --import=./tsnode.esm.js --enable-source-maps bin/test.ts"
|
|
52
|
-
},
|
|
53
|
-
"exports": {
|
|
54
|
-
".": "./build/index.js",
|
|
55
|
-
"./types/*": "./build/src/types/*.js",
|
|
56
|
-
"./mixins": "./build/src/mixins/attachmentable.js",
|
|
57
|
-
"./decorators": "./build/src/decorators/attachment.js",
|
|
58
|
-
"./services/*": "./build/services/*.js",
|
|
59
|
-
"./converters/*": "./build/src/converters/*.js",
|
|
60
|
-
"./providers/*": "./build/providers/*.js",
|
|
61
|
-
"./commands": "./build/commands/main.js",
|
|
62
|
-
"./commands/*": "./build/commands/*.js",
|
|
63
|
-
"./controllers/*": "./build/src/controllers/*.js",
|
|
64
|
-
"./attachment_service": "./build/services/attachment_service.js",
|
|
65
|
-
"./attachment_provider": "./build/providers/attachment_provider.js"
|
|
66
|
-
},
|
|
67
|
-
"dependencies": {
|
|
68
|
-
"@poppinss/defer": "^1.1.3",
|
|
69
|
-
"@verrou/core": "^0.5.2",
|
|
70
|
-
"blurhash": "^2.0.5",
|
|
71
|
-
"execa": "^9.6.1",
|
|
72
|
-
"exifreader": "^4.34.0",
|
|
73
|
-
"file-type": "^21.3.0",
|
|
74
|
-
"mime-types": "^3.0.2"
|
|
104
|
+
"docs:preview": "vitepress preview docs"
|
|
75
105
|
},
|
|
76
106
|
"devDependencies": {
|
|
77
|
-
"@adonisjs/
|
|
78
|
-
"@adonisjs/
|
|
79
|
-
"@adonisjs/
|
|
80
|
-
"@adonisjs/
|
|
81
|
-
"@adonisjs/lucid": "^21.8.1",
|
|
82
|
-
"@adonisjs/prettier-config": "^1.4.5",
|
|
83
|
-
"@adonisjs/tsconfig": "^1.4.1",
|
|
107
|
+
"@adonisjs/core": "^7.3.5",
|
|
108
|
+
"@adonisjs/drive": "^4.0.0",
|
|
109
|
+
"@adonisjs/lucid": "^22.4.2",
|
|
110
|
+
"@adonisjs/queue": "^0.6.2",
|
|
84
111
|
"@japa/assert": "^4.2.0",
|
|
85
|
-
"@japa/
|
|
86
|
-
"@
|
|
87
|
-
"@
|
|
88
|
-
"
|
|
89
|
-
"@swc/core": "^1.15.8",
|
|
90
|
-
"@types/luxon": "^3.7.1",
|
|
91
|
-
"@types/mime-types": "^3.0.1",
|
|
92
|
-
"@types/node": "^25.0.3",
|
|
93
|
-
"@types/sinon": "^21.0.0",
|
|
94
|
-
"better-sqlite3": "^12.5.0",
|
|
95
|
-
"c8": "^10.1.3",
|
|
112
|
+
"@japa/runner": "^4.5.0",
|
|
113
|
+
"@types/luxon": "^3.7.2",
|
|
114
|
+
"@types/node": "^24.13.3",
|
|
115
|
+
"better-sqlite3": "^12.11.1",
|
|
96
116
|
"copyfiles": "^2.4.1",
|
|
97
117
|
"del-cli": "^7.0.0",
|
|
98
|
-
"
|
|
99
|
-
"luxon": "^3.7.2",
|
|
100
|
-
"prettier": "^3.7.4",
|
|
101
|
-
"sharp": "^0.34.5",
|
|
102
|
-
"sinon": "^21.0.1",
|
|
103
|
-
"ts-node": "^10.9.2",
|
|
118
|
+
"prettier": "^3.9.5",
|
|
104
119
|
"typescript": "^5.9.3",
|
|
105
120
|
"vitepress": "^1.6.4"
|
|
106
121
|
},
|
|
107
122
|
"peerDependencies": {
|
|
108
|
-
"@adonisjs/core": "^
|
|
109
|
-
"@adonisjs/drive": "^
|
|
110
|
-
"@adonisjs/
|
|
111
|
-
"@adonisjs/
|
|
112
|
-
"sharp": "^0.34.0"
|
|
123
|
+
"@adonisjs/core": "^7.0.0",
|
|
124
|
+
"@adonisjs/drive": "^4.0.0",
|
|
125
|
+
"@adonisjs/lucid": "^22.0.0",
|
|
126
|
+
"@adonisjs/queue": "^0.6.0"
|
|
113
127
|
},
|
|
114
128
|
"peerDependenciesMeta": {
|
|
115
|
-
"@adonisjs/
|
|
129
|
+
"@adonisjs/drive": {
|
|
130
|
+
"optional": true
|
|
131
|
+
},
|
|
132
|
+
"@adonisjs/lucid": {
|
|
116
133
|
"optional": true
|
|
117
134
|
},
|
|
118
|
-
"
|
|
135
|
+
"@adonisjs/queue": {
|
|
119
136
|
"optional": true
|
|
120
137
|
}
|
|
121
138
|
},
|
|
122
|
-
"prettier": "@adonisjs/prettier-config",
|
|
123
|
-
"c8": {
|
|
124
|
-
"reporter": [
|
|
125
|
-
"text",
|
|
126
|
-
"html"
|
|
127
|
-
],
|
|
128
|
-
"exclude": [
|
|
129
|
-
"tests/**"
|
|
130
|
-
]
|
|
131
|
-
},
|
|
132
139
|
"publishConfig": {
|
|
133
140
|
"access": "public",
|
|
134
|
-
"tag": "
|
|
135
|
-
},
|
|
136
|
-
"volta": {
|
|
137
|
-
"node": "20.17.0"
|
|
141
|
+
"tag": "next"
|
|
138
142
|
}
|
|
139
143
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../commands/make/converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAQ,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEtD,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,WAAW;IACpD,MAAM,CAAC,WAAW,SAAmB;IACrC,MAAM,CAAC,WAAW,SAAuC;IAGjD,IAAI,EAAE,MAAM,CAAA;IAEpB,SAAS,CAAC,QAAQ,EAAE,MAAM,CAA6B;IAEjD,GAAG;CAMV"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
8
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12
|
-
};
|
|
13
|
-
import { stubsRoot } from '../../stubs/main.js';
|
|
14
|
-
import { args, BaseCommand } from '@adonisjs/core/ace';
|
|
15
|
-
export default class MakeConverter extends BaseCommand {
|
|
16
|
-
static commandName = 'make:converter';
|
|
17
|
-
static description = 'Create a new media converter class';
|
|
18
|
-
stubPath = 'make/converter/main.stub';
|
|
19
|
-
async run() {
|
|
20
|
-
const codemods = await this.createCodemods();
|
|
21
|
-
await codemods.makeUsingStub(stubsRoot, this.stubPath, {
|
|
22
|
-
name: this.name,
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
__decorate([
|
|
27
|
-
args.string({ description: 'The name of the converter' })
|
|
28
|
-
], MakeConverter.prototype, "name", void 0);
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { LucidRow, LucidModel } from '@adonisjs/lucid/types/model';
|
|
2
|
-
import type { RegenerateOptions } from '../src/types/regenerate.js';
|
|
3
|
-
export default class RegenerateService {
|
|
4
|
-
#private;
|
|
5
|
-
model(Model: LucidModel, options?: RegenerateOptions): this;
|
|
6
|
-
row(row: LucidRow, options?: RegenerateOptions): this;
|
|
7
|
-
run(): Promise<void | void[]>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=regenerate_service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"regenerate_service.d.ts","sourceRoot":"","sources":["../../services/regenerate_service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAInE,MAAM,CAAC,OAAO,OAAO,iBAAiB;;IAKpC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,GAAE,iBAAsB;IAOxD,GAAG,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,GAAE,iBAAsB;IAO5C,GAAG;CAeV"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { AttachmentRecordService } from '../src/services/attachment/index.js';
|
|
2
|
-
export default class RegenerateService {
|
|
3
|
-
#Model;
|
|
4
|
-
#row;
|
|
5
|
-
#options;
|
|
6
|
-
model(Model, options = {}) {
|
|
7
|
-
this.#Model = Model;
|
|
8
|
-
this.#options = options;
|
|
9
|
-
return this;
|
|
10
|
-
}
|
|
11
|
-
row(row, options = {}) {
|
|
12
|
-
this.#row = row;
|
|
13
|
-
this.#options = options;
|
|
14
|
-
return this;
|
|
15
|
-
}
|
|
16
|
-
async run() {
|
|
17
|
-
if (this.#row) {
|
|
18
|
-
const record = new AttachmentRecordService(this.#row);
|
|
19
|
-
return record.regenerateVariants(this.#options);
|
|
20
|
-
}
|
|
21
|
-
else if (this.#Model) {
|
|
22
|
-
const entities = (await this.#Model.all());
|
|
23
|
-
return Promise.all(entities.map(async (entity) => {
|
|
24
|
-
const record = new AttachmentRecordService(entity);
|
|
25
|
-
return record.regenerateVariants(this.#options);
|
|
26
|
-
}));
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
declare const _default: {
|
|
8
|
-
encode(pixels: Uint8ClampedArray, width: number, height: number, componentX: number, componentY: number): Promise<string>;
|
|
9
|
-
};
|
|
10
|
-
export default _default;
|
|
11
|
-
//# sourceMappingURL=blurhash.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blurhash.d.ts","sourceRoot":"","sources":["../../../src/adapters/blurhash.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;mBAMS,iBAAiB,SAClB,MAAM,UACL,MAAM,cACF,MAAM,cACN,MAAM,GACjB,OAAO,CAAC,MAAM,CAAC;;AAPpB,wBAUC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import { encode } from 'blurhash';
|
|
8
|
-
export default {
|
|
9
|
-
async encode(pixels, width, height, componentX, componentY) {
|
|
10
|
-
return encode(pixels, width, height, componentX, componentY);
|
|
11
|
-
},
|
|
12
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import type { Exif, Input } from '../types/input.js';
|
|
8
|
-
import type { Converter } from '../types/converter.js';
|
|
9
|
-
import { ResolvedAttachmentConfig } from '../define_config.js';
|
|
10
|
-
type KnownConverters = Record<string, Converter>;
|
|
11
|
-
declare const _default: {
|
|
12
|
-
exif(input: Input, config: ResolvedAttachmentConfig<KnownConverters>): Promise<Exif | undefined>;
|
|
13
|
-
};
|
|
14
|
-
export default _default;
|
|
15
|
-
//# sourceMappingURL=exif.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exif.d.ts","sourceRoot":"","sources":["../../../src/adapters/exif.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AAMtD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA;AAE9D,KAAK,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAA;;gBAIrC,KAAK,UACJ,wBAAwB,CAAC,eAAe,CAAC,GAChD,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;;AAJ9B,wBAOC"}
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import fs from 'node:fs/promises';
|
|
8
|
-
import ExifReader from 'exifreader';
|
|
9
|
-
import { fileTypeFromBuffer, fileTypeFromFile } from 'file-type';
|
|
10
|
-
import { bufferToTempFile, cleanObject } from '../utils/helpers.js';
|
|
11
|
-
export default {
|
|
12
|
-
async exif(input, config) {
|
|
13
|
-
return exif(input, config);
|
|
14
|
-
},
|
|
15
|
-
};
|
|
16
|
-
const exif = async (input, config) => {
|
|
17
|
-
let fileType;
|
|
18
|
-
let buffer;
|
|
19
|
-
if (Buffer.isBuffer(input)) {
|
|
20
|
-
fileType = await fileTypeFromBuffer(input);
|
|
21
|
-
if (fileType?.mime.includes('image')) {
|
|
22
|
-
buffer = input;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
fileType = await fileTypeFromFile(input);
|
|
27
|
-
if (fileType?.mime.includes('image')) {
|
|
28
|
-
buffer = await fs.readFile(input);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (fileType?.mime.includes('video')) {
|
|
32
|
-
return videoExif(input, config);
|
|
33
|
-
}
|
|
34
|
-
if (fileType?.mime.includes('pdf')) {
|
|
35
|
-
return pdfExif(input, config);
|
|
36
|
-
}
|
|
37
|
-
if (buffer && fileType?.mime.includes('image')) {
|
|
38
|
-
return imageExif(buffer);
|
|
39
|
-
}
|
|
40
|
-
return undefined;
|
|
41
|
-
};
|
|
42
|
-
async function imageExif(buffer) {
|
|
43
|
-
const tags = await ExifReader.load(buffer, { expanded: true });
|
|
44
|
-
const data = {};
|
|
45
|
-
if (tags.exif) {
|
|
46
|
-
if (tags.exif['DateTime'])
|
|
47
|
-
data.date = tags.exif['DateTime'].description;
|
|
48
|
-
if (tags.exif['Software'])
|
|
49
|
-
data.host = tags.exif['Software'].description;
|
|
50
|
-
if (tags.exif['PixelXDimension'] && tags.exif['PixelYDimension']) {
|
|
51
|
-
data.dimension = {
|
|
52
|
-
width: tags.exif['PixelXDimension'].value,
|
|
53
|
-
height: tags.exif['PixelYDimension'].value,
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (tags.exif['Orientation']) {
|
|
57
|
-
data.orientation = {
|
|
58
|
-
value: tags.exif['Orientation'].value,
|
|
59
|
-
description: tags.exif['Orientation'].description,
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (tags.gps) {
|
|
64
|
-
data.gps = {
|
|
65
|
-
latitude: tags.gps['Latitude'],
|
|
66
|
-
longitude: tags.gps['Longitude'],
|
|
67
|
-
altitude: tags.gps['Altitude'],
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
if (tags.png) {
|
|
71
|
-
if (tags.png['Image Width'] && tags.png['Image Height']) {
|
|
72
|
-
data.dimension = {
|
|
73
|
-
width: tags.png['Image Width'].value,
|
|
74
|
-
height: tags.png['Image Height'].value,
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
if (tags.png['Software'])
|
|
78
|
-
data.host = tags.png['Software'].description;
|
|
79
|
-
if (tags.png['Creation Time'])
|
|
80
|
-
data.date = tags.png['Creation Time'].description;
|
|
81
|
-
}
|
|
82
|
-
if (tags.pngFile) {
|
|
83
|
-
if (tags.pngFile['Image Width'] && tags.pngFile['Image Height']) {
|
|
84
|
-
data.dimension = {
|
|
85
|
-
width: tags.pngFile['Image Width'].value,
|
|
86
|
-
height: tags.pngFile['Image Height'].value,
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (tags.file) {
|
|
91
|
-
if (tags.file['Image Width'] && tags.file['Image Height']) {
|
|
92
|
-
data.dimension = {
|
|
93
|
-
width: tags.file['Image Width'].value,
|
|
94
|
-
height: tags.file['Image Height'].value,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
if (tags.icc) {
|
|
99
|
-
if (tags.icc['Software'])
|
|
100
|
-
data.host = tags.icc['Software'].description;
|
|
101
|
-
if (tags.icc['Creation Time'])
|
|
102
|
-
data.date = tags.icc['Creation Time'].description;
|
|
103
|
-
if (tags.icc['Image Width'] && tags.icc['Image Height']) {
|
|
104
|
-
data.dimension = {
|
|
105
|
-
width: parseInt(tags.icc['Image Width'].value),
|
|
106
|
-
height: parseInt(tags.icc['Image Height'].value),
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return cleanObject(data);
|
|
111
|
-
}
|
|
112
|
-
async function videoExif(input, config) {
|
|
113
|
-
const { default: FFmpeg } = await import('./ffmpeg.js');
|
|
114
|
-
return new Promise(async (resolve) => {
|
|
115
|
-
let file = input;
|
|
116
|
-
if (Buffer.isBuffer(input)) {
|
|
117
|
-
file = await bufferToTempFile(input);
|
|
118
|
-
}
|
|
119
|
-
const ffmpeg = new FFmpeg(file);
|
|
120
|
-
if (config.bin) {
|
|
121
|
-
if (config.bin.ffprobePath) {
|
|
122
|
-
ffmpeg.setFfprobePath(config.bin.ffprobePath);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
const info = await ffmpeg.exif();
|
|
126
|
-
if (info.width && info.height && info.duration) {
|
|
127
|
-
resolve({
|
|
128
|
-
dimension: {
|
|
129
|
-
width: info.width,
|
|
130
|
-
height: info.height,
|
|
131
|
-
},
|
|
132
|
-
duration: info.duration,
|
|
133
|
-
videoCodec: info?.videoCodec,
|
|
134
|
-
audioCodec: info?.audioCodec,
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
async function pdfExif(input, config) {
|
|
140
|
-
const { default: Poppler } = await import('./poppler.js');
|
|
141
|
-
return new Promise(async (resolve) => {
|
|
142
|
-
let file = input;
|
|
143
|
-
if (Buffer.isBuffer(input)) {
|
|
144
|
-
file = await bufferToTempFile(input);
|
|
145
|
-
}
|
|
146
|
-
const poppler = new Poppler(file);
|
|
147
|
-
if (config.bin) {
|
|
148
|
-
if (config.bin.pdfinfoPath) {
|
|
149
|
-
poppler.setPdfInfoPath(config.bin.pdfinfoPath);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
const info = await poppler.pdfInfo();
|
|
153
|
-
if (info.width && info.height && info.pages) {
|
|
154
|
-
resolve({
|
|
155
|
-
dimension: {
|
|
156
|
-
width: info.width,
|
|
157
|
-
height: info.height,
|
|
158
|
-
},
|
|
159
|
-
version: info?.version,
|
|
160
|
-
pages: info?.pages,
|
|
161
|
-
date: info?.creationDate,
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import { FfmpegMetadata } from '../types/metadata.js';
|
|
8
|
-
export default class FFmpeg {
|
|
9
|
-
#private;
|
|
10
|
-
private input;
|
|
11
|
-
constructor(input: string);
|
|
12
|
-
screenshots(options: {
|
|
13
|
-
time: number;
|
|
14
|
-
}): Promise<string | undefined>;
|
|
15
|
-
exif(): Promise<FfmpegMetadata>;
|
|
16
|
-
setFfmpegPath(ffmpegPath: string): Promise<void>;
|
|
17
|
-
setFfprobePath(ffprobePath: string): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=ffmpeg.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ffmpeg.d.ts","sourceRoot":"","sources":["../../../src/adapters/ffmpeg.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAErD,MAAM,CAAC,OAAO,OAAO,MAAM;;IAMb,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,MAAM;IAuB3B,WAAW,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IA8CrC,IAAI,IAAI,OAAO,CAAC,cAAc,CAAC;IA6B/B,aAAa,CAAC,UAAU,EAAE,MAAM;IAIhC,cAAc,CAAC,WAAW,EAAE,MAAM;CAGzC"}
|