@opentermsarchive/engine 6.0.0 → 6.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentermsarchive/engine",
3
- "version": "6.0.0",
3
+ "version": "6.1.0",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://opentermsarchive.org",
6
6
  "bugs": {
@@ -183,11 +183,11 @@ export default class Archivist extends events.EventEmitter {
183
183
 
184
184
  const fetchDocumentErrors = [];
185
185
 
186
- await Promise.all(terms.sourceDocuments.map(async sourceDocument => {
186
+ for (const sourceDocument of terms.sourceDocuments) {
187
187
  const { location: url, executeClientScripts, cssSelectors } = sourceDocument;
188
188
 
189
189
  try {
190
- const { mimeType, content, fetcher } = await this.fetch({ url, executeClientScripts, cssSelectors });
190
+ const { mimeType, content, fetcher } = await this.fetch({ url, executeClientScripts, cssSelectors }); // eslint-disable-line no-await-in-loop
191
191
 
192
192
  sourceDocument.content = content;
193
193
  sourceDocument.mimeType = mimeType;
@@ -199,7 +199,7 @@ export default class Archivist extends events.EventEmitter {
199
199
 
200
200
  fetchDocumentErrors.push(error);
201
201
  }
202
- }));
202
+ }
203
203
 
204
204
  if (fetchDocumentErrors.length) {
205
205
  throw new InaccessibleContentError(fetchDocumentErrors);
@@ -62,7 +62,8 @@ export default class GitHub {
62
62
  }
63
63
  }
64
64
 
65
- const existingLabelsNames = existingLabels.map(label => label.name);
65
+ const updatedExistingLabels = labelsToRemove.length ? await this.getRepositoryLabels() : existingLabels; // Refresh labels after deletion, only if needed
66
+ const existingLabelsNames = updatedExistingLabels.map(label => label.name);
66
67
  const missingLabels = this.MANAGED_LABELS.filter(label => !existingLabelsNames.includes(label.name));
67
68
 
68
69
  if (missingLabels.length) {
@@ -56,7 +56,8 @@ export default class GitLab {
56
56
  }
57
57
  }
58
58
 
59
- const existingLabelsNames = existingLabels.map(label => label.name);
59
+ const updatedExistingLabels = labelsToRemove.length ? await this.getRepositoryLabels() : existingLabels; // Refresh labels after deletion, only if needed
60
+ const existingLabelsNames = updatedExistingLabels.map(label => label.name);
60
61
  const missingLabels = this.MANAGED_LABELS.filter(label => !existingLabelsNames.includes(label.name));
61
62
 
62
63
  if (missingLabels.length) {