appwrite-utils-cli 0.0.260 → 0.0.261
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.
@@ -728,15 +728,23 @@ export class DataLoader {
|
|
728
728
|
attributeMappings: mappingsWithActions,
|
729
729
|
};
|
730
730
|
// Add the item with its context and final data to the current collection data
|
731
|
-
if (
|
731
|
+
if (itemDataToUpdate) {
|
732
|
+
// Update the existing item's finalData and context in place
|
733
|
+
itemDataToUpdate.finalData = this.mergeObjects(itemDataToUpdate.finalData, transformedData);
|
734
|
+
itemDataToUpdate.context = context;
|
735
|
+
itemDataToUpdate.importDef = newImportDef;
|
736
|
+
}
|
737
|
+
else {
|
738
|
+
// If no existing item matches, then add the new item
|
732
739
|
currentData.data.push({
|
733
740
|
rawData: item,
|
734
741
|
context: context,
|
735
742
|
importDef: newImportDef,
|
736
743
|
finalData: transformedData,
|
737
744
|
});
|
738
|
-
this.importMap.set(this.getCollectionKey(collection.name), currentData);
|
739
745
|
}
|
746
|
+
// Since we're modifying currentData in place, we ensure no duplicates are added
|
747
|
+
this.importMap.set(this.getCollectionKey(collection.name), currentData);
|
740
748
|
}
|
741
749
|
}
|
742
750
|
updateReferencesBasedOnAttributeMappings() {
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "appwrite-utils-cli",
|
3
3
|
"description": "Appwrite Utility Functions to help with database management, data conversion, data import, migrations, and much more. Meant to be used as a CLI tool, I do not recommend installing this in frontend environments.",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.261",
|
5
5
|
"main": "src/main.ts",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
@@ -999,15 +999,25 @@ export class DataLoader {
|
|
999
999
|
attributeMappings: mappingsWithActions,
|
1000
1000
|
};
|
1001
1001
|
// Add the item with its context and final data to the current collection data
|
1002
|
-
if (
|
1003
|
-
|
1002
|
+
if (itemDataToUpdate) {
|
1003
|
+
// Update the existing item's finalData and context in place
|
1004
|
+
itemDataToUpdate.finalData = this.mergeObjects(
|
1005
|
+
itemDataToUpdate.finalData,
|
1006
|
+
transformedData
|
1007
|
+
);
|
1008
|
+
itemDataToUpdate.context = context;
|
1009
|
+
itemDataToUpdate.importDef = newImportDef;
|
1010
|
+
} else {
|
1011
|
+
// If no existing item matches, then add the new item
|
1012
|
+
currentData!.data.push({
|
1004
1013
|
rawData: item,
|
1005
1014
|
context: context,
|
1006
1015
|
importDef: newImportDef,
|
1007
1016
|
finalData: transformedData,
|
1008
1017
|
});
|
1009
|
-
this.importMap.set(this.getCollectionKey(collection.name), currentData);
|
1010
1018
|
}
|
1019
|
+
// Since we're modifying currentData in place, we ensure no duplicates are added
|
1020
|
+
this.importMap.set(this.getCollectionKey(collection.name), currentData!);
|
1011
1021
|
}
|
1012
1022
|
}
|
1013
1023
|
|