@reddoorla/maintenance 0.40.0 → 0.41.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.
@@ -79,6 +79,7 @@ __export(websites_exports, {
79
79
  isDashboardVisible: () => isDashboardVisible,
80
80
  listWebsites: () => listWebsites,
81
81
  mapRow: () => mapRow,
82
+ parseNotifyRouting: () => parseNotifyRouting,
82
83
  siteSlug: () => siteSlug,
83
84
  updateA11yCounts: () => updateA11yCounts,
84
85
  updateAuditFields: () => updateAuditFields,
@@ -96,6 +97,28 @@ function trimToNull(raw) {
96
97
  const trimmed = raw.trim();
97
98
  return trimmed.length > 0 ? trimmed : null;
98
99
  }
100
+ function parseNotifyRouting(raw) {
101
+ if (typeof raw !== "string") return null;
102
+ const trimmed = raw.trim();
103
+ if (!trimmed) return null;
104
+ let parsed;
105
+ try {
106
+ parsed = JSON.parse(trimmed);
107
+ } catch {
108
+ return null;
109
+ }
110
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
111
+ const o = parsed;
112
+ if (typeof o.field !== "string" || !o.field.trim()) return null;
113
+ if (!o.routes || typeof o.routes !== "object" || Array.isArray(o.routes)) return null;
114
+ const routing = {
115
+ field: o.field,
116
+ routes: o.routes
117
+ };
118
+ if (o.default !== void 0) routing.default = o.default;
119
+ if (Array.isArray(o.cc)) routing.cc = o.cc.filter((x) => typeof x === "string");
120
+ return routing;
121
+ }
99
122
  function isDashboardVisible(site) {
100
123
  return site.status !== null && ACTIVE_STATUSES.has(site.status);
101
124
  }
@@ -138,6 +161,7 @@ function mapRow(rec) {
138
161
  copyFooter: trimToNull(f["Copy \u2014 Footer"]),
139
162
  launchedAt: f["Launched at"] ?? null,
140
163
  newsletterWebhook: trimToNull(f["Newsletter Webhook"]),
164
+ notifyRouting: parseNotifyRouting(f["Notify Routing"]),
141
165
  mailchimpApiKey: trimToNull(f["Mailchimp API Key"]),
142
166
  mailchimpAudienceId: trimToNull(f["Mailchimp Audience ID"]),
143
167
  renovateFailingCis: f["Renovate Failing CIs"] ?? null,