@fabrika/email 0.9.0-dev.4 → 0.9.0-dev.5

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.
@@ -1,5 +1,29 @@
1
- /** The providers `FABRIKA_EMAIL_PROVIDER` can name in a stock installation. Memory and Directory are composition inputs. */
1
+ import type { EmailProviderVariable } from './config.js';
2
+ /**
3
+ * The providers `FABRIKA_EMAIL_PROVIDER` can name in a stock installation, sorted by name: the order every help text
4
+ * and refusal lists them in. Memory and Directory are composition inputs.
5
+ */
2
6
  export declare const builtinEmailProviders: {
7
+ ahasend: import("./config.js").EmailProvider;
8
+ cloudflare: import("./config.js").EmailProvider;
9
+ lettermint: import("./config.js").EmailProvider;
10
+ postmark: import("./config.js").EmailProvider;
3
11
  resend: import("./config.js").EmailProvider;
4
12
  smartemailing: import("./config.js").EmailProvider;
5
13
  };
14
+ /** Every built-in provider's own variables, in registry order: what the installers write and the workflow passes on. */
15
+ export declare const builtinEmailProviderVariables: readonly EmailProviderVariable[];
16
+ /**
17
+ * The first framework release whose registry holds each built-in provider. An application on an older release builds
18
+ * its sender from its own registry, so it cannot be handed one it lacks; Control refuses that deploy. `null`: every
19
+ * release that sends through the installation (`mailer: 'installation'`, from 0.5.0) holds it. A new provider names
20
+ * the release after the newest one published without it.
21
+ */
22
+ export declare const builtinEmailProviderSince: {
23
+ readonly ahasend: "0.8.2";
24
+ readonly cloudflare: "0.9.0";
25
+ readonly lettermint: "0.8.2";
26
+ readonly postmark: "0.8.2";
27
+ readonly resend: null;
28
+ readonly smartemailing: null;
29
+ };
@@ -1,15 +1,16 @@
1
- import { type EmailProvider, type EmailSenderIdentity } from './config.js';
2
- import { type EmailDeliveryResult, type EmailFetch, type EmailMessage, type EmailSender, type EmailSenderCapabilities } from './email.js';
3
- export interface ResendEmailSenderOptions {
1
+ import { type EmailProvider } from './config.js';
2
+ import { EmailDeliveryError, type EmailMessage, type EmailSenderCapabilities } from './email.js';
3
+ import { type HttpEmailRequest, HttpEmailSender, type HttpEmailSenderOptions } from './http-sender.js';
4
+ import type { ProviderResponse } from './http.js';
5
+ export interface ResendEmailSenderOptions extends HttpEmailSenderOptions {
4
6
  readonly apiKey: string;
5
- readonly from: EmailSenderIdentity;
6
- readonly fetch?: EmailFetch;
7
- readonly timeoutMs?: number;
8
7
  }
9
- export declare class ResendEmailSender implements EmailSender {
8
+ export declare class ResendEmailSender extends HttpEmailSender {
10
9
  #private;
11
10
  readonly capabilities: EmailSenderCapabilities;
12
11
  constructor(options: ResendEmailSenderOptions);
13
- send(message: EmailMessage, signal: AbortSignal): Promise<EmailDeliveryResult>;
12
+ protected request(message: EmailMessage): HttpEmailRequest;
13
+ protected messageId(response: ProviderResponse): string | undefined;
14
+ protected refusal(response: ProviderResponse): EmailDeliveryError | undefined;
14
15
  }
15
16
  export declare const resendEmailProvider: EmailProvider;
@@ -1,20 +1,24 @@
1
- import { type EmailProvider, type EmailSenderIdentity } from './config.js';
2
- import { type EmailDeliveryResult, type EmailFetch, type EmailMessage, type EmailSender, type EmailSenderCapabilities } from './email.js';
3
- export interface SmartEmailingEmailSenderOptions {
1
+ import { type EmailProvider } from './config.js';
2
+ import { type EmailMessage, type EmailSenderCapabilities } from './email.js';
3
+ import { type HttpEmailRequest, HttpEmailSender, type HttpEmailSenderOptions } from './http-sender.js';
4
+ import type { ProviderResponse } from './http.js';
5
+ export interface SmartEmailingEmailSenderOptions extends HttpEmailSenderOptions {
4
6
  /** The account's user name or e-mail: the first half of the Basic credential. */
5
7
  readonly username: string;
6
8
  readonly apiKey: string;
7
- readonly from: EmailSenderIdentity;
8
9
  /** Groups the messages in SmartEmailing's statistics. */
9
10
  readonly tag?: string;
10
- readonly fetch?: EmailFetch;
11
- readonly timeoutMs?: number;
12
11
  }
13
- export declare class SmartEmailingEmailSender implements EmailSender {
12
+ /** Its error body's `message` is free text that may quote the request, so a refusal is classified by status alone. */
13
+ export declare class SmartEmailingEmailSender extends HttpEmailSender {
14
14
  #private;
15
- /** The API takes up to five tasks a request, but `send` carries one. */
15
+ /**
16
+ * The API takes up to five tasks a request, but `send` carries one. Its API documents no message headers, so a
17
+ * one-click unsubscribe is refused rather than sent without one.
18
+ */
16
19
  readonly capabilities: EmailSenderCapabilities;
17
20
  constructor(options: SmartEmailingEmailSenderOptions);
18
- send(message: EmailMessage, signal: AbortSignal): Promise<EmailDeliveryResult>;
21
+ protected request(message: EmailMessage): HttpEmailRequest;
22
+ protected messageId(response: ProviderResponse): string | undefined;
19
23
  }
20
24
  export declare const smartEmailingEmailProvider: EmailProvider;
@@ -15,10 +15,15 @@ export declare function isValidEmailDisplayName(value: string): boolean;
15
15
  export declare function isValidEmailSenderIdentity(identity: EmailSenderIdentity): boolean;
16
16
  export declare function validateEmailMessage(message: EmailMessage): void;
17
17
  /**
18
- * Refuses a message whose attachments `capabilities` does not carry: any attachment where the transport sends none, or
19
- * more bytes together than its `maxAttachmentBytes`. `label` names the transport in the message.
18
+ * Refuses a message whose attachments `capabilities` does not carry: any attachment where the transport sends none,
19
+ * more bytes together than its `maxAttachmentBytes`, or a file whose extension it refuses. `label` names the transport
20
+ * in the message.
20
21
  */
21
22
  export declare function validateEmailAttachments(message: EmailMessage, capabilities: EmailSenderCapabilities, label: string): void;
23
+ /** Refuses a `broadcast` message where the transport sends none. */
24
+ export declare function validateEmailBroadcast(message: EmailMessage, capabilities: EmailSenderCapabilities, label: string): void;
25
+ /** Refuses a text or HTML body shorter than the transport's `minBodyLength`, counted in characters once trimmed. */
26
+ export declare function validateEmailBodies(message: EmailMessage, capabilities: EmailSenderCapabilities, label: string): void;
22
27
  /** The most files one message carries. */
23
28
  export declare const MAX_EMAIL_ATTACHMENTS = 20;
24
29
  /** 1..255 characters, no control characters, no path separator and no `"`, so every transport can quote it. */