@vidispine/vdt-js 22.4.0-pre.5 → 22.4.0-pre.7
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 +9 -9
- package/dist/index.es.js +30 -34
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +30 -34
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.ts
CHANGED
|
@@ -1052,20 +1052,19 @@ declare type DocumentType = keyof typeof DOCUMENT_TYPES;
|
|
|
1052
1052
|
/**
|
|
1053
1053
|
* Return a const for the document type of a shape (looks at mimeType)
|
|
1054
1054
|
*
|
|
1055
|
-
* @param shape
|
|
1055
|
+
* @param shape A VidiCore shape
|
|
1056
1056
|
* @returns The document type for a shape
|
|
1057
1057
|
*
|
|
1058
1058
|
* @category Shape
|
|
1059
1059
|
*/
|
|
1060
|
-
declare const
|
|
1061
|
-
mimeType?: string | string[];
|
|
1062
|
-
}) => DocumentType;
|
|
1060
|
+
declare const getShapeDocumentType: (shape?: ShapeType) => DocumentType;
|
|
1063
1061
|
|
|
1064
1062
|
declare type FilteredShapeListObject = {
|
|
1065
1063
|
src: string;
|
|
1066
1064
|
type: string;
|
|
1067
|
-
shape:
|
|
1068
|
-
|
|
1065
|
+
shape: ShapeType;
|
|
1066
|
+
parsedShape: ParsedShapeType;
|
|
1067
|
+
[key: string]: string | ParsedShapeType | ShapeType;
|
|
1069
1068
|
};
|
|
1070
1069
|
declare type FilterShapeSourceOption = {
|
|
1071
1070
|
sortPriority?: Function;
|
|
@@ -1074,6 +1073,7 @@ declare type FilterShapeSourceOption = {
|
|
|
1074
1073
|
sourceKey?: string;
|
|
1075
1074
|
mimeTypeKey?: string;
|
|
1076
1075
|
shapeKey?: string;
|
|
1076
|
+
parsedShapeKey?: string;
|
|
1077
1077
|
};
|
|
1078
1078
|
/**
|
|
1079
1079
|
* Filter a shape type list to get shapes that are playable in a browser
|
|
@@ -1097,12 +1097,12 @@ declare type ShapeMediaType = keyof typeof SHAPE_MEDIA_TYPES;
|
|
|
1097
1097
|
/**
|
|
1098
1098
|
* Returns a const for which media type a shape has
|
|
1099
1099
|
*
|
|
1100
|
-
* @param
|
|
1100
|
+
* @param shape
|
|
1101
1101
|
* @returns
|
|
1102
1102
|
*
|
|
1103
1103
|
* @category Shape
|
|
1104
1104
|
*/
|
|
1105
|
-
declare const getShapeMediaType: (
|
|
1105
|
+
declare const getShapeMediaType: (shape: ShapeType) => ShapeMediaType;
|
|
1106
1106
|
|
|
1107
1107
|
/**
|
|
1108
1108
|
* Find the thumbnail uri in a VidiCore item object that's nearest a timeCode
|
|
@@ -1179,4 +1179,4 @@ declare type ParsedTranscodePreset = {
|
|
|
1179
1179
|
*/
|
|
1180
1180
|
declare const parseTranscodePreset: (transcodePresetType: TranscodePresetType) => ParsedTranscodePreset;
|
|
1181
1181
|
|
|
1182
|
-
export { CreateFacetTypeFieldList, CreateFacetTypeOptions, CreateMetadataTypeInput, CreateTimeCodeOptions, DocumentType, FIELD_ATTRIBUTE_KEYS, FIELD_VALUE_ATTRIBUTE_KEYS, 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, SYSTEM_FIELDGROUPS, SYSTEM_FIELDS, ShapeMediaType, TimeBase, TimeBaseInput, TimeCode, TimeCodeInput, TimeCodeInputOptions, createFacetType, createMetadataType, createTimeBase, createTimeCode, filterShapeSource, findNearestThumbnail, formatTimeBaseText, formatTimeBaseType, formatTimeCodeSeconds, formatTimeCodeSmpte, formatTimeCodeText, formatTimeCodeType,
|
|
1182
|
+
export { CreateFacetTypeFieldList, CreateFacetTypeOptions, CreateMetadataTypeInput, CreateTimeCodeOptions, DocumentType, FIELD_ATTRIBUTE_KEYS, FIELD_VALUE_ATTRIBUTE_KEYS, 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, 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 };
|
package/dist/index.es.js
CHANGED
|
@@ -2402,11 +2402,6 @@ var parseNowDate = function parseNowDate() {
|
|
|
2402
2402
|
var nowDiff = new Date();
|
|
2403
2403
|
|
|
2404
2404
|
switch (unit) {
|
|
2405
|
-
case 'TODAY':
|
|
2406
|
-
if (sign === '+') nowDiff.setHours(23, 59, 59, 999);
|
|
2407
|
-
if (sign === '-') nowDiff.setHours(0, 0, 0, 0);
|
|
2408
|
-
break;
|
|
2409
|
-
|
|
2410
2405
|
case 'HOUR':
|
|
2411
2406
|
case 'HOURS':
|
|
2412
2407
|
if (sign === '+') nowDiff.setHours(nowDiff.getHours() + number);
|
|
@@ -2826,6 +2821,7 @@ var parseShapeType = function parseShapeType() {
|
|
|
2826
2821
|
return parsedShape;
|
|
2827
2822
|
};
|
|
2828
2823
|
|
|
2824
|
+
// eslint-disable-next-line import/no-cycle
|
|
2829
2825
|
var DOCUMENT_TYPES = {
|
|
2830
2826
|
PDF: 'PDF',
|
|
2831
2827
|
TEXT: 'TEXT',
|
|
@@ -2837,15 +2833,16 @@ var DOCUMENT_TYPES = {
|
|
|
2837
2833
|
/**
|
|
2838
2834
|
* Return a const for the document type of a shape (looks at mimeType)
|
|
2839
2835
|
*
|
|
2840
|
-
* @param shape
|
|
2836
|
+
* @param shape A VidiCore shape
|
|
2841
2837
|
* @returns The document type for a shape
|
|
2842
2838
|
*
|
|
2843
2839
|
* @category Shape
|
|
2844
2840
|
*/
|
|
2845
|
-
var
|
|
2846
|
-
var
|
|
2847
|
-
|
|
2848
|
-
|
|
2841
|
+
var getShapeDocumentType = function getShapeDocumentType() {
|
|
2842
|
+
var shape = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
2843
|
+
// shapeType.mimeType is always a string array,
|
|
2844
|
+
// but accepts passing in { mimeType: string } for backwards compatibility
|
|
2845
|
+
var mimeTypeArrayOrString = shape.mimeType;
|
|
2849
2846
|
var mimeType = Array.isArray(mimeTypeArrayOrString) ? mimeTypeArrayOrString[0] : mimeTypeArrayOrString;
|
|
2850
2847
|
if (!mimeType) return undefined;
|
|
2851
2848
|
if (mimeType.endsWith('/pdf')) return DOCUMENT_TYPES.PDF;
|
|
@@ -2872,8 +2869,8 @@ var H264_CODEC = 'h264'; // Sort by tags in the order of previewShapeOrder, seco
|
|
|
2872
2869
|
var PREVIEW_SHAPE_ORDER = ['__mp4', '__mp3_160k', '__png', '__jpeg', '__gif', 'original'].reverse();
|
|
2873
2870
|
|
|
2874
2871
|
var defaultSortPriority = function defaultSortPriority(_ref, _ref2) {
|
|
2875
|
-
var firstEl = _ref.
|
|
2876
|
-
var secondEl = _ref2.
|
|
2872
|
+
var firstEl = _ref.parsedShape.tag;
|
|
2873
|
+
var secondEl = _ref2.parsedShape.tag;
|
|
2877
2874
|
|
|
2878
2875
|
if (PREVIEW_SHAPE_ORDER.includes(firstEl) || PREVIEW_SHAPE_ORDER.includes(secondEl)) {
|
|
2879
2876
|
return PREVIEW_SHAPE_ORDER.indexOf(secondEl) - PREVIEW_SHAPE_ORDER.indexOf(firstEl);
|
|
@@ -2896,29 +2893,31 @@ var filterShapeSource = function filterShapeSource(itemType, options) {
|
|
|
2896
2893
|
var _ref3 = options || {},
|
|
2897
2894
|
_ref3$allowedMimeType = _ref3.allowedMimeTypes,
|
|
2898
2895
|
allowedMimeTypes = _ref3$allowedMimeType === void 0 ? DEFAULT_ALLOWED_MIME_TYPES : _ref3$allowedMimeType,
|
|
2899
|
-
_ref3$sortPriority = _ref3.sortPriority,
|
|
2900
|
-
sortPriority = _ref3$sortPriority === void 0 ? defaultSortPriority : _ref3$sortPriority,
|
|
2901
2896
|
_ref3$allowedMethods = _ref3.allowedMethods,
|
|
2902
2897
|
allowedMethods = _ref3$allowedMethods === void 0 ? DEFAULT_ALLOWED_METHODS : _ref3$allowedMethods,
|
|
2898
|
+
_ref3$sortPriority = _ref3.sortPriority,
|
|
2899
|
+
sortPriority = _ref3$sortPriority === void 0 ? defaultSortPriority : _ref3$sortPriority,
|
|
2903
2900
|
_ref3$sourceKey = _ref3.sourceKey,
|
|
2904
2901
|
sourceKey = _ref3$sourceKey === void 0 ? 'src' : _ref3$sourceKey,
|
|
2905
2902
|
_ref3$mimeTypeKey = _ref3.mimeTypeKey,
|
|
2906
2903
|
mimeTypeKey = _ref3$mimeTypeKey === void 0 ? 'type' : _ref3$mimeTypeKey,
|
|
2907
2904
|
_ref3$shapeKey = _ref3.shapeKey,
|
|
2908
|
-
shapeKey = _ref3$shapeKey === void 0 ? 'shape' : _ref3$shapeKey
|
|
2905
|
+
shapeKey = _ref3$shapeKey === void 0 ? 'shape' : _ref3$shapeKey,
|
|
2906
|
+
_ref3$parsedShapeKey = _ref3.parsedShapeKey,
|
|
2907
|
+
parsedShapeKey = _ref3$parsedShapeKey === void 0 ? 'parsedShapeKey' : _ref3$parsedShapeKey;
|
|
2909
2908
|
|
|
2910
2909
|
var _ref4 = itemType || {},
|
|
2911
2910
|
_ref4$shape = _ref4.shape,
|
|
2912
2911
|
shapeList = _ref4$shape === void 0 ? [] : _ref4$shape;
|
|
2913
2912
|
|
|
2914
|
-
var
|
|
2913
|
+
var filteredShapeList = shapeList.reduce(function (acc, shapeType) {
|
|
2915
2914
|
var type;
|
|
2916
2915
|
var src;
|
|
2917
|
-
var
|
|
2918
|
-
var uri =
|
|
2919
|
-
mimeType =
|
|
2920
|
-
containerFormat =
|
|
2921
|
-
videoCodec =
|
|
2916
|
+
var parsedShape = parseShapeType(shapeType);
|
|
2917
|
+
var uri = parsedShape.uri,
|
|
2918
|
+
mimeType = parsedShape.mimeType,
|
|
2919
|
+
containerFormat = parsedShape.containerFormat,
|
|
2920
|
+
videoCodec = parsedShape.videoCodec;
|
|
2922
2921
|
|
|
2923
2922
|
if (mimeType) {
|
|
2924
2923
|
type = mimeType;
|
|
@@ -2940,13 +2939,13 @@ var filterShapeSource = function filterShapeSource(itemType, options) {
|
|
|
2940
2939
|
if (src && allowedMimeTypes.includes(type)) {
|
|
2941
2940
|
var _acc$push;
|
|
2942
2941
|
|
|
2943
|
-
acc.push((_acc$push = {}, _defineProperty(_acc$push, sourceKey, src), _defineProperty(_acc$push, mimeTypeKey, type), _defineProperty(_acc$push, shapeKey,
|
|
2942
|
+
acc.push((_acc$push = {}, _defineProperty(_acc$push, sourceKey, src), _defineProperty(_acc$push, mimeTypeKey, type), _defineProperty(_acc$push, shapeKey, shapeType), _defineProperty(_acc$push, parsedShapeKey, parsedShape), _acc$push));
|
|
2944
2943
|
}
|
|
2945
2944
|
|
|
2946
2945
|
return acc;
|
|
2947
2946
|
}, []);
|
|
2948
|
-
if (typeof sortPriority === 'function')
|
|
2949
|
-
return
|
|
2947
|
+
if (typeof sortPriority === 'function') filteredShapeList.sort(defaultSortPriority);
|
|
2948
|
+
return filteredShapeList;
|
|
2950
2949
|
};
|
|
2951
2950
|
|
|
2952
2951
|
var SHAPE_MEDIA_TYPES = {
|
|
@@ -2956,23 +2955,20 @@ var SHAPE_MEDIA_TYPES = {
|
|
|
2956
2955
|
DOCUMENT: 'DOCUMENT',
|
|
2957
2956
|
BINARY: 'BINARY'
|
|
2958
2957
|
};
|
|
2959
|
-
// TODO: For consistency, replace input with an actual ShapeType not a parsed shape
|
|
2960
|
-
// (parse it internally if needed)
|
|
2961
2958
|
|
|
2962
2959
|
/**
|
|
2963
2960
|
* Returns a const for which media type a shape has
|
|
2964
2961
|
*
|
|
2965
|
-
* @param
|
|
2962
|
+
* @param shape
|
|
2966
2963
|
* @returns
|
|
2967
2964
|
*
|
|
2968
2965
|
* @category Shape
|
|
2969
2966
|
*/
|
|
2970
|
-
var getShapeMediaType = function getShapeMediaType(
|
|
2971
|
-
var
|
|
2972
|
-
|
|
2973
|
-
videoCodec =
|
|
2974
|
-
audioCodec =
|
|
2975
|
-
|
|
2967
|
+
var getShapeMediaType = function getShapeMediaType(shape) {
|
|
2968
|
+
var parsedShape = parseShapeType(shape);
|
|
2969
|
+
var mimeType = parsedShape.mimeType,
|
|
2970
|
+
videoCodec = parsedShape.videoCodec,
|
|
2971
|
+
audioCodec = parsedShape.audioCodec;
|
|
2976
2972
|
if (!mimeType) return undefined;
|
|
2977
2973
|
|
|
2978
2974
|
if (mimeType.startsWith('audio/')) {
|
|
@@ -3190,5 +3186,5 @@ var parseTranscodePreset = function parseTranscodePreset(transcodePresetType) {
|
|
|
3190
3186
|
return output;
|
|
3191
3187
|
};
|
|
3192
3188
|
|
|
3193
|
-
export { FIELD_ATTRIBUTE_KEYS, FIELD_VALUE_ATTRIBUTE_KEYS, GROUP_ATTRIBUTE_KEYS, ROLE_NAMES, SYSTEM_FIELDGROUPS, SYSTEM_FIELDS, TimeBase, TimeCode, createFacetType, createMetadataType, createTimeBase, createTimeCode, filterShapeSource, findNearestThumbnail, formatTimeBaseText, formatTimeBaseType, formatTimeCodeSeconds, formatTimeCodeSmpte, formatTimeCodeText, formatTimeCodeType,
|
|
3189
|
+
export { FIELD_ATTRIBUTE_KEYS, FIELD_VALUE_ATTRIBUTE_KEYS, GROUP_ATTRIBUTE_KEYS, ROLE_NAMES, SYSTEM_FIELDGROUPS, SYSTEM_FIELDS, TimeBase, TimeCode, 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 };
|
|
3194
3190
|
//# sourceMappingURL=index.es.js.map
|