The best way to control Claude Code, Codex and more from any computer or phone

main
ts 85 lines 3.35 KB
Raw
1 import type * as sesv2 from "@distilled.cloud/aws/sesv2";
2 import * as Binding from "alchemy/Binding";
3 import type * as Effect from "effect/Effect";
4 import type { EmailIdentityRef } from "./BindingHttp.ts";
5 import type { ConfigurationSet } from "./ConfigurationSet.ts";
6 import type { EmailIdentity } from "./EmailIdentity.ts";
7
8 /**
9 * Runtime binding for `sesv2:SendCustomVerificationEmail`.
10 *
11 * Sends the branded verification email defined by a
12 * {@link CustomVerificationEmailTemplate} to a new email address, kicking off
13 * the address-verification flow. Pass the template name and the address to
14 * verify; SES takes the FROM address from the template.
15 *
16 * Bind it to the identity the function is allowed to VERIFY — SES authorizes
17 * this action against the identity of the address in the request, not against
18 * the template's FROM identity. Bind a domain to allow any address at it, or
19 * a single address to allow exactly that one. Without a bound identity the
20 * binding would let any holder send verification mail to arbitrary addresses.
21 * The identity is not injected into the request. Optionally bind a
22 * {@link ConfigurationSet}, which is injected into each request.
23 *
24 * The identity may be a managed {@link EmailIdentity} or a plain reference —
25 * `{ emailIdentity: "signups.example.com" }`. The reference form creates no
26 * resource edge and takes no ownership, so it can scope the grant to an
27 * identity the stack does not manage without a destroy ever deleting it.
28 *
29 * Provide the implementation with
30 * `Effect.provide(AWS.SES.SendCustomVerificationEmailHttp)`.
31 *
32 * Note: actually sending a custom verification email requires the account to
33 * be out of the SES sandbox — in the sandbox the call fails with the typed
34 * `BadRequestException`.
35 * ### Verifying Addresses
36 * **Example:** Send a Custom Verification Email
37 * ```typescript
38 * // init — the function may verify addresses at this identity's domain
39 * const sendVerification = yield* SES.SendCustomVerificationEmail(identity);
40 *
41 * // runtime
42 * const { MessageId } = yield* sendVerification({
43 * EmailAddress: "new-user@example.com",
44 * TemplateName: yield* template.templateName,
45 * });
46 * ```
47 *
48 * **Example:** Scope to a Domain the Stack Does Not Manage
49 * ```typescript
50 * // Any address at signups.example.com may be verified. No resource edge and
51 * // no ownership — nothing is created, adopted, or destroyed.
52 * const sendVerification = yield* SES.SendCustomVerificationEmail({
53 * emailIdentity: "signups.example.com",
54 * });
55 * ```
56 *
57 * **Example:** Attribute the Send to a Configuration Set
58 * ```typescript
59 * // ConfigurationSetName is injected into every request
60 * const sendVerification = yield* SES.SendCustomVerificationEmail(
61 * identity,
62 * configSet,
63 * );
64 * ```
65 *
66 * @binding
67 */
68 export interface SendCustomVerificationEmail extends Binding.Service<
69 SendCustomVerificationEmail,
70 "AWS.SES.SendCustomVerificationEmail",
71 (
72 identity: EmailIdentity | EmailIdentityRef,
73 configurationSet?: ConfigurationSet,
74 ) => Effect.Effect<
75 (
76 request: Omit<sesv2.SendCustomVerificationEmailRequest, "ConfigurationSetName">,
77 ) => Effect.Effect<
78 sesv2.SendCustomVerificationEmailResponse,
79 sesv2.SendCustomVerificationEmailError
80 >
81 >
82 > {}
83 export const SendCustomVerificationEmail = Binding.Service<SendCustomVerificationEmail>(
84 "AWS.SES.SendCustomVerificationEmail",
85 );