@logto/connector-aws-ses 1.0.0-beta.14

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.
@@ -0,0 +1,3 @@
1
+ import type { Config } from '@silverhand/jest-config';
2
+ declare const config: Config.InitialOptions;
3
+ export default config;
@@ -0,0 +1,2 @@
1
+ import type { ConnectorMetadata } from '@logto/connector-kit';
2
+ export declare const defaultMetadata: ConnectorMetadata;
@@ -0,0 +1,3 @@
1
+ import type { CreateConnector, EmailConnector } from '@logto/connector-kit';
2
+ declare const createAwsSesConnector: CreateConnector<EmailConnector>;
3
+ export default createAwsSesConnector;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,11 @@
1
+ export declare const mockedConfig: {
2
+ accessKeyId: string;
3
+ accessKeySecret: string;
4
+ region: string;
5
+ emailAddress: string;
6
+ templates: {
7
+ usageType: string;
8
+ content: string;
9
+ subject: string;
10
+ }[];
11
+ };
@@ -0,0 +1,75 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * UsageType here is used to specify the use case of the template, can be either
4
+ * 'Register', 'SignIn', 'ForgotPassword' or 'Test'.
5
+ */
6
+ declare const templateGuard: z.ZodObject<{
7
+ usageType: z.ZodString;
8
+ subject: z.ZodString;
9
+ content: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ usageType: string;
12
+ subject: string;
13
+ content: string;
14
+ }, {
15
+ usageType: string;
16
+ subject: string;
17
+ content: string;
18
+ }>;
19
+ export type Template = z.infer<typeof templateGuard>;
20
+ export declare const awsSesConfigGuard: z.ZodObject<{
21
+ accessKeyId: z.ZodString;
22
+ accessKeySecret: z.ZodString;
23
+ region: z.ZodString;
24
+ emailAddress: z.ZodOptional<z.ZodString>;
25
+ emailAddressIdentityArn: z.ZodOptional<z.ZodString>;
26
+ templates: z.ZodArray<z.ZodObject<{
27
+ usageType: z.ZodString;
28
+ subject: z.ZodString;
29
+ content: z.ZodString;
30
+ }, "strip", z.ZodTypeAny, {
31
+ usageType: string;
32
+ subject: string;
33
+ content: string;
34
+ }, {
35
+ usageType: string;
36
+ subject: string;
37
+ content: string;
38
+ }>, "many">;
39
+ feedbackForwardingEmailAddress: z.ZodOptional<z.ZodString>;
40
+ feedbackForwardingEmailAddressIdentityArn: z.ZodOptional<z.ZodString>;
41
+ configurationSetName: z.ZodOptional<z.ZodString>;
42
+ }, "strip", z.ZodTypeAny, {
43
+ emailAddress?: string | undefined;
44
+ emailAddressIdentityArn?: string | undefined;
45
+ feedbackForwardingEmailAddress?: string | undefined;
46
+ feedbackForwardingEmailAddressIdentityArn?: string | undefined;
47
+ configurationSetName?: string | undefined;
48
+ accessKeyId: string;
49
+ accessKeySecret: string;
50
+ region: string;
51
+ templates: {
52
+ usageType: string;
53
+ subject: string;
54
+ content: string;
55
+ }[];
56
+ }, {
57
+ emailAddress?: string | undefined;
58
+ emailAddressIdentityArn?: string | undefined;
59
+ feedbackForwardingEmailAddress?: string | undefined;
60
+ feedbackForwardingEmailAddressIdentityArn?: string | undefined;
61
+ configurationSetName?: string | undefined;
62
+ accessKeyId: string;
63
+ accessKeySecret: string;
64
+ region: string;
65
+ templates: {
66
+ usageType: string;
67
+ subject: string;
68
+ content: string;
69
+ }[];
70
+ }>;
71
+ export type AwsSesConfig = z.infer<typeof awsSesConfigGuard>;
72
+ export type Payload = {
73
+ code: string | number;
74
+ };
75
+ export {};
@@ -0,0 +1,6 @@
1
+ import type { EmailContent } from '@aws-sdk/client-sesv2';
2
+ import { SendEmailCommand, SESv2Client } from '@aws-sdk/client-sesv2';
3
+ import type { AwsSesConfig, Template, Payload } from '@/types';
4
+ export declare const makeClient: (accessKeyId: string, secretAccessKey: string, region: string) => SESv2Client;
5
+ export declare const makeEmailContent: (template: Template, payload: Payload) => EmailContent;
6
+ export declare const makeCommand: (config: AwsSesConfig, emailContent: EmailContent, to: string) => SendEmailCommand;
package/logo.svg ADDED
@@ -0,0 +1,6 @@
1
+ <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill="#FF9800" d="M20.189 12.33h-.001zM.106 14.677c3.13 2.855 7.272 4.573 11.87 4.573 3.28 0 7.096-1.04 9.722-3 .431-.323.056-.815-.383-.613-2.946 1.258-6.146 1.871-9.06 1.871-4.318 0-8.493-1.202-11.877-3.186-.296-.177-.519.13-.272.355z"/>
3
+ <path fill="#212121" d="M17.181 5.16c0-.136-.073-.202-.2-.202h-.741l-.034-.001c-.104 0-.2.03-.279.082-.056.048-.112.154-.16.315l-1.381 5.403-1.261-5.403c-.031-.154-.088-.267-.151-.315-.064-.056-.168-.081-.32-.081h-.636l-.035-.001a.535.535 0 0 0-.287.082c-.063.048-.111.154-.151.315L10.3 10.693 8.958 5.354c-.047-.154-.095-.267-.16-.315-.055-.056-.159-.081-.31-.081h-.783c-.127 0-.191.073-.191.202l.001.006c.012.114.037.224.071.318l1.875 6.235c.048.153.104.266.168.314.064.057.16.081.304.081l.686-.001c.143 0 .255-.024.32-.081.063-.057.11-.162.15-.323l1.23-5.193 1.238 5.201c.031.162.087.267.15.323.065.057.169.081.32.081h.686l.029.001c.102 0 .197-.03.275-.082.064-.048.12-.153.168-.314l1.923-6.234-.003.008a1.17 1.17 0 0 0 .059-.21c.008-.049.017-.089.017-.13zm4.501 5.042v.022a.871.871 0 0 1-.415.744c-.271.178-.663.267-1.165.267-.32 0-.631-.032-.95-.097a4.315 4.315 0 0 1-.878-.282c-.08-.032-.152-.065-.2-.081a.453.453 0 0 0-.144-.024c-.119 0-.183.081-.183.25v.411c.001.082.018.16.048.226.032.073.119.154.247.225.208.121.519.226.918.323a5.26 5.26 0 0 0 1.228.144 3.78 3.78 0 0 0 1.141-.169c.343-.105.638-.25.886-.452.247-.194.439-.435.583-.71.135-.274.207-.589.207-.936 0-.419-.12-.798-.367-1.129-.247-.33-.663-.589-1.237-.775l-1.134-.362c-.423-.137-.718-.291-.877-.445a.765.765 0 0 1-.24-.573c0-.33.128-.564.375-.717.247-.154.607-.225 1.062-.225h.056a3.56 3.56 0 0 1 1.476.314l-.004-.002a.804.804 0 0 0 .307.099c.12 0 .184-.089.184-.259v-.375a.43.43 0 0 0-.071-.266l-.001-.002a.705.705 0 0 0-.239-.2A1.583 1.583 0 0 0 21.96 5a6.564 6.564 0 0 0-.455-.128c-.168-.032-.335-.065-.518-.089a4.011 4.011 0 0 0-.535-.032c-.351 0-.686.041-1.006.137-.32.096-.59.233-.83.419a2.06 2.06 0 0 0-.575.661 1.82 1.82 0 0 0-.216.895c.002.443.152.851.4 1.17.263.363.694.637 1.277.821l1.157.364c.391.129.663.267.807.419.134.14.216.332.216.543V10.202z"/>
4
+ <path fill="#FF9800" d="M22.424 18.169c1.405-1.193 1.772-3.685 1.485-4.048-.287-.355-2.754-.661-4.254.403-.232.17-.192.396.063.364.854-.105 2.738-.33 3.074.104.335.428-.375 2.227-.695 3.025-.096.241.112.338.327.152z"/>
5
+ <path fill="#212121" d="M4.52 7.944a6.3 6.3 0 0 0-.846-.065c-.822 0-1.468.21-1.955.629-.487.418-.726.976-.726 1.661 0 .646.199 1.162.59 1.549.391.387.926.58 1.596.58.942 0 1.725-.371 2.347-1.112l.016.037c.076.16.159.315.232.438l.006.01c.083.132.177.257.281.369.079.073.159.114.239.114h.001a.373.373 0 0 0 .207-.073l.503-.338c.104-.081.152-.162.152-.242a.349.349 0 0 0-.056-.185 4.331 4.331 0 0 1-.256-.582 2.448 2.448 0 0 1-.088-.717l-.016.001V7.404c0-.887-.223-1.549-.662-1.983-.447-.436-1.141-.654-2.091-.654h-.046c-.426 0-.84.056-1.2.153a4.573 4.573 0 0 0-1.005.363l-.004.001a.6.6 0 0 0-.22.167c-.04.057-.056.154-.056.283v.395c0 .169.056.25.168.25h.001a.455.455 0 0 0 .126-.023l.016-.004a2.18 2.18 0 0 0 .264-.102c.279-.113.567-.202.862-.275.295-.073.583-.104.863-.104.614 0 1.045.12 1.3.371.248.25.375.677.375 1.29v.589a10.764 10.764 0 0 0-.918-.177zm.935 1.081v.338c0 .274-.033.508-.08.701a1.282 1.282 0 0 1-.272.517 1.777 1.777 0 0 1-.758.516 2.56 2.56 0 0 1-.822.145c-.368 0-.647-.097-.838-.299-.2-.193-.295-.476-.295-.855 0-.403.127-.709.39-.926.264-.218.655-.323 1.19-.323.265 0 .525.018.75.048l.034.004c.254.034.503.082.701.134z"/>
6
+ </svg>
package/package.json ADDED
@@ -0,0 +1,63 @@
1
+ {
2
+ "main": "./lib/index.js",
3
+ "exports": "./lib/index.js",
4
+ "license": "MPL-2.0",
5
+ "files": [
6
+ "lib",
7
+ "docs",
8
+ "logo.svg",
9
+ "logo-dark.svg"
10
+ ],
11
+ "dependencies": {
12
+ "@logto/connector-kit": "1.0.0-beta.30",
13
+ "@silverhand/essentials": "^1.2.0",
14
+ "got": "^11.8.2",
15
+ "snakecase-keys": "^5.1.0",
16
+ "zod": "^3.20.2",
17
+ "@aws-sdk/client-sesv2": "^3.224.0",
18
+ "@aws-sdk/types": "^3.226.0"
19
+ },
20
+ "devDependencies": {
21
+ "iconv-lite": "0.6.3",
22
+ "@jest/types": "^29.3.1",
23
+ "@silverhand/eslint-config": "1.3.0",
24
+ "@silverhand/ts-config": "1.2.1",
25
+ "@silverhand/jest-config": "1.2.2",
26
+ "@types/jest": "^29.2.4",
27
+ "@types/node": "^16.3.1",
28
+ "@vercel/ncc": "^0.36.0",
29
+ "@types/supertest": "^2.0.11",
30
+ "eslint": "^8.21.0",
31
+ "jest": "^29.3.1",
32
+ "jest-matcher-specific-error": "^1.0.0",
33
+ "lint-staged": "^13.0.0",
34
+ "nock": "^13.2.2",
35
+ "prettier": "^2.7.1",
36
+ "supertest": "^6.2.2",
37
+ "typescript": "^4.9.4"
38
+ },
39
+ "engines": {
40
+ "node": "^16.13.0 || ^18.12.0"
41
+ },
42
+ "eslintConfig": {
43
+ "extends": "@silverhand"
44
+ },
45
+ "prettier": "@silverhand/eslint-config/.prettierrc",
46
+ "publishConfig": {
47
+ "access": "public"
48
+ },
49
+ "name": "@logto/connector-aws-ses",
50
+ "version": "1.0.0-beta.14",
51
+ "description": "Logto Connector for Amazon SES",
52
+ "author": "Jeff <admin@breadth.app>",
53
+ "scripts": {
54
+ "package:sync": "cd ../../ && pnpm package:sync",
55
+ "precommit": "lint-staged",
56
+ "build": "rm -rf lib/ && ncc build src/index.ts -o lib",
57
+ "dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental",
58
+ "lint": "eslint --ext .ts src",
59
+ "lint:report": "pnpm lint --format json --output-file report.json",
60
+ "test": "jest",
61
+ "test:coverage": "pnpm run test --coverage --silent"
62
+ }
63
+ }