From ebda45284be4e3997dfaa67d03a3a0b3f954ca60 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Mon, 28 Mar 2022 23:03:21 +0900 Subject: [PATCH 1/8] docs: move section for supporting documents --- docs/index.html | 120 ++++++++++++++++++++++++------------------------ 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/docs/index.html b/docs/index.html index cf32147d1..d8831ad37 100644 --- a/docs/index.html +++ b/docs/index.html @@ -532,64 +532,6 @@
Sample Steel Workflow
Origin, Steel Import License, Mill Test Report, and Commercial Invoice. Data is verified by CBP’s automated processes.

- -
Featured Steel Credentials
-
-
Mill Test Report Certificate
-
-

The Mill Test Report - certifies steel type and quality, listing chemical and mechanical - properties.

-
-
Commercial Invoice Certificate
-
-
- Commercial Invoice example -
Sample Commercial Invoice
-
-

- Commercial Invoice - indicates to authorities the value of goods subject to tariffs - and duties. -

-
-
Bill of Lading Certificate
-
-
- Bill of Lading example -
Sample Bill of Lading
-
-

- Bill of Lading certificates - are issued by the carrier, indicating a) receipt of goods, b) evidence - of consignment contract, and c) title of goods. -

-
-
Verifiable Business Card
-
-

- Verifiable Business Cards hold - verifiable presentation endpoint addresses. -

-
- -
USMCA Certificate Of Origin
-
-
- USMCA Certificate Of Origin -
USMCA Certificate Of Origin
-
-

- The USMCA Certificate Of Origin - schema is adapted from - - FedEx's and UPS's - USMCA Forms, implementing the - United States - Mexico - Canada - Agreement (USMCA). -

-
-
@@ -732,8 +674,66 @@
Sample E-Commerce Workflow
are cross referenced; commercial and physical provenance is verified; and CBP’s automated processes can issue Import Approval (13) documentation for presentation back to the Express Carrier (14) well in advance of the goods arrival. -

-
Featured E-Commerce Credentials
+

+
+
+
Featured Credentials
+
+
Mill Test Report Certificate
+
+

The Mill Test Report + certifies steel type and quality, listing chemical and mechanical + properties.

+
+
Commercial Invoice Certificate
+
+
+ Commercial Invoice example +
Sample Commercial Invoice
+
+

+ Commercial Invoice + indicates to authorities the value of goods subject to tariffs + and duties. +

+
+
Bill of Lading Certificate
+
+
+ Bill of Lading example +
Sample Bill of Lading
+
+

+ Bill of Lading certificates + are issued by the carrier, indicating a) receipt of goods, b) evidence + of consignment contract, and c) title of goods. +

+
+
Verifiable Business Card
+
+

+ Verifiable Business Cards hold + verifiable presentation endpoint addresses. +

+
+ +
USMCA Certificate Of Origin
+
+
+ USMCA Certificate Of Origin +
USMCA Certificate Of Origin
+
+

+ The USMCA Certificate Of Origin + schema is adapted from + + FedEx's and UPS's + USMCA Forms, implementing the + United States - Mexico - Canada + Agreement (USMCA). +

+
+
Purchase Order
From ce2c658377066f606d4e0cae6c828a04448302ef Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Mon, 28 Mar 2022 23:04:37 +0900 Subject: [PATCH 2/8] docs: change name of image section --- docs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index d8831ad37..35a0bb674 100644 --- a/docs/index.html +++ b/docs/index.html @@ -677,7 +677,7 @@
Sample E-Commerce Workflow

-
Featured Credentials
+
Supporting Documents
Mill Test Report Certificate
From 0f69f03bb685d8d520a09305e0681c26c9501d39 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Mon, 28 Mar 2022 23:11:25 +0900 Subject: [PATCH 3/8] docs: relocate terms from script to doc --- docs/index.html | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index 35a0bb674..45eecf1cc 100644 --- a/docs/index.html +++ b/docs/index.html @@ -442,7 +442,27 @@

Vocabulary Linkage

defined in a industry-specific vocabulary. This is to ensure the broadest possible interoperability, within and beyond supply chain.

-
+ + +
+

Open API

+

+ This vocabulary can also be viewed as an + Open API Specification. +

+
+ +
+

Undefined Terms

+

+ This vocabulary uses + '@vocab': 'https://w3id.org/traceability/#undefinedTerm' + to disable JSON-LD related errors associated with Verifiable Credentials, + issued about terms that have not yet been added here. +

