@borealise/api 2.0.0-alpha.4 → 2.0.0-alpha.6
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 +26 -1
- package/dist/index.mjs +25 -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 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 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 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 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,28 @@ var createFriendResource = (api) => ({
|
|
|
377
378
|
unblock: (targetUserId) => api.delete(`${endpoint9}/${targetUserId}/block`)
|
|
378
379
|
});
|
|
379
380
|
|
|
381
|
+
// src/resources/admin.ts
|
|
382
|
+
var createAdminResource = (api) => ({
|
|
383
|
+
listUsers: (params = {}) => {
|
|
384
|
+
const query = new URLSearchParams();
|
|
385
|
+
if (params.search) query.set("search", params.search);
|
|
386
|
+
if (params.role) query.set("role", params.role);
|
|
387
|
+
if (params.disabled !== void 0) query.set("disabled", String(params.disabled));
|
|
388
|
+
if (params.page) query.set("page", String(params.page));
|
|
389
|
+
if (params.limit) query.set("limit", String(params.limit));
|
|
390
|
+
if (params.sortBy) query.set("sortBy", params.sortBy);
|
|
391
|
+
if (params.sortDir) query.set("sortDir", params.sortDir);
|
|
392
|
+
const qs = query.toString();
|
|
393
|
+
return api.get(`/api/admin/users${qs ? `?${qs}` : ""}`);
|
|
394
|
+
},
|
|
395
|
+
enableUser: (id) => api.post(`/api/admin/users/${id}/enable`),
|
|
396
|
+
disableUser: (id) => api.post(`/api/admin/users/${id}/disable`),
|
|
397
|
+
updateRole: (id, role) => api.patch(`/api/admin/users/${id}/role`, { role }),
|
|
398
|
+
broadcast: (message) => api.post("/api/admin/broadcast", { message }),
|
|
399
|
+
setMaintenance: (active, message, endsAt) => api.post("/api/admin/maintenance", { active, message, endsAt }),
|
|
400
|
+
getStats: () => api.get("/api/admin/stats")
|
|
401
|
+
});
|
|
402
|
+
|
|
380
403
|
// src/resources/index.ts
|
|
381
404
|
var createApiClient = (config) => {
|
|
382
405
|
const api = createApi(config);
|
|
@@ -390,7 +413,8 @@ var createApiClient = (config) => {
|
|
|
390
413
|
source: createSourceResource(api),
|
|
391
414
|
shop: createShopResource(api),
|
|
392
415
|
subscription: createSubscriptionResource(api),
|
|
393
|
-
friend: createFriendResource(api)
|
|
416
|
+
friend: createFriendResource(api),
|
|
417
|
+
admin: createAdminResource(api)
|
|
394
418
|
};
|
|
395
419
|
};
|
|
396
420
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -398,6 +422,7 @@ var createApiClient = (config) => {
|
|
|
398
422
|
Api,
|
|
399
423
|
ApiError,
|
|
400
424
|
Logger,
|
|
425
|
+
createAdminResource,
|
|
401
426
|
createApi,
|
|
402
427
|
createApiClient,
|
|
403
428
|
createAuthResource,
|
package/dist/index.mjs
CHANGED
|
@@ -328,6 +328,28 @@ var createFriendResource = (api) => ({
|
|
|
328
328
|
unblock: (targetUserId) => api.delete(`${endpoint9}/${targetUserId}/block`)
|
|
329
329
|
});
|
|
330
330
|
|
|
331
|
+
// src/resources/admin.ts
|
|
332
|
+
var createAdminResource = (api) => ({
|
|
333
|
+
listUsers: (params = {}) => {
|
|
334
|
+
const query = new URLSearchParams();
|
|
335
|
+
if (params.search) query.set("search", params.search);
|
|
336
|
+
if (params.role) query.set("role", params.role);
|
|
337
|
+
if (params.disabled !== void 0) query.set("disabled", String(params.disabled));
|
|
338
|
+
if (params.page) query.set("page", String(params.page));
|
|
339
|
+
if (params.limit) query.set("limit", String(params.limit));
|
|
340
|
+
if (params.sortBy) query.set("sortBy", params.sortBy);
|
|
341
|
+
if (params.sortDir) query.set("sortDir", params.sortDir);
|
|
342
|
+
const qs = query.toString();
|
|
343
|
+
return api.get(`/api/admin/users${qs ? `?${qs}` : ""}`);
|
|
344
|
+
},
|
|
345
|
+
enableUser: (id) => api.post(`/api/admin/users/${id}/enable`),
|
|
346
|
+
disableUser: (id) => api.post(`/api/admin/users/${id}/disable`),
|
|
347
|
+
updateRole: (id, role) => api.patch(`/api/admin/users/${id}/role`, { role }),
|
|
348
|
+
broadcast: (message) => api.post("/api/admin/broadcast", { message }),
|
|
349
|
+
setMaintenance: (active, message, endsAt) => api.post("/api/admin/maintenance", { active, message, endsAt }),
|
|
350
|
+
getStats: () => api.get("/api/admin/stats")
|
|
351
|
+
});
|
|
352
|
+
|
|
331
353
|
// src/resources/index.ts
|
|
332
354
|
var createApiClient = (config) => {
|
|
333
355
|
const api = createApi(config);
|
|
@@ -341,13 +363,15 @@ var createApiClient = (config) => {
|
|
|
341
363
|
source: createSourceResource(api),
|
|
342
364
|
shop: createShopResource(api),
|
|
343
365
|
subscription: createSubscriptionResource(api),
|
|
344
|
-
friend: createFriendResource(api)
|
|
366
|
+
friend: createFriendResource(api),
|
|
367
|
+
admin: createAdminResource(api)
|
|
345
368
|
};
|
|
346
369
|
};
|
|
347
370
|
export {
|
|
348
371
|
Api,
|
|
349
372
|
ApiError,
|
|
350
373
|
Logger,
|
|
374
|
+
createAdminResource,
|
|
351
375
|
createApi,
|
|
352
376
|
createApiClient,
|
|
353
377
|
createAuthResource,
|