@remotion/lambda-client 4.0.470 → 4.0.472

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/cjs/index.js CHANGED
@@ -69857,6 +69857,123 @@ var import_client_sts = __toESM(require_dist_cjs81(), 1);
69857
69857
 
69858
69858
  // ../serverless-client/dist/esm/index.mjs
69859
69859
  var tty = __toESM(require("tty"));
69860
+ var normalizeNumber = (value) => {
69861
+ return Math.round(value * 1e6) / 1e6;
69862
+ };
69863
+ var angleUnits = new Set(["deg", "rad", "grad", "turn"]);
69864
+ var lengthUnits = new Set([
69865
+ "%",
69866
+ "cap",
69867
+ "ch",
69868
+ "cm",
69869
+ "cqb",
69870
+ "cqh",
69871
+ "cqi",
69872
+ "cqmax",
69873
+ "cqmin",
69874
+ "cqw",
69875
+ "dvh",
69876
+ "dvw",
69877
+ "em",
69878
+ "ex",
69879
+ "ic",
69880
+ "in",
69881
+ "lh",
69882
+ "lvh",
69883
+ "lvw",
69884
+ "mm",
69885
+ "pc",
69886
+ "pt",
69887
+ "px",
69888
+ "q",
69889
+ "rem",
69890
+ "rlh",
69891
+ "svh",
69892
+ "svw",
69893
+ "vb",
69894
+ "vh",
69895
+ "vi",
69896
+ "vmax",
69897
+ "vmin",
69898
+ "vw"
69899
+ ]);
69900
+ var cssNumberRegex = /^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/;
69901
+ var stringifyNumber = (value) => {
69902
+ return String(normalizeNumber(value));
69903
+ };
69904
+ var parseStringInterpolationComponent = (component, value) => {
69905
+ const match = cssNumberRegex.exec(component);
69906
+ if (match === null) {
69907
+ throw new TypeError(`Cannot interpolate "${value}" because "${component}" is not a supported scale, translate, or rotate value`);
69908
+ }
69909
+ const unit = match[2] ?? null;
69910
+ const numberValue = Number(match[1]);
69911
+ if (!Number.isFinite(numberValue)) {
69912
+ throw new TypeError(`Cannot interpolate "${value}" because "${component}" is not finite`);
69913
+ }
69914
+ if (unit === null) {
69915
+ return { kind: "scale", value: numberValue, unit: null };
69916
+ }
69917
+ if (angleUnits.has(unit)) {
69918
+ return { kind: "rotate", value: numberValue, unit };
69919
+ }
69920
+ if (lengthUnits.has(unit)) {
69921
+ return { kind: "translate", value: numberValue, unit };
69922
+ }
69923
+ throw new TypeError(`Cannot interpolate "${value}" because "${unit}" is not a supported translate or rotate unit`);
69924
+ };
69925
+ var parseStringInterpolationValue = (output) => {
69926
+ if (typeof output === "number") {
69927
+ if (!Number.isFinite(output)) {
69928
+ throw new Error(`outputRange must contain only finite numbers, but got [${output}]`);
69929
+ }
69930
+ return {
69931
+ kind: "scale",
69932
+ values: [output, output, 1],
69933
+ units: [null, null, null],
69934
+ dimensions: 1
69935
+ };
69936
+ }
69937
+ const parts = output.trim().split(/\s+/);
69938
+ if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
69939
+ throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${output}"`);
69940
+ }
69941
+ const parsed = parts.map((part) => parseStringInterpolationComponent(part, output));
69942
+ const [{ kind }] = parsed;
69943
+ for (const part of parsed) {
69944
+ if (part.kind !== kind) {
69945
+ throw new TypeError(`Cannot interpolate "${output}" because it mixes ${kind} and ${part.kind} values`);
69946
+ }
69947
+ }
69948
+ if (kind === "scale") {
69949
+ const x = parsed[0].value;
69950
+ const y = parsed[1]?.value ?? x;
69951
+ const z = parsed[2]?.value ?? 1;
69952
+ return {
69953
+ kind,
69954
+ values: [x, y, z],
69955
+ units: [null, null, null],
69956
+ dimensions: parsed.length
69957
+ };
69958
+ }
69959
+ return {
69960
+ kind,
69961
+ values: [parsed[0].value, parsed[1]?.value ?? 0, parsed[2]?.value ?? 0],
69962
+ units: [parsed[0].unit, parsed[1]?.unit ?? null, parsed[2]?.unit ?? null],
69963
+ dimensions: parsed.length
69964
+ };
69965
+ };
69966
+ var serializeStringInterpolationValue = ({
69967
+ kind,
69968
+ values,
69969
+ units,
69970
+ dimensions
69971
+ }) => {
69972
+ if (kind === "scale") {
69973
+ return values.slice(0, dimensions).map((value) => stringifyNumber(value)).join(" ");
69974
+ }
69975
+ return values.slice(0, dimensions).map((value, index) => `${stringifyNumber(value)}${units[index]}`).join(" ");
69976
+ };
69860
69977
  function interpolateFunction(input, inputRange, outputRange, options) {
69861
69978
  const { extrapolateLeft, extrapolateRight, easing } = options;
69862
69979
  let result = input;
@@ -69901,6 +70018,96 @@ function findRange(input, inputRange) {
69901
70018
  }
69902
70019
  return i - 1;
69903
70020
  }
