@rustrak/client 0.2.1 → 0.2.2

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/index.d.cts CHANGED
@@ -9,7 +9,7 @@ interface ClientConfig {
9
9
  headers?: Record<string, string>;
10
10
  }
11
11
 
12
- declare const channelTypeSchema: z.ZodEnum<{
12
+ declare const providerTypeSchema: z.ZodEnum<{
13
13
  webhook: "webhook";
14
14
  email: "email";
15
15
  slack: "slack";
@@ -25,15 +25,15 @@ declare const alertStatusSchema: z.ZodEnum<{
25
25
  failed: "failed";
26
26
  skipped: "skipped";
27
27
  }>;
28
- declare const notificationChannelSchema: z.ZodObject<{
28
+ declare const alertIntegrationSchema: z.ZodObject<{
29
29
  id: z.ZodNumber;
30
30
  name: z.ZodString;
31
- channel_type: z.ZodEnum<{
31
+ provider_type: z.ZodEnum<{
32
32
  webhook: "webhook";
33
33
  email: "email";
34
34
  slack: "slack";
35
35
  }>;
36
- config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
36
+ credentials: z.ZodRecord<z.ZodString, z.ZodUnknown>;
37
37
  is_enabled: z.ZodBoolean;
38
38
  failure_count: z.ZodNumber;
39
39
  last_failure_at: z.ZodNullable<z.ZodString>;
@@ -42,21 +42,25 @@ declare const notificationChannelSchema: z.ZodObject<{
42
42
  created_at: z.ZodString;
43
43
  updated_at: z.ZodString;
44
44
  }, z.core.$strip>;
45
- declare const createNotificationChannelSchema: z.ZodObject<{
45
+ declare const createAlertIntegrationSchema: z.ZodObject<{
46
46
  name: z.ZodString;
47
- channel_type: z.ZodEnum<{
47
+ provider_type: z.ZodEnum<{
48
48
  webhook: "webhook";
49
49
  email: "email";
50
50
  slack: "slack";
51
51
  }>;
52
- config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
52
+ credentials: z.ZodRecord<z.ZodString, z.ZodUnknown>;
53
53
  is_enabled: z.ZodOptional<z.ZodBoolean>;
54
54
  }, z.core.$strip>;
55
- declare const updateNotificationChannelSchema: z.ZodObject<{
55
+ declare const updateAlertIntegrationSchema: z.ZodObject<{
56
56
  name: z.ZodOptional<z.ZodString>;
57
- config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
57
+ credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
58
58
  is_enabled: z.ZodOptional<z.ZodBoolean>;
59
59
  }, z.core.$strip>;
60
+ declare const alertRuleChannelInputSchema: z.ZodObject<{
61
+ integration_id: z.ZodNumber;
62
+ routing_override: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
63
+ }, z.core.$strip>;
60
64
  declare const alertRuleSchema: z.ZodObject<{
61
65
  id: z.ZodNumber;
62
66
  project_id: z.ZodNumber;
@@ -72,7 +76,11 @@ declare const alertRuleSchema: z.ZodObject<{
72
76
  last_triggered_at: z.ZodNullable<z.ZodString>;
73
77
  created_at: z.ZodString;
74
78
  updated_at: z.ZodString;
75
- channel_ids: z.ZodArray<z.ZodNumber>;
79
+ channels: z.ZodDefault<z.ZodArray<z.ZodObject<{
80
+ integration_id: z.ZodNumber;
81
+ routing_override: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
82
+ }, z.core.$strip>>>;
83
+ integration_ids: z.ZodArray<z.ZodNumber>;
76
84
  }, z.core.$strip>;
77
85
  declare const createAlertRuleSchema: z.ZodObject<{
78
86
  name: z.ZodString;
@@ -81,7 +89,10 @@ declare const createAlertRuleSchema: z.ZodObject<{
81
89
  regression: "regression";
82
90
  unmute: "unmute";
83
91
  }>;
84
- channel_ids: z.ZodArray<z.ZodNumber>;
92
+ channels: z.ZodDefault<z.ZodArray<z.ZodObject<{
93
+ integration_id: z.ZodNumber;
94
+ routing_override: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
95
+ }, z.core.$strip>>>;
85
96
  is_enabled: z.ZodOptional<z.ZodBoolean>;
86
97
  conditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
87
98
  cooldown_minutes: z.ZodOptional<z.ZodNumber>;
@@ -91,12 +102,15 @@ declare const updateAlertRuleSchema: z.ZodObject<{
91
102
  is_enabled: z.ZodOptional<z.ZodBoolean>;
92
103
  conditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
93
104
  cooldown_minutes: z.ZodOptional<z.ZodNumber>;
94
- channel_ids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
105
+ channels: z.ZodOptional<z.ZodArray<z.ZodObject<{
106
+ integration_id: z.ZodNumber;
107
+ routing_override: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
108
+ }, z.core.$strip>>>;
95
109
  }, z.core.$strip>;
96
110
  declare const alertHistorySchema: z.ZodObject<{
97
111
  id: z.ZodNumber;
98
112
  alert_rule_id: z.ZodNullable<z.ZodNumber>;
99
- channel_id: z.ZodNullable<z.ZodNumber>;
113
+ integration_id: z.ZodNullable<z.ZodNumber>;
100
114
  issue_id: z.ZodNullable<z.ZodString>;
101
115
  project_id: z.ZodNullable<z.ZodNumber>;
102
116
  alert_type: z.ZodString;
@@ -120,18 +134,28 @@ declare const testChannelResponseSchema: z.ZodObject<{
120
134
  success: z.ZodBoolean;
121
135
  message: z.ZodString;
122
136
  }, z.core.$strip>;
137
+ declare const testIntegrationBodySchema: z.ZodObject<{
138
+ routing_override: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
139
+ }, z.core.$strip>;
123
140
 
124
- type ChannelType = z.infer<typeof channelTypeSchema>;
141
+ type ProviderType = z.infer<typeof providerTypeSchema>;
142
+ type ChannelType = ProviderType;
125
143
  type AlertType = z.infer<typeof alertTypeSchema>;
126
144
  type AlertStatus = z.infer<typeof alertStatusSchema>;
127
- type NotificationChannel = z.infer<typeof notificationChannelSchema>;
128
- type CreateNotificationChannel = z.infer<typeof createNotificationChannelSchema>;
129
- type UpdateNotificationChannel = z.infer<typeof updateNotificationChannelSchema>;
145
+ type AlertIntegration = z.infer<typeof alertIntegrationSchema>;
146
+ type NotificationChannel = AlertIntegration;
147
+ type CreateAlertIntegration = z.infer<typeof createAlertIntegrationSchema>;
148
+ type CreateNotificationChannel = CreateAlertIntegration;
149
+ type UpdateAlertIntegration = z.infer<typeof updateAlertIntegrationSchema>;
150
+ type UpdateNotificationChannel = UpdateAlertIntegration;
151
+ type AlertRuleChannelInput = z.infer<typeof alertRuleChannelInputSchema>;
152
+ type RoutingOverride = Record<string, unknown>;
130
153
  type AlertRule = z.infer<typeof alertRuleSchema>;
131
154
  type CreateAlertRule = z.infer<typeof createAlertRuleSchema>;
132
155
  type UpdateAlertRule = z.infer<typeof updateAlertRuleSchema>;
133
156
  type AlertHistory = z.infer<typeof alertHistorySchema>;
134
157
  type TestChannelResponse = z.infer<typeof testChannelResponseSchema>;
158
+ type TestIntegrationBody = z.infer<typeof testIntegrationBodySchema>;
135
159
  interface ListAlertHistoryOptions {
136
160
  limit?: number;
137
161
  }
@@ -142,13 +166,13 @@ declare abstract class BaseResource {
142
166
  protected validate<T>(data: unknown, schema: ZodSchema<T>): T;
143
167
  }
144
168
 
145
- declare class AlertChannelsResource extends BaseResource {
146
- list(): Promise<NotificationChannel[]>;
147
- get(id: number): Promise<NotificationChannel>;
148
- create(input: CreateNotificationChannel): Promise<NotificationChannel>;
149
- update(id: number, input: UpdateNotificationChannel): Promise<NotificationChannel>;
169
+ declare class AlertIntegrationsResource extends BaseResource {
170
+ list(): Promise<AlertIntegration[]>;
171
+ get(id: number): Promise<AlertIntegration>;
172
+ create(input: CreateAlertIntegration): Promise<AlertIntegration>;
173
+ update(id: number, input: UpdateAlertIntegration): Promise<AlertIntegration>;
150
174
  delete(id: number): Promise<void>;
151
- test(id: number): Promise<TestChannelResponse>;
175
+ test(id: number, routingOverride?: RoutingOverride): Promise<TestChannelResponse>;
152
176
  }
153
177
 
154
178
  declare class AlertRulesResource extends BaseResource {
@@ -436,7 +460,7 @@ declare class RustrakClient {
436
460
  readonly issues: IssuesResource;
437
461
  readonly events: EventsResource;
438
462
  readonly tokens: TokensResource;
439
- readonly alertChannels: AlertChannelsResource;
463
+ readonly alertIntegrations: AlertIntegrationsResource;
440
464
  readonly alertRules: AlertRulesResource;
441
465
  readonly sourceMaps: SourceMapsResource;
442
466
  constructor(config: ClientConfig);
@@ -482,4 +506,4 @@ declare class ValidationError extends RustrakError {
482
506
  getValidationDetails(): string;
483
507
  }
484
508
 
485
- export { type AlertHistory, type AlertRule, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, AuthenticationError, AuthorizationError, BadRequestError, type ChannelType, type ChunkUploadCapability, type ClientConfig, type CreateAlertRule, type CreateAuthToken, type CreateNotificationChannel, type CreateProject, type Event, type EventDetail, type Issue, type IssueFilter, type IssueSort, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListProjectsOptions, type ListSourceMapsResponse, type LoginRequest, type LoginResult, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, RateLimitError, type RegisterRequest, RustrakClient, RustrakError, ServerError, type SortOrder, type SourceMapFile, type TestChannelResponse, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type User, ValidationError };
509
+ export { type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, AuthenticationError, AuthorizationError, BadRequestError, type ChannelType, type ChunkUploadCapability, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateNotificationChannel, type CreateProject, type Event, type EventDetail, type Issue, type IssueFilter, type IssueSort, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListProjectsOptions, type ListSourceMapsResponse, type LoginRequest, type LoginResult, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProviderType, RateLimitError, type RegisterRequest, type RoutingOverride, RustrakClient, RustrakError, ServerError, type SortOrder, type SourceMapFile, type TestChannelResponse, type TestIntegrationBody, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type User, ValidationError };
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ interface ClientConfig {
9
9
  headers?: Record<string, string>;
10
10
  }
11
11
 
12
- declare const channelTypeSchema: z.ZodEnum<{
12
+ declare const providerTypeSchema: z.ZodEnum<{
13
13
  webhook: "webhook";
14
14
  email: "email";
15
15
  slack: "slack";
@@ -25,15 +25,15 @@ declare const alertStatusSchema: z.ZodEnum<{
25
25
  failed: "failed";
26
26
  skipped: "skipped";
27
27
  }>;
28
- declare const notificationChannelSchema: z.ZodObject<{
28
+ declare const alertIntegrationSchema: z.ZodObject<{
29
29
  id: z.ZodNumber;
30
30
  name: z.ZodString;
31
- channel_type: z.ZodEnum<{
31
+ provider_type: z.ZodEnum<{
32
32
  webhook: "webhook";
33
33
  email: "email";
34
34
  slack: "slack";
35
35
  }>;
36
- config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
36
+ credentials: z.ZodRecord<z.ZodString, z.ZodUnknown>;
37
37
  is_enabled: z.ZodBoolean;
38
38
  failure_count: z.ZodNumber;
39
39
  last_failure_at: z.ZodNullable<z.ZodString>;
@@ -42,21 +42,25 @@ declare const notificationChannelSchema: z.ZodObject<{
42
42
  created_at: z.ZodString;
43
43
  updated_at: z.ZodString;
44
44
  }, z.core.$strip>;
45
- declare const createNotificationChannelSchema: z.ZodObject<{
45
+ declare const createAlertIntegrationSchema: z.ZodObject<{
46
46
  name: z.ZodString;
47
- channel_type: z.ZodEnum<{
47
+ provider_type: z.ZodEnum<{
48
48
  webhook: "webhook";
49
49
  email: "email";
50
50
  slack: "slack";
51
51
  }>;
52
- config: z.ZodRecord<z.ZodString, z.ZodUnknown>;
52
+ credentials: z.ZodRecord<z.ZodString, z.ZodUnknown>;
53
53
  is_enabled: z.ZodOptional<z.ZodBoolean>;
54
54
  }, z.core.$strip>;
55
- declare const updateNotificationChannelSchema: z.ZodObject<{
55
+ declare const updateAlertIntegrationSchema: z.ZodObject<{
56
56
  name: z.ZodOptional<z.ZodString>;
57
- config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
57
+ credentials: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
58
58
  is_enabled: z.ZodOptional<z.ZodBoolean>;
59
59
  }, z.core.$strip>;
60
+ declare const alertRuleChannelInputSchema: z.ZodObject<{
61
+ integration_id: z.ZodNumber;
62
+ routing_override: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
63
+ }, z.core.$strip>;
60
64
  declare const alertRuleSchema: z.ZodObject<{
61
65
  id: z.ZodNumber;
62
66
  project_id: z.ZodNumber;
@@ -72,7 +76,11 @@ declare const alertRuleSchema: z.ZodObject<{
72
76
  last_triggered_at: z.ZodNullable<z.ZodString>;
73
77
  created_at: z.ZodString;
74
78
  updated_at: z.ZodString;
75
- channel_ids: z.ZodArray<z.ZodNumber>;
79
+ channels: z.ZodDefault<z.ZodArray<z.ZodObject<{
80
+ integration_id: z.ZodNumber;
81
+ routing_override: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
82
+ }, z.core.$strip>>>;
83
+ integration_ids: z.ZodArray<z.ZodNumber>;
76
84
  }, z.core.$strip>;
77
85
  declare const createAlertRuleSchema: z.ZodObject<{
78
86
  name: z.ZodString;
@@ -81,7 +89,10 @@ declare const createAlertRuleSchema: z.ZodObject<{
81
89
  regression: "regression";
82
90
  unmute: "unmute";
83
91
  }>;
84
- channel_ids: z.ZodArray<z.ZodNumber>;
92
+ channels: z.ZodDefault<z.ZodArray<z.ZodObject<{
93
+ integration_id: z.ZodNumber;
94
+ routing_override: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
95
+ }, z.core.$strip>>>;
85
96
  is_enabled: z.ZodOptional<z.ZodBoolean>;
86
97
  conditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
87
98
  cooldown_minutes: z.ZodOptional<z.ZodNumber>;
@@ -91,12 +102,15 @@ declare const updateAlertRuleSchema: z.ZodObject<{
91
102
  is_enabled: z.ZodOptional<z.ZodBoolean>;
92
103
  conditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
93
104
  cooldown_minutes: z.ZodOptional<z.ZodNumber>;
94
- channel_ids: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
105
+ channels: z.ZodOptional<z.ZodArray<z.ZodObject<{
106
+ integration_id: z.ZodNumber;
107
+ routing_override: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
108
+ }, z.core.$strip>>>;
95
109
  }, z.core.$strip>;
96
110
  declare const alertHistorySchema: z.ZodObject<{
97
111
  id: z.ZodNumber;
98
112
  alert_rule_id: z.ZodNullable<z.ZodNumber>;
99
- channel_id: z.ZodNullable<z.ZodNumber>;
113
+ integration_id: z.ZodNullable<z.ZodNumber>;
100
114
  issue_id: z.ZodNullable<z.ZodString>;
101
115
  project_id: z.ZodNullable<z.ZodNumber>;
102
116
  alert_type: z.ZodString;
@@ -120,18 +134,28 @@ declare const testChannelResponseSchema: z.ZodObject<{
120
134
  success: z.ZodBoolean;
121
135
  message: z.ZodString;
122
136
  }, z.core.$strip>;
137
+ declare const testIntegrationBodySchema: z.ZodObject<{
138
+ routing_override: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
139
+ }, z.core.$strip>;
123
140
 
124
- type ChannelType = z.infer<typeof channelTypeSchema>;
141
+ type ProviderType = z.infer<typeof providerTypeSchema>;
142
+ type ChannelType = ProviderType;
125
143
  type AlertType = z.infer<typeof alertTypeSchema>;
126
144
  type AlertStatus = z.infer<typeof alertStatusSchema>;
127
- type NotificationChannel = z.infer<typeof notificationChannelSchema>;
128
- type CreateNotificationChannel = z.infer<typeof createNotificationChannelSchema>;
129
- type UpdateNotificationChannel = z.infer<typeof updateNotificationChannelSchema>;
145
+ type AlertIntegration = z.infer<typeof alertIntegrationSchema>;
146
+ type NotificationChannel = AlertIntegration;
147
+ type CreateAlertIntegration = z.infer<typeof createAlertIntegrationSchema>;
148
+ type CreateNotificationChannel = CreateAlertIntegration;
149
+ type UpdateAlertIntegration = z.infer<typeof updateAlertIntegrationSchema>;
150
+ type UpdateNotificationChannel = UpdateAlertIntegration;
151
+ type AlertRuleChannelInput = z.infer<typeof alertRuleChannelInputSchema>;
152
+ type RoutingOverride = Record<string, unknown>;
130
153
  type AlertRule = z.infer<typeof alertRuleSchema>;
131
154
  type CreateAlertRule = z.infer<typeof createAlertRuleSchema>;
132
155
  type UpdateAlertRule = z.infer<typeof updateAlertRuleSchema>;
133
156
  type AlertHistory = z.infer<typeof alertHistorySchema>;
134
157
  type TestChannelResponse = z.infer<typeof testChannelResponseSchema>;
158
+ type TestIntegrationBody = z.infer<typeof testIntegrationBodySchema>;
135
159
  interface ListAlertHistoryOptions {
136
160
  limit?: number;
137
161
  }
@@ -142,13 +166,13 @@ declare abstract class BaseResource {
142
166
  protected validate<T>(data: unknown, schema: ZodSchema<T>): T;
143
167
  }
144
168
 
145
- declare class AlertChannelsResource extends BaseResource {
146
- list(): Promise<NotificationChannel[]>;
147
- get(id: number): Promise<NotificationChannel>;
148
- create(input: CreateNotificationChannel): Promise<NotificationChannel>;
149
- update(id: number, input: UpdateNotificationChannel): Promise<NotificationChannel>;
169
+ declare class AlertIntegrationsResource extends BaseResource {
170
+ list(): Promise<AlertIntegration[]>;
171
+ get(id: number): Promise<AlertIntegration>;
172
+ create(input: CreateAlertIntegration): Promise<AlertIntegration>;
173
+ update(id: number, input: UpdateAlertIntegration): Promise<AlertIntegration>;
150
174
  delete(id: number): Promise<void>;
151
- test(id: number): Promise<TestChannelResponse>;
175
+ test(id: number, routingOverride?: RoutingOverride): Promise<TestChannelResponse>;
152
176
  }
153
177
 
154
178
  declare class AlertRulesResource extends BaseResource {
@@ -436,7 +460,7 @@ declare class RustrakClient {
436
460
  readonly issues: IssuesResource;
437
461
  readonly events: EventsResource;
438
462
  readonly tokens: TokensResource;
439
- readonly alertChannels: AlertChannelsResource;
463
+ readonly alertIntegrations: AlertIntegrationsResource;
440
464
  readonly alertRules: AlertRulesResource;
441
465
  readonly sourceMaps: SourceMapsResource;
442
466
  constructor(config: ClientConfig);
@@ -482,4 +506,4 @@ declare class ValidationError extends RustrakError {
482
506
  getValidationDetails(): string;
483
507
  }
484
508
 
485
- export { type AlertHistory, type AlertRule, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, AuthenticationError, AuthorizationError, BadRequestError, type ChannelType, type ChunkUploadCapability, type ClientConfig, type CreateAlertRule, type CreateAuthToken, type CreateNotificationChannel, type CreateProject, type Event, type EventDetail, type Issue, type IssueFilter, type IssueSort, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListProjectsOptions, type ListSourceMapsResponse, type LoginRequest, type LoginResult, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, RateLimitError, type RegisterRequest, RustrakClient, RustrakError, ServerError, type SortOrder, type SourceMapFile, type TestChannelResponse, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type User, ValidationError };
509
+ export { type AlertHistory, type AlertIntegration, type AlertRule, type AlertRuleChannelInput, type AlertStatus, type AlertType, type ApiError, type AssembleInput, type AssembleResponse, type AuthResponse, type AuthToken, type AuthTokenCreated, AuthenticationError, AuthorizationError, BadRequestError, type ChannelType, type ChunkUploadCapability, type ClientConfig, type CreateAlertIntegration, type CreateAlertRule, type CreateAuthToken, type CreateNotificationChannel, type CreateProject, type Event, type EventDetail, type Issue, type IssueFilter, type IssueSort, type ListAlertHistoryOptions, type ListEventsOptions, type ListIssuesOptions, type ListProjectsOptions, type ListSourceMapsResponse, type LoginRequest, type LoginResult, NetworkError, NotFoundError, type NotificationChannel, type OffsetPaginatedResponse, type PaginatedResponse, type Project, type ProviderType, RateLimitError, type RegisterRequest, type RoutingOverride, RustrakClient, RustrakError, ServerError, type SortOrder, type SourceMapFile, type TestChannelResponse, type TestIntegrationBody, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type User, ValidationError };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import ky, { isHTTPError } from 'ky';
3
3
 
4
- // src/resources/alert-channels.ts
4
+ // src/resources/alert-integrations.ts
5
5
  var paginatedResponseSchema = (itemSchema) => z.object({
6
6
  items: z.array(itemSchema),
7
7
  next_cursor: z.string().optional(),
@@ -25,7 +25,7 @@ z.object({
25
25
  });
26
26
 
27
27
  // src/schemas/alert.ts
28
- var channelTypeSchema = z.enum(["webhook", "email", "slack"]);
28
+ var providerTypeSchema = z.enum(["webhook", "email", "slack"]);
29
29
  var alertTypeSchema = z.enum(["new_issue", "regression", "unmute"]);
30
30
  var alertStatusSchema = z.enum([
31
31
  "pending",
@@ -33,11 +33,11 @@ var alertStatusSchema = z.enum([
33
33
  "failed",
34
34
  "skipped"
35
35
  ]);
36
- var notificationChannelSchema = z.object({
36
+ var alertIntegrationSchema = z.object({
37
37
  id: z.number().int(),
38
38
  name: z.string(),
39
- channel_type: channelTypeSchema,
40
- config: z.record(z.string(), z.unknown()),
39
+ provider_type: providerTypeSchema,
40
+ credentials: z.record(z.string(), z.unknown()),
41
41
  is_enabled: z.boolean(),
42
42
  failure_count: z.number().int(),
43
43
  last_failure_at: dateTimeSchema.nullable(),
@@ -46,17 +46,21 @@ var notificationChannelSchema = z.object({
46
46
  created_at: dateTimeSchema,
47
47
  updated_at: dateTimeSchema
48
48
  });
49
- var createNotificationChannelSchema = z.object({
49
+ var createAlertIntegrationSchema = z.object({
50
50
  name: z.string().min(1),
51
- channel_type: channelTypeSchema,
52
- config: z.record(z.string(), z.unknown()),
51
+ provider_type: providerTypeSchema,
52
+ credentials: z.record(z.string(), z.unknown()),
53
53
  is_enabled: z.boolean().optional()
54
54
  });
55
- var updateNotificationChannelSchema = z.object({
55
+ var updateAlertIntegrationSchema = z.object({
56
56
  name: z.string().min(1).optional(),
57
- config: z.record(z.string(), z.unknown()).optional(),
57
+ credentials: z.record(z.string(), z.unknown()).optional(),
58
58
  is_enabled: z.boolean().optional()
59
59
  });
60
+ var alertRuleChannelInputSchema = z.object({
61
+ integration_id: z.number().int(),
62
+ routing_override: z.record(z.string(), z.unknown()).default({})
63
+ });
60
64
  var alertRuleSchema = z.object({
61
65
  id: z.number().int(),
62
66
  project_id: z.number().int(),
@@ -68,12 +72,13 @@ var alertRuleSchema = z.object({
68
72
  last_triggered_at: dateTimeSchema.nullable(),
69
73
  created_at: dateTimeSchema,
70
74
  updated_at: dateTimeSchema,
71
- channel_ids: z.array(z.number().int())
75
+ channels: z.array(alertRuleChannelInputSchema).default([]),
76
+ integration_ids: z.array(z.number().int())
72
77
  });
73
78
  var createAlertRuleSchema = z.object({
74
79
  name: z.string().min(1),
75
80
  alert_type: alertTypeSchema,
76
- channel_ids: z.array(z.number().int()).min(1),
81
+ channels: z.array(alertRuleChannelInputSchema).default([]),
77
82
  is_enabled: z.boolean().optional(),
78
83
  conditions: z.record(z.string(), z.unknown()).optional(),
79
84
  cooldown_minutes: z.number().int().min(0).optional()
@@ -83,12 +88,12 @@ var updateAlertRuleSchema = z.object({
83
88
  is_enabled: z.boolean().optional(),
84
89
  conditions: z.record(z.string(), z.unknown()).optional(),
85
90
  cooldown_minutes: z.number().int().min(0).optional(),
86
- channel_ids: z.array(z.number().int()).optional()
91
+ channels: z.array(alertRuleChannelInputSchema).optional()
87
92
  });
88
93
  var alertHistorySchema = z.object({
89
94
  id: z.number().int(),
90
95
  alert_rule_id: z.number().int().nullable(),
91
- channel_id: z.number().int().nullable(),
96
+ integration_id: z.number().int().nullable(),
92
97
  issue_id: z.string().uuid().nullable(),
93
98
  project_id: z.number().int().nullable(),
94
99
  alert_type: z.string(),
@@ -107,6 +112,9 @@ var testChannelResponseSchema = z.object({
107
112
  success: z.boolean(),
108
113
  message: z.string()
109
114
  });
115
+ var testIntegrationBodySchema = z.object({
116
+ routing_override: z.record(z.string(), z.unknown()).optional()
117
+ });
110
118
 
111
119
  // src/errors/base.ts
112
120
  var RustrakError = class extends Error {
@@ -222,55 +230,57 @@ var BaseResource = class {
222
230
  }
223
231
  };
224
232
 
225
- // src/resources/alert-channels.ts
226
- var AlertChannelsResource = class extends BaseResource {
233
+ // src/resources/alert-integrations.ts
234
+ var AlertIntegrationsResource = class extends BaseResource {
227
235
  /**
228
- * List all notification channels
236
+ * List all alert integrations
229
237
  */
230
238
  async list() {
231
- const data = await this.http.get("api/alert-channels").json();
232
- return this.validate(data, z.array(notificationChannelSchema));
239
+ const data = await this.http.get("api/integrations").json();
240
+ return this.validate(data, z.array(alertIntegrationSchema));
233
241
  }
234
242
  /**
235
- * Get a single notification channel by ID
243
+ * Get a single alert integration by ID
236
244
  */
237
245
  async get(id) {
238
- const data = await this.http.get(`api/alert-channels/${id}`).json();
239
- return this.validate(data, notificationChannelSchema);
246
+ const data = await this.http.get(`api/integrations/${id}`).json();
247
+ return this.validate(data, alertIntegrationSchema);
240
248
  }
241
249
  /**
242
- * Create a new notification channel
250
+ * Create a new alert integration
243
251
  */
244
252
  async create(input) {
245
- const validatedInput = this.validate(
246
- input,
247
- createNotificationChannelSchema
248
- );
249
- const data = await this.http.post("api/alert-channels", { json: validatedInput }).json();
250
- return this.validate(data, notificationChannelSchema);
253
+ const validatedInput = this.validate(input, createAlertIntegrationSchema);
254
+ const data = await this.http.post("api/integrations", { json: validatedInput }).json();
255
+ return this.validate(data, alertIntegrationSchema);
251
256
  }
252
257
  /**
253
- * Update an existing notification channel
258
+ * Update an existing alert integration
254
259
  */
255
260
  async update(id, input) {
256
- const validatedInput = this.validate(
257
- input,
258
- updateNotificationChannelSchema
259
- );
260
- const data = await this.http.patch(`api/alert-channels/${id}`, { json: validatedInput }).json();
261
- return this.validate(data, notificationChannelSchema);
261
+ const validatedInput = this.validate(input, updateAlertIntegrationSchema);
262
+ const data = await this.http.patch(`api/integrations/${id}`, { json: validatedInput }).json();
263
+ return this.validate(data, alertIntegrationSchema);
262
264
  }
263
265
  /**
264
- * Delete a notification channel
266
+ * Delete an alert integration
265
267
  */
266
268
  async delete(id) {
267
- await this.http.delete(`api/alert-channels/${id}`);
269
+ await this.http.delete(`api/integrations/${id}`);
268
270
  }
269
271
  /**
270
- * Send a test notification to verify channel configuration
272
+ * Send a test notification to verify integration configuration.
273
+ * For Slack bot_token integrations, routingOverride must include `channel`.
271
274
  */
272
- async test(id) {
273
- const data = await this.http.post(`api/alert-channels/${id}/test`).json();
275
+ async test(id, routingOverride) {
276
+ const body = routingOverride !== void 0 ? this.validate(
277
+ { routing_override: routingOverride },
278
+ testIntegrationBodySchema
279
+ ) : void 0;
280
+ const data = await this.http.post(
281
+ `api/integrations/${id}/test`,
282
+ body !== void 0 ? { json: body } : void 0
283
+ ).json();
274
284
  return this.validate(data, testChannelResponseSchema);
275
285
  }
276
286
  };
@@ -813,9 +823,9 @@ var RustrakClient = class {
813
823
  */
814
824
  tokens;
815
825
  /**
816
- * Alert Channels API resource (global notification destinations)
826
+ * Alert Integrations API resource (global credential destinations)
817
827
  */
818
- alertChannels;
828
+ alertIntegrations;
819
829
  /**
820
830
  * Alert Rules API resource (per-project alert configuration)
821
831
  */
@@ -836,7 +846,7 @@ var RustrakClient = class {
836
846
  this.issues = new IssuesResource(this.http);
837
847
  this.events = new EventsResource(this.http);
838
848
  this.tokens = new TokensResource(this.http);
839
- this.alertChannels = new AlertChannelsResource(this.http);
849
+ this.alertIntegrations = new AlertIntegrationsResource(this.http);
840
850
  this.alertRules = new AlertRulesResource(this.http);
841
851
  this.sourceMaps = new SourceMapsResource(this.http);
842
852
  }