@pmate/chat-sdk 0.12.0-next.39 → 0.12.0-next.40
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/lib/runtime/readSync.js +4 -2
- package/package.json +1 -1
package/lib/runtime/readSync.js
CHANGED
|
@@ -76,8 +76,10 @@ export class ReadSyncClient {
|
|
|
76
76
|
this.readAfter = Math.max(this.readAfter, receipt.acceptedAt);
|
|
77
77
|
}
|
|
78
78
|
const query = new URLSearchParams({ appId, profileId });
|
|
79
|
+
if (this.options.metadataOnly)
|
|
80
|
+
query.set("metadataOnly", "true");
|
|
79
81
|
if (!this.readAfter && current.syncCursor !== "0") {
|
|
80
|
-
const delta = await this.request(`/api/social/reading/changes?${new URLSearchParams({ appId, profileId, after: current.syncCursor })}`);
|
|
82
|
+
const delta = await this.request(`/api/social/reading/changes?${new URLSearchParams({ appId, profileId, after: current.syncCursor, ...(this.options.metadataOnly ? { metadataOnly: "true" } : {}) })}`);
|
|
81
83
|
if (delta.appId !== appId || delta.profileId !== profileId || typeof delta.syncCursor !== "string"
|
|
82
84
|
|| typeof delta.snapshotRequired !== "boolean" || !Array.isArray(delta.changes))
|
|
83
85
|
throw new Error("INVALID_READ_DELTA");
|
|
@@ -87,7 +89,7 @@ export class ReadSyncClient {
|
|
|
87
89
|
throw new Error("READ_SYNC_STOPPED");
|
|
88
90
|
const next = await persistence.update(appId, profileId, (state, currentVersions) => {
|
|
89
91
|
assertReadIndexVersions(versions, currentVersions);
|
|
90
|
-
const applied = delta.changes.reduce((current, change) => applyReadChange(current, this.options.metadataOnly ? { ...change, thread: readingMetadata({ appId, threads: [change.thread] }).threads[0] } : change), state);
|
|
92
|
+
const applied = delta.changes.reduce((current, change) => applyReadChange(current, this.options.metadataOnly ? { ...change, thread: readingMetadata({ appId, threads: [change.thread] }).threads[0] } : change), this.options.metadataOnly ? readingMetadata(state) : state);
|
|
91
93
|
if (applied.syncCursor !== delta.syncCursor)
|
|
92
94
|
throw new ReadSyncGap(applied.syncCursor);
|
|
93
95
|
return applied;
|
package/package.json
CHANGED