@jrmc/adonis-attachment 5.2.1 → 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 -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 +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 +79 -75
- 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
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import { fileTypeFromBuffer, fileTypeFromFile } from 'file-type';
|
|
8
|
-
import Converter from './converter.js';
|
|
9
|
-
import ImageConverter from './image_converter.js';
|
|
10
|
-
import VideoThumnailConverter from './video_thumbnail_converter.js';
|
|
11
|
-
import DocumentThumbnailConverter from './document_thumbnail_converter.js';
|
|
12
|
-
import PdfThumbnailConverter from './pdf_thumbnail_converter.js';
|
|
13
|
-
export default class AutodetectConverter extends Converter {
|
|
14
|
-
async handle({ input, options }) {
|
|
15
|
-
let converter;
|
|
16
|
-
let fileType;
|
|
17
|
-
if (Buffer.isBuffer(input)) {
|
|
18
|
-
fileType = await fileTypeFromBuffer(input);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
fileType = await fileTypeFromFile(input);
|
|
22
|
-
}
|
|
23
|
-
if (!fileType) {
|
|
24
|
-
fileType = {
|
|
25
|
-
mime: 'text/plain',
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
if (fileType?.mime.includes('image')) {
|
|
29
|
-
converter = new ImageConverter(options, this.binPaths);
|
|
30
|
-
}
|
|
31
|
-
else if (fileType?.mime.includes('video')) {
|
|
32
|
-
converter = new VideoThumnailConverter(options, this.binPaths);
|
|
33
|
-
}
|
|
34
|
-
else if (fileType?.mime.includes('pdf')) {
|
|
35
|
-
converter = new PdfThumbnailConverter(options, this.binPaths);
|
|
36
|
-
}
|
|
37
|
-
else if (
|
|
38
|
-
// Documents texte
|
|
39
|
-
fileType?.mime.includes('application/vnd.openxmlformats-officedocument.wordprocessingml.document') || // .docx
|
|
40
|
-
fileType?.mime.includes('application/vnd.oasis.opendocument.text') || // .odt
|
|
41
|
-
fileType?.mime.includes('application/msword') || // .doc
|
|
42
|
-
fileType?.mime.includes('application/rtf') || // .rtf
|
|
43
|
-
fileType?.mime.includes('text/plain') || // .txt
|
|
44
|
-
fileType?.mime.includes('application/xml') || // .xml, .svg
|
|
45
|
-
// Feuilles de calcul
|
|
46
|
-
fileType?.mime.includes('application/vnd.oasis.opendocument.spreadsheet') || // .ods
|
|
47
|
-
fileType?.mime.includes('application/vnd.ms-excel') || // .xls
|
|
48
|
-
fileType?.mime.includes('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') || // .xlsx
|
|
49
|
-
fileType?.mime.includes('text/csv') || // .csv
|
|
50
|
-
// Présentations
|
|
51
|
-
fileType?.mime.includes('application/vnd.oasis.opendocument.presentation') || // .odp
|
|
52
|
-
fileType?.mime.includes('application/vnd.ms-powerpoint') || // .ppt
|
|
53
|
-
fileType?.mime.includes('application/vnd.openxmlformats-officedocument.presentationml.presentation') || // .pptx
|
|
54
|
-
// Dessins
|
|
55
|
-
fileType?.mime.includes('application/vnd.oasis.opendocument.graphics') || // .odg
|
|
56
|
-
fileType?.mime.includes('application/vnd.visio') || // .vsd
|
|
57
|
-
// Formules mathématiques
|
|
58
|
-
fileType?.mime.includes('application/vnd.oasis.opendocument.formula') || // .odf
|
|
59
|
-
fileType?.mime.includes('application/mathml+xml') || // .mml
|
|
60
|
-
// Bases de données
|
|
61
|
-
fileType?.mime.includes('application/vnd.oasis.opendocument.database') || // .odb
|
|
62
|
-
fileType?.mime.includes('application/x-msaccess') || // .mdb, .accdb
|
|
63
|
-
// Autres formats Office
|
|
64
|
-
fileType?.mime.includes('application/vnd.ms-office') || // Formats MS Office génériques
|
|
65
|
-
fileType?.mime.includes('application/vnd.oasis.opendocument') // Formats OpenDocument génériques
|
|
66
|
-
) {
|
|
67
|
-
converter = new DocumentThumbnailConverter(options, this.binPaths);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
return converter.handle({
|
|
73
|
-
input,
|
|
74
|
-
options,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import type { BinPaths } from '../types/config.js';
|
|
8
|
-
import type { Converter as ConverterInterface, ConverterOptions } from '../types/converter.js';
|
|
9
|
-
export default class Converter implements ConverterInterface {
|
|
10
|
-
options?: ConverterOptions;
|
|
11
|
-
binPaths?: BinPaths;
|
|
12
|
-
constructor(options?: ConverterOptions, binPaths?: BinPaths);
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=converter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"converter.d.ts","sourceRoot":"","sources":["../../../src/converters/converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAClD,OAAO,KAAK,EAAE,SAAS,IAAI,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE9F,MAAM,CAAC,OAAO,OAAO,SAAU,YAAW,kBAAkB;IAC1D,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,QAAQ,CAAC,EAAE,QAAQ,CAAA;gBAEP,OAAO,CAAC,EAAE,gBAAgB,EAAE,QAAQ,CAAC,EAAE,QAAQ;CAI5D"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
export default class Converter {
|
|
8
|
-
options;
|
|
9
|
-
binPaths;
|
|
10
|
-
constructor(options, binPaths) {
|
|
11
|
-
this.options = options;
|
|
12
|
-
this.binPaths = binPaths;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import type { ConverterAttributes } from '../types/converter.js';
|
|
8
|
-
import type { Input } from '../types/input.js';
|
|
9
|
-
import Converter from './converter.js';
|
|
10
|
-
export default class DocumentThumbnailConverter extends Converter {
|
|
11
|
-
handle({ input, options }: ConverterAttributes): Promise<Input>;
|
|
12
|
-
documentToImage(input: Input): Promise<string>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=document_thumbnail_converter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"document_thumbnail_converter.d.ts","sourceRoot":"","sources":["../../../src/converters/document_thumbnail_converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAG9C,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAItC,MAAM,CAAC,OAAO,OAAO,0BAA2B,SAAQ,SAAS;IACzD,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC;IAc/D,eAAe,CAAC,KAAK,EAAE,KAAK;CAiBnC"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import { bufferToTempFile } from '../utils/helpers.js';
|
|
8
|
-
import Converter from './converter.js';
|
|
9
|
-
import ImageConverter from './image_converter.js';
|
|
10
|
-
import Soffice from '../adapters/soffice.js';
|
|
11
|
-
export default class DocumentThumbnailConverter extends Converter {
|
|
12
|
-
async handle({ input, options }) {
|
|
13
|
-
const filePath = await this.documentToImage(input);
|
|
14
|
-
if (options && filePath) {
|
|
15
|
-
const converter = new ImageConverter();
|
|
16
|
-
return await converter.handle({
|
|
17
|
-
input: filePath,
|
|
18
|
-
options,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return filePath;
|
|
22
|
-
}
|
|
23
|
-
async documentToImage(input) {
|
|
24
|
-
let file = input;
|
|
25
|
-
if (Buffer.isBuffer(input)) {
|
|
26
|
-
file = await bufferToTempFile(input);
|
|
27
|
-
}
|
|
28
|
-
const soffice = new Soffice(file);
|
|
29
|
-
if (this.binPaths) {
|
|
30
|
-
if (this.binPaths.sofficePath) {
|
|
31
|
-
soffice.setSofficePath(this.binPaths.sofficePath);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return soffice.convert();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import type { ConverterAttributes } from '../types/converter.js';
|
|
8
|
-
import type { Input } from '../types/input.js';
|
|
9
|
-
import Converter from './converter.js';
|
|
10
|
-
export default class ImageConverter extends Converter {
|
|
11
|
-
handle({ input, options }: ConverterAttributes): Promise<Input>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=image_converter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image_converter.d.ts","sourceRoot":"","sources":["../../../src/converters/image_converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAGtC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,SAAS;IAC7C,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC;CAsBtE"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import Converter from './converter.js';
|
|
8
|
-
import { use } from '../utils/helpers.js';
|
|
9
|
-
export default class ImageConverter extends Converter {
|
|
10
|
-
async handle({ input, options }) {
|
|
11
|
-
const sharp = await use('sharp');
|
|
12
|
-
const resize = options?.resize || {};
|
|
13
|
-
let format = options?.format || 'webp';
|
|
14
|
-
const autoOrient = options?.autoOrient ?? true;
|
|
15
|
-
let formatoptions = {};
|
|
16
|
-
if (typeof format !== 'string') {
|
|
17
|
-
formatoptions = format?.options;
|
|
18
|
-
format = format.format;
|
|
19
|
-
}
|
|
20
|
-
const image = sharp(input).withMetadata();
|
|
21
|
-
if (autoOrient) {
|
|
22
|
-
image.autoOrient();
|
|
23
|
-
}
|
|
24
|
-
const buffer = await image.resize(resize).toFormat(format, formatoptions).toBuffer();
|
|
25
|
-
return buffer;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import type { ConverterAttributes } from '../types/converter.js';
|
|
8
|
-
import type { Input } from '../types/input.js';
|
|
9
|
-
import Converter from './converter.js';
|
|
10
|
-
export default class PdfThumbnailConverter extends Converter {
|
|
11
|
-
handle({ input, options }: ConverterAttributes): Promise<Input>;
|
|
12
|
-
pdfToImage(input: Input): Promise<string>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=pdf_thumbnail_converter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"pdf_thumbnail_converter.d.ts","sourceRoot":"","sources":["../../../src/converters/pdf_thumbnail_converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAKtC,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,SAAS;IACpD,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC;IAc/D,UAAU,CAAC,KAAK,EAAE,KAAK;CAoB9B"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import Converter from './converter.js';
|
|
8
|
-
import ImageConverter from './image_converter.js';
|
|
9
|
-
import Poppler from '../adapters/poppler.js';
|
|
10
|
-
import { bufferToTempFile } from '../utils/helpers.js';
|
|
11
|
-
export default class PdfThumbnailConverter extends Converter {
|
|
12
|
-
async handle({ input, options }) {
|
|
13
|
-
const filePath = await this.pdfToImage(input);
|
|
14
|
-
if (options && filePath) {
|
|
15
|
-
const converter = new ImageConverter();
|
|
16
|
-
return await converter.handle({
|
|
17
|
-
input: filePath,
|
|
18
|
-
options,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
return filePath;
|
|
22
|
-
}
|
|
23
|
-
async pdfToImage(input) {
|
|
24
|
-
let file = input;
|
|
25
|
-
if (Buffer.isBuffer(input)) {
|
|
26
|
-
file = await bufferToTempFile(input);
|
|
27
|
-
}
|
|
28
|
-
const poppler = new Poppler(file);
|
|
29
|
-
if (this.binPaths) {
|
|
30
|
-
if (this.binPaths.pdftoppmPath) {
|
|
31
|
-
poppler.setPdfToPpmPath(this.binPaths.pdftoppmPath);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return poppler.pdfToPpm({
|
|
35
|
-
page: this.options?.startPage || 1,
|
|
36
|
-
dpi: 300,
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import type { ConverterAttributes } from '../types/converter.js';
|
|
8
|
-
import type { Input } from '../types/input.js';
|
|
9
|
-
import Converter from './converter.js';
|
|
10
|
-
export default class VideoThumbnailConvert extends Converter {
|
|
11
|
-
handle({ input, options }: ConverterAttributes): Promise<Input | undefined>;
|
|
12
|
-
videoToImage(input: Input): Promise<string | undefined>;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=video_thumbnail_converter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"video_thumbnail_converter.d.ts","sourceRoot":"","sources":["../../../src/converters/video_thumbnail_converter.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAA;AAChE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,SAAS,MAAM,gBAAgB,CAAA;AAKtC,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,SAAS;IACpD,MAAM,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;IAc3E,YAAY,CAAC,KAAK,EAAE,KAAK;CAmBhC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import Converter from './converter.js';
|
|
8
|
-
import ImageConverter from './image_converter.js';
|
|
9
|
-
import { bufferToTempFile } from '../utils/helpers.js';
|
|
10
|
-
import FFmpeg from '../adapters/ffmpeg.js';
|
|
11
|
-
export default class VideoThumbnailConvert extends Converter {
|
|
12
|
-
async handle({ input, options }) {
|
|
13
|
-
const filePath = await this.videoToImage(input);
|
|
14
|
-
if (options && filePath) {
|
|
15
|
-
const converter = new ImageConverter();
|
|
16
|
-
return converter.handle({
|
|
17
|
-
input: filePath,
|
|
18
|
-
options,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
return filePath;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
async videoToImage(input) {
|
|
26
|
-
let file = input;
|
|
27
|
-
if (Buffer.isBuffer(input)) {
|
|
28
|
-
file = await bufferToTempFile(input);
|
|
29
|
-
}
|
|
30
|
-
const ffmpeg = new FFmpeg(file);
|
|
31
|
-
if (this.binPaths) {
|
|
32
|
-
if (this.binPaths.ffmpegPath) {
|
|
33
|
-
ffmpeg.setFfmpegPath(this.binPaths.ffmpegPath);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return ffmpeg.screenshots({
|
|
37
|
-
time: this.options?.startTime || 2,
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import type { LucidModel, LucidRow } from '@adonisjs/lucid/types/model';
|
|
8
|
-
import type { LucidOptions } from '../types/attachment.js';
|
|
9
|
-
import type { AttributeOfRowWithAttachment } from '../types/mixin.js';
|
|
10
|
-
export declare const bootModel: (model: LucidModel & {
|
|
11
|
-
$attachments: AttributeOfRowWithAttachment;
|
|
12
|
-
}) => void;
|
|
13
|
-
export declare const attachment: <T = LucidRow>(options?: LucidOptions<T>) => (target: any, attributeName: string) => void;
|
|
14
|
-
export declare const attachments: <T = LucidRow>(options?: LucidOptions<T>) => (target: any, attributeName: string) => void;
|
|
15
|
-
//# sourceMappingURL=attachment.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attachment.d.ts","sourceRoot":"","sources":["../../../src/decorators/attachment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AACvE,OAAO,KAAK,EAAc,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAKtE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAYrE,eAAO,MAAM,SAAS,GACpB,OAAO,UAAU,GAAG;IAClB,YAAY,EAAE,4BAA4B,CAAA;CAC3C,SA0BF,CAAA;AAgED,eAAO,MAAM,UAAU,GAtBpB,CAAC,uBAAuB,YAAY,CAAC,CAAC,CAAC,MACrB,QAAQ,GAAG,EAAE,eAAe,MAAM,SAqBJ,CAAA;AACnD,eAAO,MAAM,WAAW,GAvBrB,CAAC,uBAAuB,YAAY,CAAC,CAAC,CAAC,MACrB,QAAQ,GAAG,EAAE,eAAe,MAAM,SAmCpD,CAAA"}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import attachmentManager from '../../services/main.js';
|
|
8
|
-
import { optionsSym } from '../utils/symbols.js';
|
|
9
|
-
import { defaultOptionsDecorator } from '../utils/default_values.js';
|
|
10
|
-
import { afterFindHook, afterFetchHook, beforeSaveHook, afterSaveHook, beforeDeleteHook, } from '../utils/hooks.js';
|
|
11
|
-
import { defaultStateAttributeMixin } from '../utils/default_values.js';
|
|
12
|
-
export const bootModel = (model) => {
|
|
13
|
-
model.boot();
|
|
14
|
-
model.$attachments = structuredClone(defaultStateAttributeMixin);
|
|
15
|
-
/**
|
|
16
|
-
* Registering all hooks only once
|
|
17
|
-
*/
|
|
18
|
-
if (!model.$hooks.has('find', afterFindHook)) {
|
|
19
|
-
model.after('find', afterFindHook);
|
|
20
|
-
}
|
|
21
|
-
if (!model.$hooks.has('fetch', afterFetchHook)) {
|
|
22
|
-
model.after('fetch', afterFetchHook);
|
|
23
|
-
}
|
|
24
|
-
if (!model.$hooks.has('paginate', afterFetchHook)) {
|
|
25
|
-
model.after('paginate', afterFetchHook);
|
|
26
|
-
}
|
|
27
|
-
if (!model.$hooks.has('save', beforeSaveHook)) {
|
|
28
|
-
model.before('save', beforeSaveHook);
|
|
29
|
-
}
|
|
30
|
-
if (!model.$hooks.has('save', afterSaveHook)) {
|
|
31
|
-
model.after('save', afterSaveHook);
|
|
32
|
-
}
|
|
33
|
-
if (!model.$hooks.has('delete', beforeDeleteHook)) {
|
|
34
|
-
model.before('delete', beforeDeleteHook);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const makeColumnOptions = (options) => {
|
|
38
|
-
const { disk, folder, variants, meta, rename, ...columnOptions } = {
|
|
39
|
-
...defaultOptionsDecorator,
|
|
40
|
-
...options,
|
|
41
|
-
};
|
|
42
|
-
return {
|
|
43
|
-
consume: (value) => {
|
|
44
|
-
if (value) {
|
|
45
|
-
const attachment = attachmentManager.createFromDbResponse(value);
|
|
46
|
-
attachment?.setOptions({ disk, folder, variants });
|
|
47
|
-
if (options && options?.meta !== undefined) {
|
|
48
|
-
attachment?.setOptions({ meta: options.meta });
|
|
49
|
-
}
|
|
50
|
-
if (options && options?.rename !== undefined) {
|
|
51
|
-
attachment?.setOptions({ rename: options.rename });
|
|
52
|
-
}
|
|
53
|
-
if (options && options?.preComputeUrl !== undefined) {
|
|
54
|
-
attachment?.setOptions({ preComputeUrl: options.preComputeUrl });
|
|
55
|
-
}
|
|
56
|
-
return attachment;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
prepare: (value) => {
|
|
63
|
-
if (!value)
|
|
64
|
-
return null;
|
|
65
|
-
return value.toDbString();
|
|
66
|
-
},
|
|
67
|
-
serialize: options?.serialize !== undefined
|
|
68
|
-
? options?.serialize
|
|
69
|
-
: (value) => (value ? value.toJSON() : null),
|
|
70
|
-
...columnOptions,
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
|
-
const makeAttachmentDecorator = (columnOptionsTransformer) => (options) => {
|
|
74
|
-
return function (target, attributeName) {
|
|
75
|
-
if (!target[optionsSym]) {
|
|
76
|
-
target[optionsSym] = {};
|
|
77
|
-
}
|
|
78
|
-
target[optionsSym][attributeName] = options;
|
|
79
|
-
const Model = target.constructor;
|
|
80
|
-
bootModel(Model);
|
|
81
|
-
const columnOptions = makeColumnOptions(options);
|
|
82
|
-
const transformedColumnOptions = columnOptionsTransformer
|
|
83
|
-
? columnOptionsTransformer(columnOptions)
|
|
84
|
-
: columnOptions;
|
|
85
|
-
Model.$addColumn(attributeName, transformedColumnOptions);
|
|
86
|
-
};
|
|
87
|
-
};
|
|
88
|
-
export const attachment = makeAttachmentDecorator();
|
|
89
|
-
export const attachments = makeAttachmentDecorator((columnOptions) => ({
|
|
90
|
-
consume: (value) => {
|
|
91
|
-
if (value) {
|
|
92
|
-
const data = typeof value === 'string' ? JSON.parse(value) : value;
|
|
93
|
-
return data.map(columnOptions.consume);
|
|
94
|
-
}
|
|
95
|
-
return null;
|
|
96
|
-
},
|
|
97
|
-
prepare: (value) => {
|
|
98
|
-
if (!value)
|
|
99
|
-
return null;
|
|
100
|
-
return JSON.stringify(value.map((v) => JSON.parse(v.toDbString())));
|
|
101
|
-
},
|
|
102
|
-
serialize: (value) => (value ? value.map(columnOptions.serialize) : null),
|
|
103
|
-
}));
|
package/build/src/errors.d.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Unable to write file to the destination
|
|
9
|
-
*/
|
|
10
|
-
export declare const E_CANNOT_WRITE_FILE: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
11
|
-
/**
|
|
12
|
-
* Unable to read file
|
|
13
|
-
*/
|
|
14
|
-
export declare const E_CANNOT_READ_FILE: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
15
|
-
/**
|
|
16
|
-
* Unable to delete file
|
|
17
|
-
*/
|
|
18
|
-
export declare const E_CANNOT_DELETE_FILE: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
19
|
-
/**
|
|
20
|
-
* Unable to set file visibility
|
|
21
|
-
*/
|
|
22
|
-
export declare const E_CANNOT_SET_VISIBILITY: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
23
|
-
/**
|
|
24
|
-
* Unable to generate URL for a file
|
|
25
|
-
*/
|
|
26
|
-
export declare const E_CANNOT_GENERATE_URL: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
27
|
-
/**
|
|
28
|
-
* Unable to generate temp file
|
|
29
|
-
*/
|
|
30
|
-
export declare const E_CANNOT_GENERATE_TEMP_FILE: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
31
|
-
/**
|
|
32
|
-
* The file key has unallowed set of characters
|
|
33
|
-
*/
|
|
34
|
-
export declare const E_UNALLOWED_CHARACTERS: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
35
|
-
/**
|
|
36
|
-
* Key post normalization leads to an empty string
|
|
37
|
-
*/
|
|
38
|
-
export declare const E_INVALID_KEY: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
39
|
-
/**
|
|
40
|
-
* Missing package
|
|
41
|
-
*/
|
|
42
|
-
export declare const E_MISSING_PACKAGE: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
43
|
-
/**
|
|
44
|
-
* Unable to create Attachment Object
|
|
45
|
-
*/
|
|
46
|
-
export declare const E_CANNOT_CREATE_ATTACHMENT: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
47
|
-
/**
|
|
48
|
-
* Unable to create variant
|
|
49
|
-
*/
|
|
50
|
-
export declare const E_CANNOT_CREATE_VARIANT: new (args: [key: string], options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
51
|
-
/**
|
|
52
|
-
* Missing path
|
|
53
|
-
*/
|
|
54
|
-
export declare const E_CANNOT_PATH_BY_CONVERTER: new (args?: any, options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
55
|
-
/**
|
|
56
|
-
* Is not a Buffer
|
|
57
|
-
*/
|
|
58
|
-
export declare const E_ISNOT_BUFFER: new (args?: any, options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
59
|
-
/**
|
|
60
|
-
* Is not a Base64
|
|
61
|
-
*/
|
|
62
|
-
export declare const E_ISNOT_BASE64: new (args?: any, options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
63
|
-
/**
|
|
64
|
-
* Unable to read file
|
|
65
|
-
*/
|
|
66
|
-
export declare const ENOENT: new (args?: any, options?: ErrorOptions) => import("@adonisjs/core/exceptions").Exception;
|
|
67
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH;;GAEG;AACH,eAAO,MAAM,mBAAmB,oGAA6B,CAAA;AAE7D;;GAEG;AACH,eAAO,MAAM,kBAAkB,oGAA4B,CAAA;AAE3D;;GAEG;AACH,eAAO,MAAM,oBAAoB,oGAA8B,CAAA;AAE/D;;GAEG;AACH,eAAO,MAAM,uBAAuB,oGAAiC,CAAA;AAErE;;GAEG;AACH,eAAO,MAAM,qBAAqB,oGAA+B,CAAA;AAEjE;;GAEG;AACH,eAAO,MAAM,2BAA2B,oGAGvC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,oGAAgC,CAAA;AAEnE;;GAEG;AACH,eAAO,MAAM,aAAa,oGAAuB,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,iBAAiB,oGAG7B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,oGAGtC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,uBAAuB,oGAGnC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,0BAA0B,2FAGtC,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,cAAc,2FAAmD,CAAA;AAE9E;;GAEG;AACH,eAAO,MAAM,cAAc,2FAAmD,CAAA;AAE9E;;GAEG;AACH,eAAO,MAAM,MAAM,2FAA0C,CAAA"}
|
package/build/src/errors.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import { createError } from '@adonisjs/core/exceptions';
|
|
8
|
-
import { errors } from 'flydrive';
|
|
9
|
-
/**
|
|
10
|
-
* Unable to write file to the destination
|
|
11
|
-
*/
|
|
12
|
-
export const E_CANNOT_WRITE_FILE = errors.E_CANNOT_WRITE_FILE;
|
|
13
|
-
/**
|
|
14
|
-
* Unable to read file
|
|
15
|
-
*/
|
|
16
|
-
export const E_CANNOT_READ_FILE = errors.E_CANNOT_READ_FILE;
|
|
17
|
-
/**
|
|
18
|
-
* Unable to delete file
|
|
19
|
-
*/
|
|
20
|
-
export const E_CANNOT_DELETE_FILE = errors.E_CANNOT_DELETE_FILE;
|
|
21
|
-
/**
|
|
22
|
-
* Unable to set file visibility
|
|
23
|
-
*/
|
|
24
|
-
export const E_CANNOT_SET_VISIBILITY = errors.E_CANNOT_SET_VISIBILITY;
|
|
25
|
-
/**
|
|
26
|
-
* Unable to generate URL for a file
|
|
27
|
-
*/
|
|
28
|
-
export const E_CANNOT_GENERATE_URL = errors.E_CANNOT_GENERATE_URL;
|
|
29
|
-
/**
|
|
30
|
-
* Unable to generate temp file
|
|
31
|
-
*/
|
|
32
|
-
export const E_CANNOT_GENERATE_TEMP_FILE = createError('Cannot generate temp file "%s"', 'E_CANNOT_GENERATE_TEMP_FILE');
|
|
33
|
-
/**
|
|
34
|
-
* The file key has unallowed set of characters
|
|
35
|
-
*/
|
|
36
|
-
export const E_UNALLOWED_CHARACTERS = errors.E_UNALLOWED_CHARACTERS;
|
|
37
|
-
/**
|
|
38
|
-
* Key post normalization leads to an empty string
|
|
39
|
-
*/
|
|
40
|
-
export const E_INVALID_KEY = errors.E_INVALID_KEY;
|
|
41
|
-
/**
|
|
42
|
-
* Missing package
|
|
43
|
-
*/
|
|
44
|
-
export const E_MISSING_PACKAGE = createError('Missing package, please install "%s"', 'E_MISSING_PACKAGE');
|
|
45
|
-
/**
|
|
46
|
-
* Unable to create Attachment Object
|
|
47
|
-
*/
|
|
48
|
-
export const E_CANNOT_CREATE_ATTACHMENT = createError('Cannot create attachment from database response. Missing attribute "%s"', 'E_CANNOT_CREATE_ATTACHMENT');
|
|
49
|
-
/**
|
|
50
|
-
* Unable to create variant
|
|
51
|
-
*/
|
|
52
|
-
export const E_CANNOT_CREATE_VARIANT = createError('Cannot create variant. "%s"', 'E_CANNOT_CREATE_VARIANT');
|
|
53
|
-
/**
|
|
54
|
-
* Missing path
|
|
55
|
-
*/
|
|
56
|
-
export const E_CANNOT_PATH_BY_CONVERTER = createError('Path not found', 'E_CANNOT_PATH_BY_CONVERTER');
|
|
57
|
-
/**
|
|
58
|
-
* Is not a Buffer
|
|
59
|
-
*/
|
|
60
|
-
export const E_ISNOT_BUFFER = createError('Is not a Buffer', 'E_ISNOT_BUFFER');
|
|
61
|
-
/**
|
|
62
|
-
* Is not a Base64
|
|
63
|
-
*/
|
|
64
|
-
export const E_ISNOT_BASE64 = createError('Is not a Base64', 'E_ISNOT_BASE64');
|
|
65
|
-
/**
|
|
66
|
-
* Unable to read file
|
|
67
|
-
*/
|
|
68
|
-
export const ENOENT = createError('File not found', 'ENOENT');
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import type { RecordWithAttachment as RecordWithAttachmentImplementation } from '../../types/service.js';
|
|
8
|
-
export declare class AttachmentDetachmentService {
|
|
9
|
-
#private;
|
|
10
|
-
/**
|
|
11
|
-
* Detach dirty attachments (mark for deletion)
|
|
12
|
-
*/
|
|
13
|
-
detach(record: RecordWithAttachmentImplementation): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Detach all attachments (mark all for deletion)
|
|
16
|
-
*/
|
|
17
|
-
detachAll(record: RecordWithAttachmentImplementation): Promise<void>;
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=attachment_detachment_service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attachment_detachment_service.d.ts","sourceRoot":"","sources":["../../../../src/services/attachment/attachment_detachment_service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,oBAAoB,IAAI,kCAAkC,EAAE,MAAM,wBAAwB,CAAA;AAIxG,qBAAa,2BAA2B;;IACtC;;OAEG;IACG,MAAM,CAAC,MAAM,EAAE,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC;IAyCvE;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,kCAAkC,GAAG,OAAO,CAAC,IAAI,CAAC;CAgC3E"}
|