@opentermsarchive/engine 4.1.0 → 4.2.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": "4.1.0",
3
+ "version": "4.2.0",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://opentermsarchive.org",
6
6
  "bugs": {
@@ -18,9 +18,7 @@ export default class GitLab {
18
18
  static ISSUE_STATE_ALL = 'all';
19
19
 
20
20
  constructor(repository, baseURL = BASE_URL, apiBaseURL = API_BASE_URL) {
21
- const [ owner, repo ] = repository.split('/');
22
-
23
- this.commonParams = { owner, repo };
21
+ this.repositoryPath = repository;
24
22
  this.projectId = null;
25
23
  this.baseURL = baseURL;
26
24
  console.log('this.baseURL', this.baseURL);
@@ -31,9 +29,8 @@ export default class GitLab {
31
29
  const options = GitLab.baseOptionsHttpReq();
32
30
 
33
31
  try {
34
- const repositoryPath = `${this.commonParams.owner}/${this.commonParams.repo}`;
35
32
  const response = await nodeFetch(
36
- `${this.apiBaseURL}/projects/${encodeURIComponent(repositoryPath)}`,
33
+ `${this.apiBaseURL}/projects/${encodeURIComponent(this.repositoryPath)}`,
37
34
  options,
38
35
  );
39
36
 
@@ -42,7 +39,7 @@ export default class GitLab {
42
39
  if (response.ok) {
43
40
  this.projectId = res.id;
44
41
  } else {
45
- logger.error(`Error while obtaining projectId: ${JSON.strinfigy(res)}`);
42
+ logger.error(`Error while obtaining projectId: ${JSON.stringify(res)}`);
46
43
  this.projectId = null;
47
44
  }
48
45
  } catch (error) {
@@ -367,15 +364,15 @@ export default class GitLab {
367
364
  }
368
365
 
369
366
  generateDeclarationURL(serviceName) {
370
- return `${this.baseURL}/${this.commonParams.owner}/${this.commonParams.repo}/-/blob/main/declarations/${encodeURIComponent(serviceName)}.json`;
367
+ return `${this.baseURL}/${this.repositoryPath}/-/blob/main/declarations/${encodeURIComponent(serviceName)}.json`;
371
368
  }
372
369
 
373
370
  generateVersionURL(serviceName, termsType) {
374
- return `${this.baseURL}/${this.commonParams.owner}/${this.commonParams.repo}/-/blob/main/${encodeURIComponent(serviceName)}/${encodeURIComponent(serviceName, termsType)}.md`;
371
+ return `${this.baseURL}/${this.repositoryPath}/-/blob/main/${encodeURIComponent(serviceName)}/${encodeURIComponent(serviceName, termsType)}.md`;
375
372
  }
376
373
 
377
374
  generateSnapshotsBaseUrl(serviceName, termsType) {
378
- return `${this.baseURL}/${this.commonParams.owner}/${this.commonParams.repo}/-/blob/main/${encodeURIComponent(serviceName)}/${encodeURIComponent(termsType)}`;
375
+ return `${this.baseURL}/${this.repositoryPath}/-/blob/main/${encodeURIComponent(serviceName)}/${encodeURIComponent(termsType)}`;
379
376
  }
380
377
 
381
378
  // GitLab API responses are not cached unlike GitHub, so this method only exists to satisfy the Reporter interface contract