@sublay/js 7.4.1 → 7.4.3
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 +84 -3
- package/dist/index.d.ts +6 -0
- package/dist/index.js +65 -0
- package/dist/index.mjs +63 -0
- package/dist/interfaces/ConversationMember.d.ts +2 -1
- package/dist/interfaces/Push.d.ts +20 -0
- package/dist/interfaces/Space.d.ts +3 -0
- package/dist/modules/chat/index.d.ts +1 -0
- package/dist/modules/chat/muteConversation.d.ts +23 -0
- package/dist/modules/push/getNotificationPreferences.d.ts +11 -0
- package/dist/modules/push/index.d.ts +2 -0
- package/dist/modules/push/updateNotificationPreferences.d.ts +16 -0
- package/dist/modules/spaces/createSpace.d.ts +2 -1
- package/dist/modules/spaces/updateSpace.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -760,6 +760,7 @@ interface SpaceMention {
|
|
|
760
760
|
|
|
761
761
|
type ReadingPermission = "anyone" | "members";
|
|
762
762
|
type PostingPermission = "anyone" | "members" | "admins";
|
|
763
|
+
type SpaceVisibility = "public" | "unlisted" | "private";
|
|
763
764
|
type SpaceMemberRole = "admin" | "moderator" | "member";
|
|
764
765
|
type SpaceMemberStatus = "pending" | "active" | "banned" | "rejected";
|
|
765
766
|
interface SpaceMemberPermissions {
|
|
@@ -778,6 +779,7 @@ interface SpacePreview {
|
|
|
778
779
|
slug: string | null;
|
|
779
780
|
avatarFileId: string | null;
|
|
780
781
|
readingPermission?: ReadingPermission;
|
|
782
|
+
visibility?: SpaceVisibility;
|
|
781
783
|
parentSpaceId?: string | null;
|
|
782
784
|
depth?: number;
|
|
783
785
|
avatarFile?: File$1;
|
|
@@ -794,6 +796,7 @@ interface Space {
|
|
|
794
796
|
userId: string;
|
|
795
797
|
readingPermission: ReadingPermission;
|
|
796
798
|
postingPermission: PostingPermission;
|
|
799
|
+
visibility: SpaceVisibility;
|
|
797
800
|
requireJoinApproval: boolean;
|
|
798
801
|
parentSpaceId: string | null;
|
|
799
802
|
depth: number;
|
|
@@ -1615,6 +1618,7 @@ interface CreateSpaceProps {
|
|
|
1615
1618
|
description?: string;
|
|
1616
1619
|
readingPermission?: ReadingPermission;
|
|
1617
1620
|
postingPermission?: PostingPermission;
|
|
1621
|
+
visibility?: SpaceVisibility;
|
|
1618
1622
|
requireJoinApproval?: boolean;
|
|
1619
1623
|
parentSpaceId?: string;
|
|
1620
1624
|
metadata?: Record<string, any>;
|
|
@@ -1691,6 +1695,7 @@ interface UpdateSpaceProps {
|
|
|
1691
1695
|
description?: string;
|
|
1692
1696
|
readingPermission?: ReadingPermission;
|
|
1693
1697
|
postingPermission?: PostingPermission;
|
|
1698
|
+
visibility?: SpaceVisibility;
|
|
1694
1699
|
metadata?: Record<string, any>;
|
|
1695
1700
|
/**
|
|
1696
1701
|
* New avatar image. When present the request is sent as `multipart/form-data`
|
|
@@ -1976,7 +1981,8 @@ interface ConversationMember {
|
|
|
1976
1981
|
userId: string;
|
|
1977
1982
|
role: ConversationMemberRole | null;
|
|
1978
1983
|
lastReadAt: string | null;
|
|
1979
|
-
mutedUntil
|
|
1984
|
+
mutedUntil?: string | null;
|
|
1985
|
+
mutedForever?: boolean;
|
|
1980
1986
|
isActive: boolean;
|
|
1981
1987
|
leftAt: string | null;
|
|
1982
1988
|
createdAt: string;
|
|
@@ -3140,6 +3146,48 @@ declare function markAsRead(client: SublayHttpClient, data: MarkAsReadProps): Pr
|
|
|
3140
3146
|
message: string;
|
|
3141
3147
|
}>;
|
|
3142
3148
|
|
|
3149
|
+
/**
|
|
3150
|
+
* Every push event type — the full app-notification type set plus the chat
|
|
3151
|
+
* `message` event (push-only). Mirrors the server's `PUSH_EVENT_TYPES` exactly
|
|
3152
|
+
* (server `src/constants/push/pushEvents.ts`); these are the only names a
|
|
3153
|
+
* `disabledTypes` set may contain.
|
|
3154
|
+
*/
|
|
3155
|
+
declare const PUSH_EVENT_TYPES: readonly ["entity-comment", "comment-reply", "entity-mention", "comment-mention", "entity-reaction", "comment-reaction", "entity-reaction-milestone-specific", "entity-reaction-milestone-total", "comment-reaction-milestone-specific", "comment-reaction-milestone-total", "new-follow", "connection-request", "connection-accepted", "space-membership-approved", "event-invite", "event-updated", "event-cancelled", "message"];
|
|
3156
|
+
type PushEventType = (typeof PUSH_EVENT_TYPES)[number];
|
|
3157
|
+
/**
|
|
3158
|
+
* The four conversation-mute duration choices. Send the CHOICE, never a raw
|
|
3159
|
+
* timestamp — the server resolves it and represents "forever" via the explicit
|
|
3160
|
+
* `mutedForever` signal on the returned member. Mirrors the server's
|
|
3161
|
+
* `MUTE_DURATIONS` (server `src/helpers/push/muteDuration.ts`).
|
|
3162
|
+
*/
|
|
3163
|
+
declare const MUTE_DURATIONS: readonly ["8h", "24h", "1w", "forever"];
|
|
3164
|
+
type MuteDuration = (typeof MUTE_DURATIONS)[number];
|
|
3165
|
+
/** Response of read/update notification preferences. */
|
|
3166
|
+
interface NotificationPreferences {
|
|
3167
|
+
disabledTypes: PushEventType[];
|
|
3168
|
+
}
|
|
3169
|
+
|
|
3170
|
+
interface MuteConversationProps {
|
|
3171
|
+
conversationId: string;
|
|
3172
|
+
/**
|
|
3173
|
+
* The duration CHOICE (`8h` / `24h` / `1w` / `forever`), or `null` to clear
|
|
3174
|
+
* the mute. Never a raw timestamp — the server resolves it and represents
|
|
3175
|
+
* "forever" via the returned member's explicit `mutedForever` signal.
|
|
3176
|
+
*/
|
|
3177
|
+
duration: MuteDuration | null;
|
|
3178
|
+
}
|
|
3179
|
+
interface MuteConversationResponse {
|
|
3180
|
+
currentMember: ConversationMember;
|
|
3181
|
+
}
|
|
3182
|
+
/**
|
|
3183
|
+
* Set / clear the logged-in user's conversation mute.
|
|
3184
|
+
*
|
|
3185
|
+
* Mirrors `POST /:projectId/chat/conversations/:conversationId/mute`. The actor
|
|
3186
|
+
* is derived from the user token (Rule A) — a user only mutes their own
|
|
3187
|
+
* membership, so there is no `userId` param.
|
|
3188
|
+
*/
|
|
3189
|
+
declare function muteConversation(client: SublayHttpClient, data: MuteConversationProps): Promise<MuteConversationResponse>;
|
|
3190
|
+
|
|
3143
3191
|
interface ReportMessageProps {
|
|
3144
3192
|
conversationId: string;
|
|
3145
3193
|
messageId: string;
|
|
@@ -3168,13 +3216,45 @@ declare const Chat_listMembers: typeof listMembers;
|
|
|
3168
3216
|
declare const Chat_listMessages: typeof listMessages;
|
|
3169
3217
|
declare const Chat_listReactions: typeof listReactions;
|
|
3170
3218
|
declare const Chat_markAsRead: typeof markAsRead;
|
|
3219
|
+
declare const Chat_muteConversation: typeof muteConversation;
|
|
3171
3220
|
declare const Chat_removeMember: typeof removeMember;
|
|
3172
3221
|
declare const Chat_reportMessage: typeof reportMessage;
|
|
3173
3222
|
declare const Chat_sendMessage: typeof sendMessage;
|
|
3174
3223
|
declare const Chat_toggleReaction: typeof toggleReaction;
|
|
3175
3224
|
declare const Chat_updateConversation: typeof updateConversation;
|
|
3176
3225
|
declare namespace Chat {
|
|
3177
|
-
export { Chat_addMember as addMember, Chat_changeMemberRole as changeMemberRole, Chat_createDirectConversation as createDirectConversation, Chat_createGroupConversation as createGroupConversation, Chat_deleteConversation as deleteConversation, Chat_deleteMessage as deleteMessage, Chat_editMessage as editMessage, Chat_getConversation as getConversation, Chat_getMessage as getMessage, Chat_getUnreadCount as getUnreadCount, Chat_leaveConversation as leaveConversation, Chat_listConversations as listConversations, Chat_listMembers as listMembers, Chat_listMessages as listMessages, Chat_listReactions as listReactions, Chat_markAsRead as markAsRead, Chat_removeMember as removeMember, Chat_reportMessage as reportMessage, Chat_sendMessage as sendMessage, Chat_toggleReaction as toggleReaction, Chat_updateConversation as updateConversation };
|
|
3226
|
+
export { Chat_addMember as addMember, Chat_changeMemberRole as changeMemberRole, Chat_createDirectConversation as createDirectConversation, Chat_createGroupConversation as createGroupConversation, Chat_deleteConversation as deleteConversation, Chat_deleteMessage as deleteMessage, Chat_editMessage as editMessage, Chat_getConversation as getConversation, Chat_getMessage as getMessage, Chat_getUnreadCount as getUnreadCount, Chat_leaveConversation as leaveConversation, Chat_listConversations as listConversations, Chat_listMembers as listMembers, Chat_listMessages as listMessages, Chat_listReactions as listReactions, Chat_markAsRead as markAsRead, Chat_muteConversation as muteConversation, Chat_removeMember as removeMember, Chat_reportMessage as reportMessage, Chat_sendMessage as sendMessage, Chat_toggleReaction as toggleReaction, Chat_updateConversation as updateConversation };
|
|
3227
|
+
}
|
|
3228
|
+
|
|
3229
|
+
/**
|
|
3230
|
+
* Read the logged-in user's push notification preferences (the set of event
|
|
3231
|
+
* types disabled for push). Returns an empty `disabledTypes` (all-on) when no
|
|
3232
|
+
* preference row exists.
|
|
3233
|
+
*
|
|
3234
|
+
* Mirrors `GET /:projectId/push-notifications/preferences`. The actor is derived
|
|
3235
|
+
* from the user token (Rule A) — no `userId` param.
|
|
3236
|
+
*/
|
|
3237
|
+
declare function getNotificationPreferences(client: SublayHttpClient): Promise<NotificationPreferences>;
|
|
3238
|
+
|
|
3239
|
+
interface UpdateNotificationPreferencesProps {
|
|
3240
|
+
/**
|
|
3241
|
+
* The set of push event types the user has opted OUT of. Server-exact type
|
|
3242
|
+
* names only (unknown names are rejected server-side); duplicates collapse.
|
|
3243
|
+
*/
|
|
3244
|
+
disabledTypes: PushEventType[];
|
|
3245
|
+
}
|
|
3246
|
+
/**
|
|
3247
|
+
* Upsert the logged-in user's push notification preferences.
|
|
3248
|
+
*
|
|
3249
|
+
* Mirrors `PUT /:projectId/push-notifications/preferences`. The actor is derived
|
|
3250
|
+
* from the user token (Rule A) — no `userId` param.
|
|
3251
|
+
*/
|
|
3252
|
+
declare function updateNotificationPreferences(client: SublayHttpClient, data: UpdateNotificationPreferencesProps): Promise<NotificationPreferences>;
|
|
3253
|
+
|
|
3254
|
+
declare const Push_getNotificationPreferences: typeof getNotificationPreferences;
|
|
3255
|
+
declare const Push_updateNotificationPreferences: typeof updateNotificationPreferences;
|
|
3256
|
+
declare namespace Push {
|
|
3257
|
+
export { Push_getNotificationPreferences as getNotificationPreferences, Push_updateNotificationPreferences as updateNotificationPreferences };
|
|
3178
3258
|
}
|
|
3179
3259
|
|
|
3180
3260
|
/**
|
|
@@ -3258,6 +3338,7 @@ declare class SublayClient {
|
|
|
3258
3338
|
storage: BoundModule<typeof Storage>;
|
|
3259
3339
|
oauth: BoundModule<typeof OAuth>;
|
|
3260
3340
|
chat: BoundModule<typeof Chat>;
|
|
3341
|
+
push: BoundModule<typeof Push>;
|
|
3261
3342
|
private constructor();
|
|
3262
3343
|
static init(config: ClientConfig): Promise<SublayClient>;
|
|
3263
3344
|
/**
|
|
@@ -3272,4 +3353,4 @@ declare class SublayClient {
|
|
|
3272
3353
|
clearTokens(): void;
|
|
3273
3354
|
}
|
|
3274
3355
|
|
|
3275
|
-
export { type AuthTokens, type BulkDeleteProps, type BulkDeleteResult, type ClientConfig, type DbFilter, type DbFilterOperator, type DeleteResult, type PaginatedResponse, type PaginationMetadata, type SpaceReputationContextParams, type SpaceReputationUserParams, SublayClient, type TableAccessor, type TableQuery, type TableRow, type UserSearchParams };
|
|
3356
|
+
export { type AuthTokens, type BulkDeleteProps, type BulkDeleteResult, type ClientConfig, type DbFilter, type DbFilterOperator, type DeleteResult, MUTE_DURATIONS, type MuteConversationProps, type MuteConversationResponse, type MuteDuration, type NotificationPreferences, PUSH_EVENT_TYPES, type PaginatedResponse, type PaginationMetadata, type PushEventType, type SpaceReputationContextParams, type SpaceReputationUserParams, SublayClient, type TableAccessor, type TableQuery, type TableRow, type UpdateNotificationPreferencesProps, type UserSearchParams };
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import * as Search from "./modules/search";
|
|
|
14
14
|
import * as Storage from "./modules/storage";
|
|
15
15
|
import * as OAuth from "./modules/oauth";
|
|
16
16
|
import * as Chat from "./modules/chat";
|
|
17
|
+
import * as Push from "./modules/push";
|
|
17
18
|
import { TableAccessor, TableRow } from "./interfaces/Table";
|
|
18
19
|
type BoundModule<T extends Record<string, (client: SublayHttpClient, ...args: any[]) => any>> = {
|
|
19
20
|
[K in keyof T]: (...args: Parameters<T[K]> extends [any, ...infer R] ? R : never) => ReturnType<T[K]>;
|
|
@@ -35,6 +36,7 @@ export declare class SublayClient {
|
|
|
35
36
|
storage: BoundModule<typeof Storage>;
|
|
36
37
|
oauth: BoundModule<typeof OAuth>;
|
|
37
38
|
chat: BoundModule<typeof Chat>;
|
|
39
|
+
push: BoundModule<typeof Push>;
|
|
38
40
|
private constructor();
|
|
39
41
|
static init(config: ClientConfig): Promise<SublayClient>;
|
|
40
42
|
/**
|
|
@@ -52,4 +54,8 @@ export type { ClientConfig, AuthTokens } from "./core/client";
|
|
|
52
54
|
export type { PaginatedResponse, PaginationMetadata, } from "./interfaces/IPaginatedResponse";
|
|
53
55
|
export type { SpaceReputationContextParams, SpaceReputationUserParams, } from "./interfaces/SpaceReputation";
|
|
54
56
|
export type { UserSearchParams } from "./interfaces/UserSearch";
|
|
57
|
+
export { PUSH_EVENT_TYPES, MUTE_DURATIONS } from "./interfaces/Push";
|
|
58
|
+
export type { PushEventType, MuteDuration, NotificationPreferences, } from "./interfaces/Push";
|
|
59
|
+
export type { UpdateNotificationPreferencesProps } from "./modules/push/updateNotificationPreferences";
|
|
60
|
+
export type { MuteConversationProps, MuteConversationResponse, } from "./modules/chat/muteConversation";
|
|
55
61
|
export type { TableAccessor, TableRow, TableQuery, DbFilter, DbFilterOperator, BulkDeleteProps, DeleteResult, BulkDeleteResult, } from "./interfaces/Table";
|
package/dist/index.js
CHANGED
|
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
MUTE_DURATIONS: () => MUTE_DURATIONS,
|
|
34
|
+
PUSH_EVENT_TYPES: () => PUSH_EVENT_TYPES,
|
|
33
35
|
SublayClient: () => SublayClient
|
|
34
36
|
});
|
|
35
37
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -2172,6 +2174,7 @@ __export(chat_exports, {
|
|
|
2172
2174
|
listMessages: () => listMessages,
|
|
2173
2175
|
listReactions: () => listReactions,
|
|
2174
2176
|
markAsRead: () => markAsRead,
|
|
2177
|
+
muteConversation: () => muteConversation,
|
|
2175
2178
|
removeMember: () => removeMember,
|
|
2176
2179
|
reportMessage: () => reportMessage,
|
|
2177
2180
|
sendMessage: () => sendMessage,
|
|
@@ -2453,6 +2456,16 @@ async function markAsRead(client, data) {
|
|
|
2453
2456
|
return response.data;
|
|
2454
2457
|
}
|
|
2455
2458
|
|
|
2459
|
+
// src/modules/chat/muteConversation.ts
|
|
2460
|
+
async function muteConversation(client, data) {
|
|
2461
|
+
const { conversationId, duration } = data;
|
|
2462
|
+
const response = await client.projectInstance.post(
|
|
2463
|
+
`/chat/conversations/${conversationId}/mute`,
|
|
2464
|
+
{ duration }
|
|
2465
|
+
);
|
|
2466
|
+
return response.data;
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2456
2469
|
// src/modules/chat/reportMessage.ts
|
|
2457
2470
|
async function reportMessage(client, data) {
|
|
2458
2471
|
const { conversationId, messageId, ...body } = data;
|
|
@@ -2463,6 +2476,31 @@ async function reportMessage(client, data) {
|
|
|
2463
2476
|
return response.data;
|
|
2464
2477
|
}
|
|
2465
2478
|
|
|
2479
|
+
// src/modules/push/index.ts
|
|
2480
|
+
var push_exports = {};
|
|
2481
|
+
__export(push_exports, {
|
|
2482
|
+
getNotificationPreferences: () => getNotificationPreferences,
|
|
2483
|
+
updateNotificationPreferences: () => updateNotificationPreferences
|
|
2484
|
+
});
|
|
2485
|
+
|
|
2486
|
+
// src/modules/push/getNotificationPreferences.ts
|
|
2487
|
+
async function getNotificationPreferences(client) {
|
|
2488
|
+
const response = await client.projectInstance.get(
|
|
2489
|
+
`/push-notifications/preferences`
|
|
2490
|
+
);
|
|
2491
|
+
return response.data;
|
|
2492
|
+
}
|
|
2493
|
+
|
|
2494
|
+
// src/modules/push/updateNotificationPreferences.ts
|
|
2495
|
+
async function updateNotificationPreferences(client, data) {
|
|
2496
|
+
const { disabledTypes } = data;
|
|
2497
|
+
const response = await client.projectInstance.put(
|
|
2498
|
+
`/push-notifications/preferences`,
|
|
2499
|
+
{ disabledTypes }
|
|
2500
|
+
);
|
|
2501
|
+
return response.data;
|
|
2502
|
+
}
|
|
2503
|
+
|
|
2466
2504
|
// src/modules/tables/find.ts
|
|
2467
2505
|
async function find(client, tableName, query = {}) {
|
|
2468
2506
|
const { filters, includeDeleted, ...rest } = query;
|
|
@@ -2552,6 +2590,29 @@ function createTableAccessor(client, tableName) {
|
|
|
2552
2590
|
};
|
|
2553
2591
|
}
|
|
2554
2592
|
|
|
2593
|
+
// src/interfaces/Push.ts
|
|
2594
|
+
var PUSH_EVENT_TYPES = [
|
|
2595
|
+
"entity-comment",
|
|
2596
|
+
"comment-reply",
|
|
2597
|
+
"entity-mention",
|
|
2598
|
+
"comment-mention",
|
|
2599
|
+
"entity-reaction",
|
|
2600
|
+
"comment-reaction",
|
|
2601
|
+
"entity-reaction-milestone-specific",
|
|
2602
|
+
"entity-reaction-milestone-total",
|
|
2603
|
+
"comment-reaction-milestone-specific",
|
|
2604
|
+
"comment-reaction-milestone-total",
|
|
2605
|
+
"new-follow",
|
|
2606
|
+
"connection-request",
|
|
2607
|
+
"connection-accepted",
|
|
2608
|
+
"space-membership-approved",
|
|
2609
|
+
"event-invite",
|
|
2610
|
+
"event-updated",
|
|
2611
|
+
"event-cancelled",
|
|
2612
|
+
"message"
|
|
2613
|
+
];
|
|
2614
|
+
var MUTE_DURATIONS = ["8h", "24h", "1w", "forever"];
|
|
2615
|
+
|
|
2555
2616
|
// src/index.ts
|
|
2556
2617
|
var SublayClient = class _SublayClient {
|
|
2557
2618
|
http;
|
|
@@ -2570,6 +2631,7 @@ var SublayClient = class _SublayClient {
|
|
|
2570
2631
|
storage;
|
|
2571
2632
|
oauth;
|
|
2572
2633
|
chat;
|
|
2634
|
+
push;
|
|
2573
2635
|
constructor(http) {
|
|
2574
2636
|
this.http = http;
|
|
2575
2637
|
this.auth = bindModule(auth_exports, this.http);
|
|
@@ -2587,6 +2649,7 @@ var SublayClient = class _SublayClient {
|
|
|
2587
2649
|
this.storage = bindModule(storage_exports, this.http);
|
|
2588
2650
|
this.oauth = bindModule(oauth_exports, this.http);
|
|
2589
2651
|
this.chat = bindModule(chat_exports, this.http);
|
|
2652
|
+
this.push = bindModule(push_exports, this.http);
|
|
2590
2653
|
}
|
|
2591
2654
|
static async init(config) {
|
|
2592
2655
|
const http = new SublayHttpClient(config);
|
|
@@ -2618,5 +2681,7 @@ function bindModule(module2, client) {
|
|
|
2618
2681
|
}
|
|
2619
2682
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2620
2683
|
0 && (module.exports = {
|
|
2684
|
+
MUTE_DURATIONS,
|
|
2685
|
+
PUSH_EVENT_TYPES,
|
|
2621
2686
|
SublayClient
|
|
2622
2687
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -2142,6 +2142,7 @@ __export(chat_exports, {
|
|
|
2142
2142
|
listMessages: () => listMessages,
|
|
2143
2143
|
listReactions: () => listReactions,
|
|
2144
2144
|
markAsRead: () => markAsRead,
|
|
2145
|
+
muteConversation: () => muteConversation,
|
|
2145
2146
|
removeMember: () => removeMember,
|
|
2146
2147
|
reportMessage: () => reportMessage,
|
|
2147
2148
|
sendMessage: () => sendMessage,
|
|
@@ -2423,6 +2424,16 @@ async function markAsRead(client, data) {
|
|
|
2423
2424
|
return response.data;
|
|
2424
2425
|
}
|
|
2425
2426
|
|
|
2427
|
+
// src/modules/chat/muteConversation.ts
|
|
2428
|
+
async function muteConversation(client, data) {
|
|
2429
|
+
const { conversationId, duration } = data;
|
|
2430
|
+
const response = await client.projectInstance.post(
|
|
2431
|
+
`/chat/conversations/${conversationId}/mute`,
|
|
2432
|
+
{ duration }
|
|
2433
|
+
);
|
|
2434
|
+
return response.data;
|
|
2435
|
+
}
|
|
2436
|
+
|
|
2426
2437
|
// src/modules/chat/reportMessage.ts
|
|
2427
2438
|
async function reportMessage(client, data) {
|
|
2428
2439
|
const { conversationId, messageId, ...body } = data;
|
|
@@ -2433,6 +2444,31 @@ async function reportMessage(client, data) {
|
|
|
2433
2444
|
return response.data;
|
|
2434
2445
|
}
|
|
2435
2446
|
|
|
2447
|
+
// src/modules/push/index.ts
|
|
2448
|
+
var push_exports = {};
|
|
2449
|
+
__export(push_exports, {
|
|
2450
|
+
getNotificationPreferences: () => getNotificationPreferences,
|
|
2451
|
+
updateNotificationPreferences: () => updateNotificationPreferences
|
|
2452
|
+
});
|
|
2453
|
+
|
|
2454
|
+
// src/modules/push/getNotificationPreferences.ts
|
|
2455
|
+
async function getNotificationPreferences(client) {
|
|
2456
|
+
const response = await client.projectInstance.get(
|
|
2457
|
+
`/push-notifications/preferences`
|
|
2458
|
+
);
|
|
2459
|
+
return response.data;
|
|
2460
|
+
}
|
|
2461
|
+
|
|
2462
|
+
// src/modules/push/updateNotificationPreferences.ts
|
|
2463
|
+
async function updateNotificationPreferences(client, data) {
|
|
2464
|
+
const { disabledTypes } = data;
|
|
2465
|
+
const response = await client.projectInstance.put(
|
|
2466
|
+
`/push-notifications/preferences`,
|
|
2467
|
+
{ disabledTypes }
|
|
2468
|
+
);
|
|
2469
|
+
return response.data;
|
|
2470
|
+
}
|
|
2471
|
+
|
|
2436
2472
|
// src/modules/tables/find.ts
|
|
2437
2473
|
async function find(client, tableName, query = {}) {
|
|
2438
2474
|
const { filters, includeDeleted, ...rest } = query;
|
|
@@ -2522,6 +2558,29 @@ function createTableAccessor(client, tableName) {
|
|
|
2522
2558
|
};
|
|
2523
2559
|
}
|
|
2524
2560
|
|
|
2561
|
+
// src/interfaces/Push.ts
|
|
2562
|
+
var PUSH_EVENT_TYPES = [
|
|
2563
|
+
"entity-comment",
|
|
2564
|
+
"comment-reply",
|
|
2565
|
+
"entity-mention",
|
|
2566
|
+
"comment-mention",
|
|
2567
|
+
"entity-reaction",
|
|
2568
|
+
"comment-reaction",
|
|
2569
|
+
"entity-reaction-milestone-specific",
|
|
2570
|
+
"entity-reaction-milestone-total",
|
|
2571
|
+
"comment-reaction-milestone-specific",
|
|
2572
|
+
"comment-reaction-milestone-total",
|
|
2573
|
+
"new-follow",
|
|
2574
|
+
"connection-request",
|
|
2575
|
+
"connection-accepted",
|
|
2576
|
+
"space-membership-approved",
|
|
2577
|
+
"event-invite",
|
|
2578
|
+
"event-updated",
|
|
2579
|
+
"event-cancelled",
|
|
2580
|
+
"message"
|
|
2581
|
+
];
|
|
2582
|
+
var MUTE_DURATIONS = ["8h", "24h", "1w", "forever"];
|
|
2583
|
+
|
|
2525
2584
|
// src/index.ts
|
|
2526
2585
|
var SublayClient = class _SublayClient {
|
|
2527
2586
|
http;
|
|
@@ -2540,6 +2599,7 @@ var SublayClient = class _SublayClient {
|
|
|
2540
2599
|
storage;
|
|
2541
2600
|
oauth;
|
|
2542
2601
|
chat;
|
|
2602
|
+
push;
|
|
2543
2603
|
constructor(http) {
|
|
2544
2604
|
this.http = http;
|
|
2545
2605
|
this.auth = bindModule(auth_exports, this.http);
|
|
@@ -2557,6 +2617,7 @@ var SublayClient = class _SublayClient {
|
|
|
2557
2617
|
this.storage = bindModule(storage_exports, this.http);
|
|
2558
2618
|
this.oauth = bindModule(oauth_exports, this.http);
|
|
2559
2619
|
this.chat = bindModule(chat_exports, this.http);
|
|
2620
|
+
this.push = bindModule(push_exports, this.http);
|
|
2560
2621
|
}
|
|
2561
2622
|
static async init(config) {
|
|
2562
2623
|
const http = new SublayHttpClient(config);
|
|
@@ -2587,5 +2648,7 @@ function bindModule(module, client) {
|
|
|
2587
2648
|
return bound;
|
|
2588
2649
|
}
|
|
2589
2650
|
export {
|
|
2651
|
+
MUTE_DURATIONS,
|
|
2652
|
+
PUSH_EVENT_TYPES,
|
|
2590
2653
|
SublayClient
|
|
2591
2654
|
};
|
|
@@ -7,7 +7,8 @@ export interface ConversationMember {
|
|
|
7
7
|
userId: string;
|
|
8
8
|
role: ConversationMemberRole | null;
|
|
9
9
|
lastReadAt: string | null;
|
|
10
|
-
mutedUntil
|
|
10
|
+
mutedUntil?: string | null;
|
|
11
|
+
mutedForever?: boolean;
|
|
11
12
|
isActive: boolean;
|
|
12
13
|
leftAt: string | null;
|
|
13
14
|
createdAt: string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every push event type — the full app-notification type set plus the chat
|
|
3
|
+
* `message` event (push-only). Mirrors the server's `PUSH_EVENT_TYPES` exactly
|
|
4
|
+
* (server `src/constants/push/pushEvents.ts`); these are the only names a
|
|
5
|
+
* `disabledTypes` set may contain.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PUSH_EVENT_TYPES: readonly ["entity-comment", "comment-reply", "entity-mention", "comment-mention", "entity-reaction", "comment-reaction", "entity-reaction-milestone-specific", "entity-reaction-milestone-total", "comment-reaction-milestone-specific", "comment-reaction-milestone-total", "new-follow", "connection-request", "connection-accepted", "space-membership-approved", "event-invite", "event-updated", "event-cancelled", "message"];
|
|
8
|
+
export type PushEventType = (typeof PUSH_EVENT_TYPES)[number];
|
|
9
|
+
/**
|
|
10
|
+
* The four conversation-mute duration choices. Send the CHOICE, never a raw
|
|
11
|
+
* timestamp — the server resolves it and represents "forever" via the explicit
|
|
12
|
+
* `mutedForever` signal on the returned member. Mirrors the server's
|
|
13
|
+
* `MUTE_DURATIONS` (server `src/helpers/push/muteDuration.ts`).
|
|
14
|
+
*/
|
|
15
|
+
export declare const MUTE_DURATIONS: readonly ["8h", "24h", "1w", "forever"];
|
|
16
|
+
export type MuteDuration = (typeof MUTE_DURATIONS)[number];
|
|
17
|
+
/** Response of read/update notification preferences. */
|
|
18
|
+
export interface NotificationPreferences {
|
|
19
|
+
disabledTypes: PushEventType[];
|
|
20
|
+
}
|
|
@@ -2,6 +2,7 @@ import { PaginatedResponse } from "./IPaginatedResponse";
|
|
|
2
2
|
import { File } from "./File";
|
|
3
3
|
export type ReadingPermission = "anyone" | "members";
|
|
4
4
|
export type PostingPermission = "anyone" | "members" | "admins";
|
|
5
|
+
export type SpaceVisibility = "public" | "unlisted" | "private";
|
|
5
6
|
export type SpaceMemberRole = "admin" | "moderator" | "member";
|
|
6
7
|
export type SpaceMemberStatus = "pending" | "active" | "banned" | "rejected";
|
|
7
8
|
export interface SpaceMemberPermissions {
|
|
@@ -20,6 +21,7 @@ export interface SpacePreview {
|
|
|
20
21
|
slug: string | null;
|
|
21
22
|
avatarFileId: string | null;
|
|
22
23
|
readingPermission?: ReadingPermission;
|
|
24
|
+
visibility?: SpaceVisibility;
|
|
23
25
|
parentSpaceId?: string | null;
|
|
24
26
|
depth?: number;
|
|
25
27
|
avatarFile?: File;
|
|
@@ -36,6 +38,7 @@ export interface Space {
|
|
|
36
38
|
userId: string;
|
|
37
39
|
readingPermission: ReadingPermission;
|
|
38
40
|
postingPermission: PostingPermission;
|
|
41
|
+
visibility: SpaceVisibility;
|
|
39
42
|
requireJoinApproval: boolean;
|
|
40
43
|
parentSpaceId: string | null;
|
|
41
44
|
depth: number;
|
|
@@ -18,4 +18,5 @@ export { deleteMessage } from "./deleteMessage";
|
|
|
18
18
|
export { toggleReaction } from "./toggleReaction";
|
|
19
19
|
export { listReactions } from "./listReactions";
|
|
20
20
|
export { markAsRead } from "./markAsRead";
|
|
21
|
+
export { muteConversation } from "./muteConversation";
|
|
21
22
|
export { reportMessage } from "./reportMessage";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { ConversationMember } from "../../interfaces/ConversationMember";
|
|
3
|
+
import { MuteDuration } from "../../interfaces/Push";
|
|
4
|
+
export interface MuteConversationProps {
|
|
5
|
+
conversationId: string;
|
|
6
|
+
/**
|
|
7
|
+
* The duration CHOICE (`8h` / `24h` / `1w` / `forever`), or `null` to clear
|
|
8
|
+
* the mute. Never a raw timestamp — the server resolves it and represents
|
|
9
|
+
* "forever" via the returned member's explicit `mutedForever` signal.
|
|
10
|
+
*/
|
|
11
|
+
duration: MuteDuration | null;
|
|
12
|
+
}
|
|
13
|
+
export interface MuteConversationResponse {
|
|
14
|
+
currentMember: ConversationMember;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Set / clear the logged-in user's conversation mute.
|
|
18
|
+
*
|
|
19
|
+
* Mirrors `POST /:projectId/chat/conversations/:conversationId/mute`. The actor
|
|
20
|
+
* is derived from the user token (Rule A) — a user only mutes their own
|
|
21
|
+
* membership, so there is no `userId` param.
|
|
22
|
+
*/
|
|
23
|
+
export declare function muteConversation(client: SublayHttpClient, data: MuteConversationProps): Promise<MuteConversationResponse>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { NotificationPreferences } from "../../interfaces/Push";
|
|
3
|
+
/**
|
|
4
|
+
* Read the logged-in user's push notification preferences (the set of event
|
|
5
|
+
* types disabled for push). Returns an empty `disabledTypes` (all-on) when no
|
|
6
|
+
* preference row exists.
|
|
7
|
+
*
|
|
8
|
+
* Mirrors `GET /:projectId/push-notifications/preferences`. The actor is derived
|
|
9
|
+
* from the user token (Rule A) — no `userId` param.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getNotificationPreferences(client: SublayHttpClient): Promise<NotificationPreferences>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SublayHttpClient } from "../../core/client";
|
|
2
|
+
import { NotificationPreferences, PushEventType } from "../../interfaces/Push";
|
|
3
|
+
export interface UpdateNotificationPreferencesProps {
|
|
4
|
+
/**
|
|
5
|
+
* The set of push event types the user has opted OUT of. Server-exact type
|
|
6
|
+
* names only (unknown names are rejected server-side); duplicates collapse.
|
|
7
|
+
*/
|
|
8
|
+
disabledTypes: PushEventType[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Upsert the logged-in user's push notification preferences.
|
|
12
|
+
*
|
|
13
|
+
* Mirrors `PUT /:projectId/push-notifications/preferences`. The actor is derived
|
|
14
|
+
* from the user token (Rule A) — no `userId` param.
|
|
15
|
+
*/
|
|
16
|
+
export declare function updateNotificationPreferences(client: SublayHttpClient, data: UpdateNotificationPreferencesProps): Promise<NotificationPreferences>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SublayHttpClient } from "../../core/client";
|
|
2
|
-
import { Space, ReadingPermission, PostingPermission } from "../../interfaces/Space";
|
|
2
|
+
import { Space, ReadingPermission, PostingPermission, SpaceVisibility } from "../../interfaces/Space";
|
|
3
3
|
import { ImageOptions } from "../../interfaces/ImageProcessing";
|
|
4
4
|
/** A file plus the image-processing options the server requires alongside it. */
|
|
5
5
|
export interface SpaceImageUpload {
|
|
@@ -13,6 +13,7 @@ export interface CreateSpaceProps {
|
|
|
13
13
|
description?: string;
|
|
14
14
|
readingPermission?: ReadingPermission;
|
|
15
15
|
postingPermission?: PostingPermission;
|
|
16
|
+
visibility?: SpaceVisibility;
|
|
16
17
|
requireJoinApproval?: boolean;
|
|
17
18
|
parentSpaceId?: string;
|
|
18
19
|
metadata?: Record<string, any>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SublayHttpClient } from "../../core/client";
|
|
2
|
-
import { Space, ReadingPermission, PostingPermission } from "../../interfaces/Space";
|
|
2
|
+
import { Space, ReadingPermission, PostingPermission, SpaceVisibility } from "../../interfaces/Space";
|
|
3
3
|
import type { SpaceImageUpload } from "./createSpace";
|
|
4
4
|
export interface UpdateSpaceProps {
|
|
5
5
|
spaceId: string;
|
|
@@ -8,6 +8,7 @@ export interface UpdateSpaceProps {
|
|
|
8
8
|
description?: string;
|
|
9
9
|
readingPermission?: ReadingPermission;
|
|
10
10
|
postingPermission?: PostingPermission;
|
|
11
|
+
visibility?: SpaceVisibility;
|
|
11
12
|
metadata?: Record<string, any>;
|
|
12
13
|
/**
|
|
13
14
|
* New avatar image. When present the request is sent as `multipart/form-data`
|