@superdurable/connector-resend 0.1.0 → 0.1.1
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/dex-connector.json +57 -4
- package/dist/{chunk-FMICLBTO.js → chunk-GNJAHMSJ.js} +21 -5
- package/dist/{connection-CrjLXYUe.d.ts → connection-DSFknakP.d.ts} +7 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.js +40 -26
- package/dist/mock.d.ts +1 -1
- package/dist/mock.js +1 -1
- package/package.json +3 -2
package/dex-connector.json
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"connectorId": "resend",
|
|
3
|
-
"releaseTag": "connectors/resend/go/v0.2.
|
|
3
|
+
"releaseTag": "connectors/resend/go/v0.2.1",
|
|
4
4
|
"package": {
|
|
5
5
|
"ecosystem": "npm",
|
|
6
6
|
"name": "@superdurable/connector-resend",
|
|
7
|
-
"version": "0.1.
|
|
7
|
+
"version": "0.1.1"
|
|
8
8
|
},
|
|
9
9
|
"factories": [
|
|
10
10
|
{
|
|
11
11
|
"name": "newSendEmailStep",
|
|
12
12
|
"kind": "mutation",
|
|
13
13
|
"operationId": "sendEmail",
|
|
14
|
+
"inputType": "SendEmailInput",
|
|
15
|
+
"description": "SendEmail through the Resend public JSON API.",
|
|
14
16
|
"fields": {
|
|
15
17
|
"stepType": "stepType",
|
|
16
18
|
"annotations": "annotations",
|
|
@@ -38,12 +40,49 @@
|
|
|
38
40
|
"field": "defect",
|
|
39
41
|
"optional": true
|
|
40
42
|
}
|
|
41
|
-
]
|
|
43
|
+
],
|
|
44
|
+
"inputSchema": {
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"description": "SendEmailInput is the exact payload sent once per keyed email operation.",
|
|
47
|
+
"properties": {
|
|
48
|
+
"from": {
|
|
49
|
+
"description": "From is the verified sender email address.",
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"html": {
|
|
53
|
+
"description": "HTML is the HTML email body.",
|
|
54
|
+
"type": "string"
|
|
55
|
+
},
|
|
56
|
+
"subject": {
|
|
57
|
+
"description": "Subject is the email subject.",
|
|
58
|
+
"type": "string"
|
|
59
|
+
},
|
|
60
|
+
"to": {
|
|
61
|
+
"description": "To contains recipient email addresses.",
|
|
62
|
+
"items": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"type": [
|
|
66
|
+
"array",
|
|
67
|
+
"null"
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": [
|
|
72
|
+
"from",
|
|
73
|
+
"html",
|
|
74
|
+
"subject",
|
|
75
|
+
"to"
|
|
76
|
+
],
|
|
77
|
+
"type": "object"
|
|
78
|
+
}
|
|
42
79
|
},
|
|
43
80
|
{
|
|
44
81
|
"name": "newGetEmailStep",
|
|
45
82
|
"kind": "query",
|
|
46
83
|
"operationId": "getEmail",
|
|
84
|
+
"inputType": "GetEmailInput",
|
|
85
|
+
"description": "GetEmail through the Resend public JSON API.",
|
|
47
86
|
"fields": {
|
|
48
87
|
"stepType": "stepType",
|
|
49
88
|
"annotations": "annotations",
|
|
@@ -76,7 +115,21 @@
|
|
|
76
115
|
"field": "defect",
|
|
77
116
|
"optional": true
|
|
78
117
|
}
|
|
79
|
-
]
|
|
118
|
+
],
|
|
119
|
+
"inputSchema": {
|
|
120
|
+
"additionalProperties": false,
|
|
121
|
+
"description": "GetEmailInput identifies one sent email.",
|
|
122
|
+
"properties": {
|
|
123
|
+
"id": {
|
|
124
|
+
"description": "ID is the provider's stable resource identifier.",
|
|
125
|
+
"type": "string"
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"required": [
|
|
129
|
+
"id"
|
|
130
|
+
],
|
|
131
|
+
"type": "object"
|
|
132
|
+
}
|
|
80
133
|
}
|
|
81
134
|
]
|
|
82
135
|
}
|
|
@@ -6,14 +6,28 @@ var ConfigSchema = z.object({
|
|
|
6
6
|
"timeoutMs": z.number().int().optional(),
|
|
7
7
|
"maxResponseBytes": z.number().int().optional()
|
|
8
8
|
});
|
|
9
|
+
var CredentialMaterialError = class extends TypeError {
|
|
10
|
+
constructor(message) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = "CredentialMaterialError";
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var sdkCredentialDecodingFailureMessages = /* @__PURE__ */ new Set([
|
|
16
|
+
"project credential decoding failed",
|
|
17
|
+
"shared project credential decoding failed",
|
|
18
|
+
"project credential decoding failed: this connector version does not support shared credentials"
|
|
19
|
+
]);
|
|
20
|
+
function isCredentialMaterialError(error) {
|
|
21
|
+
return error instanceof CredentialMaterialError || error instanceof TypeError && sdkCredentialDecodingFailureMessages.has(error.message);
|
|
22
|
+
}
|
|
9
23
|
function decodeCredentials(value) {
|
|
10
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) throw new
|
|
24
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) throw new CredentialMaterialError("credential fields are invalid");
|
|
11
25
|
const fields = value;
|
|
12
26
|
const allowed = /* @__PURE__ */ new Set(["api_key"]);
|
|
13
|
-
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new
|
|
14
|
-
if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new
|
|
27
|
+
if (Object.keys(fields).some((key) => !allowed.has(key))) throw new CredentialMaterialError("stored credential does not match the connector credential fields");
|
|
28
|
+
if (fields["api_key"] != null && !(typeof fields["api_key"] === "string")) throw new CredentialMaterialError("credential api_key has an invalid type");
|
|
15
29
|
const credentials = {};
|
|
16
|
-
if (!fields["api_key"]) throw new
|
|
30
|
+
if (!fields["api_key"]) throw new CredentialMaterialError("credential api_key is required");
|
|
17
31
|
credentials.apiKey = new SecretString(fields["api_key"] ?? "");
|
|
18
32
|
return credentials;
|
|
19
33
|
}
|
|
@@ -55,7 +69,7 @@ var SendEmailDefinition = {
|
|
|
55
69
|
branches: [
|
|
56
70
|
{ id: "sent", description: "Resend returned the requested result." },
|
|
57
71
|
{ id: "providerRejected", description: "The provider definitively rejected the request.", optional: true },
|
|
58
|
-
{ id: "invalidResponse", description: "
|
|
72
|
+
{ id: "invalidResponse", description: "Kept for compatibility and no longer selected: a malformed or oversized answer now retries, because the Idempotency-Key makes Resend replay the first send.", optional: true },
|
|
59
73
|
{ id: "defect", description: "Local input or connection credentials are invalid.", optional: true }
|
|
60
74
|
],
|
|
61
75
|
stepDefaults: { executeMethodTimeoutMs: 3e4, executeDurability: "async" }
|
|
@@ -118,6 +132,8 @@ function newProjectConnection(project, connectionName, createClient) {
|
|
|
118
132
|
|
|
119
133
|
export {
|
|
120
134
|
ConfigSchema,
|
|
135
|
+
CredentialMaterialError,
|
|
136
|
+
isCredentialMaterialError,
|
|
121
137
|
decodeCredentials,
|
|
122
138
|
SendEmailInputSchema,
|
|
123
139
|
SentEmailSchema,
|
|
@@ -21,6 +21,12 @@ interface Credentials {
|
|
|
21
21
|
/** Secret Resend token. Start at https://resend.com/api-keys, follow API Keys > Create API Key. Create an API key with sending permission, then copy its secret value. It is an opaque secret string; blank prevents requests. It is sent only in the Authorization header. */
|
|
22
22
|
apiKey: SecretString;
|
|
23
23
|
}
|
|
24
|
+
/** Stored credential material that fails the connector credential checks, so no retry can succeed. */
|
|
25
|
+
declare class CredentialMaterialError extends TypeError {
|
|
26
|
+
constructor(message: string);
|
|
27
|
+
}
|
|
28
|
+
/** Report malformed stored credential material, also behind the SDK provider's decoding TypeError. */
|
|
29
|
+
declare function isCredentialMaterialError(error: unknown): boolean;
|
|
24
30
|
/** Decode private credential fields for the connector. */
|
|
25
31
|
declare function decodeCredentials(value: unknown): Credentials;
|
|
26
32
|
/** Host-owned source of private connector credentials. */
|
|
@@ -104,4 +110,4 @@ declare function newConnection(client: Operations, reference: ConnectionRef): Co
|
|
|
104
110
|
/** Bind scripted operations to a named connection. */
|
|
105
111
|
declare function newConnectionWithOperations(operations: Operations, reference: ConnectionRef): Connection;
|
|
106
112
|
|
|
107
|
-
export { Connection as C, type Email as E, type GetEmailInput as G, type Operations as O, type SendEmailInput as S, type SentEmail as a, type Config as b, type Credentials as c, ConfigSchema as d, type CredentialSource as
|
|
113
|
+
export { Connection as C, type Email as E, type GetEmailInput as G, type Operations as O, type SendEmailInput as S, type SentEmail as a, type Config as b, type Credentials as c, ConfigSchema as d, CredentialMaterialError as e, type CredentialSource as f, EmailSchema as g, GetEmailInputSchema as h, SendEmailInputSchema as i, SentEmailSchema as j, decodeCredentials as k, isCredentialMaterialError as l, newConnectionWithOperations as m, newConnection as n };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as GetEmailInput, E as Email, C as Connection, S as SendEmailInput, a as SentEmail, b as Config, c as Credentials, O as Operations } from './connection-
|
|
2
|
-
export { d as ConfigSchema, e as
|
|
1
|
+
import { G as GetEmailInput, E as Email, C as Connection, S as SendEmailInput, a as SentEmail, b as Config, c as Credentials, O as Operations } from './connection-DSFknakP.js';
|
|
2
|
+
export { d as ConfigSchema, e as CredentialMaterialError, f as CredentialSource, g as EmailSchema, h as GetEmailInputSchema, i as SendEmailInputSchema, j as SentEmailSchema, k as decodeCredentials, l as isCredentialMaterialError, n as newConnection, m as newConnectionWithOperations } from './connection-DSFknakP.js';
|
|
3
3
|
import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
|
|
4
4
|
import { QueryDefinition, MutationDefinition, QueryStepConfig, Query, QueryResult, MutationStepConfig, Mutation, MutationResult, QueryStep, MutationStep, Call, MutationAttempt, QueryAttempt, CredentialProvider } from '@superdurable/connectors-sdk';
|
|
5
5
|
import { StepTarget } from '@superdurable/dex';
|
|
@@ -22,7 +22,7 @@ declare const SendEmailBranch: {
|
|
|
22
22
|
declare const SendEmailBranchSent: "sent";
|
|
23
23
|
/** The provider definitively rejected the request. */
|
|
24
24
|
declare const SendEmailBranchProviderRejected: "providerRejected";
|
|
25
|
-
/**
|
|
25
|
+
/** Kept for compatibility and no longer selected: a malformed or oversized answer now retries, because the Idempotency-Key makes Resend replay the first send. */
|
|
26
26
|
declare const SendEmailBranchInvalidResponse: "invalidResponse";
|
|
27
27
|
/** Local input or connection credentials are invalid. */
|
|
28
28
|
declare const SendEmailBranchDefect: "defect";
|
|
@@ -73,7 +73,7 @@ interface SendEmailStepConfig<StepInput, OperationInput = SendEmailInput, Operat
|
|
|
73
73
|
sent: StepTarget<MutationResult<OperationOutput>>;
|
|
74
74
|
/** The provider definitively rejected the request. */
|
|
75
75
|
providerRejected?: StepTarget<MutationResult<OperationOutput>>;
|
|
76
|
-
/**
|
|
76
|
+
/** Kept for compatibility and no longer selected: a malformed or oversized answer now retries, because the Idempotency-Key makes Resend replay the first send. */
|
|
77
77
|
invalidResponse?: StepTarget<MutationResult<OperationOutput>>;
|
|
78
78
|
/** Local input or connection credentials are invalid. */
|
|
79
79
|
defect?: StepTarget<MutationResult<OperationOutput>>;
|
|
@@ -147,6 +147,14 @@ declare class ResendClient {
|
|
|
147
147
|
getEmail(): GetEmailOperation;
|
|
148
148
|
/** Resolve a safe API key; invalid and unavailable credentials are terminal. */
|
|
149
149
|
resolveAPIKey(call: Call): Promise<string | undefined>;
|
|
150
|
+
/**
|
|
151
|
+
* Resolve a safe API key, or report whether the failure may clear on a later attempt. Only reauthorization,
|
|
152
|
+
* a missing or unselected connection, a broker refusal, and unusable material are terminal.
|
|
153
|
+
*/
|
|
154
|
+
resolveAPIKeyResolution(call: Call): Promise<{
|
|
155
|
+
apiKey?: string;
|
|
156
|
+
isTransient: boolean;
|
|
157
|
+
}>;
|
|
150
158
|
/** Send one no-redirect request with Resend's authentication and content headers. */
|
|
151
159
|
exchange(call: Call, apiKey: string, method: 'GET' | 'POST', path: string, body?: Uint8Array): Promise<ResendResponse>;
|
|
152
160
|
}
|
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
ConfigSchema,
|
|
3
3
|
Connection,
|
|
4
4
|
ConnectorID,
|
|
5
|
+
CredentialMaterialError,
|
|
5
6
|
EmailSchema,
|
|
6
7
|
GetEmailBranch,
|
|
7
8
|
GetEmailBranchDefect,
|
|
@@ -23,10 +24,11 @@ import {
|
|
|
23
24
|
SendEmailMetadata,
|
|
24
25
|
SentEmailSchema,
|
|
25
26
|
decodeCredentials,
|
|
27
|
+
isCredentialMaterialError,
|
|
26
28
|
newConnection,
|
|
27
29
|
newConnectionWithOperations,
|
|
28
30
|
newProjectConnection
|
|
29
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-GNJAHMSJ.js";
|
|
30
32
|
|
|
31
33
|
// src/generated/steps.ts
|
|
32
34
|
import { goToBranch, newMutationStep, newQueryStep } from "@superdurable/connectors-sdk";
|
|
@@ -54,15 +56,17 @@ function newGetEmailStep(configuration) {
|
|
|
54
56
|
|
|
55
57
|
// src/project.ts
|
|
56
58
|
import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
|
|
57
|
-
import { z } from "zod";
|
|
59
|
+
import { z as z2 } from "zod";
|
|
58
60
|
|
|
59
61
|
// src/client.ts
|
|
60
62
|
import { BodyTooLargeError, isHeaderSafeCredential, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
|
|
61
|
-
import { SecretString } from "@superdurable/connectors-sdk";
|
|
63
|
+
import { ReauthorizationRequiredError, SecretString } from "@superdurable/connectors-sdk";
|
|
64
|
+
import { ConnectionNotSelectedError, CredentialBrokerRejectedError, ObjectNotFoundError } from "@superdurable/connectors-sdk/projectconfig";
|
|
65
|
+
import { z } from "zod";
|
|
62
66
|
|
|
63
67
|
// src/operations.ts
|
|
64
68
|
import { newMutationBranch, newMutationRetry, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
|
|
65
|
-
import { parseRetryAfter
|
|
69
|
+
import { parseRetryAfter } from "@superdurable/connectors-sdk/providerhttp";
|
|
66
70
|
var emptySent = { id: "" };
|
|
67
71
|
var emptyEmail = { id: "", from: "", to: [], subject: "", created_at: "" };
|
|
68
72
|
var SendEmailOperation = class {
|
|
@@ -85,7 +89,8 @@ var SendEmailOperation = class {
|
|
|
85
89
|
if (!input || !input.from || !input.to?.length || !input.subject || !input.html) return newMutationBranch("defect", emptySent, {}, failure(operation, "VALIDATION", "from, to, subject, and html are required"));
|
|
86
90
|
if (input.to.some((recipient) => !recipient)) return newMutationBranch("defect", emptySent, {}, failure(operation, "VALIDATION", "recipient cannot be blank"));
|
|
87
91
|
if (!call.idempotencyKey || Buffer.byteLength(call.idempotencyKey) > 256) return newMutationBranch("defect", emptySent, {}, failure(operation, "VALIDATION", "idempotency key is invalid"));
|
|
88
|
-
const apiKey = await this.client.
|
|
92
|
+
const { apiKey, isTransient } = await this.client.resolveAPIKeyResolution(call);
|
|
93
|
+
if (isTransient) return newMutationRetry(failure(operation, "AVAILABILITY", "connection credentials are temporarily unavailable; nothing was sent"));
|
|
89
94
|
if (!apiKey) return credentialDefect(operation, emptySent);
|
|
90
95
|
let response;
|
|
91
96
|
try {
|
|
@@ -95,21 +100,19 @@ var SendEmailOperation = class {
|
|
|
95
100
|
}
|
|
96
101
|
const retry = retryResponse(operation, response);
|
|
97
102
|
if (retry) return newMutationRetry(retry.failure, retry.delay);
|
|
98
|
-
if (response.status
|
|
99
|
-
if (readErrorTokens(response.body, ["/name"])[0] === "invalid_idempotent_request") return newMutationBranch("providerRejected", emptySent, {}, failure(operation, "PROVIDER_REJECTION", "idempotency key was used for a different request"));
|
|
100
|
-
return newMutationRetry(failure(operation, "AVAILABILITY", "provider is processing the same request"));
|
|
101
|
-
}
|
|
103
|
+
if (![200, 201, 202].includes(response.status) && !definiteRefusalStatuses.has(response.status)) return newMutationRetry(failure(operation, "AVAILABILITY", `provider answered HTTP ${response.status}, so the outcome is unknown`));
|
|
102
104
|
if (![200, 201, 202].includes(response.status)) return newMutationBranch("providerRejected", emptySent, {}, failure(operation, "PROVIDER_REJECTION", `provider rejected the request with HTTP ${response.status}`));
|
|
103
|
-
if (response.isTooLarge) return
|
|
105
|
+
if (response.isTooLarge) return newMutationRetry(failure(operation, "RESPONSE_TOO_LARGE", "provider response exceeded the configured limit"));
|
|
104
106
|
try {
|
|
105
107
|
const document = decodeObject(response.body);
|
|
106
108
|
if (typeof document.id !== "string" || !document.id) throw new TypeError("email ID missing");
|
|
107
109
|
return newMutationBranch("sent", { id: document.id }, {});
|
|
108
110
|
} catch {
|
|
109
|
-
return
|
|
111
|
+
return newMutationRetry(failure(operation, "PROTOCOL", "provider response is incomplete or malformed"));
|
|
110
112
|
}
|
|
111
113
|
}
|
|
112
114
|
};
|
|
115
|
+
var definiteRefusalStatuses = /* @__PURE__ */ new Set([400, 401, 403, 404, 411, 413, 414, 415, 422]);
|
|
113
116
|
var GetEmailOperation = class {
|
|
114
117
|
/** Bind a validated Resend client. */
|
|
115
118
|
constructor(client) {
|
|
@@ -124,7 +127,8 @@ var GetEmailOperation = class {
|
|
|
124
127
|
async invoke(call, input) {
|
|
125
128
|
const operation = "getEmail";
|
|
126
129
|
if (!input?.id) return newQueryBranch("defect", emptyEmail, {}, failure(operation, "VALIDATION", "email ID is required"));
|
|
127
|
-
const apiKey = await this.client.
|
|
130
|
+
const { apiKey, isTransient } = await this.client.resolveAPIKeyResolution(call);
|
|
131
|
+
if (isTransient) return newQueryRetry(failure(operation, "AVAILABILITY", "connection credentials are temporarily unavailable"));
|
|
128
132
|
if (!apiKey) return credentialDefect(operation, emptyEmail);
|
|
129
133
|
let response;
|
|
130
134
|
try {
|
|
@@ -167,9 +171,6 @@ function retryResponse(operation, response) {
|
|
|
167
171
|
function invalidQuery(operation, kind) {
|
|
168
172
|
return newQueryBranch("invalidResponse", emptyEmail, {}, failure(operation, kind, kind === "PROTOCOL" ? "provider response is incomplete or malformed" : "provider response exceeded the configured limit"));
|
|
169
173
|
}
|
|
170
|
-
function invalidMutation(operation, kind) {
|
|
171
|
-
return newMutationBranch("invalidResponse", emptySent, {}, failure(operation, kind, kind === "PROTOCOL" ? "provider response is incomplete or malformed" : "provider response exceeded the configured limit"));
|
|
172
|
-
}
|
|
173
174
|
function decodeObject(body) {
|
|
174
175
|
const value = JSON.parse(Buffer.from(body).toString("utf8"));
|
|
175
176
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new TypeError("invalid response object");
|
|
@@ -220,14 +221,22 @@ var ResendClient = class {
|
|
|
220
221
|
}
|
|
221
222
|
/** Resolve a safe API key; invalid and unavailable credentials are terminal. */
|
|
222
223
|
async resolveAPIKey(call) {
|
|
224
|
+
return (await this.resolveAPIKeyResolution(call)).apiKey;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Resolve a safe API key, or report whether the failure may clear on a later attempt. Only reauthorization,
|
|
228
|
+
* a missing or unselected connection, a broker refusal, and unusable material are terminal.
|
|
229
|
+
*/
|
|
230
|
+
async resolveAPIKeyResolution(call) {
|
|
231
|
+
let credentials;
|
|
223
232
|
try {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return key.trim() && isHeaderSafeCredential(key) ? key : void 0;
|
|
228
|
-
} catch {
|
|
229
|
-
return void 0;
|
|
233
|
+
credentials = await this.credentials.resolve(call, call.context.cancellationSignal);
|
|
234
|
+
} catch (error) {
|
|
235
|
+
return { isTransient: !isTerminalCredentialError(error) };
|
|
230
236
|
}
|
|
237
|
+
if (!(credentials?.apiKey instanceof SecretString)) return { isTransient: false };
|
|
238
|
+
const key = credentials.apiKey.reveal();
|
|
239
|
+
return key.trim() && isHeaderSafeCredential(key) ? { apiKey: key, isTransient: false } : { isTransient: false };
|
|
231
240
|
}
|
|
232
241
|
/** Send one no-redirect request with Resend's authentication and content headers. */
|
|
233
242
|
async exchange(call, apiKey, method, path, body) {
|
|
@@ -254,12 +263,15 @@ var ResendClient = class {
|
|
|
254
263
|
}
|
|
255
264
|
}
|
|
256
265
|
};
|
|
266
|
+
function isTerminalCredentialError(error) {
|
|
267
|
+
return error instanceof ReauthorizationRequiredError || error instanceof ObjectNotFoundError || error instanceof ConnectionNotSelectedError || error instanceof CredentialBrokerRejectedError || error instanceof z.ZodError || isCredentialMaterialError(error);
|
|
268
|
+
}
|
|
257
269
|
|
|
258
270
|
// src/project.ts
|
|
259
|
-
var projectSettingsSchema =
|
|
260
|
-
baseUrl:
|
|
261
|
-
timeout:
|
|
262
|
-
maxResponseBytes:
|
|
271
|
+
var projectSettingsSchema = z2.strictObject({
|
|
272
|
+
baseUrl: z2.string().optional(),
|
|
273
|
+
timeout: z2.union([z2.string(), z2.number().int()]).optional(),
|
|
274
|
+
maxResponseBytes: z2.number().int().optional()
|
|
263
275
|
});
|
|
264
276
|
function newProjectConnection2(project, connectionName, options = {}) {
|
|
265
277
|
return newProjectConnection(project, connectionName, (loadedProject, name) => {
|
|
@@ -279,7 +291,7 @@ function newProjectConnection2(project, connectionName, options = {}) {
|
|
|
279
291
|
async resolve(call, signal) {
|
|
280
292
|
void call;
|
|
281
293
|
const fields = await loadedProject.resolveCredential("resend", name, signal);
|
|
282
|
-
const decoded =
|
|
294
|
+
const decoded = z2.object({ api_key: z2.string().min(1) }).parse(fields);
|
|
283
295
|
return { apiKey: new SecretString2(decoded.api_key) };
|
|
284
296
|
}
|
|
285
297
|
};
|
|
@@ -303,6 +315,7 @@ export {
|
|
|
303
315
|
ConfigSchema,
|
|
304
316
|
Connection,
|
|
305
317
|
ConnectorID,
|
|
318
|
+
CredentialMaterialError,
|
|
306
319
|
EmailSchema,
|
|
307
320
|
GetEmailBranch,
|
|
308
321
|
GetEmailBranchDefect,
|
|
@@ -327,6 +340,7 @@ export {
|
|
|
327
340
|
SendEmailOperation,
|
|
328
341
|
SentEmailSchema,
|
|
329
342
|
decodeCredentials,
|
|
343
|
+
isCredentialMaterialError,
|
|
330
344
|
newConnection,
|
|
331
345
|
newConnectionWithOperations,
|
|
332
346
|
newGetEmailStep,
|
package/dist/mock.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MockMutation, MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
|
|
2
2
|
import { Failure } from '@superdurable/connectors-sdk';
|
|
3
|
-
import { O as Operations, C as Connection, S as SendEmailInput, a as SentEmail, G as GetEmailInput, E as Email } from './connection-
|
|
3
|
+
import { O as Operations, C as Connection, S as SendEmailInput, a as SentEmail, G as GetEmailInput, E as Email } from './connection-DSFknakP.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
|
|
6
6
|
/** Go zero value for SendEmailInput in scripted cases. */
|
package/dist/mock.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
SendEmailInputSchema,
|
|
8
8
|
SentEmailSchema,
|
|
9
9
|
newConnectionWithOperations
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-GNJAHMSJ.js";
|
|
11
11
|
|
|
12
12
|
// src/generated/mock.ts
|
|
13
13
|
import { branchCase, retryCase, newMutation, newQuery } from "@superdurable/connectors-sdk/connectormock";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@superdurable/connector-resend",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Resend email operations for Dex Flows",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -25,7 +25,8 @@
|
|
|
25
25
|
"./mock": {
|
|
26
26
|
"types": "./dist/mock.d.ts",
|
|
27
27
|
"import": "./dist/mock.js"
|
|
28
|
-
}
|
|
28
|
+
},
|
|
29
|
+
"./dex-connector.json": "./dex-connector.json"
|
|
29
30
|
},
|
|
30
31
|
"files": [
|
|
31
32
|
"dist",
|