@griffin-app/griffin-ts 0.1.15 → 0.1.16
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/builder.d.ts +2 -0
- package/dist/builder.d.ts.map +1 -1
- package/dist/builder.js +6 -2
- package/dist/builder.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/notifications.d.ts +61 -0
- package/dist/notifications.d.ts.map +1 -0
- package/dist/notifications.js +86 -0
- package/dist/notifications.js.map +1 -0
- package/dist/schema-exports.d.ts +1 -1
- package/dist/schema-exports.d.ts.map +1 -1
- package/dist/schema-exports.js +1 -1
- package/dist/schema-exports.js.map +1 -1
- package/dist/schema.d.ts +86 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +4 -0
- package/dist/schema.js.map +1 -1
- package/dist/sequential-builder.d.ts +2 -0
- package/dist/sequential-builder.d.ts.map +1 -1
- package/dist/sequential-builder.js +11 -3
- package/dist/sequential-builder.js.map +1 -1
- package/package.json +1 -1
- package/src/builder.ts +9 -2
- package/src/index.ts +6 -0
- package/src/notifications.ts +116 -0
- package/src/schema-exports.ts +1 -0
- package/src/schema.ts +9 -0
- package/src/sequential-builder.ts +14 -3
package/dist/builder.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Assertion, MonitorDSL, NodeDSL, Frequency, HttpRequestDSL, Wait, Assertions } from "./schema.js";
|
|
2
|
+
import type { MonitorNotification } from "./notifications.js";
|
|
2
3
|
import { type START as StartType, type END as EndType } from "./constants.js";
|
|
3
4
|
/**
|
|
4
5
|
* A node definition without the id field.
|
|
@@ -91,6 +92,7 @@ export declare function createGraphBuilder(config: {
|
|
|
91
92
|
name: string;
|
|
92
93
|
frequency: Frequency;
|
|
93
94
|
locations?: string[];
|
|
95
|
+
notifications?: MonitorNotification[];
|
|
94
96
|
}): TestBuilder;
|
|
95
97
|
/**
|
|
96
98
|
* Configuration for an HttpRequest node
|
package/dist/builder.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,UAAU,EACV,OAAO,EAEP,SAAS,EAGT,cAAc,EAEd,IAAI,EACJ,UAAU,EAEX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,KAAK,KAAK,IAAI,SAAS,EAAE,KAAK,GAAG,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE9E;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAEhD;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW,CAC1B,QAAQ,SAAS,MAAM,GAAG,KAAK,EAC/B,SAAS,SAAS,MAAM,GAAG,KAAK,EAChC,QAAQ,SAAS,MAAM,GAAG,KAAK;IAE/B;;;;;;;;;;;OAWG;IACH,OAAO,CAAC,IAAI,SAAS,MAAM,EACzB,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,aAAa,GAClB,WAAW,CAAC,QAAQ,GAAG,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;IAErD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,OAAO,CACL,IAAI,SAAS,SAAS,GAAG,OAAO,CAAC,QAAQ,EAAE,SAAS,CAAC,EACrD,EAAE,SAAS,OAAO,GAAG,OAAO,CAAC,QAAQ,EAAE,IAAI,CAAC,EAE5C,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,GACL,WAAW,CACZ,QAAQ,EACR,IAAI,SAAS,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,IAAI,EACrD,EAAE,SAAS,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,EAAE,CAC9C,CAAC;IAEF;;;;;;;;OAQG;IACH,KAAK,EAAE,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C,IAAI,EAAE,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACtC,eAAe,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,iBAAiB,GACxB,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAY5B;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAkB9E;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,IAAI,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAK7D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,CAKzE"}
|
package/dist/builder.js
CHANGED
|
@@ -23,11 +23,11 @@ class TestBuilderImpl {
|
|
|
23
23
|
return this;
|
|
24
24
|
}
|
|
25
25
|
get build() {
|
|
26
|
-
const { name, frequency, locations } = this.config;
|
|
26
|
+
const { name, frequency, locations, notifications } = this.config;
|
|
27
27
|
const nodes = this.nodes;
|
|
28
28
|
const edges = this.edges;
|
|
29
29
|
const buildFn = () => {
|
|
30
|
-
|
|
30
|
+
const result = {
|
|
31
31
|
name,
|
|
32
32
|
version: CURRENT_MONITOR_VERSION,
|
|
33
33
|
frequency,
|
|
@@ -35,6 +35,10 @@ class TestBuilderImpl {
|
|
|
35
35
|
nodes,
|
|
36
36
|
edges,
|
|
37
37
|
};
|
|
38
|
+
if (notifications !== undefined && notifications.length > 0) {
|
|
39
|
+
result.notifications = notifications;
|
|
40
|
+
}
|
|
41
|
+
return result;
|
|
38
42
|
};
|
|
39
43
|
// Type assertion: build is only callable when graph constraints are satisfied
|
|
40
44
|
// The conditional type in TestBuilder['build'] enforces this at the call site
|
package/dist/builder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,QAAQ,EAGR,uBAAuB,GACxB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"builder.js","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,QAAQ,EAGR,uBAAuB,GACxB,MAAM,aAAa,CAAC;AA8FrB;;;GAGG;AACH,MAAM,eAAe;IAST;IAJF,KAAK,GAAc,EAAE,CAAC;IACtB,KAAK,GAAW,EAAE,CAAC;IAE3B,YACU,MAKP;QALO,WAAM,GAAN,MAAM,CAKb;IACA,CAAC;IAEJ,OAAO,CACL,IAAU,EACV,IAAmB;QAEnB,yDAAyD;QACzD,4FAA4F;QAC5F,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,IAAI,EAAwB,CAAC,CAAC;QAC7D,qDAAqD;QACrD,OAAO,IAAoE,CAAC;IAC9E,CAAC;IAED,OAAO,CAIL,IAAU,EACV,EAAM;QAMN,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QAC9B,+EAA+E;QAC/E,OAAO,IAIN,CAAC;IACJ,CAAC;IAED,IAAI,KAAK;QACP,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC;QAClE,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACzB,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QAEzB,MAAM,OAA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QAAQ,CAAC;IAClB,CAAC;IACD,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,OAAO,GAAG,IAAI,CAAC;IACjC,CAAC;IACD,IAAI,SAAS,IAAI,QAAQ,EAAE,CAAC;QAC1B,OAAO,QAAQ,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC;IACtC,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,IAAI,CAAC,QAAsB;IACzC,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,WAAW,EAAE,cAAc,CAAC,QAAQ,CAAC;KACtC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,SAAS,CAAC,UAAuB;IAC/C,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,SAAS;QACxB,UAAU,EAAE,UAAU;KACvB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,9 @@ export { variable, isVariableRef } from "./variable.js";
|
|
|
16
16
|
export type { VariableRef } from "./variable.js";
|
|
17
17
|
export { secret, isSecretRef } from "./secrets.js";
|
|
18
18
|
export type { SecretOptions } from "./secrets.js";
|
|
19
|
+
export { notify } from "./notifications.js";
|
|
20
|
+
export { MonitorNotificationSchema } from "./notifications.js";
|
|
21
|
+
export type { NotificationTrigger, MonitorNotification, } from "./notifications.js";
|
|
19
22
|
export { START, END } from "./constants.js";
|
|
20
23
|
export type { START as StartType, END as EndType } from "./constants.js";
|
|
21
24
|
export { GET, POST, PUT, DELETE, PATCH } from "./http-methods.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,EAAE,kBA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,EACd,mBAAmB,EACnB,IAAI,EACJ,SAAS,IAAI,aAAa,EAC1B,SAAS,IAAI,aAAa,EAC1B,UAAU,IAAI,cAAc,EAC5B,SAAS,IAAI,aAAa,EAC1B,WAAW,IAAI,eAAe,GAC/B,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -20,6 +20,8 @@ export { Frequency } from "./frequency.js";
|
|
|
20
20
|
export { WaitDuration } from "./wait.js";
|
|
21
21
|
export { variable, isVariableRef } from "./variable.js";
|
|
22
22
|
export { secret, isSecretRef } from "./secrets.js";
|
|
23
|
+
export { notify } from "./notifications.js";
|
|
24
|
+
export { MonitorNotificationSchema } from "./notifications.js";
|
|
23
25
|
// ============================================================================
|
|
24
26
|
// DSL Constants
|
|
25
27
|
// ============================================================================
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAGlD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAM5D,+EAA+E;AAC/E,qBAAqB;AACrB,+EAA+E;AAE/E,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAM5D,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;G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,EACd,eAAe,EACf,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Type, type Static } from "typebox";
|
|
2
|
+
export declare const NotificationTriggerSchema: Type.TUnion<[Type.TObject<{
|
|
3
|
+
type: Type.TLiteral<"run_failed">;
|
|
4
|
+
}>, Type.TObject<{
|
|
5
|
+
type: Type.TLiteral<"run_recovered">;
|
|
6
|
+
}>, Type.TObject<{
|
|
7
|
+
type: Type.TLiteral<"consecutive_failures">;
|
|
8
|
+
threshold: Type.TNumber;
|
|
9
|
+
}>, Type.TObject<{
|
|
10
|
+
type: Type.TLiteral<"success_rate_below">;
|
|
11
|
+
threshold: Type.TNumber;
|
|
12
|
+
window_minutes: Type.TNumber;
|
|
13
|
+
}>, Type.TObject<{
|
|
14
|
+
type: Type.TLiteral<"latency_above">;
|
|
15
|
+
threshold_ms: Type.TNumber;
|
|
16
|
+
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
17
|
+
window_minutes: Type.TNumber;
|
|
18
|
+
}>]>;
|
|
19
|
+
export type NotificationTrigger = Static<typeof NotificationTriggerSchema>;
|
|
20
|
+
export declare const MonitorNotificationSchema: Type.TObject<{
|
|
21
|
+
trigger: Type.TUnion<[Type.TObject<{
|
|
22
|
+
type: Type.TLiteral<"run_failed">;
|
|
23
|
+
}>, Type.TObject<{
|
|
24
|
+
type: Type.TLiteral<"run_recovered">;
|
|
25
|
+
}>, Type.TObject<{
|
|
26
|
+
type: Type.TLiteral<"consecutive_failures">;
|
|
27
|
+
threshold: Type.TNumber;
|
|
28
|
+
}>, Type.TObject<{
|
|
29
|
+
type: Type.TLiteral<"success_rate_below">;
|
|
30
|
+
threshold: Type.TNumber;
|
|
31
|
+
window_minutes: Type.TNumber;
|
|
32
|
+
}>, Type.TObject<{
|
|
33
|
+
type: Type.TLiteral<"latency_above">;
|
|
34
|
+
threshold_ms: Type.TNumber;
|
|
35
|
+
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
36
|
+
window_minutes: Type.TNumber;
|
|
37
|
+
}>]>;
|
|
38
|
+
integration: Type.TString;
|
|
39
|
+
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
40
|
+
}>;
|
|
41
|
+
export type MonitorNotification = Static<typeof MonitorNotificationSchema>;
|
|
42
|
+
declare class NotificationBuilder {
|
|
43
|
+
private trigger;
|
|
44
|
+
private cooldownMinutes?;
|
|
45
|
+
constructor(trigger: NotificationTrigger);
|
|
46
|
+
withCooldown(minutes: number): this;
|
|
47
|
+
via(integrationName: string): MonitorNotification;
|
|
48
|
+
}
|
|
49
|
+
export declare const notify: {
|
|
50
|
+
onFailure: () => NotificationBuilder;
|
|
51
|
+
onRecovery: () => NotificationBuilder;
|
|
52
|
+
onConsecutiveFailures: (threshold: number) => NotificationBuilder;
|
|
53
|
+
onSuccessRateBelow: (threshold: number, window_minutes: number) => NotificationBuilder;
|
|
54
|
+
onLatencyAbove: (options: {
|
|
55
|
+
threshold_ms: number;
|
|
56
|
+
percentile: "p50" | "p95" | "p99";
|
|
57
|
+
window_minutes: number;
|
|
58
|
+
}) => NotificationBuilder;
|
|
59
|
+
};
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAM5C,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;IA0BJ,CAAC;AAEnC,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM3E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;EAOrC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM3E,cAAM,mBAAmB;IACvB,OAAO,CAAC,OAAO,CAAsB;IACrC,OAAO,CAAC,eAAe,CAAC,CAAS;gBAErB,OAAO,EAAE,mBAAmB;IAIxC,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAKnC,GAAG,CAAC,eAAe,EAAE,MAAM,GAAG,mBAAmB;CAUlD;AAMD,eAAO,MAAM,MAAM;;;uCAOkB,MAAM;oCAMT,MAAM,kBAAkB,MAAM;8BAOpC;QACxB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;QAClC,cAAc,EAAE,MAAM,CAAC;KACxB;CAOF,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Type } from "typebox";
|
|
2
|
+
// =============================================================================
|
|
3
|
+
// Trigger Types (matches hub NotificationTriggerSchema)
|
|
4
|
+
// =============================================================================
|
|
5
|
+
export const NotificationTriggerSchema = Type.Union([
|
|
6
|
+
Type.Object({
|
|
7
|
+
type: Type.Literal("run_failed"),
|
|
8
|
+
}),
|
|
9
|
+
Type.Object({
|
|
10
|
+
type: Type.Literal("run_recovered"),
|
|
11
|
+
}),
|
|
12
|
+
Type.Object({
|
|
13
|
+
type: Type.Literal("consecutive_failures"),
|
|
14
|
+
threshold: Type.Number({ minimum: 1 }),
|
|
15
|
+
}),
|
|
16
|
+
Type.Object({
|
|
17
|
+
type: Type.Literal("success_rate_below"),
|
|
18
|
+
threshold: Type.Number({ minimum: 0, maximum: 100 }),
|
|
19
|
+
window_minutes: Type.Number({ minimum: 1 }),
|
|
20
|
+
}),
|
|
21
|
+
Type.Object({
|
|
22
|
+
type: Type.Literal("latency_above"),
|
|
23
|
+
threshold_ms: Type.Number({ minimum: 0 }),
|
|
24
|
+
percentile: Type.Union([
|
|
25
|
+
Type.Literal("p50"),
|
|
26
|
+
Type.Literal("p95"),
|
|
27
|
+
Type.Literal("p99"),
|
|
28
|
+
]),
|
|
29
|
+
window_minutes: Type.Number({ minimum: 1 }),
|
|
30
|
+
}),
|
|
31
|
+
], { $id: "NotificationTrigger" });
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// Monitor Notification (DSL config: trigger + integration name)
|
|
34
|
+
// =============================================================================
|
|
35
|
+
export const MonitorNotificationSchema = Type.Object({
|
|
36
|
+
trigger: NotificationTriggerSchema,
|
|
37
|
+
integration: Type.String(),
|
|
38
|
+
cooldown_minutes: Type.Optional(Type.Number({ minimum: 0 })),
|
|
39
|
+
}, { $id: "MonitorNotification" });
|
|
40
|
+
// =============================================================================
|
|
41
|
+
// Notification Builder
|
|
42
|
+
// =============================================================================
|
|
43
|
+
class NotificationBuilder {
|
|
44
|
+
trigger;
|
|
45
|
+
cooldownMinutes;
|
|
46
|
+
constructor(trigger) {
|
|
47
|
+
this.trigger = trigger;
|
|
48
|
+
}
|
|
49
|
+
withCooldown(minutes) {
|
|
50
|
+
this.cooldownMinutes = minutes;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
via(integrationName) {
|
|
54
|
+
const result = {
|
|
55
|
+
trigger: this.trigger,
|
|
56
|
+
integration: integrationName,
|
|
57
|
+
};
|
|
58
|
+
if (this.cooldownMinutes !== undefined) {
|
|
59
|
+
result.cooldown_minutes = this.cooldownMinutes;
|
|
60
|
+
}
|
|
61
|
+
return result;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// =============================================================================
|
|
65
|
+
// notify API
|
|
66
|
+
// =============================================================================
|
|
67
|
+
export const notify = {
|
|
68
|
+
onFailure: () => new NotificationBuilder({ type: "run_failed" }),
|
|
69
|
+
onRecovery: () => new NotificationBuilder({ type: "run_recovered" }),
|
|
70
|
+
onConsecutiveFailures: (threshold) => new NotificationBuilder({
|
|
71
|
+
type: "consecutive_failures",
|
|
72
|
+
threshold,
|
|
73
|
+
}),
|
|
74
|
+
onSuccessRateBelow: (threshold, window_minutes) => new NotificationBuilder({
|
|
75
|
+
type: "success_rate_below",
|
|
76
|
+
threshold,
|
|
77
|
+
window_minutes,
|
|
78
|
+
}),
|
|
79
|
+
onLatencyAbove: (options) => new NotificationBuilder({
|
|
80
|
+
type: "latency_above",
|
|
81
|
+
threshold_ms: options.threshold_ms,
|
|
82
|
+
percentile: options.percentile,
|
|
83
|
+
window_minutes: options.window_minutes,
|
|
84
|
+
}),
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=notifications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notifications.js","sourceRoot":"","sources":["../src/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,SAAS,CAAC;AAE5C,gFAAgF;AAChF,wDAAwD;AACxD,gFAAgF;AAEhF,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC,KAAK,CAAC;IAClD,IAAI,CAAC,MAAM,CAAC;QACV,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;KACjC,CAAC;IACF,IAAI,CAAC,MAAM,CAAC;QACV,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC;KACpC,CAAC;IACF,IAAI,CAAC,MAAM,CAAC;QACV,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC;QAC1C,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;KACvC,CAAC;IACF,IAAI,CAAC,MAAM,CAAC;QACV,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC;QACxC,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;QACpD,cAAc,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;KAC5C,CAAC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C;QACF,IAAI,IAAI,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;YACvC,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,eAAe,CAAC;QACjD,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED,gFAAgF;AAChF,aAAa;AACb,gFAAgF;AAEhF,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,SAAS,EAAE,GAAG,EAAE,CACd,IAAI,mBAAmB,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAEjD,UAAU,EAAE,GAAG,EAAE,CACf,IAAI,mBAAmB,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC;IAEpD,qBAAqB,EAAE,CAAC,SAAiB,EAAE,EAAE,CAC3C,IAAI,mBAAmB,CAAC;QACtB,IAAI,EAAE,sBAAsB;QAC5B,SAAS;KACV,CAAC;IAEJ,kBAAkB,EAAE,CAAC,SAAiB,EAAE,cAAsB,EAAE,EAAE,CAChE,IAAI,mBAAmB,CAAC;QACtB,IAAI,EAAE,oBAAoB;QAC1B,SAAS;QACT,cAAc;KACf,CAAC;IAEJ,cAAc,EAAE,CAAC,OAIhB,EAAE,EAAE,CACH,IAAI,mBAAmB,CAAC;QACtB,IAAI,EAAE,eAAe;QACrB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,UAAU,EAAE,OAAO,CAAC,UAAU;QAC9B,cAAc,EAAE,OAAO,CAAC,cAAc;KACvC,CAAC;CACL,CAAC"}
|
package/dist/schema-exports.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* TypeBox schemas and enums for griffin test monitors.
|
|
3
3
|
* Import from "griffin/schema" to access validation schemas.
|
|
4
4
|
*/
|
|
5
|
-
export { SecretRefDataSchema, SecretRefSchema, StringLiteralSchema, VariableRefSchema, ResponseFormatSchema, HttpMethodSchema, HttpRequestDSLSchema, FrequencySchema, WaitSchema, JSONPathSchema, FrequencyUnitSchema, XMLPathSchema, TextPathSchema, UnaryPredicateSchema, UnaryPredicateOperatorSchema, BinaryPredicateOperatorSchema, BinaryPredicateSchema, AssertionSchema, AssertionsSchema, NodeDSLSchema, EdgeSchema, MonitorDSLSchema, MonitorDSLSchemaV1, ResolvedStringSchema, HttpRequestResolvedSchema, NodeResolvedSchema, ResolvedMonitorV1Schema, ResolvedMonitorSchema, FrequencyUnit, ResponseFormat, HttpMethod, NodeType, UnaryPredicate, BinaryPredicateOperator, CURRENT_MONITOR_VERSION, SUPPORTED_MONITOR_VERSIONS, } from "./schema.js";
|
|
5
|
+
export { SecretRefDataSchema, SecretRefSchema, StringLiteralSchema, VariableRefSchema, ResponseFormatSchema, HttpMethodSchema, HttpRequestDSLSchema, FrequencySchema, WaitSchema, JSONPathSchema, FrequencyUnitSchema, XMLPathSchema, TextPathSchema, UnaryPredicateSchema, UnaryPredicateOperatorSchema, BinaryPredicateOperatorSchema, BinaryPredicateSchema, AssertionSchema, AssertionsSchema, NodeDSLSchema, EdgeSchema, MonitorDSLSchema, MonitorDSLSchemaV1, MonitorNotificationSchema, ResolvedStringSchema, HttpRequestResolvedSchema, NodeResolvedSchema, ResolvedMonitorV1Schema, ResolvedMonitorSchema, FrequencyUnit, ResponseFormat, HttpMethod, NodeType, UnaryPredicate, BinaryPredicateOperator, CURRENT_MONITOR_VERSION, SUPPORTED_MONITOR_VERSIONS, } from "./schema.js";
|
|
6
6
|
export type { MonitorDSL, MonitorDSLV1, NodeDSL, HttpRequestDSL, Edge, Frequency, Assertion, Assertions, SecretRef, VariableRef, ResolvedMonitor, ResolvedMonitorV1, NodeResolved, HttpRequestResolved, } from "./schema.js";
|
|
7
7
|
//# sourceMappingURL=schema-exports.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-exports.d.ts","sourceRoot":"","sources":["../src/schema-exports.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,4BAA4B,EAC5B,6BAA6B,EAC7B,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,kBAAkB,
|
|
1
|
+
{"version":3,"file":"schema-exports.d.ts","sourceRoot":"","sources":["../src/schema-exports.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEL,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,4BAA4B,EAC5B,6BAA6B,EAC7B,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB,EAGzB,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EAGrB,aAAa,EACb,cAAc,EACd,UAAU,EACV,QAAQ,EACR,cAAc,EACd,uBAAuB,EAGvB,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AAGrB,YAAY,EACV,UAAU,EACV,YAAY,EACZ,OAAO,EACP,cAAc,EACd,IAAI,EACJ,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,mBAAmB,GACpB,MAAM,aAAa,CAAC"}
|
package/dist/schema-exports.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export {
|
|
6
6
|
// Schema values - DSL (what users write)
|
|
7
|
-
SecretRefDataSchema, SecretRefSchema, StringLiteralSchema, VariableRefSchema, ResponseFormatSchema, HttpMethodSchema, HttpRequestDSLSchema, FrequencySchema, WaitSchema, JSONPathSchema, FrequencyUnitSchema, XMLPathSchema, TextPathSchema, UnaryPredicateSchema, UnaryPredicateOperatorSchema, BinaryPredicateOperatorSchema, BinaryPredicateSchema, AssertionSchema, AssertionsSchema, NodeDSLSchema, EdgeSchema, MonitorDSLSchema, MonitorDSLSchemaV1,
|
|
7
|
+
SecretRefDataSchema, SecretRefSchema, StringLiteralSchema, VariableRefSchema, ResponseFormatSchema, HttpMethodSchema, HttpRequestDSLSchema, FrequencySchema, WaitSchema, JSONPathSchema, FrequencyUnitSchema, XMLPathSchema, TextPathSchema, UnaryPredicateSchema, UnaryPredicateOperatorSchema, BinaryPredicateOperatorSchema, BinaryPredicateSchema, AssertionSchema, AssertionsSchema, NodeDSLSchema, EdgeSchema, MonitorDSLSchema, MonitorDSLSchemaV1, MonitorNotificationSchema,
|
|
8
8
|
// Schema values - Resolved (what hub/executor use)
|
|
9
9
|
ResolvedStringSchema, HttpRequestResolvedSchema, NodeResolvedSchema, ResolvedMonitorV1Schema, ResolvedMonitorSchema,
|
|
10
10
|
// Enums (runtime values)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema-exports.js","sourceRoot":"","sources":["../src/schema-exports.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO;AACL,yCAAyC;AACzC,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,4BAA4B,EAC5B,6BAA6B,EAC7B,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,kBAAkB;
|
|
1
|
+
{"version":3,"file":"schema-exports.js","sourceRoot":"","sources":["../src/schema-exports.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO;AACL,yCAAyC;AACzC,mBAAmB,EACnB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,eAAe,EACf,UAAU,EACV,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,4BAA4B,EAC5B,6BAA6B,EAC7B,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,kBAAkB,EAClB,yBAAyB;AAEzB,mDAAmD;AACnD,oBAAoB,EACpB,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB;AAErB,yBAAyB;AACzB,aAAa,EACb,cAAc,EACd,UAAU,EACV,QAAQ,EAER,uBAAuB;AAEvB,YAAY;AACZ,uBAAuB,EACvB,0BAA0B,GAC3B,MAAM,aAAa,CAAC"}
|
package/dist/schema.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Type, type Static } from "typebox";
|
|
2
|
+
export { MonitorNotificationSchema } from "./notifications.js";
|
|
3
|
+
export type { MonitorNotification } from "./notifications.js";
|
|
2
4
|
export declare const CURRENT_MONITOR_VERSION = "1.0";
|
|
3
5
|
export declare const SUPPORTED_MONITOR_VERSIONS: readonly ["1.0"];
|
|
4
6
|
export declare const SecretRefDataSchema: Type.TObject<{
|
|
@@ -408,6 +410,27 @@ export declare const MonitorDSLSchemaV1: Type.TObject<{
|
|
|
408
410
|
every: Type.TNumber;
|
|
409
411
|
unit: Type.TUnsafe<FrequencyUnit>;
|
|
410
412
|
}>;
|
|
413
|
+
notifications: Type.TOptional<Type.TArray<Type.TObject<{
|
|
414
|
+
trigger: Type.TUnion<[Type.TObject<{
|
|
415
|
+
type: Type.TLiteral<"run_failed">;
|
|
416
|
+
}>, Type.TObject<{
|
|
417
|
+
type: Type.TLiteral<"run_recovered">;
|
|
418
|
+
}>, Type.TObject<{
|
|
419
|
+
type: Type.TLiteral<"consecutive_failures">;
|
|
420
|
+
threshold: Type.TNumber;
|
|
421
|
+
}>, Type.TObject<{
|
|
422
|
+
type: Type.TLiteral<"success_rate_below">;
|
|
423
|
+
threshold: Type.TNumber;
|
|
424
|
+
window_minutes: Type.TNumber;
|
|
425
|
+
}>, Type.TObject<{
|
|
426
|
+
type: Type.TLiteral<"latency_above">;
|
|
427
|
+
threshold_ms: Type.TNumber;
|
|
428
|
+
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
429
|
+
window_minutes: Type.TNumber;
|
|
430
|
+
}>]>;
|
|
431
|
+
integration: Type.TString;
|
|
432
|
+
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
433
|
+
}>>>;
|
|
411
434
|
nodes: Type.TArray<Type.TUnion<[Type.TObject<{
|
|
412
435
|
id: Type.TString;
|
|
413
436
|
type: Type.TLiteral<NodeType.HTTP_REQUEST>;
|
|
@@ -532,6 +555,27 @@ export declare const MonitorDSLSchema: Type.TObject<{
|
|
|
532
555
|
every: Type.TNumber;
|
|
533
556
|
unit: Type.TUnsafe<FrequencyUnit>;
|
|
534
557
|
}>;
|
|
558
|
+
notifications: Type.TOptional<Type.TArray<Type.TObject<{
|
|
559
|
+
trigger: Type.TUnion<[Type.TObject<{
|
|
560
|
+
type: Type.TLiteral<"run_failed">;
|
|
561
|
+
}>, Type.TObject<{
|
|
562
|
+
type: Type.TLiteral<"run_recovered">;
|
|
563
|
+
}>, Type.TObject<{
|
|
564
|
+
type: Type.TLiteral<"consecutive_failures">;
|
|
565
|
+
threshold: Type.TNumber;
|
|
566
|
+
}>, Type.TObject<{
|
|
567
|
+
type: Type.TLiteral<"success_rate_below">;
|
|
568
|
+
threshold: Type.TNumber;
|
|
569
|
+
window_minutes: Type.TNumber;
|
|
570
|
+
}>, Type.TObject<{
|
|
571
|
+
type: Type.TLiteral<"latency_above">;
|
|
572
|
+
threshold_ms: Type.TNumber;
|
|
573
|
+
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
574
|
+
window_minutes: Type.TNumber;
|
|
575
|
+
}>]>;
|
|
576
|
+
integration: Type.TString;
|
|
577
|
+
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
578
|
+
}>>>;
|
|
535
579
|
nodes: Type.TArray<Type.TUnion<[Type.TObject<{
|
|
536
580
|
id: Type.TString;
|
|
537
581
|
type: Type.TLiteral<NodeType.HTTP_REQUEST>;
|
|
@@ -780,6 +824,27 @@ export declare const ResolvedMonitorV1Schema: Type.TObject<{
|
|
|
780
824
|
every: Type.TNumber;
|
|
781
825
|
unit: Type.TUnsafe<FrequencyUnit>;
|
|
782
826
|
}>;
|
|
827
|
+
notifications: Type.TOptional<Type.TArray<Type.TObject<{
|
|
828
|
+
trigger: Type.TUnion<[Type.TObject<{
|
|
829
|
+
type: Type.TLiteral<"run_failed">;
|
|
830
|
+
}>, Type.TObject<{
|
|
831
|
+
type: Type.TLiteral<"run_recovered">;
|
|
832
|
+
}>, Type.TObject<{
|
|
833
|
+
type: Type.TLiteral<"consecutive_failures">;
|
|
834
|
+
threshold: Type.TNumber;
|
|
835
|
+
}>, Type.TObject<{
|
|
836
|
+
type: Type.TLiteral<"success_rate_below">;
|
|
837
|
+
threshold: Type.TNumber;
|
|
838
|
+
window_minutes: Type.TNumber;
|
|
839
|
+
}>, Type.TObject<{
|
|
840
|
+
type: Type.TLiteral<"latency_above">;
|
|
841
|
+
threshold_ms: Type.TNumber;
|
|
842
|
+
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
843
|
+
window_minutes: Type.TNumber;
|
|
844
|
+
}>]>;
|
|
845
|
+
integration: Type.TString;
|
|
846
|
+
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
847
|
+
}>>>;
|
|
783
848
|
environment: Type.TString;
|
|
784
849
|
nodes: Type.TArray<Type.TUnion<[Type.TObject<{
|
|
785
850
|
id: Type.TString;
|
|
@@ -876,6 +941,27 @@ export declare const ResolvedMonitorSchema: Type.TObject<{
|
|
|
876
941
|
every: Type.TNumber;
|
|
877
942
|
unit: Type.TUnsafe<FrequencyUnit>;
|
|
878
943
|
}>;
|
|
944
|
+
notifications: Type.TOptional<Type.TArray<Type.TObject<{
|
|
945
|
+
trigger: Type.TUnion<[Type.TObject<{
|
|
946
|
+
type: Type.TLiteral<"run_failed">;
|
|
947
|
+
}>, Type.TObject<{
|
|
948
|
+
type: Type.TLiteral<"run_recovered">;
|
|
949
|
+
}>, Type.TObject<{
|
|
950
|
+
type: Type.TLiteral<"consecutive_failures">;
|
|
951
|
+
threshold: Type.TNumber;
|
|
952
|
+
}>, Type.TObject<{
|
|
953
|
+
type: Type.TLiteral<"success_rate_below">;
|
|
954
|
+
threshold: Type.TNumber;
|
|
955
|
+
window_minutes: Type.TNumber;
|
|
956
|
+
}>, Type.TObject<{
|
|
957
|
+
type: Type.TLiteral<"latency_above">;
|
|
958
|
+
threshold_ms: Type.TNumber;
|
|
959
|
+
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
960
|
+
window_minutes: Type.TNumber;
|
|
961
|
+
}>]>;
|
|
962
|
+
integration: Type.TString;
|
|
963
|
+
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
964
|
+
}>>>;
|
|
879
965
|
environment: Type.TString;
|
|
880
966
|
nodes: Type.TArray<Type.TUnion<[Type.TObject<{
|
|
881
967
|
id: Type.TString;
|
package/dist/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"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/schema.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import { Ref, StringEnum } from "./shared.js";
|
|
3
|
+
import { MonitorNotificationSchema, } from "./notifications.js";
|
|
4
|
+
export { MonitorNotificationSchema } from "./notifications.js";
|
|
3
5
|
// Version constants
|
|
4
6
|
export const CURRENT_MONITOR_VERSION = "1.0";
|
|
5
7
|
export const SUPPORTED_MONITOR_VERSIONS = ["1.0"];
|
|
@@ -243,6 +245,7 @@ export const MonitorDSLSchemaV1 = Type.Object({
|
|
|
243
245
|
name: Type.String(),
|
|
244
246
|
version: Type.Literal("1.0"),
|
|
245
247
|
frequency: FrequencySchema,
|
|
248
|
+
notifications: Type.Optional(Type.Array(MonitorNotificationSchema)),
|
|
246
249
|
nodes: Type.Array(NodeDSLSchema),
|
|
247
250
|
edges: Type.Array(EdgeSchema),
|
|
248
251
|
}, {
|
|
@@ -277,6 +280,7 @@ export const ResolvedMonitorV1Schema = Type.Object({
|
|
|
277
280
|
name: Type.String(),
|
|
278
281
|
version: Type.Literal("1.0"),
|
|
279
282
|
frequency: FrequencySchema,
|
|
283
|
+
notifications: Type.Optional(Type.Array(MonitorNotificationSchema)),
|
|
280
284
|
environment: Type.String({ default: "default" }),
|
|
281
285
|
nodes: Type.Array(NodeResolvedSchema),
|
|
282
286
|
edges: Type.Array(EdgeSchema),
|
package/dist/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAe,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAE,GAAG,EAA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, type WaitDuration } from "./builder.js";
|
|
2
2
|
import { Frequency, MonitorDSL, type Assertion as AssertionType } from "./schema.js";
|
|
3
|
+
import type { MonitorNotification } from "./notifications.js";
|
|
3
4
|
import { type StateProxy } from "./assertions.js";
|
|
4
5
|
/**
|
|
5
6
|
* Callback type for building assertions with type-safe state access
|
|
@@ -121,5 +122,6 @@ export declare function createTestBuilder(config: {
|
|
|
121
122
|
name: string;
|
|
122
123
|
frequency: Frequency;
|
|
123
124
|
locations?: string[];
|
|
125
|
+
notifications?: MonitorNotification[];
|
|
124
126
|
}): SequentialTestBuilder;
|
|
125
127
|
//# sourceMappingURL=sequential-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequential-builder.d.ts","sourceRoot":"","sources":["../src/sequential-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAIL,SAAS,EACT,UAAU,EAEV,KAAK,SAAS,IAAI,aAAa,EAChC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAoB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEpE;;GAEG;AACH,MAAM,MAAM,iBAAiB,CAAC,SAAS,SAAS,MAAM,IAAI,CACxD,KAAK,EAAE,UAAU,CAAC,SAAS,CAAC,KACzB,aAAa,EAAE,CAAC;AAErB;;;;;;GAMG;AACH,MAAM,WAAW,qBAAqB,CAAC,SAAS,SAAS,MAAM,GAAG,KAAK;IACrE;;;;;;;;;;;;;;;;OAgBG;IACH,OAAO,CAAC,IAAI,SAAS,MAAM,EACzB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,iBAAiB,GACxB,qBAAqB,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IAE3C;;;;;;;;;;;;;OAaG;IACH,IAAI,CAAC,IAAI,SAAS,MAAM,EACtB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,YAAY,GAC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ACrC,qBAAqB,CAAC,SAAS,CAAC,CAAC;IAEpC;;;;;OAKG;IACH,KAAK,IAAI,UAAU,CAAC;CACrB;AAmHD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,CAAC,EAAE,mBAAmB,EAAE,CAAC;CACvC,GAAG,qBAAqB,CAExB"}
|
|
@@ -44,11 +44,11 @@ class SequentialTestBuilderImpl {
|
|
|
44
44
|
return this;
|
|
45
45
|
}
|
|
46
46
|
build() {
|
|
47
|
-
const { name, frequency, locations } = this.config;
|
|
47
|
+
const { name, frequency, locations, notifications } = this.config;
|
|
48
48
|
const edges = [];
|
|
49
49
|
// If no nodes, return empty monitor with just START->END
|
|
50
50
|
if (this.nodes.length === 0) {
|
|
51
|
-
|
|
51
|
+
const result = {
|
|
52
52
|
name,
|
|
53
53
|
frequency,
|
|
54
54
|
locations,
|
|
@@ -56,6 +56,10 @@ class SequentialTestBuilderImpl {
|
|
|
56
56
|
nodes: [],
|
|
57
57
|
edges: [{ from: START, to: END }],
|
|
58
58
|
};
|
|
59
|
+
if (notifications !== undefined && notifications.length > 0) {
|
|
60
|
+
result.notifications = notifications;
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
59
63
|
}
|
|
60
64
|
// Connect START to first node
|
|
61
65
|
edges.push({ from: START, to: this.nodes[0].id });
|
|
@@ -68,7 +72,7 @@ class SequentialTestBuilderImpl {
|
|
|
68
72
|
}
|
|
69
73
|
// Connect last node to END
|
|
70
74
|
edges.push({ from: this.nodes[this.nodes.length - 1].id, to: END });
|
|
71
|
-
|
|
75
|
+
const result = {
|
|
72
76
|
name,
|
|
73
77
|
version: CURRENT_MONITOR_VERSION,
|
|
74
78
|
frequency,
|
|
@@ -76,6 +80,10 @@ class SequentialTestBuilderImpl {
|
|
|
76
80
|
nodes: this.nodes,
|
|
77
81
|
edges,
|
|
78
82
|
};
|
|
83
|
+
if (notifications !== undefined && notifications.length > 0) {
|
|
84
|
+
result.notifications = notifications;
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
79
87
|
}
|
|
80
88
|
}
|
|
81
89
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sequential-builder.js","sourceRoot":"","sources":["../src/sequential-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,IAAI,EACJ,SAAS,GAGV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,uBAAuB,EAKvB,cAAc,GAEf,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"sequential-builder.js","sourceRoot":"","sources":["../src/sequential-builder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,IAAI,EACJ,SAAS,GAGV,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,uBAAuB,EAKvB,cAAc,GAEf,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,gBAAgB,EAAmB,MAAM,iBAAiB,CAAC;AAyFpE;;GAEG;AACH,MAAM,yBAAyB;IAQnB;IALF,KAAK,GAAc,EAAE,CAAC;IACtB,SAAS,GAAa,EAAE,CAAC;IACzB,WAAW,GAAG,CAAC,CAAC;IAExB,YACU,MAKP;QALO,WAAM,GAAN,MAAM,CAKb;IACA,CAAC;IAEJ;;OAEG;IACK,gBAAgB;QACtB,OAAO,QAAQ,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;IACtC,CAAC;IAED,OAAO,CACL,IAAU,EACV,MAAyB;QAEzB,MAAM,IAAI,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;QACj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S;YACT,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK;SACN,CAAC;QACF,IAAI,aAAa,KAAK,SAAS,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5D,MAAM,CAAC,aAAa,GAAG,aAAa,CAAC;QACvC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAKjC;IACC,OAAO,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC"}
|
package/package.json
CHANGED
package/src/builder.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
Assertions,
|
|
13
13
|
CURRENT_MONITOR_VERSION,
|
|
14
14
|
} from "./schema.js";
|
|
15
|
+
import type { MonitorNotification } from "./notifications.js";
|
|
15
16
|
import { type START as StartType, type END as EndType } from "./constants.js";
|
|
16
17
|
|
|
17
18
|
/**
|
|
@@ -121,6 +122,7 @@ class TestBuilderImpl<
|
|
|
121
122
|
name: string;
|
|
122
123
|
frequency: Frequency;
|
|
123
124
|
locations?: string[];
|
|
125
|
+
notifications?: MonitorNotification[];
|
|
124
126
|
},
|
|
125
127
|
) {}
|
|
126
128
|
|
|
@@ -156,12 +158,12 @@ class TestBuilderImpl<
|
|
|
156
158
|
}
|
|
157
159
|
|
|
158
160
|
get build(): TestBuilder<NodeName, HasOutput, HasInput>["build"] {
|
|
159
|
-
const { name, frequency, locations } = this.config;
|
|
161
|
+
const { name, frequency, locations, notifications } = this.config;
|
|
160
162
|
const nodes = this.nodes;
|
|
161
163
|
const edges = this.edges;
|
|
162
164
|
|
|
163
165
|
const buildFn = (): MonitorDSL => {
|
|
164
|
-
|
|
166
|
+
const result: MonitorDSL = {
|
|
165
167
|
name,
|
|
166
168
|
version: CURRENT_MONITOR_VERSION,
|
|
167
169
|
frequency,
|
|
@@ -169,6 +171,10 @@ class TestBuilderImpl<
|
|
|
169
171
|
nodes,
|
|
170
172
|
edges,
|
|
171
173
|
};
|
|
174
|
+
if (notifications !== undefined && notifications.length > 0) {
|
|
175
|
+
result.notifications = notifications;
|
|
176
|
+
}
|
|
177
|
+
return result;
|
|
172
178
|
};
|
|
173
179
|
|
|
174
180
|
// Type assertion: build is only callable when graph constraints are satisfied
|
|
@@ -203,6 +209,7 @@ export function createGraphBuilder(config: {
|
|
|
203
209
|
name: string;
|
|
204
210
|
frequency: Frequency;
|
|
205
211
|
locations?: string[];
|
|
212
|
+
notifications?: MonitorNotification[];
|
|
206
213
|
}): TestBuilder {
|
|
207
214
|
return new TestBuilderImpl(config);
|
|
208
215
|
}
|
package/src/index.ts
CHANGED
|
@@ -38,6 +38,12 @@ export { variable, isVariableRef } from "./variable.js";
|
|
|
38
38
|
export type { VariableRef } from "./variable.js";
|
|
39
39
|
export { secret, isSecretRef } from "./secrets.js";
|
|
40
40
|
export type { SecretOptions } from "./secrets.js";
|
|
41
|
+
export { notify } from "./notifications.js";
|
|
42
|
+
export { MonitorNotificationSchema } from "./notifications.js";
|
|
43
|
+
export type {
|
|
44
|
+
NotificationTrigger,
|
|
45
|
+
MonitorNotification,
|
|
46
|
+
} from "./notifications.js";
|
|
41
47
|
|
|
42
48
|
// ============================================================================
|
|
43
49
|
// DSL Constants
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { Type, type Static } from "typebox";
|
|
2
|
+
|
|
3
|
+
// =============================================================================
|
|
4
|
+
// Trigger Types (matches hub NotificationTriggerSchema)
|
|
5
|
+
// =============================================================================
|
|
6
|
+
|
|
7
|
+
export const NotificationTriggerSchema = Type.Union([
|
|
8
|
+
Type.Object({
|
|
9
|
+
type: Type.Literal("run_failed"),
|
|
10
|
+
}),
|
|
11
|
+
Type.Object({
|
|
12
|
+
type: Type.Literal("run_recovered"),
|
|
13
|
+
}),
|
|
14
|
+
Type.Object({
|
|
15
|
+
type: Type.Literal("consecutive_failures"),
|
|
16
|
+
threshold: Type.Number({ minimum: 1 }),
|
|
17
|
+
}),
|
|
18
|
+
Type.Object({
|
|
19
|
+
type: Type.Literal("success_rate_below"),
|
|
20
|
+
threshold: Type.Number({ minimum: 0, maximum: 100 }),
|
|
21
|
+
window_minutes: Type.Number({ minimum: 1 }),
|
|
22
|
+
}),
|
|
23
|
+
Type.Object({
|
|
24
|
+
type: Type.Literal("latency_above"),
|
|
25
|
+
threshold_ms: Type.Number({ minimum: 0 }),
|
|
26
|
+
percentile: Type.Union([
|
|
27
|
+
Type.Literal("p50"),
|
|
28
|
+
Type.Literal("p95"),
|
|
29
|
+
Type.Literal("p99"),
|
|
30
|
+
]),
|
|
31
|
+
window_minutes: Type.Number({ minimum: 1 }),
|
|
32
|
+
}),
|
|
33
|
+
], { $id: "NotificationTrigger" });
|
|
34
|
+
|
|
35
|
+
export type NotificationTrigger = Static<typeof NotificationTriggerSchema>;
|
|
36
|
+
|
|
37
|
+
// =============================================================================
|
|
38
|
+
// Monitor Notification (DSL config: trigger + integration name)
|
|
39
|
+
// =============================================================================
|
|
40
|
+
|
|
41
|
+
export const MonitorNotificationSchema = Type.Object(
|
|
42
|
+
{
|
|
43
|
+
trigger: NotificationTriggerSchema,
|
|
44
|
+
integration: Type.String(),
|
|
45
|
+
cooldown_minutes: Type.Optional(Type.Number({ minimum: 0 })),
|
|
46
|
+
},
|
|
47
|
+
{ $id: "MonitorNotification" },
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
export type MonitorNotification = Static<typeof MonitorNotificationSchema>;
|
|
51
|
+
|
|
52
|
+
// =============================================================================
|
|
53
|
+
// Notification Builder
|
|
54
|
+
// =============================================================================
|
|
55
|
+
|
|
56
|
+
class NotificationBuilder {
|
|
57
|
+
private trigger: NotificationTrigger;
|
|
58
|
+
private cooldownMinutes?: number;
|
|
59
|
+
|
|
60
|
+
constructor(trigger: NotificationTrigger) {
|
|
61
|
+
this.trigger = trigger;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
withCooldown(minutes: number): this {
|
|
65
|
+
this.cooldownMinutes = minutes;
|
|
66
|
+
return this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
via(integrationName: string): MonitorNotification {
|
|
70
|
+
const result: MonitorNotification = {
|
|
71
|
+
trigger: this.trigger,
|
|
72
|
+
integration: integrationName,
|
|
73
|
+
};
|
|
74
|
+
if (this.cooldownMinutes !== undefined) {
|
|
75
|
+
result.cooldown_minutes = this.cooldownMinutes;
|
|
76
|
+
}
|
|
77
|
+
return result;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// notify API
|
|
83
|
+
// =============================================================================
|
|
84
|
+
|
|
85
|
+
export const notify = {
|
|
86
|
+
onFailure: () =>
|
|
87
|
+
new NotificationBuilder({ type: "run_failed" }),
|
|
88
|
+
|
|
89
|
+
onRecovery: () =>
|
|
90
|
+
new NotificationBuilder({ type: "run_recovered" }),
|
|
91
|
+
|
|
92
|
+
onConsecutiveFailures: (threshold: number) =>
|
|
93
|
+
new NotificationBuilder({
|
|
94
|
+
type: "consecutive_failures",
|
|
95
|
+
threshold,
|
|
96
|
+
}),
|
|
97
|
+
|
|
98
|
+
onSuccessRateBelow: (threshold: number, window_minutes: number) =>
|
|
99
|
+
new NotificationBuilder({
|
|
100
|
+
type: "success_rate_below",
|
|
101
|
+
threshold,
|
|
102
|
+
window_minutes,
|
|
103
|
+
}),
|
|
104
|
+
|
|
105
|
+
onLatencyAbove: (options: {
|
|
106
|
+
threshold_ms: number;
|
|
107
|
+
percentile: "p50" | "p95" | "p99";
|
|
108
|
+
window_minutes: number;
|
|
109
|
+
}) =>
|
|
110
|
+
new NotificationBuilder({
|
|
111
|
+
type: "latency_above",
|
|
112
|
+
threshold_ms: options.threshold_ms,
|
|
113
|
+
percentile: options.percentile,
|
|
114
|
+
window_minutes: options.window_minutes,
|
|
115
|
+
}),
|
|
116
|
+
};
|
package/src/schema-exports.ts
CHANGED
package/src/schema.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { Type, type Static } from "typebox";
|
|
2
2
|
import { Ref, StringEnum } from "./shared.js";
|
|
3
|
+
import {
|
|
4
|
+
MonitorNotificationSchema,
|
|
5
|
+
type MonitorNotification,
|
|
6
|
+
} from "./notifications.js";
|
|
7
|
+
|
|
8
|
+
export { MonitorNotificationSchema } from "./notifications.js";
|
|
9
|
+
export type { MonitorNotification } from "./notifications.js";
|
|
3
10
|
|
|
4
11
|
// Version constants
|
|
5
12
|
export const CURRENT_MONITOR_VERSION = "1.0";
|
|
@@ -319,6 +326,7 @@ export const MonitorDSLSchemaV1 = Type.Object(
|
|
|
319
326
|
name: Type.String(),
|
|
320
327
|
version: Type.Literal("1.0"),
|
|
321
328
|
frequency: FrequencySchema,
|
|
329
|
+
notifications: Type.Optional(Type.Array(MonitorNotificationSchema)),
|
|
322
330
|
nodes: Type.Array(NodeDSLSchema),
|
|
323
331
|
edges: Type.Array(EdgeSchema),
|
|
324
332
|
},
|
|
@@ -388,6 +396,7 @@ export const ResolvedMonitorV1Schema = Type.Object(
|
|
|
388
396
|
name: Type.String(),
|
|
389
397
|
version: Type.Literal("1.0"),
|
|
390
398
|
frequency: FrequencySchema,
|
|
399
|
+
notifications: Type.Optional(Type.Array(MonitorNotificationSchema)),
|
|
391
400
|
environment: Type.String({ default: "default" }),
|
|
392
401
|
nodes: Type.Array(NodeResolvedSchema),
|
|
393
402
|
edges: Type.Array(EdgeSchema),
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
ResponseFormat,
|
|
16
16
|
type Assertion as AssertionType,
|
|
17
17
|
} from "./schema.js";
|
|
18
|
+
import type { MonitorNotification } from "./notifications.js";
|
|
18
19
|
import { createStateProxy, type StateProxy } from "./assertions.js";
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -119,6 +120,7 @@ class SequentialTestBuilderImpl<
|
|
|
119
120
|
name: string;
|
|
120
121
|
frequency: Frequency;
|
|
121
122
|
locations?: string[];
|
|
123
|
+
notifications?: MonitorNotification[];
|
|
122
124
|
},
|
|
123
125
|
) {}
|
|
124
126
|
|
|
@@ -168,12 +170,12 @@ class SequentialTestBuilderImpl<
|
|
|
168
170
|
}
|
|
169
171
|
|
|
170
172
|
build(): MonitorDSL {
|
|
171
|
-
const { name, frequency, locations } = this.config;
|
|
173
|
+
const { name, frequency, locations, notifications } = this.config;
|
|
172
174
|
const edges: Edge[] = [];
|
|
173
175
|
|
|
174
176
|
// If no nodes, return empty monitor with just START->END
|
|
175
177
|
if (this.nodes.length === 0) {
|
|
176
|
-
|
|
178
|
+
const result: MonitorDSL = {
|
|
177
179
|
name,
|
|
178
180
|
frequency,
|
|
179
181
|
locations,
|
|
@@ -181,6 +183,10 @@ class SequentialTestBuilderImpl<
|
|
|
181
183
|
nodes: [],
|
|
182
184
|
edges: [{ from: START, to: END }],
|
|
183
185
|
};
|
|
186
|
+
if (notifications !== undefined && notifications.length > 0) {
|
|
187
|
+
result.notifications = notifications;
|
|
188
|
+
}
|
|
189
|
+
return result;
|
|
184
190
|
}
|
|
185
191
|
|
|
186
192
|
// Connect START to first node
|
|
@@ -197,7 +203,7 @@ class SequentialTestBuilderImpl<
|
|
|
197
203
|
// Connect last node to END
|
|
198
204
|
edges.push({ from: this.nodes[this.nodes.length - 1].id, to: END });
|
|
199
205
|
|
|
200
|
-
|
|
206
|
+
const result: MonitorDSL = {
|
|
201
207
|
name,
|
|
202
208
|
version: CURRENT_MONITOR_VERSION,
|
|
203
209
|
frequency,
|
|
@@ -205,6 +211,10 @@ class SequentialTestBuilderImpl<
|
|
|
205
211
|
nodes: this.nodes,
|
|
206
212
|
edges,
|
|
207
213
|
};
|
|
214
|
+
if (notifications !== undefined && notifications.length > 0) {
|
|
215
|
+
result.notifications = notifications;
|
|
216
|
+
}
|
|
217
|
+
return result;
|
|
208
218
|
}
|
|
209
219
|
}
|
|
210
220
|
|
|
@@ -256,6 +266,7 @@ export function createTestBuilder(config: {
|
|
|
256
266
|
name: string;
|
|
257
267
|
frequency: Frequency;
|
|
258
268
|
locations?: string[];
|
|
269
|
+
notifications?: MonitorNotification[];
|
|
259
270
|
}): SequentialTestBuilder {
|
|
260
271
|
return new SequentialTestBuilderImpl(config);
|
|
261
272
|
}
|