@carrot-foundation/schemas 0.1.21 → 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 +55 -7
- package/dist/index.cjs +50 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +37 -34
- package/dist/index.d.ts +37 -34
- package/dist/index.js +50 -35
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
- 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
CHANGED
|
@@ -3,7 +3,9 @@ import { z } from 'zod';
|
|
|
3
3
|
declare const MassIDLocalClassificationSchema: z.ZodObject<{
|
|
4
4
|
code: z.ZodString;
|
|
5
5
|
description: z.ZodString;
|
|
6
|
-
system: z.
|
|
6
|
+
system: z.ZodEnum<{
|
|
7
|
+
IBAMA: "IBAMA";
|
|
8
|
+
}>;
|
|
7
9
|
}, z.core.$strict>;
|
|
8
10
|
type MassIDLocalClassification = z.infer<typeof MassIDLocalClassificationSchema>;
|
|
9
11
|
declare const MassIDMeasurementUnitSchema: z.ZodEnum<{
|
|
@@ -18,13 +20,15 @@ declare const ContaminationLevelSchema: z.ZodEnum<{
|
|
|
18
20
|
High: "High";
|
|
19
21
|
}>;
|
|
20
22
|
type ContaminationLevel = z.infer<typeof ContaminationLevelSchema>;
|
|
21
|
-
declare const
|
|
22
|
-
|
|
23
|
+
declare const MassIDWastePropertiesSchema: z.ZodObject<{
|
|
24
|
+
type: z.ZodString;
|
|
23
25
|
subtype: z.ZodString;
|
|
24
26
|
local_classification: z.ZodOptional<z.ZodObject<{
|
|
25
27
|
code: z.ZodString;
|
|
26
28
|
description: z.ZodString;
|
|
27
|
-
system: z.
|
|
29
|
+
system: z.ZodEnum<{
|
|
30
|
+
IBAMA: "IBAMA";
|
|
31
|
+
}>;
|
|
28
32
|
}, z.core.$strict>>;
|
|
29
33
|
measurement_unit: z.ZodEnum<{
|
|
30
34
|
kg: "kg";
|
|
@@ -38,7 +42,7 @@ declare const MassIDWasteClassificationSchema: z.ZodObject<{
|
|
|
38
42
|
High: "High";
|
|
39
43
|
}>>;
|
|
40
44
|
}, z.core.$strict>;
|
|
41
|
-
type
|
|
45
|
+
type MassIDWasteProperties = z.infer<typeof MassIDWastePropertiesSchema>;
|
|
42
46
|
declare const EventAttributeFormatSchema: z.ZodEnum<{
|
|
43
47
|
KILOGRAM: "KILOGRAM";
|
|
44
48
|
DATE: "DATE";
|
|
@@ -49,7 +53,8 @@ declare const EventAttributeFormatSchema: z.ZodEnum<{
|
|
|
49
53
|
type EventAttributeFormat = z.infer<typeof EventAttributeFormatSchema>;
|
|
50
54
|
declare const EventAttributeSchema: z.ZodObject<{
|
|
51
55
|
name: z.ZodString;
|
|
52
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]
|
|
56
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
57
|
+
preserved_sensitivity: z.ZodOptional<z.ZodBoolean>;
|
|
53
58
|
format: z.ZodOptional<z.ZodEnum<{
|
|
54
59
|
KILOGRAM: "KILOGRAM";
|
|
55
60
|
DATE: "DATE";
|
|
@@ -77,7 +82,8 @@ declare const MassIDChainOfCustodyEventSchema: z.ZodObject<{
|
|
|
77
82
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
78
83
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
79
84
|
name: z.ZodString;
|
|
80
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]
|
|
85
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
86
|
+
preserved_sensitivity: z.ZodOptional<z.ZodBoolean>;
|
|
81
87
|
format: z.ZodOptional<z.ZodEnum<{
|
|
82
88
|
KILOGRAM: "KILOGRAM";
|
|
83
89
|
DATE: "DATE";
|
|
@@ -107,7 +113,8 @@ declare const MassIDChainOfCustodySchema: z.ZodObject<{
|
|
|
107
113
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
108
114
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
109
115
|
name: z.ZodString;
|
|
110
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]
|
|
116
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
117
|
+
preserved_sensitivity: z.ZodOptional<z.ZodBoolean>;
|
|
111
118
|
format: z.ZodOptional<z.ZodEnum<{
|
|
112
119
|
KILOGRAM: "KILOGRAM";
|
|
113
120
|
DATE: "DATE";
|
|
@@ -151,13 +158,15 @@ declare const MassIDGeographicDataSchema: z.ZodObject<{
|
|
|
151
158
|
}, z.core.$strict>;
|
|
152
159
|
type MassIDGeographicData = z.infer<typeof MassIDGeographicDataSchema>;
|
|
153
160
|
declare const MassIDDataSchema: z.ZodObject<{
|
|
154
|
-
|
|
155
|
-
|
|
161
|
+
waste_properties: z.ZodObject<{
|
|
162
|
+
type: z.ZodString;
|
|
156
163
|
subtype: z.ZodString;
|
|
157
164
|
local_classification: z.ZodOptional<z.ZodObject<{
|
|
158
165
|
code: z.ZodString;
|
|
159
166
|
description: z.ZodString;
|
|
160
|
-
system: z.
|
|
167
|
+
system: z.ZodEnum<{
|
|
168
|
+
IBAMA: "IBAMA";
|
|
169
|
+
}>;
|
|
161
170
|
}, z.core.$strict>>;
|
|
162
171
|
measurement_unit: z.ZodEnum<{
|
|
163
172
|
kg: "kg";
|
|
@@ -191,15 +200,10 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
191
200
|
}>;
|
|
192
201
|
}, z.core.$strict>;
|
|
193
202
|
facility_type: z.ZodOptional<z.ZodEnum<{
|
|
194
|
-
"Waste Generation": "Waste Generation";
|
|
195
203
|
"Collection Point": "Collection Point";
|
|
196
|
-
"Transfer Station": "Transfer Station";
|
|
197
|
-
"Sorting Facility": "Sorting Facility";
|
|
198
|
-
"Composting Facility": "Composting Facility";
|
|
199
204
|
"Recycling Facility": "Recycling Facility";
|
|
200
|
-
"Processing Facility": "Processing Facility";
|
|
201
|
-
"Disposal Facility": "Disposal Facility";
|
|
202
205
|
"Administrative Office": "Administrative Office";
|
|
206
|
+
Other: "Other";
|
|
203
207
|
}>>;
|
|
204
208
|
}, z.core.$strict>>;
|
|
205
209
|
participants: z.ZodArray<z.ZodObject<{
|
|
@@ -218,7 +222,8 @@ declare const MassIDDataSchema: z.ZodObject<{
|
|
|
218
222
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
219
223
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
220
224
|
name: z.ZodString;
|
|
221
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]
|
|
225
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
226
|
+
preserved_sensitivity: z.ZodOptional<z.ZodBoolean>;
|
|
222
227
|
format: z.ZodOptional<z.ZodEnum<{
|
|
223
228
|
KILOGRAM: "KILOGRAM";
|
|
224
229
|
DATE: "DATE";
|
|
@@ -297,7 +302,7 @@ declare const AttributeIntegratorSchema: z.ZodObject<{
|
|
|
297
302
|
type AttributeIntegrator = z.infer<typeof AttributeIntegratorSchema>;
|
|
298
303
|
declare const AttributePickUpDateSchema: z.ZodObject<{
|
|
299
304
|
trait_type: z.ZodLiteral<"Pick-up Date">;
|
|
300
|
-
value: z.
|
|
305
|
+
value: z.ZodNumber;
|
|
301
306
|
display_type: z.ZodLiteral<"date">;
|
|
302
307
|
}, z.core.$strict>;
|
|
303
308
|
type AttributePickUpDate = z.infer<typeof AttributePickUpDateSchema>;
|
|
@@ -334,7 +339,7 @@ declare const MassIDAttributesSchema: z.ZodTuple<[z.ZodObject<{
|
|
|
334
339
|
value: z.ZodString;
|
|
335
340
|
}, z.core.$strict>, z.ZodObject<{
|
|
336
341
|
trait_type: z.ZodLiteral<"Pick-up Date">;
|
|
337
|
-
value: z.
|
|
342
|
+
value: z.ZodNumber;
|
|
338
343
|
display_type: z.ZodLiteral<"date">;
|
|
339
344
|
}, z.core.$strict>, z.ZodObject<{
|
|
340
345
|
trait_type: z.ZodLiteral<"Recycling Date">;
|
|
@@ -345,8 +350,8 @@ type MassIDAttributes = z.infer<typeof MassIDAttributesSchema>;
|
|
|
345
350
|
declare const MassIDIpfsSchemaMeta: {
|
|
346
351
|
readonly title: "MassID NFT IPFS Record";
|
|
347
352
|
readonly description: "Complete MassID NFT IPFS record including fixed attributes and detailed waste tracking data";
|
|
348
|
-
readonly $id:
|
|
349
|
-
readonly version:
|
|
353
|
+
readonly $id: string;
|
|
354
|
+
readonly version: string;
|
|
350
355
|
};
|
|
351
356
|
declare const MassIDIpfsSchema: z.ZodObject<{
|
|
352
357
|
$schema: z.ZodURL;
|
|
@@ -437,7 +442,7 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
437
442
|
value: z.ZodString;
|
|
438
443
|
}, z.core.$strict>, z.ZodObject<{
|
|
439
444
|
trait_type: z.ZodLiteral<"Pick-up Date">;
|
|
440
|
-
value: z.
|
|
445
|
+
value: z.ZodNumber;
|
|
441
446
|
display_type: z.ZodLiteral<"date">;
|
|
442
447
|
}, z.core.$strict>, z.ZodObject<{
|
|
443
448
|
trait_type: z.ZodLiteral<"Recycling Date">;
|
|
@@ -445,13 +450,15 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
445
450
|
display_type: z.ZodLiteral<"date">;
|
|
446
451
|
}, z.core.$strict>], null>;
|
|
447
452
|
data: z.ZodObject<{
|
|
448
|
-
|
|
449
|
-
|
|
453
|
+
waste_properties: z.ZodObject<{
|
|
454
|
+
type: z.ZodString;
|
|
450
455
|
subtype: z.ZodString;
|
|
451
456
|
local_classification: z.ZodOptional<z.ZodObject<{
|
|
452
457
|
code: z.ZodString;
|
|
453
458
|
description: z.ZodString;
|
|
454
|
-
system: z.
|
|
459
|
+
system: z.ZodEnum<{
|
|
460
|
+
IBAMA: "IBAMA";
|
|
461
|
+
}>;
|
|
455
462
|
}, z.core.$strict>>;
|
|
456
463
|
measurement_unit: z.ZodEnum<{
|
|
457
464
|
kg: "kg";
|
|
@@ -485,15 +492,10 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
485
492
|
}>;
|
|
486
493
|
}, z.core.$strict>;
|
|
487
494
|
facility_type: z.ZodOptional<z.ZodEnum<{
|
|
488
|
-
"Waste Generation": "Waste Generation";
|
|
489
495
|
"Collection Point": "Collection Point";
|
|
490
|
-
"Transfer Station": "Transfer Station";
|
|
491
|
-
"Sorting Facility": "Sorting Facility";
|
|
492
|
-
"Composting Facility": "Composting Facility";
|
|
493
496
|
"Recycling Facility": "Recycling Facility";
|
|
494
|
-
"Processing Facility": "Processing Facility";
|
|
495
|
-
"Disposal Facility": "Disposal Facility";
|
|
496
497
|
"Administrative Office": "Administrative Office";
|
|
498
|
+
Other: "Other";
|
|
497
499
|
}>>;
|
|
498
500
|
}, z.core.$strict>>;
|
|
499
501
|
participants: z.ZodArray<z.ZodObject<{
|
|
@@ -512,7 +514,8 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
512
514
|
weight: z.ZodOptional<z.ZodNumber>;
|
|
513
515
|
attributes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
514
516
|
name: z.ZodString;
|
|
515
|
-
value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]
|
|
517
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
518
|
+
preserved_sensitivity: z.ZodOptional<z.ZodBoolean>;
|
|
516
519
|
format: z.ZodOptional<z.ZodEnum<{
|
|
517
520
|
KILOGRAM: "KILOGRAM";
|
|
518
521
|
DATE: "DATE";
|
|
@@ -549,4 +552,4 @@ declare const MassIDIpfsSchema: z.ZodObject<{
|
|
|
549
552
|
}, z.core.$strict>;
|
|
550
553
|
type MassIDIpfs = z.infer<typeof MassIDIpfsSchema>;
|
|
551
554
|
|
|
552
|
-
export { type AttributeIntegrator, type AttributeOriginCountry, type AttributeOriginDivision, type AttributeOriginMunicipality, type AttributePickUpDate, type AttributeRecycler, type AttributeRecyclingDate, type AttributeWasteSubtype, type AttributeWasteType, type AttributeWeight, type ContaminationLevel, type EventAttribute, type EventAttributeFormat, type EventDocumentation, type MassIDAttributes, type MassIDChainOfCustody, type MassIDChainOfCustodyEvent, type MassIDData, MassIDDataSchema, type MassIDGeographicData, type MassIDIpfs, MassIDIpfsSchema, MassIDIpfsSchemaMeta, type MassIDLocalClassification, type MassIDMeasurementUnit, type MassIDTransportRoute, type
|
|
555
|
+
export { type AttributeIntegrator, type AttributeOriginCountry, type AttributeOriginDivision, type AttributeOriginMunicipality, type AttributePickUpDate, type AttributeRecycler, type AttributeRecyclingDate, type AttributeWasteSubtype, type AttributeWasteType, type AttributeWeight, type ContaminationLevel, type EventAttribute, type EventAttributeFormat, type EventDocumentation, type MassIDAttributes, type MassIDChainOfCustody, type MassIDChainOfCustodyEvent, type MassIDData, MassIDDataSchema, type MassIDGeographicData, type MassIDIpfs, MassIDIpfsSchema, MassIDIpfsSchemaMeta, type MassIDLocalClassification, type MassIDMeasurementUnit, type MassIDTransportRoute, type MassIDWasteProperties };
|
package/dist/index.js
CHANGED
|
@@ -33,6 +33,11 @@ var IsoDateSchema = z.iso.date("Must be a valid ISO 8601 date (YYYY-MM-DD)").met
|
|
|
33
33
|
description: "ISO 8601 formatted date in YYYY-MM-DD format",
|
|
34
34
|
examples: ["2024-12-05", "2025-02-22", "2024-02-10"]
|
|
35
35
|
});
|
|
36
|
+
var UnixTimestampSchema = z.number().int().positive().meta({
|
|
37
|
+
title: "Unix Timestamp",
|
|
38
|
+
description: "Unix timestamp in milliseconds since epoch (January 1, 1970 00:00:00 UTC)",
|
|
39
|
+
examples: [17040672e5, 17356896e5, 1762371245149]
|
|
40
|
+
});
|
|
36
41
|
var IsoCountryCodeSchema = z.string().regex(/^[A-Z]{2}$/, "Must be a valid ISO 3166-1 alpha-2 country code").meta({
|
|
37
42
|
title: "ISO Country Code",
|
|
38
43
|
description: "Two-letter country code following ISO 3166-1 alpha-2 standard",
|
|
@@ -46,14 +51,14 @@ var IsoAdministrativeDivisionCodeSchema = z.string().regex(
|
|
|
46
51
|
description: "Administrative division code following ISO 3166-2 standard",
|
|
47
52
|
examples: ["BR-AP", "BR-ES", "US-CA"]
|
|
48
53
|
});
|
|
49
|
-
var LatitudeSchema = z.number().min(-90).max(90).meta({
|
|
54
|
+
var LatitudeSchema = z.number().min(-90).max(90).multipleOf(1e-3).meta({
|
|
50
55
|
title: "Latitude",
|
|
51
|
-
description: "Geographic latitude coordinate in decimal degrees",
|
|
52
|
-
examples: [-0.02, -20.38, 40.
|
|
56
|
+
description: "Geographic latitude coordinate in decimal degrees with maximum 3 decimal places precision (~100m-1km accuracy for city-level, non-PII compliance)",
|
|
57
|
+
examples: [-0.02, -20.38, 40.713]
|
|
53
58
|
});
|
|
54
|
-
var LongitudeSchema = z.number().min(-180).max(180).meta({
|
|
59
|
+
var LongitudeSchema = z.number().min(-180).max(180).multipleOf(1e-3).meta({
|
|
55
60
|
title: "Longitude",
|
|
56
|
-
description: "Geographic longitude coordinate in decimal degrees",
|
|
61
|
+
description: "Geographic longitude coordinate in decimal degrees with maximum 3 decimal places precision (~100m-1km accuracy for city-level, non-PII compliance)",
|
|
57
62
|
examples: [-51.06, -40.34, -74.006]
|
|
58
63
|
});
|
|
59
64
|
var WeightKgSchema = z.number().min(0).meta({
|
|
@@ -95,19 +100,18 @@ var ParticipantNameSchema = NonEmptyStringSchema.max(100).meta({
|
|
|
95
100
|
examples: ["Enlatados Produ\xE7\xE3o", "Eco Reciclagem", "Green Tech Corp"]
|
|
96
101
|
});
|
|
97
102
|
var FacilityTypeSchema = z.enum([
|
|
98
|
-
"Waste Generation",
|
|
99
103
|
"Collection Point",
|
|
100
|
-
"Transfer Station",
|
|
101
|
-
"Sorting Facility",
|
|
102
|
-
"Composting Facility",
|
|
103
104
|
"Recycling Facility",
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"Administrative Office"
|
|
105
|
+
"Administrative Office",
|
|
106
|
+
"Other"
|
|
107
107
|
]).meta({
|
|
108
108
|
title: "Facility Type",
|
|
109
|
-
description: "Type of facility in the waste management
|
|
110
|
-
examples: [
|
|
109
|
+
description: "Type of facility in the waste management chain",
|
|
110
|
+
examples: [
|
|
111
|
+
"Collection Point",
|
|
112
|
+
"Recycling Facility",
|
|
113
|
+
"Administrative Office"
|
|
114
|
+
]
|
|
111
115
|
});
|
|
112
116
|
var BlockchainChainIdSchema = z.number().int().min(1).meta({
|
|
113
117
|
title: "Chain ID",
|
|
@@ -361,15 +365,10 @@ var MassIDLocalClassificationSchema = z.strictObject({
|
|
|
361
365
|
"Municipal solid waste - organic fraction"
|
|
362
366
|
]
|
|
363
367
|
}),
|
|
364
|
-
system:
|
|
368
|
+
system: z.enum(["IBAMA"]).meta({
|
|
365
369
|
title: "Classification System",
|
|
366
|
-
description:
|
|
367
|
-
examples: [
|
|
368
|
-
"European Waste Catalogue",
|
|
369
|
-
"US EPA Codes",
|
|
370
|
-
"Ibama Waste Code",
|
|
371
|
-
"Brazilian ABNT Classification"
|
|
372
|
-
]
|
|
370
|
+
description: "Classification system name - currently supports IBAMA (Instituto Brasileiro do Meio Ambiente e dos Recursos Naturais Renov\xE1veis)",
|
|
371
|
+
examples: ["IBAMA"]
|
|
373
372
|
})
|
|
374
373
|
}).meta({
|
|
375
374
|
title: "Local Classification",
|
|
@@ -385,10 +384,10 @@ var ContaminationLevelSchema = z.enum(["None", "Low", "Medium", "High"]).meta({
|
|
|
385
384
|
description: "Level of contamination in the waste batch",
|
|
386
385
|
examples: ["Low", "Medium", "None"]
|
|
387
386
|
});
|
|
388
|
-
var
|
|
389
|
-
|
|
390
|
-
title: "
|
|
391
|
-
description: "
|
|
387
|
+
var MassIDWastePropertiesSchema = z.strictObject({
|
|
388
|
+
type: WasteTypeSchema.meta({
|
|
389
|
+
title: "Waste Type",
|
|
390
|
+
description: "Waste material category"
|
|
392
391
|
}),
|
|
393
392
|
subtype: WasteSubtypeSchema.meta({
|
|
394
393
|
title: "Waste Subtype",
|
|
@@ -402,8 +401,8 @@ var MassIDWasteClassificationSchema = z.strictObject({
|
|
|
402
401
|
}),
|
|
403
402
|
contamination_level: ContaminationLevelSchema.optional()
|
|
404
403
|
}).meta({
|
|
405
|
-
title: "Waste
|
|
406
|
-
description: "Standardized waste material
|
|
404
|
+
title: "Waste Properties",
|
|
405
|
+
description: "Standardized waste material properties and regulatory information"
|
|
407
406
|
});
|
|
408
407
|
var EventAttributeFormatSchema = z.enum(["KILOGRAM", "DATE", "CURRENCY", "PERCENTAGE", "COORDINATE"]).meta({
|
|
409
408
|
title: "Event Attribute Format",
|
|
@@ -425,7 +424,7 @@ var EventAttributeSchema = z.strictObject({
|
|
|
425
424
|
"processing_cost"
|
|
426
425
|
]
|
|
427
426
|
}),
|
|
428
|
-
value: z.union([z.string(), z.number(), z.boolean()]).meta({
|
|
427
|
+
value: z.union([z.string(), z.number(), z.boolean()]).optional().meta({
|
|
429
428
|
title: "Attribute Value",
|
|
430
429
|
description: "Event attribute value",
|
|
431
430
|
examples: [
|
|
@@ -439,6 +438,10 @@ var EventAttributeSchema = z.strictObject({
|
|
|
439
438
|
"OP-456"
|
|
440
439
|
]
|
|
441
440
|
}),
|
|
441
|
+
preserved_sensitivity: z.boolean().optional().meta({
|
|
442
|
+
title: "Preserved Sensitivity",
|
|
443
|
+
description: "Indicates if the attribute contains sensitive information that was preserved"
|
|
444
|
+
}),
|
|
442
445
|
format: EventAttributeFormatSchema.optional()
|
|
443
446
|
}).meta({
|
|
444
447
|
title: "Event Attribute",
|
|
@@ -629,7 +632,7 @@ var MassIDGeographicDataSchema = z.strictObject({
|
|
|
629
632
|
description: "Geographic information about waste origin and processing locations"
|
|
630
633
|
});
|
|
631
634
|
var MassIDDataSchema = z.strictObject({
|
|
632
|
-
|
|
635
|
+
waste_properties: MassIDWastePropertiesSchema,
|
|
633
636
|
locations: uniqueBy(
|
|
634
637
|
LocationSchema,
|
|
635
638
|
(loc) => loc.id,
|
|
@@ -962,6 +965,18 @@ var NftIpfsSchema = BaseIpfsSchema.safeExtend({
|
|
|
962
965
|
description: "NFT-specific fields for Carrot IPFS records"
|
|
963
966
|
});
|
|
964
967
|
|
|
968
|
+
// src/shared/schema-version.ts
|
|
969
|
+
function getSchemaBaseUrl() {
|
|
970
|
+
return `https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/${getSchemaVersionOrDefault()}/schemas/ipfs`;
|
|
971
|
+
}
|
|
972
|
+
function buildSchemaUrl(schemaPath) {
|
|
973
|
+
const cleanPath = schemaPath.startsWith("/") ? schemaPath.slice(1) : schemaPath;
|
|
974
|
+
return `${getSchemaBaseUrl()}/${cleanPath}`;
|
|
975
|
+
}
|
|
976
|
+
function getSchemaVersionOrDefault() {
|
|
977
|
+
return "0.0.0-dev";
|
|
978
|
+
}
|
|
979
|
+
|
|
965
980
|
// src/mass-id/mass-id.schema.ts
|
|
966
981
|
var AttributeWasteTypeSchema = z.strictObject({
|
|
967
982
|
trait_type: z.literal("Waste Type"),
|
|
@@ -1037,14 +1052,14 @@ var AttributeIntegratorSchema = z.strictObject({
|
|
|
1037
1052
|
});
|
|
1038
1053
|
var AttributePickUpDateSchema = z.strictObject({
|
|
1039
1054
|
trait_type: z.literal("Pick-up Date"),
|
|
1040
|
-
value:
|
|
1055
|
+
value: UnixTimestampSchema.meta({
|
|
1041
1056
|
title: "Pick-up Date Value",
|
|
1042
|
-
description: "
|
|
1057
|
+
description: "Unix timestamp in milliseconds when the waste was picked up from the source"
|
|
1043
1058
|
}),
|
|
1044
1059
|
display_type: z.literal("date")
|
|
1045
1060
|
}).meta({
|
|
1046
1061
|
title: "Pick-up Date Attribute",
|
|
1047
|
-
description: "Pick-up date attribute"
|
|
1062
|
+
description: "Pick-up date attribute with Unix timestamp"
|
|
1048
1063
|
});
|
|
1049
1064
|
var AttributeRecyclingDateSchema = z.strictObject({
|
|
1050
1065
|
trait_type: z.literal("Recycling Date"),
|
|
@@ -1075,8 +1090,8 @@ var MassIDAttributesSchema = z.tuple([
|
|
|
1075
1090
|
var MassIDIpfsSchemaMeta = {
|
|
1076
1091
|
title: "MassID NFT IPFS Record",
|
|
1077
1092
|
description: "Complete MassID NFT IPFS record including fixed attributes and detailed waste tracking data",
|
|
1078
|
-
$id: "
|
|
1079
|
-
version:
|
|
1093
|
+
$id: buildSchemaUrl("mass-id/mass-id.schema.json"),
|
|
1094
|
+
version: getSchemaVersionOrDefault()
|
|
1080
1095
|
};
|
|
1081
1096
|
var MassIDIpfsSchema = NftIpfsSchema.safeExtend({
|
|
1082
1097
|
schema: NftIpfsSchema.shape.schema.safeExtend({
|