+
+ +
From 1d7b12b9fb36dbc0a87ad2a8d097ea883ab86921 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Mon, 28 Mar 2022 23:17:53 +0900 Subject: [PATCH 4/8] docs: make each vocab its own section --- .../scripts/schemas-to-vocab.js | 30 ++++--------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/packages/traceability-schemas/scripts/schemas-to-vocab.js b/packages/traceability-schemas/scripts/schemas-to-vocab.js index e4cda5a69..7a72c820c 100644 --- a/packages/traceability-schemas/scripts/schemas-to-vocab.js +++ b/packages/traceability-schemas/scripts/schemas-to-vocab.js @@ -91,34 +91,14 @@ const buildVocabSection = (schema) => { return buildProperty(schema); }; -(async () => { +(() => { console.log('🧪 build vocab from schemas'); const sections = schemas.map(buildVocabSection).join('\n'); const section = ` -
-

Vocabulary

- -
-

Open API

-

- This vocabulary can also be viewed as an - Open API Specification. -

-
- -
-

Undefined Terms

-

This vocabulary uses '@vocab': 'https://w3id.org/traceability/#undefinedTerm' - to disable JSON-LD related errors associated with Verifiable Credentials, issued about - terms that have not yet been added here. -

-
- -
-

Defined Terms

-${sections} -
-
+
+

Vocabulary

+ ${sections} +
`; fs.writeFileSync(vocabPath, section); })(); From 298b8a6fcaef1cb7462020fd89e8af49036b5d46 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Mon, 28 Mar 2022 23:24:07 +0900 Subject: [PATCH 5/8] docs: create credentials section --- docs/index.html | 6 ++- .../scripts/schemas-to-vocab.js | 44 +++++++++++++++++-- 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/docs/index.html b/docs/index.html index 45eecf1cc..d9571f1c4 100644 --- a/docs/index.html +++ b/docs/index.html @@ -806,7 +806,11 @@
Supporting Documents
- + +
{ return buildProperty(schema); }; +const separateSchemas = (schemaList) => { + // Define Arrays to sort the schemas into + const credentialSchemas = []; + const vocabSchemas = []; + + // Separates Schemas into Credentials and Vocabulary + schemaList.forEach((schema) => { + const { example } = schema; + const obj = JSON.parse(example); + const type = Array.isArray(obj.type) ? obj.type : [obj.type]; + if (type.indexOf('VerifiableCredential') === -1) { + vocabSchemas.push(schema); + } else { + credentialSchemas.push(schema); + } + }); + + // Generate the text for each respective section + const credentials = credentialSchemas.map(buildVocabSection).join('\n'); + const vocab = vocabSchemas.map(buildVocabSection).join('\n'); + + // Return the html text for each section + return { credentials, vocab }; +}; + (() => { console.log('🧪 build vocab from schemas'); - const sections = schemas.map(buildVocabSection).join('\n'); - const section = ` + const { credentials, vocab } = separateSchemas(schemas); + + const credentialSection = ` +
+

Credentials

+ ${credentials} +
+ `; + + const vocabSection = `

Vocabulary

- ${sections} + ${vocab}
`; - fs.writeFileSync(vocabPath, section); + + fs.writeFileSync(credentialPath, credentialSection); + fs.writeFileSync(vocabPath, vocabSection); })(); From a1e963b338ae2c53fa9915861dd0acfd23db1841 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Mon, 28 Mar 2022 23:25:09 +0900 Subject: [PATCH 6/8] chore: add credential html to ignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 59ec36b78..9bad78cfd 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,8 @@ docs/schemas docs/traceability-openapi-v1.json docs/intermediate.json docs/sections/vocab.html +docs/sections/credentials.html docs/testsuite/index.html docs/openapi/openapi.yml -packages/traceability-schemas/data/*.json \ No newline at end of file +packages/traceability-schemas/data/*.json From 331c6822a1a8ce5b319e97fb125e32bc6e16eb42 Mon Sep 17 00:00:00 2001 From: Benjamin Collins Date: Mon, 28 Mar 2022 23:28:26 +0900 Subject: [PATCH 7/8] chore: fix linting erros --- packages/traceability-schemas/scripts/schemas-to-vocab.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/traceability-schemas/scripts/schemas-to-vocab.js b/packages/traceability-schemas/scripts/schemas-to-vocab.js index 7e214b9e2..832c2e33d 100644 --- a/packages/traceability-schemas/scripts/schemas-to-vocab.js +++ b/packages/traceability-schemas/scripts/schemas-to-vocab.js @@ -21,15 +21,14 @@ const buildLinkedDataTable = (schema) => { ${$linkedData['@id']} - ${ - $id + ${$id ? ` schema ${baseUrl + $id} ` : '' - } + } @@ -119,7 +118,7 @@ const separateSchemas = (schemaList) => { (() => { console.log('🧪 build vocab from schemas'); - const { credentials, vocab } = separateSchemas(schemas); + const { credentials, vocab } = separateSchemas(schemas); const credentialSection = `
From 3e3a80c9a6963a89c9f24421cadd473c732dac12 Mon Sep 17 00:00:00 2001 From: Benjamin Collins <86194145+BenjaminMoe@users.noreply.github.com> Date: Mon, 28 Mar 2022 23:32:37 +0900 Subject: [PATCH 8/8] Update docs/index.html Co-authored-by: Ted Thibodeau Jr --- docs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index.html b/docs/index.html index d9571f1c4..9015dbb22 100644 --- a/docs/index.html +++ b/docs/index.html @@ -457,7 +457,7 @@

Undefined Terms

This vocabulary uses '@vocab': 'https://w3id.org/traceability/#undefinedTerm' - to disable JSON-LD related errors associated with Verifiable Credentials, + to disable JSON-LD related errors associated with Verifiable Credentials, issued about terms that have not yet been added here.