@carrot-foundation/schemas 0.2.3 → 0.3.0

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 (27) hide show
  1. package/README.md +144 -116
  2. package/dist/index.cjs +204 -267
  3. package/dist/index.cjs.map +1 -1
  4. package/dist/index.d.cts +23 -23
  5. package/dist/index.d.ts +23 -23
  6. package/dist/index.js +204 -267
  7. package/dist/index.js.map +1 -1
  8. package/package.json +20 -20
  9. package/schemas/ipfs/collection/collection.example.json +3 -3
  10. package/schemas/ipfs/collection/collection.schema.json +77 -77
  11. package/schemas/ipfs/credit/credit.example.json +4 -4
  12. package/schemas/ipfs/credit/credit.schema.json +85 -85
  13. package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.example.json +15 -15
  14. package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.schema.json +432 -424
  15. package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.example.json +15 -15
  16. package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.schema.json +465 -457
  17. package/schemas/ipfs/gas-id/gas-id.example.json +9 -9
  18. package/schemas/ipfs/gas-id/gas-id.schema.json +448 -432
  19. package/schemas/ipfs/mass-id/mass-id.example.json +7 -7
  20. package/schemas/ipfs/mass-id/mass-id.schema.json +533 -512
  21. package/schemas/ipfs/mass-id-audit/mass-id-audit.example.json +57 -57
  22. package/schemas/ipfs/mass-id-audit/mass-id-audit.schema.json +225 -217
  23. package/schemas/ipfs/methodology/methodology.example.json +5 -5
  24. package/schemas/ipfs/methodology/methodology.schema.json +124 -124
  25. package/schemas/ipfs/recycled-id/recycled-id.example.json +9 -9
  26. package/schemas/ipfs/recycled-id/recycled-id.schema.json +400 -384
  27. package/schemas/schema-hashes.json +10 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@carrot-foundation/schemas",
3
- "version": "0.2.3",
3
+ "version": "0.3.0",
4
4
  "description": "Carrot schema definitions and zod validation schemas",
5
5
  "license": "Apache-2.0",
6
6
  "private": false,
@@ -90,14 +90,14 @@
90
90
  },
91
91
  "dependencies": {
92
92
  "canonicalize": "2.1.0",
93
- "zod": "4.1.13"
93
+ "zod": "4.3.6"
94
94
  },
95
95
  "devDependencies": {
96
96
  "@arethetypeswrong/cli": "0.18.2",
97
- "@commitlint/cli": "20.1.0",
98
- "@commitlint/config-conventional": "20.0.0",
97
+ "@commitlint/cli": "20.5.0",
98
+ "@commitlint/config-conventional": "20.5.0",
99
99
  "@cspell/dict-pt-br": "2.4.2",
100
- "@eslint/js": "9.39.1",
100
+ "@eslint/js": "10.0.1",
101
101
  "@semantic-release/changelog": "6.0.3",
102
102
  "@semantic-release/commit-analyzer": "13.0.1",
103
103
  "@semantic-release/exec": "7.1.0",
@@ -107,34 +107,34 @@
107
107
  "@semantic-release/release-notes-generator": "14.1.0",
108
108
  "@size-limit/file": "12.0.1",
109
109
  "@tsconfig/recommended": "1.0.13",
110
- "@types/node": "24.10.1",
111
- "@vitest/coverage-v8": "4.0.15",
112
- "@vitest/ui": "4.0.15",
113
- "ajv": "8.17.1",
110
+ "@types/node": "25.5.0",
111
+ "@vitest/coverage-v8": "4.1.2",
112
+ "@vitest/ui": "4.1.2",
113
+ "ajv": "8.18.0",
114
114
  "ajv-formats": "3.0.1",
115
115
  "concurrently": "9.2.1",
116
116
  "conventional-changelog-conventionalcommits": "9.3.0",
117
- "cspell": "9.4.0",
118
- "eslint": "9.39.1",
119
- "eslint-plugin-vitest-globals": "1.5.0",
120
- "glob": "13.0.0",
121
- "globals": "16.5.0",
117
+ "cspell": "9.7.0",
118
+ "eslint": "10.1.0",
119
+ "eslint-plugin-vitest-globals": "1.6.1",
120
+ "glob": "13.0.6",
121
+ "globals": "17.4.0",
122
122
  "husky": "9.1.7",
123
123
  "jiti": "2.6.1",
124
124
  "knip": "6.0.6",
125
125
  "license-checker": "25.0.1",
126
- "lint-staged": "16.2.7",
127
- "npm-package-json-lint": "9.0.0",
126
+ "lint-staged": "16.4.0",
127
+ "npm-package-json-lint": "9.1.0",
128
128
  "npm-package-json-lint-config-default": "8.0.1",
129
129
  "npm-run-all2": "8.0.4",
130
- "prettier": "3.7.4",
130
+ "prettier": "3.8.1",
131
131
  "publint": "0.3.18",
132
132
  "semantic-release": "25.0.3",
133
133
  "size-limit": "12.0.1",
134
134
  "tsup": "8.5.1",
135
- "typescript": "5.9.3",
136
- "typescript-eslint": "8.48.1",
137
- "vitest": "4.0.15"
135
+ "typescript": "6.0.2",
136
+ "typescript-eslint": "8.57.2",
137
+ "vitest": "4.1.2"
138
138
  },
