@drawbridge/drawbridge-utils 0.0.166 → 0.0.168
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/connections/index.cjs +4 -14
- package/dist/connections/index.d.cts +4 -19
- package/dist/connections/index.d.ts +4 -19
- package/dist/connections/index.js +4 -14
- package/dist/plans.cjs +4 -4
- package/dist/plans.d.cts +4 -4
- package/dist/plans.d.ts +4 -4
- package/dist/plans.js +4 -4
- package/dist/pricing.cjs +4 -4
- package/dist/pricing.js +4 -4
- package/dist/providers.cjs +4 -14
- package/dist/providers.js +4 -14
- package/dist/sendgrid.cjs +19 -6
- package/dist/sendgrid.d.cts +23 -6
- package/dist/sendgrid.d.ts +23 -6
- package/dist/sendgrid.js +19 -6
- package/package.json +1 -1
|
@@ -1614,10 +1614,10 @@ var free = {
|
|
|
1614
1614
|
};
|
|
1615
1615
|
var plans = {
|
|
1616
1616
|
DB00002: {
|
|
1617
|
-
// A verified sending domain is a PAID capability
|
|
1618
|
-
// lead-facing email
|
|
1619
|
-
//
|
|
1620
|
-
//
|
|
1617
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
1618
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
1619
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
1620
|
+
// domain is what the paid tiers add on top.
|
|
1621
1621
|
features: all.features([organization.networking.key, organization.members.key]),
|
|
1622
1622
|
limits: all.limits({ actions: 5e3, members: 3, storage: gigabyte * 10 }),
|
|
1623
1623
|
marketing: {
|
|
@@ -2221,16 +2221,6 @@ var drawbridge_default2 = {
|
|
|
2221
2221
|
const request2 = { to };
|
|
2222
2222
|
const { ok: sendable } = await canSend({ channel: "email", to });
|
|
2223
2223
|
if (!sendable) return { message: "Recipient has opted out \u2014 skipped.", request: request2, response: { skipped: true }, skipped: true };
|
|
2224
|
-
const organization2 = await read.get({ collection: "organization", query: { id: workflow.organization } });
|
|
2225
|
-
const subscription = (organization2 == null ? void 0 : organization2.subscription) ? await read.get({ collection: "subscription", query: { id: organization2.subscription } }) : null;
|
|
2226
|
-
if ((subscription == null ? void 0 : subscription.status) !== "active") {
|
|
2227
|
-
return {
|
|
2228
|
-
message: "Organization has no active subscription \u2014 workflow-step email skipped.",
|
|
2229
|
-
request: request2,
|
|
2230
|
-
response: { skipped: true },
|
|
2231
|
-
skipped: true
|
|
2232
|
-
};
|
|
2233
|
-
}
|
|
2234
2224
|
return {
|
|
2235
2225
|
message: "Email queued for delivery to " + to + ".",
|
|
2236
2226
|
request: request2,
|
|
@@ -2397,25 +2397,10 @@ var drawbridge = {
|
|
|
2397
2397
|
|
|
2398
2398
|
if( ! sendable ) return { message : 'Recipient has opted out — skipped.', request, response : { skipped : true }, skipped : true };
|
|
2399
2399
|
|
|
2400
|
-
//
|
|
2401
|
-
//
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
const subscription = organization?.subscription
|
|
2405
|
-
? await read.get({ collection : 'subscription', query : { id : organization.subscription } })
|
|
2406
|
-
: null;
|
|
2407
|
-
|
|
2408
|
-
if( subscription?.status !== 'active' ){
|
|
2409
|
-
|
|
2410
|
-
return {
|
|
2411
|
-
message : 'Organization has no active subscription — workflow-step email skipped.',
|
|
2412
|
-
request,
|
|
2413
|
-
response : { skipped : true },
|
|
2414
|
-
skipped : true
|
|
2415
|
-
};
|
|
2416
|
-
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2400
|
+
// NO SUBSCRIPTION CHECK. The send is billed as an action, so the plan's
|
|
2401
|
+
// allowance is the entitlement and a free organization sends within its
|
|
2402
|
+
// 200 like any other. Entries stop at the free cap before a workflow
|
|
2403
|
+
// can fire on them, which is where the cap is enforced.
|
|
2419
2404
|
return {
|
|
2420
2405
|
message : 'Email queued for delivery to ' + to + '.',
|
|
2421
2406
|
request,
|
|
@@ -2397,25 +2397,10 @@ var drawbridge = {
|
|
|
2397
2397
|
|
|
2398
2398
|
if( ! sendable ) return { message : 'Recipient has opted out — skipped.', request, response : { skipped : true }, skipped : true };
|
|
2399
2399
|
|
|
2400
|
-
//
|
|
2401
|
-
//
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
const subscription = organization?.subscription
|
|
2405
|
-
? await read.get({ collection : 'subscription', query : { id : organization.subscription } })
|
|
2406
|
-
: null;
|
|
2407
|
-
|
|
2408
|
-
if( subscription?.status !== 'active' ){
|
|
2409
|
-
|
|
2410
|
-
return {
|
|
2411
|
-
message : 'Organization has no active subscription — workflow-step email skipped.',
|
|
2412
|
-
request,
|
|
2413
|
-
response : { skipped : true },
|
|
2414
|
-
skipped : true
|
|
2415
|
-
};
|
|
2416
|
-
|
|
2417
|
-
}
|
|
2418
|
-
|
|
2400
|
+
// NO SUBSCRIPTION CHECK. The send is billed as an action, so the plan's
|
|
2401
|
+
// allowance is the entitlement and a free organization sends within its
|
|
2402
|
+
// 200 like any other. Entries stop at the free cap before a workflow
|
|
2403
|
+
// can fire on them, which is where the cap is enforced.
|
|
2419
2404
|
return {
|
|
2420
2405
|
message : 'Email queued for delivery to ' + to + '.',
|
|
2421
2406
|
request,
|
|
@@ -1538,10 +1538,10 @@ var free = {
|
|
|
1538
1538
|
};
|
|
1539
1539
|
var plans = {
|
|
1540
1540
|
DB00002: {
|
|
1541
|
-
// A verified sending domain is a PAID capability
|
|
1542
|
-
// lead-facing email
|
|
1543
|
-
//
|
|
1544
|
-
//
|
|
1541
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
1542
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
1543
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
1544
|
+
// domain is what the paid tiers add on top.
|
|
1545
1545
|
features: all.features([organization.networking.key, organization.members.key]),
|
|
1546
1546
|
limits: all.limits({ actions: 5e3, members: 3, storage: gigabyte * 10 }),
|
|
1547
1547
|
marketing: {
|
|
@@ -2145,16 +2145,6 @@ var drawbridge_default2 = {
|
|
|
2145
2145
|
const request2 = { to };
|
|
2146
2146
|
const { ok: sendable } = await canSend({ channel: "email", to });
|
|
2147
2147
|
if (!sendable) return { message: "Recipient has opted out \u2014 skipped.", request: request2, response: { skipped: true }, skipped: true };
|
|
2148
|
-
const organization2 = await read.get({ collection: "organization", query: { id: workflow.organization } });
|
|
2149
|
-
const subscription = (organization2 == null ? void 0 : organization2.subscription) ? await read.get({ collection: "subscription", query: { id: organization2.subscription } }) : null;
|
|
2150
|
-
if ((subscription == null ? void 0 : subscription.status) !== "active") {
|
|
2151
|
-
return {
|
|
2152
|
-
message: "Organization has no active subscription \u2014 workflow-step email skipped.",
|
|
2153
|
-
request: request2,
|
|
2154
|
-
response: { skipped: true },
|
|
2155
|
-
skipped: true
|
|
2156
|
-
};
|
|
2157
|
-
}
|
|
2158
2148
|
return {
|
|
2159
2149
|
message: "Email queued for delivery to " + to + ".",
|
|
2160
2150
|
request: request2,
|
package/dist/plans.cjs
CHANGED
|
@@ -360,10 +360,10 @@ var free = {
|
|
|
360
360
|
};
|
|
361
361
|
var plans = {
|
|
362
362
|
DB00002: {
|
|
363
|
-
// A verified sending domain is a PAID capability
|
|
364
|
-
// lead-facing email
|
|
365
|
-
//
|
|
366
|
-
//
|
|
363
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
364
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
365
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
366
|
+
// domain is what the paid tiers add on top.
|
|
367
367
|
features: all.features([organization.networking.key, organization.members.key]),
|
|
368
368
|
limits: all.limits({ actions: 5e3, members: 3, storage: gigabyte * 10 }),
|
|
369
369
|
marketing: {
|
package/dist/plans.d.cts
CHANGED
|
@@ -121,10 +121,10 @@ const free = {
|
|
|
121
121
|
|
|
122
122
|
const plans = {
|
|
123
123
|
DB00002 : {
|
|
124
|
-
// A verified sending domain is a PAID capability
|
|
125
|
-
// lead-facing email
|
|
126
|
-
//
|
|
127
|
-
//
|
|
124
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
125
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
126
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
127
|
+
// domain is what the paid tiers add on top.
|
|
128
128
|
features : all.features([ organization.networking.key, organization.members.key ]),
|
|
129
129
|
limits : all.limits({ actions : 5000, members : 3, storage : gigabyte * 10 }),
|
|
130
130
|
marketing : {
|
package/dist/plans.d.ts
CHANGED
|
@@ -121,10 +121,10 @@ const free = {
|
|
|
121
121
|
|
|
122
122
|
const plans = {
|
|
123
123
|
DB00002 : {
|
|
124
|
-
// A verified sending domain is a PAID capability
|
|
125
|
-
// lead-facing email
|
|
126
|
-
//
|
|
127
|
-
//
|
|
124
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
125
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
126
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
127
|
+
// domain is what the paid tiers add on top.
|
|
128
128
|
features : all.features([ organization.networking.key, organization.members.key ]),
|
|
129
129
|
limits : all.limits({ actions : 5000, members : 3, storage : gigabyte * 10 }),
|
|
130
130
|
marketing : {
|
package/dist/plans.js
CHANGED
|
@@ -321,10 +321,10 @@ var free = {
|
|
|
321
321
|
};
|
|
322
322
|
var plans = {
|
|
323
323
|
DB00002: {
|
|
324
|
-
// A verified sending domain is a PAID capability
|
|
325
|
-
// lead-facing email
|
|
326
|
-
//
|
|
327
|
-
//
|
|
324
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
325
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
326
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
327
|
+
// domain is what the paid tiers add on top.
|
|
328
328
|
features: all.features([organization.networking.key, organization.members.key]),
|
|
329
329
|
limits: all.limits({ actions: 5e3, members: 3, storage: gigabyte * 10 }),
|
|
330
330
|
marketing: {
|
package/dist/pricing.cjs
CHANGED
|
@@ -651,10 +651,10 @@ var free = {
|
|
|
651
651
|
};
|
|
652
652
|
var plans = {
|
|
653
653
|
DB00002: {
|
|
654
|
-
// A verified sending domain is a PAID capability
|
|
655
|
-
// lead-facing email
|
|
656
|
-
//
|
|
657
|
-
//
|
|
654
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
655
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
656
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
657
|
+
// domain is what the paid tiers add on top.
|
|
658
658
|
features: all.features([organization.networking.key, organization.members.key]),
|
|
659
659
|
limits: all.limits({ actions: 5e3, members: 3, storage: gigabyte * 10 }),
|
|
660
660
|
marketing: {
|
package/dist/pricing.js
CHANGED
|
@@ -599,10 +599,10 @@ var free = {
|
|
|
599
599
|
};
|
|
600
600
|
var plans = {
|
|
601
601
|
DB00002: {
|
|
602
|
-
// A verified sending domain is a PAID capability
|
|
603
|
-
// lead-facing email
|
|
604
|
-
//
|
|
605
|
-
//
|
|
602
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
603
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
604
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
605
|
+
// domain is what the paid tiers add on top.
|
|
606
606
|
features: all.features([organization.networking.key, organization.members.key]),
|
|
607
607
|
limits: all.limits({ actions: 5e3, members: 3, storage: gigabyte * 10 }),
|
|
608
608
|
marketing: {
|
package/dist/providers.cjs
CHANGED
|
@@ -1523,10 +1523,10 @@ var free = {
|
|
|
1523
1523
|
};
|
|
1524
1524
|
var plans = {
|
|
1525
1525
|
DB00002: {
|
|
1526
|
-
// A verified sending domain is a PAID capability
|
|
1527
|
-
// lead-facing email
|
|
1528
|
-
//
|
|
1529
|
-
//
|
|
1526
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
1527
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
1528
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
1529
|
+
// domain is what the paid tiers add on top.
|
|
1530
1530
|
features: all.features([organization.networking.key, organization.members.key]),
|
|
1531
1531
|
limits: all.limits({ actions: 5e3, members: 3, storage: gigabyte * 10 }),
|
|
1532
1532
|
marketing: {
|
|
@@ -2130,16 +2130,6 @@ var drawbridge_default2 = {
|
|
|
2130
2130
|
const request2 = { to };
|
|
2131
2131
|
const { ok: sendable } = await canSend({ channel: "email", to });
|
|
2132
2132
|
if (!sendable) return { message: "Recipient has opted out \u2014 skipped.", request: request2, response: { skipped: true }, skipped: true };
|
|
2133
|
-
const organization2 = await read.get({ collection: "organization", query: { id: workflow.organization } });
|
|
2134
|
-
const subscription = (organization2 == null ? void 0 : organization2.subscription) ? await read.get({ collection: "subscription", query: { id: organization2.subscription } }) : null;
|
|
2135
|
-
if ((subscription == null ? void 0 : subscription.status) !== "active") {
|
|
2136
|
-
return {
|
|
2137
|
-
message: "Organization has no active subscription \u2014 workflow-step email skipped.",
|
|
2138
|
-
request: request2,
|
|
2139
|
-
response: { skipped: true },
|
|
2140
|
-
skipped: true
|
|
2141
|
-
};
|
|
2142
|
-
}
|
|
2143
2133
|
return {
|
|
2144
2134
|
message: "Email queued for delivery to " + to + ".",
|
|
2145
2135
|
request: request2,
|
package/dist/providers.js
CHANGED
|
@@ -1474,10 +1474,10 @@ var free = {
|
|
|
1474
1474
|
};
|
|
1475
1475
|
var plans = {
|
|
1476
1476
|
DB00002: {
|
|
1477
|
-
// A verified sending domain is a PAID capability
|
|
1478
|
-
// lead-facing email
|
|
1479
|
-
//
|
|
1480
|
-
//
|
|
1477
|
+
// A verified sending domain is a PAID capability. Every plan sends
|
|
1478
|
+
// lead-facing email from the platform address — the send is billed as an
|
|
1479
|
+
// action, so the allowance is the entitlement — and sending from your own
|
|
1480
|
+
// domain is what the paid tiers add on top.
|
|
1481
1481
|
features: all.features([organization.networking.key, organization.members.key]),
|
|
1482
1482
|
limits: all.limits({ actions: 5e3, members: 3, storage: gigabyte * 10 }),
|
|
1483
1483
|
marketing: {
|
|
@@ -2081,16 +2081,6 @@ var drawbridge_default2 = {
|
|
|
2081
2081
|
const request2 = { to };
|
|
2082
2082
|
const { ok: sendable } = await canSend({ channel: "email", to });
|
|
2083
2083
|
if (!sendable) return { message: "Recipient has opted out \u2014 skipped.", request: request2, response: { skipped: true }, skipped: true };
|
|
2084
|
-
const organization2 = await read.get({ collection: "organization", query: { id: workflow.organization } });
|
|
2085
|
-
const subscription = (organization2 == null ? void 0 : organization2.subscription) ? await read.get({ collection: "subscription", query: { id: organization2.subscription } }) : null;
|
|
2086
|
-
if ((subscription == null ? void 0 : subscription.status) !== "active") {
|
|
2087
|
-
return {
|
|
2088
|
-
message: "Organization has no active subscription \u2014 workflow-step email skipped.",
|
|
2089
|
-
request: request2,
|
|
2090
|
-
response: { skipped: true },
|
|
2091
|
-
skipped: true
|
|
2092
|
-
};
|
|
2093
|
-
}
|
|
2094
2084
|
return {
|
|
2095
2085
|
message: "Email queued for delivery to " + to + ".",
|
|
2096
2086
|
request: request2,
|
package/dist/sendgrid.cjs
CHANGED
|
@@ -142,14 +142,27 @@ var domain = {
|
|
|
142
142
|
// Asks SendGrid to look the records up now. `records` carries per-record
|
|
143
143
|
// validity so a UI can say WHICH record has not landed rather than only that
|
|
144
144
|
// something has not; `valid` is the whole domain's verdict.
|
|
145
|
+
//
|
|
146
|
+
// TWO CALLS, because SendGrid splits the answer. POST …/validate is what
|
|
147
|
+
// makes it look DNS up now, and it answers per KEY with only `valid` and
|
|
148
|
+
// `reason` — no host, type or data (docs: validation_results.mail_cname /
|
|
149
|
+
// dkim1 / dkim2 / spf, each { valid, reason }). The rows themselves live on
|
|
150
|
+
// the domain, GET …/domains/:id, keyed the same way with host/type/data
|
|
151
|
+
// (and a `valid` of its own, which the validate verdict overrides). Feeding
|
|
152
|
+
// validation_results straight to dnsRows filtered every entry out for want
|
|
153
|
+
// of a host, so this returned `records : []` and no check ever updated a
|
|
154
|
+
// record — the verdicts on screen were the ones from registration.
|
|
145
155
|
validate: async ({ apiKey, reference, via = sendgridRequest }) => {
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
})
|
|
156
|
+
const path = "/v3/whitelabel/domains/" + encodeURIComponent(reference);
|
|
157
|
+
const result = await via({ apiKey, method: "POST", path: path + "/validate" });
|
|
158
|
+
const doc = await via({ apiKey, method: "GET", path });
|
|
159
|
+
const verdicts = (result == null ? void 0 : result.validation_results) || {};
|
|
160
|
+
const merged = Object.fromEntries(Object.entries((doc == null ? void 0 : doc.dns) || {}).map(([key, row]) => [
|
|
161
|
+
key,
|
|
162
|
+
{ ...row, ...verdicts[key] && { reason: verdicts[key].reason, valid: verdicts[key].valid } }
|
|
163
|
+
]));
|
|
151
164
|
return {
|
|
152
|
-
records: dnsRows(
|
|
165
|
+
records: dnsRows(merged),
|
|
153
166
|
valid: Boolean(result == null ? void 0 : result.valid)
|
|
154
167
|
};
|
|
155
168
|
}
|
package/dist/sendgrid.d.cts
CHANGED
|
@@ -169,16 +169,33 @@ const domain = {
|
|
|
169
169
|
// Asks SendGrid to look the records up now. `records` carries per-record
|
|
170
170
|
// validity so a UI can say WHICH record has not landed rather than only that
|
|
171
171
|
// something has not; `valid` is the whole domain's verdict.
|
|
172
|
+
//
|
|
173
|
+
// TWO CALLS, because SendGrid splits the answer. POST …/validate is what
|
|
174
|
+
// makes it look DNS up now, and it answers per KEY with only `valid` and
|
|
175
|
+
// `reason` — no host, type or data (docs: validation_results.mail_cname /
|
|
176
|
+
// dkim1 / dkim2 / spf, each { valid, reason }). The rows themselves live on
|
|
177
|
+
// the domain, GET …/domains/:id, keyed the same way with host/type/data
|
|
178
|
+
// (and a `valid` of its own, which the validate verdict overrides). Feeding
|
|
179
|
+
// validation_results straight to dnsRows filtered every entry out for want
|
|
180
|
+
// of a host, so this returned `records : []` and no check ever updated a
|
|
181
|
+
// record — the verdicts on screen were the ones from registration.
|
|
172
182
|
validate : async ({ apiKey, reference, via = sendgridRequest }) => {
|
|
173
183
|
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
const path = '/v3/whitelabel/domains/' + encodeURIComponent( reference );
|
|
185
|
+
|
|
186
|
+
const result = await via({ apiKey, method : 'POST', path : path + '/validate' });
|
|
187
|
+
const doc = await via({ apiKey, method : 'GET', path });
|
|
188
|
+
|
|
189
|
+
const verdicts = result?.validation_results || {};
|
|
190
|
+
|
|
191
|
+
// `spf` has a verdict but no row; the host/type filter in dnsRows drops it.
|
|
192
|
+
const merged = Object.fromEntries( Object.entries( doc?.dns || {} ).map( ( [ key, row ] ) => [
|
|
193
|
+
key,
|
|
194
|
+
{ ...row, ...( verdicts[ key ] && { reason : verdicts[ key ].reason, valid : verdicts[ key ].valid } ) }
|
|
195
|
+
] ) );
|
|
179
196
|
|
|
180
197
|
return {
|
|
181
|
-
records : dnsRows(
|
|
198
|
+
records : dnsRows( merged ),
|
|
182
199
|
valid : Boolean( result?.valid )
|
|
183
200
|
};
|
|
184
201
|
|
package/dist/sendgrid.d.ts
CHANGED
|
@@ -169,16 +169,33 @@ const domain = {
|
|
|
169
169
|
// Asks SendGrid to look the records up now. `records` carries per-record
|
|
170
170
|
// validity so a UI can say WHICH record has not landed rather than only that
|
|
171
171
|
// something has not; `valid` is the whole domain's verdict.
|
|
172
|
+
//
|
|
173
|
+
// TWO CALLS, because SendGrid splits the answer. POST …/validate is what
|
|
174
|
+
// makes it look DNS up now, and it answers per KEY with only `valid` and
|
|
175
|
+
// `reason` — no host, type or data (docs: validation_results.mail_cname /
|
|
176
|
+
// dkim1 / dkim2 / spf, each { valid, reason }). The rows themselves live on
|
|
177
|
+
// the domain, GET …/domains/:id, keyed the same way with host/type/data
|
|
178
|
+
// (and a `valid` of its own, which the validate verdict overrides). Feeding
|
|
179
|
+
// validation_results straight to dnsRows filtered every entry out for want
|
|
180
|
+
// of a host, so this returned `records : []` and no check ever updated a
|
|
181
|
+
// record — the verdicts on screen were the ones from registration.
|
|
172
182
|
validate : async ({ apiKey, reference, via = sendgridRequest }) => {
|
|
173
183
|
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
const path = '/v3/whitelabel/domains/' + encodeURIComponent( reference );
|
|
185
|
+
|
|
186
|
+
const result = await via({ apiKey, method : 'POST', path : path + '/validate' });
|
|
187
|
+
const doc = await via({ apiKey, method : 'GET', path });
|
|
188
|
+
|
|
189
|
+
const verdicts = result?.validation_results || {};
|
|
190
|
+
|
|
191
|
+
// `spf` has a verdict but no row; the host/type filter in dnsRows drops it.
|
|
192
|
+
const merged = Object.fromEntries( Object.entries( doc?.dns || {} ).map( ( [ key, row ] ) => [
|
|
193
|
+
key,
|
|
194
|
+
{ ...row, ...( verdicts[ key ] && { reason : verdicts[ key ].reason, valid : verdicts[ key ].valid } ) }
|
|
195
|
+
] ) );
|
|
179
196
|
|
|
180
197
|
return {
|
|
181
|
-
records : dnsRows(
|
|
198
|
+
records : dnsRows( merged ),
|
|
182
199
|
valid : Boolean( result?.valid )
|
|
183
200
|
};
|
|
184
201
|
|
package/dist/sendgrid.js
CHANGED
|
@@ -113,14 +113,27 @@ var domain = {
|
|
|
113
113
|
// Asks SendGrid to look the records up now. `records` carries per-record
|
|
114
114
|
// validity so a UI can say WHICH record has not landed rather than only that
|
|
115
115
|
// something has not; `valid` is the whole domain's verdict.
|
|
116
|
+
//
|
|
117
|
+
// TWO CALLS, because SendGrid splits the answer. POST …/validate is what
|
|
118
|
+
// makes it look DNS up now, and it answers per KEY with only `valid` and
|
|
119
|
+
// `reason` — no host, type or data (docs: validation_results.mail_cname /
|
|
120
|
+
// dkim1 / dkim2 / spf, each { valid, reason }). The rows themselves live on
|
|
121
|
+
// the domain, GET …/domains/:id, keyed the same way with host/type/data
|
|
122
|
+
// (and a `valid` of its own, which the validate verdict overrides). Feeding
|
|
123
|
+
// validation_results straight to dnsRows filtered every entry out for want
|
|
124
|
+
// of a host, so this returned `records : []` and no check ever updated a
|
|
125
|
+
// record — the verdicts on screen were the ones from registration.
|
|
116
126
|
validate: async ({ apiKey, reference, via = sendgridRequest }) => {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
})
|
|
127
|
+
const path = "/v3/whitelabel/domains/" + encodeURIComponent(reference);
|
|
128
|
+
const result = await via({ apiKey, method: "POST", path: path + "/validate" });
|
|
129
|
+
const doc = await via({ apiKey, method: "GET", path });
|
|
130
|
+
const verdicts = (result == null ? void 0 : result.validation_results) || {};
|
|
131
|
+
const merged = Object.fromEntries(Object.entries((doc == null ? void 0 : doc.dns) || {}).map(([key, row]) => [
|
|
132
|
+
key,
|
|
133
|
+
{ ...row, ...verdicts[key] && { reason: verdicts[key].reason, valid: verdicts[key].valid } }
|
|
134
|
+
]));
|
|
122
135
|
return {
|
|
123
|
-
records: dnsRows(
|
|
136
|
+
records: dnsRows(merged),
|
|
124
137
|
valid: Boolean(result == null ? void 0 : result.valid)
|
|
125
138
|
};
|
|
126
139
|
}
|
package/package.json
CHANGED