@borealise/api 2.0.0-alpha.1 → 2.0.0-alpha.10

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.mts CHANGED
@@ -117,6 +117,12 @@ interface AuthResource {
117
117
  message: string;
118
118
  }>>;
119
119
  me(): Promise<ApiResponse<MeResponse>>;
120
+ forgotPassword(email: string): Promise<ApiResponse<{
121
+ success: boolean;
122
+ }>>;
123
+ resetPassword(token: string, password: string): Promise<ApiResponse<{
124
+ success: boolean;
125
+ }>>;
120
126
  }
121
127
  declare const createAuthResource: (api: Api) => AuthResource;
122
128
 
@@ -133,6 +139,21 @@ interface UserResponse {
133
139
  user: User;
134
140
  };
135
141
  }
142
+ interface MyViolation {
143
+ id: number;
144
+ adminUsername: string;
145
+ reason: string;
146
+ revoked: boolean;
147
+ revokedAt: string | null;
148
+ createdAt: string;
149
+ }
150
+ interface MyViolationsResponse {
151
+ success: boolean;
152
+ data: {
153
+ violations: MyViolation[];
154
+ permanentBan: boolean;
155
+ };
156
+ }
136
157
  interface UserResource {
137
158
  getById(id: number): Promise<ApiResponse<UserResponse>>;
138
159
  getByUsername(username: string): Promise<ApiResponse<UserResponse>>;
@@ -146,6 +167,7 @@ interface UserResource {
146
167
  success: boolean;
147
168
  data: null;
148
169
  }>>;
170
+ getMyViolations(): Promise<ApiResponse<MyViolationsResponse>>;
149
171
  }
150
172
  declare const createUserResource: (api: Api) => UserResource;
151
173
 
@@ -416,8 +438,53 @@ interface RoomHistoryResponse {
416
438
  pagination: PaginationMeta;
417
439
  };
418
440
  }
441
+ type AuditAction = 'kick' | 'ban' | 'unban' | 'mute' | 'unmute' | 'role_change' | 'waitlist_move' | 'waitlist_remove' | 'track_skip';
442
+ interface RoomAuditLog {
443
+ id: number;
444
+ actorId: number;
445
+ actorUsername: string;
446
+ targetId: number | null;
447
+ targetUsername: string | null;
448
+ action: AuditAction;
449
+ metadata: string | null;
450
+ createdAt: string;
451
+ }
452
+ interface RoomAuditLogResponse {
453
+ success: boolean;
454
+ data: {
455
+ logs: RoomAuditLog[];
456
+ hasMore: boolean;
457
+ };
458
+ }
459
+ type DashboardActivityType = 'play' | 'woot' | 'grab';
460
+ interface DashboardActivityItem {
461
+ id: string;
462
+ type: DashboardActivityType;
463
+ room: {
464
+ id: number;
465
+ slug: string;
466
+ name: string;
467
+ };
468
+ media: {
469
+ id: number;
470
+ source: 'youtube' | 'soundcloud';
471
+ sourceId: string;
472
+ title: string;
473
+ artist: string | null;
474
+ thumbnail: string | null;
475
+ };
476
+ count: number | null;
477
+ createdAt: string;
478
+ }
479
+ interface DashboardActivityResponse {
480
+ success: boolean;
481
+ data: {
482
+ activities: DashboardActivityItem[];
483
+ };
484
+ }
419
485
  interface RoomResource {
420
486
  list(): Promise<ApiResponse<RoomsResponse>>;
487
+ mine(limit?: number): Promise<ApiResponse<RoomsResponse>>;
421
488
  featured(): Promise<ApiResponse<FeaturedRoomsResponse>>;
422
489
  getBySlug(slug: string): Promise<ApiResponse<RoomResponse>>;
423
490
  create(data: CreateRoomData): Promise<ApiResponse<RoomResponse>>;
@@ -502,6 +569,8 @@ interface RoomResource {
502
569
  vote(slug: string, type: 'woot' | 'meh'): Promise<ApiResponse<VoteResponse>>;
503
570
  grabTrack(slug: string, playlistId?: number): Promise<ApiResponse<GrabResponse>>;
504
571
  getHistory(slug: string, page?: number, limit?: number): Promise<ApiResponse<RoomHistoryResponse>>;
572
+ getAuditLog(slug: string, limit?: number, before?: string): Promise<ApiResponse<RoomAuditLogResponse>>;
573
+ activity(limit?: number): Promise<ApiResponse<DashboardActivityResponse>>;
505
574
  }
506
575
  declare const createRoomResource: (api: Api) => RoomResource;
507
576
 
@@ -692,6 +761,9 @@ interface AvatarCatalogResponse {
692
761
  xp: number;
693
762
  };
694
763
  }
