@rustrak/client 0.2.2 → 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.cjs +181 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +128 -1
- package/dist/index.d.ts +128 -1
- package/dist/index.js +181 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -184,15 +184,60 @@ declare class AlertRulesResource extends BaseResource {
|
|
|
184
184
|
listHistory(projectId: number, options?: ListAlertHistoryOptions): Promise<AlertHistory[]>;
|
|
185
185
|
}
|
|
186
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
|
+
|
|
187
224
|
declare const userSchema: z.ZodObject<{
|
|
188
225
|
id: z.ZodNumber;
|
|
189
226
|
email: z.ZodString;
|
|
227
|
+
role: z.ZodEnum<{
|
|
228
|
+
admin: "admin";
|
|
229
|
+
member: "member";
|
|
230
|
+
}>;
|
|
190
231
|
is_admin: z.ZodBoolean;
|
|
191
232
|
}, z.core.$strip>;
|
|
192
233
|
declare const authResponseSchema: z.ZodObject<{
|
|
193
234
|
user: z.ZodObject<{
|
|
194
235
|
id: z.ZodNumber;
|
|
195
236
|
email: z.ZodString;
|
|
237
|
+
role: z.ZodEnum<{
|
|
238
|
+
admin: "admin";
|
|
239
|
+
member: "member";
|
|
240
|
+
}>;
|
|
196
241
|
is_admin: z.ZodBoolean;
|
|
197
242
|
}, z.core.$strip>;
|
|
198
243
|
}, z.core.$strip>;
|
|
@@ -200,6 +245,10 @@ declare const loginResultSchema: z.ZodObject<{
|
|
|
200
245
|
user: z.ZodObject<{
|
|
201
246
|
id: z.ZodNumber;
|
|
202
247
|
email: z.ZodString;
|
|
248
|
+
role: z.ZodEnum<{
|
|
249
|
+
admin: "admin";
|
|
250
|
+
member: "member";
|
|
251
|
+
}>;
|
|
203
252
|
is_admin: z.ZodBoolean;
|
|
204
253
|
}, z.core.$strip>;
|
|
205
254
|
cookies: z.ZodArray<z.ZodString>;
|
|
@@ -224,6 +273,8 @@ declare class AuthResource extends BaseResource {
|
|
|
224
273
|
login(credentials: LoginRequest): Promise<LoginResult>;
|
|
225
274
|
logout(): Promise<string[]>;
|
|
226
275
|
getCurrentUser(): Promise<User>;
|
|
276
|
+
getInvitation(token: string): Promise<InvitationInfo>;
|
|
277
|
+
acceptInvitation(input: AcceptInvitation): Promise<LoginResult>;
|
|
227
278
|
}
|
|
228
279
|
|
|
229
280
|
declare const sortOrderSchema: z.ZodEnum<{
|
|
@@ -331,6 +382,34 @@ declare const updateIssueStateSchema: z.ZodObject<{
|
|
|
331
382
|
type Issue = z.infer<typeof issueSchema>;
|
|
332
383
|
type UpdateIssueState = z.infer<typeof updateIssueStateSchema>;
|
|
333
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
|
+
|
|
334
413
|
declare const projectSchema: z.ZodObject<{
|
|
335
414
|
id: z.ZodNumber;
|
|
336
415
|
name: z.ZodString;
|
|
@@ -395,6 +474,33 @@ interface AssembleInput {
|
|
|
395
474
|
projects: string[];
|
|
396
475
|
}
|
|
397
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
|
+
|
|
398
504
|
declare const authTokenSchema: z.ZodObject<{
|
|
399
505
|
id: z.ZodNumber;
|
|
400
506
|
token_prefix: z.ZodString;
|
|
@@ -421,6 +527,12 @@ declare class EventsResource extends BaseResource {
|
|
|
421
527
|
get(projectId: number, issueId: string, eventId: string): Promise<EventDetail>;
|
|
422
528
|
}
|
|
423
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
|
+
|
|
424
536
|
declare class IssuesResource extends BaseResource {
|
|
425
537
|
list(projectId: number, options?: ListIssuesOptions): Promise<OffsetPaginatedResponse<Issue>>;
|
|
426
538
|
get(projectId: number, issueId: string): Promise<Issue>;
|
|
@@ -428,6 +540,12 @@ declare class IssuesResource extends BaseResource {
|
|
|
428
540
|
delete(projectId: number, issueId: string): Promise<void>;
|
|
429
541
|
}
|
|
430
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
|
+
|
|
431
549
|
declare class ProjectsResource extends BaseResource {
|
|
432
550
|
list(options?: ListProjectsOptions): Promise<OffsetPaginatedResponse<Project>>;
|
|
433
551
|
get(id: number): Promise<Project>;
|
|
@@ -446,6 +564,12 @@ declare class SourceMapsResource extends BaseResource {
|
|
|
446
564
|
list(orgSlug: string, projectSlug: string): Promise<ListSourceMapsResponse>;
|
|
447
565
|
}
|
|
448
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
|
+
|
|
449
573
|
declare class TokensResource extends BaseResource {
|
|
450
574
|
list(): Promise<AuthToken[]>;
|
|
451
575
|
get(id: number): Promise<AuthToken>;
|
|
@@ -463,6 +587,9 @@ declare class RustrakClient {
|
|
|
463
587
|
readonly alertIntegrations: AlertIntegrationsResource;
|
|
464
588
|
readonly alertRules: AlertRulesResource;
|
|
465
589
|
readonly sourceMaps: SourceMapsResource;
|
|
590
|
+
readonly team: TeamResource;
|
|
591
|
+
readonly invitations: InvitationsResource;
|
|
592
|
+
readonly members: MembersResource;
|
|
466
593
|
constructor(config: ClientConfig);
|
|
467
594
|
}
|
|
468
595
|
|
|
@@ -506,4 +633,4 @@ declare class ValidationError extends RustrakError {
|
|
|
506
633
|
getValidationDetails(): string;
|
|
507
634
|
}
|
|
508
635
|
|
|
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -184,15 +184,60 @@ declare class AlertRulesResource extends BaseResource {
|
|
|
184
184
|
listHistory(projectId: number, options?: ListAlertHistoryOptions): Promise<AlertHistory[]>;
|
|
185
185
|
}
|
|
186
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
|
+
|
|
187
224
|
declare const userSchema: z.ZodObject<{
|
|
188
225
|
id: z.ZodNumber;
|
|
189
226
|
email: z.ZodString;
|
|
227
|
+
role: z.ZodEnum<{
|
|
228
|
+
admin: "admin";
|
|
229
|
+
member: "member";
|
|
230
|
+
}>;
|
|
190
231
|
is_admin: z.ZodBoolean;
|
|
191
232
|
}, z.core.$strip>;
|
|
192
233
|
declare const authResponseSchema: z.ZodObject<{
|
|
193
234
|
user: z.ZodObject<{
|
|
194
235
|
id: z.ZodNumber;
|
|
195
236
|
email: z.ZodString;
|
|
237
|
+
role: z.ZodEnum<{
|
|
238
|
+
admin: "admin";
|
|
239
|
+
member: "member";
|
|
240
|
+
}>;
|
|
196
241
|
is_admin: z.ZodBoolean;
|
|
197
242
|
}, z.core.$strip>;
|
|
198
243
|
}, z.core.$strip>;
|
|
@@ -200,6 +245,10 @@ declare const loginResultSchema: z.ZodObject<{
|
|
|
200
245
|
user: z.ZodObject<{
|
|
201
246
|
id: z.ZodNumber;
|
|
202
247
|
email: z.ZodString;
|
|
248
|
+
role: z.ZodEnum<{
|
|
249
|
+
admin: "admin";
|
|
250
|
+
member: "member";
|
|
251
|
+
}>;
|
|
203
252
|
is_admin: z.ZodBoolean;
|
|
204
253
|
}, z.core.$strip>;
|
|
205
254
|
cookies: z.ZodArray<z.ZodString>;
|
|
@@ -224,6 +273,8 @@ declare class AuthResource extends BaseResource {
|
|
|
224
273
|
login(credentials: LoginRequest): Promise<LoginResult>;
|
|
225
274
|
logout(): Promise<string[]>;
|
|
226
275
|
getCurrentUser(): Promise<User>;
|
|
276
|
+
getInvitation(token: string): Promise<InvitationInfo>;
|
|
277
|
+
acceptInvitation(input: AcceptInvitation): Promise<LoginResult>;
|
|
227
278
|
}
|
|
228
279
|
|
|
229
280
|
declare const sortOrderSchema: z.ZodEnum<{
|
|
@@ -331,6 +382,34 @@ declare const updateIssueStateSchema: z.ZodObject<{
|
|
|
331
382
|
type Issue = z.infer<typeof issueSchema>;
|
|
332
383
|
type UpdateIssueState = z.infer<typeof updateIssueStateSchema>;
|
|
333
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
|
+
|
|
334
413
|
declare const projectSchema: z.ZodObject<{
|
|
335
414
|
id: z.ZodNumber;
|
|
336
415
|
name: z.ZodString;
|
|
@@ -395,6 +474,33 @@ interface AssembleInput {
|
|
|
395
474
|
projects: string[];
|
|
396
475
|
}
|
|
397
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
|
+
|
|
398
504
|
declare const authTokenSchema: z.ZodObject<{
|
|
399
505
|
id: z.ZodNumber;
|
|
400
506
|
token_prefix: z.ZodString;
|
|
@@ -421,6 +527,12 @@ declare class EventsResource extends BaseResource {
|
|
|
421
527
|
get(projectId: number, issueId: string, eventId: string): Promise<EventDetail>;
|
|
422
528
|
}
|
|
423
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
|
+
|
|
424
536
|
declare class IssuesResource extends BaseResource {
|
|
425
537
|
list(projectId: number, options?: ListIssuesOptions): Promise<OffsetPaginatedResponse<Issue>>;
|
|
426
538
|
get(projectId: number, issueId: string): Promise<Issue>;
|
|
@@ -428,6 +540,12 @@ declare class IssuesResource extends BaseResource {
|
|
|
428
540
|
delete(projectId: number, issueId: string): Promise<void>;
|
|
429
541
|
}
|
|
430
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
|
+
|
|
431
549
|
declare class ProjectsResource extends BaseResource {
|
|
432
550
|
list(options?: ListProjectsOptions): Promise<OffsetPaginatedResponse<Project>>;
|
|
433
551
|
get(id: number): Promise<Project>;
|
|
@@ -446,6 +564,12 @@ declare class SourceMapsResource extends BaseResource {
|
|
|
446
564
|
list(orgSlug: string, projectSlug: string): Promise<ListSourceMapsResponse>;
|
|
447
565
|
}
|
|
448
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
|
+
|
|
449
573
|
declare class TokensResource extends BaseResource {
|
|
450
574
|
list(): Promise<AuthToken[]>;
|
|
451
575
|
get(id: number): Promise<AuthToken>;
|
|
@@ -463,6 +587,9 @@ declare class RustrakClient {
|
|
|
463
587
|
readonly alertIntegrations: AlertIntegrationsResource;
|
|
464
588
|
readonly alertRules: AlertRulesResource;
|
|
465
589
|
readonly sourceMaps: SourceMapsResource;
|
|
590
|
+
readonly team: TeamResource;
|
|
591
|
+
readonly invitations: InvitationsResource;
|
|
592
|
+
readonly members: MembersResource;
|
|
466
593
|
constructor(config: ClientConfig);
|
|
467
594
|
}
|
|
468
595
|
|
|
@@ -506,4 +633,4 @@ declare class ValidationError extends RustrakError {
|
|
|
506
633
|
getValidationDetails(): string;
|
|
507
634
|
}
|
|
508
635
|
|
|
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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -337,9 +337,49 @@ var AlertRulesResource = class extends BaseResource {
|
|
|
337
337
|
return this.validate(data, z.array(alertHistorySchema));
|
|
338
338
|
}
|
|
339
339
|
};
|
|
340
|
+
var globalRoleSchema = z.enum(["admin", "member"]);
|
|
341
|
+
var teamMemberSchema = z.object({
|
|
342
|
+
id: z.number().int(),
|
|
343
|
+
email: z.string().email(),
|
|
344
|
+
role: globalRoleSchema,
|
|
345
|
+
is_active: z.boolean(),
|
|
346
|
+
/** True for the first-registered account, which cannot be demoted or deleted. */
|
|
347
|
+
is_primary: z.boolean().optional(),
|
|
348
|
+
created_at: dateTimeSchema,
|
|
349
|
+
last_login: dateTimeSchema.nullable().optional()
|
|
350
|
+
});
|
|
351
|
+
var updateUserRoleSchema = z.object({
|
|
352
|
+
role: globalRoleSchema
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
// src/schemas/invitation.ts
|
|
356
|
+
var invitationStatusSchema = z.string();
|
|
357
|
+
var invitationSchema = z.object({
|
|
358
|
+
token: z.string(),
|
|
359
|
+
email: z.string().email(),
|
|
360
|
+
role: globalRoleSchema,
|
|
361
|
+
status: invitationStatusSchema,
|
|
362
|
+
expires_at: dateTimeSchema,
|
|
363
|
+
created_at: dateTimeSchema
|
|
364
|
+
});
|
|
365
|
+
var invitationInfoSchema = z.object({
|
|
366
|
+
email: z.string().email(),
|
|
367
|
+
role: globalRoleSchema,
|
|
368
|
+
status: invitationStatusSchema,
|
|
369
|
+
expires_at: dateTimeSchema
|
|
370
|
+
});
|
|
371
|
+
var createInvitationSchema = z.object({
|
|
372
|
+
email: z.string().email(),
|
|
373
|
+
role: globalRoleSchema
|
|
374
|
+
});
|
|
375
|
+
var acceptInvitationSchema = z.object({
|
|
376
|
+
token: z.string().min(1),
|
|
377
|
+
password: z.string().min(1)
|
|
378
|
+
});
|
|
340
379
|
var userSchema = z.object({
|
|
341
380
|
id: z.number().int().positive(),
|
|
342
381
|
email: z.string().email(),
|
|
382
|
+
role: globalRoleSchema,
|
|
343
383
|
is_admin: z.boolean()
|
|
344
384
|
});
|
|
345
385
|
var authResponseSchema = z.object({
|
|
@@ -351,11 +391,11 @@ z.object({
|
|
|
351
391
|
});
|
|
352
392
|
var loginRequestSchema = z.object({
|
|
353
393
|
email: z.string().email(),
|
|
354
|
-
password: z.string().min(
|
|
394
|
+
password: z.string().min(1)
|
|
355
395
|
});
|
|
356
396
|
var registerRequestSchema = z.object({
|
|
357
397
|
email: z.string().email(),
|
|
358
|
-
password: z.string().min(
|
|
398
|
+
password: z.string().min(1)
|
|
359
399
|
});
|
|
360
400
|
|
|
361
401
|
// src/resources/auth.ts
|
|
@@ -416,6 +456,34 @@ var AuthResource = class extends BaseResource {
|
|
|
416
456
|
const data = await this.http.get("auth/me").json();
|
|
417
457
|
return this.validate(data, userSchema);
|
|
418
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* Get the details of a pending invitation by its token (public endpoint)
|
|
461
|
+
* Used by the accept-invitation page before the user has an account
|
|
462
|
+
* @param token - Invitation token
|
|
463
|
+
* @returns Invitation info (email, role, status, expiry)
|
|
464
|
+
*/
|
|
465
|
+
async getInvitation(token) {
|
|
466
|
+
const data = await this.http.get(`auth/invitation/${token}`).json();
|
|
467
|
+
return this.validate(data, invitationInfoSchema);
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Accept a pending invitation, creating the user account and logging in
|
|
471
|
+
* @param input - Invitation token and the new account's password
|
|
472
|
+
* @returns LoginResult with user information and session cookies
|
|
473
|
+
*/
|
|
474
|
+
async acceptInvitation(input) {
|
|
475
|
+
const validatedInput = this.validate(input, acceptInvitationSchema);
|
|
476
|
+
const response = await this.http.post("auth/accept-invitation", {
|
|
477
|
+
json: validatedInput
|
|
478
|
+
});
|
|
479
|
+
const cookies = response.headers.getSetCookie();
|
|
480
|
+
const data = await response.json();
|
|
481
|
+
const authResponse = this.validate(data, authResponseSchema);
|
|
482
|
+
return {
|
|
483
|
+
user: authResponse.user,
|
|
484
|
+
cookies
|
|
485
|
+
};
|
|
486
|
+
}
|
|
419
487
|
};
|
|
420
488
|
var eventSchema = z.object({
|
|
421
489
|
id: uuidSchema,
|
|
@@ -463,6 +531,17 @@ var updateIssueStateSchema = z.object({
|
|
|
463
531
|
is_resolved: z.boolean().optional(),
|
|
464
532
|
is_muted: z.boolean().optional()
|
|
465
533
|
});
|
|
534
|
+
var projectRoleSchema = z.enum(["viewer", "editor", "admin"]);
|
|
535
|
+
var projectMemberSchema = z.object({
|
|
536
|
+
user_id: z.number().int(),
|
|
537
|
+
email: z.string().email(),
|
|
538
|
+
role: projectRoleSchema,
|
|
539
|
+
created_at: dateTimeSchema
|
|
540
|
+
});
|
|
541
|
+
var upsertProjectMemberSchema = z.object({
|
|
542
|
+
user_id: z.number().int(),
|
|
543
|
+
role: projectRoleSchema
|
|
544
|
+
});
|
|
466
545
|
var projectSchema = z.object({
|
|
467
546
|
id: z.number().int(),
|
|
468
547
|
name: z.string(),
|
|
@@ -549,6 +628,33 @@ var EventsResource = class extends BaseResource {
|
|
|
549
628
|
}
|
|
550
629
|
};
|
|
551
630
|
|
|
631
|
+
// src/resources/invitations.ts
|
|
632
|
+
var InvitationsResource = class extends BaseResource {
|
|
633
|
+
/**
|
|
634
|
+
* Create a new invitation
|
|
635
|
+
* @param input - Email and global role for the invited user
|
|
636
|
+
*/
|
|
637
|
+
async create(input) {
|
|
638
|
+
const validatedInput = this.validate(input, createInvitationSchema);
|
|
639
|
+
const data = await this.http.post("api/invitations", { json: validatedInput }).json();
|
|
640
|
+
return this.validate(data, invitationSchema);
|
|
641
|
+
}
|
|
642
|
+
/**
|
|
643
|
+
* List all invitations
|
|
644
|
+
*/
|
|
645
|
+
async list() {
|
|
646
|
+
const data = await this.http.get("api/invitations").json();
|
|
647
|
+
return this.validate(data, invitationSchema.array());
|
|
648
|
+
}
|
|
649
|
+
/**
|
|
650
|
+
* Revoke a pending invitation
|
|
651
|
+
* @param token - Invitation token to revoke
|
|
652
|
+
*/
|
|
653
|
+
async revoke(token) {
|
|
654
|
+
await this.http.delete(`api/invitations/${token}`);
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
|
|
552
658
|
// src/resources/issues.ts
|
|
553
659
|
var IssuesResource = class extends BaseResource {
|
|
554
660
|
/**
|
|
@@ -599,6 +705,37 @@ var IssuesResource = class extends BaseResource {
|
|
|
599
705
|
}
|
|
600
706
|
};
|
|
601
707
|
|
|
708
|
+
// src/resources/members.ts
|
|
709
|
+
var MembersResource = class extends BaseResource {
|
|
710
|
+
/**
|
|
711
|
+
* List members of a project
|
|
712
|
+
* @param projectId - ID of the project
|
|
713
|
+
*/
|
|
714
|
+
async list(projectId) {
|
|
715
|
+
const data = await this.http.get(`api/projects/${projectId}/members`).json();
|
|
716
|
+
return this.validate(data, projectMemberSchema.array());
|
|
717
|
+
}
|
|
718
|
+
/**
|
|
719
|
+
* Add or update a project member
|
|
720
|
+
* @param projectId - ID of the project
|
|
721
|
+
* @param input - User ID and per-project role
|
|
722
|
+
*/
|
|
723
|
+
async upsert(projectId, input) {
|
|
724
|
+
const validatedInput = this.validate(input, upsertProjectMemberSchema);
|
|
725
|
+
await this.http.put(`api/projects/${projectId}/members`, {
|
|
726
|
+
json: validatedInput
|
|
727
|
+
});
|
|
728
|
+
}
|
|
729
|
+
/**
|
|
730
|
+
* Remove a member from a project
|
|
731
|
+
* @param projectId - ID of the project
|
|
732
|
+
* @param userId - ID of the user to remove
|
|
733
|
+
*/
|
|
734
|
+
async remove(projectId, userId) {
|
|
735
|
+
await this.http.delete(`api/projects/${projectId}/members/${userId}`);
|
|
736
|
+
}
|
|
737
|
+
};
|
|
738
|
+
|
|
602
739
|
// src/resources/projects.ts
|
|
603
740
|
var ProjectsResource = class extends BaseResource {
|
|
604
741
|
/**
|
|
@@ -703,6 +840,33 @@ var SourceMapsResource = class extends BaseResource {
|
|
|
703
840
|
}
|
|
704
841
|
};
|
|
705
842
|
|
|
843
|
+
// src/resources/team.ts
|
|
844
|
+
var TeamResource = class extends BaseResource {
|
|
845
|
+
/**
|
|
846
|
+
* List all team members (users)
|
|
847
|
+
*/
|
|
848
|
+
async list() {
|
|
849
|
+
const data = await this.http.get("api/team").json();
|
|
850
|
+
return this.validate(data, teamMemberSchema.array());
|
|
851
|
+
}
|
|
852
|
+
/**
|
|
853
|
+
* Change a user's global role
|
|
854
|
+
* @param userId - ID of the user to update
|
|
855
|
+
* @param role - New global role to assign
|
|
856
|
+
*/
|
|
857
|
+
async updateRole(userId, role) {
|
|
858
|
+
const body = this.validate({ role }, updateUserRoleSchema);
|
|
859
|
+
await this.http.patch(`api/team/${userId}/role`, { json: body });
|
|
860
|
+
}
|
|
861
|
+
/**
|
|
862
|
+
* Permanently remove a user from the instance.
|
|
863
|
+
* @param userId - ID of the user to delete
|
|
864
|
+
*/
|
|
865
|
+
async remove(userId) {
|
|
866
|
+
await this.http.delete(`api/team/${userId}`);
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
|
|
706
870
|
// src/resources/tokens.ts
|
|
707
871
|
var TokensResource = class extends BaseResource {
|
|
708
872
|
/**
|
|
@@ -834,6 +998,18 @@ var RustrakClient = class {
|
|
|
834
998
|
* Source Maps API resource (sentry-cli artifact bundle upload protocol)
|
|
835
999
|
*/
|
|
836
1000
|
sourceMaps;
|
|
1001
|
+
/**
|
|
1002
|
+
* Team API resource (global user roster and roles)
|
|
1003
|
+
*/
|
|
1004
|
+
team;
|
|
1005
|
+
/**
|
|
1006
|
+
* Invitations API resource (pending user invitations)
|
|
1007
|
+
*/
|
|
1008
|
+
invitations;
|
|
1009
|
+
/**
|
|
1010
|
+
* Project Members API resource (per-project membership and roles)
|
|
1011
|
+
*/
|
|
1012
|
+
members;
|
|
837
1013
|
/**
|
|
838
1014
|
* Create a new Rustrak API client
|
|
839
1015
|
*
|
|
@@ -849,6 +1025,9 @@ var RustrakClient = class {
|
|
|
849
1025
|
this.alertIntegrations = new AlertIntegrationsResource(this.http);
|
|
850
1026
|
this.alertRules = new AlertRulesResource(this.http);
|
|
851
1027
|
this.sourceMaps = new SourceMapsResource(this.http);
|
|
1028
|
+
this.team = new TeamResource(this.http);
|
|
1029
|
+
this.invitations = new InvitationsResource(this.http);
|
|
1030
|
+
this.members = new MembersResource(this.http);
|
|
852
1031
|
}
|
|
853
1032
|
};
|
|
854
1033
|
|