@carrot-foundation/schemas 0.1.22 → 0.1.23
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/dist/index.cjs +34 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -31
- package/dist/index.d.ts +31 -31
- package/dist/index.js +34 -34
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/schemas/ipfs/mass-id/mass-id.example.json +27 -25
- package/schemas/ipfs/mass-id/mass-id.schema.json +67 -89
package/dist/index.d.cts
CHANGED
|
@@ -77,8 +77,8 @@ declare const MassIDChainOfCustodyEventSchema: z.ZodObject<{
|
|
|
77
77
|
event_name: z.ZodString;
|
|
78
78
|
description: z.ZodOptional<z.ZodString>;
|
|
79
79
|
timestamp: z.ZodISODateTime;
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
81
|
+
location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
82
82
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
83
83
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
84
|
name: z.ZodString;
|
|
@@ -108,8 +108,8 @@ declare const MassIDChainOfCustodySchema: z.ZodObject<{
|
|
|
108
108
|
event_name: z.ZodString;
|
|
109
109
|
description: z.ZodOptional<z.ZodString>;
|
|
110
110
|
timestamp: z.ZodISODateTime;
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
112
|
+
location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
113
113
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
114
114
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
115
115
|
name: z.ZodString;
|
|
@@ -137,20 +137,20 @@ declare const MassIDChainOfCustodySchema: z.ZodObject<{
|
|
|
137
137
|
}, z.core.$strict>;
|
|
138
138
|
type MassIDChainOfCustody = z.infer<typeof MassIDChainOfCustodySchema>;
|
|
139
139
|
declare const MassIDTransportRouteSchema: z.ZodObject<{
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
from_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
141
|
+
to_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
142
142
|
distance_km: z.ZodNumber;
|
|
143
143
|
transport_method: z.ZodString;
|
|
144
144
|
duration_hours: z.ZodNumber;
|
|
145
145
|
}, z.core.$strict>;
|
|
146
146
|
type MassIDTransportRoute = z.infer<typeof MassIDTransportRouteSchema>;
|
|
147
147
|
declare const MassIDGeographicDataSchema: z.ZodObject<{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
origin_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
149
|
+
processing_location_id_hashes: z.ZodOptional<z.ZodArray<z.ZodCustomStringFormat<"sha256_hex">>>;
|
|
150
|
+
final_destination_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
151
151
|
transport_routes: z.ZodArray<z.ZodObject<{
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
from_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
153
|
+
to_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
154
154
|
distance_km: z.ZodNumber;
|
|
155
155
|
transport_method: z.ZodString;
|
|
156
156
|
duration_hours: z.ZodNumber;
|
|
@@ -181,13 +181,13 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
181
181
|
}>>;
|
|
182
182
|
}, z.core.$strict>;
|
|
183
183
|
locations: z.ZodArray<z.ZodObject<{
|
|
184
|
-
|
|
184
|
+
id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
185
185
|
municipality: z.ZodString;
|
|
186
186
|
administrative_division: z.ZodString;
|
|
187
187
|
administrative_division_code: z.ZodOptional<z.ZodString>;
|
|
188
188
|
country: z.ZodString;
|
|
189
189
|
country_code: z.ZodString;
|
|
190
|
-
|
|
190
|
+
responsible_participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
191
191
|
coordinates: z.ZodObject<{
|
|
192
192
|
latitude: z.ZodNumber;
|
|
193
193
|
longitude: z.ZodNumber;
|
|
@@ -207,7 +207,7 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
207
207
|
}>>;
|
|
208
208
|
}, z.core.$strict>>;
|
|
209
209
|
participants: z.ZodArray<z.ZodObject<{
|
|
210
|
-
|
|
210
|
+
id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
211
211
|
name: z.ZodString;
|
|
212
212
|
roles: z.ZodArray<z.ZodString>;
|
|
213
213
|
}, z.core.$strict>>;
|
|
@@ -217,8 +217,8 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
217
217
|
event_name: z.ZodString;
|
|
218
218
|
description: z.ZodOptional<z.ZodString>;
|
|
219
219
|
timestamp: z.ZodISODateTime;
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
221
|
+
location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
222
222
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
223
223
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
224
224
|
name: z.ZodString;
|
|
@@ -245,12 +245,12 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
245
245
|
total_duration_hours: z.ZodNumber;
|
|
246
246
|
}, z.core.$strict>;
|
|
247
247
|
geographic_data: z.ZodObject<{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
origin_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
249
|
+
processing_location_id_hashes: z.ZodOptional<z.ZodArray<z.ZodCustomStringFormat<"sha256_hex">>>;
|
|
250
|
+
final_destination_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
251
251
|
transport_routes: z.ZodArray<z.ZodObject<{
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
from_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
253
|
+
to_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
254
254
|
distance_km: z.ZodNumber;
|
|
255
255
|
transport_method: z.ZodString;
|
|
256
256
|
duration_hours: z.ZodNumber;
|
|
@@ -473,13 +473,13 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
473
473
|
}>>;
|
|
474
474
|
}, z.core.$strict>;
|
|
475
475
|
locations: z.ZodArray<z.ZodObject<{
|
|
476
|
-
|
|
476
|
+
id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
477
477
|
municipality: z.ZodString;
|
|
478
478
|
administrative_division: z.ZodString;
|
|
479
479
|
administrative_division_code: z.ZodOptional<z.ZodString>;
|
|
480
480
|
country: z.ZodString;
|
|
481
481
|
country_code: z.ZodString;
|
|
482
|
-
|
|
482
|
+
responsible_participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
483
483
|
coordinates: z.ZodObject<{
|
|
484
484
|
latitude: z.ZodNumber;
|
|
485
485
|
longitude: z.ZodNumber;
|
|
@@ -499,7 +499,7 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
499
499
|
}>>;
|
|
500
500
|
}, z.core.$strict>>;
|
|
501
501
|
participants: z.ZodArray<z.ZodObject<{
|
|
502
|
-
|
|
502
|
+
id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
503
503
|
name: z.ZodString;
|
|
504
504
|
roles: z.ZodArray<z.ZodString>;
|
|
505
505
|
}, z.core.$strict>>;
|
|
@@ -509,8 +509,8 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
509
509
|
event_name: z.ZodString;
|
|
510
510
|
description: z.ZodOptional<z.ZodString>;
|
|
511
511
|
timestamp: z.ZodISODateTime;
|
|
512
|
-
|
|
513
|
-
|
|
512
|
+
participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
513
|
+
location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
514
514
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
515
515
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
516
516
|
name: z.ZodString;
|
|
@@ -537,12 +537,12 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
537
537
|
total_duration_hours: z.ZodNumber;
|
|
538
538
|
}, z.core.$strict>;
|
|
539
539
|
geographic_data: z.ZodObject<{
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
540
|
+
origin_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
541
|
+
processing_location_id_hashes: z.ZodOptional<z.ZodArray<z.ZodCustomStringFormat<"sha256_hex">>>;
|
|
542
|
+
final_destination_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
543
543
|
transport_routes: z.ZodArray<z.ZodObject<{
|
|
544
|
-
|
|
545
|
-
|
|
544
|
+
from_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
545
|
+
to_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
546
546
|
distance_km: z.ZodNumber;
|
|
547
547
|
transport_method: z.ZodString;
|
|
548
548
|
duration_hours: z.ZodNumber;
|
package/dist/index.d.ts
CHANGED
|
@@ -77,8 +77,8 @@ declare const MassIDChainOfCustodyEventSchema: z.ZodObject<{
|
|
|
77
77
|
event_name: z.ZodString;
|
|
78
78
|
description: z.ZodOptional<z.ZodString>;
|
|
79
79
|
timestamp: z.ZodISODateTime;
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
81
|
+
location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
82
82
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
83
83
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
84
84
|
name: z.ZodString;
|
|
@@ -108,8 +108,8 @@ declare const MassIDChainOfCustodySchema: z.ZodObject<{
|
|
|
108
108
|
event_name: z.ZodString;
|
|
109
109
|
description: z.ZodOptional<z.ZodString>;
|
|
110
110
|
timestamp: z.ZodISODateTime;
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
112
|
+
location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
113
113
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
114
114
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
115
115
|
name: z.ZodString;
|
|
@@ -137,20 +137,20 @@ declare const MassIDChainOfCustodySchema: z.ZodObject<{
|
|
|
137
137
|
}, z.core.$strict>;
|
|
138
138
|
type MassIDChainOfCustody = z.infer<typeof MassIDChainOfCustodySchema>;
|
|
139
139
|
declare const MassIDTransportRouteSchema: z.ZodObject<{
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
from_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
141
|
+
to_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
142
142
|
distance_km: z.ZodNumber;
|
|
143
143
|
transport_method: z.ZodString;
|
|
144
144
|
duration_hours: z.ZodNumber;
|
|
145
145
|
}, z.core.$strict>;
|
|
146
146
|
type MassIDTransportRoute = z.infer<typeof MassIDTransportRouteSchema>;
|
|
147
147
|
declare const MassIDGeographicDataSchema: z.ZodObject<{
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
origin_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
149
|
+
processing_location_id_hashes: z.ZodOptional<z.ZodArray<z.ZodCustomStringFormat<"sha256_hex">>>;
|
|
150
|
+
final_destination_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
151
151
|
transport_routes: z.ZodArray<z.ZodObject<{
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
from_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
153
|
+
to_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
154
154
|
distance_km: z.ZodNumber;
|
|
155
155
|
transport_method: z.ZodString;
|
|
156
156
|
duration_hours: z.ZodNumber;
|
|
@@ -181,13 +181,13 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
181
181
|
}>>;
|
|
182
182
|
}, z.core.$strict>;
|
|
183
183
|
locations: z.ZodArray<z.ZodObject<{
|
|
184
|
-
|
|
184
|
+
id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
185
185
|
municipality: z.ZodString;
|
|
186
186
|
administrative_division: z.ZodString;
|
|
187
187
|
administrative_division_code: z.ZodOptional<z.ZodString>;
|
|
188
188
|
country: z.ZodString;
|
|
189
189
|
country_code: z.ZodString;
|
|
190
|
-
|
|
190
|
+
responsible_participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
191
191
|
coordinates: z.ZodObject<{
|
|
192
192
|
latitude: z.ZodNumber;
|
|
193
193
|
longitude: z.ZodNumber;
|
|
@@ -207,7 +207,7 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
207
207
|
}>>;
|
|
208
208
|
}, z.core.$strict>>;
|
|
209
209
|
participants: z.ZodArray<z.ZodObject<{
|
|
210
|
-
|
|
210
|
+
id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
211
211
|
name: z.ZodString;
|
|
212
212
|
roles: z.ZodArray<z.ZodString>;
|
|
213
213
|
}, z.core.$strict>>;
|
|
@@ -217,8 +217,8 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
217
217
|
event_name: z.ZodString;
|
|
218
218
|
description: z.ZodOptional<z.ZodString>;
|
|
219
219
|
timestamp: z.ZodISODateTime;
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
221
|
+
location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
222
222
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
223
223
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
224
224
|
name: z.ZodString;
|
|
@@ -245,12 +245,12 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
245
245
|
total_duration_hours: z.ZodNumber;
|
|
246
246
|
}, z.core.$strict>;
|
|
247
247
|
geographic_data: z.ZodObject<{
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
origin_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
249
|
+
processing_location_id_hashes: z.ZodOptional<z.ZodArray<z.ZodCustomStringFormat<"sha256_hex">>>;
|
|
250
|
+
final_destination_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
251
251
|
transport_routes: z.ZodArray<z.ZodObject<{
|
|
252
|
-
|
|
253
|
-
|
|
252
|
+
from_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
253
|
+
to_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
254
254
|
distance_km: z.ZodNumber;
|
|
255
255
|
transport_method: z.ZodString;
|
|
256
256
|
duration_hours: z.ZodNumber;
|
|
@@ -473,13 +473,13 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
473
473
|
}>>;
|
|
474
474
|
}, z.core.$strict>;
|
|
475
475
|
locations: z.ZodArray<z.ZodObject<{
|
|
476
|
-
|
|
476
|
+
id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
477
477
|
municipality: z.ZodString;
|
|
478
478
|
administrative_division: z.ZodString;
|
|
479
479
|
administrative_division_code: z.ZodOptional<z.ZodString>;
|
|
480
480
|
country: z.ZodString;
|
|
481
481
|
country_code: z.ZodString;
|
|
482
|
-
|
|
482
|
+
responsible_participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
483
483
|
coordinates: z.ZodObject<{
|
|
484
484
|
latitude: z.ZodNumber;
|
|
485
485
|
longitude: z.ZodNumber;
|
|
@@ -499,7 +499,7 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
499
499
|
}>>;
|
|
500
500
|
}, z.core.$strict>>;
|
|
501
501
|
participants: z.ZodArray<z.ZodObject<{
|
|
502
|
-
|
|
502
|
+
id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
503
503
|
name: z.ZodString;
|
|
504
504
|
roles: z.ZodArray<z.ZodString>;
|
|
505
505
|
}, z.core.$strict>>;
|
|
@@ -509,8 +509,8 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
509
509
|
event_name: z.ZodString;
|
|
510
510
|
description: z.ZodOptional<z.ZodString>;
|
|
511
511
|
timestamp: z.ZodISODateTime;
|
|
512
|
-
|
|
513
|
-
|
|
512
|
+
participant_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
513
|
+
location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
514
514
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
515
515
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
516
516
|
name: z.ZodString;
|
|
@@ -537,12 +537,12 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
537
537
|
total_duration_hours: z.ZodNumber;
|
|
538
538
|
}, z.core.$strict>;
|
|
539
539
|
geographic_data: z.ZodObject<{
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
540
|
+
origin_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
541
|
+
processing_location_id_hashes: z.ZodOptional<z.ZodArray<z.ZodCustomStringFormat<"sha256_hex">>>;
|
|
542
|
+
final_destination_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
543
543
|
transport_routes: z.ZodArray<z.ZodObject<{
|
|
544
|
-
|
|
545
|
-
|
|
544
|
+
from_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
545
|
+
to_location_id_hash: z.ZodCustomStringFormat<"sha256_hex">;
|
|
546
546
|
distance_km: z.ZodNumber;
|
|
547
547
|
transport_method: z.ZodString;
|
|
548
548
|
duration_hours: z.ZodNumber;
|
package/dist/index.js
CHANGED
|
@@ -269,9 +269,9 @@ var CoordinatesSchema = z.strictObject({
|
|
|
269
269
|
description: "GPS coordinates of the location"
|
|
270
270
|
});
|
|
271
271
|
var LocationSchema = z.strictObject({
|
|
272
|
-
|
|
273
|
-
title: "Location ID",
|
|
274
|
-
description: "
|
|
272
|
+
id_hash: Sha256HashSchema.meta({
|
|
273
|
+
title: "Location ID Hash",
|
|
274
|
+
description: "Anonymized identifier for the location"
|
|
275
275
|
}),
|
|
276
276
|
municipality: NonEmptyStringSchema.max(50).meta({
|
|
277
277
|
title: "Municipality",
|
|
@@ -296,9 +296,9 @@ var LocationSchema = z.strictObject({
|
|
|
296
296
|
title: "Country Code",
|
|
297
297
|
description: "ISO 3166-1 alpha-2 country code"
|
|
298
298
|
}),
|
|
299
|
-
|
|
300
|
-
title: "Responsible Participant ID",
|
|
301
|
-
description: "ID of the participant responsible for this location"
|
|
299
|
+
responsible_participant_id_hash: Sha256HashSchema.meta({
|
|
300
|
+
title: "Responsible Participant ID Hash",
|
|
301
|
+
description: "Anonymized ID of the participant responsible for this location"
|
|
302
302
|
}),
|
|
303
303
|
coordinates: CoordinatesSchema,
|
|
304
304
|
facility_type: FacilityTypeSchema.optional().meta({
|
|
@@ -328,9 +328,9 @@ function uniqueBy(schema, selector, errorMessage = "Items must be unique") {
|
|
|
328
328
|
|
|
329
329
|
// src/shared/entities/participant.schema.ts
|
|
330
330
|
var ParticipantSchema = z.strictObject({
|
|
331
|
-
|
|
332
|
-
title: "Participant ID",
|
|
333
|
-
description: "
|
|
331
|
+
id_hash: Sha256HashSchema.meta({
|
|
332
|
+
title: "Participant ID Hash",
|
|
333
|
+
description: "Anonymized identifier for the participant"
|
|
334
334
|
}),
|
|
335
335
|
name: ParticipantNameSchema.meta({
|
|
336
336
|
title: "Participant Name",
|
|
@@ -530,12 +530,12 @@ var MassIDChainOfCustodyEventSchema = z.strictObject({
|
|
|
530
530
|
title: "Event Timestamp",
|
|
531
531
|
description: "ISO 8601 timestamp when the event occurred"
|
|
532
532
|
}),
|
|
533
|
-
|
|
534
|
-
title: "Participant ID",
|
|
533
|
+
participant_id_hash: Sha256HashSchema.meta({
|
|
534
|
+
title: "Participant ID Hash",
|
|
535
535
|
description: "Reference to participant in the participants array"
|
|
536
536
|
}),
|
|
537
|
-
|
|
538
|
-
title: "Location ID",
|
|
537
|
+
location_id_hash: Sha256HashSchema.meta({
|
|
538
|
+
title: "Location ID Hash",
|
|
539
539
|
description: "Reference to location in the locations array"
|
|
540
540
|
}),
|
|
541
541
|
weight: NonNegativeFloatSchema.optional().meta({
|
|
@@ -576,12 +576,12 @@ var MassIDChainOfCustodySchema = z.strictObject({
|
|
|
576
576
|
description: "Complete chain of custody tracking from waste generation to final processing"
|
|
577
577
|
});
|
|
578
578
|
var MassIDTransportRouteSchema = z.strictObject({
|
|
579
|
-
|
|
580
|
-
title: "From Location ID",
|
|
579
|
+
from_location_id_hash: Sha256HashSchema.meta({
|
|
580
|
+
title: "From Location ID Hash",
|
|
581
581
|
description: "Reference to the origin location in the locations array"
|
|
582
582
|
}),
|
|
583
|
-
|
|
584
|
-
title: "To Location ID",
|
|
583
|
+
to_location_id_hash: Sha256HashSchema.meta({
|
|
584
|
+
title: "To Location ID Hash",
|
|
585
585
|
description: "Reference to the destination location in the locations array"
|
|
586
586
|
}),
|
|
587
587
|
distance_km: NonNegativeFloatSchema.meta({
|
|
@@ -611,16 +611,16 @@ var MassIDTransportRouteSchema = z.strictObject({
|
|
|
611
611
|
description: "Transport route segment information"
|
|
612
612
|
});
|
|
613
613
|
var MassIDGeographicDataSchema = z.strictObject({
|
|
614
|
-
|
|
615
|
-
title: "Origin Location ID",
|
|
614
|
+
origin_location_id_hash: Sha256HashSchema.meta({
|
|
615
|
+
title: "Origin Location ID Hash",
|
|
616
616
|
description: "Reference to origin location in the locations array"
|
|
617
617
|
}),
|
|
618
|
-
|
|
619
|
-
title: "Processing Location
|
|
618
|
+
processing_location_id_hashes: z.array(Sha256HashSchema).optional().meta({
|
|
619
|
+
title: "Processing Location ID Hashes",
|
|
620
620
|
description: "Locations where the waste was processed or handled"
|
|
621
621
|
}),
|
|
622
|
-
|
|
623
|
-
title: "Final Destination ID",
|
|
622
|
+
final_destination_id_hash: Sha256HashSchema.meta({
|
|
623
|
+
title: "Final Destination ID Hash",
|
|
624
624
|
description: "Reference to final destination in the locations array"
|
|
625
625
|
}),
|
|
626
626
|
transport_routes: z.array(MassIDTransportRouteSchema).meta({
|
|
@@ -635,16 +635,16 @@ var MassIDDataSchema = z.strictObject({
|
|
|
635
635
|
waste_properties: MassIDWastePropertiesSchema,
|
|
636
636
|
locations: uniqueBy(
|
|
637
637
|
LocationSchema,
|
|
638
|
-
(loc) => loc.
|
|
639
|
-
"Location
|
|
638
|
+
(loc) => loc.id_hash,
|
|
639
|
+
"Location ID hashes must be unique"
|
|
640
640
|
).min(1).meta({
|
|
641
641
|
title: "Locations",
|
|
642
642
|
description: "All locations referenced in this MassID, indexed by ID"
|
|
643
643
|
}),
|
|
644
644
|
participants: uniqueBy(
|
|
645
645
|
ParticipantSchema,
|
|
646
|
-
(p) => p.
|
|
647
|
-
"Participant
|
|
646
|
+
(p) => p.id_hash,
|
|
647
|
+
"Participant ID hashes must be unique"
|
|
648
648
|
).min(1).meta({
|
|
649
649
|
title: "Participants",
|
|
650
650
|
description: "All participants referenced in this MassID, indexed by ID"
|
|
@@ -653,27 +653,27 @@ var MassIDDataSchema = z.strictObject({
|
|
|
653
653
|
geographic_data: MassIDGeographicDataSchema
|
|
654
654
|
}).refine((data) => {
|
|
655
655
|
const participantIdSet = new Set(
|
|
656
|
-
data.participants.map((participant) => participant.
|
|
656
|
+
data.participants.map((participant) => participant.id_hash)
|
|
657
657
|
);
|
|
658
658
|
const eventParticipantIds = data.chain_of_custody.events.map(
|
|
659
|
-
(event) => event.
|
|
659
|
+
(event) => event.participant_id_hash
|
|
660
660
|
);
|
|
661
661
|
const allEventParticipantsExist = eventParticipantIds.every(
|
|
662
662
|
(participantId) => participantIdSet.has(participantId)
|
|
663
663
|
);
|
|
664
664
|
return allEventParticipantsExist;
|
|
665
|
-
}, "All participant
|
|
665
|
+
}, "All participant ID hashes in chain of custody events must exist in participants array").refine((data) => {
|
|
666
666
|
const locationIdSet = new Set(
|
|
667
|
-
data.locations.map((location) => location.
|
|
667
|
+
data.locations.map((location) => location.id_hash)
|
|
668
668
|
);
|
|
669
669
|
const eventLocationIds = data.chain_of_custody.events.map(
|
|
670
|
-
(event) => event.
|
|
670
|
+
(event) => event.location_id_hash
|
|
671
671
|
);
|
|
672
672
|
const allEventLocationsExist = eventLocationIds.every(
|
|
673
673
|
(locationId) => locationIdSet.has(locationId)
|
|
674
674
|
);
|
|
675
675
|
return allEventLocationsExist;
|
|
676
|
-
}, "All location
|
|
676
|
+
}, "All location ID hashes in chain of custody events must exist in locations array").meta({
|
|
677
677
|
title: "MassID Data",
|
|
678
678
|
description: "MassID data containing waste tracking and chain of custody information"
|
|
679
679
|
});
|
|
@@ -697,7 +697,7 @@ var RecordCreatorSchema = z.strictObject({
|
|
|
697
697
|
name: z.string().meta({
|
|
698
698
|
title: "Creator Name",
|
|
699
699
|
description: "Company or individual name that created this record",
|
|
700
|
-
examples: ["Carrot Foundation"
|
|
700
|
+
examples: ["Carrot Foundation"]
|
|
701
701
|
}),
|
|
702
702
|
id: UuidSchema.meta({
|
|
703
703
|
title: "Creator ID",
|