@@ -152,7 +152,7 @@ const awaitPools = {
152
152
if (steps > 1 && iteration === 1) {
153
153
pollMaxDebounces *= steps;
154
154
155
- log('Found a large number of deleting attributes, increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes')
155
+ log('Found a large number of attributes to be deleted. Increasing timeout to ' + (pollMaxDebounces * POLL_DEBOUNCE / 1000 / 60) + ' minutes')
156
156
}
157
157
158
158
const { attributes } = await paginate(databasesListAttributes, {
@@ -727,18 +727,17 @@ const mapChangeAttribute = (attribute, collection, isAdding) => {
727
727
};
728
728
729
729
const updatedList = async (remoteAttributes, localAttributes, collection) => {
730
+
730
731
const deleting = remoteAttributes.filter((attribute) => !findMatch(attribute, localAttributes)).map((attr) => mapChangeAttribute(attr, collection, false));
731
732
const adding = localAttributes.filter((attribute) => !findMatch(attribute, remoteAttributes)).map((attr) => mapChangeAttribute(attr, collection, true));
732
733
const conflicts = remoteAttributes.map((attribute) => deepSimilar(attribute, findMatch(attribute, localAttributes), collection)).filter(attribute => attribute !== undefined);
733
- let changedAttributes = [];
734
734
735
+ let changedAttributes = [];
735
736
const changing = [...deleting, ...adding, ...conflicts]
736
-
737
737
if (changing.length === 0) {
738
738
return changedAttributes;
739
739
}
740
740
log('There are pending changes in your collection deployment');
741
-
742
741
drawTable(changing.map((change) => {
743
742
return { Key: change.key, Action: change.action, Reason: change.reason, };
744
743
}));
@@ -751,16 +750,12 @@ const updatedList = async (remoteAttributes, localAttributes, collection) => {
751
750
752
751
if (conflicts.length > 0) {
753
752
changedAttributes = conflicts.map((change) => change.attribute);
754
-
755
753
await Promise.all(changedAttributes.map((changed) => deleteAttribute(collection, changed)));
756
-
757
754
remoteAttributes = remoteAttributes.filter((attribute) => !findMatch(attribute, changedAttributes))
758
755
}
759
756
760
757
const deletingAttributes = deleting.map((change) => change.attribute);
761
-
762
758
await Promise.all(deletingAttributes.map((attribute) => deleteAttribute(collection, attribute)));
763
-
764
759
const attributeKeys = [...remoteAttributes.map(attribute => attribute.key), ...deletingAttributes.map(attribute => attribute.key)]
765
760
766
761
if (attributeKeys.length) {
@@ -793,33 +788,33 @@ const pushCollection = async ({ all, yes } = {}) => {
793
788
collections.push(collection);
794
789
})
795
790
}
796
- const databases = Array.from(new Set(collections.map(c => c ['databaseId'])));
791
+ const databases = Array.from(new Set(collections.map(collection => collection ['databaseId'])));
797
792
798
793
// Parallel db actions
799
- await Promise.all(databases.map(async (dbId ) => {
800
- const localDatabase = localConfig.getDatabase(dbId );
794
+ await Promise.all(databases.map(async (databaseId ) => {
795
+ const localDatabase = localConfig.getDatabase(databaseId );
801
796
802
797
try {
803
798
const database = await databasesGet({
804
- databaseId: dbId ,
799
+ databaseId: databaseId ,
805
800
parseOutput: false,
806
801
});
807
802
808
- if (database.name !== (localDatabase.name ?? dbId )) {
803
+ if (database.name !== (localDatabase.name ?? databaseId )) {
809
804
await databasesUpdate({
810
- databaseId: dbId ,
811
- name: localDatabase.name ?? dbId ,
805
+ databaseId: databaseId ,
806
+ name: localDatabase.name ?? databaseId ,
812
807
parseOutput: false
813
808
})
814
809
815
- success(`Updated ${localDatabase.name} ( ${dbId } ) name`);
810
+ success(`Updated ${localDatabase.name} ( ${databaseId } ) name`);
816
811
}
817
812
} catch (err) {
818
- log(`Database ${dbId } not found. Creating it now...`);
813
+ log(`Database ${databaseId } not found. Creating it now...`);
819
814
820
815
await databasesCreate({
821
- databaseId: dbId ,
822
- name: localDatabase.name ?? dbId ,
816
+ databaseId: databaseId ,
817
+ name: localDatabase.name ?? databaseId ,
823
818
parseOutput: false,
824
819
});
825
820
}
@@ -858,7 +853,6 @@ const pushCollection = async ({ all, yes } = {}) => {
858
853
permissions: collection['$permissions'],
859
854
parseOutput: false
860
855
})
861
- collection.isNew = true;
862
856
} else {
863
857
throw e;
864
858
}
@@ -914,7 +908,7 @@ const createIndexes = async (indexes, collection) => {
914
908
const result = await awaitPools.expectIndexes(
915
909
collection['databaseId'],
916
910
collection['$id'],
917
- indexes.map(attribute => attribute .key)
911
+ indexes.map(index => index .key)
918
912
);
919
913
920
914
if (!result) {
0 commit comments