@remotion/lambda 4.0.188 → 4.0.191

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.
Files changed (62) hide show
  1. package/dist/api/make-lambda-payload.js +2 -1
  2. package/dist/functions/helpers/check-if-render-exists.d.ts +3 -0
  3. package/dist/functions/helpers/check-if-render-exists.js +15 -0
  4. package/dist/functions/helpers/delete-chunks.d.ts +9 -0
  5. package/dist/functions/helpers/delete-chunks.js +25 -0
  6. package/dist/functions/helpers/expected-out-name.d.ts +1 -1
  7. package/dist/functions/helpers/get-browser-instance.d.ts +2 -3
  8. package/dist/functions/helpers/get-browser-instance.js +4 -3
  9. package/dist/functions/helpers/get-cleanup-progress.d.ts +10 -0
  10. package/dist/functions/helpers/get-cleanup-progress.js +35 -0
  11. package/dist/functions/helpers/get-custom-out-name.d.ts +1 -1
  12. package/dist/functions/helpers/get-encoding-metadata.d.ts +7 -0
  13. package/dist/functions/helpers/get-encoding-metadata.js +15 -0
  14. package/dist/functions/helpers/get-encoding-progress-step-size.d.ts +1 -0
  15. package/dist/functions/helpers/get-encoding-progress-step-size.js +7 -0
  16. package/dist/functions/helpers/get-files-to-delete.d.ts +10 -0
  17. package/dist/functions/helpers/get-files-to-delete.js +52 -0
  18. package/dist/functions/helpers/get-final-encoding-status.d.ts +6 -0
  19. package/dist/functions/helpers/get-final-encoding-status.js +18 -0
  20. package/dist/functions/helpers/get-folder-size.d.ts +1 -0
  21. package/dist/functions/helpers/get-folder-size.js +8 -0
  22. package/dist/functions/helpers/get-lambdas-invoked-stats.d.ts +8 -0
  23. package/dist/functions/helpers/get-lambdas-invoked-stats.js +14 -0
  24. package/dist/functions/helpers/get-post-render-data.d.ts +8 -0
  25. package/dist/functions/helpers/get-post-render-data.js +22 -0
  26. package/dist/functions/helpers/get-render-metadata.d.ts +8 -0
  27. package/dist/functions/helpers/get-render-metadata.js +17 -0
  28. package/dist/functions/helpers/get-rendered-frames-progress.d.ts +8 -0
  29. package/dist/functions/helpers/get-rendered-frames-progress.js +37 -0
  30. package/dist/functions/helpers/get-time-to-finish.d.ts +5 -0
  31. package/dist/functions/helpers/get-time-to-finish.js +13 -0
  32. package/dist/functions/helpers/io.d.ts +33 -3
  33. package/dist/functions/helpers/io.js +104 -3
  34. package/dist/functions/helpers/print-cloudwatch-helper.d.ts +1 -1
  35. package/dist/functions/helpers/print-cloudwatch-helper.js +3 -3
  36. package/dist/functions/helpers/streaming-payloads.d.ts +19 -0
  37. package/dist/functions/helpers/streaming-payloads.js +25 -0
  38. package/dist/functions/helpers/write-lambda-error.d.ts +3 -2
  39. package/dist/functions/helpers/write-lambda-error.js +2 -3
  40. package/dist/functions/helpers/write-post-render-data.d.ts +9 -0
  41. package/dist/functions/helpers/write-post-render-data.js +18 -0
  42. package/dist/functions/launch.js +1 -0
  43. package/dist/functions/merge.d.ts +9 -0
  44. package/dist/functions/merge.js +61 -0
  45. package/dist/functions/renderer.js +12 -1
  46. package/dist/functions/still.js +1 -0
  47. package/dist/index.d.ts +2 -1
  48. package/dist/internals.d.ts +2 -0
  49. package/dist/shared/chunk-progress.d.ts +9 -0
  50. package/dist/shared/chunk-progress.js +2034 -0
  51. package/dist/shared/compress-props.d.ts +6 -8
  52. package/dist/shared/compress-props.js +14 -11
  53. package/dist/shared/parse-chunk-key.d.ts +5 -0
  54. package/dist/shared/parse-chunk-key.js +15 -0
  55. package/dist/shared/parse-lambda-initialized-key.d.ts +5 -0
  56. package/dist/shared/parse-lambda-initialized-key.js +15 -0
  57. package/dist/shared/serialize-props.d.ts +14 -0
  58. package/dist/shared/serialize-props.js +36 -0
  59. package/package.json +11 -11
  60. package/remotionlambda-arm64.zip +0 -0
  61. package/dist/functions/provider-implementation.d.ts +0 -0
  62. package/dist/functions/provider-implementation.js +0 -1
@@ -1,22 +1,20 @@
1
- import type { ProviderSpecifics } from '@remotion/serverless';
2
- import { type SerializedInputProps } from '@remotion/serverless/client';
1
+ import type { SerializedInputProps } from '@remotion/serverless/client';
2
+ import type { AwsRegion } from '../client';
3
3
  type PropsType = 'input-props' | 'resolved-props';
