@shaxpir/duiduidui-models 1.4.19 → 1.4.21

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.
@@ -14,7 +14,7 @@ class Manifest extends Model_1.Model {
14
14
  return shaxpir_common_1.CachingHasher.makeMd5Base62Hash(userId + "-" + ContentKind_1.ContentKind.MANIFEST);
15
15
  }
16
16
  static create(userId, createdAt) {
17
- const now = shaxpir_common_1.Time.utc();
17
+ const now = shaxpir_common_1.ClockService.getClock().utc();
18
18
  // If the createdAt time is not provided, use the current time
19
19
  const createdTime = createdAt ?? { utc_time: now };
20
20
  const manifestId = Manifest.makeManifestId(userId);
@@ -260,6 +260,10 @@ class ShareSync {
260
260
  }
261
261
  async acquire(kind, id, timestamp) {
262
262
  let model = this.load(kind, id);
263
+ if (!model) {
264
+ // Document doesn't exist or couldn't be loaded
265
+ return null;
266
+ }
263
267
  if (timestamp) {
264
268
  model = await model.acquire(timestamp);
265
269
  }
@@ -315,6 +319,10 @@ class ShareSync {
315
319
  // If not in the cache, get the model doc from the connection.
316
320
  // Then wrap it and put it in the cache for future reference.
317
321
  const doc = this._connection.get(kind, id);
322
+ if (!doc) {
323
+ console.error(`[ShareSync] connection.get(${kind}, ${id}) returned null/undefined doc`);
324
+ return null;
325
+ }
318
326
  const model = this.wrap(kind, doc, false);
319
327
  this._modelCache.set(compoundKey, model);
320
328
  return model;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaxpir/duiduidui-models",
3
- "version": "1.4.19",
3
+ "version": "1.4.21",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/shaxpir/duiduidui-models"