@transloadit/analyze-step
Advanced tools
Comparing version 0.1.1 to 0.1.2
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
}) : function(o, v) { | ||
o["default"] = v; | ||
}); | ||
var __importStar = (this && this.__importStar) || function (mod) { | ||
if (mod && mod.__esModule) return mod; | ||
var result = {}; | ||
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); | ||
__setModuleDefault(result, mod); | ||
return result; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
@@ -8,13 +31,13 @@ return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
const prettier_bytes_1 = __importDefault(require("@transloadit/prettier-bytes")); | ||
const inflect_1 = __importDefault(require("inflect")); | ||
const lodash_1 = __importDefault(require("lodash")); | ||
const jsonpath_1 = __importDefault(require("jsonpath")); | ||
const inflect = __importStar(require("inflection")); | ||
const jsonpath_plus_1 = require("jsonpath-plus"); | ||
const lodash_1 = require("lodash"); | ||
function humanJoin(array, reduce = true, glueword = 'and') { | ||
let countedArray = array; | ||
if (reduce === true) { | ||
const counted = lodash_1.default.countBy(array); | ||
const counted = (0, lodash_1.countBy)(array); | ||
countedArray = []; | ||
for (const [name, count] of Object.entries(counted)) { | ||
if (count > 1) { | ||
countedArray.push(`${count} ${inflect_1.default.pluralize(name)}`); | ||
countedArray.push(`${count} ${inflect.pluralize(name)}`); | ||
} | ||
@@ -65,3 +88,3 @@ else { | ||
for (const [key, operator, val] of Object.values(step[type])) { | ||
const template = lodash_1.default.clone(templates[operator]); | ||
const template = (0, lodash_1.clone)(templates[operator]); | ||
if (!template) { | ||
@@ -94,3 +117,3 @@ throw new Error(`Please add a template definition for this /file/filter operator: ${operator}`); | ||
if (humanKey === `${humanKey}` && | ||
inflect_1.default.singularize(humanKey) === `${humanKey}` && | ||
inflect.singularize(humanKey) === `${humanKey}` && | ||
!`${humanKey}`.match(/^\d+/) && | ||
@@ -101,3 +124,3 @@ humanKey !== '') { | ||
if (humanVal === `${humanVal}` && | ||
inflect_1.default.singularize(humanVal) === `${humanVal}` && | ||
inflect.singularize(humanVal) === `${humanVal}` && | ||
!`${humanVal}`.match(/^\d+/) && | ||
@@ -182,3 +205,3 @@ humanVal !== '') { | ||
function humanPreset(step, extrameta = {}) { | ||
let str = inflect_1.default.humanize(step.preset.replace(/[-_]/g, ' ')); | ||
let str = inflect.humanize(step.preset.replace(/[-_]/g, ' ')); | ||
if (str.match(/^ipad/i)) { | ||
@@ -219,3 +242,3 @@ let quality = str.split(' ')[1]; | ||
function humanFormat(step) { | ||
let str = inflect_1.default.humanize(step.format.replace(/[-_]/g, ' ')); | ||
let str = inflect.humanize(step.format.replace(/[-_]/g, ' ')); | ||
if (str.match(/^webp/i)) { | ||
@@ -237,19 +260,19 @@ str = 'WebP'; | ||
} | ||
else if (lodash_1.default.get(step, 'ffmpeg.t') && lodash_1.default.get(step, 'ffmpeg.ss')) { | ||
str = `Take a ${lodash_1.default.get(step, 'ffmpeg.t')}s clip out of videos at an offset`; | ||
else if ((0, lodash_1.get)(step, 'ffmpeg.t') && (0, lodash_1.get)(step, 'ffmpeg.ss')) { | ||
str = `Take a ${(0, lodash_1.get)(step, 'ffmpeg.t')}s clip out of videos at an offset`; | ||
} | ||
else if (lodash_1.default.get(step, 'ffmpeg.t')) { | ||
str = `Take a ${lodash_1.default.get(step, 'ffmpeg.t')}s clip out of videos at the beginning`; | ||
else if ((0, lodash_1.get)(step, 'ffmpeg.t')) { | ||
str = `Take a ${(0, lodash_1.get)(step, 'ffmpeg.t')}s clip out of videos at the beginning`; | ||
} | ||
else if (lodash_1.default.get(step, 'ffmpeg.ss')) { | ||
str = `Take a clip out of videos from ${lodash_1.default.get(step, 'ffmpeg.ss')}s till the end`; | ||
else if ((0, lodash_1.get)(step, 'ffmpeg.ss')) { | ||
str = `Take a clip out of videos from ${(0, lodash_1.get)(step, 'ffmpeg.ss')}s till the end`; | ||
} | ||
else if (lodash_1.default.has(step, 'filter:v') && step.ffmpeg['filter:v'] === 'setpts=2.0*PTS') { | ||
else if ((0, lodash_1.has)(step, 'filter:v') && step.ffmpeg['filter:v'] === 'setpts=2.0*PTS') { | ||
str = `Slowdown video to half speed`; | ||
} | ||
else if (lodash_1.default.has(step, 'ffmpeg.filter_complex') && | ||
else if ((0, lodash_1.has)(step, 'ffmpeg.filter_complex') && | ||
step.ffmpeg.filter_complex.includes('setpts=')) { | ||
str = `Change video speed`; | ||
} | ||
else if (lodash_1.default.has(step, 'ffmpeg.filter_complex') && | ||
else if ((0, lodash_1.has)(step, 'ffmpeg.filter_complex') && | ||
step.ffmpeg.filter_complex.includes('atempo=')) { | ||
@@ -278,3 +301,3 @@ str = `Change audio speed`; | ||
} | ||
if (lodash_1.default.get(step, 'ffmpeg.an') === true) { | ||
if ((0, lodash_1.get)(step, 'ffmpeg.an') === true) { | ||
str += ' and strip the sound'; | ||
@@ -284,10 +307,10 @@ } | ||
if (robot.rname === '/audio/encode') { | ||
if (lodash_1.default.has(step, 'ffmpeg.ss') && lodash_1.default.has(step, 'ffmpeg.t')) { | ||
str = `Take a ${lodash_1.default.get(step, 'ffmpeg.t')}s clip out of audio at a specified offset`; | ||
if ((0, lodash_1.has)(step, 'ffmpeg.ss') && (0, lodash_1.has)(step, 'ffmpeg.t')) { | ||
str = `Take a ${(0, lodash_1.get)(step, 'ffmpeg.t')}s clip out of audio at a specified offset`; | ||
} | ||
else if (lodash_1.default.has(step, 'ffmpeg.filter_complex') && | ||
else if ((0, lodash_1.has)(step, 'ffmpeg.filter_complex') && | ||
step.ffmpeg.filter_complex.includes('setpts=')) { | ||
str = `Change video speed`; | ||
} | ||
else if (lodash_1.default.has(step, 'ffmpeg.filter_complex') && | ||
else if ((0, lodash_1.has)(step, 'ffmpeg.filter_complex') && | ||
step.ffmpeg.filter_complex.includes('atempo=')) { | ||
@@ -302,3 +325,3 @@ str = `Change audio speed`; | ||
} | ||
if (lodash_1.default.get(step, 'ffmpeg.an') === true) { | ||
if ((0, lodash_1.get)(step, 'ffmpeg.an') === true) { | ||
str += ' and strip the sound'; | ||
@@ -316,7 +339,7 @@ } | ||
if (robot.rname === '/video/merge') { | ||
const types = jsonpath_1.default.query(step, '$..as'); | ||
const types = (0, jsonpath_plus_1.JSONPath)({ path: '$..as', json: step }); | ||
if (types.length) { | ||
str = `Merge ${humanJoin(types)} to create a new video`; | ||
} | ||
else if (lodash_1.default.get(step, 'ffmpeg.f') === 'gif') { | ||
else if ((0, lodash_1.get)(step, 'ffmpeg.f') === 'gif') { | ||
str = `Create animated GIFs from a series of still images`; | ||
@@ -329,3 +352,3 @@ } | ||
if (robot.rname === '/audio/artwork') { | ||
if (lodash_1.default.get(step, 'method') === 'insert') { | ||
if ((0, lodash_1.get)(step, 'method') === 'insert') { | ||
str = `Insert audio artwork`; | ||
@@ -332,0 +355,0 @@ } |
{ | ||
"name": "@transloadit/analyze-step", | ||
"license": "AGPL-3.0-only", | ||
"private": false, | ||
"publishConfig": { | ||
@@ -27,14 +26,15 @@ "access": "public" | ||
"dependencies": { | ||
"@transloadit/format-duration-ms": "^0.1.1", | ||
"@transloadit/prettier-bytes": "^0.1.1", | ||
"inflect": "0.4.0", | ||
"@transloadit/format-duration-ms": "^0.1.2", | ||
"@transloadit/prettier-bytes": "^0.1.2", | ||
"inflection": "^3.0.0", | ||
"jsonpath": "1.0.2", | ||
"lodash": "4.17.21" | ||
"jsonpath-plus": "^7.2.0", | ||
"lodash": "^4.17.21" | ||
}, | ||
"version": "0.1.1", | ||
"gitHead": "54c791274188e87e7d4a1e8e1bbf5fcc78cb33ef", | ||
"version": "0.1.2", | ||
"gitHead": "5c487499031f01adcc6869b3a0b7a4ac3d7d21c0", | ||
"devDependencies": { | ||
"@types/jsonpath": "^0.2.0", | ||
"@types/lodash": "^4.14.182" | ||
"@types/lodash": "^4" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
76900
558
6
+ Addedinflection@^3.0.0
+ Addedjsonpath-plus@^7.2.0
+ Addedinflection@3.0.0(transitive)
+ Addedjsonpath-plus@7.2.0(transitive)
- Removedinflect@0.4.0
- Removedinflect@0.4.0(transitive)
Updatedlodash@^4.17.21