139
139
  "publishConfig": {
140
140
  "access": "public"
@@ -1,9 +1,9 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.2.3/schemas/ipfs/collection/collection.schema.json",
2
+ "$schema": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.3.0/schemas/ipfs/collection/collection.schema.json",
3
3
  "schema": {
4
- "hash": "af8d883fca857641ab379ff451e54d46ec2fc4a14872d18cf4703fea763849af",
4
+ "hash": "2f8e7ae43fabfa0b8d4d18af1413fc375eca4622a4df75829b36492261a2a46d",
5
5
  "type": "Collection",
6
- "version": "0.2.3",
6
+ "version": "0.3.0",
7
7
  "ipfs_uri": "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm"
8
8
  },
9
9
  "environment": {
@@ -1,58 +1,54 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "title": "Collection IPFS Record",
4
- "description": "Collection metadata stored in IPFS, extending the base schema with collection-specific fields used to group and organize credit purchases and retirements in Carrot's ecosystem",
5
- "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.2.3/schemas/ipfs/collection/collection.schema.json",
6
- "version": "0.2.3",
7
3
  "type": "object",
8
4
  "properties": {
9
5
  "$schema": {
6
+ "type": "string",
7
+ "format": "uri",
10
8
  "title": "JSON Schema URI",
11
9
  "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"
10
+ "example": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/heads/main/schemas/ipfs/shared/base/base.schema.json"
15
11
  },
16
12
  "schema": {
17
13
  "type": "object",
18
14
  "properties": {
19
15
  "hash": {
16
+ "type": "string",
17
+ "pattern": "^[0-9a-fA-F]{64}$",
20
18
  "title": "Schema Hash",
21
19
  "description": "SHA-256 hash of the JSON Schema this record was validated against",
22
20
  "examples": [
23
21
  "87f633634cc4b02f628685651f0a29b7bfa22a0bd841f725c6772dd00a58d489"
24
- ],
25
- "type": "string",
26
- "pattern": "^[0-9a-fA-F]{64}$"
22
+ ]
27
23
  },
28
24
  "type": {
29
- "title": "Collection Schema Type",
30
- "description": "Schema type identifier for this record",
31
25
  "type": "string",
32
- "const": "Collection"
26
+ "const": "Collection",
27
+ "title": "Collection Schema Type",
28
+ "description": "Discriminator value identifying this record as a Collection grouping of credits and receipts"
33
29
  },
34
30
  "version": {
31
+ "type": "string",
32
+ "minLength": 1,
33
+ "pattern": "^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$",
35
34
  "title": "Schema Version",
36
35
  "description": "Version of the schema, using semantic versioning",
37
36
  "examples": [
38
37
  "0.1.0",
39
38
  "1.0.0",
40
39
  "2.1.3"
41
- ],
42
- "type": "string",
43
- "minLength": 1,
44
- "pattern": "^v?\\d+\\.\\d+\\.\\d+(-[a-zA-Z0-9.-]+)?(\\+[a-zA-Z0-9.-]+)?$"
40
+ ]
45
41
  },
46
42
  "ipfs_uri": {
43
+ "type": "string",
44
+ "minLength": 1,
45
+ "pattern": "^ipfs:\\/\\/(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|[bB][a-z2-7]{58,}|[zZ][1-9A-HJ-NP-Za-km-z]{48,})(?:\\/[^\\s]*)?$",
47
46
  "title": "Schema IPFS URI",
48
47
  "description": "IPFS URI for this JSON Schema when the primary schema URI is unavailable",
49
48
  "examples": [
50
49
  "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm",
51
50
  "ipfs://bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku"
52
- ],
53
- "type": "string",
54
- "minLength": 1,
55
- "pattern": "^ipfs:\\/\\/(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|[bB][a-z2-7]{58,}|[zZ][1-9A-HJ-NP-Za-km-z]{48,})(?:\\/[^\\s]*)?$"
51
+ ]
56
52
  }
57
53
  },
58
54
  "required": [
@@ -64,99 +60,97 @@
64
60
  "additionalProperties": false
65
61
  },
66
62
  "created_at": {
63
+ "type": "string",
64
+ "format": "date-time",
65
+ "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",
67
66
  "title": "Created At",
68
67
  "description": "ISO 8601 creation timestamp for this record",
69
68
  "examples": [
70
69
  "2024-12-05T11:02:47.000Z"
71
- ],
72
- "type": "string",
73
- "format": "date-time",
74
- "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|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
70
+ ]
75
71
  },
