@openmarket/rooms-client 0.6.0 → 0.7.1
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/agent/armed-mode.js +7 -3
- package/dist/agent/clients/common.d.ts +5 -0
- package/dist/agent/topic-inbox.d.ts +6 -0
- package/dist/agent/topic-inbox.js +20 -5
- package/dist/shared/rooms-protocol.d.ts +82 -0
- package/dist/social-client.d.ts +188 -5
- package/dist/social-client.js +346 -5
- package/dist/social-types.d.ts +164 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/src/agent/armed-mode.ts +7 -3
- package/src/agent/clients/common.ts +5 -0
- package/src/agent/topic-inbox.ts +23 -5
- package/src/shared/rooms-protocol.ts +85 -0
- package/src/social-client.ts +587 -6
- package/src/social-types.ts +175 -1
- package/src/types.ts +3 -0
package/src/social-types.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
RoomLedgerSecretPayload,
|
|
3
|
+
RoomPollSummary,
|
|
4
|
+
RoomTopicAttention,
|
|
5
|
+
RoomUnfurl,
|
|
6
|
+
} from "./shared/rooms-protocol.js";
|
|
2
7
|
|
|
3
8
|
export interface RoomSocialConfig {
|
|
4
9
|
apiUrl: string;
|
|
@@ -234,6 +239,175 @@ export interface RoomNotificationInboxResult {
|
|
|
234
239
|
lastCursorId: string | null;
|
|
235
240
|
}
|
|
236
241
|
|
|
242
|
+
/** One of the caller's user blocks, wire names verbatim from the store's
|
|
243
|
+
* block rows: the row id, the BLOCKED user's id, and when the block was
|
|
244
|
+
* created (ISO string). Blocks are directional; the blocker is always the
|
|
245
|
+
* verified caller and never appears on the row. */
|
|
246
|
+
export interface RoomUserBlock {
|
|
247
|
+
id: string;
|
|
248
|
+
blockedId: string;
|
|
249
|
+
createdAt: string;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** A newest-first page of the caller's blocks plus the composite cursor
|
|
253
|
+
* (same paging contract as the notification inbox: feed lastCursor and
|
|
254
|
+
* lastCursorId back together; both null on an empty page). */
|
|
255
|
+
export interface RoomUserBlocksResult {
|
|
256
|
+
blocks: RoomUserBlock[];
|
|
257
|
+
hasMore: boolean;
|
|
258
|
+
lastCursor: string | null;
|
|
259
|
+
lastCursorId: string | null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** The row echoed by a bookmark save. `createdAt` is null only when a
|
|
263
|
+
* concurrent remove raced the save (the save still happened). */
|
|
264
|
+
export interface RoomBookmarkSaved {
|
|
265
|
+
roomId: string;
|
|
266
|
+
seq: number;
|
|
267
|
+
createdAt: string | null;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
/** The store's REST poll summary: the ledger-entry wire shape plus the
|
|
271
|
+
* store's monotonic ordering revision (create = 0, bumped per mutation).
|
|
272
|
+
* The relay strips revision before entries reach the WS surface, so only
|
|
273
|
+
* REST consumers see it; use it to refuse applying a stale mutation echo
|
|
274
|
+
* over newer state. Optional because rows written before the field read
|
|
275
|
+
* without it. */
|
|
276
|
+
export type RoomRestPollSummary = RoomPollSummary & {
|
|
277
|
+
revision?: number | undefined;
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* A persisted room event as the store's REST surfaces return it: the stored
|
|
282
|
+
* row with its wire names verbatim (roomId/senderId/sender/createdAt, store
|
|
283
|
+
* event kinds like 'message'), minus the server-internal fields the store's
|
|
284
|
+
* publicRoomEvent projection strips. This is NOT the relay's mapped
|
|
285
|
+
* RoomLedgerEntry (room/handle/ts, type 'post'); the two shapes never mix.
|
|
286
|
+
* Only the identity core is guaranteed: non-visible bookmark targets arrive
|
|
287
|
+
* as content-free tombstones, and older rows predate newer columns.
|
|
288
|
+
*/
|
|
289
|
+
export interface RoomRestEvent {
|
|
290
|
+
roomId: string;
|
|
291
|
+
seq: number;
|
|
292
|
+
/** The store's event kinds, not the relay's mapped entry types. */
|
|
293
|
+
type: "message" | "system_market" | "moderation" | "secret";
|
|
294
|
+
senderId: string;
|
|
295
|
+
/** Write-time sender snapshot (denormalized; never re-resolved). */
|
|
296
|
+
sender: {
|
|
297
|
+
userId: string;
|
|
298
|
+
username: string;
|
|
299
|
+
handle: string;
|
|
300
|
+
isAgent: boolean;
|
|
301
|
+
role?: string | null | undefined;
|
|
302
|
+
};
|
|
303
|
+
createdAt: string;
|
|
304
|
+
updatedAt: string;
|
|
305
|
+
/** Absent on content-free tombstones. */
|
|
306
|
+
text?: string | undefined;
|
|
307
|
+
/** The store's body blob. Room attachments live at body.attachments
|
|
308
|
+
* (sanitized for the viewer), never top-level like the ledger entry's. */
|
|
309
|
+
body?: Record<string, unknown> | undefined;
|
|
310
|
+
secret?: RoomLedgerSecretPayload | null | undefined;
|
|
311
|
+
cashtags?: string[] | undefined;
|
|
312
|
+
entities?: string[] | undefined;
|
|
313
|
+
reactions?: Array<{ emoji: string; count: number }> | undefined;
|
|
314
|
+
/** Counts-only poll summary (additive; the same wire shape the ledger
|
|
315
|
+
* entry carries plus the store's ordering revision). */
|
|
316
|
+
poll?: RoomRestPollSummary | null | undefined;
|
|
317
|
+
/** Server-rendered link unfurl cards (additive). */
|
|
318
|
+
unfurls?: RoomUnfurl[] | undefined;
|
|
319
|
+
replyToSeq?: number | null | undefined;
|
|
320
|
+
topicId?: string | null | undefined;
|
|
321
|
+
replyCount?: number | undefined;
|
|
322
|
+
lastReplyAt?: string | null | undefined;
|
|
323
|
+
pinned?: boolean | undefined;
|
|
324
|
+
visibility?: "visible" | "soft_deleted" | "hidden" | "held" | undefined;
|
|
325
|
+
/** Present only when the viewer holds view-audit on the room. */
|
|
326
|
+
moderationState?: "clean" | "flagged" | "reported" | "actioned" | undefined;
|
|
327
|
+
clientMsgId?: string | null | undefined;
|
|
328
|
+
editedAt?: string | null | undefined;
|
|
329
|
+
deletedAt?: string | null | undefined;
|
|
330
|
+
deletedBy?: string | null | undefined;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/** One saved message on the cross-room bookmark list, with the bookmarked
|
|
334
|
+
* event hydrated server-side in the store's public row shape (non-visible
|
|
335
|
+
* targets arrive as content-free tombstones, exactly like the room's own
|
|
336
|
+
* read surfaces). */
|
|
337
|
+
export interface RoomBookmark {
|
|
338
|
+
roomId: string;
|
|
339
|
+
seq: number;
|
|
340
|
+
createdAt: string;
|
|
341
|
+
event: RoomRestEvent;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** A newest-first bookmark page plus the composite cursor. `total` is the
|
|
345
|
+
* raw row count capped server-side: a bounded hint, not an exact readable
|
|
346
|
+
* total (rows in rooms the caller can no longer read are subtracted from
|
|
347
|
+
* pages but still count). */
|
|
348
|
+
export interface RoomBookmarksResult {
|
|
349
|
+
bookmarks: RoomBookmark[];
|
|
350
|
+
hasMore: boolean;
|
|
351
|
+
lastCursor: string | null;
|
|
352
|
+
lastCursorId: string | null;
|
|
353
|
+
total: number;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/** Voter identities for one poll option, fetched on demand (the entry's
|
|
357
|
+
* poll summary carries counts only). */
|
|
358
|
+
export interface RoomPollOptionVoters {
|
|
359
|
+
optionId: string;
|
|
360
|
+
users: Array<{ userId: string; handle: string }>;
|
|
361
|
+
count: number;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export interface RoomPollVotersResult {
|
|
365
|
+
room: string;
|
|
366
|
+
seq: number;
|
|
367
|
+
voters: RoomPollOptionVoters[];
|
|
368
|
+
/** The authenticated caller's own current ballot, from an exact point
|
|
369
|
+
* read: independent of the bounded voter-identity window and of any
|
|
370
|
+
* optionId filter. Empty when the caller holds no ballot. This is the
|
|
371
|
+
* reload/recovery source of truth for rendering one's own vote. */
|
|
372
|
+
viewerOptionIds: string[];
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/** Recipient-local daily push-suppression window (notify settings). */
|
|
376
|
+
export interface RoomNotifyQuietHours {
|
|
377
|
+
enabled: boolean;
|
|
378
|
+
/** Minutes after local midnight, 0..1439. */
|
|
379
|
+
startMinutes: number;
|
|
380
|
+
/** Minutes after local midnight, 0..1439. May wrap past midnight. */
|
|
381
|
+
endMinutes: number;
|
|
382
|
+
/** IANA time zone name, 1..64 chars (server-probed against Intl). */
|
|
383
|
+
tz: string;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
/** Per-space override entry on the rooms notification settings. */
|
|
387
|
+
export interface RoomSpaceNotificationOverride {
|
|
388
|
+
suppressMassMentions?: boolean | undefined;
|
|
389
|
+
attention?: RoomTopicAttention | undefined;
|
|
390
|
+
/** Timed-mute expiry (ISO date). Meaningful only beside attention 'mute';
|
|
391
|
+
* normalization drops it otherwise. The settings surface echoes the
|
|
392
|
+
* CONFIGURED expiry, lapsed or not (a configuration read, not an
|
|
393
|
+
* effective-state read). */
|
|
394
|
+
muteUntil?: string | undefined;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/** The store-owned `user_settings.notificationSettings.rooms` shape behind
|
|
398
|
+
* GET/PUT /users/notification-settings. PUT is always the FULL object;
|
|
399
|
+
* absent fields take their contract defaults. */
|
|
400
|
+
export interface RoomsNotificationSettings {
|
|
401
|
+
dm: boolean;
|
|
402
|
+
mention: boolean;
|
|
403
|
+
reply: boolean;
|
|
404
|
+
/** Case-insensitive word-boundary keywords, capped at 50. */
|
|
405
|
+
keywords: string[];
|
|
406
|
+
spaceOverrides: Record<string, RoomSpaceNotificationOverride>;
|
|
407
|
+
/** Absent means no quiet-hours window is configured. */
|
|
408
|
+
quietHours?: RoomNotifyQuietHours | undefined;
|
|
409
|
+
}
|
|
410
|
+
|
|
237
411
|
/** A living markdown doc scoped to a space (head state; content on demand). */
|
|
238
412
|
export interface RoomDoc {
|
|
239
413
|
docId: string;
|
package/src/types.ts
CHANGED
|
@@ -44,6 +44,8 @@ export type {
|
|
|
44
44
|
RoomModerateMemberPayload,
|
|
45
45
|
RoomMutedPayload,
|
|
46
46
|
RoomPinsPayload,
|
|
47
|
+
RoomPollOption,
|
|
48
|
+
RoomPollSummary,
|
|
47
49
|
RoomPresenceDeltaPayload,
|
|
48
50
|
RoomPresencePayload,
|
|
49
51
|
RoomReactorsPayload,
|
|
@@ -80,6 +82,7 @@ export type {
|
|
|
80
82
|
RoomTopicsResultPayload,
|
|
81
83
|
RoomTopicUpdatedPayload,
|
|
82
84
|
RoomTypingPayload,
|
|
85
|
+
RoomUnfurl,
|
|
83
86
|
RoomUserStatus,
|
|
84
87
|
RoomWhoPayload,
|
|
85
88
|
} from "./shared/rooms-protocol.js";
|