@borealise/api 2.0.0-alpha.5 → 2.0.0-alpha.7
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 +73 -1
- package/dist/index.d.ts +73 -1
- package/dist/index.js +27 -1
- package/dist/index.mjs +26 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -816,6 +816,77 @@ interface FriendResource {
|
|
|
816
816
|
}
|
|
817
817
|
declare const createFriendResource: (api: Api) => FriendResource;
|
|
818
818
|
|
|
819
|
+
interface AdminUserEntry {
|
|
820
|
+
id: number;
|
|
821
|
+
username: string;
|
|
822
|
+
displayName: string | null;
|
|
823
|
+
email?: string;
|
|
824
|
+
avatarId: string;
|
|
825
|
+
globalRole: GlobalRole;
|
|
826
|
+
disabled: boolean;
|
|
827
|
+
emailVerified: boolean;
|
|
828
|
+
xp: number;
|
|
829
|
+
createdAt: string;
|
|
830
|
+
}
|
|
831
|
+
interface AdminUsersResponse {
|
|
832
|
+
success: boolean;
|
|
833
|
+
data: {
|
|
834
|
+
users: AdminUserEntry[];
|
|
835
|
+
total: number;
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
interface AdminStatsRoom {
|
|
839
|
+
slug: string;
|
|
840
|
+
name: string;
|
|
841
|
+
population: number;
|
|
842
|
+
}
|
|
843
|
+
interface AdminStatsResponse {
|
|
844
|
+
success: boolean;
|
|
845
|
+
data: {
|
|
846
|
+
activeRooms: number;
|
|
847
|
+
totalOnlineUsers: number;
|
|
848
|
+
rooms: AdminStatsRoom[];
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
interface AdminListUsersParams {
|
|
852
|
+
search?: string;
|
|
853
|
+
role?: GlobalRole | '';
|
|
854
|
+
disabled?: boolean;
|
|
855
|
+
page?: number;
|
|
856
|
+
limit?: number;
|
|
857
|
+
sortBy?: 'id' | 'username' | 'createdAt';
|
|
858
|
+
sortDir?: 'asc' | 'desc';
|
|
859
|
+
}
|
|
860
|
+
interface AdminResource {
|
|
861
|
+
listUsers(params?: AdminListUsersParams): Promise<ApiResponse<AdminUsersResponse>>;
|
|
862
|
+
enableUser(id: number): Promise<ApiResponse<{
|
|
863
|
+
success: boolean;
|
|
864
|
+
data: null;
|
|
865
|
+
}>>;
|
|
866
|
+
disableUser(id: number): Promise<ApiResponse<{
|
|
867
|
+
success: boolean;
|
|
868
|
+
data: null;
|
|
869
|
+
}>>;
|
|
870
|
+
updateRole(id: number, role: GlobalRole): Promise<ApiResponse<{
|
|
871
|
+
success: boolean;
|
|
872
|
+
data: null;
|
|
873
|
+
}>>;
|
|
874
|
+
broadcast(message: string): Promise<ApiResponse<{
|
|
875
|
+
success: boolean;
|
|
876
|
+
data: {
|
|
877
|
+
sent_to_rooms: number;
|
|
878
|
+
};
|
|
879
|
+
}>>;
|
|
880
|
+
setMaintenance(active: boolean, message?: string, endsAt?: number | null): Promise<ApiResponse<{
|
|
881
|
+
success: boolean;
|
|
882
|
+
data: {
|
|
883
|
+
active: boolean;
|
|
884
|
+
};
|
|
885
|
+
}>>;
|
|
886
|
+
getStats(): Promise<ApiResponse<AdminStatsResponse>>;
|
|
887
|
+
}
|
|
888
|
+
declare const createAdminResource: (api: Api) => AdminResource;
|
|
889
|
+
|
|
819
890
|
interface ApiClient {
|
|
820
891
|
api: Api;
|
|
821
892
|
auth: AuthResource;
|
|
@@ -827,7 +898,8 @@ interface ApiClient {
|
|
|
827
898
|
shop: ShopResource;
|
|
828
899
|
subscription: SubscriptionResource;
|
|
829
900
|
friend: FriendResource;
|
|
901
|
+
admin: AdminResource;
|
|
830
902
|
}
|
|
831
903
|
declare const createApiClient: (config: ApiConfig) => ApiClient;
|
|
832
904
|
|
|
833
|
-
export { type AddMediaData, 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 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 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 VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
|
|
905
|
+
export { type AddMediaData, 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 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 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 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
|
@@ -816,6 +816,77 @@ interface FriendResource {
|
|
|
816
816
|
}
|
|
817
817
|
declare const createFriendResource: (api: Api) => FriendResource;
|
|
818
818
|
|
|
819
|
+
interface AdminUserEntry {
|
|
820
|
+
id: number;
|
|
821
|
+
username: string;
|
|
822
|
+
displayName: string | null;
|
|
823
|
+
email?: string;
|
|
824
|
+
avatarId: string;
|
|
825
|
+
globalRole: GlobalRole;
|
|
826
|
+
disabled: boolean;
|
|
827
|
+
emailVerified: boolean;
|
|
828
|
+
xp: number;
|
|
829
|
+
createdAt: string;
|
|
830
|
+
}
|
|
831
|
+
interface AdminUsersResponse {
|
|
832
|
+
success: boolean;
|
|
833
|
+
data: {
|
|
834
|
+
users: AdminUserEntry[];
|
|
835
|
+
total: number;
|
|
836
|
+
};
|
|
837
|
+
}
|
|
838
|
+
interface AdminStatsRoom {
|
|
839
|
+
slug: string;
|
|
840
|
+
name: string;
|
|
841
|
+
population: number;
|
|
842
|
+
}
|
|
843
|
+
interface AdminStatsResponse {
|
|
844
|
+
success: boolean;
|
|
845
|
+
data: {
|
|
846
|
+
activeRooms: number;
|
|
847
|
+
totalOnlineUsers: number;
|
|
848
|
+
rooms: AdminStatsRoom[];
|
|
849
|
+
};
|
|
850
|
+
}
|
|
851
|
+
interface AdminListUsersParams {
|
|
852
|
+
search?: string;
|
|
853
|
+
role?: GlobalRole | '';
|
|
854
|
+
disabled?: boolean;
|
|
855
|
+
page?: number;
|
|
856
|
+
limit?: number;
|
|
857
|
+
sortBy?: 'id' | 'username' | 'createdAt';
|
|
858
|
+
sortDir?: 'asc' | 'desc';
|
|
859
|
+
}
|
|
860
|
+
interface AdminResource {
|
|
861
|
+
listUsers(params?: AdminListUsersParams): Promise<ApiResponse<AdminUsersResponse>>;
|
|
862
|
+
enableUser(id: number): Promise<ApiResponse<{
|
|
863
|
+
success: boolean;
|
|
864
|
+
data: null;
|
|
865
|
+
}>>;
|
|
866
|
+
disableUser(id: number): Promise<ApiResponse<{
|
|
867
|
+
success: boolean;
|
|
868
|
+
data: null;
|
|
869
|
+
}>>;
|
|
870
|
+
updateRole(id: number, role: GlobalRole): Promise<ApiResponse<{
|
|
871
|
+
success: boolean;
|
|
872
|
+
data: null;
|
|
873
|
+
}>>;
|
|
874
|
+
broadcast(message: string): Promise<ApiResponse<{
|
|
875
|
+
success: boolean;
|
|
876
|
+
data: {
|
|
877
|
+
sent_to_rooms: number;
|
|
878
|
+
};
|
|
879
|
+
}>>;
|
|
880
|
+
setMaintenance(active: boolean, message?: string, endsAt?: number | null): Promise<ApiResponse<{
|
|
881
|
+
success: boolean;
|
|
882
|
+
data: {
|
|
883
|
+
active: boolean;
|
|
884
|
+
};
|
|
885
|
+
}>>;
|
|
886
|
+
getStats(): Promise<ApiResponse<AdminStatsResponse>>;
|
|
887
|
+
}
|
|
888
|
+
declare const createAdminResource: (api: Api) => AdminResource;
|
|
889
|
+
|
|
819
890
|
interface ApiClient {
|
|
820
891
|
api: Api;
|
|
821
892
|
auth: AuthResource;
|
|
@@ -827,7 +898,8 @@ interface ApiClient {
|
|
|
827
898
|
shop: ShopResource;
|
|
828
899
|
subscription: SubscriptionResource;
|
|
829
900
|
friend: FriendResource;
|
|
901
|
+
admin: AdminResource;
|
|
830
902
|
}
|
|
831
903
|
declare const createApiClient: (config: ApiConfig) => ApiClient;
|
|
832
904
|
|
|
833
|
-
export { type AddMediaData, 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 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 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 VoteResponse, type WaitlistResponse, type WaitlistUser, type YouTubeSearchResponse, type YouTubeVideoResponse, createApi, createApiClient, createAuthResource, createChatResource, createFriendResource, createPlaylistResource, createRoomResource, createShopResource, createSourceResource, createSubscriptionResource, createUserResource };
|
|
905
|
+
export { type AddMediaData, 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 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 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 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,
|
|
@@ -377,6 +378,29 @@ var createFriendResource = (api) => ({
|
|
|
377
378
|
unblock: (targetUserId) => api.delete(`${endpoint9}/${targetUserId}/block`)
|
|
378
379
|
});
|
|
379
380
|
|
|
381
|
+
// src/resources/admin.ts
|
|
382
|
+
var endpoint10 = "/admin";
|
|
383
|
+
var createAdminResource = (api) => ({
|
|
384
|
+
listUsers: (params = {}) => {
|
|
385
|
+
const query = new URLSearchParams();
|
|
386
|
+
if (params.search) query.set("search", params.search);
|
|
387
|
+
if (params.role) query.set("role", params.role);
|
|
388
|
+
if (params.disabled !== void 0) query.set("disabled", String(params.disabled));
|
|
389
|
+
if (params.page) query.set("page", String(params.page));
|
|
390
|
+
if (params.limit) query.set("limit", String(params.limit));
|
|
391
|
+
if (params.sortBy) query.set("sortBy", params.sortBy);
|
|
392
|
+
if (params.sortDir) query.set("sortDir", params.sortDir);
|
|
393
|
+
const qs = query.toString();
|
|
394
|
+
return api.get(`${endpoint10}/users${qs ? `?${qs}` : ""}`);
|
|
395
|
+
},
|
|
396
|
+
enableUser: (id) => api.post(`${endpoint10}/users/${id}/enable`),
|
|
397
|
+
disableUser: (id) => api.post(`${endpoint10}/users/${id}/disable`),
|
|
398
|
+
updateRole: (id, role) => api.patch(`${endpoint10}/users/${id}/role`, { role }),
|
|
399
|
+
broadcast: (message) => api.post(`${endpoint10}/broadcast`, { message }),
|
|
400
|
+
setMaintenance: (active, message, endsAt) => api.post(`${endpoint10}/maintenance`, { active, message, endsAt }),
|
|
401
|
+
getStats: () => api.get(`${endpoint10}/stats`)
|
|
402
|
+
});
|
|
403
|
+
|
|
380
404
|
// src/resources/index.ts
|
|
381
405
|
var createApiClient = (config) => {
|
|
382
406
|
const api = createApi(config);
|
|
@@ -390,7 +414,8 @@ var createApiClient = (config) => {
|
|
|
390
414
|
source: createSourceResource(api),
|
|
391
415
|
shop: createShopResource(api),
|
|
392
416
|
subscription: createSubscriptionResource(api),
|
|
393
|
-
friend: createFriendResource(api)
|
|
417
|
+
friend: createFriendResource(api),
|
|
418
|
+
admin: createAdminResource(api)
|
|
394
419
|
};
|
|
395
420
|
};
|
|
396
421
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -398,6 +423,7 @@ var createApiClient = (config) => {
|
|
|
398
423
|
Api,
|
|
399
424
|
ApiError,
|
|
400
425
|
Logger,
|
|
426
|
+
createAdminResource,
|
|
401
427
|
createApi,
|
|
402
428
|
createApiClient,
|
|
403
429
|
createAuthResource,
|
package/dist/index.mjs
CHANGED
|
@@ -328,6 +328,29 @@ var createFriendResource = (api) => ({
|
|
|
328
328
|
unblock: (targetUserId) => api.delete(`${endpoint9}/${targetUserId}/block`)
|
|
329
329
|
});
|
|
330
330
|
|
|
331
|
+
// src/resources/admin.ts
|
|
332
|
+
var endpoint10 = "/admin";
|
|
333
|
+
var createAdminResource = (api) => ({
|
|
334
|
+
listUsers: (params = {}) => {
|
|
335
|
+
const query = new URLSearchParams();
|
|
336
|
+
if (params.search) query.set("search", params.search);
|
|
337
|
+
if (params.role) query.set("role", params.role);
|
|
338
|
+
if (params.disabled !== void 0) query.set("disabled", String(params.disabled));
|
|
339
|
+
if (params.page) query.set("page", String(params.page));
|
|
340
|
+
if (params.limit) query.set("limit", String(params.limit));
|
|
341
|
+
if (params.sortBy) query.set("sortBy", params.sortBy);
|
|
342
|
+
if (params.sortDir) query.set("sortDir", params.sortDir);
|
|
343
|
+
const qs = query.toString();
|
|
344
|
+
return api.get(`${endpoint10}/users${qs ? `?${qs}` : ""}`);
|
|
345
|
+
},
|
|
346
|
+
enableUser: (id) => api.post(`${endpoint10}/users/${id}/enable`),
|
|
347
|
+
disableUser: (id) => api.post(`${endpoint10}/users/${id}/disable`),
|
|
348
|
+
updateRole: (id, role) => api.patch(`${endpoint10}/users/${id}/role`, { role }),
|
|
349
|
+
broadcast: (message) => api.post(`${endpoint10}/broadcast`, { message }),
|
|
350
|
+
setMaintenance: (active, message, endsAt) => api.post(`${endpoint10}/maintenance`, { active, message, endsAt }),
|
|
351
|
+
getStats: () => api.get(`${endpoint10}/stats`)
|
|
352
|
+
});
|
|
353
|
+
|
|
331
354
|
// src/resources/index.ts
|
|
332
355
|
var createApiClient = (config) => {
|
|
333
356
|
const api = createApi(config);
|
|
@@ -341,13 +364,15 @@ var createApiClient = (config) => {
|
|
|
341
364
|
source: createSourceResource(api),
|
|
342
365
|
shop: createShopResource(api),
|
|
343
366
|
subscription: createSubscriptionResource(api),
|
|
344
|
-
friend: createFriendResource(api)
|
|
367
|
+
friend: createFriendResource(api),
|
|
368
|
+
admin: createAdminResource(api)
|
|
345
369
|
};
|
|
346
370
|
};
|
|
347
371
|
export {
|
|
348
372
|
Api,
|
|
349
373
|
ApiError,
|
|
350
374
|
Logger,
|
|
375
|
+
createAdminResource,
|
|
351
376
|
createApi,
|
|
352
377
|
createApiClient,
|
|
353
378
|
createAuthResource,
|