@sublay/js 7.4.2 → 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 +79 -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/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/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1981,7 +1981,8 @@ interface ConversationMember {
|
|
|
1981
1981
|
userId: string;
|
|
1982
1982
|
role: ConversationMemberRole | null;
|
|
1983
1983
|
lastReadAt: string | null;
|
|
1984
|
-
mutedUntil
|
|
1984
|
+
mutedUntil?: string | null;
|
|
1985
|
+
mutedForever?: boolean;
|
|
1985
1986
|
isActive: boolean;
|
|
1986
1987
|
leftAt: string | null;
|
|
1987
1988
|
createdAt: string;
|
|
@@ -3145,6 +3146,48 @@ declare function markAsRead(client: SublayHttpClient, data: MarkAsReadProps): Pr
|
|
|
3145
3146
|
message: string;
|
|
3146
3147
|
}>;
|
|
3147
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
|
+
|
|
3148
3191
|
interface ReportMessageProps {
|
|
3149
3192
|
conversationId: string;
|
|
3150
3193
|
messageId: string;
|
|
@@ -3173,13 +3216,45 @@ declare const Chat_listMembers: typeof listMembers;
|
|
|
3173
3216
|
declare const Chat_listMessages: typeof listMessages;
|
|
3174
3217
|
declare const Chat_listReactions: typeof listReactions;
|
|
3175
3218
|
declare const Chat_markAsRead: typeof markAsRead;
|
|
3219
|
+
declare const Chat_muteConversation: typeof muteConversation;
|
|
3176
3220
|
declare const Chat_removeMember: typeof removeMember;
|
|
3177
3221
|
declare const Chat_reportMessage: typeof reportMessage;
|
|
3178
3222
|
declare const Chat_sendMessage: typeof sendMessage;
|
|
3179
3223
|
declare const Chat_toggleReaction: typeof toggleReaction;
|
|
3180
3224
|
declare const Chat_updateConversation: typeof updateConversation;
|
|
3181
3225
|
declare namespace Chat {
|
|
3182
|
-
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 };
|
|
3183
3258
|
}
|
|
3184
3259
|
|
|
3185
3260
|
/**
|
|
@@ -3263,6 +3338,7 @@ declare class SublayClient {
|
|
|
3263
3338
|
storage: BoundModule<typeof Storage>;
|
|
3264
3339
|
oauth: BoundModule<typeof OAuth>;
|
|
3265
3340
|
chat: BoundModule<typeof Chat>;
|
|
3341
|
+
push: BoundModule<typeof Push>;
|
|
3266
3342
|
private constructor();
|
|
3267
3343
|
static init(config: ClientConfig): Promise<SublayClient>;
|
|
3268
3344
|
/**
|
|
@@ -3277,4 +3353,4 @@ declare class SublayClient {
|
|
|
3277
3353
|
clearTokens(): void;
|
|
3278
3354
|
}
|
|
3279
3355
|
|
|
3280
|
-
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
|
+
}
|
|
@@ -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>;
|