@8ms/helpers 3.0.21 → 3.0.23
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/adverity/adverity.d.cts +0 -1
- package/dist/adverity/adverity.d.mts +0 -1
- package/dist/adverity/server/getJobs.d.cts +2 -0
- package/dist/adverity/server/getJobs.d.mts +2 -0
- package/dist/api/ApiResponseClass.cjs +2 -1
- package/dist/api/ApiResponseClass.d.cts +1 -6
- package/dist/api/ApiResponseClass.d.mts +1 -6
- package/dist/api/ApiResponseClass.mjs +2 -1
- package/dist/api/api.d.cts +0 -1
- package/dist/api/api.d.mts +0 -1
- package/dist/api/deleteRequest.d.cts +0 -1
- package/dist/api/deleteRequest.d.mts +0 -1
- package/dist/api/functions.d.cts +0 -1
- package/dist/api/functions.d.mts +0 -1
- package/dist/api/get.d.cts +0 -1
- package/dist/api/get.d.mts +0 -1
- package/dist/api/post.d.cts +0 -1
- package/dist/api/post.d.mts +0 -1
- package/dist/atInternet/atInternet.d.cts +0 -1
- package/dist/atInternet/atInternet.d.mts +0 -1
- package/dist/aws/cloudWatchLog/server/AwsCloudWatchLog.d.cts +0 -1
- package/dist/aws/cloudWatchLog/server/AwsCloudWatchLog.d.mts +0 -1
- package/dist/aws/cloudWatchLog/server/logEvent.d.cts +1 -0
- package/dist/aws/cloudWatchLog/server/logEvent.d.mts +1 -0
- package/dist/aws/cloudWatchMetric/server/AwsCloudWatchMetric.d.cts +0 -1
- package/dist/aws/cloudWatchMetric/server/AwsCloudWatchMetric.d.mts +0 -1
- package/dist/aws/cloudWatchMetric/server/logMetric.d.cts +1 -1
- package/dist/aws/cloudWatchMetric/server/logMetric.d.mts +1 -1
- package/dist/aws/ec2/server/AwsEc2.d.cts +0 -1
- package/dist/aws/ec2/server/AwsEc2.d.mts +0 -1
- package/dist/aws/ecs/server/AwsEcs.d.cts +0 -1
- package/dist/aws/ecs/server/AwsEcs.d.mts +0 -1
- package/dist/aws/glue/server/AwsGlue.d.cts +0 -1
- package/dist/aws/glue/server/AwsGlue.d.mts +0 -1
- package/dist/aws/lambda/server/AwsLambda.d.cts +0 -1
- package/dist/aws/lambda/server/AwsLambda.d.mts +0 -1
- package/dist/aws/s3/server/AwsS3.d.cts +1 -1
- package/dist/aws/s3/server/AwsS3.d.mts +1 -1
- package/dist/aws/s3/server/payload.d.cts +0 -1
- package/dist/aws/s3/server/payload.d.mts +0 -1
- package/dist/aws/server/getAwsConfig.cjs +3 -1
- package/dist/aws/server/getAwsConfig.mjs +3 -1
- package/dist/aws/ses/server/AwsSes.cjs +4 -11
- package/dist/aws/ses/server/AwsSes.d.cts +3 -4
- package/dist/aws/ses/server/AwsSes.d.mts +3 -4
- package/dist/aws/ses/server/AwsSes.mjs +4 -11
- package/dist/aws/ses/server/SimpleEmail.cjs +10 -11
- package/dist/aws/ses/server/SimpleEmail.d.cts +3 -12
- package/dist/aws/ses/server/SimpleEmail.d.mts +3 -12
- package/dist/aws/ses/server/SimpleEmail.mjs +10 -11
- package/dist/aws/sqs/server/AwsSqs.d.cts +0 -1
- package/dist/aws/sqs/server/AwsSqs.d.mts +0 -1
- package/dist/aws/ssm/server/AwsSsm.d.cts +0 -1
- package/dist/aws/ssm/server/AwsSsm.d.mts +0 -1
- package/dist/brightData/serpApi/server/getAsyncRequestId.d.cts +1 -0
- package/dist/brightData/serpApi/server/getAsyncRequestId.d.mts +1 -0
- package/dist/brightData/serpApi/server/getAsyncResults.d.cts +1 -1
- package/dist/brightData/serpApi/server/getAsyncResults.d.mts +1 -1
- package/dist/brightData/serpApi/server/getRealtime.d.cts +0 -1
- package/dist/brightData/serpApi/server/getRealtime.d.mts +0 -1
- package/dist/brightData/webScraperIde/server/getBatch.d.cts +0 -1
- package/dist/brightData/webScraperIde/server/getBatch.d.mts +0 -1
- package/dist/brightData/webScraperIde/server/getRealtime.d.cts +0 -1
- package/dist/brightData/webScraperIde/server/getRealtime.d.mts +0 -1
- package/dist/date/calculation.d.cts +0 -1
- package/dist/date/calculation.d.mts +0 -1
- package/dist/date/date.d.cts +0 -1
- package/dist/date/date.d.mts +0 -1
- package/dist/date/financialYear.d.cts +0 -1
- package/dist/date/financialYear.d.mts +0 -1
- package/dist/date/format.cjs +8 -4
- package/dist/date/format.d.cts +0 -1
- package/dist/date/format.d.mts +0 -1
- package/dist/date/format.mjs +8 -4
- package/dist/drizzle/server/Drizzle.d.cts +0 -1
- package/dist/drizzle/server/Drizzle.d.mts +0 -1
- package/dist/emsApi/awsTs/get.d.cts +1 -0
- package/dist/emsApi/awsTs/get.d.mts +1 -0
- package/dist/emsApi/awsTs/post.d.cts +1 -0
- package/dist/emsApi/awsTs/post.d.mts +1 -0
- package/dist/emsApi/vercel/get.d.cts +1 -0
- package/dist/emsApi/vercel/get.d.mts +1 -0
- package/dist/emsApi/vercel/post.d.cts +1 -0
- package/dist/emsApi/vercel/post.d.mts +1 -0
- package/dist/environment/environment.cjs +3 -7
- package/dist/environment/environment.d.cts +1 -0
- package/dist/environment/environment.d.mts +1 -0
- package/dist/environment/environment.mjs +3 -7
- package/dist/eskimi/eskimi.d.cts +0 -1
- package/dist/eskimi/eskimi.d.mts +0 -1
- package/dist/googleAds/keywordPlanner/server/googleAdsKeywordPlanner.d.cts +0 -1
- package/dist/googleAds/keywordPlanner/server/googleAdsKeywordPlanner.d.mts +0 -1
- package/dist/googleAds/server/GoogleAds.d.cts +0 -1
- package/dist/googleAds/server/GoogleAds.d.mts +0 -1
- package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.d.cts +0 -1
- package/dist/googleCloud/bigquery/server/GoogleCloudBigquery.d.mts +0 -1
- package/dist/googleCloud/bigquery/server/loadData.d.cts +1 -7
- package/dist/googleCloud/bigquery/server/loadData.d.mts +1 -7
- package/dist/googleCloud/sheets/server/GoogleCloudSheets.d.cts +0 -1
- package/dist/googleCloud/sheets/server/GoogleCloudSheets.d.mts +0 -1
- package/dist/googleCloud/storage/server/GoogleCloudStorage.d.cts +0 -1
- package/dist/googleCloud/storage/server/GoogleCloudStorage.d.mts +0 -1
- package/dist/googlePageSpeed/server/GooglePageSpeed.d.cts +0 -1
- package/dist/googlePageSpeed/server/GooglePageSpeed.d.mts +0 -1
- package/dist/googleSearchIncidents/server/googleSearchIncidents.d.cts +0 -1
- package/dist/googleSearchIncidents/server/googleSearchIncidents.d.mts +0 -1
- package/dist/greenDomain/server/greenDomain.d.cts +0 -1
- package/dist/greenDomain/server/greenDomain.d.mts +0 -1
- package/dist/littleWarden/server/LittleWarden.d.cts +0 -1
- package/dist/littleWarden/server/LittleWarden.d.mts +0 -1
- package/dist/littleWarden/server/littleWardenAttrs.d.cts +3 -10
- package/dist/littleWarden/server/littleWardenAttrs.d.mts +3 -10
- package/dist/lumar/api/server/buildRequest.d.cts +1 -0
- package/dist/lumar/api/server/buildRequest.d.mts +1 -0
- package/dist/lumar/api/server/getData.d.cts +1 -0
- package/dist/lumar/api/server/getData.d.mts +1 -0
- package/dist/lumar/graphql/server/getData.d.cts +1 -0
- package/dist/lumar/graphql/server/getData.d.mts +1 -0
- package/dist/lumar/graphql/server/queries/getCrawls.d.cts +1 -4
- package/dist/lumar/graphql/server/queries/getCrawls.d.mts +1 -4
- package/dist/lumar/graphql/server/queries/getReportDifferences.d.cts +1 -5
- package/dist/lumar/graphql/server/queries/getReportDifferences.d.mts +1 -5
- package/dist/lumar/graphql/server/queries/getRows.d.cts +1 -11
- package/dist/lumar/graphql/server/queries/getRows.d.mts +1 -11
- package/dist/lumar/graphql/server/queries/getTotals.d.cts +1 -7
- package/dist/lumar/graphql/server/queries/getTotals.d.mts +1 -7
- package/dist/myTarget/server/myTarget.d.cts +0 -1
- package/dist/myTarget/server/myTarget.d.mts +0 -1
- package/dist/nextAuth/nextAuth.d.cts +0 -1
- package/dist/nextAuth/nextAuth.d.mts +0 -1
- package/dist/nextJs/client/LazyLoad.d.cts +0 -1
- package/dist/nextJs/client/LazyLoad.d.mts +0 -1
- package/dist/onePassword/server/OnePassword.d.cts +0 -1
- package/dist/onePassword/server/OnePassword.d.mts +0 -1
- package/dist/openAi/server/OpenAi.d.cts +0 -1
- package/dist/openAi/server/OpenAi.d.mts +0 -1
- package/dist/prisma/server/Prisma.d.cts +0 -1
- package/dist/prisma/server/Prisma.d.mts +0 -1
- package/dist/snapchat/server/Snapchat.d.cts +0 -1
- package/dist/snapchat/server/Snapchat.d.mts +0 -1
- package/dist/stream/server/sort.d.cts +0 -1
- package/dist/stream/server/sort.d.mts +0 -1
- package/dist/swr/client/swr.d.cts +1 -0
- package/dist/swr/client/swr.d.mts +1 -0
- package/dist/upTimeRobot/server/UpTimeRobot.d.cts +0 -1
- package/dist/upTimeRobot/server/UpTimeRobot.d.mts +0 -1
- package/dist/util/isUndefined.cjs +2 -1
- package/dist/util/isUndefined.mjs +2 -1
- package/dist/util/server/getBrotliCompressed.d.cts +0 -1
- package/dist/util/server/getBrotliCompressed.d.mts +0 -1
- package/dist/util/server/getBrotliDecompressed.d.cts +0 -1
- package/dist/util/server/getBrotliDecompressed.d.mts +0 -1
- package/dist/util/server/getGzipCompressed.d.cts +0 -1
- package/dist/util/server/getGzipCompressed.d.mts +0 -1
- package/dist/util/server/getGzipDecompressed.d.cts +0 -1
- package/dist/util/server/getGzipDecompressed.d.mts +0 -1
- package/package.json +31 -31
|
@@ -97,8 +97,9 @@ var ApiResponseClass = class ApiResponseClass {
|
|
|
97
97
|
};
|
|
98
98
|
validateZod = (schema) => {
|
|
99
99
|
try {
|
|
100
|
+
const validatedBody = schema.parse(this.body);
|
|
100
101
|
return new ApiResponseClass({
|
|
101
|
-
body:
|
|
102
|
+
body: validatedBody,
|
|
102
103
|
state: this.state
|
|
103
104
|
});
|
|
104
105
|
} catch (error) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ApiResponse, ApiState } from "./api.cjs";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
3
|
import { ZodSafeParseResult } from "zod";
|
|
4
|
-
|
|
5
4
|
//#region src/api/ApiResponseClass.d.ts
|
|
6
5
|
type ConstructorProps = {
|
|
7
6
|
body?: any;
|
|
@@ -15,11 +14,7 @@ declare class ApiResponseClass<T = any, E = any> {
|
|
|
15
14
|
state: ApiState;
|
|
16
15
|
body: T | null;
|
|
17
16
|
error: E | null;
|
|
18
|
-
constructor({
|
|
19
|
-
body,
|
|
20
|
-
error,
|
|
21
|
-
state
|
|
22
|
-
}?: ConstructorProps);
|
|
17
|
+
constructor({ body, error, state }?: ConstructorProps);
|
|
23
18
|
fromJson: (input: ApiResponse) => this;
|
|
24
19
|
getBody: () => any;
|
|
25
20
|
getBodyDefaultTo: (keys: any | any[], defaultValue: any) => any;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ApiResponse, ApiState } from "./api.mjs";
|
|
2
2
|
import { z } from "zod/v4";
|
|
3
3
|
import { ZodSafeParseResult } from "zod";
|
|
4
|
-
|
|
5
4
|
//#region src/api/ApiResponseClass.d.ts
|
|
6
5
|
type ConstructorProps = {
|
|
7
6
|
body?: any;
|
|
@@ -15,11 +14,7 @@ declare class ApiResponseClass<T = any, E = any> {
|
|
|
15
14
|
state: ApiState;
|
|
16
15
|
body: T | null;
|
|
17
16
|
error: E | null;
|
|
18
|
-
constructor({
|
|
19
|
-
body,
|
|
20
|
-
error,
|
|
21
|
-
state
|
|
22
|
-
}?: ConstructorProps);
|
|
17
|
+
constructor({ body, error, state }?: ConstructorProps);
|
|
23
18
|
fromJson: (input: ApiResponse) => this;
|
|
24
19
|
getBody: () => any;
|
|
25
20
|
getBodyDefaultTo: (keys: any | any[], defaultValue: any) => any;
|
|
@@ -96,8 +96,9 @@ var ApiResponseClass = class ApiResponseClass {
|
|
|
96
96
|
};
|
|
97
97
|
validateZod = (schema) => {
|
|
98
98
|
try {
|
|
99
|
+
const validatedBody = schema.parse(this.body);
|
|
99
100
|
return new ApiResponseClass({
|
|
100
|
-
body:
|
|
101
|
+
body: validatedBody,
|
|
101
102
|
state: this.state
|
|
102
103
|
});
|
|
103
104
|
} catch (error) {
|
package/dist/api/api.d.cts
CHANGED
package/dist/api/api.d.mts
CHANGED
package/dist/api/functions.d.cts
CHANGED
package/dist/api/functions.d.mts
CHANGED
package/dist/api/get.d.cts
CHANGED
package/dist/api/get.d.mts
CHANGED
package/dist/api/post.d.cts
CHANGED
package/dist/api/post.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.cjs";
|
|
2
2
|
import { LogEvent } from "./logEvent.cjs";
|
|
3
3
|
import { CloudWatchLogsClient } from "@aws-sdk/client-cloudwatch-logs";
|
|
4
|
-
|
|
5
4
|
//#region src/aws/cloudWatchLog/server/AwsCloudWatchLog.d.ts
|
|
6
5
|
declare class AwsCloudWatchLog extends BaseNamespace {
|
|
7
6
|
client: CloudWatchLogsClient;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.mjs";
|
|
2
2
|
import { LogEvent } from "./logEvent.mjs";
|
|
3
3
|
import { CloudWatchLogsClient } from "@aws-sdk/client-cloudwatch-logs";
|
|
4
|
-
|
|
5
4
|
//#region src/aws/cloudWatchLog/server/AwsCloudWatchLog.d.ts
|
|
6
5
|
declare class AwsCloudWatchLog extends BaseNamespace {
|
|
7
6
|
client: CloudWatchLogsClient;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.cjs";
|
|
2
2
|
import { LogMetric } from "./logMetric.cjs";
|
|
3
3
|
import { CloudWatchClient } from "@aws-sdk/client-cloudwatch";
|
|
4
|
-
|
|
5
4
|
//#region src/aws/cloudWatchMetric/server/AwsCloudWatchMetric.d.ts
|
|
6
5
|
declare class AwsCloudWatchMetric extends BaseNamespace {
|
|
7
6
|
client: CloudWatchClient;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.mjs";
|
|
2
2
|
import { LogMetric } from "./logMetric.mjs";
|
|
3
3
|
import { CloudWatchClient } from "@aws-sdk/client-cloudwatch";
|
|
4
|
-
|
|
5
4
|
//#region src/aws/cloudWatchMetric/server/AwsCloudWatchMetric.d.ts
|
|
6
5
|
declare class AwsCloudWatchMetric extends BaseNamespace {
|
|
7
6
|
client: CloudWatchClient;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.cjs";
|
|
2
2
|
import { DesiredStatus, ECSClient, LaunchType, NetworkConfiguration, SortOrder, TaskDefinitionStatus, TaskOverride } from "@aws-sdk/client-ecs";
|
|
3
|
-
|
|
4
3
|
//#region src/aws/ecs/server/AwsEcs.d.ts
|
|
5
4
|
type GetTaskDefinitionsProps = {
|
|
6
5
|
familyPrefix?: string;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.mjs";
|
|
2
2
|
import { DesiredStatus, ECSClient, LaunchType, NetworkConfiguration, SortOrder, TaskDefinitionStatus, TaskOverride } from "@aws-sdk/client-ecs";
|
|
3
|
-
|
|
4
3
|
//#region src/aws/ecs/server/AwsEcs.d.ts
|
|
5
4
|
type GetTaskDefinitionsProps = {
|
|
6
5
|
familyPrefix?: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.cjs";
|
|
2
2
|
import { Modified, ReadFileResponse } from "./awsS3File.cjs";
|
|
3
|
+
import "./index.cjs";
|
|
3
4
|
import { S3Client } from "@aws-sdk/client-s3";
|
|
4
|
-
|
|
5
5
|
//#region src/aws/s3/server/AwsS3.d.ts
|
|
6
6
|
type ReadBufferResponse = Modified & {
|
|
7
7
|
buffer: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.mjs";
|
|
2
2
|
import { Modified, ReadFileResponse } from "./awsS3File.mjs";
|
|
3
|
+
import "./index.mjs";
|
|
3
4
|
import { S3Client } from "@aws-sdk/client-s3";
|
|
4
|
-
|
|
5
5
|
//#region src/aws/s3/server/AwsS3.d.ts
|
|
6
6
|
type ReadBufferResponse = Modified & {
|
|
7
7
|
buffer: any;
|
|
@@ -28,8 +28,10 @@ const getAwsConfig = async (props) => {
|
|
|
28
28
|
if (props.oidcRoleArn && require_environment_environment.isVercel()) {
|
|
29
29
|
const { awsCredentialsProvider } = await import("@vercel/oidc-aws-credentials-provider");
|
|
30
30
|
credentials = await awsCredentialsProvider({ roleArn: props.oidcRoleArn })();
|
|
31
|
+
} else if (props.oidcRoleArn && require_environment_environment.isGoogleCloud()) {
|
|
32
|
+
const gcpToken = await getGcpOidcToken();
|
|
33
|
+
credentials = await assumeAwsRoleWithGcpToken(gcpToken, props);
|
|
31
34
|
}
|
|
32
|
-
if (props.oidcRoleArn && require_environment_environment.isGoogleCloud()) credentials = await assumeAwsRoleWithGcpToken(await getGcpOidcToken(), props);
|
|
33
35
|
return { credentials };
|
|
34
36
|
};
|
|
35
37
|
//#endregion
|
|
@@ -27,8 +27,10 @@ const getAwsConfig = async (props) => {
|
|
|
27
27
|
if (props.oidcRoleArn && isVercel()) {
|
|
28
28
|
const { awsCredentialsProvider } = await import("@vercel/oidc-aws-credentials-provider");
|
|
29
29
|
credentials = await awsCredentialsProvider({ roleArn: props.oidcRoleArn })();
|
|
30
|
+
} else if (props.oidcRoleArn && isGoogleCloud()) {
|
|
31
|
+
const gcpToken = await getGcpOidcToken();
|
|
32
|
+
credentials = await assumeAwsRoleWithGcpToken(gcpToken, props);
|
|
30
33
|
}
|
|
31
|
-
if (props.oidcRoleArn && isGoogleCloud()) credentials = await assumeAwsRoleWithGcpToken(await getGcpOidcToken(), props);
|
|
32
34
|
return { credentials };
|
|
33
35
|
};
|
|
34
36
|
//#endregion
|
|
@@ -4,8 +4,8 @@ const require__class_BaseNamespace = require("../../../_class/BaseNamespace.cjs"
|
|
|
4
4
|
var AwsSes = class extends require__class_BaseNamespace.BaseNamespace {
|
|
5
5
|
init = async (config, region) => {
|
|
6
6
|
if (!this.client) try {
|
|
7
|
-
const {
|
|
8
|
-
this.client = new
|
|
7
|
+
const { SESv2Client } = await import("@aws-sdk/client-sesv2");
|
|
8
|
+
this.client = new SESv2Client({
|
|
9
9
|
...config,
|
|
10
10
|
region: region ?? "eu-west-2"
|
|
11
11
|
});
|
|
@@ -17,20 +17,13 @@ var AwsSes = class extends require__class_BaseNamespace.BaseNamespace {
|
|
|
17
17
|
};
|
|
18
18
|
send = async (input) => {
|
|
19
19
|
let response;
|
|
20
|
-
|
|
21
|
-
const { SendEmailCommand } = await import("@aws-sdk/client-
|
|
20
|
+
try {
|
|
21
|
+
const { SendEmailCommand } = await import("@aws-sdk/client-sesv2");
|
|
22
22
|
const command = new SendEmailCommand(input);
|
|
23
23
|
response = await this.client.send(command);
|
|
24
24
|
} catch (exception) {
|
|
25
25
|
response = exception;
|
|
26
26
|
}
|
|
27
|
-
else try {
|
|
28
|
-
const { SendRawEmailCommand } = await import("@aws-sdk/client-ses");
|
|
29
|
-
const command = new SendRawEmailCommand(input);
|
|
30
|
-
response = await this.client.send(command);
|
|
31
|
-
} catch (exception) {
|
|
32
|
-
response = exception;
|
|
33
|
-
}
|
|
34
27
|
return response;
|
|
35
28
|
};
|
|
36
29
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.cjs";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { SESv2Client, SendEmailCommandInput } from "@aws-sdk/client-sesv2";
|
|
4
3
|
//#region src/aws/ses/server/AwsSes.d.ts
|
|
5
4
|
declare class AwsSes extends BaseNamespace {
|
|
6
|
-
client:
|
|
5
|
+
client: SESv2Client;
|
|
7
6
|
config: any;
|
|
8
7
|
init: (config: any, region?: string) => Promise<this>;
|
|
9
|
-
send: (input: SendEmailCommandInput
|
|
8
|
+
send: (input: SendEmailCommandInput) => Promise<unknown>;
|
|
10
9
|
}
|
|
11
10
|
//#endregion
|
|
12
11
|
export { AwsSes };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { BaseNamespace } from "../../../_class/BaseNamespace.mjs";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { SESv2Client, SendEmailCommandInput } from "@aws-sdk/client-sesv2";
|
|
4
3
|
//#region src/aws/ses/server/AwsSes.d.ts
|
|
5
4
|
declare class AwsSes extends BaseNamespace {
|
|
6
|
-
client:
|
|
5
|
+
client: SESv2Client;
|
|
7
6
|
config: any;
|
|
8
7
|
init: (config: any, region?: string) => Promise<this>;
|
|
9
|
-
send: (input: SendEmailCommandInput
|
|
8
|
+
send: (input: SendEmailCommandInput) => Promise<unknown>;
|
|
10
9
|
}
|
|
11
10
|
//#endregion
|
|
12
11
|
export { AwsSes };
|
|
@@ -3,8 +3,8 @@ import { BaseNamespace } from "../../../_class/BaseNamespace.mjs";
|
|
|
3
3
|
var AwsSes = class extends BaseNamespace {
|
|
4
4
|
init = async (config, region) => {
|
|
5
5
|
if (!this.client) try {
|
|
6
|
-
const {
|
|
7
|
-
this.client = new
|
|
6
|
+
const { SESv2Client } = await import("@aws-sdk/client-sesv2");
|
|
7
|
+
this.client = new SESv2Client({
|
|
8
8
|
...config,
|
|
9
9
|
region: region ?? "eu-west-2"
|
|
10
10
|
});
|
|
@@ -16,20 +16,13 @@ var AwsSes = class extends BaseNamespace {
|
|
|
16
16
|
};
|
|
17
17
|
send = async (input) => {
|
|
18
18
|
let response;
|
|
19
|
-
|
|
20
|
-
const { SendEmailCommand } = await import("@aws-sdk/client-
|
|
19
|
+
try {
|
|
20
|
+
const { SendEmailCommand } = await import("@aws-sdk/client-sesv2");
|
|
21
21
|
const command = new SendEmailCommand(input);
|
|
22
22
|
response = await this.client.send(command);
|
|
23
23
|
} catch (exception) {
|
|
24
24
|
response = exception;
|
|
25
25
|
}
|
|
26
|
-
else try {
|
|
27
|
-
const { SendRawEmailCommand } = await import("@aws-sdk/client-ses");
|
|
28
|
-
const command = new SendRawEmailCommand(input);
|
|
29
|
-
response = await this.client.send(command);
|
|
30
|
-
} catch (exception) {
|
|
31
|
-
response = exception;
|
|
32
|
-
}
|
|
33
26
|
return response;
|
|
34
27
|
};
|
|
35
28
|
};
|
|
@@ -83,7 +83,7 @@ var SimpleEmail = class extends require__class_BaseClass.BaseClass {
|
|
|
83
83
|
CcAddresses: this._filterRecipients("cc"),
|
|
84
84
|
ToAddresses: this._filterRecipients("to")
|
|
85
85
|
},
|
|
86
|
-
|
|
86
|
+
Content: { Simple: {
|
|
87
87
|
Body: {
|
|
88
88
|
Html: {
|
|
89
89
|
Charset: "UTF-8",
|
|
@@ -98,17 +98,12 @@ var SimpleEmail = class extends require__class_BaseClass.BaseClass {
|
|
|
98
98
|
Charset: "UTF-8",
|
|
99
99
|
Data: this.subject ?? ""
|
|
100
100
|
}
|
|
101
|
-
},
|
|
102
|
-
|
|
101
|
+
} },
|
|
102
|
+
FromEmailAddress: this.from ?? ""
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
105
|
_getRawEmailParams = async () => {
|
|
106
106
|
const boundary = `----=_NextPart_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
|
|
107
|
-
const allRecipients = [
|
|
108
|
-
...this._filterRecipients("to"),
|
|
109
|
-
...this._filterRecipients("cc"),
|
|
110
|
-
...this._filterRecipients("bcc")
|
|
111
|
-
];
|
|
112
107
|
let rawMessage = "";
|
|
113
108
|
rawMessage += `From: ${this.from}\r\n`;
|
|
114
109
|
if (this._filterRecipients("to").length > 0) rawMessage += `To: ${this._filterRecipients("to").join(", ")}\r\n`;
|
|
@@ -137,9 +132,13 @@ var SimpleEmail = class extends require__class_BaseClass.BaseClass {
|
|
|
137
132
|
}
|
|
138
133
|
rawMessage += `--${boundary}--\r\n`;
|
|
139
134
|
return {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
135
|
+
Destination: {
|
|
136
|
+
ToAddresses: this._filterRecipients("to"),
|
|
137
|
+
CcAddresses: this._filterRecipients("cc"),
|
|
138
|
+
BccAddresses: this._filterRecipients("bcc")
|
|
139
|
+
},
|
|
140
|
+
Content: { Raw: { Data: Buffer.from(rawMessage) } },
|
|
141
|
+
FromEmailAddress: this.from ?? ""
|
|
143
142
|
};
|
|
144
143
|
};
|
|
145
144
|
_isTextFile = (contentType) => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BaseClass } from "../../../_class/BaseClass.cjs";
|
|
2
|
-
import { SendEmailCommandInput
|
|
3
|
-
|
|
2
|
+
import { SendEmailCommandInput } from "@aws-sdk/client-sesv2";
|
|
4
3
|
//#region src/aws/ses/server/SimpleEmail.d.ts
|
|
5
4
|
type AttachmentSource = {
|
|
6
5
|
filename: string;
|
|
@@ -28,15 +27,7 @@ declare class SimpleEmail extends BaseClass {
|
|
|
28
27
|
html?: string;
|
|
29
28
|
subject?: string;
|
|
30
29
|
attachments: AttachmentSource[];
|
|
31
|
-
constructor({
|
|
32
|
-
bcc,
|
|
33
|
-
cc,
|
|
34
|
-
from,
|
|
35
|
-
html,
|
|
36
|
-
subject,
|
|
37
|
-
to,
|
|
38
|
-
attachments
|
|
39
|
-
}: ConstructorProps);
|
|
30
|
+
constructor({ bcc, cc, from, html, subject, to, attachments }: ConstructorProps);
|
|
40
31
|
setFrom: (from: string) => this;
|
|
41
32
|
setHtml: (html: string) => this;
|
|
42
33
|
setSubject: (subject: string) => this;
|
|
@@ -51,7 +42,7 @@ declare class SimpleEmail extends BaseClass {
|
|
|
51
42
|
setBcc: (recipient: string | string[]) => this;
|
|
52
43
|
setCc: (recipient: string | string[]) => this;
|
|
53
44
|
setTo: (recipient: string | string[]) => this;
|
|
54
|
-
getSendParam: () => Promise<SendEmailCommandInput
|
|
45
|
+
getSendParam: () => Promise<SendEmailCommandInput>;
|
|
55
46
|
private _getRawEmailParams;
|
|
56
47
|
private _isTextFile;
|
|
57
48
|
private _getAttachmentTextData;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { BaseClass } from "../../../_class/BaseClass.mjs";
|
|
2
|
-
import { SendEmailCommandInput
|
|
3
|
-
|
|
2
|
+
import { SendEmailCommandInput } from "@aws-sdk/client-sesv2";
|
|
4
3
|
//#region src/aws/ses/server/SimpleEmail.d.ts
|
|
5
4
|
type AttachmentSource = {
|
|
6
5
|
filename: string;
|
|
@@ -28,15 +27,7 @@ declare class SimpleEmail extends BaseClass {
|
|
|
28
27
|
html?: string;
|
|
29
28
|
subject?: string;
|
|
30
29
|
attachments: AttachmentSource[];
|
|
31
|
-
constructor({
|
|
32
|
-
bcc,
|
|
33
|
-
cc,
|
|
34
|
-
from,
|
|
35
|
-
html,
|
|
36
|
-
subject,
|
|
37
|
-
to,
|
|
38
|
-
attachments
|
|
39
|
-
}: ConstructorProps);
|
|
30
|
+
constructor({ bcc, cc, from, html, subject, to, attachments }: ConstructorProps);
|
|
40
31
|
setFrom: (from: string) => this;
|
|
41
32
|
setHtml: (html: string) => this;
|
|
42
33
|
setSubject: (subject: string) => this;
|
|
@@ -51,7 +42,7 @@ declare class SimpleEmail extends BaseClass {
|
|
|
51
42
|
setBcc: (recipient: string | string[]) => this;
|
|
52
43
|
setCc: (recipient: string | string[]) => this;
|
|
53
44
|
setTo: (recipient: string | string[]) => this;
|
|
54
|
-
getSendParam: () => Promise<SendEmailCommandInput
|
|
45
|
+
getSendParam: () => Promise<SendEmailCommandInput>;
|
|
55
46
|
private _getRawEmailParams;
|
|
56
47
|
private _isTextFile;
|
|
57
48
|
private _getAttachmentTextData;
|