groundmail 0.42.0 → 0.44.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/dist/authjs.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as Groundmail } from './client-Dsi5VG_k.js';
1
+ import { G as Groundmail } from './client-CD3tBIro.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-65NWGUZM.js";
4
+ } from "./chunk-WMMIGQLO.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-Dsi5VG_k.js';
1
+ import { S as SendEmailResult, G as Groundmail } from './client-CD3tBIro.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-65NWGUZM.js";
4
+ } from "./chunk-WMMIGQLO.js";
5
5
 
6
6
  // src/better-auth.ts
7
7
  function linkHtml(label, url) {
@@ -1407,6 +1407,9 @@ function verifyWebhookSignature(secret, payload, header, toleranceSec = 300) {
1407
1407
  }
1408
1408
  }
1409
1409
 
1410
+ // package.json
1411
+ var version = "0.44.0";
1412
+
1410
1413
  // src/automations.ts
1411
1414
  var AutomationsResource = class {
1412
1415
  constructor(client) {
@@ -1450,6 +1453,7 @@ var AutomationsResource = class {
1450
1453
  async listRuns(params = {}) {
1451
1454
  const search = new URLSearchParams();
1452
1455
  if (params.automation_id) search.set("automation_id", params.automation_id);
1456
+ if (params.test != null) search.set("test", String(params.test));
1453
1457
  const query = search.toString();
1454
1458
  return this.client.request(`/automations/runs${query ? `?${query}` : ""}`, { method: "GET" });
1455
1459
  }
@@ -1648,8 +1652,8 @@ var EmailsResource = class {
1648
1652
  method: "GET"
1649
1653
  });
1650
1654
  }
1651
- async insights(window = "30d") {
1652
- const search = new URLSearchParams({ window });
1655
+ async insights(window2 = "30d") {
1656
+ const search = new URLSearchParams({ window: window2 });
1653
1657
  return this.client.request(`/deliverability?${search.toString()}`, {
1654
1658
  method: "GET"
1655
1659
  });
@@ -1859,6 +1863,7 @@ var SmtpCredentialsResource = class {
1859
1863
  const search = new URLSearchParams();
1860
1864
  if (params.limit != null) search.set("limit", String(params.limit));
1861
1865
  if (params.cursor) search.set("cursor", params.cursor);
1866
+ if (params.test != null) search.set("test", String(params.test));
1862
1867
  const query = search.toString();
1863
1868
  return this.client.request(
1864
1869
  `/smtp-credentials${query ? `?${query}` : ""}`,
@@ -1869,7 +1874,8 @@ var SmtpCredentialsResource = class {
1869
1874
  return this.client.request("/smtp-credentials", {
1870
1875
  method: "POST",
1871
1876
  body: JSON.stringify({
1872
- ...params.name ? { name: params.name } : {}
1877
+ ...params.name ? { name: params.name } : {},
1878
+ ...params.test ? { test: true } : {}
1873
1879
  })
1874
1880
  });
1875
1881
  }
@@ -2086,9 +2092,9 @@ var TemplatesResource = class {
2086
2092
  method: "GET"
2087
2093
  });
2088
2094
  }
2089
- async restoreVersion(idOrAlias, version) {
2095
+ async restoreVersion(idOrAlias, version2) {
2090
2096
  return this.client.request(
2091
- `/templates/${encodeURIComponent(idOrAlias)}/versions/${version}`,
2097
+ `/templates/${encodeURIComponent(idOrAlias)}/versions/${version2}`,
2092
2098
  {
2093
2099
  method: "POST",
2094
2100
  body: JSON.stringify({ action: "restore" })
@@ -2307,6 +2313,16 @@ var _Groundmail = class _Groundmail {
2307
2313
  get fetchImpl() {
2308
2314
  return this.options.fetch || fetch;
2309
2315
  }
2316
+ /**
2317
+ * `groundmail/<version> node/<version>`, so Groundmail can tell SDK traffic from a plain
2318
+ * HTTP call. Left to a custom `fetch` (our CLI and MCP server send their own), and never
2319
+ * set in a browser, which owns this header.
2320
+ */
2321
+ get userAgentHeader() {
2322
+ if (this.options.fetch || typeof window !== "undefined") return {};
2323
+ const node = typeof process !== "undefined" ? process.versions?.node : void 0;
2324
+ return { "User-Agent": `groundmail/${version}${node ? ` node/${node}` : ""}` };
2325
+ }
2310
2326
  async bearer(forceRefresh = false) {
2311
2327
  if (this.apiKey) return this.apiKey;
2312
2328
  if (!forceRefresh && this.cachedToken && Date.now() < this.cachedToken.refreshAt) {
@@ -2324,7 +2340,12 @@ var _Groundmail = class _Groundmail {
2324
2340
  async authorizedFetch(url, init, extraHeaders) {
2325
2341
  const send = async (forceRefresh) => this.fetchImpl(url, {
2326
2342
  ...init,
2327
- headers: { Authorization: `Bearer ${await this.bearer(forceRefresh)}`, ...extraHeaders, ...init.headers || {} }
2343
+ headers: {
2344
+ ...this.userAgentHeader,
2345
+ Authorization: `Bearer ${await this.bearer(forceRefresh)}`,
2346
+ ...extraHeaders,
2347
+ ...init.headers || {}
2348
+ }
2328
2349
  });
2329
2350
  const response = await send(false);
2330
2351
  if (response.status === 401 && this.getToken) {
package/dist/clerk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as Groundmail, S as SendEmailResult } from './client-Dsi5VG_k.js';
1
+ import { G as Groundmail, S as SendEmailResult } from './client-CD3tBIro.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-65NWGUZM.js";
4
+ } from "./chunk-WMMIGQLO.js";
5
5
 
6
6
  // src/clerk.ts
7
7
  function resolveApiKey(options) {
@@ -473,6 +473,8 @@ type SmtpCredential = {
473
473
  id: string;
474
474
  name: string;
475
475
  password_prefix: string;
476
+ /** A test credential (`gmsmtp_test_…`): mail sent with it is simulated and never delivered. */
477
+ test: boolean;
476
478
  username: string;
477
479
  host: string;
478
480
  port: number;
@@ -483,6 +485,8 @@ type SmtpCredential = {
483
485
  type ListSmtpCredentialsParams = {
484
486
  limit?: number;
485
487
  cursor?: string;
488
+ /** `true` for test credentials only, `false` for live ones only. */
489
+ test?: boolean;
486
490
  };
487
491
  type ListSmtpCredentialsResult = {
488
492
  data: SmtpCredential[];
@@ -491,6 +495,8 @@ type ListSmtpCredentialsResult = {
491
495
  };
492
496
  type CreateSmtpCredentialParams = {
493
497
  name?: string;
498
+ /** Create a test credential: mail sent with it is simulated and never delivered. */
499
+ test?: boolean;
494
500
  };
495
501
  type CreateSmtpCredentialResult = SmtpCredential & {
496
502
  password: string;
@@ -808,6 +814,8 @@ type AutomationRunResponse = {
808
814
  };
809
815
  type ListAutomationRunsParams = {
810
816
  automation_id?: string;
817
+ /** `true` for runs started with a test key only, `false` for live runs only. */
818
+ test?: boolean;
811
819
  };
812
820
  type ListAutomationRunsResult = {
813
821
  runs: AutomationRun[];
@@ -2562,6 +2570,12 @@ declare class Groundmail {
2562
2570
  validate(email: string): Promise<ValidateEmailResult>;
2563
2571
  get baseUrl(): string;
2564
2572
  get fetchImpl(): typeof fetch;
2573
+ /**
2574
+ * `groundmail/<version> node/<version>`, so Groundmail can tell SDK traffic from a plain
2575
+ * HTTP call. Left to a custom `fetch` (our CLI and MCP server send their own), and never
2576
+ * set in a browser, which owns this header.
2577
+ */
2578
+ private get userAgentHeader();
2565
2579
  /** Two minutes of slack so a token never expires in flight. */
2566
2580
  private static readonly TOKEN_REFRESH_SKEW_MS;
2567
2581
  /** Tokens with no known expiry are reused this long at most. */
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as ApiErrorBody, D as DnsRecord } from './client-Dsi5VG_k.js';
2
- export { a as ApiErrorCode, b as ApiKey, c as ApiKeyMigrationParams, d as ApiKeyScope, e as ApplyDnsParams, f as ApplyDnsRecordResult, g as ApplyDnsResult, h as Asset, i as Automation, j as AutomationBranchQuestion, k as AutomationBranchStep, l as AutomationInlineEmail, m as AutomationResult, n as AutomationRun, o as AutomationRunResponse, p as AutomationRunStatus, q as AutomationRunStep, r as AutomationRunStepStatus, s as AutomationSendEmailStep, t as AutomationStatus, u as AutomationStep, v as AutomationTemplateEmail, w as AutomationTrigger, B as Batch, x as BatchSendEmailResult, y as BounceType, z as Brand, C as BrandLogo, E as BrandSettings, F as BurrowGuardCheck, H as BurrowGuardReason, I as BurrowGuardResource, J as BurrowGuardSite, K as BurrowGuardSiteWithSecret, L as BurrowGuardVerifyParams, M as BurrowGuardVerifyResult, N as CancelBatchResult, O as CategoryOptOut, P as CategoryOptOutCategory, Q as CategoryUnsubscribedErrorDetails, R as ConnectTwilioParams, T as ContactWebhookEventPayload, U as CreateApiKeyParams, V as CreateApiKeyResult, W as CreateAutomationParams, X as CreateBurrowGuardSiteParams, Y as CreateDomainParams, Z as CreateDomainResult, _ as CreateMigrationParams, $ as CreateSenderParams, a0 as CreateSuppressionParams, a1 as CreateTemplateParams, a2 as CreateTenantParams, a3 as CreateWebhookParams, a4 as DEFAULT_API_BASE_URL, a5 as DailyRampLimitErrorDetails, a6 as DeleteTenantResult, a7 as DeliverabilityBucket, a8 as DeliverabilityDomainInsight, a9 as DeliverabilityInsightsResult, aa as DeliverabilityMailServerRelay, ab as DeliverabilityWindow, ac as DmarcDailyPoint, ad as DmarcMonitoring, ae as DmarcMonitoringDisabled, af as DmarcReadiness, ag as DmarcReadinessVerdict, ah as DmarcSource, ai as DmarcSourceStatus, aj as DmarcStatus, ak as DnsProviderName, al as Domain, am as DomainBimiAnalysis, an as DomainBlocklistListing, ao as DomainBlocklistStatus, ap as DomainBlocklists, aq as DomainDetailResult, ar as DomainDmarcAnalysis, as as DomainDnsAnalysis, at as DomainStatus, au as DomainTlsMode, av as DomainTrackingDns, aw as DomainTrackingStatus, ax as EmailDelivery, ay as EmailListItem, az as EmailWebhookEventPayload, aA as EmailWebhookEventType, aB as EnableDmarcParams, aC as EnableDmarcResult, aD as EnrollmentSkip, aE as EventRecord, G as Groundmail, aF as GroundmailAccessToken, aG as GroundmailOptions, aH as GroundmailTokenOptions, aI as GroundmailTokenProvider, aJ as HeldBackErrorDetails, aK as HeldBackReason, aL as HeldBackRecipient, aM as InReplyToEmail, aN as ListApiKeysParams, aO as ListApiKeysResult, aP as ListAutomationRunsParams, aQ as ListAutomationRunsResult, aR as ListAutomationsResult, aS as ListBurrowGuardChecksParams, aT as ListBurrowGuardChecksResult, aU as ListCategoryOptOutsParams, aV as ListCategoryOptOutsResult, aW as ListDomainsParams, aX as ListDomainsResult, aY as ListEmailsParams, aZ as ListEmailsResult, a_ as ListReceivedEmailsParams, a$ as ListReceivedEmailsResult, b0 as ListSendersResult, b1 as ListSuppressionsParams, b2 as ListSuppressionsResult, b3 as ListTemplatesParams, b4 as ListTemplatesResult, b5 as ListTenantDomainsResult, b6 as ListTenantsParams, b7 as ListTenantsResult, b8 as ListTestInboxEmailsParams, b9 as ListTestInboxEmailsResult, ba as ListWebhookDeliveriesParams, bb as ListWebhookDeliveriesResult, bc as MailServerSigningStatus, bd as MailStream, be as Migration, bf as MigrationDnsChange, bg as MigrationDnsPlan, bh as MigrationDomainItem, bi as MigrationItemStatus, bj as MigrationProvider, bk as MigrationResource, bl as MigrationSummary, bm as MigrationTemplateItem, bn as MigrationTotals, bo as MigrationWebhookItem, bp as ReceivedEmail, bq as ReceivedEmailAttachment, br as ReceivedEmailAttachmentMeta, bs as RemoteApplyDnsCredentials, bt as RemoveCategoryOptOutOptions, bu as RunMigrationOptions, bv as SendEmailParams, S as SendEmailResult, bw as Sender, bx as SesMigrationParams, by as StreamDeliverability, bz as SuppressedErrorDetails, bA as Suppression, bB as TEST_INBOX_WAIT_DEFAULT_MS, bC as TEST_INBOX_WAIT_MAX_SECONDS, bD as Template, bE as TemplateFormat, bF as TemplateLintWarning, bG as TemplateStarter, bH as TemplateStatus, bI as TemplateVersion, bJ as Tenant, bK as TenantPauseSource, bL as TenantRamp, bM as TenantStats, bN as TenantStatsResult, bO as TenantStatus, bP as TenantStreamPolicy, bQ as TestEmailWebhookParams, bR as TestEmailWebhookResult, bS as TestInbox, bT as TestInboxAddressOptions, bU as TestInboxEmail, bV as TestInboxEmailDetail, bW as TestInboxHeader, bX as TestInboxResource, bY as TestInboxUsage, bZ as TriggerEventParams, b_ as TriggerEventResult, b$ as TwilioIntegrationResponse, c0 as TwilioIntegrationStatus, c1 as UpdateAutomationParams, c2 as UpdateBrandParams, c3 as UpdateBurrowGuardSiteParams, c4 as UpdateDomainParams, c5 as UpdateEmailParams, c6 as UpdateSenderParams, c7 as UpdateTemplateParams, c8 as UpdateTenantParams, c9 as UpdateWebhookParams, ca as ValidateEmailResult, cb as ValidationReason, cc as ValidationVerdict, cd as VerifyDomainResult, ce as WaitForTestEmailParams, cf as WebhookDelivery, cg as WebhookDeliveryAttempt, ch as WebhookDeliveryDetail, ci as WebhookDeliveryStatus, cj as WebhookEmailTag, ck as WebhookEndpoint, cl as WebhookEndpointHealth, cm as WebhookEndpointWithSecret, cn as WebhookEventType, co as mergeMigrations, cp as normalizeAccessToken } from './client-Dsi5VG_k.js';
1
+ import { A as ApiErrorBody, D as DnsRecord } from './client-CD3tBIro.js';
2
+ export { a as ApiErrorCode, b as ApiKey, c as ApiKeyMigrationParams, d as ApiKeyScope, e as ApplyDnsParams, f as ApplyDnsRecordResult, g as ApplyDnsResult, h as Asset, i as Automation, j as AutomationBranchQuestion, k as AutomationBranchStep, l as AutomationInlineEmail, m as AutomationResult, n as AutomationRun, o as AutomationRunResponse, p as AutomationRunStatus, q as AutomationRunStep, r as AutomationRunStepStatus, s as AutomationSendEmailStep, t as AutomationStatus, u as AutomationStep, v as AutomationTemplateEmail, w as AutomationTrigger, B as Batch, x as BatchSendEmailResult, y as BounceType, z as Brand, C as BrandLogo, E as BrandSettings, F as BurrowGuardCheck, H as BurrowGuardReason, I as BurrowGuardResource, J as BurrowGuardSite, K as BurrowGuardSiteWithSecret, L as BurrowGuardVerifyParams, M as BurrowGuardVerifyResult, N as CancelBatchResult, O as CategoryOptOut, P as CategoryOptOutCategory, Q as CategoryUnsubscribedErrorDetails, R as ConnectTwilioParams, T as ContactWebhookEventPayload, U as CreateApiKeyParams, V as CreateApiKeyResult, W as CreateAutomationParams, X as CreateBurrowGuardSiteParams, Y as CreateDomainParams, Z as CreateDomainResult, _ as CreateMigrationParams, $ as CreateSenderParams, a0 as CreateSuppressionParams, a1 as CreateTemplateParams, a2 as CreateTenantParams, a3 as CreateWebhookParams, a4 as DEFAULT_API_BASE_URL, a5 as DailyRampLimitErrorDetails, a6 as DeleteTenantResult, a7 as DeliverabilityBucket, a8 as DeliverabilityDomainInsight, a9 as DeliverabilityInsightsResult, aa as DeliverabilityMailServerRelay, ab as DeliverabilityWindow, ac as DmarcDailyPoint, ad as DmarcMonitoring, ae as DmarcMonitoringDisabled, af as DmarcReadiness, ag as DmarcReadinessVerdict, ah as DmarcSource, ai as DmarcSourceStatus, aj as DmarcStatus, ak as DnsProviderName, al as Domain, am as DomainBimiAnalysis, an as DomainBlocklistListing, ao as DomainBlocklistStatus, ap as DomainBlocklists, aq as DomainDetailResult, ar as DomainDmarcAnalysis, as as DomainDnsAnalysis, at as DomainStatus, au as DomainTlsMode, av as DomainTrackingDns, aw as DomainTrackingStatus, ax as EmailDelivery, ay as EmailListItem, az as EmailWebhookEventPayload, aA as EmailWebhookEventType, aB as EnableDmarcParams, aC as EnableDmarcResult, aD as EnrollmentSkip, aE as EventRecord, G as Groundmail, aF as GroundmailAccessToken, aG as GroundmailOptions, aH as GroundmailTokenOptions, aI as GroundmailTokenProvider, aJ as HeldBackErrorDetails, aK as HeldBackReason, aL as HeldBackRecipient, aM as InReplyToEmail, aN as ListApiKeysParams, aO as ListApiKeysResult, aP as ListAutomationRunsParams, aQ as ListAutomationRunsResult, aR as ListAutomationsResult, aS as ListBurrowGuardChecksParams, aT as ListBurrowGuardChecksResult, aU as ListCategoryOptOutsParams, aV as ListCategoryOptOutsResult, aW as ListDomainsParams, aX as ListDomainsResult, aY as ListEmailsParams, aZ as ListEmailsResult, a_ as ListReceivedEmailsParams, a$ as ListReceivedEmailsResult, b0 as ListSendersResult, b1 as ListSuppressionsParams, b2 as ListSuppressionsResult, b3 as ListTemplatesParams, b4 as ListTemplatesResult, b5 as ListTenantDomainsResult, b6 as ListTenantsParams, b7 as ListTenantsResult, b8 as ListTestInboxEmailsParams, b9 as ListTestInboxEmailsResult, ba as ListWebhookDeliveriesParams, bb as ListWebhookDeliveriesResult, bc as MailServerSigningStatus, bd as MailStream, be as Migration, bf as MigrationDnsChange, bg as MigrationDnsPlan, bh as MigrationDomainItem, bi as MigrationItemStatus, bj as MigrationProvider, bk as MigrationResource, bl as MigrationSummary, bm as MigrationTemplateItem, bn as MigrationTotals, bo as MigrationWebhookItem, bp as ReceivedEmail, bq as ReceivedEmailAttachment, br as ReceivedEmailAttachmentMeta, bs as RemoteApplyDnsCredentials, bt as RemoveCategoryOptOutOptions, bu as RunMigrationOptions, bv as SendEmailParams, S as SendEmailResult, bw as Sender, bx as SesMigrationParams, by as StreamDeliverability, bz as SuppressedErrorDetails, bA as Suppression, bB as TEST_INBOX_WAIT_DEFAULT_MS, bC as TEST_INBOX_WAIT_MAX_SECONDS, bD as Template, bE as TemplateFormat, bF as TemplateLintWarning, bG as TemplateStarter, bH as TemplateStatus, bI as TemplateVersion, bJ as Tenant, bK as TenantPauseSource, bL as TenantRamp, bM as TenantStats, bN as TenantStatsResult, bO as TenantStatus, bP as TenantStreamPolicy, bQ as TestEmailWebhookParams, bR as TestEmailWebhookResult, bS as TestInbox, bT as TestInboxAddressOptions, bU as TestInboxEmail, bV as TestInboxEmailDetail, bW as TestInboxHeader, bX as TestInboxResource, bY as TestInboxUsage, bZ as TriggerEventParams, b_ as TriggerEventResult, b$ as TwilioIntegrationResponse, c0 as TwilioIntegrationStatus, c1 as UpdateAutomationParams, c2 as UpdateBrandParams, c3 as UpdateBurrowGuardSiteParams, c4 as UpdateDomainParams, c5 as UpdateEmailParams, c6 as UpdateSenderParams, c7 as UpdateTemplateParams, c8 as UpdateTenantParams, c9 as UpdateWebhookParams, ca as ValidateEmailResult, cb as ValidationReason, cc as ValidationVerdict, cd as VerifyDomainResult, ce as WaitForTestEmailParams, cf as WebhookDelivery, cg as WebhookDeliveryAttempt, ch as WebhookDeliveryDetail, ci as WebhookDeliveryStatus, cj as WebhookEmailTag, ck as WebhookEndpoint, cl as WebhookEndpointHealth, cm as WebhookEndpointWithSecret, cn as WebhookEventType, co as mergeMigrations, cp as normalizeAccessToken } from './client-CD3tBIro.js';
3
3
 
4
4
  type GroundmailErrorOptions = {
5
5
  code?: string;
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  normalizeAccessToken,
14
14
  signWebhookPayload,
15
15
  verifyWebhookSignature
16
- } from "./chunk-65NWGUZM.js";
16
+ } from "./chunk-WMMIGQLO.js";
17
17
 
18
18
  // src/simulator.ts
19
19
  var SIMULATOR_DOMAIN = "simulator.groundmail.dev";
package/dist/payload.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { G as Groundmail } from './client-Dsi5VG_k.js';
1
+ import { G as Groundmail } from './client-CD3tBIro.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-65NWGUZM.js";
4
+ } from "./chunk-WMMIGQLO.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.42.0",
3
+ "version": "0.44.0",
4
4
  "description": "Groundmail transactional email API client",
5
5
  "license": "MIT",
6
6
  "type": "module",