76
72
  "external_id": {
73
+ "type": "string",
74
+ "format": "uuid",
75
+ "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})$",
77
76
  "title": "External ID",
78
- "description": "UUID identifier for external system references",
77
+ "description": "UUID v4 identifier linking this IPFS record to its counterpart in the Carrot platform and other consuming systems",
79
78
  "examples": [
80
79
  "ad44dd3f-f176-4b98-bf78-5ee6e77d0530"
81
- ],
82
- "type": "string",
83
- "format": "uuid",
84
- "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})$"
80
+ ]
85
81
  },
86
82
  "external_url": {
83
+ "type": "string",
84
+ "format": "uri",
87
85
  "title": "External URL",
88
86
  "description": "URL pointing to external resources",
89
87
  "examples": [
90
88
  "https://explore.carrot.eco/",
91
89
  "https://whitepaper.carrot.eco/"
92
- ],
93
- "type": "string",
94
- "format": "uri"
90
+ ]
95
91
  },
96
92
  "viewer_reference": {
97
- "title": "Metadata Viewer Reference",
98
- "description": "References to the metadata viewer dApp, including immutable and latest entry points",
99
93
  "type": "object",
100
94
  "properties": {
101
95
  "ipfs_uri": {
96
+ "type": "string",
97
+ "minLength": 1,
98
+ "pattern": "^ipfs:\\/\\/(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|[bB][a-z2-7]{58,}|[zZ][1-9A-HJ-NP-Za-km-z]{48,})(?:\\/[^\\s]*)?$",
102
99
  "title": "Viewer IPFS URI",
103
100
  "description": "IPFS URI of the metadata viewer dApp build",
104
101
  "examples": [
105
102
  "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm",
106
103
  "ipfs://bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku"
107
- ],
108
- "type": "string",
109
- "minLength": 1,
110
- "pattern": "^ipfs:\\/\\/(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|[bB][a-z2-7]{58,}|[zZ][1-9A-HJ-NP-Za-km-z]{48,})(?:\\/[^\\s]*)?$"
104
+ ]
111
105
  },
112
106
  "integrity_hash": {
107
+ "type": "string",
108
+ "pattern": "^[0-9a-fA-F]{64}$",
113
109
  "title": "Viewer Integrity Hash",
114
110
  "description": "SHA-256 hash of the published viewer bundle to verify integrity",
115
111
  "examples": [
116
112
  "87f633634cc4b02f628685651f0a29b7bfa22a0bd841f725c6772dd00a58d489"
117
- ],
118
- "type": "string",
119
- "pattern": "^[0-9a-fA-F]{64}$"
113
+ ]
120
114
  }
