@rustrak/client 0.2.2 → 0.3.1

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
@@ -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,8 +273,15 @@ 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
 
280
+ declare const serverVersionSchema: z.ZodObject<{
281
+ version: z.ZodString;
282
+ }, z.core.$strip>;
283
+ type ServerVersion = z.infer<typeof serverVersionSchema>;
284
+
229
285
  declare const sortOrderSchema: z.ZodEnum<{
230
286
  asc: "asc";
231
287
  desc: "desc";
@@ -331,6 +387,34 @@ declare const updateIssueStateSchema: z.ZodObject<{
331
387
  type Issue = z.infer<typeof issueSchema>;
332
388
  type UpdateIssueState = z.infer<typeof updateIssueStateSchema>;
333
389
 
390
+ declare const projectRoleSchema: z.ZodEnum<{
391
+ admin: "admin";
392
+ viewer: "viewer";
393
+ editor: "editor";
394
+ }>;
395
+ declare const projectMemberSchema: z.ZodObject<{
396
+ user_id: z.ZodNumber;
397
+ email: z.ZodString;
398
+ role: z.ZodEnum<{
399
+ admin: "admin";
400
+ viewer: "viewer";
401
+ editor: "editor";
402
+ }>;
403
+ created_at: z.ZodString;
404
+ }, z.core.$strip>;
405
+ declare const upsertProjectMemberSchema: z.ZodObject<{
406
+ user_id: z.ZodNumber;
407
+ role: z.ZodEnum<{
408
+ admin: "admin";
409
+ viewer: "viewer";
410
+ editor: "editor";
411
+ }>;
412
+ }, z.core.$strip>;
413
+
414
+ type ProjectRole = z.infer<typeof projectRoleSchema>;
415
+ type ProjectMember = z.infer<typeof projectMemberSchema>;
416
+ type UpsertProjectMember = z.infer<typeof upsertProjectMemberSchema>;
417
+
334
418
  declare const projectSchema: z.ZodObject<{
335
419
  id: z.ZodNumber;
336
420
  name: z.ZodString;
@@ -395,6 +479,33 @@ interface AssembleInput {
395
479
  projects: string[];
396
480
  }
397
481
 
482
+ declare const globalRoleSchema: z.ZodEnum<{
483
+ admin: "admin";
484
+ member: "member";
485
+ }>;
486
+ declare const teamMemberSchema: z.ZodObject<{
487
+ id: z.ZodNumber;
488
+ email: z.ZodString;
489
+ role: z.ZodEnum<{
490
+ admin: "admin";
491
+ member: "member";
492
+ }>;
493
+ is_active: z.ZodBoolean;
494
+ is_primary: z.ZodOptional<z.ZodBoolean>;
495
+ created_at: z.ZodString;
496
+ last_login: z.ZodOptional<z.ZodNullable<z.ZodString>>;
497
+ }, z.core.$strip>;
498
+ declare const updateUserRoleSchema: z.ZodObject<{
499
+ role: z.ZodEnum<{
500
+ admin: "admin";
501
+ member: "member";
502
+ }>;
503
+ }, z.core.$strip>;
504
+
505
+ type GlobalRole = z.infer<typeof globalRoleSchema>;
506
+ type TeamMember = z.infer<typeof teamMemberSchema>;
507
+ type UpdateUserRole = z.infer<typeof updateUserRoleSchema>;
508
+
398
509
  declare const authTokenSchema: z.ZodObject<{
399
510
  id: z.ZodNumber;
400
511
  token_prefix: z.ZodString;
@@ -421,6 +532,16 @@ declare class EventsResource extends BaseResource {
421
532
  get(projectId: number, issueId: string, eventId: string): Promise<EventDetail>;
422
533
  }
423
534
 
535
+ declare class HealthResource extends BaseResource {
536
+ getVersion(): Promise<ServerVersion>;
537
+ }
538
+
539
+ declare class InvitationsResource extends BaseResource {
540
+ create(input: CreateInvitation): Promise<Invitation>;
541
+ list(): Promise<Invitation[]>;
542
+ revoke(token: string): Promise<void>;
543
+ }
544
+
424
545
  declare class IssuesResource extends BaseResource {
425
546
  list(projectId: number, options?: ListIssuesOptions): Promise<OffsetPaginatedResponse<Issue>>;
426
547
  get(projectId: number, issueId: string): Promise<Issue>;
@@ -428,6 +549,12 @@ declare class IssuesResource extends BaseResource {
428
549
  delete(projectId: number, issueId: string): Promise<void>;
429
550
  }
430
551
 
552
+ declare class MembersResource extends BaseResource {
553
+ list(projectId: number): Promise<ProjectMember[]>;
554
+ upsert(projectId: number, input: UpsertProjectMember): Promise<void>;
555
+ remove(projectId: number, userId: number): Promise<void>;
556
+ }
557
+
431
558
  declare class ProjectsResource extends BaseResource {
432
559
  list(options?: ListProjectsOptions): Promise<OffsetPaginatedResponse<Project>>;
433
560
  get(id: number): Promise<Project>;
@@ -446,6 +573,12 @@ declare class SourceMapsResource extends BaseResource {
446
573
  list(orgSlug: string, projectSlug: string): Promise<ListSourceMapsResponse>;
447
574
  }
448
575
 
576
+ declare class TeamResource extends BaseResource {
577
+ list(): Promise<TeamMember[]>;
578
+ updateRole(userId: number, role: GlobalRole): Promise<void>;
579
+ remove(userId: number): Promise<void>;
580
+ }
581
+
449
582
  declare class TokensResource extends BaseResource {
450
583
  list(): Promise<AuthToken[]>;
451
584
  get(id: number): Promise<AuthToken>;
@@ -463,6 +596,10 @@ declare class RustrakClient {
463
596
  readonly alertIntegrations: AlertIntegrationsResource;
464
597
  readonly alertRules: AlertRulesResource;
465
598
  readonly sourceMaps: SourceMapsResource;
599
+ readonly team: TeamResource;
600
+ readonly invitations: InvitationsResource;
601
+ readonly members: MembersResource;
602
+ readonly health: HealthResource;
466
603
  constructor(config: ClientConfig);
467
604
  }
468
605
 
@@ -506,4 +643,4 @@ declare class ValidationError extends RustrakError {
506
643
  getValidationDetails(): string;
507
644
  }
508
645
 
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 };
646
+ 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 ServerVersion, 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,8 +273,15 @@ 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
 
280
+ declare const serverVersionSchema: z.ZodObject<{
281
+ version: z.ZodString;
282
+ }, z.core.$strip>;
283
+ type ServerVersion = z.infer<typeof serverVersionSchema>;
284
+
229
285
  declare const sortOrderSchema: z.ZodEnum<{
230
286
  asc: "asc";
231
287
  desc: "desc";
@@ -331,6 +387,34 @@ declare const updateIssueStateSchema: z.ZodObject<{
331
387
  type Issue = z.infer<typeof issueSchema>;
332
388
  type UpdateIssueState = z.infer<typeof updateIssueStateSchema>;
333
389
 
390
+ declare const projectRoleSchema: z.ZodEnum<{
391
+ admin: "admin";
392
+ viewer: "viewer";
393
+ editor: "editor";
394
+ }>;
395
+ declare const projectMemberSchema: z.ZodObject<{
396
+ user_id: z.ZodNumber;
397
+ email: z.ZodString;
398
+ role: z.ZodEnum<{
399
+ admin: "admin";
400
+ viewer: "viewer";
401
+ editor: "editor";
402
+ }>;
403
+ created_at: z.ZodString;
404
+ }, z.core.$strip>;
405
+ declare const upsertProjectMemberSchema: z.ZodObject<{
406
+ user_id: z.ZodNumber;
407
+ role: z.ZodEnum<{
408
+ admin: "admin";
409
+ viewer: "viewer";
410
+ editor: "editor";
411
+ }>;
412
+ }, z.core.$strip>;
413
+
414
+ type ProjectRole = z.infer<typeof projectRoleSchema>;
415
+ type ProjectMember = z.infer<typeof projectMemberSchema>;
416
+ type UpsertProjectMember = z.infer<typeof upsertProjectMemberSchema>;
417
+
334
418
  declare const projectSchema: z.ZodObject<{
335
419
  id: z.ZodNumber;
336
420
  name: z.ZodString;
@@ -395,6 +479,33 @@ interface AssembleInput {
395
479
  projects: string[];
396
480
  }
397
481
 
482
+ declare const globalRoleSchema: z.ZodEnum<{
483
+ admin: "admin";
484
+ member: "member";
485
+ }>;
486
+ declare const teamMemberSchema: z.ZodObject<{
487
+ id: z.ZodNumber;
488
+ email: z.ZodString;
489
+ role: z.ZodEnum<{
490
+ admin: "admin";
491
+ member: "member";
492
+ }>;
493
+ is_active: z.ZodBoolean;
494
+ is_primary: z.ZodOptional<z.ZodBoolean>;
495
+ created_at: z.ZodString;
496
+ last_login: z.ZodOptional<z.ZodNullable<z.ZodString>>;
497
+ }, z.core.$strip>;
498
+ declare const updateUserRoleSchema: z.ZodObject<{
499
+ role: z.ZodEnum<{
500
+ admin: "admin";
501
+ member: "member";
502
+ }>;
503
+ }, z.core.$strip>;
504
+
505
+ type GlobalRole = z.infer<typeof globalRoleSchema>;
506
+ type TeamMember = z.infer<typeof teamMemberSchema>;
507
+ type UpdateUserRole = z.infer<typeof updateUserRoleSchema>;
508
+
398
509
  declare const authTokenSchema: z.ZodObject<{
399
510
  id: z.ZodNumber;
400
511
  token_prefix: z.ZodString;
@@ -421,6 +532,16 @@ declare class EventsResource extends BaseResource {
421
532
  get(projectId: number, issueId: string, eventId: string): Promise<EventDetail>;
422
533
  }
423
534
 
535
+ declare class HealthResource extends BaseResource {
536
+ getVersion(): Promise<ServerVersion>;
537
+ }
538
+
539
+ declare class InvitationsResource extends BaseResource {
540
+ create(input: CreateInvitation): Promise<Invitation>;
541
+ list(): Promise<Invitation[]>;
542
+ revoke(token: string): Promise<void>;
543
+ }
544
+
424
545
  declare class IssuesResource extends BaseResource {
425
546
  list(projectId: number, options?: ListIssuesOptions): Promise<OffsetPaginatedResponse<Issue>>;
426
547
  get(projectId: number, issueId: string): Promise<Issue>;
@@ -428,6 +549,12 @@ declare class IssuesResource extends BaseResource {
428
549
  delete(projectId: number, issueId: string): Promise<void>;
429
550
  }
430
551
 
552
+ declare class MembersResource extends BaseResource {
553
+ list(projectId: number): Promise<ProjectMember[]>;
554
+ upsert(projectId: number, input: UpsertProjectMember): Promise<void>;
555
+ remove(projectId: number, userId: number): Promise<void>;
556
+ }
557
+
431
558
  declare class ProjectsResource extends BaseResource {
432
559
  list(options?: ListProjectsOptions): Promise<OffsetPaginatedResponse<Project>>;
433
560
  get(id: number): Promise<Project>;
@@ -446,6 +573,12 @@ declare class SourceMapsResource extends BaseResource {
446
573
  list(orgSlug: string, projectSlug: string): Promise<ListSourceMapsResponse>;
447
574
  }
448
575
 
576
+ declare class TeamResource extends BaseResource {
577
+ list(): Promise<TeamMember[]>;
578
+ updateRole(userId: number, role: GlobalRole): Promise<void>;
579
+ remove(userId: number): Promise<void>;
580
+ }
581
+
449
582
  declare class TokensResource extends BaseResource {
450
583
  list(): Promise<AuthToken[]>;
451
584
  get(id: number): Promise<AuthToken>;
@@ -463,6 +596,10 @@ declare class RustrakClient {
463
596
  readonly alertIntegrations: AlertIntegrationsResource;
464
597
  readonly alertRules: AlertRulesResource;
465
598
  readonly sourceMaps: SourceMapsResource;
599
+ readonly team: TeamResource;
600
+ readonly invitations: InvitationsResource;
601
+ readonly members: MembersResource;
602
+ readonly health: HealthResource;
466
603
  constructor(config: ClientConfig);
467
604
  }
468
605
 
@@ -506,4 +643,4 @@ declare class ValidationError extends RustrakError {
506
643
  getValidationDetails(): string;
507
644
  }
508
645
 
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 };
646
+ 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 ServerVersion, 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(8)
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(8)
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(),
@@ -548,6 +627,44 @@ var EventsResource = class extends BaseResource {
548
627
  return this.validate(data, eventDetailSchema);
549
628
  }
550
629
  };
630
+ var serverVersionSchema = z.object({
631
+ version: z.string()
632
+ });
633
+
634
+ // src/resources/health.ts
635
+ var HealthResource = class extends BaseResource {
636
+ async getVersion() {
637
+ const data = await this.http.get("health/version").json();
638
+ return this.validate(data, serverVersionSchema);
639
+ }
640
+ };
641
+
642
+ // src/resources/invitations.ts
643
+ var InvitationsResource = class extends BaseResource {
644
+ /**
645
+ * Create a new invitation
646
+ * @param input - Email and global role for the invited user
647
+ */
648
+ async create(input) {
649
+ const validatedInput = this.validate(input, createInvitationSchema);
650
+ const data = await this.http.post("api/invitations", { json: validatedInput }).json();
651
+ return this.validate(data, invitationSchema);
652
+ }
653
+ /**
654
+ * List all invitations
655
+ */
656
+ async list() {
657
+ const data = await this.http.get("api/invitations").json();
658
+ return this.validate(data, invitationSchema.array());
659
+ }
660
+ /**
661
+ * Revoke a pending invitation
662
+ * @param token - Invitation token to revoke
663
+ */
664
+ async revoke(token) {
665
+ await this.http.delete(`api/invitations/${token}`);
666
+ }
667
+ };
551
668
 
552
669
  // src/resources/issues.ts
553
670
  var IssuesResource = class extends BaseResource {
@@ -599,6 +716,37 @@ var IssuesResource = class extends BaseResource {
599
716
  }
600
717
  };
601
718
 
719
+ // src/resources/members.ts
720
+ var MembersResource = class extends BaseResource {
721
+ /**
722
+ * List members of a project
723
+ * @param projectId - ID of the project
724
+ */
725
+ async list(projectId) {
726
+ const data = await this.http.get(`api/projects/${projectId}/members`).json();
727
+ return this.validate(data, projectMemberSchema.array());
728
+ }
729
+ /**
730
+ * Add or update a project member
731
+ * @param projectId - ID of the project
732
+ * @param input - User ID and per-project role
733
+ */
734
+ async upsert(projectId, input) {
735
+ const validatedInput = this.validate(input, upsertProjectMemberSchema);
736
+ await this.http.put(`api/projects/${projectId}/members`, {
737
+ json: validatedInput
738
+ });
739
+ }
740
+ /**
741
+ * Remove a member from a project
742
+ * @param projectId - ID of the project
743
+ * @param userId - ID of the user to remove
744
+ */
745
+ async remove(projectId, userId) {
746
+ await this.http.delete(`api/projects/${projectId}/members/${userId}`);
747
+ }
748
+ };
749
+
602
750
  // src/resources/projects.ts
603
751
  var ProjectsResource = class extends BaseResource {
604
752
  /**
@@ -703,6 +851,33 @@ var SourceMapsResource = class extends BaseResource {
703
851
  }
704
852
  };
705
853
 
854
+ // src/resources/team.ts
855
+ var TeamResource = class extends BaseResource {
856
+ /**
857
+ * List all team members (users)
858
+ */
859
+ async list() {
860
+ const data = await this.http.get("api/team").json();
861
+ return this.validate(data, teamMemberSchema.array());
862
+ }
863
+ /**
864
+ * Change a user's global role
865
+ * @param userId - ID of the user to update
866
+ * @param role - New global role to assign
867
+ */
868
+ async updateRole(userId, role) {
869
+ const body = this.validate({ role }, updateUserRoleSchema);
870
+ await this.http.patch(`api/team/${userId}/role`, { json: body });
871
+ }
872
+ /**
873
+ * Permanently remove a user from the instance.
874
+ * @param userId - ID of the user to delete
875
+ */
876
+ async remove(userId) {
877
+ await this.http.delete(`api/team/${userId}`);
878
+ }
879
+ };
880
+
706
881
  // src/resources/tokens.ts
707
882
  var TokensResource = class extends BaseResource {
708
883
  /**
@@ -834,6 +1009,22 @@ var RustrakClient = class {
834
1009
  * Source Maps API resource (sentry-cli artifact bundle upload protocol)
835
1010
  */
836
1011
  sourceMaps;
1012
+ /**
1013
+ * Team API resource (global user roster and roles)
1014
+ */
1015
+ team;
1016
+ /**
1017
+ * Invitations API resource (pending user invitations)
1018
+ */
1019
+ invitations;
1020
+ /**
1021
+ * Project Members API resource (per-project membership and roles)
1022
+ */
1023
+ members;
1024
+ /**
1025
+ * Health API resource (version info)
1026
+ */
1027
+ health;
837
1028
  /**
838
1029
  * Create a new Rustrak API client
839
1030
  *
@@ -849,6 +1040,10 @@ var RustrakClient = class {
849
1040
  this.alertIntegrations = new AlertIntegrationsResource(this.http);
850
1041
  this.alertRules = new AlertRulesResource(this.http);
851
1042
  this.sourceMaps = new SourceMapsResource(this.http);
1043
+ this.team = new TeamResource(this.http);
1044
+ this.invitations = new InvitationsResource(this.http);
1045
+ this.members = new MembersResource(this.http);
1046
+ this.health = new HealthResource(this.http);
852
1047
  }
853
1048
  };
854
1049