diff --git a/src/lib.ts b/src/lib.ts index 28c723a1..26ea52a0 100644 --- a/src/lib.ts +++ b/src/lib.ts @@ -258,7 +258,17 @@ import type { UrlParams } from '@/services/api/apiHelper' import { generateUUIDv1, generateUUIDv4 } from '@/utils/generator' import { useLoginStatus } from '@/composables/system/loginStatus' import { useRemainingTime } from '@/composables/datetime/remainingTime' -import { DamAssetStatus, DamAssetType } from '@/types/coreDam/Asset' +import { + type AssetCustomData, + type AssetDetailItemDto, + type AssetFileProperties, + type AssetMetadataDto, + type AssetMetadataSuggestions, + type AssetSearchListItemDto, + DamAssetStatus, + DamAssetType, +} from '@/types/coreDam/Asset' +import { QueueItemType, type UploadQueueItem, UploadQueueItemStatus } from '@/types/coreDam/UploadQueue' import type { AssetSelectReturnData } from '@/types/coreDam/AssetSelect' import type { SortableItem, SortablePropItem } from '@/components/sortable/sortableActions' import type { SortableNested, SortableNestedItem } from '@/components/sortable/sortableNestedActions' @@ -272,6 +282,7 @@ export { AChipNoLink, AAlerts, ABooleanValue, +import type { UploadQueueItem } from './types/coreDam/UploadQueue' APermissionGrantEditor, APermissionValueChip, ASystemEntityScope, @@ -430,6 +441,15 @@ export { SortableNested, SortableItemDataAware, SortableItemWithParentDataAware, + AssetFileProperties, + AssetSearchListItemDto, + AssetDetailItemDto, + AssetMetadataDto, + AssetCustomData, + AssetMetadataSuggestions, + UploadQueueItem, + UploadQueueItemStatus, + QueueItemType, // FACTORIES useAnzuUserFactory, diff --git a/src/types/coreDam/Asset.ts b/src/types/coreDam/Asset.ts index cce03bcc..fa1055b4 100644 --- a/src/types/coreDam/Asset.ts +++ b/src/types/coreDam/Asset.ts @@ -1,4 +1,4 @@ -import type { DocId, IntegerId } from '@/types/common' +import type { DocId, DocIdNullable, IntegerId } from '@/types/common' import type { AnzuUserAndTimeTrackingAware } from '@/types/AnzuUserAndTimeTrackingAware' import type { ResourceNameSystemAware } from '@/types/ResourceNameSystemAware' import type { AssetFile } from '@/types/coreDam/AssetFile' @@ -54,14 +54,56 @@ export interface AssetFileProperties { height: number } +interface Flags { + described: boolean + visible: boolean +} + +export interface AssetMetadataSuggestions extends Record> {} + +export type AssetCustomData = Record + +interface Metadata { + authorSuggestions: AssetMetadataSuggestions + keywordSuggestions: AssetMetadataSuggestions + customData: any +} + export interface AssetSearchListItemDto extends AnzuUserAndTimeTrackingAware, ResourceNameSystemAware { id: DocId texts: Texts attributes: Attributes + flags: Flags + licence: IntegerId + mainFile: null | AssetFile + keywords: DocId[] + authors: DocId[] + podcasts: DocId[] + metadata: Metadata + assetFileProperties: AssetFileProperties +} + +export interface AssetDetailItemDto extends AnzuUserAndTimeTrackingAware, ResourceNameSystemAware { + id: DocId + texts: Texts + attributes: Attributes + flags: Flags licence: IntegerId mainFile: null | AssetFile keywords: DocId[] authors: DocId[] podcasts: DocId[] + metadata: Metadata + distributionCategory: DocIdNullable assetFileProperties: AssetFileProperties } + +export interface AssetMetadataDto extends AnzuUserAndTimeTrackingAware, ResourceNameSystemAware, Metadata { + id: DocId + customData: AssetCustomData +} + +export type AssetExternalProviderId = string | number +export type AssetExternalProviderIdNullable = AssetExternalProviderId | null + +export type AssetExternalProviderMetadata = Record diff --git a/src/types/coreDam/UploadQueue.ts b/src/types/coreDam/UploadQueue.ts new file mode 100644 index 00000000..d8d0121a --- /dev/null +++ b/src/types/coreDam/UploadQueue.ts @@ -0,0 +1,71 @@ +import type { CancelTokenSource } from 'axios' +import type { DocId, DocIdNullable, IntegerId } from '@/types/common' +import type { + AssetExternalProviderIdNullable, + AssetExternalProviderMetadata, + DamAssetStatus, + DamAssetType +} from '@/types/coreDam/Asset' +import type { AssetFileFailReason, Link } from '@/types/coreDam/AssetFile' + +export enum QueueItemType { + File = 'file', + Asset = 'asset', + ExternalProviderAsset = 'externalProviderAsset', + SlotFile = 'slotFile', +} + +export enum UploadQueueItemStatus { + Loading = 'loading', // loading additional api data + Waiting = 'waiting', // waiting to be uploaded + Uploading = 'uploading', // uploading right now + Processing = 'processing', // all data sent by FE, server processing, waiting for notification, todo + Failed = 'failed', // any error + Uploaded = 'uploaded', // uploaded/ready after loading + Stop = 'stop', // after hitting stop upload +} + +export interface UploadQueueItemChunk { + cancelTokenSource: CancelTokenSource +} + +export interface UploadQueueItem { + key: string + file: File | null + status: UploadQueueItemStatus + assetStatus: DamAssetStatus + isDuplicate: boolean + type: QueueItemType + assetType: DamAssetType + displayTitle: string + assetId: DocIdNullable + duplicateAssetId: DocIdNullable + fileId: DocIdNullable + externalProviderAssetId: AssetExternalProviderIdNullable + externalProviderName: string | null + externalProviderMetadata: AssetExternalProviderMetadata + chunks: UploadQueueItemChunk[] + chunkSize: number + currentChunkIndex: number + chunkTotalCount: number + licenceId: IntegerId + imagePreview?: Link + canEditMetadata: boolean + keywords: DocId[] + authors: DocId[] + customData: any + authorConflicts: DocId[] + progress: { + remainingTime: null | number + progressPercent: null | number + speed: null | number + } + error: { + hasError: boolean + message: string + assetFileFailReason: AssetFileFailReason + } + notificationFallbackTimer: ReturnType | undefined + notificationFallbackTry: number + slotName: string | null +}