70021
+ var defaultEasing = (num) => num;
70022
+ var interpolateNumber = ({
70023
+ input,
70024
+ inputRange,
70025
+ outputRange,
70026
+ options
70027
+ }) => {
70028
+ if (inputRange.length === 1) {
70029
+ return outputRange[0];
70030
+ }
70031
+ const easingOption = options?.easing;
70032
+ const resolveEasingForSegment = (segmentIndex) => {
70033
+ if (easingOption === undefined) {
70034
+ return defaultEasing;
70035
+ }
70036
+ if (typeof easingOption === "function") {
70037
+ return easingOption;
70038
+ }
70039
+ return easingOption[segmentIndex];
70040
+ };
70041
+ let extrapolateLeft = "extend";
70042
+ if (options?.extrapolateLeft !== undefined) {
70043
+ extrapolateLeft = options.extrapolateLeft;
70044
+ }
70045
+ let extrapolateRight = "extend";
70046
+ if (options?.extrapolateRight !== undefined) {
70047
+ extrapolateRight = options.extrapolateRight;
70048
+ }
70049
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
70050
+ const range = findRange(posterizedInput, inputRange);
70051
+ return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
70052
+ easing: resolveEasingForSegment(range),
70053
+ extrapolateLeft,
70054
+ extrapolateRight
70055
+ });
70056
+ };
70057
+ var interpolateString = ({
70058
+ input,
70059
+ inputRange,
70060
+ outputRange,
70061
+ options
70062
+ }) => {
70063
+ const parsedOutputRange = outputRange.map(parseStringInterpolationValue);
70064
+ const kind = parsedOutputRange[0]?.kind;
70065
+ if (kind === undefined) {
70066
+ throw new Error("outputRange must have at least 1 element");
70067
+ }
70068
+ for (const parsed of parsedOutputRange) {
70069
+ if (parsed.kind !== kind) {
70070
+ throw new TypeError(`Cannot interpolate ${kind} values with ${parsed.kind} values`);
70071
+ }
70072
+ }
70073
+ const dimensions = Math.max(...parsedOutputRange.map((parsed) => parsed.dimensions));
70074
+ const units = [
70075
+ null,
70076
+ null,
70077
+ null
70078
+ ];
70079
+ if (kind !== "scale") {
70080
+ for (let axis = 0;axis < dimensions; axis++) {
70081
+ for (const parsed of parsedOutputRange) {
70082
+ const unit = parsed.units[axis];
70083
+ if (unit === null) {
70084
+ continue;
70085
+ }
70086
+ if (units[axis] === null) {
70087
+ units[axis] = unit;
70088
+ continue;
70089
+ }
70090
+ if (units[axis] !== unit) {
70091
+ throw new TypeError(`Cannot interpolate ${kind} values with different units on axis ${axis + 1}: ${units[axis]} and ${unit}`);
70092
+ }
70093
+ }
70094
+ if (units[axis] === null) {
70095
+ throw new TypeError(`Cannot interpolate ${kind} values because axis ${axis + 1} has no unit`);
70096
+ }
70097
+ }
70098
+ }
70099
+ return serializeStringInterpolationValue({
70100
+ kind,
70101
+ values: [0, 0, 0].map((_, axis) => interpolateNumber({
70102
+ input,
70103
+ inputRange,
70104
+ outputRange: parsedOutputRange.map((parsed) => parsed.values[axis]),
70105
+ options
70106
+ })),
70107
+ units,
70108
+ dimensions
70109
+ });
70110
+ };
69904
70111
  function checkValidInputRange(arr) {
69905
70112
  for (let i = 1;i < arr.length; ++i) {
69906
70113
  if (!(arr[i] > arr[i - 1])) {
@@ -69960,42 +70167,27 @@ function interpolate(input, inputRange, outputRange, options) {
69960
70167
  throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
69961
70168
  }
69962
70169
  checkInfiniteRange("inputRange", inputRange);
69963
- checkInfiniteRange("outputRange", outputRange);
69964
70170
  checkValidInputRange(inputRange);
69965
70171
  assertValidInterpolateEasingOption(options?.easing, inputRange.length);
69966
70172
  assertValidInterpolatePosterizeOption(options?.posterize);
69967
- const easingOption = options?.easing;
69968
- const defaultEasing = (num) => num;
69969
- const resolveEasingForSegment = (segmentIndex) => {
69970
- if (easingOption === undefined) {
69971
- return defaultEasing;
69972
- }
69973
- if (typeof easingOption === "function") {
69974
- return easingOption;
69975
- }
69976
- return easingOption[segmentIndex];
69977
- };
69978
- let extrapolateLeft = "extend";
69979
- if (options?.extrapolateLeft !== undefined) {
69980
- extrapolateLeft = options.extrapolateLeft;
69981
- }
69982
- let extrapolateRight = "extend";
69983
- if (options?.extrapolateRight !== undefined) {
69984
- extrapolateRight = options.extrapolateRight;
69985
- }
69986
70173
  if (typeof input !== "number") {
69987
70174
  throw new TypeError("Cannot interpolate an input which is not a number");
69988
70175
  }
69989
- if (inputRange.length === 1) {
69990
- return outputRange[0];
70176
+ if (!Array.isArray(outputRange)) {
70177
+ throw new Error("outputRange must contain only numbers");
69991
70178
  }
69992
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
69993
- const range = findRange(posterizedInput, inputRange);
69994
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
69995
- easing: resolveEasingForSegment(range),
69996
- extrapolateLeft,
69997
- extrapolateRight
69998
- });
70179
+ const hasStringOutput = outputRange.some((output) => typeof output === "string");
70180
+ if (hasStringOutput) {
70181
+ if (!outputRange.every((output) => typeof output === "string" || typeof output === "number")) {
70182
+ throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
70183
+ }
70184
+ return interpolateString({ input, inputRange, outputRange, options });
70185
+ }
70186
+ if (!outputRange.every((output) => typeof output === "number")) {
70187
+ throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
70188
+ }
70189
+ checkInfiniteRange("outputRange", outputRange);
70190
+ return interpolateNumber({ input, inputRange, outputRange, options });
69999
70191
  }
70000
70192
  function mulberry32(a) {
70001
70193
  let t = a + 1831565813;
@@ -70578,6 +70770,45 @@ var proResProfileOptions = [
70578
70770
  "light",
70579
70771
  "proxy"
70580
70772
  ];
70773
+ var defaultScaleValue = [1, 1, 1];
70774
+ var parseScaleString = (value) => {
70775
+ const parts = value.trim().split(/\s+/);
70776
+ if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
70777
+ return null;
70778
+ }
70779
+ const parsed = parts.map((part) => Number(part));
70780
+ if (!parsed.every((part) => Number.isFinite(part))) {
70781
+ return null;
70782
+ }
70783
+ const x = parsed[0];
70784
+ const y = parsed[1] ?? x;
70785
+ const z = parsed[2] ?? 1;
70786
+ return [x, y, z];
70787
+ };
70788
+ var parseValidScaleValue = (value) => {
70789
+ if (typeof value === "number") {
70790
+ return Number.isFinite(value) ? [value, value, 1] : null;
70791
+ }
70792
+ if (typeof value === "string") {
70793
+ return parseScaleString(value);
70794
+ }
70795
+ return null;
70796
+ };
70797
+ var parseScaleValue = (value) => {
70798
+ return parseValidScaleValue(value) ?? defaultScaleValue;
70799
+ };
70800
+ var serializeScaleValue = ([x, y, z]) => {
70801
+ const normalizedX = normalizeNumber(x);
70802
+ const normalizedY = normalizeNumber(y);
70803
+ const normalizedZ = normalizeNumber(z);
70804
+ if (normalizedX === normalizedY && normalizedZ === 1) {
70805
+ return normalizedX;
70806
+ }
70807
+ if (normalizedZ === 1) {
70808
+ return `${normalizedX} ${normalizedY}`;
70809
+ }
70810
+ return `${normalizedX} ${normalizedY} ${normalizedZ}`;
70811
+ };
70581
70812
  var sequenceVisualStyleSchema = {
70582
70813
  "style.translate": {
70583
70814
  type: "translate",
@@ -70586,7 +70817,7 @@ var sequenceVisualStyleSchema = {
70586
70817
  description: "Offset"
70587
70818
  },
70588
70819
  "style.scale": {
70589
- type: "number",
70820
+ type: "scale",
70590
70821
  min: 0.05,
70591
70822
  max: 100,
70592
70823
  step: 0.01,
@@ -70594,7 +70825,7 @@ var sequenceVisualStyleSchema = {
70594
70825
  description: "Scale"
70595
70826
  },
70596
70827
  "style.rotate": {
70597
- type: "rotation",
70828
+ type: "rotation-css",
70598
70829
  step: 1,
70599
70830
  default: "0deg",
70600
70831
  description: "Rotation"
@@ -70605,7 +70836,8 @@ var sequenceVisualStyleSchema = {
70605
70836
  max: 1,
70606
70837
  step: 0.01,
70607
70838
  default: 1,
70608
- description: "Opacity"
70839
+ description: "Opacity",
70840
+ hiddenFromList: false
70609
70841
  }
70610
70842
  };
70611
70843
  var sequencePremountSchema = {
@@ -70614,10 +70846,15 @@ var sequencePremountSchema = {
70614
70846
  default: 0,
70615
70847
  description: "Premount For",
70616
70848
  min: 0,
70617
- step: 1
70849
+ step: 1,
70850
+ hiddenFromList: false
70618
70851
  },
70619
70852
  postmountFor: {
70620
- type: "hidden"
70853
+ type: "number",
70854
+ default: 0,
70855
+ min: 0,
70856
+ step: 1,
70857
+ hiddenFromList: true
70621
70858
  },
70622
70859
  styleWhilePremounted: {
70623
70860
  type: "hidden"
@@ -70635,8 +70872,23 @@ var hiddenField = {
70635
70872
  default: false,
70636
70873
  description: "Hidden"
70637
70874
  };
70875
+ var durationInFramesField = {
70876
+ type: "number",
70877
+ default: undefined,
70878
+ min: 1,
70879
+ step: 1,
70880
+ hiddenFromList: true
70881
+ };
70882
+ var fromField = {
70883
+ type: "number",
70884
+ default: 0,
70885
+ step: 1,
70886
+ hiddenFromList: true
70887
+ };
70638
70888
  var sequenceSchema = {
70639
70889
  hidden: hiddenField,
70890
+ from: fromField,
70891
+ durationInFrames: durationInFramesField,
70640
70892
  layout: {
70641
70893
  type: "enum",
70642
70894
  default: "absolute-fill",
@@ -70818,7 +71070,9 @@ var NoReactInternals = {
70818
71070
  validateCodec,
70819
71071
  proResProfileOptions,
70820
71072
  findPropsToDelete,
70821
- sequenceSchema
71073
+ sequenceSchema,
71074
+ parseScaleValue,
71075
+ serializeScaleValue
70822
71076
  };
70823
71077
  var COMMAND_NOT_FOUND = "Command not found";
70824
71078
  var expiryDays = {
@@ -70884,7 +71138,7 @@ var validateDownloadBehavior = (downloadBehavior) => {
70884
71138
  }
70885
71139
  }
70886
71140
  };
70887
- var VERSION = "4.0.470";
71141
+ var VERSION = "4.0.472";
70888
71142
  var isColorSupported = () => {
70889
71143
  const env = process.env || {};
70890
71144
  const isForceDisabled = "NO_COLOR" in env;
@@ -72244,6 +72498,50 @@ var getExpectedOutName = ({
72244
72498
  }
72245
72499
  throw new TypeError("no type passed");
72246
72500
  };
72501
+ var findOutputFileInBucket = async ({
72502
+ region,
72503
+ renderMetadata,
72504
+ bucketName,
72505
+ customCredentials,
72506
+ currentRegion,
72507
+ providerSpecifics,
72508
+ forcePathStyle,
72509
+ requestHandler
72510
+ }) => {
72511
+ const { renderBucketName, key } = getExpectedOutName({
72512
+ renderMetadata,
72513
+ bucketName,
72514
+ customCredentials,
72515
+ bucketNamePrefix: providerSpecifics.getBucketPrefix()
72516
+ });
72517
+ try {
72518
+ const metadata = await providerSpecifics.headFile({
72519
+ bucketName: renderBucketName,
72520
+ key,
72521
+ region,
72522
+ customCredentials,
72523
+ forcePathStyle,
72524
+ requestHandler
72525
+ });
72526
+ return {
72527
+ url: providerSpecifics.getOutputUrl({
72528
+ renderMetadata,
72529
+ bucketName,
72530
+ customCredentials,
72531
+ currentRegion
72532
+ }).url,
72533
+ sizeInBytes: metadata.ContentLength ?? null
72534
+ };
72535
+ } catch (err) {
72536
+ if (err.name === "NotFound") {
72537
+ return null;
72538
+ }
72539
+ if (err.message === "UnknownError" || err.$metadata?.httpStatusCode === 403) {
72540
+ throw new Error(`Unable to access item "${key}" from bucket "${renderBucketName}" ${customCredentials?.endpoint ? `(S3 Endpoint = ${customCredentials?.endpoint})` : ""} - got a 403 error when heading the file. Check your credentials and permissions. The Lambda role must have permission for both "s3:GetObject" and "s3:ListBucket" actions.`, { cause: err });
72541
+ }
72542
+ throw err;
72543
+ }
72544
+ };
72247
72545
  var display = (accrued) => {
72248
72546
  if (accrued < 0.001) {
72249
72547
  return "<$0.001";
@@ -72649,6 +72947,76 @@ var getProgress = async ({
72649
72947
  });
72650
72948
  const isBeyondTimeoutAndMissingChunks = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000 && missingChunks && missingChunks.length > 0;
72651
72949
  const isBeyondTimeoutAndHasStitchTimeout = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds * 2 + 20000;
72950
+ const shouldCheckForCompletedOutput = allChunks && (isBeyondTimeoutAndHasStitchTimeout || overallProgress.combinedFrames >= frameCount && overallProgress.timeToCombine !== null);
72951
+ if (shouldCheckForCompletedOutput) {
72952
+ const outputFile = await findOutputFileInBucket({
72953
+ bucketName,
72954
+ customCredentials,
72955
+ renderMetadata,
72956
+ region,
72957
+ currentRegion: region,
72958
+ providerSpecifics,
72959
+ forcePathStyle,
72960
+ requestHandler
72961
+ });
72962
+ if (outputFile) {
72963
+ const outData = getExpectedOutName({
72964
+ renderMetadata,
72965
+ bucketName,
72966
+ customCredentials,
72967
+ bucketNamePrefix: providerSpecifics.getBucketPrefix()
72968
+ });
72969
+ const now = Date.now();
72970
+ const timeToFinishChunks = calculateChunkTimes({
72971
+ type: "absolute-time",
72972
+ timings: overallProgress.timings
72973
+ });
72974
+ return {
72975
+ framesRendered: frameCount,
72976
+ bucket: bucketName,
72977
+ renderSize: outputFile.sizeInBytes ?? 0,
72978
+ chunks: renderMetadata.totalChunks,
72979
+ cleanup: {
72980
+ doneIn: null,
72981
+ filesDeleted: 0,
72982
+ minFilesToDelete: 0
72983
+ },
72984
+ costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar) : formatCostsInfo(0),
72985
+ currentTime: now,
72986
+ done: true,
72987
+ encodingStatus: {
72988
+ framesEncoded: frameCount,
72989
+ combinedFrames: frameCount,
72990
+ timeToCombine: overallProgress.timeToCombine
72991
+ },
72992
+ errors: errorExplanations,
72993
+ fatalErrorEncountered: false,
72994
+ lambdasInvoked: renderMetadata.totalChunks,
72995
+ outputFile: outputFile.url,
72996
+ renderId,
72997
+ timeToFinish: now - renderMetadata.startedDate,
72998
+ timeToFinishChunks,
72999
+ timeToRenderFrames: overallProgress.timeToRenderFrames,
73000
+ overallProgress: 1,
73001
+ retriesInfo: overallProgress.retries ?? [],
73002
+ outKey: outData.key,
73003
+ outBucket: outData.renderBucketName,
73004
+ mostExpensiveFrameRanges: null,
73005
+ timeToEncode: overallProgress.timeToEncode,
73006
+ outputSizeInBytes: outputFile.sizeInBytes ?? 0,
73007
+ type: "success",
73008
+ estimatedBillingDurationInMilliseconds: priceFromBucket?.estimatedBillingDurationInMilliseconds ?? null,
73009
+ timeToCombine: overallProgress.timeToCombine,
73010
+ combinedFrames: frameCount,
73011
+ renderMetadata,
73012
+ timeoutTimestamp: overallProgress.timeoutTimestamp,
73013
+ compositionValidated: overallProgress.compositionValidated,
73014
+ functionLaunched: overallProgress.functionLaunched,
73015
+ serveUrlOpened: overallProgress.serveUrlOpened,
73016
+ artifacts: overallProgress.receivedArtifact
73017
+ };
73018
+ }
73019
+ }
72652
73020
  const allErrors = [
72653
73021
  isBeyondTimeoutAndMissingChunks || isBeyondTimeoutAndHasStitchTimeout ? makeTimeoutError({
72654
73022
  timeoutInMilliseconds,
@@ -69200,6 +69200,123 @@ var import_client_sts = __toESM(require_dist_cjs81(), 1);
69200
69200
 
69201
69201
  // ../serverless-client/dist/esm/index.mjs
69202
69202
  import * as tty from "tty";
69203
+ var normalizeNumber = (value) => {
69204
+ return Math.round(value * 1e6) / 1e6;
69205
+ };
69206
+ var angleUnits = new Set(["deg", "rad", "grad", "turn"]);
69207
+ var lengthUnits = new Set([
69208
+ "%",
69209
+ "cap",
69210
+ "ch",
69211
+ "cm",
69212
+ "cqb",
69213
+ "cqh",
69214
+ "cqi",
69215
+ "cqmax",
69216
+ "cqmin",
69217
+ "cqw",
69218
+ "dvh",
69219
+ "dvw",
69220
+ "em",
69221
+ "ex",
69222
+ "ic",
69223
+ "in",
69224
+ "lh",
69225
+ "lvh",
69226
+ "lvw",
69227
+ "mm",
69228
+ "pc",
69229
+ "pt",
69230
+ "px",
69231
+ "q",
69232
+ "rem",
69233
+ "rlh",
69234
+ "svh",
69235
+ "svw",
69236
+ "vb",
69237
+ "vh",
69238
+ "vi",
69239
+ "vmax",
69240
+ "vmin",
69241
+ "vw"
69242
+ ]);
69243
+ var cssNumberRegex = /^([+-]?(?:\d+\.?\d*|\.\d+))([a-zA-Z%]+)?$/;
69244
+ var stringifyNumber = (value) => {
69245
+ return String(normalizeNumber(value));
69246
+ };
69247
+ var parseStringInterpolationComponent = (component, value) => {
69248
+ const match = cssNumberRegex.exec(component);
69249
+ if (match === null) {
69250
+ throw new TypeError(`Cannot interpolate "${value}" because "${component}" is not a supported scale, translate, or rotate value`);
69251
+ }
69252
+ const unit = match[2] ?? null;
69253
+ const numberValue = Number(match[1]);
69254
+ if (!Number.isFinite(numberValue)) {
69255
+ throw new TypeError(`Cannot interpolate "${value}" because "${component}" is not finite`);
69256
+ }
69257
+ if (unit === null) {
69258
+ return { kind: "scale", value: numberValue, unit: null };
69259
+ }
69260
+ if (angleUnits.has(unit)) {
69261
+ return { kind: "rotate", value: numberValue, unit };
69262
+ }
69263
+ if (lengthUnits.has(unit)) {
69264
+ return { kind: "translate", value: numberValue, unit };
69265
+ }
69266
+ throw new TypeError(`Cannot interpolate "${value}" because "${unit}" is not a supported translate or rotate unit`);
69267
+ };
69268
+ var parseStringInterpolationValue = (output) => {
69269
+ if (typeof output === "number") {
69270
+ if (!Number.isFinite(output)) {
69271
+ throw new Error(`outputRange must contain only finite numbers, but got [${output}]`);
69272
+ }
69273
+ return {
69274
+ kind: "scale",
69275
+ values: [output, output, 1],
69276
+ units: [null, null, null],
69277
+ dimensions: 1
69278
+ };
69279
+ }
69280
+ const parts = output.trim().split(/\s+/);
69281
+ if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
69282
+ throw new TypeError(`String outputRange values must contain 1 to 3 components, but got "${output}"`);
69283
+ }
69284
+ const parsed = parts.map((part) => parseStringInterpolationComponent(part, output));
69285
+ const [{ kind }] = parsed;
69286
+ for (const part of parsed) {
69287
+ if (part.kind !== kind) {
69288
+ throw new TypeError(`Cannot interpolate "${output}" because it mixes ${kind} and ${part.kind} values`);
69289
+ }
69290
+ }
69291
+ if (kind === "scale") {
69292
+ const x = parsed[0].value;
69293
+ const y = parsed[1]?.value ?? x;
69294
+ const z = parsed[2]?.value ?? 1;
69295
+ return {
69296
+ kind,
69297
+ values: [x, y, z],
69298
+ units: [null, null, null],
69299
+ dimensions: parsed.length
69300
+ };
69301
+ }
69302
+ return {
69303
+ kind,
69304
+ values: [parsed[0].value, parsed[1]?.value ?? 0, parsed[2]?.value ?? 0],
69305
+ units: [parsed[0].unit, parsed[1]?.unit ?? null, parsed[2]?.unit ?? null],
69306
+ dimensions: parsed.length
69307
+ };
69308
+ };
69309
+ var serializeStringInterpolationValue = ({
69310
+ kind,
69311
+ values,
69312
+ units,
69313
+ dimensions
69314
+ }) => {
69315
+ if (kind === "scale") {
69316
+ return values.slice(0, dimensions).map((value) => stringifyNumber(value)).join(" ");
69317
+ }
69318
+ return values.slice(0, dimensions).map((value, index) => `${stringifyNumber(value)}${units[index]}`).join(" ");
69319
+ };
69203
69320
  function interpolateFunction(input, inputRange, outputRange, options) {
69204
69321
  const { extrapolateLeft, extrapolateRight, easing } = options;
69205
69322
  let result = input;
@@ -69244,6 +69361,96 @@ function findRange(input, inputRange) {
69244
69361
  }
69245
69362
  return i - 1;
69246
69363
  }
69364
+ var defaultEasing = (num) => num;
69365
+ var interpolateNumber = ({
69366
+ input,
69367
+ inputRange,
69368
+ outputRange,
69369
+ options
69370
+ }) => {
69371
+ if (inputRange.length === 1) {
69372
+ return outputRange[0];
69373
+ }
69374
+ const easingOption = options?.easing;
69375
+ const resolveEasingForSegment = (segmentIndex) => {
69376
+ if (easingOption === undefined) {
69377
+ return defaultEasing;
69378
+ }
69379
+ if (typeof easingOption === "function") {
69380
+ return easingOption;
69381
+ }
69382
+ return easingOption[segmentIndex];
69383
+ };
69384
+ let extrapolateLeft = "extend";
69385
+ if (options?.extrapolateLeft !== undefined) {
69386
+ extrapolateLeft = options.extrapolateLeft;
69387
+ }
69388
+ let extrapolateRight = "extend";
69389
+ if (options?.extrapolateRight !== undefined) {
69390
+ extrapolateRight = options.extrapolateRight;
69391
+ }
69392
+ const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
69393
+ const range = findRange(posterizedInput, inputRange);
69394
+ return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
69395
+ easing: resolveEasingForSegment(range),
69396
+ extrapolateLeft,
69397
+ extrapolateRight
69398
+ });
69399
+ };
69400
+ var interpolateString = ({
69401
+ input,
69402
+ inputRange,
69403
+ outputRange,
69404
+ options
69405
+ }) => {
69406
+ const parsedOutputRange = outputRange.map(parseStringInterpolationValue);
69407
+ const kind = parsedOutputRange[0]?.kind;
69408
+ if (kind === undefined) {
69409
+ throw new Error("outputRange must have at least 1 element");
69410
+ }
69411
+ for (const parsed of parsedOutputRange) {
69412
+ if (parsed.kind !== kind) {
69413
+ throw new TypeError(`Cannot interpolate ${kind} values with ${parsed.kind} values`);
69414
+ }
69415
+ }
69416
+ const dimensions = Math.max(...parsedOutputRange.map((parsed) => parsed.dimensions));
69417
+ const units = [
69418
+ null,
69419
+ null,
69420
+ null
69421
+ ];
69422
+ if (kind !== "scale") {
69423
+ for (let axis = 0;axis < dimensions; axis++) {
69424
+ for (const parsed of parsedOutputRange) {
69425
+ const unit = parsed.units[axis];
69426
+ if (unit === null) {
69427
+ continue;
69428
+ }
69429
+ if (units[axis] === null) {
69430
+ units[axis] = unit;
69431
+ continue;
69432
+ }
69433
+ if (units[axis] !== unit) {
69434
+ throw new TypeError(`Cannot interpolate ${kind} values with different units on axis ${axis + 1}: ${units[axis]} and ${unit}`);
69435
+ }
69436
+ }
69437
+ if (units[axis] === null) {
69438
+ throw new TypeError(`Cannot interpolate ${kind} values because axis ${axis + 1} has no unit`);
69439
+ }
69440
+ }
69441
+ }
69442
+ return serializeStringInterpolationValue({
69443
+ kind,
69444
+ values: [0, 0, 0].map((_, axis) => interpolateNumber({
69445
+ input,
69446
+ inputRange,
69447
+ outputRange: parsedOutputRange.map((parsed) => parsed.values[axis]),
69448
+ options
69449
+ })),
69450
+ units,
69451
+ dimensions
69452
+ });
69453
+ };
69247
69454
  function checkValidInputRange(arr) {
69248
69455
  for (let i = 1;i < arr.length; ++i) {
69249
69456
  if (!(arr[i] > arr[i - 1])) {
@@ -69303,42 +69510,27 @@ function interpolate(input, inputRange, outputRange, options) {
69303
69510
  throw new Error("inputRange (" + inputRange.length + ") and outputRange (" + outputRange.length + ") must have the same length");
69304
69511
  }
69305
69512
  checkInfiniteRange("inputRange", inputRange);
69306
- checkInfiniteRange("outputRange", outputRange);
69307
69513
  checkValidInputRange(inputRange);
69308
69514
  assertValidInterpolateEasingOption(options?.easing, inputRange.length);
69309
69515
  assertValidInterpolatePosterizeOption(options?.posterize);
69310
- const easingOption = options?.easing;
69311
- const defaultEasing = (num) => num;
69312
- const resolveEasingForSegment = (segmentIndex) => {
69313
- if (easingOption === undefined) {
69314
- return defaultEasing;
69315
- }
69316
- if (typeof easingOption === "function") {
69317
- return easingOption;
69318
- }
69319
- return easingOption[segmentIndex];
69320
- };
69321
- let extrapolateLeft = "extend";
69322
- if (options?.extrapolateLeft !== undefined) {
69323
- extrapolateLeft = options.extrapolateLeft;
69324
- }
69325
- let extrapolateRight = "extend";
69326
- if (options?.extrapolateRight !== undefined) {
69327
- extrapolateRight = options.extrapolateRight;
69328
- }
69329
69516
  if (typeof input !== "number") {
69330
69517
  throw new TypeError("Cannot interpolate an input which is not a number");
69331
69518
  }
69332
- if (inputRange.length === 1) {
69333
- return outputRange[0];
69519
+ if (!Array.isArray(outputRange)) {
69520
+ throw new Error("outputRange must contain only numbers");
69334
69521
  }
69335
- const posterizedInput = options?.posterize === undefined ? input : Math.floor(input / options.posterize) * options.posterize;
69336
- const range = findRange(posterizedInput, inputRange);
69337
- return interpolateFunction(posterizedInput, [inputRange[range], inputRange[range + 1]], [outputRange[range], outputRange[range + 1]], {
69338
- easing: resolveEasingForSegment(range),
69339
- extrapolateLeft,
69340
- extrapolateRight
69341
- });
69522
+ const hasStringOutput = outputRange.some((output) => typeof output === "string");
69523
+ if (hasStringOutput) {
69524
+ if (!outputRange.every((output) => typeof output === "string" || typeof output === "number")) {
69525
+ throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
69526
+ }
69527
+ return interpolateString({ input, inputRange, outputRange, options });
69528
+ }
69529
+ if (!outputRange.every((output) => typeof output === "number")) {
69530
+ throw new TypeError("outputRange must contain only numbers, or supported scale, translate, and rotate strings");
69531
+ }
69532
+ checkInfiniteRange("outputRange", outputRange);
69533
+ return interpolateNumber({ input, inputRange, outputRange, options });
69342
69534
  }
69343
69535
  function mulberry32(a) {
69344
69536
  let t = a + 1831565813;
@@ -69921,6 +70113,45 @@ var proResProfileOptions = [
69921
70113
  "light",
69922
70114
  "proxy"
69923
70115
  ];
70116
+ var defaultScaleValue = [1, 1, 1];
70117
+ var parseScaleString = (value) => {
70118
+ const parts = value.trim().split(/\s+/);
70119
+ if (parts.length < 1 || parts.length > 3 || parts[0] === "") {
70120
+ return null;
70121
+ }
70122
+ const parsed = parts.map((part) => Number(part));
70123
+ if (!parsed.every((part) => Number.isFinite(part))) {
70124
+ return null;
70125
+ }
70126
+ const x = parsed[0];
70127
+ const y = parsed[1] ?? x;
70128
+ const z = parsed[2] ?? 1;
70129
+ return [x, y, z];
70130
+ };
70131
+ var parseValidScaleValue = (value) => {
70132
+ if (typeof value === "number") {
70133
+ return Number.isFinite(value) ? [value, value, 1] : null;
70134
+ }
70135
+ if (typeof value === "string") {
70136
+ return parseScaleString(value);
70137
+ }
70138
+ return null;
70139
+ };
70140
+ var parseScaleValue = (value) => {
70141
+ return parseValidScaleValue(value) ?? defaultScaleValue;
70142
+ };
70143
+ var serializeScaleValue = ([x, y, z]) => {
70144
+ const normalizedX = normalizeNumber(x);
70145
+ const normalizedY = normalizeNumber(y);
70146
+ const normalizedZ = normalizeNumber(z);
70147
+ if (normalizedX === normalizedY && normalizedZ === 1) {
70148
+ return normalizedX;
70149
+ }
70150
+ if (normalizedZ === 1) {
70151
+ return `${normalizedX} ${normalizedY}`;
70152
+ }
70153
+ return `${normalizedX} ${normalizedY} ${normalizedZ}`;
70154
+ };
69924
70155
  var sequenceVisualStyleSchema = {
69925
70156
  "style.translate": {
69926
70157
  type: "translate",
@@ -69929,7 +70160,7 @@ var sequenceVisualStyleSchema = {
69929
70160
  description: "Offset"
69930
70161
  },
69931
70162
  "style.scale": {
69932
- type: "number",
70163
+ type: "scale",
69933
70164
  min: 0.05,
69934
70165
  max: 100,
69935
70166
  step: 0.01,
@@ -69937,7 +70168,7 @@ var sequenceVisualStyleSchema = {
69937
70168
  description: "Scale"
69938
70169
  },
69939
70170
  "style.rotate": {
69940
- type: "rotation",
70171
+ type: "rotation-css",
69941
70172
  step: 1,
69942
70173
  default: "0deg",
69943
70174
  description: "Rotation"
@@ -69948,7 +70179,8 @@ var sequenceVisualStyleSchema = {
69948
70179
  max: 1,
69949
70180
  step: 0.01,
69950
70181
  default: 1,
69951
- description: "Opacity"
70182
+ description: "Opacity",
70183
+ hiddenFromList: false
69952
70184
  }
69953
70185
  };
69954
70186
  var sequencePremountSchema = {
@@ -69957,10 +70189,15 @@ var sequencePremountSchema = {
69957
70189
  default: 0,
69958
70190
  description: "Premount For",
69959
70191
  min: 0,
69960
- step: 1
70192
+ step: 1,
70193
+ hiddenFromList: false
69961
70194
  },
69962
70195
  postmountFor: {
69963
- type: "hidden"
70196
+ type: "number",
70197
+ default: 0,
70198
+ min: 0,
70199
+ step: 1,
70200
+ hiddenFromList: true
69964
70201
  },
69965
70202
  styleWhilePremounted: {
69966
70203
  type: "hidden"
@@ -69978,8 +70215,23 @@ var hiddenField = {
69978
70215
  default: false,
69979
70216
  description: "Hidden"
69980
70217
  };
70218
+ var durationInFramesField = {
70219
+ type: "number",
70220
+ default: undefined,
70221
+ min: 1,
70222
+ step: 1,
70223
+ hiddenFromList: true
70224
+ };
70225
+ var fromField = {
70226
+ type: "number",
70227
+ default: 0,
70228
+ step: 1,
70229
+ hiddenFromList: true
70230
+ };
69981
70231
  var sequenceSchema = {
69982
70232
  hidden: hiddenField,
70233
+ from: fromField,
70234
+ durationInFrames: durationInFramesField,
69983
70235
  layout: {
69984
70236
  type: "enum",
69985
70237
  default: "absolute-fill",
@@ -70161,7 +70413,9 @@ var NoReactInternals = {
70161
70413
  validateCodec,
70162
70414
  proResProfileOptions,
70163
70415
  findPropsToDelete,
70164
- sequenceSchema
70416
+ sequenceSchema,
70417
+ parseScaleValue,
70418
+ serializeScaleValue
70165
70419
  };
70166
70420
  var COMMAND_NOT_FOUND = "Command not found";
70167
70421
  var expiryDays = {
@@ -70227,7 +70481,7 @@ var validateDownloadBehavior = (downloadBehavior) => {
70227
70481
  }
70228
70482
  }
70229
70483
  };
70230
- var VERSION = "4.0.470";
70484
+ var VERSION = "4.0.472";
70231
70485
  var isColorSupported = () => {
70232
70486
  const env = process.env || {};
70233
70487
  const isForceDisabled = "NO_COLOR" in env;
@@ -71587,6 +71841,50 @@ var getExpectedOutName = ({
71587
71841
  }
71588
71842
  throw new TypeError("no type passed");
71589
71843
  };
71844
+ var findOutputFileInBucket = async ({
71845
+ region,
71846
+ renderMetadata,
71847
+ bucketName,
71848
+ customCredentials,
71849
+ currentRegion,
71850
+ providerSpecifics,
71851
+ forcePathStyle,
71852
+ requestHandler
71853
+ }) => {
71854
+ const { renderBucketName, key } = getExpectedOutName({
71855
+ renderMetadata,
71856
+ bucketName,
71857
+ customCredentials,
71858
+ bucketNamePrefix: providerSpecifics.getBucketPrefix()
71859
+ });
71860
+ try {
71861
+ const metadata = await providerSpecifics.headFile({
71862
+ bucketName: renderBucketName,
71863
+ key,
71864
+ region,
71865
+ customCredentials,
71866
+ forcePathStyle,
71867
+ requestHandler
71868
+ });
71869
+ return {
71870
+ url: providerSpecifics.getOutputUrl({
71871
+ renderMetadata,
71872
+ bucketName,
71873
+ customCredentials,
71874
+ currentRegion
71875
+ }).url,
71876
+ sizeInBytes: metadata.ContentLength ?? null
71877
+ };
71878
+ } catch (err) {
71879
+ if (err.name === "NotFound") {
71880
+ return null;
71881
+ }
71882
+ if (err.message === "UnknownError" || err.$metadata?.httpStatusCode === 403) {
71883
+ throw new Error(`Unable to access item "${key}" from bucket "${renderBucketName}" ${customCredentials?.endpoint ? `(S3 Endpoint = ${customCredentials?.endpoint})` : ""} - got a 403 error when heading the file. Check your credentials and permissions. The Lambda role must have permission for both "s3:GetObject" and "s3:ListBucket" actions.`, { cause: err });
71884
+ }
71885
+ throw err;
71886
+ }
71887
+ };
71590
71888
  var display = (accrued) => {
71591
71889
  if (accrued < 0.001) {
71592
71890
  return "<$0.001";
@@ -71992,6 +72290,76 @@ var getProgress = async ({
71992
72290
  });
71993
72291
  const isBeyondTimeoutAndMissingChunks = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds + 20000 && missingChunks && missingChunks.length > 0;
71994
72292
  const isBeyondTimeoutAndHasStitchTimeout = Date.now() > renderMetadata.startedDate + timeoutInMilliseconds * 2 + 20000;
72293
+ const shouldCheckForCompletedOutput = allChunks && (isBeyondTimeoutAndHasStitchTimeout || overallProgress.combinedFrames >= frameCount && overallProgress.timeToCombine !== null);
72294
+ if (shouldCheckForCompletedOutput) {
72295
+ const outputFile = await findOutputFileInBucket({
72296
+ bucketName,
72297
+ customCredentials,
72298
+ renderMetadata,
72299
+ region,
72300
+ currentRegion: region,
72301
+ providerSpecifics,
72302
+ forcePathStyle,
72303
+ requestHandler
72304
+ });
72305
+ if (outputFile) {
72306
+ const outData = getExpectedOutName({
72307
+ renderMetadata,
72308
+ bucketName,
72309
+ customCredentials,
72310
+ bucketNamePrefix: providerSpecifics.getBucketPrefix()
72311
+ });
72312
+ const now = Date.now();
72313
+ const timeToFinishChunks = calculateChunkTimes({
72314
+ type: "absolute-time",
72315
+ timings: overallProgress.timings
72316
+ });
72317
+ return {
72318
+ framesRendered: frameCount,
72319
+ bucket: bucketName,
72320
+ renderSize: outputFile.sizeInBytes ?? 0,
72321
+ chunks: renderMetadata.totalChunks,
72322
+ cleanup: {
72323
+ doneIn: null,
72324
+ filesDeleted: 0,
72325
+ minFilesToDelete: 0
72326
+ },
72327
+ costs: priceFromBucket ? formatCostsInfo(priceFromBucket.accruedSoFar) : formatCostsInfo(0),
72328
+ currentTime: now,
72329
+ done: true,
72330
+ encodingStatus: {
72331
+ framesEncoded: frameCount,
72332
+ combinedFrames: frameCount,
72333
+ timeToCombine: overallProgress.timeToCombine
72334
+ },
72335
+ errors: errorExplanations,
72336
+ fatalErrorEncountered: false,
72337
+ lambdasInvoked: renderMetadata.totalChunks,
72338
+ outputFile: outputFile.url,
72339
+ renderId,
72340
+ timeToFinish: now - renderMetadata.startedDate,
72341
+ timeToFinishChunks,
72342
+ timeToRenderFrames: overallProgress.timeToRenderFrames,
72343
+ overallProgress: 1,
72344
+ retriesInfo: overallProgress.retries ?? [],
72345
+ outKey: outData.key,
72346
+ outBucket: outData.renderBucketName,
72347
+ mostExpensiveFrameRanges: null,
72348
+ timeToEncode: overallProgress.timeToEncode,
72349
+ outputSizeInBytes: outputFile.sizeInBytes ?? 0,
72350
+ type: "success",
72351
+ estimatedBillingDurationInMilliseconds: priceFromBucket?.estimatedBillingDurationInMilliseconds ?? null,
72352
+ timeToCombine: overallProgress.timeToCombine,
72353
+ combinedFrames: frameCount,
72354
+ renderMetadata,
72355
+ timeoutTimestamp: overallProgress.timeoutTimestamp,
72356
+ compositionValidated: overallProgress.compositionValidated,
72357
+ functionLaunched: overallProgress.functionLaunched,
72358
+ serveUrlOpened: overallProgress.serveUrlOpened,
72359
+ artifacts: overallProgress.receivedArtifact
72360
+ };
72361
+ }
72362
+ }
71995
72363
  const allErrors = [
71996
72364
  isBeyondTimeoutAndMissingChunks || isBeyondTimeoutAndHasStitchTimeout ? makeTimeoutError({
71997
72365
  timeoutInMilliseconds,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/lambda-client"
4
4
  },
5
5
  "name": "@remotion/lambda-client",
6
- "version": "4.0.470",
6
+ "version": "4.0.472",
7
7
  "main": "dist/cjs/index.js",
8
8
  "scripts": {
9
9
  "formatting": "oxfmt src --check",
@@ -26,10 +26,10 @@
26
26
  "@aws-sdk/lib-storage": "3.986.0",
27
27
  "mime-types": "2.1.34",
28
28
  "@aws-sdk/credential-provider-ini": "3.972.5",
29
- "@remotion/serverless-client": "4.0.470",
29
+ "@remotion/serverless-client": "4.0.472",
30
30
  "@types/express": "5.0.1",
31
31
  "express": "4.21.0",
32
- "@remotion/eslint-config-internal": "4.0.470",
32
+ "@remotion/eslint-config-internal": "4.0.472",
33
33
  "eslint": "9.19.0",
34
34
  "next": "16.2.6",
35
35
  "@types/mime-types": "2.1.1",