Skip to content

Commit

Permalink
added several dam exports
Browse files Browse the repository at this point in the history
  • Loading branch information
volar committed Nov 10, 2023
1 parent 61c6ca5 commit 53842fe
Show file tree
Hide file tree
Showing 3 changed files with 135 additions and 2 deletions.
22 changes: 21 additions & 1 deletion src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -272,6 +282,7 @@ export {
AChipNoLink,
AAlerts,
ABooleanValue,
import type { UploadQueueItem } from './types/coreDam/UploadQueue'

Check failure on line 285 in src/lib.ts

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

',' expected.

Check failure on line 285 in src/lib.ts

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

',' expected.

Check failure on line 285 in src/lib.ts

View workflow job for this annotation

GitHub Actions / Lint (20, ubuntu-latest)

Unexpected keyword or identifier.
APermissionGrantEditor,
APermissionValueChip,
ASystemEntityScope,
Expand Down Expand Up @@ -430,6 +441,15 @@ export {
SortableNested,
SortableItemDataAware,
SortableItemWithParentDataAware,
AssetFileProperties,
AssetSearchListItemDto,
AssetDetailItemDto,
AssetMetadataDto,
AssetCustomData,
AssetMetadataSuggestions,
UploadQueueItem,
UploadQueueItemStatus,
QueueItemType,

// FACTORIES
useAnzuUserFactory,
Expand Down
44 changes: 43 additions & 1 deletion src/types/coreDam/Asset.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -54,14 +54,56 @@ export interface AssetFileProperties {
height: number
}

interface Flags {
described: boolean
visible: boolean
}

export interface AssetMetadataSuggestions extends Record<string, Array<string>> {}

export type AssetCustomData = Record<string, any>

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<string, string | number | number[] | string[] | boolean>
71 changes: 71 additions & 0 deletions src/types/coreDam/UploadQueue.ts
Original file line number Diff line number Diff line change
@@ -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<typeof setTimeout> | undefined
notificationFallbackTry: number
slotName: string | null
}

0 comments on commit 53842fe

Please sign in to comment.