@carrot-foundation/schemas 0.1.20 β†’ 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.
Files changed (42) hide show
  1. package/README.md +99 -6
  2. package/dist/index.cjs +1119 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +555 -0
  5. package/dist/index.d.ts +555 -2
  6. package/dist/index.js +1115 -1
  7. package/dist/index.js.map +1 -0
  8. package/package.json +8 -5
  9. package/schemas/ipfs/gas-id/gas-id.example.json +1 -1
  10. package/schemas/ipfs/mass-id/mass-id.example.json +5 -5
  11. package/schemas/ipfs/mass-id/mass-id.schema.json +306 -89
  12. package/schemas/ipfs/recycled-id/recycled-id.example.json +1 -1
  13. package/schemas/ipfs/shared/definitions/definitions.schema.json +3 -8
  14. package/schemas/ipfs/shared/entities/location/location.schema.json +3 -8
  15. package/dist/index.d.ts.map +0 -1
  16. package/dist/mass-id/index.d.ts +0 -3
  17. package/dist/mass-id/index.d.ts.map +0 -1
  18. package/dist/mass-id/index.js +0 -2
  19. package/dist/mass-id/mass-id.data.schema.d.ts +0 -256
  20. package/dist/mass-id/mass-id.data.schema.d.ts.map +0 -1
  21. package/dist/mass-id/mass-id.data.schema.js +0 -348
  22. package/dist/mass-id/mass-id.schema.d.ts +0 -297
  23. package/dist/mass-id/mass-id.schema.d.ts.map +0 -1
  24. package/dist/mass-id/mass-id.schema.js +0 -163
  25. package/dist/shared/base.schema.d.ts +0 -111
  26. package/dist/shared/base.schema.d.ts.map +0 -1
  27. package/dist/shared/base.schema.js +0 -127
  28. package/dist/shared/definitions.schema.d.ts +0 -96
  29. package/dist/shared/definitions.schema.d.ts.map +0 -1
  30. package/dist/shared/definitions.schema.js +0 -283
  31. package/dist/shared/entities/location.schema.d.ts +0 -55
  32. package/dist/shared/entities/location.schema.d.ts.map +0 -1
  33. package/dist/shared/entities/location.schema.js +0 -68
  34. package/dist/shared/entities/participant.schema.d.ts +0 -8
  35. package/dist/shared/entities/participant.schema.d.ts.map +0 -1
  36. package/dist/shared/entities/participant.schema.js +0 -24
  37. package/dist/shared/helpers.schema.d.ts +0 -4
  38. package/dist/shared/helpers.schema.d.ts.map +0 -1
  39. package/dist/shared/helpers.schema.js +0 -16
  40. package/dist/shared/nft.schema.d.ts +0 -116
  41. package/dist/shared/nft.schema.d.ts.map +0 -1
  42. package/dist/shared/nft.schema.js +0 -193
package/README.md CHANGED
@@ -14,15 +14,108 @@ They are versioned, publicly referenceable, and used for validation, traceabilit
14
14
 
15
15
  ## πŸ”– Versioning
16
16
 
17
- - Schemas are versioned using isolated versioning; each schema can evolve independently.
18
- - For released versions, each schema’s `$id` must point to the tagged raw URL to remain immutable.
19
- - During development on `main`, `$id` may reference `refs/heads/main`, but consumers should pin to tags in production.
20
- - Keep `$ref` paths relative; they resolve against the `$id` base (the tag) at validation time.
17
+ This project uses automated schema reference versioning with a **unified versioning approach** for both development and production environments. All schema `$id` fields always reference Git tags, ensuring consistency across all environments.
21
18
 
22
- Example `$id` pinned to a tag:
19
+ ### How It Works
20
+
21
+ - **All builds**: Schemas reference `refs/tags/{version}` where version is set via `SCHEMA_VERSION` environment variable
22
+ - **Default version**: If `SCHEMA_VERSION` is not set, defaults to `0.0.0-dev`
23
+ - **No special cases**: Development and production use the exact same versioning mechanism
24
+
25
+ ### Local Development
26
+
27
+ For local development, the default version `0.0.0-dev` is used automatically:
28
+
29
+ ```bash
30
+ # Build with default dev version (0.0.0-dev)
31
+ pnpm build
32
+ pnpm generate-ipfs-schemas
33
+ ```
34
+
35
+ ### Development Tag Management
36
+
37
+ To test a versioned build locally:
38
+
39
+ ```bash
40
+ # Build with a specific version
41
+ SCHEMA_VERSION=1.2.3 pnpm build
42
+ SCHEMA_VERSION=1.2.3 pnpm generate-ipfs-schemas
43
+ SCHEMA_VERSION=1.2.3 pnpm verify-schema-versions
44
+ ```
45
+
46
+ ### Release Process
47
+
48
+ The release process automatically:
49
+
50
+ 1. Calculates the next version based on conventional commits
51
+ 2. Builds the package with the new version embedded
52
+ 3. Generates JSON schemas with versioned `$id` references
53
+ 4. Creates a Git tag
54
+ 5. Publishes to npm
55
+ 6. Creates a GitHub release
56
+
57
+ All of this happens automatically via the GitHub Actions workflow when you push to `main`.
58
+
59
+ ### Example Schema References
60
+
61
+ **Development (default):**
62
+
63
+ ```json
64
+ "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/0.0.0-dev/schemas/ipfs/mass-id/mass-id.schema.json"
65
+ ```
66
+
67
+ **Production (versioned):**
23
68
 
24
69
  ```json
25
- "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/v0.1.0/schemas/ipfs/collection/collection.schema.json"
70
+ "$id": "https://raw.githubusercontent.com/carrot-foundation/schemas/refs/tags/1.2.3/schemas/ipfs/mass-id/mass-id.schema.json"
71
+ ```
72
+
73
+ ## πŸ“š Package Usage
74
+
75
+ This package is published to npm as `@carrot-foundation/schemas` and supports both **ESM** and **CommonJS** module formats.
76
+
77
+ ### Installation
78
+
79
+ ```bash
80
+ npm install @carrot-foundation/schemas
81
+ # or
82
+ pnpm add @carrot-foundation/schemas
83
+ # or
84
+ yarn add @carrot-foundation/schemas
85
+ ```
86
+
87
+ ### ESM (ECMAScript Modules)
88
+
89
+ ```typescript
90
+ import { MassIDIpfsSchema, MassIDDataSchema } from '@carrot-foundation/schemas';
91
+
92
+ // Use the schemas for validation
93
+ const result = MassIDIpfsSchema.safeParse(data);
94
+ ```
95
+
96
+ ### CommonJS
97
+
98
+ ```javascript
99
+ const {
100
+ MassIDIpfsSchema,
101
+ MassIDDataSchema,
102
+ } = require('@carrot-foundation/schemas');
103
+
104
+ // Use the schemas for validation
105
+ const result = MassIDIpfsSchema.safeParse(data);
106
+ ```
107
+
108
+ ### TypeScript Support
109
+
110
+ The package includes full TypeScript definitions:
111
+
112
+ ```typescript
113
+ import { MassIDIpfs, MassIDData } from '@carrot-foundation/schemas';
114
+
115
+ // Types are automatically inferred from the schemas
116
+ const massIdData: MassIDData = {
117
+ // ...
118
+ };
26
119
  ```
27
120
 
28
121
  ## βœ… Usage