qstd 0.3.15 → 0.3.17
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/server/aws/lambda/domain.d.ts +17 -0
- package/dist/server/aws/lambda/domain.d.ts.map +1 -0
- package/dist/server/aws/lambda/fns.d.ts +34 -0
- package/dist/server/aws/lambda/fns.d.ts.map +1 -0
- package/dist/server/aws/lambda/index.d.ts +4 -0
- package/dist/server/aws/lambda/index.d.ts.map +1 -0
- package/dist/server/aws/lambda/literals.d.ts +14 -0
- package/dist/server/aws/lambda/literals.d.ts.map +1 -0
- package/dist/server/aws/lambda/types.d.ts +67 -0
- package/dist/server/aws/lambda/types.d.ts.map +1 -0
- package/dist/server/aws/s3/domain.d.ts +48 -0
- package/dist/server/aws/s3/domain.d.ts.map +1 -0
- package/dist/server/aws/s3/fns.d.ts +6 -0
- package/dist/server/aws/s3/fns.d.ts.map +1 -0
- package/dist/server/aws/s3/index.d.ts +4 -0
- package/dist/server/aws/s3/index.d.ts.map +1 -0
- package/dist/server/aws/s3/types.d.ts +81 -0
- package/dist/server/aws/s3/types.d.ts.map +1 -0
- package/dist/server/aws/sns/index.d.ts +19 -0
- package/dist/server/aws/sns/index.d.ts.map +1 -0
- package/dist/server/{file.d.ts → file/index.d.ts} +1 -1
- package/dist/server/file/index.d.ts.map +1 -0
- package/dist/server/index.cjs +918 -21962
- package/dist/server/index.d.ts +3 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +905 -21947
- package/package.json +11 -2
- package/dist/server/file.d.ts.map +0 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as _t from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Create a REST handler for an AWS Lambda function.
|
|
4
|
+
* This handler will catch all errors and automatically
|
|
5
|
+
* handle things like HTTP errors and Arktype validation errors,
|
|
6
|
+
* @param fn
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare const createRestHandler: (fn: (event: import("aws-lambda").APIGatewayProxyEventV2) => Promise<_t.ApigwResult> | _t.ApigwResult) => (event: import("aws-lambda").APIGatewayProxyEventV2) => Promise<_t.Response | _t.ApigwResult>;
|
|
10
|
+
/**
|
|
11
|
+
* Same as rest handler but just receives a websocket event.
|
|
12
|
+
* @param fn
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
export declare const createWebsocketHandler: (fn: (event: import("aws-lambda").APIGatewayProxyEvent) => Promise<_t.ApigwResult> | _t.ApigwResult) => (event: import("aws-lambda").APIGatewayProxyEvent) => Promise<_t.Response | _t.ApigwResult>;
|
|
16
|
+
export declare const createSqsHandler: (fn: _t.SQSHandler) => (event: _t.SqsEvent, context: _t.SqsContext, callback: _t.SqsCallback) => void | Promise<void | import("aws-lambda").SQSBatchResponse>;
|
|
17
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/lambda/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAG9B;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,6GAeujD,kDAAQ,0CAfphD,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,2GAQkjD,gDAAQ,0CAP/iD,CAAC;AAE/C,eAAO,MAAM,gBAAgB,GAC1B,IAAI,EAAE,CAAC,UAAU,MACjB,OAAO,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC,WAAW,iEAEpE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as _t from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Determine the correct status code to return.
|
|
4
|
+
* If no status code is passed, return either 204 or 200, depending on if a body is present.
|
|
5
|
+
* @param body
|
|
6
|
+
* @param options
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare const getStatusCode: (body: unknown, options?: _t.ResponseOptions) => number;
|
|
10
|
+
export declare const getDefaultHeaders: (opts?: _t.ResponseOptions) => {
|
|
11
|
+
"Content-Type": string;
|
|
12
|
+
"access-control-allow-origin": string;
|
|
13
|
+
"access-control-allow-headers": string;
|
|
14
|
+
"access-control-allow-methods": string;
|
|
15
|
+
"access-control-allow-credentials": boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* This will take a string or object and return as a proper
|
|
19
|
+
* response object including the status code, headers,
|
|
20
|
+
* and stringified body.
|
|
21
|
+
* @param responseBody Defaults to 200 status code.
|
|
22
|
+
* @param opts
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
export declare const response: <T = unknown>(
|
|
26
|
+
/** Try to make an object or null. */
|
|
27
|
+
responseBody?: T, opts?: _t.ResponseOptions) => _t.Response;
|
|
28
|
+
/**
|
|
29
|
+
* Creates a handler function that will catch all errors and automatically
|
|
30
|
+
* handle things like HTTP errors and Arktype validation errors,
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
export declare const createHandlerFactory: <T extends _t.ApigwEvent | _t.WebsocketEvent>() => (fn: (event: T) => Promise<_t.ApigwResult> | _t.ApigwResult) => (event: T) => Promise<_t.Response | _t.ApigwResult>;
|
|
34
|
+
//# sourceMappingURL=fns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fns.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/lambda/fns.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,OAAO,EAAE,UAAU,EAAE,CAAC,eAAe,KAAG,MAK3E,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,OAAM,EAAE,CAAC,eAAoB;;;;;;CAU7D,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC,GAAG,OAAO;AAClC,qCAAqC;AACrC,eAAe,CAAC,EAChB,OAAO,EAAE,CAAC,eAAe,KACxB,EAAE,CAAC,QAWL,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC9B,CAAC,SAAS,EAAE,CAAC,UAAU,GAAG,EAAE,CAAC,cAAc,QAC3C,IAAI,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,CAAC,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,WAAW,MACpD,OAAO,CAAC,0CAsBd,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/lambda/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as _t from "./types";
|
|
2
|
+
export declare class HttpError extends Error {
|
|
3
|
+
statusCode: _t.ResponseOptions["status"];
|
|
4
|
+
/** human-readable vague error message sent to client. */
|
|
5
|
+
display: string;
|
|
6
|
+
/** internal log message for debugging. */
|
|
7
|
+
log?: string;
|
|
8
|
+
constructor(props: {
|
|
9
|
+
statusCode: _t.ResponseOptions["status"];
|
|
10
|
+
display?: string;
|
|
11
|
+
log: string;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=literals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"literals.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/lambda/literals.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,qBAAa,SAAU,SAAQ,KAAK;IAClC,UAAU,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;IACzC,yDAAyD;IACzD,OAAO,EAAE,MAAM,CAAC;IAChB,0CAA0C;IAC1C,GAAG,CAAC,EAAE,MAAM,CAAC;gBAED,KAAK,EAAE;QACjB,UAAU,EAAE,EAAE,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QACzC,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,EAAE,MAAM,CAAC;KACb;CAMF"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResultV2, SQSHandler as AwsSqsHandler, SQSBatchResponse, Callback, Context, SQSEvent } from "aws-lambda";
|
|
2
|
+
export type Response = {
|
|
3
|
+
statusCode: number;
|
|
4
|
+
headers: {
|
|
5
|
+
"Content-Type": string;
|
|
6
|
+
"access-control-allow-origin": string;
|
|
7
|
+
"access-control-allow-headers": string;
|
|
8
|
+
"access-control-allow-methods": string;
|
|
9
|
+
"access-control-allow-credentials": string | boolean;
|
|
10
|
+
};
|
|
11
|
+
cookies?: string[] | undefined;
|
|
12
|
+
isBase64Encoded?: boolean;
|
|
13
|
+
body: string;
|
|
14
|
+
};
|
|
15
|
+
export type WebsocketEvent = APIGatewayProxyEvent;
|
|
16
|
+
export type ApigwEvent = APIGatewayProxyEventV2;
|
|
17
|
+
export type ApigwResult = APIGatewayProxyResultV2;
|
|
18
|
+
export type SqsEvent = SQSEvent;
|
|
19
|
+
export type SqsContext = Context;
|
|
20
|
+
export type SQSHandler = AwsSqsHandler;
|
|
21
|
+
export type SqsCallback = Callback<SQSBatchResponse | void>;
|
|
22
|
+
export type ResponseOptions = {
|
|
23
|
+
/**
|
|
24
|
+
* `200` - **Ok**: request succeeded and there is a response payload.
|
|
25
|
+
*
|
|
26
|
+
* `201` - **Created**
|
|
27
|
+
*
|
|
28
|
+
* `204` - **No Content**: request succeeded and there is no response payload.
|
|
29
|
+
*
|
|
30
|
+
* `304` - **Not Modified**: request succeeded but there was no change.j
|
|
31
|
+
*
|
|
32
|
+
* `400` - **Bad Request**: malformed syntax.
|
|
33
|
+
*
|
|
34
|
+
* `401` - **Unauthorized**: request lacks valid auth credentials for target resource.
|
|
35
|
+
* Note: Will *not* return a response.
|
|
36
|
+
*
|
|
37
|
+
* `404` - **Not Found**: no matching resource uri.
|
|
38
|
+
*
|
|
39
|
+
* `410` - **Gone**: the client should not request the resource in the future.
|
|
40
|
+
*
|
|
41
|
+
* `415` - **Unsupported Media Type**
|
|
42
|
+
*
|
|
43
|
+
* `422` - **Unprocessable entity**
|
|
44
|
+
*
|
|
45
|
+
* `500` - **Internal Server Error**
|
|
46
|
+
*/
|
|
47
|
+
status?: 200 | 201 | 204 | 304 | 400 | 401 | 404 | 410 | 415 | 422 | 500;
|
|
48
|
+
additionalHeaders?: {
|
|
49
|
+
[key: string]: string;
|
|
50
|
+
};
|
|
51
|
+
isBase64Encoded?: boolean;
|
|
52
|
+
/** @example "cookies": [ "cookie1", "cookie2" ] */
|
|
53
|
+
cookies?: string[] | undefined;
|
|
54
|
+
/** @example application/json */
|
|
55
|
+
contentType?: string;
|
|
56
|
+
/**
|
|
57
|
+
* @example "*"
|
|
58
|
+
* @example "http://localhost:8000/"
|
|
59
|
+
* */
|
|
60
|
+
origin?: string;
|
|
61
|
+
/** @example "Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token,X-Amz-User-Agent" */
|
|
62
|
+
allowedHeaders?: string;
|
|
63
|
+
/** @example "OPTIONS,POST,GET,PUT,DELETE,PATCH" */
|
|
64
|
+
methods?: string;
|
|
65
|
+
allowCredentials?: boolean;
|
|
66
|
+
};
|
|
67
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/lambda/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,uBAAuB,EACvB,UAAU,IAAI,aAAa,EAC3B,gBA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gC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;SAGK;IACL,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,uGAAuG;IACvG,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type CreateBucketCommandOutput, type DeleteBucketCommandOutput, type DeleteObjectCommandOutput, type GetObjectCommandOutput, type HeadObjectCommandOutput } from "@aws-sdk/client-s3";
|
|
2
|
+
import { type PresignedPost } from "@aws-sdk/s3-presigned-post";
|
|
3
|
+
import * as _t from "./types";
|
|
4
|
+
export declare const create: (props?: _t.CreateProps) => _t.Client;
|
|
5
|
+
/**
|
|
6
|
+
* signed url for a get
|
|
7
|
+
* NOTE: ensure lambda has permissions to create
|
|
8
|
+
* signed url or url will give access denied
|
|
9
|
+
* @param s3
|
|
10
|
+
* @param props
|
|
11
|
+
*/
|
|
12
|
+
export declare function createSignedUrl(s3: _t.Client, props: _t.SignedUrlGetProps): Promise<string>;
|
|
13
|
+
export declare function createSignedUrl(s3: _t.Client, props: _t.SignedUrlPostProps): Promise<PresignedPost>;
|
|
14
|
+
/**
|
|
15
|
+
* upload a file directly to s3 bucket
|
|
16
|
+
* @param s3
|
|
17
|
+
* @param props
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
export declare const uploadFile: (s3: _t.Client, props: _t.UploadProps) => Promise<import("@aws-sdk/client-s3").PutObjectCommandOutput>;
|
|
21
|
+
export type FileProps = {
|
|
22
|
+
key: string;
|
|
23
|
+
bucketName?: string;
|
|
24
|
+
};
|
|
25
|
+
export declare const getFile: (s3: _t.Client, props: FileProps) => Promise<GetObjectCommandOutput>;
|
|
26
|
+
export declare const deleteFile: (s3: _t.Client, props: FileProps) => Promise<DeleteObjectCommandOutput>;
|
|
27
|
+
export declare const getFileMetadata: (s3: _t.Client, props: FileProps) => Promise<HeadObjectCommandOutput>;
|
|
28
|
+
/** create a new bucket */
|
|
29
|
+
export declare function bucketHandle(s3: _t.Client, props: {
|
|
30
|
+
action: "create";
|
|
31
|
+
bucketName: string;
|
|
32
|
+
}): Promise<CreateBucketCommandOutput>;
|
|
33
|
+
export declare function bucketHandle(s3: _t.Client, props: {
|
|
34
|
+
action: "delete";
|
|
35
|
+
bucketName: string;
|
|
36
|
+
}): Promise<DeleteBucketCommandOutput>;
|
|
37
|
+
export declare function bucketHandle(s3: _t.Client, props: {
|
|
38
|
+
action: "exists";
|
|
39
|
+
bucketName: string;
|
|
40
|
+
}): Promise<boolean>;
|
|
41
|
+
/**
|
|
42
|
+
* Copy and delete original files from src bucket to target bucket.
|
|
43
|
+
* @param s3
|
|
44
|
+
* @param buckets
|
|
45
|
+
* @returns
|
|
46
|
+
*/
|
|
47
|
+
export declare const migrateBucketContents: (s3: _t.Client, buckets: _t.BucketTransferOpts) => Promise<DeleteObjectCommandOutput[] | undefined>;
|
|
48
|
+
//# sourceMappingURL=domain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/s3/domain.ts"],"names":[],"mappings":"AAAA,OAAO,EAYL,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAE7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B,eAAO,MAAM,MAAM,GAAI,QAAO,EAAE,CAAC,WAAgB,KAAG,EAAE,CAAC,MAKtD,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,EAAE,EAAE,EAAE,CAAC,MAAM,EACb,KAAK,EAAE,EAAE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UAAU,EAAE,MAAM,CAAA;CAAE,GAC9C,OAAO,CAAC,OAAO,CAAC,CAAC;AAmCpB;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,GAChC,IAAI,EAAE,CAAC,MAAM,EACb,SAAS,EAAE,CAAC,kBAAkB,qDAkB/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fns.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/s3/fns.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,GAC/B,GAAG,YAAY,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,KACpC,MAOF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/s3/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { S3Client } from "@aws-sdk/client-s3";
|
|
2
|
+
import type { CompletedPart, PutObjectCommandInput, UploadPartRequest } from "@aws-sdk/client-s3";
|
|
3
|
+
import type { PresignedPostOptions } from "@aws-sdk/s3-presigned-post";
|
|
4
|
+
import type { S3Event } from "aws-lambda";
|
|
5
|
+
export type NotificationEvent = S3Event;
|
|
6
|
+
export type Client = {
|
|
7
|
+
client: S3Client;
|
|
8
|
+
bucketName: string;
|
|
9
|
+
useSignedUrls?: boolean;
|
|
10
|
+
cdn: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
export type CreateProps = {
|
|
13
|
+
cdn?: string;
|
|
14
|
+
bucketName?: string;
|
|
15
|
+
};
|
|
16
|
+
export type BucketTransferOpts = {
|
|
17
|
+
from: string;
|
|
18
|
+
to: string;
|
|
19
|
+
};
|
|
20
|
+
export type SignedPostOpts = {
|
|
21
|
+
key: string;
|
|
22
|
+
/** bytes - 1000 bytes = 1kb, 1000kb = 1mb, etc. */
|
|
23
|
+
maxSize: number;
|
|
24
|
+
expireInSecs: number;
|
|
25
|
+
bucketName?: string;
|
|
26
|
+
contentType?: string;
|
|
27
|
+
startsWith?: string;
|
|
28
|
+
};
|
|
29
|
+
export type SignedUrlGetProps = {
|
|
30
|
+
expiresInSecs?: number;
|
|
31
|
+
bucketName?: string;
|
|
32
|
+
action: "get";
|
|
33
|
+
key: string;
|
|
34
|
+
};
|
|
35
|
+
export type SignedUrlPostProps = SignedPostOpts & {
|
|
36
|
+
action: "post";
|
|
37
|
+
};
|
|
38
|
+
export type SignedUrlProps = SignedUrlGetProps | SignedUrlPostProps;
|
|
39
|
+
export type SignedUrlOpts = {
|
|
40
|
+
key: string;
|
|
41
|
+
expires: number;
|
|
42
|
+
bucket?: string;
|
|
43
|
+
numOfParts: number;
|
|
44
|
+
uploadId: string;
|
|
45
|
+
};
|
|
46
|
+
export type UploadProps = {
|
|
47
|
+
body: PutObjectCommandInput["Body"];
|
|
48
|
+
contentType?: string;
|
|
49
|
+
bucketName?: string;
|
|
50
|
+
key: string;
|
|
51
|
+
};
|
|
52
|
+
export type FileObjectProps = {
|
|
53
|
+
key: string;
|
|
54
|
+
bucketName?: string;
|
|
55
|
+
action: "get" | "delete" | "metadata";
|
|
56
|
+
};
|
|
57
|
+
export type StartMultiPartProps = {
|
|
58
|
+
key: string;
|
|
59
|
+
bucketName?: string;
|
|
60
|
+
contentType?: string;
|
|
61
|
+
};
|
|
62
|
+
export type CompleteMultiPartProps = {
|
|
63
|
+
key: string;
|
|
64
|
+
bucketName?: string;
|
|
65
|
+
uploadId: string;
|
|
66
|
+
parts: CompletedPart[];
|
|
67
|
+
};
|
|
68
|
+
export type MultiPartProps = {
|
|
69
|
+
bucketName?: string;
|
|
70
|
+
uploadId: string;
|
|
71
|
+
key: string;
|
|
72
|
+
};
|
|
73
|
+
export type UploadPartProps = {
|
|
74
|
+
key: string;
|
|
75
|
+
partNum: number;
|
|
76
|
+
uploadId: string;
|
|
77
|
+
body: UploadPartRequest["Body"];
|
|
78
|
+
bucketName?: string;
|
|
79
|
+
};
|
|
80
|
+
export type PresignedPostOpts = PresignedPostOptions;
|
|
81
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/s3/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC;AAExC,MAAM,MAAM,MAAM,GAAG;IACnB,MAAM,EAAE,QAAQ,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEhE,MAAM,MAAM,kBAAkB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB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AAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SNSClient } from "@aws-sdk/client-sns";
|
|
2
|
+
type Client = ReturnType<typeof create>;
|
|
3
|
+
export declare const create: (props?: {
|
|
4
|
+
topicArn?: string;
|
|
5
|
+
}) => {
|
|
6
|
+
client: SNSClient;
|
|
7
|
+
topicArn: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export declare const publish: (sns: Client, props: {
|
|
10
|
+
topicArn?: string;
|
|
11
|
+
message: unknown;
|
|
12
|
+
}) => Promise<import("@aws-sdk/client-sns").PublishCommandOutput>;
|
|
13
|
+
export declare const publishError: (sns: Client, props: {
|
|
14
|
+
topicArn?: string;
|
|
15
|
+
message: object;
|
|
16
|
+
error: Error;
|
|
17
|
+
}) => Promise<import("@aws-sdk/client-sns").PublishCommandOutput>;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/server/aws/sns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAkB,MAAM,qBAAqB,CAAC;AAEhE,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;AAExC,eAAO,MAAM,MAAM,GAAI,QAAQ;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE;;;CAInD,CAAC;AAEF,eAAO,MAAM,OAAO,GAClB,KAAK,MAAM,EACX,OAAO;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,gEAS/C,CAAC;AAEF,eAAO,MAAM,YAAY,GACvB,KAAK,MAAM,EACX,OAAO;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,gEAkB5D,CAAC"}
|
|
@@ -18,4 +18,4 @@ export declare const writeBufferToFile: (filepath: string, buffer: Readable | un
|
|
|
18
18
|
* @param content - String content to write
|
|
19
19
|
*/
|
|
20
20
|
export declare const writeFile: (filepath: string, content: string) => Promise<void>;
|
|
21
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/file/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GACnB,UAAU,MAAM,EAChB,WAAU,cAAwB,KACjC,OAAO,CAAC,MAAM,CAEhB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,MAAM,EAChB,QAAQ,QAAQ,GAAG,SAAS,kBAQ7B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,UAAU,MAAM,EAAE,SAAS,MAAM,kBAEhE,CAAC"}
|