@theholocron/holocron-plugin-checkly 5.0.0-alpha.474 → 5.0.0-alpha.475

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 +26 -1
  2. package/package.json +5 -5
package/dist/index.mjs CHANGED
@@ -180,6 +180,16 @@ function result(h, alreadyExists) {
180
180
  };
181
181
  }
182
182
  // src/capabilities/status-pages.ts
183
+ /**
184
+ * Status pages for the Checkly `monitoring` capability (spec `tech-monitoring-dashboards-status-pages`, #2302).
185
+ *
186
+ * A page is found by its exact name and made if absent. Its components are upserted by name in the declared order; a
187
+ * component with a `group` sits under a `GROUP` component of that name (made if absent). A component holds no check: an
188
+ * automation rule ties them, so each component gets one rule, named like it, whose `tags` are the component's and whose
189
+ * `components` lists it with a full-outage impact. Nothing is ever deleted: a component, group or rule the config no
190
+ * longer lists is left alone and the doctor reports it. A field the config leaves out is left alone on an existing
191
+ * resource. With `automation: false` (a plan without automated incidents) no rule is read or made.
192
+ */
183
193
  /** What a failing check does to a component's status: the full outage (the spec's choice; a milder impact is later). */
184
194
  const IMPACT = "MAJOR_OUTAGE";
185
195
  /** The fields of a page that can be written back (Checkly rejects the read-only ones). */
@@ -208,6 +218,21 @@ function writable(page) {
208
218
  for (const key of PAGE_FIELDS) if (page[key] !== void 0) out[key] = page[key];
209
219
  return out;
210
220
  }
221
+ /**
222
+ * Update the page. The free plan refuses a body that carries `themeColors` (402, "Custom CSS ... is not part of your
223
+ * plan"), and the page holds its default colours there, so that one refusal is sent again without them. A plan that
224
+ * accepts the whole body is unaffected, and any other refusal is thrown.
225
+ */
226
+ async function putPage(api, id, body) {
227
+ try {
228
+ return await api.update(id, body);
229
+ } catch (err) {
230
+ if (!(err instanceof ProviderApiError && err.status === 402 && /css|theme/i.test(String(err.details))) || body.themeColors === void 0) throw err;
231
+ const without = { ...body };
232
+ delete without.themeColors;
233
+ return api.update(id, without);
234
+ }
235
+ }
211
236
  /** The page fields the config states, in Checkly's names. */
212
237
  function declaredFields(input) {
213
238
  return {
@@ -304,7 +329,7 @@ async function ensureStatusPage(client, input) {
304
329
  const have = writable(page);
305
330
  const changed = Object.keys(wanted).filter((k) => have[k] !== wanted[k]);
306
331
  if (changed.length > 0) {
307
- page = await api.update(page.id, {
332
+ page = await putPage(api, page.id, {
308
333
  ...have,
309
334
  ...wanted
310
335
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/holocron-plugin-checkly",
3
- "version": "5.0.0-alpha.474",
3
+ "version": "5.0.0-alpha.475",
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",
@@ -41,16 +41,16 @@
41
41
  "tsx": "4.23.15",
42
42
  "typescript": "^5.9.3",
43
43
  "vitest": "^5.1.0",
44
- "@theholocron/checkly-client": "^1.58.0-alpha.40",
45
- "@theholocron/cli": "5.0.0-alpha.474",
46
44
  "@theholocron/http-client": "^1.58.0-alpha.40",
45
+ "@theholocron/cli": "5.0.0-alpha.475",
47
46
  "@theholocron/tsconfig": "^8.9.0-alpha.20",
48
- "@theholocron/misc-utils": "^1.17.0-alpha.5"
47
+ "@theholocron/misc-utils": "^1.17.0-alpha.5",
48
+ "@theholocron/checkly-client": "^1.58.0-alpha.40"
49
49
  },
50
50
  "peerDependencies": {
51
51
  "@theholocron/checkly-client": "^1.55.0",
52
52
  "@theholocron/misc-utils": "^1.16.0",
53
- "@theholocron/cli": "5.0.0-alpha.474"
53
+ "@theholocron/cli": "5.0.0-alpha.475"
54
54
  },
55
55
  "engines": {
56
56
  "node": ">=22"