mailery 0.19.0 → 0.19.1

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/index.js CHANGED
@@ -3894,7 +3894,7 @@ async function runDnsblChecks(ctx, opts = {}) {
3894
3894
  let listedCount = 0;
3895
3895
  async function processPair(p) {
3896
3896
  const queryName = buildQueryName(p.target, p.targetKind, spamhausQueryHost(p.list.host, cfg.spamhausDqsKey));
3897
- const lookup2 = queryName ? await queryDnsbl(resolver, queryName) : { result: "error", returnCodes: [], errorMessage: "unsupported target format" };
3897
+ const lookup2 = queryName ? await queryDnsbl(resolver, queryName, p.list.host) : { result: "error", returnCodes: [], errorMessage: "unsupported target format" };
3898
3898
  if (lookup2.transient) return;
3899
3899
  if (lookup2.result === "listed") listedCount++;
3900
3900
  await ctx.collections.dnsblChecks.updateOne(
@@ -3955,10 +3955,10 @@ function buildQueryName(target, kind, listHost) {
3955
3955
  return `${domain}.${listHost}`;
3956
3956
  }
3957
3957
  var TRANSIENT_DNS_CODES = /* @__PURE__ */ new Set(["ESERVFAIL", "EREFUSED", "ETIMEOUT", "ETIMEDOUT", "ECONNRESET", "ECONNREFUSED"]);
3958
- async function queryDnsbl(resolver, query) {
3958
+ async function queryDnsbl(resolver, query, listHost) {
3959
3959
  try {
3960
3960
  const records = await resolver.resolve4(query);
3961
- return interpretRecords(records);
3961
+ return interpretRecords(records, listHost);
3962
3962
  } catch (err) {
3963
3963
  const code = err?.code;
3964
3964
  if (code === "ENOTFOUND" || code === "ENODATA") {
@@ -3984,10 +3984,17 @@ var REFUSAL_REASONS = {
3984
3984
  "127.255.255.254": "queried through a public or shared DNS resolver, which Spamhaus blocks. Set dnsbl.spamhausDqsKey (free Spamhaus DQS key) or use a private resolver",
3985
3985
  "127.255.255.255": "this resolver has exceeded the free query limit"
3986
3986
  };
3987
- function interpretRecords(records) {
3987
+ function interpretRecords(records, listHost) {
3988
3988
  if (!records || records.length === 0) {
3989
3989
  return { result: "clean", returnCodes: [], errorMessage: null };
3990
3990
  }
3991
+ if (listHost && REGISTRABLE_ONLY_LISTS.has(listHost) && records.every((r) => r === "127.0.0.1")) {
3992
+ return {
3993
+ result: "error",
3994
+ returnCodes: records,
3995
+ errorMessage: `${listHost} refused the query (127.0.0.1): queried through a public or shared DNS resolver, or over the free query limit. Use a private resolver`
3996
+ };
3997
+ }
3991
3998
  const errorish = records.filter((r) => r.startsWith("127.255.255."));
3992
3999
  if (errorish.length === records.length) {
3993
4000
  const reasons = [...new Set(records.map((r) => REFUSAL_REASONS[r] ?? "unrecognised refusal code"))];
@@ -9554,7 +9561,7 @@ function unitToMs2(value, unit) {
9554
9561
  }
9555
9562
 
9556
9563
  // src/server/api/agent.ts
9557
- var VERSION = "0.19.0" ;
9564
+ var VERSION = "0.19.1" ;
9558
9565
  var broadcastCountSchema = z.object({
9559
9566
  recipientCap: z.number().int().positive().max(1e7).nullable().optional()
9560
9567
  });
@@ -11621,7 +11628,7 @@ var DEDUPE_POLICIES = [
11621
11628
  ];
11622
11629
 
11623
11630
  // src/server/index.ts
11624
- var VERSION2 = "0.19.0" ;
11631
+ var VERSION2 = "0.19.1" ;
11625
11632
 
11626
11633
  export { DEDUPE_POLICIES, DEFAULT_BOT_UA_RE, FLOW_STEP_KINDS, FlowOperationError, MIN_AGENT_TOKEN_LENGTH, Mailer, MongoContactAdapter, NullProvider, PREDICATE_KINDS, RESERVED_VAR_KEYS, SEGMENT_FILTER_KINDS, SendGridProvider, TRACKING_SIG_LENGTH, VERSION2 as VERSION, applyTracking, applyWebhookEvent, armFlow, compileMailyTemplate, compileTemplate, computeDeliveryTime, createAdminApiRouter, createAdminRouter, createAgentRouter, createPublicRouter, defaultFlowStep, defaultPredicate, defaultSegmentFilter, defineVars, derivePlaintext, disarmFlow, dispatchSend, drainPendingUnsubscribes, ensureIndexes, gateFlow, getCollections, isCanaryGate, predicateKind, processNewlyFiredEventTriggers, processOneRunStep, referencedPaths, renderForContact, renderTemplate, runTick, sendgridInboundParser, sha256Hex, signTrackingToken, signUnsubscribeToken, simulateFlow, stampWatermarkIfNull, sweepStrandedFlowRuns, ungateFlow, validateSenderDomain, varsJsonSchema, verifyTemplate, verifyTrackingToken, verifyUnsubscribeToken };
11627
11634
  //# sourceMappingURL=index.js.map