@remotion/lambda 4.0.244 → 4.0.246

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 (258) hide show
  1. package/LICENSE.md +1 -1
  2. package/dist/admin/make-layer-public.js +10 -11
  3. package/dist/api/app-router-webhook.d.ts +10 -0
  4. package/dist/api/app-router-webhook.js +43 -0
  5. package/dist/api/create-function.d.ts +1 -2
  6. package/dist/api/create-function.js +10 -10
  7. package/dist/api/delete-function.d.ts +4 -13
  8. package/dist/api/delete-function.js +2 -5
  9. package/dist/api/delete-render.d.ts +0 -8
  10. package/dist/api/delete-render.js +4 -10
  11. package/dist/api/delete-site.d.ts +0 -10
  12. package/dist/api/delete-site.js +4 -11
  13. package/dist/api/deploy-function.d.ts +8 -15
  14. package/dist/api/deploy-function.js +21 -27
  15. package/dist/api/deploy-site.d.ts +2 -11
  16. package/dist/api/deploy-site.js +14 -22
  17. package/dist/api/download-media.d.ts +0 -11
  18. package/dist/api/download-media.js +3 -12
  19. package/dist/api/estimate-price.d.ts +0 -6
  20. package/dist/api/estimate-price.js +1 -3
  21. package/dist/api/get-aws-client.d.ts +1 -9
  22. package/dist/api/get-aws-client.js +2 -6
  23. package/dist/api/get-compositions-on-lambda.d.ts +1 -14
  24. package/dist/api/get-compositions-on-lambda.js +12 -17
  25. package/dist/api/get-function-info.d.ts +1 -14
  26. package/dist/api/get-function-info.js +2 -5
  27. package/dist/api/get-functions.d.ts +1 -8
  28. package/dist/api/get-functions.js +2 -5
  29. package/dist/api/get-or-create-bucket.d.ts +0 -6
  30. package/dist/api/get-or-create-bucket.js +3 -5
  31. package/dist/api/get-regions.d.ts +0 -5
  32. package/dist/api/get-regions.js +3 -4
  33. package/dist/api/get-render-progress.d.ts +0 -10
  34. package/dist/api/get-render-progress.js +3 -11
  35. package/dist/api/get-sites.d.ts +0 -6
  36. package/dist/api/get-sites.js +4 -7
  37. package/dist/api/iam-validation/simulate.d.ts +0 -7
  38. package/dist/api/iam-validation/simulate.js +2 -5
  39. package/dist/api/iam-validation/suggested-policy.d.ts +0 -10
  40. package/dist/api/iam-validation/suggested-policy.js +2 -4
  41. package/dist/api/make-lambda-payload.d.ts +2 -1
  42. package/dist/api/make-lambda-payload.js +19 -13
  43. package/dist/api/pages-router-webhook.d.ts +3 -0
  44. package/dist/api/pages-router-webhook.js +47 -0
  45. package/dist/api/presign-url.d.ts +0 -10
  46. package/dist/api/presign-url.js +2 -8
  47. package/dist/api/render-media-on-lambda.d.ts +1 -20
  48. package/dist/api/render-media-on-lambda.js +4 -19
  49. package/dist/api/render-still-on-lambda.d.ts +2 -19
  50. package/dist/api/render-still-on-lambda.js +6 -17
  51. package/dist/api/speculate-function-name.d.ts +0 -8
  52. package/dist/api/speculate-function-name.js +3 -7
  53. package/dist/api/upload-dir.d.ts +1 -7
  54. package/dist/api/upload-dir.js +1 -5
  55. package/dist/api/validate-webhook-signature.d.ts +0 -8
  56. package/dist/api/validate-webhook-signature.js +3 -7
  57. package/dist/cli/args.d.ts +2 -1
  58. package/dist/cli/commands/compositions/index.d.ts +7 -1
  59. package/dist/cli/commands/compositions/index.js +2 -2
  60. package/dist/cli/commands/functions/deploy.d.ts +7 -1
  61. package/dist/cli/commands/functions/deploy.js +7 -2
  62. package/dist/cli/commands/functions/index.d.ts +8 -1
  63. package/dist/cli/commands/functions/index.js +8 -4
  64. package/dist/cli/commands/functions/ls.d.ts +6 -1
  65. package/dist/cli/commands/functions/ls.js +2 -3
  66. package/dist/cli/commands/functions/rmall.d.ts +6 -1
  67. package/dist/cli/commands/functions/rmall.js +2 -3
  68. package/dist/cli/commands/render/render.d.ts +6 -1
  69. package/dist/cli/commands/render/render.js +9 -7
  70. package/dist/cli/commands/sites/create.js +2 -0
  71. package/dist/cli/commands/sites/index.d.ts +1 -1
  72. package/dist/cli/commands/sites/index.js +4 -4
  73. package/dist/cli/commands/still.d.ts +2 -2
  74. package/dist/cli/commands/still.js +5 -5
  75. package/dist/cli/get-aws-region.js +0 -4
  76. package/dist/cli/helpers/find-function-name.d.ts +6 -1
  77. package/dist/cli/helpers/find-function-name.js +4 -5
  78. package/dist/cli/index.d.ts +2 -2
  79. package/dist/cli/index.js +36 -16
  80. package/dist/client.d.ts +17 -22
  81. package/dist/client.js +17 -13
  82. package/dist/functions/aws-implementation.d.ts +13 -1
  83. package/dist/functions/aws-implementation.js +46 -0
  84. package/dist/functions/aws-server-implementation.d.ts +2 -0
  85. package/dist/functions/aws-server-implementation.js +25 -0
  86. package/dist/functions/full-client-implementation.d.ts +3 -0
  87. package/dist/functions/full-client-implementation.js +16 -0
  88. package/dist/functions/helpers/clean-tmpdir.js +1 -3
  89. package/dist/functions/helpers/get-current-region.js +0 -4
  90. package/dist/functions/helpers/get-output-url-from-metadata.d.ts +3 -7
  91. package/dist/functions/helpers/get-output-url-from-metadata.js +1 -1
  92. package/dist/functions/helpers/lifecycle.d.ts +4 -2
  93. package/dist/functions/helpers/lifecycle.js +3 -18
  94. package/dist/functions/helpers/timer.d.ts +2 -4
  95. package/dist/functions/http-client.d.ts +7 -0
  96. package/dist/functions/http-client.js +22 -0
  97. package/dist/functions/index.d.ts +1 -8
  98. package/dist/functions/index.js +12 -235
  99. package/dist/index.d.ts +6 -6
  100. package/dist/index.js +27 -6
  101. package/dist/internals.d.ts +6 -5
  102. package/dist/pricing/price-per-1-s.js +102 -0
  103. package/dist/regions.d.ts +1 -1
  104. package/dist/regions.js +3 -0
  105. package/dist/shared/call-lambda-async.d.ts +3 -0
  106. package/dist/shared/call-lambda-async.js +20 -0
  107. package/dist/shared/call-lambda-streaming.d.ts +7 -0
  108. package/dist/shared/{call-lambda.js → call-lambda-streaming.js} +36 -61
  109. package/dist/shared/call-lambda-sync.d.ts +3 -0
  110. package/dist/shared/call-lambda-sync.js +30 -0
  111. package/dist/shared/check-credentials.js +2 -3
  112. package/dist/shared/constants.d.ts +2 -91
  113. package/dist/shared/constants.js +1 -8
  114. package/dist/shared/convert-to-serve-url.js +2 -2
  115. package/dist/shared/get-account-id.d.ts +3 -4
  116. package/dist/shared/get-account-id.js +3 -3
  117. package/dist/shared/get-aws-urls.d.ts +4 -8
  118. package/dist/shared/get-aws-urls.js +1 -1
  119. package/dist/shared/get-function-version.js +4 -4
  120. package/dist/shared/get-layers.d.ts +1 -2
  121. package/dist/shared/get-layers.js +2 -4
  122. package/dist/shared/get-s3-operations.d.ts +4 -1
  123. package/dist/shared/get-s3-operations.js +2 -3
  124. package/dist/shared/get-service-client.js +2 -2
  125. package/dist/shared/hosted-layers.d.ts +0 -1
  126. package/dist/shared/hosted-layers.js +139 -537
  127. package/dist/shared/lambda-insights-extensions.d.ts +1 -1
  128. package/dist/shared/lambda-insights-extensions.js +3 -0
  129. package/dist/shared/read-dir.d.ts +2 -10
  130. package/dist/shared/read-dir.js +5 -4
  131. package/dist/shared/validate-aws-region.js +1 -1
  132. package/dist/shared/validate-bucketname.d.ts +1 -1
  133. package/package.json +15 -15
  134. package/remotionlambda-arm64.zip +0 -0
  135. package/dist/api/__mocks__/clean-items.d.ts +0 -2
  136. package/dist/api/__mocks__/clean-items.js +0 -24
  137. package/dist/api/__mocks__/create-function.d.ts +0 -2
  138. package/dist/api/__mocks__/create-function.js +0 -21
  139. package/dist/api/__mocks__/delete-function.d.ts +0 -2
  140. package/dist/api/__mocks__/delete-function.js +0 -9
  141. package/dist/api/__mocks__/get-functions.d.ts +0 -2
  142. package/dist/api/__mocks__/get-functions.js +0 -9
  143. package/dist/api/__mocks__/upload-dir.d.ts +0 -3
  144. package/dist/api/__mocks__/upload-dir.js +0 -47
  145. package/dist/api/mock-functions.d.ts +0 -18
  146. package/dist/api/mock-functions.js +0 -36
  147. package/dist/cli/helpers/__mocks__/quit.d.ts +0 -1
  148. package/dist/cli/helpers/__mocks__/quit.js +0 -7
  149. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +0 -7
  150. package/dist/functions/chunk-optimization/plan-frame-ranges.js +0 -17
  151. package/dist/functions/chunk-optimization/types.d.ts +0 -8
  152. package/dist/functions/chunk-optimization/types.js +0 -2
  153. package/dist/functions/helpers/__mocks__/get-browser-instance.d.ts +0 -3
  154. package/dist/functions/helpers/__mocks__/get-browser-instance.js +0 -12
  155. package/dist/functions/helpers/__mocks__/leak-detection.d.ts +0 -4
  156. package/dist/functions/helpers/__mocks__/leak-detection.js +0 -9
  157. package/dist/functions/helpers/__mocks__/timer.d.ts +0 -2
  158. package/dist/functions/helpers/__mocks__/timer.js +0 -10
  159. package/dist/functions/helpers/best-frames-per-lambda-param.d.ts +0 -1
  160. package/dist/functions/helpers/best-frames-per-lambda-param.js +0 -17
  161. package/dist/functions/helpers/calculate-chunk-times.d.ts +0 -5
  162. package/dist/functions/helpers/calculate-chunk-times.js +0 -29
  163. package/dist/functions/helpers/calculate-price-from-bucket.d.ts +0 -15
  164. package/dist/functions/helpers/calculate-price-from-bucket.js +0 -30
  165. package/dist/functions/helpers/can-concat-seamlessly.d.ts +0 -3
  166. package/dist/functions/helpers/can-concat-seamlessly.js +0 -17
  167. package/dist/functions/helpers/cleanup-props.d.ts +0 -8
  168. package/dist/functions/helpers/cleanup-props.js +0 -23
  169. package/dist/functions/helpers/concat-videos.d.ts +0 -23
  170. package/dist/functions/helpers/concat-videos.js +0 -54
  171. package/dist/functions/helpers/create-post-render-data.d.ts +0 -17
  172. package/dist/functions/helpers/create-post-render-data.js +0 -67
  173. package/dist/functions/helpers/find-output-file-in-bucket.d.ts +0 -14
  174. package/dist/functions/helpers/find-output-file-in-bucket.js +0 -38
  175. package/dist/functions/helpers/format-costs-info.d.ts +0 -2
  176. package/dist/functions/helpers/format-costs-info.js +0 -23
  177. package/dist/functions/helpers/get-overall-progress-s3.d.ts +0 -10
  178. package/dist/functions/helpers/get-overall-progress-s3.js +0 -24
  179. package/dist/functions/helpers/get-overall-progress.d.ts +0 -9
  180. package/dist/functions/helpers/get-overall-progress.js +0 -23
  181. package/dist/functions/helpers/get-progress.d.ts +0 -15
  182. package/dist/functions/helpers/get-progress.js +0 -254
  183. package/dist/functions/helpers/get-retry-stats.d.ts +0 -5
  184. package/dist/functions/helpers/get-retry-stats.js +0 -2
  185. package/dist/functions/helpers/inspect-errors.d.ts +0 -4
  186. package/dist/functions/helpers/inspect-errors.js +0 -39
  187. package/dist/functions/helpers/is-warm.d.ts +0 -2
  188. package/dist/functions/helpers/is-warm.js +0 -10
  189. package/dist/functions/helpers/leak-detection.d.ts +0 -4
  190. package/dist/functions/helpers/leak-detection.js +0 -40
  191. package/dist/functions/helpers/make-timeout-error.d.ts +0 -10
  192. package/dist/functions/helpers/make-timeout-error.js +0 -31
  193. package/dist/functions/helpers/make-timeout-message.d.ts +0 -10
  194. package/dist/functions/helpers/make-timeout-message.js +0 -75
  195. package/dist/functions/helpers/merge-chunks.d.ts +0 -36
  196. package/dist/functions/helpers/merge-chunks.js +0 -84
  197. package/dist/functions/helpers/min-max.d.ts +0 -2
  198. package/dist/functions/helpers/min-max.js +0 -33
  199. package/dist/functions/helpers/on-downloads-logger.d.ts +0 -2
  200. package/dist/functions/helpers/on-downloads-logger.js +0 -29
  201. package/dist/functions/helpers/overall-render-progress.d.ts +0 -59
  202. package/dist/functions/helpers/overall-render-progress.js +0 -180
  203. package/dist/functions/helpers/print-concurrency-curve.d.ts +0 -1
  204. package/dist/functions/helpers/print-concurrency-curve.js +0 -8
  205. package/dist/functions/helpers/print-logging-helper.d.ts +0 -4
  206. package/dist/functions/helpers/print-logging-helper.js +0 -12
  207. package/dist/functions/helpers/render-has-audio-video.d.ts +0 -6
  208. package/dist/functions/helpers/render-has-audio-video.js +0 -21
  209. package/dist/functions/helpers/request-context.d.ts +0 -5
  210. package/dist/functions/helpers/request-context.js +0 -2
  211. package/dist/functions/helpers/stream-renderer.d.ts +0 -17
  212. package/dist/functions/helpers/stream-renderer.js +0 -148
  213. package/dist/functions/launch.d.ts +0 -10
  214. package/dist/functions/launch.js +0 -596
  215. package/dist/functions/progress.d.ts +0 -11
  216. package/dist/functions/progress.js +0 -51
  217. package/dist/functions/renderer.d.ts +0 -17
  218. package/dist/functions/renderer.js +0 -341
  219. package/dist/functions/start.d.ts +0 -13
  220. package/dist/functions/start.js +0 -113
  221. package/dist/functions/still.d.ts +0 -19
  222. package/dist/functions/still.js +0 -330
  223. package/dist/shared/__mocks__/aws-clients.d.ts +0 -2
  224. package/dist/shared/__mocks__/aws-clients.js +0 -62
  225. package/dist/shared/__mocks__/bundle-site.d.ts +0 -2
  226. package/dist/shared/__mocks__/bundle-site.js +0 -32
  227. package/dist/shared/__mocks__/check-credentials.d.ts +0 -1
  228. package/dist/shared/__mocks__/check-credentials.js +0 -5
  229. package/dist/shared/__mocks__/get-account-id.d.ts +0 -2
  230. package/dist/shared/__mocks__/get-account-id.js +0 -11
  231. package/dist/shared/__mocks__/read-dir.d.ts +0 -2
  232. package/dist/shared/__mocks__/read-dir.js +0 -13
  233. package/dist/shared/call-lambda.d.ts +0 -16
  234. package/dist/shared/cleanup-serialized-input-props.d.ts +0 -14
  235. package/dist/shared/cleanup-serialized-input-props.js +0 -34
  236. package/dist/shared/docs-url.d.ts +0 -1
  237. package/dist/shared/docs-url.js +0 -4
  238. package/dist/shared/get-most-expensive-chunks.d.ts +0 -8
  239. package/dist/shared/get-most-expensive-chunks.js +0 -28
  240. package/dist/shared/invoke-webhook.d.ts +0 -48
  241. package/dist/shared/invoke-webhook.js +0 -140
  242. package/dist/shared/parse-lambda-timings-key.d.ts +0 -5
  243. package/dist/shared/parse-lambda-timings-key.js +0 -2
  244. package/dist/shared/return-values.d.ts +0 -16
  245. package/dist/shared/return-values.js +0 -2
  246. package/dist/shared/stackback.d.ts +0 -6
  247. package/dist/shared/stackback.js +0 -59
  248. package/dist/shared/validate-download-behavior.d.ts +0 -1
  249. package/dist/shared/validate-download-behavior.js +0 -21
  250. package/dist/shared/validate-frames-per-lambda.d.ts +0 -4
  251. package/dist/shared/validate-frames-per-lambda.js +0 -29
  252. package/dist/shared/validate-privacy.d.ts +0 -2
  253. package/dist/shared/validate-privacy.js +0 -14
  254. package/dist/shared/validate.d.ts +0 -4
  255. package/dist/shared/validate.js +0 -8
  256. package/dist/shared/why-is-node-running.d.ts +0 -15
  257. package/dist/shared/why-is-node-running.js +0 -88
  258. package/vitest.config.mts +0 -11
