@usefragments/core 1.11.0 → 2.0.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 (39) hide show
  1. package/dist/{chunk-RPSEABY3.js → chunk-BMPYIUZE.js} +23 -33
  2. package/dist/chunk-BMPYIUZE.js.map +1 -0
  3. package/dist/{chunk-3LLRNCPX.js → chunk-MZ2FS7U4.js} +1 -1
  4. package/dist/chunk-MZ2FS7U4.js.map +1 -0
  5. package/dist/codes/index.d.ts +1 -1
  6. package/dist/codes/index.js +1 -1
  7. package/dist/compiled-types/index.d.ts +1 -1
  8. package/dist/generate/index.d.ts +1 -1
  9. package/dist/{governance-BAsy1k2H.d.ts → governance-hOPXGbbs.d.ts} +3 -3
  10. package/dist/index.d.ts +133 -6026
  11. package/dist/index.js +179 -806
  12. package/dist/index.js.map +1 -1
  13. package/dist/preview-runtime.d.ts +1 -1
  14. package/dist/react-types.d.ts +1 -1
  15. package/dist/schemas/index.js +1 -1
  16. package/dist/storyAdapter.d.ts +1 -1
  17. package/dist/test-utils.d.ts +1 -1
  18. package/dist/topology/index.d.ts +1 -1
  19. package/dist/topology/index.js +1 -1
  20. package/package.json +1 -1
  21. package/src/approved-contract-tokens.test.ts +39 -0
  22. package/src/approved-contract-tokens.ts +18 -0
  23. package/src/codes/__tests__/codes.test.ts +4 -0
  24. package/src/codes/codes.ts +10 -0
  25. package/src/domain-ids.test.ts +9 -26
  26. package/src/domain-ids.ts +0 -45
  27. package/src/evaluation/evaluate.ts +17 -7
  28. package/src/evaluation/evaluation-v2-receipt-v1.test.ts +20 -8
  29. package/src/evaluation/index.ts +1 -1
  30. package/src/governance.ts +18 -0
  31. package/src/index.ts +10 -79
  32. package/src/topology/resolve-area.ts +1 -1
  33. package/src/types.ts +0 -3
  34. package/dist/chunk-3LLRNCPX.js.map +0 -1
  35. package/dist/chunk-RPSEABY3.js.map +0 -1
  36. package/src/feature-plan/digest.ts +0 -217
  37. package/src/feature-plan/feature-plan-v1.test.ts +0 -529
  38. package/src/feature-plan/index.ts +0 -65
  39. package/src/feature-plan/types.ts +0 -628
@@ -571,6 +571,16 @@ var CODES = [
571
571
  lifecycle: "experimental",
572
572
  fixAvailable: false,
573
573
  evidenceRequired: false
574
+ }),
575
+ code({
576
+ code: "FUI9012",
577
+ ruleId: "contract/write-not-entitled",
578
+ category: "system",
579
+ defaultSeverity: "critical",
580
+ title: "Contract write requires a paid workspace",
581
+ lifecycle: "experimental",
582
+ fixAvailable: false,
583
+ evidenceRequired: false
574
584
  })
575
585
  ];
