@carrot-foundation/schemas 0.1.54 → 0.1.56

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 (26) hide show
  1. package/dist/index.cjs +234 -118
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +243 -510
  4. package/dist/index.d.ts +243 -510
  5. package/dist/index.js +234 -119
  6. package/dist/index.js.map +1 -1
  7. package/package.json +1 -1
  8. package/schemas/ipfs/collection/collection.example.json +6 -6
  9. package/schemas/ipfs/collection/collection.schema.json +4 -4
  10. package/schemas/ipfs/credit/credit.example.json +6 -6
  11. package/schemas/ipfs/credit/credit.schema.json +4 -4
  12. package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.example.json +16 -16
  13. package/schemas/ipfs/credit-purchase-receipt/credit-purchase-receipt.schema.json +87 -87
  14. package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.example.json +15 -15
  15. package/schemas/ipfs/credit-retirement-receipt/credit-retirement-receipt.schema.json +118 -118
  16. package/schemas/ipfs/gas-id/gas-id.example.json +9 -9
  17. package/schemas/ipfs/gas-id/gas-id.schema.json +505 -73
  18. package/schemas/ipfs/mass-id/mass-id.example.json +65 -31
  19. package/schemas/ipfs/mass-id/mass-id.schema.json +138 -138
  20. package/schemas/ipfs/mass-id-audit/mass-id-audit.example.json +8 -8
  21. package/schemas/ipfs/mass-id-audit/mass-id-audit.schema.json +6 -6
  22. package/schemas/ipfs/methodology/methodology.example.json +6 -6
  23. package/schemas/ipfs/methodology/methodology.schema.json +4 -4
  24. package/schemas/ipfs/recycled-id/recycled-id.example.json +9 -9
  25. package/schemas/ipfs/recycled-id/recycled-id.schema.json +455 -73
  26. package/schemas/schema-hashes.json +10 -10
package/dist/index.cjs CHANGED
@@ -28077,17 +28077,17 @@ var BlockchainChainIdSchema = zod.z.union([
28077
28077
  zod.z.literal(BLOCKCHAIN_NETWORK_CONFIG.testnet.chain_id)
28078
28078
  ]).meta({
28079
28079
  title: "Chain ID",
28080
- description: "Supported Polygon chain identifiers",
28080
+ description: "Blockchain network chain identifier (e.g., 137 for Polygon mainnet, 80002 for Amoy testnet)",
28081
28081
  examples: BLOCKCHAIN_CHAIN_IDS
28082
28082
  });
28083
28083
  var BlockchainNetworkNameSchema = zod.z.enum(BLOCKCHAIN_NETWORK_NAMES).meta({
28084
28084
  title: "Blockchain Network Name",
28085
- description: "Supported Polygon network names",
28085
+ description: "Blockchain network name. Supported values include Polygon and Amoy",
28086
28086
  examples: BLOCKCHAIN_NETWORK_NAMES
28087
28087
  });
28088
28088
  var SmartContractAddressSchema = EthereumAddressSchema.meta({
28089
28089
  title: "Smart Contract Address",
28090
- description: "Address of the smart contract"
28090
+ description: "Ethereum-compatible address of the smart contract that mints and manages this NFT"
28091
28091
  });
