@shaxpir/duiduidui-models 1.4.21 → 1.4.23
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/Model.js +8 -0
- package/dist/repo/ShareSync.js +6 -1
- package/package.json +1 -1
package/dist/models/Model.js
CHANGED
|
@@ -64,12 +64,20 @@ class Model {
|
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
66
|
get kind() {
|
|
67
|
+
// Defensive check in case doc isn't fully initialized
|
|
68
|
+
if (!this.doc || !this.doc.collection) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
67
71
|
return this.doc.collection;
|
|
68
72
|
}
|
|
69
73
|
get ref() {
|
|
70
74
|
return this.doc.id;
|
|
71
75
|
}
|
|
72
76
|
get compoundKey() {
|
|
77
|
+
// Defensive check in case doc isn't fully initialized
|
|
78
|
+
if (!this.doc || !this.doc.collection || !this.doc.id) {
|
|
79
|
+
return 'unknown/unknown';
|
|
80
|
+
}
|
|
73
81
|
return `${this.doc.collection}/${this.doc.id}`;
|
|
74
82
|
}
|
|
75
83
|
exists() {
|
package/dist/repo/ShareSync.js
CHANGED
|
@@ -282,7 +282,12 @@ class ShareSync {
|
|
|
282
282
|
return [];
|
|
283
283
|
}
|
|
284
284
|
// Load all models first (this creates docs, wraps them, and caches them)
|
|
285
|
-
|
|
285
|
+
// Filter out any null models (documents that don't exist)
|
|
286
|
+
const models = ids.map(id => this.load(kind, id)).filter(model => model !== null);
|
|
287
|
+
// If no valid models were loaded, return empty array
|
|
288
|
+
if (models.length === 0) {
|
|
289
|
+
return [];
|
|
290
|
+
}
|
|
286
291
|
// Try bulk acquire if DurableStore supports it
|
|
287
292
|
if (this._durableStore?.getDocsBulk) {
|
|
288
293
|
try {
|