@carrot-foundation/schemas 0.1.20 → 0.1.21

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 (36) hide show
  1. package/README.md +45 -0
  2. package/dist/index.cjs +1104 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +552 -0
  5. package/dist/index.d.ts +552 -2
  6. package/dist/index.js +1100 -1
  7. package/dist/index.js.map +1 -0
  8. package/package.json +6 -4
  9. package/dist/index.d.ts.map +0 -1
  10. package/dist/mass-id/index.d.ts +0 -3
  11. package/dist/mass-id/index.d.ts.map +0 -1
  12. package/dist/mass-id/index.js +0 -2
  13. package/dist/mass-id/mass-id.data.schema.d.ts +0 -256
  14. package/dist/mass-id/mass-id.data.schema.d.ts.map +0 -1
  15. package/dist/mass-id/mass-id.data.schema.js +0 -348
  16. package/dist/mass-id/mass-id.schema.d.ts +0 -297
  17. package/dist/mass-id/mass-id.schema.d.ts.map +0 -1
  18. package/dist/mass-id/mass-id.schema.js +0 -163
  19. package/dist/shared/base.schema.d.ts +0 -111
  20. package/dist/shared/base.schema.d.ts.map +0 -1
  21. package/dist/shared/base.schema.js +0 -127
  22. package/dist/shared/definitions.schema.d.ts +0 -96
  23. package/dist/shared/definitions.schema.d.ts.map +0 -1
  24. package/dist/shared/definitions.schema.js +0 -283
  25. package/dist/shared/entities/location.schema.d.ts +0 -55
  26. package/dist/shared/entities/location.schema.d.ts.map +0 -1
  27. package/dist/shared/entities/location.schema.js +0 -68
  28. package/dist/shared/entities/participant.schema.d.ts +0 -8
  29. package/dist/shared/entities/participant.schema.d.ts.map +0 -1
  30. package/dist/shared/entities/participant.schema.js +0 -24
  31. package/dist/shared/helpers.schema.d.ts +0 -4
  32. package/dist/shared/helpers.schema.d.ts.map +0 -1
  33. package/dist/shared/helpers.schema.js +0 -16
  34. package/dist/shared/nft.schema.d.ts +0 -116
  35. package/dist/shared/nft.schema.d.ts.map +0 -1
  36. package/dist/shared/nft.schema.js +0 -193
