@statezero/core 0.1.99 → 0.2.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.
|
@@ -38,7 +38,9 @@ class EventData {
|
|
|
38
38
|
static fromOperation(operation) {
|
|
39
39
|
const ModelClass = operation.queryset.ModelClass;
|
|
40
40
|
const pkField = ModelClass.primaryKeyField;
|
|
41
|
-
return operation.instances
|
|
41
|
+
return operation.instances
|
|
42
|
+
.filter(instance => instance != null && typeof instance === 'object' && pkField in instance)
|
|
43
|
+
.map(instance => new EventData(ModelClass, instance[pkField]));
|
|
42
44
|
}
|
|
43
45
|
/**
|
|
44
46
|
* One event per unique PK across multiple operations
|
|
@@ -51,7 +53,9 @@ class EventData {
|
|
|
51
53
|
const uniquePks = new Set();
|
|
52
54
|
for (const op of operations) {
|
|
53
55
|
for (const inst of op.instances) {
|
|
54
|
-
|
|
56
|
+
if (inst != null && typeof inst === 'object' && pkField in inst) {
|
|
57
|
+
uniquePks.add(inst[pkField]);
|
|
58
|
+
}
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
return Array.from(uniquePks).map(pk => new EventData(ModelClass, pk));
|
package/package.json
CHANGED