121
115
  },
122
116
  "required": [
123
117
  "ipfs_uri",
124
118
  "integrity_hash"
125
119
  ],
126
- "additionalProperties": false
120
+ "additionalProperties": false,
121
+ "title": "Metadata Viewer Reference",
122
+ "description": "References to the metadata viewer dApp, including immutable and latest entry points"
127
123
  },
128
124
  "environment": {
129
- "title": "Record Environment",
130
- "description": "Environment information for the record",
131
125
  "type": "object",
132
126
  "properties": {
133
127
  "blockchain_network": {
134
- "title": "Blockchain Network",
135
- "description": "Blockchain network where this record is deployed",
136
128
  "type": "string",
137
129
  "enum": [
138
130
  "mainnet",
139
131
  "testnet"
140
- ]
132
+ ],
133
+ "title": "Blockchain Network",
134
+ "description": "Blockchain network where this record is deployed"
141
135
  },
142
136
  "deployment": {
143
- "title": "Deployment Environment",
144
- "description": "System environment where this record was generated",
145
137
  "type": "string",
146
138
  "enum": [
147
139
  "production",
148
140
  "development",
149
141
  "testing"
150
- ]
142
+ ],
143
+ "title": "Deployment Environment",
144
+ "description": "System environment where this record was generated"
151
145
  },
152
146
  "data_set_name": {
153
- "title": "Data Set Name",
154
- "description": "Name of the data set for this record",
155
147
  "type": "string",
156
148
  "enum": [
157
149
  "TEST",
158
150
  "PROD"
159
- ]
151
+ ],
152
+ "title": "Data Set Name",
153
+ "description": "Name of the data set for this record"
160
154
  }
161
155
  },
162
156
  "required": [
@@ -164,7 +158,9 @@
164
158
  "deployment",
165
159
  "data_set_name"
166
160
  ],
167
- "additionalProperties": false
161
+ "additionalProperties": false,
162
+ "title": "Record Environment",
163
+ "description": "Environment information for the record"
168
164
  },
169
165
  "data": {
170
166
  "title": "Custom Data",
@@ -176,54 +172,54 @@
176
172
  "additionalProperties": {}
177
173
  },
178
174
  "name": {
179
- "title": "Collection Name",
180
- "description": "Display name of the collection",
181
- "examples": [
182
- "BOLD Cold Start - Carazinho",
183
- "BOLD Brazil"
184
- ],
185
175
  "type": "string",
186
176
  "enum": [
187
177
  "BOLD Innovators",
188
178
  "BOLD Cold Start - Carazinho",
189
179
  "BOLD Cold Start - Jundiaí",
190
180
  "BOLD Brazil"
181
+ ],
182
+ "title": "Collection Name",
183
+ "description": "Human-readable display name for the environmental credit collection",
184
+ "examples": [
185
+ "BOLD Cold Start - Carazinho",
186
+ "BOLD Brazil"
191
187
  ]
192
188
  },
