@antzsoft/chat-core 1.1.4 → 1.1.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/README.md +17 -0
- package/dist/chunk-3ISWHKXI.js +429 -0
- package/dist/chunk-3ISWHKXI.js.map +1 -0
- package/dist/index.cjs +72 -36
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -619
- package/dist/index.d.ts +4 -619
- package/dist/index.js +54 -409
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +224 -0
- package/dist/internal.cjs.map +1 -0
- package/dist/internal.d.cts +5 -0
- package/dist/internal.d.ts +5 -0
- package/dist/internal.js +9 -0
- package/dist/internal.js.map +1 -0
- package/dist/storage-Dc0__sXE.d.cts +635 -0
- package/dist/storage-Dc0__sXE.d.ts +635 -0
- package/docs/integration-guide.html +174 -5
- package/package.json +6 -1
|
@@ -155,7 +155,7 @@ section.sec>h2:hover{color:#fff}
|
|
|
155
155
|
|
|
156
156
|
<div class="section-label">What's New</div>
|
|
157
157
|
<ul>
|
|
158
|
-
<li><a href="#whats-new">v1.1.
|
|
158
|
+
<li><a href="#whats-new">v1.1.6 Release Notes</a></li>
|
|
159
159
|
</ul>
|
|
160
160
|
|
|
161
161
|
<div class="section-label">Getting Started</div>
|
|
@@ -242,16 +242,185 @@ section.sec>h2:hover{color:#fff}
|
|
|
242
242
|
<h2>What's New</h2>
|
|
243
243
|
<p style="color:var(--muted);font-size:13px;margin-bottom:20px">Version history and release notes. Click a version to expand.</p>
|
|
244
244
|
|
|
245
|
-
<!-- ── v1.1.
|
|
246
|
-
<div class="wn-version open" id="wn-
|
|
247
|
-
<div class="wn-header" onclick="toggleVersion('wn-
|
|
245
|
+
<!-- ── v1.1.6 (current) ── -->
|
|
246
|
+
<div class="wn-version open" id="wn-116">
|
|
247
|
+
<div class="wn-header" onclick="toggleVersion('wn-116')">
|
|
248
248
|
<div class="wn-title">
|
|
249
|
-
<span class="wn-ver">v1.1.
|
|
249
|
+
<span class="wn-ver">v1.1.6</span>
|
|
250
250
|
<span class="wn-badge current">Current</span>
|
|
251
251
|
<span class="wn-date">May 2026</span>
|
|
252
252
|
</div>
|
|
253
253
|
<span class="wn-chevron">▲</span>
|
|
254
254
|
</div>
|
|
255
|
+
<div class="wn-body">
|
|
256
|
+
|
|
257
|
+
<div class="wn-item" id="wn-116-1">
|
|
258
|
+
<div class="wn-item-header" onclick="toggleItem('wn-116-1')">
|
|
259
|
+
<span class="wn-tag fix">Fix</span>
|
|
260
|
+
<span class="wn-item-title">Messages arrive out of order when typing and sending rapidly</span>
|
|
261
|
+
<span class="wn-chevron-sm">▾</span>
|
|
262
|
+
</div>
|
|
263
|
+
<div class="wn-item-body">
|
|
264
|
+
<p>When a user sent 10–15+ messages in quick succession, the SDK fired all <code>send_message</code> socket emits concurrently. Each emit raced independently against the 5-second ACK timeout, and the server received them in an unpredictable order — causing messages to appear jumbled in the recipient's view, even though the sender saw them in the correct order locally.</p>
|
|
265
|
+
<p>The SDK now routes all outgoing messages through a per-conversation FIFO send queue. The next message is only emitted after the server acknowledges the previous one, guaranteeing the server processes them in the exact order the user sent them. Two safety limits are enforced:</p>
|
|
266
|
+
<ul>
|
|
267
|
+
<li><strong>Max queue size: 100 entries per conversation.</strong> Any send beyond the limit is rejected immediately with an error so the caller can surface feedback rather than silently dropping messages.</li>
|
|
268
|
+
<li><strong>Per-entry TTL: 30 seconds.</strong> An entry that has been waiting in the queue longer than 30 seconds is dropped before it reaches the socket, preventing stale messages from arriving at the server long after the user typed them.</li>
|
|
269
|
+
</ul>
|
|
270
|
+
<p><strong>No integration changes required.</strong> The queue is applied automatically in <code>@antzsoft/chat-core</code> for both web and React Native SDKs.</p>
|
|
271
|
+
</div>
|
|
272
|
+
</div>
|
|
273
|
+
|
|
274
|
+
<div class="wn-item" id="wn-116-2">
|
|
275
|
+
<div class="wn-item-header" onclick="toggleItem('wn-116-2')">
|
|
276
|
+
<span class="wn-tag new">New</span>
|
|
277
|
+
<span class="wn-item-title">POST mirrors for all PUT and DELETE endpoints</span>
|
|
278
|
+
<span class="wn-chevron-sm">▾</span>
|
|
279
|
+
</div>
|
|
280
|
+
<div class="wn-item-body">
|
|
281
|
+
<p>Every <code>PUT</code> and <code>DELETE</code> route on the server now has an equivalent <code>POST</code> endpoint running alongside it. This is required for deployments behind black-box proxies, carrier-grade NATs, and enterprise middleware stacks (common in Jio, Reliance, and similar infrastructure) that strip or block non-POST/GET HTTP methods.</p>
|
|
282
|
+
<p>The SDK calls the POST mirrors exclusively from this version onwards. The original <code>PUT</code>/<code>DELETE</code> routes remain fully operational — nothing is removed — so direct REST clients, third-party integrations, and older SDK versions are unaffected.</p>
|
|
283
|
+
<p>The POST mirror paths follow a consistent naming pattern:</p>
|
|
284
|
+
<ul>
|
|
285
|
+
<li><code>PUT /messages/:id</code> → <code>POST /messages/:id/update</code></li>
|
|
286
|
+
<li><code>DELETE /messages/:id</code> → <code>POST /messages/:id/delete</code></li>
|
|
287
|
+
<li><code>DELETE /messages/:id/for-me</code> → <code>POST /messages/:id/delete-for-me</code></li>
|
|
288
|
+
<li><code>DELETE /messages/:id/reactions/:emoji</code> → <code>POST /messages/:id/reactions/:emoji/remove</code></li>
|
|
289
|
+
<li><code>DELETE /messages/:id/star</code> → <code>POST /messages/:id/unstar</code></li>
|
|
290
|
+
<li><code>DELETE /messages/:id/pin</code> → <code>POST /messages/:id/unpin</code></li>
|
|
291
|
+
<li><code>PUT /conversations/:id</code> → <code>POST /conversations/:id/update</code></li>
|
|
292
|
+
<li><code>DELETE /conversations/:id</code> → <code>POST /conversations/:id/delete</code></li>
|
|
293
|
+
<li><code>DELETE /conversations/:id/leave</code> → <code>POST /conversations/:id/leave</code></li>
|
|
294
|
+
<li><code>DELETE /conversations/:id/participants/:userId</code> → <code>POST /conversations/:id/participants/:userId/remove</code></li>
|
|
295
|
+
<li><code>PUT /conversations/:id/participants/:userId/role</code> → <code>POST /conversations/:id/participants/:userId/role</code></li>
|
|
296
|
+
<li><code>DELETE /conversations/:id/mute</code> → <code>POST /conversations/:id/unmute</code></li>
|
|
297
|
+
<li><code>DELETE /conversations/:id/pin</code> → <code>POST /conversations/:id/unpin</code></li>
|
|
298
|
+
<li><code>PUT /conversations/:id/icon</code> → <code>POST /conversations/:id/icon</code></li>
|
|
299
|
+
<li><code>DELETE /conversations/:id/icon</code> → <code>POST /conversations/:id/icon/remove</code></li>
|
|
300
|
+
<li><code>PUT /users/me</code> → <code>POST /users/me/update</code></li>
|
|
301
|
+
<li><code>PUT /users/me/preferences</code> → <code>POST /users/me/preferences</code></li>
|
|
302
|
+
<li><code>PUT /users/me/password</code> → <code>POST /users/me/password</code></li>
|
|
303
|
+
<li><code>PUT /users/me/avatar</code> → <code>POST /users/me/avatar</code></li>
|
|
304
|
+
<li><code>DELETE /users/me/devices/:deviceId</code> → <code>POST /users/me/devices/:deviceId/remove</code></li>
|
|
305
|
+
<li><code>DELETE /users/me/blocked/:userId</code> → <code>POST /users/me/blocked/:userId/remove</code></li>
|
|
306
|
+
<li><code>DELETE /users/me/contacts/:userId</code> → <code>POST /users/me/contacts/:userId/remove</code></li>
|
|
307
|
+
<li><code>PUT /storage/direct-upload</code> → <code>POST /storage/direct-upload</code></li>
|
|
308
|
+
<li><code>DELETE /storage/files/:id</code> → <code>POST /storage/files/:id/delete</code></li>
|
|
309
|
+
</ul>
|
|
310
|
+
<p><strong>No integration changes required.</strong> The SDK handles this transparently. All mirror endpoints return the same HTTP status codes and response shapes as their originals, verified by an automated parity script.</p>
|
|
311
|
+
</div>
|
|
312
|
+
</div>
|
|
313
|
+
|
|
314
|
+
<div class="wn-item" id="wn-116-3">
|
|
315
|
+
<div class="wn-item-header" onclick="toggleItem('wn-116-3')">
|
|
316
|
+
<span class="wn-tag new">New</span>
|
|
317
|
+
<span class="wn-item-title"><code>lastReaction</code> on <code>lastMessage</code> in conversation responses</span>
|
|
318
|
+
<span class="wn-chevron-sm">▾</span>
|
|
319
|
+
</div>
|
|
320
|
+
<div class="wn-item-body">
|
|
321
|
+
<p><code>Conversation.lastMessage</code> now includes a <code>lastReaction</code> field reflecting the most recent reaction added to the last message in the conversation.</p>
|
|
322
|
+
<p>Shape: <code>{ emoji: string; userId: string; displayName: string } | null</code>. The field is <code>null</code> when the last message has no reactions, or when the conversation has no messages.</p>
|
|
323
|
+
<p>This enables conversation list UIs to surface reaction activity inline — for example, rendering <em>"👍 Alice reacted"</em> as the conversation subtitle — without requiring a separate message fetch. The <code>lastReaction</code> field was already present on individual <code>Message</code> objects; it is now also propagated to the <code>lastMessage</code> snapshot on the <code>Conversation</code> object.</p>
|
|
324
|
+
<p><strong>No action required.</strong> The field is additive. Existing code that ignores unknown fields is unaffected.</p>
|
|
325
|
+
</div>
|
|
326
|
+
</div>
|
|
327
|
+
|
|
328
|
+
<div class="wn-item" id="wn-116-4">
|
|
329
|
+
<div class="wn-item-header" onclick="toggleItem('wn-116-4')">
|
|
330
|
+
<span class="wn-tag improvement">Improvement</span>
|
|
331
|
+
<span class="wn-item-title">Query optimisations — conversation list, message pagination, unread counts</span>
|
|
332
|
+
<span class="wn-chevron-sm">▾</span>
|
|
333
|
+
</div>
|
|
334
|
+
<div class="wn-item-body">
|
|
335
|
+
<p>Several high-traffic database queries have been rewritten with targeted compound indexes covering the most common access patterns:</p>
|
|
336
|
+
<ul>
|
|
337
|
+
<li><strong>Conversation list</strong> — the <code>GET /conversations</code> query (filtered by tenant, user, pinned/muted/unread state, type, role, and attachment presence) now uses a purpose-built compound index. Load times are significantly reduced for tenants with large participant or conversation counts.</li>
|
|
338
|
+
<li><strong>Message pagination</strong> — cursor-based before/after pagination on <code>GET /conversations/:id/messages</code> uses a tighter index that avoids full collection scans on high-volume conversations.</li>
|
|
339
|
+
<li><strong>Unread count aggregation</strong> — <code>GET /conversations/unread</code> and per-conversation unread counts now run against an optimised index, reducing latency on app cold start and foreground resume.</li>
|
|
340
|
+
</ul>
|
|
341
|
+
<p>No API surface changes. No integration changes required.</p>
|
|
342
|
+
</div>
|
|
343
|
+
</div>
|
|
344
|
+
|
|
345
|
+
</div>
|
|
346
|
+
</div><!-- /.wn-version -->
|
|
347
|
+
|
|
348
|
+
<!-- ── v1.1.5 ── -->
|
|
349
|
+
<div class="wn-version" id="wn-115">
|
|
350
|
+
<div class="wn-header" onclick="toggleVersion('wn-115')">
|
|
351
|
+
<div class="wn-title">
|
|
352
|
+
<span class="wn-ver">v1.1.5</span>
|
|
353
|
+
<span class="wn-date">May 2026</span>
|
|
354
|
+
</div>
|
|
355
|
+
<span class="wn-chevron">▼</span>
|
|
356
|
+
</div>
|
|
357
|
+
<div class="wn-body">
|
|
358
|
+
|
|
359
|
+
<div class="wn-item" id="wn-115-1">
|
|
360
|
+
<div class="wn-item-header" onclick="toggleItem('wn-115-1')">
|
|
361
|
+
<span class="wn-tag fix">Fix</span>
|
|
362
|
+
<span class="wn-item-title">Hermes crash on image upload — <code>crypto.randomUUID()</code> unavailable on React Native</span>
|
|
363
|
+
<span class="wn-chevron-sm">▾</span>
|
|
364
|
+
</div>
|
|
365
|
+
<div class="wn-item-body">
|
|
366
|
+
<p>Hermes (React Native's JS engine) does not expose <code>globalThis.crypto.randomUUID</code>, causing a hard crash whenever <code>uploadBatch</code> was called on iOS or Android — including all image and file attachments.</p>
|
|
367
|
+
<p>A new <code>generateUUID()</code> helper is included in <code>@antzsoft/chat-core</code> that uses the Web Crypto API when available and falls back to a <code>Math.random</code>-based RFC 4122 v4 UUID on environments that lack it (Hermes, older Node). It is used in <code>uploadBatch</code>, the RN <code>useChat</code> hook, and the web <code>useChat</code> hook.</p>
|
|
368
|
+
<p><strong>No action required.</strong> The fix is applied automatically. No integration changes needed.</p>
|
|
369
|
+
</div>
|
|
370
|
+
</div>
|
|
371
|
+
|
|
372
|
+
<div class="wn-item" id="wn-115-2">
|
|
373
|
+
<div class="wn-item-header" onclick="toggleItem('wn-115-2')">
|
|
374
|
+
<span class="wn-tag fix">Fix</span>
|
|
375
|
+
<span class="wn-item-title">Batch upload slot misalignment when a file fails presigned-URL generation</span>
|
|
376
|
+
<span class="wn-chevron-sm">▾</span>
|
|
377
|
+
</div>
|
|
378
|
+
<div class="wn-item-body">
|
|
379
|
+
<p>When one or more files in a batch failed the presigned-URL request, the SDK's slot-mapping logic was incorrect. The previous implementation assumed failed entries appear at the end of the server's <code>errors</code> array — but the server processes files in order, so a failure at position 1 produced <code>urls = [file0, file2]</code> and <code>errors = [file1]</code>, causing the SDK to assign file2's presigned URL to the wrong slot and corrupt upload-to-UI tracking.</p>
|
|
380
|
+
<p>The fix introduces a <code>clientIndex</code> — a 0-based position sent with each file in the batch request. The server now echoes it back in both <code>urls</code> and <code>errors</code> entries. The SDK uses the echoed <code>clientIndex</code> for all slot resolution. This is reliable regardless of failure pattern, file count, or whether multiple files share the same name. A filename-based fallback is kept for older server versions that do not echo the index.</p>
|
|
381
|
+
<p><strong>No integration changes required.</strong> Callers of <code>uploadBatch</code> and <code>uploadBatchWithSlots</code> are unaffected.</p>
|
|
382
|
+
</div>
|
|
383
|
+
</div>
|
|
384
|
+
|
|
385
|
+
<div class="wn-item" id="wn-115-3">
|
|
386
|
+
<div class="wn-item-header" onclick="toggleItem('wn-115-3')">
|
|
387
|
+
<span class="wn-tag improvement">Improvement</span>
|
|
388
|
+
<span class="wn-item-title">Conversation list reaction counts update live without a full refetch</span>
|
|
389
|
+
<span class="wn-chevron-sm">▾</span>
|
|
390
|
+
</div>
|
|
391
|
+
<div class="wn-item-body">
|
|
392
|
+
<p><code>SocketProvider</code> in both the web SDK and RN SDK now handles <code>reaction_updated</code> socket events by patching the affected conversation's <code>lastMessage.reactions</code> directly in the local conversations cache.</p>
|
|
393
|
+
<p>Previously, emoji counts on the conversation list were stale until the next full list refresh or navigation. The count now updates immediately when any reaction is added or removed in any conversation — including conversations that are not currently open.</p>
|
|
394
|
+
<p><strong>No integration changes required.</strong></p>
|
|
395
|
+
</div>
|
|
396
|
+
</div>
|
|
397
|
+
|
|
398
|
+
<div class="wn-item" id="wn-115-4">
|
|
399
|
+
<div class="wn-item-header" onclick="toggleItem('wn-115-4')">
|
|
400
|
+
<span class="wn-tag improvement">Improvement</span>
|
|
401
|
+
<span class="wn-item-title">Server — <code>conversation_updated</code> fan-out and create conversation batch-optimised</span>
|
|
402
|
+
<span class="wn-chevron-sm">▾</span>
|
|
403
|
+
</div>
|
|
404
|
+
<div class="wn-item-body">
|
|
405
|
+
<p>Two server-side performance improvements with no API surface changes:</p>
|
|
406
|
+
<p><strong>Fan-out batch query.</strong> When a conversation update was broadcast to all participants (on message, reaction, role change, member add/remove), the server previously ran 3 sequential DB queries per participant to build each recipient's response DTO — 300 round trips for a 100-member group. The fan-out now runs a single batch: 1 participants query, 1 batch user lookup, 1 batch read-receipt query, then parallel unread counts — one shared DTO emitted to all recipients.</p>
|
|
407
|
+
<p><strong>Create conversation fire-and-forget.</strong> <code>POST /conversations</code> previously awaited the full <code>conversation_created</code> socket fan-out before returning the HTTP response. For 300 participants this triggered ~900 DB queries before the caller received a reply. The broadcast is now fire-and-forget with a single shared DTO built once and emitted to all participants in memory. The API responds immediately after the conversation is written.</p>
|
|
408
|
+
<p><strong>No API or integration changes required.</strong></p>
|
|
409
|
+
</div>
|
|
410
|
+
</div>
|
|
411
|
+
|
|
412
|
+
</div>
|
|
413
|
+
</div><!-- /.wn-version -->
|
|
414
|
+
|
|
415
|
+
<!-- ── v1.1.4 ── -->
|
|
416
|
+
<div class="wn-version" id="wn-114">
|
|
417
|
+
<div class="wn-header" onclick="toggleVersion('wn-114')">
|
|
418
|
+
<div class="wn-title">
|
|
419
|
+
<span class="wn-ver">v1.1.4</span>
|
|
420
|
+
<span class="wn-date">May 2026</span>
|
|
421
|
+
</div>
|
|
422
|
+
<span class="wn-chevron">▼</span>
|
|
423
|
+
</div>
|
|
255
424
|
<div class="wn-body">
|
|
256
425
|
|
|
257
426
|
<div class="wn-item" id="wn-114-1">
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antzsoft/chat-core",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "Platform-agnostic core for Antz Chat — API, socket, stores, types. Works in browser, React Native (Expo or bare), and Node.js.",
|
|
5
5
|
"author": "Antz",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js",
|
|
15
15
|
"require": "./dist/index.cjs"
|
|
16
|
+
},
|
|
17
|
+
"./internal": {
|
|
18
|
+
"types": "./dist/internal.d.ts",
|
|
19
|
+
"import": "./dist/internal.js",
|
|
20
|
+
"require": "./dist/internal.cjs"
|
|
16
21
|
}
|
|
17
22
|
},
|
|
18
23
|
"files": [
|