MCPcopy
hub / github.com/triggerdotdev/trigger.dev / Resend

Class Resend

integrations/resend/src/index.ts:55–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53export type ResendRunTask = InstanceType<typeof Resend>["runTask"];
54
55export class Resend implements TriggerIntegration {
56 /**
57 * @internal
58 */
59 private _options: ResendIntegrationOptions;
60 /**
61 * @internal
62 */
63 private _client?: ResendClient;
64 /**
65 * @internal
66 */
67 private _io?: IO;
68
69 // @internal
70 private _connectionKey?: string;
71
72 constructor(options: ResendIntegrationOptions) {
73 this._options = options;
74 }
75
76 get authSource() {
77 return this._options.apiKey ? ("LOCAL" as const) : ("HOSTED" as const);
78 }
79
80 cloneForRun(io: IO, connectionKey: string, auth?: ConnectionAuth) {
81 const apiKey = this._options.apiKey ?? auth?.accessToken;
82
83 if (!apiKey) {
84 throw new Error(
85 `Can't create Resend integration (${this._options.id}) as apiKey was undefined`
86 );
87 }
88
89 const resend = new Resend(this._options);
90 resend._io = io;
91 resend._connectionKey = connectionKey;
92 resend._client = new ResendClient(apiKey);
93 return resend;
94 }
95
96 get id() {
97 return this._options.id;
98 }
99
100 get metadata() {
101 return { id: "resend", name: "Resend.com" };
102 }
103
104 runTask<T, TResult extends Json<T> | void>(
105 key: IntegrationTaskKey,
106 callback: (client: ResendClient, task: IOTask, io: IO) => Promise<TResult>,
107 options?: RunTaskOptions,
108 errorCallback?: RunTaskErrorCallback
109 ): Promise<TResult> {
110 if (!this._io) throw new Error("No IO");
111 if (!this._connectionKey) throw new Error("No connection key");
112

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…