@griffin-app/griffin-ts 0.1.25 → 0.1.27
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/integrations.d.ts +2 -2
- package/dist/integrations.d.ts.map +1 -1
- package/dist/integrations.js +0 -1
- package/dist/integrations.js.map +1 -1
- package/dist/notifications.d.ts +12 -12
- package/dist/notifications.d.ts.map +1 -1
- package/dist/notifications.js +12 -12
- package/dist/notifications.js.map +1 -1
- package/dist/schema.d.ts +16 -16
- package/package.json +1 -1
- package/src/integrations.ts +0 -1
- package/src/notifications.ts +12 -12
package/dist/integrations.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Type, type Static } from "typebox";
|
|
2
2
|
export declare const IntegrationCategorySchema: Type.TUnsafe<"notifications" | "secrets" | "metrics">;
|
|
3
|
-
export declare const NotificationProviderSchema: Type.TUnsafe<"slack" | "email" | "webhook"
|
|
3
|
+
export declare const NotificationProviderSchema: Type.TUnsafe<"slack" | "email" | "webhook">;
|
|
4
4
|
export declare const SecretsProviderSchema: Type.TUnsafe<"aws" | "vault">;
|
|
5
|
-
export declare const ProviderSchema: Type.TUnsafe<"slack" | "email" | "webhook" | "
|
|
5
|
+
export declare const ProviderSchema: Type.TUnsafe<"slack" | "email" | "webhook" | "aws" | "vault" | "resend">;
|
|
6
6
|
export type IntegrationCategory = Static<typeof IntegrationCategorySchema>;
|
|
7
7
|
export type SecretsProvider = Static<typeof SecretsProviderSchema>;
|
|
8
8
|
export type NotificationProvider = Static<typeof NotificationProviderSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,yBAAyB,uDAIN,CAAC;AAEjC,eAAO,MAAM,0BAA0B,
|
|
1
|
+
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,yBAAyB,uDAIN,CAAC;AAEjC,eAAO,MAAM,0BAA0B,6CAIN,CAAC;AAElC,eAAO,MAAM,qBAAqB,+BAIN,CAAC;AAC7B,eAAO,MAAM,cAAc,0EAON,CAAC;AAEtB,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE3E,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACnE,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC7E,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
package/dist/integrations.js
CHANGED
package/dist/integrations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.js","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC;IAClD,eAAe;IACf,SAAS;IACT,SAAS;CACV,EAAE,EAAC,GAAG,EAAE,qBAAqB,EAAC,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;IACnD,OAAO;IACP,OAAO;IACP,SAAS;
|
|
1
|
+
{"version":3,"file":"integrations.js","sourceRoot":"","sources":["../src/integrations.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,MAAM,CAAC,MAAM,yBAAyB,GAAG,UAAU,CAAC;IAClD,eAAe;IACf,SAAS;IACT,SAAS;CACV,EAAE,EAAC,GAAG,EAAE,qBAAqB,EAAC,CAAC,CAAC;AAEjC,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC;IACnD,OAAO;IACP,OAAO;IACP,SAAS;CACV,EAAE,EAAC,GAAG,EAAE,sBAAsB,EAAC,CAAC,CAAC;AAElC,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC;IAC9C,sBAAsB;IACtB,KAAK;IACL,OAAO;CACR,EAAE,EAAC,GAAG,EAAE,iBAAiB,EAAC,CAAC,CAAC;AAC7B,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,KAAK;IACL,OAAO;IACP,OAAO;IACP,OAAO;IACP,SAAS;IACT,QAAQ;CACT,EAAE,EAAC,GAAG,EAAE,UAAU,EAAC,CAAC,CAAC"}
|
package/dist/notifications.d.ts
CHANGED
|
@@ -18,24 +18,24 @@ export declare const NotificationTriggerSchema: Type.TUnion<[Type.TObject<{
|
|
|
18
18
|
}>]>;
|
|
19
19
|
export type NotificationTrigger = Static<typeof NotificationTriggerSchema>;
|
|
20
20
|
export declare const SlackRoutingSchema: Type.TObject<{
|
|
21
|
-
|
|
21
|
+
channelType: Type.TLiteral<"slack">;
|
|
22
22
|
channel: Type.TString;
|
|
23
23
|
}>;
|
|
24
24
|
export declare const EmailRoutingSchema: Type.TObject<{
|
|
25
|
-
|
|
25
|
+
channelType: Type.TLiteral<"email">;
|
|
26
26
|
toAddresses: Type.TArray<Type.TString>;
|
|
27
27
|
}>;
|
|
28
28
|
export declare const WebhookRoutingSchema: Type.TObject<{
|
|
29
|
-
|
|
29
|
+
channelType: Type.TLiteral<"webhook">;
|
|
30
30
|
}>;
|
|
31
31
|
export declare const NotificationRoutingSchema: Type.TUnion<[Type.TObject<{
|
|
32
|
-
|
|
32
|
+
channelType: Type.TLiteral<"slack">;
|
|
33
33
|
channel: Type.TString;
|
|
34
34
|
}>, Type.TObject<{
|
|
35
|
-
|
|
35
|
+
channelType: Type.TLiteral<"email">;
|
|
36
36
|
toAddresses: Type.TArray<Type.TString>;
|
|
37
37
|
}>, Type.TObject<{
|
|
38
|
-
|
|
38
|
+
channelType: Type.TLiteral<"webhook">;
|
|
39
39
|
}>]>;
|
|
40
40
|
export type SlackRouting = Static<typeof SlackRoutingSchema>;
|
|
41
41
|
export type EmailRouting = Static<typeof EmailRoutingSchema>;
|
|
@@ -59,15 +59,15 @@ export declare const MonitorNotificationSchema: Type.TObject<{
|
|
|
59
59
|
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
60
60
|
window_minutes: Type.TNumber;
|
|
61
61
|
}>]>;
|
|
62
|
-
integration: Type.TString
|
|
62
|
+
integration: Type.TOptional<Type.TString>;
|
|
63
63
|
routing: Type.TUnion<[Type.TObject<{
|
|
64
|
-
|
|
64
|
+
channelType: Type.TLiteral<"slack">;
|
|
65
65
|
channel: Type.TString;
|
|
66
66
|
}>, Type.TObject<{
|
|
67
|
-
|
|
67
|
+
channelType: Type.TLiteral<"email">;
|
|
68
68
|
toAddresses: Type.TArray<Type.TString>;
|
|
69
69
|
}>, Type.TObject<{
|
|
70
|
-
|
|
70
|
+
channelType: Type.TLiteral<"webhook">;
|
|
71
71
|
}>]>;
|
|
72
72
|
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
73
73
|
}>;
|
|
@@ -77,8 +77,8 @@ declare class NotificationBuilder {
|
|
|
77
77
|
private cooldownMinutes?;
|
|
78
78
|
constructor(trigger: NotificationTrigger);
|
|
79
79
|
withCooldown(minutes: number): this;
|
|
80
|
-
toSlack(channel: string): MonitorNotification;
|
|
81
|
-
toEmail(toAddresses: string[]): MonitorNotification;
|
|
80
|
+
toSlack(channel: string, integration?: string): MonitorNotification;
|
|
81
|
+
toEmail(toAddresses: string[], integration?: string): MonitorNotification;
|
|
82
82
|
toWebhook(integration: string): MonitorNotification;
|
|
83
83
|
}
|
|
84
84
|
export declare const notify: {
|
|
@@ -1 +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,kBAAkB;;;EAG7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;EAG7B,CAAC;AAEH,eAAO,MAAM,oBAAoB;;EAE/B,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;;;IAIpC,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC7D,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC7D,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AACjE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAM3E,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQrC,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,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB;
|
|
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,yBAAy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GAAG,KAAK,GAAG,KAAK,CAAC;QAClC,cAAc,EAAE,MAAM,CAAC;KACxB;CAOF,CAAC"}
|
package/dist/notifications.js
CHANGED
|
@@ -30,18 +30,18 @@ export const NotificationTriggerSchema = Type.Union([
|
|
|
30
30
|
}),
|
|
31
31
|
], { $id: "NotificationTrigger" });
|
|
32
32
|
// =============================================================================
|
|
33
|
-
// Routing (discriminated union
|
|
33
|
+
// Routing (discriminated union by channel type)
|
|
34
34
|
// =============================================================================
|
|
35
35
|
export const SlackRoutingSchema = Type.Object({
|
|
36
|
-
|
|
36
|
+
channelType: Type.Literal("slack"),
|
|
37
37
|
channel: Type.String(),
|
|
38
38
|
});
|
|
39
39
|
export const EmailRoutingSchema = Type.Object({
|
|
40
|
-
|
|
40
|
+
channelType: Type.Literal("email"),
|
|
41
41
|
toAddresses: Type.Array(Type.String()),
|
|
42
42
|
});
|
|
43
43
|
export const WebhookRoutingSchema = Type.Object({
|
|
44
|
-
|
|
44
|
+
channelType: Type.Literal("webhook"),
|
|
45
45
|
});
|
|
46
46
|
export const NotificationRoutingSchema = Type.Union([
|
|
47
47
|
SlackRoutingSchema,
|
|
@@ -53,7 +53,7 @@ export const NotificationRoutingSchema = Type.Union([
|
|
|
53
53
|
// =============================================================================
|
|
54
54
|
export const MonitorNotificationSchema = Type.Object({
|
|
55
55
|
trigger: NotificationTriggerSchema,
|
|
56
|
-
integration: Type.String(),
|
|
56
|
+
integration: Type.Optional(Type.String()),
|
|
57
57
|
routing: NotificationRoutingSchema,
|
|
58
58
|
cooldown_minutes: Type.Optional(Type.Number({ minimum: 0 })),
|
|
59
59
|
}, { $id: "MonitorNotification" });
|
|
@@ -70,21 +70,21 @@ class NotificationBuilder {
|
|
|
70
70
|
this.cooldownMinutes = minutes;
|
|
71
71
|
return this;
|
|
72
72
|
}
|
|
73
|
-
toSlack(channel) {
|
|
73
|
+
toSlack(channel, integration) {
|
|
74
74
|
return {
|
|
75
75
|
trigger: this.trigger,
|
|
76
|
-
integration
|
|
77
|
-
routing: {
|
|
76
|
+
...(integration !== undefined && { integration }),
|
|
77
|
+
routing: { channelType: "slack", channel },
|
|
78
78
|
...(this.cooldownMinutes !== undefined && {
|
|
79
79
|
cooldown_minutes: this.cooldownMinutes,
|
|
80
80
|
}),
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
toEmail(toAddresses) {
|
|
83
|
+
toEmail(toAddresses, integration) {
|
|
84
84
|
return {
|
|
85
85
|
trigger: this.trigger,
|
|
86
|
-
integration
|
|
87
|
-
routing: {
|
|
86
|
+
...(integration !== undefined && { integration }),
|
|
87
|
+
routing: { channelType: "email", toAddresses },
|
|
88
88
|
...(this.cooldownMinutes !== undefined && {
|
|
89
89
|
cooldown_minutes: this.cooldownMinutes,
|
|
90
90
|
}),
|
|
@@ -94,7 +94,7 @@ class NotificationBuilder {
|
|
|
94
94
|
return {
|
|
95
95
|
trigger: this.trigger,
|
|
96
96
|
integration,
|
|
97
|
-
routing: {
|
|
97
|
+
routing: { channelType: "webhook" },
|
|
98
98
|
...(this.cooldownMinutes !== undefined && {
|
|
99
99
|
cooldown_minutes: this.cooldownMinutes,
|
|
100
100
|
}),
|
|
@@ -1 +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,s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AC5B,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.d.ts
CHANGED
|
@@ -408,15 +408,15 @@ export declare const MonitorDSLSchemaV1: Type.TObject<{
|
|
|
408
408
|
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
409
409
|
window_minutes: Type.TNumber;
|
|
410
410
|
}>]>;
|
|
411
|
-
integration: Type.TString
|
|
411
|
+
integration: Type.TOptional<Type.TString>;
|
|
412
412
|
routing: Type.TUnion<[Type.TObject<{
|
|
413
|
-
|
|
413
|
+
channelType: Type.TLiteral<"slack">;
|
|
414
414
|
channel: Type.TString;
|
|
415
415
|
}>, Type.TObject<{
|
|
416
|
-
|
|
416
|
+
channelType: Type.TLiteral<"email">;
|
|
417
417
|
toAddresses: Type.TArray<Type.TString>;
|
|
418
418
|
}>, Type.TObject<{
|
|
419
|
-
|
|
419
|
+
channelType: Type.TLiteral<"webhook">;
|
|
420
420
|
}>]>;
|
|
421
421
|
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
422
422
|
}>>>;
|
|
@@ -562,15 +562,15 @@ export declare const MonitorDSLSchema: Type.TObject<{
|
|
|
562
562
|
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
563
563
|
window_minutes: Type.TNumber;
|
|
564
564
|
}>]>;
|
|
565
|
-
integration: Type.TString
|
|
565
|
+
integration: Type.TOptional<Type.TString>;
|
|
566
566
|
routing: Type.TUnion<[Type.TObject<{
|
|
567
|
-
|
|
567
|
+
channelType: Type.TLiteral<"slack">;
|
|
568
568
|
channel: Type.TString;
|
|
569
569
|
}>, Type.TObject<{
|
|
570
|
-
|
|
570
|
+
channelType: Type.TLiteral<"email">;
|
|
571
571
|
toAddresses: Type.TArray<Type.TString>;
|
|
572
572
|
}>, Type.TObject<{
|
|
573
|
-
|
|
573
|
+
channelType: Type.TLiteral<"webhook">;
|
|
574
574
|
}>]>;
|
|
575
575
|
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
576
576
|
}>>>;
|
|
@@ -840,15 +840,15 @@ export declare const ResolvedMonitorV1Schema: Type.TObject<{
|
|
|
840
840
|
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
841
841
|
window_minutes: Type.TNumber;
|
|
842
842
|
}>]>;
|
|
843
|
-
integration: Type.TString
|
|
843
|
+
integration: Type.TOptional<Type.TString>;
|
|
844
844
|
routing: Type.TUnion<[Type.TObject<{
|
|
845
|
-
|
|
845
|
+
channelType: Type.TLiteral<"slack">;
|
|
846
846
|
channel: Type.TString;
|
|
847
847
|
}>, Type.TObject<{
|
|
848
|
-
|
|
848
|
+
channelType: Type.TLiteral<"email">;
|
|
849
849
|
toAddresses: Type.TArray<Type.TString>;
|
|
850
850
|
}>, Type.TObject<{
|
|
851
|
-
|
|
851
|
+
channelType: Type.TLiteral<"webhook">;
|
|
852
852
|
}>]>;
|
|
853
853
|
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
854
854
|
}>>>;
|
|
@@ -966,15 +966,15 @@ export declare const ResolvedMonitorSchema: Type.TObject<{
|
|
|
966
966
|
percentile: Type.TUnion<[Type.TLiteral<"p50">, Type.TLiteral<"p95">, Type.TLiteral<"p99">]>;
|
|
967
967
|
window_minutes: Type.TNumber;
|
|
968
968
|
}>]>;
|
|
969
|
-
integration: Type.TString
|
|
969
|
+
integration: Type.TOptional<Type.TString>;
|
|
970
970
|
routing: Type.TUnion<[Type.TObject<{
|
|
971
|
-
|
|
971
|
+
channelType: Type.TLiteral<"slack">;
|
|
972
972
|
channel: Type.TString;
|
|
973
973
|
}>, Type.TObject<{
|
|
974
|
-
|
|
974
|
+
channelType: Type.TLiteral<"email">;
|
|
975
975
|
toAddresses: Type.TArray<Type.TString>;
|
|
976
976
|
}>, Type.TObject<{
|
|
977
|
-
|
|
977
|
+
channelType: Type.TLiteral<"webhook">;
|
|
978
978
|
}>]>;
|
|
979
979
|
cooldown_minutes: Type.TOptional<Type.TNumber>;
|
|
980
980
|
}>>>;
|
package/package.json
CHANGED
package/src/integrations.ts
CHANGED
package/src/notifications.ts
CHANGED
|
@@ -35,21 +35,21 @@ export const NotificationTriggerSchema = Type.Union([
|
|
|
35
35
|
export type NotificationTrigger = Static<typeof NotificationTriggerSchema>;
|
|
36
36
|
|
|
37
37
|
// =============================================================================
|
|
38
|
-
// Routing (discriminated union
|
|
38
|
+
// Routing (discriminated union by channel type)
|
|
39
39
|
// =============================================================================
|
|
40
40
|
|
|
41
41
|
export const SlackRoutingSchema = Type.Object({
|
|
42
|
-
|
|
42
|
+
channelType: Type.Literal("slack"),
|
|
43
43
|
channel: Type.String(),
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
export const EmailRoutingSchema = Type.Object({
|
|
47
|
-
|
|
47
|
+
channelType: Type.Literal("email"),
|
|
48
48
|
toAddresses: Type.Array(Type.String()),
|
|
49
49
|
});
|
|
50
50
|
|
|
51
51
|
export const WebhookRoutingSchema = Type.Object({
|
|
52
|
-
|
|
52
|
+
channelType: Type.Literal("webhook"),
|
|
53
53
|
});
|
|
54
54
|
|
|
55
55
|
export const NotificationRoutingSchema = Type.Union([
|
|
@@ -70,7 +70,7 @@ export type NotificationRouting = Static<typeof NotificationRoutingSchema>;
|
|
|
70
70
|
export const MonitorNotificationSchema = Type.Object(
|
|
71
71
|
{
|
|
72
72
|
trigger: NotificationTriggerSchema,
|
|
73
|
-
integration: Type.String(),
|
|
73
|
+
integration: Type.Optional(Type.String()),
|
|
74
74
|
routing: NotificationRoutingSchema,
|
|
75
75
|
cooldown_minutes: Type.Optional(Type.Number({ minimum: 0 })),
|
|
76
76
|
},
|
|
@@ -96,22 +96,22 @@ class NotificationBuilder {
|
|
|
96
96
|
return this;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
toSlack(channel: string): MonitorNotification {
|
|
99
|
+
toSlack(channel: string, integration?: string): MonitorNotification {
|
|
100
100
|
return {
|
|
101
101
|
trigger: this.trigger,
|
|
102
|
-
integration
|
|
103
|
-
routing: {
|
|
102
|
+
...(integration !== undefined && { integration }),
|
|
103
|
+
routing: { channelType: "slack", channel },
|
|
104
104
|
...(this.cooldownMinutes !== undefined && {
|
|
105
105
|
cooldown_minutes: this.cooldownMinutes,
|
|
106
106
|
}),
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
toEmail(toAddresses: string[]): MonitorNotification {
|
|
110
|
+
toEmail(toAddresses: string[], integration?: string): MonitorNotification {
|
|
111
111
|
return {
|
|
112
112
|
trigger: this.trigger,
|
|
113
|
-
integration
|
|
114
|
-
routing: {
|
|
113
|
+
...(integration !== undefined && { integration }),
|
|
114
|
+
routing: { channelType: "email", toAddresses },
|
|
115
115
|
...(this.cooldownMinutes !== undefined && {
|
|
116
116
|
cooldown_minutes: this.cooldownMinutes,
|
|
117
117
|
}),
|
|
@@ -122,7 +122,7 @@ class NotificationBuilder {
|
|
|
122
122
|
return {
|
|
123
123
|
trigger: this.trigger,
|
|
124
124
|
integration,
|
|
125
|
-
routing: {
|
|
125
|
+
routing: { channelType: "webhook" },
|
|
126
126
|
...(this.cooldownMinutes !== undefined && {
|
|
127
127
|
cooldown_minutes: this.cooldownMinutes,
|
|
128
128
|
}),
|