@axiumine/koa-utils 9.2.0 → 10.0.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/README.md +33 -6
- package/dist/email/ISocketLabsClient.d.mts +4 -3
- package/dist/email/ISocketLabsMessage.d.mts +1 -1
- package/dist/email/ISocketLabsSendResult.d.mts +3 -3
- package/dist/email/ISocketLabsSenderOptions.d.mts +9 -8
- package/dist/email/SocketLabsLib.d.mts +2 -15
- package/dist/email/SocketLabsLib.mjs +4 -19
- package/dist/email/createSocketLabsSender.d.mts +9 -8
- package/dist/email/createSocketLabsSender.mjs +16 -22
- package/dist/files/VirusScanError.d.mts +14 -0
- package/dist/files/VirusScanError.mjs +19 -0
- package/dist/files/reEncodePdf.d.mts +43 -0
- package/dist/files/reEncodePdf.mjs +39 -0
- package/dist/files/scanVirus.d.mts +18 -5
- package/dist/files/scanVirus.mjs +56 -22
- package/dist/files/storeUploadAsTemp.d.mts +13 -1
- package/dist/files/storeUploadAsTemp.mjs +21 -3
- package/dist/files/uploadTempImage.d.mts +19 -1
- package/dist/files/uploadTempImage.mjs +52 -17
- package/dist/files/uploadTempPdf.d.mts +14 -3
- package/dist/files/uploadTempPdf.mjs +52 -17
- package/dist/private/email/ISocketLabsBasicMessage.d.mts +22 -0
- package/dist/private/email/ISocketLabsBasicMessage.mjs +2 -0
- package/dist/private/email/ISocketLabsOutcome.d.mts +10 -0
- package/dist/private/email/ISocketLabsOutcome.mjs +2 -0
- package/dist/private/email/SocketLabsSendError.d.mts +17 -0
- package/dist/private/email/SocketLabsSendError.mjs +21 -0
- package/dist/private/email/socketLabsClient.d.mts +26 -0
- package/dist/private/email/socketLabsClient.mjs +80 -0
- package/dist/private/email/socketLabsMessage.d.mts +9 -0
- package/dist/private/email/socketLabsMessage.mjs +36 -0
- package/dist/private/email/socketLabsRequest.d.mts +19 -0
- package/dist/private/email/socketLabsRequest.mjs +86 -0
- package/dist/private/email/socketLabsResponse.d.mts +10 -0
- package/dist/private/email/socketLabsResponse.mjs +49 -0
- package/dist/private/email/withDefined.d.mts +4 -0
- package/dist/private/email/withDefined.mjs +5 -0
- package/dist/private/files/assertWholeNumber.d.mts +9 -0
- package/dist/private/files/assertWholeNumber.mjs +14 -0
- package/dist/private/files/reEncode.d.mts +10 -2
- package/dist/private/files/reEncode.mjs +28 -15
- package/dist/private/files/replaceExtension.d.mts +8 -0
- package/dist/private/files/replaceExtension.mjs +11 -0
- package/dist/private/glb/reEncodeImage.d.mts +2 -2
- package/dist/private/glb/reEncodeImage.mjs +2 -2
- package/dist/private/lib/createLimiter.d.mts +7 -0
- package/dist/private/lib/createLimiter.mjs +31 -0
- package/dist/private/lib/createSentryClient.mjs +1 -0
- package/dist/private/pdf/pdfDictionary.d.mts +9 -0
- package/dist/private/pdf/pdfDictionary.mjs +25 -0
- package/dist/private/pdf/pdfStripRules.d.mts +12 -0
- package/dist/private/pdf/pdfStripRules.mjs +56 -0
- package/dist/private/pdf/resolvePdfOptions.d.mts +15 -0
- package/dist/private/pdf/resolvePdfOptions.mjs +49 -0
- package/dist/private/pdf/rewritePdf.d.mts +11 -0
- package/dist/private/pdf/rewritePdf.mjs +29 -0
- package/dist/private/pdf/rewritePdfWorker.d.mts +1 -0
- package/dist/private/pdf/rewritePdfWorker.mjs +7 -0
- package/dist/private/pdf/runInWorker.d.mts +10 -0
- package/dist/private/pdf/runInWorker.mjs +45 -0
- package/dist/private/pdf/stripPdf.d.mts +7 -0
- package/dist/private/pdf/stripPdf.mjs +67 -0
- package/dist/s3/S3ObjectTooLargeError.d.mts +8 -0
- package/dist/s3/S3ObjectTooLargeError.mjs +13 -0
- package/dist/s3/createS3Client.d.mts +18 -0
- package/dist/s3/createS3Client.mjs +20 -0
- package/dist/s3/deleteObject.d.mts +9 -0
- package/dist/s3/deleteObject.mjs +9 -0
- package/dist/s3/getObjectToFile.d.mts +19 -0
- package/dist/s3/getObjectToFile.mjs +52 -0
- package/dist/s3/headObject.d.mts +17 -0
- package/dist/s3/headObject.mjs +23 -0
- package/dist/s3/presignPutUrl.d.mts +22 -0
- package/dist/s3/presignPutUrl.mjs +27 -0
- package/dist/s3/putObject.d.mts +15 -0
- package/dist/s3/putObject.mjs +10 -0
- package/package.json +62 -19
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An object bigger than the limit given to `getObjectToFile`.
|
|
3
|
+
*/
|
|
4
|
+
export class S3ObjectTooLargeError extends Error {
|
|
5
|
+
/** the limit in bytes */
|
|
6
|
+
maxBytes;
|
|
7
|
+
constructor(maxBytes) {
|
|
8
|
+
super(`Object size exceeds the limit of ${maxBytes} bytes`);
|
|
9
|
+
this.name = 'S3ObjectTooLargeError';
|
|
10
|
+
this.maxBytes = maxBytes;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=S3ObjectTooLargeError.mjs.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
export interface IS3ClientOptions {
|
|
3
|
+
/** URL of the service. Cloudflare R2: `https://<account>.r2.cloudflarestorage.com`, EU: `https://<account>.eu.r2.cloudflarestorage.com` */
|
|
4
|
+
endpoint: string;
|
|
5
|
+
/** Cloudflare R2: `auto` */
|
|
6
|
+
region: string;
|
|
7
|
+
accessKeyId: string;
|
|
8
|
+
secretAccessKey: string;
|
|
9
|
+
/** `true` (default): `https://host/bucket/key`. `false`: `https://bucket.host/key` */
|
|
10
|
+
forcePathStyle?: boolean | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Client for S3-compatible storage with static credentials.
|
|
14
|
+
*
|
|
15
|
+
* Checksums are sent and checked only where an operation requires them: not every S3-compatible service takes the ones
|
|
16
|
+
* the SDK adds by default, and a presigned PUT URL would carry the checksum of an empty body.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createS3Client(options: IS3ClientOptions): S3Client;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
/* eslint-enable sonarjs/no-redundant-optional -- end of the exactOptionalPropertyTypes block above */
|
|
3
|
+
/**
|
|
4
|
+
* Client for S3-compatible storage with static credentials.
|
|
5
|
+
*
|
|
6
|
+
* Checksums are sent and checked only where an operation requires them: not every S3-compatible service takes the ones
|
|
7
|
+
* the SDK adds by default, and a presigned PUT URL would carry the checksum of an empty body.
|
|
8
|
+
*/
|
|
9
|
+
export function createS3Client(options) {
|
|
10
|
+
const { endpoint, region, accessKeyId, secretAccessKey, forcePathStyle = true } = options;
|
|
11
|
+
return new S3Client({
|
|
12
|
+
endpoint,
|
|
13
|
+
region,
|
|
14
|
+
credentials: { accessKeyId, secretAccessKey },
|
|
15
|
+
forcePathStyle,
|
|
16
|
+
requestChecksumCalculation: 'WHEN_REQUIRED',
|
|
17
|
+
responseChecksumValidation: 'WHEN_REQUIRED'
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=createS3Client.mjs.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
export interface IDeleteObjectInput {
|
|
3
|
+
bucket: string;
|
|
4
|
+
key: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Delete an object. A key that holds no object is not an error.
|
|
8
|
+
*/
|
|
9
|
+
export declare function deleteObject(client: S3Client, input: IDeleteObjectInput): Promise<void>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DeleteObjectCommand } from '@aws-sdk/client-s3';
|
|
2
|
+
/**
|
|
3
|
+
* Delete an object. A key that holds no object is not an error.
|
|
4
|
+
*/
|
|
5
|
+
export async function deleteObject(client, input) {
|
|
6
|
+
const { bucket, key } = input;
|
|
7
|
+
await client.send(new DeleteObjectCommand({ Bucket: bucket, Key: key }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=deleteObject.mjs.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
import type { IHeadObjectResult } from './headObject.mjs';
|
|
3
|
+
export interface IGetObjectToFileInput {
|
|
4
|
+
bucket: string;
|
|
5
|
+
key: string;
|
|
6
|
+
/** file to write. It is replaced when it exists; its folder must exist */
|
|
7
|
+
filePath: string;
|
|
8
|
+
/** biggest accepted object in bytes */
|
|
9
|
+
maxBytes: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Download an object to a file, never writing more than `maxBytes`. The size the service reports is checked first, then
|
|
13
|
+
* every byte received. A download that fails or passes the limit leaves no file.
|
|
14
|
+
*
|
|
15
|
+
* @returns the number of bytes written and the content type of the object
|
|
16
|
+
* @throws S3ObjectTooLargeError past `maxBytes`, `TypeError` for an invalid `maxBytes`, and the errors of the SDK and of
|
|
17
|
+
* `fs`
|
|
18
|
+
*/
|
|
19
|
+
export declare function getObjectToFile(client: S3Client, input: IGetObjectToFileInput): Promise<IHeadObjectResult>;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { pipeline } from 'node:stream/promises';
|
|
2
|
+
import { GetObjectCommand } from '@aws-sdk/client-s3';
|
|
3
|
+
import { assertWholeNumber } from "../private/files/assertWholeNumber.mjs";
|
|
4
|
+
import { promises as fs } from 'fs';
|
|
5
|
+
import { S3ObjectTooLargeError } from './S3ObjectTooLargeError.mjs';
|
|
6
|
+
async function writeCapped(body, filePath, maxBytes) {
|
|
7
|
+
// opened before the transfer starts, so that only a file this call has opened is ever removed
|
|
8
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename -- the path is the caller's own, nothing here builds it from request data
|
|
9
|
+
const file = await fs.open(filePath, 'w');
|
|
10
|
+
let size = 0;
|
|
11
|
+
try {
|
|
12
|
+
await pipeline(body, async function* (chunks) {
|
|
13
|
+
for await (const chunk of chunks) {
|
|
14
|
+
size += chunk.length;
|
|
15
|
+
if (size > maxBytes)
|
|
16
|
+
throw new S3ObjectTooLargeError(maxBytes);
|
|
17
|
+
yield chunk;
|
|
18
|
+
}
|
|
19
|
+
}, file.createWriteStream());
|
|
20
|
+
}
|
|
21
|
+
catch (e) {
|
|
22
|
+
await fs.rm(filePath, { force: true });
|
|
23
|
+
throw e;
|
|
24
|
+
}
|
|
25
|
+
return size;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Download an object to a file, never writing more than `maxBytes`. The size the service reports is checked first, then
|
|
29
|
+
* every byte received. A download that fails or passes the limit leaves no file.
|
|
30
|
+
*
|
|
31
|
+
* @returns the number of bytes written and the content type of the object
|
|
32
|
+
* @throws S3ObjectTooLargeError past `maxBytes`, `TypeError` for an invalid `maxBytes`, and the errors of the SDK and of
|
|
33
|
+
* `fs`
|
|
34
|
+
*/
|
|
35
|
+
export async function getObjectToFile(client, input) {
|
|
36
|
+
const { bucket, key, filePath, maxBytes } = input;
|
|
37
|
+
assertWholeNumber(maxBytes, 'maxBytes');
|
|
38
|
+
const { Body, ContentLength = 0, ContentType } = await client.send(new GetObjectCommand({ Bucket: bucket, Key: key }));
|
|
39
|
+
// in Node the SDK hands the body over as a readable stream
|
|
40
|
+
const body = Body;
|
|
41
|
+
try {
|
|
42
|
+
if (ContentLength > maxBytes)
|
|
43
|
+
throw new S3ObjectTooLargeError(maxBytes);
|
|
44
|
+
const size = await writeCapped(body, filePath, maxBytes);
|
|
45
|
+
return { size, contentType: ContentType };
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
// frees the connection when nothing has read the body to its end; does nothing to a body read in full
|
|
49
|
+
body.destroy();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=getObjectToFile.mjs.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
export interface IHeadObjectInput {
|
|
3
|
+
bucket: string;
|
|
4
|
+
key: string;
|
|
5
|
+
}
|
|
6
|
+
export interface IHeadObjectResult {
|
|
7
|
+
/** size in bytes */
|
|
8
|
+
size: number;
|
|
9
|
+
contentType: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Size and content type of an object, `undefined` when the service answers 404. A HEAD answer has no body, so a missing
|
|
13
|
+
* bucket looks the same as a missing object.
|
|
14
|
+
*
|
|
15
|
+
* Throws when the answer has no size, so that a caller that checks the size never reads an unknown one as small.
|
|
16
|
+
*/
|
|
17
|
+
export declare function headObject(client: S3Client, input: IHeadObjectInput): Promise<IHeadObjectResult | undefined>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { HeadObjectCommand, NotFound } from '@aws-sdk/client-s3';
|
|
2
|
+
/**
|
|
3
|
+
* Size and content type of an object, `undefined` when the service answers 404. A HEAD answer has no body, so a missing
|
|
4
|
+
* bucket looks the same as a missing object.
|
|
5
|
+
*
|
|
6
|
+
* Throws when the answer has no size, so that a caller that checks the size never reads an unknown one as small.
|
|
7
|
+
*/
|
|
8
|
+
export async function headObject(client, input) {
|
|
9
|
+
const { bucket, key } = input;
|
|
10
|
+
const head = await client.send(new HeadObjectCommand({ Bucket: bucket, Key: key })).catch((e) => {
|
|
11
|
+
if (e instanceof NotFound)
|
|
12
|
+
return undefined;
|
|
13
|
+
throw e;
|
|
14
|
+
});
|
|
15
|
+
if (head === undefined)
|
|
16
|
+
return undefined;
|
|
17
|
+
const { ContentLength, ContentType } = head;
|
|
18
|
+
if (ContentLength === undefined) {
|
|
19
|
+
throw new Error('The storage service did not report the object size');
|
|
20
|
+
}
|
|
21
|
+
return { size: ContentLength, contentType: ContentType };
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=headObject.mjs.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
2
|
+
export interface IPresignPutUrlInput {
|
|
3
|
+
bucket: string;
|
|
4
|
+
key: string;
|
|
5
|
+
/** `Content-Type` the upload must send */
|
|
6
|
+
contentType: string;
|
|
7
|
+
/** exact size of the upload in bytes, sent as `Content-Length` */
|
|
8
|
+
contentLength: number;
|
|
9
|
+
/** life of the URL in seconds, at most 604800 */
|
|
10
|
+
expiresIn: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* URL that lets its holder PUT one object, with the content type and the content length signed into it. A service that
|
|
14
|
+
* checks the signature refuses a request that sends another value of either header. The URL does not limit how many
|
|
15
|
+
* times it is used before it expires.
|
|
16
|
+
*
|
|
17
|
+
* Use a client from `createS3Client`: one with the default checksum settings of the SDK signs the checksum of an empty
|
|
18
|
+
* body into the URL.
|
|
19
|
+
*
|
|
20
|
+
* @throws TypeError for an empty content type, or a length or life that is not a whole number in range
|
|
21
|
+
*/
|
|
22
|
+
export declare function presignPutUrl(client: S3Client, input: IPresignPutUrlInput): Promise<string>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PutObjectCommand } from '@aws-sdk/client-s3';
|
|
2
|
+
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
|
|
3
|
+
import { assertWholeNumber } from "../private/files/assertWholeNumber.mjs";
|
|
4
|
+
// longest life of a Signature Version 4 presigned URL: 7 days
|
|
5
|
+
const MAX_EXPIRES_IN = 604_800;
|
|
6
|
+
/**
|
|
7
|
+
* URL that lets its holder PUT one object, with the content type and the content length signed into it. A service that
|
|
8
|
+
* checks the signature refuses a request that sends another value of either header. The URL does not limit how many
|
|
9
|
+
* times it is used before it expires.
|
|
10
|
+
*
|
|
11
|
+
* Use a client from `createS3Client`: one with the default checksum settings of the SDK signs the checksum of an empty
|
|
12
|
+
* body into the URL.
|
|
13
|
+
*
|
|
14
|
+
* @throws TypeError for an empty content type, or a length or life that is not a whole number in range
|
|
15
|
+
*/
|
|
16
|
+
export async function presignPutUrl(client, input) {
|
|
17
|
+
const { bucket, key, contentType, contentLength, expiresIn } = input;
|
|
18
|
+
// a header with no value is left out of the signature, which would let the upload send any value
|
|
19
|
+
if (!contentType)
|
|
20
|
+
throw new TypeError('Invalid contentType: expected a non-empty string');
|
|
21
|
+
assertWholeNumber(contentLength, 'contentLength');
|
|
22
|
+
assertWholeNumber(expiresIn, 'expiresIn', MAX_EXPIRES_IN);
|
|
23
|
+
const command = new PutObjectCommand({ Bucket: bucket, Key: key, ContentType: contentType, ContentLength: contentLength });
|
|
24
|
+
// the presigner leaves content-type out of the signature unless it is named here; content-length is signed without that
|
|
25
|
+
return await getSignedUrl(client, command, { expiresIn, signableHeaders: new Set(['content-type']) });
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=presignPutUrl.mjs.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Readable } from 'node:stream';
|
|
2
|
+
import { S3Client } from '@aws-sdk/client-s3';
|
|
3
|
+
export interface IPutObjectInput {
|
|
4
|
+
bucket: string;
|
|
5
|
+
key: string;
|
|
6
|
+
/** the bytes, or a file stream (`fs.createReadStream`): the length of any other stream is unknown and refused */
|
|
7
|
+
body: Uint8Array | string | Readable;
|
|
8
|
+
contentType: string;
|
|
9
|
+
/** value of the `Cache-Control` header the object is served with */
|
|
10
|
+
cacheControl?: string | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Store an object. An object already at that key is replaced.
|
|
14
|
+
*/
|
|
15
|
+
export declare function putObject(client: S3Client, input: IPutObjectInput): Promise<void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PutObjectCommand } from '@aws-sdk/client-s3';
|
|
2
|
+
/* eslint-enable sonarjs/no-redundant-optional -- end of the exactOptionalPropertyTypes block above */
|
|
3
|
+
/**
|
|
4
|
+
* Store an object. An object already at that key is replaced.
|
|
5
|
+
*/
|
|
6
|
+
export async function putObject(client, input) {
|
|
7
|
+
const { bucket, key, body, contentType, cacheControl } = input;
|
|
8
|
+
await client.send(new PutObjectCommand({ Bucket: bucket, Key: key, Body: body, ContentType: contentType, CacheControl: cacheControl }));
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=putObject.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axiumine/koa-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.0",
|
|
4
4
|
"description": "Koa Utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"prepare:all": "echo 'read REAMDE' && rm -rf dist && yarn run build:all",
|
|
25
25
|
"build:all": "yarn run build:cjs && yarn run build:esm",
|
|
26
26
|
"build:cjs": "yarn run tsc -p tsconfig.cjs.json && find dist/cjs -type f -name \"*.js\" -exec bash -c 'mv \"$0\" \"${0%.js}.cjs\"' {} \\; && cp -R dist/cjs/* dist/ && rm -rf dist/cjs",
|
|
27
|
-
"build:esm": "yarn run
|
|
27
|
+
"build:esm": "yarn run tsc -p tsconfig.json && find dist/esm -type f -name \"*.js\" -exec bash -c 'mv \"$0\" \"${0%.js}.mjs\"' {} \\; && node scripts/rewrite-path-aliases.mts tsconfig.json && cp -R dist/esm/* dist/ && find dist -name \"*.mjs.map\" -exec sed -i -E 's#(\"sources\":\\[\")\\.\\./#\\1#' {} + && rm -rf dist/esm",
|
|
28
28
|
"lint": "eslint --fix && prettier --write 'src/**/*.mts' 'scripts/**/*.mts'",
|
|
29
29
|
"lint:check": "eslint --max-warnings 0 --cache && prettier --check 'src/**/*.mts' 'scripts/**/*.mts'",
|
|
30
30
|
"typecheck": "tsc -p tsconfig.check.json --noEmit",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"leak:check": "node --expose-gc scripts/leak-check.mts",
|
|
43
43
|
"check:static": "yarn caps && yarn lint:check && yarn typecheck && yarn typecheck:scripts && yarn typecheck:tests && yarn knip && yarn type-coverage && yarn fta",
|
|
44
44
|
"clean": "rm -rf ./dist",
|
|
45
|
-
"build:tests": "rm -rf dist-test && yarn run
|
|
45
|
+
"build:tests": "rm -rf dist-test && yarn run tsc -p tsconfig.build-tests.json && find dist-test -type f -name \"*.js\" -exec bash -c 'mv \"$0\" \"${0%.js}.mjs\"' {} \\; && node scripts/rewrite-path-aliases.mts tsconfig.build-tests.json",
|
|
46
46
|
"test": "yarn build && yarn build:tests && mocha",
|
|
47
47
|
"test:watch": "mocha --watch",
|
|
48
48
|
"test:coverage": "yarn build && yarn build:tests && c8 mocha",
|
|
@@ -142,6 +142,10 @@
|
|
|
142
142
|
"import": "./dist/lib/throwIfNotValidEnumValue.mjs",
|
|
143
143
|
"types": "./dist/lib/throwIfNotValidEnumValue.d.mts"
|
|
144
144
|
},
|
|
145
|
+
"./files/VirusScanError": {
|
|
146
|
+
"import": "./dist/files/VirusScanError.mjs",
|
|
147
|
+
"types": "./dist/files/VirusScanError.d.mts"
|
|
148
|
+
},
|
|
145
149
|
"./files/IUploadTemp": {
|
|
146
150
|
"import": "./dist/files/IUploadTemp.mjs",
|
|
147
151
|
"types": "./dist/files/IUploadTemp.d.mts"
|
|
@@ -170,6 +174,10 @@
|
|
|
170
174
|
"import": "./dist/files/fileConst.mjs",
|
|
171
175
|
"types": "./dist/files/fileConst.d.mts"
|
|
172
176
|
},
|
|
177
|
+
"./files/reEncodePdf": {
|
|
178
|
+
"import": "./dist/files/reEncodePdf.mjs",
|
|
179
|
+
"types": "./dist/files/reEncodePdf.d.mts"
|
|
180
|
+
},
|
|
173
181
|
"./files/reEncodeToJpeg": {
|
|
174
182
|
"import": "./dist/files/reEncodeToJpeg.mjs",
|
|
175
183
|
"types": "./dist/files/reEncodeToJpeg.d.mts"
|
|
@@ -242,6 +250,34 @@
|
|
|
242
250
|
"import": "./dist/files/IGlbContainer.mjs",
|
|
243
251
|
"types": "./dist/files/IGlbContainer.d.mts"
|
|
244
252
|
},
|
|
253
|
+
"./s3/createS3Client": {
|
|
254
|
+
"import": "./dist/s3/createS3Client.mjs",
|
|
255
|
+
"types": "./dist/s3/createS3Client.d.mts"
|
|
256
|
+
},
|
|
257
|
+
"./s3/putObject": {
|
|
258
|
+
"import": "./dist/s3/putObject.mjs",
|
|
259
|
+
"types": "./dist/s3/putObject.d.mts"
|
|
260
|
+
},
|
|
261
|
+
"./s3/headObject": {
|
|
262
|
+
"import": "./dist/s3/headObject.mjs",
|
|
263
|
+
"types": "./dist/s3/headObject.d.mts"
|
|
264
|
+
},
|
|
265
|
+
"./s3/getObjectToFile": {
|
|
266
|
+
"import": "./dist/s3/getObjectToFile.mjs",
|
|
267
|
+
"types": "./dist/s3/getObjectToFile.d.mts"
|
|
268
|
+
},
|
|
269
|
+
"./s3/deleteObject": {
|
|
270
|
+
"import": "./dist/s3/deleteObject.mjs",
|
|
271
|
+
"types": "./dist/s3/deleteObject.d.mts"
|
|
272
|
+
},
|
|
273
|
+
"./s3/presignPutUrl": {
|
|
274
|
+
"import": "./dist/s3/presignPutUrl.mjs",
|
|
275
|
+
"types": "./dist/s3/presignPutUrl.d.mts"
|
|
276
|
+
},
|
|
277
|
+
"./s3/S3ObjectTooLargeError": {
|
|
278
|
+
"import": "./dist/s3/S3ObjectTooLargeError.mjs",
|
|
279
|
+
"types": "./dist/s3/S3ObjectTooLargeError.d.mts"
|
|
280
|
+
},
|
|
245
281
|
"./graphQL/schema/types/MidNameType": {
|
|
246
282
|
"import": "./dist/graphQL/schema/types/MidNameType.mjs",
|
|
247
283
|
"types": "./dist/graphQL/schema/types/MidNameType.d.mts"
|
|
@@ -1249,12 +1285,13 @@
|
|
|
1249
1285
|
"!dist/**/*.js.map"
|
|
1250
1286
|
],
|
|
1251
1287
|
"peerDependencies": {
|
|
1288
|
+
"@aws-sdk/client-s3": "<4",
|
|
1289
|
+
"@aws-sdk/s3-request-presigner": "<4",
|
|
1252
1290
|
"@gltf-transform/core": "<5",
|
|
1253
1291
|
"@gltf-transform/extensions": "<5",
|
|
1254
1292
|
"@gltf-transform/functions": "<5",
|
|
1255
1293
|
"@node-rs/bcrypt": "<2",
|
|
1256
1294
|
"@sentry/node": "<11",
|
|
1257
|
-
"@socketlabs/email": "<2",
|
|
1258
1295
|
"clamscan": "<3",
|
|
1259
1296
|
"dotenv": "<18",
|
|
1260
1297
|
"file-type": "<23",
|
|
@@ -1266,6 +1303,7 @@
|
|
|
1266
1303
|
"mariadb": "<4",
|
|
1267
1304
|
"meshoptimizer": "<2",
|
|
1268
1305
|
"mongoose": "<10",
|
|
1306
|
+
"mupdf": "<2",
|
|
1269
1307
|
"pg": "<9",
|
|
1270
1308
|
"redis": "<7",
|
|
1271
1309
|
"reflect-metadata": "<0.3",
|
|
@@ -1274,6 +1312,12 @@
|
|
|
1274
1312
|
"sharp": "<1"
|
|
1275
1313
|
},
|
|
1276
1314
|
"peerDependenciesMeta": {
|
|
1315
|
+
"@aws-sdk/client-s3": {
|
|
1316
|
+
"optional": true
|
|
1317
|
+
},
|
|
1318
|
+
"@aws-sdk/s3-request-presigner": {
|
|
1319
|
+
"optional": true
|
|
1320
|
+
},
|
|
1277
1321
|
"@gltf-transform/core": {
|
|
1278
1322
|
"optional": true
|
|
1279
1323
|
},
|
|
@@ -1289,9 +1333,6 @@
|
|
|
1289
1333
|
"@sentry/node": {
|
|
1290
1334
|
"optional": true
|
|
1291
1335
|
},
|
|
1292
|
-
"@socketlabs/email": {
|
|
1293
|
-
"optional": true
|
|
1294
|
-
},
|
|
1295
1336
|
"clamscan": {
|
|
1296
1337
|
"optional": true
|
|
1297
1338
|
},
|
|
@@ -1325,6 +1366,9 @@
|
|
|
1325
1366
|
"mongoose": {
|
|
1326
1367
|
"optional": true
|
|
1327
1368
|
},
|
|
1369
|
+
"mupdf": {
|
|
1370
|
+
"optional": true
|
|
1371
|
+
},
|
|
1328
1372
|
"pg": {
|
|
1329
1373
|
"optional": true
|
|
1330
1374
|
},
|
|
@@ -1345,6 +1389,8 @@
|
|
|
1345
1389
|
}
|
|
1346
1390
|
},
|
|
1347
1391
|
"devDependencies": {
|
|
1392
|
+
"@aws-sdk/client-s3": "^3.1179.0",
|
|
1393
|
+
"@aws-sdk/s3-request-presigner": "^3.1179.0",
|
|
1348
1394
|
"@axiumine/eslint-config-be": "^2.0.2",
|
|
1349
1395
|
"@eslint-community/eslint-plugin-eslint-comments": "^4.8.1",
|
|
1350
1396
|
"@eslint/eslintrc": "^3.3.7",
|
|
@@ -1354,7 +1400,6 @@
|
|
|
1354
1400
|
"@gltf-transform/functions": "^4.5.1",
|
|
1355
1401
|
"@node-rs/bcrypt": "^1.10.9",
|
|
1356
1402
|
"@sentry/node": "^10.78.0",
|
|
1357
|
-
"@socketlabs/email": "^1.4.4",
|
|
1358
1403
|
"@stryker-mutator/core": "10.1.1",
|
|
1359
1404
|
"@stryker-mutator/mocha-runner": "10.1.1",
|
|
1360
1405
|
"@stryker-mutator/typescript-checker": "10.1.1",
|
|
@@ -1366,13 +1411,13 @@
|
|
|
1366
1411
|
"@types/node": "^26.6.6",
|
|
1367
1412
|
"@types/pg": "^8.23.1",
|
|
1368
1413
|
"@types/sinon": "^22.0.2",
|
|
1369
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
1370
|
-
"@typescript-eslint/parser": "^8.
|
|
1414
|
+
"@typescript-eslint/eslint-plugin": "^8.73.0",
|
|
1415
|
+
"@typescript-eslint/parser": "^8.73.0",
|
|
1371
1416
|
"c8": "^12.0.0",
|
|
1372
1417
|
"chai": "^6.3.0",
|
|
1373
1418
|
"clamscan": "^2.4.0",
|
|
1374
1419
|
"dotenv": "^17.4.2",
|
|
1375
|
-
"eslint": "^10.
|
|
1420
|
+
"eslint": "^10.15.0",
|
|
1376
1421
|
"eslint-config-prettier": "^10.1.8",
|
|
1377
1422
|
"eslint-import-resolver-typescript": "^4.4.5",
|
|
1378
1423
|
"eslint-plugin-n": "^18.5.0",
|
|
@@ -1380,23 +1425,24 @@
|
|
|
1380
1425
|
"eslint-plugin-security": "^4.2.1",
|
|
1381
1426
|
"eslint-plugin-simple-import-sort": "^14.0.0",
|
|
1382
1427
|
"eslint-plugin-sonarjs": "^4.2.2",
|
|
1383
|
-
"fast-check": "^4.10.
|
|
1428
|
+
"fast-check": "^4.10.3",
|
|
1384
1429
|
"file-type": "^22.3.0",
|
|
1385
1430
|
"fs-extra": "^11.4.1",
|
|
1386
1431
|
"fta-cli": "^3.1.0",
|
|
1387
1432
|
"gltf-validator": "^2.0.0-dev.3.10",
|
|
1388
1433
|
"graphql": "^16.15.0",
|
|
1389
1434
|
"keygrip": "^1.1.0",
|
|
1390
|
-
"knip": "^6.
|
|
1435
|
+
"knip": "^6.45.1",
|
|
1391
1436
|
"koa": "^3.3.0",
|
|
1392
1437
|
"mariadb": "^3.5.5",
|
|
1393
1438
|
"meshoptimizer": "^1.3.0",
|
|
1394
1439
|
"mocha": "^12.0.3",
|
|
1395
1440
|
"mongodb-memory-server": "^11.3.0",
|
|
1396
|
-
"mongoose": "^9.12.
|
|
1441
|
+
"mongoose": "^9.12.3",
|
|
1442
|
+
"mupdf": "^1.28.6",
|
|
1397
1443
|
"patch-package": "8.0.1",
|
|
1398
1444
|
"pg": "^8.23.1",
|
|
1399
|
-
"prettier": "^3.
|
|
1445
|
+
"prettier": "^3.10.1",
|
|
1400
1446
|
"redis": "^6.3.1",
|
|
1401
1447
|
"reflect-metadata": "^0.2.2",
|
|
1402
1448
|
"sequelize": "^6.37.8",
|
|
@@ -1404,15 +1450,12 @@
|
|
|
1404
1450
|
"sharp": "^0.35.3",
|
|
1405
1451
|
"sinon": "^22.1.0",
|
|
1406
1452
|
"ts-node": "^10.9.2",
|
|
1407
|
-
"ts-patch": "^4.0.1",
|
|
1408
1453
|
"type-coverage": "^2.31.2",
|
|
1409
1454
|
"typescript": "^6.0.3",
|
|
1410
|
-
"typescript-eslint": "8.
|
|
1411
|
-
"typescript-transform-paths": "^4.0.0",
|
|
1455
|
+
"typescript-eslint": "8.73.0",
|
|
1412
1456
|
"uuid": "^14.0.3"
|
|
1413
1457
|
},
|
|
1414
1458
|
"resolutions": {
|
|
1415
|
-
"@socketlabs/email/axios": "^1.21.0",
|
|
1416
1459
|
"sequelize/uuid": "^11.1.1",
|
|
1417
1460
|
"typed-rest-client/qs": "^6.16.1",
|
|
1418
1461
|
"glob": "^14.0.2",
|