diff --git a/packages/traceability-schemas/schemas/Event.json b/packages/traceability-schemas/schemas/Event.json new file mode 100644 index 000000000..805f4eef8 --- /dev/null +++ b/packages/traceability-schemas/schemas/Event.json @@ -0,0 +1,67 @@ +{ + "$id": "https://w3id.org/traceability/schemas/Event.json", + "$schema": "https://json-schema.org/draft-07/schema#", + "$comment": "{\"term\": \"Event\", \"@id\": \"https://schema.org/Event\"}", + "title": "Organization", + "description": "An event such as a transformation, aggregation, commission, etc.", + "type": "object", + "properties": { + "@context": { + "type": "array" + }, + "type": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array" + } + ] + }, + "eventType": { + "$comment": "{\"term\": \"eventType\", \"@id\": \"https://schema.org/value\"}", + "title": "Event Type", + "description": "The Type of the Event.", + "type": "string" + }, + "eventId": { + "$comment": "{\"term\": \"eventId\", \"@id\": \"https://schema.org/identifier\"}", + "title": "Event Identifier", + "description": "The Identifier of the Event.", + "type": "string" + }, + "actor": { + "$comment": "{\"term\": \"actor\", \"@id\": \"https://w3id.org/traceability#Organization\", \"@type\": \"https://schema.org/ItemList\"}", + "title": "Actor", + "description": "The organization performing the activity.", + "type": "array", + "items": { + "$ref": "https://w3id.org/traceability/schemas/Entity.json" + } + }, + "place": { + "$comment": "{\"term\": \"place\", \"@id\": \"https://w3id.org/traceability#place\"}", + "title": "Event Location", + "description": "The location where the event took place.", + "$ref": "https://w3id.org/traceability/schemas/Place.json" + }, + "eventTime": { + "$comment": "{\"term\": \"eventTime\", \"@id\": \"https://schema.org/DateTime#v2\"}", + "title": "Event Time", + "description": "The time when the event took place.", + "type": "string" + }, + "products": { + "$comment": "{\"term\": \"products\", \"@id\": \"https://schema.org/Product\"}", + "title": "Products", + "description": "The products referenced by the event.", + "type": "array", + "items": { + "$ref": "https://w3id.org/traceability/schemas/Product.json" + } + } + }, + "additionalProperties": false, + "examples": [] +} diff --git a/packages/traceability-schemas/src/__fixtures__/Event/bad.json b/packages/traceability-schemas/src/__fixtures__/Event/bad.json new file mode 100644 index 000000000..14c9e730b --- /dev/null +++ b/packages/traceability-schemas/src/__fixtures__/Event/bad.json @@ -0,0 +1,144 @@ +[ + { + "circuit": "bypass", + "sensor": "synthesize" + }, + { + "@context": [ + "https://w3id.org/traceability/v1" + ], + "type": "Event", + "eventType": "commission", + "actor": [ + { + "type": "Organization", + "name": "Rowe Inc", + "description": "Realigned directional framework", + "address": { + "type": "PostalAddress", + "streetAddress": "859 Leannon Hill", + "addressLocality": "Port Aryanna", + "addressRegion": "Ohio", + "postalCode": "65217-4733", + "addressCountry": "Macedonia" + }, + "email": "Amina.Abbott95@example.com", + "phoneNumber": "555-535-6270", + "faxNumber": "555-365-1076" + }, + { + "type": "Organization", + "name": "Shanahan, Waelchi and Beier", + "description": "Extended the explicit framework.", + "address": { + "type": "PostalAddress", + "streetAddress": "1456 Hermiston Dale", + "addressLocality": "Predovicland", + "addressRegion": "New Hampshire", + "postalCode": "33475-5040", + "addressCountry": "Chad" + }, + "email": "Keshaun_Kuvalis94@example.net", + "phoneNumber": "555-893-6731", + "faxNumber": "555-170-9772" + } + ], + "place": { + "type": "Place", + "globalLocationNumber": "9213394765603", + "geo": { + "type": "GeoCoordinates", + "latitude": "67.2831", + "longitude": "-148.8169" + }, + "address": { + "type": "PostalAddress", + "organizationName": "Ortiz - Kessler", + "streetAddress": "3470 Fritsch Glen", + "addressLocality": "Hermistonview", + "addressRegion": "Florida", + "postalCode": "63684", + "addressCountry": "Saint Helena" + } + }, + "products": [ + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Heloise", + "lastName": "Kuvalis", + "email": "Mohammad52@example.org", + "phoneNumber": "555-631-4341", + "worksFor": { + "type": "Organization", + "name": "Runolfsdottir LLC", + "description": "Ergonomic 6th generation algorithm", + "address": { + "type": "PostalAddress", + "streetAddress": "27995 Kathlyn Lock", + "addressLocality": "Tyrelborough", + "addressRegion": "Hawaii", + "postalCode": "55412-1858", + "addressCountry": "United Arab Emirates" + }, + "email": "Bart_Lehner19@example.net", + "phoneNumber": "555-803-3775", + "faxNumber": "555-275-8825" + }, + "jobTitle": "Regional Branding Analyst" + }, + "name": "Tasty Wooden Ball", + "description": "New range of formal shirts, designed keeping you in mind, with fits and styling that will make you stand apart.", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "5413" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "8186" + }, + "sku": "71119993108" + }, + { + "type": "Product", + "manufacturer": { + "type": "Organization", + "name": "Farrell, Schimmel and Mills", + "description": "Networked neutral superstructure", + "address": { + "type": "PostalAddress", + "streetAddress": "448 Malvina Crossing", + "addressLocality": "Lefflershire", + "addressRegion": "New York", + "postalCode": "34965", + "addressCountry": "El Salvador" + }, + "email": "Dolores.Kuphal@example.org", + "phoneNumber": "555-176-4663", + "faxNumber": "555-504-7099" + }, + "name": "Handcrafted Fresh Pizza", + "description": "The Nagasaki Lander is the trademarked name of several series of Nagasaki sport bikes, that started with the 1984 ABC800J.", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "7247" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "1903" + }, + "sku": "88782379145" + } + ], + "interface": "override", + "system": "compress" + }, + { + "panel": "quantify" + } +] diff --git a/packages/traceability-schemas/src/__fixtures__/Event/credential.json b/packages/traceability-schemas/src/__fixtures__/Event/credential.json new file mode 100644 index 000000000..b0b0eb22c --- /dev/null +++ b/packages/traceability-schemas/src/__fixtures__/Event/credential.json @@ -0,0 +1,155 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/traceability/v1" + ], + "id": "http://example.org/credentials/", + "type": [ + "VerifiableCredential" + ], + "issuanceDate": "2021-02-04T20:29:37+00:00", + "issuer": "did:key:z6MktHQo3fRRohk44dsbE76CuiTpBmyMWq2VVjvV6aBSeE3U", + "credentialSubject": { + "@context": [ + "https://w3id.org/traceability/v1" + ], + "type": "Event", + "eventType": "commission", + "eventId": "12345", + "actor": [ + { + "type": "Organization", + "name": "White, Howell and Runolfsson", + "description": "Seamless didactic initiative", + "address": { + "type": "PostalAddress", + "streetAddress": "81311 Torphy Groves", + "addressLocality": "Lake Taylor", + "addressRegion": "Oregon", + "postalCode": "75298-4103", + "addressCountry": "Equatorial Guinea" + }, + "email": "Chester_Reichert25@example.com", + "phoneNumber": "555-628-4924", + "faxNumber": "555-192-2412" + }, + { + "type": "Organization", + "name": "Keeling - Bergnaum", + "description": "Face to face intermediate matrix", + "address": { + "type": "PostalAddress", + "streetAddress": "656 Buckridge Oval", + "addressLocality": "Cassinhaven", + "addressRegion": "Nebraska", + "postalCode": "27027-6015", + "addressCountry": "Cambodia" + }, + "email": "Amari43@example.net", + "phoneNumber": "555-585-9995", + "faxNumber": "555-971-6601" + } + ], + "place": { + "type": "Place", + "globalLocationNumber": "1295710388268", + "geo": { + "type": "GeoCoordinates", + "latitude": "-0.1494", + "longitude": "146.3952" + }, + "address": { + "type": "PostalAddress", + "organizationName": "Dicki - Berge", + "streetAddress": "7420 Wunsch Rapids", + "addressLocality": "New Marlon", + "addressRegion": "Vermont", + "postalCode": "92487-0853", + "addressCountry": "Bangladesh" + } + }, + "eventTime": "", + "products": [ + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Anna", + "lastName": "Gusikowski", + "email": "Hallie38@example.net", + "phoneNumber": "555-349-6434", + "worksFor": { + "type": "Organization", + "name": "Dietrich, Bruen and Kulas", + "description": "Expanded web-enabled initiative", + "address": { + "type": "PostalAddress", + "streetAddress": "2846 Kasey Squares", + "addressLocality": "Mabelside", + "addressRegion": "Pennsylvania", + "postalCode": "61557-1756", + "addressCountry": "Lao People's Democratic Republic" + }, + "email": "Roderick71@example.com", + "phoneNumber": "555-423-6603", + "faxNumber": "555-465-1090" + }, + "jobTitle": "Principal Division Liaison" + }, + "name": "Rustic Concrete Hat", + "description": "New range of formal shirts, designed keeping you in mind, with fits and styling that will make you stand apart.", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "3725" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "268" + }, + "sku": "962958370089" + }, + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Pearl", + "lastName": "Williamson", + "email": "Marian_Bergstrom72@example.org", + "phoneNumber": "555-290-5245", + "worksFor": { + "type": "Organization", + "name": "Sporer - Rogahn", + "description": "Re-contextualized composite utilisation", + "address": { + "type": "PostalAddress", + "streetAddress": "8000 Edmund Prairie", + "addressLocality": "Macejkovicside", + "addressRegion": "Indiana", + "postalCode": "36902-7880", + "addressCountry": "Seychelles" + }, + "email": "Carley62@example.com", + "phoneNumber": "555-181-5576", + "faxNumber": "555-869-3096" + }, + "jobTitle": "Lead Mobility Assistant" + }, + "name": "Refined Rubber Bike", + "description": "The beautiful range of Apple Naturalé has an exciting mix of natural ingredients, with the Goodness of 100% Natural Ingredients", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "3660" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "8418" + }, + "sku": "115514706525" + } + ] + } +} diff --git a/packages/traceability-schemas/src/__fixtures__/Event/good.json b/packages/traceability-schemas/src/__fixtures__/Event/good.json new file mode 100644 index 000000000..6d8259517 --- /dev/null +++ b/packages/traceability-schemas/src/__fixtures__/Event/good.json @@ -0,0 +1,423 @@ +[ + { + "@context": [ + "https://w3id.org/traceability/v1" + ], + "type": "Event", + "eventType": "commission", + "eventId": "12345", + "actor": [ + { + "type": "Organization", + "name": "White, Howell and Runolfsson", + "description": "Seamless didactic initiative", + "address": { + "type": "PostalAddress", + "streetAddress": "81311 Torphy Groves", + "addressLocality": "Lake Taylor", + "addressRegion": "Oregon", + "postalCode": "75298-4103", + "addressCountry": "Equatorial Guinea" + }, + "email": "Chester_Reichert25@example.com", + "phoneNumber": "555-628-4924", + "faxNumber": "555-192-2412" + }, + { + "type": "Organization", + "name": "Keeling - Bergnaum", + "description": "Face to face intermediate matrix", + "address": { + "type": "PostalAddress", + "streetAddress": "656 Buckridge Oval", + "addressLocality": "Cassinhaven", + "addressRegion": "Nebraska", + "postalCode": "27027-6015", + "addressCountry": "Cambodia" + }, + "email": "Amari43@example.net", + "phoneNumber": "555-585-9995", + "faxNumber": "555-971-6601" + } + ], + "place": { + "type": "Place", + "globalLocationNumber": "1295710388268", + "geo": { + "type": "GeoCoordinates", + "latitude": "-0.1494", + "longitude": "146.3952" + }, + "address": { + "type": "PostalAddress", + "organizationName": "Dicki - Berge", + "streetAddress": "7420 Wunsch Rapids", + "addressLocality": "New Marlon", + "addressRegion": "Vermont", + "postalCode": "92487-0853", + "addressCountry": "Bangladesh" + } + }, + "eventTime": "", + "products": [ + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Anna", + "lastName": "Gusikowski", + "email": "Hallie38@example.net", + "phoneNumber": "555-349-6434", + "worksFor": { + "type": "Organization", + "name": "Dietrich, Bruen and Kulas", + "description": "Expanded web-enabled initiative", + "address": { + "type": "PostalAddress", + "streetAddress": "2846 Kasey Squares", + "addressLocality": "Mabelside", + "addressRegion": "Pennsylvania", + "postalCode": "61557-1756", + "addressCountry": "Lao People's Democratic Republic" + }, + "email": "Roderick71@example.com", + "phoneNumber": "555-423-6603", + "faxNumber": "555-465-1090" + }, + "jobTitle": "Principal Division Liaison" + }, + "name": "Rustic Concrete Hat", + "description": "New range of formal shirts are designed keeping you in mind. With fits and styling that will make you stand apart", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "3725" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "268" + }, + "sku": "962958370089" + }, + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Pearl", + "lastName": "Williamson", + "email": "Marian_Bergstrom72@example.org", + "phoneNumber": "555-290-5245", + "worksFor": { + "type": "Organization", + "name": "Sporer - Rogahn", + "description": "Re-contextualized composite utilisation", + "address": { + "type": "PostalAddress", + "streetAddress": "8000 Edmund Prairie", + "addressLocality": "Macejkovicside", + "addressRegion": "Indiana", + "postalCode": "36902-7880", + "addressCountry": "Seychelles" + }, + "email": "Carley62@example.com", + "phoneNumber": "555-181-5576", + "faxNumber": "555-869-3096" + }, + "jobTitle": "Lead Mobility Assistant" + }, + "name": "Refined Rubber Bike", + "description": "The beautiful range of Apple Naturalé that has an exciting mix of natural ingredients. With the Goodness of 100% Natural Ingredients", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "3660" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "8418" + }, + "sku": "115514706525" + } + ] + }, + { + "@context": [ + "https://w3id.org/traceability/v1" + ], + "type": "Event", + "eventType": "commission", + "eventId": "12345", + "actor": [ + { + "type": "Organization", + "name": "Rowe Inc", + "description": "Realigned directional framework", + "address": { + "type": "PostalAddress", + "streetAddress": "859 Leannon Hill", + "addressLocality": "Port Aryanna", + "addressRegion": "Ohio", + "postalCode": "65217-4733", + "addressCountry": "Macedonia" + }, + "email": "Amina.Abbott95@example.com", + "phoneNumber": "555-535-6270", + "faxNumber": "555-365-1076" + }, + { + "type": "Organization", + "name": "Shanahan, Waelchi and Beier", + "description": "Extended explicit framework", + "address": { + "type": "PostalAddress", + "streetAddress": "1456 Hermiston Dale", + "addressLocality": "Predovicland", + "addressRegion": "New Hampshire", + "postalCode": "33475-5040", + "addressCountry": "Chad" + }, + "email": "Keshaun_Kuvalis94@example.net", + "phoneNumber": "555-893-6731", + "faxNumber": "555-170-9772" + } + ], + "place": { + "type": "Place", + "globalLocationNumber": "9213394765603", + "geo": { + "type": "GeoCoordinates", + "latitude": "67.2831", + "longitude": "-148.8169" + }, + "address": { + "type": "PostalAddress", + "organizationName": "Ortiz - Kessler", + "streetAddress": "3470 Fritsch Glen", + "addressLocality": "Hermistonview", + "addressRegion": "Florida", + "postalCode": "63684", + "addressCountry": "Saint Helena" + } + }, + "eventTime": "", + "products": [ + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Heloise", + "lastName": "Kuvalis", + "email": "Mohammad52@example.org", + "phoneNumber": "555-631-4341", + "worksFor": { + "type": "Organization", + "name": "Runolfsdottir LLC", + "description": "Ergonomic 6th generation algorithm", + "address": { + "type": "PostalAddress", + "streetAddress": "27995 Kathlyn Lock", + "addressLocality": "Tyrelborough", + "addressRegion": "Hawaii", + "postalCode": "55412-1858", + "addressCountry": "United Arab Emirates" + }, + "email": "Bart_Lehner19@example.net", + "phoneNumber": "555-803-3775", + "faxNumber": "555-275-8825" + }, + "jobTitle": "Regional Branding Analyst" + }, + "name": "Tasty Wooden Ball", + "description": "New range of formal shirts are designed keeping you in mind. With fits and styling that will make you stand apart", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "5413" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "8186" + }, + "sku": "71119993108" + }, + { + "type": "Product", + "manufacturer": { + "type": "Organization", + "name": "Farrell, Schimmel and Mills", + "description": "Networked neutral superstructure", + "address": { + "type": "PostalAddress", + "streetAddress": "448 Malvina Crossing", + "addressLocality": "Lefflershire", + "addressRegion": "New York", + "postalCode": "34965", + "addressCountry": "El Salvador" + }, + "email": "Dolores.Kuphal@example.org", + "phoneNumber": "555-176-4663", + "faxNumber": "555-504-7099" + }, + "name": "Handcrafted Fresh Pizza", + "description": "The Nagasaki Lander is the trademarked name of several series of Nagasaki sport bikes, that started with the 1984 ABC800J", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "7247" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "1903" + }, + "sku": "88782379145" + } + ] + }, + { + "@context": [ + "https://w3id.org/traceability/v1" + ], + "type": "Event", + "eventType": "commission", + "eventId": "12345", + "actor": [ + { + "type": "Organization", + "name": "Schiller Inc", + "description": "Extended encompassing moderator", + "address": { + "type": "PostalAddress", + "streetAddress": "13017 Kiana Green", + "addressLocality": "South Raheem", + "addressRegion": "Louisiana", + "postalCode": "77837", + "addressCountry": "Bangladesh" + }, + "email": "Schuyler6@example.net", + "phoneNumber": "555-398-9393", + "faxNumber": "555-769-4550" + }, + { + "type": "Organization", + "name": "Schmeler Group", + "description": "Self-enabling composite Graphical User Interface", + "address": { + "type": "PostalAddress", + "streetAddress": "6528 Legros Oval", + "addressLocality": "New Sedrick", + "addressRegion": "Idaho", + "postalCode": "80356-5043", + "addressCountry": "French Guiana" + }, + "email": "Ebony56@example.net", + "phoneNumber": "555-416-7135", + "faxNumber": "555-589-2870" + } + ], + "place": { + "type": "Place", + "globalLocationNumber": "5340621766790", + "geo": { + "type": "GeoCoordinates", + "latitude": "39.5243", + "longitude": "58.2697" + }, + "address": { + "type": "PostalAddress", + "organizationName": "Hermiston - Monahan", + "streetAddress": "323 Rodriguez Parkway", + "addressLocality": "West Danikaburgh", + "addressRegion": "Massachusetts", + "postalCode": "88792", + "addressCountry": "Malta" + } + }, + "eventTime": "", + "products": [ + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Ruthie", + "lastName": "Schoen", + "email": "Jaeden1@example.com", + "phoneNumber": "555-594-9653", + "worksFor": { + "type": "Organization", + "name": "Shields, Rodriguez and Keebler", + "description": "Assimilated methodical local area network", + "address": { + "type": "PostalAddress", + "streetAddress": "0424 Senger Road", + "addressLocality": "Lake Adolphbury", + "addressRegion": "Delaware", + "postalCode": "74224", + "addressCountry": "France" + }, + "email": "Pamela8@example.org", + "phoneNumber": "555-632-7950", + "faxNumber": "555-898-1679" + }, + "jobTitle": "Chief Group Director" + }, + "name": "Handmade Frozen Mouse", + "description": "Ergonomic executive chair upholstered in bonded black leather and PVC padded seat and back for all-day comfort and support", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "1618" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "5636" + }, + "sku": "888534407936" + }, + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Jamarcus", + "lastName": "Grant", + "email": "Dylan60@example.org", + "phoneNumber": "555-923-9992", + "worksFor": { + "type": "Organization", + "name": "McGlynn Inc", + "description": "Devolved 24 hour toolset", + "address": { + "type": "PostalAddress", + "streetAddress": "71756 Jasen Throughway", + "addressLocality": "Zanehaven", + "addressRegion": "North Dakota", + "postalCode": "07994", + "addressCountry": "Qatar" + }, + "email": "Chanelle57@example.com", + "phoneNumber": "555-358-2027", + "faxNumber": "555-602-5664" + }, + "jobTitle": "Corporate Brand Specialist" + }, + "name": "Awesome Frozen Hat", + "description": "New ABC 13 9370, 13.3, 5th Gen CoreA5-8250U, 8GB RAM, 256GB SSD, power UHD Graphics, OS 10 Home, OS Office A & J 2016", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "7931" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "9059" + }, + "sku": "610735670417" + } + ] + } +] \ No newline at end of file diff --git a/packages/traceability-schemas/src/__fixtures__/Event/vc.json b/packages/traceability-schemas/src/__fixtures__/Event/vc.json new file mode 100644 index 000000000..75afc49f3 --- /dev/null +++ b/packages/traceability-schemas/src/__fixtures__/Event/vc.json @@ -0,0 +1,162 @@ +{ + "@context": [ + "https://www.w3.org/2018/credentials/v1", + "https://w3id.org/traceability/v1" + ], + "id": "http://example.org/credentials/", + "type": [ + "VerifiableCredential" + ], + "issuanceDate": "2021-02-04T20:29:37+00:00", + "issuer": "did:key:z6MktHQo3fRRohk44dsbE76CuiTpBmyMWq2VVjvV6aBSeE3U", + "credentialSubject": { + "@context": [ + "https://w3id.org/traceability/v1" + ], + "type": "Event", + "eventType": "commission", + "eventId": "12345", + "actor": [ + { + "type": "Organization", + "name": "White, Howell and Runolfsson", + "description": "Seamless didactic initiative", + "address": { + "type": "PostalAddress", + "streetAddress": "81311 Torphy Groves", + "addressLocality": "Lake Taylor", + "addressRegion": "Oregon", + "postalCode": "75298-4103", + "addressCountry": "Equatorial Guinea" + }, + "email": "Chester_Reichert25@example.com", + "phoneNumber": "555-628-4924", + "faxNumber": "555-192-2412" + }, + { + "type": "Organization", + "name": "Keeling - Bergnaum", + "description": "Face to face intermediate matrix", + "address": { + "type": "PostalAddress", + "streetAddress": "656 Buckridge Oval", + "addressLocality": "Cassinhaven", + "addressRegion": "Nebraska", + "postalCode": "27027-6015", + "addressCountry": "Cambodia" + }, + "email": "Amari43@example.net", + "phoneNumber": "555-585-9995", + "faxNumber": "555-971-6601" + } + ], + "place": { + "type": "Place", + "globalLocationNumber": "1295710388268", + "geo": { + "type": "GeoCoordinates", + "latitude": "-0.1494", + "longitude": "146.3952" + }, + "address": { + "type": "PostalAddress", + "organizationName": "Dicki - Berge", + "streetAddress": "7420 Wunsch Rapids", + "addressLocality": "New Marlon", + "addressRegion": "Vermont", + "postalCode": "92487-0853", + "addressCountry": "Bangladesh" + } + }, + "eventTime": "", + "products": [ + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Anna", + "lastName": "Gusikowski", + "email": "Hallie38@example.net", + "phoneNumber": "555-349-6434", + "worksFor": { + "type": "Organization", + "name": "Dietrich, Bruen and Kulas", + "description": "Expanded web-enabled initiative", + "address": { + "type": "PostalAddress", + "streetAddress": "2846 Kasey Squares", + "addressLocality": "Mabelside", + "addressRegion": "Pennsylvania", + "postalCode": "61557-1756", + "addressCountry": "Lao People's Democratic Republic" + }, + "email": "Roderick71@example.com", + "phoneNumber": "555-423-6603", + "faxNumber": "555-465-1090" + }, + "jobTitle": "Principal Division Liaison" + }, + "name": "Rustic Concrete Hat", + "description": "New range of formal shirts are designed keeping you in mind. With fits and styling that will make you stand apart", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "3725" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "268" + }, + "sku": "962958370089" + }, + { + "type": "Product", + "manufacturer": { + "type": "Person", + "firstName": "Pearl", + "lastName": "Williamson", + "email": "Marian_Bergstrom72@example.org", + "phoneNumber": "555-290-5245", + "worksFor": { + "type": "Organization", + "name": "Sporer - Rogahn", + "description": "Re-contextualized composite utilisation", + "address": { + "type": "PostalAddress", + "streetAddress": "8000 Edmund Prairie", + "addressLocality": "Macejkovicside", + "addressRegion": "Indiana", + "postalCode": "36902-7880", + "addressCountry": "Seychelles" + }, + "email": "Carley62@example.com", + "phoneNumber": "555-181-5576", + "faxNumber": "555-869-3096" + }, + "jobTitle": "Lead Mobility Assistant" + }, + "name": "Refined Rubber Bike", + "description": "The beautiful range of Apple Naturalé that has an exciting mix of natural ingredients. With the Goodness of 100% Natural Ingredients", + "sizeOrAmount": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "3660" + }, + "weight": { + "type": "QuantitativeValue", + "unitCode": "hg/ha", + "value": "8418" + }, + "sku": "115514706525" + } + ] + }, + "proof": { + "type": "Ed25519Signature2018", + "created": "2019-12-11T03:50:55Z", + "jws": "eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..XMQeKunpJptw8EAs_OjpaEMmBJ-kn4Tqt8OAFvq2AAG7uiddUnG6Qlx7b8mYBjl47Ns7hnvopuihdd5eQnSeAA", + "proofPurpose": "assertionMethod", + "verificationMethod": "did:key:z6MktHQo3fRRohk44dsbE76CuiTpBmyMWq2VVjvV6aBSeE3U#z6MktHQo3fRRohk44dsbE76CuiTpBmyMWq2VVjvV6aBSeE3U" + } +} \ No newline at end of file diff --git a/packages/traceability-schemas/src/generators/Event.js b/packages/traceability-schemas/src/generators/Event.js new file mode 100644 index 000000000..f8c37734e --- /dev/null +++ b/packages/traceability-schemas/src/generators/Event.js @@ -0,0 +1,32 @@ +const { getEntity } = require('./Entity'); +const { getPlace } = require('./Place'); +const { getProduct } = require('./Product'); + +const getEvent = () => { + const eventType = 'commission'; + const eventId = '12345'; + const actor = [getEntity(), getEntity()]; + + delete actor[0]['@context']; + delete actor[1]['@context']; + const place = getPlace(); + delete place['@context']; + const eventTime = '2019-12-11T03:50:55Z'; + const products = [getProduct(), getProduct()]; + delete products[0]['@context']; + delete products[1]['@context']; + + const example = { + '@context': ['https://w3id.org/traceability/v1'], + type: 'Event', + eventType, + eventId, + actor, + place, + eventTime, + products, + }; + return example; +}; + +module.exports = { getEvent }; diff --git a/packages/traceability-schemas/src/generators/OGBillOfLading.js b/packages/traceability-schemas/src/generators/OGBillOfLading.js index d9c67b40d..3df0dc379 100644 --- a/packages/traceability-schemas/src/generators/OGBillOfLading.js +++ b/packages/traceability-schemas/src/generators/OGBillOfLading.js @@ -2,6 +2,7 @@ const _ = require('lodash'); const { generator, schemas } = require('../data/util/data'); const { getBillOfLading } = require('./BillOfLading'); +const { getMeasuredValue } = require('./MeasuredValue'); const { getObservation } = require('./Observation'); const { getPlace } = require('./Place'); @@ -61,8 +62,8 @@ const getOGBillOfLading = () => { totalOrderValue: '1500', freightChargeTerms: 'Freight Prepaid', batchNumber: '12345678', - openingVolume: '123', - closingVolume: '222', + openingVolume: getMeasuredValue(), + closingVolume: getMeasuredValue(), observation, }; const validate = ajv.compile(schemas.OGBillOfLading); diff --git a/packages/traceability-schemas/typings.d.ts b/packages/traceability-schemas/typings.d.ts index a682d12ad..c4f4b37d4 100644 --- a/packages/traceability-schemas/typings.d.ts +++ b/packages/traceability-schemas/typings.d.ts @@ -35,6 +35,7 @@ EcommerceWayBillRegistrationCredential: require('./schemas/EcommerceWayBillRegis EcommerceWayBillRegistrationEvidenceDocument: require('./schemas/EcommerceWayBillRegistrationEvidenceDocument.json'), EcommerceWayBillTotals: require('./schemas/EcommerceWayBillTotals.json'), Entity: require('./schemas/Entity.json'), +Event: require('./schemas/Event.json'), GeoCoordinates: require('./schemas/GeoCoordinates.json'), Inbond: require('./schemas/Inbond.json'), InspectionReport: require('./schemas/InspectionReport.json'),