@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.
package/config/default.json
CHANGED
|
@@ -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
|
@@ -72,12 +72,29 @@ const router = express.Router();
|
|
|
72
72
|
* schema:
|
|
73
73
|
* type: array
|
|
74
74
|
* items:
|
|
75
|
-
*
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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) {
|
package/src/reporter/index.js
CHANGED
|
@@ -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
|
-
|
|
136
|
-
|
|
135
|
+
${this.repositories.versions ? `- ${latestVersionLink}` : ''}
|
|
136
|
+
${this.repositories.snapshots ? `- ${latestSnapshotsLink}` : ''}
|
|
137
137
|
`;
|
|
138
138
|
/* eslint-enable no-irregular-whitespace */
|
|
139
139
|
}
|