@carrot-foundation/schemas 0.1.18 β 0.1.19
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 +49 -3
- package/dist/index.cjs +1104 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +552 -0
- package/dist/index.d.ts +552 -2
- package/dist/index.js +1100 -1
- package/dist/index.js.map +1 -0
- package/package.json +6 -4
- 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
package/README.md
CHANGED
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
This repository contains all JSON Schemas used across the Carrot ecosystem.
|
|
4
4
|
|
|
5
|
-
These schemas define the structure of IPFS metadata for tokenized assets.
|
|
5
|
+
These schemas define the structure of IPFS metadata for tokenized assets and other schemas.
|
|
6
|
+
|
|
6
7
|
They are versioned, publicly referenceable, and used for validation, traceability, and frontend/backend integration.
|
|
7
8
|
|
|
8
9
|
## π¦ Structure
|
|
9
10
|
|
|
10
11
|
- Schemas are organized by type (e.g., `mass-id`, `gas-id`, `shared`) and follow [Semantic Versioning](https://semver.org/), but folder names are not versioned.
|
|
11
12
|
- Each schema lives in its own folder and includes an `example.json` for testing and documentation.
|
|
12
|
-
- Shared components
|
|
13
|
+
- Shared components are located in `src/shared/**`.
|
|
13
14
|
|
|
14
15
|
## π Versioning
|
|
15
16
|
|
|
16
|
-
- Schemas are versioned using
|
|
17
|
+
- Schemas are versioned using isolated versioning; each schema can evolve independently.
|
|
17
18
|
- For released versions, each schemaβs `$id` must point to the tagged raw URL to remain immutable.
|
|
18
19
|
- During development on `main`, `$id` may reference `refs/heads/main`, but consumers should pin to tags in production.
|
|
19
20
|
- Keep `$ref` paths relative; they resolve against the `$id` base (the tag) at validation time.
|
|
@@ -24,6 +25,51 @@ Example `$id` pinned to a tag:
|
|
|
24
25
|
"$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/v0.1.0/schemas/ipfs/collection/collection.schema.json"
|
|
25
26
|
```
|
|
26
27
|
|
|
28
|
+
## π Package Usage
|
|
29
|
+
|
|
30
|
+
This package is published to npm as `@carrot-foundation/schemas` and supports both **ESM** and **CommonJS** module formats.
|
|
31
|
+
|
|
32
|
+
### Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install @carrot-foundation/schemas
|
|
36
|
+
# or
|
|
37
|
+
pnpm add @carrot-foundation/schemas
|
|
38
|
+
# or
|
|
39
|
+
yarn add @carrot-foundation/schemas
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### ESM (ECMAScript Modules)
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
import { MassIDIpfsSchema, MassIDDataSchema } from '@carrot-foundation/schemas';
|
|
46
|
+
|
|
47
|
+
// Use the schemas for validation
|
|
48
|
+
const result = MassIDIpfsSchema.safeParse(data);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### CommonJS
|
|
52
|
+
|
|
53
|
+
```javascript
|
|
54
|
+
const { MassIDIpfsSchema, MassIDDataSchema } = require('@carrot-foundation/schemas');
|
|
55
|
+
|
|
56
|
+
// Use the schemas for validation
|
|
57
|
+
const result = MassIDIpfsSchema.safeParse(data);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### TypeScript Support
|
|
61
|
+
|
|
62
|
+
The package includes full TypeScript definitions:
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { MassIDIpfs, MassIDData } from '@carrot-foundation/schemas';
|
|
66
|
+
|
|
67
|
+
// Types are automatically inferred from the schemas
|
|
68
|
+
const massIdData: MassIDData = {
|
|
69
|
+
// ...
|
|
70
|
+
};
|
|
71
|
+
```
|
|
72
|
+
|
|
27
73
|
## β
Usage
|
|
28
74
|
|
|
29
75
|
You may:
|