576
586
  var byCode = new Map(
@@ -589,7 +599,6 @@ import { z as z2 } from "zod";
589
599
  // src/domain-ids.ts
590
600
  import { z } from "zod";
591
601
  var FULL_DIGEST_PATTERN = /^[0-9a-f]{64}$/u;
592
- var WORKFLOW_ENTROPY_PATTERN = /^[0-9a-f]{32}$/u;
593
602
  var digestHexStringSchema = z.string().regex(FULL_DIGEST_PATTERN, "Expected 64 lowercase hexadecimal characters");
594
603
  var digestHexSchema = digestHexStringSchema;
595
604
  var analysisPlanIdStringSchema = z.string().regex(/^apl_[0-9a-f]{64}$/u, "Invalid analysis plan ID");
@@ -598,14 +607,6 @@ var analysisPlanIdSchema = analysisPlanIdStringSchema.transform(
598
607
  );
599
608
  var evaluationReceiptIdSchema = z.string().regex(/^evr_[0-9a-f]{64}$/u, "Invalid evaluation receipt ID").transform((value) => value);
600
609
  var evaluationReceiptIdStringSchema = z.string().regex(/^evr_[0-9a-f]{64}$/u, "Invalid evaluation receipt ID");
601
- var featurePlanIdStringSchema = z.string().regex(/^fpl_[0-9a-f]{32}$/u, "Invalid feature plan ID");
602
- var featurePlanIdSchema = featurePlanIdStringSchema.transform(
603
- (value) => value
604
- );
605
- var featureRevisionIdStringSchema = z.string().regex(/^fpr_[0-9a-f]{64}$/u, "Invalid feature revision ID");
606
- var featureRevisionIdSchema = featureRevisionIdStringSchema.transform(
607
- (value) => value
608
- );
609
610
  function parseDigestHex(value) {
610
611
  return digestHexSchema.parse(value);
611
612
  }
@@ -618,27 +619,12 @@ function evaluationReceiptIdFromDigest(digest) {
618
619
  function mintEvaluationReceiptId(resultDigest) {
619
620
  return evaluationReceiptIdFromDigest(resultDigest);
620
621
  }
621
- function featureRevisionIdFromDigest(digest) {
622
- return featureRevisionIdSchema.parse(`fpr_${parseDigestHex(digest)}`);
623
- }
624
- function featurePlanIdFromEntropy(entropyHex) {
625
- if (!WORKFLOW_ENTROPY_PATTERN.test(entropyHex)) {
626
- throw new TypeError("Feature plan entropy must be exactly 128-bit lowercase hexadecimal");
627
- }
628
- return featurePlanIdSchema.parse(`fpl_${entropyHex}`);
629
- }
630
622
  function parseAnalysisPlanId(value) {
631
623
  return analysisPlanIdSchema.parse(value);
632
624
  }
633
625
  function parseEvaluationReceiptId(value) {
634
626
  return evaluationReceiptIdSchema.parse(value);
635
627
  }
636
- function parseFeaturePlanId(value) {
637
- return featurePlanIdSchema.parse(value);
638
- }
639
- function parseFeatureRevisionId(value) {
640
- return featureRevisionIdSchema.parse(value);
641
- }
642
628
 
643
629
  // src/facts/integrity.ts
644
630
  var CANONICAL_FACT_MAX_CONFLICTS_V1 = 1e3;
@@ -1900,6 +1886,17 @@ var componentGovernanceRecordSchema = z4.discriminatedUnion("kind", [
1900
1886
  a11yRequireNameRecordSchema
1901
1887
  ]);
1902
1888
  var componentGovernanceRecordsSchema = z4.array(componentGovernanceRecordSchema);
1889
+ function parseComponentGovernancePolicyJson(policyJson) {
1890
+ try {
1891
+ const parsed = JSON.parse(policyJson);
1892
+ const record = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
1893
+ const candidate = Array.isArray(parsed) ? parsed : record?.governance ?? record?.rules;
1894
+ const result = componentGovernanceRecordsSchema.safeParse(candidate);
1895
+ return result.success ? result.data : null;
1896
+ } catch {
1897
+ return null;
1898
+ }
1899
+ }
1903
1900
  var componentPolicyMatchSchema = z4.object({
1904
1901
  componentKey: z4.string().min(1).optional(),
1905
1902
  componentId: z4.string().min(1).optional(),
@@ -3061,20 +3058,12 @@ export {
3061
3058
  analysisPlanIdSchema,
3062
3059
  evaluationReceiptIdSchema,
3063
3060
  evaluationReceiptIdStringSchema,
3064
- featurePlanIdStringSchema,
3065
- featurePlanIdSchema,
3066
- featureRevisionIdStringSchema,
3067
- featureRevisionIdSchema,
3068
3061
  parseDigestHex,
3069
3062
  analysisPlanIdFromDigest,
3070
3063
  evaluationReceiptIdFromDigest,
3071
3064
  mintEvaluationReceiptId,
3072
- featureRevisionIdFromDigest,
3073
- featurePlanIdFromEntropy,
3074
3065
  parseAnalysisPlanId,
3075
3066
  parseEvaluationReceiptId,
3076
- parseFeaturePlanId,
3077
- parseFeatureRevisionId,
3078
3067
  CANONICAL_FACT_MAX_CONFLICTS_V1,
3079
3068
  CANONICAL_FACT_MAX_VALUES_PER_CONFLICT_V1,
3080
3069
  CANONICAL_FACT_MAX_PROVENANCE_PER_VALUE_V1,
@@ -3147,6 +3136,7 @@ export {
3147
3136
  globalGovernanceRecordSchema,
3148
3137
  componentGovernanceRecordSchema,
3149
3138
  componentGovernanceRecordsSchema,
3139
+ parseComponentGovernancePolicyJson,
3150
3140
  canonicalBridgeV1Schema,
3151
3141
  governanceConfigSchema,
3152
3142
  markPresetSourcedRules,
@@ -3190,4 +3180,4 @@ export {
3190
3180
  normalizeFinding,
3191
3181
  normalizeViolation
3192
3182
  };
3193
- //# sourceMappingURL=chunk-RPSEABY3.js.map
3183
+ //# sourceMappingURL=chunk-BMPYIUZE.js.map