@opentermsarchive/engine 0.32.0 → 0.33.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.
@@ -54,15 +54,6 @@
54
54
  "updateTemplateId": 7
55
55
  }
56
56
  },
57
- "reporter": {
58
- "githubIssues": {
59
- "repositories": {
60
- "declarations": "OpenTermsArchive/sandbox-declarations",
61
- "versions": "OpenTermsArchive/sandbox-versions",
62
- "snapshots": "OpenTermsArchive/sandbox-snapshots"
63
- }
64
- }
65
- },
66
57
  "dataset": {
67
58
  "title": "sandbox",
68
59
  "versionsRepositoryURL": "https://github.com/OpenTermsArchive/sandbox"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentermsarchive/engine",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://github.com/OpenTermsArchive/engine#readme",
6
6
  "bugs": {
@@ -57,7 +57,6 @@ describe('Docs API', () => {
57
57
  context('When requested as HTML', () => {
58
58
  before(async () => {
59
59
  response = await request(app).get(`${basePath}/v1/docs/`);
60
- console.log(response);
61
60
  });
62
61
 
63
62
  it('responds with 200 status code', () => {
@@ -72,12 +72,29 @@ const router = express.Router();
72
72
  * schema:
73
73
  * type: array
74
74
  * items:
75
- * $ref: '#/components/schemas/Service'
75
+ * type: object
76
+ * properties:
77
+ * id:
78
+ * type: string
79
+ * description: The ID of the service.
80
+ * name:
81
+ * type: string
82
+ * description: The name of the service.
83
+ * terms:
84
+ * type: array
85
+ * description: The declared terms types for this service.
86
+ * items:
87
+ * type: object
88
+ * properties:
89
+ * type:
90
+ * type: string
91
+ * description: The type of terms.
76
92
  */
77
93
  router.get('/services', (req, res) => {
78
94
  res.status(200).json(Object.values(services).map(service => ({
79
95
  id: service.id,
80
96
  name: service.name,
97
+ terms: service.getTermsTypes().map(type => ({ type })),
81
98
  })));
82
99
  });
83
100
 
@@ -37,6 +37,20 @@ describe('Services API', () => {
37
37
  expect(service).to.have.property('name');
38
38
  });
39
39
  });
40
+
41
+ it('each service should have a terms array', () => {
42
+ response.body.forEach(service => {
43
+ expect(service).to.have.property('terms').that.is.an('array');
44
+ });
45
+ });
46
+
47
+ it('each terms should have a type', () => {
48
+ response.body.forEach(service => {
49
+ service.terms.forEach(terms => {
50
+ expect(terms).to.have.property('type');
51
+ });
52
+ });
53
+ });
40
54
  });
41
55
 
42
56
  describe('GET /service/:serviceId', () => {
package/src/index.js CHANGED
@@ -43,10 +43,14 @@ export default async function track({ services, types, extractOnly, schedule })
43
43
  }
44
44
 
45
45
  if (process.env.GITHUB_TOKEN) {
46
- const reporter = new Reporter(config.get('reporter'));
47
-
48
- await reporter.initialize();
49
- archivist.attach(reporter);
46
+ if (config.has('reporter.githubIssues.repositories.declarations')) {
47
+ const reporter = new Reporter(config.get('reporter'));
48
+
49
+ await reporter.initialize();
50
+ archivist.attach(reporter);
51
+ } else {
52
+ logger.warn('Configuration key "reporter.githubIssues.repositories.declarations" was not found; the Reporter module will be ignored\n');
53
+ }
50
54
  }
51
55
 
52
56
  if (!schedule) {
@@ -132,8 +132,8 @@ If the source documents are accessible in a browser but fetching them always fai
132
132
  ### References
133
133
 
134
134
  - ${latestDeclarationLink}
135
- - ${latestVersionLink}
136
- - ${latestSnapshotsLink}
135
+ ${this.repositories.versions ? `- ${latestVersionLink}` : ''}
136
+ ${this.repositories.snapshots ? `- ${latestSnapshotsLink}` : ''}
137
137
  `;
138
138
  /* eslint-enable no-irregular-whitespace */
139
139
  }