@vidispine/vdt-js 23.1.0 → 23.2.0-pre.2

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/dist/index.d.ts CHANGED
@@ -1,609 +1,409 @@
1
- import * as _vidispine_types from '@vidispine/types';
2
- import { KeyValuePairType, MetadataValueType, MetadataFieldValueType, MetadataGroupValueType, MetadataType, SimpleMetadataType, FacetType, SearchResultEntryTimespanType, AudioComponentType, BinaryComponentType, FileType, TimeCodeType, ContainerComponentType, TimeBaseType, VideoComponentType, ShapeType, ItemType, TranscodePresetType } from '@vidispine/types';
3
-
1
+ import type { AudioComponentType } from '@vidispine/types';
2
+ import type { BinaryComponentType } from '@vidispine/types';
3
+ import type { ContainerComponentType } from '@vidispine/types';
4
+ import type { FacetType } from '@vidispine/types';
5
+ import type { FileType } from '@vidispine/types';
6
+ import type { ItemType } from '@vidispine/types';
7
+ import type { KeyValuePairType } from '@vidispine/types';
8
+ import type { MetadataFieldType } from '@vidispine/types';
9
+ import type { MetadataFieldValueType } from '@vidispine/types';
10
+ import type { MetadataGroupValueType } from '@vidispine/types';
11
+ import type { MetadataType } from '@vidispine/types';
12
+ import type { MetadataValueType } from '@vidispine/types';
13
+ import type { RationalType } from 'packages/types/dist';
14
+ import type { SearchFacetType } from '@vidispine/types';
15
+ import type { SearchResultEntryTimespanType } from '@vidispine/types';
16
+ import type { ShapeType } from '@vidispine/types';
17
+ import type { SimpleMetadataType } from '@vidispine/types';
18
+ import type { TimeBaseType } from '@vidispine/types';
19
+ import type { TimeCodeType } from '@vidispine/types';
20
+ import type { TranscodePresetType } from '@vidispine/types';
21
+ import type { VideoComponentType } from '@vidispine/types';
22
+
4
23
  /**
24
+ * Create a VidiCore metadata object from a more dense/simplified structure
5
25
  *
6
- * @param keyValuePairTypes
7
- * @returns
26
+ * @param input To create VidiCore metadata object of
27
+ * @returns A VidiCore metadata object
8
28
  *
9
- * @category Other
29
+ * @category Metadata
10
30
  */
11
- declare const parseKeyValuePairTypes: (keyValuePairTypes: KeyValuePairType[]) => {
12
- [k: string]: string;
13
- };
14
-
31
+ export declare const createMetadataType: (input: CreateMetadataTypeInput) => MetadataType;
32
+
33
+ export declare type CreateMetadataTypeInput = InputTimespan | InputTimespan[];
34
+
15
35
  /**
16
- * Const object with VidiCore role names
36
+ * Create a Vidicore search facet list
17
37
  *
18
- * @category Auth
38
+ * @param input array of field names or actual search facet objects
39
+ * @param options Options for creating the facet
40
+ * @returns A VidiCore facet list
41
+ *
42
+ * @category Search
19
43
  */
