@jrmc/adonis-attachment 6.0.0-alpha.1 → 6.0.0-alpha.3
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/build/commands/commands.json +1 -1
- package/build/commands/make/attachment_v5_migration.d.ts.map +1 -1
- package/build/commands/make/attachment_v5_migration.js +6 -3
- package/build/commands/make/attachment_v5_migration.js.map +1 -1
- package/build/commands/make/attachments_table.d.ts.map +1 -1
- package/build/commands/make/attachments_table.js +8 -2
- package/build/commands/make/attachments_table.js.map +1 -1
- package/build/commands/make/converter.d.ts +17 -0
- package/build/commands/make/converter.d.ts.map +1 -0
- package/build/commands/make/converter.js +27 -0
- package/build/commands/make/converter.js.map +1 -0
- package/build/index.d.ts +12 -6
- package/build/index.d.ts.map +1 -1
- package/build/index.js +3 -5
- package/build/index.js.map +1 -1
- package/build/providers/attachment_provider.d.ts.map +1 -1
- package/build/providers/attachment_provider.js +36 -1
- package/build/providers/attachment_provider.js.map +1 -1
- package/build/services/converters.d.ts +10 -0
- package/build/services/converters.d.ts.map +1 -0
- package/build/services/converters.js +17 -0
- package/build/services/converters.js.map +1 -0
- package/build/src/adapters/adonis_drive_storage.d.ts.map +1 -1
- package/build/src/adapters/adonis_drive_storage.js +4 -1
- package/build/src/adapters/adonis_drive_storage.js.map +1 -1
- package/build/src/adapters/local_file_storage.d.ts.map +1 -1
- package/build/src/adapters/local_file_storage.js +9 -2
- package/build/src/adapters/local_file_storage.js.map +1 -1
- package/build/src/converters/autodetect_converter.d.ts +24 -0
- package/build/src/converters/autodetect_converter.d.ts.map +1 -0
- package/build/src/converters/autodetect_converter.js +113 -0
- package/build/src/converters/autodetect_converter.js.map +1 -0
- package/build/src/converters/configured_variant_converter_registry.d.ts +36 -0
- package/build/src/converters/configured_variant_converter_registry.d.ts.map +1 -0
- package/build/src/converters/configured_variant_converter_registry.js +81 -0
- package/build/src/converters/configured_variant_converter_registry.js.map +1 -0
- package/build/src/converters/converter.d.ts +148 -0
- package/build/src/converters/converter.d.ts.map +1 -0
- package/build/src/converters/converter.js +24 -0
- package/build/src/converters/converter.js.map +1 -0
- package/build/src/core/attachment.d.ts +7 -3
- package/build/src/core/attachment.d.ts.map +1 -1
- package/build/src/core/attachment.js +29 -4
- package/build/src/core/attachment.js.map +1 -1
- package/build/src/core/attachment_job_processor.d.ts +17 -1
- package/build/src/core/attachment_job_processor.d.ts.map +1 -1
- package/build/src/core/attachment_job_processor.js +81 -8
- package/build/src/core/attachment_job_processor.js.map +1 -1
- package/build/src/core/attachment_metadata_persister.d.ts +13 -0
- package/build/src/core/attachment_metadata_persister.d.ts.map +1 -0
- package/build/{tests/create_legacy_attachment_migration_script.spec.d.ts → src/core/attachment_metadata_persister.js} +1 -1
- package/build/src/core/attachment_metadata_persister.js.map +1 -0
- package/build/src/core/attachment_options.d.ts +3 -2
- package/build/src/core/attachment_options.d.ts.map +1 -1
- package/build/src/core/attachment_options.js.map +1 -1
- package/build/src/core/attachment_service.d.ts +24 -1
- package/build/src/core/attachment_service.d.ts.map +1 -1
- package/build/src/core/attachment_service.js +95 -4
- package/build/src/core/attachment_service.js.map +1 -1
- package/build/src/core/index.d.ts +9 -2
- package/build/src/core/index.d.ts.map +1 -1
- package/build/src/core/index.js +8 -2
- package/build/src/core/index.js.map +1 -1
- package/build/src/core/queue.d.ts +11 -1
- package/build/src/core/queue.d.ts.map +1 -1
- package/build/src/define_config.d.ts +40 -3
- package/build/src/define_config.d.ts.map +1 -1
- package/build/src/define_config.js +43 -1
- package/build/src/define_config.js.map +1 -1
- package/build/src/errors.d.ts +57 -0
- package/build/src/errors.d.ts.map +1 -0
- package/build/src/errors.js +96 -0
- package/build/src/errors.js.map +1 -0
- package/build/src/events/adonis_attachment_event_emitter.d.ts +17 -0
- package/build/src/events/adonis_attachment_event_emitter.d.ts.map +1 -0
- package/build/src/events/adonis_attachment_event_emitter.js +17 -0
- package/build/src/events/adonis_attachment_event_emitter.js.map +1 -0
- package/build/src/events/attachment_events.d.ts +43 -0
- package/build/src/events/attachment_events.d.ts.map +1 -0
- package/build/src/events/attachment_events.js +32 -0
- package/build/src/events/attachment_events.js.map +1 -0
- package/build/src/integrations/lucid/{attachment_column.d.ts → column/attachment_column.d.ts} +2 -2
- package/build/src/integrations/lucid/column/attachment_column.d.ts.map +1 -0
- package/build/src/integrations/lucid/{attachment_column.js → column/attachment_column.js} +2 -2
- package/build/src/integrations/lucid/column/attachment_column.js.map +1 -0
- package/build/src/integrations/lucid/index.d.ts +17 -13
- package/build/src/integrations/lucid/index.d.ts.map +1 -1
- package/build/src/integrations/lucid/index.js +17 -13
- package/build/src/integrations/lucid/index.js.map +1 -1
- package/build/src/integrations/lucid/migrations/legacy/legacy_attachment_migration_stub.d.ts +20 -0
- package/build/src/integrations/lucid/migrations/legacy/legacy_attachment_migration_stub.d.ts.map +1 -0
- package/build/src/integrations/lucid/migrations/legacy/legacy_attachment_migration_stub.js +18 -0
- package/build/src/integrations/lucid/migrations/legacy/legacy_attachment_migration_stub.js.map +1 -0
- package/build/src/integrations/lucid/{migrate_legacy_attachment.d.ts → migrations/legacy/migrate_legacy_attachment.d.ts} +22 -10
- package/build/src/integrations/lucid/migrations/legacy/migrate_legacy_attachment.d.ts.map +1 -0
- package/build/src/integrations/lucid/{migrate_legacy_attachment.js → migrations/legacy/migrate_legacy_attachment.js} +35 -25
- package/build/src/integrations/lucid/migrations/legacy/migrate_legacy_attachment.js.map +1 -0
- package/build/src/integrations/lucid/{migrate_legacy_attachment_records.d.ts → migrations/legacy/migrate_legacy_attachment_records.d.ts} +3 -3
- package/build/src/integrations/lucid/migrations/legacy/migrate_legacy_attachment_records.d.ts.map +1 -0
- package/build/src/integrations/lucid/{migrate_legacy_attachment_records.js → migrations/legacy/migrate_legacy_attachment_records.js} +11 -7
- package/build/src/integrations/lucid/migrations/legacy/migrate_legacy_attachment_records.js.map +1 -0
- package/build/src/integrations/lucid/models/attachment_link_model.d.ts +30 -0
- package/build/src/integrations/lucid/models/attachment_link_model.d.ts.map +1 -0
- package/build/src/integrations/lucid/models/attachment_link_model.js +59 -0
- package/build/src/integrations/lucid/models/attachment_link_model.js.map +1 -0
- package/build/src/integrations/lucid/{attachment_model.d.ts → models/attachment_model.d.ts} +5 -8
- package/build/src/integrations/lucid/models/attachment_model.d.ts.map +1 -0
- package/build/src/integrations/lucid/{attachment_model.js → models/attachment_model.js} +5 -16
- package/build/src/integrations/lucid/models/attachment_model.js.map +1 -0
- package/build/src/integrations/lucid/{lucid_attachment_lifecycle_service.d.ts → persistence/lucid_attachment_lifecycle_service.d.ts} +18 -14
- package/build/src/integrations/lucid/persistence/lucid_attachment_lifecycle_service.d.ts.map +1 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_lifecycle_service.js +252 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_lifecycle_service.js.map +1 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_metadata_persister.d.ts +17 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_metadata_persister.d.ts.map +1 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_metadata_persister.js +18 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_metadata_persister.js.map +1 -0
- package/build/src/integrations/lucid/{lucid_attachment_repository.d.ts → persistence/lucid_attachment_repository.d.ts} +3 -3
- package/build/src/integrations/lucid/persistence/lucid_attachment_repository.d.ts.map +1 -0
- package/build/src/integrations/lucid/{lucid_attachment_repository.js → persistence/lucid_attachment_repository.js} +1 -1
- package/build/src/integrations/lucid/persistence/lucid_attachment_repository.js.map +1 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_store.d.ts +48 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_store.d.ts.map +1 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_store.js +226 -0
- package/build/src/integrations/lucid/persistence/lucid_attachment_store.js.map +1 -0
- package/build/src/integrations/lucid/{lucid_variant_generation_service.d.ts → persistence/lucid_variant_generation_service.d.ts} +8 -5
- package/build/src/integrations/lucid/persistence/lucid_variant_generation_service.d.ts.map +1 -0
- package/build/src/integrations/lucid/{lucid_variant_generation_service.js → persistence/lucid_variant_generation_service.js} +9 -3
- package/build/src/integrations/lucid/persistence/lucid_variant_generation_service.js.map +1 -0
- package/build/src/integrations/lucid/relations/attachment_owner.d.ts.map +1 -0
- package/build/src/integrations/lucid/relations/attachment_owner.js.map +1 -0
- package/build/src/integrations/lucid/{attachment_relation.d.ts → relations/attachment_relation.d.ts} +29 -15
- package/build/src/integrations/lucid/relations/attachment_relation.d.ts.map +1 -0
- package/build/src/integrations/lucid/relations/attachment_relation.js +273 -0
- package/build/src/integrations/lucid/relations/attachment_relation.js.map +1 -0
- package/build/src/integrations/lucid/schema/attachment_schema_service.d.ts +28 -0
- package/build/src/integrations/lucid/schema/attachment_schema_service.d.ts.map +1 -0
- package/build/src/integrations/lucid/schema/attachment_schema_service.js +81 -0
- package/build/src/integrations/lucid/schema/attachment_schema_service.js.map +1 -0
- package/build/src/integrations/lucid/schema/attachment_table_names.d.ts +15 -0
- package/build/src/integrations/lucid/schema/attachment_table_names.d.ts.map +1 -0
- package/build/src/integrations/lucid/schema/attachment_table_names.js +23 -0
- package/build/src/integrations/lucid/schema/attachment_table_names.js.map +1 -0
- package/build/src/integrations/lucid/schema/attachments_table_stub.d.ts.map +1 -0
- package/build/src/integrations/lucid/{attachments_table_stub.js → schema/attachments_table_stub.js} +2 -4
- package/build/src/integrations/lucid/schema/attachments_table_stub.js.map +1 -0
- package/build/src/integrations/lucid/schema/configure_lucid_attachment_tables.d.ts +12 -0
- package/build/src/integrations/lucid/schema/configure_lucid_attachment_tables.d.ts.map +1 -0
- package/build/src/integrations/lucid/schema/configure_lucid_attachment_tables.js +19 -0
- package/build/src/integrations/lucid/schema/configure_lucid_attachment_tables.js.map +1 -0
- package/build/src/media/binaries.d.ts +79 -0
- package/build/src/media/binaries.d.ts.map +1 -0
- package/build/src/media/binaries.js +288 -0
- package/build/src/media/binaries.js.map +1 -0
- package/build/src/media/blurhash.d.ts +48 -0
- package/build/src/media/blurhash.d.ts.map +1 -0
- package/build/src/media/blurhash.js +46 -0
- package/build/src/media/blurhash.js.map +1 -0
- package/build/src/media/exif.d.ts +23 -0
- package/build/src/media/exif.d.ts.map +1 -0
- package/build/src/media/exif.js +98 -0
- package/build/src/media/exif.js.map +1 -0
- package/build/src/media/media_metadata.d.ts +55 -0
- package/build/src/media/media_metadata.d.ts.map +1 -0
- package/build/src/media/media_metadata.js +27 -0
- package/build/src/media/media_metadata.js.map +1 -0
- package/build/src/media/sharp.d.ts +45 -0
- package/build/src/media/sharp.d.ts.map +1 -0
- package/build/src/media/sharp.js +76 -0
- package/build/src/media/sharp.js.map +1 -0
- package/build/src/media/v5_metadata.d.ts +20 -0
- package/build/src/media/v5_metadata.d.ts.map +1 -0
- package/build/src/media/v5_metadata.js +20 -0
- package/build/src/media/v5_metadata.js.map +1 -0
- package/build/src/queues/memory_queue.d.ts.map +1 -1
- package/build/src/queues/memory_queue.js +4 -1
- package/build/src/queues/memory_queue.js.map +1 -1
- package/build/src/sources/attachment_manager.d.ts +1 -3
- package/build/src/sources/attachment_manager.d.ts.map +1 -1
- package/build/src/sources/attachment_manager.js +19 -12
- package/build/src/sources/attachment_manager.js.map +1 -1
- package/build/src/variants/variant_converter.d.ts +4 -1
- package/build/src/variants/variant_converter.d.ts.map +1 -1
- package/build/src/variants/variant_generation_service.d.ts +9 -3
- package/build/src/variants/variant_generation_service.d.ts.map +1 -1
- package/build/src/variants/variant_generation_service.js +47 -6
- package/build/src/variants/variant_generation_service.js.map +1 -1
- package/build/stubs/config/attachment.stub +23 -2
- package/build/stubs/converters/converter.stub +18 -0
- package/build/stubs/migrations/attachments_table.stub +7 -25
- package/build/{src/integrations/lucid/render_legacy_attachment_migration_script.js → stubs/migrations/legacy_attachment_migration.stub} +13 -15
- package/build/tests/adonis_queue.spec.js +56 -1
- package/build/tests/adonis_queue.spec.js.map +1 -1
- package/build/tests/attachment_events.spec.d.ts +8 -0
- package/build/tests/attachment_events.spec.d.ts.map +1 -0
- package/build/tests/attachment_events.spec.js +65 -0
- package/build/tests/attachment_events.spec.js.map +1 -0
- package/build/tests/attachment_job_processor.spec.js +77 -2
- package/build/tests/attachment_job_processor.spec.js.map +1 -1
- package/build/tests/attachment_provider.spec.js +84 -1
- package/build/tests/attachment_provider.spec.js.map +1 -1
- package/build/tests/attachment_schema_service.spec.d.ts +8 -0
- package/build/tests/attachment_schema_service.spec.d.ts.map +1 -0
- package/build/tests/attachment_schema_service.spec.js +52 -0
- package/build/tests/attachment_schema_service.spec.js.map +1 -0
- package/build/tests/attachment_service.spec.js +81 -2
- package/build/tests/attachment_service.spec.js.map +1 -1
- package/build/tests/attachment_table_names.spec.d.ts +8 -0
- package/build/tests/attachment_table_names.spec.d.ts.map +1 -0
- package/build/tests/attachment_table_names.spec.js +36 -0
- package/build/tests/attachment_table_names.spec.js.map +1 -0
- package/build/tests/attachments_table_stub.spec.js +41 -6
- package/build/tests/attachments_table_stub.spec.js.map +1 -1
- package/build/tests/autodetect_converter.spec.d.ts +8 -0
- package/build/tests/autodetect_converter.spec.d.ts.map +1 -0
- package/build/tests/autodetect_converter.spec.js +55 -0
- package/build/tests/autodetect_converter.spec.js.map +1 -0
- package/build/tests/binary_media.spec.d.ts +8 -0
- package/build/tests/binary_media.spec.d.ts.map +1 -0
- package/build/tests/binary_media.spec.js +106 -0
- package/build/tests/binary_media.spec.js.map +1 -0
- package/build/tests/blurhash_media.spec.d.ts +8 -0
- package/build/tests/blurhash_media.spec.d.ts.map +1 -0
- package/build/tests/blurhash_media.spec.js +40 -0
- package/build/tests/blurhash_media.spec.js.map +1 -0
- package/build/tests/configure.spec.js +1 -0
- package/build/tests/configure.spec.js.map +1 -1
- package/build/tests/configured_variant_converter_registry.spec.d.ts +8 -0
- package/build/tests/configured_variant_converter_registry.spec.d.ts.map +1 -0
- package/build/tests/configured_variant_converter_registry.spec.js +73 -0
- package/build/tests/configured_variant_converter_registry.spec.js.map +1 -0
- package/build/tests/converter_config.types.d.ts +36 -0
- package/build/tests/converter_config.types.d.ts.map +1 -0
- package/build/tests/converter_config.types.js +60 -0
- package/build/tests/converter_config.types.js.map +1 -0
- package/build/tests/define_config.spec.js +113 -0
- package/build/tests/define_config.spec.js.map +1 -1
- package/build/tests/errors.spec.d.ts +8 -0
- package/build/tests/errors.spec.d.ts.map +1 -0
- package/build/tests/errors.spec.js +43 -0
- package/build/tests/errors.spec.js.map +1 -0
- package/build/tests/exif_media.spec.d.ts +8 -0
- package/build/tests/exif_media.spec.d.ts.map +1 -0
- package/build/tests/exif_media.spec.js +50 -0
- package/build/tests/exif_media.spec.js.map +1 -0
- package/build/tests/helpers/lucid_test_database.d.ts.map +1 -1
- package/build/tests/helpers/lucid_test_database.js +17 -7
- package/build/tests/helpers/lucid_test_database.js.map +1 -1
- package/build/tests/legacy_attachment_migration_stub.spec.d.ts +8 -0
- package/build/tests/legacy_attachment_migration_stub.spec.d.ts.map +1 -0
- package/build/tests/legacy_attachment_migration_stub.spec.js +57 -0
- package/build/tests/legacy_attachment_migration_stub.spec.js.map +1 -0
- package/build/tests/lucid_attachment_collection_store.spec.js +5 -4
- package/build/tests/lucid_attachment_collection_store.spec.js.map +1 -1
- package/build/tests/lucid_attachment_column.spec.js +1 -1
- package/build/tests/lucid_attachment_column.spec.js.map +1 -1
- package/build/tests/lucid_attachment_lifecycle_service.spec.js +144 -256
- package/build/tests/lucid_attachment_lifecycle_service.spec.js.map +1 -1
- package/build/tests/lucid_attachment_metadata_persister.spec.d.ts +8 -0
- package/build/tests/lucid_attachment_metadata_persister.spec.d.ts.map +1 -0
- package/build/tests/lucid_attachment_metadata_persister.spec.js +34 -0
- package/build/tests/lucid_attachment_metadata_persister.spec.js.map +1 -0
- package/build/tests/lucid_attachment_relation.spec.js +167 -27
- package/build/tests/lucid_attachment_relation.spec.js.map +1 -1
- package/build/tests/lucid_attachment_repository.spec.js +1 -1
- package/build/tests/lucid_attachment_repository.spec.js.map +1 -1
- package/build/tests/lucid_attachment_store.spec.js +24 -52
- package/build/tests/lucid_attachment_store.spec.js.map +1 -1
- package/build/tests/lucid_sqlite_integration.spec.js +24 -18
- package/build/tests/lucid_sqlite_integration.spec.js.map +1 -1
- package/build/tests/lucid_variant_generation_service.spec.js +18 -1
- package/build/tests/lucid_variant_generation_service.spec.js.map +1 -1
- package/build/tests/make_converter.spec.d.ts +8 -0
- package/build/tests/make_converter.spec.d.ts.map +1 -0
- package/build/tests/make_converter.spec.js +32 -0
- package/build/tests/make_converter.spec.js.map +1 -0
- package/build/tests/media_metadata.spec.d.ts +8 -0
- package/build/tests/media_metadata.spec.d.ts.map +1 -0
- package/build/tests/media_metadata.spec.js +51 -0
- package/build/tests/media_metadata.spec.js.map +1 -0
- package/build/tests/migrate_legacy_attachment.spec.js +62 -47
- package/build/tests/migrate_legacy_attachment.spec.js.map +1 -1
- package/build/tests/migrate_legacy_attachment_records.spec.js +4 -3
- package/build/tests/migrate_legacy_attachment_records.spec.js.map +1 -1
- package/build/tests/package_exports.spec.js +18 -2
- package/build/tests/package_exports.spec.js.map +1 -1
- package/build/tests/sharp_media.spec.d.ts +8 -0
- package/build/tests/sharp_media.spec.d.ts.map +1 -0
- package/build/tests/sharp_media.spec.js +84 -0
- package/build/tests/sharp_media.spec.js.map +1 -0
- package/build/tests/v5_metadata.spec.d.ts +8 -0
- package/build/tests/v5_metadata.spec.d.ts.map +1 -0
- package/build/tests/v5_metadata.spec.js +19 -0
- package/build/tests/v5_metadata.spec.js.map +1 -0
- package/build/tests/variant_generation_service.spec.js +122 -0
- package/build/tests/variant_generation_service.spec.js.map +1 -1
- package/package.json +50 -2
- package/build/src/integrations/lucid/attachment_column.d.ts.map +0 -1
- package/build/src/integrations/lucid/attachment_column.js.map +0 -1
- package/build/src/integrations/lucid/attachment_model.d.ts.map +0 -1
- package/build/src/integrations/lucid/attachment_model.js.map +0 -1
- package/build/src/integrations/lucid/attachment_owner.d.ts.map +0 -1
- package/build/src/integrations/lucid/attachment_owner.js.map +0 -1
- package/build/src/integrations/lucid/attachment_relation.d.ts.map +0 -1
- package/build/src/integrations/lucid/attachment_relation.js +0 -163
- package/build/src/integrations/lucid/attachment_relation.js.map +0 -1
- package/build/src/integrations/lucid/attachments_table_stub.d.ts.map +0 -1
- package/build/src/integrations/lucid/attachments_table_stub.js.map +0 -1
- package/build/src/integrations/lucid/create_legacy_attachment_migration_script.d.ts +0 -13
- package/build/src/integrations/lucid/create_legacy_attachment_migration_script.d.ts.map +0 -1
- package/build/src/integrations/lucid/create_legacy_attachment_migration_script.js +0 -20
- package/build/src/integrations/lucid/create_legacy_attachment_migration_script.js.map +0 -1
- package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.d.ts.map +0 -1
- package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.js +0 -188
- package/build/src/integrations/lucid/lucid_attachment_lifecycle_service.js.map +0 -1
- package/build/src/integrations/lucid/lucid_attachment_repository.d.ts.map +0 -1
- package/build/src/integrations/lucid/lucid_attachment_repository.js.map +0 -1
- package/build/src/integrations/lucid/lucid_attachment_store.d.ts +0 -36
- package/build/src/integrations/lucid/lucid_attachment_store.d.ts.map +0 -1
- package/build/src/integrations/lucid/lucid_attachment_store.js +0 -179
- package/build/src/integrations/lucid/lucid_attachment_store.js.map +0 -1
- package/build/src/integrations/lucid/lucid_variant_generation_service.d.ts.map +0 -1
- package/build/src/integrations/lucid/lucid_variant_generation_service.js.map +0 -1
- package/build/src/integrations/lucid/migrate_legacy_attachment.d.ts.map +0 -1
- package/build/src/integrations/lucid/migrate_legacy_attachment.js.map +0 -1
- package/build/src/integrations/lucid/migrate_legacy_attachment_records.d.ts.map +0 -1
- package/build/src/integrations/lucid/migrate_legacy_attachment_records.js.map +0 -1
- package/build/src/integrations/lucid/render_legacy_attachment_migration_script.d.ts +0 -11
- package/build/src/integrations/lucid/render_legacy_attachment_migration_script.d.ts.map +0 -1
- package/build/src/integrations/lucid/render_legacy_attachment_migration_script.js.map +0 -1
- package/build/tests/create_legacy_attachment_migration_script.spec.d.ts.map +0 -1
- package/build/tests/create_legacy_attachment_migration_script.spec.js +0 -31
- package/build/tests/create_legacy_attachment_migration_script.spec.js.map +0 -1
- /package/build/src/integrations/lucid/{attachment_owner.d.ts → relations/attachment_owner.d.ts} +0 -0
- /package/build/src/integrations/lucid/{attachment_owner.js → relations/attachment_owner.js} +0 -0
- /package/build/src/integrations/lucid/{attachments_table_stub.d.ts → schema/attachments_table_stub.d.ts} +0 -0
|
@@ -13,6 +13,7 @@ export type LegacyAttachment = {
|
|
|
13
13
|
disk?: string;
|
|
14
14
|
path?: string;
|
|
15
15
|
meta?: Record<string, unknown>;
|
|
16
|
+
blurhash?: string;
|
|
16
17
|
variants?: LegacyVariant[];
|
|
17
18
|
};
|
|
18
19
|
export type LegacyVariant = {
|
|
@@ -24,16 +25,13 @@ export type LegacyVariant = {
|
|
|
24
25
|
disk?: string;
|
|
25
26
|
path?: string;
|
|
26
27
|
meta?: Record<string, unknown>;
|
|
28
|
+
blurhash?: string;
|
|
27
29
|
};
|
|
28
|
-
import { type AttachmentOwner } from "
|
|
29
|
-
import type { Attachment } from "
|
|
30
|
-
export type { AttachmentOwner } from "
|
|
31
|
-
export type
|
|
30
|
+
import { type AttachmentOwner } from "../../relations/attachment_owner.js";
|
|
31
|
+
import type { Attachment } from "../../../../core/attachment.js";
|
|
32
|
+
export type { AttachmentOwner } from "../../relations/attachment_owner.js";
|
|
33
|
+
export type MigratedAttachmentBlob = {
|
|
32
34
|
id: string;
|
|
33
|
-
attachableType: string;
|
|
34
|
-
attachableId: string;
|
|
35
|
-
field: string;
|
|
36
|
-
ownerKey: string | null;
|
|
37
35
|
parentId: string | null;
|
|
38
36
|
variantKey: string | null;
|
|
39
37
|
disk: string;
|
|
@@ -43,8 +41,22 @@ export type MigratedAttachmentRow = {
|
|
|
43
41
|
mimeType: string;
|
|
44
42
|
extname: string;
|
|
45
43
|
size: number;
|
|
44
|
+
blurhash: string | null;
|
|
46
45
|
metadata: Record<string, unknown> | null;
|
|
47
46
|
};
|
|
47
|
+
export type MigratedAttachmentLink = {
|
|
48
|
+
id: string;
|
|
49
|
+
attachableType: string;
|
|
50
|
+
attachableId: string;
|
|
51
|
+
field: string;
|
|
52
|
+
ownerKey: string | null;
|
|
53
|
+
position: number | null;
|
|
54
|
+
attachmentId: string;
|
|
55
|
+
};
|
|
56
|
+
export type MigratedAttachmentRows = {
|
|
57
|
+
blobs: MigratedAttachmentBlob[];
|
|
58
|
+
links: MigratedAttachmentLink[];
|
|
59
|
+
};
|
|
48
60
|
export type MigrateLegacyAttachmentOptions = {
|
|
49
61
|
owner: AttachmentOwner;
|
|
50
62
|
defaultDisk: string;
|
|
@@ -52,10 +64,10 @@ export type MigrateLegacyAttachmentOptions = {
|
|
|
52
64
|
};
|
|
53
65
|
export type MigrateLegacyAttachmentColumnOptions = Omit<MigrateLegacyAttachmentOptions, "owner">;
|
|
54
66
|
/**
|
|
55
|
-
* Converts one v5 JSON attachment document into
|
|
67
|
+
* Converts one v5 JSON attachment document into blob and polymorphic-link rows.
|
|
56
68
|
* Callers can run it from an Ace command, another ORM migration, or a one-off script.
|
|
57
69
|
*/
|
|
58
|
-
export declare function migrateLegacyAttachment(value: LegacyAttachment | string, options: MigrateLegacyAttachmentOptions):
|
|
70
|
+
export declare function migrateLegacyAttachment(value: LegacyAttachment | string, options: MigrateLegacyAttachmentOptions): MigratedAttachmentRows;
|
|
59
71
|
/**
|
|
60
72
|
* Converts one v5 JSON value for a retained single attachment column. Legacy
|
|
61
73
|
* variants require the polymorphic table and therefore cannot be kept here.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate_legacy_attachment.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/lucid/migrations/legacy/migrate_legacy_attachment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC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AAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,sBAAsB,EAAE,CAAC;IAChC,KAAK,EAAE,sBAAsB,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,EAAE,eAAe,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,oCAAoC,GAAG,IAAI,CACrD,8BAA8B,EAC9B,OAAO,CACR,CAAC;AAEF;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,gBAAgB,GAAG,MAAM,EAChC,OAAO,EAAE,8BAA8B,GACtC,sBAAsB,CAwCxB;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,KAAK,EAAE,gBAAgB,GAAG,MAAM,EAChC,OAAO,EAAE,oCAAoC,GAC5C,UAAU,CAwBZ"}
|
|
@@ -4,38 +4,48 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
6
|
*/
|
|
7
|
-
import { createAttachmentOwnerKey, } from "
|
|
7
|
+
import { createAttachmentOwnerKey, } from "../../relations/attachment_owner.js";
|
|
8
|
+
import { AttachmentError } from "../../../../errors.js";
|
|
8
9
|
/**
|
|
9
|
-
* Converts one v5 JSON attachment document into
|
|
10
|
+
* Converts one v5 JSON attachment document into blob and polymorphic-link rows.
|
|
10
11
|
* Callers can run it from an Ace command, another ORM migration, or a one-off script.
|
|
11
12
|
*/
|
|
12
13
|
export function migrateLegacyAttachment(value, options) {
|
|
13
14
|
const attachment = typeof value === "string" ? parseLegacyAttachment(value) : value;
|
|
14
15
|
const id = options.createId();
|
|
15
16
|
const originalName = attachment.originalName ?? attachment.name;
|
|
16
|
-
const original =
|
|
17
|
+
const original = toBlob({
|
|
17
18
|
id,
|
|
18
19
|
attachment,
|
|
19
|
-
owner: options.owner,
|
|
20
|
-
ownerKey: createAttachmentOwnerKey(options.owner),
|
|
21
20
|
parentId: null,
|
|
22
21
|
variantKey: null,
|
|
23
22
|
originalName,
|
|
24
23
|
defaultDisk: options.defaultDisk,
|
|
25
24
|
});
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
25
|
+
return {
|
|
26
|
+
blobs: [
|
|
27
|
+
original,
|
|
28
|
+
...(attachment.variants ?? []).map((variant) => toBlob({
|
|
29
|
+
id: options.createId(),
|
|
30
|
+
attachment: variant,
|
|
31
|
+
parentId: id,
|
|
32
|
+
variantKey: variant.key,
|
|
33
|
+
originalName,
|
|
34
|
+
defaultDisk: options.defaultDisk,
|
|
35
|
+
})),
|
|
36
|
+
],
|
|
37
|
+
links: [
|
|
38
|
+
{
|
|
39
|
+
id: options.createId(),
|
|
40
|
+
attachableType: options.owner.type,
|
|
41
|
+
attachableId: options.owner.id,
|
|
42
|
+
field: options.owner.field,
|
|
43
|
+
ownerKey: createAttachmentOwnerKey(options.owner),
|
|
44
|
+
position: null,
|
|
45
|
+
attachmentId: id,
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
};
|
|
39
49
|
}
|
|
40
50
|
/**
|
|
41
51
|
* Converts one v5 JSON value for a retained single attachment column. Legacy
|
|
@@ -44,7 +54,7 @@ export function migrateLegacyAttachment(value, options) {
|
|
|
44
54
|
export function migrateLegacyAttachmentColumn(value, options) {
|
|
45
55
|
const attachment = typeof value === "string" ? parseLegacyAttachment(value) : value;
|
|
46
56
|
if (attachment.variants?.length) {
|
|
47
|
-
throw new
|
|
57
|
+
throw new AttachmentError("Legacy attachments with variants must migrate to the polymorphic table", { code: "E_LEGACY_VARIANTS_REQUIRE_RELATIONS", status: 422 });
|
|
48
58
|
}
|
|
49
59
|
const originalName = attachment.originalName ?? attachment.name;
|
|
50
60
|
return {
|
|
@@ -64,16 +74,15 @@ function parseLegacyAttachment(value) {
|
|
|
64
74
|
return JSON.parse(value);
|
|
65
75
|
}
|
|
66
76
|
catch {
|
|
67
|
-
throw new
|
|
77
|
+
throw new AttachmentError("Legacy attachment value must be valid JSON", {
|
|
78
|
+
code: "E_INVALID_LEGACY_ATTACHMENT",
|
|
79
|
+
status: 400,
|
|
80
|
+
});
|
|
68
81
|
}
|
|
69
82
|
}
|
|
70
|
-
function
|
|
83
|
+
function toBlob({ id, attachment, parentId, variantKey, originalName, defaultDisk, }) {
|
|
71
84
|
return {
|
|
72
85
|
id,
|
|
73
|
-
attachableType: owner.type,
|
|
74
|
-
attachableId: owner.id,
|
|
75
|
-
field: owner.field,
|
|
76
|
-
ownerKey,
|
|
77
86
|
parentId,
|
|
78
87
|
variantKey,
|
|
79
88
|
disk: attachment.disk ?? defaultDisk,
|
|
@@ -83,6 +92,7 @@ function toRow({ id, attachment, owner, ownerKey, parentId, variantKey, original
|
|
|
83
92
|
mimeType: attachment.mimeType,
|
|
84
93
|
extname: attachment.extname,
|
|
85
94
|
size: attachment.size,
|
|
95
|
+
blurhash: attachment.blurhash ?? null,
|
|
86
96
|
metadata: attachment.meta ?? null,
|
|
87
97
|
};
|
|
88
98
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate_legacy_attachment.js","sourceRoot":"","sources":["../../../../../../src/integrations/lucid/migrations/legacy/migrate_legacy_attachment.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA2BH,OAAO,EACL,wBAAwB,GAEzB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AA6CxD;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAgC,EAChC,OAAuC;IAEvC,MAAM,UAAU,GACd,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IACnE,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAC9B,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,IAAI,UAAU,CAAC,IAAI,CAAC;IAChE,MAAM,QAAQ,GAAG,MAAM,CAAC;QACtB,EAAE;QACF,UAAU;QACV,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,IAAI;QAChB,YAAY;QACZ,WAAW,EAAE,OAAO,CAAC,WAAW;KACjC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK,EAAE;YACL,QAAQ;YACR,GAAG,CAAC,UAAU,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAC7C,MAAM,CAAC;gBACL,EAAE,EAAE,OAAO,CAAC,QAAQ,EAAE;gBACtB,UAAU,EAAE,OAAO;gBACnB,QAAQ,EAAE,EAAE;gBACZ,UAAU,EAAE,OAAO,CAAC,GAAG;gBACvB,YAAY;gBACZ,WAAW,EAAE,OAAO,CAAC,WAAW;aACjC,CAAC,CACH;SACF;QACD,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,OAAO,CAAC,QAAQ,EAAE;gBACtB,cAAc,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI;gBAClC,YAAY,EAAE,OAAO,CAAC,KAA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AK,CAAqB,CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,eAAe,CAAC,4CAA4C,EAAE;YACtE,IAAI,EAAE,6BAA6B;YACnC,MAAM,EAAE,GAAG;SACZ,CAAC,CAAC;IACL,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CAAC,EACd,EAAE,EACF,UAAU,EACV,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,WAAW,GAQZ;IACC,OAAO;QACL,EAAE;QACF,QAAQ;QACR,UAAU;QACV,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,WAAW;QACpC,IAAI,EAAE,UAAU,CAAC,IAAI,IAAI,UAAU,CAAC,IAAI;QACxC,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,YAAY;QACZ,QAAQ,EAAE,UAAU,CAAC,QAAQ;QAC7B,OAAO,EAAE,UAAU,CAAC,OAAO;QAC3B,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,QAAQ,EAAE,UAAU,CAAC,QAAQ,IAAI,IAAI;QACrC,QAAQ,EAAE,UAAU,CAAC,IAAI,IAAI,IAAI;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
6
|
*/
|
|
7
|
-
import type { AttachmentOwner } from '
|
|
8
|
-
import { type LegacyAttachment, type
|
|
7
|
+
import type { AttachmentOwner } from '../../relations/attachment_owner.js';
|
|
8
|
+
import { type LegacyAttachment, type MigratedAttachmentRows } from './migrate_legacy_attachment.js';
|
|
9
9
|
export type LegacyAttachmentMigrationRecord = {
|
|
10
10
|
owner: AttachmentOwner;
|
|
11
11
|
value: LegacyAttachment | string | null | undefined;
|
|
12
12
|
};
|
|
13
13
|
export type LegacyAttachmentMigrationWriter = {
|
|
14
|
-
insert(rows:
|
|
14
|
+
insert(rows: MigratedAttachmentRows): Promise<void>;
|
|
15
15
|
};
|
|
16
16
|
export type MigrateLegacyAttachmentRecordsOptions = {
|
|
17
17
|
records: Iterable<LegacyAttachmentMigrationRecord> | AsyncIterable<LegacyAttachmentMigrationRecord>;
|
package/build/src/integrations/lucid/migrations/legacy/migrate_legacy_attachment_records.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate_legacy_attachment_records.d.ts","sourceRoot":"","sources":["../../../../../../src/integrations/lucid/migrations/legacy/migrate_legacy_attachment_records.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAA;AAE1E,OAAO,EAEL,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC5B,MAAM,gCAAgC,CAAA;AAEvC,MAAM,MAAM,+BAA+B,GAAG;IAC5C,KAAK,EAAE,eAAe,CAAA;IACtB,KAAK,EAAE,gBAAgB,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CACpD,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,MAAM,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CACpD,CAAA;AAED,MAAM,MAAM,qCAAqC,GAAG;IAClD,OAAO,EAAE,QAAQ,CAAC,+BAA+B,CAAC,GAAG,aAAa,CAAC,+BAA+B,CAAC,CAAA;IACnG,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,MAAM,CAAA;IACtB,MAAM,EAAE,+BAA+B,CAAA;IACvC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,+BAA+B,GAAG;IAC5C,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED;;;;GAIG;AACH,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,qCAAqC,GAC7C,OAAO,CAAC,+BAA+B,CAAC,CA4C1C"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
6
|
*/
|
|
7
|
+
import { AttachmentError } from '../../../../errors.js';
|
|
7
8
|
import { migrateLegacyAttachment, } from './migrate_legacy_attachment.js';
|
|
8
9
|
/**
|
|
9
10
|
* Migrates a stream of legacy v5 JSON values into attachment-table rows.
|
|
@@ -13,14 +14,16 @@ import { migrateLegacyAttachment, } from './migrate_legacy_attachment.js';
|
|
|
13
14
|
export async function migrateLegacyAttachmentRecords(options) {
|
|
14
15
|
const batchSize = options.batchSize ?? 100;
|
|
15
16
|
if (!Number.isSafeInteger(batchSize) || batchSize < 1) {
|
|
16
|
-
throw new
|
|
17
|
+
throw new AttachmentError('Legacy attachment migration batchSize must be a positive integer', {
|
|
18
|
+
code: 'E_INVALID_LEGACY_MIGRATION_BATCH_SIZE',
|
|
19
|
+
});
|
|
17
20
|
}
|
|
18
21
|
const result = {
|
|
19
22
|
attachments: 0,
|
|
20
23
|
variants: 0,
|
|
21
24
|
skipped: 0,
|
|
22
25
|
};
|
|
23
|
-
let batch = [];
|
|
26
|
+
let batch = { blobs: [], links: [] };
|
|
24
27
|
for await (const record of options.records) {
|
|
25
28
|
if (record.value === null || record.value === undefined) {
|
|
26
29
|
result.skipped += 1;
|
|
@@ -32,14 +35,15 @@ export async function migrateLegacyAttachmentRecords(options) {
|
|
|
32
35
|
createId: options.createId,
|
|
33
36
|
});
|
|
34
37
|
result.attachments += 1;
|
|
35
|
-
result.variants += rows.length - 1;
|
|
36
|
-
batch.push(...rows);
|
|
37
|
-
|
|
38
|
+
result.variants += rows.blobs.length - 1;
|
|
39
|
+
batch.blobs.push(...rows.blobs);
|
|
40
|
+
batch.links.push(...rows.links);
|
|
41
|
+
if (batch.blobs.length >= batchSize) {
|
|
38
42
|
await options.writer.insert(batch);
|
|
39
|
-
batch = [];
|
|
43
|
+
batch = { blobs: [], links: [] };
|
|
40
44
|
}
|
|
41
45
|
}
|
|
42
|
-
if (batch.length > 0) {
|
|
46
|
+
if (batch.blobs.length > 0) {
|
|
43
47
|
await options.writer.insert(batch);
|
|
44
48
|
}
|
|
45
49
|
return result;
|
package/build/src/integrations/lucid/migrations/legacy/migrate_legacy_attachment_records.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate_legacy_attachment_records.js","sourceRoot":"","sources":["../../../../../../src/integrations/lucid/migrations/legacy/migrate_legacy_attachment_records.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EACL,uBAAuB,GAGxB,MAAM,gCAAgC,CAAA;AAyBvC;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,OAA8C;IAE9C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,GAAG,CAAA;IAE1C,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,SAAS,CAAC,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;QACtD,MAAM,IAAI,eAAe,CAAC,kEAAkE,EAAE;YAC5F,IAAI,EAAE,uCAAuC;SAC9C,CAAC,CAAA;IACJ,CAAC;IAED,MAAM,MAAM,GAAoC;QAC9C,WAAW,EAAE,CAAC;QACd,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;KACX,CAAA;IACD,IAAI,KAAK,GAA2B,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;IAE5D,IAAI,KAAK,EAAE,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,KAAK,KAAK,SAAS,EAAE,CAAC;YACxD,MAAM,CAAC,OAAO,IAAI,CAAC,CAAA;YACnB,SAAQ;QACV,CAAC;QAED,MAAM,IAAI,GAAG,uBAAuB,CAAC,MAAM,CAAC,KAAK,EAAE;YACjD,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC,CAAA;QAEF,MAAM,CAAC,WAAW,IAAI,CAAC,CAAA;QACvB,MAAM,CAAC,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAA;QACxC,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;QAC/B,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAA;QAE/B,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC;YACpC,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;YAClC,KAAK,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAA;QAClC,CAAC;IACH,CAAC;IAED,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;IACpC,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
import { BaseModel } from '@adonisjs/lucid/orm';
|
|
8
|
+
import type { BelongsTo } from '@adonisjs/lucid/types/relations';
|
|
9
|
+
import type { DateTime } from 'luxon';
|
|
10
|
+
import type { Attachment } from '../../../core/attachment.js';
|
|
11
|
+
import { AttachmentModel } from './attachment_model.js';
|
|
12
|
+
/**
|
|
13
|
+
* Polymorphic relation between an application record and an attachment blob.
|
|
14
|
+
*/
|
|
15
|
+
export declare class AttachmentLinkModel extends BaseModel {
|
|
16
|
+
static table: string;
|
|
17
|
+
static selfAssignPrimaryKey: boolean;
|
|
18
|
+
id: string;
|
|
19
|
+
attachableType: string;
|
|
20
|
+
attachableId: string;
|
|
21
|
+
field: string;
|
|
22
|
+
ownerKey: string | null;
|
|
23
|
+
position: number | null;
|
|
24
|
+
attachmentId: string;
|
|
25
|
+
attachment: BelongsTo<typeof AttachmentModel>;
|
|
26
|
+
createdAt: DateTime;
|
|
27
|
+
updatedAt: DateTime;
|
|
28
|
+
toAttachment(): Attachment;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=attachment_link_model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_link_model.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/lucid/models/attachment_link_model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAqB,MAAM,qBAAqB,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAChE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAGvD;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,SAAS;IAChD,MAAM,CAAC,KAAK,SAAqB;IACjC,MAAM,CAAC,oBAAoB,UAAO;IAG1B,EAAE,EAAE,MAAM,CAAA;IAGV,cAAc,EAAE,MAAM,CAAA;IAGtB,YAAY,EAAE,MAAM,CAAA;IAGpB,KAAK,EAAE,MAAM,CAAA;IAGb,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAGvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAGvB,YAAY,EAAE,MAAM,CAAA;IAGpB,UAAU,EAAE,SAAS,CAAC,OAAO,eAAe,CAAC,CAAA;IAG7C,SAAS,EAAE,QAAQ,CAAA;IAGnB,SAAS,EAAE,QAAQ,CAAA;IAE3B,YAAY,IAAI,UAAU;CAS3B"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jrmc/adonis-attachment
|
|
3
|
+
*
|
|
4
|
+
* @license MIT
|
|
5
|
+
* @copyright Jeremy Chaufourier <jeremy@chaufourier.fr>
|
|
6
|
+
*/
|
|
7
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
8
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
10
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
11
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
12
|
+
};
|
|
13
|
+
import { BaseModel, belongsTo, column } from '@adonisjs/lucid/orm';
|
|
14
|
+
import { AttachmentModel } from './attachment_model.js';
|
|
15
|
+
import { AttachmentConfigurationError } from '../../../errors.js';
|
|
16
|
+
/**
|
|
17
|
+
* Polymorphic relation between an application record and an attachment blob.
|
|
18
|
+
*/
|
|
19
|
+
export class AttachmentLinkModel extends BaseModel {
|
|
20
|
+
static table = 'attachment_links';
|
|
21
|
+
static selfAssignPrimaryKey = true;
|
|
22
|
+
toAttachment() {
|
|
23
|
+
if (!this.attachment) {
|
|
24
|
+
throw new AttachmentConfigurationError('Attachment links must load their attachment blob before they can be read');
|
|
25
|
+
}
|
|
26
|
+
return this.attachment.toAttachment();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
__decorate([
|
|
30
|
+
column({ isPrimary: true })
|
|
31
|
+
], AttachmentLinkModel.prototype, "id", void 0);
|
|
32
|
+
__decorate([
|
|
33
|
+
column()
|
|
34
|
+
], AttachmentLinkModel.prototype, "attachableType", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
column()
|
|
37
|
+
], AttachmentLinkModel.prototype, "attachableId", void 0);
|
|
38
|
+
__decorate([
|
|
39
|
+
column()
|
|
40
|
+
], AttachmentLinkModel.prototype, "field", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
column({ serializeAs: null })
|
|
43
|
+
], AttachmentLinkModel.prototype, "ownerKey", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
column()
|
|
46
|
+
], AttachmentLinkModel.prototype, "position", void 0);
|
|
47
|
+
__decorate([
|
|
48
|
+
column()
|
|
49
|
+
], AttachmentLinkModel.prototype, "attachmentId", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
belongsTo(() => AttachmentModel, { foreignKey: 'attachmentId' })
|
|
52
|
+
], AttachmentLinkModel.prototype, "attachment", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
column.dateTime({ autoCreate: true })
|
|
55
|
+
], AttachmentLinkModel.prototype, "createdAt", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
column.dateTime({ autoCreate: true, autoUpdate: true })
|
|
58
|
+
], AttachmentLinkModel.prototype, "updatedAt", void 0);
|
|
59
|
+
//# sourceMappingURL=attachment_link_model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_link_model.js","sourceRoot":"","sources":["../../../../../src/integrations/lucid/models/attachment_link_model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;AAEH,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAKlE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,oBAAoB,CAAA;AAEjE;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,MAAM,CAAC,KAAK,GAAG,kBAAkB,CAAA;IACjC,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAA;IAgClC,YAAY;QACV,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,4BAA4B,CACpC,0EAA0E,CAC3E,CAAA;QACH,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,EAAE,CAAA;IACvC,CAAC;;AArCO;IADP,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;+CACV;AAGV;IADP,MAAM,EAAE;2DACqB;AAGtB;IADP,MAAM,EAAE;yDACmB;AAGpB;IADP,MAAM,EAAE;kDACY;AAGb;IADP,MAAM,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;qDACC;AAGvB;IADP,MAAM,EAAE;qDACsB;AAGvB;IADP,MAAM,EAAE;yDACmB;AAGpB;IADP,SAAS,CAAC,GAAG,EAAE,CAAC,eAAe,EAAE,EAAE,UAAU,EAAE,cAAc,EAAE,CAAC;uDACZ;AAG7C;IADP,MAAM,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;sDACX;AAGnB;IADP,MAAM,CAAC,QAAQ,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;sDAC7B"}
|
|
@@ -6,20 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { BaseModel } from '@adonisjs/lucid/orm';
|
|
8
8
|
import type { DateTime } from 'luxon';
|
|
9
|
-
import type { Attachment } from '
|
|
9
|
+
import type { Attachment } from '../../../core/attachment.js';
|
|
10
|
+
import type { AttachmentMetadata } from '../../../media/media_metadata.js';
|
|
10
11
|
/**
|
|
11
|
-
* Default Lucid model for
|
|
12
|
+
* Default Lucid model for a stored attachment blob.
|
|
12
13
|
* Applications may extend this model to add their own scopes and serialization rules.
|
|
13
14
|
*/
|
|
14
15
|
export declare class AttachmentModel extends BaseModel {
|
|
15
16
|
static table: string;
|
|
16
17
|
static selfAssignPrimaryKey: boolean;
|
|
17
18
|
id: string;
|
|
18
|
-
attachableType: string;
|
|
19
|
-
attachableId: string;
|
|
20
|
-
field: string;
|
|
21
|
-
ownerKey: string | null;
|
|
22
|
-
position: number | null;
|
|
23
19
|
parentId: string | null;
|
|
24
20
|
variantKey: string | null;
|
|
25
21
|
disk: string;
|
|
@@ -29,7 +25,8 @@ export declare class AttachmentModel extends BaseModel {
|
|
|
29
25
|
mimeType: string;
|
|
30
26
|
extname: string;
|
|
31
27
|
size: number;
|
|
32
|
-
|
|
28
|
+
blurhash: string | null;
|
|
29
|
+
metadata: AttachmentMetadata | null;
|
|
33
30
|
createdAt: DateTime;
|
|
34
31
|
updatedAt: DateTime;
|
|
35
32
|
toAttachment(): Attachment;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_model.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/lucid/models/attachment_model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAU,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAErC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAA;AAE1E;;;GAGG;AACH,qBAAa,eAAgB,SAAQ,SAAS;IAC5C,MAAM,CAAC,KAAK,SAAgB;IAC5B,MAAM,CAAC,oBAAoB,UAAO;IAG1B,EAAE,EAAE,MAAM,CAAA;IAGV,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAGvB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IAGzB,IAAI,EAAE,MAAM,CAAA;IAGZ,IAAI,EAAE,MAAM,CAAA;IAGZ,IAAI,EAAE,MAAM,CAAA;IAGZ,YAAY,EAAE,MAAM,CAAA;IAGpB,QAAQ,EAAE,MAAM,CAAA;IAGhB,OAAO,EAAE,MAAM,CAAA;IAGf,IAAI,EAAE,MAAM,CAAA;IAGZ,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IAcvB,QAAQ,EAAE,kBAAkB,GAAG,IAAI,CAAA;IAGnC,SAAS,EAAE,QAAQ,CAAA;IAGnB,SAAS,EAAE,QAAQ,CAAA;IAE3B,YAAY,IAAI,UAAU;CAc3B"}
|
|
@@ -12,7 +12,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
12
12
|
};
|
|
13
13
|
import { BaseModel, column } from '@adonisjs/lucid/orm';
|
|
14
14
|
/**
|
|
15
|
-
* Default Lucid model for
|
|
15
|
+
* Default Lucid model for a stored attachment blob.
|
|
16
16
|
* Applications may extend this model to add their own scopes and serialization rules.
|
|
17
17
|
*/
|
|
18
18
|
export class AttachmentModel extends BaseModel {
|
|
@@ -28,6 +28,7 @@ export class AttachmentModel extends BaseModel {
|
|
|
28
28
|
mimeType: this.mimeType,
|
|
29
29
|
extname: this.extname,
|
|
30
30
|
size: this.size,
|
|
31
|
+
...(this.blurhash ? { blurhash: this.blurhash } : {}),
|
|
31
32
|
...(this.metadata ? { metadata: this.metadata } : {}),
|
|
32
33
|
};
|
|
33
34
|
}
|
|
@@ -35,21 +36,6 @@ export class AttachmentModel extends BaseModel {
|
|
|
35
36
|
__decorate([
|
|
36
37
|
column({ isPrimary: true })
|
|
37
38
|
], AttachmentModel.prototype, "id", void 0);
|
|
38
|
-
__decorate([
|
|
39
|
-
column()
|
|
40
|
-
], AttachmentModel.prototype, "attachableType", void 0);
|
|
41
|
-
__decorate([
|
|
42
|
-
column()
|
|
43
|
-
], AttachmentModel.prototype, "attachableId", void 0);
|
|
44
|
-
__decorate([
|
|
45
|
-
column()
|
|
46
|
-
], AttachmentModel.prototype, "field", void 0);
|
|
47
|
-
__decorate([
|
|
48
|
-
column({ serializeAs: null })
|
|
49
|
-
], AttachmentModel.prototype, "ownerKey", void 0);
|
|
50
|
-
__decorate([
|
|
51
|
-
column()
|
|
52
|
-
], AttachmentModel.prototype, "position", void 0);
|
|
53
39
|
__decorate([
|
|
54
40
|
column()
|
|
55
41
|
], AttachmentModel.prototype, "parentId", void 0);
|
|
@@ -77,6 +63,9 @@ __decorate([
|
|
|
77
63
|
__decorate([
|
|
78
64
|
column()
|
|
79
65
|
], AttachmentModel.prototype, "size", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
column()
|
|
68
|
+
], AttachmentModel.prototype, "blurhash", void 0);
|
|
80
69
|
__decorate([
|
|
81
70
|
column({
|
|
82
71
|
prepare(value) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment_model.js","sourceRoot":"","sources":["../../../../../src/integrations/lucid/models/attachment_model.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;;;;;;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAMvD;;;GAGG;AACH,MAAM,OAAO,eAAgB,SAAQ,SAAS;IAC5C,MAAM,CAAC,KAAK,GAAG,aAAa,CAAA;IAC5B,MAAM,CAAC,oBAAoB,GAAG,IAAI,CAAA;IAuDlC,YAAY;QACV,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,CA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chaufourier.fr>
|
|
6
6
|
*/
|
|
7
|
-
import { type AttachmentDraft, type CreateAttachmentInput } from '
|
|
8
|
-
import type { AttachmentService } from '
|
|
9
|
-
import type { AttachmentPersistenceOptions } from '
|
|
10
|
-
import type { AttachmentOwner } from '
|
|
11
|
-
import {
|
|
7
|
+
import { type AttachmentDraft, type CreateAttachmentInput } from '../../../core/attachment.js';
|
|
8
|
+
import type { AttachmentService } from '../../../core/attachment_service.js';
|
|
9
|
+
import type { AttachmentPersistenceOptions } from '../../../core/attachment_options.js';
|
|
10
|
+
import type { AttachmentOwner } from '../relations/attachment_owner.js';
|
|
11
|
+
import { AttachmentLinkModel } from '../models/attachment_link_model.js';
|
|
12
|
+
import { AttachmentModel } from '../models/attachment_model.js';
|
|
12
13
|
import { LucidAttachmentStore } from './lucid_attachment_store.js';
|
|
13
|
-
export type AttachmentFileService = Pick<AttachmentService, 'create' | 'remove'> & Partial<Pick<AttachmentService, 'createDraft'>>;
|
|
14
|
-
export type LucidAttachmentPersistence = Pick<LucidAttachmentStore, 'createOriginal' | 'findOriginal' | 'listVariants' | 'releaseOwner' | 'restoreOwner' | 'remove'> & Partial<Pick<LucidAttachmentStore, 'createCollectionItem' | 'findCollectionItem' | 'listCollection' | 'moveCollectionItem' | 'removeCollectionItem'>>;
|
|
14
|
+
export type AttachmentFileService = Pick<AttachmentService, 'create' | 'remove'> & Partial<Pick<AttachmentService, 'createDraft' | 'getVariantKeys' | 'getVariantMetadataEnabled' | 'getMetadataMode' | 'scheduleMetadataExtraction' | 'scheduleVariantGeneration'>>;
|
|
15
|
+
export type LucidAttachmentPersistence = Pick<LucidAttachmentStore, 'createOriginal' | 'findOriginal' | 'listVariants' | 'releaseOwner' | 'restoreOwner' | 'remove' | 'listOwnerLinks'> & Partial<Pick<LucidAttachmentStore, 'createCollectionItem' | 'findCollectionItem' | 'listCollection' | 'moveCollectionItem' | 'removeCollectionItem' | 'createOriginalLink' | 'createCollectionLink'>>;
|
|
15
16
|
export declare class LucidAttachmentLifecycleService {
|
|
16
17
|
#private;
|
|
17
18
|
constructor(attachments: AttachmentFileService, store: LucidAttachmentPersistence);
|
|
18
|
-
get(owner: AttachmentOwner): Promise<
|
|
19
|
-
attach(owner: AttachmentOwner, input: CreateAttachmentInput | AttachmentDraft, options?: AttachmentPersistenceOptions<any>): Promise<
|
|
20
|
-
replace(owner: AttachmentOwner, input: CreateAttachmentInput | AttachmentDraft, options?: AttachmentPersistenceOptions<any>): Promise<
|
|
19
|
+
get(owner: AttachmentOwner): Promise<AttachmentLinkModel | null>;
|
|
20
|
+
attach(owner: AttachmentOwner, input: CreateAttachmentInput | AttachmentDraft, options?: AttachmentPersistenceOptions<any>): Promise<AttachmentLinkModel>;
|
|
21
|
+
replace(owner: AttachmentOwner, input: CreateAttachmentInput | AttachmentDraft, options?: AttachmentPersistenceOptions<any>): Promise<AttachmentLinkModel>;
|
|
21
22
|
detach(owner: AttachmentOwner): Promise<void>;
|
|
22
23
|
listVariants(owner: AttachmentOwner): Promise<AttachmentModel[]>;
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
purgeOwner(owner: AttachmentOwner): Promise<void>;
|
|
25
|
+
add(owner: AttachmentOwner, input: CreateAttachmentInput | AttachmentDraft, position?: number, options?: AttachmentPersistenceOptions<any>): Promise<AttachmentLinkModel>;
|
|
26
|
+
attachExisting(owner: AttachmentOwner, attachmentId: string): Promise<AttachmentLinkModel>;
|
|
27
|
+
addExisting(owner: AttachmentOwner, attachmentId: string, position?: number): Promise<AttachmentLinkModel>;
|
|
28
|
+
listCollection(owner: AttachmentOwner): Promise<AttachmentLinkModel[]>;
|
|
25
29
|
removeCollectionItem(owner: AttachmentOwner, id: string): Promise<boolean>;
|
|
26
30
|
clearCollection(owner: AttachmentOwner): Promise<void>;
|
|
27
|
-
replaceCollection(owner: AttachmentOwner, inputs: readonly (CreateAttachmentInput | AttachmentDraft)[], options?: AttachmentPersistenceOptions<any>): Promise<
|
|
28
|
-
moveCollectionItem(owner: AttachmentOwner, id: string, position: number): Promise<
|
|
31
|
+
replaceCollection(owner: AttachmentOwner, inputs: readonly (CreateAttachmentInput | AttachmentDraft)[], options?: AttachmentPersistenceOptions<any>): Promise<AttachmentLinkModel[]>;
|
|
32
|
+
moveCollectionItem(owner: AttachmentOwner, id: string, position: number): Promise<AttachmentLinkModel[]>;
|
|
29
33
|
}
|
|
30
34
|
//# sourceMappingURL=lucid_attachment_lifecycle_service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lucid_attachment_lifecycle_service.d.ts","sourceRoot":"","sources":["../../../../../src/integrations/lucid/persistence/lucid_attachment_lifecycle_service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC3B,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAA;AAC5E,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAA;AACvF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AACvE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAIlE,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,iBAAiB,EAAE,QAAQ,GAAG,QAAQ,CAAC,GAC9E,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,aAAa,GAAG,gBAAgB,GAAG,2BAA2B,GAAG,iBAAiB,GAAG,4BAA4B,GAAG,2BAA2B,CAAC,CAAC,CAAA;AACnL,MAAM,MAAM,0BAA0B,GAAG,IAAI,CAC3C,oBAAoB,EAClB,gBAAgB,GAChB,cAAc,GACd,cAAc,GACd,cAAc,GACd,cAAc,GACd,QAAQ,GACR,gBAAgB,CACnB,GACC,O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