@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,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import crypto from 'node:crypto';
|
|
8
|
-
import os from 'node:os';
|
|
9
|
-
import path from 'node:path';
|
|
10
|
-
import https from 'node:https';
|
|
11
|
-
import fs from 'node:fs/promises';
|
|
12
|
-
import { pipeline } from 'node:stream';
|
|
13
|
-
import { promisify } from 'node:util';
|
|
14
|
-
import { createWriteStream } from 'node:fs';
|
|
15
|
-
import BlurhashAdapter from '../adapters/blurhash.js';
|
|
16
|
-
import * as errors from '../errors.js';
|
|
17
|
-
const streamPipeline = promisify(pipeline);
|
|
18
|
-
export function cleanObject(obj) {
|
|
19
|
-
if (obj === null || typeof obj !== 'object') {
|
|
20
|
-
return obj;
|
|
21
|
-
}
|
|
22
|
-
const cleanedObj = Array.isArray(obj) ? [] : {};
|
|
23
|
-
for (const key in obj) {
|
|
24
|
-
if (obj.hasOwnProperty(key)) {
|
|
25
|
-
const cleanedValue = cleanObject(obj[key]);
|
|
26
|
-
if (cleanedValue !== null &&
|
|
27
|
-
cleanedValue !== undefined &&
|
|
28
|
-
cleanedValue !== 0 &&
|
|
29
|
-
cleanedValue !== '') {
|
|
30
|
-
cleanedObj[key] = cleanedValue;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return cleanedObj;
|
|
35
|
-
}
|
|
36
|
-
export async function use(module) {
|
|
37
|
-
try {
|
|
38
|
-
const result = await import(module);
|
|
39
|
-
if (result.default) {
|
|
40
|
-
return result.default;
|
|
41
|
-
}
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
throw new errors.E_MISSING_PACKAGE([module], { cause: err });
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
export async function bufferToTempFile(input) {
|
|
49
|
-
const folder = os.tmpdir();
|
|
50
|
-
const tempFilePath = path.join(folder, `tempfile-${Date.now()}.tmp`);
|
|
51
|
-
await fs.writeFile(tempFilePath, input);
|
|
52
|
-
return tempFilePath;
|
|
53
|
-
}
|
|
54
|
-
export async function streamToTempFile(input) {
|
|
55
|
-
const folder = os.tmpdir();
|
|
56
|
-
const tempFilePath = path.join(folder, `tempfile-${Date.now()}.tmp`);
|
|
57
|
-
const writeStream = createWriteStream(tempFilePath);
|
|
58
|
-
try {
|
|
59
|
-
await streamPipeline(input, writeStream);
|
|
60
|
-
return tempFilePath;
|
|
61
|
-
}
|
|
62
|
-
catch (err) {
|
|
63
|
-
throw new errors.E_CANNOT_GENERATE_TEMP_FILE([err.message]);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
export async function downloadToTempFile(input) {
|
|
67
|
-
return await new Promise((resolve) => {
|
|
68
|
-
https
|
|
69
|
-
.get(input, (response) => {
|
|
70
|
-
if (response.statusCode === 200) {
|
|
71
|
-
resolve(streamToTempFile(response));
|
|
72
|
-
}
|
|
73
|
-
else {
|
|
74
|
-
// reject(`${response.statusCode}`)
|
|
75
|
-
throw new errors.E_CANNOT_GENERATE_TEMP_FILE(['']);
|
|
76
|
-
}
|
|
77
|
-
})
|
|
78
|
-
.on('error', (err) => {
|
|
79
|
-
throw new errors.E_CANNOT_GENERATE_TEMP_FILE([err.message]);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
export function isBase64(str) {
|
|
84
|
-
const base64Regex = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/;
|
|
85
|
-
if (!base64Regex.test(str)) {
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
try {
|
|
89
|
-
Buffer.from(str, 'base64').toString();
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
catch (err) {
|
|
93
|
-
return false;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
export function imageToBlurhash(input, options) {
|
|
97
|
-
const { componentX, componentY } = options || { componentX: 4, componentY: 4 };
|
|
98
|
-
return new Promise(async (resolve, reject) => {
|
|
99
|
-
try {
|
|
100
|
-
const sharp = await use('sharp');
|
|
101
|
-
// Convert input to pixels
|
|
102
|
-
const { data: pixels, info: metadata } = await sharp(input)
|
|
103
|
-
.raw()
|
|
104
|
-
.ensureAlpha()
|
|
105
|
-
.toBuffer({ resolveWithObject: true });
|
|
106
|
-
const blurhash = BlurhashAdapter.encode(new Uint8ClampedArray(pixels), metadata.width, metadata.height, componentX, componentY);
|
|
107
|
-
return resolve(blurhash);
|
|
108
|
-
}
|
|
109
|
-
catch (error) {
|
|
110
|
-
return reject(error);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
export function extractPathParameters(path) {
|
|
115
|
-
const paramRegex = /:(\w+)/g;
|
|
116
|
-
const parameters = [];
|
|
117
|
-
let match;
|
|
118
|
-
while ((match = paramRegex.exec(path)) !== null) {
|
|
119
|
-
parameters.push(match[1]);
|
|
120
|
-
}
|
|
121
|
-
return parameters;
|
|
122
|
-
}
|
|
123
|
-
export function secondsToTimeFormat(seconds) {
|
|
124
|
-
const hours = Math.floor(seconds / 3600);
|
|
125
|
-
const minutes = Math.floor((seconds % 3600) / 60);
|
|
126
|
-
const remainingSeconds = Math.floor(seconds % 60);
|
|
127
|
-
return `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${remainingSeconds.toString().padStart(2, '0')}`;
|
|
128
|
-
}
|
|
129
|
-
export function uuid() {
|
|
130
|
-
return crypto.randomUUID();
|
|
131
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
export declare const afterFindHook: (instance: unknown) => Promise<void>;
|
|
8
|
-
export declare const afterFetchHook: (instance: unknown) => Promise<void>;
|
|
9
|
-
export declare const beforeSaveHook: (instance: unknown) => Promise<void>;
|
|
10
|
-
export declare const afterSaveHook: (instance: unknown) => Promise<void>;
|
|
11
|
-
export declare const beforeDeleteHook: (instance: unknown) => Promise<void>;
|
|
12
|
-
//# sourceMappingURL=hooks.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/utils/hooks.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,eAAO,MAAM,aAAa,GAAU,UAAU,OAAO,kBAKpD,CAAA;AAID,eAAO,MAAM,cAAc,GAAU,UAAU,OAAO,kBAGrD,CAAA;AAGD,eAAO,MAAM,cAAc,GAAU,UAAU,OAAO,kBAMrD,CAAA;AAGD,eAAO,MAAM,aAAa,GAAU,UAAU,OAAO,kBAKpD,CAAA;AAGD,eAAO,MAAM,gBAAgB,GAAU,UAAU,OAAO,kBAKvD,CAAA"}
|
package/build/src/utils/hooks.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @jrmc/adonis-attachment
|
|
3
|
-
*
|
|
4
|
-
* @license MIT
|
|
5
|
-
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
-
*/
|
|
7
|
-
import AttachmentRecordService from '../services/attachment_service.js';
|
|
8
|
-
// @afterFind()
|
|
9
|
-
export const afterFindHook = async (instance) => {
|
|
10
|
-
const modelInstance = instance;
|
|
11
|
-
const model = new AttachmentRecordService(modelInstance);
|
|
12
|
-
await model.setKeyId();
|
|
13
|
-
await model.preComputeUrl();
|
|
14
|
-
};
|
|
15
|
-
// @afterFetch()
|
|
16
|
-
// @afterPaginate()
|
|
17
|
-
export const afterFetchHook = async (instance) => {
|
|
18
|
-
const modelInstances = instance;
|
|
19
|
-
await Promise.all(modelInstances.map((row) => afterFindHook(row)));
|
|
20
|
-
};
|
|
21
|
-
// @beforeSave()
|
|
22
|
-
export const beforeSaveHook = async (instance) => {
|
|
23
|
-
const modelInstance = instance;
|
|
24
|
-
const model = new AttachmentRecordService(modelInstance);
|
|
25
|
-
await model.detach();
|
|
26
|
-
await model.persist();
|
|
27
|
-
await model.transaction();
|
|
28
|
-
};
|
|
29
|
-
// @afterSave()
|
|
30
|
-
export const afterSaveHook = async (instance) => {
|
|
31
|
-
const modelInstance = instance;
|
|
32
|
-
const model = new AttachmentRecordService(modelInstance);
|
|
33
|
-
await model.generateVariants();
|
|
34
|
-
await model.setKeyId();
|
|
35
|
-
};
|
|
36
|
-
// @beforeDelete()
|
|
37
|
-
export const beforeDeleteHook = async (instance) => {
|
|
38
|
-
const modelInstance = instance;
|
|
39
|
-
const model = new AttachmentRecordService(modelInstance);
|
|
40
|
-
await model.detachAll();
|
|
41
|
-
await model.transaction({ enabledRollback: false });
|
|
42
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"symbols.d.ts","sourceRoot":"","sources":["../../../src/utils/symbols.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,eAAO,MAAM,UAAU,eAA+B,CAAA"}
|
package/build/stubs/config.stub
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
{{{
|
|
2
|
-
exports({ to: app.configPath('attachment.ts') })
|
|
3
|
-
}}}
|
|
4
|
-
import type { InferConverters } from '@jrmc/adonis-attachment/types/config'
|
|
5
|
-
import { defineConfig } from '@jrmc/adonis-attachment'
|
|
6
|
-
// import sharp from 'sharp'
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Documentation: https://adonis-attachment.jrmc.dev/guide/essentials/configuration
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const attachmentConfig = defineConfig({
|
|
13
|
-
/**
|
|
14
|
-
* Enable the preComputeUrl flag to pre compute the URLs after SELECT queries. (default: false)
|
|
15
|
-
*/
|
|
16
|
-
// preComputeUrl: true,
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Enable the meta informations after upload. (default: false)
|
|
20
|
-
*/
|
|
21
|
-
// meta: true,
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Enable file rename after upload. (default: true)
|
|
25
|
-
*/
|
|
26
|
-
// rename: false,
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Specify binary path
|
|
30
|
-
*/
|
|
31
|
-
// bin: { // [!code focus:8]
|
|
32
|
-
// ffmpegPath: 'ffmpeg_path', // the full path of the binary
|
|
33
|
-
// ffprobePath: 'ffprobe_path', // the full path of the binary
|
|
34
|
-
// pdftoppmPath: 'pdftoppm_path' // the full path of the binary
|
|
35
|
-
// pdfinfoPath: 'pdfinfo_path' // the full path of the binary
|
|
36
|
-
// sofficePath: 'soffice_path', // the full path of the binary (libreoffice/openoffice)
|
|
37
|
-
// },
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Queue configuration for file processing.
|
|
41
|
-
* By default, 1 task is processed concurrently. A task corresponds to a model attribute.
|
|
42
|
-
* For example, if a model has a logo attribute and an avatar attribute,
|
|
43
|
-
* this represents 2 tasks, regardless of the number of concerts per attribute.
|
|
44
|
-
*
|
|
45
|
-
* Increasing concurrency can improve performance but consumes more resources.
|
|
46
|
-
* A value too high may lead to memory or CPU issues.
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
// queue: {
|
|
50
|
-
// concurrency: 2
|
|
51
|
-
// },
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Maximum duration (in milliseconds) that an operation can take before being interrupted.
|
|
55
|
-
* Default: 30_000 (30 seconds)
|
|
56
|
-
*
|
|
57
|
-
* This timeout applies to each individual operation conversion.
|
|
58
|
-
* If an operation exceeds this time limit, it will be interrupted and an error will be thrown.
|
|
59
|
-
*
|
|
60
|
-
* Increase this value if you're processing large files or if your operations
|
|
61
|
-
* require more time (e.g., long video conversion).
|
|
62
|
-
*
|
|
63
|
-
*/
|
|
64
|
-
// timeout: 40_000,
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Configure how variants are stored relative to the original file.
|
|
68
|
-
*
|
|
69
|
-
* - 'basePath': Define a custom base path where all variants will be stored.
|
|
70
|
-
* By default, variants are stored in the same folder as the original file.
|
|
71
|
-
*
|
|
72
|
-
* - 'ignoreFolder': When set to 'true', the variant will not include the parent
|
|
73
|
-
* folder from the original attachment.
|
|
74
|
-
*/
|
|
75
|
-
// variant: {
|
|
76
|
-
// basePath: 'variants',
|
|
77
|
-
// ignoreFolder: true,
|
|
78
|
-
// },
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
*
|
|
82
|
-
*/
|
|
83
|
-
converters: {
|
|
84
|
-
thumbnail: {
|
|
85
|
-
/**
|
|
86
|
-
* optional converter
|
|
87
|
-
* default : @jrmc/adonis-attachment/converters/autodetect_converter
|
|
88
|
-
* image : @jrmc/adonis-attachment/converters/image_converter
|
|
89
|
-
* pdf : @jrmc/adonis-attachment/converters/pdf_thumbnail_converter
|
|
90
|
-
* document : @jrmc/adonis-attachment/converters/document_thumbnail_converter
|
|
91
|
-
* video : @jrmc/adonis-attachment/converters/video_thumbnail_converter
|
|
92
|
-
* create your custom converter : https://adonis-attachment.jrmc.dev/guide/advanced_usage/custom-converter
|
|
93
|
-
*/
|
|
94
|
-
// converter: () => import('@jrmc/adonis-attachment/converters/autodetect_converter'),
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
*
|
|
98
|
-
* https://sharp.pixelplumbing.com/api-resize/
|
|
99
|
-
*/
|
|
100
|
-
resize: 300,
|
|
101
|
-
|
|
102
|
-
// resize: { // https://sharp.pixelplumbing.com/api-resize
|
|
103
|
-
// width: 400,
|
|
104
|
-
// height: 400,
|
|
105
|
-
// fit: sharp.fit.cover,
|
|
106
|
-
// position: 'top'
|
|
107
|
-
// },
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
*
|
|
111
|
-
* https://sharp.pixelplumbing.com/api-output/#toformat
|
|
112
|
-
*/
|
|
113
|
-
// format: 'jpeg',
|
|
114
|
-
// format: {
|
|
115
|
-
// format: 'jpeg',
|
|
116
|
-
// options: {
|
|
117
|
-
// quality: 80
|
|
118
|
-
// }
|
|
119
|
-
// }
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
*
|
|
123
|
-
* https://sharp.pixelplumbing.com/api-operation/#autoorient
|
|
124
|
-
*/
|
|
125
|
-
// autoOrient: false,
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* generation of blurhashes (default: true)
|
|
129
|
-
* https://blurha.sh/
|
|
130
|
-
*/
|
|
131
|
-
// blurhash: true,
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
export default attachmentConfig
|
|
137
|
-
|
|
138
|
-
declare module '@jrmc/adonis-attachment' {
|
|
139
|
-
interface AttachmentVariants extends InferConverters<typeof attachmentConfig> {}
|
|
140
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{{#var entity = generators.createEntity(name)}}
|
|
2
|
-
{{#var modelConverterName = string(entity.name).removeSuffix('converter').pascalCase().suffix(string.pascalCase('converter')).toString()}}
|
|
3
|
-
{{#var modelConverterFileName = string(entity.name).snakeCase().suffix('_converter').ext('.ts').toString()}}
|
|
4
|
-
{{{
|
|
5
|
-
exports({ to: app.makePath('app/converters', entity.path, modelConverterFileName) })
|
|
6
|
-
}}}
|
|
7
|
-
|
|
8
|
-
import type { ConverterAttributes } from '@jrmc/adonis-attachment/types/converter'
|
|
9
|
-
import type { Input } from '@jrmc/adonis-attachment/types/input'
|
|
10
|
-
|
|
11
|
-
import logger from '@adonisjs/core/services/logger'
|
|
12
|
-
import Converter from '@jrmc/adonis-attachment/converters/converter'
|
|
13
|
-
|
|
14
|
-
export default class {{ modelConverterName }} extends Converter {
|
|
15
|
-
async handle({ input }: ConverterAttributes): Promise<Input> {
|
|
16
|
-
logger.info('Input path %s', input)
|
|
17
|
-
|
|
18
|
-
return input
|
|
19
|
-
}
|
|
20
|
-
}
|