20
- declare const ROLE_NAMES: {
21
- readonly ACCESSCONTROL_READ: "_accesscontrol_read";
22
- readonly ACCESSCONTROL_WRITE: "_accesscontrol_write";
23
- readonly ADMINISTRATOR: "_administrator";
24
- readonly AUTO_PROJECTION_READ: "_auto_projection_read";
25
- readonly AUTO_PROJECTION_WRITE: "_auto_projection_write";
26
- readonly COLLECTION_NOTIFICATION_READ: "_collection_notification_read";
27
- readonly COLLECTION_NOTIFICATION_WRITE: "_collection_notification_write";
28
- readonly COLLECTION_READ: "_collection_read";
29
- readonly COLLECTION_WRITE: "_collection_write";
30
- readonly CONFIGURATION_READ: "_configuration_read";
31
- readonly DELETION_LOCK_NOTIFICATION_READ: "_deletion_lock_notification_read";
32
- readonly DELETION_LOCK_NOTIFICATION_WRITE: "_deletion_lock_notification_write";
33
- readonly DELETION_LOCK_READ: "_deletion_lock_read";
34
- readonly DELETION_LOCK_WRITE: "_deletion_lock_write";
35
- readonly DOCUMENT_NOTIFICATION_READ: "_document_notification_read";
36
- readonly DOCUMENT_NOTIFICATION_WRITE: "_document_notification_write";
37
- readonly DOCUMENT_READ: "_document_read";
38
- readonly DOCUMENT_WRITE: "_document_write";
39
- readonly ERROR_READ: "_error_read";
40
- readonly ERROR_WRITE: "_error_write";
41
- readonly EXPORT: "_export";
42
- readonly EXPORT_TEMPLATE_READ: "_export_template_read";
43
- readonly EXPORT_TEMPLATE_WRITE: "_export_template_write";
44
- readonly EXTERNAL_ID_READ: "_external_id_read";
45
- readonly EXTERNAL_ID_WRITE: "_external_id_write";
46
- readonly FILE_NOTIFICATION_READ: "_file_notification_read";
47
- readonly FILE_NOTIFICATION_WRITE: "_file_notification_write";
48
- readonly FILE_READ: "_file_read";
49
- readonly FILE_WRITE: "_file_write";
50
- readonly GROUP_READ: "_group_read";
51
- readonly GROUP_WRITE: "_group_write";
52
- readonly IMPORT_WRITE: "_import";
53
- readonly ITEM_ID_READ: "_item_id_read";
54
- readonly ITEM_ID_WRITE: "_item_id_write";
55
- readonly ITEM_NOTIFICATION_READ: "_item_notification_read";
56
- readonly ITEM_NOTIFICATION_WRITE: "_item_notification_write";
57
- readonly ITEM_WRITE: "_item_write";
58
- readonly ITEM_SEARCH: "_item_search";
59
- readonly ITEM_SHAPE_READ: "_item_shape_read";
60
- readonly ITEM_SHAPE_WRITE: "_item_shape_write";
61
- readonly ITEM_TIMELINE_READ: "_item_timeline_read";
62
- readonly ITEM_TIMELINE_WRITE: "_item_timeline_write";
63
- readonly ITEM_URI: "_item_uri";
64
- readonly JOB_NOTIFICATION_READ: "_job_notification_read";
65
- readonly JOB_NOTIFICATION_WRITE: "_job_notification_write";
66
- readonly JOB_READ: "_job_read";
67
- readonly JOB_WRITE: "_job_write";
68
- readonly LIBRARY_READ: "_library_read";
69
- readonly LIBRARY_WRITE: "_library_write";
70
- readonly LOCK_READ: "_lock_read";
71
- readonly LOCK_WRITE: "_lock_write";
72
- readonly LOG_READ: "_log_read";
73
- readonly METADATA_DATASET_READ: "_metadata_dataset_read";
74
- readonly METADATA_DATASET_WRITE: "_metadata_dataset_write";
75
- readonly METADATA_FIELD_GROUP_READ: "_metadata_field_group_read";
76
- readonly METADATA_FIELD_GROUP_WRITE: "_metadata_field_group_write";
77
- readonly METADATA_FIELD_READ: "_metadata_field_read";
78
- readonly METADATA_FIELD_WRITE: "_metadata_field_write";
79
- readonly METADATA_GLOBAL_READ: "_metadata_global_read";
80
- readonly METADATA_GLOBAL_WRITE: "_metadata_global_write";
81
- readonly METADATA_LOCK_READ: "_metadata_lock_read";
82
- readonly METADATA_LOCK_WRITE: "_metadata_lock_write";
83
- readonly METADATA_READ: "_metadata_read";
84
- readonly METADATA_SCHEMA_READ: "_metadata_schema_read";
85
- readonly METADATA_SCHEMA_WRITE: "_metadata_schema_write";
86
- readonly METADATA_WRITE: "_metadata_write";
87
- readonly OTIF_ANALYZE: "_otif_analyze";
88
- readonly OTIF_READ: "_otif_read";
89
- readonly OTIF_WRITE: "_otif_write";
90
- readonly PLACEHOLDER_NOTIFICATION_READ: "_placeholder_notification_read";
91
- readonly PLACEHOLDER_NOTIFICATION_WRITE: "_placeholder_notification_write";
92
- readonly PROJECTION_READ: "_projection_read";
93
- readonly PROJECTION_WRITE: "_projection_write";
94
- readonly QUOTA_NOTIFICATION_READ: "_quota_notification_read";
95
- readonly QUOTA_NOTIFICATION_WRITE: "_quota_notification_write";
96
- readonly QUOTA_READ: "_quota_read";
97
- readonly QUOTA_WRITE: "_quota_write";
98
- readonly RELATION_READ: "_relation_read";
99
- readonly RELATION_WRITE: "_relation_write";
100
- readonly RESOURCE_READ: "_resource_read";
101
- readonly RESOURCE_WRITE: "_resource_write";
102
- readonly RUN_AS: "_run_as";
103
- readonly SEARCH: "_search";
104
- readonly SEQUENCE_READ: "_sequence_read";
105
- readonly SEQUENCE_WRITE: "_sequence_write";
106
- readonly SHAPE_TAG_READ: "_shape_tag_read";
107
- readonly SHAPE_TAG_WRITE: "_shape_tag_write";
108
- readonly SITE_MANAGER: "_site_manager";
109
- readonly SITE_RULE_READ: "_site_rule_read";
110
- readonly SITE_RULE_WRITE: "_site_rule_write";
111
- readonly STORAGE_GROUP_READ: "_storage_group_read";
112
- readonly STORAGE_GROUP_WRITE: "_storage_group_write";
113
- readonly STORAGE_NOTIFICATION_READ: "_storage_notification_read";
114
- readonly STORAGE_NOTIFICATION_WRITE: "_storage_notification_write";
115
- readonly STORAGE_READ: "_storage_read";
116
- readonly STORAGE_RULE_READ: "_storage_rule_read";
117
- readonly STORAGE_RULE_WRITE: "_storage_rule_write";
118
- readonly STORAGE_WRITE: "_storage_write";
119
- readonly SUPER_ACCESS_USER: "_super_access_user";
120
- readonly TASKDEFINITION_READ: "_taskdefinition_read";
121
- readonly TASKDEFINITION_WRITE: "_taskdefinition_write";
122
- readonly THUMBNAIL_READ: "_thumbnail_read";
123
- readonly THUMBNAIL_WRITE: "_thumbnail_write";
124
- readonly TRANSCODER: "_transcoder";
125
- readonly TRANSFER_READ: "_transfer_read";
126
- readonly TRANSFER_WRITE: "_transfer_write";
127
- readonly USER: "_user";
128
- readonly VXA: "_vxa";
129
- readonly VXA_READ: "_vxa_read";
130
- };
131
- type RoleNameTypes = keyof typeof ROLE_NAMES;
132
-
133
- type InputValueTypes = string | boolean | number | Date;
134
- /** Possible input values for the field value */
135
- type InputValue = InputValueTypes | InputValueTypes[];
136
- /** Input value object for the field value */
137
- type InputValueObject = {
138
- value: string | InputValue;
139
- } & Omit<MetadataValueType, 'value'>;
140
- type InputFieldValue = InputValueObject | InputValue | InputValueObject[] | InputValue[];
141
- /** Input object to create field of */
142
- type InputFieldObject = {
143
- value: InputFieldValue;
144
- } & MetadataFieldValueType;
145
- /** Input to create a field of */
146
- type InputField = InputFieldValue | InputFieldObject;
147
- /** Input to create one or multiple groups and/or fields of */
148
- type InputGroupsOrFields = InputGroup | InputGroup[] | InputField | InputField[];
149
- /** Input object to create group of */
150
- type InputGroup = {
151
- [groupOrFieldName: string]: InputGroupsOrFields;
152
- } & Partial<MetadataGroupValueType>;
153
- /** Input to create a timespan of */
154
- type InputTimespan = {
155
- /** Start for timespan */
156
- start?: string | number;
157
- /** End for timespan */
158
- end?: string | number;
159
- /** Base for timespan (typically undefined) */
160
- base?: string;
161
- /** Group or field metadata */
162
- [groupOrFieldName: string]: InputGroupsOrFields;
44
+ export declare const createSearchFacetList: (input?: CreateSearchFacetListInput, options?: Partial<CreateSearchFacetListOptions>) => SearchFacetType[];
45
+
46
+ export declare type CreateSearchFacetListInput = (string | SearchFacetType)[];
47
+
48
+ export declare type CreateSearchFacetListOptions = {
49
+ count?: boolean;
50
+ exclude?: boolean;
163
51
  };
164
- type CreateMetadataTypeInput = InputTimespan | InputTimespan[];
52
+
165
53
  /**
166
- * Create a VidiCore metadata object from a more dense/simplified structure
54
+ * Create a TimeBase Instance from a number, string or object representation of a time base
167
55
  *
168
- * @param input To create VidiCore metadata object of
169
- * @returns A VidiCore metadata object
56
+ * @param timeBase Input to create time base from
57
+ * @returns A TimeBase instance
170
58
  *
171
- * @category Metadata
59
+ * @category Time
172
60
  */
173
- declare const createMetadataType: (input: CreateMetadataTypeInput) => MetadataType;
174
-
175
- type ParsedValueAttributes = Partial<Omit<MetadataValueType, 'value'>>;
176
- type ParsedValue<TOptions> = TOptions extends {
177
- includeValueAttributes?: false;
178
- } ? string : {
179
- value: string;
180
- } & ParsedValueAttributes;
181
- type ParseValueOptions = {
182
- /** Include attributes on value (`true` for all) */
183
- includeValueAttributes?: boolean | (keyof ParsedValueAttributes)[];
184
- };
185
-
186
- type ParsedValueList<TOptions> = TOptions extends {
187
- joinValue?: string;
188
- includeValueAttributes?: false;
189
- } ? string : TOptions extends {
190
- arrayOnSingleValue?: true;
191
- } ? ParsedValue<TOptions>[] : ParsedValue<TOptions> | ParsedValue<TOptions>[];
192
- interface ParseValueListOptions extends ParseValueOptions {
193
- /** String to join the values, (e.g. `,`) */
194
- joinValue?: string;
195
- /** Return values as array even if single value */
196
- arrayOnSingleValue?: boolean;
197
- }
198
-
199
- type ParsedFieldAttributes = Partial<Omit<MetadataFieldValueType, 'value'>>;
200
- type ParsedFieldObject<TOptions> = {
201
- value: ParsedValueList<TOptions>;
202
- } & ParsedFieldAttributes;
203
- type ParsedField<TOptions> = TOptions extends {
204
- includeFieldAttributes?: false;
205
- } ? ParsedValueList<TOptions> : ParsedFieldObject<TOptions>;
206
- interface ParseFieldOptions extends ParseValueListOptions {
207
- /** Include attributes on field (`true` for all) */
208
- includeFieldAttributes?: boolean | (keyof ParsedFieldAttributes)[];
209
- }
210
-
211
- interface ParseFieldListOptions extends ParseFieldOptions {
212
- /** Return fields as list */
213
- fieldAsList?: boolean;
214
- /** Return fields as array even if only one field */
215
- arrayOnSingleField?: boolean;
216
- /** Return all fields flattened (Note: keys might be overridden) */
217
- overrideField?: boolean;
218
- }
219
- type ParsedFieldList<TOptions> = TOptions extends {
220
- fieldAsList?: true;
221
- } ? ParsedField<TOptions>[] : TOptions extends {
222
- arrayOnSingle?: true;
223
- arrayOnSingleField?: undefined | true;
224
- } | {
225
- arrayOnSingleField?: true;
226
- } ? {
227
- [name: string]: ParsedField<TOptions>[];
228
- } : TOptions extends {
229
- flat?: true;
230
- overrideField?: true | undefined;
231
- } | {
232
- overrideField?: true;
233
- } ? {
234
- [name: string]: ParsedField<TOptions>;
235
- } : {
236
- [name: string]: ParsedField<TOptions> | ParsedField<TOptions>[];
61
+ export declare const createTimeBase: (timeBase: TimeBaseInput | string | number) => TimeBase;
62
+
63
+ /**
64
+ * Create a TimeCode instance from smpte, seconds/samples, timeCode object or string
65
+ *
66
+ * @param timeCode Smpte, seconds/samples, timeCode object or string
67
+ * @param options For the format functions
68
+ * @returns A TimeCode instance
69
+ *
70
+ * @category Time
71
+ */
72
+ export declare const createTimeCode: (timeCode: TimeCodeInput | string | number, options?: CreateTimeCodeOptions) => TimeCode;
73
+
74
+ export declare type CreateTimeCodeOptions = TimeCodeInputOptions | FormatTimeCodeSmpteOptions | FormatTimeCodeSecondsOptions | FormatTimeCodeTextOptions;
75
+
76
+ /**
77
+ * Const object with document types
78
+ *
79
+ * @category Shape
80
+ */
81
+ export declare const DOCUMENT_TYPES: {
82
+ readonly PDF: "PDF";
83
+ readonly TEXT: "TEXT";
84
+ readonly MSWORD: "MSWORD";
85
+ readonly JSON: "JSON";
86
+ readonly XML: "XML";
237
87
  };
88
+
89
+ declare type DocumentType_2 = keyof typeof DOCUMENT_TYPES;
90
+ export { DocumentType_2 as DocumentType }
91
+
238
92
  /**
239
- * Parse a metadata field list according to selected options
93
+ * Array with all available metadata field attributes
94
+ *
95
+ * @category Metadata
96
+ */
97
+ export declare const FIELD_ATTRIBUTE_KEYS: (keyof MetadataFieldValueType)[];
98
+
99
+ /**
100
+ * Array with all VidiCore system field definition types
240
101
  *
241
102
  * @remarks
242
- * When parsing duplicate fields (same field name in the same field list) it will:
243
- * - with default options: combine field values to one array within the same field name key
244
- * - with `joinValue` enabled: join values within each field (returns array with string for each field value)
245
- * - with `fieldAsList` enabled: separate fields in the list/array (as usual, even if not duplicate)
246
- * - with `includeFieldAttributes` enabled: return an array of field objects
247
- * - with `overrideField` enabled: return the latest duplicated field it parses
103
+ * The `-noindex` and `-sortable` suffix for types has been replaced with boolean options in field definitions (since 4.1).
248
104
  *
249
- * @param fieldList Field list to parse
250
- * @param [options=defaultOptions] Options for how to parse the field list
251
- * @returns A parsed field list
105
+ * @category Field
106
+ */
107
+ export declare const FIELD_DEFINITION_TYPES: readonly ["date", "float", "integer", "long", "string", "string-exact", "boolean", "timeCode"];
108
+
109
+ /**
110
+ * Array with all available metadata field value attributes
252
111
  *
253
112
  * @category Metadata
254
113
  */
255
- declare const parseFieldList: <TOptions extends ParseFieldListOptions = ParseFieldListOptions>(fieldList: MetadataFieldValueType[], options?: TOptions) => ParsedFieldList<TOptions>;
256
-
257
- type ParsedGroupAttributes = Omit<MetadataGroupValueType, 'field' | 'group'>;
258
- interface ParseGroupOptions extends ParseFieldListOptions {
259
- /** Include group attributes (`true` for all) */
260
- includeGroupAttributes?: boolean | (keyof ParsedGroupAttributes)[];
261
- /** Return groups as list */
262
- groupAsList?: boolean;
263
- /** Return groups as array even if only one group */
264
- arrayOnSingleGroup?: boolean;
265
- /** Return all groups flattened (Note: keys might be overridden) */
266
- overrideGroup?: boolean;
267
- }
268
- type ParsedGroup<TOptions> = ((TOptions extends {
269
- groupAsList?: true;
270
- } ? {
271
- group?: ParsedGroupList<TOptions>;
272
- } : {
273
- [name: string]: ParsedGroupList<TOptions>;
274
- }) & (TOptions extends {
275
- fieldAsList?: true;
276
- } ? {
277
- field?: ParsedFieldList<TOptions>;
278
- } : {
279
- [name: string]: ParsedFieldList<TOptions>;
280
- })) & ParsedGroupAttributes;
281
- type ParseGroupListOptions = ParseGroupOptions;
282
- type ParsedGroupList<TOptions> = TOptions extends {
283
- groupAsList?: true;
284
- } ? ParsedGroup<TOptions>[] : TOptions extends {
285
- arrayOnSingle?: true;
286
- arrayOnSingleGroup?: true | undefined;
287
- } | {
288
- arrayOnSingleGroup?: true;
289
- } ? {
290
- [groupName: string]: ParsedGroup<TOptions>[];
291
- } : TOptions extends {
292
- flat?: true;
293
- overrideGroup?: true | undefined;
294
- } | {
295
- overrideGroup?: true;
296
- } ? {
297
- [groupName: string]: ParsedGroup<TOptions>;
298
- } : {
299
- [groupName: string]: ParsedGroup<TOptions> | ParsedGroup<TOptions>[];
300
- };
114
+ export declare const FIELD_VALUE_ATTRIBUTE_KEYS: (keyof MetadataValueType)[];
115
+
301
116
  /**
302
- * Parse a metadata group list according to selected options
117
+ * Const object with all file states in VidiCore
118
+ * (see https://apidoc.vidispine.com/latest/storage/storage.html#file-states for more info)
303
119
  *
304
- * @remarks
305
- * Parsing duplicate groups (same group name in the same group list) it will:
306
- * - with default options: combine group objects to one array within the same group name key
307
- * - with `groupAsList` enabled: return separate group objects in a list/array (as usual, even if not duplicate)
308
- * - with `overrideGroup` enabled: return the latest duplicated group it parses
120
+ * @category File
121
+ */
122
+ export declare const FILE_STATES: {
123
+ /** Just created, not used. */
124
+ readonly NONE: "NONE";
125
+ /** Discovered or created, not yet marked as finished. */
126
+ readonly OPEN: "OPEN";
127
+ /** File does no longer grow. */
128
+ readonly CLOSED: "CLOSED";
129
+ /** The current state is not known. */
130
+ readonly UNKNOWN: "UNKNOWN";
131
+ /** File is missing from the file system/storage. */
132
+ readonly MISSING: "MISSING";
133
+ /** File has been missing for a longer period. Candidate for restoration from archive. */
134
+ readonly LOST: "LOST";
135
+ /** File will appear on file system/storage, transfer subsystem or transcoder will create it. */
136
+ readonly TO_APPEAR: "TO_APPEAR";
137
+ /** The file is no longer in use, and will be deleted at the next clean-up sweep. */
138
+ readonly TO_BE_DELETED: "TO_BE_DELETED";
139
+ /** File is in use by transfer subsystem or transcoder. */
140
+ readonly BEING_READ: "BEING_READ";
141
+ /** File is archived. */
142
+ readonly ARCHIVED: "ARCHIVED";
143
+ /** File will be synchronized by multi-site agent. */
144
+ readonly AWAITING_SYNC: "AWAITING_SYNC";
145
+ };
146
+
147
+ export declare type FileStateTypes = keyof typeof FILE_STATES;
148
+
149
+ export declare type FilteredShapeListObject = {
150
+ src: string;
151
+ type: string;
152
+ shape: ShapeType;
153
+ parsedShape: ParsedShapeType;
154
+ [key: string]: string | ParsedShapeType | ShapeType;
155
+ };
156
+
157
+ /**
158
+ * Filter a shape type list to get shapes that are playable in a browser
309
159
  *
310
- * @param groupList Group list to parse
311
- * @param options options for how to parse list
312
- * @returns A parsed group list
160
+ * @param itemType
161
+ * @param options
162
+ * @returns
313
163
  *
314
- * @category Metadata
164
+ * @category Shape
315
165
  */
316
- declare const parseGroupList: <TOptions extends ParseGroupOptions = ParseGroupOptions>(groupList: MetadataGroupValueType[], options?: TOptions) => ParsedGroupList<TOptions>;
317
-
318
- type ParsedTimespanAttributes = Omit<MetadataType['timespan'][number], 'field' | 'group'>;
319
- interface ParseTimespanOptions extends ParseGroupListOptions {
320
- /** Include attributes on timespan (`true` for all) */
321
- includeTimespanAttributes?: boolean | (keyof ParsedTimespanAttributes)[];
322
- /** Return groups, fields, and values as array */
323
- arrayOnSingle?: boolean;
324
- /** Flatten timespan, groups and fields (Note: keys might be overridden) */
325
- flat?: boolean;
326
- }
327
- type ParsedTimespan<TOptions> = ((TOptions extends {
328
- groupAsList?: true;
329
- } ? {
330
- group?: ParsedGroupList<TOptions>;
331
- } : {
332
- [name: string]: ParsedGroupList<TOptions>;
333
- }) & (TOptions extends {
334
- fieldAsList?: true;
335
- } ? {
336
- field?: ParsedFieldList<TOptions>;
337
- } : {
338
- [name: string]: ParsedFieldList<TOptions>;
339
- })) & ParsedTimespanAttributes;
166
+ export declare const filterShapeSource: (itemType: ItemType, options?: FilterShapeSourceOption) => FilteredShapeListObject[];
167
+
168
+ export declare type FilterShapeSourceOption = {
169
+ sortPriority?: Function;
170
+ allowedMimeTypes?: string[];
171
+ allowedMethods?: string[];
172
+ sourceKey?: string;
173
+ mimeTypeKey?: string;
174
+ shapeKey?: string;
175
+ parsedShapeKey?: string;
176
+ };
177
+
340
178
  /**
341
- *
342
- * Parses timespan according to specified options
179
+ * Find the thumbnail uri in a VidiCore item object that's nearest a timeCode
343
180
  *
344
181
  * @remarks
345
- * To ensure a flat (no array) representation when using `flat: true`, the parser will also set `overrideGroup` and `overrideField` to true (unless those are explicitly set false)
346
- *
347
- * @param timespan - A VidiCore metadata timespan
348
- * @param options - Options to change how it is parsed
349
- * @returns Timespan parsed according to options
182
+ * Time code is included in path of VidiCore thumbnail uris
350
183
  *
351
- * @see {@link parseGroupList} and {@link parseFieldList} for more info
184
+ * @param itemType A VidiCore item object
185
+ * @param timeCode A timeCode to find nearest thumbnail to
186
+ * @returns A URI of a thumbnail, `undefined` if item has no thumbnails
352
187
  *
353
- * @category Metadata
188
+ * @category Thumbnail
354
189
  */
355
- declare const parseTimespan: <TOptions extends ParseTimespanOptions = ParseTimespanOptions>(timespan: MetadataType['timespan'][number], options?: TOptions) => ParsedTimespan<TOptions>;
356
-
357
- type ParsedTimespanList<TOptions> = TOptions extends {
358
- timespanAsList?: true;
359
- } ? ParsedTimespan<TOptions>[] : TOptions extends {
360
- flat?: true;
361
- onlyGeneric?: true | undefined;
362
- } | {
363
- onlyGeneric?: true;
364
- } ? ParsedTimespan<TOptions> : {
365
- [timespanKey: string]: ParsedTimespan<TOptions>[];
366
- };
367
- interface ParseTimespanListOptions extends ParseTimespanOptions {
368
- /** Return timespans as list */
369
- timespanAsList?: boolean;
370
- /** String to join timespans with (defaults to '_') */
371
- joinTimespan?: string;
372
- /** Sort timespanList by ascending start then end time */
373
- sortTimespan?: boolean;
374
- /** Return a flat representation - only one timespan with groups/fields named the same as single - of the timespan list (Note: timespans/fields/groups can be overridden) */
375
- flat?: boolean;
376
- /** Flatten timespans to one object with generic timespan having highest priority (Note: fields/groups might be overridden) */
377
- flatTimespan?: boolean;
378
- }
190
+ export declare const findNearestThumbnail: (itemType: ItemType, timeCode: TimeCode | TimeCodeInput) => string;
191
+
379
192
  /**
380
- * Parses timespanList according to specified options.
381
- * The attributes can be targeted for each sub-type.
193
+ * Format a string representation of a time base to a TimeBase Instance
382
194
  *
383
- * @param timespanList - A Vidicore metadata timespan list
384
- * @param options - Options which change how the metadataType is parsed.
385
- * @returns Timespan list parsed according to options
195
+ * @param timeBaseText The string to format to a TimeBase instance
196
+ * @returns A TimeBase Instance
386
197
  *
387
- * @see {@link parseTimespan} for more info
198
+ * @category Time
199
+ */
200
+ export declare const formatTimeBaseText: (timeBaseText?: string | number) => TimeBase;
201
+
202
+ /**
203
+ * Create a TimeBase instance of an object
388
204
  *
389
- * @category Metadata
205
+ * @param timeBase A TimeBase object
206
+ * @returns A TimeBase instance
207
+ *
208
+ * @category Time
390
209
  */
391
- declare const parseTimespanList: <TOptions extends ParseTimespanListOptions = ParseTimespanListOptions>(timespanList: MetadataType['timespan'], options?: TOptions) => ParsedTimespanList<TOptions>;
392
-
393
- type ParsedMetadataAttributes = Partial<Omit<MetadataType, 'timespan' | 'revision'> & {
394
- revision?: string[];
395
- }>;
396
- type ParsedMetadataType<TOptions> = (TOptions extends {
397
- timespanAsList?: true;
398
- } ? {
399
- timespan: ParsedTimespanList<TOptions>;
400
- } : TOptions extends {
401
- flat?: true;
402
- } ? ParsedTimespanList<TOptions> : {
403
- [timespanKey: string]: ParsedTimespanList<TOptions>;
404
- }) & (TOptions extends {
405
- includeMetadataAttributes?: true | string[];
406
- } ? ParsedMetadataAttributes : {});
407
- interface ParseMetadataTypeOptions extends ParseTimespanListOptions {
408
- /** Include metadata attributes (`true` for all) */
409
- includeMetadataAttributes?: boolean | (keyof ParsedMetadataAttributes)[];
410
- /** Flatten timespans, groups and fields (Note: keys might be overridden) */
411
- flat?: boolean;
412
- }
210
+ export declare const formatTimeBaseType: (timeBase: TimeBaseInput) => TimeBase;
211
+
413
212
  /**
414
- * Parses MetadataType according to specified options
213
+ * Format seconds to TimeCode object
415
214
  *
416
215
  * @remarks
417
- * Be aware that you need to take into account that the returned groups and fields can be an array if it has multiple values or groups/fields with same name.
418
- * If you are certain your metadata type won't return multiple groups/fields/values with same name or don't mind that they _might_ be overridden:
419
- * you can use the option `flat` along with `joinValue` or `arrayOnSingleValue: false`.
216
+ * Input time base is always considered as 1:1 since it expects seconds as input
420
217
  *
421
- * @param metadataType - A MetadataType from VidiCore
422
- * @param options - Options which change how the metadataType is parsed
423
- * @returns Metadata object parsed according to options
218
+ * Note: Max 15 digits accuracy (double precision float64), e.g.
219
+ * - 10^6 seconds can have 10^9 decimals (nanosecond) precision
220
+ * - 10^9 seconds can have 10^6 decimals (microsecond) precision
221
+ * - 10^12 seconds can have 10^3 decimals (millisecond) precision
424
222
  *
425
- * @see {@link parseTimespanList} for more info
223
+ * @param seconds With or without decimals ("." and "," are both interpreted as decimal)
224
+ * @param options Options for how to format the seconds to a TimeCode
225
+ * @returns A TimeCode instance
426
226
  *
427
- * @category Metadata
227
+ * @category Time
428
228
  */
429
- declare function parseMetadataType<TOptions extends ParseMetadataTypeOptions = ParseMetadataTypeOptions>(metadataType: MetadataType, options?: TOptions): ParsedMetadataType<TOptions>;
430
-
229
+ export declare const formatTimeCodeSeconds: (seconds: string | number, options?: FormatTimeCodeSecondsOptions) => TimeCode;
230
+
231
+ export declare interface FormatTimeCodeSecondsOptions extends TimeCodeInputOptions {
232
+ /**
233
+ * The TimeBase the output TimeCode should have
234
+ *
235
+ * Note: if unset and useGCD=false, denominator will be 10^(amount-of-decimals)
236
+ */
237
+ timeBase?: number | string | TimeBaseInput;
238
+ /**
239
+ * Samples and denominator are divided with GCD
240
+ *
241
+ * e.g. `1.04 => 104@100 => 26@25` (if no explicit `timeBase` is set)
242
+ */
243
+ useGCD?: boolean;
244
+ }
245
+
431
246
  /**
432
- * Parse simple (key/value) metadata
247
+ * Format smpte text to a TimeCode Instance
433
248
  *
434
- * Not indexed metadata, available on almost all entities (storages, library, user, group, etc...)
249
+ * Options for `exceedingMode`:
250
+ * - `add` will be overflow to higher unit (e.g. PAL and 00:00:00:25 => 00:00:01:00)
251
+ * - `ignore` will be truncated (e.g. PAL and 00:00:00:25 => 00:00:00:24)
252
+ * - `error` will throw error (e.g. PAL and 00:00:00:25 => Error)
435
253
  *
436
- * @param simpleMetadataType A VidiCore simple metadata object
437
- * @returns A parsed simple metadata object
254
+ * @param smpte String representation of smpte
255
+ * @param options Options for creating the time code from smpte
256
+ * @returns TimeCode instance created from smpte string
438
257
  *
439
- * @category Metadata
258
+ * @category Time
440
259
  */
441
- declare const parseSimpleMetadataType: (simpleMetadataType: SimpleMetadataType) => {
442
- [key: string]: string;
443
- };
444
-
445
- type MetadataTypeToWebVttOptions = {
446
- /** Name of group containing subtitle field/text */
447
- subtitleGroup?: string;
448
- /** Name of field (text) to use for the subtitles */
449
- subtitleField?: string;
450
- };
260
+ export declare const formatTimeCodeSmpte: (smpte: string, options?: FormatTimeCodeSmpteOptions) => TimeCode;
261
+
262
+ export declare interface FormatTimeCodeSmpteOptions extends TimeCodeInputOptions {
263
+ /** TimeBase of smpte (and consequently TimeBase of output TimeCode) */
264
+ timeBase?: number | string | TimeBaseInput;
265
+ /** How to handle exceeding values (default `error`) */
266
+ exceedingMode?: 'add' | 'ignore' | 'error';
267
+ }
268
+
451
269
  /**
452
- * Convert metadata subtitle groups to WebVtt subtitles
270
+ * Format text to a TimeCode instance
453
271
  *
454
- * @param metadataType - Vidicore metadata object (should include subtitleGroup and subtitleField)
455
- * @param options - options for how to map subtitle group
456
- * @returns WebVtt subtitles
272
+ * @returns A TimeCode instance
457
273
  *
458
- * @category Metadata
274
+ * @category Time
459
275
  */
460
- declare const metadataTypeToWebVtt: (metadataType: MetadataType, options?: MetadataTypeToWebVttOptions) => string;
461
-
276
+ export declare const formatTimeCodeText: (timeCodeText?: number | string, options?: FormatTimeCodeTextOptions) => TimeCode;
277
+
278
+ export declare interface FormatTimeCodeTextOptions extends TimeCodeInputOptions {
279
+ /** The time base the returned TimeCode should have */
280
+ timeBase?: number | string | TimeBaseInput;
281
+ }
282
+
462
283
  /**
463
- * Array with all available VidiCore system/default field group names
284
+ * Format an object to a TimeCode instance
464
285
  *
465
- * @category Metadata
286
+ * @param timeCode To create TimeCode instance of
287
+ * @param options For the TimeCode constructor
288
+ * @returns A TimeCode instance
289
+ *
290
+ * @category Time
466
291
  */
467
- declare const SYSTEM_FIELDGROUPS: readonly ["stl_subtitle", "stl_tti", "stl_gsi", "mrk_marker", "pho_validation", "pho_resource", "pho_error", "facedetect_rect", "facedetect_face", "originalTrackFilename", "stl_gsiHeader"];
468
-
292
+ export declare const formatTimeCodeType: (timeCode: TimeCodeInput, options?: TimeCodeInputOptions) => TimeCode;
293
+
469
294
  /**
470
- * Array with all available VidiCore system/default field names (including transient)
295
+ * Return a const for the document type of a shape (looks at mimeType)
471
296
  *
472
- * @category Metadata
297
+ * @param shape A VidiCore shape
298
+ * @returns The document type for a shape
299
+ *
300
+ * @category Shape
473
301
  */
474
- declare const SYSTEM_FIELDS: readonly ["title", "user", "shapeTag", "representativeThumbnail", "representativeThumbnailNoAuth", "representativeItems", "itemId", "collectionId", "mediaType", "mimeType", "created", "startTimeCode", "startSeconds", "fieldValidationError", "schemaValidationError", "originalFilename", "originalUri", "originalAudioCodec", "originalVideoCodec", "originalHeight", "originalWidth", "originalFormat", "durationSeconds", "durationTimeCode", "solr-index", "__user", "__collection", "__collection_size", "__ancestor_collection", "__ancestor_collection_size", "__shape", "__shape_size", "__shape_last_added", "__placeholder_shape_size", "__version", "__version_count", "__storage", "__storage_size", "__shapetag_{tag}_hash_{hash}", "__storage_{tag}", "__storage_{tag}_size", "__storagegroup", "__storagegroup_size", "__sequence", "__sequence_size", "__metadata_last_modified", "__external_id", "__deletion_lock_id", "__deletion_lock_expiry", "__child_collection", "__child_collection_size", "__parent_collection", "__parent_collection_size", "__items_size", "stl_text", "stl_justification", "stl_xrelative", "stl_yrelative", "stl_vertical", "stl_verticalbase", "stl_horizontalbase", "stl_sizerelative", "stl_color", "stl_outline", "stl_outlinecolor", "stl_outlinesize", "stl_font", "stl_service", "stl_tti", "stl_gsi", "cct", "tcd", "tcf", "oet", "cd", "mnc", "cpn", "dfc", "tcp", "tcs", "tet", "tnb", "tnd", "en", "co", "tng", "rd", "mnr", "dsc", "opt", "lc", "tpt", "tn", "slr", "tns", "rn", "pub", "dsn", "ecd", "mrk_zerolength", "mrk_text", "mrk_color", "pho_resource_name", "pho_error_level", "pho_error_code", "pho_error_description", "facedetect_rect_width", "facedetect_rect_height", "facedetect_rect_y", "facedetect_rect_x", "facedetect_pid", "facedetect_rect", "trackId", "eidr_actor", "eidr_alternateId", "eidr_countryOfOrigin", "eidr_director", "eidr_id", "eidr_referentType", "eidr_releaseDate", "eidr_resourceName", "eidr_status", "eidr_sync", "ttml_div", "ttml_root", "vxa_collection_id", "vxaId", "vxaLocalPath", "tco", "cs", "ebn", "tf", "cf", "sgn", "tci", "jc", "vp", "sn"];
475
-
302
+ export declare const getShapeDocumentType: (shape?: ShapeType) => DocumentType_2;
303
+
476
304
  /**
477
- * Array with all available metadata field value attributes
305
+ * Returns a const for which media type a shape has
478
306
  *
479
- * @category Metadata
307
+ * @param shape
308
+ * @returns
309
+ *
310
+ * @category Shape
480
311
  */
481
- declare const FIELD_VALUE_ATTRIBUTE_KEYS: (keyof MetadataValueType)[];
482
-
312
+ export declare const getShapeMediaType: (shape: ShapeType) => ShapeMediaType;
313
+
483
314
  /**
484
- * Array with all available metadata field attributes
315
+ * Array with all available metadata group attributes
485
316
  *
486
317
  * @category Metadata
487
318
  */
488
- declare const FIELD_ATTRIBUTE_KEYS: (keyof MetadataFieldValueType)[];
489
-
490
- /**
491
- * Array with all available metadata group attributes
492
- *
493
- * @category Metadata
494
- */
495
- declare const GROUP_ATTRIBUTE_KEYS: (keyof MetadataGroupValueType)[];
496
-
497
- type CreateFacetTypeFieldList = string[];
498
- type CreateFacetTypeOptions = {
499
- count: boolean;
500
- };
501
- /**
502
- * Create a Vidicore facet list
503
- *
504
- * @param fieldList Input to create facet of
505
- * @param options Options for creating the facet
506
- * @returns A VidiCore facet list
507
- *
508
- * @category Search
509
- */
510
- declare const createFacetType: (fieldList?: CreateFacetTypeFieldList, options?: Partial<CreateFacetTypeOptions>) => {
511
- field: string;
512
- name: string;
513
- count: boolean;
514
- exclude: CreateFacetTypeFieldList;
515
- }[];
516
-
517
- type ParsedFacetTypeCount = {
518
- [fieldValue: string]: number;
519
- };
520
- /** Parsed facet type */
521
- type ParsedFacetType = {
522
- [fieldName: string]: ParsedFacetTypeCount;
319
+ export declare const GROUP_ATTRIBUTE_KEYS: (keyof MetadataGroupValueType)[];
320
+
321
+ /** Input to create a field of */
322
+ export declare type InputField = InputFieldValue | InputFieldObject;
323
+
324
+ /** Input object to create field of */
325
+ export declare type InputFieldObject = {
326
+ value: InputFieldValue;
327
+ } & MetadataFieldValueType;
328
+
329
+ export declare type InputFieldValue = InputValueObject | InputValue | InputValueObject[] | InputValue[];
330
+
331
+ /** Input object to create group of */
332
+ export declare type InputGroup = {
333
+ [groupOrFieldName: string]: InputGroupsOrFields;
334
+ } & Partial<MetadataGroupValueType>;
335
+
336
+ /** Input to create one or multiple groups and/or fields of */
337
+ export declare type InputGroupsOrFields = InputGroup | InputGroup[] | InputField | InputField[];
338
+
339
+ /** Input to create a timespan of */
340
+ export declare type InputTimespan = {
341
+ /** Start for timespan */
342
+ start?: string | number;
343
+ /** End for timespan */
344
+ end?: string | number;
345
+ /** Base for timespan (typically undefined) */
346
+ base?: string;
347
+ /** Group or field metadata */
348
+ [groupOrFieldName: string]: InputGroupsOrFields;
523
349
  };
350
+
351
+ /** Possible input values for the field value */
352
+ export declare type InputValue = InputValueTypes | InputValueTypes[];
353
+
354
+ /** Input value object for the field value */
355
+ export declare type InputValueObject = {
356
+ value: string | InputValue;
357
+ } & Omit<MetadataValueType, 'value'>;
358
+
359
+ export declare type InputValueTypes = string | boolean | number | Date;
360
+
524
361
  /**
525
- * Parse a VidiCore facet type list
362
+ * Convert metadata subtitle groups to WebVtt subtitles
526
363
  *
527
- * @param facetType A facet type list to parse
528
- * @returns A parsed facet type list
364
+ * @param metadataType - Vidicore metadata object (should include subtitleGroup and subtitleField)
365
+ * @param options - options for how to map subtitle group
366
+ * @returns WebVtt subtitles
529
367
  *
530
- * @category Search
368
+ * @category Metadata
531
369
  */
532
- declare const parseFacetType: (facetType?: FacetType[]) => ParsedFacetType;
533
-
534
- type ParseHighlightTimespanOptions = {
535
- /** Return an array if there is a single value */
536
- arrayOnSingle?: boolean;
537
- /** Return timespans as list */
538
- timespanAsList?: boolean;
539
- /** String to join the values (e.g. `,`) */
540
- joinValue?: string;
541
- };
542
- type ParsedHighlightTimespan = {
543
- start?: string;
544
- end?: string;
545
- [key: string]: string | string[];
370
+ export declare const metadataTypeToWebVtt: (metadataType: MetadataType, options?: MetadataTypeToWebVttOptions) => string;
371
+
372
+ export declare type MetadataTypeToWebVttOptions = {
373
+ /** Name of group containing subtitle field/text */
374
+ subtitleGroup?: string;
375
+ /** Name of field (text) to use for the subtitles */
376
+ subtitleField?: string;
546
377
  };
378
+
547
379
  /**
548
- * Parses highlight timespan in VidiCore into key/value object.
549
- * The attributes can be targeted for each sub-type.
550
- * @param timespan - A VidiCore search timespan
551
- * @param options - Options which change how the timespans are parsed
380
+ * Parses the technical information of a AudioComponentType.
381
+ * @param audioComponentType - A AudioComponentType from VidiCore.
382
+ * @returns Parsed component object.
552
383
  *
553
- * @category Search
384
+ * @category Shape
554
385
  */
555
- declare const parseHighlightTimespan: (timespan: SearchResultEntryTimespanType, options: ParseHighlightTimespanOptions) => ParsedHighlightTimespan;
556
-
557
- interface ParseHighlightTimespanListOptions extends ParseHighlightTimespanOptions {
558
- /** Return parsed timespan as list (in an array) */
559
- timespanAsList?: boolean;
560
- /** Character to join the start/end time codes with */
561
- joinTimespan?: string;
562
- /** Flatten to field-name/field-value (Note: field-values may be overwritten) */
563
- flat?: boolean;
564
- /** Flatten timespan to object with start/end as key */
565
- flatTimespan?: boolean;
566
- }
386
+ export declare const parseAudioComponent: (audioComponentType: AudioComponentType) => ParsedAudioComponentType;
387
+
567
388
  /**
568
- * Parses highlight timespans from VidiCore into key/value object.
569
- * The attributes can be targeted for each sub-type.
570
- *
571
- * @param highlightTimespanList - A list of timespans from VidiCore.
572
- * @param options - Options to change how the timespans are parsed
389
+ * Parses the technical information of a BinaryComponentType.
390
+ * @param binaryComponentType - A BinaryComponentType from VidiCore.
391
+ * @returns Parsed component object.
573
392
  *
574
- * @category Search
393
+ * @category Shape
575
394
  */
576
- declare const parseHighlightTimespanList: (highlightTimespanList?: SearchResultEntryTimespanType[], options?: ParseHighlightTimespanListOptions) => ParsedHighlightTimespan | ParsedHighlightTimespan[];
577
-
395
+ export declare const parseBinaryComponent: (binaryComponentType?: BinaryComponentType) => ParsedBinaryComponentType;
396
+
578
397
  /**
579
- * Parse Vidicore "NOW" constants to a date object
580
- *
581
- * Format: `NOW[+/-][number][HOUR/DAY/MONTH/YEAR(s)]` (e.g. "NOW-2HOURS")
582
- *
583
- * @remarks
584
- * Returns an approximate date since it's created client side
585
- *
586
- * @param value A "NOW" constant
587
- * @returns A date from the NOW constant
398
+ * Parses the technical information of a ContainerComponentType.
399
+ * @param containerComponentType - A ContainerComponentType from VidiCore.
400
+ * @returns Parsed component object.
588
401
  *
589
- * @category Search
402
+ * @category Shape
590
403
  */
591
- declare const parseNowDate: (value?: string) => Date;
592
-
593
- type ParsedBaseMediaInfoType = {
594
- Bit_rate_mode?: string;
595
- Source?: string;
596
- } & {
597
- [key: string]: string;
598
- };
599
- type ParsedAudioMediaInfoType = ParsedBaseMediaInfoType;
600
- type ParsedBinaryMediaInfoType = ParsedBaseMediaInfoType;
601
- type ParsedVideoMediaInfoType = ParsedBaseMediaInfoType & {
602
- Format_Settings_GOP?: string;
603
- intra_dc_precision?: string;
604
- };
605
-
606
- type ParsedAudioComponentType = {
404
+ export declare const parseContainerComponent: (containerComponentType?: ContainerComponentType) => ParsedContainerComponentType;
405
+
406
+ export declare type ParsedAudioComponentType = {
607
407
  audioFormat?: string;
608
408
  audioCodec?: string;
609
409
  audioSamplerate?: string;
@@ -618,56 +418,29 @@ type ParsedAudioComponentType = {
618
418
  };
619
419
  audioMediaInfo?: ParsedAudioMediaInfoType;
620
420
  };
621
- /**
622
- * Parses the technical information of a AudioComponentType.
623
- * @param audioComponentType - A AudioComponentType from VidiCore.
624
- * @returns Parsed component object.
625
- *
626
- * @category Shape
627
- */
628
- declare const parseAudioComponent: (audioComponentType: AudioComponentType) => ParsedAudioComponentType;
629
-
630
- type ParsedBinaryComponentType = {
421
+
422
+ export declare type ParsedAudioMediaInfoType = ParsedBaseMediaInfoType;
423
+
424
+ export declare type ParsedBaseMediaInfoType = {
425
+ Bit_rate_mode?: string;
426
+ Source?: string;
427
+ } & {
428
+ [key: string]: string;
429
+ };
430
+
431
+ export declare type ParsedBinaryComponentType = {
631
432
  binaryMetadata?: {
632
433
  [key: string]: string;
633
434
  };
634
435
  binaryMediaInfo?: ParsedBinaryMediaInfoType;
635
436
  };
636
- /**
637
- * Parses the technical information of a BinaryComponentType.
638
- * @param binaryComponentType - A BinaryComponentType from VidiCore.
639
- * @returns Parsed component object.
640
- *
641
- * @category Shape
642
- */
643
- declare const parseBinaryComponent: (binaryComponentType?: BinaryComponentType) => ParsedBinaryComponentType;
644
-
645
- type ParsedFileType = {
646
- uri?: string;
647
- hash?: string;
648
- fileSize?: string;
649
- fileSizeBytes?: number;
650
- path?: string;
651
- fileName?: string;
652
- fileId?: string;
653
- };
654
- /**
655
- * Parses a VidiCore file object
656
- *
657
- * @remarks
658
- * File sizes are parsed with JEDEC standard (base 2)
659
- *
660
- * @param fileType VidiCore file object
661
- * @returns A parsed file object
662
- *
663
- * @category File
664
- */
665
- declare const parseFileType: (fileType: FileType) => ParsedFileType;
666
-
437
+
438
+ export declare type ParsedBinaryMediaInfoType = ParsedBaseMediaInfoType;
439
+
667
440
  /**
668
441
  * Parsed container component
669
442
  */
670
- type ParsedContainerComponentType = {
443
+ export declare type ParsedContainerComponentType = {
671
444
  containerFormat?: string;
672
445
  videoFormat?: string;
673
446
  audioFormat?: string;
@@ -682,617 +455,566 @@ type ParsedContainerComponentType = {
682
455
  };
683
456
  containerMediaInfo?: ParsedBaseMediaInfoType;
684
457
  } & ParsedFileType;
685
- /**
686
- * Parses the technical information of a ContainerComponentType.
687
- * @param containerComponentType - A ContainerComponentType from VidiCore.
688
- * @returns Parsed component object.
689
- *
690
- * @category Shape
691
- */
692
- declare const parseContainerComponent: (containerComponentType?: ContainerComponentType) => ParsedContainerComponentType;
693
-
694
- type TimeBaseInput = {
695
- /** The numerator for the TimeBase */
696
- numerator?: number | string;
697
- /** The denominator for the TimeBase */
698
- denominator?: number | string;
458
+
459
+ export declare type ParsedFacetList = {
460
+ facetName?: string;
461
+ fieldName?: string;
462
+ count?: {
463
+ [fieldValue: string]: number;
464
+ };
465
+ range?: {
466
+ start: number | string;
467
+ end: number | string;
468
+ count: number;
469
+ }[];
470
+ }[];
471
+
472
+ /** Parsed facet type */
473
+ export declare type ParsedFacetType = {
474
+ [fieldName: string]: ParsedFacetTypeCount;
475
+ };
476
+
477
+ export declare type ParsedFacetTypeCount = {
478
+ [fieldValue: string]: number;
479
+ };
480
+
481
+ export declare type ParsedField<TOptions> = TOptions extends {
482
+ includeFieldAttributes?: false;
483
+ } ? ParsedValueList<TOptions> : ParsedFieldObject<TOptions>;
484
+
485
+ export declare type ParsedFieldAttributes = Partial<Omit<MetadataFieldValueType, 'value'>>;
486
+
487
+ declare type ParsedFieldDefinition = {
488
+ name?: string;
489
+ type?: string;
490
+ defaultValue?: string;
491
+ restrictions?: {
492
+ min?: number;
493
+ max?: number;
494
+ minLength?: number;
495
+ maxLength?: number;
496
+ pattern?: RegExp;
497
+ };
498
+ required?: boolean;
499
+ data?: {
500
+ [key: string]: string;
501
+ };
502
+ options?: Array<{
503
+ label: string;
504
+ value: string;
505
+ }>;
506
+ };
507
+
508
+ export declare type ParsedFieldDefinitionList = ParsedFieldDefinition[];
509
+
510
+ export declare type ParsedFieldList<TOptions> = TOptions extends {
511
+ fieldAsList?: true;
512
+ } ? ParsedField<TOptions>[] : TOptions extends {
513
+ arrayOnSingle?: true;
514
+ arrayOnSingleField?: undefined | true;
515
+ } | {
516
+ arrayOnSingleField?: true;
517
+ } ? {
518
+ [name: string]: ParsedField<TOptions>[];
519
+ } : TOptions extends {
520
+ flat?: true;
521
+ overrideField?: true | undefined;
522
+ } | {
523
+ overrideField?: true;
524
+ } ? {
525
+ [name: string]: ParsedField<TOptions>;
526
+ } : {
527
+ [name: string]: ParsedField<TOptions> | ParsedField<TOptions>[];
528
+ };
529
+
530
+ export declare type ParsedFieldObject<TOptions> = {
531
+ value: ParsedValueList<TOptions>;
532
+ } & ParsedFieldAttributes;
533
+
534
+ export declare type ParsedFileType = {
535
+ uri?: string;
536
+ hash?: string;
537
+ fileSize?: string;
538
+ fileSizeBytes?: number;
539
+ path?: string;
540
+ fileName?: string;
541
+ fileId?: string;
542
+ storageId?: string;
543
+ folderPath?: string;
544
+ };
545
+
546
+ export declare type ParsedGroup<TOptions> = ((TOptions extends {
547
+ groupAsList?: true;
548
+ } ? {
549
+ group?: ParsedGroupList<TOptions>;
550
+ } : {
551
+ [name: string]: ParsedGroupList<TOptions>;
552
+ }) & (TOptions extends {
553
+ fieldAsList?: true;
554
+ } ? {
555
+ field?: ParsedFieldList<TOptions>;
556
+ } : {
557
+ [name: string]: ParsedFieldList<TOptions>;
558
+ })) & ParsedGroupAttributes;
559
+
560
+ export declare type ParsedGroupAttributes = Omit<MetadataGroupValueType, 'field' | 'group'>;
561
+
562
+ export declare type ParsedGroupList<TOptions> = TOptions extends {
563
+ groupAsList?: true;
564
+ } ? ParsedGroup<TOptions>[] : TOptions extends {
565
+ arrayOnSingle?: true;
566
+ arrayOnSingleGroup?: true | undefined;
567
+ } | {
568
+ arrayOnSingleGroup?: true;
569
+ } ? {
570
+ [groupName: string]: ParsedGroup<TOptions>[];
571
+ } : TOptions extends {
572
+ flat?: true;
573
+ overrideGroup?: true | undefined;
574
+ } | {
575
+ overrideGroup?: true;
576
+ } ? {
577
+ [groupName: string]: ParsedGroup<TOptions>;
578
+ } : {
579
+ [groupName: string]: ParsedGroup<TOptions> | ParsedGroup<TOptions>[];
580
+ };
581
+
582
+ export declare type ParsedHighlightTimespan = {
583
+ start?: string;
584
+ end?: string;
585
+ [key: string]: string | string[];
699
586
  };
587
+
700
588
  /**
701
- * TimeBase class representing the TimeBaseType in VidiCore
702
- *
703
- * For more info, see the [Time bases section in VidiCore API Docs](https://apidoc.vidispine.com/latest/time.html#time-bases)
704
- *
705
- * @category Time
589
+ * TODO
706
590
  */
707
- declare class TimeBase {
708
- /** The numerator for the TimeBase */
709
- numerator: number;
710
- /** The denominator for the TimeBase */
711
- denominator: number;
712
- /**
713
- * Constructor for TimeBase
714
- *
715
- * @param timeBaseType A TimeBaseType object
716
- */
717
- constructor(timeBaseType?: TimeBaseInput);
718
- /**
719
- * Get TimeBase in a constant representation (e.g. "PAL") if possible, otherwise undefined
720
- * @returns Constant representation of the TimeBase
721
- */
722
- toConstant(): string;
723
- /**
724
- * Get TimeBase as a VidiCore TimeBaseType string
725
- *
726
- * @remarks
727
- * Default format: denominator(:numerator if > 1)
728
- *
729
- * `constant` has precedence over `fraction` if both are true (e.g. NTSC > 30000:1001)
730
- *
731
- * @param options For how to display it as text
732
- * @returns Text representation of the TimeBase
733
- */
734
- toText(options?: {
735
- /** Show time base as constant (e.g. PAL) */
736
- constant?: boolean;
737
- /** Show time base as fraction (25:1) even when numerator is 1 */
738
- fraction?: boolean;
739
- }): string;
740
- /**
741
- * Output TimeBase as frame rate (by default max 16 decimal places)
742
- *
743
- * @remarks
744
- * Default format: rate with two decimals if needed (i.e. decimals are > 0)
745
- *
746
- * `rounded` has precedence over `fixed`
747
- *
748
- * @param options On how to return the rate
749
- *
750
- * @return Rate of the TimeBase
751
- */
752
- toRate(options?: {
753
- /** Rounded to nearest integer */
754
- rounded?: boolean;
755
- /** Amount of decimal places
756
- * - `true` two decimal places
757
- * - `false` max amount of decimal places
758
- * - `number` that amount of decimal places
759
- */
760
- fixed?: boolean | number;
761
- }): number;
762
- /**
763
- * Get TimeBase in a object representation
764
- *
765
- * @returns TimeBase as `{denominator, numerator}` object
766
- */
767
- toObject(): TimeBaseType;
768
- /**
769
- * @deprecated Use {@link TimeBase#toObject | toObject} instead
770
- *
771
- * @returns TimeBase as `{denominator, numerator}` object
772
- */
773
- toJson(): TimeBaseType;
774
- }
775
-
591
+ export declare type ParsedMediaConvertTranscodePreset = {
592
+ description?: string;
593
+ containerFormat?: any;
594
+ videoFormat?: string;
595
+ height?: number;
596
+ width?: number;
597
+ dimension?: string;
598
+ aspectRatio?: string;
599
+ fieldOrder?: string;
600
+ videoBitrate?: number;
601
+ timeBase?: TimeBase;
602
+ frameRate?: string | number;
603
+ audioFormat?: string;
604
+ audioSamplerate?: string;
605
+ audioBitrate?: string;
606
+ audioBitRateMode?: string;
607
+ };
608
+
609
+ export declare type ParsedMetadataAttributes = Partial<Omit<MetadataType, 'timespan' | 'revision'> & {
610
+ revision?: string[];
611
+ }>;
612
+
613
+ export declare type ParsedMetadataType<TOptions> = (TOptions extends {
614
+ timespanAsList?: true;
615
+ } ? {
616
+ timespan: ParsedTimespanList<TOptions>;
617
+ } : TOptions extends {
618
+ flat?: true;
619
+ } ? ParsedTimespanList<TOptions> : {
620
+ [timespanKey: string]: ParsedTimespanList<TOptions>;
621
+ }) & (TOptions extends {
622
+ includeMetadataAttributes?: true | string[];
623
+ } ? ParsedMetadataAttributes : {});
624
+
625
+ export declare type ParsedShapeType = {
626
+ uri?: string;
627
+ tag?: string;
628
+ mimeType?: string;
629
+ } & ParsedContainerComponentType & ParsedBinaryComponentType & ParsedAudioComponentType & ParsedVideoComponentType;
630
+
631
+ export declare type ParsedTimespan<TOptions> = ((TOptions extends {
632
+ groupAsList?: true;
633
+ } ? {
634
+ group?: ParsedGroupList<TOptions>;
635
+ } : {
636
+ [name: string]: ParsedGroupList<TOptions>;
637
+ }) & (TOptions extends {
638
+ fieldAsList?: true;
639
+ } ? {
640
+ field?: ParsedFieldList<TOptions>;
641
+ } : {
642
+ [name: string]: ParsedFieldList<TOptions>;
643
+ })) & ParsedTimespanAttributes;
644
+
645
+ export declare type ParsedTimespanAttributes = Omit<MetadataType['timespan'][number], 'field' | 'group'>;
646
+
647
+ export declare type ParsedTimespanList<TOptions> = TOptions extends {
648
+ timespanAsList?: true;
649
+ } ? ParsedTimespan<TOptions>[] : TOptions extends {
650
+ flat?: true;
651
+ onlyGeneric?: true | undefined;
652
+ } | {
653
+ onlyGeneric?: true;
654
+ } ? ParsedTimespan<TOptions> : {
655
+ [timespanKey: string]: ParsedTimespan<TOptions>[];
656
+ };
657
+
658
+ export declare type ParsedTranscodePreset = {
659
+ description?: string;
660
+ containerFormat?: any;
661
+ videoFormat?: string;
662
+ height?: number;
663
+ width?: number;
664
+ dimension?: string;
665
+ aspectRatio?: string;
666
+ fieldOrder?: string;
667
+ videoBitrate?: number;
668
+ timeBase?: TimeBase;
669
+ frameRate?: string | number;
670
+ audioFormat?: string;
671
+ audioSamplerate?: string;
672
+ audioBitrate?: string;
673
+ audioBitRateMode?: string;
674
+ audioChannels?: number;
675
+ };
676
+
677
+ export declare type ParsedValue<TOptions> = TOptions extends {
678
+ includeValueAttributes?: false;
679
+ } ? string : {
680
+ value: string;
681
+ } & ParsedValueAttributes;
682
+
683
+ export declare type ParsedValueAttributes = Partial<Omit<MetadataValueType, 'value'>>;
684
+
685
+ export declare type ParsedValueList<TOptions> = TOptions extends {
686
+ joinValue?: string;
687
+ includeValueAttributes?: false;
688
+ } ? string : TOptions extends {
689
+ arrayOnSingleValue?: true;
690
+ } ? ParsedValue<TOptions>[] : ParsedValue<TOptions> | ParsedValue<TOptions>[];
691
+
692
+ export declare type ParsedVideoComponentType = {
693
+ videoFormat?: string;
694
+ dimension?: string;
695
+ frameRate?: string | number;
696
+ height?: number;
697
+ width?: number;
698
+ timeBase?: TimeBase;
699
+ timeCode?: TimeCode;
700
+ videoCodec?: string;
701
+ smpte?: string;
702
+ videoBitrate?: string;
703
+ videoBitrateMbps?: number;
704
+ fieldOrder?: string;
705
+ colorSpace?: string;
706
+ chromaSubsampling?: string;
707
+ aspectRatio?: string;
708
+ colorPrimaries?: string;
709
+ videoMetadata?: {
710
+ [key: string]: string;
711
+ };
712
+ videoMediaInfo?: ParsedVideoMediaInfoType;
713
+ };
714
+
715
+ export declare type ParsedVideoMediaInfoType = ParsedBaseMediaInfoType & {
716
+ Format_Settings_GOP?: string;
717
+ intra_dc_precision?: string;
718
+ };
719
+
776
720
  /**
777
- * Create a TimeBase Instance from a number, string or object representation of a time base
721
+ * Parse a VidiCore facet list
778
722
  *
779
- * @param timeBase Input to create time base from
780
- * @returns A TimeBase instance
723
+ * @param facetType A facet list to parse
724
+ * @returns A parsed facet list
781
725
  *
782
- * @category Time
726
+ * @category Search
783
727
  */
784
- declare const createTimeBase: (timeBase: TimeBaseInput | string | number) => TimeBase;
785
-
728
+ export declare const parseFacetList: (facetList?: FacetType[]) => ParsedFacetList;
729
+
786
730
  /**
787
- * Format a string representation of a time base to a TimeBase Instance
731
+ * Parse a VidiCore facet type list
788
732
  *
789
- * @param timeBaseText The string to format to a TimeBase instance
790
- * @returns A TimeBase Instance
733
+ * @param facetType A facet type list to parse
734
+ * @returns A parsed facet type list
791
735
  *
792
- * @category Time
736
+ * @category Search
793
737
  */
794
- declare const formatTimeBaseText: (timeBaseText?: string | number) => TimeBase;
795
-
738
+ export declare const parseFacetType: (facetType?: FacetType[]) => ParsedFacetType;
739
+
796
740
  /**
797
- * Create a TimeBase instance of an object
741
+ * Parse a metadata field definition list
798
742
  *
799
- * @param timeBase A TimeBase object
800
- * @returns A TimeBase instance
743
+ * @remarks
744
+ * - `values` are parsed to an options array (as `[{ label, value }, ...]`)
745
+ * - Include values using the `includeValues: true` query parameter
746
+ * - `restrictions.required` is parsed from restrictions having defined minInclusive or minLength > 0
801
747
  *
802
- * @category Time
748
+ * @param fieldList Field definition list to parse
749
+ * @returns A parsed field list
750
+ *
751
+ * @category Field
803
752
  */
804
- declare const formatTimeBaseType: (timeBase: TimeBaseInput) => TimeBase;
805
-
806
- type TimeCodeInput = {
807
- /** Amount of samples for the time code */
808
- samples?: number | string;
809
- /** The time base for the time code */
810
- timeBase?: string | TimeBaseInput | TimeBase;
811
- };
812
- type TimeCodeInputOptions = {
813
- /** If time code is dropFrame or not (by default checks timeBase) */
814
- dropFrame?: boolean;
815
- /** Separator for frame in smpte output (default ":" for non-drop-frame and ";" for dropFrame) */
816
- frameSeparator?: string;
817
- };
753
+ export declare const parseFieldDefinitionList: (fieldList: MetadataFieldType[]) => ParsedFieldDefinitionList;
754
+
755
+ export declare type ParseFieldDefinitionListOptions = {};
756
+
818
757
  /**
819
- * TimeCode class representing the TimeCodeType in VidiCore
758
+ * Parse a metadata field list according to selected options
820
759
  *
821
- * For more info, see the [Time Codes section of VidiCore API Docs](https://apidoc.vidispine.com/latest/time.html#time-codes)
760
+ * @remarks
761
+ * When parsing duplicate fields (same field name in the same field list) it will:
762
+ * - with default options: combine field values to one array within the same field name key
763
+ * - with `joinValue` enabled: join values within each field (returns array with string for each field value)
764
+ * - with `fieldAsList` enabled: separate fields in the list/array (as usual, even if not duplicate)
765
+ * - with `includeFieldAttributes` enabled: return an array of field objects
766
+ * - with `overrideField` enabled: return the latest duplicated field it parses
822
767
  *
823
- * @category Time
768
+ * @param fieldList Field list to parse
769
+ * @param [options=defaultOptions] Options for how to parse the field list
770
+ * @returns A parsed field list
771
+ *
772
+ * @category Metadata
824
773
  */
825
- declare class TimeCode {
826
- /** Amount of samples for the time code */
827
- samples: number;
828
- /** The time base for the time code */
829
- timeBase: TimeBase;
830
- /** If time code is dropFrame or not (by default checks timeBase) */
831
- dropFrame?: boolean;
832
- /** Separator for frame in smpte output (default ":" for non-drop-frame and ";" for dropFrame) */
833
- frameSeparator?: string;
834
- /**
835
- * Constructor for TimeCode
836
- *
837
- * @param timeCodeType Object to create TimeCode of
838
- * @param options Options for the timeCode
839
- */
840
- constructor(timeCodeType: TimeCodeInput, options?: TimeCodeInputOptions);
841
- /**
842
- * Return this TimeCode added with the supplied timeCodeType
843
- * - If time bases differ, it will retain the time base of this TimeCode instance
844
- * - If supplied time code has a more granular time base, it will round down exceeding samples (hasn't reached that sample yet)
845
- *
846
- * @remarks
847
- * If you don't want to "lose" frames in the manner described above, make sure time code you're operating on has higher time base granularity
848
- *
849
- * To exemplify:
850
- * - "51@50".add("25@25") => "101@50"
851
- * - while "25@25".add("51@50") => "50@25"
852
- *
853
- * @param timeCode A TimeCode instance you want to add with
854
- * @returns A new TimeCode instance with the addition applied
855
- */
856
- add(timeCode: TimeCode): TimeCode;
857
- /**
858
- * Return this TimeCode subtracted with the supplied timeCodeType
859
- * - If time bases differ, it will retain the time base of the instance time code
860
- * - If supplied time code has a more granular time base, it will round down exceeding samples (hasn't reached that sample yet)
861
- *
862
- * @remarks
863
- * If you don't want to "lose" frames in the manner described above, make sure time code you're operating on has higher time base granularity
864
-
865
- * To exemplify:
866
- * - "101@50".subtract("25@25") => "51@50"
867
- * - while "50@25".subtract("51@50") => "25@25"
868
- *
869
- * @param timeCode A TimeCode instance you want to subtract with
870
- * @returns A new TimeCode instance with the subtraction applied
871
- */
872
- subtract(timeCode: TimeCode): TimeCode;
873
- /**
874
- * Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
875
- *
876
- * @remarks
877
- * If it conforms to a less granular time base - it will floor samples (hasn't reached that sample yet)
878
- * - e.g. "51@50".conformTo("PAL") => "25@PAL" (not "26@PAL")
879
- *
880
- * @param timeBase The TimeBase it should conform the TimeCode to
881
- * @param options Explicitly set TimeCode options, by default these are derived from `timeBase`
882
- * @returns A new TimeCode instance with the conformTo timeBase applied
883
- */
884
- conformTimeBase(timeBase: TimeCodeInput['timeBase'], options?: TimeCodeInputOptions): TimeCode;
885
- /**
886
- * Get TimeCode as a text representation
887
- *
888
- * @remarks
889
- * Default format: `samples@denominator[:numerator (if > 1)])`
890
- *
891
- * `constant` has precedence over `fraction` if both are true
892
- *
893
- * @param options Options for how to format text
894
- * @returns Text representation of TimeCode
895
- */
896
- toText(options?: {
897
- /** Include time base even if seconds (i.e. append @1 or @1:1) */
898
- includeTimeBaseForSeconds?: boolean;
899
- /** show as constant (e.g. @PAL) */
900
- constant?: boolean;
901
- /** show as fraction (e.g. @25:1) */
902
- fraction?: boolean;
903
- }): string;
904
- /**
905
- * Get TimeCode in a units object representation
906
- *
907
- * @returns Units (time and frames) for the time code
908
- */
909
- toUnits(): {
910
- hours: number;
911
- minutes: number;
912
- seconds: number;
913
- frames: number;
914
- };
915
- /**
916
- * Get TimeCode in a time object representation
917
- *
918
- * Note: "milliseconds" is rounded down - use "partialSeconds" for another representation
919
- *
920
- * @returns Time for the time code
921
- */
922
- toTime(): {
923
- hours: number;
924
- minutes: number;
925
- seconds: number;
926
- milliseconds: number;
927
- partialSeconds: number;
928
- };
929
- /**
930
- * Get TimeCode in a seconds representation
931
- *
932
- * @returns Total seconds for the time code
933
- */
934
- toSeconds(): number;
935
- /**
936
- * Get TimeCode in a duration representation
937
- *
938
- * The time unit keys for the format string are:
939
- * - `h` for hour
940
- * - `m` for minute
941
- * - `s` for seconds
942
- * - `S` for milliseconds
943
- * - Any other char will be kept in the duration output string
944
- *
945
- * Note: Add several consecutive chars for zero padding.
946
- *
947
- * By default it:
948
- * - uses colon delimiter (e.g. for format "hhmmss")
949
- * - shows "m:ss" or "h:mm:ss" if format is undefined
950
- *
951
- * @param options Options for how to display duration
952
- * @returns Duration representation of the TimeCode
953
- */
954
- toDuration(options?: {
955
- /** Specify format of duration string, (e.g. `hh:mm:ss.S` for "01:23:04.5") */
956
- format?: string;
957
- }): string;
958
- /**
959
- * Get TimeCode in a smpte representation
960
- *
961
- * @returns Smpte representation of the TimeCode
962
- */
963
- toSmpte(): string;
964
- /**
965
- * Get TimeCode as a VidiCore TimeCodeType object
966
- *
967
- * @returns TimeCode as `{ samples, timeBase }`
968
- */
969
- toObject(): {
970
- samples: number;
971
- timeBase: _vidispine_types.RationalType;
972
- };
973
- /**
974
- * @deprecated Use {@link TimeCode#toObject | toObject} instead
975
- *
976
- * @returns TimeCode as `{ samples, timeBase }`
977
- */
978
- toJson(): {
979
- samples: number;
980
- timeBase: _vidispine_types.RationalType;
981
- };
982
- }
983
-
984
- interface FormatTimeCodeSecondsOptions extends TimeCodeInputOptions {
985
- /**
986
- * The TimeBase the output TimeCode should have
987
- *
988
- * Note: if unset and useGCD=false, denominator will be 10^(amount-of-decimals)
989
- */
990
- timeBase?: number | string | TimeBaseInput;
991
- /**
992
- * Samples and denominator are divided with GCD
993
- *
994
- * e.g. `1.04 => 104@100 => 26@25` (if no explicit `timeBase` is set)
995
- */
996
- useGCD?: boolean;
774
+ export declare const parseFieldList: <TOptions extends ParseFieldListOptions = ParseFieldListOptions>(fieldList: MetadataFieldValueType[], options?: TOptions) => ParsedFieldList<TOptions>;
775
+
776
+ export declare interface ParseFieldListOptions extends ParseFieldOptions {
777
+ /** Return fields as list */
778
+ fieldAsList?: boolean;
779
+ /** Return fields as array even if only one field */
780
+ arrayOnSingleField?: boolean;
781
+ /** Return all fields flattened (Note: keys might be overridden) */
782
+ overrideField?: boolean;
783
+ }
784
+
785
+ export declare interface ParseFieldOptions extends ParseValueListOptions {
786
+ /** Include attributes on field (`true` for all) */
787
+ includeFieldAttributes?: boolean | (keyof ParsedFieldAttributes)[];
997
788
  }
789
+
998
790
  /**
999
- * Format seconds to TimeCode object
791
+ * Parses a VidiCore file object
1000
792
  *
1001
793
  * @remarks
1002
- * Input time base is always considered as 1:1 since it expects seconds as input
1003
- *
1004
- * Note: Max 15 digits accuracy (double precision float64), e.g.
1005
- * - 10^6 seconds can have 10^9 decimals (nanosecond) precision
1006
- * - 10^9 seconds can have 10^6 decimals (microsecond) precision
1007
- * - 10^12 seconds can have 10^3 decimals (millisecond) precision
794
+ * File sizes are parsed with JEDEC standard (base 2)
1008
795
  *
1009
- * @param seconds With or without decimals ("." and "," are both interpreted as decimal)
1010
- * @param options Options for how to format the seconds to a TimeCode
1011
- * @returns A TimeCode instance
796
+ * @param fileType VidiCore file object
797
+ * @returns A parsed file object
1012
798
  *
1013
- * @category Time
799
+ * @category File
1014
800
  */
1015
- declare const formatTimeCodeSeconds: (seconds: string | number, options?: FormatTimeCodeSecondsOptions) => TimeCode;
1016
-
1017
- interface FormatTimeCodeSmpteOptions extends TimeCodeInputOptions {
1018
- /** TimeBase of smpte (and consequently TimeBase of output TimeCode) */
1019
- timeBase?: number | string | TimeBaseInput;
1020
- /** How to handle exceeding values (default `error`) */
1021
- exceedingMode?: 'add' | 'ignore' | 'error';
1022
- }
801
+ export declare const parseFileType: (fileType: FileType) => ParsedFileType;
802
+
1023
803
  /**
1024
- * Format smpte text to a TimeCode Instance
804
+ * Parse a metadata group list according to selected options
1025
805
  *
1026
- * Options for `exceedingMode`:
1027
- * - `add` will be overflow to higher unit (e.g. PAL and 00:00:00:25 => 00:00:01:00)
1028
- * - `ignore` will be truncated (e.g. PAL and 00:00:00:25 => 00:00:00:24)
1029
- * - `error` will throw error (e.g. PAL and 00:00:00:25 => Error)
806
+ * @remarks
807
+ * Parsing duplicate groups (same group name in the same group list) it will:
808
+ * - with default options: combine group objects to one array within the same group name key
809
+ * - with `groupAsList` enabled: return separate group objects in a list/array (as usual, even if not duplicate)
810
+ * - with `overrideGroup` enabled: return the latest duplicated group it parses
1030
811
  *
1031
- * @param smpte String representation of smpte
1032
- * @param options Options for creating the time code from smpte
1033
- * @returns TimeCode instance created from smpte string
812
+ * @param groupList Group list to parse
813
+ * @param options options for how to parse list
814
+ * @returns A parsed group list
1034
815
  *
1035
- * @category Time
816
+ * @category Metadata
1036
817
  */
1037
- declare const formatTimeCodeSmpte: (smpte: string, options?: FormatTimeCodeSmpteOptions) => TimeCode;
1038
-
1039
- interface FormatTimeCodeTextOptions extends TimeCodeInputOptions {
1040
- /** The time base the returned TimeCode should have */
1041
- timeBase?: number | string | TimeBaseInput;
818
+ export declare const parseGroupList: <TOptions extends ParseGroupOptions = ParseGroupOptions>(groupList: MetadataGroupValueType[], options?: TOptions) => ParsedGroupList<TOptions>;
819
+
820
+ export declare type ParseGroupListOptions = ParseGroupOptions;
821
+
822
+ export declare interface ParseGroupOptions extends ParseFieldListOptions {
823
+ /** Include group attributes (`true` for all) */
824
+ includeGroupAttributes?: boolean | (keyof ParsedGroupAttributes)[];
825
+ /** Return groups as list */
826
+ groupAsList?: boolean;
827
+ /** Return groups as array even if only one group */
828
+ arrayOnSingleGroup?: boolean;
829
+ /** Return all groups flattened (Note: keys might be overridden) */
830
+ overrideGroup?: boolean;
1042
831
  }
832
+
1043
833
  /**
1044
- * Format text to a TimeCode instance
1045
- *
1046
- * @returns A TimeCode instance
834
+ * Parses highlight timespan in VidiCore into key/value object.
835
+ * The attributes can be targeted for each sub-type.
836
+ * @param timespan - A VidiCore search timespan
837
+ * @param options - Options which change how the timespans are parsed
1047
838
  *
1048
- * @category Time
839
+ * @category Search
1049
840
  */
1050
- declare const formatTimeCodeText: (timeCodeText?: number | string, options?: FormatTimeCodeTextOptions) => TimeCode;
1051
-
1052
- type CreateTimeCodeOptions = TimeCodeInputOptions | FormatTimeCodeSmpteOptions | FormatTimeCodeSecondsOptions | FormatTimeCodeTextOptions;
841
+ export declare const parseHighlightTimespan: (timespan: SearchResultEntryTimespanType, options: ParseHighlightTimespanOptions) => ParsedHighlightTimespan;
842
+
1053
843
  /**
1054
- * Create a TimeCode instance from smpte, seconds/samples, timeCode object or string
844
+ * Parses highlight timespans from VidiCore into key/value object.
845
+ * The attributes can be targeted for each sub-type.
1055
846
  *
1056
- * @param timeCode Smpte, seconds/samples, timeCode object or string
1057
- * @param options For the format functions
1058
- * @returns A TimeCode instance
847
+ * @param highlightTimespanList - A list of timespans from VidiCore.
848
+ * @param options - Options to change how the timespans are parsed
1059
849
  *
1060
- * @category Time
850
+ * @category Search
1061
851
  */
1062
- declare const createTimeCode: (timeCode: TimeCodeInput | string | number, options?: CreateTimeCodeOptions) => TimeCode;
1063
-
852
+ export declare const parseHighlightTimespanList: (highlightTimespanList?: SearchResultEntryTimespanType[], options?: ParseHighlightTimespanListOptions) => ParsedHighlightTimespan | ParsedHighlightTimespan[];
853
+
854
+ export declare interface ParseHighlightTimespanListOptions extends ParseHighlightTimespanOptions {
855
+ /** Return parsed timespan as list (in an array) */
856
+ timespanAsList?: boolean;
857
+ /** Character to join the start/end time codes with */
858
+ joinTimespan?: string;
859
+ /** Flatten to field-name/field-value (Note: field-values may be overwritten) */
860
+ flat?: boolean;
861
+ /** Flatten timespan to object with start/end as key */
862
+ flatTimespan?: boolean;
863
+ }
864
+
865
+ export declare type ParseHighlightTimespanOptions = {
866
+ /** Return an array if there is a single value */
867
+ arrayOnSingle?: boolean;
868
+ /** Return timespans as list */
869
+ timespanAsList?: boolean;
870
+ /** String to join the values (e.g. `,`) */
871
+ joinValue?: string;
872
+ };
873
+
1064
874
  /**
1065
- * Format an object to a TimeCode instance
1066
875
  *
1067
- * @param timeCode To create TimeCode instance of
1068
- * @param options For the TimeCode constructor
1069
- * @returns A TimeCode instance
876
+ * @param keyValuePairTypes
877
+ * @returns
1070
878
  *
1071
- * @category Time
879
+ * @category Other
1072
880
  */
1073
- declare const formatTimeCodeType: (timeCode: TimeCodeInput, options?: TimeCodeInputOptions) => TimeCode;
1074
-
1075
- type ParsedVideoComponentType = {
1076
- videoFormat?: string;
1077
- dimension?: string;
1078
- frameRate?: string | number;
1079
- height?: number;
1080
- width?: number;
1081
- timeBase?: TimeBase;
1082
- timeCode?: TimeCode;
1083
- videoCodec?: string;
1084
- smpte?: string;
1085
- videoBitrate?: string;
1086
- videoBitrateMbps?: number;
1087
- fieldOrder?: string;
1088
- colorSpace?: string;
1089
- chromaSubsampling?: string;
1090
- aspectRatio?: string;
1091
- colorPrimaries?: string;
1092
- videoMetadata?: {
1093
- [key: string]: string;
1094
- };
1095
- videoMediaInfo?: ParsedVideoMediaInfoType;
881
+ export declare const parseKeyValuePairType: (keyValuePairTypes: KeyValuePairType[]) => {
882
+ [k: string]: string;
1096
883
  };
884
+
1097
885
  /**
1098
- * Parses the technical information of a VideoComponentType.
1099
- * @param {Object} videoComponentType - A VideoComponentType from VidiCore.
1100
- * @returns {Object} Parsed component object.
1101
- *
1102
- * @category Shape
1103
- */
1104
- declare const parseVideoComponent: (videoComponentType?: VideoComponentType) => ParsedVideoComponentType;
1105
-
1106
- type ParsedShapeType = {
1107
- uri?: string;
1108
- tag?: string;
1109
- mimeType?: string;
1110
- } & ParsedContainerComponentType & ParsedBinaryComponentType & ParsedAudioComponentType & ParsedVideoComponentType;
1111
- /**
1112
- * Parses the technical information of a ShapeType and its various components.
886
+ * TODO
1113
887
  *
1114
- * Will only parse the first videoComponent, audioComponent, binaryComponent in the corresponding array.
1115
- * To parse a selected component see:
1116
- * - {@link parseContainerComponent}
1117
- * - {@link parseVideoComponent}
1118
- * - {@link parseAudioComponent}
1119
- * - {@link parseBinaryComponent}
1120
- * @param shapeType - A ShapeType from VidiCore.
1121
- * @returns Parsed shape object.
888
+ * @param mediaconvert
889
+ * @returns
1122
890
  *
1123
- * @category Shape
891
+ * @category Transcode
1124
892
  */
1125
- declare const parseShapeType: (shapeType?: ShapeType) => ParsedShapeType;
1126
-
893
+ export declare const parseMediaConvertPreset: (mediaconvert: TranscodePresetType['mediaconvert']) => ParsedMediaConvertTranscodePreset;
894
+
1127
895
  /**
1128
- * Const object with document types
896
+ * Parses MetadataType according to specified options
1129
897
  *
1130
- * @category Shape
1131
- */
1132
- declare const DOCUMENT_TYPES: {
1133
- readonly PDF: "PDF";
1134
- readonly TEXT: "TEXT";
1135
- readonly MSWORD: "MSWORD";
1136
- readonly JSON: "JSON";
1137
- readonly XML: "XML";
1138
- };
1139
-
1140
- /**
1141
- * Const object with media types
898
+ * @remarks
899
+ * Be aware that you need to take into account that the returned groups and fields can be an array if it has multiple values or groups/fields with same name.
900
+ * If you are certain your metadata type won't return multiple groups/fields/values with same name or don't mind that they _might_ be overridden:
901
+ * you can use the option `flat` along with `joinValue` or `arrayOnSingleValue: false`.
1142
902
  *
1143
- * @category Shape
1144
- */
1145
- declare const SHAPE_MEDIA_TYPES: {
1146
- readonly IMAGE: "IMAGE";
1147
- readonly AUDIO: "AUDIO";
1148
- readonly VIDEO: "VIDEO";
1149
- readonly DOCUMENT: "DOCUMENT";
1150
- readonly BINARY: "BINARY";
1151
- };
1152
-
1153
- type DocumentType = keyof typeof DOCUMENT_TYPES;
1154
- /**
1155
- * Return a const for the document type of a shape (looks at mimeType)
903
+ * @param metadataType - A MetadataType from VidiCore
904
+ * @param options - Options which change how the metadataType is parsed
905
+ * @returns Metadata object parsed according to options
1156
906
  *
1157
- * @param shape A VidiCore shape
1158
- * @returns The document type for a shape
907
+ * @see {@link parseTimespanList} for more info
1159
908
  *
1160
- * @category Shape
909
+ * @category Metadata
1161
910
  */
1162
- declare const getShapeDocumentType: (shape?: ShapeType) => DocumentType;
1163
-
1164
- type FilteredShapeListObject = {
1165
- src: string;
1166
- type: string;
1167
- shape: ShapeType;
1168
- parsedShape: ParsedShapeType;
1169
- [key: string]: string | ParsedShapeType | ShapeType;
1170
- };
1171
- type FilterShapeSourceOption = {
1172
- sortPriority?: Function;
1173
- allowedMimeTypes?: string[];
1174
- allowedMethods?: string[];
1175
- sourceKey?: string;
1176
- mimeTypeKey?: string;
1177
- shapeKey?: string;
1178
- parsedShapeKey?: string;
1179
- };
911
+ export declare function parseMetadataType<TOptions extends ParseMetadataTypeOptions = ParseMetadataTypeOptions>(metadataType: MetadataType, options?: TOptions): ParsedMetadataType<TOptions>;
912
+
913
+ export declare interface ParseMetadataTypeOptions extends ParseTimespanListOptions {
914
+ /** Include metadata attributes (`true` for all) */
915
+ includeMetadataAttributes?: boolean | (keyof ParsedMetadataAttributes)[];
916
+ /** Flatten timespans, groups and fields (Note: keys might be overridden) */
917
+ flat?: boolean;
918
+ }
919
+
1180
920
  /**
1181
- * Filter a shape type list to get shapes that are playable in a browser
921
+ * Parse Vidicore "NOW" constants to a date object
1182
922
  *
1183
- * @param itemType
1184
- * @param options
1185
- * @returns
923
+ * Format: `NOW[+/-][number][HOUR/DAY/MONTH/YEAR(s)]` (e.g. "NOW-2HOURS")
1186
924
  *
1187
- * @category Shape
925
+ * @remarks
926
+ * Returns an approximate date since it's created client side
927
+ *
928
+ * @param value A "NOW" constant
929
+ * @returns A date from the NOW constant
930
+ *
931
+ * @category Search
1188
932
  */
1189
- declare const filterShapeSource: (itemType: ItemType, options?: FilterShapeSourceOption) => FilteredShapeListObject[];
1190
-
1191
- type ShapeMediaType = keyof typeof SHAPE_MEDIA_TYPES;
933
+ export declare const parseNowDate: (value?: string) => Date;
934
+
1192
935
  /**
1193
- * Returns a const for which media type a shape has
936
+ * Parses the technical information of a ShapeType and its various components.
1194
937
  *
1195
- * @param shape
1196
- * @returns
938
+ * Will only parse the first videoComponent, audioComponent, binaryComponent in the corresponding array.
939
+ * To parse a selected component see:
940
+ * - {@link parseContainerComponent}
941
+ * - {@link parseVideoComponent}
942
+ * - {@link parseAudioComponent}
943
+ * - {@link parseBinaryComponent}
944
+ * @param shapeType - A ShapeType from VidiCore.
945
+ * @returns Parsed shape object.
1197
946
  *
1198
947
  * @category Shape
1199
948
  */
1200
- declare const getShapeMediaType: (shape: ShapeType) => ShapeMediaType;
1201
-
949
+ export declare const parseShapeType: (shapeType?: ShapeType) => ParsedShapeType;
950
+
1202
951
  /**
1203
- * Const object with all file states in VidiCore
1204
- * (see https://apidoc.vidispine.com/latest/storage/storage.html#file-states for more info)
952
+ * Parse simple (key/value) metadata
1205
953
  *
1206
- * @category File
954
+ * Not indexed metadata, available on almost all entities (storages, library, user, group, etc...)
955
+ *
956
+ * @param simpleMetadataType A VidiCore simple metadata object
957
+ * @returns A parsed simple metadata object
958
+ *
959
+ * @category Metadata
1207
960
  */
1208
- declare const FILE_STATES: {
1209
- /** Just created, not used. */
1210
- readonly NONE: "NONE";
1211
- /** Discovered or created, not yet marked as finished. */
1212
- readonly OPEN: "OPEN";
1213
- /** File does no longer grow. */
1214
- readonly CLOSED: "CLOSED";
1215
- /** The current state is not known. */
1216
- readonly UNKNOWN: "UNKNOWN";
1217
- /** File is missing from the file system/storage. */
1218
- readonly MISSING: "MISSING";
1219
- /** File has been missing for a longer period. Candidate for restoration from archive. */
1220
- readonly LOST: "LOST";
1221
- /** File will appear on file system/storage, transfer subsystem or transcoder will create it. */
1222
- readonly TO_APPEAR: "TO_APPEAR";
1223
- /** The file is no longer in use, and will be deleted at the next clean-up sweep. */
1224
- readonly TO_BE_DELETED: "TO_BE_DELETED";
1225
- /** File is in use by transfer subsystem or transcoder. */
1226
- readonly BEING_READ: "BEING_READ";
1227
- /** File is archived. */
1228
- readonly ARCHIVED: "ARCHIVED";
1229
- /** File will be synchronized by multi-site agent. */
1230
- readonly AWAITING_SYNC: "AWAITING_SYNC";
961
+ export declare const parseSimpleMetadataType: (simpleMetadataType: SimpleMetadataType) => {
962
+ [key: string]: string;
1231
963
  };
1232
- type FileStateTypes = keyof typeof FILE_STATES;
1233
-
964
+
1234
965
  /**
1235
- * Find the thumbnail uri in a VidiCore item object that's nearest a timeCode
966
+ *
967
+ * Parses timespan according to specified options
1236
968
  *
1237
969
  * @remarks
1238
- * Time code is included in path of VidiCore thumbnail uris
970
+ * To ensure a flat (no array) representation when using `flat: true`, the parser will also set `overrideGroup` and `overrideField` to true (unless those are explicitly set false)
1239
971
  *
1240
- * @param itemType A VidiCore item object
1241
- * @param timeCode A timeCode to find nearest thumbnail to
1242
- * @returns A URI of a thumbnail, `undefined` if item has no thumbnails
972
+ * @param timespan - A VidiCore metadata timespan
973
+ * @param options - Options to change how it is parsed
974
+ * @returns Timespan parsed according to options
1243
975
  *
1244
- * @category Thumbnail
1245
- */
1246
- declare const findNearestThumbnail: (itemType: ItemType, timeCode: TimeCode | TimeCodeInput) => string;
1247
-
1248
- /**
1249
- * TODO
976
+ * @see {@link parseGroupList} and {@link parseFieldList} for more info
977
+ *
978
+ * @category Metadata
1250
979
  */
1251
- type ParsedMediaConvertTranscodePreset = {
1252
- description?: string;
1253
- containerFormat?: any;
1254
- videoFormat?: string;
1255
- height?: number;
1256
- width?: number;
1257
- dimension?: string;
1258
- aspectRatio?: string;
1259
- fieldOrder?: string;
1260
- videoBitrate?: number;
1261
- timeBase?: TimeBase;
1262
- frameRate?: string | number;
1263
- audioFormat?: string;
1264
- audioSamplerate?: string;
1265
- audioBitrate?: string;
1266
- audioBitRateMode?: string;
1267
- };
980
+ export declare const parseTimespan: <TOptions extends ParseTimespanOptions = ParseTimespanOptions>(timespan: MetadataType['timespan'][number], options?: TOptions) => ParsedTimespan<TOptions>;
981
+
1268
982
  /**
1269
- * TODO
983
+ * Parses timespanList according to specified options.
984
+ * The attributes can be targeted for each sub-type.
1270
985
  *
1271
- * @param mediaconvert
1272
- * @returns
986
+ * @param timespanList - A Vidicore metadata timespan list
987
+ * @param options - Options which change how the metadataType is parsed.
988
+ * @returns Timespan list parsed according to options
1273
989
  *
1274
- * @category Transcode
990
+ * @see {@link parseTimespan} for more info
991
+ *
992
+ * @category Metadata
1275
993
  */
1276
- declare const parseMediaConvertPreset: (mediaconvert: TranscodePresetType['mediaconvert']) => ParsedMediaConvertTranscodePreset;
1277
-
1278
- type ParsedTranscodePreset = {
1279
- description?: string;
1280
- containerFormat?: any;
1281
- videoFormat?: string;
1282
- height?: number;
1283
- width?: number;
1284
- dimension?: string;
1285
- aspectRatio?: string;
1286
- fieldOrder?: string;
1287
- videoBitrate?: number;
1288
- timeBase?: TimeBase;
1289
- frameRate?: string | number;
1290
- audioFormat?: string;
1291
- audioSamplerate?: string;
1292
- audioBitrate?: string;
1293
- audioBitRateMode?: string;
1294
- audioChannels?: number;
1295
- };
994
+ export declare const parseTimespanList: <TOptions extends ParseTimespanListOptions = ParseTimespanListOptions>(timespanList: MetadataType['timespan'], options?: TOptions) => ParsedTimespanList<TOptions>;
995
+
996
+ export declare interface ParseTimespanListOptions extends ParseTimespanOptions {
997
+ /** Return timespans as list */
998
+ timespanAsList?: boolean;
999
+ /** String to join timespans with (defaults to '_') */
1000
+ joinTimespan?: string;
1001
+ /** Sort timespanList by ascending start then end time */
1002
+ sortTimespan?: boolean;
1003
+ /** Return a flat representation - only one timespan with groups/fields named the same as single - of the timespan list (Note: timespans/fields/groups can be overridden) */
1004
+ flat?: boolean;
1005
+ /** Flatten timespans to one object with generic timespan having highest priority (Note: fields/groups might be overridden) */
1006
+ flatTimespan?: boolean;
1007
+ }
1008
+
1009
+ export declare interface ParseTimespanOptions extends ParseGroupListOptions {
1010
+ /** Include attributes on timespan (`true` for all) */
1011
+ includeTimespanAttributes?: boolean | (keyof ParsedTimespanAttributes)[];
1012
+ /** Return groups, fields, and values as array */
1013
+ arrayOnSingle?: boolean;
1014
+ /** Flatten timespan, groups and fields (Note: keys might be overridden) */
1015
+ flat?: boolean;
1016
+ }
1017
+
1296
1018
  /**
1297
1019
  * Parse a VidiCore transcode preset
1298
1020
  *
@@ -1301,6 +1023,441 @@ type ParsedTranscodePreset = {
1301
1023
  *
1302
1024
  * @category Transcode
1303
1025
  */
1304
- declare const parseTranscodePreset: (transcodePresetType: TranscodePresetType) => ParsedTranscodePreset;
1305
-
1306
- export { CreateFacetTypeFieldList, CreateFacetTypeOptions, CreateMetadataTypeInput, CreateTimeCodeOptions, DOCUMENT_TYPES, DocumentType, FIELD_ATTRIBUTE_KEYS, FIELD_VALUE_ATTRIBUTE_KEYS, FILE_STATES, FileStateTypes, FilterShapeSourceOption, FilteredShapeListObject, FormatTimeCodeSecondsOptions, FormatTimeCodeSmpteOptions, FormatTimeCodeTextOptions, GROUP_ATTRIBUTE_KEYS, InputField, InputFieldObject, InputFieldValue, InputGroup, InputGroupsOrFields, InputTimespan, InputValue, InputValueObject, InputValueTypes, MetadataTypeToWebVttOptions, ParseFieldListOptions, ParseFieldOptions, ParseGroupListOptions, ParseGroupOptions, ParseHighlightTimespanListOptions, ParseHighlightTimespanOptions, ParseMetadataTypeOptions, ParseTimespanListOptions, ParseTimespanOptions, ParseValueListOptions, ParseValueOptions, ParsedAudioComponentType, ParsedAudioMediaInfoType, ParsedBaseMediaInfoType, ParsedBinaryComponentType, ParsedBinaryMediaInfoType, ParsedContainerComponentType, ParsedFacetType, ParsedFacetTypeCount, ParsedField, ParsedFieldAttributes, ParsedFieldList, ParsedFieldObject, ParsedFileType, ParsedGroup, ParsedGroupAttributes, ParsedGroupList, ParsedHighlightTimespan, ParsedMediaConvertTranscodePreset, ParsedMetadataAttributes, ParsedMetadataType, ParsedShapeType, ParsedTimespan, ParsedTimespanAttributes, ParsedTimespanList, ParsedTranscodePreset, ParsedValue, ParsedValueAttributes, ParsedValueList, ParsedVideoComponentType, ParsedVideoMediaInfoType, ROLE_NAMES, RoleNameTypes, SHAPE_MEDIA_TYPES, SYSTEM_FIELDGROUPS, SYSTEM_FIELDS, ShapeMediaType, TimeBase, TimeBaseInput, TimeCode, TimeCodeInput, TimeCodeInputOptions, createFacetType, createMetadataType, createTimeBase, createTimeCode, filterShapeSource, findNearestThumbnail, formatTimeBaseText, formatTimeBaseType, formatTimeCodeSeconds, formatTimeCodeSmpte, formatTimeCodeText, formatTimeCodeType, getShapeDocumentType, getShapeMediaType, metadataTypeToWebVtt, parseAudioComponent, parseBinaryComponent, parseContainerComponent, parseFacetType, parseFieldList, parseFileType, parseGroupList, parseHighlightTimespan, parseHighlightTimespanList, parseKeyValuePairTypes as parseKeyValuePairType, parseMediaConvertPreset, parseMetadataType, parseNowDate, parseShapeType, parseSimpleMetadataType, parseTimespan, parseTimespanList, parseTranscodePreset, parseVideoComponent };
1026
+ export declare const parseTranscodePreset: (transcodePresetType: TranscodePresetType) => ParsedTranscodePreset;
1027
+
1028
+ export declare interface ParseValueListOptions extends ParseValueOptions {
1029
+ /** String to join the values, (e.g. `,`) */
1030
+ joinValue?: string;
1031
+ /** Return values as array even if single value */
1032
+ arrayOnSingleValue?: boolean;
1033
+ }
1034
+
1035
+ export declare type ParseValueOptions = {
1036
+ /** Include attributes on value (`true` for all) */
1037
+ includeValueAttributes?: boolean | (keyof ParsedValueAttributes)[];
1038
+ };
1039
+
1040
+ /**
1041
+ * Parses the technical information of a VideoComponentType.
1042
+ * @param {Object} videoComponentType - A VideoComponentType from VidiCore.
1043
+ * @returns {Object} Parsed component object.
1044
+ *
1045
+ * @category Shape
1046
+ */
1047
+ export declare const parseVideoComponent: (videoComponentType?: VideoComponentType) => ParsedVideoComponentType;
1048
+
1049
+ /**
1050
+ * Const object with VidiCore role names
1051
+ *
1052
+ * @category Auth
1053
+ */
1054
+ export declare const ROLE_NAMES: {
1055
+ readonly ACCESSCONTROL_READ: "_accesscontrol_read";
1056
+ readonly ACCESSCONTROL_WRITE: "_accesscontrol_write";
1057
+ readonly ADMINISTRATOR: "_administrator";
1058
+ readonly AUTO_PROJECTION_READ: "_auto_projection_read";
1059
+ readonly AUTO_PROJECTION_WRITE: "_auto_projection_write";
1060
+ readonly COLLECTION_NOTIFICATION_READ: "_collection_notification_read";
1061
+ readonly COLLECTION_NOTIFICATION_WRITE: "_collection_notification_write";
1062
+ readonly COLLECTION_READ: "_collection_read";
1063
+ readonly COLLECTION_WRITE: "_collection_write";
1064
+ readonly CONFIGURATION_READ: "_configuration_read";
1065
+ readonly DELETION_LOCK_NOTIFICATION_READ: "_deletion_lock_notification_read";
1066
+ readonly DELETION_LOCK_NOTIFICATION_WRITE: "_deletion_lock_notification_write";
1067
+ readonly DELETION_LOCK_READ: "_deletion_lock_read";
1068
+ readonly DELETION_LOCK_WRITE: "_deletion_lock_write";
1069
+ readonly DOCUMENT_NOTIFICATION_READ: "_document_notification_read";
1070
+ readonly DOCUMENT_NOTIFICATION_WRITE: "_document_notification_write";
1071
+ readonly DOCUMENT_READ: "_document_read";
1072
+ readonly DOCUMENT_WRITE: "_document_write";
1073
+ readonly ERROR_READ: "_error_read";
1074
+ readonly ERROR_WRITE: "_error_write";
1075
+ readonly EXPORT: "_export";
1076
+ readonly EXPORT_TEMPLATE_READ: "_export_template_read";
1077
+ readonly EXPORT_TEMPLATE_WRITE: "_export_template_write";
1078
+ readonly EXTERNAL_ID_READ: "_external_id_read";
1079
+ readonly EXTERNAL_ID_WRITE: "_external_id_write";
1080
+ readonly FILE_NOTIFICATION_READ: "_file_notification_read";
1081
+ readonly FILE_NOTIFICATION_WRITE: "_file_notification_write";
1082
+ readonly FILE_READ: "_file_read";
1083
+ readonly FILE_WRITE: "_file_write";
1084
+ readonly GROUP_READ: "_group_read";
1085
+ readonly GROUP_WRITE: "_group_write";
1086
+ readonly IMPORT_WRITE: "_import";
1087
+ readonly ITEM_ID_READ: "_item_id_read";
1088
+ readonly ITEM_ID_WRITE: "_item_id_write";
1089
+ readonly ITEM_NOTIFICATION_READ: "_item_notification_read";
1090
+ readonly ITEM_NOTIFICATION_WRITE: "_item_notification_write";
1091
+ readonly ITEM_WRITE: "_item_write";
1092
+ readonly ITEM_SEARCH: "_item_search";
1093
+ readonly ITEM_SHAPE_READ: "_item_shape_read";
1094
+ readonly ITEM_SHAPE_WRITE: "_item_shape_write";
1095
+ readonly ITEM_TIMELINE_READ: "_item_timeline_read";
1096
+ readonly ITEM_TIMELINE_WRITE: "_item_timeline_write";
1097
+ readonly ITEM_URI: "_item_uri";
1098
+ readonly JOB_NOTIFICATION_READ: "_job_notification_read";
1099
+ readonly JOB_NOTIFICATION_WRITE: "_job_notification_write";
1100
+ readonly JOB_READ: "_job_read";
1101
+ readonly JOB_WRITE: "_job_write";
1102
+ readonly LIBRARY_READ: "_library_read";
1103
+ readonly LIBRARY_WRITE: "_library_write";
1104
+ readonly LOCK_READ: "_lock_read";
1105
+ readonly LOCK_WRITE: "_lock_write";
1106
+ readonly LOG_READ: "_log_read";
1107
+ readonly METADATA_DATASET_READ: "_metadata_dataset_read";
1108
+ readonly METADATA_DATASET_WRITE: "_metadata_dataset_write";
1109
+ readonly METADATA_FIELD_GROUP_READ: "_metadata_field_group_read";
1110
+ readonly METADATA_FIELD_GROUP_WRITE: "_metadata_field_group_write";
1111
+ readonly METADATA_FIELD_READ: "_metadata_field_read";
1112
+ readonly METADATA_FIELD_WRITE: "_metadata_field_write";
1113
+ readonly METADATA_GLOBAL_READ: "_metadata_global_read";
1114
+ readonly METADATA_GLOBAL_WRITE: "_metadata_global_write";
1115
+ readonly METADATA_LOCK_READ: "_metadata_lock_read";
1116
+ readonly METADATA_LOCK_WRITE: "_metadata_lock_write";
1117
+ readonly METADATA_READ: "_metadata_read";
1118
+ readonly METADATA_SCHEMA_READ: "_metadata_schema_read";
1119
+ readonly METADATA_SCHEMA_WRITE: "_metadata_schema_write";
1120
+ readonly METADATA_WRITE: "_metadata_write";
1121
+ readonly OTIF_ANALYZE: "_otif_analyze";
1122
+ readonly OTIF_READ: "_otif_read";
1123
+ readonly OTIF_WRITE: "_otif_write";
1124
+ readonly PLACEHOLDER_NOTIFICATION_READ: "_placeholder_notification_read";
1125
+ readonly PLACEHOLDER_NOTIFICATION_WRITE: "_placeholder_notification_write";
1126
+ readonly PROJECTION_READ: "_projection_read";
1127
+ readonly PROJECTION_WRITE: "_projection_write";
1128
+ readonly QUOTA_NOTIFICATION_READ: "_quota_notification_read";
1129
+ readonly QUOTA_NOTIFICATION_WRITE: "_quota_notification_write";
1130
+ readonly QUOTA_READ: "_quota_read";
1131
+ readonly QUOTA_WRITE: "_quota_write";
1132
+ readonly RELATION_READ: "_relation_read";
1133
+ readonly RELATION_WRITE: "_relation_write";
1134
+ readonly RESOURCE_READ: "_resource_read";
1135
+ readonly RESOURCE_WRITE: "_resource_write";
1136
+ readonly RUN_AS: "_run_as";
1137
+ readonly SEARCH: "_search";
1138
+ readonly SEQUENCE_READ: "_sequence_read";
1139
+ readonly SEQUENCE_WRITE: "_sequence_write";
1140
+ readonly SHAPE_TAG_READ: "_shape_tag_read";
1141
+ readonly SHAPE_TAG_WRITE: "_shape_tag_write";
1142
+ readonly SITE_MANAGER: "_site_manager";
1143
+ readonly SITE_RULE_READ: "_site_rule_read";
1144
+ readonly SITE_RULE_WRITE: "_site_rule_write";
1145
+ readonly STORAGE_GROUP_READ: "_storage_group_read";
1146
+ readonly STORAGE_GROUP_WRITE: "_storage_group_write";
1147
+ readonly STORAGE_NOTIFICATION_READ: "_storage_notification_read";
1148
+ readonly STORAGE_NOTIFICATION_WRITE: "_storage_notification_write";
1149
+ readonly STORAGE_READ: "_storage_read";
1150
+ readonly STORAGE_RULE_READ: "_storage_rule_read";
1151
+ readonly STORAGE_RULE_WRITE: "_storage_rule_write";
1152
+ readonly STORAGE_WRITE: "_storage_write";
1153
+ readonly SUPER_ACCESS_USER: "_super_access_user";
1154
+ readonly TASKDEFINITION_READ: "_taskdefinition_read";
1155
+ readonly TASKDEFINITION_WRITE: "_taskdefinition_write";
1156
+ readonly THUMBNAIL_READ: "_thumbnail_read";
1157
+ readonly THUMBNAIL_WRITE: "_thumbnail_write";
1158
+ readonly TRANSCODER: "_transcoder";
1159
+ readonly TRANSFER_READ: "_transfer_read";
1160
+ readonly TRANSFER_WRITE: "_transfer_write";
1161
+ readonly USER: "_user";
1162
+ readonly VXA: "_vxa";
1163
+ readonly VXA_READ: "_vxa_read";
1164
+ };
1165
+
1166
+ export declare type RoleNameTypes = keyof typeof ROLE_NAMES;
1167
+
1168
+ /**
1169
+ * Const object with media types
1170
+ *
1171
+ * @category Shape
1172
+ */
1173
+ export declare const SHAPE_MEDIA_TYPES: {
1174
+ readonly IMAGE: "IMAGE";
1175
+ readonly AUDIO: "AUDIO";
1176
+ readonly VIDEO: "VIDEO";
1177
+ readonly DOCUMENT: "DOCUMENT";
1178
+ readonly BINARY: "BINARY";
1179
+ };
1180
+
1181
+ export declare type ShapeMediaType = keyof typeof SHAPE_MEDIA_TYPES;
1182
+
1183
+ /**
1184
+ * Array with all available VidiCore system/default field group names
1185
+ *
1186
+ * @category Metadata
1187
+ */
1188
+ export declare const SYSTEM_FIELDGROUPS: readonly ["stl_subtitle", "stl_tti", "stl_gsi", "mrk_marker", "pho_validation", "pho_resource", "pho_error", "facedetect_rect", "facedetect_face", "originalTrackFilename", "stl_gsiHeader"];
1189
+
1190
+ /**
1191
+ * Array with all available VidiCore system/default field names (including transient)
1192
+ *
1193
+ * @category Metadata
1194
+ */
1195
+ export declare const SYSTEM_FIELDS: readonly ["title", "user", "shapeTag", "representativeThumbnail", "representativeThumbnailNoAuth", "representativeItems", "itemId", "collectionId", "mediaType", "mimeType", "created", "startTimeCode", "startSeconds", "fieldValidationError", "schemaValidationError", "originalFilename", "originalUri", "originalAudioCodec", "originalVideoCodec", "originalHeight", "originalWidth", "originalFormat", "durationSeconds", "durationTimeCode", "solr-index", "__user", "__collection", "__collection_size", "__ancestor_collection", "__ancestor_collection_size", "__shape", "__shape_size", "__shape_last_added", "__placeholder_shape_size", "__version", "__version_count", "__storage", "__storage_size", "__shapetag_{tag}_hash_{hash}", "__storage_{tag}", "__storage_{tag}_size", "__storagegroup", "__storagegroup_size", "__sequence", "__sequence_size", "__metadata_last_modified", "__external_id", "__deletion_lock_id", "__deletion_lock_expiry", "__child_collection", "__child_collection_size", "__parent_collection", "__parent_collection_size", "__items_size", "stl_text", "stl_justification", "stl_xrelative", "stl_yrelative", "stl_vertical", "stl_verticalbase", "stl_horizontalbase", "stl_sizerelative", "stl_color", "stl_outline", "stl_outlinecolor", "stl_outlinesize", "stl_font", "stl_service", "stl_tti", "stl_gsi", "cct", "tcd", "tcf", "oet", "cd", "mnc", "cpn", "dfc", "tcp", "tcs", "tet", "tnb", "tnd", "en", "co", "tng", "rd", "mnr", "dsc", "opt", "lc", "tpt", "tn", "slr", "tns", "rn", "pub", "dsn", "ecd", "mrk_zerolength", "mrk_text", "mrk_color", "pho_resource_name", "pho_error_level", "pho_error_code", "pho_error_description", "facedetect_rect_width", "facedetect_rect_height", "facedetect_rect_y", "facedetect_rect_x", "facedetect_pid", "facedetect_rect", "trackId", "eidr_actor", "eidr_alternateId", "eidr_countryOfOrigin", "eidr_director", "eidr_id", "eidr_referentType", "eidr_releaseDate", "eidr_resourceName", "eidr_status", "eidr_sync", "ttml_div", "ttml_root", "vxa_collection_id", "vxaId", "vxaLocalPath", "tco", "cs", "ebn", "tf", "cf", "sgn", "tci", "jc", "vp", "sn"];
1196
+
1197
+ /**
1198
+ * TimeBase class representing the TimeBaseType in VidiCore
1199
+ *
1200
+ * For more info, see the [Time bases section in VidiCore API Docs](https://apidoc.vidispine.com/latest/time.html#time-bases)
1201
+ *
1202
+ * @category Time
1203
+ */
1204
+ export declare class TimeBase {
1205
+ /** The numerator for the TimeBase */
1206
+ numerator: number;
1207
+ /** The denominator for the TimeBase */
1208
+ denominator: number;
1209
+ /**
1210
+ * Constructor for TimeBase
1211
+ *
1212
+ * @param timeBaseType A TimeBaseType object
1213
+ */
1214
+ constructor(timeBaseType?: TimeBaseInput);
1215
+ /**
1216
+ * Get TimeBase in a constant representation (e.g. "PAL") if possible, otherwise undefined
1217
+ * @returns Constant representation of the TimeBase
1218
+ */
1219
+ toConstant(): string;
1220
+ /**
1221
+ * Get TimeBase as a VidiCore TimeBaseType string
1222
+ *
1223
+ * @remarks
1224
+ * Default format: denominator(:numerator if > 1)
1225
+ *
1226
+ * `constant` has precedence over `fraction` if both are true (e.g. NTSC > 30000:1001)
1227
+ *
1228
+ * @param options For how to display it as text
1229
+ * @returns Text representation of the TimeBase
1230
+ */
1231
+ toText(options?: {
1232
+ /** Show time base as constant (e.g. PAL) */
1233
+ constant?: boolean;
1234
+ /** Show time base as fraction (25:1) even when numerator is 1 */
1235
+ fraction?: boolean;
1236
+ }): string;
1237
+ /**
1238
+ * Output TimeBase as frame rate (by default max 16 decimal places)
1239
+ *
1240
+ * @remarks
1241
+ * Default format: rate with two decimals if needed (i.e. decimals are > 0)
1242
+ *
1243
+ * `rounded` has precedence over `fixed`
1244
+ *
1245
+ * @param options On how to return the rate
1246
+ *
1247
+ * @return Rate of the TimeBase
1248
+ */
1249
+ toRate(options?: {
1250
+ /** Rounded to nearest integer */
1251
+ rounded?: boolean;
1252
+ /** Amount of decimal places
1253
+ * - `true` two decimal places
1254
+ * - `false` max amount of decimal places
1255
+ * - `number` that amount of decimal places
1256
+ */
1257
+ fixed?: boolean | number;
1258
+ }): number;
1259
+ /**
1260
+ * Get TimeBase in a object representation
1261
+ *
1262
+ * @returns TimeBase as `{denominator, numerator}` object
1263
+ */
1264
+ toObject(): TimeBaseType;
1265
+ /**
1266
+ * @deprecated Use {@link TimeBase#toObject | toObject} instead
1267
+ *
1268
+ * @returns TimeBase as `{denominator, numerator}` object
1269
+ */
1270
+ toJson(): TimeBaseType;
1271
+ }
1272
+
1273
+ export declare type TimeBaseInput = {
1274
+ /** The numerator for the TimeBase */
1275
+ numerator?: number | string;
1276
+ /** The denominator for the TimeBase */
1277
+ denominator?: number | string;
1278
+ };
1279
+
1280
+ /**
1281
+ * TimeCode class representing the TimeCodeType in VidiCore
1282
+ *
1283
+ * For more info, see the [Time Codes section of VidiCore API Docs](https://apidoc.vidispine.com/latest/time.html#time-codes)
1284
+ *
1285
+ * @category Time
1286
+ */
1287
+ export declare class TimeCode {
1288
+ /** Amount of samples for the time code */
1289
+ samples: number;
1290
+ /** The time base for the time code */
1291
+ timeBase: TimeBase;
1292
+ /** If time code is dropFrame or not (by default checks timeBase) */
1293
+ dropFrame: boolean;
1294
+ /** Separator for frame in smpte output (default ":" for non dropFrame and ";" for dropFrame) */
1295
+ frameSeparator: string;
1296
+ /**
1297
+ * Constructor for TimeCode
1298
+ *
1299
+ * @param timeCodeType Object to create TimeCode of
1300
+ * @param options Options for the timeCode
1301
+ */
1302
+ constructor(timeCodeType: TimeCodeInput, options?: TimeCodeInputOptions);
1303
+ /**
1304
+ * Return this TimeCode added with the supplied timeCodeType
1305
+ * - If time bases differ, it will retain the time base of this TimeCode instance
1306
+ * - If supplied time code has a more granular time base, it will round down exceeding samples (hasn't reached that sample yet)
1307
+ *
1308
+ * @remarks
1309
+ * If you don't want to "lose" frames in the manner described above, make sure time code you're operating on has higher time base granularity
1310
+ *
1311
+ * To exemplify:
1312
+ * - "51@50".add("25@25") => "101@50"
1313
+ * - while "25@25".add("51@50") => "50@25"
1314
+ *
1315
+ * @param timeCode A TimeCode instance you want to add with
1316
+ * @returns A new TimeCode instance with the addition applied
1317
+ */
1318
+ add(timeCode: TimeCode): TimeCode;
1319
+ /**
1320
+ * Return this TimeCode subtracted with the supplied timeCodeType
1321
+ * - If time bases differ, it will retain the time base of the instance time code
1322
+ * - If supplied time code has a more granular time base, it will round down exceeding samples (hasn't reached that sample yet)
1323
+ *
1324
+ * @remarks
1325
+ * If you don't want to "lose" frames in the manner described above, make sure time code you're operating on has higher time base granularity
1326
+
1327
+ * To exemplify:
1328
+ * - "101@50".subtract("25@25") => "51@50"
1329
+ * - while "50@25".subtract("51@50") => "25@25"
1330
+ *
1331
+ * @param timeCode A TimeCode instance you want to subtract with
1332
+ * @returns A new TimeCode instance with the subtraction applied
1333
+ */
1334
+ subtract(timeCode: TimeCode): TimeCode;
1335
+ /**
1336
+ * Creates a new TimeCode instance with specified timeBase and samples adjusted to that.
1337
+ *
1338
+ * @remarks
1339
+ * If it conforms to a less granular time base - it will floor samples (hasn't reached that sample yet)
1340
+ * - e.g. "51@50".conformTo("PAL") => "25@PAL" (not "26@PAL")
1341
+ *
1342
+ * @param timeBase The TimeBase it should conform the TimeCode to
1343
+ * @param options Explicitly set TimeCode options, by default these are derived from `timeBase`
1344
+ * @returns A new TimeCode instance with the conformTo timeBase applied
1345
+ */
1346
+ conformTimeBase(timeBase: TimeCodeInput['timeBase'], options?: TimeCodeInputOptions): TimeCode;
1347
+ /**
1348
+ * Get TimeCode as a text representation
1349
+ *
1350
+ * @remarks
1351
+ * Default format: `samples@denominator[:numerator (if > 1)])`
1352
+ *
1353
+ * `constant` has precedence over `fraction` if both are true
1354
+ *
1355
+ * @param options Options for how to format text
1356
+ * @returns Text representation of TimeCode
1357
+ */
1358
+ toText(options?: {
1359
+ /** Include time base even if seconds (i.e. append @1 or @1:1) */
1360
+ includeTimeBaseForSeconds?: boolean;
1361
+ /** show as constant (e.g. @PAL) */
1362
+ constant?: boolean;
1363
+ /** show as fraction (e.g. @25:1) */
1364
+ fraction?: boolean;
1365
+ }): string;
1366
+ /**
1367
+ * Get TimeCode in a units object representation
1368
+ *
1369
+ * @remarks
1370
+ * If samples is `Infinity` it also returns `Infinity` for all units
1371
+ *
1372
+ * @returns Units (time and frames) for the time code
1373
+ */
1374
+ toUnits(): {
1375
+ hours: number;
1376
+ minutes: number;
1377
+ seconds: number;
1378
+ frames: number;
1379
+ };
1380
+ /**
1381
+ * Get TimeCode in a time object representation
1382
+ *
1383
+ * Note: "milliseconds" is rounded down - use "partialSeconds" for another representation
1384
+ *
1385
+ * @returns Time for the time code
1386
+ */
1387
+ toTime(): {
1388
+ hours: number;
1389
+ minutes: number;
1390
+ seconds: number;
1391
+ milliseconds: number;
1392
+ partialSeconds: number;
1393
+ };
1394
+ /**
1395
+ * Get TimeCode in a seconds representation
1396
+ *
1397
+ * @returns Total seconds for the time code
1398
+ */
1399
+ toSeconds(): number;
1400
+ /**
1401
+ * Get TimeCode in a duration representation
1402
+ *
1403
+ * The time unit keys for the format string are:
1404
+ * - `h` for hour
1405
+ * - `m` for minute
1406
+ * - `s` for seconds
1407
+ * - `S` for milliseconds
1408
+ * - Any other char will be kept in the duration output string
1409
+ *
1410
+ * Note: Add several consecutive chars for zero padding.
1411
+ *
1412
+ * By default it:
1413
+ * - uses colon delimiter (e.g. for format "hhmmss")
1414
+ * - shows "m:ss" or "h:mm:ss" if format is undefined
1415
+ *
1416
+ * @param options Options for how to display duration
1417
+ * @returns Duration representation of the TimeCode
1418
+ */
1419
+ toDuration(options?: {
1420
+ /** Specify format of duration string, (e.g. `hh:mm:ss.S` for "01:23:04.5") */
1421
+ format?: string;
1422
+ }): string;
1423
+ /**
1424
+ * Get TimeCode in a smpte representation
1425
+ *
1426
+ * @returns Smpte representation of the TimeCode
1427
+ */
1428
+ toSmpte(): string;
1429
+ /**
1430
+ * Get TimeCode as a VidiCore TimeCodeType object
1431
+ *
1432
+ * @returns TimeCode as `{ samples, timeBase }`
1433
+ */
1434
+ toObject(): {
1435
+ samples: number;
1436
+ timeBase: RationalType;
1437
+ };
1438
+ /**
1439
+ * @deprecated Use {@link TimeCode#toObject | toObject} instead
1440
+ *
1441
+ * @returns TimeCode as `{ samples, timeBase }`
1442
+ */
1443
+ toJson(): {
1444
+ samples: number;
1445
+ timeBase: RationalType;
1446
+ };
1447
+ }
1448
+
1449
+ export declare type TimeCodeInput = {
1450
+ /** Amount of samples for the time code */
1451
+ samples?: number | string;
1452
+ /** The time base for the time code */
1453
+ timeBase?: string | TimeBaseInput | TimeBase;
1454
+ };
1455
+
1456
+ export declare type TimeCodeInputOptions = {
1457
+ /** If time code is dropFrame or not (by default checks timeBase) */
1458
+ dropFrame?: boolean;
1459
+ /** Separator for frame in smpte output (default ":" for non-drop-frame and ";" for dropFrame) */
1460
+ frameSeparator?: string;
1461
+ };
1462
+
1463
+ export { }