@opentermsarchive/engine 1.2.1 → 1.2.2

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": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://opentermsarchive.org",
6
6
  "bugs": {
@@ -91,9 +91,9 @@
91
91
  "node-fetch": "^3.1.0",
92
92
  "octokit": "^1.7.0",
93
93
  "pdfjs-dist": "^2.9.359",
94
- "puppeteer": "14.3.0",
95
- "puppeteer-extra": "^3.2.3",
96
- "puppeteer-extra-plugin-stealth": "^2.9.0",
94
+ "puppeteer": "^22.8.1",
95
+ "puppeteer-extra": "^3.3.6",
96
+ "puppeteer-extra-plugin-stealth": "^2.11.2",
97
97
  "sib-api-v3-sdk": "^8.2.1",
98
98
  "simple-git": "^3.8.0",
99
99
  "swagger-jsdoc": "^6.2.8",
@@ -36,7 +36,7 @@ export default async options => {
36
36
 
37
37
  const lintFile = lintAndFixFile(options.fix);
38
38
 
39
- describe('Service declarations lint validation', async function () {
39
+ describe('Service declarations lint validation', function () {
40
40
  this.timeout(30000);
41
41
 
42
42
  servicesToValidate.forEach(serviceId => {
@@ -46,8 +46,8 @@ export default async options => {
46
46
  const filtersFilePath = path.join(declarationsPath, `${serviceId}.filters.js`);
47
47
  const filtersHistoryFilePath = path.join(declarationsPath, `${serviceId}.filters.history.js`);
48
48
 
49
- context(serviceId, async () => {
50
- before(async function () {
49
+ context(serviceId, () => {
50
+ before(function () {
51
51
  if (!service) {
52
52
  console.log(' (Tests skipped as declaration has been archived)');
53
53
  this.skip();
@@ -40,7 +40,7 @@ export default async options => {
40
40
  ({ services: servicesToValidate, servicesTermsTypes } = await declarationUtils.getModifiedServicesAndTermsTypes());
41
41
  }
42
42
 
43
- describe('Service declarations validation', async function () {
43
+ describe('Service declarations validation', function () {
44
44
  this.timeout(60000);
45
45
  this.slow(SLOW_DOCUMENT_THRESHOLD);
46
46
 
@@ -53,8 +53,8 @@ export default async options => {
53
53
 
54
54
  after(stopHeadlessBrowser);
55
55
 
56
- context(serviceId, async () => {
57
- before(async function () {
56
+ context(serviceId, () => {
57
+ before(function () {
58
58
  if (!service) {
59
59
  console.log(' (Tests skipped as declaration has been archived)');
60
60
  this.skip();
@@ -100,7 +100,7 @@ export default async options => {
100
100
  let filteredContent;
101
101
 
102
102
  context(sourceDocument.location, () => {
103
- before(async function () {
103
+ before(function () {
104
104
  if (!terms) {
105
105
  console.log(' (Tests skipped as declaration has been archived)');
106
106
  this.skip();
@@ -129,7 +129,7 @@ export default async options => {
129
129
  expect(filteredContent).to.not.be.empty;
130
130
  });
131
131
 
132
- it(`filtered content has at least ${MIN_DOC_LENGTH} characters`, async function checkContentLength() {
132
+ it(`filtered content has at least ${MIN_DOC_LENGTH} characters`, function checkContentLength() {
133
133
  if (!sourceDocument.content) {
134
134
  console.log(' [Tests skipped as URL is not fetchable]');
135
135
  this.skip();
@@ -198,7 +198,7 @@ async function initialize(migration) {
198
198
  ]);
199
199
  }
200
200
 
201
- async function finalize(migration) {
201
+ function finalize(migration) {
202
202
  return Promise.all([
203
203
  migration.from.snapshots.source.finalize(),
204
204
  migration.from.snapshots.destination.finalize(),
@@ -67,7 +67,7 @@ async function initialize() {
67
67
  await renamer.loadRules();
68
68
  }
69
69
 
70
- async function queueWorker({ commit, index, total }) {
70
+ function queueWorker({ commit, index, total }) {
71
71
  return async.retry({
72
72
  times: MAX_RETRY,
73
73
  interval(retryCount) {
@@ -26,7 +26,7 @@ describe('Docs API', () => {
26
26
  describe('body response defines', () => {
27
27
  let subject;
28
28
 
29
- before(async () => {
29
+ before(() => {
30
30
  subject = response.body;
31
31
  });
32
32
 
@@ -39,7 +39,7 @@ describe('Docs API', () => {
39
39
  });
40
40
 
41
41
  describe('with endpoints', () => {
42
- before(async () => {
42
+ before(() => {
43
43
  subject = response.body.paths;
44
44
  });
45
45
 
@@ -57,7 +57,7 @@ describe('Versions API', () => {
57
57
  };
58
58
  });
59
59
 
60
- after(async () => versionsRepository.removeAll());
60
+ after(() => versionsRepository.removeAll());
61
61
 
62
62
  let response;
63
63
 
@@ -1,8 +1,8 @@
1
- import puppeteer from 'puppeteer';
2
- import puppeteerExtra from 'puppeteer-extra';
1
+ import { TimeoutError } from 'puppeteer';
2
+ import puppeteer from 'puppeteer-extra';
3
3
  import stealthPlugin from 'puppeteer-extra-plugin-stealth';
4
4
 
5
- puppeteerExtra.use(stealthPlugin());
5
+ puppeteer.use(stealthPlugin());
6
6
 
7
7
  let browser;
8
8
 
@@ -51,7 +51,7 @@ export default async function fetch(url, cssSelectors, config) {
51
51
  content: await page.content(),
52
52
  };
53
53
  } catch (error) {
54
- if (error instanceof puppeteer.errors.TimeoutError) {
54
+ if (error instanceof TimeoutError) {
55
55
  throw new Error(`Timed out after ${config.navigationTimeout / 1000} seconds when trying to fetch '${url}'`);
56
56
  }
57
57
  throw new Error(error.message);
@@ -67,7 +67,7 @@ export async function launchHeadlessBrowser() {
67
67
  return browser;
68
68
  }
69
69
 
70
- browser = await puppeteerExtra.launch({ headless: true });
70
+ browser = await puppeteer.launch({ headless: true });
71
71
 
72
72
  return browser;
73
73
  }
@@ -70,7 +70,7 @@ describe('Fetcher', function () {
70
70
 
71
71
  context('when expected selectors are present', () => {
72
72
  before(async () => {
73
- ({ content, mimeType } = await fetch({ url, selectors: 'body' }));
73
+ ({ content, mimeType } = await fetch({ url, cssSelectors: 'body' }));
74
74
  });
75
75
 
76
76
  it('returns the web page content of the given URL', () => {
@@ -83,7 +83,7 @@ describe('Fetcher', function () {
83
83
 
84
84
  context('with client script enabled', () => {
85
85
  before(async () => {
86
- ({ content, mimeType } = await fetch({ url, selectors: 'body', executeClientScripts: true }));
86
+ ({ content, mimeType } = await fetch({ url, cssSelectors: 'body', executeClientScripts: true }));
87
87
  });
88
88
 
89
89
  it('returns the web page content of the given URL', () => {
@@ -100,7 +100,7 @@ describe('Fetcher', function () {
100
100
  const NOT_PRESENT_SELECTOR = 'h2';
101
101
 
102
102
  before(async () => {
103
- ({ content, mimeType } = await fetch({ url, selectors: NOT_PRESENT_SELECTOR }));
103
+ ({ content, mimeType } = await fetch({ url, cssSelectors: NOT_PRESENT_SELECTOR }));
104
104
  });
105
105
 
106
106
  it('returns the web page content of the given URL', () => {
@@ -113,7 +113,7 @@ describe('Fetcher', function () {
113
113
 
114
114
  context('with client script enabled', () => {
115
115
  before(async () => {
116
- ({ content, mimeType } = await fetch({ url, selectors: NOT_PRESENT_SELECTOR, executeClientScripts: true }));
116
+ ({ content, mimeType } = await fetch({ url, cssSelectors: NOT_PRESENT_SELECTOR, executeClientScripts: true }));
117
117
  });
118
118
 
119
119
  it('returns the web page content of the given URL', () => {
@@ -133,7 +133,7 @@ describe('Fetcher', function () {
133
133
 
134
134
  context('when expected selectors are present', () => {
135
135
  before(async () => {
136
- ({ content } = await fetch({ url, selectors: 'body' }));
136
+ ({ content } = await fetch({ url, cssSelectors: 'body' }));
137
137
  });
138
138
 
139
139
  it('returns the web page content of the given URL', () => {
@@ -28,7 +28,7 @@ const FETCH_DATE = new Date('2000-01-02T12:00:00.000Z');
28
28
  let gitVersion;
29
29
  let app;
30
30
 
31
- async function resetGitRepositories() {
31
+ function resetGitRepositories() {
32
32
  return Promise.all([ app.recorder.snapshotsRepository.removeAll(), app.recorder.versionsRepository.removeAll() ]);
33
33
  }
34
34
 
@@ -79,7 +79,7 @@ describe('Archivist', function () {
79
79
  });
80
80
 
81
81
  context('when everything works fine', () => {
82
- before(async () => app.track({ services }));
82
+ before(() => app.track({ services }));
83
83
 
84
84
  after(resetGitRepositories);
85
85
 
@@ -118,11 +118,11 @@ describe('Archivist', function () {
118
118
 
119
119
  after(resetGitRepositories);
120
120
 
121
- it('records no snapshot for service A', async () => {
121
+ it('records no snapshot for service A', () => {
122
122
  expect(fsApi.existsSync(path.resolve(__dirname, SERVICE_A_EXPECTED_SNAPSHOT_FILE_PATH))).to.be.false;
123
123
  });
124
124
 
125
- it('records no version for service A', async () => {
125
+ it('records no version for service A', () => {
126
126
  expect(fsApi.existsSync(path.resolve(__dirname, SERVICE_A_EXPECTED_VERSION_FILE_PATH))).to.be.false;
127
127
  });
128
128
 
@@ -182,11 +182,11 @@ describe('Archivist', function () {
182
182
  expect(serviceAContent).to.equal('Terms of service with UTF-8 \'çhãràčtęrs"\n========================================');
183
183
  });
184
184
 
185
- it('generates a new version id', async () => {
185
+ it('generates a new version id', () => {
186
186
  expect(reExtractedVersionId).to.not.equal(firstVersionId);
187
187
  });
188
188
 
189
- it('mentions the snapshot id in the changelog', async () => {
189
+ it('mentions the snapshot id in the changelog', () => {
190
190
  expect(reExtractedVersionMessageBody).to.include(originalSnapshotId);
191
191
  });
192
192
 
@@ -233,11 +233,11 @@ describe('Archivist', function () {
233
233
 
234
234
  after(resetGitRepositories);
235
235
 
236
- it('emits an inaccessibleContent event', async () => {
236
+ it('emits an inaccessibleContent event', () => {
237
237
  expect(inaccessibleContentSpy).to.have.been.called;
238
238
  });
239
239
 
240
- it('still extracts the terms of other services', async () => {
240
+ it('still extracts the terms of other services', () => {
241
241
  expect(versionNotChangedSpy).to.have.been.calledWith(versionB);
242
242
  });
243
243
  });
@@ -355,10 +355,10 @@ describe('Archivist', function () {
355
355
  let terms;
356
356
  let snapshot;
357
357
 
358
- before(async () => {
358
+ before(() => {
359
359
  terms = app.services.service·A.getTerms({ type: SERVICE_A_TYPE });
360
360
  terms.fetchDate = FETCH_DATE;
361
- terms.sourceDocuments.forEach(async sourceDocument => {
361
+ terms.sourceDocuments.forEach(sourceDocument => {
362
362
  sourceDocument.content = serviceASnapshotExpectedContent;
363
363
  sourceDocument.mimeType = MIME_TYPE;
364
364
  });
@@ -376,7 +376,7 @@ describe('Archivist', function () {
376
376
  return resetGitRepositories();
377
377
  });
378
378
 
379
- it('emits "firstSnapshotRecorded" event', async () => {
379
+ it('emits "firstSnapshotRecorded" event', () => {
380
380
  expect(spies.onFirstSnapshotRecorded).to.have.been.calledWith(snapshot);
381
381
  });
382
382
 
@@ -424,7 +424,7 @@ describe('Archivist', function () {
424
424
  return resetGitRepositories();
425
425
  });
426
426
 
427
- it('emits "snapshotNotChanged" event', async () => {
427
+ it('emits "snapshotNotChanged" event', () => {
428
428
  expect(spies.onSnapshotNotChanged).to.have.been.calledWith(snapshot);
429
429
  });
430
430
 
@@ -472,7 +472,7 @@ describe('Archivist', function () {
472
472
  before(async () => {
473
473
  await app.recordVersion(terms);
474
474
  resetSpiesHistory();
475
- terms.sourceDocuments.forEach(async sourceDocument => {
475
+ terms.sourceDocuments.forEach(sourceDocument => {
476
476
  sourceDocument.content = serviceBSnapshotExpectedContent;
477
477
  });
478
478
  changedVersion = await app.recordVersion(terms);
@@ -484,7 +484,7 @@ describe('Archivist', function () {
484
484
  return resetGitRepositories();
485
485
  });
486
486
 
487
- it('emits "versionRecorded" event', async () => {
487
+ it('emits "versionRecorded" event', () => {
488
488
  expect(spies.onVersionRecorded).to.have.been.calledWith(changedVersion);
489
489
  });
490
490
 
@@ -506,7 +506,7 @@ describe('Archivist', function () {
506
506
  return resetGitRepositories();
507
507
  });
508
508
 
509
- it('emits "versionNotChanged" event', async () => {
509
+ it('emits "versionNotChanged" event', () => {
510
510
  expect(spies.onVersionNotChanged).to.have.been.calledWith(version);
511
511
  });
512
512
 
@@ -516,7 +516,7 @@ describe('Archivist', function () {
516
516
  });
517
517
 
518
518
  context('when tracking changes on new services', () => {
519
- before(async () => {
519
+ before(() => {
520
520
  nock('https://www.servicea.example').get('/tos').reply(200, serviceASnapshotExpectedContent, { 'Content-Type': 'text/html' });
521
521
  nock('https://www.serviceb.example').get('/privacy').reply(200, serviceBSnapshotExpectedContent, { 'Content-Type': 'application/pdf' });
522
522
 
@@ -8,19 +8,19 @@ export default class Recorder {
8
8
  this.snapshotsRepository = RepositoryFactory.create(config.snapshots.storage);
9
9
  }
10
10
 
11
- async initialize() {
11
+ initialize() {
12
12
  return Promise.all([ this.versionsRepository.initialize(), this.snapshotsRepository.initialize() ]);
13
13
  }
14
14
 
15
- async finalize() {
15
+ finalize() {
16
16
  return Promise.all([ this.versionsRepository.finalize(), this.snapshotsRepository.finalize() ]);
17
17
  }
18
18
 
19
- async getLatestSnapshot(terms, sourceDocumentId) {
19
+ getLatestSnapshot(terms, sourceDocumentId) {
20
20
  return this.snapshotsRepository.findLatest(terms.service.id, terms.type, terms.hasMultipleSourceDocuments && sourceDocumentId);
21
21
  }
22
22
 
23
- async record(record) {
23
+ record(record) {
24
24
  record.validate();
25
25
 
26
26
  switch (record.constructor) { // eslint-disable-line default-case
@@ -30,7 +30,7 @@ describe('Recorder', () => {
30
30
  await recorder.initialize();
31
31
  });
32
32
 
33
- after(async () => recorder.finalize());
33
+ after(() => recorder.finalize());
34
34
 
35
35
  context('Snapshot', () => {
36
36
  describe('#record', () => {
@@ -41,7 +41,7 @@ describe('Recorder', () => {
41
41
  let record;
42
42
 
43
43
  context('when a required param is missing', () => {
44
- after(async () => recorder.snapshotsRepository.removeAll());
44
+ after(() => recorder.snapshotsRepository.removeAll());
45
45
 
46
46
  Snapshot.REQUIRED_PARAMS.forEach(testedRequiredParam => {
47
47
  context(`when "${testedRequiredParam}" is missing`, () => {
@@ -82,17 +82,17 @@ describe('Recorder', () => {
82
82
  record = await recorder.snapshotsRepository.findLatest(SERVICE_ID, TYPE);
83
83
  });
84
84
 
85
- after(async () => recorder.snapshotsRepository.removeAll());
85
+ after(() => recorder.snapshotsRepository.removeAll());
86
86
 
87
87
  it('records the snapshot with the proper content', async () => {
88
88
  expect(await record.content).to.equal(CONTENT);
89
89
  });
90
90
 
91
- it('returns the record id', async () => {
91
+ it('returns the record id', () => {
92
92
  expect(record.id).to.include(id);
93
93
  });
94
94
 
95
- it('states that it is the first record', async () => {
95
+ it('states that it is the first record', () => {
96
96
  expect(isFirstRecord).to.be.true;
97
97
  });
98
98
  });
@@ -120,17 +120,17 @@ describe('Recorder', () => {
120
120
  record = await recorder.snapshotsRepository.findLatest(SERVICE_ID, TYPE);
121
121
  });
122
122
 
123
- after(async () => recorder.snapshotsRepository.removeAll());
123
+ after(() => recorder.snapshotsRepository.removeAll());
124
124
 
125
125
  it('records the snapshot with the proper content', async () => {
126
126
  expect(await record.content).to.equal(UPDATED_CONTENT);
127
127
  });
128
128
 
129
- it('returns the record id', async () => {
129
+ it('returns the record id', () => {
130
130
  expect(record.id).to.include(id);
131
131
  });
132
132
 
133
- it('states that it is not the first record', async () => {
133
+ it('states that it is not the first record', () => {
134
134
  expect(isFirstRecord).to.be.false;
135
135
  });
136
136
  });
@@ -156,9 +156,9 @@ describe('Recorder', () => {
156
156
  record = await recorder.snapshotsRepository.findLatest(SERVICE_ID, TYPE);
157
157
  });
158
158
 
159
- after(async () => recorder.snapshotsRepository.removeAll());
159
+ after(() => recorder.snapshotsRepository.removeAll());
160
160
 
161
- it('does not record the snapshot', async () => {
161
+ it('does not record the snapshot', () => {
162
162
  expect(id).to.not.be.ok;
163
163
  });
164
164
  });
@@ -175,7 +175,7 @@ describe('Recorder', () => {
175
175
  let record;
176
176
 
177
177
  context('when a required param is missing', () => {
178
- after(async () => recorder.versionsRepository.removeAll());
178
+ after(() => recorder.versionsRepository.removeAll());
179
179
 
180
180
  Version.REQUIRED_PARAMS.forEach(testedRequiredParam => {
181
181
  context(`when "${testedRequiredParam}" is missing`, () => {
@@ -216,17 +216,17 @@ describe('Recorder', () => {
216
216
  record = await recorder.versionsRepository.findLatest(SERVICE_ID, TYPE);
217
217
  });
218
218
 
219
- after(async () => recorder.versionsRepository.removeAll());
219
+ after(() => recorder.versionsRepository.removeAll());
220
220
 
221
221
  it('records the version with the proper content', async () => {
222
222
  expect(await record.content).to.equal(CONTENT);
223
223
  });
224
224
 
225
- it('returns the record id', async () => {
225
+ it('returns the record id', () => {
226
226
  expect(record.id).to.include(id);
227
227
  });
228
228
 
229
- it('states that it is the first record', async () => {
229
+ it('states that it is the first record', () => {
230
230
  expect(isFirstRecord).to.be.true;
231
231
  });
232
232
  });
@@ -254,21 +254,21 @@ describe('Recorder', () => {
254
254
  record = await recorder.versionsRepository.findLatest(SERVICE_ID, TYPE);
255
255
  });
256
256
 
257
- after(async () => recorder.versionsRepository.removeAll());
257
+ after(() => recorder.versionsRepository.removeAll());
258
258
 
259
259
  it('records the version with the proper content', async () => {
260
260
  expect(await record.content).to.equal(UPDATED_CONTENT);
261
261
  });
262
262
 
263
- it('records in the version that it is not an extracted only version', async () => {
263
+ it('records in the version that it is not an extracted only version', () => {
264
264
  expect(record.isExtractOnly).to.equal(false);
265
265
  });
266
266
 
267
- it('returns the record id', async () => {
267
+ it('returns the record id', () => {
268
268
  expect(record.id).to.include(id);
269
269
  });
270
270
 
271
- it('states that it is not the first record', async () => {
271
+ it('states that it is not the first record', () => {
272
272
  expect(isFirstRecord).to.be.false;
273
273
  });
274
274
  });
@@ -294,9 +294,9 @@ describe('Recorder', () => {
294
294
  record = await recorder.versionsRepository.findLatest(SERVICE_ID, TYPE);
295
295
  });
296
296
 
297
- after(async () => recorder.versionsRepository.removeAll());
297
+ after(() => recorder.versionsRepository.removeAll());
298
298
 
299
- it('does not record any version', async () => {
299
+ it('does not record any version', () => {
300
300
  expect(id).to.not.be.ok;
301
301
  });
302
302
  });
@@ -323,17 +323,17 @@ describe('Recorder', () => {
323
323
  record = await recorder.versionsRepository.findLatest(SERVICE_ID, TYPE);
324
324
  });
325
325
 
326
- after(async () => recorder.versionsRepository.removeAll()); after(async () => recorder.versionsRepository.removeAll());
326
+ after(() => recorder.versionsRepository.removeAll()); after(() => recorder.versionsRepository.removeAll());
327
327
 
328
328
  it('records the version with the proper content', async () => {
329
329
  expect(await record.content).to.equal(CONTENT);
330
330
  });
331
331
 
332
- it('returns the record id', async () => {
332
+ it('returns the record id', () => {
333
333
  expect(record.id).to.include(id);
334
334
  });
335
335
 
336
- it('states that it is the first record', async () => {
336
+ it('states that it is the first record', () => {
337
337
  expect(isFirstRecord).to.be.true;
338
338
  });
339
339
  });
@@ -362,21 +362,21 @@ describe('Recorder', () => {
362
362
  record = await recorder.versionsRepository.findLatest(SERVICE_ID, TYPE);
363
363
  });
364
364
 
365
- after(async () => recorder.versionsRepository.removeAll());
365
+ after(() => recorder.versionsRepository.removeAll());
366
366
 
367
367
  it('records the version with the proper content', async () => {
368
368
  expect(await record.content).to.equal(UPDATED_CONTENT);
369
369
  });
370
370
 
371
- it('records in the version that it is an extracted only version', async () => {
371
+ it('records in the version that it is an extracted only version', () => {
372
372
  expect(record.isExtractOnly).to.equal(true);
373
373
  });
374
374
 
375
- it('returns the record id', async () => {
375
+ it('returns the record id', () => {
376
376
  expect(record.id).to.include(id);
377
377
  });
378
378
 
379
- it('states that it is not the first record', async () => {
379
+ it('states that it is not the first record', () => {
380
380
  expect(isFirstRecord).to.be.false;
381
381
  });
382
382
  });
@@ -403,9 +403,9 @@ describe('Recorder', () => {
403
403
  record = await recorder.versionsRepository.findLatest(SERVICE_ID, TYPE);
404
404
  });
405
405
 
406
- after(async () => recorder.versionsRepository.removeAll());
406
+ after(() => recorder.versionsRepository.removeAll());
407
407
 
408
- it('does not record any version', async () => {
408
+ it('does not record any version', () => {
409
409
  expect(id).to.not.be.ok;
410
410
  });
411
411
  });
@@ -30,7 +30,7 @@ export default class Git {
30
30
  .addConfig('core.quotePath', false); // disable Git's encoding of special characters in pathnames. For example, `service·A` will be encoded as `service\302\267A` without this setting, leading to issues. See https://git-scm.com/docs/git-config#Documentation/git-config.txt-corequotePath
31
31
  }
32
32
 
33
- async add(filePath) {
33
+ add(filePath) {
34
34
  return this.git.add(this.relativePath(filePath));
35
35
  }
36
36
 
@@ -55,11 +55,11 @@ export default class Git {
55
55
  return summary.commit;
56
56
  }
57
57
 
58
- async pushChanges() {
58
+ pushChanges() {
59
59
  return this.git.push();
60
60
  }
61
61
 
62
- async listCommits(options = []) {
62
+ listCommits(options = []) {
63
63
  return this.log([ '--reverse', '--no-merges', '--name-only', ...options ]);
64
64
  }
65
65
 
@@ -89,11 +89,11 @@ export default class Git {
89
89
  return Boolean(result);
90
90
  }
91
91
 
92
- async checkout(options) {
92
+ checkout(options) {
93
93
  return this.git.checkout(options);
94
94
  }
95
95
 
96
- async show(options) {
96
+ show(options) {
97
97
  return this.git.show(options);
98
98
  }
99
99
 
@@ -107,7 +107,7 @@ export default class Git {
107
107
  return (await this.git.show([ shortHash, '--pretty=%H', '-s' ])).trim();
108
108
  }
109
109
 
110
- async restore(path, commit) {
110
+ restore(path, commit) {
111
111
  return this.git.raw([ 'restore', '-s', commit, '--', path ]);
112
112
  }
113
113
 
@@ -100,7 +100,7 @@ export default class GitRepository extends RepositoryInterface {
100
100
  }
101
101
  }
102
102
 
103
- async removeAll() {
103
+ removeAll() {
104
104
  return this.git.destroyHistory();
105
105
  }
106
106
 
@@ -129,7 +129,9 @@ export default class GitRepository extends RepositoryInterface {
129
129
 
130
130
  async #getCommits() {
131
131
  return (await this.git.listCommits())
132
- .filter(({ message }) => message.match(DataMapper.COMMIT_MESSAGE_PREFIXES_REGEXP)) // Skip commits which are not a record (README, LICENSE…)
132
+ .filter(commit => // Skip non-record commits (e.g., README or LICENSE updates)
133
+ DataMapper.COMMIT_MESSAGE_PREFIXES_REGEXP.test(commit.message) // Commits generated by the engine have messages that match predefined prefixes
134
+ && path.dirname(commit.diff.files[0].file) !== '.') // Assumes one record per commit; records must be in a serviceId folder, not root
133
135
  .sort((commitA, commitB) => new Date(commitA.date) - new Date(commitB.date)); // Make sure that the commits are sorted in ascending chronological order
134
136
  }
135
137