@@ -1,283 +0,0 @@
1
- import { z } from 'zod';
2
- export const UuidSchema = z.uuidv4('Must be a valid UUID v4 string').meta({
3
- title: 'UUID',
4
- description: 'A universally unique identifier version 4',
5
- examples: [
6
- 'ad44dd3f-f176-4b98-bf78-5ee6e77d0530',
7
- '6f520d88-864d-432d-bf9f-5c3166c4818f',
8
- 'f77afa89-1c58-40fd-9bf5-8a86703a8af4',
9
- ],
10
- });
11
- export const EthereumAddressSchema = z
12
- .string()
13
- .regex(/^0x[a-fA-F0-9]{40}$/, 'Must be a valid Ethereum address in lowercase hexadecimal format')
14
- .meta({
15
- title: 'Ethereum Address',
16
- description: 'A valid Ethereum address in hexadecimal format',
17
- examples: [
18
- '0x1234567890abcdef1234567890abcdef12345678',
19
- '0xabcdef1234567890abcdef1234567890abcdef12',
20
- ],
21
- });
22
- export const IsoTimestampSchema = z.iso
23
- .datetime({
24
- message: 'Must be a valid ISO 8601 timestamp with timezone',
25
- })
26
- .meta({
27
- title: 'ISO Timestamp',
28
- description: 'ISO 8601 formatted timestamp with timezone information',
29
- examples: ['2024-12-05T11:02:47.000Z', '2025-02-22T10:35:12.000Z'],
30
- });
31
- export const IsoDateSchema = z.iso
32
- .date('Must be a valid ISO 8601 date (YYYY-MM-DD)')
33
- .meta({
34
- title: 'ISO Date',
35
- description: 'ISO 8601 formatted date in YYYY-MM-DD format',
36
- examples: ['2024-12-05', '2025-02-22', '2024-02-10'],
37
- });
38
- export const IsoCountryCodeSchema = z
39
- .string()
40
- .regex(/^[A-Z]{2}$/, 'Must be a valid ISO 3166-1 alpha-2 country code')
41
- .meta({
42
- title: 'ISO Country Code',
43
- description: 'Two-letter country code following ISO 3166-1 alpha-2 standard',
44
- examples: ['BR', 'US', 'DE'],
45
- });
46
- export const IsoAdministrativeDivisionCodeSchema = z
47
- .string()
48
- .regex(/^[A-Z]{2}-[A-Z0-9]{1,3}$/, 'Must be a valid ISO 3166-2 administrative division code')
49
- .meta({
50
- title: 'ISO Administrative Division Code',
51
- description: 'Administrative division code following ISO 3166-2 standard',
52
- examples: ['BR-AP', 'BR-ES', 'US-CA'],
53
- });
54
- export const LatitudeSchema = z
55
- .number()
56
- .min(-90)
57
- .max(90)
58
- .meta({
59
- title: 'Latitude',
60
- description: 'Geographic latitude coordinate in decimal degrees',
61
- examples: [-0.02, -20.38, 40.7128],
62
- });
63
- export const LongitudeSchema = z
64
- .number()
65
- .min(-180)
66
- .max(180)
67
- .meta({
68
- title: 'Longitude',
69
- description: 'Geographic longitude coordinate in decimal degrees',
70
- examples: [-51.06, -40.34, -74.006],
71
- });
72
- export const WeightKgSchema = z
73
- .number()
74
- .min(0)
75
- .meta({
76
- title: 'Weight (kg)',
77
- description: 'Weight measurement in kilograms',
78
- examples: [3000, 1500, 500],
79
- });
80
- export const NonEmptyStringSchema = z
81
- .string()
82
- .min(1, 'Cannot be empty')
83
- .meta({
84
- title: 'Non-Empty String',
85
- description: 'A string that contains at least one character',
86
- examples: ['Example text', 'Sample value', 'Test string'],
87
- });
88
- export const SlugSchema = NonEmptyStringSchema.regex(/^[a-z0-9-]+$/, 'Must contain only lowercase letters, numbers, and hyphens')
89
- .max(100)
90
- .meta({
91
- title: 'Slug',
92
- description: 'URL-friendly identifier with lowercase letters, numbers, and hyphens',
93
- examples: ['mass-id-123', 'recycled-plastic', 'organic-waste'],
94
- });
95
- export const WasteTypeSchema = NonEmptyStringSchema.meta({
96
- title: 'Waste Type',
97
- description: 'Category or type of waste material',
98
- examples: ['Organic', 'Plastic', 'Metal'],
99
- });
100
- export const WasteSubtypeSchema = NonEmptyStringSchema.max(100).meta({
101
- title: 'Waste Subtype',
102
- description: 'Specific subcategory of waste within a waste type',
103
- examples: ['Food, Food Waste and Beverages', 'PET Bottles', 'Aluminum Cans'],
104
- });
105
- export const ParticipantRoleSchema = NonEmptyStringSchema.max(100).meta({
106
- title: 'Participant Role',
107
- description: 'Role that a participant plays in the waste management supply chain',
108
- examples: ['Waste Generator', 'Hauler', 'Recycler'],
109
- });
110
- export const ParticipantNameSchema = NonEmptyStringSchema.max(100).meta({
111
- title: 'Participant Name',
112
- description: 'Name of a participant in the waste management system',
113
- examples: ['Enlatados Produção', 'Eco Reciclagem', 'Green Tech Corp'],
114
- });
115
- export const FacilityTypeSchema = z
116
- .enum([
117
- 'Waste Generation',
118
- 'Collection Point',
119
- 'Transfer Station',
120
- 'Sorting Facility',
121
- 'Composting Facility',
122
- 'Recycling Facility',
123
- 'Processing Facility',
124
- 'Disposal Facility',
125
- 'Administrative Office',
126
- ])
127
- .meta({
128
- title: 'Facility Type',
129
- description: 'Type of facility in the waste management infrastructure',
130
- examples: ['Waste Generation', 'Recycling Facility', 'Collection Point'],
131
- });
132
- export const BlockchainChainIdSchema = z
133
- .number()
134
- .int()
135
- .min(1)
136
- .meta({
137
- title: 'Chain ID',
138
- description: 'Blockchain network identifier',
139
- examples: [1, 137, 11155111],
140
- });
141
- export const PercentageSchema = z
142
- .number()
143
- .min(0)
144
- .max(100)
145
- .meta({
146
- title: 'Percentage',
147
- description: 'Percentage value between 0 and 100',
148
- examples: [50, 75.5, 100],
149
- });
150
- export const NonNegativeIntegerSchema = z
151
- .number()
152
- .int()
153
- .min(0)
154
- .meta({
155
- title: 'Non-Negative Integer',
156
- description: 'Integer value that is zero or positive',
157
- examples: [0, 123, 4126],
158
- });
159
- export const PositiveIntegerSchema = z
160
- .number()
161
- .int()
162
- .min(1)
163
- .meta({
164
- title: 'Positive Integer',
165
- description: 'Integer value that is greater than zero',
166
- examples: [1, 123, 456],
167
- });
168
- export const NonNegativeFloatSchema = z
169
- .number()
170
- .min(0)
171
- .meta({
172
- title: 'Non-Negative Float',
173
- description: 'Floating-point number that is zero or positive',
174
- examples: [0.0, 45.2, 72.5],
175
- });
176
- export const HoursSchema = z
177
- .number()
178
- .min(0)
179
- .multipleOf(0.1)
180
- .meta({
181
- title: 'Hours',
182
- description: 'Time duration in hours with 0.1 hour precision',
183
- examples: [72.5, 24.0, 168.5],
184
- });
185
- export const IpfsUriSchema = NonEmptyStringSchema.regex(/^ipfs:\/\/[a-zA-Z0-9]+(\/.*)?$/, 'Must be a valid IPFS URI with CID').meta({
186
- title: 'IPFS URI',
187
- description: 'InterPlanetary File System URI pointing to distributed content',
188
- examples: [
189
- 'ipfs://QmTy8w65yBXgyfG2ZBg5TrfB2hPjrDQH3RCQFJGkARStJb/mass-id-organic.png',
190
- 'ipfs://QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o',
191
- ],
192
- });
193
- export const SemanticVersionSchema = NonEmptyStringSchema.regex(/^v?\d+\.\d+\.\d+(-[a-zA-Z0-9.-]+)?(\+[a-zA-Z0-9.-]+)?$/, 'Must be a valid semantic version string').meta({
194
- title: 'Semantic Version',
195
- description: 'Version string following semantic versioning specification',
196
- examples: ['0.1.0', '1.0.0', '2.1.3'],
197
- });
198
- export const TokenIdSchema = NonEmptyStringSchema.regex(/^\d+$/, 'Must be a numeric string (supports uint256)').meta({
199
- title: 'Token ID',
200
- description: 'Numeric identifier for blockchain tokens as string',
201
- examples: ['123', '456789', '1000000'],
202
- });
203
- export const HexColorSchema = NonEmptyStringSchema.regex(/^#[0-9A-F]{6}$/, 'Must be a hex color code with # prefix and uppercase').meta({
204
- title: 'Hex Color',
205
- description: 'Hexadecimal color code with hash prefix',
206
- examples: ['#2D5A27', '#FF5733', '#1E90FF'],
207
- });
208
- export const Sha256HashSchema = z
209
- .hash('sha256', {
210
- error: 'Must be a SHA256 hash as 32-byte hex string',
211
- })
212
- .meta({
213
- format: undefined,
214
- title: 'SHA256 Hash',
215
- description: 'SHA-256 cryptographic hash as hexadecimal string',
216
- examples: [
217
- '87f633634cc4b02f628685651f0a29b7bfa22a0bd841f725c6772dd00a58d489',
218
- '6e83b8e6373847bbdc056549bedda38dc88854ce41ba4fca11e0fc6ce3e07ef6',
219
- ],
220
- });
221
- export const Keccak256HashSchema = Sha256HashSchema.meta({
222
- title: 'Keccak256 Hash',
223
- description: 'Keccak256 cryptographic hash as hexadecimal string',
224
- examples: [
225
- 'ac08c3cf2e175e55961d6affdb38bc24591b84ceef7f3707c69ae3d52c148b2f',
226
- 'b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2',
227
- ],
228
- });
229
- export const ExternalIdSchema = UuidSchema.meta({
230
- title: 'External ID',
231
- description: 'UUID identifier for external system references',
232
- examples: [
233
- 'ad44dd3f-f176-4b98-bf78-5ee6e77d0530',
234
- 'b2c4e6f8-a1b3-4c5d-9e8f-123456789abc',
235
- ],
236
- });
237
- export const ExternalUrlSchema = z.url('Must be a valid URL').meta({
238
- title: 'External URL',
239
- description: 'Valid URL pointing to external resources',
240
- examples: [
241
- 'https://explore.carrot.eco/document/ad44dd3f-f176-4b98-bf78-5ee6e77d0530',
242
- 'https://carrot.eco/whitepaper.pdf',
243
- ],
244
- });
245
- export const RecordSchemaTypeSchema = z
246
- .enum([
247
- 'MassID',
248
- 'MassID Audit',
249
- 'RecycledID',
250
- 'GasID',
251
- 'PurchaseID',
252
- 'Methodology',
253
- 'Credit',
254
- 'Collection',
255
- ])
256
- .meta({
257
- title: 'Schema Type',
258
- description: 'Type of schema in the Carrot ecosystem',
259
- examples: ['MassID', 'RecycledID', 'GasID'],
260
- });
261
- export const TokenSymbolSchema = NonEmptyStringSchema.max(10)
262
- .regex(/^[A-Z0-9-]+$/, 'Must contain only uppercase letters, numbers, and hyphens')
263
- .meta({
264
- title: 'Token Symbol',
265
- description: 'Symbol representing a token or cryptocurrency',
266
- examples: ['MASS', 'REC', 'GAS'],
267
- });
268
- export const RecordRelationshipTypeSchema = z
269
- .enum([
270
- 'collection',
271
- 'credit',
272
- 'gas-id',
273
- 'mass-id',
274
- 'mass-id-audit',
275
- 'methodology',
276
- 'purchase-id',
277
- 'recycled-id',
278
- ])
279
- .meta({
280
- title: 'Relationship Type',
281
- description: 'Type of relationship between different entities in the system',
282
- examples: ['mass-id', 'audit', 'collection'],
283
- });
@@ -1,55 +0,0 @@
1
- import { z } from 'zod';
2
- declare const PrecisionLevelSchema: z.ZodEnum<{
3
- exact: "exact";
4
- neighborhood: "neighborhood";
5
- city: "city";
6
- region: "region";
7
- country: "country";
8
- }>;
9
- export type PrecisionLevel = z.infer<typeof PrecisionLevelSchema>;
10
- export declare const CoordinatesSchema: z.ZodObject<{
11
- latitude: z.ZodNumber;
12
- longitude: z.ZodNumber;
13
- precision_level: z.ZodEnum<{
14
- exact: "exact";
15
- neighborhood: "neighborhood";
16
- city: "city";
17
- region: "region";
18
- country: "country";
19
- }>;
20
- }, z.core.$strict>;
21
- export type Coordinates = z.infer<typeof CoordinatesSchema>;
22
- export declare const LocationSchema: z.ZodObject<{
23
- id: z.ZodUUID;
24
- municipality: z.ZodString;
25
- administrative_division: z.ZodString;
26
- administrative_division_code: z.ZodOptional<z.ZodString>;
27
- country: z.ZodString;
28
- country_code: z.ZodString;
29
- responsible_participant_id: z.ZodUUID;
30
- coordinates: z.ZodObject<{
31
- latitude: z.ZodNumber;
32
- longitude: z.ZodNumber;
33
- precision_level: z.ZodEnum<{
34
- exact: "exact";
35
- neighborhood: "neighborhood";
36
- city: "city";
37
- region: "region";
38
- country: "country";
39
- }>;
40
- }, z.core.$strict>;
41
- facility_type: z.ZodOptional<z.ZodEnum<{
42
- "Waste Generation": "Waste Generation";
43
- "Collection Point": "Collection Point";
44
- "Transfer Station": "Transfer Station";
45
- "Sorting Facility": "Sorting Facility";
46
- "Composting Facility": "Composting Facility";
47
- "Recycling Facility": "Recycling Facility";
48
- "Processing Facility": "Processing Facility";
49
- "Disposal Facility": "Disposal Facility";
50
- "Administrative Office": "Administrative Office";
51
- }>>;
52
- }, z.core.$strict>;
53
- export type Location = z.infer<typeof LocationSchema>;
54
- export {};
55
- //# sourceMappingURL=location.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"location.schema.d.ts","sourceRoot":"","sources":["../../../src/shared/entities/location.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAWxB,QAAA,MAAM,oBAAoB;;;;;;EAMtB,CAAC;AAEL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,iBAAiB;;;;;;;;;;kBAe1B,CAAC;AACL,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA2CvB,CAAC;AAEL,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC"}
@@ -1,68 +0,0 @@
1
- import { z } from 'zod';
2
- import { UuidSchema, NonEmptyStringSchema, LatitudeSchema, LongitudeSchema, IsoCountryCodeSchema, IsoAdministrativeDivisionCodeSchema, FacilityTypeSchema, } from '../definitions.schema.js';
3
- const PrecisionLevelSchema = z
4
- .enum(['exact', 'neighborhood', 'city', 'region', 'country'])
5
- .meta({
6
- title: 'Precision Level',
7
- description: 'Level of coordinate precision',
8
- examples: ['city', 'exact', 'neighborhood'],
9
- });
10
- export const CoordinatesSchema = z
11
- .strictObject({
12
- latitude: LatitudeSchema.meta({
13
- title: 'Latitude',
14
- description: 'GPS latitude coordinate',
15
- }),
16
- longitude: LongitudeSchema.meta({
17
- title: 'Longitude',
18
- description: 'GPS longitude coordinate',
19
- }),
20
- precision_level: PrecisionLevelSchema,
21
- })
22
- .meta({
23
- title: 'Coordinates',
24
- description: 'GPS coordinates of the location',
25
- });
26
- export const LocationSchema = z
27
- .strictObject({
28
- id: UuidSchema.meta({
29
- title: 'Location ID',
30
- description: 'Unique identifier for the location',
31
- }),
32
- municipality: NonEmptyStringSchema.max(50).meta({
33
- title: 'Municipality',
34
- description: 'Municipality or city name',
35
- examples: ['New York', 'São Paulo', 'London', 'Tokyo'],
36
- }),
37
- administrative_division: NonEmptyStringSchema.max(50).meta({
38
- title: 'Administrative Division',
39
- description: 'State, province, or administrative region',
40
- examples: ['California', 'Ontario', 'Bavaria', 'Queensland'],
41
- }),
42
- administrative_division_code: IsoAdministrativeDivisionCodeSchema.optional().meta({
43
- title: 'Administrative Division Code',
44
- description: 'ISO 3166-2 administrative division code',
45
- }),
46
- country: NonEmptyStringSchema.max(50).meta({
47
- title: 'Country',
48
- description: 'Full country name in English',
49
- examples: ['United States', 'Canada', 'Germany', 'Australia'],
50
- }),
51
- country_code: IsoCountryCodeSchema.meta({
52
- title: 'Country Code',
53
- description: 'ISO 3166-1 alpha-2 country code',
54
- }),
55
- responsible_participant_id: UuidSchema.meta({
56
- title: 'Responsible Participant ID',
57
- description: 'ID of the participant responsible for this location',
58
- }),
59
- coordinates: CoordinatesSchema,
60
- facility_type: FacilityTypeSchema.optional().meta({
61
- title: 'Facility Type',
62
- description: 'Type of facility at this location',
63
- }),
64
- })
65
- .meta({
66
- title: 'Location',
67
- description: 'Geographic location with address and coordinate information',
68
- });
@@ -1,8 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ParticipantSchema: z.ZodObject<{
3
- id: z.ZodUUID;
4
- name: z.ZodString;
5
- roles: z.ZodArray<z.ZodString>;
6
- }, z.core.$strict>;
7
- export type Participant = z.infer<typeof ParticipantSchema>;
8
- //# sourceMappingURL=participant.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"participant.schema.d.ts","sourceRoot":"","sources":["../../../src/shared/entities/participant.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,iBAAiB;;;;kBAwB1B,CAAC;AAEL,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,24 +0,0 @@
1
- import { z } from 'zod';
2
- import { UuidSchema, ParticipantNameSchema, ParticipantRoleSchema, } from '../definitions.schema.js';
3
- import { uniqueArrayItems } from '../helpers.schema.js';
4
- export const ParticipantSchema = z
5
- .strictObject({
6
- id: UuidSchema.meta({
7
- title: 'Participant ID',
8
- description: 'Unique identifier for the participant',
9
- }),
10
- name: ParticipantNameSchema.meta({
11
- title: 'Participant Name',
12
- description: 'Name of the participant',
13
- }),
14
- roles: uniqueArrayItems(ParticipantRoleSchema, 'Participant roles must be unique')
15
- .min(1)
16
- .meta({
17
- title: 'Participant Roles',
18
- description: 'Roles of the participant in the waste management supply chain',
19
- }),
20
- })
21
- .meta({
22
- title: 'Participant',
23
- description: 'A participant in the waste management supply chain',
24
- });
@@ -1,4 +0,0 @@
1
- import { z } from 'zod';
2
- export declare function uniqueArrayItems<T extends z.ZodTypeAny>(schema: T, errorMessage?: string): z.ZodArray<T>;
3
- export declare function uniqueBy<T extends z.ZodTypeAny, K>(schema: T, selector: (item: z.infer<T>) => K, errorMessage?: string): z.ZodArray<T>;
4
- //# sourceMappingURL=helpers.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"helpers.schema.d.ts","sourceRoot":"","sources":["../../src/shared/helpers.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EACrD,MAAM,EAAE,CAAC,EACT,YAAY,GAAE,MAAqC,iBAOpD;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,CAAC,EAChD,MAAM,EAAE,CAAC,EACT,QAAQ,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,EACjC,YAAY,GAAE,MAA+B,iBAW9C"}
@@ -1,16 +0,0 @@
1
- import { z } from 'zod';
2
- export function uniqueArrayItems(schema, errorMessage = 'Array items must be unique') {
3
- return z
4
- .array(schema)
5
- .refine((items) => new Set(items).size === items.length, {
6
- message: errorMessage,
7
- });
8
- }
9
- export function uniqueBy(schema, selector, errorMessage = 'Items must be unique') {
10
- return z.array(schema).refine((items) => {
11
- const values = items.map(selector);
12
- return new Set(values).size === values.length;
13
- }, {
14
- message: errorMessage,
15
- });
16
- }
@@ -1,116 +0,0 @@
1
- import { z } from 'zod';
2
- declare const NftSchemaTypeSchema: z.ZodEnum<{
3
- MassID: "MassID";
4
- RecycledID: "RecycledID";
5
- GasID: "GasID";
6
- PurchaseID: "PurchaseID";
7
- }>;
8
- export type NftSchemaType = z.infer<typeof NftSchemaTypeSchema>;
9
- declare const BlockchainReferenceSchema: z.ZodObject<{
10
- smart_contract_address: z.ZodString;
11
- chain_id: z.ZodNumber;
12
- network_name: z.ZodString;
13
- token_id: z.ZodString;
14
- }, z.core.$strict>;
15
- export type BlockchainReference = z.infer<typeof BlockchainReferenceSchema>;
16
- declare const ExternalLinkSchema: z.ZodObject<{
17
- label: z.ZodString;
18
- url: z.ZodURL;
19
- description: z.ZodOptional<z.ZodString>;
20
- }, z.core.$strict>;
21
- export type ExternalLink = z.infer<typeof ExternalLinkSchema>;
22
- declare const NftAttributeSchema: z.ZodObject<{
23
- trait_type: z.ZodString;
24
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
25
- display_type: z.ZodOptional<z.ZodEnum<{
26
- number: "number";
27
- date: "date";
28
- boost_number: "boost_number";
29
- boost_percentage: "boost_percentage";
30
- }>>;
31
- max_value: z.ZodOptional<z.ZodNumber>;
32
- }, z.core.$strict>;
33
- export type NftAttribute = z.infer<typeof NftAttributeSchema>;
34
- export declare const NftIpfsSchema: z.ZodObject<{
35
- $schema: z.ZodURL;
36
- created_at: z.ZodISODateTime;
37
- external_id: z.ZodUUID;
38
- external_url: z.ZodURL;
39
- original_content_hash: z.ZodCustomStringFormat<"sha256_hex">;
40
- content_hash: z.ZodCustomStringFormat<"sha256_hex">;
41
- creator: z.ZodOptional<z.ZodObject<{
42
- name: z.ZodString;
43
- id: z.ZodUUID;
44
- }, z.core.$strict>>;
45
- relationships: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
- target_uri: z.ZodString;
47
- type: z.ZodEnum<{
48
- collection: "collection";
49
- credit: "credit";
50
- "gas-id": "gas-id";
51
- "mass-id": "mass-id";
52
- "mass-id-audit": "mass-id-audit";
53
- methodology: "methodology";
54
- "purchase-id": "purchase-id";
55
- "recycled-id": "recycled-id";
56
- }>;
57
- description: z.ZodOptional<z.ZodString>;
58
- }, z.core.$strict>>>;
59
- environment: z.ZodOptional<z.ZodObject<{
60
- blockchain_network: z.ZodEnum<{
61
- mainnet: "mainnet";
62
- testnet: "testnet";
63
- }>;
64
- deployment: z.ZodEnum<{
65
- production: "production";
66
- development: "development";
67
- testing: "testing";
68
- }>;
69
- data_set_name: z.ZodEnum<{
70
- TEST: "TEST";
71
- PROD: "PROD";
72
- }>;
73
- }, z.core.$strict>>;
74
- data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
75
- schema: z.ZodObject<{
76
- hash: z.ZodCustomStringFormat<"sha256_hex">;
77
- version: z.ZodString;
78
- type: z.ZodEnum<{
79
- MassID: "MassID";
80
- RecycledID: "RecycledID";
81
- GasID: "GasID";
82
- PurchaseID: "PurchaseID";
83
- }>;
84
- }, z.core.$strict>;
85
- blockchain: z.ZodObject<{
86
- smart_contract_address: z.ZodString;
87
- chain_id: z.ZodNumber;
88
- network_name: z.ZodString;
89
- token_id: z.ZodString;
90
- }, z.core.$strict>;
91
- name: z.ZodString;
92
- short_name: z.ZodString;
93
- description: z.ZodString;
94
- image: z.ZodString;
95
- background_color: z.ZodOptional<z.ZodString>;
96
- animation_url: z.ZodOptional<z.ZodString>;
97
- external_links: z.ZodOptional<z.ZodArray<z.ZodObject<{
98
- label: z.ZodString;
99
- url: z.ZodURL;
100
- description: z.ZodOptional<z.ZodString>;
101
- }, z.core.$strict>>>;
102
- attributes: z.ZodArray<z.ZodObject<{
103
- trait_type: z.ZodString;
104
- value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
105
- display_type: z.ZodOptional<z.ZodEnum<{
106
- number: "number";
107
- date: "date";
108
- boost_number: "boost_number";
109
- boost_percentage: "boost_percentage";
110
- }>>;
111
- max_value: z.ZodOptional<z.ZodNumber>;
112
- }, z.core.$strict>>;
113
- }, z.core.$strict>;
114
- export type NftIpfs = z.infer<typeof NftIpfsSchema>;
115
- export {};
116
- //# sourceMappingURL=nft.schema.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nft.schema.d.ts","sourceRoot":"","sources":["../../src/shared/nft.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,QAAA,MAAM,mBAAmB;;;;;EAQvB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,QAAA,MAAM,yBAAyB;;;;;kBAqB3B,CAAC;AAEL,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAE5E,QAAA,MAAM,kBAAkB;;;;kBAkBpB,CAAC;AAEL,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,QAAA,MAAM,kBAAkB;;;;;;;;;;kBAyBpB,CAAC;AAEL,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA0HxB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}