@antzsoft/chat-core 1.2.9 → 1.3.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/index.cjs CHANGED
@@ -152,13 +152,7 @@ module.exports = __toCommonJS(src_exports);
152
152
 
153
153
  // src/config/types.ts
154
154
  function resolveConfig(config) {
155
- const socketUrl = config.socketUrl ?? (() => {
156
- try {
157
- return new URL(config.apiUrl).origin;
158
- } catch {
159
- return config.apiUrl;
160
- }
161
- })();
155
+ const socketUrl = config.socketUrl ?? config.apiUrl.replace(/\/api\/v\d+\/?$/, "").replace(/\/$/, "");
162
156
  let socketOrigin = socketUrl;
163
157
  let socketPath = "/socket.io";
164
158
  try {
@@ -860,18 +854,23 @@ var syncApi = {
860
854
  },
861
855
  /**
862
856
  * Per-conversation delta sync — call when a conversation has `needs_refresh = true`
863
- * or on fresh install (omit both since and afterSeq to receive full history).
857
+ * or on fresh install (omit all opts to receive full history).
864
858
  * Covers messages, deletedForMe, full reaction state, stars, participant changes,
865
859
  * and read receipts — everything needed to make local SQLite authoritative.
866
860
  *
867
- * Prefer `afterSeq` when available (new server) — paginated, collision-safe.
868
- * Fall back to `since` timestamp for old servers or first sync on a new install.
869
- * When `hasMore` is true in the response, call again with the returned `nextSeq`.
861
+ * Direction:
862
+ * afterSeq — forward (oldest→newest, catch-up/sync). Default when seq is known.
863
+ * beforeSeq backward (newest→oldest, scroll-back / load history).
864
+ * since — timestamp fallback for old servers or first sync on a new install.
865
+ *
866
+ * When `hasMore` is true, call again with `nextSeq` as the same cursor type you sent.
870
867
  */
871
868
  pullConversation(conversationId, opts) {
872
869
  const params = {};
873
870
  if (opts?.afterSeq !== void 0) {
874
871
  params.afterSeq = opts.afterSeq;
872
+ } else if (opts?.beforeSeq !== void 0) {
873
+ params.beforeSeq = opts.beforeSeq;
875
874
  } else if (opts?.since) {
876
875
  params.since = opts.since;
877
876
  }