@remotion/lambda 4.0.187 → 4.0.188

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 (230) hide show
  1. package/dist/api/__mocks__/clean-items.d.ts +2 -0
  2. package/dist/api/__mocks__/clean-items.js +24 -0
  3. package/dist/api/__mocks__/create-function.d.ts +2 -0
  4. package/dist/api/__mocks__/create-function.js +21 -0
  5. package/dist/api/__mocks__/delete-function.d.ts +2 -0
  6. package/dist/api/__mocks__/delete-function.js +9 -0
  7. package/dist/api/__mocks__/get-functions.d.ts +2 -0
  8. package/dist/api/__mocks__/get-functions.js +9 -0
  9. package/dist/api/__mocks__/upload-dir.d.ts +3 -0
  10. package/dist/api/__mocks__/upload-dir.js +47 -0
  11. package/dist/api/bucket-exists.d.ts +3 -6
  12. package/dist/api/bucket-exists.js +5 -5
  13. package/dist/api/clean-items.d.ts +4 -3
  14. package/dist/api/clean-items.js +7 -7
  15. package/dist/api/create-bucket.d.ts +3 -5
  16. package/dist/api/create-bucket.js +6 -6
  17. package/dist/api/create-function.d.ts +1 -1
  18. package/dist/api/delete-function.d.ts +1 -1
  19. package/dist/api/delete-render.d.ts +10 -3
  20. package/dist/api/delete-render.js +27 -19
  21. package/dist/api/delete-site.d.ts +7 -2
  22. package/dist/api/delete-site.js +23 -15
  23. package/dist/api/deploy-function.d.ts +1 -1
  24. package/dist/api/deploy-function.js +2 -2
  25. package/dist/api/deploy-site.d.ts +9 -5
  26. package/dist/api/deploy-site.js +11 -12
  27. package/dist/api/download-media.d.ts +8 -3
  28. package/dist/api/download-media.js +24 -15
  29. package/dist/api/estimate-price.d.ts +1 -1
  30. package/dist/api/get-aws-client.d.ts +4 -2
  31. package/dist/api/get-aws-client.js +2 -2
  32. package/dist/api/get-buckets.d.ts +4 -4
  33. package/dist/api/get-buckets.js +12 -14
  34. package/dist/api/get-compositions-on-lambda.js +7 -6
  35. package/dist/api/get-function-info.d.ts +1 -1
  36. package/dist/api/get-functions.d.ts +1 -1
  37. package/dist/api/get-or-create-bucket.d.ts +3 -19
  38. package/dist/api/get-or-create-bucket.js +5 -39
  39. package/dist/api/get-regions.d.ts +1 -1
  40. package/dist/api/get-regions.js +1 -2
  41. package/dist/api/get-render-progress.d.ts +4 -3
  42. package/dist/api/get-render-progress.js +2 -2
  43. package/dist/api/get-sites.d.ts +6 -1
  44. package/dist/api/get-sites.js +21 -14
  45. package/dist/api/iam-validation/role-permissions.js +2 -1
  46. package/dist/api/iam-validation/simulate-rule.d.ts +1 -1
  47. package/dist/api/iam-validation/simulate.d.ts +1 -1
  48. package/dist/api/iam-validation/user-permissions.js +2 -1
  49. package/dist/api/make-lambda-payload.d.ts +8 -9
  50. package/dist/api/make-lambda-payload.js +15 -13
  51. package/dist/api/mock-functions.d.ts +1 -1
  52. package/dist/api/presign-url.d.ts +1 -1
  53. package/dist/api/presign-url.js +4 -4
  54. package/dist/api/render-media-on-lambda.d.ts +5 -6
  55. package/dist/api/render-media-on-lambda.js +5 -5
  56. package/dist/api/render-still-on-lambda.d.ts +8 -6
  57. package/dist/api/render-still-on-lambda.js +6 -5
  58. package/dist/api/upload-dir.d.ts +2 -2
  59. package/dist/api/upload-dir.js +2 -2
  60. package/dist/cli/args.d.ts +2 -3
  61. package/dist/cli/commands/render/progress.d.ts +2 -2
  62. package/dist/cli/commands/render/progress.js +6 -5
  63. package/dist/cli/commands/render/render.d.ts +3 -1
  64. package/dist/cli/commands/render/render.js +3 -2
  65. package/dist/cli/commands/sites/create.d.ts +3 -1
  66. package/dist/cli/commands/sites/create.js +6 -5
  67. package/dist/cli/commands/sites/index.d.ts +3 -1
  68. package/dist/cli/commands/sites/index.js +4 -4
  69. package/dist/cli/commands/sites/rm.d.ts +3 -1
  70. package/dist/cli/commands/sites/rm.js +4 -3
  71. package/dist/cli/commands/sites/rmall.d.ts +3 -1
  72. package/dist/cli/commands/sites/rmall.js +4 -3
  73. package/dist/cli/commands/still.d.ts +3 -1
  74. package/dist/cli/commands/still.js +3 -2
  75. package/dist/cli/get-aws-region.d.ts +1 -1
  76. package/dist/cli/helpers/__mocks__/quit.d.ts +1 -0
  77. package/dist/cli/helpers/__mocks__/quit.js +7 -0
  78. package/dist/cli/index.d.ts +3 -1
  79. package/dist/cli/index.js +8 -7
  80. package/dist/client.d.ts +4 -5
  81. package/dist/functions/aws-implementation.d.ts +11 -0
  82. package/dist/functions/aws-implementation.js +49 -0
  83. package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
  84. package/dist/functions/compositions.d.ts +3 -2
  85. package/dist/functions/compositions.js +18 -15
  86. package/dist/functions/helpers/__mocks__/get-browser-instance.d.ts +3 -0
  87. package/dist/functions/helpers/__mocks__/get-browser-instance.js +12 -0
  88. package/dist/functions/helpers/__mocks__/leak-detection.d.ts +4 -0
  89. package/dist/functions/helpers/__mocks__/leak-detection.js +9 -0
  90. package/dist/functions/helpers/__mocks__/timer.d.ts +2 -0
  91. package/dist/functions/helpers/__mocks__/timer.js +10 -0
  92. package/dist/functions/helpers/calculate-price-from-bucket.d.ts +5 -3
  93. package/dist/functions/helpers/calculate-price-from-bucket.js +2 -3
  94. package/dist/functions/helpers/cleanup-props.d.ts +4 -2
  95. package/dist/functions/helpers/cleanup-props.js +5 -4
  96. package/dist/functions/helpers/concat-videos.d.ts +2 -2
  97. package/dist/functions/helpers/create-post-render-data.d.ts +8 -8
  98. package/dist/functions/helpers/create-post-render-data.js +1 -1
  99. package/dist/functions/helpers/expected-out-name.d.ts +4 -4
  100. package/dist/functions/helpers/find-output-file-in-bucket.d.ts +8 -7
  101. package/dist/functions/helpers/find-output-file-in-bucket.js +5 -6
  102. package/dist/functions/helpers/get-browser-instance.d.ts +3 -2
  103. package/dist/functions/helpers/get-browser-instance.js +3 -4
  104. package/dist/functions/helpers/get-current-region.d.ts +1 -1
  105. package/dist/functions/helpers/get-current-region.js +3 -3
  106. package/dist/functions/helpers/get-custom-out-name.d.ts +5 -5
  107. package/dist/functions/helpers/get-folder-files.d.ts +2 -0
  108. package/dist/functions/helpers/get-folder-files.js +38 -0
  109. package/dist/functions/helpers/get-output-url-from-metadata.d.ts +4 -3
  110. package/dist/functions/helpers/get-output-url-from-metadata.js +4 -5
  111. package/dist/functions/helpers/get-overall-progress-s3.d.ts +5 -4
  112. package/dist/functions/helpers/get-overall-progress-s3.js +5 -7
  113. package/dist/functions/helpers/get-progress.d.ts +8 -7
  114. package/dist/functions/helpers/get-progress.js +7 -5
  115. package/dist/functions/helpers/inspect-errors.d.ts +1 -1
  116. package/dist/functions/helpers/inspect-errors.js +4 -4
  117. package/dist/functions/helpers/io.d.ts +3 -36
  118. package/dist/functions/helpers/io.js +3 -104
  119. package/dist/functions/helpers/lifecycle.d.ts +3 -9
  120. package/dist/functions/helpers/lifecycle.js +6 -16
  121. package/dist/functions/helpers/make-aws-artifact.d.ts +3 -0
  122. package/dist/functions/helpers/make-aws-artifact.js +12 -0
  123. package/dist/functions/helpers/make-timeout-error.d.ts +5 -4
  124. package/dist/functions/helpers/make-timeout-error.js +2 -1
  125. package/dist/functions/helpers/make-timeout-message.d.ts +5 -3
  126. package/dist/functions/helpers/make-timeout-message.js +8 -9
  127. package/dist/functions/helpers/merge-chunks.d.ts +10 -10
  128. package/dist/functions/helpers/merge-chunks.js +7 -8
  129. package/dist/functions/helpers/overall-render-progress.d.ts +18 -23
  130. package/dist/functions/helpers/overall-render-progress.js +5 -5
  131. package/dist/functions/helpers/print-cloudwatch-helper.d.ts +2 -2
  132. package/dist/functions/helpers/print-logging-helper.d.ts +4 -0
  133. package/dist/functions/helpers/print-logging-helper.js +12 -0
  134. package/dist/functions/helpers/read-with-progress.d.ts +4 -3
  135. package/dist/functions/helpers/read-with-progress.js +2 -2
  136. package/dist/functions/helpers/render-has-audio-video.d.ts +3 -2
  137. package/dist/functions/helpers/stream-renderer.d.ts +7 -4
  138. package/dist/functions/helpers/stream-renderer.js +11 -10
  139. package/dist/functions/helpers/streamify-response.d.ts +0 -20
  140. package/dist/functions/helpers/streamify-response.js +1 -62
  141. package/dist/functions/helpers/validate-composition.d.ts +5 -3
  142. package/dist/functions/helpers/validate-composition.js +2 -3
  143. package/dist/functions/index.d.ts +5 -3
  144. package/dist/functions/index.js +98 -72
  145. package/dist/functions/info.d.ts +1 -1
  146. package/dist/functions/info.js +2 -2
  147. package/dist/functions/launch.d.ts +3 -2
  148. package/dist/functions/launch.js +54 -41
  149. package/dist/functions/progress.d.ts +6 -3
  150. package/dist/functions/progress.js +5 -4
  151. package/dist/functions/provider-implementation.d.ts +0 -0
  152. package/dist/functions/provider-implementation.js +1 -0
  153. package/dist/functions/renderer.d.ts +9 -3
  154. package/dist/functions/renderer.js +30 -22
  155. package/dist/functions/start.d.ts +3 -2
  156. package/dist/functions/start.js +13 -16
  157. package/dist/functions/still.d.ts +8 -18
  158. package/dist/functions/still.js +47 -46
  159. package/dist/index.d.ts +4 -6
  160. package/dist/internals.d.ts +16 -14
  161. package/dist/io/delete-file.d.ts +3 -0
  162. package/dist/io/delete-file.js +12 -0
  163. package/dist/io/head-file.d.ts +3 -0
  164. package/dist/io/head-file.js +13 -0
  165. package/dist/io/list-objects.d.ts +3 -0
  166. package/dist/io/list-objects.js +58 -0
  167. package/dist/io/read-file.d.ts +9 -0
  168. package/dist/io/read-file.js +14 -0
  169. package/dist/io/write-file.d.ts +5 -0
  170. package/dist/io/write-file.js +51 -0
  171. package/dist/pricing/aws-regions.d.ts +0 -3
  172. package/dist/pricing/aws-regions.js +0 -44
  173. package/dist/pricing/price-per-1-s.d.ts +1 -1
  174. package/dist/regions.d.ts +3 -2
  175. package/dist/regions.js +43 -3
  176. package/dist/shared/__mocks__/aws-clients.d.ts +2 -0
  177. package/dist/shared/__mocks__/aws-clients.js +62 -0
  178. package/dist/shared/__mocks__/bundle-site.d.ts +2 -0
  179. package/dist/shared/__mocks__/bundle-site.js +32 -0
  180. package/dist/shared/__mocks__/check-credentials.d.ts +1 -0
  181. package/dist/shared/__mocks__/check-credentials.js +5 -0
  182. package/dist/shared/__mocks__/get-account-id.d.ts +2 -0
  183. package/dist/shared/__mocks__/get-account-id.js +11 -0
  184. package/dist/shared/__mocks__/read-dir.d.ts +2 -0
  185. package/dist/shared/__mocks__/read-dir.js +13 -0
  186. package/dist/shared/aws-clients.d.ts +6 -29
  187. package/dist/shared/aws-clients.js +7 -177
  188. package/dist/shared/call-lambda.d.ts +8 -9
  189. package/dist/shared/call-lambda.js +16 -3
  190. package/dist/shared/check-credentials.js +2 -2
  191. package/dist/shared/cleanup-serialized-input-props.d.ts +8 -6
  192. package/dist/shared/cleanup-serialized-input-props.js +7 -8
  193. package/dist/shared/compress-props.d.ts +8 -6
  194. package/dist/shared/compress-props.js +11 -14
  195. package/dist/shared/constants.d.ts +10 -288
  196. package/dist/shared/constants.js +1 -46
  197. package/dist/shared/content-disposition-header.d.ts +1 -6
  198. package/dist/shared/content-disposition-header.js +2 -2
  199. package/dist/shared/convert-to-serve-url.d.ts +2 -2
  200. package/dist/shared/convert-to-serve-url.js +3 -3
  201. package/dist/shared/get-account-id.d.ts +1 -1
  202. package/dist/shared/get-aws-urls.d.ts +2 -2
  203. package/dist/shared/get-credentials.d.ts +9 -0
  204. package/dist/shared/get-credentials.js +53 -0
  205. package/dist/shared/get-function-version.d.ts +1 -1
  206. package/dist/shared/get-function-version.js +2 -1
  207. package/dist/shared/get-s3-client.d.ts +5 -0
  208. package/dist/shared/get-s3-client.js +13 -0
  209. package/dist/shared/get-service-client.d.ts +22 -0
  210. package/dist/shared/get-service-client.js +117 -0
  211. package/dist/shared/hosted-layers.d.ts +1 -1
  212. package/dist/shared/invoke-webhook.d.ts +1 -1
  213. package/dist/shared/lambda-insights-extensions.d.ts +1 -1
  214. package/dist/shared/lifecycle-rules.d.ts +4 -3
  215. package/dist/shared/lifecycle-rules.js +3 -3
  216. package/dist/shared/make-s3-url.d.ts +1 -1
  217. package/dist/shared/random-hash.d.ts +1 -3
  218. package/dist/shared/random-hash.js +3 -4
  219. package/dist/shared/return-values.d.ts +10 -11
  220. package/dist/shared/validate-aws-region.d.ts +1 -1
  221. package/dist/shared/validate-aws-region.js +3 -3
  222. package/dist/shared/validate-bucketname.d.ts +0 -4
  223. package/dist/shared/validate-bucketname.js +3 -23
  224. package/dist/shared/validate-lambda-codec.d.ts +2 -4
  225. package/dist/shared/validate-lambda-codec.js +3 -13
  226. package/dist/shared/validate-outname.js +2 -2
  227. package/dist/shared/validate-privacy.d.ts +1 -1
  228. package/dist/shared/validate-webhook.d.ts +1 -1
  229. package/package.json +11 -9
  230. package/remotionlambda-arm64.zip +0 -0
