@aspan-corporation/ac-shared 1.0.28 → 1.0.30
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/lib/index.js +22 -3
- package/lib/index.js.map +2 -2
- package/lib/utils/thumbsKey.d.ts +9 -1
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -14394,12 +14394,15 @@ import { extname } from "node:path";
|
|
|
14394
14394
|
var JPEG_EXTENSION = "jpeg";
|
|
14395
14395
|
var JPG_EXTENSION = "jpg";
|
|
14396
14396
|
var HEIC_EXTENSION = "heic";
|
|
14397
|
-
var
|
|
14397
|
+
var MOV_EXTENSION = "mov";
|
|
14398
|
+
var THUMBS_EXTENSION = JPG_EXTENSION;
|
|
14399
|
+
var ENCODED_VIDEO_EXTENSION = "mp4";
|
|
14398
14400
|
var ALLOWED_EXTENSIONS = [
|
|
14399
14401
|
JPEG_EXTENSION,
|
|
14400
14402
|
JPG_EXTENSION,
|
|
14401
14403
|
HEIC_EXTENSION
|
|
14402
14404
|
];
|
|
14405
|
+
var ALLOWED_VIDEO_EXTENSIONS = [MOV_EXTENSION];
|
|
14403
14406
|
var THUMBNAIL_RESOLUTIONS = [
|
|
14404
14407
|
[200, 200],
|
|
14405
14408
|
[1180, 820]
|
|
@@ -14411,14 +14414,25 @@ var getThumbsKey = ({
|
|
|
14411
14414
|
height
|
|
14412
14415
|
}) => {
|
|
14413
14416
|
const ext = getKeyExtension(key);
|
|
14414
|
-
const destinationKey = [JPEG_EXTENSION, JPG_EXTENSION].includes(ext) ? key : `${key.split(".").slice(0, -1).join(".")}.${
|
|
14417
|
+
const destinationKey = [JPEG_EXTENSION, JPG_EXTENSION].includes(ext) ? key : `${key.split(".").slice(0, -1).join(".")}.${THUMBS_EXTENSION}`;
|
|
14415
14418
|
return `${prefix}/${width}x${height}/${destinationKey}`;
|
|
14416
14419
|
};
|
|
14420
|
+
var getEncodedVideoKey = ({
|
|
14421
|
+
key,
|
|
14422
|
+
prefix
|
|
14423
|
+
}) => {
|
|
14424
|
+
const destinationKey = `${key.split(".").slice(0, -1).join(".")}.${ENCODED_VIDEO_EXTENSION}`;
|
|
14425
|
+
return `${prefix}/${destinationKey}`;
|
|
14426
|
+
};
|
|
14417
14427
|
var getKeyExtension = (key) => extname(key).slice(1).toLowerCase();
|
|
14418
14428
|
var isAllowedExtension = (key) => {
|
|
14419
14429
|
const ext = getKeyExtension(key);
|
|
14420
14430
|
return ALLOWED_EXTENSIONS.includes(ext);
|
|
14421
14431
|
};
|
|
14432
|
+
var isAllowedVideoExtension = (key) => {
|
|
14433
|
+
const ext = getKeyExtension(key);
|
|
14434
|
+
return ALLOWED_VIDEO_EXTENSIONS.includes(ext);
|
|
14435
|
+
};
|
|
14422
14436
|
|
|
14423
14437
|
// src/utils/helpers.ts
|
|
14424
14438
|
var getObjectWithAssumeRoleCommandOutputAttribute = (assumeRoleCommandOutput) => assumeRoleCommandOutput ? {
|
|
@@ -14817,22 +14831,26 @@ var getPersistenceStore = () => {
|
|
|
14817
14831
|
};
|
|
14818
14832
|
export {
|
|
14819
14833
|
ALLOWED_EXTENSIONS,
|
|
14820
|
-
|
|
14834
|
+
ALLOWED_VIDEO_EXTENSIONS,
|
|
14821
14835
|
DynamoDBService,
|
|
14836
|
+
ENCODED_VIDEO_EXTENSION,
|
|
14822
14837
|
HEIC_EXTENSION,
|
|
14823
14838
|
JPEG_EXTENSION,
|
|
14824
14839
|
JPG_EXTENSION,
|
|
14825
14840
|
LocationService,
|
|
14826
14841
|
Logger2 as Logger,
|
|
14842
|
+
MOV_EXTENSION,
|
|
14827
14843
|
Metrics2 as Metrics,
|
|
14828
14844
|
S3Service,
|
|
14829
14845
|
SQSService,
|
|
14830
14846
|
SSMService,
|
|
14831
14847
|
STSService,
|
|
14832
14848
|
THUMBNAIL_RESOLUTIONS,
|
|
14849
|
+
THUMBS_EXTENSION,
|
|
14833
14850
|
Tracer2 as Tracer,
|
|
14834
14851
|
assertEnvVar,
|
|
14835
14852
|
assertString,
|
|
14853
|
+
getEncodedVideoKey,
|
|
14836
14854
|
getKeyExtension,
|
|
14837
14855
|
getLoggerWithScope,
|
|
14838
14856
|
getObjectWithAssumeRoleCommandOutputAttribute,
|
|
@@ -14841,6 +14859,7 @@ export {
|
|
|
14841
14859
|
getPersistenceStore,
|
|
14842
14860
|
getThumbsKey,
|
|
14843
14861
|
isAllowedExtension,
|
|
14862
|
+
isAllowedVideoExtension,
|
|
14844
14863
|
normalizeErrorMessage,
|
|
14845
14864
|
plumbingMiddleware,
|
|
14846
14865
|
rootLogger
|