4
4
  export declare const serializeOrThrow: (inputProps: Record<string, unknown>, propsType: PropsType) => string;
5
5
  export declare const getNeedsToUpload: (type: 'still' | 'video-or-audio', sizes: number[]) => boolean;
6
- export declare const compressInputProps: <Region extends string>({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, providerSpecifics, }: {
6
+ export declare const compressInputProps: ({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, }: {
7
7
  stringifiedInputProps: string;
8
- region: Region;
8
+ region: AwsRegion;
9
9
  userSpecifiedBucketName: string | null;
10
10
  propsType: PropsType;
11
11
  needsToUpload: boolean;
12
- providerSpecifics: ProviderSpecifics<Region>;
13
12
  }) => Promise<SerializedInputProps>;
14
- export declare const decompressInputProps: <Region extends string>({ serialized, region, bucketName, expectedBucketOwner, propsType, providerSpecifics, }: {
13
+ export declare const decompressInputProps: ({ serialized, region, bucketName, expectedBucketOwner, propsType, }: {
15
14
  serialized: SerializedInputProps;
16
- region: Region;
15
+ region: AwsRegion;
17
16
  bucketName: string;
18
17
  expectedBucketOwner: string;
19
18
  propsType: PropsType;
20
- providerSpecifics: ProviderSpecifics<Region>;
21
19
  }) => Promise<string>;
22
20
  export {};
@@ -1,14 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.decompressInputProps = exports.compressInputProps = exports.getNeedsToUpload = exports.serializeOrThrow = void 0;
4
- const client_1 = require("@remotion/serverless/client");
5
4
  const no_react_1 = require("remotion/no-react");
5
+ const get_or_create_bucket_1 = require("../api/get-or-create-bucket");
6
+ const io_1 = require("../functions/helpers/io");
7
+ const constants_1 = require("./constants");
8
+ const random_hash_1 = require("./random-hash");
9
+ const stream_to_string_1 = require("./stream-to-string");
6
10
  const validate_webhook_1 = require("./validate-webhook");
7
11
  const makeKey = (type, hash) => {
8
12
  if (type === 'input-props') {
9
- return (0, client_1.inputPropsKey)(hash);
13
+ return (0, constants_1.inputPropsKey)(hash);
10
14
  }
11
- return (0, client_1.resolvedPropsKey)(hash);
15
+ return (0, constants_1.resolvedPropsKey)(hash);
12
16
  };
13
17
  const serializeOrThrow = (inputProps, propsType) => {
14
18
  try {
@@ -35,16 +39,15 @@ const getNeedsToUpload = (type, sizes) => {
35
39
  return false;
36
40
  };
37
41
  exports.getNeedsToUpload = getNeedsToUpload;
38
- const compressInputProps = async ({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, providerSpecifics, }) => {
39
- const hash = providerSpecifics.randomHash();
42
+ const compressInputProps = async ({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, }) => {
43
+ const hash = (0, random_hash_1.randomHash)();
40
44
  if (needsToUpload) {
41
- const bucketName = userSpecifiedBucketName !== null && userSpecifiedBucketName !== void 0 ? userSpecifiedBucketName : (await (0, client_1.internalGetOrCreateBucket)({
45
+ const bucketName = userSpecifiedBucketName !== null && userSpecifiedBucketName !== void 0 ? userSpecifiedBucketName : (await (0, get_or_create_bucket_1.internalGetOrCreateBucket)({
42
46
  region,
43
47
  enableFolderExpiry: null,
44
48
  customCredentials: null,
45
- providerSpecifics,
46
49
  })).bucketName;
47
- await providerSpecifics.writeFile({
50
+ await (0, io_1.lambdaWriteFile)({
48
51
  body: stringifiedInputProps,
49
52
  bucketName,
50
53
  region,
@@ -66,18 +69,18 @@ const compressInputProps = async ({ stringifiedInputProps, region, userSpecified
66
69
  };
67
70
  };
68
71
  exports.compressInputProps = compressInputProps;
69
- const decompressInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, propsType, providerSpecifics, }) => {
72
+ const decompressInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, propsType, }) => {
70
73
  if (serialized.type === 'payload') {
71
74
  return serialized.payload;
72
75
  }
73
76
  try {
74
- const response = await providerSpecifics.readFile({
77
+ const response = await (0, io_1.lambdaReadFile)({
75
78
  bucketName,
76
79
  expectedBucketOwner,
77
80
  key: makeKey(propsType, serialized.hash),
78
81
  region,
79
82
  });
80
- const body = await (0, client_1.streamToString)(response);
83
+ const body = await (0, stream_to_string_1.streamToString)(response);
81
84
  const payload = body;
82
85
  return payload;
83
86
  }
@@ -0,0 +1,5 @@
1
+ export declare const parseLambdaChunkKey: (key: string) => {
2
+ renderId: string;
3
+ chunk: number;
4
+ type: string;
5
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseLambdaChunkKey = void 0;
4
+ const parseLambdaChunkKey = (key) => {
5
+ const match = key.match(/^renders\/(.*)\/chunks\/chunk:([0-9]+):(video|audio)$/);
6
+ if (!match) {
7
+ throw new Error(`Cannot parse filename ${key} into timing information. Malformed data.`);
8
+ }
9
+ return {
10
+ renderId: match[1],
11
+ chunk: Number(match[2]),
12
+ type: match[3],
13
+ };
14
+ };
15
+ exports.parseLambdaChunkKey = parseLambdaChunkKey;
@@ -0,0 +1,5 @@
1
+ export declare const parseLambdaInitializedKey: (key: string) => {
2
+ renderId: string;
3
+ chunk: number;
4
+ attempt: number;
5
+ };
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseLambdaInitializedKey = void 0;
4
+ const parseLambdaInitializedKey = (key) => {
5
+ const match = key.match(/^renders\/(.*)\/lambda-initialized-chunk:([0-9]+)-attempt:([0-9]+).txt$/);
6
+ if (!match) {
7
+ throw new Error(`Cannot parse filename ${key} into timing information. Malformed data.`);
8
+ }
9
+ return {
10
+ renderId: match[1],
11
+ chunk: Number(match[2]),
12
+ attempt: Number(match[3]),
13
+ };
14
+ };
15
+ exports.parseLambdaInitializedKey = parseLambdaInitializedKey;
@@ -0,0 +1,14 @@
1
+ type SerializedJSONWithCustomFields = {
2
+ serializedString: string;
3
+ customDateUsed: boolean;
4
+ customFileUsed: boolean;
5
+ mapUsed: boolean;
6
+ setUsed: boolean;
7
+ };
8
+ export declare const FILE_TOKEN = "remotion-file:";
9
+ export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
10
+ data: Record<string, unknown>;
11
+ indent: number | undefined;
12
+ staticBase: string | null;
13
+ }) => SerializedJSONWithCustomFields;
14
+ export {};
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ // Must keep this file in sync with the one in packages/core/src/input-props-serialization.ts!
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.serializeJSONWithDate = exports.FILE_TOKEN = void 0;
5
+ const DATE_TOKEN = 'remotion-date:';
6
+ exports.FILE_TOKEN = 'remotion-file:';
7
+ const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
8
+ let customDateUsed = false;
9
+ let customFileUsed = false;
10
+ let mapUsed = false;
11
+ let setUsed = false;
12
+ const serializedString = JSON.stringify(data, function (key, value) {
13
+ const item = this[key];
14
+ if (item instanceof Date) {
15
+ customDateUsed = true;
16
+ return `${DATE_TOKEN}${item.toISOString()}`;
17
+ }
18
+ if (item instanceof Map) {
19
+ mapUsed = true;
20
+ return value;
21
+ }
22
+ if (item instanceof Set) {
23
+ setUsed = true;
24
+ return value;
25
+ }
26
+ if (typeof item === 'string' &&
27
+ staticBase !== null &&
28
+ item.startsWith(staticBase)) {
29
+ customFileUsed = true;
30
+ return `${exports.FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
31
+ }
32
+ return value;
33
+ }, indent);
34
+ return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
35
+ };
36
+ exports.serializeJSONWithDate = serializeJSONWithDate;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "url": "https://github.com/remotion-dev/remotion/tree/main/packages/lambda"
4
4
  },
5
5
  "name": "@remotion/lambda",
6
- "version": "4.0.188",
6
+ "version": "4.0.191",
7
7
  "description": "Render Remotion videos on AWS Lambda",
8
8
  "main": "dist/index.js",
9
9
  "sideEffects": false,
@@ -22,13 +22,13 @@
22
22
  "@aws-sdk/s3-request-presigner": "3.583.0",
23
23
  "mime-types": "2.1.34",
24
24
  "zod": "3.22.3",
25
- "@remotion/cli": "4.0.188",
26
- "@remotion/bundler": "4.0.188",
27
- "@remotion/streaming": "4.0.188",
28
- "@remotion/renderer": "4.0.188",
29
- "@remotion/studio-server": "4.0.188",
30
- "remotion": "4.0.188",
31
- "@remotion/serverless": "4.0.188"
25
+ "@remotion/bundler": "4.0.191",
26
+ "@remotion/studio-server": "4.0.191",
27
+ "@remotion/renderer": "4.0.191",
28
+ "@remotion/streaming": "4.0.191",
29
+ "@remotion/serverless": "4.0.191",
30
+ "remotion": "4.0.191",
31
+ "@remotion/cli": "4.0.191"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/mime-types": "2.1.1",
@@ -37,11 +37,11 @@
37
37
  "pureimage": "0.4.13",
38
38
  "vitest": "0.31.1",
39
39
  "zip-lib": "^0.7.2",
40
- "@remotion/bundler": "4.0.188",
41
- "@remotion/compositor-linux-arm64-gnu": "4.0.188"
40
+ "@remotion/bundler": "4.0.191",
41
+ "@remotion/compositor-linux-arm64-gnu": "4.0.191"
42
42
  },
43
43
  "peerDependencies": {
44
- "@remotion/bundler": "4.0.188"
44
+ "@remotion/bundler": "4.0.191"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
Binary file
File without changes
@@ -1 +0,0 @@
1
- "use strict";