@carrot-foundation/schemas 0.1.36 → 0.1.37

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.
Files changed (40) hide show
  1. package/dist/index.cjs +1124 -36
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +959 -13
  4. package/dist/index.d.ts +959 -13
  5. package/dist/index.js +1102 -37
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/schemas/ipfs/collection/collection.example.json +1 -0
  9. package/schemas/ipfs/collection/collection.schema.json +305 -32
  10. package/schemas/ipfs/credit/credit.example.json +1 -0
  11. package/schemas/ipfs/credit/credit.schema.json +326 -45
  12. package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.example.json +290 -0
  13. package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.schema.json +1768 -0
  14. package/schemas/ipfs/gas-id/gas-id.schema.json +6 -6
  15. package/schemas/ipfs/mass-id/mass-id.schema.json +6 -6
  16. package/schemas/ipfs/mass-id-audit/mass-id-audit.example.json +30 -29
  17. package/schemas/ipfs/mass-id-audit/mass-id-audit.schema.json +636 -15
  18. package/schemas/ipfs/methodology/methodology.example.json +27 -26
  19. package/schemas/ipfs/methodology/methodology.schema.json +457 -15
  20. package/schemas/ipfs/recycled-id/recycled-id.schema.json +6 -6
  21. package/schemas/ipfs/gas-id/gas-id.attributes.schema.json +0 -219
  22. package/schemas/ipfs/gas-id/gas-id.data.schema.json +0 -120
  23. package/schemas/ipfs/mass-id-audit/mass-id-audit.data.schema.json +0 -130
  24. package/schemas/ipfs/methodology/methodology.data.schema.json +0 -121
  25. package/schemas/ipfs/purchase-id/purchase-id.attributes.schema.json +0 -91
  26. package/schemas/ipfs/purchase-id/purchase-id.data.schema.json +0 -337
  27. package/schemas/ipfs/purchase-id/purchase-id.example.json +0 -224
  28. package/schemas/ipfs/purchase-id/purchase-id.schema.json +0 -29
  29. package/schemas/ipfs/recycled-id/recycled-id.attributes.schema.json +0 -202
  30. package/schemas/ipfs/recycled-id/recycled-id.data.schema.json +0 -63
  31. package/schemas/ipfs/shared/base/base.schema.json +0 -163
  32. package/schemas/ipfs/shared/certificate/certificate.schema.json +0 -145
  33. package/schemas/ipfs/shared/definitions/definitions.schema.json +0 -255
  34. package/schemas/ipfs/shared/entities/location/location.schema.json +0 -90
  35. package/schemas/ipfs/shared/entities/participant/participant.schema.json +0 -28
  36. package/schemas/ipfs/shared/nft/nft.schema.json +0 -182
  37. package/schemas/ipfs/shared/references/audit-reference/audit-reference.schema.json +0 -42
  38. package/schemas/ipfs/shared/references/gas-id-reference/gas-id-reference.schema.json +0 -27
  39. package/schemas/ipfs/shared/references/mass-id-reference/mass-id-reference.schema.json +0 -27
  40. package/schemas/ipfs/shared/references/methodology-reference/methodology-reference.schema.json +0 -34
@@ -1,26 +1,468 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/methodology/methodology.schema.json",
4
3
  "title": "Methodology IPFS Record",
