@emeryld/rrroutes-contract 2.7.11 → 2.7.13

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 CHANGED
@@ -459,7 +459,7 @@ How to use:
459
459
  1. Generate an export JSON with `export:finalized-leaves`.
460
460
  2. Open the HTML file in your browser.
461
461
  3. Load the JSON file using the file picker.
462
- 4. Use the single search textbox + field checkboxes to filter routes.
462
+ 4. Use the search box, quick filter toggles, grouped field chips, and advanced filter panel to filter routes.
463
463
 
464
464
  Each result is rendered as a collapsible block with title `METHOD path`.
465
465
 
@@ -5,6 +5,7 @@ export type FlatSchemaEntry = {
5
5
  type: string;
6
6
  nullable: boolean;
7
7
  optional: boolean;
8
+ literal?: unknown;
8
9
  };
9
10
  export type FlatSchemaMap = Record<string, FlatSchemaEntry>;
10
11
  export declare function flattenSerializableSchema(schema: SerializableSchema | undefined, path: string): FlatSchemaMap;
package/dist/index.cjs CHANGED
@@ -657,6 +657,24 @@ function serializeLeavesContract(leaves, options = {}) {
657
657
  }
658
658
 
659
659
  // src/export/flattenSchema.ts
660
+ function formatLiteralType(literal) {
661
+ if (typeof literal === "string") return literal;
662
+ if (typeof literal === "number" || typeof literal === "boolean" || typeof literal === "bigint") {
663
+ return String(literal);
664
+ }
665
+ if (literal === null) return "null";
666
+ if (Array.isArray(literal)) {
667
+ return literal.map((item) => formatLiteralType(item)).join("|");
668
+ }
669
+ if (typeof literal === "object") {
670
+ try {
671
+ return JSON.stringify(literal);
672
+ } catch {
673
+ return "object";
674
+ }
675
+ }
676
+ return "unknown";
677
+ }
660
678
  function normalizeType(schema) {
661
679
  switch (schema.kind) {
662
680
  case "string":
@@ -673,11 +691,7 @@ function normalizeType(schema) {
673
691
  return "unknown";
674
692
  }
675
693
  case "literal": {
676
- const lit = schema.literal;
677
- if (typeof lit === "string") return "string";
678
- if (typeof lit === "number") return "number";
679
- if (typeof lit === "boolean") return "boolean";
680
- return "unknown";
694
+ return formatLiteralType(schema.literal);
681
695
  }
682
696
  default:
683
697
  return "unknown";
@@ -691,7 +705,8 @@ function setNode(out, path4, schema, inherited) {
691
705
  out[path4] = {
692
706
  type: normalizeType(schema),
693
707
  nullable: inherited.nullable || Boolean(schema.nullable),
694
- optional: inherited.optional || Boolean(schema.optional)
708
+ optional: inherited.optional || Boolean(schema.optional),
709
+ literal: schema.kind === "literal" ? schema.literal : void 0
695
710
  };
696
711
  }
697
712
  function flattenInto(out, schema, path4, inherited) {
@@ -1461,7 +1476,7 @@ function buildMeta(sourceExtraction) {
1461
1476
  "literal?",
1462
1477
  "enumValues?"
1463
1478
  ],
1464
- flatSchemaEntry: ["type", "nullable", "optional"]
1479
+ flatSchemaEntry: ["type", "nullable", "optional", "literal?"]
1465
1480
  },
1466
1481
  flattening: {
1467
1482
  notation: "dot+[]",