28092
28092
  var SmartContractSchema = zod.z.strictObject({
28093
28093
  address: SmartContractAddressSchema,
@@ -28111,7 +28111,7 @@ var TokenIdSchema = NonEmptyStringSchema.regex(
28111
28111
  "Must be a numeric string (supports uint256)"
28112
28112
  ).meta({
28113
28113
  title: "Token ID",
28114
- description: "Numeric identifier for blockchain tokens as string",
28114
+ description: "Unique token identifier for this NFT within the smart contract",
28115
28115
  examples: ["456789", "1000000"]
28116
28116
  });
28117
28117
  var StringifiedTokenIdSchema = NonEmptyStringSchema.regex(
@@ -28145,7 +28145,7 @@ var IpfsUriSchema = NonEmptyStringSchema.regex(
28145
28145
  title: "IPFS URI",
28146
28146
  description: "InterPlanetary File System URI pointing to distributed content",
28147
28147
  examples: [
28148
- "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm/mass-id-organic.png",
28148
+ "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm",
28149
28149
  "ipfs://bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku"
28150
28150
  ]
28151
28151
  });
@@ -28480,7 +28480,7 @@ var BlockchainReferenceSchema = zod.z.strictObject({
28480
28480
  }
28481
28481
  }).meta({
28482
28482
  title: "Blockchain Information",
28483
- description: "Blockchain-specific information for the NFT"
28483
+ description: "Blockchain deployment information including smart contract address, network, and token identifier"
28484
28484
  });
28485
28485
  var ExternalLinkSchema = zod.z.strictObject({
28486
28486
  label: NonEmptyStringSchema.max(50).meta({
@@ -28532,7 +28532,7 @@ var NftIpfsSchema = BaseIpfsSchema.safeExtend({
28532
28532
  blockchain: BlockchainReferenceSchema,
28533
28533
  name: NonEmptyStringSchema.max(100).meta({
28534
28534
  title: "NFT Name",
28535
- description: "Full display name for this NFT, including extra context",
28535
+ description: "Full display name for this NFT, typically including token identifier, waste type, and weight",
28536
28536
  examples: [
28537
28537
  "MassID #123 \u2022 Organic \u2022 3.0t",
28538
28538
  "RecycledID #456 \u2022 Plastic \u2022 2.5t",
@@ -28541,12 +28541,12 @@ var NftIpfsSchema = BaseIpfsSchema.safeExtend({
28541
28541
  }),
28542
28542
  short_name: NonEmptyStringSchema.max(50).meta({
28543
28543
  title: "Short Name",
28544
- description: "Compact name for UI summaries, tables, or tooltips",
28544
+ description: "Compact name for UI summaries, tables, or tooltips, typically including token identifier",
28545
28545
  examples: ["MassID #123", "RecycledID #456", "GasID #789"]
28546
28546
  }),
28547
28547
  description: NonEmptyStringSchema.max(500).meta({
28548
28548
  title: "Description",
28549
- description: "Human-readable summary of the NFT's role and context. Ideally, maximum 300 characters.",
28549
+ description: "Human-readable summary describing the waste batch, origin, processing method, and chain of custody. Ideally, maximum 300 characters.",
28550
28550
  examples: [
28551
28551
  "This MassID represents 3 metric tons of organic food waste from Enlatados Produ\xE7\xE3o, tracked through complete chain of custody from generation to composting.",
28552
28552
  "This RecycledID represents 2.5 metric tons of recycled plastic bottles processed by Green Solutions Ltd."
@@ -28554,18 +28554,18 @@ var NftIpfsSchema = BaseIpfsSchema.safeExtend({
28554
28554
  }),
28555
28555
  image: IpfsUriSchema.meta({
28556
28556
  title: "Image URI",
28557
- description: "IPFS URI pointing to the preview image"
28557
+ description: "IPFS URI pointing to the NFT preview image displayed in marketplaces and wallets"
28558
28558
  }),
28559
28559
  background_color: HexColorSchema.optional().meta({
28560
28560
  title: "Background Color",
28561
- description: "Hex color code for marketplace background display"
28561
+ description: "Hexadecimal color code used as background color in NFT marketplace displays"
28562
28562
  }),
28563
28563
  animation_url: IpfsUriSchema.optional().meta({
28564
28564
  title: "Animation URL",
28565
- description: "IPFS URI pointing to an animated or interactive media file",
28565
+ description: "IPFS URI pointing to an animated or interactive media file for enhanced NFT display",
28566
28566
  examples: [
28567
- "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm/mass-id-animation.mp4",
28568
- "ipfs://bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku/recycled-visualization.webm"
28567
+ "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm",
28568
+ "ipfs://bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku"
28569
28569
  ]
28570
28570
  }),
28571
28571
  external_links: uniqueBy(
@@ -28632,6 +28632,29 @@ function mergeSchemaMeta(schema, newMeta) {
28632
28632
  }
28633
28633
  return merged;
28634
28634
  }
28635
+ function extractTraitType(schema) {
28636
+ try {
28637
+ if (typeof schema === "object" && schema !== null && "shape" in schema && typeof schema.shape === "object" && schema.shape !== null && "trait_type" in schema.shape) {
28638
+ const traitTypeSchema = schema.shape.trait_type;
28639
+ const literalSchema = traitTypeSchema;
28640
+ if (literalSchema.value !== void 0 && typeof literalSchema.value === "string") {
28641
+ return literalSchema.value;
28642
+ }
28643
+ }
28644
+ const meta = getSchemaMetadata(schema);
28645
+ if (meta?.title) {
28646
+ const title = meta.title;
28647
+ if (title.endsWith(" Attribute")) {
28648
+ const inferred = title.slice(0, -11);
28649
+ if (inferred.length > 3) {
28650
+ return inferred;
28651
+ }
28652
+ }
28653
+ }
28654
+ } catch {
28655
+ }
28656
+ return "";
28657
+ }
28635
28658
  function createDateAttributeSchema(params) {
28636
28659
  const { omitMaxValue = true } = params;
28637
28660
  const base = omitMaxValue ? NftAttributeSchema.omit({ max_value: true }) : NftAttributeSchema;
@@ -28682,6 +28705,71 @@ function createNumericAttributeSchema(params) {
28682
28705
  description: `${params.description} attribute with numeric display`
28683
28706
  });
28684
28707
  }
28708
+ function createOrderedAttributesSchema(params) {
28709
+ const {
28710
+ required,
28711
+ optional = [],
28712
+ title,
28713
+ description,
28714
+ uniqueBySelector,
28715
+ maxItems,
28716
+ requiredTraitTypes,
28717
+ optionalTraitTypes
28718
+ } = params;
28719
+ const allSchemas = [...required, ...optional];
28720
+ let unionSchema;
28721
+ if (allSchemas.length === 0) {
28722
+ unionSchema = zod.z.never();
28723
+ } else if (allSchemas.length === 1) {
28724
+ unionSchema = allSchemas[0];
28725
+ } else {
28726
+ unionSchema = zod.z.union(
28727
+ allSchemas
28728
+ );
28729
+ }
28730
+ const requiredTypes = requiredTraitTypes ?? required.map(extractTraitType).filter(Boolean);
28731
+ const optionalTypes = optionalTraitTypes ?? optional.map(extractTraitType).filter(Boolean);
28732
+ const isDynamic = description.includes("Dynamic attributes");
28733
+ const descriptionParts = [description];
28734
+ if (requiredTypes.length > 0) {
28735
+ descriptionParts.push(
28736
+ `
28737
+
28738
+ Required attributes (${required.length}): ${requiredTypes.join(", ")}`
28739
+ );
28740
+ }
28741
+ if (optionalTypes.length > 0 && !isDynamic) {
28742
+ descriptionParts.push(
28743
+ `
28744
+ Optional attributes (${optional.length}): ${optionalTypes.join(", ")}`
28745
+ );
28746
+ }
28747
+ let arraySchema = uniqueBy(unionSchema, uniqueBySelector).min(
28748
+ required.length
28749
+ );
28750
+ if (maxItems !== void 0) {
28751
+ arraySchema = arraySchema.max(maxItems);
28752
+ } else if (optional.length > 0 && !isDynamic) {
28753
+ arraySchema = arraySchema.max(required.length + optional.length);
28754
+ }
28755
+ return arraySchema.superRefine((attributes, ctx) => {
28756
+ const traitTypes = new Set(
28757
+ attributes.map(uniqueBySelector)
28758
+ );
28759
+ for (const traitType of requiredTypes) {
28760
+ if (traitType && !traitTypes.has(traitType)) {
28761
+ ctx.addIssue({
28762
+ code: "custom",
28763
+ message: `Required attribute '${traitType}' is missing`,
28764
+ path: []
28765
+ });
28766
+ }
28767
+ }
28768
+ }).meta({
28769
+ title,
28770
+ description: descriptionParts.join("")
28771
+ });
28772
+ }
28685
28773
  var MethodologyAttributeSchema = NftAttributeSchema.safeExtend({
28686
28774
  trait_type: zod.z.literal("Methodology"),
28687
28775
  value: MethodologyNameSchema
@@ -28741,7 +28829,7 @@ var OriginCityAttributeSchema = NftAttributeSchema.safeExtend({
28741
28829
  value: CitySchema
28742
28830
  }).meta({
28743
28831
  title: "Origin City Attribute",
28744
- description: "Origin municipality attribute"
28832
+ description: "City or municipality where waste was originally generated and picked up"
28745
28833
  });
28746
28834
  var AuditResultSchema = zod.z.enum(["PASSED", "FAILED"]).meta({
28747
28835
  title: "Audit Result",
@@ -29357,7 +29445,7 @@ function buildSchemaUrl(schemaPath) {
29357
29445
  return `${getSchemaBaseUrl()}/${cleanPath}`;
29358
29446
  }
29359
29447
  function getSchemaVersionOrDefault() {
29360
- return "0.1.54";
29448
+ return "0.1.56";
29361
29449
  }
29362
29450
 
29363
29451
  // src/shared/schema-validation.ts
@@ -29534,7 +29622,7 @@ var MassIDAttributeWasteTypeSchema = NftAttributeSchema.safeExtend({
29534
29622
  value: WasteTypeSchema
29535
29623
  }).meta({
29536
29624
  title: "Waste Type Attribute",
29537
- description: "Primary waste material category (e.g., Organic, Paper, Glass, Metal)"
29625
+ description: "Primary waste material category"
29538
29626
  });
29539
29627
  var MassIDAttributeWasteSubtypeSchema = NftAttributeSchema.safeExtend({
29540
29628
  trait_type: zod.z.literal("Waste Subtype"),
@@ -29557,7 +29645,7 @@ var MassIDAttributePickUpVehicleTypeSchema = NftAttributeSchema.safeExtend({
29557
29645
  })
29558
29646
  }).meta({
29559
29647
  title: "Pick-up Vehicle Type Attribute",
29560
- description: "Vehicle type used during pick-up"
29648
+ description: "Type of vehicle used to transport waste from the origin location during pick-up"
29561
29649
  });
29562
29650
  var MassIDAttributeRecyclingMethodSchema = NftAttributeSchema.safeExtend({
29563
29651
  trait_type: zod.z.literal("Recycling Method"),
@@ -29568,14 +29656,14 @@ var MassIDAttributeRecyclingMethodSchema = NftAttributeSchema.safeExtend({
29568
29656
  })
29569
29657
  }).meta({
29570
29658
  title: "Recycling Method Attribute",
29571
- description: "Process applied to this mass (e.g., composting, mechanical recycling)"
29659
+ description: "Processing or recycling method applied to transform the waste material"
29572
29660
  });
29573
29661
  var MassIDAttributeLocalWasteClassificationIdSchema = NftAttributeSchema.safeExtend({
29574
29662
  trait_type: zod.z.literal("Local Waste Classification ID"),
29575
29663
  value: IbamaWasteClassificationSchema
29576
29664
  }).meta({
29577
29665
  title: "Local Waste Classification ID Attribute",
29578
- description: "Regulatory waste classification code (e.g., Ibama format NN NN NN[*])"
29666
+ description: "Regulatory waste classification code in Ibama format (NN NN NN with optional trailing asterisk)"
29579
29667
  });
29580
29668
  var MassIDAttributeRecyclingManifestCodeSchema = NftAttributeSchema.safeExtend({
29581
29669
  trait_type: zod.z.literal("Recycling Manifest Number"),
@@ -29586,7 +29674,7 @@ var MassIDAttributeRecyclingManifestCodeSchema = NftAttributeSchema.safeExtend({
29586
29674
  })
29587
29675
  }).meta({
29588
29676
  title: "Recycling Manifest Number Attribute",
29589
- description: "Official recycling manifest number issued by recycling authority (optional)"
29677
+ description: "Official recycling manifest document number issued by regulatory authorities, linked to the Recycling event (optional)"
29590
29678
  });
29591
29679
  var MassIDAttributeTransportManifestCodeSchema = NftAttributeSchema.safeExtend({
29592
29680
  trait_type: zod.z.literal("Transport Manifest Number"),
@@ -29597,58 +29685,79 @@ var MassIDAttributeTransportManifestCodeSchema = NftAttributeSchema.safeExtend({
29597
29685
  })
29598
29686
  }).meta({
29599
29687
  title: "Transport Manifest Number Attribute",
29600
- description: "Official transport manifest number issued by logistics/transport authority (optional)"
29688
+ description: "Official transport manifest document number issued by logistics authorities, linked to transport events (optional)"
29601
29689
  });
29602
29690
  var MassIDAttributeWeighingCaptureMethodSchema = NftAttributeSchema.safeExtend({
29603
29691
  trait_type: zod.z.literal("Weighing Capture Method"),
29604
29692
  value: WeighingCaptureMethodSchema
29605
29693
  }).meta({
29606
29694
  title: "Weighing Capture Method Attribute",
29607
- description: "Weighing capture method attribute (optional)"
29695
+ description: "Method used to capture weight measurements during weighing operations (optional)"
29608
29696
  });
29609
29697
  var MassIDAttributeScaleTypeSchema = NftAttributeSchema.safeExtend({
29610
29698
  trait_type: zod.z.literal("Scale Type"),
29611
29699
  value: ScaleTypeSchema
29612
29700
  }).meta({
29613
29701
  title: "Scale Type Attribute",
29614
- description: "Scale type attribute (optional)"
29702
+ description: "Type of weighing equipment used to measure waste weight (optional)"
29615
29703
  });
29616
29704
  var MassIDAttributePickUpDateSchema = createDateAttributeSchema({
29617
29705
  traitType: "Pick-up Date",
29618
29706
  title: "Pick-up Date",
29619
- description: "Unix timestamp in milliseconds when the waste was picked up from the source"
29707
+ description: "Unix timestamp in milliseconds when waste was picked up from the origin location"
29620
29708
  });
29621
29709
  var MassIDAttributeDropOffDateSchema = createDateAttributeSchema({
29622
29710
  traitType: "Drop-off Date",
29623
29711
  title: "Drop-off Date",
29624
- description: "Unix timestamp in milliseconds when the waste was dropped off at the destination"
29712
+ description: "Unix timestamp in milliseconds when waste was delivered to the destination location"
29625
29713
  });
29626
29714
  var MassIDAttributeRecyclingDateSchema = createDateAttributeSchema({
29627
29715
  traitType: "Recycling Date",
29628
29716
  title: "Recycling Date",
29629
- description: "Unix timestamp in milliseconds when the waste was recycled/processed"
29717
+ description: "Unix timestamp in milliseconds when waste recycling or processing was completed"
29630
29718
  });
29631
- var MassIDAttributesSchema = uniqueBy(
29632
- zod.z.union([
29633
- MassIDAttributeWasteTypeSchema,
29634
- MassIDAttributeWasteSubtypeSchema,
29635
- MassIDAttributeWeightSchema,
29636
- MassIDAttributeOriginCitySchema,
29637
- MassIDAttributePickUpVehicleTypeSchema,
29638
- MassIDAttributeRecyclingMethodSchema,
29639
- MassIDAttributeLocalWasteClassificationIdSchema,
29640
- MassIDAttributeRecyclingManifestCodeSchema,
29641
- MassIDAttributeTransportManifestCodeSchema,
29642
- MassIDAttributeWeighingCaptureMethodSchema,
29643
- MassIDAttributeScaleTypeSchema,
29644
- MassIDAttributePickUpDateSchema,
29645
- MassIDAttributeDropOffDateSchema,
29646
- MassIDAttributeRecyclingDateSchema
29647
- ]),
29648
- (attr) => attr.trait_type
29649
- ).min(9).max(14).meta({
29719
+ var REQUIRED_MASS_ID_ATTRIBUTES = [
29720
+ MassIDAttributeWasteTypeSchema,
29721
+ MassIDAttributeWasteSubtypeSchema,
29722
+ MassIDAttributeWeightSchema,
29723
+ MassIDAttributeOriginCitySchema,
29724
+ MassIDAttributePickUpVehicleTypeSchema,
29725
+ MassIDAttributeRecyclingMethodSchema,
29726
+ MassIDAttributePickUpDateSchema,
29727
+ MassIDAttributeDropOffDateSchema,
29728
+ MassIDAttributeRecyclingDateSchema
29729
+ ];
29730
+ var OPTIONAL_MASS_ID_ATTRIBUTES = [
29731
+ MassIDAttributeLocalWasteClassificationIdSchema,
29732
+ MassIDAttributeRecyclingManifestCodeSchema,
29733
+ MassIDAttributeTransportManifestCodeSchema,
29734
+ MassIDAttributeWeighingCaptureMethodSchema,
29735
+ MassIDAttributeScaleTypeSchema
29736
+ ];
29737
+ var MassIDAttributesSchema = createOrderedAttributesSchema({
29738
+ required: REQUIRED_MASS_ID_ATTRIBUTES,
29739
+ optional: OPTIONAL_MASS_ID_ATTRIBUTES,
29650
29740
  title: "MassID Attributes",
29651
- description: "Array of NFT attributes describing waste characteristics, origin, logistics, and lifecycle events."
29741
+ description: "Array of NFT attributes describing waste characteristics, origin, logistics, and lifecycle events.",
29742
+ uniqueBySelector: (attr) => attr.trait_type,
29743
+ requiredTraitTypes: [
29744
+ "Waste Type",
29745
+ "Waste Subtype",
29746
+ "Weight (kg)",
29747
+ "Origin City",
29748
+ "Pick-up Vehicle Type",
29749
+ "Recycling Method",
29750
+ "Pick-up Date",
29751
+ "Drop-off Date",
29752
+ "Recycling Date"
29753
+ ],
29754
+ optionalTraitTypes: [
29755
+ "Local Waste Classification ID",
29756
+ "Recycling Manifest Number",
29757
+ "Transport Manifest Number",
29758
+ "Weighing Capture Method",
29759
+ "Scale Type"
29760
+ ]
29652
29761
  });
29653
29762
  var MassIDLocalClassificationSchema = zod.z.strictObject({
29654
29763
  code: IbamaWasteClassificationSchema,
@@ -29678,7 +29787,7 @@ var MassIDWastePropertiesSchema = zod.z.strictObject({
29678
29787
  })
29679
29788
  }).meta({
29680
29789
  title: "Waste Properties",
29681
- description: "Standardized waste material properties and regulatory information"
29790
+ description: "Waste material classification, regulatory codes, and net weight for the tracked batch"
29682
29791
  });
29683
29792
  var MassIDAttachmentTypeSchema = zod.z.enum(["Recycling Manifest", "Transport Manifest"]).meta({
29684
29793
  title: "Attachment Type",
@@ -29689,7 +29798,7 @@ var MassIDAttachmentSchema = zod.z.strictObject({
29689
29798
  type: MassIDAttachmentTypeSchema,
29690
29799
  document_number: NonEmptyStringSchema.max(50).optional().meta({
29691
29800
  title: "Document Number",
29692
- description: "Official document number if applicable",
29801
+ description: "Official regulatory document number issued by authorities, when applicable",
29693
29802
  examples: ["2353", "12345"]
29694
29803
  }),
29695
29804
  issued_at: IsoDateTimeSchema.optional().meta({
@@ -29728,7 +29837,7 @@ var MassIDBaseEventSchema = zod.z.strictObject({
29728
29837
  var buildMassIDEventSchema = (eventName, description) => MassIDBaseEventSchema.safeExtend({
29729
29838
  event_name: zod.z.literal(eventName).meta({
29730
29839
  title: "Event Name",
29731
- description: `${eventName} event discriminator`,
29840
+ description: `Type of event, indicating this is a ${eventName} event`,
29732
29841
  examples: [eventName]
29733
29842
  })
29734
29843
  }).meta({
@@ -29737,7 +29846,7 @@ var buildMassIDEventSchema = (eventName, description) => MassIDBaseEventSchema.s
29737
29846
  });
29738
29847
  var PickUpEventSchema = buildMassIDEventSchema(
29739
29848
  "Pick-up",
29740
- "Waste picked up from the origin location"
29849
+ "Waste collected from the origin location"
29741
29850
  ).safeExtend({
29742
29851
  data: zod.z.strictObject({
29743
29852
  vehicle_type: VehicleTypeSchema.optional().meta({
@@ -29745,7 +29854,7 @@ var PickUpEventSchema = buildMassIDEventSchema(
29745
29854
  }),
29746
29855
  weight_kg: WeightKgSchema.optional().meta({
29747
29856
  title: "Pick-up Waste Weight",
29748
- description: "Weight of the waste picked up at the origin location in kilograms (kg)"
29857
+ description: "Weight of waste collected at the origin location, measured in kilograms (kg)"
29749
29858
  })
29750
29859
  }).optional().meta({
29751
29860
  title: "Pick-up Event Data",
@@ -29760,7 +29869,7 @@ var WeighingEventSchema = buildMassIDEventSchema(
29760
29869
  weighing_capture_method: WeighingCaptureMethodSchema.optional(),
29761
29870
  scale_type: ScaleTypeSchema.optional(),
29762
29871
  container_type: ContainerTypeSchema.optional().meta({
29763
- description: "Type of container holding the waste during weighing"
29872
+ description: "Type of container or vehicle holding the waste material during the weighing operation"
29764
29873
  }),
29765
29874
  vehicle_type: VehicleTypeSchema.optional().meta({
29766
29875
  description: "Type of vehicle used during weighing"
@@ -29779,12 +29888,12 @@ var WeighingEventSchema = buildMassIDEventSchema(
29779
29888
  })
29780
29889
  }).optional().meta({
29781
29890
  title: "Weighing Event Data",
29782
- description: "Weighing operational details including capture method, equipment, and weights"
29891
+ description: "Weighing operational details including capture method, scale type, container or vehicle information, and weight measurements"
29783
29892
  })
29784
29893
  });
29785
29894
  var DropOffEventSchema = buildMassIDEventSchema(
29786
29895
  "Drop-off",
29787
- "Waste delivered to a destination location"
29896
+ "Waste delivered to the destination location"
29788
29897
  );
29789
29898
  var SortingEventSchema = buildMassIDEventSchema(
29790
29899
  "Sorting",
@@ -29801,12 +29910,12 @@ var SortingEventSchema = buildMassIDEventSchema(
29801
29910
  })
29802
29911
  }).optional().meta({
29803
29912
  title: "Sorting Event Data",
29804
- description: "Weights associated with sorting, including initial and deducted amounts"
29913
+ description: "Weight measurements for sorting operations: initial weight entering the process and weight deducted (contaminants, moisture, etc.)"
29805
29914
  })
29806
29915
  });
29807
29916
  var RecyclingEventSchema = buildMassIDEventSchema(
29808
29917
  "Recycling",
29809
- "Waste processed or recycled at the destination"
29918
+ "Waste processing or recycling completion event, marking the final transformation of waste material"
29810
29919
  );
29811
29920
  var MassIDEventSchema = zod.z.discriminatedUnion("event_name", [
29812
29921
  PickUpEventSchema,
@@ -29834,7 +29943,7 @@ var MassIDEventsSchema = zod.z.array(MassIDEventSchema).min(1).superRefine((even
29834
29943
  });
29835
29944
  }).meta({
29836
29945
  title: "MassID Events",
29837
- description: "Chronological sequence of custody transfer, processing, and recycling events"
29946
+ description: "Chronological sequence of waste lifecycle events: Pick-up, Weighing, Drop-off, Sorting, and Recycling operations"
29838
29947
  });
29839
29948
  var MassIDDataSchema = zod.z.strictObject({
29840
29949
  waste_properties: MassIDWastePropertiesSchema,
@@ -29844,7 +29953,7 @@ var MassIDDataSchema = zod.z.strictObject({
29844
29953
  "Location ID hashes must be unique"
29845
29954
  ).min(1).meta({
29846
29955
  title: "Locations",
29847
- description: "All locations referenced in this MassID, indexed by ID"
29956
+ description: "Geographic locations involved in the waste chain of custody, including origin, processing, and destination sites"
29848
29957
  }),
29849
29958
  participants: uniqueBy(
29850
29959
  ParticipantSchema,
@@ -29852,12 +29961,12 @@ var MassIDDataSchema = zod.z.strictObject({
29852
29961
  "Participant ID hashes must be unique"
29853
29962
  ).min(1).meta({
29854
29963
  title: "Participants",
29855
- description: "All participants referenced in this MassID, indexed by ID"
29964
+ description: "Supply chain participants involved in waste management operations. Roles include Waste Generator, Hauler, Processor, Recycler, Network Integrator, Methodology Author, Methodology Developer, Network, and Community Impact Pool"
29856
29965
  }),
29857
29966
  events: MassIDEventsSchema,
29858
29967
  attachments: zod.z.array(MassIDAttachmentSchema).optional().meta({
29859
29968
  title: "Attachments",
29860
- description: "Supporting documents associated with events, linked by event_id"
29969
+ description: "Official regulatory documents linked to specific chain of custody events via event_id. Document types include Transport Manifest and Recycling Manifest"
29861
29970
  })
29862
29971
  }).refine((data) => {
29863
29972
  const participantIdSet = new Set(
@@ -29904,7 +30013,7 @@ var isDropOffEvent = (event) => event.event_name === "Drop-off";
29904
30013
  var isRecyclingEvent = (event) => event.event_name === "Recycling";
29905
30014
  var MassIDIpfsSchemaMeta = {
29906
30015
  title: "MassID NFT IPFS Record",
29907
- description: "Complete MassID NFT IPFS record including fixed attributes and detailed waste tracking data",
30016
+ description: "Complete MassID NFT IPFS record schema defining waste tracking metadata, chain of custody events, and NFT display attributes",
29908
30017
  $id: buildSchemaUrl("mass-id/mass-id.schema.json"),
29909
30018
  version: getSchemaVersionOrDefault()
29910
30019
  };
@@ -29912,7 +30021,7 @@ var MassIDIpfsSchema = NftIpfsSchema.safeExtend({
29912
30021
  schema: NftIpfsSchema.shape.schema.safeExtend({
29913
30022
  type: zod.z.literal("MassID").meta({
29914
30023
  title: "MassID Schema Type",
29915
- description: "MassID NFT schema type"
30024
+ description: "Schema type identifier for this record"
29916
30025
  })
29917
30026
  }),
29918
30027
  attributes: MassIDAttributesSchema,
@@ -30082,7 +30191,7 @@ var GasIDAttributesSchema = zod.z.tuple([
30082
30191
  GasIDAttributeCertificateIssuanceDateSchema
30083
30192
  ]).meta({
30084
30193
  title: "GasID NFT Attribute Array",
30085
- description: "Schema for the fixed set of GasID NFT attributes, enforcing order and type for each trait"
30194
+ description: "Schema for the fixed set of GasID NFT attributes, enforcing order and type for each trait.\n\nRequired attributes (11, in order): Methodology, Gas Type, CO\u2082e Prevented (kg), Credit Amount, Credit Type, Source Waste Type, Source Weight (kg), Origin City, MassID, MassID Recycling Date, Certificate Issuance Date."
30086
30195
  });
30087
30196
  var GasIDSummarySchema = zod.z.strictObject({
30088
30197
  gas_type: GasTypeSchema,
@@ -30176,17 +30285,8 @@ var GasIDIpfsSchema = NftIpfsSchema.safeExtend({
30176
30285
  description: "GasID NFT schema type"
30177
30286
  })
30178
30287
  }),
30288
+ attributes: GasIDAttributesSchema,
30179
30289
  data: GasIDDataSchema
30180
- }).superRefine((value, ctx) => {
30181
- const attributesResult = GasIDAttributesSchema.safeParse(value.attributes);
30182
- if (!attributesResult.success) {
30183
- attributesResult.error.issues.forEach((issue) => {
30184
- ctx.addIssue({
30185
- ...issue,
30186
- path: ["attributes", ...issue.path]
30187
- });
30188
- });
30189
- }
30190
30290
  }).meta(GasIDIpfsSchemaMeta);
30191
30291
  var RecycledIDAttributeMethodologySchema = MethodologyAttributeSchema;
30192
30292
  var RecycledIDAttributeRecycledMassWeightSchema = createWeightAttributeSchema(
@@ -30217,7 +30317,7 @@ var RecycledIDAttributesSchema = zod.z.tuple([
30217
30317
  RecycledIDAttributeCertificateIssuanceDateSchema
30218
30318
  ]).meta({
30219
30319
  title: "RecycledID NFT Attribute Array",
30220
- description: "Schema for the fixed set of RecycledID NFT attributes, enforcing order and type for each trait"
30320
+ description: "Schema for the fixed set of RecycledID NFT attributes, enforcing order and type for each trait.\n\nRequired attributes (10, in order): Methodology, Recycled Mass Weight (kg), Credit Amount, Credit Type, Source Waste Type, Source Weight (kg), Origin City, MassID, MassID Recycling Date, Certificate Issuance Date."
30221
30321
  });
30222
30322
  var RecycledIDSummarySchema = zod.z.strictObject({
30223
30323
  recycled_mass_kg: WeightKgSchema.meta({
@@ -30262,19 +30362,8 @@ var RecycledIDIpfsSchema = NftIpfsSchema.safeExtend({
30262
30362
  description: "RecycledID NFT schema type"
30263
30363
  })
30264
30364
  }),
30365
+ attributes: RecycledIDAttributesSchema,
30265
30366
  data: RecycledIDDataSchema
30266
- }).superRefine((value, ctx) => {
30267
- const attributesResult = RecycledIDAttributesSchema.safeParse(
30268
- value.attributes
30269
- );
30270
- if (!attributesResult.success) {
30271
- attributesResult.error.issues.forEach((issue) => {
30272
- ctx.addIssue({
30273
- ...issue,
30274
- path: ["attributes", ...issue.path]
30275
- });
30276
- });
30277
- }
30278
30367
  }).meta(RecycledIDIpfsSchemaMeta);
30279
30368
  var CreditPurchaseReceiptCreditAttributeSchema = NftAttributeSchema.safeExtend({
30280
30369
  trait_type: CreditTokenSymbolSchema,
@@ -30335,21 +30424,34 @@ var CreditPurchaseReceiptCollectionAttributeSchema = NftAttributeSchema.safeExte
30335
30424
  title: "Collection Attribute",
30336
30425
  description: "Attribute representing the amount of credits purchased from a collection"
30337
30426
  });
30338
- var CreditPurchaseReceiptAttributesSchema = uniqueBy(
30339
- zod.z.union([
30340
- CreditPurchaseReceiptCreditAttributeSchema,
30341
- CreditPurchaseReceiptTotalCreditsAttributeSchema,
30342
- CreditPurchaseReceiptTotalUsdcAttributeSchema,
30343
- CreditPurchaseReceiptPurchaseDateAttributeSchema,
30344
- CreditPurchaseReceiptCertificatesAttributeSchema,
30345
- CreditPurchaseReceiptReceiverAttributeSchema,
30346
- CreditPurchaseReceiptCollectionAttributeSchema
30347
- ]),
30348
- (attribute) => attribute.trait_type,
30349
- "Attribute trait_type values must be unique"
30350
- ).min(5).meta({
30427
+ var REQUIRED_CREDIT_PURCHASE_RECEIPT_ATTRIBUTES = [
30428
+ CreditPurchaseReceiptTotalCreditsAttributeSchema,
30429
+ CreditPurchaseReceiptTotalUsdcAttributeSchema,
30430
+ CreditPurchaseReceiptPurchaseDateAttributeSchema,
30431
+ CreditPurchaseReceiptCertificatesAttributeSchema
30432
+ ];
30433
+ var CONDITIONAL_CREDIT_PURCHASE_RECEIPT_ATTRIBUTES = [
30434
+ CreditPurchaseReceiptReceiverAttributeSchema
30435
+ ];
30436
+ var DYNAMIC_CREDIT_PURCHASE_RECEIPT_ATTRIBUTES = [
30437
+ CreditPurchaseReceiptCreditAttributeSchema,
30438
+ CreditPurchaseReceiptCollectionAttributeSchema
30439
+ ];
30440
+ var CreditPurchaseReceiptAttributesSchema = createOrderedAttributesSchema({
30441
+ required: REQUIRED_CREDIT_PURCHASE_RECEIPT_ATTRIBUTES,
30442
+ optional: [
30443
+ ...CONDITIONAL_CREDIT_PURCHASE_RECEIPT_ATTRIBUTES,
30444
+ ...DYNAMIC_CREDIT_PURCHASE_RECEIPT_ATTRIBUTES
30445
+ ],
30351
30446
  title: "Credit Purchase Receipt NFT Attribute Array",
30352
- description: "Attributes for credit purchase receipts including per-credit breakdowns, totals, receiver, purchase date, and per-collection amounts. Attributes must have unique trait types."
30447
+ description: "Attributes for credit purchase receipts including per-credit breakdowns, totals, receiver, purchase date, and per-collection amounts. Fixed required attributes: Total Credits Purchased, Total USDC Amount, Purchase Date, Certificates Purchased. Conditional attributes: Receiver (required when receiver.identity.name is provided). Dynamic attributes: Credit attributes (one per credit symbol in data.credits), Collection attributes (one per collection name in data.collections).",
30448
+ uniqueBySelector: (attribute) => attribute.trait_type,
30449
+ requiredTraitTypes: [
30450
+ "Total Credits Purchased",
30451
+ "Total USDC Amount",
30452
+ "Purchase Date",
30453
+ "Certificates Purchased"
30454
+ ]
30353
30455
  });
30354
30456
  var CreditPurchaseReceiptIdentitySchema = ReceiptIdentitySchema;
30355
30457
  var CreditPurchaseReceiptReceiverSchema = zod.z.strictObject({
@@ -30860,21 +30962,34 @@ var CreditRetirementReceiptCollectionAttributeSchema = NftAttributeSchema.safeEx
30860
30962
  title: "Collection Attribute",
30861
30963
  description: "Attribute representing the amount of credits retired from a collection"
30862
30964
  });
30863
- var CreditRetirementReceiptAttributesSchema = uniqueBy(
30864
- zod.z.union([
30865
- CreditRetirementReceiptCreditAttributeSchema,
30866
- CreditRetirementReceiptTotalCreditsAttributeSchema,
30867
- CreditRetirementReceiptBeneficiaryAttributeSchema,
30868
- CreditRetirementReceiptCreditHolderAttributeSchema,
30869
- CreditRetirementReceiptRetirementDateAttributeSchema,
30870
- CreditRetirementReceiptCertificatesAttributeSchema,
30871
- CreditRetirementReceiptCollectionAttributeSchema
30872
- ]),
30873
- (attribute) => attribute.trait_type,
30874
- "Attribute trait_type values must be unique"
30875
- ).min(6).meta({
30965
+ var REQUIRED_CREDIT_RETIREMENT_RECEIPT_ATTRIBUTES = [
30966
+ CreditRetirementReceiptTotalCreditsAttributeSchema,
30967
+ CreditRetirementReceiptBeneficiaryAttributeSchema,
30968
+ CreditRetirementReceiptRetirementDateAttributeSchema,
30969
+ CreditRetirementReceiptCertificatesAttributeSchema
30970
+ ];
30971
+ var CONDITIONAL_CREDIT_RETIREMENT_RECEIPT_ATTRIBUTES = [
30972
+ CreditRetirementReceiptCreditHolderAttributeSchema
30973
+ ];
30974
+ var DYNAMIC_CREDIT_RETIREMENT_RECEIPT_ATTRIBUTES = [
30975
+ CreditRetirementReceiptCreditAttributeSchema,
30976
+ CreditRetirementReceiptCollectionAttributeSchema
30977
+ ];
30978
+ var CreditRetirementReceiptAttributesSchema = createOrderedAttributesSchema({
30979
+ required: REQUIRED_CREDIT_RETIREMENT_RECEIPT_ATTRIBUTES,
30980
+ optional: [
30981
+ ...CONDITIONAL_CREDIT_RETIREMENT_RECEIPT_ATTRIBUTES,
30982
+ ...DYNAMIC_CREDIT_RETIREMENT_RECEIPT_ATTRIBUTES
30983
+ ],
30876
30984
  title: "Credit Retirement Receipt NFT Attribute Array",
30877
- description: "Attributes for credit retirement receipts including per-credit breakdowns, totals, beneficiary, credit holder, retirement date, certificate count, and per-collection amounts. Attributes must have unique trait types."
30985
+ description: "Attributes for credit retirement receipts including per-credit breakdowns, totals, beneficiary, credit holder, retirement date, certificate count, and per-collection amounts. Fixed required attributes: Total Credits Retired, Beneficiary, Retirement Date, Certificates Retired. Conditional attributes: Credit Holder (required when credit_holder.identity.name is provided). Dynamic attributes: Credit attributes (one per credit symbol in data.credits), Collection attributes (one per collection name in data.collections).",
30986
+ uniqueBySelector: (attribute) => attribute.trait_type,
30987
+ requiredTraitTypes: [
30988
+ "Total Credits Retired",
30989
+ "Beneficiary",
30990
+ "Retirement Date",
30991
+ "Certificates Retired"
30992
+ ]
30878
30993
  });
30879
30994
  var CreditRetirementReceiptIdentitySchema = ReceiptIdentitySchema;
30880
30995
  var CreditRetirementReceiptBeneficiarySchema = zod.z.strictObject({
@@ -31323,7 +31438,7 @@ var CollectionSchema = BaseIpfsSchema.safeExtend({
31323
31438
  title: "Collection Image",
31324
31439
  description: "IPFS URI pointing to the collection's visual representation",
31325
31440
  examples: [
31326
- "ipfs://bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku/collection-icon.png"
31441
+ "ipfs://bafybeihdwdcefgh4dqkjv67uzcmw7ojee6xedzdetojuzjevtenxquvyku"
31327
31442
  ]
31328
31443
  }),
31329
31444
  description: zod.z.string().min(50).max(1e3).meta({
@@ -31359,7 +31474,7 @@ var CreditSchema = BaseIpfsSchema.safeExtend({
31359
31474
  title: "Token Image",
31360
31475
  description: "IPFS URI pointing to the token's visual representation image",
31361
31476
  examples: [
31362
- "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm/credit-icon.png"
31477
+ "ipfs://bafybeigdyrztvzl5cceubvaxob7iqh6f3f7s36c74ojav2xsz2uib2g3vm"
31363
31478
  ]
31364
31479
  }),
31365
31480
  description: zod.z.string().min(50).max(1e3).meta({
@@ -31473,7 +31588,7 @@ var MassIDAuditSchema = BaseIpfsSchema.safeExtend({
31473
31588
  }),
31474
31589
  data: MassIDAuditDataSchema
31475
31590
  }).meta(MassIDAuditSchemaMeta);
31476
- /* v8 ignore next -- @preserve */
31591
+ /* v8 ignore file -- @preserve */
31477
31592
 
31478
31593
  exports.ALLOWED_BLOCKCHAIN_NETWORKS = ALLOWED_BLOCKCHAIN_NETWORKS;
31479
31594
  exports.AuditReferenceSchema = AuditReferenceSchema;
@@ -31607,6 +31722,7 @@ exports.canonicalizeForHash = canonicalizeForHash;
31607
31722
  exports.createAttributeMap = createAttributeMap;
31608
31723
  exports.createDateAttributeSchema = createDateAttributeSchema;
31609
31724
  exports.createNumericAttributeSchema = createNumericAttributeSchema;
31725
+ exports.createOrderedAttributesSchema = createOrderedAttributesSchema;
31610
31726
  exports.createReceiptCertificateSchema = createReceiptCertificateSchema;
31611
31727
  exports.createReceiptCollectionSchema = createReceiptCollectionSchema;
31612
31728
  exports.createReceiptCreditSchema = createReceiptCreditSchema;