5
- "unevaluatedProperties": false,
6
- "allOf": [
7
- {
8
- "$ref": "../shared/base/base.schema.json"
4
+ "description": "Methodology metadata stored in IPFS, extending the base schema with methodology data and audit rules",
5
+ "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.1.37/schemas/ipfs/methodology/methodology.schema.json",
6
+ "version": "0.1.37",
7
+ "type": "object",
8
+ "properties": {
9
+ "$schema": {
10
+ "title": "JSON Schema URI",
11
+ "description": "URI of the JSON Schema used to validate this record",
12
+ "example": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/shared/base/base.schema.json",
13
+ "type": "string",
14
+ "format": "uri"
9
15
  },
10
- {
16
+ "schema": {
11
17
  "type": "object",
12
18
  "properties": {
13
- "schema": {
14
- "properties": {
15
- "type": {
16
- "const": "Methodology"
19
+ "hash": {
20
+ "title": "Schema Hash",
21
+ "description": "Keccak256 hash of the JSON Schema this record was validated against",
22
+ "examples": [
23
+ "ac08c3cf2e175e55961d6affdb38bc24591b84ceef7f3707c69ae3d52c148b2f",
24
+ "0xac08c3cf2e175e55961d6affdb38bc24591b84ceef7f3707c69ae3d52c148b2f"
25
+ ],
26
+ "anyOf": [
27
+ {
28
+ "title": "Keccak256 Hash",
29
+ "description": "Keccak256 cryptographic hash as hexadecimal string",
30
+ "examples": [
31
+ "ac08c3cf2e175e55961d6affdb38bc24591b84ceef7f3707c69ae3d52c148b2f",
32
+ "b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2"
33
+ ],
34
+ "type": "string",
35
+ "pattern": "^[0-9a-fA-F]{64}$"
36
+ },
37
+ {
38
+ "type": "string",
39
+ "pattern": "^0x[a-fA-F0-9]{64}$"
17
40
  }
18
- }
41
+ ]
42
+ },
43
+ "type": {
44
+ "title": "Methodology Schema Type",
45
+ "description": "Methodology schema type",
46
+ "type": "string",
47
+ "const": "Methodology"
19
48
  },
20
- "data": {
21
- "$ref": "./methodology.data.schema.json"
49
+ "version": {
50
+ "title": "Schema Version",
51
+ "description": "Version of the schema, using semantic versioning",
52
+ "examples": [
53
+ "0.1.0",
54
+ "1.0.0",
55
+ "2.1.3"
56
+ ],
57
+ "type": "string",
58
+ "minLength": 1,
59
+ "pattern": "^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$"
22
60
  }
61
+ },
62
+ "required": [
63
+ "hash",
64
+ "type",
65
+ "version"
66
+ ],
67
+ "additionalProperties": false
68
+ },
69
+ "created_at": {
70
+ "title": "Created At",
71
+ "description": "ISO 8601 creation timestamp for this record",
72
+ "examples": [
73
+ "2024-12-05T11:02:47.000Z",
74
+ "2025-02-22T10:35:12.000Z"
75
+ ],
76
+ "type": "string",
77
+ "format": "date-time",
78
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
79
+ },
80
+ "external_id": {
81
+ "title": "External ID",
82
+ "description": "Off-chain reference ID (UUID from Carrot backend)",
83
+ "examples": [
84
+ "ad44dd3f-f176-4b98-bf78-5ee6e77d0530",
85
+ "b2c4e6f8-a1b3-4c5d-9e8f-123456789abc"
86
+ ],
87
+ "type": "string",
88
+ "format": "uuid",
89
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
90
+ },
91
+ "external_url": {
92
+ "title": "External URL",
93
+ "description": "External URL of the content",
94
+ "examples": [
95
+ "https://explore.carrot.eco/document/ad44dd3f-f176-4b98-bf78-5ee6e77d0530",
96
+ "https://carrot.eco/whitepaper.pdf"
97
+ ],
98
+ "type": "string",
99
+ "format": "uri"
100
+ },
101
+ "original_content_hash": {
102
+ "title": "Original Content Hash",
103
+ "description": "SHA-256 hash of the original JSON content including private data before schema validation",
104
+ "examples": [
105
+ "87f633634cc4b02f628685651f0a29b7bfa22a0bd841f725c6772dd00a58d489",
106
+ "6e83b8e6373847bbdc056549bedda38dc88854ce41ba4fca11e0fc6ce3e07ef6"
107
+ ],
108
+ "type": "string",
109
+ "pattern": "^[0-9a-fA-F]{64}$"
110
+ },
111
+ "content_hash": {
112
+ "title": "Content Hash",
113
+ "description": "SHA-256 hash of RFC 8785 canonicalized JSON after schema validation",
114
+ "examples": [
115
+ "87f633634cc4b02f628685651f0a29b7bfa22a0bd841f725c6772dd00a58d489",
116
+ "6e83b8e6373847bbdc056549bedda38dc88854ce41ba4fca11e0fc6ce3e07ef6"
117
+ ],
118
+ "type": "string",
119
+ "pattern": "^[0-9a-fA-F]{64}$"
120
+ },
121
+ "creator": {
122
+ "title": "Creator",
123
+ "description": "Entity that created this record",
124
+ "type": "object",
125
+ "properties": {
126
+ "name": {
127
+ "title": "Creator Name",
128
+ "description": "Company or individual name that created this record",
129
+ "examples": [
130
+ "Carrot Foundation"
131
+ ],
132
+ "type": "string"
133
+ },
134
+ "id": {
135
+ "title": "Creator ID",
136
+ "description": "Unique identifier for the creator",
137
+ "examples": [
138
+ "ad44dd3f-f176-4b98-bf78-5ee6e77d0530",
139
+ "6f520d88-864d-432d-bf9f-5c3166c4818f",
140
+ "f77afa89-1c58-40fd-9bf5-8a86703a8af4"
141
+ ],
142
+ "type": "string",
143
+ "format": "uuid",
144
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
145
+ }
146
+ },
147
+ "required": [
148
+ "name",
149
+ "id"
150
+ ],
151
+ "additionalProperties": false
152
+ },
153
+ "relationships": {
154
+ "title": "Relationships",
155
+ "description": "References to other IPFS records this record relates to",
156
+ "type": "array",
157
+ "items": {
158
+ "title": "Relationship",
159
+ "description": "Relationship to another IPFS record",
160
+ "type": "object",
161
+ "properties": {
162
+ "target_uri": {
163
+ "title": "Target IPFS URI",
164
+ "description": "Target IPFS URI of the referenced record",
165
+ "examples": [
166
+ "ipfs://QmTy8w65yBXgyfG2ZBg5TrfB2hPjrDQH3RCQFJGkARStJb/mass-id-organic.png",
167
+ "ipfs://QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o"
168
+ ],
169
+ "type": "string",
170
+ "minLength": 1,
171
+ "pattern": "^ipfs:\\/\\/[a-zA-Z0-9]+(\\/.*)?$"
172
+ },
173
+ "type": {
174
+ "title": "Relationship Type",
175
+ "description": "Type of relationship to the referenced record",
176
+ "examples": [
177
+ "mass-id",
178
+ "collection",
179
+ "credit-purchase-receipt"
180
+ ],
181
+ "type": "string",
182
+ "enum": [
183
+ "collection",
184
+ "credit",
185
+ "gas-id",
186
+ "mass-id",
187
+ "mass-id-audit",
188
+ "methodology",
189
+ "credit-purchase-receipt",
190
+ "recycled-id"
191
+ ]
192
+ },
193
+ "description": {
194
+ "title": "Relationship Description",
195
+ "description": "Human-readable description of the relationship",
196
+ "examples": [
197
+ "This record supersedes the previous version",
198
+ "Related carbon credit batch",
199
+ "Source document for this verification",
200
+ "Child record derived from this parent",
201
+ "Updated version of original record"
202
+ ],
203
+ "type": "string"
204
+ }
205
+ },
206
+ "required": [
207
+ "target_uri",
208
+ "type"
209
+ ],
210
+ "additionalProperties": false
23
211
  }
212
+ },
213
+ "environment": {
214
+ "title": "Environment",
215
+ "description": "Environment information",
216
+ "type": "object",
217
+ "properties": {
218
+ "blockchain_network": {
219
+ "title": "Blockchain Network",
220
+ "description": "Blockchain Network Environment",
221
+ "type": "string",
222
+ "enum": [
223
+ "mainnet",
224
+ "testnet"
225
+ ]
226
+ },
227
+ "deployment": {
228
+ "title": "Deployment Environment",
229
+ "description": "System environment where this record was generated",
230
+ "type": "string",
231
+ "enum": [
232
+ "production",
233
+ "development",
234
+ "testing"
235
+ ]
236
+ },
237
+ "data_set_name": {
238
+ "title": "Data Set Name",
239
+ "description": "Name of the data set for this record",
240
+ "type": "string",
241
+ "enum": [
242
+ "TEST",
243
+ "PROD"
244
+ ]
245
+ }
246
+ },
247
+ "required": [
248
+ "blockchain_network",
249
+ "deployment",
250
+ "data_set_name"
251
+ ],
252
+ "additionalProperties": false
253
+ },
254
+ "data": {
255
+ "title": "Methodology Data",
256
+ "description": "Methodology-specific data including audit rules",
257
+ "type": "object",
258
+ "properties": {
259
+ "name": {
260
+ "title": "Methodology Name",
261
+ "description": "Full official name of the methodology",
262
+ "examples": [
263
+ "BOLD Recycling",
264
+ "BOLD Carbon (CH₄)"
265
+ ],
266
+ "type": "string",
267
+ "minLength": 1,
268
+ "maxLength": 100
269
+ },
270
+ "short_name": {
271
+ "title": "Methodology Short Name",
272
+ "description": "Abbreviated name for UI display and references",
273
+ "examples": [
274
+ "BOLD Carbon",
275
+ "BOLD Recycling"
276
+ ],
277
+ "type": "string",
278
+ "minLength": 1,
279
+ "maxLength": 50
280
+ },
281
+ "slug": {
282
+ "title": "Methodology Slug",
283
+ "description": "URL-friendly identifier for the methodology",
284
+ "examples": [
285
+ "bold-carbon-ch4",
286
+ "bold-recycling"
287
+ ],
288
+ "type": "string",
289
+ "minLength": 1,
290
+ "maxLength": 100,
291
+ "pattern": "^[a-z0-9-]+$"
292
+ },
293
+ "version": {
294
+ "title": "Methodology Version",
295
+ "description": "Version of the methodology",
296
+ "examples": [
297
+ "0.1.0",
298
+ "1.0.0",
299
+ "2.1.3"
300
+ ],
301
+ "type": "string",
302
+ "minLength": 1,
303
+ "pattern": "^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$"
304
+ },
305
+ "description": {
306
+ "title": "Methodology Description",
307
+ "description": "Comprehensive methodology description including purpose, scope, and implementation approach",
308
+ "type": "string",
309
+ "minLength": 50,
310
+ "maxLength": 2000
311
+ },
312
+ "revision_date": {
313
+ "title": "Revision Date",
314
+ "description": "ISO 8601 date of the last revision to this methodology",
315
+ "examples": [
316
+ "2024-12-05",
317
+ "2025-02-22",
318
+ "2024-02-10"
319
+ ],
320
+ "type": "string",
321
+ "format": "date",
322
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
323
+ },
324
+ "publication_date": {
325
+ "title": "Publication Date",
326
+ "description": "ISO 8601 date of the original publication of this methodology",
327
+ "examples": [
328
+ "2024-12-05",
329
+ "2025-02-22",
330
+ "2024-02-10"
331
+ ],
332
+ "type": "string",
333
+ "format": "date",
334
+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
335
+ },
336
+ "methodology_pdf": {
337
+ "title": "Methodology PDF",
338
+ "description": "IPFS URI pointing to the complete methodology PDF document",
339
+ "examples": [
340
+ "ipfs://QmTy8w65yBXgyfG2ZBg5TrfB2hPjrDQH3RCQFJGkARStJb/mass-id-organic.png",
341
+ "ipfs://QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o"
342
+ ],
343
+ "type": "string",
344
+ "minLength": 1,
345
+ "pattern": "^ipfs:\\/\\/[a-zA-Z0-9]+(\\/.*)?$"
346
+ },
347
+ "mass_id_audit_rules": {
348
+ "title": "MassID Audit Rules",
349
+ "description": "Audit rules that must be executed to check MassID compliance with the methodology",
350
+ "minItems": 1,
351
+ "type": "array",
352
+ "items": {
353
+ "title": "Audit Rule Definition",
354
+ "description": "Definition of an audit rule that must be executed for methodology compliance",
355
+ "type": "object",
356
+ "properties": {
357
+ "rule_id": {
358
+ "title": "Rule ID",
359
+ "description": "Unique identifier for the audit rule",
360
+ "examples": [
361
+ "ad44dd3f-f176-4b98-bf78-5ee6e77d0530",
362
+ "6f520d88-864d-432d-bf9f-5c3166c4818f",
363
+ "f77afa89-1c58-40fd-9bf5-8a86703a8af4"
364
+ ],
365
+ "type": "string",
366
+ "format": "uuid",
367
+ "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$"
368
+ },
369
+ "rule_slug": {
370
+ "title": "Rule Slug",
371
+ "description": "URL-friendly identifier for the rule",
372
+ "examples": [
373
+ "mass-id-123",
374
+ "recycled-plastic",
375
+ "organic-waste"
376
+ ],
377
+ "type": "string",
378
+ "minLength": 1,
379
+ "maxLength": 100,
380
+ "pattern": "^[a-z0-9-]+$"
381
+ },
382
+ "rule_name": {
383
+ "title": "Rule Name",
384
+ "description": "Human-readable name of the rule",
385
+ "examples": [
386
+ "Waste Mass is Unique",
387
+ "No Conflicting GasID or Credit"
388
+ ],
389
+ "type": "string",
390
+ "minLength": 1,
391
+ "maxLength": 100
392
+ },
393
+ "description": {
394
+ "title": "Rule Description",
395
+ "description": "Detailed description of what the rule validates and why it is necessary",
396
+ "examples": [
397
+ "Validates that each MassID is unique within the system to prevent duplicate entries"
398
+ ],
399
+ "type": "string",
400
+ "minLength": 10,
401
+ "maxLength": 500
402
+ },
403
+ "source_code_url": {
404
+ "title": "Rule Source Code URL",
405
+ "description": "GitHub URL pointing to the implementation source code for this rule",
406
+ "examples": [
407
+ "https://github.com/carrot-foundation/methodologies/blob/main/bold-carbon/rules/waste-mass-unique.js"
408
+ ],
409
+ "type": "string",
410
+ "pattern": "^https:\\/\\/github\\.com\\/.*$"
411
+ },
412
+ "mandatory": {
413
+ "title": "Mandatory",
414
+ "description": "Whether this rule is mandatory for methodology compliance",
415
+ "type": "boolean"
416
+ },
417
+ "execution_order": {
418
+ "title": "Rule Execution Order",
419
+ "description": "Sequential order in which this rule must be executed",
420
+ "examples": [
421
+ 1,
422
+ 123,
423
+ 456
424
+ ],
425
+ "type": "integer",
426
+ "minimum": 1,
427
+ "maximum": 9007199254740991
428
+ }
429
+ },
430
+ "required": [
431
+ "rule_id",
432
+ "rule_slug",
433
+ "rule_name",
434
+ "description",
435
+ "source_code_url",
436
+ "mandatory",
437
+ "execution_order"
438
+ ],
439
+ "additionalProperties": false
440
+ }
441
+ }
442
+ },
443
+ "required": [
444
+ "name",
445
+ "short_name",
446
+ "slug",
447
+ "version",
448
+ "description",
449
+ "revision_date",
450
+ "publication_date",
451
+ "methodology_pdf",
452
+ "mass_id_audit_rules"
453
+ ],
454
+ "additionalProperties": false
24
455
  }
25
- ]
26
- }
456
+ },
457
+ "required": [
458
+ "$schema",
459
+ "schema",
460
+ "created_at",
461
+ "external_id",
462
+ "external_url",
463
+ "original_content_hash",
464
+ "content_hash",
465
+ "data"
466
+ ],
467
+ "additionalProperties": false
468
+ }
@@ -2,8 +2,8 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "title": "RecycledID NFT IPFS Record",
4
4
  "description": "Complete RecycledID NFT IPFS record including fixed attributes and recycling outcome data",
5
- "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.1.36/schemas/ipfs/recycled-id/recycled-id.schema.json",
6
- "version": "0.1.36",
5
+ "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.1.37/schemas/ipfs/recycled-id/recycled-id.schema.json",
6
+ "version": "0.1.37",
7
7
  "type": "object",
8
8
  "properties": {
9
9
  "$schema": {
@@ -175,8 +175,8 @@
175
175
  "description": "Type of relationship to the referenced record",
176
176
  "examples": [
177
177
  "mass-id",
178
- "audit",
179
- "collection"
178
+ "collection",
179
+ "credit-purchase-receipt"
180
180
  ],
181
181
  "type": "string",
182
182
  "enum": [
@@ -186,7 +186,7 @@
186
186
  "mass-id",
187
187
  "mass-id-audit",
188
188
  "methodology",
189
- "purchase-id",
189
+ "credit-purchase-receipt",
190
190
  "recycled-id"
191
191
  ]
192
192
  },
@@ -967,7 +967,7 @@
967
967
  "0xabcdef1234567890abcdef1234567890abcdef12"
968
968
  ],
969
969
  "type": "string",
970
- "pattern": "^0x[a-fA-F0-9]{40}$"
970
+ "pattern": "^0x[a-f0-9]{40}$"
971
971
  },
972
972
  "chain_id": {
973
973
  "title": "Chain ID",