ropegeo-common 1.5.0 → 1.6.0
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/helpers/cloudfront/createCloudFrontInvalidation.d.ts +9 -0
- package/dist/helpers/cloudfront/createCloudFrontInvalidation.d.ts.map +1 -0
- package/dist/helpers/cloudfront/createCloudFrontInvalidation.js +30 -0
- package/dist/helpers/httpRequest.d.ts +16 -0
- package/dist/helpers/httpRequest.d.ts.map +1 -0
- package/dist/helpers/httpRequest.js +108 -0
- package/dist/helpers/index.d.ts +17 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +40 -0
- package/dist/helpers/progressLogger.d.ts +24 -0
- package/dist/helpers/progressLogger.d.ts.map +1 -0
- package/dist/helpers/progressLogger.js +82 -0
- package/dist/helpers/s3/deleteS3Object.d.ts +5 -0
- package/dist/helpers/s3/deleteS3Object.d.ts.map +1 -0
- package/dist/helpers/s3/deleteS3Object.js +15 -0
- package/dist/helpers/s3/getS3Client.d.ts +10 -0
- package/dist/helpers/s3/getS3Client.d.ts.map +1 -0
- package/dist/helpers/s3/getS3Client.js +22 -0
- package/dist/helpers/s3/getS3Object.d.ts +16 -0
- package/dist/helpers/s3/getS3Object.d.ts.map +1 -0
- package/dist/helpers/s3/getS3Object.js +29 -0
- package/dist/helpers/s3/listS3Folder.d.ts +8 -0
- package/dist/helpers/s3/listS3Folder.d.ts.map +1 -0
- package/dist/helpers/s3/listS3Folder.js +32 -0
- package/dist/helpers/s3/listS3Objects.d.ts +15 -0
- package/dist/helpers/s3/listS3Objects.d.ts.map +1 -0
- package/dist/helpers/s3/listS3Objects.js +36 -0
- package/dist/helpers/s3/putS3Folder.d.ts +13 -0
- package/dist/helpers/s3/putS3Folder.d.ts.map +1 -0
- package/dist/helpers/s3/putS3Folder.js +56 -0
- package/dist/helpers/s3/putS3Object.d.ts +13 -0
- package/dist/helpers/s3/putS3Object.d.ts.map +1 -0
- package/dist/helpers/s3/putS3Object.js +36 -0
- package/dist/helpers/s3/replaceS3Folder.d.ts +14 -0
- package/dist/helpers/s3/replaceS3Folder.d.ts.map +1 -0
- package/dist/helpers/s3/replaceS3Folder.js +43 -0
- package/dist/helpers/sqs/changeSQSMessageVisibilityTimeout.d.ts +13 -0
- package/dist/helpers/sqs/changeSQSMessageVisibilityTimeout.d.ts.map +1 -0
- package/dist/helpers/sqs/changeSQSMessageVisibilityTimeout.js +62 -0
- package/dist/helpers/sqs/deleteSQSMessage.d.ts +11 -0
- package/dist/helpers/sqs/deleteSQSMessage.d.ts.map +1 -0
- package/dist/helpers/sqs/deleteSQSMessage.js +56 -0
- package/dist/helpers/sqs/getSQSClient.d.ts +10 -0
- package/dist/helpers/sqs/getSQSClient.d.ts.map +1 -0
- package/dist/helpers/sqs/getSQSClient.js +22 -0
- package/dist/helpers/sqs/sendSQSMessage.d.ts +12 -0
- package/dist/helpers/sqs/sendSQSMessage.d.ts.map +1 -0
- package/dist/helpers/sqs/sendSQSMessage.js +64 -0
- package/dist/helpers/timeoutAfter.d.ts +12 -0
- package/dist/helpers/timeoutAfter.d.ts.map +1 -0
- package/dist/helpers/timeoutAfter.js +24 -0
- package/dist/index.d.ts +1 -50
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -105
- package/dist/types/index.d.ts +51 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +107 -0
- package/package.json +42 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a CloudFront invalidation for the given paths so the edge cache serves fresh content.
|
|
3
|
+
*
|
|
4
|
+
* @param distributionArn - ARN of the CloudFront distribution (e.g. arn:aws:cloudfront::123456789:distribution/E2ABC123)
|
|
5
|
+
* @param paths - Paths to invalidate (e.g. ['/mapdata/trails/*'])
|
|
6
|
+
* @param callerReference - Base string for the invalidation caller reference; timestamp is appended for uniqueness
|
|
7
|
+
*/
|
|
8
|
+
export declare function createCloudFrontInvalidation(distributionArn: string, paths: string[], callerReference: string): Promise<void>;
|
|
9
|
+
//# sourceMappingURL=createCloudFrontInvalidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createCloudFrontInvalidation.d.ts","sourceRoot":"","sources":["../../../src/helpers/cloudfront/createCloudFrontInvalidation.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAsB,4BAA4B,CAC9C,eAAe,EAAE,MAAM,EACvB,KAAK,EAAE,MAAM,EAAE,EACf,eAAe,EAAE,MAAM,GACxB,OAAO,CAAC,IAAI,CAAC,CAoBf"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createCloudFrontInvalidation = createCloudFrontInvalidation;
|
|
4
|
+
const client_cloudfront_1 = require("@aws-sdk/client-cloudfront");
|
|
5
|
+
/**
|
|
6
|
+
* Creates a CloudFront invalidation for the given paths so the edge cache serves fresh content.
|
|
7
|
+
*
|
|
8
|
+
* @param distributionArn - ARN of the CloudFront distribution (e.g. arn:aws:cloudfront::123456789:distribution/E2ABC123)
|
|
9
|
+
* @param paths - Paths to invalidate (e.g. ['/mapdata/trails/*'])
|
|
10
|
+
* @param callerReference - Base string for the invalidation caller reference; timestamp is appended for uniqueness
|
|
11
|
+
*/
|
|
12
|
+
async function createCloudFrontInvalidation(distributionArn, paths, callerReference) {
|
|
13
|
+
const distributionId = distributionArn.split('/').pop();
|
|
14
|
+
if (!distributionId) {
|
|
15
|
+
throw new Error(`Invalid CLOUDFRONT_DISTRIBUTION_ARN: ${distributionArn}`);
|
|
16
|
+
}
|
|
17
|
+
const client = new client_cloudfront_1.CloudFrontClient({});
|
|
18
|
+
const callerRef = `${callerReference}-${Date.now()}`;
|
|
19
|
+
await client.send(new client_cloudfront_1.CreateInvalidationCommand({
|
|
20
|
+
DistributionId: distributionId,
|
|
21
|
+
InvalidationBatch: {
|
|
22
|
+
Paths: {
|
|
23
|
+
Quantity: paths.length,
|
|
24
|
+
Items: paths,
|
|
25
|
+
},
|
|
26
|
+
CallerReference: callerRef,
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
29
|
+
console.log(`Created CloudFront invalidation for ${paths.join(', ')} (distribution ${distributionId})`);
|
|
30
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wrapper for HTTP requests: sets headers, throws on non-OK or failed request with
|
|
3
|
+
* detailed messages, and optionally routes through a proxy in Lambda dev/prod.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Send an HTTP request with default headers and optional proxy (Lambda + dev/prod only by default).
|
|
7
|
+
* Throws an Error with detailed message on non-OK response or failed request.
|
|
8
|
+
* Retries on fetch errors or 5XX (except 502) / 403 responses up to retryCount times (default 5).
|
|
9
|
+
* Every attempt has a request timeout (30s with proxy, 60s without).
|
|
10
|
+
* If abortSignal is provided and aborts, the request is cancelled and retries are not attempted.
|
|
11
|
+
* Pass init.method e.g. 'HEAD' for HEAD requests.
|
|
12
|
+
* When useProxy is provided it overrides the default (isLambda + dev/prod) and forces proxy on (true) or off (false).
|
|
13
|
+
*/
|
|
14
|
+
export declare function httpRequest(url: string | URL, retryCount?: number, abortSignal?: AbortSignal, init?: RequestInit, useProxy?: boolean): Promise<Response>;
|
|
15
|
+
export default httpRequest;
|
|
16
|
+
//# sourceMappingURL=httpRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"httpRequest.d.ts","sourceRoot":"","sources":["../../src/helpers/httpRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiDH;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAC7B,GAAG,EAAE,MAAM,GAAG,GAAG,EACjB,UAAU,SAAI,EACd,WAAW,CAAC,EAAE,WAAW,EACzB,IAAI,CAAC,EAAE,WAAW,EAClB,QAAQ,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,QAAQ,CAAC,CAiEnB;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Wrapper for HTTP requests: sets headers, throws on non-OK or failed request with
|
|
4
|
+
* detailed messages, and optionally routes through a proxy in Lambda dev/prod.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.httpRequest = httpRequest;
|
|
8
|
+
const undici_1 = require("undici");
|
|
9
|
+
const DEFAULT_HEADERS = {
|
|
10
|
+
Accept: 'application/json, text/html, application/xml, */*',
|
|
11
|
+
'Accept-Language': 'en-US,en;q=0.9',
|
|
12
|
+
};
|
|
13
|
+
const isLambda = () => typeof process.env.AWS_LAMBDA_FUNCTION_NAME === 'string' && process.env.AWS_LAMBDA_FUNCTION_NAME.length > 0;
|
|
14
|
+
const shouldUseProxy = () => {
|
|
15
|
+
if (!isLambda())
|
|
16
|
+
return false;
|
|
17
|
+
const env = process.env.DEV_ENVIRONMENT;
|
|
18
|
+
return env === 'dev' || env === 'production';
|
|
19
|
+
};
|
|
20
|
+
const getProxyDispatcher = () => {
|
|
21
|
+
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
|
22
|
+
const proxyUrl = process.env.PROXY_URL ?? process.env.HTTP_PROXY ?? process.env.HTTPS_PROXY;
|
|
23
|
+
if (!proxyUrl)
|
|
24
|
+
throw new Error(`PROXY_URL not defined in ${process.env.DEV_ENVIRONMENT} environment`);
|
|
25
|
+
return new undici_1.ProxyAgent(proxyUrl);
|
|
26
|
+
};
|
|
27
|
+
const buildNonOkMessage = async (response, requestUrl) => {
|
|
28
|
+
const finalUrl = response.url;
|
|
29
|
+
const server = response.headers.get('server') ?? response.headers.get('x-powered-by') ?? '(none)';
|
|
30
|
+
let bodyText = '';
|
|
31
|
+
try {
|
|
32
|
+
bodyText = await response.clone().text();
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
bodyText = '(failed to read body)';
|
|
36
|
+
}
|
|
37
|
+
const bodyPreview = bodyText.length > 2000 ? `${bodyText.slice(0, 2000)}...` : bodyText;
|
|
38
|
+
return (`httpRequest non-OK: status=${response.status} statusText=${response.statusText} ` +
|
|
39
|
+
`requestUrl=${requestUrl} finalUrl=${finalUrl} server=${server} responseBody=${bodyPreview}`);
|
|
40
|
+
};
|
|
41
|
+
/** Request timeout in ms when using proxy (avoids Lambda hanging until 900s timeout). */
|
|
42
|
+
const REQUEST_TIMEOUT_MS_PROXY = 30000;
|
|
43
|
+
/** Request timeout in ms when not using proxy (avoids hang on slow or stuck connections). */
|
|
44
|
+
const REQUEST_TIMEOUT_MS_NO_PROXY = 60000;
|
|
45
|
+
/**
|
|
46
|
+
* Send an HTTP request with default headers and optional proxy (Lambda + dev/prod only by default).
|
|
47
|
+
* Throws an Error with detailed message on non-OK response or failed request.
|
|
48
|
+
* Retries on fetch errors or 5XX (except 502) / 403 responses up to retryCount times (default 5).
|
|
49
|
+
* Every attempt has a request timeout (30s with proxy, 60s without).
|
|
50
|
+
* If abortSignal is provided and aborts, the request is cancelled and retries are not attempted.
|
|
51
|
+
* Pass init.method e.g. 'HEAD' for HEAD requests.
|
|
52
|
+
* When useProxy is provided it overrides the default (isLambda + dev/prod) and forces proxy on (true) or off (false).
|
|
53
|
+
*/
|
|
54
|
+
async function httpRequest(url, retryCount = 5, abortSignal, init, useProxy) {
|
|
55
|
+
const requestUrl = typeof url === 'string' ? url : url.toString();
|
|
56
|
+
const useProxyResolved = useProxy === undefined ? shouldUseProxy() : useProxy;
|
|
57
|
+
const dispatcher = useProxyResolved ? getProxyDispatcher() : undefined;
|
|
58
|
+
const timeoutMs = dispatcher ? REQUEST_TIMEOUT_MS_PROXY : REQUEST_TIMEOUT_MS_NO_PROXY;
|
|
59
|
+
let lastError = null;
|
|
60
|
+
const maxAttempts = retryCount + 1;
|
|
61
|
+
for (let attempt = 0; attempt < maxAttempts; attempt++) {
|
|
62
|
+
if (abortSignal?.aborted) {
|
|
63
|
+
const err = abortSignal.reason instanceof Error ? abortSignal.reason : new Error(String(abortSignal.reason));
|
|
64
|
+
throw new Error(`httpRequest aborted: requestUrl=${requestUrl} error=${err.message}`);
|
|
65
|
+
}
|
|
66
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
67
|
+
const requestSignal = abortSignal != null
|
|
68
|
+
? AbortSignal.any([abortSignal, timeoutSignal])
|
|
69
|
+
: timeoutSignal;
|
|
70
|
+
const requestOptions = {
|
|
71
|
+
headers: DEFAULT_HEADERS,
|
|
72
|
+
...(dispatcher ? { dispatcher } : {}),
|
|
73
|
+
signal: requestSignal,
|
|
74
|
+
...init,
|
|
75
|
+
};
|
|
76
|
+
let response;
|
|
77
|
+
try {
|
|
78
|
+
response = (await (0, undici_1.fetch)(requestUrl, requestOptions));
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
lastError = new Error(`httpRequest failed: requestUrl=${requestUrl} error=${error}`);
|
|
82
|
+
if (abortSignal?.aborted) {
|
|
83
|
+
throw lastError;
|
|
84
|
+
}
|
|
85
|
+
if (attempt < maxAttempts - 1) {
|
|
86
|
+
console.warn(`httpRequest retry ${attempt + 1}/${retryCount}: fetch failed - ${error}`);
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
throw lastError;
|
|
90
|
+
}
|
|
91
|
+
if (!response.ok) {
|
|
92
|
+
const message = await buildNonOkMessage(response, requestUrl);
|
|
93
|
+
lastError = new Error(message);
|
|
94
|
+
const isRetryableStatus = (response.status >= 500 && response.status !== 502) || response.status === 403;
|
|
95
|
+
if (abortSignal?.aborted) {
|
|
96
|
+
throw lastError;
|
|
97
|
+
}
|
|
98
|
+
if (isRetryableStatus && attempt < maxAttempts - 1) {
|
|
99
|
+
console.warn(`httpRequest retry ${attempt + 1}/${retryCount}: status ${response.status} ${response.statusText}`);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
throw lastError;
|
|
103
|
+
}
|
|
104
|
+
return response;
|
|
105
|
+
}
|
|
106
|
+
throw lastError ?? new Error(`httpRequest failed: requestUrl=${requestUrl}`);
|
|
107
|
+
}
|
|
108
|
+
exports.default = httpRequest;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { httpRequest } from './httpRequest';
|
|
2
|
+
export { default as ProgressLogger } from './progressLogger';
|
|
3
|
+
export { timeoutAfter } from './timeoutAfter';
|
|
4
|
+
export { getS3Client, resetS3ClientForTests } from './s3/getS3Client';
|
|
5
|
+
export { default as listS3Objects, type S3ObjectEntry } from './s3/listS3Objects';
|
|
6
|
+
export { default as getS3Object, type GetS3ObjectResult } from './s3/getS3Object';
|
|
7
|
+
export { default as putS3Object } from './s3/putS3Object';
|
|
8
|
+
export { deleteS3Object } from './s3/deleteS3Object';
|
|
9
|
+
export { listS3Folder } from './s3/listS3Folder';
|
|
10
|
+
export { putS3Folder } from './s3/putS3Folder';
|
|
11
|
+
export { replaceS3Folder } from './s3/replaceS3Folder';
|
|
12
|
+
export { getSQSClient, resetSQSClientForTests } from './sqs/getSQSClient';
|
|
13
|
+
export { default as sendSQSMessage } from './sqs/sendSQSMessage';
|
|
14
|
+
export { default as deleteSQSMessage } from './sqs/deleteSQSMessage';
|
|
15
|
+
export { default as changeSQSMessageVisibilityTimeout } from './sqs/changeSQSMessageVisibilityTimeout';
|
|
16
|
+
export { createCloudFrontInvalidation } from './cloudfront/createCloudFrontInvalidation';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,iCAAiC,EAAE,MAAM,yCAAyC,CAAC;AAEvG,OAAO,EAAE,4BAA4B,EAAE,MAAM,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createCloudFrontInvalidation = exports.changeSQSMessageVisibilityTimeout = exports.deleteSQSMessage = exports.sendSQSMessage = exports.resetSQSClientForTests = exports.getSQSClient = exports.replaceS3Folder = exports.putS3Folder = exports.listS3Folder = exports.deleteS3Object = exports.putS3Object = exports.getS3Object = exports.listS3Objects = exports.resetS3ClientForTests = exports.getS3Client = exports.timeoutAfter = exports.ProgressLogger = exports.httpRequest = void 0;
|
|
7
|
+
var httpRequest_1 = require("./httpRequest");
|
|
8
|
+
Object.defineProperty(exports, "httpRequest", { enumerable: true, get: function () { return httpRequest_1.httpRequest; } });
|
|
9
|
+
var progressLogger_1 = require("./progressLogger");
|
|
10
|
+
Object.defineProperty(exports, "ProgressLogger", { enumerable: true, get: function () { return __importDefault(progressLogger_1).default; } });
|
|
11
|
+
var timeoutAfter_1 = require("./timeoutAfter");
|
|
12
|
+
Object.defineProperty(exports, "timeoutAfter", { enumerable: true, get: function () { return timeoutAfter_1.timeoutAfter; } });
|
|
13
|
+
var getS3Client_1 = require("./s3/getS3Client");
|
|
14
|
+
Object.defineProperty(exports, "getS3Client", { enumerable: true, get: function () { return getS3Client_1.getS3Client; } });
|
|
15
|
+
Object.defineProperty(exports, "resetS3ClientForTests", { enumerable: true, get: function () { return getS3Client_1.resetS3ClientForTests; } });
|
|
16
|
+
var listS3Objects_1 = require("./s3/listS3Objects");
|
|
17
|
+
Object.defineProperty(exports, "listS3Objects", { enumerable: true, get: function () { return __importDefault(listS3Objects_1).default; } });
|
|
18
|
+
var getS3Object_1 = require("./s3/getS3Object");
|
|
19
|
+
Object.defineProperty(exports, "getS3Object", { enumerable: true, get: function () { return __importDefault(getS3Object_1).default; } });
|
|
20
|
+
var putS3Object_1 = require("./s3/putS3Object");
|
|
21
|
+
Object.defineProperty(exports, "putS3Object", { enumerable: true, get: function () { return __importDefault(putS3Object_1).default; } });
|
|
22
|
+
var deleteS3Object_1 = require("./s3/deleteS3Object");
|
|
23
|
+
Object.defineProperty(exports, "deleteS3Object", { enumerable: true, get: function () { return deleteS3Object_1.deleteS3Object; } });
|
|
24
|
+
var listS3Folder_1 = require("./s3/listS3Folder");
|
|
25
|
+
Object.defineProperty(exports, "listS3Folder", { enumerable: true, get: function () { return listS3Folder_1.listS3Folder; } });
|
|
26
|
+
var putS3Folder_1 = require("./s3/putS3Folder");
|
|
27
|
+
Object.defineProperty(exports, "putS3Folder", { enumerable: true, get: function () { return putS3Folder_1.putS3Folder; } });
|
|
28
|
+
var replaceS3Folder_1 = require("./s3/replaceS3Folder");
|
|
29
|
+
Object.defineProperty(exports, "replaceS3Folder", { enumerable: true, get: function () { return replaceS3Folder_1.replaceS3Folder; } });
|
|
30
|
+
var getSQSClient_1 = require("./sqs/getSQSClient");
|
|
31
|
+
Object.defineProperty(exports, "getSQSClient", { enumerable: true, get: function () { return getSQSClient_1.getSQSClient; } });
|
|
32
|
+
Object.defineProperty(exports, "resetSQSClientForTests", { enumerable: true, get: function () { return getSQSClient_1.resetSQSClientForTests; } });
|
|
33
|
+
var sendSQSMessage_1 = require("./sqs/sendSQSMessage");
|
|
34
|
+
Object.defineProperty(exports, "sendSQSMessage", { enumerable: true, get: function () { return __importDefault(sendSQSMessage_1).default; } });
|
|
35
|
+
var deleteSQSMessage_1 = require("./sqs/deleteSQSMessage");
|
|
36
|
+
Object.defineProperty(exports, "deleteSQSMessage", { enumerable: true, get: function () { return __importDefault(deleteSQSMessage_1).default; } });
|
|
37
|
+
var changeSQSMessageVisibilityTimeout_1 = require("./sqs/changeSQSMessageVisibilityTimeout");
|
|
38
|
+
Object.defineProperty(exports, "changeSQSMessageVisibilityTimeout", { enumerable: true, get: function () { return __importDefault(changeSQSMessageVisibilityTimeout_1).default; } });
|
|
39
|
+
var createCloudFrontInvalidation_1 = require("./cloudfront/createCloudFrontInvalidation");
|
|
40
|
+
Object.defineProperty(exports, "createCloudFrontInvalidation", { enumerable: true, get: function () { return createCloudFrontInvalidation_1.createCloudFrontInvalidation; } });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare class ProgressLogger {
|
|
2
|
+
private title;
|
|
3
|
+
private total;
|
|
4
|
+
private chunkStart;
|
|
5
|
+
private chunkEnd;
|
|
6
|
+
private current;
|
|
7
|
+
private errors;
|
|
8
|
+
private successes;
|
|
9
|
+
private progressIntervals;
|
|
10
|
+
private lastProgressTime;
|
|
11
|
+
private readonly maxIntervalsForAverage;
|
|
12
|
+
constructor(title: string, total: number);
|
|
13
|
+
setChunk(start: number, end: number): void;
|
|
14
|
+
getResults(): {
|
|
15
|
+
errors: number;
|
|
16
|
+
successes: number;
|
|
17
|
+
remaining: number;
|
|
18
|
+
};
|
|
19
|
+
logError(message: string): void;
|
|
20
|
+
logProgress(message: string): void;
|
|
21
|
+
private getProgressLog;
|
|
22
|
+
}
|
|
23
|
+
export default ProgressLogger;
|
|
24
|
+
//# sourceMappingURL=progressLogger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progressLogger.d.ts","sourceRoot":"","sources":["../../src/helpers/progressLogger.ts"],"names":[],"mappings":"AAAA,cAAM,cAAc;IAChB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,OAAO,CAAa;IAC5B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,iBAAiB,CAAgB;IACzC,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,QAAQ,CAAC,sBAAsB,CAAc;gBAEzC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAMxC,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAO1C,UAAU,IAAI;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE;IAQtE,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAK/B,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKlC,OAAO,CAAC,cAAc;CAoDzB;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class ProgressLogger {
|
|
4
|
+
constructor(title, total) {
|
|
5
|
+
this.chunkStart = 0;
|
|
6
|
+
this.chunkEnd = 0;
|
|
7
|
+
this.current = 0;
|
|
8
|
+
this.errors = 0;
|
|
9
|
+
this.successes = 0;
|
|
10
|
+
this.progressIntervals = [];
|
|
11
|
+
this.lastProgressTime = null;
|
|
12
|
+
this.maxIntervalsForAverage = 10; // Keep last 10 intervals for running average
|
|
13
|
+
this.title = title;
|
|
14
|
+
this.total = total;
|
|
15
|
+
this.chunkEnd = total;
|
|
16
|
+
}
|
|
17
|
+
setChunk(start, end) {
|
|
18
|
+
this.chunkStart = start;
|
|
19
|
+
this.chunkEnd = end;
|
|
20
|
+
this.current = start;
|
|
21
|
+
this.lastProgressTime = Date.now();
|
|
22
|
+
}
|
|
23
|
+
getResults() {
|
|
24
|
+
return {
|
|
25
|
+
errors: this.errors,
|
|
26
|
+
successes: this.successes,
|
|
27
|
+
remaining: this.total - this.current,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
logError(message) {
|
|
31
|
+
this.errors++;
|
|
32
|
+
console.error(this.getProgressLog(message));
|
|
33
|
+
}
|
|
34
|
+
logProgress(message) {
|
|
35
|
+
this.successes++;
|
|
36
|
+
console.log(this.getProgressLog(message));
|
|
37
|
+
}
|
|
38
|
+
getProgressLog(message) {
|
|
39
|
+
const now = Date.now();
|
|
40
|
+
// Calculate time interval since last progress
|
|
41
|
+
if (this.lastProgressTime !== null) {
|
|
42
|
+
const interval = now - this.lastProgressTime;
|
|
43
|
+
this.progressIntervals.push(interval);
|
|
44
|
+
// Keep only the last N intervals for running average
|
|
45
|
+
if (this.progressIntervals.length > this.maxIntervalsForAverage) {
|
|
46
|
+
this.progressIntervals.shift();
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
this.current++;
|
|
50
|
+
this.lastProgressTime = now;
|
|
51
|
+
// Calculate running average time per item
|
|
52
|
+
const averageInterval = this.progressIntervals.length > 0
|
|
53
|
+
? this.progressIntervals.reduce((sum, interval) => sum + interval, 0) / this.progressIntervals.length
|
|
54
|
+
: 0;
|
|
55
|
+
// Calculate remaining items
|
|
56
|
+
const remainingInChunk = this.chunkEnd - this.current + 1;
|
|
57
|
+
const remainingTotal = this.total - this.current + 1;
|
|
58
|
+
// Calculate estimated time remaining
|
|
59
|
+
const estimatedTimeRemainingMs = averageInterval > 0
|
|
60
|
+
? averageInterval * remainingTotal
|
|
61
|
+
: 0;
|
|
62
|
+
// Format estimated time
|
|
63
|
+
const estimatedHours = Math.floor(estimatedTimeRemainingMs / (1000 * 60 * 60));
|
|
64
|
+
const estimatedMinutes = Math.floor((estimatedTimeRemainingMs % (1000 * 60 * 60)) / (1000 * 60));
|
|
65
|
+
const estimatedSeconds = Math.floor((estimatedTimeRemainingMs % (1000 * 60)) / 1000);
|
|
66
|
+
let estimatedTimeStr = '';
|
|
67
|
+
if (estimatedHours > 0) {
|
|
68
|
+
estimatedTimeStr = `${estimatedHours}h ${estimatedMinutes}m ${estimatedSeconds}s`;
|
|
69
|
+
}
|
|
70
|
+
else if (estimatedMinutes > 0) {
|
|
71
|
+
estimatedTimeStr = `${estimatedMinutes}m ${estimatedSeconds}s`;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
estimatedTimeStr = `${estimatedSeconds}s`;
|
|
75
|
+
}
|
|
76
|
+
return (`${this.title}: ${message} | ` +
|
|
77
|
+
`Progress: ${this.current}/${this.total} | ` +
|
|
78
|
+
`Remaining in chunk: ${remainingInChunk} | ` +
|
|
79
|
+
(estimatedTimeStr ? `ETA: ${estimatedTimeStr}` : 'ETA: calculating...'));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.default = ProgressLogger;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteS3Object.d.ts","sourceRoot":"","sources":["../../../src/helpers/s3/deleteS3Object.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAQ/E"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deleteS3Object = deleteS3Object;
|
|
4
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
+
const getS3Client_1 = require("./getS3Client");
|
|
6
|
+
/**
|
|
7
|
+
* Deletes a single object from S3.
|
|
8
|
+
*/
|
|
9
|
+
async function deleteS3Object(bucket, key) {
|
|
10
|
+
const client = (0, getS3Client_1.getS3Client)();
|
|
11
|
+
await client.send(new client_s3_1.DeleteObjectCommand({
|
|
12
|
+
Bucket: bucket,
|
|
13
|
+
Key: key,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
/**
|
|
3
|
+
* Returns a shared S3 client for the current Lambda container.
|
|
4
|
+
* Reusing a single client avoids repeated DNS lookups (getaddrinfo) and connection churn,
|
|
5
|
+
* which can help prevent EBUSY and similar errors under load.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getS3Client: () => S3Client;
|
|
8
|
+
/** Reset shared client (for tests only). */
|
|
9
|
+
export declare const resetS3ClientForTests: () => void;
|
|
10
|
+
//# sourceMappingURL=getS3Client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getS3Client.d.ts","sourceRoot":"","sources":["../../../src/helpers/s3/getS3Client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAI9C;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAAO,QAK9B,CAAC;AAEF,4CAA4C;AAC5C,eAAO,MAAM,qBAAqB,QAAO,IAExC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resetS3ClientForTests = exports.getS3Client = void 0;
|
|
4
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
+
let sharedClient = null;
|
|
6
|
+
/**
|
|
7
|
+
* Returns a shared S3 client for the current Lambda container.
|
|
8
|
+
* Reusing a single client avoids repeated DNS lookups (getaddrinfo) and connection churn,
|
|
9
|
+
* which can help prevent EBUSY and similar errors under load.
|
|
10
|
+
*/
|
|
11
|
+
const getS3Client = () => {
|
|
12
|
+
if (!sharedClient) {
|
|
13
|
+
sharedClient = new client_s3_1.S3Client({});
|
|
14
|
+
}
|
|
15
|
+
return sharedClient;
|
|
16
|
+
};
|
|
17
|
+
exports.getS3Client = getS3Client;
|
|
18
|
+
/** Reset shared client (for tests only). */
|
|
19
|
+
const resetS3ClientForTests = () => {
|
|
20
|
+
sharedClient = null;
|
|
21
|
+
};
|
|
22
|
+
exports.resetS3ClientForTests = resetS3ClientForTests;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type GetS3ObjectResult = {
|
|
2
|
+
body: string;
|
|
3
|
+
contentType?: string;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Fetches an object from S3 and returns its body as a string and optional Content-Type.
|
|
7
|
+
* Uses the shared S3 client from getS3Client.
|
|
8
|
+
*
|
|
9
|
+
* @param bucket - S3 bucket name
|
|
10
|
+
* @param key - S3 object key
|
|
11
|
+
* @returns Object with body (string) and optional contentType from the response
|
|
12
|
+
* @throws NoSuchKey or other S3 errors (caller should handle for 404/500)
|
|
13
|
+
*/
|
|
14
|
+
declare const getS3Object: (bucket: string, key: string) => Promise<GetS3ObjectResult>;
|
|
15
|
+
export default getS3Object;
|
|
16
|
+
//# sourceMappingURL=getS3Object.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getS3Object.d.ts","sourceRoot":"","sources":["../../../src/helpers/s3/getS3Object.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;;;;;GAQG;AACH,QAAA,MAAM,WAAW,GAAU,QAAQ,MAAM,EAAE,KAAK,MAAM,KAAG,OAAO,CAAC,iBAAiB,CAoBjF,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
4
|
+
const getS3Client_1 = require("./getS3Client");
|
|
5
|
+
/**
|
|
6
|
+
* Fetches an object from S3 and returns its body as a string and optional Content-Type.
|
|
7
|
+
* Uses the shared S3 client from getS3Client.
|
|
8
|
+
*
|
|
9
|
+
* @param bucket - S3 bucket name
|
|
10
|
+
* @param key - S3 object key
|
|
11
|
+
* @returns Object with body (string) and optional contentType from the response
|
|
12
|
+
* @throws NoSuchKey or other S3 errors (caller should handle for 404/500)
|
|
13
|
+
*/
|
|
14
|
+
const getS3Object = async (bucket, key) => {
|
|
15
|
+
const s3Client = (0, getS3Client_1.getS3Client)();
|
|
16
|
+
const response = await s3Client.send(new client_s3_1.GetObjectCommand({
|
|
17
|
+
Bucket: bucket,
|
|
18
|
+
Key: key,
|
|
19
|
+
}));
|
|
20
|
+
if (response.Body == null) {
|
|
21
|
+
const err = new Error('S3 GetObject returned no body');
|
|
22
|
+
err.name = 'NoSuchKey';
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
const body = await response.Body.transformToString();
|
|
26
|
+
const contentType = response.ContentType;
|
|
27
|
+
return contentType !== undefined ? { body, contentType } : { body };
|
|
28
|
+
};
|
|
29
|
+
exports.default = getS3Object;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lists all object keys in an S3 "folder" (objects with the given prefix).
|
|
3
|
+
* Prefix is normalized to end with / so that e.g. "trails" lists keys under "trails/".
|
|
4
|
+
*
|
|
5
|
+
* @returns Array of full S3 keys (e.g. ["trails/0/0/0.pbf", "trails/1/0/0.pbf"])
|
|
6
|
+
*/
|
|
7
|
+
export declare function listS3Folder(bucket: string, prefix: string): Promise<string[]>;
|
|
8
|
+
//# sourceMappingURL=listS3Folder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listS3Folder.d.ts","sourceRoot":"","sources":["../../../src/helpers/s3/listS3Folder.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAuBpF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listS3Folder = listS3Folder;
|
|
4
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
+
const getS3Client_1 = require("./getS3Client");
|
|
6
|
+
/**
|
|
7
|
+
* Lists all object keys in an S3 "folder" (objects with the given prefix).
|
|
8
|
+
* Prefix is normalized to end with / so that e.g. "trails" lists keys under "trails/".
|
|
9
|
+
*
|
|
10
|
+
* @returns Array of full S3 keys (e.g. ["trails/0/0/0.pbf", "trails/1/0/0.pbf"])
|
|
11
|
+
*/
|
|
12
|
+
async function listS3Folder(bucket, prefix) {
|
|
13
|
+
const normalizedPrefix = prefix.replace(/\/$/, '') + '/';
|
|
14
|
+
const client = (0, getS3Client_1.getS3Client)();
|
|
15
|
+
const keys = [];
|
|
16
|
+
let continuationToken;
|
|
17
|
+
do {
|
|
18
|
+
const list = await client.send(new client_s3_1.ListObjectsV2Command({
|
|
19
|
+
Bucket: bucket,
|
|
20
|
+
Prefix: normalizedPrefix,
|
|
21
|
+
ContinuationToken: continuationToken,
|
|
22
|
+
}));
|
|
23
|
+
if (list.Contents?.length) {
|
|
24
|
+
for (const obj of list.Contents) {
|
|
25
|
+
if (obj.Key)
|
|
26
|
+
keys.push(obj.Key);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
continuationToken = list.IsTruncated ? list.NextContinuationToken : undefined;
|
|
30
|
+
} while (continuationToken);
|
|
31
|
+
return keys;
|
|
32
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type S3ObjectEntry = {
|
|
2
|
+
key: string;
|
|
3
|
+
size: number;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* Lists all objects under an S3 prefix (paginated via continuation tokens).
|
|
7
|
+
* Prefix is normalized the same way as `listS3Folder`: a trailing slash is ensured so listing is consistent.
|
|
8
|
+
*
|
|
9
|
+
* @param bucket - S3 bucket name
|
|
10
|
+
* @param prefix - Key prefix (e.g. `tiles/uuid` or `tiles/uuid/`); normalized to end with `/`
|
|
11
|
+
* @returns One entry per object (key + ContentLength, missing size treated as 0)
|
|
12
|
+
*/
|
|
13
|
+
declare const listS3Objects: (bucket: string, prefix: string) => Promise<S3ObjectEntry[]>;
|
|
14
|
+
export default listS3Objects;
|
|
15
|
+
//# sourceMappingURL=listS3Objects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listS3Objects.d.ts","sourceRoot":"","sources":["../../../src/helpers/s3/listS3Objects.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;;;;GAOG;AACH,QAAA,MAAM,aAAa,GAAU,QAAQ,MAAM,EAAE,QAAQ,MAAM,KAAG,OAAO,CAAC,aAAa,EAAE,CAyBpF,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
4
|
+
const getS3Client_1 = require("./getS3Client");
|
|
5
|
+
/**
|
|
6
|
+
* Lists all objects under an S3 prefix (paginated via continuation tokens).
|
|
7
|
+
* Prefix is normalized the same way as `listS3Folder`: a trailing slash is ensured so listing is consistent.
|
|
8
|
+
*
|
|
9
|
+
* @param bucket - S3 bucket name
|
|
10
|
+
* @param prefix - Key prefix (e.g. `tiles/uuid` or `tiles/uuid/`); normalized to end with `/`
|
|
11
|
+
* @returns One entry per object (key + ContentLength, missing size treated as 0)
|
|
12
|
+
*/
|
|
13
|
+
const listS3Objects = async (bucket, prefix) => {
|
|
14
|
+
const normalizedPrefix = prefix.replace(/\/$/, '') + '/';
|
|
15
|
+
const client = (0, getS3Client_1.getS3Client)();
|
|
16
|
+
const entries = [];
|
|
17
|
+
let continuationToken;
|
|
18
|
+
do {
|
|
19
|
+
const list = await client.send(new client_s3_1.ListObjectsV2Command({
|
|
20
|
+
Bucket: bucket,
|
|
21
|
+
Prefix: normalizedPrefix,
|
|
22
|
+
ContinuationToken: continuationToken,
|
|
23
|
+
}));
|
|
24
|
+
if (list.Contents?.length) {
|
|
25
|
+
for (const obj of list.Contents) {
|
|
26
|
+
if (obj.Key == null)
|
|
27
|
+
continue;
|
|
28
|
+
const size = obj.Size ?? 0;
|
|
29
|
+
entries.push({ key: obj.Key, size });
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
continuationToken = list.IsTruncated ? list.NextContinuationToken : undefined;
|
|
33
|
+
} while (continuationToken);
|
|
34
|
+
return entries;
|
|
35
|
+
};
|
|
36
|
+
exports.default = listS3Objects;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Uploads all files from inFolder to S3 under keyPrefix, preserving directory structure.
|
|
3
|
+
* Each file is uploaded with the given contentType. Logs progress and errors via ProgressLogger.
|
|
4
|
+
*
|
|
5
|
+
* @param inFolder - Local directory to upload (e.g. /tmp/trails-tiles)
|
|
6
|
+
* @param keyPrefix - S3 key prefix (e.g. trails or routeMarkers). No trailing slash.
|
|
7
|
+
* @param bucket - S3 bucket name
|
|
8
|
+
* @param contentType - Content-Type header for every uploaded file
|
|
9
|
+
* @returns Array of all S3 keys that correspond to the local files (whether or not each upload succeeded).
|
|
10
|
+
* Used by replaceS3Folder so we only delete existing keys not in this set—failed overwrites are not removed.
|
|
11
|
+
*/
|
|
12
|
+
export declare function putS3Folder(inFolder: string, keyPrefix: string, bucket: string, contentType: string): Promise<string[]>;
|
|
13
|
+
//# sourceMappingURL=putS3Folder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"putS3Folder.d.ts","sourceRoot":"","sources":["../../../src/helpers/s3/putS3Folder.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;GAUG;AACH,wBAAsB,WAAW,CAC7B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,EAAE,CAAC,CAsBnB"}
|