@@ -1,189 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getStsClient = exports.getServiceQuotasClient = exports.getIamClient = exports.getLambdaClient = exports.getS3Client = exports.getCloudWatchLogsClient = exports.getServiceClient = void 0;
4
- const client_cloudwatch_logs_1 = require("@aws-sdk/client-cloudwatch-logs");
5
- const client_iam_1 = require("@aws-sdk/client-iam");
6
- const client_lambda_1 = require("@aws-sdk/client-lambda");
7
- const client_s3_1 = require("@aws-sdk/client-s3");
8
- const client_service_quotas_1 = require("@aws-sdk/client-service-quotas");
9
- const client_sts_1 = require("@aws-sdk/client-sts");
10
- const credential_providers_1 = require("@aws-sdk/credential-providers");
11
- const no_react_1 = require("remotion/no-react");
12
- const check_credentials_1 = require("./check-credentials");
13
- const constants_1 = require("./constants");
14
- const is_in_lambda_1 = require("./is-in-lambda");
15
- const _clients = {};
16
- const getCredentials = () => {
17
- if ((0, is_in_lambda_1.isInsideLambda)()) {
18
- return undefined;
19
- }
20
- if (process.env.REMOTION_AWS_PROFILE) {
21
- return (0, credential_providers_1.fromIni)({
22
- profile: process.env.REMOTION_AWS_PROFILE,
23
- });
24
- }
25
- if (process.env.REMOTION_AWS_ACCESS_KEY_ID &&
26
- process.env.REMOTION_AWS_SECRET_ACCESS_KEY &&
27
- process.env.REMOTION_AWS_SESSION_TOKEN) {
28
- return {
29
- accessKeyId: process.env.REMOTION_AWS_ACCESS_KEY_ID,
30
- secretAccessKey: process.env.REMOTION_AWS_SECRET_ACCESS_KEY,
31
- sessionToken: process.env.REMOTION_AWS_SESSION_TOKEN,
32
- };
33
- }
34
- if (process.env.REMOTION_AWS_ACCESS_KEY_ID &&
35
- process.env.REMOTION_AWS_SECRET_ACCESS_KEY) {
36
- return {
37
- accessKeyId: process.env.REMOTION_AWS_ACCESS_KEY_ID,
38
- secretAccessKey: process.env.REMOTION_AWS_SECRET_ACCESS_KEY,
39
- };
40
- }
41
- if (process.env.AWS_PROFILE) {
42
- return (0, credential_providers_1.fromIni)({
43
- profile: process.env.AWS_PROFILE,
44
- });
45
- }
46
- if (process.env.AWS_ACCESS_KEY_ID &&
47
- process.env.AWS_SECRET_ACCESS_KEY &&
48
- process.env.AWS_SESSION_TOKEN) {
49
- return {
50
- accessKeyId: process.env.AWS_ACCESS_KEY_ID,
51
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
52
- sessionToken: process.env.AWS_SESSION_TOKEN,
53
- };
54
- }
55
- if (process.env.AWS_ACCESS_KEY_ID && process.env.AWS_SECRET_ACCESS_KEY) {
56
- return {
57
- accessKeyId: process.env.AWS_ACCESS_KEY_ID,
58
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
59
- };
60
- }
61
- return undefined;
62
- };
63
- const getCredentialsHash = ({ customCredentials, region, service, }) => {
64
- const hashComponents = {};
65
- if (process.env.REMOTION_SKIP_AWS_CREDENTIALS_CHECK) {
66
- hashComponents.credentials = {
67
- credentialsSkipped: true,
68
- };
69
- }
70
- else if (process.env.REMOTION_AWS_PROFILE) {
71
- hashComponents.credentials = {
72
- awsProfile: process.env.REMOTION_AWS_PROFILE,
73
- };
74
- }
75
- else if (process.env.REMOTION_AWS_ACCESS_KEY_ID &&
76
- process.env.REMOTION_AWS_SECRET_ACCESS_KEY) {
77
- hashComponents.credentials = {
78
- accessKeyId: process.env.REMOTION_AWS_ACCESS_KEY_ID,
79
- secretAccessKey: process.env.REMOTION_AWS_SECRET_ACCESS_KEY,
80
- };
81
- }
82
- else if (process.env.AWS_PROFILE) {
83
- hashComponents.credentials = {
84
- awsProfile: process.env.AWS_PROFILE,
85
- };
86
- }
87
- else if (process.env.AWS_ACCESS_KEY_ID &&
88
- process.env.AWS_SECRET_ACCESS_KEY) {
89
- hashComponents.credentials = {
90
- accessKeyId: process.env.AWS_ACCESS_KEY_ID,
91
- secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
92
- };
93
- }
94
- hashComponents.customCredentials = customCredentials;
95
- hashComponents.region = region;
96
- hashComponents.service = service;
97
- return (0, no_react_1.random)(JSON.stringify(hashComponents)).toString().replace('0.', '');
98
- };
99
- const getServiceClient = ({ region, service, customCredentials, }) => {
100
- var _a;
101
- const Client = (() => {
102
- if (service === 'cloudwatch') {
103
- return client_cloudwatch_logs_1.CloudWatchLogsClient;
104
- }
105
- if (service === 'lambda') {
106
- return client_lambda_1.LambdaClient;
107
- }
108
- if (service === 's3') {
109
- return client_s3_1.S3Client;
110
- }
111
- if (service === 'iam') {
112
- return client_iam_1.IAMClient;
113
- }
114
- if (service === 'servicequotas') {
115
- return client_service_quotas_1.ServiceQuotasClient;
116
- }
117
- if (service === 'sts') {
118
- return client_sts_1.STSClient;
119
- }
120
- throw new TypeError('unknown client ' + service);
121
- })();
122
- const key = getCredentialsHash({
123
- region,
124
- customCredentials,
125
- service,
126
- });
127
- if (!_clients[key]) {
128
- (0, check_credentials_1.checkCredentials)();
129
- const lambdaOptions = service === 'lambda'
130
- ? {
131
- httpsAgent: {
132
- maxSockets: constants_1.MAX_FUNCTIONS_PER_RENDER * 2,
133
- },
134
- }
135
- : undefined;
136
- const client = customCredentials
137
- ? new Client({
138
- region: (_a = customCredentials.region) !== null && _a !== void 0 ? _a : 'us-east-1',
139
- credentials: customCredentials.accessKeyId && customCredentials.secretAccessKey
140
- ? {
141
- accessKeyId: customCredentials.accessKeyId,
142
- secretAccessKey: customCredentials.secretAccessKey,
143
- }
144
- : undefined,
145
- endpoint: customCredentials.endpoint,
146
- requestHandler: lambdaOptions,
147
- })
148
- : process.env.REMOTION_SKIP_AWS_CREDENTIALS_CHECK
149
- ? new Client({
150
- region,
151
- requestHandler: lambdaOptions,
152
- })
153
- : new Client({
154
- region,
155
- credentials: getCredentials(),
156
- requestHandler: lambdaOptions,
157
- });
158
- if (process.env.REMOTION_DISABLE_AWS_CLIENT_CACHE) {
159
- return client;
160
- }
161
- _clients[key] = client;
162
- }
163
- return _clients[key];
164
- };
165
- exports.getServiceClient = getServiceClient;
3
+ exports.getStsClient = exports.getServiceQuotasClient = exports.getIamClient = exports.getLambdaClient = exports.getCloudWatchLogsClient = void 0;
4
+ const get_service_client_1 = require("./get-service-client");
166
5
  const getCloudWatchLogsClient = (region) => {
167
- return (0, exports.getServiceClient)({
6
+ return (0, get_service_client_1.getServiceClient)({
168
7
  region,
169
8
  service: 'cloudwatch',
170
9
  customCredentials: null,
171
10
  });
172
11
  };
173
12
  exports.getCloudWatchLogsClient = getCloudWatchLogsClient;
174
- const getS3Client = (region, customCredentials) => {
175
- var _a;
176
- return (0, exports.getServiceClient)({
177
- region: (_a = customCredentials === null || customCredentials === void 0 ? void 0 : customCredentials.region) !== null && _a !== void 0 ? _a : region,
178
- service: 's3',
179
- customCredentials,
180
- });
181
- };
182
- exports.getS3Client = getS3Client;
183
13
  const getLambdaClient = (region,
184
14
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
185
15
  _timeoutInTest) => {
186
- return (0, exports.getServiceClient)({
16
+ return (0, get_service_client_1.getServiceClient)({
187
17
  region,
188
18
  service: 'lambda',
189
19
  customCredentials: null,
@@ -191,11 +21,11 @@ _timeoutInTest) => {
191
21
  };
192
22
  exports.getLambdaClient = getLambdaClient;
193
23
  const getIamClient = (region) => {
194
- return (0, exports.getServiceClient)({ region, service: 'iam', customCredentials: null });
24
+ return (0, get_service_client_1.getServiceClient)({ region, service: 'iam', customCredentials: null });
195
25
  };
196
26
  exports.getIamClient = getIamClient;
197
27
  const getServiceQuotasClient = (region) => {
198
- return (0, exports.getServiceClient)({
28
+ return (0, get_service_client_1.getServiceClient)({
199
29
  region,
200
30
  service: 'servicequotas',
201
31
  customCredentials: null,
@@ -203,6 +33,6 @@ const getServiceQuotasClient = (region) => {
203
33
  };
204
34
  exports.getServiceQuotasClient = getServiceQuotasClient;
205
35
  const getStsClient = (region) => {
206
- return (0, exports.getServiceClient)({ region, service: 'sts', customCredentials: null });
36
+ return (0, get_service_client_1.getServiceClient)({ region, service: 'sts', customCredentials: null });
207
37
  };
208
38
  exports.getStsClient = getStsClient;
@@ -1,17 +1,16 @@
1
- import type { OnMessage } from '../functions/streaming/streaming';
2
- import type { AwsRegion } from '../pricing/aws-regions';
3
- import type { LambdaPayloads, LambdaRoutines } from './constants';
1
+ import type { CloudProvider, OnMessage } from '@remotion/serverless';
2
+ import type { ServerlessPayloads, ServerlessRoutines } from '@remotion/serverless/client';
4
3
  import type { LambdaReturnValues } from './return-values';
5
- type Options<T extends LambdaRoutines> = {
4
+ type Options<T extends ServerlessRoutines, Provider extends CloudProvider> = {
6
5
  functionName: string;
7
6
  type: T;
8
- payload: Omit<LambdaPayloads[T], 'type'>;
9
- region: AwsRegion;
7
+ payload: Omit<ServerlessPayloads<Provider>[T], 'type'>;
8
+ region: Provider['region'];
10
9
  timeoutInTest: number;
11
10
  };
12
- export declare const callLambda: <T extends LambdaRoutines>(options: Options<T>) => Promise<LambdaReturnValues[T]>;
13
- export declare const callLambdaWithStreaming: <T extends LambdaRoutines>(options: Options<T> & {
14
- receivedStreamingPayload: OnMessage;
11
+ export declare const callLambda: <Provider extends CloudProvider<string, Record<string, unknown>>, T extends ServerlessRoutines>(options: Options<T, Provider>) => Promise<LambdaReturnValues<Provider>[T]>;
12
+ export declare const callLambdaWithStreaming: <Provider extends CloudProvider<string, Record<string, unknown>>, T extends ServerlessRoutines>(options: Options<T, Provider> & {
13
+ receivedStreamingPayload: OnMessage<Provider>;
15
14
  retriesRemaining: number;
16
15
  }) => Promise<void>;
17
16
  export {};
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.callLambdaWithStreaming = exports.callLambda = void 0;
4
4
  const client_lambda_1 = require("@aws-sdk/client-lambda");
5
+ const client_1 = require("@remotion/serverless/client");
5
6
  const streaming_1 = require("@remotion/streaming");
6
- const streaming_2 = require("../functions/streaming/streaming");
7
7
  const aws_clients_1 = require("./aws-clients");
8
8
  const INVALID_JSON_MESSAGE = 'Cannot parse Lambda response as JSON';
9
9
  const parseJsonOrThrowSource = (data, type) => {
@@ -95,8 +95,8 @@ const callLambdaWithStreamingWithoutRetry = async ({ functionName, type, payload
95
95
  type,
96
96
  });
97
97
  const { onData, clear } = (0, streaming_1.makeStreamer)((status, messageTypeId, data) => {
98
- const messageType = (0, streaming_2.messageTypeIdToMessageType)(messageTypeId);
99
- const innerPayload = streaming_2.formatMap[messageType] === 'json'
98
+ const messageType = (0, client_1.messageTypeIdToMessageType)(messageTypeId);
99
+ const innerPayload = client_1.formatMap[messageType] === 'json'
100
100
  ? parseJsonOrThrowSource(data, messageType)
101
101
  : data;
102
102
  const message = {
@@ -108,6 +108,14 @@ const callLambdaWithStreamingWithoutRetry = async ({ functionName, type, payload
108
108
  };
109
109
  receivedStreamingPayload(message);
110
110
  });
111
+ const dumpBuffers = () => {
112
+ clear();
113
+ };
114
+ // @ts-expect-error - We are adding a listener to a global variable
115
+ if (globalThis._dumpUnreleasedBuffers) {
116
+ // @ts-expect-error - We are adding a listener to a global variable
117
+ globalThis._dumpUnreleasedBuffers.addListener('dump-unreleased-buffers', dumpBuffers);
118
+ }
111
119
  const events = res.EventStream;
112
120
  for await (const event of events) {
113
121
  // There are two types of events you can get on a stream.
@@ -127,5 +135,10 @@ const callLambdaWithStreamingWithoutRetry = async ({ functionName, type, payload
127
135
  }
128
136
  // Don't put a `break` statement here, as it will cause the socket to not properly exit.
129
137
  }
138
+ // @ts-expect-error - We are adding a listener to a global variable
139
+ if (globalThis._dumpUnreleasedBuffers) {
140
+ // @ts-expect-error - We are adding a listener to a global variable
141
+ globalThis._dumpUnreleasedBuffers.removeListener('dump-unreleased-buffers', dumpBuffers);
142
+ }
130
143
  clear();
131
144
  };
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkCredentials = void 0;
4
+ const client_1 = require("@remotion/serverless/client");
4
5
  const is_cli_1 = require("../cli/is-cli");
5
6
  const docs_url_1 = require("./docs-url");
6
7
  const is_likely_to_have_aws_profile_1 = require("./is-likely-to-have-aws-profile");
7
- const truthy_1 = require("./truthy");
8
8
  const messageForVariable = (variable) => {
9
9
  return [
10
10
  `You have tried to call a Remotion Lambda function, but have not set the environment variable ${variable}.`,
@@ -14,7 +14,7 @@ const messageForVariable = (variable) => {
14
14
  `- Please refer to the Remotion Lambda docs (${docs_url_1.DOCS_URL}/docs/lambda/setup) to see how to generate the credentials for your AWS account and then set the environment variables.`,
15
15
  `- For more reasons see the troubleshooting page: ${docs_url_1.DOCS_URL}/docs/lambda/troubleshooting/permissions`,
16
16
  ]
17
- .filter(truthy_1.truthy)
17
+ .filter(client_1.truthy)
18
18
  .join('\n');
19
19
  };
20
20
  const checkCredentials = () => {
@@ -1,10 +1,12 @@
1
- import type { AwsRegion } from '../client';
2
- import type { SerializedInputProps } from './constants';
3
- export declare const cleanupSerializedInputProps: ({ serialized, region, }: {
1
+ import type { CloudProvider, ProviderSpecifics } from '@remotion/serverless';
2
+ import { type SerializedInputProps } from '@remotion/serverless/client';
3
+ export declare const cleanupSerializedInputProps: <Provider extends CloudProvider<string, Record<string, unknown>>>({ serialized, region, providerSpecifics, }: {
4
4
  serialized: SerializedInputProps;
5
- region: AwsRegion;
5
+ region: Provider["region"];
6
+ providerSpecifics: ProviderSpecifics<Provider>;
6
7
  }) => Promise<number>;
7
- export declare const cleanupSerializedResolvedProps: ({ serialized, region, }: {
8
+ export declare const cleanupSerializedResolvedProps: <Provider extends CloudProvider<string, Record<string, unknown>>>({ serialized, region, providerSpecifics, }: {
8
9
  serialized: SerializedInputProps;
9
- region: AwsRegion;
10
+ region: Provider["region"];
11
+ providerSpecifics: ProviderSpecifics<Provider>;
10
12
  }) => Promise<number>;
@@ -1,30 +1,29 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cleanupSerializedResolvedProps = exports.cleanupSerializedInputProps = void 0;
4
- const io_1 = require("../functions/helpers/io");
5
- const constants_1 = require("./constants");
6
- const cleanupSerializedInputProps = async ({ serialized, region, }) => {
4
+ const client_1 = require("@remotion/serverless/client");
5
+ const cleanupSerializedInputProps = async ({ serialized, region, providerSpecifics, }) => {
7
6
  if (serialized.type === 'payload') {
8
7
  return 0;
9
8
  }
10
9
  const time = Date.now();
11
- await (0, io_1.lambdaDeleteFile)({
10
+ await providerSpecifics.deleteFile({
12
11
  bucketName: serialized.bucketName,
13
- key: (0, constants_1.inputPropsKey)(serialized.hash),
12
+ key: (0, client_1.inputPropsKey)(serialized.hash),
14
13
  region,
15
14
  customCredentials: null,
16
15
  });
17
16
  return Date.now() - time;
18
17
  };
19
18
  exports.cleanupSerializedInputProps = cleanupSerializedInputProps;
20
- const cleanupSerializedResolvedProps = async ({ serialized, region, }) => {
19
+ const cleanupSerializedResolvedProps = async ({ serialized, region, providerSpecifics, }) => {
21
20
  if (serialized.type === 'payload') {
22
21
  return 0;
23
22
  }
24
23
  const time = Date.now();
25
- await (0, io_1.lambdaDeleteFile)({
24
+ await providerSpecifics.deleteFile({
26
25
  bucketName: serialized.bucketName,
27
- key: (0, constants_1.resolvedPropsKey)(serialized.hash),
26
+ key: (0, client_1.resolvedPropsKey)(serialized.hash),
28
27
  region,
29
28
  customCredentials: null,
30
29
  });
@@ -1,20 +1,22 @@
1
- import type { AwsRegion } from '../client';
2
- import type { SerializedInputProps } from './constants';
1
+ import type { ProviderSpecifics } from '@remotion/serverless';
2
+ import { type SerializedInputProps } from '@remotion/serverless/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: ({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, }: {
6
+ export declare const compressInputProps: <Region extends string>({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, providerSpecifics, }: {
7
7
  stringifiedInputProps: string;
8
- region: AwsRegion;
8
+ region: Region;
9
9
  userSpecifiedBucketName: string | null;
10
10
  propsType: PropsType;
11
11
  needsToUpload: boolean;
12
+ providerSpecifics: ProviderSpecifics<Region>;
12
13
  }) => Promise<SerializedInputProps>;
13
- export declare const decompressInputProps: ({ serialized, region, bucketName, expectedBucketOwner, propsType, }: {
14
+ export declare const decompressInputProps: <Region extends string>({ serialized, region, bucketName, expectedBucketOwner, propsType, providerSpecifics, }: {
14
15
  serialized: SerializedInputProps;
15
- region: AwsRegion;
16
+ region: Region;
16
17
  bucketName: string;
17
18
  expectedBucketOwner: string;
18
19
  propsType: PropsType;
20
+ providerSpecifics: ProviderSpecifics<Region>;
19
21
  }) => Promise<string>;
20
22
  export {};
@@ -1,18 +1,14 @@
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");
4
5
  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");
10
6
  const validate_webhook_1 = require("./validate-webhook");
11
7
  const makeKey = (type, hash) => {
12
8
  if (type === 'input-props') {
13
- return (0, constants_1.inputPropsKey)(hash);
9
+ return (0, client_1.inputPropsKey)(hash);
14
10
  }
15
- return (0, constants_1.resolvedPropsKey)(hash);
11
+ return (0, client_1.resolvedPropsKey)(hash);
16
12
  };
17
13
  const serializeOrThrow = (inputProps, propsType) => {
18
14
  try {
@@ -39,15 +35,16 @@ const getNeedsToUpload = (type, sizes) => {
39
35
  return false;
40
36
  };
41
37
  exports.getNeedsToUpload = getNeedsToUpload;
42
- const compressInputProps = async ({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, }) => {
43
- const hash = (0, random_hash_1.randomHash)();
38
+ const compressInputProps = async ({ stringifiedInputProps, region, userSpecifiedBucketName, propsType, needsToUpload, providerSpecifics, }) => {
39
+ const hash = providerSpecifics.randomHash();
44
40
  if (needsToUpload) {
45
- const bucketName = userSpecifiedBucketName !== null && userSpecifiedBucketName !== void 0 ? userSpecifiedBucketName : (await (0, get_or_create_bucket_1.internalGetOrCreateBucket)({
41
+ const bucketName = userSpecifiedBucketName !== null && userSpecifiedBucketName !== void 0 ? userSpecifiedBucketName : (await (0, client_1.internalGetOrCreateBucket)({
46
42
  region,
47
43
  enableFolderExpiry: null,
48
44
  customCredentials: null,
45
+ providerSpecifics,
49
46
  })).bucketName;
50
- await (0, io_1.lambdaWriteFile)({
47
+ await providerSpecifics.writeFile({
51
48
  body: stringifiedInputProps,
52
49
  bucketName,
53
50
  region,
@@ -69,18 +66,18 @@ const compressInputProps = async ({ stringifiedInputProps, region, userSpecified
69
66
  };
70
67
  };
71
68
  exports.compressInputProps = compressInputProps;
72
- const decompressInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, propsType, }) => {
69
+ const decompressInputProps = async ({ serialized, region, bucketName, expectedBucketOwner, propsType, providerSpecifics, }) => {
73
70
  if (serialized.type === 'payload') {
74
71
  return serialized.payload;
75
72
  }
76
73
  try {
77
- const response = await (0, io_1.lambdaReadFile)({
74
+ const response = await providerSpecifics.readFile({
78
75
  bucketName,
79
76
  expectedBucketOwner,
80
77
  key: makeKey(propsType, serialized.hash),
81
78
  region,
82
79
  });
83
- const body = await (0, stream_to_string_1.streamToString)(response);
80
+ const body = await (0, client_1.streamToString)(response);
84
81
  const payload = body;
85
82
  return payload;
86
83
  }