groundmail 0.24.0 → 0.25.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/README.md CHANGED
@@ -25,6 +25,20 @@ const email = await tx.emails.send({
25
25
  console.log(email.id, email.status)
26
26
  ```
27
27
 
28
+ ## Azure managed identity (no API key)
29
+
30
+ On Azure, authenticate with the workload's managed identity instead of a key. Pass a token provider; the client caches the token until shortly before it expires and asks for a new one after a 401:
31
+
32
+ ```ts
33
+ import { DefaultAzureCredential } from '@azure/identity'
34
+ import { Groundmail } from 'groundmail'
35
+
36
+ const credential = new DefaultAzureCredential()
37
+ const client = new Groundmail({ getToken: () => credential.getToken('api://<your-app-id>/.default') })
38
+ ```
39
+
40
+ `getToken` may return a string or `{ token, expiresOnTimestamp }`. Register the identity in the dashboard first: https://docs.groundmail.dev/authentication/azure-managed-identity
41
+
28
42
  ## Testing
29
43
 
30
44
  Use a test key (`gm_test_…`, create one with `tx.apiKeys.create({ test: true })` or in the
package/dist/authjs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as Groundmail } from './client-DkpJ9AT0.js';
1
+ import { G as Groundmail } from './client-NSj8n5sB.js';
2
2
 
3
3
  /** Subset of Auth.js theme used for the default magic-link email. */
4
4
  type AuthjsTheme = {
package/dist/authjs.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_API_BASE_URL,
3
3
  Groundmail
4
- } from "./chunk-TTRMVR6T.js";
4
+ } from "./chunk-NQWM7F3N.js";
5
5
 
6
6
  // src/authjs.ts
7
7
  function escapeHtml(value) {
@@ -1,4 +1,4 @@
1
- import { S as SendEmailResult, G as Groundmail } from './client-DkpJ9AT0.js';
1
+ import { S as SendEmailResult, G as Groundmail } from './client-NSj8n5sB.js';
2
2
 
3
3
  type BetterAuthEmailUser = {
4
4
  email: string;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_API_BASE_URL,
3
3
  Groundmail
4
- } from "./chunk-TTRMVR6T.js";
4
+ } from "./chunk-NQWM7F3N.js";
5
5
 
6
6
  // src/better-auth.ts
7
7
  function linkHtml(label, url) {
@@ -1559,12 +1559,24 @@ var WebhooksResource = class {
1559
1559
 
1560
1560
  // src/client.ts
1561
1561
  var DEFAULT_API_BASE_URL = "https://api.groundmail.dev";
1562
- var Groundmail = class {
1563
- constructor(apiKey, options = {}) {
1564
- this.apiKey = apiKey;
1565
- this.options = options;
1566
- if (!apiKey?.startsWith("gm_")) {
1567
- throw new Error("Groundmail API key must start with gm_");
1562
+ var _Groundmail = class _Groundmail {
1563
+ constructor(apiKeyOrOptions, options = {}) {
1564
+ this.cachedToken = null;
1565
+ if (apiKeyOrOptions && typeof apiKeyOrOptions === "object") {
1566
+ if (typeof apiKeyOrOptions.getToken !== "function") {
1567
+ throw new Error("Groundmail: pass an API key (gm_\u2026) or { getToken } to authenticate");
1568
+ }
1569
+ const { getToken, ...rest } = apiKeyOrOptions;
1570
+ this.apiKey = null;
1571
+ this.getToken = getToken;
1572
+ this.options = rest;
1573
+ } else {
1574
+ if (!apiKeyOrOptions?.startsWith("gm_")) {
1575
+ throw new Error("Groundmail API key must start with gm_");
1576
+ }
1577
+ this.apiKey = apiKeyOrOptions;
1578
+ this.getToken = null;
1579
+ this.options = options;
1568
1580
  }
1569
1581
  this.domains = new DomainsResource(this);
1570
1582
  this.emails = new EmailsResource(this);
@@ -1598,12 +1610,35 @@ var Groundmail = class {
1598
1610
  get fetchImpl() {
1599
1611
  return this.options.fetch || fetch;
1600
1612
  }
1613
+ async bearer(forceRefresh = false) {
1614
+ if (this.apiKey) return this.apiKey;
1615
+ if (!forceRefresh && this.cachedToken && Date.now() < this.cachedToken.refreshAt) {
1616
+ return this.cachedToken.token;
1617
+ }
1618
+ const value = await this.getToken();
1619
+ const { token, expiresAt } = normalizeAccessToken(value);
1620
+ if (!token) throw new Error("Groundmail: getToken() returned no token");
1621
+ const fallback = Date.now() + _Groundmail.TOKEN_DEFAULT_TTL_MS;
1622
+ const refreshAt = expiresAt ? expiresAt - _Groundmail.TOKEN_REFRESH_SKEW_MS : fallback;
1623
+ this.cachedToken = { token, refreshAt };
1624
+ return token;
1625
+ }
1626
+ /** Send with the current credential; with a token provider, retry once with a fresh token after a 401. */
1627
+ async authorizedFetch(url, init, extraHeaders) {
1628
+ const send = async (forceRefresh) => this.fetchImpl(url, {
1629
+ ...init,
1630
+ headers: { Authorization: `Bearer ${await this.bearer(forceRefresh)}`, ...extraHeaders, ...init.headers || {} }
1631
+ });
1632
+ const response = await send(false);
1633
+ if (response.status === 401 && this.getToken) {
1634
+ this.cachedToken = null;
1635
+ return send(true);
1636
+ }
1637
+ return response;
1638
+ }
1601
1639
  /** GET a text body (CSV downloads). Errors are JSON, like every other route. */
1602
1640
  async requestText(path) {
1603
- const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
1604
- method: "GET",
1605
- headers: { Authorization: `Bearer ${this.apiKey}` }
1606
- });
1641
+ const response = await this.authorizedFetch(`${this.baseUrl}${path}`, { method: "GET" }, {});
1607
1642
  if (!response.ok) {
1608
1643
  const body = await response.json().catch(() => ({}));
1609
1644
  throw GroundmailError.fromResponse(response.status, body);
@@ -1611,14 +1646,7 @@ var Groundmail = class {
1611
1646
  return response.text();
1612
1647
  }
1613
1648
  async request(path, init) {
1614
- const response = await this.fetchImpl(`${this.baseUrl}${path}`, {
1615
- ...init,
1616
- headers: {
1617
- Authorization: `Bearer ${this.apiKey}`,
1618
- "Content-Type": "application/json",
1619
- ...init.headers || {}
1620
- }
1621
- });
1649
+ const response = await this.authorizedFetch(`${this.baseUrl}${path}`, init, { "Content-Type": "application/json" });
1622
1650
  const body = await response.json().catch(() => ({}));
1623
1651
  if (!response.ok) {
1624
1652
  throw GroundmailError.fromResponse(response.status, body);
@@ -1626,6 +1654,33 @@ var Groundmail = class {
1626
1654
  return body;
1627
1655
  }
1628
1656
  };
1657
+ /** Two minutes of slack so a token never expires in flight. */
1658
+ _Groundmail.TOKEN_REFRESH_SKEW_MS = 2 * 60 * 1e3;
1659
+ /** Tokens with no known expiry are reused this long at most. */
1660
+ _Groundmail.TOKEN_DEFAULT_TTL_MS = 5 * 60 * 1e3;
1661
+ var Groundmail = _Groundmail;
1662
+ function normalizeAccessToken(value) {
1663
+ if (!value) return { token: "", expiresAt: null };
1664
+ if (typeof value === "string") return { token: value, expiresAt: jwtExpiry(value) };
1665
+ const token = typeof value.token === "string" ? value.token : "";
1666
+ let expiresAt = null;
1667
+ if (typeof value.expiresOnTimestamp === "number") expiresAt = value.expiresOnTimestamp;
1668
+ else if (value.expiresOn instanceof Date) expiresAt = value.expiresOn.getTime();
1669
+ else if (typeof value.expiresOn === "number") expiresAt = value.expiresOn < 1e12 ? value.expiresOn * 1e3 : value.expiresOn;
1670
+ return { token, expiresAt: expiresAt ?? jwtExpiry(token) };
1671
+ }
1672
+ function jwtExpiry(token) {
1673
+ const part = token.split(".")[1];
1674
+ if (!part) return null;
1675
+ try {
1676
+ const base64 = part.replace(/-/g, "+").replace(/_/g, "/");
1677
+ const json = typeof atob === "function" ? atob(base64.padEnd(base64.length + (4 - base64.length % 4) % 4, "=")) : "";
1678
+ const exp = JSON.parse(json).exp;
1679
+ return typeof exp === "number" ? exp * 1e3 : null;
1680
+ } catch {
1681
+ return null;
1682
+ }
1683
+ }
1629
1684
 
1630
1685
  export {
1631
1686
  GroundmailError,
@@ -1636,5 +1691,6 @@ export {
1636
1691
  buildSignatureHeader,
1637
1692
  verifyWebhookSignature,
1638
1693
  DEFAULT_API_BASE_URL,
1639
- Groundmail
1694
+ Groundmail,
1695
+ normalizeAccessToken
1640
1696
  };
package/dist/clerk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as Groundmail, S as SendEmailResult } from './client-DkpJ9AT0.js';
1
+ import { G as Groundmail, S as SendEmailResult } from './client-NSj8n5sB.js';
2
2
 
3
3
  /**
4
4
  * Subset of Clerk `email.created` webhook `data` used for delivery.
package/dist/clerk.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_API_BASE_URL,
3
3
  Groundmail
4
- } from "./chunk-TTRMVR6T.js";
4
+ } from "./chunk-NQWM7F3N.js";
5
5
 
6
6
  // src/clerk.ts
7
7
  function resolveApiKey(options) {
@@ -840,10 +840,31 @@ type UpdateTemplateParams = {
840
840
  /** Move it to this folder (created when missing); `null` or `''` takes it out of any folder. */
841
841
  folder?: string | null;
842
842
  };
843
+ /**
844
+ * What a token provider may return: the token itself, or an object with the
845
+ * token and when it expires (the `AccessToken` shape `@azure/identity`'s
846
+ * `credential.getToken()` returns, so it can be passed straight through).
847
+ */
848
+ type GroundmailAccessToken = string | {
849
+ token: string;
850
+ expiresOnTimestamp?: number;
851
+ expiresOn?: Date | number;
852
+ };
853
+ /**
854
+ * Returns a Bearer token for each request, instead of a fixed API key. Use it
855
+ * for keyless auth from Azure (a managed identity's Microsoft Entra token):
856
+ * `getToken: () => credential.getToken('api://…/.default')`. The SDK caches the
857
+ * token until two minutes before it expires and asks again after a 401.
858
+ */
859
+ type GroundmailTokenProvider = () => GroundmailAccessToken | null | undefined | Promise<GroundmailAccessToken | null | undefined>;
843
860
  type GroundmailOptions = {
844
861
  baseUrl?: string;
845
862
  fetch?: typeof fetch;
846
863
  };
864
+ /** `new Groundmail({ getToken })`: authenticate with a token provider instead of an API key. */
865
+ type GroundmailTokenOptions = GroundmailOptions & {
866
+ getToken: GroundmailTokenProvider;
867
+ };
847
868
  type DomainStatus = 'pending' | 'verified' | 'failed';
848
869
  type DomainTlsMode = 'opportunistic' | 'enforced';
849
870
  type DomainDmarcAnalysis = {
@@ -1718,8 +1739,6 @@ declare class WebhooksResource {
1718
1739
 
1719
1740
  declare const DEFAULT_API_BASE_URL = "https://api.groundmail.dev";
1720
1741
  declare class Groundmail {
1721
- private readonly apiKey;
1722
- private readonly options;
1723
1742
  readonly domains: DomainsResource;
1724
1743
  readonly emails: EmailsResource;
1725
1744
  readonly receivedEmails: ReceivedEmailsResource;
@@ -1737,7 +1756,16 @@ declare class Groundmail {
1737
1756
  readonly migrations: MigrationsResource;
1738
1757
  /** DMARC monitoring per domain: report address, sources, pass rates and readiness. */
1739
1758
  readonly dmarc: DmarcResource;
1759
+ private readonly apiKey;
1760
+ private readonly options;
1761
+ private readonly getToken;
1762
+ private cachedToken;
1763
+ /**
1764
+ * `new Groundmail('gm_…')` with an API key, or `new Groundmail({ getToken })`
1765
+ * with a token provider (for example an Azure managed identity; no key).
1766
+ */
1740
1767
  constructor(apiKey: string, options?: GroundmailOptions);
1768
+ constructor(options: GroundmailTokenOptions);
1741
1769
  /**
1742
1770
  * Check one address with Groundmail validation before you accept it (for
1743
1771
  * example on a signup form): syntax, mail server, disposable and role
@@ -1746,9 +1774,21 @@ declare class Groundmail {
1746
1774
  validate(email: string): Promise<ValidateEmailResult>;
1747
1775
  get baseUrl(): string;
1748
1776
  get fetchImpl(): typeof fetch;
1777
+ /** Two minutes of slack so a token never expires in flight. */
1778
+ private static readonly TOKEN_REFRESH_SKEW_MS;
1779
+ /** Tokens with no known expiry are reused this long at most. */
1780
+ private static readonly TOKEN_DEFAULT_TTL_MS;
1781
+ private bearer;
1782
+ /** Send with the current credential; with a token provider, retry once with a fresh token after a 401. */
1783
+ private authorizedFetch;
1749
1784
  /** GET a text body (CSV downloads). Errors are JSON, like every other route. */
1750
1785
  requestText(path: string): Promise<string>;
1751
1786
  request<T>(path: string, init: RequestInit): Promise<T>;
1752
1787
  }
1788
+ /** A token provider's result → the token and its expiry (ms since epoch), if known. */
1789
+ declare function normalizeAccessToken(value: GroundmailAccessToken | null | undefined): {
1790
+ token: string;
1791
+ expiresAt: number | null;
1792
+ };
1753
1793
 
1754
- export { type DmarcStatus as $, type ApiErrorBody as A, type BatchSendEmailResult as B, type CategoryOptOut as C, type DnsRecord as D, type CreateDomainResult as E, type CreateMigrationParams as F, Groundmail as G, type CreateSuppressionParams as H, type CreateTemplateParams as I, type CreateTenantParams as J, type CreateWebhookParams as K, DEFAULT_API_BASE_URL as L, type DailyRampLimitErrorDetails as M, type DeleteTenantResult as N, type DeliverabilityBucket as O, type DeliverabilityDomainInsight as P, type DeliverabilityInsightsResult as Q, type DeliverabilityMailServerRelay as R, type SendEmailResult as S, type DeliverabilityWindow as T, type DmarcDailyPoint as U, type DmarcMonitoring as V, type DmarcMonitoringDisabled as W, type DmarcReadiness as X, type DmarcReadinessVerdict as Y, type DmarcSource as Z, type DmarcSourceStatus as _, type ApiErrorCode as a, type Suppression as a$, type DnsProviderName as a0, type Domain as a1, type DomainBimiAnalysis as a2, type DomainDetailResult as a3, type DomainDmarcAnalysis as a4, type DomainDnsAnalysis as a5, type DomainStatus as a6, type DomainTlsMode as a7, type DomainTrackingDns as a8, type DomainTrackingStatus as a9, type ListTemplatesParams as aA, type ListTemplatesResult as aB, type ListTenantDomainsResult as aC, type ListTenantsParams as aD, type ListTenantsResult as aE, type MailServerSigningStatus as aF, type MailStream as aG, type Migration as aH, type MigrationDnsChange as aI, type MigrationDnsPlan as aJ, type MigrationDomainItem as aK, type MigrationItemStatus as aL, type MigrationProvider as aM, type MigrationResource as aN, type MigrationSummary as aO, type MigrationTemplateItem as aP, type MigrationTotals as aQ, type MigrationWebhookItem as aR, type ReceivedEmail as aS, type ReceivedEmailAttachment as aT, type ReceivedEmailAttachmentMeta as aU, type RemoteApplyDnsCredentials as aV, type RemoveCategoryOptOutOptions as aW, type RunMigrationOptions as aX, type SendEmailParams as aY, type StreamDeliverability as aZ, type SuppressedErrorDetails as a_, type EmailListItem as aa, type EmailWebhookEventPayload as ab, type EmailWebhookEventType as ac, type EnableDmarcParams as ad, type EnableDmarcResult as ae, type EnrollmentSkip as af, type EventRecord as ag, type GroundmailOptions as ah, type HeldBackErrorDetails as ai, type HeldBackReason as aj, type HeldBackRecipient as ak, type ListApiKeysParams as al, type ListApiKeysResult as am, type ListAutomationRunsParams as an, type ListAutomationRunsResult as ao, type ListAutomationsResult as ap, type ListCategoryOptOutsParams as aq, type ListCategoryOptOutsResult as ar, type ListDomainsParams as as, type ListDomainsResult as at, type ListEmailsParams as au, type ListEmailsResult as av, type ListReceivedEmailsParams as aw, type ListReceivedEmailsResult as ax, type ListSuppressionsParams as ay, type ListSuppressionsResult as az, type ApiKey as b, type Template as b0, type TemplateFormat as b1, type TemplateLintWarning as b2, type TemplateStarter as b3, type TemplateStatus as b4, type TemplateVersion as b5, type Tenant as b6, type TenantPauseSource as b7, type TenantRamp as b8, type TenantStats as b9, type TenantStatsResult as ba, type TenantStatus as bb, type TenantStreamPolicy as bc, type TestEmailWebhookParams as bd, type TestEmailWebhookResult as be, type TriggerEventParams as bf, type TriggerEventResult as bg, type TwilioIntegrationResponse as bh, type TwilioIntegrationStatus as bi, type UpdateAutomationParams as bj, type UpdateDomainParams as bk, type UpdateEmailParams as bl, type UpdateTemplateParams as bm, type UpdateTenantParams as bn, type UpdateWebhookParams as bo, type ValidateEmailResult as bp, type ValidationReason as bq, type ValidationVerdict as br, type VerifyDomainResult as bs, type WebhookEmailTag as bt, type WebhookEndpoint as bu, type WebhookEndpointWithSecret as bv, type WebhookEventType as bw, mergeMigrations as bx, type ApiKeyScope as c, type ApplyDnsParams as d, type ApplyDnsRecordResult as e, type ApplyDnsResult as f, type Asset as g, type Automation as h, type AutomationResult as i, type AutomationRun as j, type AutomationRunResponse as k, type AutomationRunStatus as l, type AutomationRunStep as m, type AutomationRunStepStatus as n, type AutomationStatus as o, type AutomationStep as p, type AutomationTrigger as q, type BounceType as r, type CategoryOptOutCategory as s, type CategoryUnsubscribedErrorDetails as t, type ConnectTwilioParams as u, type ContactWebhookEventPayload as v, type CreateApiKeyParams as w, type CreateApiKeyResult as x, type CreateAutomationParams as y, type CreateDomainParams as z };
1794
+ export { type DmarcStatus as $, type ApiErrorBody as A, type BatchSendEmailResult as B, type CategoryOptOut as C, type DnsRecord as D, type CreateDomainResult as E, type CreateMigrationParams as F, Groundmail as G, type CreateSuppressionParams as H, type CreateTemplateParams as I, type CreateTenantParams as J, type CreateWebhookParams as K, DEFAULT_API_BASE_URL as L, type DailyRampLimitErrorDetails as M, type DeleteTenantResult as N, type DeliverabilityBucket as O, type DeliverabilityDomainInsight as P, type DeliverabilityInsightsResult as Q, type DeliverabilityMailServerRelay as R, type SendEmailResult as S, type DeliverabilityWindow as T, type DmarcDailyPoint as U, type DmarcMonitoring as V, type DmarcMonitoringDisabled as W, type DmarcReadiness as X, type DmarcReadinessVerdict as Y, type DmarcSource as Z, type DmarcSourceStatus as _, type ApiErrorCode as a, type SendEmailParams as a$, type DnsProviderName as a0, type Domain as a1, type DomainBimiAnalysis as a2, type DomainDetailResult as a3, type DomainDmarcAnalysis as a4, type DomainDnsAnalysis as a5, type DomainStatus as a6, type DomainTlsMode as a7, type DomainTrackingDns as a8, type DomainTrackingStatus as a9, type ListReceivedEmailsResult as aA, type ListSuppressionsParams as aB, type ListSuppressionsResult as aC, type ListTemplatesParams as aD, type ListTemplatesResult as aE, type ListTenantDomainsResult as aF, type ListTenantsParams as aG, type ListTenantsResult as aH, type MailServerSigningStatus as aI, type MailStream as aJ, type Migration as aK, type MigrationDnsChange as aL, type MigrationDnsPlan as aM, type MigrationDomainItem as aN, type MigrationItemStatus as aO, type MigrationProvider as aP, type MigrationResource as aQ, type MigrationSummary as aR, type MigrationTemplateItem as aS, type MigrationTotals as aT, type MigrationWebhookItem as aU, type ReceivedEmail as aV, type ReceivedEmailAttachment as aW, type ReceivedEmailAttachmentMeta as aX, type RemoteApplyDnsCredentials as aY, type RemoveCategoryOptOutOptions as aZ, type RunMigrationOptions as a_, type EmailListItem as aa, type EmailWebhookEventPayload as ab, type EmailWebhookEventType as ac, type EnableDmarcParams as ad, type EnableDmarcResult as ae, type EnrollmentSkip as af, type EventRecord as ag, type GroundmailAccessToken as ah, type GroundmailOptions as ai, type GroundmailTokenOptions as aj, type GroundmailTokenProvider as ak, type HeldBackErrorDetails as al, type HeldBackReason as am, type HeldBackRecipient as an, type ListApiKeysParams as ao, type ListApiKeysResult as ap, type ListAutomationRunsParams as aq, type ListAutomationRunsResult as ar, type ListAutomationsResult as as, type ListCategoryOptOutsParams as at, type ListCategoryOptOutsResult as au, type ListDomainsParams as av, type ListDomainsResult as aw, type ListEmailsParams as ax, type ListEmailsResult as ay, type ListReceivedEmailsParams as az, type ApiKey as b, type StreamDeliverability as b0, type SuppressedErrorDetails as b1, type Suppression as b2, type Template as b3, type TemplateFormat as b4, type TemplateLintWarning as b5, type TemplateStarter as b6, type TemplateStatus as b7, type TemplateVersion as b8, type Tenant as b9, mergeMigrations as bA, normalizeAccessToken as bB, type TenantPauseSource as ba, type TenantRamp as bb, type TenantStats as bc, type TenantStatsResult as bd, type TenantStatus as be, type TenantStreamPolicy as bf, type TestEmailWebhookParams as bg, type TestEmailWebhookResult as bh, type TriggerEventParams as bi, type TriggerEventResult as bj, type TwilioIntegrationResponse as bk, type TwilioIntegrationStatus as bl, type UpdateAutomationParams as bm, type UpdateDomainParams as bn, type UpdateEmailParams as bo, type UpdateTemplateParams as bp, type UpdateTenantParams as bq, type UpdateWebhookParams as br, type ValidateEmailResult as bs, type ValidationReason as bt, type ValidationVerdict as bu, type VerifyDomainResult as bv, type WebhookEmailTag as bw, type WebhookEndpoint as bx, type WebhookEndpointWithSecret as by, type WebhookEventType as bz, type ApiKeyScope as c, type ApplyDnsParams as d, type ApplyDnsRecordResult as e, type ApplyDnsResult as f, type Asset as g, type Automation as h, type AutomationResult as i, type AutomationRun as j, type AutomationRunResponse as k, type AutomationRunStatus as l, type AutomationRunStep as m, type AutomationRunStepStatus as n, type AutomationStatus as o, type AutomationStep as p, type AutomationTrigger as q, type BounceType as r, type CategoryOptOutCategory as s, type CategoryUnsubscribedErrorDetails as t, type ConnectTwilioParams as u, type ContactWebhookEventPayload as v, type CreateApiKeyParams as w, type CreateApiKeyResult as x, type CreateAutomationParams as y, type CreateDomainParams as z };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as ApiErrorBody, D as DnsRecord } from './client-DkpJ9AT0.js';
2
- export { a as ApiErrorCode, b as ApiKey, c as ApiKeyScope, d as ApplyDnsParams, e as ApplyDnsRecordResult, f as ApplyDnsResult, g as Asset, h as Automation, i as AutomationResult, j as AutomationRun, k as AutomationRunResponse, l as AutomationRunStatus, m as AutomationRunStep, n as AutomationRunStepStatus, o as AutomationStatus, p as AutomationStep, q as AutomationTrigger, B as BatchSendEmailResult, r as BounceType, C as CategoryOptOut, s as CategoryOptOutCategory, t as CategoryUnsubscribedErrorDetails, u as ConnectTwilioParams, v as ContactWebhookEventPayload, w as CreateApiKeyParams, x as CreateApiKeyResult, y as CreateAutomationParams, z as CreateDomainParams, E as CreateDomainResult, F as CreateMigrationParams, H as CreateSuppressionParams, I as CreateTemplateParams, J as CreateTenantParams, K as CreateWebhookParams, L as DEFAULT_API_BASE_URL, M as DailyRampLimitErrorDetails, N as DeleteTenantResult, O as DeliverabilityBucket, P as DeliverabilityDomainInsight, Q as DeliverabilityInsightsResult, R as DeliverabilityMailServerRelay, T as DeliverabilityWindow, U as DmarcDailyPoint, V as DmarcMonitoring, W as DmarcMonitoringDisabled, X as DmarcReadiness, Y as DmarcReadinessVerdict, Z as DmarcSource, _ as DmarcSourceStatus, $ as DmarcStatus, a0 as DnsProviderName, a1 as Domain, a2 as DomainBimiAnalysis, a3 as DomainDetailResult, a4 as DomainDmarcAnalysis, a5 as DomainDnsAnalysis, a6 as DomainStatus, a7 as DomainTlsMode, a8 as DomainTrackingDns, a9 as DomainTrackingStatus, aa as EmailListItem, ab as EmailWebhookEventPayload, ac as EmailWebhookEventType, ad as EnableDmarcParams, ae as EnableDmarcResult, af as EnrollmentSkip, ag as EventRecord, G as Groundmail, ah as GroundmailOptions, ai as HeldBackErrorDetails, aj as HeldBackReason, ak as HeldBackRecipient, al as ListApiKeysParams, am as ListApiKeysResult, an as ListAutomationRunsParams, ao as ListAutomationRunsResult, ap as ListAutomationsResult, aq as ListCategoryOptOutsParams, ar as ListCategoryOptOutsResult, as as ListDomainsParams, at as ListDomainsResult, au as ListEmailsParams, av as ListEmailsResult, aw as ListReceivedEmailsParams, ax as ListReceivedEmailsResult, ay as ListSuppressionsParams, az as ListSuppressionsResult, aA as ListTemplatesParams, aB as ListTemplatesResult, aC as ListTenantDomainsResult, aD as ListTenantsParams, aE as ListTenantsResult, aF as MailServerSigningStatus, aG as MailStream, aH as Migration, aI as MigrationDnsChange, aJ as MigrationDnsPlan, aK as MigrationDomainItem, aL as MigrationItemStatus, aM as MigrationProvider, aN as MigrationResource, aO as MigrationSummary, aP as MigrationTemplateItem, aQ as MigrationTotals, aR as MigrationWebhookItem, aS as ReceivedEmail, aT as ReceivedEmailAttachment, aU as ReceivedEmailAttachmentMeta, aV as RemoteApplyDnsCredentials, aW as RemoveCategoryOptOutOptions, aX as RunMigrationOptions, aY as SendEmailParams, S as SendEmailResult, aZ as StreamDeliverability, a_ as SuppressedErrorDetails, a$ as Suppression, b0 as Template, b1 as TemplateFormat, b2 as TemplateLintWarning, b3 as TemplateStarter, b4 as TemplateStatus, b5 as TemplateVersion, b6 as Tenant, b7 as TenantPauseSource, b8 as TenantRamp, b9 as TenantStats, ba as TenantStatsResult, bb as TenantStatus, bc as TenantStreamPolicy, bd as TestEmailWebhookParams, be as TestEmailWebhookResult, bf as TriggerEventParams, bg as TriggerEventResult, bh as TwilioIntegrationResponse, bi as TwilioIntegrationStatus, bj as UpdateAutomationParams, bk as UpdateDomainParams, bl as UpdateEmailParams, bm as UpdateTemplateParams, bn as UpdateTenantParams, bo as UpdateWebhookParams, bp as ValidateEmailResult, bq as ValidationReason, br as ValidationVerdict, bs as VerifyDomainResult, bt as WebhookEmailTag, bu as WebhookEndpoint, bv as WebhookEndpointWithSecret, bw as WebhookEventType, bx as mergeMigrations } from './client-DkpJ9AT0.js';
1
+ import { A as ApiErrorBody, D as DnsRecord } from './client-NSj8n5sB.js';
2
+ export { a as ApiErrorCode, b as ApiKey, c as ApiKeyScope, d as ApplyDnsParams, e as ApplyDnsRecordResult, f as ApplyDnsResult, g as Asset, h as Automation, i as AutomationResult, j as AutomationRun, k as AutomationRunResponse, l as AutomationRunStatus, m as AutomationRunStep, n as AutomationRunStepStatus, o as AutomationStatus, p as AutomationStep, q as AutomationTrigger, B as BatchSendEmailResult, r as BounceType, C as CategoryOptOut, s as CategoryOptOutCategory, t as CategoryUnsubscribedErrorDetails, u as ConnectTwilioParams, v as ContactWebhookEventPayload, w as CreateApiKeyParams, x as CreateApiKeyResult, y as CreateAutomationParams, z as CreateDomainParams, E as CreateDomainResult, F as CreateMigrationParams, H as CreateSuppressionParams, I as CreateTemplateParams, J as CreateTenantParams, K as CreateWebhookParams, L as DEFAULT_API_BASE_URL, M as DailyRampLimitErrorDetails, N as DeleteTenantResult, O as DeliverabilityBucket, P as DeliverabilityDomainInsight, Q as DeliverabilityInsightsResult, R as DeliverabilityMailServerRelay, T as DeliverabilityWindow, U as DmarcDailyPoint, V as DmarcMonitoring, W as DmarcMonitoringDisabled, X as DmarcReadiness, Y as DmarcReadinessVerdict, Z as DmarcSource, _ as DmarcSourceStatus, $ as DmarcStatus, a0 as DnsProviderName, a1 as Domain, a2 as DomainBimiAnalysis, a3 as DomainDetailResult, a4 as DomainDmarcAnalysis, a5 as DomainDnsAnalysis, a6 as DomainStatus, a7 as DomainTlsMode, a8 as DomainTrackingDns, a9 as DomainTrackingStatus, aa as EmailListItem, ab as EmailWebhookEventPayload, ac as EmailWebhookEventType, ad as EnableDmarcParams, ae as EnableDmarcResult, af as EnrollmentSkip, ag as EventRecord, G as Groundmail, ah as GroundmailAccessToken, ai as GroundmailOptions, aj as GroundmailTokenOptions, ak as GroundmailTokenProvider, al as HeldBackErrorDetails, am as HeldBackReason, an as HeldBackRecipient, ao as ListApiKeysParams, ap as ListApiKeysResult, aq as ListAutomationRunsParams, ar as ListAutomationRunsResult, as as ListAutomationsResult, at as ListCategoryOptOutsParams, au as ListCategoryOptOutsResult, av as ListDomainsParams, aw as ListDomainsResult, ax as ListEmailsParams, ay as ListEmailsResult, az as ListReceivedEmailsParams, aA as ListReceivedEmailsResult, aB as ListSuppressionsParams, aC as ListSuppressionsResult, aD as ListTemplatesParams, aE as ListTemplatesResult, aF as ListTenantDomainsResult, aG as ListTenantsParams, aH as ListTenantsResult, aI as MailServerSigningStatus, aJ as MailStream, aK as Migration, aL as MigrationDnsChange, aM as MigrationDnsPlan, aN as MigrationDomainItem, aO as MigrationItemStatus, aP as MigrationProvider, aQ as MigrationResource, aR as MigrationSummary, aS as MigrationTemplateItem, aT as MigrationTotals, aU as MigrationWebhookItem, aV as ReceivedEmail, aW as ReceivedEmailAttachment, aX as ReceivedEmailAttachmentMeta, aY as RemoteApplyDnsCredentials, aZ as RemoveCategoryOptOutOptions, a_ as RunMigrationOptions, a$ as SendEmailParams, S as SendEmailResult, b0 as StreamDeliverability, b1 as SuppressedErrorDetails, b2 as Suppression, b3 as Template, b4 as TemplateFormat, b5 as TemplateLintWarning, b6 as TemplateStarter, b7 as TemplateStatus, b8 as TemplateVersion, b9 as Tenant, ba as TenantPauseSource, bb as TenantRamp, bc as TenantStats, bd as TenantStatsResult, be as TenantStatus, bf as TenantStreamPolicy, bg as TestEmailWebhookParams, bh as TestEmailWebhookResult, bi as TriggerEventParams, bj as TriggerEventResult, bk as TwilioIntegrationResponse, bl as TwilioIntegrationStatus, bm as UpdateAutomationParams, bn as UpdateDomainParams, bo as UpdateEmailParams, bp as UpdateTemplateParams, bq as UpdateTenantParams, br as UpdateWebhookParams, bs as ValidateEmailResult, bt as ValidationReason, bu as ValidationVerdict, bv as VerifyDomainResult, bw as WebhookEmailTag, bx as WebhookEndpoint, by as WebhookEndpointWithSecret, bz as WebhookEventType, bA as mergeMigrations, bB as normalizeAccessToken } from './client-NSj8n5sB.js';
3
3
 
4
4
  type GroundmailErrorOptions = {
5
5
  code?: string;
package/dist/index.js CHANGED
@@ -6,9 +6,10 @@ import {
6
6
  buildSignatureHeader,
7
7
  mergeMigrations,
8
8
  mergeSpfInclude,
9
+ normalizeAccessToken,
9
10
  signWebhookPayload,
10
11
  verifyWebhookSignature
11
- } from "./chunk-TTRMVR6T.js";
12
+ } from "./chunk-NQWM7F3N.js";
12
13
 
13
14
  // src/simulator.ts
14
15
  var SIMULATOR_DOMAIN = "simulator.groundmail.dev";
@@ -42,6 +43,7 @@ export {
42
43
  isTestApiKey,
43
44
  mergeMigrations,
44
45
  mergeSpfInclude,
46
+ normalizeAccessToken,
45
47
  signWebhookPayload,
46
48
  simulatorAddress,
47
49
  verifyWebhookSignature
package/dist/payload.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as Groundmail } from './client-DkpJ9AT0.js';
1
+ import { G as Groundmail } from './client-NSj8n5sB.js';
2
2
 
3
3
  /**
4
4
  * Minimal Payload `SendEmailOptions` / address shapes used by this adapter.
package/dist/payload.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_API_BASE_URL,
3
3
  Groundmail
4
- } from "./chunk-TTRMVR6T.js";
4
+ } from "./chunk-NQWM7F3N.js";
5
5
 
6
6
  // src/payload.ts
7
7
  function resolveApiKey(args) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groundmail",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "Groundmail transactional email API client",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -89,7 +89,7 @@
89
89
  "prepublishOnly": "npm run build && npm run build:nodemailer-bridge"
90
90
  },
91
91
  "dependencies": {
92
- "groundmail-nodemailer": "0.15.10"
92
+ "groundmail-nodemailer": "0.15.11"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@types/nodemailer": "^8.0.1",