@kispi/chat 0.7.4 → 0.8.0

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.
@@ -333,7 +333,14 @@ function createChatServer(options) {
333
333
  },
334
334
  list: (roomId, o) => rest.call(
335
335
  "GET",
336
- `/v1/rooms/${roomId}/messages${rest.query({ before: o?.before, after: o?.after, limit: o?.limit })}`
336
+ `/v1/rooms/${roomId}/messages${rest.query({
337
+ before: o?.before,
338
+ after: o?.after,
339
+ limit: o?.limit,
340
+ // 와이어의 값은 `main`·`all`·`thread:<id>` 셋이다(클라이언트 `history()`와 같다).
341
+ view: o?.view === void 0 ? void 0 : typeof o.view === "string" ? o.view : `thread:${o.view.thread}`,
342
+ q: o?.q
343
+ })}`
337
344
  ),
338
345
  delete: async (roomId, messageId) => {
339
346
  await rest.call("DELETE", `/v1/rooms/${roomId}/messages/${messageId}`);
@@ -220,11 +220,26 @@ type ChatServer = {
220
220
  messageId: string;
221
221
  seq: number;
222
222
  }>;
223
+ /**
224
+ * A page of history, seq ascending. `view` is `'main'`, `'all'` (the
225
+ * server's default) or `{thread: rootId}` for one thread's replies.
226
+ *
227
+ * `q` searches the bodies: substring, case-insensitive, deleted messages
228
+ * excluded. **Secret keys only** -- the route refuses it to user tokens
229
+ * (an unindexed scan is not a cost any browser may ask for). The seqs of a
230
+ * search page are not contiguous: never feed them to a sync cursor.
231
+ */
223
232
  list: (roomId: string, options?: {
224
233
  before?: number;
225
234
  after?: number;
226
235
  limit?: number;
227
- }) => Promise<unknown>;
236
+ view?: 'main' | 'all' | {
237
+ thread: string;
238
+ };
239
+ q?: string;
240
+ }) => Promise<{
241
+ messages: unknown[];
242
+ }>;
228
243
  delete: (roomId: string, messageId: string) => Promise<void>;
229
244
  };
230
245
  users: {
@@ -220,11 +220,26 @@ type ChatServer = {
220
220
  messageId: string;
221
221
  seq: number;
222
222
  }>;
223
+ /**
224
+ * A page of history, seq ascending. `view` is `'main'`, `'all'` (the
225
+ * server's default) or `{thread: rootId}` for one thread's replies.
226
+ *
227
+ * `q` searches the bodies: substring, case-insensitive, deleted messages
228
+ * excluded. **Secret keys only** -- the route refuses it to user tokens
229
+ * (an unindexed scan is not a cost any browser may ask for). The seqs of a
230
+ * search page are not contiguous: never feed them to a sync cursor.
231
+ */
223
232
  list: (roomId: string, options?: {
224
233
  before?: number;
225
234
  after?: number;
226
235
  limit?: number;
227
- }) => Promise<unknown>;
236
+ view?: 'main' | 'all' | {
237
+ thread: string;
238
+ };
239
+ q?: string;
240
+ }) => Promise<{
241
+ messages: unknown[];
242
+ }>;
228
243
  delete: (roomId: string, messageId: string) => Promise<void>;
229
244
  };
230
245
  users: {
@@ -262,7 +262,14 @@ function createChatServer(options) {
262
262
  },
263
263
  list: (roomId, o) => rest.call(
264
264
  "GET",
265
- `/v1/rooms/${roomId}/messages${rest.query({ before: o?.before, after: o?.after, limit: o?.limit })}`
265
+ `/v1/rooms/${roomId}/messages${rest.query({
266
+ before: o?.before,
267
+ after: o?.after,
268
+ limit: o?.limit,
269
+ // 와이어의 값은 `main`·`all`·`thread:<id>` 셋이다(클라이언트 `history()`와 같다).
270
+ view: o?.view === void 0 ? void 0 : typeof o.view === "string" ? o.view : `thread:${o.view.thread}`,
271
+ q: o?.q
272
+ })}`
266
273
  ),
267
274
  delete: async (roomId, messageId) => {
268
275
  await rest.call("DELETE", `/v1/rooms/${roomId}/messages/${messageId}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kispi/chat",
3
- "version": "0.7.4",
3
+ "version": "0.8.0",
4
4
  "description": "GravEx Chat SDK: managed realtime chat API. One WebSocket, many rooms, ordered history. Get an API key at chat.gravex.app.",
5
5
  "homepage": "https://chat.gravex.app/?utm_source=npm&utm_medium=referral&utm_campaign=sdk_readme",
6
6
  "keywords": [