764
+ interface EquipAvatarData {
765
+ avatarId: string;
766
+ }
695
767
  interface ShopResource {
696
768
  getAvatarCatalog(): Promise<ApiResponse<AvatarCatalogResponse>>;
697
769
  unlockAvatar(avatarId: string): Promise<ApiResponse<{
@@ -788,6 +860,109 @@ interface FriendResource {
788
860
  }
789
861
  declare const createFriendResource: (api: Api) => FriendResource;
790
862
 
863
+ interface AdminUserEntry {
864
+ id: number;
865
+ username: string;
866
+ displayName: string | null;
867
+ email?: string;
868
+ avatarId: string;
869
+ globalRole: GlobalRole;
870
+ disabled: boolean;
871
+ permanentBan: boolean;
872
+ emailVerified: boolean;
873
+ xp: number;
874
+ createdAt: string;
875
+ }
876
+ interface AdminUsersResponse {
877
+ success: boolean;
878
+ data: {
879
+ users: AdminUserEntry[];
880
+ total: number;
881
+ };
882
+ }
883
+ interface AdminStatsRoom {
884
+ slug: string;
885
+ name: string;
886
+ population: number;
887
+ }
888
+ interface AdminStatsResponse {
889
+ success: boolean;
890
+ data: {
891
+ activeRooms: number;
892
+ totalOnlineUsers: number;
893
+ rooms: AdminStatsRoom[];
894
+ };
895
+ }
896
+ interface AdminListUsersParams {
897
+ search?: string;
898
+ role?: GlobalRole | '';
899
+ disabled?: boolean;
900
+ page?: number;
901
+ limit?: number;
902
+ sortBy?: 'id' | 'username' | 'createdAt';
903
+ sortDir?: 'asc' | 'desc';
904
+ }
905
+ interface AccountViolation {
906
+ id: number;
907
+ adminId: number;
908
+ adminUsername: string;
909
+ reason: string;
910
+ revoked: boolean;
911
+ revokedAt: string | null;
912
+ revokerId: number | null;
913
+ createdAt: string;
914
+ }
915
+ interface UserViolationsResponse {
916
+ success: boolean;
917
+ data: {
918
+ violations: AccountViolation[];
919
+ permanentBan: boolean;
920
+ };
921
+ }
922
+ interface AddViolationResponse {
923
+ success: boolean;
924
+ data: {
925
+ violation: AccountViolation;
926
+ permanentlyBanned: boolean;
927
+ activeViolations: number;
928
+ };
929
+ }
930
+ interface AdminResource {
931
+ listUsers(params?: AdminListUsersParams): Promise<ApiResponse<AdminUsersResponse>>;
932
+ enableUser(id: number): Promise<ApiResponse<{
933
+ success: boolean;
934
+ data: null;
935
+ }>>;
936
+ disableUser(id: number): Promise<ApiResponse<{
937
+ success: boolean;
938
+ data: null;
939
+ }>>;
940
+ updateRole(id: number, role: GlobalRole): Promise<ApiResponse<{
941
+ success: boolean;
942
+ data: null;
943
+ }>>;
944
+ broadcast(message: string): Promise<ApiResponse<{
945
+ success: boolean;
946
+ data: {
947
+ sent_to_rooms: number;
948
+ };
949
+ }>>;
950
+ setMaintenance(active: boolean, message?: string, endsAt?: number | null): Promise<ApiResponse<{
951
+ success: boolean;
952
+ data: {
953
+ active: boolean;
954
+ };
955
+ }>>;
956
+ getStats(): Promise<ApiResponse<AdminStatsResponse>>;
957
+ addViolation(userId: number, reason: string): Promise<ApiResponse<AddViolationResponse>>;
958
+ revokeViolation(violationId: number): Promise<ApiResponse<{
959
+ success: boolean;
960
+ data: null;
961
+ }>>;
962
+ getUserViolations(userId: number): Promise<ApiResponse<UserViolationsResponse>>;
963
+ }
964
+ declare const createAdminResource: (api: Api) => AdminResource;
965
+
791
966
  interface ApiClient {
792
967
  api: Api;
793
968
  auth: AuthResource;
@@ -799,7 +974,8 @@ interface ApiClient {
799
974
  shop: ShopResource;
800
975
  subscription: SubscriptionResource;
801
976
  friend: FriendResource;
977
+ admin: AdminResource;
802
978
  }
803
979
  declare const createApiClient: (config: ApiConfig) => ApiClient;
804
980
 
805
- export { Api, type ApiClient, type ApiConfig, ApiError, type ApiResponse, type AuthResource, type BackendErrorResponse, type ChatResource, type FriendResource, Logger, type PlaylistResource, type RoomResource, type ShopResource, type SourceResource, type SubscriptionResource, type UserResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
981
+ export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, Api, type ApiClient, type ApiConfig, ApiError, type ApiResponse, type AuditAction, type AuthResource, type AuthUser, type AvatarCatalogItem, type AvatarCatalogResponse, type AvatarUnlockType, type BackendErrorResponse, type BanResponse, type BoothDJ, type BoothMedia, type BoothResponse, type BoothState, type ChatMessage, type ChatMessageResponse, type ChatMessagesResponse, type ChatResource, type CreateIntentResponse, type CreateRoomData, type DashboardActivityItem, type DashboardActivityResponse, type DashboardActivityType, type EquipAvatarData, type FeaturedRoomsResponse, type FriendActionResponse, type FriendEntry, type FriendList, type FriendListResponse, type FriendResource, type FriendStatusResponse, type FriendshipStatus, type GlobalRole, type GrabResponse, type ImportPlaylistData, type ImportPlaylistResponse, type ImportResult, type JoinMuteInfo, type JoinRoomResponse, Logger, type MediaItem, type MediaItemResponse, type MediaSearchResult, type MediaSource, type ModerateUserData, type MuteResponse, type MyViolation, type MyViolationsResponse, type PaginationMeta, type PlayHistoryItem, type Playlist, type PlaylistResource, type PlaylistResponse, type PlaylistsResponse, type PortalResponse, type Room, type RoomAuditLog, type RoomBan, type RoomBansResponse, type RoomHistoryResponse, type RoomMember, type RoomMute, type RoomMutesResponse, type RoomResource, type RoomResponse, type RoomRole, type RoomStaffResponse, type RoomUserState, type RoomsResponse, type SendMessageData, type ShopResource, type ShuffleResponse, type SoundCloudSearchResponse, type SoundCloudTrackResponse, type SourceResource, type SubscriptionPlan, type SubscriptionResource, type SubscriptionStatus, type UpdateProfileData, type UpdateRoomData, type User, type UserResource, type UserResponse, type UserViolationsResponse, type VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, createAdminResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
package/dist/index.d.ts CHANGED
@@ -117,6 +117,12 @@ interface AuthResource {
117
117
  message: string;
118
118
  }>>;
119
119
  me(): Promise<ApiResponse<MeResponse>>;
120
+ forgotPassword(email: string): Promise<ApiResponse<{
121
+ success: boolean;
122
+ }>>;
123
+ resetPassword(token: string, password: string): Promise<ApiResponse<{
124
+ success: boolean;
125
+ }>>;
120
126
  }
121
127
  declare const createAuthResource: (api: Api) => AuthResource;
122
128
 
@@ -133,6 +139,21 @@ interface UserResponse {
133
139
  user: User;
134
140
  };
135
141
  }
142
+ interface MyViolation {
143
+ id: number;
144
+ adminUsername: string;
145
+ reason: string;
146
+ revoked: boolean;
147
+ revokedAt: string | null;
148
+ createdAt: string;
149
+ }
150
+ interface MyViolationsResponse {
151
+ success: boolean;
152
+ data: {
153
+ violations: MyViolation[];
154
+ permanentBan: boolean;
155
+ };
156
+ }
136
157
  interface UserResource {
137
158
  getById(id: number): Promise<ApiResponse<UserResponse>>;
138
159
  getByUsername(username: string): Promise<ApiResponse<UserResponse>>;
@@ -146,6 +167,7 @@ interface UserResource {
146
167
  success: boolean;
147
168
  data: null;
148
169
  }>>;
170
+ getMyViolations(): Promise<ApiResponse<MyViolationsResponse>>;
149
171
  }
150
172
  declare const createUserResource: (api: Api) => UserResource;
151
173
 
@@ -416,8 +438,53 @@ interface RoomHistoryResponse {
416
438
  pagination: PaginationMeta;
417
439
  };
418
440
  }
441
+ type AuditAction = 'kick' | 'ban' | 'unban' | 'mute' | 'unmute' | 'role_change' | 'waitlist_move' | 'waitlist_remove' | 'track_skip';
442
+ interface RoomAuditLog {
443
+ id: number;
444
+ actorId: number;
445
+ actorUsername: string;
446
+ targetId: number | null;
447
+ targetUsername: string | null;
448
+ action: AuditAction;
449
+ metadata: string | null;
450
+ createdAt: string;
451
+ }
452
+ interface RoomAuditLogResponse {
453
+ success: boolean;
454
+ data: {
455
+ logs: RoomAuditLog[];
456
+ hasMore: boolean;
457
+ };
458
+ }
459
+ type DashboardActivityType = 'play' | 'woot' | 'grab';
460
+ interface DashboardActivityItem {
461
+ id: string;
462
+ type: DashboardActivityType;
463
+ room: {
464
+ id: number;
465
+ slug: string;
466
+ name: string;
467
+ };
468
+ media: {
469
+ id: number;
470
+ source: 'youtube' | 'soundcloud';
471
+ sourceId: string;
472
+ title: string;
473
+ artist: string | null;
474
+ thumbnail: string | null;
475
+ };
476
+ count: number | null;
477
+ createdAt: string;
478
+ }
479
+ interface DashboardActivityResponse {
480
+ success: boolean;
481
+ data: {
482
+ activities: DashboardActivityItem[];
483
+ };
484
+ }
419
485
  interface RoomResource {
420
486
  list(): Promise<ApiResponse<RoomsResponse>>;
487
+ mine(limit?: number): Promise<ApiResponse<RoomsResponse>>;
421
488
  featured(): Promise<ApiResponse<FeaturedRoomsResponse>>;
422
489
  getBySlug(slug: string): Promise<ApiResponse<RoomResponse>>;
423
490
  create(data: CreateRoomData): Promise<ApiResponse<RoomResponse>>;
@@ -502,6 +569,8 @@ interface RoomResource {
502
569
  vote(slug: string, type: 'woot' | 'meh'): Promise<ApiResponse<VoteResponse>>;
503
570
  grabTrack(slug: string, playlistId?: number): Promise<ApiResponse<GrabResponse>>;
504
571
  getHistory(slug: string, page?: number, limit?: number): Promise<ApiResponse<RoomHistoryResponse>>;
572
+ getAuditLog(slug: string, limit?: number, before?: string): Promise<ApiResponse<RoomAuditLogResponse>>;
573
+ activity(limit?: number): Promise<ApiResponse<DashboardActivityResponse>>;
505
574
  }
506
575
  declare const createRoomResource: (api: Api) => RoomResource;
507
576
 
@@ -692,6 +761,9 @@ interface AvatarCatalogResponse {
692
761
  xp: number;
693
762
  };
694
763
  }
764
+ interface EquipAvatarData {
765
+ avatarId: string;
766
+ }
695
767
  interface ShopResource {
696
768
  getAvatarCatalog(): Promise<ApiResponse<AvatarCatalogResponse>>;
697
769
  unlockAvatar(avatarId: string): Promise<ApiResponse<{
@@ -788,6 +860,109 @@ interface FriendResource {
788
860
  }
789
861
  declare const createFriendResource: (api: Api) => FriendResource;
790
862
 
863
+ interface AdminUserEntry {
864
+ id: number;
865
+ username: string;
866
+ displayName: string | null;
867
+ email?: string;
868
+ avatarId: string;
869
+ globalRole: GlobalRole;
870
+ disabled: boolean;
871
+ permanentBan: boolean;
872
+ emailVerified: boolean;
873
+ xp: number;
874
+ createdAt: string;
875
+ }
876
+ interface AdminUsersResponse {
877
+ success: boolean;
878
+ data: {
879
+ users: AdminUserEntry[];
880
+ total: number;
881
+ };
882
+ }
883
+ interface AdminStatsRoom {
884
+ slug: string;
885
+ name: string;
886
+ population: number;
887
+ }
888
+ interface AdminStatsResponse {
889
+ success: boolean;
890
+ data: {
891
+ activeRooms: number;
892
+ totalOnlineUsers: number;
893
+ rooms: AdminStatsRoom[];
894
+ };
895
+ }
896
+ interface AdminListUsersParams {
897
+ search?: string;
898
+ role?: GlobalRole | '';
899
+ disabled?: boolean;
900
+ page?: number;
901
+ limit?: number;
902
+ sortBy?: 'id' | 'username' | 'createdAt';
903
+ sortDir?: 'asc' | 'desc';
904
+ }
905
+ interface AccountViolation {
906
+ id: number;
907
+ adminId: number;
908
+ adminUsername: string;
909
+ reason: string;
910
+ revoked: boolean;
911
+ revokedAt: string | null;
912
+ revokerId: number | null;
913
+ createdAt: string;
914
+ }
915
+ interface UserViolationsResponse {
916
+ success: boolean;
917
+ data: {
918
+ violations: AccountViolation[];
919
+ permanentBan: boolean;
920
+ };
921
+ }
922
+ interface AddViolationResponse {
923
+ success: boolean;
924
+ data: {
925
+ violation: AccountViolation;
926
+ permanentlyBanned: boolean;
927
+ activeViolations: number;
928
+ };
929
+ }
930
+ interface AdminResource {
931
+ listUsers(params?: AdminListUsersParams): Promise<ApiResponse<AdminUsersResponse>>;
932
+ enableUser(id: number): Promise<ApiResponse<{
933
+ success: boolean;
934
+ data: null;
935
+ }>>;
936
+ disableUser(id: number): Promise<ApiResponse<{
937
+ success: boolean;
938
+ data: null;
939
+ }>>;
940
+ updateRole(id: number, role: GlobalRole): Promise<ApiResponse<{
941
+ success: boolean;
942
+ data: null;
943
+ }>>;
944
+ broadcast(message: string): Promise<ApiResponse<{
945
+ success: boolean;
946
+ data: {
947
+ sent_to_rooms: number;
948
+ };
949
+ }>>;
950
+ setMaintenance(active: boolean, message?: string, endsAt?: number | null): Promise<ApiResponse<{
951
+ success: boolean;
952
+ data: {
953
+ active: boolean;
954
+ };
955
+ }>>;
956
+ getStats(): Promise<ApiResponse<AdminStatsResponse>>;
957
+ addViolation(userId: number, reason: string): Promise<ApiResponse<AddViolationResponse>>;
958
+ revokeViolation(violationId: number): Promise<ApiResponse<{
959
+ success: boolean;
960
+ data: null;
961
+ }>>;
962
+ getUserViolations(userId: number): Promise<ApiResponse<UserViolationsResponse>>;
963
+ }
964
+ declare const createAdminResource: (api: Api) => AdminResource;
965
+
791
966
  interface ApiClient {
792
967
  api: Api;
793
968
  auth: AuthResource;
@@ -799,7 +974,8 @@ interface ApiClient {
799
974
  shop: ShopResource;
800
975
  subscription: SubscriptionResource;
801
976
  friend: FriendResource;
977
+ admin: AdminResource;
802
978
  }
803
979
  declare const createApiClient: (config: ApiConfig) => ApiClient;
804
980
 
805
- export { Api, type ApiClient, type ApiConfig, ApiError, type ApiResponse, type AuthResource, type BackendErrorResponse, type ChatResource, type FriendResource, Logger, type PlaylistResource, type RoomResource, type ShopResource, type SourceResource, type SubscriptionResource, type UserResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
981
+ export { type AccountViolation, type AddMediaData, type AddViolationResponse, type AdminListUsersParams, type AdminResource, type AdminStatsResponse, type AdminStatsRoom, type AdminUserEntry, type AdminUsersResponse, Api, type ApiClient, type ApiConfig, ApiError, type ApiResponse, type AuditAction, type AuthResource, type AuthUser, type AvatarCatalogItem, type AvatarCatalogResponse, type AvatarUnlockType, type BackendErrorResponse, type BanResponse, type BoothDJ, type BoothMedia, type BoothResponse, type BoothState, type ChatMessage, type ChatMessageResponse, type ChatMessagesResponse, type ChatResource, type CreateIntentResponse, type CreateRoomData, type DashboardActivityItem, type DashboardActivityResponse, type DashboardActivityType, type EquipAvatarData, type FeaturedRoomsResponse, type FriendActionResponse, type FriendEntry, type FriendList, type FriendListResponse, type FriendResource, type FriendStatusResponse, type FriendshipStatus, type GlobalRole, type GrabResponse, type ImportPlaylistData, type ImportPlaylistResponse, type ImportResult, type JoinMuteInfo, type JoinRoomResponse, Logger, type MediaItem, type MediaItemResponse, type MediaSearchResult, type MediaSource, type ModerateUserData, type MuteResponse, type MyViolation, type MyViolationsResponse, type PaginationMeta, type PlayHistoryItem, type Playlist, type PlaylistResource, type PlaylistResponse, type PlaylistsResponse, type PortalResponse, type Room, type RoomAuditLog, type RoomBan, type RoomBansResponse, type RoomHistoryResponse, type RoomMember, type RoomMute, type RoomMutesResponse, type RoomResource, type RoomResponse, type RoomRole, type RoomStaffResponse, type RoomUserState, type RoomsResponse, type SendMessageData, type ShopResource, type ShuffleResponse, type SoundCloudSearchResponse, type SoundCloudTrackResponse, type SourceResource, type SubscriptionPlan, type SubscriptionResource, type SubscriptionStatus, type UpdateProfileData, type UpdateRoomData, type User, type UserResource, type UserResponse, type UserViolationsResponse, type VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, createAdminResource, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  Api: () => Api,
34
34
  ApiError: () => ApiError,
35
35
  Logger: () => Logger,
36
+ createAdminResource: () => createAdminResource,
36
37
  createApi: () => createApi,
37
38
  createApiClient: () => createApiClient,
38
39
  createAuthResource: () => createAuthResource,
@@ -225,7 +226,9 @@ var createAuthResource = (api) => ({
225
226
  register: (data) => api.post(`${endpoint}/register`, data),
226
227
  refresh: (refreshToken) => api.post(`${endpoint}/refresh`, { refreshToken }),
227
228
  logout: () => api.post(`${endpoint}/logout`),
228
- me: () => api.get(`${endpoint}/me`)
229
+ me: () => api.get(`${endpoint}/me`),
230
+ forgotPassword: (email) => api.post(`${endpoint}/forgot-password`, { email }),
231
+ resetPassword: (token, password) => api.post(`${endpoint}/reset-password`, { token, password })
229
232
  });
230
233
 
231
234
  // src/resources/user.ts
@@ -236,13 +239,15 @@ var createUserResource = (api) => ({
236
239
  updateProfile: (data) => api.patch(`${endpoint2}/me`, data),
237
240
  deleteAccount: () => api.delete(`${endpoint2}/me`),
238
241
  updateRole: (id, role) => api.patch(`/api/admin/users/${id}/role`, { role }),
239
- disable: (id) => api.post(`/api/admin/users/${id}/disable`)
242
+ disable: (id) => api.post(`/api/admin/users/${id}/disable`),
243
+ getMyViolations: () => api.get(`${endpoint2}/me/violations`)
240
244
  });
241
245
 
242
246
  // src/resources/room.ts
243
247
  var endpoint3 = "/rooms";
244
248
  var createRoomResource = (api) => ({
245
249
  list: () => api.get(endpoint3),
250
+ mine: (limit = 20) => api.get(`${endpoint3}/mine`, { params: { limit } }),
246
251
  featured: () => api.get(`${endpoint3}/featured`),
247
252
  getBySlug: (slug) => api.get(`${endpoint3}/${slug}`),
248
253
  create: (data) => api.post(endpoint3, data),
@@ -279,7 +284,9 @@ var createRoomResource = (api) => ({
279
284
  ),
280
285
  vote: (slug, type) => api.post(`${endpoint3}/${slug}/booth/vote`, { type }),
281
286
  grabTrack: (slug, playlistId) => api.post(`${endpoint3}/${slug}/booth/grab`, playlistId ? { playlistId } : {}),
282
- getHistory: (slug, page = 1, limit = 20) => api.get(`${endpoint3}/${slug}/history`, { params: { page, limit } })
287
+ getHistory: (slug, page = 1, limit = 20) => api.get(`${endpoint3}/${slug}/history`, { params: { page, limit } }),
288
+ getAuditLog: (slug, limit = 50, before) => api.get(`${endpoint3}/${slug}/audit`, { params: before ? { limit, before } : { limit } }),
289
+ activity: (limit = 12) => api.get(`${endpoint3}/activity`, { params: { limit } })
283
290
  });
284
291
 
285
292
  // src/resources/chat.ts
@@ -374,6 +381,32 @@ var createFriendResource = (api) => ({
374
381
  unblock: (targetUserId) => api.delete(`${endpoint9}/${targetUserId}/block`)
375
382
  });
376
383
 
384
+ // src/resources/admin.ts
385
+ var endpoint10 = "/admin";
386
+ var createAdminResource = (api) => ({
387
+ listUsers: (params = {}) => {
388
+ const query = new URLSearchParams();
389
+ if (params.search) query.set("search", params.search);
390
+ if (params.role) query.set("role", params.role);
391
+ if (params.disabled !== void 0) query.set("disabled", String(params.disabled));
392
+ if (params.page) query.set("page", String(params.page));
393
+ if (params.limit) query.set("limit", String(params.limit));
394
+ if (params.sortBy) query.set("sortBy", params.sortBy);
395
+ if (params.sortDir) query.set("sortDir", params.sortDir);
396
+ const qs = query.toString();
397
+ return api.get(`${endpoint10}/users${qs ? `?${qs}` : ""}`);
398
+ },
399
+ enableUser: (id) => api.post(`${endpoint10}/users/${id}/enable`),
400
+ disableUser: (id) => api.post(`${endpoint10}/users/${id}/disable`),
401
+ updateRole: (id, role) => api.patch(`${endpoint10}/users/${id}/role`, { role }),
402
+ broadcast: (message) => api.post(`${endpoint10}/broadcast`, { message }),
403
+ setMaintenance: (active, message, endsAt) => api.post(`${endpoint10}/maintenance`, { active, message, endsAt }),
404
+ getStats: () => api.get(`${endpoint10}/stats`),
405
+ addViolation: (userId, reason) => api.post(`${endpoint10}/users/${userId}/violations`, { reason }),
406
+ revokeViolation: (violationId) => api.delete(`${endpoint10}/violations/${violationId}`),
407
+ getUserViolations: (userId) => api.get(`${endpoint10}/users/${userId}/violations`)
408
+ });
409
+
377
410
  // src/resources/index.ts
378
411
  var createApiClient = (config) => {
379
412
  const api = createApi(config);
@@ -387,7 +420,8 @@ var createApiClient = (config) => {
387
420
  source: createSourceResource(api),
388
421
  shop: createShopResource(api),
389
422
  subscription: createSubscriptionResource(api),
390
- friend: createFriendResource(api)
423
+ friend: createFriendResource(api),
424
+ admin: createAdminResource(api)
391
425
  };
392
426
  };
393
427
  // Annotate the CommonJS export names for ESM import in node:
@@ -395,6 +429,7 @@ var createApiClient = (config) => {
395
429
  Api,
396
430
  ApiError,
397
431
  Logger,
432
+ createAdminResource,
398
433
  createApi,
399
434
  createApiClient,
400
435
  createAuthResource,
package/dist/index.mjs CHANGED
@@ -176,7 +176,9 @@ var createAuthResource = (api) => ({
176
176
  register: (data) => api.post(`${endpoint}/register`, data),
177
177
  refresh: (refreshToken) => api.post(`${endpoint}/refresh`, { refreshToken }),
178
178
  logout: () => api.post(`${endpoint}/logout`),
179
- me: () => api.get(`${endpoint}/me`)
179
+ me: () => api.get(`${endpoint}/me`),
180
+ forgotPassword: (email) => api.post(`${endpoint}/forgot-password`, { email }),
181
+ resetPassword: (token, password) => api.post(`${endpoint}/reset-password`, { token, password })
180
182
  });
181
183
 
182
184
  // src/resources/user.ts
@@ -187,13 +189,15 @@ var createUserResource = (api) => ({
187
189
  updateProfile: (data) => api.patch(`${endpoint2}/me`, data),
188
190
  deleteAccount: () => api.delete(`${endpoint2}/me`),
189
191
  updateRole: (id, role) => api.patch(`/api/admin/users/${id}/role`, { role }),
190
- disable: (id) => api.post(`/api/admin/users/${id}/disable`)
192
+ disable: (id) => api.post(`/api/admin/users/${id}/disable`),
193
+ getMyViolations: () => api.get(`${endpoint2}/me/violations`)
191
194
  });
192
195
 
193
196
  // src/resources/room.ts
194
197
  var endpoint3 = "/rooms";
195
198
  var createRoomResource = (api) => ({
196
199
  list: () => api.get(endpoint3),
200
+ mine: (limit = 20) => api.get(`${endpoint3}/mine`, { params: { limit } }),
197
201
  featured: () => api.get(`${endpoint3}/featured`),
198
202
  getBySlug: (slug) => api.get(`${endpoint3}/${slug}`),
199
203
  create: (data) => api.post(endpoint3, data),
@@ -230,7 +234,9 @@ var createRoomResource = (api) => ({
230
234
  ),
231
235
  vote: (slug, type) => api.post(`${endpoint3}/${slug}/booth/vote`, { type }),
232
236
  grabTrack: (slug, playlistId) => api.post(`${endpoint3}/${slug}/booth/grab`, playlistId ? { playlistId } : {}),
233
- getHistory: (slug, page = 1, limit = 20) => api.get(`${endpoint3}/${slug}/history`, { params: { page, limit } })
237
+ getHistory: (slug, page = 1, limit = 20) => api.get(`${endpoint3}/${slug}/history`, { params: { page, limit } }),
238
+ getAuditLog: (slug, limit = 50, before) => api.get(`${endpoint3}/${slug}/audit`, { params: before ? { limit, before } : { limit } }),
239
+ activity: (limit = 12) => api.get(`${endpoint3}/activity`, { params: { limit } })
234
240
  });
235
241
 
236
242
  // src/resources/chat.ts
@@ -325,6 +331,32 @@ var createFriendResource = (api) => ({
325
331
  unblock: (targetUserId) => api.delete(`${endpoint9}/${targetUserId}/block`)
326
332
  });
327
333
 
334
+ // src/resources/admin.ts
335
+ var endpoint10 = "/admin";
336
+ var createAdminResource = (api) => ({
337
+ listUsers: (params = {}) => {
338
+ const query = new URLSearchParams();
339
+ if (params.search) query.set("search", params.search);
340
+ if (params.role) query.set("role", params.role);
341
+ if (params.disabled !== void 0) query.set("disabled", String(params.disabled));
342
+ if (params.page) query.set("page", String(params.page));
343
+ if (params.limit) query.set("limit", String(params.limit));
344
+ if (params.sortBy) query.set("sortBy", params.sortBy);
345
+ if (params.sortDir) query.set("sortDir", params.sortDir);
346
+ const qs = query.toString();
347
+ return api.get(`${endpoint10}/users${qs ? `?${qs}` : ""}`);
348
+ },
349
+ enableUser: (id) => api.post(`${endpoint10}/users/${id}/enable`),
350
+ disableUser: (id) => api.post(`${endpoint10}/users/${id}/disable`),
351
+ updateRole: (id, role) => api.patch(`${endpoint10}/users/${id}/role`, { role }),
352
+ broadcast: (message) => api.post(`${endpoint10}/broadcast`, { message }),
353
+ setMaintenance: (active, message, endsAt) => api.post(`${endpoint10}/maintenance`, { active, message, endsAt }),
354
+ getStats: () => api.get(`${endpoint10}/stats`),
355
+ addViolation: (userId, reason) => api.post(`${endpoint10}/users/${userId}/violations`, { reason }),
356
+ revokeViolation: (violationId) => api.delete(`${endpoint10}/violations/${violationId}`),
357
+ getUserViolations: (userId) => api.get(`${endpoint10}/users/${userId}/violations`)
358
+ });
359
+
328
360
  // src/resources/index.ts
329
361
  var createApiClient = (config) => {
330
362
  const api = createApi(config);
@@ -338,13 +370,15 @@ var createApiClient = (config) => {
338
370
  source: createSourceResource(api),
339
371
  shop: createShopResource(api),
340
372
  subscription: createSubscriptionResource(api),
341
- friend: createFriendResource(api)
373
+ friend: createFriendResource(api),
374
+ admin: createAdminResource(api)
342
375
  };
343
376
  };
344
377
  export {
345
378
  Api,
346
379
  ApiError,
347
380
  Logger,
381
+ createAdminResource,
348
382
  createApi,
349
383
  createApiClient,
350
384
  createAuthResource,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@borealise/api",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.10",
4
4
  "description": "Official API client for Borealise",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",