groundmail 0.14.5 → 0.14.6
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 +1 -1
- package/dist/authjs.js +1 -1
- package/dist/better-auth.d.ts +1 -1
- package/dist/better-auth.js +1 -1
- package/dist/{chunk-2ZKYDDVV.js → chunk-LKMNSXA3.js} +53 -0
- package/dist/clerk.d.ts +1 -1
- package/dist/clerk.js +1 -1
- package/dist/{client-BysKOdUg.d.ts → client-CWIVF1eb.d.ts} +130 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/payload.d.ts +1 -1
- package/dist/payload.js +1 -1
- package/package.json +2 -2
package/dist/authjs.d.ts
CHANGED
package/dist/authjs.js
CHANGED
package/dist/better-auth.d.ts
CHANGED
package/dist/better-auth.js
CHANGED
|
@@ -738,6 +738,57 @@ async function applyDnsRecords(input) {
|
|
|
738
738
|
};
|
|
739
739
|
}
|
|
740
740
|
|
|
741
|
+
// src/migrations.ts
|
|
742
|
+
function mergeMigrations(previous, next) {
|
|
743
|
+
if (!previous || previous.id !== next.id) return next;
|
|
744
|
+
const merged = {
|
|
745
|
+
...next,
|
|
746
|
+
errors: [...previous.errors, ...next.errors],
|
|
747
|
+
notes: [.../* @__PURE__ */ new Set([...previous.notes, ...next.notes])]
|
|
748
|
+
};
|
|
749
|
+
if (next.domains) merged.domains = { totals: next.domains.totals, items: [...previous.domains?.items ?? [], ...next.domains.items] };
|
|
750
|
+
if (next.webhooks) merged.webhooks = { totals: next.webhooks.totals, items: [...previous.webhooks?.items ?? [], ...next.webhooks.items] };
|
|
751
|
+
if (next.templates) merged.templates = { totals: next.templates.totals, items: [...previous.templates?.items ?? [], ...next.templates.items] };
|
|
752
|
+
if (next.suppressions) {
|
|
753
|
+
const reasons = { ...previous.suppressions?.skipped_reasons ?? {} };
|
|
754
|
+
for (const [reason, count] of Object.entries(next.suppressions.skipped_reasons)) {
|
|
755
|
+
reasons[reason] = (reasons[reason] ?? 0) + count;
|
|
756
|
+
}
|
|
757
|
+
merged.suppressions = {
|
|
758
|
+
totals: next.suppressions.totals,
|
|
759
|
+
skipped_reasons: reasons,
|
|
760
|
+
estimated: Boolean(previous.suppressions?.estimated) || next.suppressions.estimated
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
return merged;
|
|
764
|
+
}
|
|
765
|
+
var MigrationsResource = class {
|
|
766
|
+
constructor(client) {
|
|
767
|
+
this.client = client;
|
|
768
|
+
}
|
|
769
|
+
/** One request (about 40 seconds of work). Continue with `cursor` while `has_more`. */
|
|
770
|
+
async create(params) {
|
|
771
|
+
return this.client.request("/migrations", {
|
|
772
|
+
method: "POST",
|
|
773
|
+
body: JSON.stringify(params)
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
/** The whole import: follows `next_cursor` until done and returns the combined report. */
|
|
777
|
+
async run(params, options = {}) {
|
|
778
|
+
const sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
779
|
+
let merged = null;
|
|
780
|
+
let cursor = params.cursor;
|
|
781
|
+
for (; ; ) {
|
|
782
|
+
const { migration } = await this.create({ ...params, ...cursor ? { cursor } : {} });
|
|
783
|
+
merged = mergeMigrations(merged, migration);
|
|
784
|
+
options.onProgress?.(merged);
|
|
785
|
+
if (!merged.has_more || !merged.next_cursor || options.signal?.aborted) return merged;
|
|
786
|
+
if (merged.retry_after_seconds) await sleep(merged.retry_after_seconds * 1e3);
|
|
787
|
+
cursor = merged.next_cursor;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
};
|
|
791
|
+
|
|
741
792
|
// src/webhooks/verify.ts
|
|
742
793
|
import { createHmac, timingSafeEqual } from "crypto";
|
|
743
794
|
function signWebhookPayload(secret, payload, timestamp) {
|
|
@@ -1361,6 +1412,7 @@ var Groundmail = class {
|
|
|
1361
1412
|
this.smtpCredentials = new SmtpCredentialsResource(this);
|
|
1362
1413
|
this.suppressions = new SuppressionsResource(this);
|
|
1363
1414
|
this.templates = new TemplatesResource(this);
|
|
1415
|
+
this.migrations = new MigrationsResource(this);
|
|
1364
1416
|
}
|
|
1365
1417
|
get baseUrl() {
|
|
1366
1418
|
return (this.options.baseUrl || DEFAULT_API_BASE_URL).replace(/\/$/, "");
|
|
@@ -1389,6 +1441,7 @@ export {
|
|
|
1389
1441
|
GroundmailError,
|
|
1390
1442
|
mergeSpfInclude,
|
|
1391
1443
|
applyDnsRecords,
|
|
1444
|
+
mergeMigrations,
|
|
1392
1445
|
signWebhookPayload,
|
|
1393
1446
|
buildSignatureHeader,
|
|
1394
1447
|
verifyWebhookSignature,
|
package/dist/clerk.d.ts
CHANGED
package/dist/clerk.js
CHANGED
|
@@ -769,6 +769,116 @@ type ApiErrorBody = {
|
|
|
769
769
|
} & Omit<ApiErrorFields, 'message'> & {
|
|
770
770
|
message?: string;
|
|
771
771
|
};
|
|
772
|
+
/** Providers the importer reads from (Beta). */
|
|
773
|
+
type MigrationProvider = 'sendgrid' | 'postmark' | 'mailgun';
|
|
774
|
+
type MigrationResource = 'domains' | 'webhooks' | 'templates' | 'suppressions';
|
|
775
|
+
type MigrationItemStatus = 'imported' | 'would_import' | 'needs_attention' | 'skipped' | 'failed';
|
|
776
|
+
type CreateMigrationParams = {
|
|
777
|
+
provider: MigrationProvider;
|
|
778
|
+
/** SendGrid API key, Postmark server token or Mailgun private key. Used for the import only; never stored. */
|
|
779
|
+
api_key: string;
|
|
780
|
+
/** Postmark only: the account token, needed to import sending domains. */
|
|
781
|
+
account_api_key?: string;
|
|
782
|
+
/** SendGrid and Mailgun: `eu` for EU-region accounts. */
|
|
783
|
+
region?: 'us' | 'eu';
|
|
784
|
+
/** What to import; all four by default. */
|
|
785
|
+
resources?: MigrationResource[];
|
|
786
|
+
/** Preview without writing anything. */
|
|
787
|
+
dry_run?: boolean;
|
|
788
|
+
/** `next_cursor` from the previous response, to continue. */
|
|
789
|
+
cursor?: string;
|
|
790
|
+
};
|
|
791
|
+
type MigrationTotals = Record<string, number>;
|
|
792
|
+
type MigrationDomainItem = {
|
|
793
|
+
name: string;
|
|
794
|
+
status: MigrationItemStatus;
|
|
795
|
+
domain_id: string | null;
|
|
796
|
+
verified_at_source: boolean | null;
|
|
797
|
+
records: Array<{
|
|
798
|
+
type: string;
|
|
799
|
+
host: string;
|
|
800
|
+
value: string;
|
|
801
|
+
purpose: string;
|
|
802
|
+
}>;
|
|
803
|
+
dashboard_url: string | null;
|
|
804
|
+
message: string | null;
|
|
805
|
+
};
|
|
806
|
+
type MigrationWebhookItem = {
|
|
807
|
+
url: string;
|
|
808
|
+
status: MigrationItemStatus;
|
|
809
|
+
webhook_id: string | null;
|
|
810
|
+
/** Signing secret of a webhook created by this request (shown once). */
|
|
811
|
+
secret: string | null;
|
|
812
|
+
enabled: boolean;
|
|
813
|
+
source_events: string[];
|
|
814
|
+
events: string[];
|
|
815
|
+
unmapped_events: string[];
|
|
816
|
+
message: string | null;
|
|
817
|
+
};
|
|
818
|
+
type MigrationTemplateItem = {
|
|
819
|
+
source_id: string;
|
|
820
|
+
name: string;
|
|
821
|
+
status: MigrationItemStatus;
|
|
822
|
+
template_id: string | null;
|
|
823
|
+
alias: string | null;
|
|
824
|
+
published: boolean;
|
|
825
|
+
variables: string[];
|
|
826
|
+
notes: string[];
|
|
827
|
+
message: string | null;
|
|
828
|
+
};
|
|
829
|
+
type Migration = {
|
|
830
|
+
id: string;
|
|
831
|
+
provider: MigrationProvider;
|
|
832
|
+
dry_run: boolean;
|
|
833
|
+
status: 'in_progress' | 'completed' | 'partial' | 'failed';
|
|
834
|
+
started_at: string;
|
|
835
|
+
resources: MigrationResource[];
|
|
836
|
+
has_more: boolean;
|
|
837
|
+
next_cursor: string | null;
|
|
838
|
+
retry_after_seconds: number | null;
|
|
839
|
+
domains?: {
|
|
840
|
+
totals: MigrationTotals;
|
|
841
|
+
items: MigrationDomainItem[];
|
|
842
|
+
};
|
|
843
|
+
webhooks?: {
|
|
844
|
+
totals: MigrationTotals;
|
|
845
|
+
items: MigrationWebhookItem[];
|
|
846
|
+
};
|
|
847
|
+
templates?: {
|
|
848
|
+
totals: MigrationTotals;
|
|
849
|
+
items: MigrationTemplateItem[];
|
|
850
|
+
};
|
|
851
|
+
suppressions?: {
|
|
852
|
+
totals: MigrationTotals;
|
|
853
|
+
skipped_reasons: Record<string, number>;
|
|
854
|
+
estimated: boolean;
|
|
855
|
+
};
|
|
856
|
+
errors: Array<{
|
|
857
|
+
resource: MigrationResource;
|
|
858
|
+
code: string;
|
|
859
|
+
message: string;
|
|
860
|
+
}>;
|
|
861
|
+
notes: string[];
|
|
862
|
+
attention: string[];
|
|
863
|
+
template_map: Array<{
|
|
864
|
+
source_id: string;
|
|
865
|
+
alias: string;
|
|
866
|
+
}>;
|
|
867
|
+
code_changes: Array<{
|
|
868
|
+
stack: 'node' | 'python' | 'curl';
|
|
869
|
+
label: string;
|
|
870
|
+
diff: string;
|
|
871
|
+
}> | null;
|
|
872
|
+
agent_prompt: string | null;
|
|
873
|
+
};
|
|
874
|
+
type RunMigrationOptions = {
|
|
875
|
+
/** Called after each request with the report so far. */
|
|
876
|
+
onProgress?: (migration: Migration) => void;
|
|
877
|
+
/** Stop between requests; what was imported stays. */
|
|
878
|
+
signal?: AbortSignal;
|
|
879
|
+
/** Waits for `retry_after_seconds` (tests can pass a no-op). */
|
|
880
|
+
sleep?: (ms: number) => Promise<void>;
|
|
881
|
+
};
|
|
772
882
|
|
|
773
883
|
declare class AutomationsResource {
|
|
774
884
|
private readonly client;
|
|
@@ -863,6 +973,23 @@ declare class KeysResource {
|
|
|
863
973
|
}>;
|
|
864
974
|
}
|
|
865
975
|
|
|
976
|
+
/** Combine the reports of one import's requests: every item, the latest totals. */
|
|
977
|
+
declare function mergeMigrations(previous: Migration | null, next: Migration): Migration;
|
|
978
|
+
/**
|
|
979
|
+
* Import templates, suppressions, domains and webhooks from SendGrid, Postmark
|
|
980
|
+
* or Mailgun (Beta). The provider key is sent with each request and never stored.
|
|
981
|
+
*/
|
|
982
|
+
declare class MigrationsResource {
|
|
983
|
+
private readonly client;
|
|
984
|
+
constructor(client: Groundmail);
|
|
985
|
+
/** One request (about 40 seconds of work). Continue with `cursor` while `has_more`. */
|
|
986
|
+
create(params: CreateMigrationParams): Promise<{
|
|
987
|
+
migration: Migration;
|
|
988
|
+
}>;
|
|
989
|
+
/** The whole import: follows `next_cursor` until done and returns the combined report. */
|
|
990
|
+
run(params: CreateMigrationParams, options?: RunMigrationOptions): Promise<Migration>;
|
|
991
|
+
}
|
|
992
|
+
|
|
866
993
|
declare class SmtpCredentialsResource {
|
|
867
994
|
private readonly client;
|
|
868
995
|
constructor(client: Groundmail);
|
|
@@ -979,10 +1106,12 @@ declare class Groundmail {
|
|
|
979
1106
|
readonly smtpCredentials: SmtpCredentialsResource;
|
|
980
1107
|
readonly suppressions: SuppressionsResource;
|
|
981
1108
|
readonly templates: TemplatesResource;
|
|
1109
|
+
/** Import from SendGrid, Postmark or Mailgun (Beta). */
|
|
1110
|
+
readonly migrations: MigrationsResource;
|
|
982
1111
|
constructor(apiKey: string, options?: GroundmailOptions);
|
|
983
1112
|
get baseUrl(): string;
|
|
984
1113
|
get fetchImpl(): typeof fetch;
|
|
985
1114
|
request<T>(path: string, init: RequestInit): Promise<T>;
|
|
986
1115
|
}
|
|
987
1116
|
|
|
988
|
-
export { type
|
|
1117
|
+
export { type EventRecord as $, type ApiErrorBody as A, type BatchSendEmailResult as B, type CategoryUnsubscribedErrorDetails as C, type DnsRecord as D, type CreateTemplateParams as E, type CreateWebhookParams as F, Groundmail as G, DEFAULT_API_BASE_URL as H, type DeliverabilityBucket as I, type DeliverabilityDomainInsight as J, type DeliverabilityInsightsResult as K, type DeliverabilityMailServerRelay as L, type DeliverabilityWindow as M, type DnsProviderName as N, type Domain as O, type DomainBimiAnalysis as P, type DomainDetailResult as Q, type DomainDmarcAnalysis as R, type SendEmailResult as S, type DomainDnsAnalysis as T, type DomainStatus as U, type DomainTlsMode as V, type DomainTrackingDns as W, type DomainTrackingStatus as X, type EmailListItem as Y, type EmailWebhookEventType as Z, type EnrollmentSkip as _, type ApiErrorCode as a, type GroundmailOptions as a0, type ListApiKeysParams as a1, type ListApiKeysResult as a2, type ListAutomationRunsParams as a3, type ListAutomationRunsResult as a4, type ListAutomationsResult as a5, type ListDomainsParams as a6, type ListDomainsResult as a7, type ListEmailsParams as a8, type ListEmailsResult as a9, type TemplateStarter as aA, type TemplateStatus as aB, type TemplateVersion as aC, type TestEmailWebhookParams as aD, type TestEmailWebhookResult as aE, type TriggerEventParams as aF, type TriggerEventResult as aG, type TwilioIntegrationResponse as aH, type TwilioIntegrationStatus as aI, type UpdateAutomationParams as aJ, type UpdateDomainParams as aK, type UpdateEmailParams as aL, type UpdateTemplateParams as aM, type UpdateWebhookParams as aN, type VerifyDomainResult as aO, type WebhookEndpoint as aP, type WebhookEndpointWithSecret as aQ, type WebhookEventType as aR, mergeMigrations as aS, type ListReceivedEmailsParams as aa, type ListReceivedEmailsResult as ab, type ListSuppressionsParams as ac, type ListSuppressionsResult as ad, type ListTemplatesParams as ae, type ListTemplatesResult as af, type MailServerSigningStatus as ag, type Migration as ah, type MigrationDomainItem as ai, type MigrationItemStatus as aj, type MigrationProvider as ak, type MigrationResource as al, type MigrationTemplateItem as am, type MigrationTotals as an, type MigrationWebhookItem as ao, type ReceivedEmail as ap, type ReceivedEmailAttachment as aq, type ReceivedEmailAttachmentMeta as ar, type RemoteApplyDnsCredentials as as, type RunMigrationOptions as at, type SendEmailParams as au, type SuppressedErrorDetails as av, type Suppression as aw, type Template as ax, type TemplateFormat as ay, type TemplateLintWarning as az, type ApiKey as b, 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 ConnectTwilioParams as r, type ContactWebhookEventPayload as s, type CreateApiKeyParams as t, type CreateApiKeyResult as u, type CreateAutomationParams as v, type CreateDomainParams as w, type CreateDomainResult as x, type CreateMigrationParams as y, type CreateSuppressionParams as z };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as ApiErrorBody, D as DnsRecord } from './client-
|
|
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, C as CategoryUnsubscribedErrorDetails, r as ConnectTwilioParams, s as ContactWebhookEventPayload, t as CreateApiKeyParams, u as CreateApiKeyResult, v as CreateAutomationParams, w as CreateDomainParams, x as CreateDomainResult, y as
|
|
1
|
+
import { A as ApiErrorBody, D as DnsRecord } from './client-CWIVF1eb.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, C as CategoryUnsubscribedErrorDetails, r as ConnectTwilioParams, s as ContactWebhookEventPayload, t as CreateApiKeyParams, u as CreateApiKeyResult, v as CreateAutomationParams, w as CreateDomainParams, x as CreateDomainResult, y as CreateMigrationParams, z as CreateSuppressionParams, E as CreateTemplateParams, F as CreateWebhookParams, H as DEFAULT_API_BASE_URL, I as DeliverabilityBucket, J as DeliverabilityDomainInsight, K as DeliverabilityInsightsResult, L as DeliverabilityMailServerRelay, M as DeliverabilityWindow, N as DnsProviderName, O as Domain, P as DomainBimiAnalysis, Q as DomainDetailResult, R as DomainDmarcAnalysis, T as DomainDnsAnalysis, U as DomainStatus, V as DomainTlsMode, W as DomainTrackingDns, X as DomainTrackingStatus, Y as EmailListItem, Z as EmailWebhookEventType, _ as EnrollmentSkip, $ as EventRecord, G as Groundmail, a0 as GroundmailOptions, a1 as ListApiKeysParams, a2 as ListApiKeysResult, a3 as ListAutomationRunsParams, a4 as ListAutomationRunsResult, a5 as ListAutomationsResult, a6 as ListDomainsParams, a7 as ListDomainsResult, a8 as ListEmailsParams, a9 as ListEmailsResult, aa as ListReceivedEmailsParams, ab as ListReceivedEmailsResult, ac as ListSuppressionsParams, ad as ListSuppressionsResult, ae as ListTemplatesParams, af as ListTemplatesResult, ag as MailServerSigningStatus, ah as Migration, ai as MigrationDomainItem, aj as MigrationItemStatus, ak as MigrationProvider, al as MigrationResource, am as MigrationTemplateItem, an as MigrationTotals, ao as MigrationWebhookItem, ap as ReceivedEmail, aq as ReceivedEmailAttachment, ar as ReceivedEmailAttachmentMeta, as as RemoteApplyDnsCredentials, at as RunMigrationOptions, au as SendEmailParams, S as SendEmailResult, av as SuppressedErrorDetails, aw as Suppression, ax as Template, ay as TemplateFormat, az as TemplateLintWarning, aA as TemplateStarter, aB as TemplateStatus, aC as TemplateVersion, aD as TestEmailWebhookParams, aE as TestEmailWebhookResult, aF as TriggerEventParams, aG as TriggerEventResult, aH as TwilioIntegrationResponse, aI as TwilioIntegrationStatus, aJ as UpdateAutomationParams, aK as UpdateDomainParams, aL as UpdateEmailParams, aM as UpdateTemplateParams, aN as UpdateWebhookParams, aO as VerifyDomainResult, aP as WebhookEndpoint, aQ as WebhookEndpointWithSecret, aR as WebhookEventType, aS as mergeMigrations } from './client-CWIVF1eb.js';
|
|
3
3
|
|
|
4
4
|
type GroundmailErrorOptions = {
|
|
5
5
|
code?: string;
|
package/dist/index.js
CHANGED
|
@@ -4,16 +4,18 @@ import {
|
|
|
4
4
|
GroundmailError,
|
|
5
5
|
applyDnsRecords,
|
|
6
6
|
buildSignatureHeader,
|
|
7
|
+
mergeMigrations,
|
|
7
8
|
mergeSpfInclude,
|
|
8
9
|
signWebhookPayload,
|
|
9
10
|
verifyWebhookSignature
|
|
10
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-LKMNSXA3.js";
|
|
11
12
|
export {
|
|
12
13
|
DEFAULT_API_BASE_URL,
|
|
13
14
|
Groundmail,
|
|
14
15
|
GroundmailError,
|
|
15
16
|
applyDnsRecords,
|
|
16
17
|
buildSignatureHeader,
|
|
18
|
+
mergeMigrations,
|
|
17
19
|
mergeSpfInclude,
|
|
18
20
|
signWebhookPayload,
|
|
19
21
|
verifyWebhookSignature
|
package/dist/payload.d.ts
CHANGED
package/dist/payload.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "groundmail",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.6",
|
|
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.14.
|
|
92
|
+
"groundmail-nodemailer": "0.14.6"
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
95
|
"@types/nodemailer": "^8.0.1",
|