@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-foundation/schemas",
3
- "version": "0.1.36",
3
+ "version": "0.1.37",
4
4
  "description": "Carrot schema definitions and zod validation schemas",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,
@@ -13,6 +13,7 @@
13
13
  "created_at": "2024-12-05T14:30:00.000Z",
14
14
  "external_id": "8f2c3445-ef89-4de7-8d95-7c814d5c8af9",
15
15
  "external_url": "https://explore.carrot.eco/collection/bold-cold-start-carazinho",
16
+ "original_content_hash": "8b33fe7f20e0b71c003e63f7db6da83fedef22b4229b5089b78554fc8a2cb987",
16
17
  "content_hash": "8b33fe7f20e0b71c003e63f7db6da83fedef22b4229b5089b78554fc8a2cb987",
17
18
  "creator": {
18
19
  "name": "Carrot Foundation",
@@ -1,47 +1,320 @@
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/collection/collection.schema.json",
4
3
  "title": "Collection IPFS Record",
5
- "unevaluatedProperties": false,
6
- "allOf": [
7
- {
8
- "$ref": "../shared/base/base.schema.json"
4
+ "description": "Collection metadata stored in IPFS, extending the base schema with collection-specific fields required for NFT collection definitions in Carrot's ecosystem",
5
+ "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.1.37/schemas/ipfs/collection/collection.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
- "required": ["name", "description", "image"],
13
18
  "properties": {
14
- "schema": {
15
- "properties": {
16
- "type": {
17
- "const": "Collection"
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}$"
18
40
  }
19
- }
41
+ ]
42
+ },
43
+ "type": {
44
+ "title": "Collection Schema Type",
45
+ "description": "Collection schema type",
46
+ "type": "string",
47
+ "const": "Collection"
20
48
  },
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.-]+)?$"
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": {
21
126
  "name": {
22
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/non_empty_string",
23
- "title": "Collection Name",
24
- "example": "BOLD Cold Start - Carazinho"
127
+ "title": "Creator Name",
128
+ "description": "Company or individual name that created this record",
129
+ "examples": [
130
+ "Carrot Foundation"
131
+ ],
132
+ "type": "string"
25
133
  },
26
- "slug": {
27
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/slug",
28
- "title": "Collection Slug",
29
- "example": "bold-cold-start-carazinho"
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
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
+ ]
30
226
  },
31
- "image": {
32
- "$ref": "../shared/definitions/definitions.schema.json#/$defs/ipfs_uri",
33
- "title": "Collection Image",
34
- "description": "IPFS URI pointing to the collection's visual representation image.",
35
- "example": "ipfs://QmCollectionImageHash/collection-icon.png"
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
+ ]
36
236
  },
37
- "description": {
237
+ "data_set_name": {
238
+ "title": "Data Set Name",
239
+ "description": "Name of the data set for this record",
38
240
  "type": "string",
39
- "minLength": 50,
40
- "maxLength": 1000,
41
- "title": "Collection Description",
42
- "example": "Cold Start is a limited-edition collection created for early supporters of BOLD - Breakthrough in Organic Landfill Diversion. This purchase contributes to reducing global waste and promoting circularity, with funds distributed via smart contract to local recycling operations and communities."
241
+ "enum": [
242
+ "TEST",
243
+ "PROD"
244
+ ]
43
245
  }
44
- }
246
+ },
247
+ "required": [
248
+ "blockchain_network",
249
+ "deployment",
250
+ "data_set_name"
251
+ ],
252
+ "additionalProperties": false
253
+ },
254
+ "data": {
255
+ "title": "Custom Data",
256
+ "description": "Custom data block that includes the record's data",
257
+ "type": "object",
258
+ "propertyNames": {
259
+ "type": "string"
260
+ },
261
+ "additionalProperties": {}
262
+ },
263
+ "name": {
264
+ "title": "Collection Name",
265
+ "description": "Display name of the collection",
266
+ "examples": [
267
+ "BOLD Cold Start - Carazinho",
268
+ "BOLD Brazil"
269
+ ],
270
+ "type": "string",
271
+ "minLength": 1,
272
+ "maxLength": 150
273
+ },
274
+ "slug": {
275
+ "title": "Collection Slug",
276
+ "description": "URL-friendly identifier for a collection",
277
+ "examples": [
278
+ "bold-cold-start-carazinho",
279
+ "bold-brazil"
280
+ ],
281
+ "type": "string",
282
+ "minLength": 1,
283
+ "maxLength": 100,
284
+ "pattern": "^[a-z0-9-]+$"
285
+ },
286
+ "image": {
287
+ "title": "Collection Image",
288
+ "description": "IPFS URI pointing to the collection's visual representation",
289
+ "examples": [
290
+ "ipfs://QmCollectionImageHash/collection-icon.png"
291
+ ],
292
+ "type": "string",
293
+ "minLength": 1,
294
+ "pattern": "^ipfs:\\/\\/[a-zA-Z0-9]+(\\/.*)?$"
295
+ },
296
+ "description": {
297
+ "title": "Collection Description",
298
+ "description": "Comprehensive description of the collection, its purpose, and context",
299
+ "examples": [
300
+ "Cold Start is a limited-edition collection created for early supporters of BOLD - Breakthrough in Organic Landfill Diversion. This purchase contributes to reducing global waste and promoting circularity, with funds distributed via smart contract to local recycling operations and communities."
301
+ ],
302
+ "type": "string",
303
+ "minLength": 50,
304
+ "maxLength": 1000
45
305
  }
46
- ]
47
- }
306
+ },
307
+ "required": [
308
+ "$schema",
309
+ "schema",
310
+ "created_at",
311
+ "external_id",
312
+ "external_url",
313
+ "original_content_hash",
314
+ "content_hash",
315
+ "name",
316
+ "image",
317
+ "description"
318
+ ],
319
+ "additionalProperties": false
320
+ }
@@ -13,6 +13,7 @@
13
13
  "created_at": "2024-12-05T14:30:00.000Z",
14
14
  "external_id": "8f2c3445-ef89-4de7-8d95-7c814d5c8af9",
15
15
  "external_url": "https://explore.carrot.eco/credit/carrot-carbon",
16
+ "original_content_hash": "8b33fe7f20e0b71c003e63f7db6da83fedef22b4229b5089b78554fc8a2cb987",
16
17
  "content_hash": "8b33fe7f20e0b71c003e63f7db6da83fedef22b4229b5089b78554fc8a2cb987",
17
18
  "creator": {
18
19
  "name": "Carrot Foundation",