Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@transloadit/analyze-step

Package Overview
Dependencies
Maintainers
6
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@transloadit/analyze-step - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

4

dist/analyzeStep.d.ts

@@ -35,3 +35,3 @@ type Condition = [value: string, operator: string, value: string];

};
export default function humanize(step: Step, robots: Robots, extrameta?: ExtraMeta): string;
export {};
declare function humanize(step: Step, robots: Robots, extrameta?: ExtraMeta): string;
export = humanize;
"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) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const format_duration_ms_1 = __importDefault(require("@transloadit/format-duration-ms"));
const prettier_bytes_1 = __importDefault(require("@transloadit/prettier-bytes"));
const inflect = __importStar(require("inflection"));
const jsonpath_plus_1 = require("jsonpath-plus");
const lodash_1 = require("lodash");
const formatDurationMs = require("@transloadit/format-duration-ms");
const prettierBytes = require("@transloadit/prettier-bytes");
const inflect = require("inflection");
const JSONPath = require("jsonpath-plus");
const clone = require("lodash/clone");
const countBy = require("lodash/countBy");
const get = require("lodash/get");
const has = require("lodash/has");
function humanJoin(array, reduce = true, glueword = 'and') {
let countedArray = array;
if (reduce === true) {
const counted = (0, lodash_1.countBy)(array);
const counted = countBy(array);
countedArray = [];

@@ -87,3 +63,3 @@ for (const [name, count] of Object.entries(counted)) {

for (const [key, operator, val] of Object.values(step[type])) {
const template = (0, lodash_1.clone)(templates[operator]);
const template = clone(templates[operator]);
if (!template) {

@@ -103,9 +79,9 @@ throw new Error(`Please add a template definition for this /file/filter operator: ${operator}`);

if (humanKey === 'filesize') {
humanVal = (0, prettier_bytes_1.default)(parseInt(humanVal, 10));
humanVal = prettierBytes(parseInt(humanVal, 10));
}
if (humanKey.match(/ bitrate$/) && humanVal) {
humanVal = `${(0, prettier_bytes_1.default)(parseInt(humanVal, 10))}`.replace('B', 'bit/s');
humanVal = `${prettierBytes(parseInt(humanVal, 10))}`.replace('B', 'bit/s');
}
if (humanKey === 'duration') {
humanVal = (0, format_duration_ms_1.default)(parseInt(humanVal, 10) * 1000);
humanVal = formatDurationMs(parseInt(humanVal, 10) * 1000);
}

@@ -260,19 +236,19 @@ if (humanVal ===

}
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 (get(step, 'ffmpeg.t') && get(step, 'ffmpeg.ss')) {
str = `Take a ${get(step, 'ffmpeg.t')}s clip out of videos at an offset`;
}
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 (get(step, 'ffmpeg.t')) {
str = `Take a ${get(step, 'ffmpeg.t')}s clip out of videos at the beginning`;
}
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 (get(step, 'ffmpeg.ss')) {
str = `Take a clip out of videos from ${get(step, 'ffmpeg.ss')}s till the end`;
}
else if ((0, lodash_1.has)(step, 'filter:v') && step.ffmpeg['filter:v'] === 'setpts=2.0*PTS') {
else if (has(step, 'filter:v') && step.ffmpeg['filter:v'] === 'setpts=2.0*PTS') {
str = `Slowdown video to half speed`;
}
else if ((0, lodash_1.has)(step, 'ffmpeg.filter_complex') &&
else if (has(step, 'ffmpeg.filter_complex') &&
step.ffmpeg.filter_complex.includes('setpts=')) {
str = `Change video speed`;
}
else if ((0, lodash_1.has)(step, 'ffmpeg.filter_complex') &&
else if (has(step, 'ffmpeg.filter_complex') &&
step.ffmpeg.filter_complex.includes('atempo=')) {

@@ -301,3 +277,3 @@ str = `Change audio speed`;

}
if ((0, lodash_1.get)(step, 'ffmpeg.an') === true) {
if (get(step, 'ffmpeg.an') === true) {
str += ' and strip the sound';

@@ -307,10 +283,10 @@ }

if (robot?.rname === '/audio/encode') {
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`;
if (has(step, 'ffmpeg.ss') && has(step, 'ffmpeg.t')) {
str = `Take a ${get(step, 'ffmpeg.t')}s clip out of audio at a specified offset`;
}
else if ((0, lodash_1.has)(step, 'ffmpeg.filter_complex') &&
else if (has(step, 'ffmpeg.filter_complex') &&
step.ffmpeg.filter_complex.includes('setpts=')) {
str = `Change video speed`;
}
else if ((0, lodash_1.has)(step, 'ffmpeg.filter_complex') &&
else if (has(step, 'ffmpeg.filter_complex') &&
step.ffmpeg.filter_complex.includes('atempo=')) {

@@ -325,3 +301,3 @@ str = `Change audio speed`;

}
if ((0, lodash_1.get)(step, 'ffmpeg.an') === true) {
if (get(step, 'ffmpeg.an') === true) {
str += ' and strip the sound';

@@ -339,7 +315,7 @@ }

if (robot?.rname === '/video/merge') {
const types = (0, jsonpath_plus_1.JSONPath)({ path: '$..as', json: step });
const types = JSONPath.JSONPath({ path: '$..as', json: step });
if (types.length) {
str = `Merge ${humanJoin(types)} to create a new video`;
}
else if ((0, lodash_1.get)(step, 'ffmpeg.f') === 'gif') {
else if (get(step, 'ffmpeg.f') === 'gif') {
str = `Create animated GIFs from a series of still images`;

@@ -352,3 +328,3 @@ }

if (robot?.rname === '/audio/artwork') {
if ((0, lodash_1.get)(step, 'method') === 'insert') {
if (get(step, 'method') === 'insert') {
str = `Insert audio artwork`;

@@ -385,3 +361,3 @@ }

}
exports.default = humanize;
module.exports = humanize;
//# sourceMappingURL=analyzeStep.js.map

@@ -26,4 +26,4 @@ {

"dependencies": {
"@transloadit/format-duration-ms": "^0.2.0",
"@transloadit/prettier-bytes": "^0.2.0",
"@transloadit/format-duration-ms": "^0.3.0",
"@transloadit/prettier-bytes": "^0.3.0",
"inflection": "^3.0.0",

@@ -33,4 +33,4 @@ "jsonpath-plus": "^7.2.0",

},
"version": "0.2.0",
"gitHead": "3fbbb8c4c18eeb9b9de5e3a5c022d46a7cc40800",
"version": "0.3.0",
"gitHead": "df8101d46064782dd743550aac74ab6afdb6b82c",
"devDependencies": {

@@ -37,0 +37,0 @@ "@types/jsonpath": "^0.2.4",

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc