@remotion/lambda-client 4.0.364 → 4.0.366
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/package.json +4 -4
- package/.turbo/turbo-formatting.log +0 -4
- package/.turbo/turbo-lint.log +0 -25
- package/.turbo/turbo-make.log +0 -3
- package/bundle.ts +0 -20
- package/dist/cjs/test/concurrency-payload.test.d.ts +0 -1
- package/dist/cjs/test/encode-aws-url.test.d.ts +0 -1
- package/dist/cjs/test/price-calculation.test.d.ts +0 -1
- package/dist/cjs/test/pricing.test.d.ts +0 -1
- package/dist/cjs/test/request-handler.test.d.ts +0 -1
- package/dist/cjs/test/validate-disk-size-in-mb.test.d.ts +0 -1
- package/dist/test/concurrency-payload.test.d.ts +0 -1
- package/dist/test/concurrency-payload.test.js +0 -119
- package/dist/test/encode-aws-url.test.d.ts +0 -1
- package/dist/test/encode-aws-url.test.js +0 -8
- package/dist/test/price-calculation.test.d.ts +0 -1
- package/dist/test/price-calculation.test.js +0 -62
- package/dist/test/pricing.test.d.ts +0 -1
- package/dist/test/pricing.test.js +0 -27
- package/dist/test/request-handler.test.d.ts +0 -1
- package/dist/test/request-handler.test.js +0 -36
- package/dist/test/validate-disk-size-in-mb.test.d.ts +0 -1
- package/dist/test/validate-disk-size-in-mb.test.js +0 -14
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/eslint.config.mjs +0 -5
- package/src/app-router-webhook.ts +0 -73
- package/src/apply-lifecycle.ts +0 -30
- package/src/aws-clients.ts +0 -75
- package/src/aws-provider.ts +0 -139
- package/src/bucket-exists.ts +0 -35
- package/src/call-lambda-async.ts +0 -43
- package/src/call-lambda-streaming.ts +0 -226
- package/src/call-lambda-sync.ts +0 -59
- package/src/check-credentials.ts +0 -51
- package/src/clean-items.ts +0 -50
- package/src/constants.ts +0 -38
- package/src/content-disposition-header.ts +0 -64
- package/src/convert-to-serve-url.ts +0 -24
- package/src/create-bucket.ts +0 -87
- package/src/delete-file.ts +0 -38
- package/src/delete-function.ts +0 -28
- package/src/delete-render.ts +0 -114
- package/src/encode-aws-url-params.ts +0 -3
- package/src/estimate-price.ts +0 -95
- package/src/express-webhook.ts +0 -57
- package/src/get-account-id.ts +0 -22
- package/src/get-aws-client.ts +0 -63
- package/src/get-aws-urls.ts +0 -85
- package/src/get-buckets.ts +0 -84
- package/src/get-compositions-on-lambda.ts +0 -111
- package/src/get-credentials.ts +0 -81
- package/src/get-env-variable.ts +0 -15
- package/src/get-function-name.ts +0 -24
- package/src/get-function-version.ts +0 -49
- package/src/get-functions.ts +0 -114
- package/src/get-output-url-from-metadata.ts +0 -23
- package/src/get-render-progress.ts +0 -66
- package/src/get-s3-client.ts +0 -26
- package/src/get-service-client.ts +0 -195
- package/src/get-sites.ts +0 -136
- package/src/head-file.ts +0 -30
- package/src/index.ts +0 -152
- package/src/is-cli.ts +0 -7
- package/src/is-flaky-error.ts +0 -104
- package/src/is-in-lambda.ts +0 -5
- package/src/is-likely-to-have-aws-profile.ts +0 -55
- package/src/lambda-version-string.ts +0 -5
- package/src/lifecycle-rules.ts +0 -119
- package/src/lifecycle.ts +0 -44
- package/src/list-objects.ts +0 -87
- package/src/make-lambda-payload.ts +0 -328
- package/src/make-s3-url.ts +0 -13
- package/src/p-limit.ts +0 -75
- package/src/pages-router-webhook.ts +0 -68
- package/src/parse-function-name.ts +0 -24
- package/src/presign-url.ts +0 -121
- package/src/price-per-1s.ts +0 -863
- package/src/random-hash.ts +0 -10
- package/src/read-file.ts +0 -35
- package/src/regions.ts +0 -48
- package/src/render-media-on-lambda.ts +0 -227
- package/src/render-still-on-lambda.ts +0 -209
- package/src/runtime-preference.ts +0 -7
- package/src/speculate-function-name.ts +0 -60
- package/src/test/concurrency-payload.test.ts +0 -121
- package/src/test/encode-aws-url.test.ts +0 -7
- package/src/test/price-calculation.test.ts +0 -62
- package/src/test/pricing.test.ts +0 -32
- package/src/test/request-handler.test.ts +0 -42
- package/src/test/validate-disk-size-in-mb.test.ts +0 -15
- package/src/types.ts +0 -7
- package/src/validate-aws-region.ts +0 -14
- package/src/validate-bucketname.ts +0 -24
- package/src/validate-disk-size-in-mb.ts +0 -37
- package/src/validate-lambda-codec.ts +0 -28
- package/src/validate-memory-size.ts +0 -31
- package/src/validate-presign-expiration.ts +0 -46
- package/src/validate-serveurl.ts +0 -9
- package/src/validate-webhook-signature.ts +0 -42
- package/src/write-file.ts +0 -108
- package/tsconfig.json +0 -10
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type {CustomCredentials, LogLevel} from '@remotion/serverless-client';
|
|
2
|
-
import {getProgress, ServerlessRoutines} from '@remotion/serverless-client';
|
|
3
|
-
import {awsImplementation, type AwsProvider} from './aws-provider';
|
|
4
|
-
import type {RenderProgress} from './constants';
|
|
5
|
-
import {getRenderProgressPayload} from './make-lambda-payload';
|
|
6
|
-
import {parseFunctionName} from './parse-function-name';
|
|
7
|
-
import type {AwsRegion} from './regions';
|
|
8
|
-
import type {RequestHandler} from './types';
|
|
9
|
-
|
|
10
|
-
export type GetRenderProgressInput = {
|
|
11
|
-
functionName: string;
|
|
12
|
-
bucketName: string;
|
|
13
|
-
renderId: string;
|
|
14
|
-
region: AwsRegion;
|
|
15
|
-
logLevel?: LogLevel;
|
|
16
|
-
s3OutputProvider?: CustomCredentials<AwsProvider>;
|
|
17
|
-
forcePathStyle?: boolean;
|
|
18
|
-
skipLambdaInvocation?: boolean;
|
|
19
|
-
requestHandler?: RequestHandler;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
/*
|
|
23
|
-
* @description Gets the current status of a render originally triggered via renderMediaOnLambda().
|
|
24
|
-
* @see [Documentation](https://remotion.dev/docs/lambda/getrenderprogress)
|
|
25
|
-
*/
|
|
26
|
-
export const getRenderProgress = async (
|
|
27
|
-
input: GetRenderProgressInput,
|
|
28
|
-
): Promise<RenderProgress> => {
|
|
29
|
-
if (input.skipLambdaInvocation) {
|
|
30
|
-
const parsed = parseFunctionName(input.functionName);
|
|
31
|
-
if (!parsed) {
|
|
32
|
-
throw new Error(
|
|
33
|
-
[
|
|
34
|
-
`The function name ${input.functionName} does not adhere to the function name convention (https://www.remotion.dev/docs/lambda/naming-convention).`,
|
|
35
|
-
'Cannot determine memory and disk size from the function name.',
|
|
36
|
-
'You must call getRenderProgress with `skipLambdaInvocation` set to false.',
|
|
37
|
-
].join('\n'),
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return getProgress<AwsProvider>({
|
|
42
|
-
bucketName: input.bucketName,
|
|
43
|
-
renderId: input.renderId,
|
|
44
|
-
region: input.region,
|
|
45
|
-
forcePathStyle: input.forcePathStyle ?? false,
|
|
46
|
-
customCredentials: input.s3OutputProvider ?? null,
|
|
47
|
-
expectedBucketOwner: null,
|
|
48
|
-
providerSpecifics: awsImplementation,
|
|
49
|
-
memorySizeInMb: parsed.memorySizeInMb,
|
|
50
|
-
timeoutInMilliseconds: parsed.timeoutInSeconds * 1000,
|
|
51
|
-
functionName: input.functionName,
|
|
52
|
-
requestHandler: input.requestHandler,
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const result =
|
|
57
|
-
await awsImplementation.callFunctionSync<ServerlessRoutines.status>({
|
|
58
|
-
functionName: input.functionName,
|
|
59
|
-
type: ServerlessRoutines.status,
|
|
60
|
-
payload: getRenderProgressPayload(input),
|
|
61
|
-
region: input.region,
|
|
62
|
-
timeoutInTest: 120000,
|
|
63
|
-
requestHandler: input.requestHandler,
|
|
64
|
-
});
|
|
65
|
-
return result;
|
|
66
|
-
};
|
package/src/get-s3-client.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type {S3Client} from '@aws-sdk/client-s3';
|
|
2
|
-
import type {CustomCredentials} from '@remotion/serverless-client';
|
|
3
|
-
import type {AwsProvider} from './aws-provider';
|
|
4
|
-
import {getServiceClient} from './get-service-client';
|
|
5
|
-
import type {AwsRegion} from './regions';
|
|
6
|
-
import type {RequestHandler} from './types';
|
|
7
|
-
|
|
8
|
-
export const getS3Client = ({
|
|
9
|
-
region,
|
|
10
|
-
customCredentials,
|
|
11
|
-
forcePathStyle,
|
|
12
|
-
requestHandler,
|
|
13
|
-
}: {
|
|
14
|
-
region: AwsRegion;
|
|
15
|
-
customCredentials: CustomCredentials<AwsProvider> | null;
|
|
16
|
-
forcePathStyle: boolean;
|
|
17
|
-
requestHandler: RequestHandler | null;
|
|
18
|
-
}): S3Client => {
|
|
19
|
-
return getServiceClient({
|
|
20
|
-
region: customCredentials?.region ?? region,
|
|
21
|
-
service: 's3',
|
|
22
|
-
customCredentials,
|
|
23
|
-
forcePathStyle,
|
|
24
|
-
requestHandler,
|
|
25
|
-
});
|
|
26
|
-
};
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import {CloudWatchLogsClient} from '@aws-sdk/client-cloudwatch-logs';
|
|
2
|
-
import {IAMClient} from '@aws-sdk/client-iam';
|
|
3
|
-
import {LambdaClient} from '@aws-sdk/client-lambda';
|
|
4
|
-
import {S3Client} from '@aws-sdk/client-s3';
|
|
5
|
-
import {ServiceQuotasClient} from '@aws-sdk/client-service-quotas';
|
|
6
|
-
import {STSClient} from '@aws-sdk/client-sts';
|
|
7
|
-
import type {CustomCredentials} from '@remotion/serverless-client';
|
|
8
|
-
import {MAX_FUNCTIONS_PER_RENDER, random} from '@remotion/serverless-client';
|
|
9
|
-
import type {AwsProvider} from './aws-provider';
|
|
10
|
-
import {checkCredentials} from './check-credentials';
|
|
11
|
-
import {getCredentials} from './get-credentials';
|
|
12
|
-
import {getEnvVariable} from './get-env-variable';
|
|
13
|
-
import type {AwsRegion} from './regions';
|
|
14
|
-
import type {RequestHandler} from './types';
|
|
15
|
-
|
|
16
|
-
export type ServiceMapping = {
|
|
17
|
-
s3: S3Client;
|
|
18
|
-
cloudwatch: CloudWatchLogsClient;
|
|
19
|
-
iam: IAMClient;
|
|
20
|
-
lambda: LambdaClient;
|
|
21
|
-
servicequotas: ServiceQuotasClient;
|
|
22
|
-
sts: STSClient;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const getCredentialsHash = ({
|
|
26
|
-
customCredentials,
|
|
27
|
-
region,
|
|
28
|
-
service,
|
|
29
|
-
forcePathStyle,
|
|
30
|
-
requestHandler,
|
|
31
|
-
}: {
|
|
32
|
-
region: AwsRegion;
|
|
33
|
-
customCredentials: CustomCredentials<AwsProvider> | null;
|
|
34
|
-
service: keyof ServiceMapping;
|
|
35
|
-
forcePathStyle: boolean;
|
|
36
|
-
requestHandler: RequestHandler | null;
|
|
37
|
-
}): string => {
|
|
38
|
-
const hashComponents: {[key: string]: unknown} = {};
|
|
39
|
-
|
|
40
|
-
if (getEnvVariable('REMOTION_SKIP_AWS_CREDENTIALS_CHECK')) {
|
|
41
|
-
hashComponents.credentials = {
|
|
42
|
-
credentialsSkipped: true,
|
|
43
|
-
};
|
|
44
|
-
} else if (getEnvVariable('REMOTION_AWS_PROFILE')) {
|
|
45
|
-
hashComponents.credentials = {
|
|
46
|
-
awsProfile: getEnvVariable('REMOTION_AWS_PROFILE'),
|
|
47
|
-
};
|
|
48
|
-
} else if (
|
|
49
|
-
getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID') &&
|
|
50
|
-
getEnvVariable('REMOTION_AWS_SECRET_ACCESS_KEY')
|
|
51
|
-
) {
|
|
52
|
-
hashComponents.credentials = {
|
|
53
|
-
accessKeyId: getEnvVariable('REMOTION_AWS_ACCESS_KEY_ID'),
|
|
54
|
-
secretAccessKey: getEnvVariable('REMOTION_AWS_SECRET_ACCESS_KEY'),
|
|
55
|
-
};
|
|
56
|
-
} else if (getEnvVariable('AWS_PROFILE')) {
|
|
57
|
-
hashComponents.credentials = {
|
|
58
|
-
awsProfile: getEnvVariable('AWS_PROFILE'),
|
|
59
|
-
};
|
|
60
|
-
} else if (
|
|
61
|
-
getEnvVariable('AWS_ACCESS_KEY_ID') &&
|
|
62
|
-
getEnvVariable('AWS_SECRET_ACCESS_KEY')
|
|
63
|
-
) {
|
|
64
|
-
hashComponents.credentials = {
|
|
65
|
-
accessKeyId: getEnvVariable('AWS_ACCESS_KEY_ID') as string,
|
|
66
|
-
secretAccessKey: getEnvVariable('AWS_SECRET_ACCESS_KEY') as string,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
hashComponents.customCredentials = customCredentials;
|
|
71
|
-
hashComponents.region = region;
|
|
72
|
-
hashComponents.service = service;
|
|
73
|
-
hashComponents.forcePathStyle = forcePathStyle;
|
|
74
|
-
hashComponents.requestHandler = requestHandler;
|
|
75
|
-
|
|
76
|
-
return random(JSON.stringify(hashComponents)).toString().replace('0.', '');
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
const _clients: Partial<
|
|
80
|
-
Record<
|
|
81
|
-
string,
|
|
82
|
-
| CloudWatchLogsClient
|
|
83
|
-
| LambdaClient
|
|
84
|
-
| S3Client
|
|
85
|
-
| IAMClient
|
|
86
|
-
| ServiceQuotasClient
|
|
87
|
-
| STSClient
|
|
88
|
-
>
|
|
89
|
-
> = {};
|
|
90
|
-
|
|
91
|
-
export const getServiceClient = <T extends keyof ServiceMapping>({
|
|
92
|
-
region,
|
|
93
|
-
service,
|
|
94
|
-
customCredentials,
|
|
95
|
-
forcePathStyle,
|
|
96
|
-
requestHandler,
|
|
97
|
-
}: {
|
|
98
|
-
region: AwsRegion;
|
|
99
|
-
service: T;
|
|
100
|
-
customCredentials: CustomCredentials<AwsProvider> | null;
|
|
101
|
-
forcePathStyle: boolean;
|
|
102
|
-
requestHandler: RequestHandler | null;
|
|
103
|
-
}): ServiceMapping[T] => {
|
|
104
|
-
const Client = (() => {
|
|
105
|
-
if (service === 'cloudwatch') {
|
|
106
|
-
return CloudWatchLogsClient;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (service === 'lambda') {
|
|
110
|
-
return LambdaClient;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
if (service === 's3') {
|
|
114
|
-
return S3Client;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (service === 'iam') {
|
|
118
|
-
return IAMClient;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (service === 'servicequotas') {
|
|
122
|
-
return ServiceQuotasClient;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
if (service === 'sts') {
|
|
126
|
-
return STSClient;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
throw new TypeError('unknown client ' + service);
|
|
130
|
-
})();
|
|
131
|
-
|
|
132
|
-
const key = getCredentialsHash({
|
|
133
|
-
region,
|
|
134
|
-
customCredentials,
|
|
135
|
-
service,
|
|
136
|
-
forcePathStyle,
|
|
137
|
-
requestHandler,
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
if (!_clients[key]) {
|
|
141
|
-
checkCredentials();
|
|
142
|
-
|
|
143
|
-
const lambdaOptions =
|
|
144
|
-
service === 'lambda'
|
|
145
|
-
? {
|
|
146
|
-
httpsAgent: {
|
|
147
|
-
maxSockets: MAX_FUNCTIONS_PER_RENDER * 2,
|
|
148
|
-
},
|
|
149
|
-
}
|
|
150
|
-
: undefined;
|
|
151
|
-
|
|
152
|
-
// Merge custom requestHandler with lambda options
|
|
153
|
-
const finalRequestHandler = requestHandler
|
|
154
|
-
? lambdaOptions
|
|
155
|
-
? {...requestHandler, ...lambdaOptions}
|
|
156
|
-
: requestHandler
|
|
157
|
-
: lambdaOptions;
|
|
158
|
-
|
|
159
|
-
const client = customCredentials
|
|
160
|
-
? new Client({
|
|
161
|
-
region: customCredentials.region ?? 'us-east-1',
|
|
162
|
-
credentials:
|
|
163
|
-
customCredentials.accessKeyId && customCredentials.secretAccessKey
|
|
164
|
-
? {
|
|
165
|
-
accessKeyId: customCredentials.accessKeyId,
|
|
166
|
-
secretAccessKey: customCredentials.secretAccessKey,
|
|
167
|
-
}
|
|
168
|
-
: undefined,
|
|
169
|
-
endpoint: customCredentials.endpoint,
|
|
170
|
-
requestHandler: finalRequestHandler,
|
|
171
|
-
forcePathStyle: customCredentials.forcePathStyle,
|
|
172
|
-
maxAttempts: service === 'lambda' ? 1 : undefined,
|
|
173
|
-
})
|
|
174
|
-
: getEnvVariable('REMOTION_SKIP_AWS_CREDENTIALS_CHECK')
|
|
175
|
-
? new Client({
|
|
176
|
-
region,
|
|
177
|
-
requestHandler: finalRequestHandler,
|
|
178
|
-
maxAttempts: service === 'lambda' ? 1 : undefined,
|
|
179
|
-
})
|
|
180
|
-
: new Client({
|
|
181
|
-
region,
|
|
182
|
-
credentials: getCredentials(),
|
|
183
|
-
requestHandler: finalRequestHandler,
|
|
184
|
-
maxAttempts: service === 'lambda' ? 1 : undefined,
|
|
185
|
-
});
|
|
186
|
-
|
|
187
|
-
if (getEnvVariable('REMOTION_DISABLE_AWS_CLIENT_CACHE')) {
|
|
188
|
-
return client as ServiceMapping[T];
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
_clients[key] = client;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
return _clients[key] as ServiceMapping[T];
|
|
195
|
-
};
|
package/src/get-sites.ts
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
import type {ProviderSpecifics} from '@remotion/serverless-client';
|
|
2
|
-
import type {AwsProvider} from './aws-provider';
|
|
3
|
-
import {awsImplementation} from './aws-provider';
|
|
4
|
-
import {getSitesKey} from './constants';
|
|
5
|
-
import type {BucketWithLocation} from './get-buckets';
|
|
6
|
-
import {makeS3ServeUrl} from './make-s3-url';
|
|
7
|
-
import type {AwsRegion} from './regions';
|
|
8
|
-
import type {RequestHandler} from './types';
|
|
9
|
-
|
|
10
|
-
type Site = {
|
|
11
|
-
sizeInBytes: number;
|
|
12
|
-
lastModified: number | null;
|
|
13
|
-
bucketName: string;
|
|
14
|
-
id: string;
|
|
15
|
-
serveUrl: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
type MandatoryParameters = {
|
|
19
|
-
region: AwsRegion;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
type OptionalParameters = {
|
|
23
|
-
forceBucketName: string | null;
|
|
24
|
-
forcePathStyle: boolean;
|
|
25
|
-
requestHandler: RequestHandler | null;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
type GetSitesInternalInput = MandatoryParameters & OptionalParameters;
|
|
29
|
-
export type GetSitesInput = MandatoryParameters & Partial<OptionalParameters>;
|
|
30
|
-
|
|
31
|
-
export type GetSitesOutput = {
|
|
32
|
-
sites: Site[];
|
|
33
|
-
buckets: BucketWithLocation[];
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export const internalGetSites = async ({
|
|
37
|
-
region,
|
|
38
|
-
forceBucketName,
|
|
39
|
-
providerSpecifics,
|
|
40
|
-
forcePathStyle,
|
|
41
|
-
requestHandler,
|
|
42
|
-
}: GetSitesInternalInput & {
|
|
43
|
-
providerSpecifics: ProviderSpecifics<AwsProvider>;
|
|
44
|
-
}): Promise<GetSitesOutput> => {
|
|
45
|
-
const remotionBuckets = forceBucketName
|
|
46
|
-
? await providerSpecifics.getBuckets({
|
|
47
|
-
region,
|
|
48
|
-
forceBucketName,
|
|
49
|
-
forcePathStyle,
|
|
50
|
-
requestHandler,
|
|
51
|
-
})
|
|
52
|
-
: await providerSpecifics.getBuckets({
|
|
53
|
-
region,
|
|
54
|
-
forceBucketName: null,
|
|
55
|
-
forcePathStyle,
|
|
56
|
-
requestHandler,
|
|
57
|
-
});
|
|
58
|
-
const accountId = await providerSpecifics.getAccountId({region});
|
|
59
|
-
|
|
60
|
-
const sites: {[key: string]: Site} = {};
|
|
61
|
-
|
|
62
|
-
for (const bucket of remotionBuckets) {
|
|
63
|
-
const ls = await providerSpecifics.listObjects({
|
|
64
|
-
bucketName: bucket.name,
|
|
65
|
-
prefix: getSitesKey(''),
|
|
66
|
-
region,
|
|
67
|
-
expectedBucketOwner: accountId,
|
|
68
|
-
forcePathStyle,
|
|
69
|
-
requestHandler,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
for (const file of ls) {
|
|
73
|
-
const siteKeyMatch = file.Key?.match(
|
|
74
|
-
/sites\/([0-9a-zA-Z-!_.*'()]+)\/(.*)$/,
|
|
75
|
-
);
|
|
76
|
-
if (!siteKeyMatch) {
|
|
77
|
-
throw new Error(
|
|
78
|
-
`A file was found in the bucket "${bucket.name}" with the key ${file.Key} which is an unexpected folder structure. Delete this file.`,
|
|
79
|
-
);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
const [, siteId] = siteKeyMatch;
|
|
83
|
-
if (!sites[siteId]) {
|
|
84
|
-
sites[siteId] = {
|
|
85
|
-
sizeInBytes: 0,
|
|
86
|
-
bucketName: bucket.name,
|
|
87
|
-
lastModified: null,
|
|
88
|
-
id: siteId,
|
|
89
|
-
serveUrl: makeS3ServeUrl({
|
|
90
|
-
bucketName: bucket.name,
|
|
91
|
-
region,
|
|
92
|
-
subFolder: getSitesKey(siteId),
|
|
93
|
-
}),
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
if (file.LastModified) {
|
|
98
|
-
const currentLastModified = sites[siteId].lastModified;
|
|
99
|
-
if (
|
|
100
|
-
currentLastModified === null ||
|
|
101
|
-
file.LastModified.getTime() > currentLastModified
|
|
102
|
-
) {
|
|
103
|
-
sites[siteId].lastModified = file.LastModified.getTime();
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (file.Size) {
|
|
108
|
-
sites[siteId].sizeInBytes += file.Size;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
const sitesArray: Site[] = Object.keys(sites).map((siteId) => {
|
|
114
|
-
return sites[siteId];
|
|
115
|
-
});
|
|
116
|
-
return {sites: sitesArray, buckets: remotionBuckets};
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
/*
|
|
120
|
-
* @description Gets an array of Remotion projects in Cloud Storage, in your GCP project.
|
|
121
|
-
* @see [Documentation](https://remotion.dev/docs/cloudrun/getsites)
|
|
122
|
-
*/
|
|
123
|
-
export const getSites = ({
|
|
124
|
-
region,
|
|
125
|
-
forceBucketName,
|
|
126
|
-
forcePathStyle,
|
|
127
|
-
requestHandler,
|
|
128
|
-
}: GetSitesInput): Promise<GetSitesOutput> => {
|
|
129
|
-
return internalGetSites({
|
|
130
|
-
region,
|
|
131
|
-
forceBucketName: forceBucketName ?? null,
|
|
132
|
-
forcePathStyle: forcePathStyle ?? false,
|
|
133
|
-
providerSpecifics: awsImplementation,
|
|
134
|
-
requestHandler: requestHandler ?? null,
|
|
135
|
-
});
|
|
136
|
-
};
|
package/src/head-file.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import {HeadObjectCommand} from '@aws-sdk/client-s3';
|
|
2
|
-
import type {ProviderSpecifics} from '@remotion/serverless-client';
|
|
3
|
-
import type {AwsProvider} from './aws-provider';
|
|
4
|
-
import {getS3Client} from './get-s3-client';
|
|
5
|
-
|
|
6
|
-
export const lambdaHeadFileImplementation: ProviderSpecifics<AwsProvider>['headFile'] =
|
|
7
|
-
async ({
|
|
8
|
-
bucketName,
|
|
9
|
-
key,
|
|
10
|
-
region,
|
|
11
|
-
customCredentials,
|
|
12
|
-
forcePathStyle,
|
|
13
|
-
requestHandler,
|
|
14
|
-
}): Promise<{
|
|
15
|
-
LastModified?: Date | undefined;
|
|
16
|
-
ContentLength?: number | undefined;
|
|
17
|
-
}> => {
|
|
18
|
-
const head = await getS3Client({
|
|
19
|
-
region,
|
|
20
|
-
customCredentials,
|
|
21
|
-
forcePathStyle,
|
|
22
|
-
requestHandler,
|
|
23
|
-
}).send(
|
|
24
|
-
new HeadObjectCommand({
|
|
25
|
-
Bucket: bucketName,
|
|
26
|
-
Key: key,
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
return head;
|
|
30
|
-
};
|
package/src/index.ts
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
export type {
|
|
2
|
-
EnhancedErrorInfo,
|
|
3
|
-
GetOrCreateBucketInput,
|
|
4
|
-
GetOrCreateBucketOutput,
|
|
5
|
-
} from '@remotion/serverless-client';
|
|
6
|
-
export type {RuntimePreference} from './runtime-preference';
|
|
7
|
-
import {
|
|
8
|
-
getCloudWatchLogsClient,
|
|
9
|
-
getIamClient,
|
|
10
|
-
getLambdaClient,
|
|
11
|
-
getServiceQuotasClient,
|
|
12
|
-
getStsClient,
|
|
13
|
-
} from './aws-clients';
|
|
14
|
-
import {awsImplementation} from './aws-provider';
|
|
15
|
-
import {parseJsonOrThrowSource} from './call-lambda-streaming';
|
|
16
|
-
import {cleanItems} from './clean-items';
|
|
17
|
-
import {
|
|
18
|
-
DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
|
|
19
|
-
DEFAULT_EPHEMERAL_STORAGE_IN_MB,
|
|
20
|
-
MAX_EPHEMERAL_STORAGE_IN_MB,
|
|
21
|
-
} from './constants';
|
|
22
|
-
import {convertToServeUrlImplementation} from './convert-to-serve-url';
|
|
23
|
-
import {internalDeleteRender} from './delete-render';
|
|
24
|
-
import {
|
|
25
|
-
getCloudwatchMethodUrl,
|
|
26
|
-
getCloudwatchRendererUrl,
|
|
27
|
-
getS3RenderUrl,
|
|
28
|
-
} from './get-aws-urls';
|
|
29
|
-
import {getEnvVariable} from './get-env-variable';
|
|
30
|
-
import {getS3Client} from './get-s3-client';
|
|
31
|
-
import {internalGetSites} from './get-sites';
|
|
32
|
-
import {isFlakyError} from './is-flaky-error';
|
|
33
|
-
import {LAMBDA_VERSION_STRING} from './lambda-version-string';
|
|
34
|
-
import {
|
|
35
|
-
generateRandomHashWithLifeCycleRule,
|
|
36
|
-
getLifeCycleRules,
|
|
37
|
-
} from './lifecycle';
|
|
38
|
-
import {
|
|
39
|
-
getRenderProgressPayload,
|
|
40
|
-
makeLambdaRenderMediaPayload,
|
|
41
|
-
makeLambdaRenderStillPayload,
|
|
42
|
-
} from './make-lambda-payload';
|
|
43
|
-
import {makeS3ServeUrl} from './make-s3-url';
|
|
44
|
-
import {pLimit} from './p-limit';
|
|
45
|
-
import {parseFunctionName} from './parse-function-name';
|
|
46
|
-
import {randomHashImplementation} from './random-hash';
|
|
47
|
-
import {
|
|
48
|
-
internalRenderMediaOnLambdaRaw,
|
|
49
|
-
renderMediaOnLambdaOptionalToRequired,
|
|
50
|
-
} from './render-media-on-lambda';
|
|
51
|
-
import {internalRenderStillOnLambda} from './render-still-on-lambda';
|
|
52
|
-
import {runtimePreferenceOptions} from './runtime-preference';
|
|
53
|
-
import {innerSpeculateFunctionName} from './speculate-function-name';
|
|
54
|
-
import {validateAwsRegion} from './validate-aws-region';
|
|
55
|
-
import {parseBucketName} from './validate-bucketname';
|
|
56
|
-
import {validateDiskSizeInMb} from './validate-disk-size-in-mb';
|
|
57
|
-
import {validateMemorySize} from './validate-memory-size';
|
|
58
|
-
import {validateServeUrl} from './validate-serveurl';
|
|
59
|
-
|
|
60
|
-
export type {
|
|
61
|
-
CustomCredentials,
|
|
62
|
-
DeleteAfter,
|
|
63
|
-
WebhookErrorPayload,
|
|
64
|
-
WebhookPayload,
|
|
65
|
-
WebhookSuccessPayload,
|
|
66
|
-
WebhookTimeoutPayload,
|
|
67
|
-
} from '@remotion/serverless-client';
|
|
68
|
-
export {appRouterWebhook, NextWebhookArgs} from './app-router-webhook';
|
|
69
|
-
export {AwsProvider} from './aws-provider';
|
|
70
|
-
export type {RenderProgress} from './constants';
|
|
71
|
-
export {deleteFunction, DeleteFunctionInput} from './delete-function';
|
|
72
|
-
export {deleteRender, type DeleteRenderInput} from './delete-render';
|
|
73
|
-
export {estimatePrice, EstimatePriceInput} from './estimate-price';
|
|
74
|
-
export {expressWebhook} from './express-webhook';
|
|
75
|
-
export {
|
|
76
|
-
getAwsClient,
|
|
77
|
-
type GetAwsClientInput,
|
|
78
|
-
type GetAwsClientOutput,
|
|
79
|
-
} from './get-aws-client';
|
|
80
|
-
export {
|
|
81
|
-
getCompositionsOnLambda,
|
|
82
|
-
type GetCompositionsOnLambdaInput,
|
|
83
|
-
type GetCompositionsOnLambdaOutput,
|
|
84
|
-
} from './get-compositions-on-lambda';
|
|
85
|
-
export {getFunctionVersion} from './get-function-version';
|
|
86
|
-
export {getFunctions, type GetFunctionsInput} from './get-functions';
|
|
87
|
-
export {getRenderProgress} from './get-render-progress';
|
|
88
|
-
export type {GetRenderProgressInput} from './get-render-progress';
|
|
89
|
-
export {getSites, type GetSitesInput, type GetSitesOutput} from './get-sites';
|
|
90
|
-
export {pagesRouterWebhook} from './pages-router-webhook';
|
|
91
|
-
export {presignUrl, type PresignUrlInput} from './presign-url';
|
|
92
|
-
export type {AwsRegion} from './regions';
|
|
93
|
-
export {
|
|
94
|
-
renderMediaOnLambda,
|
|
95
|
-
renderVideoOnLambda,
|
|
96
|
-
type RenderMediaOnLambdaInput,
|
|
97
|
-
type RenderMediaOnLambdaOutput,
|
|
98
|
-
} from './render-media-on-lambda';
|
|
99
|
-
export {
|
|
100
|
-
renderStillOnLambda,
|
|
101
|
-
type RenderStillOnLambdaInput,
|
|
102
|
-
type RenderStillOnLambdaOutput,
|
|
103
|
-
} from './render-still-on-lambda';
|
|
104
|
-
export {
|
|
105
|
-
speculateFunctionName,
|
|
106
|
-
type SpeculateFunctionNameInput,
|
|
107
|
-
} from './speculate-function-name';
|
|
108
|
-
export type {RequestHandler} from './types';
|
|
109
|
-
export {validateWebhookSignature} from './validate-webhook-signature';
|
|
110
|
-
|
|
111
|
-
export const LambdaClientInternals = {
|
|
112
|
-
generateRandomHashWithLifeCycleRule,
|
|
113
|
-
getLambdaClient,
|
|
114
|
-
getS3Client,
|
|
115
|
-
getS3RenderUrl,
|
|
116
|
-
getIamClient,
|
|
117
|
-
getStsClient,
|
|
118
|
-
getCloudWatchLogsClient,
|
|
119
|
-
getServiceQuotasClient,
|
|
120
|
-
parseJsonOrThrowSource,
|
|
121
|
-
getCloudwatchMethodUrl,
|
|
122
|
-
getCloudwatchRendererUrl,
|
|
123
|
-
MAX_EPHEMERAL_STORAGE_IN_MB,
|
|
124
|
-
parseFunctionName,
|
|
125
|
-
isFlakyError,
|
|
126
|
-
convertToServeUrlImplementation,
|
|
127
|
-
randomHashImplementation,
|
|
128
|
-
parseBucketName,
|
|
129
|
-
makeLambdaRenderMediaPayload,
|
|
130
|
-
renderMediaOnLambdaOptionalToRequired,
|
|
131
|
-
internalDeleteRender,
|
|
132
|
-
internalGetSites,
|
|
133
|
-
getLifeCycleRules,
|
|
134
|
-
awsImplementation,
|
|
135
|
-
runtimePreferenceOptions,
|
|
136
|
-
validateAwsRegion,
|
|
137
|
-
validateDiskSizeInMb,
|
|
138
|
-
validateMemorySize,
|
|
139
|
-
DEFAULT_CLOUDWATCH_RETENTION_PERIOD,
|
|
140
|
-
DEFAULT_EPHEMERAL_STORAGE_IN_MB,
|
|
141
|
-
LAMBDA_VERSION_STRING,
|
|
142
|
-
pLimit,
|
|
143
|
-
makeS3ServeUrl,
|
|
144
|
-
validateServeUrl,
|
|
145
|
-
getEnvVariable,
|
|
146
|
-
internalRenderMediaOnLambdaRaw,
|
|
147
|
-
internalRenderStillOnLambda,
|
|
148
|
-
cleanItems,
|
|
149
|
-
makeLambdaRenderStillPayload,
|
|
150
|
-
getRenderProgressPayload,
|
|
151
|
-
innerSpeculateFunctionName,
|
|
152
|
-
};
|