@shaxpir/duiduidui-models 1.26.1 → 1.27.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.
- package/dist/models/Chat.d.ts +1 -1
- package/dist/models/Workspace.js +13 -2
- package/package.json +1 -1
package/dist/models/Chat.d.ts
CHANGED
package/dist/models/Workspace.js
CHANGED
|
@@ -174,13 +174,24 @@ class Workspace extends Content_1.Content {
|
|
|
174
174
|
async acquireSessionForUtcTime(utcTime) {
|
|
175
175
|
this.checkDisposed("Workspace.acquireSessionForUtcTime");
|
|
176
176
|
const shareSync = repo_1.ShareSyncFactory.get();
|
|
177
|
+
// First, try direct ref match — if the utcTime exactly matches a
|
|
178
|
+
// session's created_at, we can acquire by ref without range checking.
|
|
177
179
|
for (let i = 0, len = this.sessions.length; i < len; i++) {
|
|
178
180
|
const sessionCreatedAt = this.sessions.get(i);
|
|
179
|
-
if (
|
|
181
|
+
if (sessionCreatedAt.utc_time === utcTime) {
|
|
182
|
+
const sessionRef = Session_1.Session.makeSessionRef(this.owner, sessionCreatedAt);
|
|
183
|
+
return await shareSync.acquire(ContentKind_1.ContentKind.SESSION, sessionRef);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
// Fall back to range match — find the session that contains utcTime
|
|
187
|
+
// (created_at <= utcTime <= updated_at).
|
|
188
|
+
for (let i = 0, len = this.sessions.length; i < len; i++) {
|
|
189
|
+
const sessionCreatedAt = this.sessions.get(i);
|
|
190
|
+
if (!shaxpir_common_1.Time.isDateTimeAfter(sessionCreatedAt.utc_time, utcTime)) {
|
|
180
191
|
const sessionRef = Session_1.Session.makeSessionRef(this.owner, sessionCreatedAt);
|
|
181
192
|
const session = await shareSync.acquire(ContentKind_1.ContentKind.SESSION, sessionRef);
|
|
182
193
|
const sessionUpdatedAt = session.updatedAt;
|
|
183
|
-
if (shaxpir_common_1.Time.
|
|
194
|
+
if (!shaxpir_common_1.Time.isDateTimeBefore(sessionUpdatedAt.utc_time, utcTime)) {
|
|
184
195
|
return session;
|
|
185
196
|
}
|
|
186
197
|
else {
|