193
189
  "slug": {
194
- "title": "Collection Slug",
195
- "description": "URL-friendly identifier for a collection",
196
- "examples": [
197
- "bold-cold-start-carazinho",
198
- "bold-brazil"
199
- ],
200
190
  "type": "string",
201
191
  "enum": [
202
192
  "bold-innovators",
203
193
  "bold-cold-start-jundiai",
204
194
  "bold-cold-start-carazinho",
205
195
  "bold-brazil"
196
+ ],
197
+ "title": "Collection Slug",
198
+ "description": "URL-friendly identifier for an environmental credit collection, used in URIs and API references",
199
+ "examples": [
200
+ "bold-cold-start-carazinho",
201
+ "bold-brazil"
206
202
  ]
207
203
  },
208
204
  "image": {
205
+ "type": "string",
206
+ "minLength": 1,
207
+ "pattern": "^ipfs:\\/\\/(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|[bB][a-z2-7]{58,}|[zZ][1-9A-HJ-NP-Za-km-z]{48,})(?:\\/[^\\s]*)?$",
209
208
  "title": "Collection Image",
210
209
  "description": "IPFS URI pointing to the collection's visual representation",
211
210
  "examples": [
212
211
  "ipfs://bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku"
213
- ],
214
- "type": "string",
215
- "minLength": 1,
216
- "pattern": "^ipfs:\\/\\/(?:Qm[1-9A-HJ-NP-Za-km-z]{44}|[bB][a-z2-7]{58,}|[zZ][1-9A-HJ-NP-Za-km-z]{48,})(?:\\/[^\\s]*)?$"
212
+ ]
217
213
  },
218
214
  "description": {
215
+ "type": "string",
216
+ "minLength": 50,
217
+ "maxLength": 1000,
219
218
  "title": "Collection Description",
220
219
  "description": "Comprehensive description of the collection, its purpose, and context",
221
220
  "examples": [
222
221
  "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."
223
- ],
224
- "type": "string",
225
- "minLength": 50,
226
- "maxLength": 1000
222
+ ]
227
223
  }
228
224
  },
229
225
  "required": [
@@ -237,5 +233,9 @@
237
233
  "image",
238
234
  "description"
239
235
  ],
240
- "additionalProperties": false
241
- }
236
+ "additionalProperties": false,
237
+ "title": "Collection IPFS Record",
238
+ "description": "Collection metadata stored in IPFS, extending the base schema with collection-specific fields used to group and organize credit purchases and retirements in Carrot's ecosystem",
239
+ "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.3.0/schemas/ipfs/collection/collection.schema.json",
240
+ "version": "0.3.0"
241
+ }
@@ -1,9 +1,9 @@
1
1
  {
2
- "$schema": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.2.3/schemas/ipfs/credit/credit.schema.json",
2
+ "$schema": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.3.0/schemas/ipfs/credit/credit.schema.json",
3
3
  "schema": {
4
- "hash": "b5007ea555820789788bdd281cd32ff9219378929d4442b3aac7a9738a622d95",
4
+ "hash": "e043c3689a769dfad05f4d20a83821e659266a61d7bfa3a01462d24a91c26e5e",
5
5
  "type": "Credit",
6
- "version": "0.2.3",
6
+ "version": "0.3.0",
7
7
  "ipfs_uri": "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm"
8
8
  },
9
9
  "environment": {
@@ -19,5 +19,5 @@
19
19
  "name": "Carrot Carbon (CH₄)",
20
20
  "decimals": 18,
21
21
  "image": "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm",
22
- "description": "Carrot Carbon (C-CARB.CH4) represents verified carbon emissions reductions from organic waste composting projects. Each token equals one metric ton of CO2 equivalent prevented from entering the atmosphere through sustainable waste management practices. These credits are generated through the BOLD Carbon methodology and provide transparent, traceable environmental impact."
22
+ "description": "Carrot Carbon (C-CARB.CH4) represents verified prevented emissions from organic waste composting projects. Each token equals one metric ton of CO₂ equivalent (CO₂e) prevented from entering the atmosphere through sustainable waste management practices. These credits are generated through the BOLD Carbon methodology and provide transparent, traceable environmental impact."
23
23
  }