@@ -1,140 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.invokeWebhook = exports.mockableHttpClients = void 0;
30
- exports.calculateSignature = calculateSignature;
31
- const renderer_1 = require("@remotion/renderer");
32
- const https_1 = __importDefault(require("https"));
33
- const Crypto = __importStar(require("node:crypto"));
34
- const node_http_1 = __importDefault(require("node:http"));
35
- /**
36
- * @description Calculates cryptographically secure signature for webhooks using Hmac.
37
- * @link https://remotion.dev/docs/lambda/webhooks#validate-webhooks
38
- * @param payload Stringified request body to encode in the signature.
39
- * @param secret User-provided webhook secret used to sign the request.
40
- * @returns {string} Calculated signature
41
- */
42
- function calculateSignature(payload, secret) {
43
- if (!secret) {
44
- return 'NO_SECRET_PROVIDED';
45
- }
46
- const hmac = Crypto.createHmac('sha512', secret);
47
- const signature = 'sha512=' + hmac.update(payload).digest('hex');
48
- return signature;
49
- }
50
- exports.mockableHttpClients = {
51
- http: node_http_1.default.request,
52
- https: https_1.default.request,
53
- };
54
- // Don't handle 304 status code (Not Modified) as a redirect,
55
- // since the browser will display the right page.
56
- const redirectStatusCodes = [301, 302, 303, 307, 308];
57
- const getWebhookClient = (url) => {
58
- if (url.startsWith('https://')) {
59
- return exports.mockableHttpClients.https;
60
- }
61
- if (url.startsWith('http://')) {
62
- return exports.mockableHttpClients.http;
63
- }
64
- throw new Error('Can only request URLs starting with http:// or https://');
65
- };
66
- function invokeWebhookRaw({ payload, secret, url, redirectsSoFar, }) {
67
- const jsonPayload = JSON.stringify(payload);
68
- return new Promise((resolve, reject) => {
69
- const req = getWebhookClient(url)(url, {
70
- method: 'POST',
71
- headers: {
72
- 'Content-Type': 'application/json',
73
- 'Content-Length': jsonPayload.length,
74
- 'X-Remotion-Mode': 'production',
75
- 'X-Remotion-Signature': calculateSignature(jsonPayload, secret),
76
- 'X-Remotion-Status': payload.type,
77
- },
78
- timeout: 5000,
79
- }, (res) => {
80
- if (res.statusCode && res.statusCode > 299) {
81
- if (redirectStatusCodes.includes(res.statusCode)) {
82
- if (!res.headers.location) {
83
- reject(new Error(`Received a status code ${res.statusCode} but no "Location" header while calling ${res.headers.location}`));
84
- return;
85
- }
86
- if (redirectsSoFar > 10) {
87
- reject(new Error(`Too many redirects while downloading ${url}`));
88
- return;
89
- }
90
- invokeWebhookRaw({
91
- payload,
92
- secret,
93
- url: res.headers.location,
94
- redirectsSoFar: redirectsSoFar + 1,
95
- })
96
- .then(resolve)
97
- .catch(reject);
98
- return;
99
- }
100
- reject(new Error(`Sent a webhook to ${url} but got a status code of ${res.statusCode} with message '${res.statusMessage}'`));
101
- return;
102
- }
103
- resolve();
104
- });
105
- req.write(jsonPayload, (err) => {
106
- if (err) {
107
- reject(err);
108
- }
109
- else {
110
- req.end();
111
- }
112
- });
113
- req.on('error', (err) => {
114
- reject(err);
115
- });
116
- });
117
- }
118
- function exponentialBackoff(errorCount) {
119
- return 1000 * 2 ** (errorCount - 1);
120
- }
121
- const invokeWebhook = async (options, logLevel, retries = 2, errors = 0) => {
122
- try {
123
- await invokeWebhookRaw(options);
124
- }
125
- catch (err) {
126
- if (retries === 0) {
127
- throw err;
128
- }
129
- renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, 'Could not send webhook due to error:');
130
- renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, err.stack);
131
- renderer_1.RenderInternals.Log.error({ indent: false, logLevel }, `Retrying in ${exponentialBackoff(errors)}ms.`);
132
- await new Promise((resolve) => {
133
- setTimeout(() => {
134
- resolve();
135
- }, exponentialBackoff(errors));
136
- });
137
- return (0, exports.invokeWebhook)(options, logLevel, retries - 1, errors + 1);
138
- }
139
- };
140
- exports.invokeWebhook = invokeWebhook;
@@ -1,5 +0,0 @@
1
- export type ParsedTiming = {
2
- chunk: number;
3
- start: number;
4
- rendered: number;
5
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,16 +0,0 @@
1
- import type { CloudProvider, compositionsHandler, infoHandler } from '@remotion/serverless';
2
- import type { ServerlessRoutines } from '@remotion/serverless/client';
3
- import type { launchHandler } from '../functions/launch';
4
- import type { progressHandler } from '../functions/progress';
5
- import type { rendererHandler } from '../functions/renderer';
6
- import type { startHandler } from '../functions/start';
7
- import type { stillHandler } from '../functions/still';
8
- export interface LambdaReturnValues<Provider extends CloudProvider> {
9
- [ServerlessRoutines.start]: ReturnType<typeof startHandler>;
10
- [ServerlessRoutines.launch]: ReturnType<typeof launchHandler>;
11
- [ServerlessRoutines.renderer]: ReturnType<typeof rendererHandler>;
12
- [ServerlessRoutines.status]: ReturnType<typeof progressHandler<Provider>>;
13
- [ServerlessRoutines.info]: ReturnType<typeof infoHandler<Provider>>;
14
- [ServerlessRoutines.still]: ReturnType<typeof stillHandler>;
15
- [ServerlessRoutines.compositions]: ReturnType<typeof compositionsHandler>;
16
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +0,0 @@
1
- export declare const stackback: (error: Error) => NodeJS.CallSite[];
2
- declare global {
3
- interface Error {
4
- _sb_callsites: NodeJS.CallSite[];
5
- }
6
- }
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stackback = void 0;
4
- function FormatStackTrace(error, frames) {
5
- const lines = [];
6
- try {
7
- lines.push(error.toString());
8
- }
9
- catch (e) {
10
- try {
11
- lines.push('<error: ' + e + '>');
12
- }
13
- catch (_a) {
14
- lines.push('<error>');
15
- }
16
- }
17
- for (let i = 0; i < frames.length; i++) {
18
- const frame = frames[i];
19
- let line;
20
- try {
21
- line = frame.toString();
22
- }
23
- catch (e) {
24
- try {
25
- line = '<error: ' + e + '>';
26
- }
27
- catch (_b) {
28
- // Any code that reaches this point is seriously nasty!
29
- line = '<error>';
30
- }
31
- }
32
- lines.push(' at ' + line);
33
- }
34
- return lines.join('\n');
35
- }
36
- const stackback = (error) => {
37
- // save original stacktrace
38
- const save = Error.prepareStackTrace;
39
- // replace capture with our function
40
- Error.prepareStackTrace = function (err, trace) {
41
- // cache stack frames so we don't have to get them again
42
- // use a non-enumerable property
43
- Object.defineProperty(err, '_sb_callsites', {
44
- value: trace,
45
- });
46
- return (save || FormatStackTrace)(err, trace);
47
- };
48
- // force capture of the stack frames
49
- // eslint-disable-next-line no-unused-expressions
50
- error.stack;
51
- // someone already asked for the stack so we can't do this trick
52
- if (!error._sb_callsites) {
53
- return [];
54
- }
55
- // return original capture function
56
- Error.prepareStackTrace = save;
57
- return error._sb_callsites;
58
- };
59
- exports.stackback = stackback;
@@ -1 +0,0 @@
1
- export declare const validateDownloadBehavior: (downloadBehavior: unknown) => null | undefined;
@@ -1,21 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateDownloadBehavior = void 0;
4
- const validateDownloadBehavior = (downloadBehavior) => {
5
- if (downloadBehavior === null || downloadBehavior === undefined) {
6
- return null;
7
- }
8
- if (typeof downloadBehavior !== 'object') {
9
- throw new Error('downloadBehavior must be null or an object');
10
- }
11
- const behavior = downloadBehavior;
12
- if (behavior.type !== 'download' && behavior.type !== 'play-in-browser') {
13
- throw new Error('Download behavior must be either "download" or "play-in-browser"');
14
- }
15
- if (behavior.type === 'download') {
16
- if (typeof behavior.fileName !== 'string' && behavior.fileName !== null) {
17
- throw new Error('If "downloadBehavior.type" is "download", then fileName must be "null" or a string');
18
- }
19
- }
20
- };
21
- exports.validateDownloadBehavior = validateDownloadBehavior;
@@ -1,4 +0,0 @@
1
- export declare const validateFramesPerLambda: ({ framesPerLambda, durationInFrames, }: {
2
- framesPerLambda: unknown;
3
- durationInFrames: number;
4
- }) => void;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateFramesPerLambda = void 0;
4
- const constants_1 = require("./constants");
5
- const validateFramesPerLambda = ({ framesPerLambda, durationInFrames, }) => {
6
- if (framesPerLambda === null) {
7
- return;
8
- }
9
- if (framesPerLambda === undefined) {
10
- return;
11
- }
12
- if (typeof framesPerLambda !== 'number') {
13
- throw new TypeError(`'framesPerLambda' needs to be a number, passed ${JSON.stringify(framesPerLambda)}`);
14
- }
15
- if (!Number.isFinite(framesPerLambda)) {
16
- throw new TypeError(`'framesPerLambda' needs to be finite, passed ${framesPerLambda}`);
17
- }
18
- if (Number.isNaN(framesPerLambda)) {
19
- throw new TypeError(`'framesPerLambda' needs to be NaN, passed ${framesPerLambda}`);
20
- }
21
- if (framesPerLambda % 1 !== 0) {
22
- throw new TypeError(`'framesPerLambda' needs to be an integer, passed ${framesPerLambda}`);
23
- }
24
- const effectiveMinimum = Math.min(constants_1.MINIMUM_FRAMES_PER_LAMBDA, durationInFrames);
25
- if (framesPerLambda < effectiveMinimum) {
26
- throw new TypeError(`The framesPerLambda needs to be at least ${effectiveMinimum}, but is ${framesPerLambda}`);
27
- }
28
- };
29
- exports.validateFramesPerLambda = validateFramesPerLambda;
@@ -1,2 +0,0 @@
1
- import type { Privacy } from '@remotion/serverless/client';
2
- export declare function validatePrivacy(privacy: unknown, allowPrivate: boolean): asserts privacy is Privacy;
@@ -1,14 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validatePrivacy = validatePrivacy;
4
- function validatePrivacy(privacy, allowPrivate) {
5
- if (typeof privacy !== 'string') {
6
- throw new TypeError('Privacy must be a string');
7
- }
8
- if (!allowPrivate && privacy === 'private') {
9
- throw new TypeError('Privacy must be either "public" or "no-acl"');
10
- }
11
- if (privacy !== 'private' && privacy !== 'public' && privacy !== 'no-acl') {
12
- throw new TypeError('Privacy must be either "private", "public" or "no-acl"');
13
- }
14
- }
@@ -1,4 +0,0 @@
1
- import { NoReactInternals } from 'remotion/no-react';
2
- export declare const validateFps: typeof NoReactInternals.validateFps;
3
- export declare const validateDimension: typeof NoReactInternals.validateDimension;
4
- export declare const validateDurationInFrames: typeof NoReactInternals.validateDurationInFrames;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateDurationInFrames = exports.validateDimension = exports.validateFps = void 0;
4
- /* eslint-disable prefer-destructuring */
5
- const no_react_1 = require("remotion/no-react");
6
- exports.validateFps = no_react_1.NoReactInternals.validateFps;
7
- exports.validateDimension = no_react_1.NoReactInternals.validateDimension;
8
- exports.validateDurationInFrames = no_react_1.NoReactInternals.validateDurationInFrames;
@@ -1,15 +0,0 @@
1
- import asyncHooks from 'async_hooks';
2
- type Resource = {
3
- type: string;
4
- stacks: NodeJS.CallSite[];
5
- resource: {
6
- hasRef?: () => boolean;
7
- };
8
- };
9
- export type NodeIntrospection = {
10
- hook: asyncHooks.AsyncHook | null;
11
- active: Map<number, Resource>;
12
- };
13
- export declare const enableNodeIntrospection: (enabled: boolean) => NodeIntrospection;
14
- export declare function whyIsNodeRunning({ active, hook }: NodeIntrospection): void;
15
- export {};
@@ -1,88 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.enableNodeIntrospection = void 0;
7
- exports.whyIsNodeRunning = whyIsNodeRunning;
8
- const async_hooks_1 = __importDefault(require("async_hooks"));
9
- const fs_1 = __importDefault(require("fs"));
10
- const path_1 = require("path");
11
- const stackback_1 = require("./stackback");
12
- const enableNodeIntrospection = (enabled) => {
13
- const active = new Map();
14
- if (!enabled) {
15
- return {
16
- active,
17
- hook: null,
18
- };
19
- }
20
- const hook = async_hooks_1.default.createHook({
21
- init(asyncId, type, _triggerAsyncId, resource) {
22
- if (type === 'TIMERWRAP' || type === 'PROMISE')
23
- return;
24
- if (type === 'PerformanceObserver' || type === 'RANDOMBYTESREQUEST')
25
- return;
26
- const err = new Error('whatevs');
27
- const stacks = (0, stackback_1.stackback)(err);
28
- active.set(asyncId, { type, stacks, resource });
29
- },
30
- destroy(asyncId) {
31
- active.delete(asyncId);
32
- },
33
- });
34
- hook.enable();
35
- return { hook, active };
36
- };
37
- exports.enableNodeIntrospection = enableNodeIntrospection;
38
- function whyIsNodeRunning({ active, hook }) {
39
- if (!hook) {
40
- return;
41
- }
42
- hook.disable();
43
- const activeResources = [...active.values()].filter((r) => {
44
- if (typeof r.resource.hasRef === 'function' && !r.resource.hasRef())
45
- return false;
46
- return true;
47
- });
48
- console.error('There are %d handle(s) keeping the process running', activeResources.length);
49
- function printStacks(o) {
50
- const stacks = o.stacks.slice(1).filter((s) => {
51
- const filename = s.getFileName();
52
- return (filename &&
53
- filename.indexOf(path_1.sep) > -1 &&
54
- filename.indexOf('internal' + path_1.sep) !== 0);
55
- });
56
- console.error('');
57
- console.error('# %s', o.type);
58
- if (stacks[0]) {
59
- let padding = '';
60
- stacks.forEach((s) => {
61
- const pad = (s.getFileName() + ':' + s.getLineNumber()).replace(/./g, ' ');
62
- if (pad.length > padding.length)
63
- padding = pad;
64
- });
65
- stacks.forEach((s) => {
66
- const prefix = s.getFileName() + ':' + s.getLineNumber();
67
- try {
68
- const src = fs_1.default
69
- .readFileSync(s.getFileName(), 'utf-8')
70
- .split(/\n|\r\n/);
71
- console.error(prefix +
72
- padding.slice(prefix.length) +
73
- ' - ' +
74
- src[s.getLineNumber() - 1].trim());
75
- }
76
- catch (_a) {
77
- console.error(prefix + padding.slice(prefix.length));
78
- }
79
- });
80
- }
81
- else {
82
- console.error('(unknown stack trace)');
83
- }
84
- }
85
- for (const o of activeResources) {
86
- printStacks(o);
87
- }
88
- }
package/vitest.config.mts DELETED
@@ -1,11 +0,0 @@
1
- import {defineConfig} from 'vitest/config';
2
-
3
- export default defineConfig({
4
- test: {
5
- setupFiles: ['./src/test/setup.ts'],
6
- maxConcurrency: 1,
7
- testTimeout: 90000,
8
- maxThreads: 1,
9
- minThreads: 1,
10
- },
11
- });