@vidispine/vdt-js 22.4.0-pre.6 → 22.4.0-pre.8
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 -29
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +30 -29
- 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
|
@@ -2821,6 +2821,7 @@ var parseShapeType = function parseShapeType() {
|
|
|
2821
2821
|
return parsedShape;
|
|
2822
2822
|
};
|
|
2823
2823
|
|
|
2824
|
+
// eslint-disable-next-line import/no-cycle
|
|
2824
2825
|
var DOCUMENT_TYPES = {
|
|
2825
2826
|
PDF: 'PDF',
|
|
2826
2827
|
TEXT: 'TEXT',
|
|
@@ -2832,15 +2833,16 @@ var DOCUMENT_TYPES = {
|
|
|
2832
2833
|
/**
|
|
2833
2834
|
* Return a const for the document type of a shape (looks at mimeType)
|
|
2834
2835
|
*
|
|
2835
|
-
* @param shape
|
|
2836
|
+
* @param shape A VidiCore shape
|
|
2836
2837
|
* @returns The document type for a shape
|
|
2837
2838
|
*
|
|
2838
2839
|
* @category Shape
|
|
2839
2840
|
*/
|
|
2840
|
-
var
|
|
2841
|
-
var
|
|
2842
|
-
|
|
2843
|
-
|
|
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;
|
|
2844
2846
|
var mimeType = Array.isArray(mimeTypeArrayOrString) ? mimeTypeArrayOrString[0] : mimeTypeArrayOrString;
|
|
2845
2847
|
if (!mimeType) return undefined;
|
|
2846
2848
|
if (mimeType.endsWith('/pdf')) return DOCUMENT_TYPES.PDF;
|
|
@@ -2867,8 +2869,8 @@ var H264_CODEC = 'h264'; // Sort by tags in the order of previewShapeOrder, seco
|
|
|
2867
2869
|
var PREVIEW_SHAPE_ORDER = ['__mp4', '__mp3_160k', '__png', '__jpeg', '__gif', 'original'].reverse();
|
|
2868
2870
|
|
|
2869
2871
|
var defaultSortPriority = function defaultSortPriority(_ref, _ref2) {
|
|
2870
|
-
var firstEl = _ref.
|
|
2871
|
-
var secondEl = _ref2.
|
|
2872
|
+
var firstEl = _ref.parsedShape.tag;
|
|
2873
|
+
var secondEl = _ref2.parsedShape.tag;
|
|
2872
2874
|
|
|
2873
2875
|
if (PREVIEW_SHAPE_ORDER.includes(firstEl) || PREVIEW_SHAPE_ORDER.includes(secondEl)) {
|
|
2874
2876
|
return PREVIEW_SHAPE_ORDER.indexOf(secondEl) - PREVIEW_SHAPE_ORDER.indexOf(firstEl);
|
|
@@ -2891,29 +2893,31 @@ var filterShapeSource = function filterShapeSource(itemType, options) {
|
|
|
2891
2893
|
var _ref3 = options || {},
|
|
2892
2894
|
_ref3$allowedMimeType = _ref3.allowedMimeTypes,
|
|
2893
2895
|
allowedMimeTypes = _ref3$allowedMimeType === void 0 ? DEFAULT_ALLOWED_MIME_TYPES : _ref3$allowedMimeType,
|
|
2894
|
-
_ref3$sortPriority = _ref3.sortPriority,
|
|
2895
|
-
sortPriority = _ref3$sortPriority === void 0 ? defaultSortPriority : _ref3$sortPriority,
|
|
2896
2896
|
_ref3$allowedMethods = _ref3.allowedMethods,
|
|
2897
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,
|
|
2898
2900
|
_ref3$sourceKey = _ref3.sourceKey,
|
|
2899
2901
|
sourceKey = _ref3$sourceKey === void 0 ? 'src' : _ref3$sourceKey,
|
|
2900
2902
|
_ref3$mimeTypeKey = _ref3.mimeTypeKey,
|
|
2901
2903
|
mimeTypeKey = _ref3$mimeTypeKey === void 0 ? 'type' : _ref3$mimeTypeKey,
|
|
2902
2904
|
_ref3$shapeKey = _ref3.shapeKey,
|
|
2903
|
-
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 ? 'parsedShape' : _ref3$parsedShapeKey;
|
|
2904
2908
|
|
|
2905
2909
|
var _ref4 = itemType || {},
|
|
2906
2910
|
_ref4$shape = _ref4.shape,
|
|
2907
2911
|
shapeList = _ref4$shape === void 0 ? [] : _ref4$shape;
|
|
2908
2912
|
|
|
2909
|
-
var
|
|
2913
|
+
var filteredShapeList = shapeList.reduce(function (acc, shapeType) {
|
|
2910
2914
|
var type;
|
|
2911
2915
|
var src;
|
|
2912
|
-
var
|
|
2913
|
-
var uri =
|
|
2914
|
-
mimeType =
|
|
2915
|
-
containerFormat =
|
|
2916
|
-
videoCodec =
|
|
2916
|
+
var parsedShape = parseShapeType(shapeType);
|
|
2917
|
+
var uri = parsedShape.uri,
|
|
2918
|
+
mimeType = parsedShape.mimeType,
|
|
2919
|
+
containerFormat = parsedShape.containerFormat,
|
|
2920
|
+
videoCodec = parsedShape.videoCodec;
|
|
2917
2921
|
|
|
2918
2922
|
if (mimeType) {
|
|
2919
2923
|
type = mimeType;
|
|
@@ -2935,13 +2939,13 @@ var filterShapeSource = function filterShapeSource(itemType, options) {
|
|
|
2935
2939
|
if (src && allowedMimeTypes.includes(type)) {
|
|
2936
2940
|
var _acc$push;
|
|
2937
2941
|
|
|
2938
|
-
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));
|
|
2939
2943
|
}
|
|
2940
2944
|
|
|
2941
2945
|
return acc;
|
|
2942
2946
|
}, []);
|
|
2943
|
-
if (typeof sortPriority === 'function')
|
|
2944
|
-
return
|
|
2947
|
+
if (typeof sortPriority === 'function') filteredShapeList.sort(defaultSortPriority);
|
|
2948
|
+
return filteredShapeList;
|
|
2945
2949
|
};
|
|
2946
2950
|
|
|
2947
2951
|
var SHAPE_MEDIA_TYPES = {
|
|
@@ -2951,23 +2955,20 @@ var SHAPE_MEDIA_TYPES = {
|
|
|
2951
2955
|
DOCUMENT: 'DOCUMENT',
|
|
2952
2956
|
BINARY: 'BINARY'
|
|
2953
2957
|
};
|
|
2954
|
-
// TODO: For consistency, replace input with an actual ShapeType not a parsed shape
|
|
2955
|
-
// (parse it internally if needed)
|
|
2956
2958
|
|
|
2957
2959
|
/**
|
|
2958
2960
|
* Returns a const for which media type a shape has
|
|
2959
2961
|
*
|
|
2960
|
-
* @param
|
|
2962
|
+
* @param shape
|
|
2961
2963
|
* @returns
|
|
2962
2964
|
*
|
|
2963
2965
|
* @category Shape
|
|
2964
2966
|
*/
|
|
2965
|
-
var getShapeMediaType = function getShapeMediaType(
|
|
2966
|
-
var
|
|
2967
|
-
|
|
2968
|
-
videoCodec =
|
|
2969
|
-
audioCodec =
|
|
2970
|
-
|
|
2967
|
+
var getShapeMediaType = function getShapeMediaType(shape) {
|
|
2968
|
+
var parsedShape = parseShapeType(shape);
|
|
2969
|
+
var mimeType = parsedShape.mimeType,
|
|
2970
|
+
videoCodec = parsedShape.videoCodec,
|
|
2971
|
+
audioCodec = parsedShape.audioCodec;
|
|
2971
2972
|
if (!mimeType) return undefined;
|
|
2972
2973
|
|
|
2973
2974
|
if (mimeType.startsWith('audio/')) {
|
|
@@ -3185,5 +3186,5 @@ var parseTranscodePreset = function parseTranscodePreset(transcodePresetType) {
|
|
|
3185
3186
|
return output;
|
|
3186
3187
|
};
|
|
3187
3188
|
|
|
3188
|
-
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 };
|
|
3189
3190
|
//# sourceMappingURL=index.es.js.map
|