@rustrak/client 0.2.1 → 0.3.0

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 {
@@ -160,15 +184,60 @@ declare class AlertRulesResource extends BaseResource {
160
184
  listHistory(projectId: number, options?: ListAlertHistoryOptions): Promise<AlertHistory[]>;
161
185
  }
162
186
 
187
+ declare const invitationSchema: z.ZodObject<{
188
+ token: z.ZodString;
189
+ email: z.ZodString;
190
+ role: z.ZodEnum<{
191
+ admin: "admin";
192
+ member: "member";
193
+ }>;
194
+ status: z.ZodString;
195
+ expires_at: z.ZodString;
196
+ created_at: z.ZodString;
197
+ }, z.core.$strip>;
198
+ declare const invitationInfoSchema: z.ZodObject<{
199
+ email: z.ZodString;
200
+ role: z.ZodEnum<{
201
+ admin: "admin";
202
+ member: "member";
203
+ }>;
204
+ status: z.ZodString;
205
+ expires_at: z.ZodString;
206
+ }, z.core.$strip>;
207
+ declare const createInvitationSchema: z.ZodObject<{
208
+ email: z.ZodString;
209
+ role: z.ZodEnum<{
210
+ admin: "admin";
211
+ member: "member";
212
+ }>;
213
+ }, z.core.$strip>;
214
+ declare const acceptInvitationSchema: z.ZodObject<{
215
+ token: z.ZodString;
216
+ password: z.ZodString;
217
+ }, z.core.$strip>;
218
+
219
+ type Invitation = z.infer<typeof invitationSchema>;
220
+ type InvitationInfo = z.infer<typeof invitationInfoSchema>;
221
+ type CreateInvitation = z.infer<typeof createInvitationSchema>;
222
+ type AcceptInvitation = z.infer<typeof acceptInvitationSchema>;
223
+
163
224
  declare const userSchema: z.ZodObject<{
164
225
  id: z.ZodNumber;
165
226
  email: z.ZodString;
227
+ role: z.ZodEnum<{
228
+ admin: "admin";
229
+ member: "member";
230
+ }>;
166
231
  is_admin: z.ZodBoolean;
167
232
  }, z.core.$strip>;
168
233
  declare const authResponseSchema: z.ZodObject<{
169
234
  user: z.ZodObject<{
170
235
  id: z.ZodNumber;
171
236
  email: z.ZodString;
237
+ role: z.ZodEnum<{
238
+ admin: "admin";
239
+ member: "member";
240
+ }>;
172
241
  is_admin: z.ZodBoolean;
173
242
  }, z.core.$strip>;
174
243
  }, z.core.$strip>;
@@ -176,6 +245,10 @@ declare const loginResultSchema: z.ZodObject<{
176
245
  user: z.ZodObject<{
177
246
  id: z.ZodNumber;
178
247
  email: z.ZodString;
248
+ role: z.ZodEnum<{
249
+ admin: "admin";
250
+ member: "member";
251
+ }>;
179
252
  is_admin: z.ZodBoolean;
180
253
  }, z.core.$strip>;
181
254
  cookies: z.ZodArray<z.ZodString>;
@@ -200,6 +273,8 @@ declare class AuthResource extends BaseResource {
200
273
  login(credentials: LoginRequest): Promise<LoginResult>;
201
274
  logout(): Promise<string[]>;
202
275
  getCurrentUser(): Promise<User>;
276
+ getInvitation(token: string): Promise<InvitationInfo>;
277
+ acceptInvitation(input: AcceptInvitation): Promise<LoginResult>;
203
278
  }
204
279
 
205
280
  declare const sortOrderSchema: z.ZodEnum<{
@@ -307,6 +382,34 @@ declare const updateIssueStateSchema: z.ZodObject<{
307
382
  type Issue = z.infer<typeof issueSchema>;
308
383
  type UpdateIssueState = z.infer<typeof updateIssueStateSchema>;
309
384
 
385
+ declare const projectRoleSchema: z.ZodEnum<{
386
+ admin: "admin";
387
+ viewer: "viewer";
388
+ editor: "editor";
389
+ }>;
390
+ declare const projectMemberSchema: z.ZodObject<{
391
+ user_id: z.ZodNumber;
392
+ email: z.ZodString;
393
+ role: z.ZodEnum<{
394
+ admin: "admin";
395
+ viewer: "viewer";
396
+ editor: "editor";
397
+ }>;
398
+ created_at: z.ZodString;
399
+ }, z.core.$strip>;
400
+ declare const upsertProjectMemberSchema: z.ZodObject<{
401
+ user_id: z.ZodNumber;
402
+ role: z.ZodEnum<{
403
+ admin: "admin";
404
+ viewer: "viewer";
405
+ editor: "editor";
406
+ }>;
407
+ }, z.core.$strip>;
408
+
409
+ type ProjectRole = z.infer<typeof projectRoleSchema>;
410
+ type ProjectMember = z.infer<typeof projectMemberSchema>;
411
+ type UpsertProjectMember = z.infer<typeof upsertProjectMemberSchema>;
412
+
310
413
  declare const projectSchema: z.ZodObject<{
311
414
  id: z.ZodNumber;
312
415
  name: z.ZodString;
@@ -371,6 +474,33 @@ interface AssembleInput {
371
474
  projects: string[];
372
475
  }
373
476
 
477
+ declare const globalRoleSchema: z.ZodEnum<{
478
+ admin: "admin";
479
+ member: "member";
480
+ }>;
481
+ declare const teamMemberSchema: z.ZodObject<{
482
+ id: z.ZodNumber;
483
+ email: z.ZodString;
484
+ role: z.ZodEnum<{
485
+ admin: "admin";
486
+ member: "member";
487
+ }>;
488
+ is_active: z.ZodBoolean;
489
+ is_primary: z.ZodOptional<z.ZodBoolean>;
490
+ created_at: z.ZodString;
491
+ last_login: z.ZodOptional<z.ZodNullable<z.ZodString>>;
492
+ }, z.core.$strip>;
493
+ declare const updateUserRoleSchema: z.ZodObject<{
494
+ role: z.ZodEnum<{
495
+ admin: "admin";
496
+ member: "member";
497
+ }>;
498
+ }, z.core.$strip>;
499
+
500
+ type GlobalRole = z.infer<typeof globalRoleSchema>;
501
+ type TeamMember = z.infer<typeof teamMemberSchema>;
502
+ type UpdateUserRole = z.infer<typeof updateUserRoleSchema>;
503
+
374
504
  declare const authTokenSchema: z.ZodObject<{
375
505
  id: z.ZodNumber;
376
506
  token_prefix: z.ZodString;
@@ -397,6 +527,12 @@ declare class EventsResource extends BaseResource {
397
527
  get(projectId: number, issueId: string, eventId: string): Promise<EventDetail>;
398
528
  }
399
529
 
530
+ declare class InvitationsResource extends BaseResource {
531
+ create(input: CreateInvitation): Promise<Invitation>;
532
+ list(): Promise<Invitation[]>;
533
+ revoke(token: string): Promise<void>;
534
+ }
535
+
400
536
  declare class IssuesResource extends BaseResource {
401
537
  list(projectId: number, options?: ListIssuesOptions): Promise<OffsetPaginatedResponse<Issue>>;
402
538
  get(projectId: number, issueId: string): Promise<Issue>;
@@ -404,6 +540,12 @@ declare class IssuesResource extends BaseResource {
404
540
  delete(projectId: number, issueId: string): Promise<void>;
405
541
  }
406
542
 
543
+ declare class MembersResource extends BaseResource {
544
+ list(projectId: number): Promise<ProjectMember[]>;
545
+ upsert(projectId: number, input: UpsertProjectMember): Promise<void>;
546
+ remove(projectId: number, userId: number): Promise<void>;
547
+ }
548
+
407
549
  declare class ProjectsResource extends BaseResource {
408
550
  list(options?: ListProjectsOptions): Promise<OffsetPaginatedResponse<Project>>;
409
551
  get(id: number): Promise<Project>;
@@ -422,6 +564,12 @@ declare class SourceMapsResource extends BaseResource {
422
564
  list(orgSlug: string, projectSlug: string): Promise<ListSourceMapsResponse>;
423
565
  }
424
566
 
567
+ declare class TeamResource extends BaseResource {
568
+ list(): Promise<TeamMember[]>;
569
+ updateRole(userId: number, role: GlobalRole): Promise<void>;
570
+ remove(userId: number): Promise<void>;
571
+ }
572
+
425
573
  declare class TokensResource extends BaseResource {
426
574
  list(): Promise<AuthToken[]>;
427
575
  get(id: number): Promise<AuthToken>;
@@ -436,9 +584,12 @@ declare class RustrakClient {
436
584
  readonly issues: IssuesResource;
437
585
  readonly events: EventsResource;
438
586
  readonly tokens: TokensResource;
439
- readonly alertChannels: AlertChannelsResource;
587
+ readonly alertIntegrations: AlertIntegrationsResource;
440
588
  readonly alertRules: AlertRulesResource;
441
589
  readonly sourceMaps: SourceMapsResource;
590
+ readonly team: TeamResource;
591
+ readonly invitations: InvitationsResource;
592
+ readonly members: MembersResource;
442
593
  constructor(config: ClientConfig);
443
594
  }
444
595
 
@@ -482,4 +633,4 @@ declare class ValidationError extends RustrakError {
482
633
  getValidationDetails(): string;
483
634
  }
484
635
 
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 };
636
+ export { type AcceptInvitation, 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 CreateInvitation, type CreateNotificationChannel, type CreateProject, type Event, type EventDetail, type GlobalRole, type Invitation, type InvitationInfo, 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 ProjectMember, type ProjectRole, type ProviderType, RateLimitError, type RegisterRequest, type RoutingOverride, RustrakClient, RustrakError, ServerError, type SortOrder, type SourceMapFile, type TeamMember, type TestChannelResponse, type TestIntegrationBody, type UpdateAlertIntegration, type UpdateAlertRule, type UpdateIssueState, type UpdateNotificationChannel, type UpdateProject, type UpdateUserRole, type UpsertProjectMember, type User, ValidationError };