@marinoscar/platform-contract 0.1.0-next.19 → 0.1.0-next.21

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 (119) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +4 -0
  3. package/dist/cjs/alerts/constants.d.ts +195 -0
  4. package/dist/cjs/alerts/constants.d.ts.map +1 -0
  5. package/dist/cjs/alerts/constants.js +165 -0
  6. package/dist/cjs/alerts/constants.js.map +1 -0
  7. package/dist/cjs/alerts/enum.d.ts +5 -0
  8. package/dist/cjs/alerts/enum.d.ts.map +1 -0
  9. package/dist/cjs/alerts/enum.js +9 -0
  10. package/dist/cjs/alerts/enum.js.map +1 -0
  11. package/dist/cjs/alerts/index.d.ts +5 -0
  12. package/dist/cjs/alerts/index.d.ts.map +1 -0
  13. package/dist/cjs/alerts/index.js +68 -0
  14. package/dist/cjs/alerts/index.js.map +1 -0
  15. package/dist/cjs/alerts/schemas.d.ts +351 -0
  16. package/dist/cjs/alerts/schemas.d.ts.map +1 -0
  17. package/dist/cjs/alerts/schemas.js +432 -0
  18. package/dist/cjs/alerts/schemas.js.map +1 -0
  19. package/dist/cjs/nodes/admin-schemas.d.ts +85 -1
  20. package/dist/cjs/nodes/admin-schemas.d.ts.map +1 -1
  21. package/dist/cjs/nodes/admin-schemas.js +55 -1
  22. package/dist/cjs/nodes/admin-schemas.js.map +1 -1
  23. package/dist/cjs/nodes/constants.d.ts +12 -0
  24. package/dist/cjs/nodes/constants.d.ts.map +1 -1
  25. package/dist/cjs/nodes/constants.js +13 -1
  26. package/dist/cjs/nodes/constants.js.map +1 -1
  27. package/dist/cjs/nodes/index.d.ts +5 -5
  28. package/dist/cjs/nodes/index.d.ts.map +1 -1
  29. package/dist/cjs/nodes/index.js +14 -1
  30. package/dist/cjs/nodes/index.js.map +1 -1
  31. package/dist/cjs/nodes/schemas.d.ts +178 -0
  32. package/dist/cjs/nodes/schemas.d.ts.map +1 -1
  33. package/dist/cjs/nodes/schemas.js +149 -1
  34. package/dist/cjs/nodes/schemas.js.map +1 -1
  35. package/dist/cjs/telemetry/constants.d.ts.map +1 -1
  36. package/dist/cjs/telemetry/constants.js +6 -0
  37. package/dist/cjs/telemetry/constants.js.map +1 -1
  38. package/dist/cjs/telemetry/dashboard.d.ts +5 -5
  39. package/dist/cjs/telemetry/presentation.d.ts +5 -5
  40. package/dist/cjs/telemetry/stack.d.ts +2 -2
  41. package/dist/cjs/webhooks/constants.d.ts +154 -0
  42. package/dist/cjs/webhooks/constants.d.ts.map +1 -0
  43. package/dist/cjs/webhooks/constants.js +136 -0
  44. package/dist/cjs/webhooks/constants.js.map +1 -0
  45. package/dist/cjs/webhooks/enum.d.ts +5 -0
  46. package/dist/cjs/webhooks/enum.d.ts.map +1 -0
  47. package/dist/cjs/webhooks/enum.js +9 -0
  48. package/dist/cjs/webhooks/enum.js.map +1 -0
  49. package/dist/cjs/webhooks/index.d.ts +7 -0
  50. package/dist/cjs/webhooks/index.d.ts.map +1 -0
  51. package/dist/cjs/webhooks/index.js +48 -0
  52. package/dist/cjs/webhooks/index.js.map +1 -0
  53. package/dist/cjs/webhooks/schemas.d.ts +288 -0
  54. package/dist/cjs/webhooks/schemas.d.ts.map +1 -0
  55. package/dist/cjs/webhooks/schemas.js +295 -0
  56. package/dist/cjs/webhooks/schemas.js.map +1 -0
  57. package/dist/cjs/webhooks/signature.d.ts +54 -0
  58. package/dist/cjs/webhooks/signature.d.ts.map +1 -0
  59. package/dist/cjs/webhooks/signature.js +97 -0
  60. package/dist/cjs/webhooks/signature.js.map +1 -0
  61. package/dist/esm/alerts/constants.d.ts +195 -0
  62. package/dist/esm/alerts/constants.d.ts.map +1 -0
  63. package/dist/esm/alerts/constants.js +162 -0
  64. package/dist/esm/alerts/constants.js.map +1 -0
  65. package/dist/esm/alerts/enum.d.ts +5 -0
  66. package/dist/esm/alerts/enum.d.ts.map +1 -0
  67. package/dist/esm/alerts/enum.js +6 -0
  68. package/dist/esm/alerts/enum.js.map +1 -0
  69. package/dist/esm/alerts/index.d.ts +5 -0
  70. package/dist/esm/alerts/index.d.ts.map +1 -0
  71. package/dist/esm/alerts/index.js +8 -0
  72. package/dist/esm/alerts/index.js.map +1 -0
  73. package/dist/esm/alerts/schemas.d.ts +351 -0
  74. package/dist/esm/alerts/schemas.d.ts.map +1 -0
  75. package/dist/esm/alerts/schemas.js +429 -0
  76. package/dist/esm/alerts/schemas.js.map +1 -0
  77. package/dist/esm/nodes/admin-schemas.d.ts +85 -1
  78. package/dist/esm/nodes/admin-schemas.d.ts.map +1 -1
  79. package/dist/esm/nodes/admin-schemas.js +55 -1
  80. package/dist/esm/nodes/admin-schemas.js.map +1 -1
  81. package/dist/esm/nodes/constants.d.ts +12 -0
  82. package/dist/esm/nodes/constants.d.ts.map +1 -1
  83. package/dist/esm/nodes/constants.js +12 -0
  84. package/dist/esm/nodes/constants.js.map +1 -1
  85. package/dist/esm/nodes/index.d.ts +5 -5
  86. package/dist/esm/nodes/index.d.ts.map +1 -1
  87. package/dist/esm/nodes/index.js +3 -3
  88. package/dist/esm/nodes/index.js.map +1 -1
  89. package/dist/esm/nodes/schemas.d.ts +178 -0
  90. package/dist/esm/nodes/schemas.d.ts.map +1 -1
  91. package/dist/esm/nodes/schemas.js +149 -1
  92. package/dist/esm/nodes/schemas.js.map +1 -1
  93. package/dist/esm/telemetry/constants.d.ts.map +1 -1
  94. package/dist/esm/telemetry/constants.js +6 -0
  95. package/dist/esm/telemetry/constants.js.map +1 -1
  96. package/dist/esm/telemetry/dashboard.d.ts +5 -5
  97. package/dist/esm/telemetry/presentation.d.ts +5 -5
  98. package/dist/esm/telemetry/stack.d.ts +2 -2
  99. package/dist/esm/webhooks/constants.d.ts +154 -0
  100. package/dist/esm/webhooks/constants.d.ts.map +1 -0
  101. package/dist/esm/webhooks/constants.js +133 -0
  102. package/dist/esm/webhooks/constants.js.map +1 -0
  103. package/dist/esm/webhooks/enum.d.ts +5 -0
  104. package/dist/esm/webhooks/enum.d.ts.map +1 -0
  105. package/dist/esm/webhooks/enum.js +6 -0
  106. package/dist/esm/webhooks/enum.js.map +1 -0
  107. package/dist/esm/webhooks/index.d.ts +7 -0
  108. package/dist/esm/webhooks/index.d.ts.map +1 -0
  109. package/dist/esm/webhooks/index.js +8 -0
  110. package/dist/esm/webhooks/index.js.map +1 -0
  111. package/dist/esm/webhooks/schemas.d.ts +288 -0
  112. package/dist/esm/webhooks/schemas.d.ts.map +1 -0
  113. package/dist/esm/webhooks/schemas.js +292 -0
  114. package/dist/esm/webhooks/schemas.js.map +1 -0
  115. package/dist/esm/webhooks/signature.d.ts +54 -0
  116. package/dist/esm/webhooks/signature.d.ts.map +1 -0
  117. package/dist/esm/webhooks/signature.js +93 -0
  118. package/dist/esm/webhooks/signature.js.map +1 -0
  119. package/package.json +21 -1
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ // =============================================================================
3
+ // Webhook signing and verification (Standard Webhooks, scheme v1)
4
+ // =============================================================================
5
+ //
6
+ // HMAC-SHA256 over `${id}.${timestamp}.${body}` with the base64-decoded key of
7
+ // a `whsec_<base64>` secret. Web Crypto only (`globalThis.crypto.subtle`), so
8
+ // it runs in Node and in a browser. Zod-free.
9
+ // =============================================================================
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.signWebhookPayload = signWebhookPayload;
12
+ exports.verifyWebhookSignature = verifyWebhookSignature;
13
+ const constants_js_1 = require("./constants.js");
14
+ const encoder = new TextEncoder();
15
+ function base64ToBytes(value) {
16
+ const binary = atob(value);
17
+ const bytes = new Uint8Array(new ArrayBuffer(binary.length));
18
+ for (let i = 0; i < binary.length; i += 1)
19
+ bytes[i] = binary.charCodeAt(i);
20
+ return bytes;
21
+ }
22
+ function bytesToBase64(bytes) {
23
+ let binary = '';
24
+ for (const byte of bytes)
25
+ binary += String.fromCharCode(byte);
26
+ return btoa(binary);
27
+ }
28
+ async function hmac(secret, message) {
29
+ const raw = secret.startsWith(constants_js_1.WEBHOOK_SECRET_PREFIX) ? secret.slice(constants_js_1.WEBHOOK_SECRET_PREFIX.length) : secret;
30
+ const key = await globalThis.crypto.subtle.importKey('raw', base64ToBytes(raw), { name: 'HMAC', hash: 'SHA-256' }, false, ['sign']);
31
+ return new Uint8Array(await globalThis.crypto.subtle.sign('HMAC', key, encoder.encode(message)));
32
+ }
33
+ function timingSafeEqual(a, b) {
34
+ if (a.length !== b.length)
35
+ return false;
36
+ let diff = 0;
37
+ for (let i = 0; i < a.length; i += 1)
38
+ diff |= a[i] ^ b[i];
39
+ return diff === 0;
40
+ }
41
+ /**
42
+ * Sign a body. Returns one `webhook-signature` entry, `v1,<base64>`.
43
+ *
44
+ * @stability experimental
45
+ */
46
+ async function signWebhookPayload(input) {
47
+ const mac = await hmac(input.secret, `${input.id}.${input.timestamp}.${input.body}`);
48
+ return `${constants_js_1.WEBHOOK_SIGNATURE_VERSION},${bytesToBase64(mac)}`;
49
+ }
50
+ /**
51
+ * Verify a delivery. True when the timestamp is within the tolerance and any
52
+ * `v1` entry of the header matches a signature made with any given secret.
53
+ * Comparison is constant time. Never throws on malformed input.
54
+ *
55
+ * @stability experimental
56
+ */
57
+ async function verifyWebhookSignature(input) {
58
+ try {
59
+ const tolerance = input.toleranceSeconds ?? constants_js_1.WEBHOOK_DEFAULT_TOLERANCE_SECONDS;
60
+ const ts = Number(input.timestamp);
61
+ if (!Number.isFinite(ts))
62
+ return false;
63
+ const nowSeconds = (input.now ?? Date.now()) / 1000;
64
+ if (Math.abs(nowSeconds - ts) > tolerance)
65
+ return false;
66
+ const secrets = [...(input.secrets ?? []), ...(input.secret ? [input.secret] : [])];
67
+ if (secrets.length === 0)
68
+ return false;
69
+ const presented = [];
70
+ for (const entry of input.signatureHeader.split(' ')) {
71
+ const comma = entry.indexOf(',');
72
+ if (comma < 0 || entry.slice(0, comma) !== constants_js_1.WEBHOOK_SIGNATURE_VERSION)
73
+ continue;
74
+ try {
75
+ presented.push(base64ToBytes(entry.slice(comma + 1)));
76
+ }
77
+ catch {
78
+ // ignore a malformed entry
79
+ }
80
+ }
81
+ if (presented.length === 0)
82
+ return false;
83
+ let ok = false;
84
+ for (const secret of secrets) {
85
+ const expected = await hmac(secret, `${input.id}.${input.timestamp}.${input.body}`);
86
+ for (const candidate of presented) {
87
+ if (timingSafeEqual(expected, candidate))
88
+ ok = true;
89
+ }
90
+ }
91
+ return ok;
92
+ }
93
+ catch {
94
+ return false;
95
+ }
96
+ }
97
+ //# sourceMappingURL=signature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signature.js","sourceRoot":"","sources":["../../../src/webhooks/signature.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,kEAAkE;AAClE,gFAAgF;AAChF,EAAE;AACF,+EAA+E;AAC/E,8EAA8E;AAC9E,8CAA8C;AAC9C,gFAAgF;;AA+DhF,gDAGC;AAkCD,wDAkCC;AApID,iDAIwB;AAExB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7D,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC;QAAE,KAAK,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAC3E,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAC,KAAiB;IACtC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,MAAM,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC9D,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC;AAED,KAAK,UAAU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C,MAAM,CAAC;gBACP,2BAA2B;YAC7B,CAAC;QACH,CAAC;QACD,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QAEzC,IAAI,EAAE,GAAG,KAAK,CAAC;QACf,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;YAC7B,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YACpF,KAAK,MAAM,SAAS,IAAI,SAAS,EAAE,CAAC;gBAClC,IAAI,eAAe,CAAC,QAAQ,EAAE,SAAS,CAAC;oBAAE,EAAE,GAAG,IAAI,CAAC;YACtD,CAAC;QACH,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -0,0 +1,195 @@
1
+ /**
2
+ * The entries type `z.enum` builds for a list of values, named so the API
3
+ * reference shows one type instead of an anonymous object per property.
4
+ *
5
+ * @typeParam V - the values.
6
+ * @stability experimental
7
+ */
8
+ export type AlertEnumEntries<V extends string> = {
9
+ readonly [K in V]: K;
10
+ };
11
+ /**
12
+ * The permission strings the alerts routes enforce. Both are system
13
+ * permissions held by the `admin` role.
14
+ *
15
+ * @stability experimental
16
+ */
17
+ export declare const ALERT_PERMISSIONS: {
18
+ /** View rules, incidents and the summary. */
19
+ readonly READ: "alerts:read";
20
+ /** Create, edit, delete, test and acknowledge. */
21
+ readonly WRITE: "alerts:write";
22
+ };
23
+ /**
24
+ * How serious a rule's incidents are.
25
+ *
26
+ * @stability experimental
27
+ */
28
+ export declare const ALERT_SEVERITIES: readonly ["info", "warning", "critical"];
29
+ /**
30
+ * One alert severity.
31
+ *
32
+ * @stability experimental
33
+ */
34
+ export type AlertSeverity = (typeof ALERT_SEVERITIES)[number];
35
+ /**
36
+ * The lifecycle of one incident: `pending` (the condition holds but has not
37
+ * held for the rule's `forSeconds` yet), `firing` and `resolved`.
38
+ *
39
+ * @stability experimental
40
+ */
41
+ export declare const ALERT_INCIDENT_STATES: readonly ["pending", "firing", "resolved"];
42
+ /**
43
+ * One incident state.
44
+ *
45
+ * @stability experimental
46
+ */
47
+ export type AlertIncidentState = (typeof ALERT_INCIDENT_STATES)[number];
48
+ /**
49
+ * How a metric value is compared to the threshold.
50
+ *
51
+ * @stability experimental
52
+ */
53
+ export declare const ALERT_COMPARATORS: readonly ["gt", "gte", "lt", "lte", "eq", "neq"];
54
+ /**
55
+ * One comparator.
56
+ *
57
+ * @stability experimental
58
+ */
59
+ export type AlertComparator = (typeof ALERT_COMPARATORS)[number];
60
+ /**
61
+ * How a metric's points inside the window are reduced to one number. `rate`
62
+ * is the increase of a counter per MINUTE over the window.
63
+ *
64
+ * @stability experimental
65
+ */
66
+ export declare const ALERT_AGGREGATIONS: readonly ["avg", "max", "min", "sum", "last", "rate"];
67
+ /**
68
+ * One aggregation.
69
+ *
70
+ * @stability experimental
71
+ */
72
+ export type AlertAggregation = (typeof ALERT_AGGREGATIONS)[number];
73
+ /**
74
+ * The operators of a metric attribute filter.
75
+ *
76
+ * @stability experimental
77
+ */
78
+ export declare const ALERT_FILTER_OPS: readonly ["eq", "neq"];
79
+ /**
80
+ * One filter operator.
81
+ *
82
+ * @stability experimental
83
+ */
84
+ export type AlertFilterOp = (typeof ALERT_FILTER_OPS)[number];
85
+ /**
86
+ * The ids of the rule kinds the slice ships. The kind id on the wire is an
87
+ * OPEN string (an app adds its own with `registerAlertRuleKind`); these are
88
+ * only the ones the platform knows by name.
89
+ *
90
+ * @stability experimental
91
+ */
92
+ export declare const ALERT_KIND_IDS: {
93
+ /** An aggregate of one telemetry metric compared to a threshold. */
94
+ readonly METRIC_THRESHOLD: "metric_threshold";
95
+ /** A worker node reported a matching event. */
96
+ readonly NODE_EVENT: "node_event";
97
+ /** The telemetry dashboard verdict is at or past a level. */
98
+ readonly VERDICT: "verdict";
99
+ /** A worker node is stale or offline. */
100
+ readonly NODE_OFFLINE: "node_offline";
101
+ /** The telemetry store cannot be queried. */
102
+ readonly TELEMETRY_UNAVAILABLE: "telemetry_unavailable";
103
+ };
104
+ /**
105
+ * The stable keys of the starter rules the slice seeds (disabled).
106
+ *
107
+ * @stability experimental
108
+ */
109
+ export declare const ALERT_STARTER_RULE_KEYS: {
110
+ /** A node switched to battery. */
111
+ readonly NODES_ON_BATTERY: "nodes.on_battery";
112
+ /** A node reported a low or critical battery. */
113
+ readonly NODES_BATTERY_LOW: "nodes.battery_low";
114
+ /** A worker host CPU is high. */
115
+ readonly NODES_HOST_CPU_HIGH: "nodes.host_cpu_high";
116
+ /** A worker host has little memory available. */
117
+ readonly NODES_HOST_MEMORY_LOW: "nodes.host_memory_low";
118
+ /** A worker node is offline. */
119
+ readonly NODES_OFFLINE: "nodes.offline";
120
+ /** Jobs are failing faster than usual. */
121
+ readonly JOBS_FAILURE_SPIKE: "jobs.failure_spike";
122
+ /** The dashboard verdict is critical. */
123
+ readonly TELEMETRY_VERDICT_CRITICAL: "telemetry.verdict_critical";
124
+ /** The telemetry store cannot be queried. */
125
+ readonly TELEMETRY_UNAVAILABLE: "telemetry.unavailable";
126
+ };
127
+ /**
128
+ * The webhook event keys the slice emits through the optional webhook port.
129
+ *
130
+ * @stability experimental
131
+ */
132
+ export declare const ALERT_WEBHOOK_EVENTS: {
133
+ /** The event emitted when an alert fires. */
134
+ readonly FIRED: "alerts.alert.fired";
135
+ /** The event emitted when an alert resolves. */
136
+ readonly RESOLVED: "alerts.alert.resolved";
137
+ };
138
+ /**
139
+ * The refusal codes (`details.reason`) of the alerts routes.
140
+ *
141
+ * @stability experimental
142
+ */
143
+ export declare const ALERT_ERROR_CODES: {
144
+ /** No rule has this id (404). */
145
+ readonly RULE_NOT_FOUND: "ALERT_RULE_NOT_FOUND";
146
+ /** No incident has this id (404). */
147
+ readonly INCIDENT_NOT_FOUND: "ALERT_INCIDENT_NOT_FOUND";
148
+ /** The rule kind is not registered (400). */
149
+ readonly UNKNOWN_KIND: "ALERT_UNKNOWN_KIND";
150
+ /** The config does not match the kind (400). */
151
+ readonly INVALID_CONFIG: "ALERT_INVALID_CONFIG";
152
+ /** A starter rule cannot be deleted (409). */
153
+ readonly STARTER_RULE_PROTECTED: "ALERT_STARTER_RULE_PROTECTED";
154
+ };
155
+ /** Longest rule name. @stability experimental */
156
+ export declare const ALERT_NAME_MAX = 120;
157
+ /** Longest rule description. @stability experimental */
158
+ export declare const ALERT_DESCRIPTION_MAX = 500;
159
+ /** Longest incident summary. @stability experimental */
160
+ export declare const ALERT_SUMMARY_MAX = 500;
161
+ /** Longest rule key. @stability experimental */
162
+ export declare const ALERT_KEY_MAX = 64;
163
+ /** Longest kind id. @stability experimental */
164
+ export declare const ALERT_KIND_MAX = 32;
165
+ /** Most notification channels one rule names. @stability experimental */
166
+ export declare const ALERT_NOTIFY_CHANNELS_MAX = 8;
167
+ /** Longest `for` duration of a rule, in seconds (one day). @stability experimental */
168
+ export declare const ALERT_FOR_SECONDS_MAX = 86400;
169
+ /** Longest cooldown of a rule, in seconds (one week). @stability experimental */
170
+ export declare const ALERT_COOLDOWN_SECONDS_MAX = 604800;
171
+ /** Shortest metric window, in seconds. @stability experimental */
172
+ export declare const ALERT_WINDOW_SECONDS_MIN = 60;
173
+ /** Longest metric window, in seconds. @stability experimental */
174
+ export declare const ALERT_WINDOW_SECONDS_MAX = 86400;
175
+ /** Most group-by columns of a metric rule. @stability experimental */
176
+ export declare const ALERT_GROUP_BY_MAX = 3;
177
+ /** Most attribute filters of a metric rule. @stability experimental */
178
+ export declare const ALERT_FILTERS_MAX = 5;
179
+ /** Default seconds a `node_event` incident stays open without a recovery event. @stability experimental */
180
+ export declare const ALERT_NODE_EVENT_RESOLVE_AFTER_DEFAULT = 3600;
181
+ /** Default cooldown of a new rule, in seconds. @stability experimental */
182
+ export declare const ALERT_COOLDOWN_SECONDS_DEFAULT = 900;
183
+ /** Largest incident page. @stability experimental */
184
+ export declare const ALERT_PAGE_SIZE_MAX = 100;
185
+ /** Default incident page size. @stability experimental */
186
+ export declare const ALERT_PAGE_SIZE_DEFAULT = 20;
187
+ /** Metric name or table name accepted by `metric_threshold`. @stability experimental */
188
+ export declare const ALERT_METRIC_NAME_PATTERN: RegExp;
189
+ /** A telemetry attribute (column) identifier. @stability experimental */
190
+ export declare const ALERT_ATTRIBUTE_PATTERN: RegExp;
191
+ /** What a rule key looks like. @stability experimental */
192
+ export declare const ALERT_KEY_PATTERN: RegExp;
193
+ /** What a rule kind id looks like. @stability experimental */
194
+ export declare const ALERT_KIND_PATTERN: RegExp;
195
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/alerts/constants.ts"],"names":[],"mappings":"AAQA;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;IAAE,QAAQ,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC;CAAE,CAAC;AAE1E;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;IAC5B,6CAA6C;;IAE7C,kDAAkD;;CAE1C,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,0CAA2C,CAAC;AAEzE;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,4CAA6C,CAAC;AAEhF;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,kDAAmD,CAAC;AAElF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;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F,eAAO,MAAM,0BAA0B,SAAU,CAAC;AAClD,kEAAkE;AAClE,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,iEAAiE;AACjE,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAC/C,sEAAsE;AACtE,eAAO,MAAM,kBAAkB,IAAI,CAAC;AACpC,uEAAuE;AACvE,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,2GAA2G;AAC3G,eAAO,MAAM,sCAAsC,OAAQ,CAAC;AAC5D,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,MAAM,CAAC;AAClD,qDAAqD;AACrD,eAAO,MAAM,mBAAmB,MAAM,CAAC;AACvC,0DAA0D;AAC1D,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,wFAAwF;AACxF,eAAO,MAAM,yBAAyB,QAA6B,CAAC;AACpE,yEAAyE;AACzE,eAAO,MAAM,uBAAuB,QAAmC,CAAC;AACxE,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,QAAqC,CAAC;AACpE,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,QAAsB,CAAC"}
@@ -0,0 +1,162 @@
1
+ // =============================================================================
2
+ // The alerts slice's zod-free constants (issue #1047)
3
+ // =============================================================================
4
+ //
5
+ // Plain values and string-literal unions only (no zod), so a browser that needs
6
+ // a constant or a type never bundles zod (test/no-zod-in-constants.test.ts).
7
+ // =============================================================================
8
+ /**
9
+ * The permission strings the alerts routes enforce. Both are system
10
+ * permissions held by the `admin` role.
11
+ *
12
+ * @stability experimental
13
+ */
14
+ export const ALERT_PERMISSIONS = {
15
+ /** View rules, incidents and the summary. */
16
+ READ: 'alerts:read',
17
+ /** Create, edit, delete, test and acknowledge. */
18
+ WRITE: 'alerts:write',
19
+ };
20
+ /**
21
+ * How serious a rule's incidents are.
22
+ *
23
+ * @stability experimental
24
+ */
25
+ export const ALERT_SEVERITIES = ['info', 'warning', 'critical'];
26
+ /**
27
+ * The lifecycle of one incident: `pending` (the condition holds but has not
28
+ * held for the rule's `forSeconds` yet), `firing` and `resolved`.
29
+ *
30
+ * @stability experimental
31
+ */
32
+ export const ALERT_INCIDENT_STATES = ['pending', 'firing', 'resolved'];
33
+ /**
34
+ * How a metric value is compared to the threshold.
35
+ *
36
+ * @stability experimental
37
+ */
38
+ export const ALERT_COMPARATORS = ['gt', 'gte', 'lt', 'lte', 'eq', 'neq'];
39
+ /**
40
+ * How a metric's points inside the window are reduced to one number. `rate`
41
+ * is the increase of a counter per MINUTE over the window.
42
+ *
43
+ * @stability experimental
44
+ */
45
+ export const ALERT_AGGREGATIONS = ['avg', 'max', 'min', 'sum', 'last', 'rate'];
46
+ /**
47
+ * The operators of a metric attribute filter.
48
+ *
49
+ * @stability experimental
50
+ */
51
+ export const ALERT_FILTER_OPS = ['eq', 'neq'];
52
+ /**
53
+ * The ids of the rule kinds the slice ships. The kind id on the wire is an
54
+ * OPEN string (an app adds its own with `registerAlertRuleKind`); these are
55
+ * only the ones the platform knows by name.
56
+ *
57
+ * @stability experimental
58
+ */
59
+ export const ALERT_KIND_IDS = {
60
+ /** An aggregate of one telemetry metric compared to a threshold. */
61
+ METRIC_THRESHOLD: 'metric_threshold',
62
+ /** A worker node reported a matching event. */
63
+ NODE_EVENT: 'node_event',
64
+ /** The telemetry dashboard verdict is at or past a level. */
65
+ VERDICT: 'verdict',
66
+ /** A worker node is stale or offline. */
67
+ NODE_OFFLINE: 'node_offline',
68
+ /** The telemetry store cannot be queried. */
69
+ TELEMETRY_UNAVAILABLE: 'telemetry_unavailable',
70
+ };
71
+ /**
72
+ * The stable keys of the starter rules the slice seeds (disabled).
73
+ *
74
+ * @stability experimental
75
+ */
76
+ export const ALERT_STARTER_RULE_KEYS = {
77
+ /** A node switched to battery. */
78
+ NODES_ON_BATTERY: 'nodes.on_battery',
79
+ /** A node reported a low or critical battery. */
80
+ NODES_BATTERY_LOW: 'nodes.battery_low',
81
+ /** A worker host CPU is high. */
82
+ NODES_HOST_CPU_HIGH: 'nodes.host_cpu_high',
83
+ /** A worker host has little memory available. */
84
+ NODES_HOST_MEMORY_LOW: 'nodes.host_memory_low',
85
+ /** A worker node is offline. */
86
+ NODES_OFFLINE: 'nodes.offline',
87
+ /** Jobs are failing faster than usual. */
88
+ JOBS_FAILURE_SPIKE: 'jobs.failure_spike',
89
+ /** The dashboard verdict is critical. */
90
+ TELEMETRY_VERDICT_CRITICAL: 'telemetry.verdict_critical',
91
+ /** The telemetry store cannot be queried. */
92
+ TELEMETRY_UNAVAILABLE: 'telemetry.unavailable',
93
+ };
94
+ /**
95
+ * The webhook event keys the slice emits through the optional webhook port.
96
+ *
97
+ * @stability experimental
98
+ */
99
+ export const ALERT_WEBHOOK_EVENTS = {
100
+ /** The event emitted when an alert fires. */
101
+ FIRED: 'alerts.alert.fired',
102
+ /** The event emitted when an alert resolves. */
103
+ RESOLVED: 'alerts.alert.resolved',
104
+ };
105
+ /**
106
+ * The refusal codes (`details.reason`) of the alerts routes.
107
+ *
108
+ * @stability experimental
109
+ */
110
+ export const ALERT_ERROR_CODES = {
111
+ /** No rule has this id (404). */
112
+ RULE_NOT_FOUND: 'ALERT_RULE_NOT_FOUND',
113
+ /** No incident has this id (404). */
114
+ INCIDENT_NOT_FOUND: 'ALERT_INCIDENT_NOT_FOUND',
115
+ /** The rule kind is not registered (400). */
116
+ UNKNOWN_KIND: 'ALERT_UNKNOWN_KIND',
117
+ /** The config does not match the kind (400). */
118
+ INVALID_CONFIG: 'ALERT_INVALID_CONFIG',
119
+ /** A starter rule cannot be deleted (409). */
120
+ STARTER_RULE_PROTECTED: 'ALERT_STARTER_RULE_PROTECTED',
121
+ };
122
+ /** Longest rule name. @stability experimental */
123
+ export const ALERT_NAME_MAX = 120;
124
+ /** Longest rule description. @stability experimental */
125
+ export const ALERT_DESCRIPTION_MAX = 500;
126
+ /** Longest incident summary. @stability experimental */
127
+ export const ALERT_SUMMARY_MAX = 500;
128
+ /** Longest rule key. @stability experimental */
129
+ export const ALERT_KEY_MAX = 64;
130
+ /** Longest kind id. @stability experimental */
131
+ export const ALERT_KIND_MAX = 32;
132
+ /** Most notification channels one rule names. @stability experimental */
133
+ export const ALERT_NOTIFY_CHANNELS_MAX = 8;
134
+ /** Longest `for` duration of a rule, in seconds (one day). @stability experimental */
135
+ export const ALERT_FOR_SECONDS_MAX = 86_400;
136
+ /** Longest cooldown of a rule, in seconds (one week). @stability experimental */
137
+ export const ALERT_COOLDOWN_SECONDS_MAX = 604_800;
138
+ /** Shortest metric window, in seconds. @stability experimental */
139
+ export const ALERT_WINDOW_SECONDS_MIN = 60;
140
+ /** Longest metric window, in seconds. @stability experimental */
141
+ export const ALERT_WINDOW_SECONDS_MAX = 86_400;
142
+ /** Most group-by columns of a metric rule. @stability experimental */
143
+ export const ALERT_GROUP_BY_MAX = 3;
144
+ /** Most attribute filters of a metric rule. @stability experimental */
145
+ export const ALERT_FILTERS_MAX = 5;
146
+ /** Default seconds a `node_event` incident stays open without a recovery event. @stability experimental */
147
+ export const ALERT_NODE_EVENT_RESOLVE_AFTER_DEFAULT = 3_600;
148
+ /** Default cooldown of a new rule, in seconds. @stability experimental */
149
+ export const ALERT_COOLDOWN_SECONDS_DEFAULT = 900;
150
+ /** Largest incident page. @stability experimental */
151
+ export const ALERT_PAGE_SIZE_MAX = 100;
152
+ /** Default incident page size. @stability experimental */
153
+ export const ALERT_PAGE_SIZE_DEFAULT = 20;
154
+ /** Metric name or table name accepted by `metric_threshold`. @stability experimental */
155
+ export const ALERT_METRIC_NAME_PATTERN = /^[a-z][a-z0-9_.]{0,127}$/;
156
+ /** A telemetry attribute (column) identifier. @stability experimental */
157
+ export const ALERT_ATTRIBUTE_PATTERN = /^[A-Za-z_][A-Za-z0-9_.]{0,63}$/;
158
+ /** What a rule key looks like. @stability experimental */
159
+ export const ALERT_KEY_PATTERN = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)*$/;
160
+ /** What a rule kind id looks like. @stability experimental */
161
+ export const ALERT_KIND_PATTERN = /^[a-z][a-z0-9_]*$/;
162
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/alerts/constants.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,sDAAsD;AACtD,gFAAgF;AAChF,EAAE;AACF,gFAAgF;AAChF,6EAA6E;AAC7E,gFAAgF;AAWhF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,6CAA6C;IAC7C,IAAI,EAAE,aAAa;IACnB,kDAAkD;IAClD,KAAK,EAAE,cAAc;CACb,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAU,CAAC;AASzE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAU,CAAC;AAShF;;;;GAIG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAU,CAAC;AASlF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAU,CAAC;AASxF;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAI,EAAE,KAAK,CAAU,CAAC;AASvD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,oEAAoE;IACpE,gBAAgB,EAAE,kBAAkB;IACpC,+CAA+C;IAC/C,UAAU,EAAE,YAAY;IACxB,6DAA6D;IAC7D,OAAO,EAAE,SAAS;IAClB,yCAAyC;IACzC,YAAY,EAAE,cAAc;IAC5B,6CAA6C;IAC7C,qBAAqB,EAAE,uBAAuB;CACtC,CAAC;AAEX;;;;GAIG;AACH,MAAM,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C,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC5C,iFAAiF;AACjF,MAAM,CAAC,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAClD,kEAAkE;AAClE,MAAM,CAAC,MAAM,wBAAwB,GAAG,EAAE,CAAC;AAC3C,iEAAiE;AACjE,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC;AAC/C,sEAAsE;AACtE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC;AACpC,uEAAuE;AACvE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AACnC,2GAA2G;AAC3G,MAAM,CAAC,MAAM,sCAAsC,GAAG,KAAK,CAAC;AAC5D,0EAA0E;AAC1E,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAG,CAAC;AAClD,qDAAqD;AACrD,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAC;AACvC,0DAA0D;AAC1D,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,wFAAwF;AACxF,MAAM,CAAC,MAAM,yBAAyB,GAAG,0BAA0B,CAAC;AACpE,yEAAyE;AACzE,MAAM,CAAC,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AACxE,0DAA0D;AAC1D,MAAM,CAAC,MAAM,iBAAiB,GAAG,kCAAkC,CAAC;AACpE,8DAA8D;AAC9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod';
2
+ import type { AlertEnumEntries } from './constants.js';
3
+ /** `z.enum(values)`, typed as `ZodEnum<AlertEnumEntries<value>>` (a named entries type for the API reference). */
4
+ export declare function wireEnum<const T extends readonly [string, ...string[]]>(values: T): z.ZodEnum<AlertEnumEntries<T[number]>>;
5
+ //# sourceMappingURL=enum.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/alerts/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAEvD,kHAAkH;AAClH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAE1H"}
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod';
2
+ /** `z.enum(values)`, typed as `ZodEnum<AlertEnumEntries<value>>` (a named entries type for the API reference). */
3
+ export function wireEnum(values) {
4
+ return z.enum(values);
5
+ }
6
+ //# sourceMappingURL=enum.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/alerts/enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,kHAAkH;AAClH,MAAM,UAAU,QAAQ,CAAiD,MAAS;IAChF,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAsD,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { ALERT_AGGREGATIONS, ALERT_ATTRIBUTE_PATTERN, ALERT_COMPARATORS, ALERT_COOLDOWN_SECONDS_DEFAULT, ALERT_COOLDOWN_SECONDS_MAX, ALERT_DESCRIPTION_MAX, ALERT_ERROR_CODES, ALERT_FILTERS_MAX, ALERT_FILTER_OPS, ALERT_FOR_SECONDS_MAX, ALERT_GROUP_BY_MAX, ALERT_INCIDENT_STATES, ALERT_KEY_MAX, ALERT_KEY_PATTERN, ALERT_KIND_IDS, ALERT_KIND_MAX, ALERT_KIND_PATTERN, ALERT_METRIC_NAME_PATTERN, ALERT_NAME_MAX, ALERT_NODE_EVENT_RESOLVE_AFTER_DEFAULT, ALERT_NOTIFY_CHANNELS_MAX, ALERT_PAGE_SIZE_DEFAULT, ALERT_PAGE_SIZE_MAX, ALERT_PERMISSIONS, ALERT_SEVERITIES, ALERT_STARTER_RULE_KEYS, ALERT_SUMMARY_MAX, ALERT_WEBHOOK_EVENTS, ALERT_WINDOW_SECONDS_MAX, ALERT_WINDOW_SECONDS_MIN, } from './constants.js';
2
+ export type { AlertAggregation, AlertEnumEntries, AlertComparator, AlertFilterOp, AlertIncidentState, AlertSeverity, } from './constants.js';
3
+ export { alertAggregationSchema, alertComparatorSchema, alertEventAttrsSchema, alertIncidentListQuerySchema, alertIncidentListSchema, alertIncidentSchema, alertIncidentStateSchema, alertKindIdSchema, alertKindListSchema, alertKindSchema, alertMetricFilterSchema, alertObservationSchema, alertRuleKeySchema, alertRuleListQuerySchema, alertRuleListSchema, alertRuleSchema, alertRuleTestResponseSchema, alertSeveritySchema, alertSummarySchema, alertWebhookDataSchema, createAlertRuleSchema, emptyAlertConfigSchema, metricThresholdConfigSchema, nodeEventConfigSchema, updateAlertRuleSchema, verdictConfigSchema, } from './schemas.js';
4
+ export type { AlertIncident, AlertIncidentListQuery, AlertKind, AlertObservation, AlertRule, AlertRuleListQuery, AlertRuleTestResponse, AlertSummary, AlertWebhookData, CreateAlertRule, MetricThresholdConfig, NodeEventConfig, UpdateAlertRule, VerdictConfig, } from './schemas.js';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/alerts/index.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,8BAA8B,EAC9B,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,sCAAsC,EACtC,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EACV,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,aAAa,GACd,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,2BAA2B,EAC3B,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,aAAa,EACb,sBAAsB,EACtB,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,kBAAkB,EAClB,qBAAqB,EACrB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,aAAa,GACd,MAAM,cAAc,CAAC"}
@@ -0,0 +1,8 @@
1
+ // `@marinoscar/platform-contract/alerts`: the alerts slice's wire shapes
2
+ // (issue #1047): rules and the per-kind configs of the built-in kinds,
3
+ // incidents, the dry-run response, the kind catalog, the dashboard summary and
4
+ // the webhook event data. Documented in ./README.md. Explicit named exports
5
+ // only. constants.ts is zod-free.
6
+ export { ALERT_AGGREGATIONS, ALERT_ATTRIBUTE_PATTERN, ALERT_COMPARATORS, ALERT_COOLDOWN_SECONDS_DEFAULT, ALERT_COOLDOWN_SECONDS_MAX, ALERT_DESCRIPTION_MAX, ALERT_ERROR_CODES, ALERT_FILTERS_MAX, ALERT_FILTER_OPS, ALERT_FOR_SECONDS_MAX, ALERT_GROUP_BY_MAX, ALERT_INCIDENT_STATES, ALERT_KEY_MAX, ALERT_KEY_PATTERN, ALERT_KIND_IDS, ALERT_KIND_MAX, ALERT_KIND_PATTERN, ALERT_METRIC_NAME_PATTERN, ALERT_NAME_MAX, ALERT_NODE_EVENT_RESOLVE_AFTER_DEFAULT, ALERT_NOTIFY_CHANNELS_MAX, ALERT_PAGE_SIZE_DEFAULT, ALERT_PAGE_SIZE_MAX, ALERT_PERMISSIONS, ALERT_SEVERITIES, ALERT_STARTER_RULE_KEYS, ALERT_SUMMARY_MAX, ALERT_WEBHOOK_EVENTS, ALERT_WINDOW_SECONDS_MAX, ALERT_WINDOW_SECONDS_MIN, } from './constants.js';
7
+ export { alertAggregationSchema, alertComparatorSchema, alertEventAttrsSchema, alertIncidentListQuerySchema, alertIncidentListSchema, alertIncidentSchema, alertIncidentStateSchema, alertKindIdSchema, alertKindListSchema, alertKindSchema, alertMetricFilterSchema, alertObservationSchema, alertRuleKeySchema, alertRuleListQuerySchema, alertRuleListSchema, alertRuleSchema, alertRuleTestResponseSchema, alertSeveritySchema, alertSummarySchema, alertWebhookDataSchema, createAlertRuleSchema, emptyAlertConfigSchema, metricThresholdConfigSchema, nodeEventConfigSchema, updateAlertRuleSchema, verdictConfigSchema, } from './schemas.js';
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/alerts/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,uEAAuE;AACvE,+EAA+E;AAC/E,4EAA4E;AAC5E,kCAAkC;AAElC,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,8BAA8B,EAC9B,0BAA0B,EAC1B,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,yBAAyB,EACzB,cAAc,EACd,sCAAsC,EACtC,yBAAyB,EACzB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,gBAAgB,CAAC;AASxB,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,mBAAmB,EACnB,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,eAAe,EACf,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,2BAA2B,EAC3B,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,cAAc,CAAC"}