@opentermsarchive/engine 0.16.0 → 0.17.1
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/README.md +240 -232
- package/package.json +7 -1
- package/scripts/dataset/README.md +2 -2
- package/scripts/dataset/assets/README.template.js +5 -5
- package/scripts/dataset/export/test/fixtures/dataset/README.md +5 -5
- package/scripts/import/README.md +1 -1
- package/scripts/rewrite/README.md +2 -2
- package/scripts/rewrite/rewrite-versions.js +1 -1
- package/scripts/utils/renamer/README.md +5 -5
- package/scripts/utils/renamer/index.js +2 -2
- package/src/archivist/recorder/index.js +2 -2
- package/src/archivist/recorder/index.test.js +3 -3
- package/src/archivist/recorder/repositories/git/dataMapper.js +1 -1
- package/src/archivist/recorder/repositories/git/index.test.js +5 -5
- package/src/archivist/recorder/repositories/interface.js +2 -2
- package/src/archivist/recorder/repositories/mongo/index.test.js +4 -4
- package/src/archivist/services/index.test.js +2 -2
- package/src/archivist/services/service.test.js +1 -1
- package/src/main.js +1 -1
- package/.env.example +0 -3
- package/.eslintrc.yaml +0 -116
- package/.github/workflows/deploy.yml +0 -50
- package/.github/workflows/release.yml +0 -71
- package/.github/workflows/test.yml +0 -77
- package/CHANGELOG.md +0 -14
- package/CODE_OF_CONDUCT.md +0 -128
- package/CONTRIBUTING.md +0 -143
- package/MIGRATING.md +0 -42
- package/README.fr.md +0 -110
- package/Vagrantfile +0 -38
- package/ansible.cfg +0 -13
- package/decision-records/0001-service-name-and-id.md +0 -73
- package/decision-records/0002-service-history.md +0 -212
- package/decision-records/0003-snapshots-database.md +0 -123
- package/ops/README.md +0 -280
- package/ops/app.yml +0 -5
- package/ops/infra.yml +0 -6
- package/ops/inventories/dev.yml +0 -7
- package/ops/inventories/production.yml +0 -27
- package/ops/roles/infra/defaults/main.yml +0 -2
- package/ops/roles/infra/files/.gitconfig +0 -3
- package/ops/roles/infra/files/mongod.conf +0 -18
- package/ops/roles/infra/files/ota-bot-key.private_key +0 -26
- package/ops/roles/infra/tasks/main.yml +0 -78
- package/ops/roles/infra/tasks/mongo.yml +0 -40
- package/ops/roles/infra/templates/ssh_config.j2 +0 -5
- package/ops/roles/ota/defaults/main.yml +0 -14
- package/ops/roles/ota/files/.env +0 -21
- package/ops/roles/ota/tasks/database.yml +0 -65
- package/ops/roles/ota/tasks/main.yml +0 -110
- package/ops/site.yml +0 -6
- package/pm2.config.cjs +0 -20
- package/test/fixtures/service_A.js +0 -22
- package/test/fixtures/service_A_terms.md +0 -10
- package/test/fixtures/service_A_terms_snapshot.html +0 -14
- package/test/fixtures/service_B.js +0 -22
- package/test/fixtures/service_with_declaration_history.js +0 -65
- package/test/fixtures/service_with_filters_history.js +0 -155
- package/test/fixtures/service_with_history.js +0 -188
- package/test/fixtures/service_with_multipage_document.js +0 -100
- package/test/fixtures/service_without_history.js +0 -31
- package/test/fixtures/services.js +0 -19
- package/test/fixtures/terms.pdf +0 -0
- package/test/fixtures/termsFromPDF.md +0 -25
- package/test/fixtures/termsModified.pdf +0 -0
- package/test/services/service_A.json +0 -9
- package/test/services/service_B.json +0 -9
- package/test/services/service_with_declaration_history.filters.js +0 -7
- package/test/services/service_with_declaration_history.history.json +0 -17
- package/test/services/service_with_declaration_history.json +0 -13
- package/test/services/service_with_filters_history.filters.history.js +0 -29
- package/test/services/service_with_filters_history.filters.js +0 -7
- package/test/services/service_with_filters_history.json +0 -13
- package/test/services/service_with_history.filters.history.js +0 -29
- package/test/services/service_with_history.filters.js +0 -7
- package/test/services/service_with_history.history.json +0 -26
- package/test/services/service_with_history.json +0 -17
- package/test/services/service_with_multipage_document.filters.js +0 -7
- package/test/services/service_with_multipage_document.history.json +0 -37
- package/test/services/service_with_multipage_document.json +0 -28
- package/test/services/service_without_history.filters.js +0 -7
- package/test/services/service_without_history.json +0 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentermsarchive/engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"description": "Tracks and makes visible changes to the terms of online services",
|
|
5
5
|
"homepage": "https://github.com/ambanum/OpenTermsArchive#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -40,6 +40,12 @@
|
|
|
40
40
|
"posttest": "npm run lint",
|
|
41
41
|
"test:debug": "npm run test -- --inspect-brk --exit"
|
|
42
42
|
},
|
|
43
|
+
"files": [
|
|
44
|
+
"bin",
|
|
45
|
+
"config",
|
|
46
|
+
"scripts",
|
|
47
|
+
"src"
|
|
48
|
+
],
|
|
43
49
|
"dependencies": {
|
|
44
50
|
"@accordproject/markdown-cicero": "^0.15.2",
|
|
45
51
|
"@accordproject/markdown-pdf": "^0.15.2",
|
|
@@ -4,7 +4,7 @@ Export the versions dataset into a ZIP file and publish it to GitHub releases.
|
|
|
4
4
|
|
|
5
5
|
## Configuring
|
|
6
6
|
|
|
7
|
-
You can change the configuration in the appropriate config file in the `config` folder. See the [main README](
|
|
7
|
+
You can change the configuration in the appropriate config file in the `config` folder. See the [main README](../../README.md#configuring) for documentation on using the configuration file.
|
|
8
8
|
|
|
9
9
|
## Running
|
|
10
10
|
|
|
@@ -34,4 +34,4 @@ node scripts/dataset/main.js --schedule --publish --remove-local-copy
|
|
|
34
34
|
|
|
35
35
|
## Adding renaming rules
|
|
36
36
|
|
|
37
|
-
See the [renamer module documentation](../renamer/README.md).
|
|
37
|
+
See the [renamer module documentation](../utils/renamer/README.md).
|
|
@@ -31,27 +31,27 @@ It has been generated with [Open Terms Archive](https://opentermsarchive.org).
|
|
|
31
31
|
|
|
32
32
|
### Dataset format
|
|
33
33
|
|
|
34
|
-
This dataset represents each version of a document as a separate [Markdown](https://spec.commonmark.org/0.30/) file, nested in a directory with the name of the service provider and in a directory with the name of the
|
|
34
|
+
This dataset represents each version of a document as a separate [Markdown](https://spec.commonmark.org/0.30/) file, nested in a directory with the name of the service provider and in a directory with the name of the terms type. The filesystem layout will look like below.
|
|
35
35
|
|
|
36
36
|
\`\`\`
|
|
37
37
|
├ README.md
|
|
38
38
|
├┬ Service provider 1 (e.g. Facebook)
|
|
39
|
-
│├┬
|
|
39
|
+
│├┬ Terms type 1 (e.g. Terms of Service)
|
|
40
40
|
││├ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-08-01T01-03-12Z.md)
|
|
41
41
|
┆┆┆
|
|
42
42
|
││└ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-10-03T08-12-25Z.md)
|
|
43
43
|
┆┆
|
|
44
|
-
│└┬
|
|
44
|
+
│└┬ Terms type X (e.g. Privacy Policy)
|
|
45
45
|
│ ├ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-05-02T03-02-15Z.md)
|
|
46
46
|
┆ ┆
|
|
47
47
|
│ └ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-11-14T12-36-45Z.md)
|
|
48
48
|
┆
|
|
49
49
|
└┬ Service provider Y (e.g. Google)
|
|
50
|
-
├┬
|
|
50
|
+
├┬ Terms type 1 (e.g. Developer Terms)
|
|
51
51
|
│├ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2019-03-12T04-18-22Z.md)
|
|
52
52
|
┆┆
|
|
53
53
|
│└ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-12-04T22-47-05Z.md)
|
|
54
|
-
└┬
|
|
54
|
+
└┬ Terms type Z (e.g. Privacy Policy)
|
|
55
55
|
┆
|
|
56
56
|
├ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-05-02T03-02-15Z.md)
|
|
57
57
|
┆
|
|
@@ -8,27 +8,27 @@ It has been generated with [Open Terms Archive](https://opentermsarchive.org).
|
|
|
8
8
|
|
|
9
9
|
### Dataset format
|
|
10
10
|
|
|
11
|
-
This dataset represents each version of a document as a separate [Markdown](https://spec.commonmark.org/0.30/) file, nested in a directory with the name of the service provider and in a directory with the name of the
|
|
11
|
+
This dataset represents each version of a document as a separate [Markdown](https://spec.commonmark.org/0.30/) file, nested in a directory with the name of the service provider and in a directory with the name of the terms type. The filesystem layout will look like below.
|
|
12
12
|
|
|
13
13
|
```
|
|
14
14
|
├ README.md
|
|
15
15
|
├┬ Service provider 1 (e.g. Facebook)
|
|
16
|
-
│├┬
|
|
16
|
+
│├┬ Terms type 1 (e.g. Terms of Service)
|
|
17
17
|
││├ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-08-01T01-03-12Z.md)
|
|
18
18
|
┆┆┆
|
|
19
19
|
││└ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-10-03T08-12-25Z.md)
|
|
20
20
|
┆┆
|
|
21
|
-
│└┬
|
|
21
|
+
│└┬ Terms type X (e.g. Privacy Policy)
|
|
22
22
|
│ ├ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-05-02T03-02-15Z.md)
|
|
23
23
|
┆ ┆
|
|
24
24
|
│ └ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-11-14T12-36-45Z.md)
|
|
25
25
|
┆
|
|
26
26
|
└┬ Service provider Y (e.g. Google)
|
|
27
|
-
├┬
|
|
27
|
+
├┬ Terms type 1 (e.g. Developer Terms)
|
|
28
28
|
│├ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2019-03-12T04-18-22Z.md)
|
|
29
29
|
┆┆
|
|
30
30
|
│└ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-12-04T22-47-05Z.md)
|
|
31
|
-
└┬
|
|
31
|
+
└┬ Terms type Z (e.g. Privacy Policy)
|
|
32
32
|
┆
|
|
33
33
|
├ YYYY-DD-MMTHH-MM-SSZ.md (e.g. 2021-05-02T03-02-15Z.md)
|
|
34
34
|
┆
|
package/scripts/import/README.md
CHANGED
|
@@ -54,6 +54,6 @@ NODE_ENV=import node scripts/import/index.js
|
|
|
54
54
|
The script will:
|
|
55
55
|
|
|
56
56
|
- Ignore commits which are not a document snapshot (like renaming or documentation commits).
|
|
57
|
-
- Rename
|
|
57
|
+
- Rename terms types according to declared rules. See the [renamer module documentation](../renamer/README.md).
|
|
58
58
|
- Rename services according to declared rules. See the [renamer module documentation](../renamer/README.md).
|
|
59
59
|
- Handle duplicates, so you can run it twice without worrying about duplicate entries in the database.
|
|
@@ -2,7 +2,7 @@ __:warning: These scripts are no longer up-to-date with the codebase and are not
|
|
|
2
2
|
|
|
3
3
|
# Rewrite history
|
|
4
4
|
|
|
5
|
-
As some
|
|
5
|
+
As some terms types or service names can change over time or as we need to import history from other tools, provided they have an history with the same structure as Open Terms Archive, we need a way to rewrite, reorder and apply changes to the snapshots or versions history.
|
|
6
6
|
|
|
7
7
|
The script works by reading commits from a **source** repository, applying changes and then committing the result in another, empty or not, **target** repository. So a source repository with commits is required.
|
|
8
8
|
|
|
@@ -125,7 +125,7 @@ Currently, the script will:
|
|
|
125
125
|
|
|
126
126
|
- Ignore commits which are not a document snapshot (like renaming or documentation commits)
|
|
127
127
|
- Reorder commits according to their author date
|
|
128
|
-
- Rename
|
|
128
|
+
- Rename terms types according to declared rules
|
|
129
129
|
- Rename services according to declared rules
|
|
130
130
|
- Skip commits with empty content
|
|
131
131
|
- Skip commits which do not change the document
|
|
@@ -101,7 +101,7 @@ let recorder;
|
|
|
101
101
|
);
|
|
102
102
|
|
|
103
103
|
if (!documentDeclaration) {
|
|
104
|
-
console.log(`⌙ Skip unknown
|
|
104
|
+
console.log(`⌙ Skip unknown terms type "${documentType}" for service "${serviceId}"`);
|
|
105
105
|
continue;
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Renamer
|
|
2
2
|
|
|
3
|
-
This module is used to apply renaming rules to service IDs and
|
|
3
|
+
This module is used to apply renaming rules to service IDs and terms types.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -24,9 +24,9 @@ To rename a service, add a rule in `./rules/services.json`, for example, to rena
|
|
|
24
24
|
}
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### Terms type
|
|
28
28
|
|
|
29
|
-
To rename a
|
|
29
|
+
To rename a terms type, add a rule in `./rules/documentTypes.json`, for example, to rename "Program Policies" to "Acceptable Use Policy", add the following line in the file:
|
|
30
30
|
|
|
31
31
|
```json
|
|
32
32
|
{
|
|
@@ -35,9 +35,9 @@ To rename a document type, add a rule in `./rules/documentTypes.json`, for examp
|
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
###
|
|
38
|
+
### Terms type for a specific service
|
|
39
39
|
|
|
40
|
-
To rename a
|
|
40
|
+
To rename a terms type only for a specific service, add a rule in `./rules/servicesDocumentTypes.json`, for example, to rename "Program Policies" to "Acceptable Use Policy" only for Skype, add the following line in the file:
|
|
41
41
|
|
|
42
42
|
```json
|
|
43
43
|
{
|
|
@@ -26,7 +26,7 @@ export function applyRules(serviceId, documentType) {
|
|
|
26
26
|
const renamedDocumentType = renamingRules.documentTypes[documentType];
|
|
27
27
|
|
|
28
28
|
if (renamedDocumentType) {
|
|
29
|
-
console.log(`⌙ Rename
|
|
29
|
+
console.log(`⌙ Rename terms type "${documentType}" to "${renamedDocumentType}" of "${serviceId}" service`);
|
|
30
30
|
documentType = renamedDocumentType;
|
|
31
31
|
}
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ export function applyRules(serviceId, documentType) {
|
|
|
34
34
|
&& renamingRules.documentTypesByService[serviceId][documentType];
|
|
35
35
|
|
|
36
36
|
if (renamedServiceDocumentType) {
|
|
37
|
-
console.log(`⌙ Specific rename
|
|
37
|
+
console.log(`⌙ Specific rename terms type "${documentType}" to "${renamedServiceDocumentType}" of "${serviceId}" service`);
|
|
38
38
|
documentType = renamedServiceDocumentType;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -27,7 +27,7 @@ export default class Recorder {
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
if (!documentType) {
|
|
30
|
-
throw new Error('A
|
|
30
|
+
throw new Error('A terms type is required');
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
if (!fetchDate) {
|
|
@@ -51,7 +51,7 @@ export default class Recorder {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
if (!documentType) {
|
|
54
|
-
throw new Error('A
|
|
54
|
+
throw new Error('A terms type is required');
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
if (!snapshotIds?.length) {
|
|
@@ -49,7 +49,7 @@ describe('Recorder', () => {
|
|
|
49
49
|
|
|
50
50
|
const paramsNameToExpectedTextInError = {
|
|
51
51
|
serviceId: 'service ID',
|
|
52
|
-
documentType: '
|
|
52
|
+
documentType: 'terms type',
|
|
53
53
|
fetchDate: 'fetch date',
|
|
54
54
|
content: 'content',
|
|
55
55
|
mimeType: 'mime type',
|
|
@@ -190,7 +190,7 @@ describe('Recorder', () => {
|
|
|
190
190
|
|
|
191
191
|
const paramsNameToExpectedTextInError = {
|
|
192
192
|
serviceId: 'service ID',
|
|
193
|
-
documentType: '
|
|
193
|
+
documentType: 'terms type',
|
|
194
194
|
snapshotIds: 'snapshot ID',
|
|
195
195
|
fetchDate: 'fetch date',
|
|
196
196
|
content: 'content',
|
|
@@ -335,7 +335,7 @@ describe('Recorder', () => {
|
|
|
335
335
|
|
|
336
336
|
const paramsNameToExpectedTextInError = {
|
|
337
337
|
serviceId: 'service ID',
|
|
338
|
-
documentType: '
|
|
338
|
+
documentType: 'terms type',
|
|
339
339
|
snapshotIds: 'snapshot ID',
|
|
340
340
|
fetchDate: 'fetch date',
|
|
341
341
|
content: 'content',
|
|
@@ -77,7 +77,7 @@ function generateFileName(documentType, pageId, extension) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export function generateFilePath(serviceId, documentType, pageId, mimeType) {
|
|
80
|
-
const extension = mime.getExtension(mimeType) || '*'; // If mime type is undefined, an asterisk is set as an extension. Used to match all files for the given service ID,
|
|
80
|
+
const extension = mime.getExtension(mimeType) || '*'; // If mime type is undefined, an asterisk is set as an extension. Used to match all files for the given service ID, terms type and page ID when mime type is unknown.
|
|
81
81
|
|
|
82
82
|
return `${serviceId}/${generateFileName(documentType, pageId, extension)}`; // Do not use `path.join` as even for Windows, the path should be with `/` and not `\`. See https://github.com/ambanum/OpenTermsArchive/runs/8110230474?check_suite_focus=true#step:7:125
|
|
83
83
|
}
|
|
@@ -101,7 +101,7 @@ describe('GitRepository', () => {
|
|
|
101
101
|
expect(commit.message).to.include(SERVICE_PROVIDER_ID);
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
-
it('stores the
|
|
104
|
+
it('stores the terms type', () => {
|
|
105
105
|
expect(commit.message).to.include(DOCUMENT_TYPE);
|
|
106
106
|
});
|
|
107
107
|
|
|
@@ -314,7 +314,7 @@ describe('GitRepository', () => {
|
|
|
314
314
|
expect(commit.message).to.include(SERVICE_PROVIDER_ID);
|
|
315
315
|
});
|
|
316
316
|
|
|
317
|
-
it('stores the
|
|
317
|
+
it('stores the terms type', () => {
|
|
318
318
|
expect(commit.message).to.include(DOCUMENT_TYPE);
|
|
319
319
|
});
|
|
320
320
|
|
|
@@ -351,7 +351,7 @@ describe('GitRepository', () => {
|
|
|
351
351
|
expect(commit.message).to.include(SERVICE_PROVIDER_ID);
|
|
352
352
|
});
|
|
353
353
|
|
|
354
|
-
it('stores the
|
|
354
|
+
it('stores the terms type', () => {
|
|
355
355
|
expect(commit.message).to.include(DOCUMENT_TYPE);
|
|
356
356
|
});
|
|
357
357
|
|
|
@@ -394,7 +394,7 @@ describe('GitRepository', () => {
|
|
|
394
394
|
expect(commit.message).to.include(SERVICE_PROVIDER_ID);
|
|
395
395
|
});
|
|
396
396
|
|
|
397
|
-
it('stores the
|
|
397
|
+
it('stores the terms type', () => {
|
|
398
398
|
expect(commit.message).to.include(DOCUMENT_TYPE);
|
|
399
399
|
});
|
|
400
400
|
|
|
@@ -436,7 +436,7 @@ describe('GitRepository', () => {
|
|
|
436
436
|
expect(record.serviceId).to.equal(SERVICE_PROVIDER_ID);
|
|
437
437
|
});
|
|
438
438
|
|
|
439
|
-
it('returns the
|
|
439
|
+
it('returns the terms type', () => {
|
|
440
440
|
expect(record.documentType).to.equal(DOCUMENT_TYPE);
|
|
441
441
|
});
|
|
442
442
|
|
|
@@ -35,11 +35,11 @@ export default class RepositoryInterface {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Find the most recent record that matches the given service ID and
|
|
38
|
+
* Find the most recent record that matches the given service ID and terms type and optionally the page ID
|
|
39
39
|
* In case of snapshots, if the record is related to a multipage document, the page ID is required to find the corresponding snapshot
|
|
40
40
|
*
|
|
41
41
|
* @param {string} serviceId - Service ID of record to find
|
|
42
|
-
* @param {string} documentType -
|
|
42
|
+
* @param {string} documentType - Terms type of record to find
|
|
43
43
|
* @param {string} [pageId] - Page ID of record to find. Used to differentiate pages of multipage document. Not necessary for single page document
|
|
44
44
|
* @returns {Promise<Record>} Promise that will be resolved with the found record or an empty object if none match the given criteria
|
|
45
45
|
*/
|
|
@@ -95,7 +95,7 @@ describe('MongoRepository', () => {
|
|
|
95
95
|
expect(mongoDocument.serviceId).to.include(SERVICE_PROVIDER_ID);
|
|
96
96
|
});
|
|
97
97
|
|
|
98
|
-
it('stores the
|
|
98
|
+
it('stores the terms type', () => {
|
|
99
99
|
expect(mongoDocument.documentType).to.include(DOCUMENT_TYPE);
|
|
100
100
|
});
|
|
101
101
|
|
|
@@ -349,7 +349,7 @@ describe('MongoRepository', () => {
|
|
|
349
349
|
expect(mongoDocument.serviceId).to.include(SERVICE_PROVIDER_ID);
|
|
350
350
|
});
|
|
351
351
|
|
|
352
|
-
it('stores the
|
|
352
|
+
it('stores the terms type', () => {
|
|
353
353
|
expect(mongoDocument.documentType).to.include(DOCUMENT_TYPE);
|
|
354
354
|
});
|
|
355
355
|
|
|
@@ -392,7 +392,7 @@ describe('MongoRepository', () => {
|
|
|
392
392
|
expect(mongoDocument.serviceId).to.include(SERVICE_PROVIDER_ID);
|
|
393
393
|
});
|
|
394
394
|
|
|
395
|
-
it('stores the
|
|
395
|
+
it('stores the terms type', () => {
|
|
396
396
|
expect(mongoDocument.documentType).to.include(DOCUMENT_TYPE);
|
|
397
397
|
});
|
|
398
398
|
|
|
@@ -434,7 +434,7 @@ describe('MongoRepository', () => {
|
|
|
434
434
|
expect(record.serviceId).to.equal(SERVICE_PROVIDER_ID);
|
|
435
435
|
});
|
|
436
436
|
|
|
437
|
-
it('returns the
|
|
437
|
+
it('returns the terms type', () => {
|
|
438
438
|
expect(record.documentType).to.equal(DOCUMENT_TYPE);
|
|
439
439
|
});
|
|
440
440
|
|
|
@@ -51,7 +51,7 @@ describe('Services', () => {
|
|
|
51
51
|
expect(actualDocumentDeclaration.service.name).to.eql(expectedDocumentDeclaration.service.name);
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
it('has the proper
|
|
54
|
+
it('has the proper terms type', () => {
|
|
55
55
|
expect(actualDocumentDeclaration.type).to.eql(expectedDocumentDeclaration.type);
|
|
56
56
|
});
|
|
57
57
|
|
|
@@ -170,7 +170,7 @@ describe('Services', () => {
|
|
|
170
170
|
expect(actualDocumentDeclaration.service.name).to.eql(expectedDocumentDeclaration.service.name);
|
|
171
171
|
});
|
|
172
172
|
|
|
173
|
-
it('has the proper
|
|
173
|
+
it('has the proper terms type', () => {
|
|
174
174
|
expect(actualDocumentDeclaration.type).to.eql(expectedDocumentDeclaration.type);
|
|
175
175
|
});
|
|
176
176
|
|
|
@@ -154,7 +154,7 @@ describe('Service', () => {
|
|
|
154
154
|
subject.addDocumentDeclaration(privacyPolicyDeclaration);
|
|
155
155
|
});
|
|
156
156
|
|
|
157
|
-
it('returns the service
|
|
157
|
+
it('returns the service terms types', async () => {
|
|
158
158
|
expect(subject.getDocumentTypes()).to.have.members([
|
|
159
159
|
termsOfServiceDeclaration.type,
|
|
160
160
|
privacyPolicyDeclaration.type,
|
package/src/main.js
CHANGED
|
@@ -11,7 +11,7 @@ program
|
|
|
11
11
|
.description(description)
|
|
12
12
|
.version(version)
|
|
13
13
|
.option('-s, --services [serviceId...]', 'service IDs of services to handle')
|
|
14
|
-
.option('-d, --documentTypes [documentType...]', '
|
|
14
|
+
.option('-d, --documentTypes [documentType...]', 'terms types to handle')
|
|
15
15
|
.option('-r, --refilter-only', 'only refilter exisiting snapshots with last declarations and engine\'s updates')
|
|
16
16
|
.option('--schedule', 'schedule automatic document tracking');
|
|
17
17
|
|
package/.env.example
DELETED
package/.eslintrc.yaml
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
extends:
|
|
2
|
-
- airbnb-base
|
|
3
|
-
parserOptions:
|
|
4
|
-
ecmaVersion: 2022
|
|
5
|
-
env:
|
|
6
|
-
node: true
|
|
7
|
-
mocha: true
|
|
8
|
-
es6: true
|
|
9
|
-
plugins:
|
|
10
|
-
- chai-friendly
|
|
11
|
-
- import
|
|
12
|
-
- json-format
|
|
13
|
-
rules:
|
|
14
|
-
arrow-parens:
|
|
15
|
-
- error
|
|
16
|
-
- as-needed
|
|
17
|
-
array-bracket-spacing:
|
|
18
|
-
- error
|
|
19
|
-
- always
|
|
20
|
-
- objectsInArrays: false
|
|
21
|
-
arraysInArrays: false
|
|
22
|
-
singleValue: false
|
|
23
|
-
eqeqeq: 0
|
|
24
|
-
chai-friendly/no-unused-expressions: 2
|
|
25
|
-
comma-dangle:
|
|
26
|
-
- error
|
|
27
|
-
- always-multiline
|
|
28
|
-
consistent-return: 0
|
|
29
|
-
function-paren-newline:
|
|
30
|
-
- error
|
|
31
|
-
- multiline
|
|
32
|
-
implicit-arrow-linebreak:
|
|
33
|
-
- 'off'
|
|
34
|
-
import/extensions:
|
|
35
|
-
- error
|
|
36
|
-
- always
|
|
37
|
-
- ignorePackages: true
|
|
38
|
-
import/prefer-default-export: 0
|
|
39
|
-
import/order:
|
|
40
|
-
- error
|
|
41
|
-
- newlines-between: always
|
|
42
|
-
alphabetize:
|
|
43
|
-
order: asc
|
|
44
|
-
caseInsensitive: true
|
|
45
|
-
import/namespace:
|
|
46
|
-
- error
|
|
47
|
-
- allowComputed: true
|
|
48
|
-
indent:
|
|
49
|
-
- error
|
|
50
|
-
- 2
|
|
51
|
-
max-len: 0
|
|
52
|
-
object-curly-newline:
|
|
53
|
-
- error
|
|
54
|
-
- multiline: true
|
|
55
|
-
no-console: 0
|
|
56
|
-
no-continue: 0
|
|
57
|
-
no-param-reassign: 0
|
|
58
|
-
no-plusplus: 0
|
|
59
|
-
no-restricted-syntax: 0
|
|
60
|
-
no-shadow: 0
|
|
61
|
-
no-tabs: 0
|
|
62
|
-
no-underscore-dangle: 0
|
|
63
|
-
no-unused-expressions: 0
|
|
64
|
-
no-unused-vars:
|
|
65
|
-
- error
|
|
66
|
-
- argsIgnorePattern: next
|
|
67
|
-
no-use-before-define: 0
|
|
68
|
-
padding-line-between-statements:
|
|
69
|
-
- error
|
|
70
|
-
- blankLine: always
|
|
71
|
-
prev: '*'
|
|
72
|
-
next: return
|
|
73
|
-
- blankLine: always
|
|
74
|
-
prev:
|
|
75
|
-
- const
|
|
76
|
-
- let
|
|
77
|
-
- var
|
|
78
|
-
next: '*'
|
|
79
|
-
- blankLine: any
|
|
80
|
-
prev:
|
|
81
|
-
- const
|
|
82
|
-
- let
|
|
83
|
-
- var
|
|
84
|
-
next:
|
|
85
|
-
- const
|
|
86
|
-
- let
|
|
87
|
-
- var
|
|
88
|
-
multiline-comment-style:
|
|
89
|
-
- error
|
|
90
|
-
- separate-lines
|
|
91
|
-
eol-last:
|
|
92
|
-
- error
|
|
93
|
-
- always
|
|
94
|
-
new-cap:
|
|
95
|
-
- error
|
|
96
|
-
- properties: false
|
|
97
|
-
|
|
98
|
-
overrides:
|
|
99
|
-
- files:
|
|
100
|
-
- src/**/*test.js
|
|
101
|
-
- scripts/declarations/validate/*.js
|
|
102
|
-
rules:
|
|
103
|
-
func-names: 0
|
|
104
|
-
- files:
|
|
105
|
-
- scripts/**/*.js
|
|
106
|
-
- bin/**/*.js
|
|
107
|
-
rules:
|
|
108
|
-
func-names: 0
|
|
109
|
-
import/no-extraneous-dependencies: 0
|
|
110
|
-
- files:
|
|
111
|
-
- src/**/*[iI]nterface.js
|
|
112
|
-
rules:
|
|
113
|
-
no-unused-vars: 0
|
|
114
|
-
require-yield: 0
|
|
115
|
-
class-methods-use-this: 0
|
|
116
|
-
no-empty-function: 0
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
name: Deploy
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ main ]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
test:
|
|
9
|
-
uses: "ambanum/OpenTermsArchive/.github/workflows/test.yml@main"
|
|
10
|
-
|
|
11
|
-
get_instances:
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
outputs:
|
|
14
|
-
names: ${{ steps.get_production_instances_names.outputs.result }}
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v2
|
|
17
|
-
- name: Get production instance names
|
|
18
|
-
id: get_production_instances_names
|
|
19
|
-
uses: mikefarah/yq@master
|
|
20
|
-
with:
|
|
21
|
-
cmd: yq 'with_entries(select(.key | test("all") | not)) | keys' ops/inventories/production.yml --output-format=json # list all group names except `all`
|
|
22
|
-
|
|
23
|
-
deploy:
|
|
24
|
-
needs: [ test, get_instances ]
|
|
25
|
-
runs-on: ubuntu-latest
|
|
26
|
-
strategy:
|
|
27
|
-
fail-fast: false # deploy other instances even if one fails to deploy
|
|
28
|
-
matrix:
|
|
29
|
-
instance: ${{ fromJSON(needs.get_instances.outputs.names) }}
|
|
30
|
-
steps:
|
|
31
|
-
- uses: actions/checkout@v2
|
|
32
|
-
- name: Get target server hostname
|
|
33
|
-
id: get_hostname
|
|
34
|
-
uses: mikefarah/yq@master
|
|
35
|
-
with:
|
|
36
|
-
cmd: yq ".${{ matrix.instance }}.hosts.* | key" ops/inventories/production.yml
|
|
37
|
-
- name: Get target server fingerprint
|
|
38
|
-
id: get_fingerprint
|
|
39
|
-
uses: mikefarah/yq@master
|
|
40
|
-
with:
|
|
41
|
-
cmd: yq '.${{ matrix.instance }}.hosts.["${{ steps.get_hostname.outputs.result }}"].ed25519_fingerprint' ops/inventories/production.yml
|
|
42
|
-
- name: Set up SSH
|
|
43
|
-
uses: shimataro/ssh-key-action@v2
|
|
44
|
-
with:
|
|
45
|
-
key: ${{ secrets.SERVER_SSH_KEY }}
|
|
46
|
-
known_hosts: ${{ steps.get_hostname.outputs.result }} ssh-ed25519 ${{ steps.get_fingerprint.outputs.result }}
|
|
47
|
-
- run: echo "${{ secrets.ANSIBLE_VAULT_KEY }}" > vault.key
|
|
48
|
-
- run: pip install --upgrade setuptools
|
|
49
|
-
- run: pip install 'ansible ~= 2.9'
|
|
50
|
-
- run: ansible-playbook ops/site.yml --inventory ops/inventories/production.yml --limit ${{ matrix.instance }}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ packaging ]
|
|
6
|
-
|
|
7
|
-
jobs:
|
|
8
|
-
test:
|
|
9
|
-
uses: "ambanum/OpenTermsArchive/.github/workflows/test.yml@packaging"
|
|
10
|
-
release:
|
|
11
|
-
needs: [ test ]
|
|
12
|
-
runs-on: ubuntu-latest
|
|
13
|
-
steps:
|
|
14
|
-
- name: Checkout
|
|
15
|
-
uses: actions/checkout@v2
|
|
16
|
-
with:
|
|
17
|
-
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
|
|
18
|
-
|
|
19
|
-
- name: Configure Git author
|
|
20
|
-
run: |
|
|
21
|
-
git config --global user.name "Open Terms Archive Release Bot"
|
|
22
|
-
git config --global user.email "release-bot@opentermsarchive.org"
|
|
23
|
-
|
|
24
|
-
- name: Bump package version
|
|
25
|
-
run: |
|
|
26
|
-
echo "Release type obtained from the previous job: '${{ needs.test.outputs.release_type }}'"
|
|
27
|
-
echo "NEW_VERSION=$(npm --no-git-tag-version version ${{ needs.test.outputs.release_type }})" >> $GITHUB_ENV
|
|
28
|
-
|
|
29
|
-
- name: Update changelog unreleased section with new version
|
|
30
|
-
uses: superfaceai/release-changelog-action@v2
|
|
31
|
-
with:
|
|
32
|
-
version: ${{ env.NEW_VERSION }}
|
|
33
|
-
operation: release
|
|
34
|
-
|
|
35
|
-
- name: Commit CHANGELOG.md and package.json changes and create tag
|
|
36
|
-
run: |
|
|
37
|
-
git add "package.json"
|
|
38
|
-
git add "package-lock.json"
|
|
39
|
-
git add "CHANGELOG.md"
|
|
40
|
-
git commit -m "Release ${{ env.NEW_VERSION }}"
|
|
41
|
-
git tag ${{ env.NEW_VERSION }}
|
|
42
|
-
|
|
43
|
-
- name: Push to protected branch
|
|
44
|
-
uses: CasperWA/push-protected@v2
|
|
45
|
-
with:
|
|
46
|
-
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
|
|
47
|
-
branch: packaging
|
|
48
|
-
unprotect_reviews: true
|
|
49
|
-
|
|
50
|
-
- name: Read version changelog
|
|
51
|
-
uses: superfaceai/release-changelog-action@v2
|
|
52
|
-
id: get-changelog
|
|
53
|
-
with:
|
|
54
|
-
version: ${{ env.NEW_VERSION }}
|
|
55
|
-
operation: read
|
|
56
|
-
|
|
57
|
-
- name: Push changes to repository
|
|
58
|
-
run: git push origin && git push --tags
|
|
59
|
-
|
|
60
|
-
- name: Create GitHub release
|
|
61
|
-
uses: softprops/action-gh-release@v1
|
|
62
|
-
with:
|
|
63
|
-
tag_name: ${{ env.NEW_VERSION }}
|
|
64
|
-
body: ${{ steps.get-changelog.outputs.changelog }}
|
|
65
|
-
token: ${{ secrets.RELEASE_BOT_GITHUB_TOKEN }}
|
|
66
|
-
|
|
67
|
-
- name: Publish version to NPM public repository
|
|
68
|
-
uses: JS-DevTools/npm-publish@v1
|
|
69
|
-
with:
|
|
70
|
-
token: ${{ secrets.NPMJS_ACCESS_TOKEN }}
|
|
71
|
-
dryRun: true
|