@superdurable/connector-amazon-ses 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +2 -2
- package/dex-connector.json +64 -0
- package/dist/chunk-6NP3EK7O.js +111 -0
- package/dist/connection-BEfEuNCI.d.ts +73 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +255 -0
- package/dist/mock.d.ts +35 -0
- package/dist/mock.js +73 -0
- package/package.json +59 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Super Durable
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated keyation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Amazon SES TypeScript connector
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The `getEmailIdentity` Query reads an email address or domain verification status. Configure AWS Region and signing credentials as described in the [connector README](../README.md). The [runnable Flow](examples/identity-lookup/README.md) exercises a real Dex Worker and local provider fixture. Live AWS access has not been verified.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"connectorId": "amazon-ses",
|
|
3
|
+
"releaseTag": "connectors/amazon/ses/go/v0.1.0",
|
|
4
|
+
"package": {
|
|
5
|
+
"ecosystem": "npm",
|
|
6
|
+
"name": "@superdurable/connector-amazon-ses",
|
|
7
|
+
"version": "0.1.0"
|
|
8
|
+
},
|
|
9
|
+
"factories": [
|
|
10
|
+
{
|
|
11
|
+
"name": "newGetEmailIdentityStep",
|
|
12
|
+
"kind": "query",
|
|
13
|
+
"operationId": "getEmailIdentity",
|
|
14
|
+
"inputType": "GetEmailIdentityInput",
|
|
15
|
+
"description": "Read the verification status of an SES email identity.",
|
|
16
|
+
"fields": {
|
|
17
|
+
"stepType": "stepType",
|
|
18
|
+
"annotations": "annotations",
|
|
19
|
+
"connectionName": "connectionName",
|
|
20
|
+
"resultAttribute": "resultAttribute"
|
|
21
|
+
},
|
|
22
|
+
"branches": [
|
|
23
|
+
{
|
|
24
|
+
"id": "found",
|
|
25
|
+
"field": "found",
|
|
26
|
+
"optional": false
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"id": "missing",
|
|
30
|
+
"field": "missing",
|
|
31
|
+
"optional": true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"id": "providerRejected",
|
|
35
|
+
"field": "providerRejected",
|
|
36
|
+
"optional": true
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "invalidResponse",
|
|
40
|
+
"field": "invalidResponse",
|
|
41
|
+
"optional": true
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"id": "defect",
|
|
45
|
+
"field": "defect",
|
|
46
|
+
"optional": true
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"inputSchema": {
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"description": "GetEmailIdentityInput identifies one SES email identity in the configured Region.",
|
|
52
|
+
"properties": {
|
|
53
|
+
"emailIdentity": {
|
|
54
|
+
"type": "string"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"required": [
|
|
58
|
+
"emailIdentity"
|
|
59
|
+
],
|
|
60
|
+
"type": "object"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// src/generated/models.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { SecretString } from "@superdurable/connectors-sdk";
|
|
4
|
+
var ConfigSchema = z.object({
|
|
5
|
+
"region": z.string().optional(),
|
|
6
|
+
"endpoint": z.string().optional(),
|
|
7
|
+
"timeoutMs": z.number().int().optional(),
|
|
8
|
+
"maxResponseBytes": z.number().int().optional()
|
|
9
|
+
});
|
|
10
|
+
function decodeCredentials(value) {
|
|
11
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("credential fields are invalid");
|
|
12
|
+
const fields = value;
|
|
13
|
+
const allowed = /* @__PURE__ */ new Set(["access_key_id", "secret_access_key", "session_token"]);
|
|
14
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new TypeError("stored credential does not match the connector credential fields");
|
|
15
|
+
if (fields["access_key_id"] != null && !(typeof fields["access_key_id"] === "string")) throw new TypeError("credential access_key_id has an invalid type");
|
|
16
|
+
if (fields["secret_access_key"] != null && !(typeof fields["secret_access_key"] === "string")) throw new TypeError("credential secret_access_key has an invalid type");
|
|
17
|
+
if (fields["session_token"] != null && !(typeof fields["session_token"] === "string")) throw new TypeError("credential session_token has an invalid type");
|
|
18
|
+
const credentials = {};
|
|
19
|
+
if (!fields["access_key_id"]) throw new TypeError("credential access_key_id is required");
|
|
20
|
+
credentials.accessKeyId = new SecretString(fields["access_key_id"] ?? "");
|
|
21
|
+
if (!fields["secret_access_key"]) throw new TypeError("credential secret_access_key is required");
|
|
22
|
+
credentials.secretAccessKey = new SecretString(fields["secret_access_key"] ?? "");
|
|
23
|
+
credentials.sessionToken = new SecretString(fields["session_token"] ?? "");
|
|
24
|
+
return credentials;
|
|
25
|
+
}
|
|
26
|
+
var GetEmailIdentityInputSchema = z.strictObject({
|
|
27
|
+
"emailIdentity": z.string()
|
|
28
|
+
});
|
|
29
|
+
var EmailIdentityDetailsSchema = z.strictObject({
|
|
30
|
+
"name": z.string(),
|
|
31
|
+
"verificationStatus": z.string()
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// src/generated/definitions.ts
|
|
35
|
+
var ConnectorID = "amazon-ses";
|
|
36
|
+
var ProviderID = "amazon-ses";
|
|
37
|
+
var GetEmailIdentityBranch = {
|
|
38
|
+
Found: "found",
|
|
39
|
+
Missing: "missing",
|
|
40
|
+
ProviderRejected: "providerRejected",
|
|
41
|
+
InvalidResponse: "invalidResponse",
|
|
42
|
+
Defect: "defect"
|
|
43
|
+
};
|
|
44
|
+
var GetEmailIdentityBranchFound = GetEmailIdentityBranch.Found;
|
|
45
|
+
var GetEmailIdentityBranchMissing = GetEmailIdentityBranch.Missing;
|
|
46
|
+
var GetEmailIdentityBranchProviderRejected = GetEmailIdentityBranch.ProviderRejected;
|
|
47
|
+
var GetEmailIdentityBranchInvalidResponse = GetEmailIdentityBranch.InvalidResponse;
|
|
48
|
+
var GetEmailIdentityBranchDefect = GetEmailIdentityBranch.Defect;
|
|
49
|
+
var GetEmailIdentityDefinition = {
|
|
50
|
+
operation: { connectorId: ConnectorID, operationId: "getEmailIdentity" },
|
|
51
|
+
branches: [
|
|
52
|
+
{ id: "found", description: "AWS returned the identity verification status." },
|
|
53
|
+
{ id: "missing", description: "The identity does not exist in the selected Region.", optional: true },
|
|
54
|
+
{ id: "providerRejected", description: "AWS conclusively rejected the request or credentials.", optional: true },
|
|
55
|
+
{ id: "invalidResponse", description: "AWS returned malformed or oversized identity metadata.", optional: true },
|
|
56
|
+
{ id: "defect", description: "The identity, endpoint, Region, or credentials are invalid.", optional: true }
|
|
57
|
+
],
|
|
58
|
+
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
59
|
+
};
|
|
60
|
+
var GetEmailIdentityMetadata = { kind: "query", idempotency: "none", authorization: "required" };
|
|
61
|
+
|
|
62
|
+
// src/generated/connection.ts
|
|
63
|
+
import { ConnectionRefSchema } from "@superdurable/connectors-sdk";
|
|
64
|
+
var Connection = class {
|
|
65
|
+
/** Stable provider and connection name. */
|
|
66
|
+
reference;
|
|
67
|
+
/** Bound provider operations. */
|
|
68
|
+
operations;
|
|
69
|
+
/** Validate a reference and bind operations. */
|
|
70
|
+
constructor(reference, operations) {
|
|
71
|
+
this.reference = ConnectionRefSchema.parse(reference);
|
|
72
|
+
if (this.reference.provider !== ProviderID) throw new TypeError("connection provider differs from the manifest");
|
|
73
|
+
if (!operations) throw new TypeError("connector operations are required");
|
|
74
|
+
this.operations = operations;
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
function newConnection(client, reference) {
|
|
78
|
+
if (!client) throw new TypeError("connector client is required");
|
|
79
|
+
return new Connection(reference, client);
|
|
80
|
+
}
|
|
81
|
+
function newConnectionWithOperations(operations, reference) {
|
|
82
|
+
return new Connection(reference, operations);
|
|
83
|
+
}
|
|
84
|
+
function newProjectConnection(project, connectionName, createClient) {
|
|
85
|
+
if (!project) throw new TypeError("loaded project is required");
|
|
86
|
+
const reference = ConnectionRefSchema.parse({ provider: ProviderID, name: connectionName });
|
|
87
|
+
const selected = project.configuration.connections.find((entry) => entry.connectorId === ConnectorID && entry.connectionName === connectionName);
|
|
88
|
+
if (!selected || selected.provider !== ProviderID) throw new TypeError("project connection is not configured");
|
|
89
|
+
return newConnection(createClient(project, connectionName), reference);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export {
|
|
93
|
+
ConfigSchema,
|
|
94
|
+
decodeCredentials,
|
|
95
|
+
GetEmailIdentityInputSchema,
|
|
96
|
+
EmailIdentityDetailsSchema,
|
|
97
|
+
ConnectorID,
|
|
98
|
+
ProviderID,
|
|
99
|
+
GetEmailIdentityBranch,
|
|
100
|
+
GetEmailIdentityBranchFound,
|
|
101
|
+
GetEmailIdentityBranchMissing,
|
|
102
|
+
GetEmailIdentityBranchProviderRejected,
|
|
103
|
+
GetEmailIdentityBranchInvalidResponse,
|
|
104
|
+
GetEmailIdentityBranchDefect,
|
|
105
|
+
GetEmailIdentityDefinition,
|
|
106
|
+
GetEmailIdentityMetadata,
|
|
107
|
+
Connection,
|
|
108
|
+
newConnection,
|
|
109
|
+
newConnectionWithOperations,
|
|
110
|
+
newProjectConnection
|
|
111
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { SecretString, CredentialProvider, Query, ConnectionRef } from '@superdurable/connectors-sdk';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/** Connector configuration; omitted fields use manifest defaults. */
|
|
5
|
+
interface Config {
|
|
6
|
+
/** AWS Region code for the email identity, such as eu-west-1. In https://console.aws.amazon.com/ses > Verified identities, use the Region selector; blank uses the displayed default. */
|
|
7
|
+
region?: string;
|
|
8
|
+
/** Optional SES-compatible API root. Blank derives the regional AWS endpoint from region. Override only for a trusted compatible endpoint; local tests may use loopback HTTP. */
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
/** Maximum duration of one GetEmailIdentity request as a positive Go duration such as 15s. Blank uses the displayed default; increase only for a slow network. Runtime value in milliseconds. */
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
/** Maximum complete identity metadata response in bytes. Blank uses the displayed default; increase only for unusually large responses. */
|
|
13
|
+
maxResponseBytes?: number;
|
|
14
|
+
}
|
|
15
|
+
/** Runtime schema for manifest configuration. */
|
|
16
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
17
|
+
region: z.ZodOptional<z.ZodString>;
|
|
18
|
+
endpoint: z.ZodOptional<z.ZodString>;
|
|
19
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
20
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
/** Private connector credentials resolved by the host. */
|
|
23
|
+
interface Credentials {
|
|
24
|
+
/** Secret-stored AWS access key ID from https://console.aws.amazon.com/iam > Users > selected user > Security credentials > Access keys > Create access key. Long-term IDs start AKIA and temporary IDs start ASIA. Blank prevents signing. */
|
|
25
|
+
accessKeyId: SecretString;
|
|
26
|
+
/** Secret access key paired with access_key_id, shown once on the IAM Retrieve access keys page. Copy the Value, never the key ID. Blank prevents signing; rotate through IAM. */
|
|
27
|
+
secretAccessKey: SecretString;
|
|
28
|
+
/** Secret session token for temporary ASIA credentials, from AWS STS. Blank means long-term IAM user credentials. Temporary credentials expire; replace all three fields before expiry. */
|
|
29
|
+
sessionToken?: SecretString;
|
|
30
|
+
}
|
|
31
|
+
/** Decode private credential fields for the connector. */
|
|
32
|
+
declare function decodeCredentials(value: unknown): Credentials;
|
|
33
|
+
/** Host-owned source of private connector credentials. */
|
|
34
|
+
type CredentialSource = CredentialProvider<Credentials>;
|
|
35
|
+
/** GetEmailIdentityInput identifies one SES email identity in the configured Region. */
|
|
36
|
+
interface GetEmailIdentityInput {
|
|
37
|
+
"emailIdentity": string;
|
|
38
|
+
}
|
|
39
|
+
/** EmailIdentityDetails returns the name and verification status of an SES email identity. */
|
|
40
|
+
interface EmailIdentityDetails {
|
|
41
|
+
"name": string;
|
|
42
|
+
"verificationStatus": string;
|
|
43
|
+
}
|
|
44
|
+
/** Runtime validator for GetEmailIdentityInput. */
|
|
45
|
+
declare const GetEmailIdentityInputSchema: z.ZodObject<{
|
|
46
|
+
emailIdentity: z.ZodString;
|
|
47
|
+
}, z.core.$strict>;
|
|
48
|
+
/** Runtime validator for EmailIdentityDetails. */
|
|
49
|
+
declare const EmailIdentityDetailsSchema: z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
verificationStatus: z.ZodString;
|
|
52
|
+
}, z.core.$strict>;
|
|
53
|
+
|
|
54
|
+
/** Typed operations supplied by a client or mock. */
|
|
55
|
+
interface Operations {
|
|
56
|
+
/** Invoke getEmailIdentity through this connection. */
|
|
57
|
+
getEmailIdentity(): Query<GetEmailIdentityInput, EmailIdentityDetails>;
|
|
58
|
+
}
|
|
59
|
+
/** Named connector connection kept outside Flow state. */
|
|
60
|
+
declare class Connection<BoundOperations = Operations> {
|
|
61
|
+
/** Stable provider and connection name. */
|
|
62
|
+
readonly reference: ConnectionRef;
|
|
63
|
+
/** Bound provider operations. */
|
|
64
|
+
readonly operations: BoundOperations;
|
|
65
|
+
/** Validate a reference and bind operations. */
|
|
66
|
+
constructor(reference: ConnectionRef, operations: BoundOperations);
|
|
67
|
+
}
|
|
68
|
+
/** Bind a client to a named connection. */
|
|
69
|
+
declare function newConnection(client: Operations, reference: ConnectionRef): Connection;
|
|
70
|
+
/** Bind scripted operations to a named connection. */
|
|
71
|
+
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
72
|
+
|
|
73
|
+
export { Connection as C, type EmailIdentityDetails as E, type GetEmailIdentityInput as G, type Operations as O, type Config as a, type Credentials as b, ConfigSchema as c, type CredentialSource as d, EmailIdentityDetailsSchema as e, GetEmailIdentityInputSchema as f, decodeCredentials as g, newConnectionWithOperations as h, newConnection as n };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { G as GetEmailIdentityInput, E as EmailIdentityDetails, C as Connection, O as Operations, a as Config, b as Credentials } from './connection-BEfEuNCI.js';
|
|
2
|
+
export { c as ConfigSchema, d as CredentialSource, e as EmailIdentityDetailsSchema, f as GetEmailIdentityInputSchema, g as decodeCredentials, n as newConnection, h as newConnectionWithOperations } from './connection-BEfEuNCI.js';
|
|
3
|
+
import { QueryDefinition, QueryStepConfig, Query, QueryResult, QueryStep, CredentialProvider, Call, QueryAttempt } from '@superdurable/connectors-sdk';
|
|
4
|
+
import { StepTarget } from '@superdurable/dex';
|
|
5
|
+
import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
|
|
6
|
+
import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
|
|
7
|
+
import 'zod';
|
|
8
|
+
|
|
9
|
+
/** Stable connector identity. */
|
|
10
|
+
declare const ConnectorID = "amazon-ses";
|
|
11
|
+
/** Provider identity for named connections. */
|
|
12
|
+
declare const ProviderID = "amazon-ses";
|
|
13
|
+
/** Branch IDs for getEmailIdentity. */
|
|
14
|
+
declare const GetEmailIdentityBranch: {
|
|
15
|
+
readonly Found: "found";
|
|
16
|
+
readonly Missing: "missing";
|
|
17
|
+
readonly ProviderRejected: "providerRejected";
|
|
18
|
+
readonly InvalidResponse: "invalidResponse";
|
|
19
|
+
readonly Defect: "defect";
|
|
20
|
+
};
|
|
21
|
+
/** AWS returned the identity verification status. */
|
|
22
|
+
declare const GetEmailIdentityBranchFound: "found";
|
|
23
|
+
/** The identity does not exist in the selected Region. */
|
|
24
|
+
declare const GetEmailIdentityBranchMissing: "missing";
|
|
25
|
+
/** AWS conclusively rejected the request or credentials. */
|
|
26
|
+
declare const GetEmailIdentityBranchProviderRejected: "providerRejected";
|
|
27
|
+
/** AWS returned malformed or oversized identity metadata. */
|
|
28
|
+
declare const GetEmailIdentityBranchInvalidResponse: "invalidResponse";
|
|
29
|
+
/** The identity, endpoint, Region, or credentials are invalid. */
|
|
30
|
+
declare const GetEmailIdentityBranchDefect: "defect";
|
|
31
|
+
/** Manifest definition for getEmailIdentity. */
|
|
32
|
+
declare const GetEmailIdentityDefinition: QueryDefinition;
|
|
33
|
+
/** Manifest metadata for getEmailIdentity. */
|
|
34
|
+
declare const GetEmailIdentityMetadata: {
|
|
35
|
+
readonly kind: "query";
|
|
36
|
+
readonly idempotency: "none";
|
|
37
|
+
readonly authorization: "required";
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** Configuration for the getEmailIdentity connector Step. */
|
|
41
|
+
interface GetEmailIdentityStepConfig<StepInput, OperationInput = GetEmailIdentityInput, OperationOutput = EmailIdentityDetails> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
|
|
42
|
+
/** Named connection supplying this operation. */
|
|
43
|
+
connection: Connection<{
|
|
44
|
+
getEmailIdentity(): Query<OperationInput, OperationOutput>;
|
|
45
|
+
}>;
|
|
46
|
+
/** Name matching the bound connection. */
|
|
47
|
+
connectionName: string;
|
|
48
|
+
/** AWS returned the identity verification status. */
|
|
49
|
+
found: StepTarget<QueryResult<OperationOutput>>;
|
|
50
|
+
/** The identity does not exist in the selected Region. */
|
|
51
|
+
missing?: StepTarget<QueryResult<OperationOutput>>;
|
|
52
|
+
/** AWS conclusively rejected the request or credentials. */
|
|
53
|
+
providerRejected?: StepTarget<QueryResult<OperationOutput>>;
|
|
54
|
+
/** AWS returned malformed or oversized identity metadata. */
|
|
55
|
+
invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
|
|
56
|
+
/** The identity, endpoint, Region, or credentials are invalid. */
|
|
57
|
+
defect?: StepTarget<QueryResult<OperationOutput>>;
|
|
58
|
+
}
|
|
59
|
+
/** Build the getEmailIdentity Step from a named connection. */
|
|
60
|
+
declare function newGetEmailIdentityStep<StepInput, OperationInput = GetEmailIdentityInput, OperationOutput = EmailIdentityDetails>(configuration: GetEmailIdentityStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
|
|
61
|
+
|
|
62
|
+
/** Open one named Amazon SES connection from Dex project configuration. */
|
|
63
|
+
declare function newProjectConnection(project: LoadedProject, connectionName: string): Connection<Operations>;
|
|
64
|
+
|
|
65
|
+
/** Injectable transport and clock for tests and local applications. */
|
|
66
|
+
interface AmazonSESClientOptions {
|
|
67
|
+
/** Provider sender; omitted uses the SDK transport. */ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
|
|
68
|
+
/** Signing clock; omitted uses the current time. */ now?: () => Date;
|
|
69
|
+
}
|
|
70
|
+
interface Exchange {
|
|
71
|
+
status: number;
|
|
72
|
+
body: Uint8Array;
|
|
73
|
+
retryAfterMs: number;
|
|
74
|
+
error?: 'credential' | 'request' | 'tooLarge';
|
|
75
|
+
}
|
|
76
|
+
/** Authenticated AWS SES client for signed GetEmailIdentity requests. */
|
|
77
|
+
declare class AmazonSESClient {
|
|
78
|
+
private readonly credentials;
|
|
79
|
+
private readonly endpoint;
|
|
80
|
+
private readonly region;
|
|
81
|
+
private readonly timeoutMs;
|
|
82
|
+
private readonly maxResponseBytes;
|
|
83
|
+
private readonly send;
|
|
84
|
+
private readonly now;
|
|
85
|
+
/** Validate the Region, endpoint, and limits without contacting AWS. */
|
|
86
|
+
constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: AmazonSESClientOptions);
|
|
87
|
+
/** Bind the getEmailIdentity Query. */ getEmailIdentity(): GetEmailIdentityOperation;
|
|
88
|
+
/** Sign and send one bounded GetEmailIdentity request. */
|
|
89
|
+
readIdentity(call: Call, name: string): Promise<Exchange>;
|
|
90
|
+
}
|
|
91
|
+
/** Read the name and verification status of one SES identity. */
|
|
92
|
+
declare class GetEmailIdentityOperation implements Query<GetEmailIdentityInput, EmailIdentityDetails> {
|
|
93
|
+
private readonly client;
|
|
94
|
+
/** Bind the provider client. */ constructor(client: AmazonSESClient);
|
|
95
|
+
/** Return the generated Query contract. */ definition(): QueryDefinition;
|
|
96
|
+
/** Classify provider outcomes consistently with the Go implementation. */
|
|
97
|
+
invoke(call: Call, input: GetEmailIdentityInput): Promise<QueryAttempt<EmailIdentityDetails>>;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { AmazonSESClient, type AmazonSESClientOptions, Config, Connection, ConnectorID, Credentials, EmailIdentityDetails, GetEmailIdentityBranch, GetEmailIdentityBranchDefect, GetEmailIdentityBranchFound, GetEmailIdentityBranchInvalidResponse, GetEmailIdentityBranchMissing, GetEmailIdentityBranchProviderRejected, GetEmailIdentityDefinition, GetEmailIdentityInput, GetEmailIdentityMetadata, GetEmailIdentityOperation, type GetEmailIdentityStepConfig, ProviderID, newGetEmailIdentityStep, newProjectConnection };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ConfigSchema,
|
|
3
|
+
Connection,
|
|
4
|
+
ConnectorID,
|
|
5
|
+
EmailIdentityDetailsSchema,
|
|
6
|
+
GetEmailIdentityBranch,
|
|
7
|
+
GetEmailIdentityBranchDefect,
|
|
8
|
+
GetEmailIdentityBranchFound,
|
|
9
|
+
GetEmailIdentityBranchInvalidResponse,
|
|
10
|
+
GetEmailIdentityBranchMissing,
|
|
11
|
+
GetEmailIdentityBranchProviderRejected,
|
|
12
|
+
GetEmailIdentityDefinition,
|
|
13
|
+
GetEmailIdentityInputSchema,
|
|
14
|
+
GetEmailIdentityMetadata,
|
|
15
|
+
ProviderID,
|
|
16
|
+
decodeCredentials,
|
|
17
|
+
newConnection,
|
|
18
|
+
newConnectionWithOperations,
|
|
19
|
+
newProjectConnection
|
|
20
|
+
} from "./chunk-6NP3EK7O.js";
|
|
21
|
+
|
|
22
|
+
// src/generated/steps.ts
|
|
23
|
+
import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
|
|
24
|
+
function newGetEmailIdentityStep(configuration) {
|
|
25
|
+
const { connection, connectionName, found, missing, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
|
|
26
|
+
if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
|
|
27
|
+
return newQueryStep({ ...stepConfiguration, operation: connection.operations.getEmailIdentity(), connection: connection.reference, branches: [
|
|
28
|
+
goToBranch("found", found),
|
|
29
|
+
...missing ? [goToBranch("missing", missing)] : [],
|
|
30
|
+
...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
|
|
31
|
+
...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
|
|
32
|
+
...defect ? [goToBranch("defect", defect)] : []
|
|
33
|
+
] });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// src/project.ts
|
|
37
|
+
import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
|
|
38
|
+
import { z } from "zod";
|
|
39
|
+
|
|
40
|
+
// src/client.ts
|
|
41
|
+
import { createHash, createHmac } from "crypto";
|
|
42
|
+
import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
43
|
+
import { BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
|
|
44
|
+
var emptyDetails = () => ({ name: "", verificationStatus: "" });
|
|
45
|
+
var emailIdentityPattern = /^[A-Za-z0-9._+@-]{1,254}$/;
|
|
46
|
+
var regionPattern = /^[a-z]{2}(?:-gov)?-[a-z]+-[0-9]+$/;
|
|
47
|
+
var AmazonSESClient = class {
|
|
48
|
+
/** Validate the Region, endpoint, and limits without contacting AWS. */
|
|
49
|
+
constructor(config, credentials, options = {}) {
|
|
50
|
+
this.credentials = credentials;
|
|
51
|
+
if (!config || !credentials) throw new TypeError("SES configuration and credentials are required");
|
|
52
|
+
this.region = config.region || "us-east-1";
|
|
53
|
+
if (!regionPattern.test(this.region)) throw new TypeError("SES Region is invalid");
|
|
54
|
+
this.endpoint = validateBaseURL(config.endpoint || `https://email.${this.region}.amazonaws.com`).replace(/\/+$/, "");
|
|
55
|
+
this.timeoutMs = config.timeoutMs || 15e3;
|
|
56
|
+
this.maxResponseBytes = config.maxResponseBytes || 2097152;
|
|
57
|
+
if (!Number.isSafeInteger(this.timeoutMs) || this.timeoutMs <= 0 || !Number.isSafeInteger(this.maxResponseBytes) || this.maxResponseBytes <= 0)
|
|
58
|
+
throw new TypeError("SES request limits must be positive integers");
|
|
59
|
+
this.send = options.send ?? sendProviderRequest;
|
|
60
|
+
this.now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
61
|
+
}
|
|
62
|
+
credentials;
|
|
63
|
+
endpoint;
|
|
64
|
+
region;
|
|
65
|
+
timeoutMs;
|
|
66
|
+
maxResponseBytes;
|
|
67
|
+
send;
|
|
68
|
+
now;
|
|
69
|
+
/** Bind the getEmailIdentity Query. */
|
|
70
|
+
getEmailIdentity() {
|
|
71
|
+
return new GetEmailIdentityOperation(this);
|
|
72
|
+
}
|
|
73
|
+
/** Sign and send one bounded GetEmailIdentity request. */
|
|
74
|
+
async readIdentity(call, name) {
|
|
75
|
+
let accessKey;
|
|
76
|
+
let secretKey;
|
|
77
|
+
let sessionToken;
|
|
78
|
+
try {
|
|
79
|
+
const credentials = await this.credentials.resolve(call, call.context.cancellationSignal);
|
|
80
|
+
accessKey = credentials.accessKeyId instanceof SecretString ? credentials.accessKeyId.reveal() : "";
|
|
81
|
+
secretKey = credentials.secretAccessKey instanceof SecretString ? credentials.secretAccessKey.reveal() : "";
|
|
82
|
+
sessionToken = credentials.sessionToken instanceof SecretString ? credentials.sessionToken.reveal() : "";
|
|
83
|
+
} catch {
|
|
84
|
+
return emptyExchange("credential");
|
|
85
|
+
}
|
|
86
|
+
if (!accessKey || !secretKey || !isHeaderSafeCredential(accessKey) || !isHeaderSafeCredential(secretKey) || sessionToken && !isHeaderSafeCredential(sessionToken)) return emptyExchange("credential");
|
|
87
|
+
const url = `${this.endpoint}/v2/email/identities/${encodeURIComponent(name)}`;
|
|
88
|
+
const now = this.now();
|
|
89
|
+
const timestamp = now.toISOString().replace(/[-:]|\.\d{3}/g, "");
|
|
90
|
+
const day = timestamp.slice(0, 8);
|
|
91
|
+
const host = new URL(url).host;
|
|
92
|
+
const signedHeaders = sessionToken ? "host;x-amz-date;x-amz-security-token" : "host;x-amz-date";
|
|
93
|
+
const canonicalHeaders = `host:${host}
|
|
94
|
+
x-amz-date:${timestamp}
|
|
95
|
+
` + (sessionToken ? `x-amz-security-token:${sessionToken}
|
|
96
|
+
` : "");
|
|
97
|
+
const payloadHash = createHash("sha256").update("").digest("hex");
|
|
98
|
+
const canonicalRequest = `GET
|
|
99
|
+
/v2/email/identities/${encodeURIComponent(name)}
|
|
100
|
+
|
|
101
|
+
${canonicalHeaders}
|
|
102
|
+
${signedHeaders}
|
|
103
|
+
${payloadHash}`;
|
|
104
|
+
const scope = `${day}/${this.region}/ses/aws4_request`;
|
|
105
|
+
const stringToSign = `AWS4-HMAC-SHA256
|
|
106
|
+
${timestamp}
|
|
107
|
+
${scope}
|
|
108
|
+
${createHash("sha256").update(canonicalRequest).digest("hex")}`;
|
|
109
|
+
const hmac = (key, value) => createHmac("sha256", key).update(value).digest();
|
|
110
|
+
const signingKey = hmac(hmac(hmac(hmac(`AWS4${secretKey}`, day), this.region), "ses"), "aws4_request");
|
|
111
|
+
const signature = createHmac("sha256", signingKey).update(stringToSign).digest("hex");
|
|
112
|
+
const headers = {
|
|
113
|
+
"X-Amz-Date": timestamp,
|
|
114
|
+
Authorization: `AWS4-HMAC-SHA256 Credential=${accessKey}/${scope}, SignedHeaders=${signedHeaders}, Signature=${signature}`
|
|
115
|
+
};
|
|
116
|
+
if (sessionToken) headers["X-Amz-Security-Token"] = sessionToken;
|
|
117
|
+
const request = {
|
|
118
|
+
url,
|
|
119
|
+
method: "GET",
|
|
120
|
+
headers,
|
|
121
|
+
maxResponseBytes: this.maxResponseBytes,
|
|
122
|
+
timeoutMs: this.timeoutMs,
|
|
123
|
+
addressPolicy: this.endpoint.startsWith("https://") ? "publicHTTPS" : "privateNetworkHTTP",
|
|
124
|
+
signal: call.context.cancellationSignal
|
|
125
|
+
};
|
|
126
|
+
let response;
|
|
127
|
+
let isTooLarge = false;
|
|
128
|
+
try {
|
|
129
|
+
response = await this.send(request);
|
|
130
|
+
} catch (error) {
|
|
131
|
+
if (error instanceof BodyTooLargeError && error.status !== void 0) {
|
|
132
|
+
response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
|
|
133
|
+
isTooLarge = true;
|
|
134
|
+
} else return emptyExchange("request");
|
|
135
|
+
}
|
|
136
|
+
const retryAfterMs = parseRetryAfter(header(response.headers, "retry-after"));
|
|
137
|
+
if (isTooLarge || response.body.length > this.maxResponseBytes)
|
|
138
|
+
return { status: response.status, body: new Uint8Array(), retryAfterMs, error: "tooLarge" };
|
|
139
|
+
if ([accessKey, secretKey, sessionToken].some((secret) => secret && Buffer.from(response.body).includes(secret)))
|
|
140
|
+
return { ...emptyExchange("credential"), status: response.status, retryAfterMs };
|
|
141
|
+
return { status: response.status, body: response.body, retryAfterMs };
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
var GetEmailIdentityOperation = class {
|
|
145
|
+
/** Bind the provider client. */
|
|
146
|
+
constructor(client) {
|
|
147
|
+
this.client = client;
|
|
148
|
+
}
|
|
149
|
+
client;
|
|
150
|
+
/** Return the generated Query contract. */
|
|
151
|
+
definition() {
|
|
152
|
+
return GetEmailIdentityDefinition;
|
|
153
|
+
}
|
|
154
|
+
/** Classify provider outcomes consistently with the Go implementation. */
|
|
155
|
+
async invoke(call, input) {
|
|
156
|
+
if (!input || typeof input.emailIdentity !== "string" || !emailIdentityPattern.test(input.emailIdentity))
|
|
157
|
+
return terminal("defect", "VALIDATION", "SES email identity is invalid");
|
|
158
|
+
const exchange = await this.client.readIdentity(call, input.emailIdentity);
|
|
159
|
+
if (exchange.error === "credential") return terminal("defect", "AUTHENTICATION", "SES credentials are unavailable or invalid");
|
|
160
|
+
if (exchange.error === "request") return retry("TRANSPORT", "SES request failed");
|
|
161
|
+
if (exchange.status === 429) return retry("RATE_LIMIT", "SES rate limited the request", exchange.retryAfterMs);
|
|
162
|
+
if (exchange.status === 408 || exchange.status >= 500) return retry("AVAILABILITY", "SES is temporarily unavailable", exchange.retryAfterMs);
|
|
163
|
+
if (exchange.status === 404) return newQueryBranch("missing", emptyDetails());
|
|
164
|
+
if (exchange.status !== 200) return terminal("providerRejected", "PROVIDER_REJECTION", `SES rejected HTTP ${exchange.status}`);
|
|
165
|
+
if (exchange.error === "tooLarge") return terminal("invalidResponse", "RESPONSE_TOO_LARGE", "SES response exceeded the configured limit");
|
|
166
|
+
let document;
|
|
167
|
+
try {
|
|
168
|
+
document = JSON.parse(Buffer.from(exchange.body).toString("utf8"));
|
|
169
|
+
} catch {
|
|
170
|
+
return terminal("invalidResponse", "PROTOCOL", "SES returned invalid identity JSON");
|
|
171
|
+
}
|
|
172
|
+
if (!isObject(document) || typeof document.VerificationStatus !== "string" || !["PENDING", "SUCCESS", "FAILED", "TEMPORARY_FAILURE", "NOT_STARTED"].includes(document.VerificationStatus))
|
|
173
|
+
return terminal("invalidResponse", "PROTOCOL", "SES returned invalid identity JSON");
|
|
174
|
+
return newQueryBranch("found", { name: input.emailIdentity, verificationStatus: document.VerificationStatus });
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
function isObject(value) {
|
|
178
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
179
|
+
}
|
|
180
|
+
function emptyExchange(error) {
|
|
181
|
+
return { status: 0, body: new Uint8Array(), retryAfterMs: 0, error };
|
|
182
|
+
}
|
|
183
|
+
function failure(kind, message) {
|
|
184
|
+
return { provider: "amazon-ses", operation: "getEmailIdentity", kind, message };
|
|
185
|
+
}
|
|
186
|
+
function terminal(branch, kind, message) {
|
|
187
|
+
return newQueryBranch(branch, emptyDetails(), {}, failure(kind, message));
|
|
188
|
+
}
|
|
189
|
+
function retry(kind, message, delay = 0) {
|
|
190
|
+
return newQueryRetry(failure(kind, message), delay);
|
|
191
|
+
}
|
|
192
|
+
function header(headers, name) {
|
|
193
|
+
const entry = Object.entries(headers).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
|
|
194
|
+
return Array.isArray(entry) ? entry[0] ?? "" : entry ?? "";
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// src/project.ts
|
|
198
|
+
function newProjectConnection2(project, connectionName) {
|
|
199
|
+
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
200
|
+
const selected = loadedProject.configuration.connections.find((entry) => entry.connectorId === "amazon-ses" && entry.connectionName === name);
|
|
201
|
+
if (!selected) throw new TypeError("Amazon SES project connection is not configured");
|
|
202
|
+
const fields = z.strictObject({ region: z.string().optional(), endpoint: z.string().optional(), timeout: z.union([z.string(), z.number().int()]).optional(), maxResponseBytes: z.number().int().optional() }).parse(selected.configuration);
|
|
203
|
+
const timeoutMs = typeof fields.timeout === "number" ? Math.ceil(fields.timeout / 1e6) : fields.timeout ? parseDurationMilliseconds(fields.timeout) : void 0;
|
|
204
|
+
const config = {
|
|
205
|
+
...fields.region ? { region: fields.region } : {},
|
|
206
|
+
...fields.endpoint ? { endpoint: fields.endpoint } : {},
|
|
207
|
+
...timeoutMs !== void 0 ? { timeoutMs } : {},
|
|
208
|
+
...fields.maxResponseBytes !== void 0 ? { maxResponseBytes: fields.maxResponseBytes } : {}
|
|
209
|
+
};
|
|
210
|
+
const credentials = {
|
|
211
|
+
async resolve(_call, signal) {
|
|
212
|
+
const privateFields = await loadedProject.resolveCredential("amazon-ses", name, signal);
|
|
213
|
+
if (typeof privateFields.access_key_id !== "string" || typeof privateFields.secret_access_key !== "string") throw new TypeError("Amazon SES credentials are unavailable");
|
|
214
|
+
return { accessKeyId: new SecretString2(privateFields.access_key_id), secretAccessKey: new SecretString2(privateFields.secret_access_key), sessionToken: new SecretString2(typeof privateFields.session_token === "string" ? privateFields.session_token : "") };
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
return new AmazonSESClient(config, credentials);
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
function parseDurationMilliseconds(value) {
|
|
221
|
+
let remaining = value;
|
|
222
|
+
let milliseconds = 0;
|
|
223
|
+
const units = { ns: 1e-6, us: 1e-3, "\xB5s": 1e-3, ms: 1, s: 1e3, m: 6e4, h: 36e5 };
|
|
224
|
+
while (remaining) {
|
|
225
|
+
const part = /^(\d+(?:\.\d+)?)(ns|us|µs|ms|s|m|h)/.exec(remaining);
|
|
226
|
+
if (!part) throw new TypeError("Amazon SES timeout must be a positive Go duration");
|
|
227
|
+
milliseconds += Number(part[1]) * (units[part[2] ?? ""] ?? NaN);
|
|
228
|
+
remaining = remaining.slice(part[0].length);
|
|
229
|
+
}
|
|
230
|
+
if (!Number.isSafeInteger(milliseconds) || milliseconds <= 0) throw new TypeError("Amazon SES timeout must resolve to positive whole milliseconds");
|
|
231
|
+
return milliseconds;
|
|
232
|
+
}
|
|
233
|
+
export {
|
|
234
|
+
AmazonSESClient,
|
|
235
|
+
ConfigSchema,
|
|
236
|
+
Connection,
|
|
237
|
+
ConnectorID,
|
|
238
|
+
EmailIdentityDetailsSchema,
|
|
239
|
+
GetEmailIdentityBranch,
|
|
240
|
+
GetEmailIdentityBranchDefect,
|
|
241
|
+
GetEmailIdentityBranchFound,
|
|
242
|
+
GetEmailIdentityBranchInvalidResponse,
|
|
243
|
+
GetEmailIdentityBranchMissing,
|
|
244
|
+
GetEmailIdentityBranchProviderRejected,
|
|
245
|
+
GetEmailIdentityDefinition,
|
|
246
|
+
GetEmailIdentityInputSchema,
|
|
247
|
+
GetEmailIdentityMetadata,
|
|
248
|
+
GetEmailIdentityOperation,
|
|
249
|
+
ProviderID,
|
|
250
|
+
decodeCredentials,
|
|
251
|
+
newConnection,
|
|
252
|
+
newConnectionWithOperations,
|
|
253
|
+
newGetEmailIdentityStep,
|
|
254
|
+
newProjectConnection2 as newProjectConnection
|
|
255
|
+
};
|
package/dist/mock.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
|
+
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
+
import { O as Operations, C as Connection, G as GetEmailIdentityInput, E as EmailIdentityDetails } from './connection-BEfEuNCI.js';
|
|
4
|
+
import 'zod';
|
|
5
|
+
|
|
6
|
+
/** Go zero value for GetEmailIdentityInput in scripted cases. */
|
|
7
|
+
declare const emptyGetEmailIdentityInput: GetEmailIdentityInput;
|
|
8
|
+
/** Go zero value for EmailIdentityDetails in scripted cases. */
|
|
9
|
+
declare const emptyEmailIdentityDetails: EmailIdentityDetails;
|
|
10
|
+
/** Script the found branch. */
|
|
11
|
+
declare function getEmailIdentityFound(value: EmailIdentityDetails, failure?: Failure): Case<EmailIdentityDetails>;
|
|
12
|
+
/** Script the missing branch. */
|
|
13
|
+
declare function getEmailIdentityMissing(value: EmailIdentityDetails, failure?: Failure): Case<EmailIdentityDetails>;
|
|
14
|
+
/** Script the providerRejected branch. */
|
|
15
|
+
declare function getEmailIdentityProviderRejected(value: EmailIdentityDetails, failure?: Failure): Case<EmailIdentityDetails>;
|
|
16
|
+
/** Script the invalidResponse branch. */
|
|
17
|
+
declare function getEmailIdentityInvalidResponse(value: EmailIdentityDetails, failure?: Failure): Case<EmailIdentityDetails>;
|
|
18
|
+
/** Script the defect branch. */
|
|
19
|
+
declare function getEmailIdentityDefect(value: EmailIdentityDetails, failure?: Failure): Case<EmailIdentityDetails>;
|
|
20
|
+
/** Script a safe retry of getEmailIdentity. */
|
|
21
|
+
declare function getEmailIdentityRetry(failure: Failure, retryAfterMs?: number): Case<EmailIdentityDetails>;
|
|
22
|
+
/** Manifest scenario foundDefault for getEmailIdentity. */
|
|
23
|
+
declare function getEmailIdentityFoundDefault(): Case<EmailIdentityDetails>;
|
|
24
|
+
/** Default getEmailIdentity scenario. */
|
|
25
|
+
declare function getEmailIdentityDefault(): Case<EmailIdentityDetails>;
|
|
26
|
+
/** Scripted operations and manifest defaults for this connector. */
|
|
27
|
+
declare class GeneratedMock implements Operations {
|
|
28
|
+
#private;
|
|
29
|
+
constructor(connectionName: string);
|
|
30
|
+
connection(): Connection;
|
|
31
|
+
getEmailIdentity(): MockQuery<GetEmailIdentityInput, EmailIdentityDetails>;
|
|
32
|
+
assertNoFailures(): void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { GeneratedMock, GeneratedMock as Mock, emptyEmailIdentityDetails, emptyGetEmailIdentityInput, getEmailIdentityDefault, getEmailIdentityDefect, getEmailIdentityFound, getEmailIdentityFoundDefault, getEmailIdentityInvalidResponse, getEmailIdentityMissing, getEmailIdentityProviderRejected, getEmailIdentityRetry };
|
package/dist/mock.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EmailIdentityDetailsSchema,
|
|
3
|
+
GetEmailIdentityDefinition,
|
|
4
|
+
GetEmailIdentityInputSchema,
|
|
5
|
+
ProviderID,
|
|
6
|
+
newConnectionWithOperations
|
|
7
|
+
} from "./chunk-6NP3EK7O.js";
|
|
8
|
+
|
|
9
|
+
// src/generated/mock.ts
|
|
10
|
+
import { branchCase, retryCase, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
|
11
|
+
var emptyGetEmailIdentityInput = GetEmailIdentityInputSchema.parse({
|
|
12
|
+
"emailIdentity": ""
|
|
13
|
+
});
|
|
14
|
+
var emptyEmailIdentityDetails = EmailIdentityDetailsSchema.parse({
|
|
15
|
+
"name": "",
|
|
16
|
+
"verificationStatus": ""
|
|
17
|
+
});
|
|
18
|
+
function getEmailIdentityFound(value, failure) {
|
|
19
|
+
return branchCase("found", value, failure);
|
|
20
|
+
}
|
|
21
|
+
function getEmailIdentityMissing(value, failure) {
|
|
22
|
+
return branchCase("missing", value, failure);
|
|
23
|
+
}
|
|
24
|
+
function getEmailIdentityProviderRejected(value, failure) {
|
|
25
|
+
return branchCase("providerRejected", value, failure);
|
|
26
|
+
}
|
|
27
|
+
function getEmailIdentityInvalidResponse(value, failure) {
|
|
28
|
+
return branchCase("invalidResponse", value, failure);
|
|
29
|
+
}
|
|
30
|
+
function getEmailIdentityDefect(value, failure) {
|
|
31
|
+
return branchCase("defect", value, failure);
|
|
32
|
+
}
|
|
33
|
+
function getEmailIdentityRetry(failure, retryAfterMs = 0) {
|
|
34
|
+
return retryCase(failure, retryAfterMs);
|
|
35
|
+
}
|
|
36
|
+
function getEmailIdentityFoundDefault() {
|
|
37
|
+
const value = EmailIdentityDetailsSchema.parse({ "name": "example.com", "verificationStatus": "SUCCESS" });
|
|
38
|
+
return branchCase("found", value);
|
|
39
|
+
}
|
|
40
|
+
function getEmailIdentityDefault() {
|
|
41
|
+
return getEmailIdentityFoundDefault();
|
|
42
|
+
}
|
|
43
|
+
var GeneratedMock = class {
|
|
44
|
+
#getEmailIdentity;
|
|
45
|
+
#connection;
|
|
46
|
+
constructor(connectionName) {
|
|
47
|
+
this.#getEmailIdentity = newQuery(GetEmailIdentityDefinition).default(getEmailIdentityDefault());
|
|
48
|
+
this.#connection = newConnectionWithOperations(this, { provider: ProviderID, name: connectionName });
|
|
49
|
+
}
|
|
50
|
+
connection() {
|
|
51
|
+
return this.#connection;
|
|
52
|
+
}
|
|
53
|
+
getEmailIdentity() {
|
|
54
|
+
return this.#getEmailIdentity;
|
|
55
|
+
}
|
|
56
|
+
assertNoFailures() {
|
|
57
|
+
this.#getEmailIdentity.assertNoFailures();
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
GeneratedMock,
|
|
62
|
+
GeneratedMock as Mock,
|
|
63
|
+
emptyEmailIdentityDetails,
|
|
64
|
+
emptyGetEmailIdentityInput,
|
|
65
|
+
getEmailIdentityDefault,
|
|
66
|
+
getEmailIdentityDefect,
|
|
67
|
+
getEmailIdentityFound,
|
|
68
|
+
getEmailIdentityFoundDefault,
|
|
69
|
+
getEmailIdentityInvalidResponse,
|
|
70
|
+
getEmailIdentityMissing,
|
|
71
|
+
getEmailIdentityProviderRejected,
|
|
72
|
+
getEmailIdentityRetry
|
|
73
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-amazon-ses",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"description": "Amazon SES connector for Dex TypeScript applications",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/superdurable/dex-connectors-library.git",
|
|
9
|
+
"directory": "connectors/amazon/ses/typescript"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": "^22.0.0 || ^24.0.0"
|
|
14
|
+
},
|
|
15
|
+
"module": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"exports": {
|
|
18
|
+
".": {
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"import": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./mock": {
|
|
23
|
+
"types": "./dist/mock.d.ts",
|
|
24
|
+
"import": "./dist/mock.js"
|
|
25
|
+
},
|
|
26
|
+
"./dex-connector.json": "./dex-connector.json"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE",
|
|
32
|
+
"dex-connector.json"
|
|
33
|
+
],
|
|
34
|
+
"scripts": {
|
|
35
|
+
"prepack": "npm run build",
|
|
36
|
+
"build": "tsup src/index.ts src/mock.ts --format esm --dts --clean",
|
|
37
|
+
"typecheck": "tsc --noEmit",
|
|
38
|
+
"lint": "eslint src test examples",
|
|
39
|
+
"test": "vitest run --exclude test/integration/**",
|
|
40
|
+
"test:integration": "vitest run test/integration/*.integration.test.ts",
|
|
41
|
+
"example:worker": "tsx examples/identity-lookup/worker.ts",
|
|
42
|
+
"example:start": "tsx examples/identity-lookup/start.ts",
|
|
43
|
+
"check": "npm run typecheck && npm run lint && npm test && npm run build"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@superdurable/connectors-sdk": "0.1.1",
|
|
47
|
+
"@superdurable/dex": ">=1.28.0",
|
|
48
|
+
"zod": "^4.1.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@eslint/js": "^9.0.0",
|
|
52
|
+
"@types/node": "^22.0.0",
|
|
53
|
+
"eslint": "^9.0.0",
|
|
54
|
+
"tsup": "^8.0.0",
|
|
55
|
+
"tsx": "^4.23.15",
|
|
56
|
+
"typescript": "^5.9.0",
|
|
57
|
+
"typescript-eslint": "^8.0.0",
|
|
58
|
+
"vitest": "^3.0.0",
|
|
59
|
+
"yaml": "^2.9.1"
|
|
60
|
+
}
|
|
61
|
+
}
|