@theholocron/holocron-plugin-checkly 5.0.0-alpha.223 → 5.0.0-alpha.225

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.
Files changed (2) hide show
  1. package/dist/index.mjs +6 -2
  2. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -66,6 +66,8 @@ function toChecklyPayload(input) {
66
66
  }
67
67
  };
68
68
  }
69
+ /** Whether two templates are the same message, whatever the whitespace between the lines. */
70
+ const sameTemplate = (a, b) => (a ?? "").replace(/\s+/g, "") === b.replace(/\s+/g, "");
69
71
  var ChecklyMonitoring = class {
70
72
  client;
71
73
  key = "monitoring";
@@ -147,15 +149,16 @@ var ChecklyMonitoring = class {
147
149
  }
148
150
  const urlChanged = input.url !== void 0 && existing.config.url !== input.url;
149
151
  const formatChanged = existing.config.webhookType !== "WEBHOOK_DISCORD";
152
+ const templateChanged = !formatChanged && !sameTemplate(existing.config.template, DISCORD_TEMPLATE);
150
153
  let current;
151
- if (urlChanged || formatChanged) {
154
+ if (urlChanged || formatChanged || templateChanged) {
152
155
  const fresh = await client.alertChannels.get(existing.id);
153
156
  const replacement = {
154
157
  type: "WEBHOOK",
155
158
  config: {
156
159
  ...existing.config,
157
160
  ...urlChanged ? { url: input.url } : {},
158
- ...formatChanged ? {
161
+ ...formatChanged || templateChanged ? {
159
162
  webhookType: "WEBHOOK_DISCORD",
160
163
  template: DISCORD_TEMPLATE
161
164
  } : {}
@@ -183,6 +186,7 @@ var ChecklyMonitoring = class {
183
186
  updated: [
184
187
  ...urlChanged ? ["url"] : [],
185
188
  ...formatChanged ? ["format"] : [],
189
+ ...templateChanged ? ["template"] : [],
186
190
  ...added > 0 ? ["subscriptions"] : []
187
191
  ],
188
192
  subscribed: active
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-checkly",
3
- "version": "5.0.0-alpha.223",
3
+ "version": "5.0.0-alpha.225",
4
4
  "description": "Holocron plugin for Checkly. Implements the monitoring capability against Checkly's REST API, plus exports verifyToken + AUTH_HINT for `holocron auth`.",
5
5
  "keywords": [
6
6
  "checkly",
@@ -42,12 +42,12 @@
42
42
  "tsx": "4.23.15",
43
43
  "typescript": "^5.9.3",
44
44
  "vitest": "^4.1.11",
45
- "@theholocron/cli": "5.0.0-alpha.223"
45
+ "@theholocron/cli": "5.0.0-alpha.225"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "@theholocron/checkly-client": "^1.53.0",
49
49
  "@theholocron/misc-utils": "^1.16.0",
50
- "@theholocron/cli": "5.0.0-alpha.223"
50
+ "@theholocron/cli": "5.0.0-alpha.225"
51
51
  },
52
52
  "engines": {
53
53
  "node": ">=22"