@carrot-foundation/schemas 0.1.20 → 0.1.22
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 +99 -6
- package/dist/index.cjs +1119 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +555 -0
- package/dist/index.d.ts +555 -2
- package/dist/index.js +1115 -1
- package/dist/index.js.map +1 -0
- package/package.json +8 -5
- package/schemas/ipfs/gas-id/gas-id.example.json +1 -1
- package/schemas/ipfs/mass-id/mass-id.example.json +5 -5
- package/schemas/ipfs/mass-id/mass-id.schema.json +306 -89
- package/schemas/ipfs/recycled-id/recycled-id.example.json +1 -1
- package/schemas/ipfs/shared/definitions/definitions.schema.json +3 -8
- package/schemas/ipfs/shared/entities/location/location.schema.json +3 -8
- package/dist/index.d.ts.map +0 -1
- package/dist/mass-id/index.d.ts +0 -3
- package/dist/mass-id/index.d.ts.map +0 -1
- package/dist/mass-id/index.js +0 -2
- package/dist/mass-id/mass-id.data.schema.d.ts +0 -256
- package/dist/mass-id/mass-id.data.schema.d.ts.map +0 -1
- package/dist/mass-id/mass-id.data.schema.js +0 -348
- package/dist/mass-id/mass-id.schema.d.ts +0 -297
- package/dist/mass-id/mass-id.schema.d.ts.map +0 -1
- package/dist/mass-id/mass-id.schema.js +0 -163
- package/dist/shared/base.schema.d.ts +0 -111
- package/dist/shared/base.schema.d.ts.map +0 -1
- package/dist/shared/base.schema.js +0 -127
- package/dist/shared/definitions.schema.d.ts +0 -96
- package/dist/shared/definitions.schema.d.ts.map +0 -1
- package/dist/shared/definitions.schema.js +0 -283
- package/dist/shared/entities/location.schema.d.ts +0 -55
- package/dist/shared/entities/location.schema.d.ts.map +0 -1
- package/dist/shared/entities/location.schema.js +0 -68
- package/dist/shared/entities/participant.schema.d.ts +0 -8
- package/dist/shared/entities/participant.schema.d.ts.map +0 -1
- package/dist/shared/entities/participant.schema.js +0 -24
- package/dist/shared/helpers.schema.d.ts +0 -4
- package/dist/shared/helpers.schema.d.ts.map +0 -1
- package/dist/shared/helpers.schema.js +0 -16
- package/dist/shared/nft.schema.d.ts +0 -116
- package/dist/shared/nft.schema.d.ts.map +0 -1
- package/dist/shared/nft.schema.js +0 -193
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"longitude": -51.07045,
|
|
146
146
|
"precision_level": "city"
|
|
147
147
|
},
|
|
148
|
-
"facility_type": "
|
|
148
|
+
"facility_type": "Collection Point",
|
|
149
149
|
"responsible_participant_id": "5021ea45-5b35-4749-8a85-83dc0c6f7cbf"
|
|
150
150
|
},
|
|
151
151
|
"accredited_participants": [
|
|
@@ -112,18 +112,13 @@
|
|
|
112
112
|
"facility_type": {
|
|
113
113
|
"type": "string",
|
|
114
114
|
"enum": [
|
|
115
|
-
"Waste Generation",
|
|
116
115
|
"Collection Point",
|
|
117
|
-
"Transfer Station",
|
|
118
|
-
"Sorting Facility",
|
|
119
|
-
"Composting Facility",
|
|
120
116
|
"Recycling Facility",
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"Administrative Office"
|
|
117
|
+
"Administrative Office",
|
|
118
|
+
"Other"
|
|
124
119
|
],
|
|
125
120
|
"title": "Facility Type",
|
|
126
|
-
"description": "Type of facility
|
|
121
|
+
"description": "Type of facility in the waste management chain.",
|
|
127
122
|
"example": "Recycling Facility"
|
|
128
123
|
},
|
|
129
124
|
"chain_id": {
|
|
@@ -76,18 +76,13 @@
|
|
|
76
76
|
"facility_type": {
|
|
77
77
|
"type": "string",
|
|
78
78
|
"enum": [
|
|
79
|
-
"Waste Generation",
|
|
80
79
|
"Collection Point",
|
|
81
|
-
"Transfer Station",
|
|
82
|
-
"Sorting Facility",
|
|
83
|
-
"Composting Facility",
|
|
84
80
|
"Recycling Facility",
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"Administrative Office"
|
|
81
|
+
"Administrative Office",
|
|
82
|
+
"Other"
|
|
88
83
|
],
|
|
89
84
|
"title": "Facility Type",
|
|
90
|
-
"description": "Type of facility
|
|
85
|
+
"description": "Type of facility in the waste management chain.",
|
|
91
86
|
"example": "Recycling Facility"
|
|
92
87
|
}
|
|
93
88
|
},
|
package/dist/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
package/dist/mass-id/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/mass-id/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
package/dist/mass-id/index.js
DELETED
|
@@ -1,256 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
declare const MassIDLocalClassificationSchema: z.ZodObject<{
|
|
3
|
-
code: z.ZodString;
|
|
4
|
-
description: z.ZodString;
|
|
5
|
-
system: z.ZodString;
|
|
6
|
-
}, z.core.$strict>;
|
|
7
|
-
export type MassIDLocalClassification = z.infer<typeof MassIDLocalClassificationSchema>;
|
|
8
|
-
declare const MassIDMeasurementUnitSchema: z.ZodEnum<{
|
|
9
|
-
kg: "kg";
|
|
10
|
-
ton: "ton";
|
|
11
|
-
}>;
|
|
12
|
-
export type MassIDMeasurementUnit = z.infer<typeof MassIDMeasurementUnitSchema>;
|
|
13
|
-
declare const ContaminationLevelSchema: z.ZodEnum<{
|
|
14
|
-
None: "None";
|
|
15
|
-
Low: "Low";
|
|
16
|
-
Medium: "Medium";
|
|
17
|
-
High: "High";
|
|
18
|
-
}>;
|
|
19
|
-
export type ContaminationLevel = z.infer<typeof ContaminationLevelSchema>;
|
|
20
|
-
declare const MassIDWasteClassificationSchema: z.ZodObject<{
|
|
21
|
-
primary_type: z.ZodString;
|
|
22
|
-
subtype: z.ZodString;
|
|
23
|
-
local_classification: z.ZodOptional<z.ZodObject<{
|
|
24
|
-
code: z.ZodString;
|
|
25
|
-
description: z.ZodString;
|
|
26
|
-
system: z.ZodString;
|
|
27
|
-
}, z.core.$strict>>;
|
|
28
|
-
measurement_unit: z.ZodEnum<{
|
|
29
|
-
kg: "kg";
|
|
30
|
-
ton: "ton";
|
|
31
|
-
}>;
|
|
32
|
-
net_weight: z.ZodNumber;
|
|
33
|
-
contamination_level: z.ZodOptional<z.ZodEnum<{
|
|
34
|
-
None: "None";
|
|
35
|
-
Low: "Low";
|
|
36
|
-
Medium: "Medium";
|
|
37
|
-
High: "High";
|
|
38
|
-
}>>;
|
|
39
|
-
}, z.core.$strict>;
|
|
40
|
-
export type MassIDWasteClassification = z.infer<typeof MassIDWasteClassificationSchema>;
|
|
41
|
-
declare const EventAttributeFormatSchema: z.ZodEnum<{
|
|
42
|
-
KILOGRAM: "KILOGRAM";
|
|
43
|
-
DATE: "DATE";
|
|
44
|
-
CURRENCY: "CURRENCY";
|
|
45
|
-
PERCENTAGE: "PERCENTAGE";
|
|
46
|
-
COORDINATE: "COORDINATE";
|
|
47
|
-
}>;
|
|
48
|
-
export type EventAttributeFormat = z.infer<typeof EventAttributeFormatSchema>;
|
|
49
|
-
declare const EventAttributeSchema: z.ZodObject<{
|
|
50
|
-
name: z.ZodString;
|
|
51
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
52
|
-
format: z.ZodOptional<z.ZodEnum<{
|
|
53
|
-
KILOGRAM: "KILOGRAM";
|
|
54
|
-
DATE: "DATE";
|
|
55
|
-
CURRENCY: "CURRENCY";
|
|
56
|
-
PERCENTAGE: "PERCENTAGE";
|
|
57
|
-
COORDINATE: "COORDINATE";
|
|
58
|
-
}>>;
|
|
59
|
-
}, z.core.$strict>;
|
|
60
|
-
export type EventAttribute = z.infer<typeof EventAttributeSchema>;
|
|
61
|
-
declare const EventDocumentSchema: z.ZodObject<{
|
|
62
|
-
type: z.ZodString;
|
|
63
|
-
document_number: z.ZodOptional<z.ZodString>;
|
|
64
|
-
reference: z.ZodString;
|
|
65
|
-
issue_date: z.ZodOptional<z.ZodISODate>;
|
|
66
|
-
issuer: z.ZodOptional<z.ZodString>;
|
|
67
|
-
}, z.core.$strict>;
|
|
68
|
-
export type EventDocumentation = z.infer<typeof EventDocumentSchema>;
|
|
69
|
-
declare const MassIDChainOfCustodyEventSchema: z.ZodObject<{
|
|
70
|
-
event_id: z.ZodUUID;
|
|
71
|
-
event_name: z.ZodString;
|
|
72
|
-
description: z.ZodOptional<z.ZodString>;
|
|
73
|
-
timestamp: z.ZodISODateTime;
|
|
74
|
-
participant_id: z.ZodUUID;
|
|
75
|
-
location_id: z.ZodUUID;
|
|
76
|
-
weight: z.ZodOptional<z.ZodNumber>;
|
|
77
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
78
|
-
name: z.ZodString;
|
|
79
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
80
|
-
format: z.ZodOptional<z.ZodEnum<{
|
|
81
|
-
KILOGRAM: "KILOGRAM";
|
|
82
|
-
DATE: "DATE";
|
|
83
|
-
CURRENCY: "CURRENCY";
|
|
84
|
-
PERCENTAGE: "PERCENTAGE";
|
|
85
|
-
COORDINATE: "COORDINATE";
|
|
86
|
-
}>>;
|
|
87
|
-
}, z.core.$strict>>>;
|
|
88
|
-
documentation: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
89
|
-
type: z.ZodString;
|
|
90
|
-
document_number: z.ZodOptional<z.ZodString>;
|
|
91
|
-
reference: z.ZodString;
|
|
92
|
-
issue_date: z.ZodOptional<z.ZodISODate>;
|
|
93
|
-
issuer: z.ZodOptional<z.ZodString>;
|
|
94
|
-
}, z.core.$strict>>>;
|
|
95
|
-
notes: z.ZodOptional<z.ZodString>;
|
|
96
|
-
}, z.core.$strict>;
|
|
97
|
-
export type MassIDChainOfCustodyEvent = z.infer<typeof MassIDChainOfCustodyEventSchema>;
|
|
98
|
-
declare const MassIDChainOfCustodySchema: z.ZodObject<{
|
|
99
|
-
events: z.ZodArray<z.ZodObject<{
|
|
100
|
-
event_id: z.ZodUUID;
|
|
101
|
-
event_name: z.ZodString;
|
|
102
|
-
description: z.ZodOptional<z.ZodString>;
|
|
103
|
-
timestamp: z.ZodISODateTime;
|
|
104
|
-
participant_id: z.ZodUUID;
|
|
105
|
-
location_id: z.ZodUUID;
|
|
106
|
-
weight: z.ZodOptional<z.ZodNumber>;
|
|
107
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
108
|
-
name: z.ZodString;
|
|
109
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
110
|
-
format: z.ZodOptional<z.ZodEnum<{
|
|
111
|
-
KILOGRAM: "KILOGRAM";
|
|
112
|
-
DATE: "DATE";
|
|
113
|
-
CURRENCY: "CURRENCY";
|
|
114
|
-
PERCENTAGE: "PERCENTAGE";
|
|
115
|
-
COORDINATE: "COORDINATE";
|
|
116
|
-
}>>;
|
|
117
|
-
}, z.core.$strict>>>;
|
|
118
|
-
documentation: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
119
|
-
type: z.ZodString;
|
|
120
|
-
document_number: z.ZodOptional<z.ZodString>;
|
|
121
|
-
reference: z.ZodString;
|
|
122
|
-
issue_date: z.ZodOptional<z.ZodISODate>;
|
|
123
|
-
issuer: z.ZodOptional<z.ZodString>;
|
|
124
|
-
}, z.core.$strict>>>;
|
|
125
|
-
notes: z.ZodOptional<z.ZodString>;
|
|
126
|
-
}, z.core.$strict>>;
|
|
127
|
-
total_distance_km: z.ZodNumber;
|
|
128
|
-
total_duration_hours: z.ZodNumber;
|
|
129
|
-
}, z.core.$strict>;
|
|
130
|
-
export type MassIDChainOfCustody = z.infer<typeof MassIDChainOfCustodySchema>;
|
|
131
|
-
declare const MassIDTransportRouteSchema: z.ZodObject<{
|
|
132
|
-
from_location_id: z.ZodUUID;
|
|
133
|
-
to_location_id: z.ZodUUID;
|
|
134
|
-
distance_km: z.ZodNumber;
|
|
135
|
-
transport_method: z.ZodString;
|
|
136
|
-
duration_hours: z.ZodNumber;
|
|
137
|
-
}, z.core.$strict>;
|
|
138
|
-
export type MassIDTransportRoute = z.infer<typeof MassIDTransportRouteSchema>;
|
|
139
|
-
declare const MassIDGeographicDataSchema: z.ZodObject<{
|
|
140
|
-
origin_location_id: z.ZodUUID;
|
|
141
|
-
processing_location_ids: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
142
|
-
final_destination_id: z.ZodUUID;
|
|
143
|
-
transport_routes: z.ZodArray<z.ZodObject<{
|
|
144
|
-
from_location_id: z.ZodUUID;
|
|
145
|
-
to_location_id: z.ZodUUID;
|
|
146
|
-
distance_km: z.ZodNumber;
|
|
147
|
-
transport_method: z.ZodString;
|
|
148
|
-
duration_hours: z.ZodNumber;
|
|
149
|
-
}, z.core.$strict>>;
|
|
150
|
-
}, z.core.$strict>;
|
|
151
|
-
export type MassIDGeographicData = z.infer<typeof MassIDGeographicDataSchema>;
|
|
152
|
-
export declare const MassIDDataSchema: z.ZodObject<{
|
|
153
|
-
waste_classification: z.ZodObject<{
|
|
154
|
-
primary_type: z.ZodString;
|
|
155
|
-
subtype: z.ZodString;
|
|
156
|
-
local_classification: z.ZodOptional<z.ZodObject<{
|
|
157
|
-
code: z.ZodString;
|
|
158
|
-
description: z.ZodString;
|
|
159
|
-
system: z.ZodString;
|
|
160
|
-
}, z.core.$strict>>;
|
|
161
|
-
measurement_unit: z.ZodEnum<{
|
|
162
|
-
kg: "kg";
|
|
163
|
-
ton: "ton";
|
|
164
|
-
}>;
|
|
165
|
-
net_weight: z.ZodNumber;
|
|
166
|
-
contamination_level: z.ZodOptional<z.ZodEnum<{
|
|
167
|
-
None: "None";
|
|
168
|
-
Low: "Low";
|
|
169
|
-
Medium: "Medium";
|
|
170
|
-
High: "High";
|
|
171
|
-
}>>;
|
|
172
|
-
}, z.core.$strict>;
|
|
173
|
-
locations: z.ZodArray<z.ZodObject<{
|
|
174
|
-
id: z.ZodUUID;
|
|
175
|
-
municipality: z.ZodString;
|
|
176
|
-
administrative_division: z.ZodString;
|
|
177
|
-
administrative_division_code: z.ZodOptional<z.ZodString>;
|
|
178
|
-
country: z.ZodString;
|
|
179
|
-
country_code: z.ZodString;
|
|
180
|
-
responsible_participant_id: z.ZodUUID;
|
|
181
|
-
coordinates: z.ZodObject<{
|
|
182
|
-
latitude: z.ZodNumber;
|
|
183
|
-
longitude: z.ZodNumber;
|
|
184
|
-
precision_level: z.ZodEnum<{
|
|
185
|
-
exact: "exact";
|
|
186
|
-
neighborhood: "neighborhood";
|
|
187
|
-
city: "city";
|
|
188
|
-
region: "region";
|
|
189
|
-
country: "country";
|
|
190
|
-
}>;
|
|
191
|
-
}, z.core.$strict>;
|
|
192
|
-
facility_type: z.ZodOptional<z.ZodEnum<{
|
|
193
|
-
"Waste Generation": "Waste Generation";
|
|
194
|
-
"Collection Point": "Collection Point";
|
|
195
|
-
"Transfer Station": "Transfer Station";
|
|
196
|
-
"Sorting Facility": "Sorting Facility";
|
|
197
|
-
"Composting Facility": "Composting Facility";
|
|
198
|
-
"Recycling Facility": "Recycling Facility";
|
|
199
|
-
"Processing Facility": "Processing Facility";
|
|
200
|
-
"Disposal Facility": "Disposal Facility";
|
|
201
|
-
"Administrative Office": "Administrative Office";
|
|
202
|
-
}>>;
|
|
203
|
-
}, z.core.$strict>>;
|
|
204
|
-
participants: z.ZodArray<z.ZodObject<{
|
|
205
|
-
id: z.ZodUUID;
|
|
206
|
-
name: z.ZodString;
|
|
207
|
-
roles: z.ZodArray<z.ZodString>;
|
|
208
|
-
}, z.core.$strict>>;
|
|
209
|
-
chain_of_custody: z.ZodObject<{
|
|
210
|
-
events: z.ZodArray<z.ZodObject<{
|
|
211
|
-
event_id: z.ZodUUID;
|
|
212
|
-
event_name: z.ZodString;
|
|
213
|
-
description: z.ZodOptional<z.ZodString>;
|
|
214
|
-
timestamp: z.ZodISODateTime;
|
|
215
|
-
participant_id: z.ZodUUID;
|
|
216
|
-
location_id: z.ZodUUID;
|
|
217
|
-
weight: z.ZodOptional<z.ZodNumber>;
|
|
218
|
-
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
219
|
-
name: z.ZodString;
|
|
220
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
|
|
221
|
-
format: z.ZodOptional<z.ZodEnum<{
|
|
222
|
-
KILOGRAM: "KILOGRAM";
|
|
223
|
-
DATE: "DATE";
|
|
224
|
-
CURRENCY: "CURRENCY";
|
|
225
|
-
PERCENTAGE: "PERCENTAGE";
|
|
226
|
-
COORDINATE: "COORDINATE";
|
|
227
|
-
}>>;
|
|
228
|
-
}, z.core.$strict>>>;
|
|
229
|
-
documentation: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
230
|
-
type: z.ZodString;
|
|
231
|
-
document_number: z.ZodOptional<z.ZodString>;
|
|
232
|
-
reference: z.ZodString;
|
|
233
|
-
issue_date: z.ZodOptional<z.ZodISODate>;
|
|
234
|
-
issuer: z.ZodOptional<z.ZodString>;
|
|
235
|
-
}, z.core.$strict>>>;
|
|
236
|
-
notes: z.ZodOptional<z.ZodString>;
|
|
237
|
-
}, z.core.$strict>>;
|
|
238
|
-
total_distance_km: z.ZodNumber;
|
|
239
|
-
total_duration_hours: z.ZodNumber;
|
|
240
|
-
}, z.core.$strict>;
|
|
241
|
-
geographic_data: z.ZodObject<{
|
|
242
|
-
origin_location_id: z.ZodUUID;
|
|
243
|
-
processing_location_ids: z.ZodOptional<z.ZodArray<z.ZodUUID>>;
|
|
244
|
-
final_destination_id: z.ZodUUID;
|
|
245
|
-
transport_routes: z.ZodArray<z.ZodObject<{
|
|
246
|
-
from_location_id: z.ZodUUID;
|
|
247
|
-
to_location_id: z.ZodUUID;
|
|
248
|
-
distance_km: z.ZodNumber;
|
|
249
|
-
transport_method: z.ZodString;
|
|
250
|
-
duration_hours: z.ZodNumber;
|
|
251
|
-
}, z.core.$strict>>;
|
|
252
|
-
}, z.core.$strict>;
|
|
253
|
-
}, z.core.$strict>;
|
|
254
|
-
export type MassIDData = z.infer<typeof MassIDDataSchema>;
|
|
255
|
-
export {};
|
|
256
|
-
//# sourceMappingURL=mass-id.data.schema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mass-id.data.schema.d.ts","sourceRoot":"","sources":["../../src/mass-id/mass-id.data.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAexB,QAAA,MAAM,+BAA+B;;;;kBAiCjC,CAAC;AAEL,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AAEF,QAAA,MAAM,2BAA2B;;;EAI/B,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,QAAA,MAAM,wBAAwB;;;;;EAM1B,CAAC;AAEL,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;kBAuBjC,CAAC;AAEL,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AAEF,QAAA,MAAM,0BAA0B;;;;;;EAM5B,CAAC;AAEL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,QAAA,MAAM,oBAAoB;;;;;;;;;;kBAmCtB,CAAC;AACL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,QAAA,MAAM,mBAAmB;;;;;;kBA+DrB,CAAC;AACL,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAErE,QAAA,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAyDjC,CAAC;AAEL,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAC7C,OAAO,+BAA+B,CACvC,CAAC;AAEF,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAoB5B,CAAC;AAEL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,QAAA,MAAM,0BAA0B;;;;;;kBAqC5B,CAAC;AAEL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,QAAA,MAAM,0BAA0B;;;;;;;;;;;kBAuB5B,CAAC;AAEL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA8DzB,CAAC;AAEL,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { UuidSchema, WasteTypeSchema, WasteSubtypeSchema, NonEmptyStringSchema, NonNegativeFloatSchema, IsoTimestampSchema, IsoDateSchema, HoursSchema, } from '../shared/definitions.schema.js';
|
|
3
|
-
import { LocationSchema } from '../shared/entities/location.schema.js';
|
|
4
|
-
import { ParticipantSchema } from '../shared/entities/participant.schema.js';
|
|
5
|
-
import { uniqueBy } from '../shared/helpers.schema.js';
|
|
6
|
-
const MassIDLocalClassificationSchema = z
|
|
7
|
-
.strictObject({
|
|
8
|
-
code: NonEmptyStringSchema.max(20).meta({
|
|
9
|
-
title: 'Classification Code',
|
|
10
|
-
description: 'Local waste classification code',
|
|
11
|
-
examples: ['20 01 01', 'D001', 'EWC-150101', 'IBAMA-A001'],
|
|
12
|
-
}),
|
|
13
|
-
description: NonEmptyStringSchema.max(200).meta({
|
|
14
|
-
title: 'Classification Description',
|
|
15
|
-
description: 'Local waste classification description',
|
|
16
|
-
examples: [
|
|
17
|
-
'Paper and cardboard packaging',
|
|
18
|
-
'Ignitable waste',
|
|
19
|
-
'Paper and cardboard packaging waste',
|
|
20
|
-
'Municipal solid waste - organic fraction',
|
|
21
|
-
],
|
|
22
|
-
}),
|
|
23
|
-
system: NonEmptyStringSchema.max(50).meta({
|
|
24
|
-
title: 'Classification System',
|
|
25
|
-
description: 'Classification system name (e.g., "Ibama Waste Code", "European Waste Catalogue", "US EPA Codes")',
|
|
26
|
-
examples: [
|
|
27
|
-
'European Waste Catalogue',
|
|
28
|
-
'US EPA Codes',
|
|
29
|
-
'Ibama Waste Code',
|
|
30
|
-
'Brazilian ABNT Classification',
|
|
31
|
-
],
|
|
32
|
-
}),
|
|
33
|
-
})
|
|
34
|
-
.meta({
|
|
35
|
-
title: 'Local Classification',
|
|
36
|
-
description: 'Local or regional waste classification codes and descriptions',
|
|
37
|
-
});
|
|
38
|
-
const MassIDMeasurementUnitSchema = z.enum(['kg', 'ton']).meta({
|
|
39
|
-
title: 'Measurement Unit',
|
|
40
|
-
description: 'Unit of measurement for the waste quantity',
|
|
41
|
-
examples: ['kg', 'ton'],
|
|
42
|
-
});
|
|
43
|
-
const ContaminationLevelSchema = z
|
|
44
|
-
.enum(['None', 'Low', 'Medium', 'High'])
|
|
45
|
-
.meta({
|
|
46
|
-
title: 'Contamination Level',
|
|
47
|
-
description: 'Level of contamination in the waste batch',
|
|
48
|
-
examples: ['Low', 'Medium', 'None'],
|
|
49
|
-
});
|
|
50
|
-
const MassIDWasteClassificationSchema = z
|
|
51
|
-
.strictObject({
|
|
52
|
-
primary_type: WasteTypeSchema.meta({
|
|
53
|
-
title: 'Primary Waste Type',
|
|
54
|
-
description: 'Primary waste material category',
|
|
55
|
-
}),
|
|
56
|
-
subtype: WasteSubtypeSchema.meta({
|
|
57
|
-
title: 'Waste Subtype',
|
|
58
|
-
description: 'Specific subcategory of waste material',
|
|
59
|
-
}),
|
|
60
|
-
local_classification: MassIDLocalClassificationSchema.optional(),
|
|
61
|
-
measurement_unit: MassIDMeasurementUnitSchema,
|
|
62
|
-
net_weight: NonNegativeFloatSchema.meta({
|
|
63
|
-
title: 'Net Weight',
|
|
64
|
-
description: 'Net weight of the waste batch in the specified measurement unit',
|
|
65
|
-
}),
|
|
66
|
-
contamination_level: ContaminationLevelSchema.optional(),
|
|
67
|
-
})
|
|
68
|
-
.meta({
|
|
69
|
-
title: 'Waste Classification',
|
|
70
|
-
description: 'Standardized waste material classification and regulatory information',
|
|
71
|
-
});
|
|
72
|
-
const EventAttributeFormatSchema = z
|
|
73
|
-
.enum(['KILOGRAM', 'DATE', 'CURRENCY', 'PERCENTAGE', 'COORDINATE'])
|
|
74
|
-
.meta({
|
|
75
|
-
title: 'Event Attribute Format',
|
|
76
|
-
description: 'Data format hint for proper display',
|
|
77
|
-
examples: ['KILOGRAM', 'DATE', 'PERCENTAGE'],
|
|
78
|
-
});
|
|
79
|
-
const EventAttributeSchema = z
|
|
80
|
-
.strictObject({
|
|
81
|
-
name: NonEmptyStringSchema.max(100).meta({
|
|
82
|
-
title: 'Attribute Name',
|
|
83
|
-
description: 'Event attribute name',
|
|
84
|
-
examples: [
|
|
85
|
-
'temperature',
|
|
86
|
-
'humidity',
|
|
87
|
-
'contamination_percentage',
|
|
88
|
-
'quality_grade',
|
|
89
|
-
'batch_number',
|
|
90
|
-
'operator_id',
|
|
91
|
-
'equipment_used',
|
|
92
|
-
'processing_cost',
|
|
93
|
-
],
|
|
94
|
-
}),
|
|
95
|
-
value: z.union([z.string(), z.number(), z.boolean()]).meta({
|
|
96
|
-
title: 'Attribute Value',
|
|
97
|
-
description: 'Event attribute value',
|
|
98
|
-
examples: [
|
|
99
|
-
25.5,
|
|
100
|
-
'Grade A',
|
|
101
|
-
true,
|
|
102
|
-
'BATCH-2024-001',
|
|
103
|
-
12.75,
|
|
104
|
-
'Shredder-X200',
|
|
105
|
-
false,
|
|
106
|
-
'OP-456',
|
|
107
|
-
],
|
|
108
|
-
}),
|
|
109
|
-
format: EventAttributeFormatSchema.optional(),
|
|
110
|
-
})
|
|
111
|
-
.meta({
|
|
112
|
-
title: 'Event Attribute',
|
|
113
|
-
description: 'Additional attribute specific to an event',
|
|
114
|
-
});
|
|
115
|
-
const EventDocumentSchema = z
|
|
116
|
-
.strictObject({
|
|
117
|
-
type: NonEmptyStringSchema.max(50).meta({
|
|
118
|
-
title: 'Document Type',
|
|
119
|
-
description: 'Type of supporting documentation',
|
|
120
|
-
examples: [
|
|
121
|
-
'Waste Transfer Note',
|
|
122
|
-
'Certificate of Disposal',
|
|
123
|
-
'Certificate of Final Destination',
|
|
124
|
-
'Quality Assessment Report',
|
|
125
|
-
'Transport Manifest',
|
|
126
|
-
'Processing Receipt',
|
|
127
|
-
'Environmental Permit',
|
|
128
|
-
'Invoice',
|
|
129
|
-
],
|
|
130
|
-
}),
|
|
131
|
-
document_number: NonEmptyStringSchema.max(50)
|
|
132
|
-
.optional()
|
|
133
|
-
.meta({
|
|
134
|
-
title: 'Document Number',
|
|
135
|
-
description: 'Official document number if applicable',
|
|
136
|
-
examples: [
|
|
137
|
-
'WTN-2024-001234',
|
|
138
|
-
'CD-ENV-456789',
|
|
139
|
-
'INV-2024-QTR1-789',
|
|
140
|
-
'PERMIT-EPA-2024-001',
|
|
141
|
-
'MANIFEST-DOT-567890',
|
|
142
|
-
],
|
|
143
|
-
}),
|
|
144
|
-
reference: NonEmptyStringSchema.meta({
|
|
145
|
-
title: 'Document Reference',
|
|
146
|
-
description: 'Reference to document (IPFS hash, file name, or external URL)',
|
|
147
|
-
examples: [
|
|
148
|
-
'QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o',
|
|
149
|
-
'waste_transfer_note_2024_001.pdf',
|
|
150
|
-
'https://docs.example.com/certificates/disposal_cert_456.pdf',
|
|
151
|
-
'bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi',
|
|
152
|
-
'processing_receipt_20240315.jpg',
|
|
153
|
-
],
|
|
154
|
-
}),
|
|
155
|
-
issue_date: IsoDateSchema.optional().meta({
|
|
156
|
-
title: 'Issue Date',
|
|
157
|
-
description: 'Date the document was issued',
|
|
158
|
-
}),
|
|
159
|
-
issuer: NonEmptyStringSchema.max(100)
|
|
160
|
-
.optional()
|
|
161
|
-
.meta({
|
|
162
|
-
title: 'Document Issuer',
|
|
163
|
-
description: 'Entity that issued the document',
|
|
164
|
-
examples: [
|
|
165
|
-
'Environmental Protection Agency',
|
|
166
|
-
'Waste Management Solutions Ltd',
|
|
167
|
-
'Green Recycling Corp',
|
|
168
|
-
'City Waste Authority',
|
|
169
|
-
'EcoProcess Industries',
|
|
170
|
-
'Regional Environmental Office',
|
|
171
|
-
],
|
|
172
|
-
}),
|
|
173
|
-
})
|
|
174
|
-
.meta({
|
|
175
|
-
title: 'Event Document',
|
|
176
|
-
description: 'Supporting event document',
|
|
177
|
-
});
|
|
178
|
-
const MassIDChainOfCustodyEventSchema = z
|
|
179
|
-
.strictObject({
|
|
180
|
-
event_id: UuidSchema.meta({
|
|
181
|
-
title: 'Event ID',
|
|
182
|
-
description: 'Unique event identifier',
|
|
183
|
-
}),
|
|
184
|
-
event_name: NonEmptyStringSchema.max(50).meta({
|
|
185
|
-
title: 'Event Name',
|
|
186
|
-
description: 'Name of custody or processing event',
|
|
187
|
-
examples: ['Sorting', 'Processing', 'Recycling', 'Weighing'],
|
|
188
|
-
}),
|
|
189
|
-
description: NonEmptyStringSchema.max(200)
|
|
190
|
-
.optional()
|
|
191
|
-
.meta({
|
|
192
|
-
title: 'Event Description',
|
|
193
|
-
description: 'Detailed description of what happened during this event',
|
|
194
|
-
examples: [
|
|
195
|
-
'Waste collected from residential area using collection truck',
|
|
196
|
-
'Material sorted into recyclable and non-recyclable fractions',
|
|
197
|
-
'Plastic waste processed through shredding and washing',
|
|
198
|
-
'Waste transferred to authorized recycling facility',
|
|
199
|
-
'Final disposal at licensed landfill site',
|
|
200
|
-
'Quality inspection and contamination assessment completed',
|
|
201
|
-
],
|
|
202
|
-
}),
|
|
203
|
-
timestamp: IsoTimestampSchema.meta({
|
|
204
|
-
title: 'Event Timestamp',
|
|
205
|
-
description: 'ISO 8601 timestamp when the event occurred',
|
|
206
|
-
}),
|
|
207
|
-
participant_id: UuidSchema.meta({
|
|
208
|
-
title: 'Participant ID',
|
|
209
|
-
description: 'Reference to participant in the participants array',
|
|
210
|
-
}),
|
|
211
|
-
location_id: UuidSchema.meta({
|
|
212
|
-
title: 'Location ID',
|
|
213
|
-
description: 'Reference to location in the locations array',
|
|
214
|
-
}),
|
|
215
|
-
weight: NonNegativeFloatSchema.optional().meta({
|
|
216
|
-
title: 'Event Weight',
|
|
217
|
-
description: 'Mass weight after this event',
|
|
218
|
-
}),
|
|
219
|
-
attributes: z.array(EventAttributeSchema).optional().meta({
|
|
220
|
-
title: 'Event Attributes',
|
|
221
|
-
description: 'Additional attributes specific to this event',
|
|
222
|
-
}),
|
|
223
|
-
documentation: z.array(EventDocumentSchema).optional().meta({
|
|
224
|
-
title: 'Event Documentation',
|
|
225
|
-
description: 'Associated documentation for this event',
|
|
226
|
-
}),
|
|
227
|
-
notes: NonEmptyStringSchema.max(500).optional().meta({
|
|
228
|
-
title: 'Event Notes',
|
|
229
|
-
description: 'Additional notes or comments about this event',
|
|
230
|
-
}),
|
|
231
|
-
})
|
|
232
|
-
.meta({
|
|
233
|
-
title: 'Chain of Custody Event',
|
|
234
|
-
description: 'Chain of custody event',
|
|
235
|
-
});
|
|
236
|
-
const MassIDChainOfCustodySchema = z
|
|
237
|
-
.strictObject({
|
|
238
|
-
events: z.array(MassIDChainOfCustodyEventSchema).min(1).meta({
|
|
239
|
-
title: 'Custody Events',
|
|
240
|
-
description: 'Chronological sequence of custody transfer and processing events',
|
|
241
|
-
}),
|
|
242
|
-
total_distance_km: NonNegativeFloatSchema.meta({
|
|
243
|
-
title: 'Total Distance (km)',
|
|
244
|
-
description: 'Total distance traveled across all transport events',
|
|
245
|
-
}),
|
|
246
|
-
total_duration_hours: HoursSchema.meta({
|
|
247
|
-
title: 'Total Duration (hours)',
|
|
248
|
-
description: 'Total time from first to last event in hours',
|
|
249
|
-
}),
|
|
250
|
-
})
|
|
251
|
-
.meta({
|
|
252
|
-
title: 'Chain of Custody',
|
|
253
|
-
description: 'Complete chain of custody tracking from waste generation to final processing',
|
|
254
|
-
});
|
|
255
|
-
const MassIDTransportRouteSchema = z
|
|
256
|
-
.strictObject({
|
|
257
|
-
from_location_id: UuidSchema.meta({
|
|
258
|
-
title: 'From Location ID',
|
|
259
|
-
description: 'Reference to the origin location in the locations array',
|
|
260
|
-
}),
|
|
261
|
-
to_location_id: UuidSchema.meta({
|
|
262
|
-
title: 'To Location ID',
|
|
263
|
-
description: 'Reference to the destination location in the locations array',
|
|
264
|
-
}),
|
|
265
|
-
distance_km: NonNegativeFloatSchema.meta({
|
|
266
|
-
title: 'Distance (km)',
|
|
267
|
-
description: 'Distance for this route segment in kilometers',
|
|
268
|
-
}),
|
|
269
|
-
transport_method: NonEmptyStringSchema.max(50).meta({
|
|
270
|
-
title: 'Transport Method',
|
|
271
|
-
description: 'Method of transportation for this segment',
|
|
272
|
-
examples: [
|
|
273
|
-
'Truck',
|
|
274
|
-
'Rail',
|
|
275
|
-
'Barge',
|
|
276
|
-
'Container Ship',
|
|
277
|
-
'Conveyor Belt',
|
|
278
|
-
'Pipeline',
|
|
279
|
-
'Walking',
|
|
280
|
-
'Forklift',
|
|
281
|
-
],
|
|
282
|
-
}),
|
|
283
|
-
duration_hours: HoursSchema.meta({
|
|
284
|
-
title: 'Duration (hours)',
|
|
285
|
-
description: 'Time taken for this route segment in hours',
|
|
286
|
-
}),
|
|
287
|
-
})
|
|
288
|
-
.meta({
|
|
289
|
-
title: 'Transport Route',
|
|
290
|
-
description: 'Transport route segment information',
|
|
291
|
-
});
|
|
292
|
-
const MassIDGeographicDataSchema = z
|
|
293
|
-
.strictObject({
|
|
294
|
-
origin_location_id: UuidSchema.meta({
|
|
295
|
-
title: 'Origin Location ID',
|
|
296
|
-
description: 'Reference to origin location in the locations array',
|
|
297
|
-
}),
|
|
298
|
-
processing_location_ids: z.array(UuidSchema).optional().meta({
|
|
299
|
-
title: 'Processing Location IDs',
|
|
300
|
-
description: 'Locations where the waste was processed or handled',
|
|
301
|
-
}),
|
|
302
|
-
final_destination_id: UuidSchema.meta({
|
|
303
|
-
title: 'Final Destination ID',
|
|
304
|
-
description: 'Reference to final destination in the locations array',
|
|
305
|
-
}),
|
|
306
|
-
transport_routes: z.array(MassIDTransportRouteSchema).meta({
|
|
307
|
-
title: 'Transport Routes',
|
|
308
|
-
description: 'Detailed transport route information',
|
|
309
|
-
}),
|
|
310
|
-
})
|
|
311
|
-
.meta({
|
|
312
|
-
title: 'Geographic Data',
|
|
313
|
-
description: 'Geographic information about waste origin and processing locations',
|
|
314
|
-
});
|
|
315
|
-
export const MassIDDataSchema = z
|
|
316
|
-
.strictObject({
|
|
317
|
-
waste_classification: MassIDWasteClassificationSchema,
|
|
318
|
-
locations: uniqueBy(LocationSchema, (loc) => loc.id, 'Location IDs must be unique')
|
|
319
|
-
.min(1)
|
|
320
|
-
.meta({
|
|
321
|
-
title: 'Locations',
|
|
322
|
-
description: 'All locations referenced in this MassID, indexed by ID',
|
|
323
|
-
}),
|
|
324
|
-
participants: uniqueBy(ParticipantSchema, (p) => p.id, 'Participant IDs must be unique')
|
|
325
|
-
.min(1)
|
|
326
|
-
.meta({
|
|
327
|
-
title: 'Participants',
|
|
328
|
-
description: 'All participants referenced in this MassID, indexed by ID',
|
|
329
|
-
}),
|
|
330
|
-
chain_of_custody: MassIDChainOfCustodySchema,
|
|
331
|
-
geographic_data: MassIDGeographicDataSchema,
|
|
332
|
-
})
|
|
333
|
-
.refine((data) => {
|
|
334
|
-
const participantIdSet = new Set(data.participants.map((participant) => participant.id));
|
|
335
|
-
const eventParticipantIds = data.chain_of_custody.events.map((event) => event.participant_id);
|
|
336
|
-
const allEventParticipantsExist = eventParticipantIds.every((participantId) => participantIdSet.has(participantId));
|
|
337
|
-
return allEventParticipantsExist;
|
|
338
|
-
}, 'All participant IDs in chain of custody events must exist in participants array')
|
|
339
|
-
.refine((data) => {
|
|
340
|
-
const locationIdSet = new Set(data.locations.map((location) => location.id));
|
|
341
|
-
const eventLocationIds = data.chain_of_custody.events.map((event) => event.location_id);
|
|
342
|
-
const allEventLocationsExist = eventLocationIds.every((locationId) => locationIdSet.has(locationId));
|
|
343
|
-
return allEventLocationsExist;
|
|
344
|
-
}, 'All location IDs in chain of custody events must exist in locations array')
|
|
345
|
-
.meta({
|
|
346
|
-
title: 'MassID Data',
|
|
347
|
-
description: 'MassID data containing waste tracking and chain of custody information',
|
|
348
|
-
});
|