@remotion/lambda 4.0.187 → 4.0.189
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/api/__mocks__/clean-items.d.ts +2 -0
- package/dist/api/__mocks__/clean-items.js +24 -0
- package/dist/api/__mocks__/create-function.d.ts +2 -0
- package/dist/api/__mocks__/create-function.js +21 -0
- package/dist/api/__mocks__/delete-function.d.ts +2 -0
- package/dist/api/__mocks__/delete-function.js +9 -0
- package/dist/api/__mocks__/get-functions.d.ts +2 -0
- package/dist/api/__mocks__/get-functions.js +9 -0
- package/dist/api/__mocks__/upload-dir.d.ts +3 -0
- package/dist/api/__mocks__/upload-dir.js +47 -0
- package/dist/api/bucket-exists.d.ts +3 -6
- package/dist/api/bucket-exists.js +5 -5
- package/dist/api/clean-items.d.ts +4 -3
- package/dist/api/clean-items.js +7 -7
- package/dist/api/create-bucket.d.ts +3 -5
- package/dist/api/create-bucket.js +6 -6
- package/dist/api/create-function.d.ts +1 -1
- package/dist/api/delete-function.d.ts +1 -1
- package/dist/api/delete-render.d.ts +10 -3
- package/dist/api/delete-render.js +27 -19
- package/dist/api/delete-site.d.ts +7 -2
- package/dist/api/delete-site.js +23 -15
- package/dist/api/deploy-function.d.ts +1 -1
- package/dist/api/deploy-function.js +2 -2
- package/dist/api/deploy-site.d.ts +9 -5
- package/dist/api/deploy-site.js +11 -12
- package/dist/api/download-media.d.ts +8 -3
- package/dist/api/download-media.js +24 -15
- package/dist/api/estimate-price.d.ts +1 -1
- package/dist/api/get-aws-client.d.ts +4 -2
- package/dist/api/get-aws-client.js +2 -2
- package/dist/api/get-buckets.d.ts +4 -4
- package/dist/api/get-buckets.js +12 -14
- package/dist/api/get-compositions-on-lambda.js +7 -6
- package/dist/api/get-function-info.d.ts +1 -1
- package/dist/api/get-functions.d.ts +1 -1
- package/dist/api/get-or-create-bucket.d.ts +3 -19
- package/dist/api/get-or-create-bucket.js +5 -39
- package/dist/api/get-regions.d.ts +1 -1
- package/dist/api/get-regions.js +1 -2
- package/dist/api/get-render-progress.d.ts +4 -3
- package/dist/api/get-render-progress.js +2 -2
- package/dist/api/get-sites.d.ts +6 -1
- package/dist/api/get-sites.js +21 -14
- package/dist/api/iam-validation/role-permissions.js +2 -1
- package/dist/api/iam-validation/simulate-rule.d.ts +1 -1
- package/dist/api/iam-validation/simulate.d.ts +1 -1
- package/dist/api/iam-validation/user-permissions.js +2 -1
- package/dist/api/make-lambda-payload.d.ts +8 -9
- package/dist/api/make-lambda-payload.js +17 -14
- package/dist/api/mock-functions.d.ts +1 -1
- package/dist/api/presign-url.d.ts +1 -1
- package/dist/api/presign-url.js +4 -4
- package/dist/api/render-media-on-lambda.d.ts +5 -6
- package/dist/api/render-media-on-lambda.js +5 -5
- package/dist/api/render-still-on-lambda.d.ts +8 -6
- package/dist/api/render-still-on-lambda.js +6 -5
- package/dist/api/upload-dir.d.ts +2 -2
- package/dist/api/upload-dir.js +2 -2
- package/dist/cli/args.d.ts +2 -3
- package/dist/cli/commands/render/progress.d.ts +2 -2
- package/dist/cli/commands/render/progress.js +6 -5
- package/dist/cli/commands/render/render.d.ts +3 -1
- package/dist/cli/commands/render/render.js +3 -2
- package/dist/cli/commands/sites/create.d.ts +3 -1
- package/dist/cli/commands/sites/create.js +6 -5
- package/dist/cli/commands/sites/index.d.ts +3 -1
- package/dist/cli/commands/sites/index.js +4 -4
- package/dist/cli/commands/sites/rm.d.ts +3 -1
- package/dist/cli/commands/sites/rm.js +4 -3
- package/dist/cli/commands/sites/rmall.d.ts +3 -1
- package/dist/cli/commands/sites/rmall.js +4 -3
- package/dist/cli/commands/still.d.ts +3 -1
- package/dist/cli/commands/still.js +3 -2
- package/dist/cli/get-aws-region.d.ts +1 -1
- package/dist/cli/helpers/__mocks__/quit.d.ts +1 -0
- package/dist/cli/helpers/__mocks__/quit.js +7 -0
- package/dist/cli/index.d.ts +3 -1
- package/dist/cli/index.js +8 -7
- package/dist/client.d.ts +4 -5
- package/dist/functions/aws-implementation.d.ts +11 -0
- package/dist/functions/aws-implementation.js +49 -0
- package/dist/functions/chunk-optimization/plan-frame-ranges.d.ts +4 -1
- package/dist/functions/compositions.d.ts +3 -2
- package/dist/functions/compositions.js +18 -15
- package/dist/functions/helpers/__mocks__/get-browser-instance.d.ts +3 -0
- package/dist/functions/helpers/__mocks__/get-browser-instance.js +12 -0
- package/dist/functions/helpers/__mocks__/leak-detection.d.ts +4 -0
- package/dist/functions/helpers/__mocks__/leak-detection.js +9 -0
- package/dist/functions/helpers/__mocks__/timer.d.ts +2 -0
- package/dist/functions/helpers/__mocks__/timer.js +10 -0
- package/dist/functions/helpers/calculate-price-from-bucket.d.ts +5 -3
- package/dist/functions/helpers/calculate-price-from-bucket.js +2 -3
- package/dist/functions/helpers/cleanup-props.d.ts +4 -2
- package/dist/functions/helpers/cleanup-props.js +5 -4
- package/dist/functions/helpers/concat-videos.d.ts +2 -2
- package/dist/functions/helpers/create-post-render-data.d.ts +8 -8
- package/dist/functions/helpers/create-post-render-data.js +1 -1
- package/dist/functions/helpers/expected-out-name.d.ts +4 -4
- package/dist/functions/helpers/find-output-file-in-bucket.d.ts +8 -7
- package/dist/functions/helpers/find-output-file-in-bucket.js +5 -6
- package/dist/functions/helpers/get-browser-instance.d.ts +3 -2
- package/dist/functions/helpers/get-browser-instance.js +3 -4
- package/dist/functions/helpers/get-current-region.d.ts +1 -1
- package/dist/functions/helpers/get-current-region.js +3 -3
- package/dist/functions/helpers/get-custom-out-name.d.ts +5 -5
- package/dist/functions/helpers/get-folder-files.d.ts +2 -0
- package/dist/functions/helpers/get-folder-files.js +38 -0
- package/dist/functions/helpers/get-output-url-from-metadata.d.ts +4 -3
- package/dist/functions/helpers/get-output-url-from-metadata.js +4 -5
- package/dist/functions/helpers/get-overall-progress-s3.d.ts +5 -4
- package/dist/functions/helpers/get-overall-progress-s3.js +5 -7
- package/dist/functions/helpers/get-progress.d.ts +8 -7
- package/dist/functions/helpers/get-progress.js +7 -5
- package/dist/functions/helpers/inspect-errors.d.ts +1 -1
- package/dist/functions/helpers/inspect-errors.js +4 -4
- package/dist/functions/helpers/io.d.ts +3 -36
- package/dist/functions/helpers/io.js +3 -104
- package/dist/functions/helpers/lifecycle.d.ts +3 -9
- package/dist/functions/helpers/lifecycle.js +6 -16
- package/dist/functions/helpers/make-aws-artifact.d.ts +3 -0
- package/dist/functions/helpers/make-aws-artifact.js +12 -0
- package/dist/functions/helpers/make-timeout-error.d.ts +5 -4
- package/dist/functions/helpers/make-timeout-error.js +2 -1
- package/dist/functions/helpers/make-timeout-message.d.ts +5 -3
- package/dist/functions/helpers/make-timeout-message.js +8 -9
- package/dist/functions/helpers/merge-chunks.d.ts +10 -10
- package/dist/functions/helpers/merge-chunks.js +7 -8
- package/dist/functions/helpers/overall-render-progress.d.ts +18 -23
- package/dist/functions/helpers/overall-render-progress.js +5 -5
- package/dist/functions/helpers/print-cloudwatch-helper.d.ts +2 -2
- package/dist/functions/helpers/print-logging-helper.d.ts +4 -0
- package/dist/functions/helpers/print-logging-helper.js +12 -0
- package/dist/functions/helpers/read-with-progress.d.ts +4 -3
- package/dist/functions/helpers/read-with-progress.js +2 -2
- package/dist/functions/helpers/render-has-audio-video.d.ts +3 -2
- package/dist/functions/helpers/stream-renderer.d.ts +7 -4
- package/dist/functions/helpers/stream-renderer.js +11 -10
- package/dist/functions/helpers/streamify-response.d.ts +0 -20
- package/dist/functions/helpers/streamify-response.js +1 -62
- package/dist/functions/helpers/validate-composition.d.ts +5 -3
- package/dist/functions/helpers/validate-composition.js +2 -3
- package/dist/functions/index.d.ts +5 -3
- package/dist/functions/index.js +98 -72
- package/dist/functions/info.d.ts +1 -1
- package/dist/functions/info.js +2 -2
- package/dist/functions/launch.d.ts +3 -2
- package/dist/functions/launch.js +55 -41
- package/dist/functions/progress.d.ts +6 -3
- package/dist/functions/progress.js +5 -4
- package/dist/functions/provider-implementation.d.ts +0 -0
- package/dist/functions/provider-implementation.js +1 -0
- package/dist/functions/renderer.d.ts +9 -3
- package/dist/functions/renderer.js +41 -22
- package/dist/functions/start.d.ts +3 -2
- package/dist/functions/start.js +13 -16
- package/dist/functions/still.d.ts +8 -18
- package/dist/functions/still.js +48 -46
- package/dist/index.d.ts +6 -7
- package/dist/internals.d.ts +18 -14
- package/dist/io/delete-file.d.ts +3 -0
- package/dist/io/delete-file.js +12 -0
- package/dist/io/head-file.d.ts +3 -0
- package/dist/io/head-file.js +13 -0
- package/dist/io/list-objects.d.ts +3 -0
- package/dist/io/list-objects.js +58 -0
- package/dist/io/read-file.d.ts +9 -0
- package/dist/io/read-file.js +14 -0
- package/dist/io/write-file.d.ts +5 -0
- package/dist/io/write-file.js +51 -0
- package/dist/pricing/aws-regions.d.ts +0 -3
- package/dist/pricing/aws-regions.js +0 -44
- package/dist/pricing/price-per-1-s.d.ts +1 -1
- package/dist/regions.d.ts +3 -2
- package/dist/regions.js +43 -3
- package/dist/shared/__mocks__/aws-clients.d.ts +2 -0
- package/dist/shared/__mocks__/aws-clients.js +62 -0
- package/dist/shared/__mocks__/bundle-site.d.ts +2 -0
- package/dist/shared/__mocks__/bundle-site.js +32 -0
- package/dist/shared/__mocks__/check-credentials.d.ts +1 -0
- package/dist/shared/__mocks__/check-credentials.js +5 -0
- package/dist/shared/__mocks__/get-account-id.d.ts +2 -0
- package/dist/shared/__mocks__/get-account-id.js +11 -0
- package/dist/shared/__mocks__/read-dir.d.ts +2 -0
- package/dist/shared/__mocks__/read-dir.js +13 -0
- package/dist/shared/aws-clients.d.ts +6 -29
- package/dist/shared/aws-clients.js +7 -177
- package/dist/shared/call-lambda.d.ts +8 -9
- package/dist/shared/call-lambda.js +16 -3
- package/dist/shared/check-credentials.js +2 -2
- package/dist/shared/cleanup-serialized-input-props.d.ts +8 -6
- package/dist/shared/cleanup-serialized-input-props.js +7 -8
- package/dist/shared/compress-props.d.ts +8 -6
- package/dist/shared/compress-props.js +11 -14
- package/dist/shared/constants.d.ts +10 -288
- package/dist/shared/constants.js +1 -46
- package/dist/shared/content-disposition-header.d.ts +1 -6
- package/dist/shared/content-disposition-header.js +2 -2
- package/dist/shared/convert-to-serve-url.d.ts +2 -2
- package/dist/shared/convert-to-serve-url.js +3 -3
- package/dist/shared/get-account-id.d.ts +1 -1
- package/dist/shared/get-aws-urls.d.ts +2 -2
- package/dist/shared/get-credentials.d.ts +9 -0
- package/dist/shared/get-credentials.js +53 -0
- package/dist/shared/get-function-version.d.ts +1 -1
- package/dist/shared/get-function-version.js +2 -1
- package/dist/shared/get-s3-client.d.ts +5 -0
- package/dist/shared/get-s3-client.js +13 -0
- package/dist/shared/get-service-client.d.ts +22 -0
- package/dist/shared/get-service-client.js +117 -0
- package/dist/shared/hosted-layers.d.ts +1 -1
- package/dist/shared/invoke-webhook.d.ts +1 -1
- package/dist/shared/lambda-insights-extensions.d.ts +1 -1
- package/dist/shared/lifecycle-rules.d.ts +4 -3
- package/dist/shared/lifecycle-rules.js +3 -3
- package/dist/shared/make-s3-url.d.ts +1 -1
- package/dist/shared/random-hash.d.ts +1 -3
- package/dist/shared/random-hash.js +3 -4
- package/dist/shared/return-values.d.ts +10 -11
- package/dist/shared/validate-aws-region.d.ts +1 -1
- package/dist/shared/validate-aws-region.js +3 -3
- package/dist/shared/validate-bucketname.d.ts +0 -4
- package/dist/shared/validate-bucketname.js +3 -23
- package/dist/shared/validate-lambda-codec.d.ts +2 -4
- package/dist/shared/validate-lambda-codec.js +3 -13
- package/dist/shared/validate-outname.js +2 -2
- package/dist/shared/validate-privacy.d.ts +1 -1
- package/dist/shared/validate-webhook.d.ts +1 -1
- package/package.json +11 -9
- 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.
|
|
4
|
-
const
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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,
|
|
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 '
|
|
2
|
-
import type {
|
|
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
|
|
4
|
+
type Options<T extends ServerlessRoutines, Provider extends CloudProvider> = {
|
|
6
5
|
functionName: string;
|
|
7
6
|
type: T;
|
|
8
|
-
payload: Omit<
|
|
9
|
-
region:
|
|
7
|
+
payload: Omit<ServerlessPayloads<Provider>[T], 'type'>;
|
|
8
|
+
region: Provider['region'];
|
|
10
9
|
timeoutInTest: number;
|
|
11
10
|
};
|
|
12
|
-
export declare const callLambda: <T extends
|
|
13
|
-
export declare const callLambdaWithStreaming: <T extends
|
|
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,
|
|
99
|
-
const innerPayload =
|
|
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(
|
|
17
|
+
.filter(client_1.truthy)
|
|
18
18
|
.join('\n');
|
|
19
19
|
};
|
|
20
20
|
const checkCredentials = () => {
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
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:
|
|
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:
|
|
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
|
|
5
|
-
const
|
|
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
|
|
10
|
+
await providerSpecifics.deleteFile({
|
|
12
11
|
bucketName: serialized.bucketName,
|
|
13
|
-
key: (0,
|
|
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
|
|
24
|
+
await providerSpecifics.deleteFile({
|
|
26
25
|
bucketName: serialized.bucketName,
|
|
27
|
-
key: (0,
|
|
26
|
+
key: (0, client_1.resolvedPropsKey)(serialized.hash),
|
|
28
27
|
region,
|
|
29
28
|
customCredentials: null,
|
|
30
29
|
});
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
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:
|
|
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:
|
|
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,
|
|
9
|
+
return (0, client_1.inputPropsKey)(hash);
|
|
14
10
|
}
|
|
15
|
-
return (0,
|
|
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 =
|
|
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,
|
|
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
|
|
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
|
|
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,
|
|
80
|
+
const body = await (0, client_1.streamToString)(response);
|
|
84
81
|
const payload = body;
|
|
85
82
|
return payload;
|
|
86
83
|
}
|