typia 13.3.0 → 14.0.1

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 (84) hide show
  1. package/lib/internal/_createStandardSchema.d.ts +1 -2
  2. package/lib/internal/_createStandardSchema.js.map +1 -1
  3. package/lib/internal/_createStandardSchema.mjs.map +1 -1
  4. package/lib/internal/_randomPattern.js +20 -3
  5. package/lib/internal/_randomPattern.js.map +1 -1
  6. package/lib/internal/_randomPattern.mjs +5 -1
  7. package/lib/internal/_randomPattern.mjs.map +1 -1
  8. package/lib/internal/_randomStringLength.js +9 -2
  9. package/lib/internal/_randomStringLength.js.map +1 -1
  10. package/lib/internal/_randomStringLength.mjs +3 -1
  11. package/lib/internal/_randomStringLength.mjs.map +1 -1
  12. package/lib/module.d.ts +1 -2
  13. package/lib/module.js.map +1 -1
  14. package/lib/module.mjs.map +1 -1
  15. package/lib/re-exports.d.ts +1 -1
  16. package/lib/re-exports.js.map +1 -1
  17. package/lib/transform.mjs +1 -1
  18. package/native/cmd/ttsc-typia/create_assert_error_factory_arity_test.go +5 -2
  19. package/native/cmd/ttsc-typia/dependency_collector_virtual_scheme_test.go +52 -0
  20. package/native/cmd/ttsc-typia/dynamic_key_tags_transform_test.go +206 -0
  21. package/native/cmd/ttsc-typia/notation_kebab_case_transform_test.go +2 -2
  22. package/native/cmd/ttsc-typia/project_catalog_transform_coverage_test.go +84 -85
  23. package/native/cmd/ttsc-typia/project_dependencies_callee_argument_transform_test.go +177 -0
  24. package/native/cmd/ttsc-typia/project_dependencies_callee_barrel_transform_test.go +115 -0
  25. package/native/cmd/ttsc-typia/project_dependencies_callee_inference_transform_test.go +285 -0
  26. package/native/cmd/ttsc-typia/project_dependencies_callee_shape_transform_test.go +117 -0
  27. package/native/cmd/ttsc-typia/project_dependencies_callee_untransformed_barrel_transform_test.go +121 -0
  28. package/native/cmd/ttsc-typia/project_dependencies_complete_diagnostic_transform_test.go +116 -0
  29. package/native/cmd/ttsc-typia/project_dependencies_complete_envelope_transform_test.go +115 -0
  30. package/native/cmd/ttsc-typia/project_dependencies_complete_inferred_type_transform_test.go +127 -0
  31. package/native/cmd/ttsc-typia/project_dependencies_complete_replaced_library_transform_test.go +153 -0
  32. package/native/cmd/ttsc-typia/project_dependencies_complete_untouched_reprint_transform_test.go +155 -0
  33. package/native/cmd/ttsc-typia/project_dependencies_computed_key_transform_test.go +218 -0
  34. package/native/cmd/ttsc-typia/project_dependencies_custom_lib_name_transform_test.go +6 -5
  35. package/native/cmd/ttsc-typia/project_dependencies_enum_member_value_transform_test.go +131 -0
  36. package/native/cmd/ttsc-typia/project_dependencies_inferred_declaration_transform_test.go +159 -0
  37. package/native/cmd/ttsc-typia/project_dependencies_jsdoc_typedef_transform_test.go +134 -0
  38. package/native/cmd/ttsc-typia/project_dependencies_named_tuple_member_transform_test.go +123 -0
  39. package/native/cmd/ttsc-typia/project_dependencies_qualified_barrel_transform_test.go +141 -0
  40. package/native/cmd/ttsc-typia/project_dependencies_type_parameter_default_transform_test.go +127 -0
  41. package/native/cmd/ttsc-typia/template_literal_type_tags_transform_test.go +3 -1
  42. package/native/cmd/ttsc-typia/transform.go +195 -21
  43. package/native/cmd/ttsc-typia/transform_helpers_test.go +12 -0
  44. package/native/core/factories/MetadataCommentTagFactory.go +96 -27
  45. package/native/core/factories/metadata_comment_tag_factory_coverage_test.go +2 -2
  46. package/native/core/factories/metadata_comment_tag_factory_rejects_out_of_range_integer_test.go +124 -0
  47. package/native/core/programmers/AssertProgrammer.go +20 -6
  48. package/native/core/programmers/RandomProgrammer.go +78 -6
  49. package/native/core/programmers/ValidateProgrammer.go +21 -6
  50. package/native/core/programmers/helpers/RandomJoiner.go +8 -1
  51. package/native/core/programmers/iterate/check_dynamic_properties.go +177 -3
  52. package/native/core/programmers/iterate/check_object.go +12 -1
  53. package/native/core/schemas/metadata/MetadataDependency.go +613 -30
  54. package/native/transform/CallExpressionTransformer.go +16 -1
  55. package/package.json +4 -14
  56. package/src/internal/_createStandardSchema.ts +1 -2
  57. package/src/internal/_randomPattern.ts +18 -3
  58. package/src/internal/_randomStringLength.ts +9 -2
  59. package/src/module.ts +6 -2
  60. package/src/re-exports.ts +13 -0
  61. package/lib/executable/FileSystemIdentity.d.ts +0 -44
  62. package/lib/executable/FileSystemIdentity.js +0 -213
  63. package/lib/executable/FileSystemIdentity.js.map +0 -1
  64. package/lib/executable/FileSystemIdentity.mjs +0 -133
  65. package/lib/executable/FileSystemIdentity.mjs.map +0 -1
  66. package/lib/executable/TypiaGenerateWizard.d.ts +0 -9
  67. package/lib/executable/TypiaGenerateWizard.js +0 -852
  68. package/lib/executable/TypiaGenerateWizard.js.map +0 -1
  69. package/lib/executable/TypiaGenerateWizard.mjs +0 -618
  70. package/lib/executable/TypiaGenerateWizard.mjs.map +0 -1
  71. package/lib/executable/generate/ttsc.d.ts +0 -1
  72. package/lib/executable/generate/ttsc.js +0 -53
  73. package/lib/executable/generate/ttsc.js.map +0 -1
  74. package/lib/executable/generate/ttsc.mjs +0 -37
  75. package/lib/executable/generate/ttsc.mjs.map +0 -1
  76. package/lib/executable/typia.d.ts +0 -2
  77. package/lib/executable/typia.js +0 -84
  78. package/lib/executable/typia.js.map +0 -1
  79. package/lib/executable/typia.mjs +0 -60
  80. package/lib/executable/typia.mjs.map +0 -1
  81. package/src/executable/FileSystemIdentity.ts +0 -222
  82. package/src/executable/TypiaGenerateWizard.ts +0 -1133
  83. package/src/executable/generate/ttsc.ts +0 -70
  84. package/src/executable/typia.ts +0 -80
@@ -1,3 +1,2 @@
1
- import { StandardSchemaV1 } from "@standard-schema/spec";
2
- import { IValidation } from "@typia/interface";
1
+ import { IValidation, StandardSchemaV1 } from "@typia/interface";
3
2
  export declare const _createStandardSchema: <T>(fn: (input: unknown) => IValidation<T>) => ((input: unknown) => IValidation<T>) & StandardSchemaV1<T, T>;
@@ -1 +1 @@
1
- {"version":3,"file":"_createStandardSchema.js","sourceRoot":"","sources":["../../src/internal/_createStandardSchema.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AC/D,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;YAC5B,cAAc,GAAG,EAAE,CAAC;YACpB,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;gBACpB,IAAI,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;oBAC5B,sBAAsB;oBACtB,oGAAoG;oBACpG,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC;oBAClC,KAAK,EAAE,CAAC;oBACR,cAAc,GAAG,GAAG,CAAC;gBACvB,CAAC;qBAAM,CAAC;oBACN,sBAAsB;oBACtB,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC;gBACpC,CAAC;YACH,CAAC;iBAAM,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;gBAC3B,oBAAoB;gBACpB,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,KAAK,KAAK,eAAe,CAAC,KAAK,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
1
+ {"version":3,"file":"_createStandardSchema.js","sourceRoot":"","sources":["../../src/internal/_createStandardSchema.ts"],"names":[],"mappings":";;;AAEO,MAAM,qBAAqB,GAAG,CACnC,EAAsC,EACyB,EAAE,CACjE,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE;IAChB,WAAW,EAAE;QACX,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,OAAO;QACf,QAAQ,EAAE,CAAC,KAAc,EAA8B,EAAE;YACvD,MAAM,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,MAAM,CAAC,OAAO,EAAE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Ac,GAAG,GAAG,CAAC;gBACvB,CAAC;qBAAM,CAAC;oBACN,sBAAsB;oBACtB,KAAK,GAAG,eAAe,CAAC,SAAS,CAAC;gBACpC,CAAC;YACH,CAAC;iBAAM,IAAI,OAAO,KAAK,GAAG,EAAE,CAAC;gBAC3B,oBAAoB;gBACpB,KAAK,GAAG,eAAe,CAAC,QAAQ,CAAC;YACnC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;IACH,CAAC;IAED,IAAI,KAAK,KAAK,eAAe,CAAC,KAAK,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACnE,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"_createStandardSchema.mjs","names":[],"sources":["../../src/internal/_createStandardSchema.ts"],"sourcesContent":["import { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport { IValidation } from \"@typia/interface\";\n\nexport const _createStandardSchema = <T>(\n fn: (input: unknown) => IValidation<T>,\n): ((input: unknown) => IValidation<T>) & StandardSchemaV1<T, T> =>\n Object.assign(fn, {\n \"~standard\": {\n version: 1,\n vendor: \"typia\",\n validate: (input: unknown): StandardSchemaV1.Result<T> => {\n const result = fn(input);\n if (result.success) {\n return {\n value: result.data,\n } satisfies StandardSchemaV1.SuccessResult<T>;\n } else {\n return {\n issues: result.errors.map((error) => ({\n message: `expected ${error.expected}, got ${formatValue(error.value)}`,\n path: typiaPathToStandardSchemaPath(error.path),\n })),\n } satisfies StandardSchemaV1.FailureResult;\n }\n },\n },\n } satisfies StandardSchemaV1<T, T>);\n\nconst formatValue = (value: unknown): string => {\n if (typeof value === \"object\") {\n if (value === null) return \"null\";\n try {\n if (Array.isArray(value)) return \"[object Array]\";\n } catch {\n // A revoked proxy can throw even for Array.isArray().\n }\n return \"[object Object]\";\n }\n if (typeof value === \"function\") return \"[function]\";\n return String(value);\n};\n\nenum PathParserState {\n // Start of a new segment\n // When the parser is in this state,\n // the pointer must point `.` or `[` or equal to length of the path\n Start,\n // Parsing a property key (`.hoge`)\n Property,\n // Parsing a string key (`[\"fuga\"]`)\n StringKey,\n // Parsing a number key (`[42]`)\n NumberKey,\n}\n\nconst typiaPathToStandardSchemaPath = (\n path: string,\n): ReadonlyArray<StandardSchemaV1.PathSegment> => {\n if (!path.startsWith(\"$input\")) {\n throw new Error(`Invalid path: ${JSON.stringify(path)}`);\n }\n\n const segments: StandardSchemaV1.PathSegment[] = [];\n let currentSegment = \"\";\n let state: PathParserState = PathParserState.Start;\n let index = \"$input\".length - 1;\n while (index < path.length - 1) {\n index++;\n const char = path[index];\n\n if (state === PathParserState.Property) {\n if (char === \".\" || char === \"[\") {\n // End of property\n segments.push({\n key: currentSegment,\n });\n state = PathParserState.Start;\n } else if (index === path.length - 1) {\n // End of path\n currentSegment += char;\n segments.push({\n key: currentSegment,\n });\n index++;\n state = PathParserState.Start;\n } else {\n currentSegment += char;\n }\n } else if (state === PathParserState.StringKey) {\n if (char === '\"') {\n // End of string key\n segments.push({\n key: JSON.parse(currentSegment + char),\n });\n // Skip `\"` and `]`\n index += 2;\n state = PathParserState.Start;\n } else if (char === \"\\\\\") {\n // Skip the next character from parsing\n currentSegment += path[index];\n index++;\n currentSegment += path[index];\n } else {\n currentSegment += char;\n }\n } else if (state === PathParserState.NumberKey) {\n if (char === \"]\") {\n // End of number key\n segments.push({\n key: Number.parseInt(currentSegment),\n });\n index++;\n state = PathParserState.Start;\n } else {\n currentSegment += char;\n }\n }\n\n if (state === PathParserState.Start && index < path.length - 1) {\n const newChar = path[index];\n currentSegment = \"\";\n if (newChar === \"[\") {\n if (path[index + 1] === '\"') {\n // Start of string key\n // NOTE: Typia uses JSON.stringify for this kind of keys, so `'` will not used as a string delimiter\n state = PathParserState.StringKey;\n index++;\n currentSegment = '\"';\n } else {\n // Start of number key\n state = PathParserState.NumberKey;\n }\n } else if (newChar === \".\") {\n // Start of property\n state = PathParserState.Property;\n } else {\n throw new Error(\"Unreachable: pointer points invalid character\");\n }\n }\n }\n\n if (state !== PathParserState.Start) {\n throw new Error(`Failed to parse path: ${JSON.stringify(path)}`);\n }\n\n return segments;\n};\n"],"mappings":";AAGA,MAAa,yBACX,OAEA,OAAO,OAAO,IAAI,EAChB,aAAa;CACX,SAAS;CACT,QAAQ;CACR,WAAW,UAA+C;EACxD,MAAM,SAAS,GAAG,KAAK;EACvB,IAAI,OAAO,SACT,OAAO,EACL,OAAO,OAAO,KAChB;OAEA,OAAO,EACL,QAAQ,OAAO,OAAO,KAAK,WAAW;GACpC,SAAS,YAAY,MAAM,SAAS,QAAQ,YAAY,MAAM,KAAK;GACnE,MAAM,8BAA8B,MAAM,IAAI;EAChD,EAAE,EACJ;CAEJ;AACF,EACF,CAAkC;AAEpC,MAAM,eAAe,UAA2B;CAC9C,IAAI,OAAO,UAAU,UAAU;EAC7B,IAAI,UAAU,MAAM,OAAO;EAC3B,IAAI;GACF,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;EACnC,QAAQ,CAER;EACA,OAAO;CACT;CACA,IAAI,OAAO,UAAU,YAAY,OAAO;CACxC,OAAO,OAAO,KAAK;AACrB;AAeA,MAAM,iCACJ,SACgD;CAChD,IAAI,CAAC,KAAK,WAAW,QAAQ,GAC3B,MAAM,IAAI,MAAM,iBAAiB,KAAK,UAAU,IAAI,GAAG;CAGzD,MAAM,WAA2C,CAAC;CAClD,IAAI,iBAAiB;CACrB,IAAI,QAAA;CACJ,IAAI,QAAQ;CACZ,OAAO,QAAQ,KAAK,SAAS,GAAG;EAC9B;EACA,MAAM,OAAO,KAAK;EAElB,IAAI,UAAA,GACF,IAAI,SAAS,OAAO,SAAS,KAAK;GAEhC,SAAS,KAAK,EACZ,KAAK,eACP,CAAC;GACD,QAAA;EACF,OAAO,IAAI,UAAU,KAAK,SAAS,GAAG;GAEpC,kBAAkB;GAClB,SAAS,KAAK,EACZ,KAAK,eACP,CAAC;GACD;GACA,QAAA;EACF,OACE,kBAAkB;OAEf,IAAI,UAAA,GACT,IAAI,SAAS,MAAK;GAEhB,SAAS,KAAK,EACZ,KAAK,KAAK,MAAM,iBAAiB,IAAI,EACvC,CAAC;GAED,SAAS;GACT,QAAA;EACF,OAAO,IAAI,SAAS,MAAM;GAExB,kBAAkB,KAAK;GACvB;GACA,kBAAkB,KAAK;EACzB,OACE,kBAAkB;OAEf,IAAI,UAAA,GACT,IAAI,SAAS,KAAK;GAEhB,SAAS,KAAK,EACZ,KAAK,OAAO,SAAS,cAAc,EACrC,CAAC;GACD;GACA,QAAA;EACF,OACE,kBAAkB;EAItB,IAAI,UAAA,KAAmC,QAAQ,KAAK,SAAS,GAAG;GAC9D,MAAM,UAAU,KAAK;GACrB,iBAAiB;GACjB,IAAI,YAAY,KACd,IAAI,KAAK,QAAQ,OAAO,MAAK;IAG3B,QAAA;IACA;IACA,iBAAiB;GACnB,OAEE,QAAA;QAEG,IAAI,YAAY,KAErB,QAAA;QAEA,MAAM,IAAI,MAAM,+CAA+C;EAEnE;CACF;CAEA,IAAI,UAAA,GACF,MAAM,IAAI,MAAM,yBAAyB,KAAK,UAAU,IAAI,GAAG;CAGjE,OAAO;AACT"}
1
+ {"version":3,"file":"_createStandardSchema.mjs","names":[],"sources":["../../src/internal/_createStandardSchema.ts"],"sourcesContent":["import { IValidation, StandardSchemaV1 } from \"@typia/interface\";\n\nexport const _createStandardSchema = <T>(\n fn: (input: unknown) => IValidation<T>,\n): ((input: unknown) => IValidation<T>) & StandardSchemaV1<T, T> =>\n Object.assign(fn, {\n \"~standard\": {\n version: 1,\n vendor: \"typia\",\n validate: (input: unknown): StandardSchemaV1.Result<T> => {\n const result = fn(input);\n if (result.success) {\n return {\n value: result.data,\n } satisfies StandardSchemaV1.SuccessResult<T>;\n } else {\n return {\n issues: result.errors.map((error) => ({\n message: `expected ${error.expected}, got ${formatValue(error.value)}`,\n path: typiaPathToStandardSchemaPath(error.path),\n })),\n } satisfies StandardSchemaV1.FailureResult;\n }\n },\n },\n } satisfies StandardSchemaV1<T, T>);\n\nconst formatValue = (value: unknown): string => {\n if (typeof value === \"object\") {\n if (value === null) return \"null\";\n try {\n if (Array.isArray(value)) return \"[object Array]\";\n } catch {\n // A revoked proxy can throw even for Array.isArray().\n }\n return \"[object Object]\";\n }\n if (typeof value === \"function\") return \"[function]\";\n return String(value);\n};\n\nenum PathParserState {\n // Start of a new segment\n // When the parser is in this state,\n // the pointer must point `.` or `[` or equal to length of the path\n Start,\n // Parsing a property key (`.hoge`)\n Property,\n // Parsing a string key (`[\"fuga\"]`)\n StringKey,\n // Parsing a number key (`[42]`)\n NumberKey,\n}\n\nconst typiaPathToStandardSchemaPath = (\n path: string,\n): ReadonlyArray<StandardSchemaV1.PathSegment> => {\n if (!path.startsWith(\"$input\")) {\n throw new Error(`Invalid path: ${JSON.stringify(path)}`);\n }\n\n const segments: StandardSchemaV1.PathSegment[] = [];\n let currentSegment = \"\";\n let state: PathParserState = PathParserState.Start;\n let index = \"$input\".length - 1;\n while (index < path.length - 1) {\n index++;\n const char = path[index];\n\n if (state === PathParserState.Property) {\n if (char === \".\" || char === \"[\") {\n // End of property\n segments.push({\n key: currentSegment,\n });\n state = PathParserState.Start;\n } else if (index === path.length - 1) {\n // End of path\n currentSegment += char;\n segments.push({\n key: currentSegment,\n });\n index++;\n state = PathParserState.Start;\n } else {\n currentSegment += char;\n }\n } else if (state === PathParserState.StringKey) {\n if (char === '\"') {\n // End of string key\n segments.push({\n key: JSON.parse(currentSegment + char),\n });\n // Skip `\"` and `]`\n index += 2;\n state = PathParserState.Start;\n } else if (char === \"\\\\\") {\n // Skip the next character from parsing\n currentSegment += path[index];\n index++;\n currentSegment += path[index];\n } else {\n currentSegment += char;\n }\n } else if (state === PathParserState.NumberKey) {\n if (char === \"]\") {\n // End of number key\n segments.push({\n key: Number.parseInt(currentSegment),\n });\n index++;\n state = PathParserState.Start;\n } else {\n currentSegment += char;\n }\n }\n\n if (state === PathParserState.Start && index < path.length - 1) {\n const newChar = path[index];\n currentSegment = \"\";\n if (newChar === \"[\") {\n if (path[index + 1] === '\"') {\n // Start of string key\n // NOTE: Typia uses JSON.stringify for this kind of keys, so `'` will not used as a string delimiter\n state = PathParserState.StringKey;\n index++;\n currentSegment = '\"';\n } else {\n // Start of number key\n state = PathParserState.NumberKey;\n }\n } else if (newChar === \".\") {\n // Start of property\n state = PathParserState.Property;\n } else {\n throw new Error(\"Unreachable: pointer points invalid character\");\n }\n }\n }\n\n if (state !== PathParserState.Start) {\n throw new Error(`Failed to parse path: ${JSON.stringify(path)}`);\n }\n\n return segments;\n};\n"],"mappings":";AAEA,MAAa,yBACX,OAEA,OAAO,OAAO,IAAI,EAChB,aAAa;CACX,SAAS;CACT,QAAQ;CACR,WAAW,UAA+C;EACxD,MAAM,SAAS,GAAG,KAAK;EACvB,IAAI,OAAO,SACT,OAAO,EACL,OAAO,OAAO,KAChB;OAEA,OAAO,EACL,QAAQ,OAAO,OAAO,KAAK,WAAW;GACpC,SAAS,YAAY,MAAM,SAAS,QAAQ,YAAY,MAAM,KAAK;GACnE,MAAM,8BAA8B,MAAM,IAAI;EAChD,EAAE,EACJ;CAEJ;AACF,EACF,CAAkC;AAEpC,MAAM,eAAe,UAA2B;CAC9C,IAAI,OAAO,UAAU,UAAU;EAC7B,IAAI,UAAU,MAAM,OAAO;EAC3B,IAAI;GACF,IAAI,MAAM,QAAQ,KAAK,GAAG,OAAO;EACnC,QAAQ,CAER;EACA,OAAO;CACT;CACA,IAAI,OAAO,UAAU,YAAY,OAAO;CACxC,OAAO,OAAO,KAAK;AACrB;AAeA,MAAM,iCACJ,SACgD;CAChD,IAAI,CAAC,KAAK,WAAW,QAAQ,GAC3B,MAAM,IAAI,MAAM,iBAAiB,KAAK,UAAU,IAAI,GAAG;CAGzD,MAAM,WAA2C,CAAC;CAClD,IAAI,iBAAiB;CACrB,IAAI,QAAA;CACJ,IAAI,QAAQ;CACZ,OAAO,QAAQ,KAAK,SAAS,GAAG;EAC9B;EACA,MAAM,OAAO,KAAK;EAElB,IAAI,UAAA,GACF,IAAI,SAAS,OAAO,SAAS,KAAK;GAEhC,SAAS,KAAK,EACZ,KAAK,eACP,CAAC;GACD,QAAA;EACF,OAAO,IAAI,UAAU,KAAK,SAAS,GAAG;GAEpC,kBAAkB;GAClB,SAAS,KAAK,EACZ,KAAK,eACP,CAAC;GACD;GACA,QAAA;EACF,OACE,kBAAkB;OAEf,IAAI,UAAA,GACT,IAAI,SAAS,MAAK;GAEhB,SAAS,KAAK,EACZ,KAAK,KAAK,MAAM,iBAAiB,IAAI,EACvC,CAAC;GAED,SAAS;GACT,QAAA;EACF,OAAO,IAAI,SAAS,MAAM;GAExB,kBAAkB,KAAK;GACvB;GACA,kBAAkB,KAAK;EACzB,OACE,kBAAkB;OAEf,IAAI,UAAA,GACT,IAAI,SAAS,KAAK;GAEhB,SAAS,KAAK,EACZ,KAAK,OAAO,SAAS,cAAc,EACrC,CAAC;GACD;GACA,QAAA;EACF,OACE,kBAAkB;EAItB,IAAI,UAAA,KAAmC,QAAQ,KAAK,SAAS,GAAG;GAC9D,MAAM,UAAU,KAAK;GACrB,iBAAiB;GACjB,IAAI,YAAY,KACd,IAAI,KAAK,QAAQ,OAAO,MAAK;IAG3B,QAAA;IACA;IACA,iBAAiB;GACnB,OAEE,QAAA;QAEG,IAAI,YAAY,KAErB,QAAA;QAEA,MAAM,IAAI,MAAM,+CAA+C;EAEnE;CACF;CAEA,IAAI,UAAA,GACF,MAAM,IAAI,MAAM,yBAAyB,KAAK,UAAU,IAAI,GAAG;CAGjE,OAAO;AACT"}
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports._randomPattern = void 0;
7
7
  const randexp_1 = __importDefault(require("randexp"));
8
+ const _stringLength_1 = require("./_stringLength");
8
9
  const _randomPattern = (regex, props) => {
9
10
  const r = new randexp_1.default(regex);
10
11
  const min = props === null || props === void 0 ? void 0 : props.minLength;
@@ -16,13 +17,29 @@ const _randomPattern = (regex, props) => {
16
17
  r.max = max;
17
18
  else if (min !== undefined && min * 2 > r.max)
18
19
  r.max = min * 2;
20
+ // The verification counts characters, not UTF-16 code units, because that is
21
+ // what `MinLength` and `MaxLength` compare against. `Pattern` compiles to a
22
+ // flagless `RegExp`, so a quantifier binds one code unit wherever its atom is
23
+ // a bare astral character: under `^😀+$` the `+` repeats the trailing low
24
+ // surrogate alone, and RandExp draws `\ud83d` + k * `\ude00` -- k characters
25
+ // in k + 1 code units. Measuring in code units accepted a two-character draw
26
+ // for `MinLength<3>` and handed back a value the generated validator rejects.
27
+ // Group the atom (`^(?:😀)+$`) and the arithmetic changes to 2k units for k
28
+ // characters; the two counts still differ, which is the point.
29
+ //
30
+ // The count is taken only after the pattern matches, and only when a bound
31
+ // exists, so an unbounded draw still walks nothing.
19
32
  const bounded = min !== undefined || max !== undefined;
20
33
  const limit = bounded ? 1024 : 10;
21
34
  for (let i = 0; i < limit; ++i) {
22
35
  const str = r.gen();
23
- if (regex.test(str) &&
24
- (min === undefined || str.length >= min) &&
25
- (max === undefined || str.length <= max))
36
+ if (regex.test(str) === false)
37
+ continue;
38
+ if (bounded === false)
39
+ return str;
40
+ const length = (0, _stringLength_1._stringLength)(str);
41
+ if ((min === undefined || length >= min) &&
42
+ (max === undefined || length <= max))
26
43
  return str;
27
44
  }
28
45
  throw new Error(bounded
@@ -1 +1 @@
1
- {"version":3,"file":"_randomPattern.js","sourceRoot":"","sources":["../../src/internal/_randomPattern.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8B;AAIvB,MAAM,cAAc,GAAG,CAC5B,KAAa,EACb,KAAqB,EACb,EAAE;IACV,MAAM,CAAC,GAAY,IAAI,iBAAO,CAAC,KAAK,CAAC,CAAC;IACtC,MAAM,GAAG,GAAuB,KAAK,aAAL,KAAK,u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AM,IAAI,GAAG,CAAC;YAEpC,OAAO,GAAG,CAAC;IACf,CAAC;IACD,MAAM,IAAI,KAAK,CACb,OAAO;QACL,CAAC,CAAC,kFAAkF;QACpF,CAAC,CAAC,0DAA0D,CAC/D,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,cAAc,GAAd,cAAc,CA4CzB"}
@@ -1,3 +1,4 @@
1
+ import { _stringLength } from "./_stringLength.mjs";
1
2
  import RandExp from "randexp";
2
3
  //#region src/internal/_randomPattern.ts
3
4
  const _randomPattern = (regex, props) => {
@@ -10,7 +11,10 @@ const _randomPattern = (regex, props) => {
10
11
  const limit = bounded ? 1024 : 10;
11
12
  for (let i = 0; i < limit; ++i) {
12
13
  const str = r.gen();
13
- if (regex.test(str) && (min === void 0 || str.length >= min) && (max === void 0 || str.length <= max)) return str;
14
+ if (regex.test(str) === false) continue;
15
+ if (bounded === false) return str;
16
+ const length = _stringLength(str);
17
+ if ((min === void 0 || length >= min) && (max === void 0 || length <= max)) return str;
14
18
  }
15
19
  throw new Error(bounded ? "unable to generate a random string matching the pattern within the length range." : "unable to generate a random string matching the pattern.");
16
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"_randomPattern.mjs","names":[],"sources":["../../src/internal/_randomPattern.ts"],"sourcesContent":["import RandExp from \"randexp\";\n\nimport { _ILengthProps } from \"./_randomStringLength\";\n\nexport const _randomPattern = (\n regex: RegExp,\n props?: _ILengthProps,\n): string => {\n const r: RandExp = new RandExp(regex);\n const min: number | undefined = props?.minLength;\n const max: number | undefined = props?.maxLength;\n\n // RandExp expands an unbounded quantifier to `randInt(token.min, token.min +\n // r.max)`, so steering `r.max` biases the generated length toward the window.\n // There is no matching floor control, so the length is still verified below.\n if (max !== undefined) r.max = max;\n else if (min !== undefined && min * 2 > r.max) r.max = min * 2;\n\n const bounded: boolean = min !== undefined || max !== undefined;\n const limit: number = bounded ? 1024 : 10;\n for (let i: number = 0; i < limit; ++i) {\n const str: string = r.gen();\n if (\n regex.test(str) &&\n (min === undefined || str.length >= min) &&\n (max === undefined || str.length <= max)\n )\n return str;\n }\n throw new Error(\n bounded\n ? \"unable to generate a random string matching the pattern within the length range.\"\n : \"unable to generate a random string matching the pattern.\",\n );\n};\n"],"mappings":";;AAIA,MAAa,kBACX,OACA,UACW;CACX,MAAM,IAAa,IAAI,QAAQ,KAAK;CACpC,MAAM,MAA0B,OAAO;CACvC,MAAM,MAA0B,OAAO;CAKvC,IAAI,QAAQ,KAAA,GAAW,EAAE,MAAM;MAC1B,IAAI,QAAQ,KAAA,KAAa,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,MAAM;CAE7D,MAAM,UAAmB,QAAQ,KAAA,KAAa,QAAQ,KAAA;CACtD,MAAM,QAAgB,UAAU,OAAO;CACvC,KAAK,IAAI,IAAY,GAAG,IAAI,OAAO,EAAE,GAAG;EACtC,MAAM,MAAc,EAAE,IAAI;EAC1B,IACE,MAAM,KAAK,GAAG,MACb,QAAQ,KAAA,KAAa,IAAI,UAAU,SACnC,QAAQ,KAAA,KAAa,IAAI,UAAU,MAEpC,OAAO;CACX;CACA,MAAM,IAAI,MACR,UACI,qFACA,0DACN;AACF"}
1
+ {"version":3,"file":"_randomPattern.mjs","names":[],"sources":["../../src/internal/_randomPattern.ts"],"sourcesContent":["import RandExp from \"randexp\";\n\nimport { _ILengthProps } from \"./_randomStringLength\";\nimport { _stringLength } from \"./_stringLength\";\n\nexport const _randomPattern = (\n regex: RegExp,\n props?: _ILengthProps,\n): string => {\n const r: RandExp = new RandExp(regex);\n const min: number | undefined = props?.minLength;\n const max: number | undefined = props?.maxLength;\n\n // RandExp expands an unbounded quantifier to `randInt(token.min, token.min +\n // r.max)`, so steering `r.max` biases the generated length toward the window.\n // There is no matching floor control, so the length is still verified below.\n if (max !== undefined) r.max = max;\n else if (min !== undefined && min * 2 > r.max) r.max = min * 2;\n\n // The verification counts characters, not UTF-16 code units, because that is\n // what `MinLength` and `MaxLength` compare against. `Pattern` compiles to a\n // flagless `RegExp`, so a quantifier binds one code unit wherever its atom is\n // a bare astral character: under `^😀+$` the `+` repeats the trailing low\n // surrogate alone, and RandExp draws `\\ud83d` + k * `\\ude00` -- k characters\n // in k + 1 code units. Measuring in code units accepted a two-character draw\n // for `MinLength<3>` and handed back a value the generated validator rejects.\n // Group the atom (`^(?:😀)+$`) and the arithmetic changes to 2k units for k\n // characters; the two counts still differ, which is the point.\n //\n // The count is taken only after the pattern matches, and only when a bound\n // exists, so an unbounded draw still walks nothing.\n const bounded: boolean = min !== undefined || max !== undefined;\n const limit: number = bounded ? 1024 : 10;\n for (let i: number = 0; i < limit; ++i) {\n const str: string = r.gen();\n if (regex.test(str) === false) continue;\n if (bounded === false) return str;\n const length: number = _stringLength(str);\n if (\n (min === undefined || length >= min) &&\n (max === undefined || length <= max)\n )\n return str;\n }\n throw new Error(\n bounded\n ? \"unable to generate a random string matching the pattern within the length range.\"\n : \"unable to generate a random string matching the pattern.\",\n );\n};\n"],"mappings":";;;AAKA,MAAa,kBACX,OACA,UACW;CACX,MAAM,IAAa,IAAI,QAAQ,KAAK;CACpC,MAAM,MAA0B,OAAO;CACvC,MAAM,MAA0B,OAAO;CAKvC,IAAI,QAAQ,KAAA,GAAW,EAAE,MAAM;MAC1B,IAAI,QAAQ,KAAA,KAAa,MAAM,IAAI,EAAE,KAAK,EAAE,MAAM,MAAM;CAc7D,MAAM,UAAmB,QAAQ,KAAA,KAAa,QAAQ,KAAA;CACtD,MAAM,QAAgB,UAAU,OAAO;CACvC,KAAK,IAAI,IAAY,GAAG,IAAI,OAAO,EAAE,GAAG;EACtC,MAAM,MAAc,EAAE,IAAI;EAC1B,IAAI,MAAM,KAAK,GAAG,MAAM,OAAO;EAC/B,IAAI,YAAY,OAAO,OAAO;EAC9B,MAAM,SAAiB,cAAc,GAAG;EACxC,KACG,QAAQ,KAAA,KAAa,UAAU,SAC/B,QAAQ,KAAA,KAAa,UAAU,MAEhC,OAAO;CACX;CACA,MAAM,IAAI,MACR,UACI,qFACA,0DACN;AACF"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports._randomFormatLength = exports._randomLengthPick = exports._randomLengthWindow = exports._randomSegmentLength = exports._RANDOM_LENGTH_ERROR = void 0;
4
4
  const _randomInteger_1 = require("./_randomInteger");
5
5
  const _randomString_1 = require("./_randomString");
6
+ const _stringLength_1 = require("./_stringLength");
6
7
  exports._RANDOM_LENGTH_ERROR = "unable to generate a random string satisfying both the format and the length constraints.";
7
8
  /**
8
9
  * Builds the variable segment of a fixed-shape format string so that the total
@@ -74,8 +75,14 @@ const _randomFormatLength = (props, generate) => {
74
75
  return generate();
75
76
  for (let i = 0; i < 256; ++i) {
76
77
  const value = generate();
77
- if ((props.minLength === undefined || value.length >= props.minLength) &&
78
- (props.maxLength === undefined || value.length <= props.maxLength))
78
+ // Characters, not UTF-16 code units: `minLength` and `maxLength` are the
79
+ // bounds the generated validator compares in characters. `uuid` and `date`,
80
+ // the only two shapes routed through here, are ASCII, so the two counts
81
+ // agree for them today -- this keeps one measure so a later non-ASCII
82
+ // format cannot reintroduce the divergence unnoticed.
83
+ const length = (0, _stringLength_1._stringLength)(value);
84
+ if ((props.minLength === undefined || length >= props.minLength) &&
85
+ (props.maxLength === undefined || length <= props.maxLength))
79
86
  return value;
80
87
  }
81
88
  throw new Error(exports._RANDOM_LENGTH_ERROR);
@@ -1 +1 @@
1
- {"version":3,"file":"_randomStringLength.js","sourceRoot":"","sources":["../../src/internal/_randomStringLength.ts"],"names":[],"mappings":";;;AAAA,qDAAkD;AAClD,mDAAgD;AAEnC,QAAA,oBAAoB,GAC/B,2FAA2F,CAAC;AAe9F;;;;;;;;;GASG;AACI,MAAM,oBAAoB,GAAG,CAClC,KAAgC,EAChC,KAAa,EACb,QAAgB,EAChB,OAAe,EACP,EAAE;IACV,IAAI,GAAG,GACL,CAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,SAAS,MAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAA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AC;YAE5D,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,QAAA,oBAAoB,CAAC,CAAC;AACxC,CAAC,CAAC;AArBW,QAAA,mBAAmB,GAAnB,mBAAmB,CAqB9B"}
@@ -1,5 +1,6 @@
1
1
  import { _randomInteger } from "./_randomInteger.mjs";
2
2
  import { _randomString } from "./_randomString.mjs";
3
+ import { _stringLength } from "./_stringLength.mjs";
3
4
  //#region src/internal/_randomStringLength.ts
4
5
  const _RANDOM_LENGTH_ERROR = "unable to generate a random string satisfying both the format and the length constraints.";
5
6
  /**
@@ -69,7 +70,8 @@ const _randomFormatLength = (props, generate) => {
69
70
  if (props?.minLength === void 0 && props?.maxLength === void 0) return generate();
70
71
  for (let i = 0; i < 256; ++i) {
71
72
  const value = generate();
72
- if ((props.minLength === void 0 || value.length >= props.minLength) && (props.maxLength === void 0 || value.length <= props.maxLength)) return value;
73
+ const length = _stringLength(value);
74
+ if ((props.minLength === void 0 || length >= props.minLength) && (props.maxLength === void 0 || length <= props.maxLength)) return value;
73
75
  }
74
76
  throw new Error(_RANDOM_LENGTH_ERROR);
75
77
  };
@@ -1 +1 @@
1
- {"version":3,"file":"_randomStringLength.mjs","names":[],"sources":["../../src/internal/_randomStringLength.ts"],"sourcesContent":["import { _randomInteger } from \"./_randomInteger\";\nimport { _randomString } from \"./_randomString\";\n\nexport const _RANDOM_LENGTH_ERROR =\n \"unable to generate a random string satisfying both the format and the length constraints.\";\n\n/**\n * Length bounds forwarded to a string format or pattern generator.\n *\n * `typia.random<T>()` passes this object to the `_randomFormat*` and\n * `_randomPattern` helpers whenever the string leaf also carries a `MinLength`\n * or `MaxLength` tag, so a constrained format or pattern is generated at a\n * length its own validator accepts (issue #2189).\n */\nexport interface _ILengthProps {\n minLength?: number;\n maxLength?: number;\n}\n\n/**\n * Builds the variable segment of a fixed-shape format string so that the total\n * length `fixed + segment.length` lands inside the requested window.\n *\n * `fixed` is the number of characters the format always contributes around the\n * segment, `fallback` is the segment length used when the leaf is unconstrained\n * on that side, and `minimum` is the smallest segment the format still\n * validates with. Throws when the window cannot be satisfied by this format's\n * shape (e.g. `Format<\"email\"> & MaxLength<3>`).\n */\nexport const _randomSegmentLength = (\n props: _ILengthProps | undefined,\n fixed: number,\n fallback: number,\n minimum: number,\n): string => {\n let low: number =\n props?.minLength === undefined ? minimum : props.minLength - fixed;\n if (low < minimum) low = minimum;\n // With only a lower bound, spread the segment across `fallback` extra\n // characters so the generated length varies, mirroring `_randomString`.\n const high: number =\n props?.maxLength === undefined ? low + fallback : props.maxLength - fixed;\n if (high < low || high < minimum) throw new Error(_RANDOM_LENGTH_ERROR);\n return _randomString({ type: \"string\", minLength: low, maxLength: high });\n};\n\n/**\n * Intersects the requested length window with the lengths a format's grammar\n * can express, and draws one of them.\n *\n * `minimum` and `maximum` are the shortest and longest values the format admits\n * — omit `maximum` when the grammar is open above — and `spread` is how far\n * past the floor an unbounded request may reach, so an open side still varies\n * the way `_randomString` does. The caller draws from the returned window and\n * applies whatever step its grammar has (base64 lengths are multiples of four,\n * a fractional second needs at least one digit).\n *\n * Throws only when the window and the grammar do not overlap at all. That is\n * the distinction the retry driver below cannot make: it redraws one shape, so\n * it gives up on every length that shape never emits even when the format\n * itself accepts one (issue #2284).\n */\nexport const _randomLengthWindow = (\n props: _ILengthProps | undefined,\n format: { minimum: number; maximum?: number; spread?: number },\n): { low: number; high: number } => {\n const ceiling: number = format.maximum ?? Number.MAX_SAFE_INTEGER;\n const low: number = Math.max(\n props?.minLength ?? format.minimum,\n format.minimum,\n );\n const high: number = Math.min(\n props?.maxLength ?? low + (format.spread ?? 0),\n ceiling,\n );\n if (low > high) throw new Error(_RANDOM_LENGTH_ERROR);\n return { low, high };\n};\n\n/** Draws a length inside a window produced by {@link _randomLengthWindow}. */\nexport const _randomLengthPick = (window: {\n low: number;\n high: number;\n}): number =>\n _randomInteger({\n type: \"integer\",\n minimum: window.low,\n maximum: window.high,\n });\n\n/**\n * Wraps a fixed-length format generator (uuid, date) with the requested length\n * window.\n *\n * Use it only where the grammar admits exactly one length, so a window that\n * excludes it is genuinely unsatisfiable. A format that can express more than\n * one length must build its value at a length drawn from\n * {@link _randomLengthWindow} instead; redrawing one shape cannot reach a length\n * that shape never emits.\n */\nexport const _randomFormatLength = (\n props: _ILengthProps | undefined,\n generate: () => string,\n): string => {\n if (props?.minLength === undefined && props?.maxLength === undefined)\n return generate();\n for (let i: number = 0; i < 256; ++i) {\n const value: string = generate();\n if (\n (props.minLength === undefined || value.length >= props.minLength) &&\n (props.maxLength === undefined || value.length <= props.maxLength)\n )\n return value;\n }\n throw new Error(_RANDOM_LENGTH_ERROR);\n};\n"],"mappings":";;;AAGA,MAAa,uBACX;;;;;;;;;;;AAyBF,MAAa,wBACX,OACA,OACA,UACA,YACW;CACX,IAAI,MACF,OAAO,cAAc,KAAA,IAAY,UAAU,MAAM,YAAY;CAC/D,IAAI,MAAM,SAAS,MAAM;CAGzB,MAAM,OACJ,OAAO,cAAc,KAAA,IAAY,MAAM,WAAW,MAAM,YAAY;CACtE,IAAI,OAAO,OAAO,OAAO,SAAS,MAAM,IAAI,MAAM,oBAAoB;CACtE,OAAO,cAAc;EAAE,MAAM;EAAU,WAAW;EAAK,WAAW;CAAK,CAAC;AAC1E;;;;;;;;;;;;;;;;;AAkBA,MAAa,uBACX,OACA,WACkC;CAClC,MAAM,UAAkB,OAAO,WAAW,OAAO;CACjD,MAAM,MAAc,KAAK,IACvB,OAAO,aAAa,OAAO,SAC3B,OAAO,OACT;CACA,MAAM,OAAe,KAAK,IACxB,OAAO,aAAa,OAAO,OAAO,UAAU,IAC5C,OACF;CACA,IAAI,MAAM,MAAM,MAAM,IAAI,MAAM,oBAAoB;CACpD,OAAO;EAAE;EAAK;CAAK;AACrB;;AAGA,MAAa,qBAAqB,WAIhC,eAAe;CACb,MAAM;CACN,SAAS,OAAO;CAChB,SAAS,OAAO;AAClB,CAAC;;;;;;;;;;;AAYH,MAAa,uBACX,OACA,aACW;CACX,IAAI,OAAO,cAAc,KAAA,KAAa,OAAO,cAAc,KAAA,GACzD,OAAO,SAAS;CAClB,KAAK,IAAI,IAAY,GAAG,IAAI,KAAK,EAAE,GAAG;EACpC,MAAM,QAAgB,SAAS;EAC/B,KACG,MAAM,cAAc,KAAA,KAAa,MAAM,UAAU,MAAM,eACvD,MAAM,cAAc,KAAA,KAAa,MAAM,UAAU,MAAM,YAExD,OAAO;CACX;CACA,MAAM,IAAI,MAAM,oBAAoB;AACtC"}
1
+ {"version":3,"file":"_randomStringLength.mjs","names":[],"sources":["../../src/internal/_randomStringLength.ts"],"sourcesContent":["import { _randomInteger } from \"./_randomInteger\";\nimport { _randomString } from \"./_randomString\";\nimport { _stringLength } from \"./_stringLength\";\n\nexport const _RANDOM_LENGTH_ERROR =\n \"unable to generate a random string satisfying both the format and the length constraints.\";\n\n/**\n * Length bounds forwarded to a string format or pattern generator.\n *\n * `typia.random<T>()` passes this object to the `_randomFormat*` and\n * `_randomPattern` helpers whenever the string leaf also carries a `MinLength`\n * or `MaxLength` tag, so a constrained format or pattern is generated at a\n * length its own validator accepts (issue #2189).\n */\nexport interface _ILengthProps {\n minLength?: number;\n maxLength?: number;\n}\n\n/**\n * Builds the variable segment of a fixed-shape format string so that the total\n * length `fixed + segment.length` lands inside the requested window.\n *\n * `fixed` is the number of characters the format always contributes around the\n * segment, `fallback` is the segment length used when the leaf is unconstrained\n * on that side, and `minimum` is the smallest segment the format still\n * validates with. Throws when the window cannot be satisfied by this format's\n * shape (e.g. `Format<\"email\"> & MaxLength<3>`).\n */\nexport const _randomSegmentLength = (\n props: _ILengthProps | undefined,\n fixed: number,\n fallback: number,\n minimum: number,\n): string => {\n let low: number =\n props?.minLength === undefined ? minimum : props.minLength - fixed;\n if (low < minimum) low = minimum;\n // With only a lower bound, spread the segment across `fallback` extra\n // characters so the generated length varies, mirroring `_randomString`.\n const high: number =\n props?.maxLength === undefined ? low + fallback : props.maxLength - fixed;\n if (high < low || high < minimum) throw new Error(_RANDOM_LENGTH_ERROR);\n return _randomString({ type: \"string\", minLength: low, maxLength: high });\n};\n\n/**\n * Intersects the requested length window with the lengths a format's grammar\n * can express, and draws one of them.\n *\n * `minimum` and `maximum` are the shortest and longest values the format admits\n * — omit `maximum` when the grammar is open above — and `spread` is how far\n * past the floor an unbounded request may reach, so an open side still varies\n * the way `_randomString` does. The caller draws from the returned window and\n * applies whatever step its grammar has (base64 lengths are multiples of four,\n * a fractional second needs at least one digit).\n *\n * Throws only when the window and the grammar do not overlap at all. That is\n * the distinction the retry driver below cannot make: it redraws one shape, so\n * it gives up on every length that shape never emits even when the format\n * itself accepts one (issue #2284).\n */\nexport const _randomLengthWindow = (\n props: _ILengthProps | undefined,\n format: { minimum: number; maximum?: number; spread?: number },\n): { low: number; high: number } => {\n const ceiling: number = format.maximum ?? Number.MAX_SAFE_INTEGER;\n const low: number = Math.max(\n props?.minLength ?? format.minimum,\n format.minimum,\n );\n const high: number = Math.min(\n props?.maxLength ?? low + (format.spread ?? 0),\n ceiling,\n );\n if (low > high) throw new Error(_RANDOM_LENGTH_ERROR);\n return { low, high };\n};\n\n/** Draws a length inside a window produced by {@link _randomLengthWindow}. */\nexport const _randomLengthPick = (window: {\n low: number;\n high: number;\n}): number =>\n _randomInteger({\n type: \"integer\",\n minimum: window.low,\n maximum: window.high,\n });\n\n/**\n * Wraps a fixed-length format generator (uuid, date) with the requested length\n * window.\n *\n * Use it only where the grammar admits exactly one length, so a window that\n * excludes it is genuinely unsatisfiable. A format that can express more than\n * one length must build its value at a length drawn from\n * {@link _randomLengthWindow} instead; redrawing one shape cannot reach a length\n * that shape never emits.\n */\nexport const _randomFormatLength = (\n props: _ILengthProps | undefined,\n generate: () => string,\n): string => {\n if (props?.minLength === undefined && props?.maxLength === undefined)\n return generate();\n for (let i: number = 0; i < 256; ++i) {\n const value: string = generate();\n // Characters, not UTF-16 code units: `minLength` and `maxLength` are the\n // bounds the generated validator compares in characters. `uuid` and `date`,\n // the only two shapes routed through here, are ASCII, so the two counts\n // agree for them today -- this keeps one measure so a later non-ASCII\n // format cannot reintroduce the divergence unnoticed.\n const length: number = _stringLength(value);\n if (\n (props.minLength === undefined || length >= props.minLength) &&\n (props.maxLength === undefined || length <= props.maxLength)\n )\n return value;\n }\n throw new Error(_RANDOM_LENGTH_ERROR);\n};\n"],"mappings":";;;;AAIA,MAAa,uBACX;;;;;;;;;;;AAyBF,MAAa,wBACX,OACA,OACA,UACA,YACW;CACX,IAAI,MACF,OAAO,cAAc,KAAA,IAAY,UAAU,MAAM,YAAY;CAC/D,IAAI,MAAM,SAAS,MAAM;CAGzB,MAAM,OACJ,OAAO,cAAc,KAAA,IAAY,MAAM,WAAW,MAAM,YAAY;CACtE,IAAI,OAAO,OAAO,OAAO,SAAS,MAAM,IAAI,MAAM,oBAAoB;CACtE,OAAO,cAAc;EAAE,MAAM;EAAU,WAAW;EAAK,WAAW;CAAK,CAAC;AAC1E;;;;;;;;;;;;;;;;;AAkBA,MAAa,uBACX,OACA,WACkC;CAClC,MAAM,UAAkB,OAAO,WAAW,OAAO;CACjD,MAAM,MAAc,KAAK,IACvB,OAAO,aAAa,OAAO,SAC3B,OAAO,OACT;CACA,MAAM,OAAe,KAAK,IACxB,OAAO,aAAa,OAAO,OAAO,UAAU,IAC5C,OACF;CACA,IAAI,MAAM,MAAM,MAAM,IAAI,MAAM,oBAAoB;CACpD,OAAO;EAAE;EAAK;CAAK;AACrB;;AAGA,MAAa,qBAAqB,WAIhC,eAAe;CACb,MAAM;CACN,SAAS,OAAO;CAChB,SAAS,OAAO;AAClB,CAAC;;;;;;;;;;;AAYH,MAAa,uBACX,OACA,aACW;CACX,IAAI,OAAO,cAAc,KAAA,KAAa,OAAO,cAAc,KAAA,GACzD,OAAO,SAAS;CAClB,KAAK,IAAI,IAAY,GAAG,IAAI,KAAK,EAAE,GAAG;EACpC,MAAM,QAAgB,SAAS;EAM/B,MAAM,SAAiB,cAAc,KAAK;EAC1C,KACG,MAAM,cAAc,KAAA,KAAa,UAAU,MAAM,eACjD,MAAM,cAAc,KAAA,KAAa,UAAU,MAAM,YAElD,OAAO;CACX;CACA,MAAM,IAAI,MAAM,oBAAoB;AACtC"}
package/lib/module.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import { StandardSchemaV1 } from "@standard-schema/spec";
2
- import { IRandomGenerator, IValidation, Resolved } from "@typia/interface";
1
+ import { IRandomGenerator, IValidation, Resolved, StandardSchemaV1 } from "@typia/interface";
3
2
  import { TypeGuardError } from "./TypeGuardError";
4
3
  export * as compare from "./compare";
5
4
  export * as functional from "./functional";
package/lib/module.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"module.js","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,gGAA6F;AAE7F,QAAY,OAAO,sCAAkB;AACrC,QAAY,UAAU,yCAAqB;AAC3C,QAAY,IAAI,mCAAe;AAC/B,QAAY,GAAG,kCAAc;AAC7B,QAAY,IAAI,mCAAe;AAC/B,QAAY,KAAK,oCAAgB;AACjC,QAAY,SAAS,wCAAoB;AACzC,QAAY,QAAQ,uCAAmB;AACvC,QAAY,OAAO,sCAAkB;AAErC,mDAAiC;AAEjC,+CAA6B;AA+D7B,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,QAAQ,CAAC,CAAC;AAC1C,CAAC;AA4DD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,aAAa,CAAC,CAAC;AAC/C,CAAC;AA0CD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,IAAI,CAAC,CAAC;AACtC,CAAC;AAgED,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,SAAS,CAAC,CAAC;AAC3C,CAAC;AAoDD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,UAAU,CAAC,CAAC;AAC5C,CAAC;AAyDD,gBAAgB;AAChB;IACE,IAAA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E,IAAA,6DAA6B,EAAC,mBAAmB,CAAC,CAAC;AACrD,CAAC;AAyBD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,UAAU,CAAC,CAAC;AAC5C,CAAC;AA+BD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,eAAe,CAAC,CAAC;AACjD,CAAC;AA4BD,gBAAgB;AAChB;IAEE,IAAA,6DAA6B,EAAC,gBAAgB,CAAC,CAAC;AAClD,CAAC;AAsCD,gBAAgB;AAChB;IAIE,IAAA,6DAA6B,EAAC,oBAAoB,CAAC,CAAC;AACtD,CAAC;AA+CD,gBAAgB;AAChB;IAIE,IAAA,6DAA6B,EAAC,yBAAyB,CAAC,CAAC;AAC3D,CAAC;AAyBD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,cAAc,CAAC,CAAC;AAChD,CAAC;AA8BD,gBAAgB;AAChB;IAEE,IAAA,6DAA6B,EAAC,sBAAsB,CAAC,CAAC;AACxD,CAAC;AA6BD,gBAAgB;AAChB;IACE,IAAA,6DAA6B,EAAC,cAAc,CAAC,CAAC;AAChD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"module.mjs","names":[],"sources":["../src/module.ts"],"sourcesContent":["import { StandardSchemaV1 } from \"@standard-schema/spec\";\nimport { IRandomGenerator, IValidation, Resolved } from \"@typia/interface\";\n\nimport { TypeGuardError } from \"./TypeGuardError\";\nimport { NoTransformConfigurationError } from \"./transformers/NoTransformConfigurationError\";\n\nexport * as compare from \"./compare\";\nexport * as functional from \"./functional\";\nexport * as http from \"./http\";\nexport * as llm from \"./llm\";\nexport * as json from \"./json\";\nexport * as plain from \"./plain\";\nexport * as notations from \"./notations\";\nexport * as protobuf from \"./protobuf\";\nexport * as reflect from \"./reflect\";\n\nexport * from \"./TypeGuardError\";\n\nexport * from \"./re-exports\";\n\n/* -----------------------------------------------------------\n BASIC VALIDATORS\n----------------------------------------------------------- */\n/**\n * Asserts type `T`.\n *\n * Performs runtime type checking against compile-time type `T`. Stops at first\n * mismatch and throws {@link TypeGuardError} containing:\n *\n * - `path`: Property path where error occurred (e.g., `\"input.user.age\"`)\n * - `expected`: Expected type string (e.g., `\"number & ExclusiveMinimum<19>\"`)\n * - `value`: Actual value that failed validation\n *\n * Related functions:\n *\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of stopping at first\n * - {@link assertGuard} — Type guard with no return value (narrows type only)\n * - {@link assertEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assert<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/**\n * Asserts type `T`.\n *\n * Performs runtime type checking against compile-time type `T`. Stops at first\n * mismatch and throws {@link TypeGuardError} containing:\n *\n * - `path`: Property path where error occurred (e.g., `\"input.user.age\"`)\n * - `expected`: Expected type string (e.g., `\"number & ExclusiveMinimum<19>\"`)\n * - `value`: Actual value that failed validation\n *\n * Related functions:\n *\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of stopping at first\n * - {@link assertGuard} — Type guard with no return value (narrows type only)\n * - {@link assertEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assert<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/** @internal */\nexport function assert(): never {\n NoTransformConfigurationError(\"assert\");\n}\n\n/**\n * Asserts type `T` as assertion guard.\n *\n * Unlike {@link assert}, returns nothing (`asserts input is T`). After this\n * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when\n * you need type narrowing with runtime validation but don't need the return\n * value.\n *\n * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and\n * `value`.\n *\n * Related functions:\n *\n * - {@link assert} — Same validation but returns the input value\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of throwing\n * - {@link assertGuardEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assertGuard<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/**\n * Asserts type `T` as assertion guard.\n *\n * Unlike {@link assert}, returns nothing (`asserts input is T`). After this\n * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when\n * you need type narrowing with runtime validation but don't need the return\n * value.\n *\n * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and\n * `value`.\n *\n * Related functions:\n *\n * - {@link assert} — Same validation but returns the input value\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of throwing\n * - {@link assertGuardEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assertGuard<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/** @internal */\nexport function assertGuard(): never {\n NoTransformConfigurationError(\"assertGuard\");\n}\n\n/**\n * Tests type `T`.\n *\n * Performs runtime type checking without throwing exceptions. Acts as\n * TypeScript type guard, narrowing the input type in conditional branches when\n * result is `true`.\n *\n * Related functions:\n *\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n * - {@link equals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to check\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function is<T>(input: T): input is T;\n\n/**\n * Tests type `T`.\n *\n * Performs runtime type checking without throwing exceptions. Acts as\n * TypeScript type guard, narrowing the input type in conditional branches when\n * result is `true`.\n *\n * Related functions:\n *\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n * - {@link equals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to check\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function is<T>(input: unknown): input is T;\n\n/** @internal */\nexport function is(): never {\n NoTransformConfigurationError(\"is\");\n}\n\n/**\n * Tests type `T` up to a limited depth.\n *\n * Like {@link is}, but only descends into nested objects, arrays, and tuples\n * until the depth budget `N` is exhausted; beyond that point a value is\n * accepted as long as it is an `object` (or `null` where the type permits).\n * Useful for **discrimination** rather than full validation — when you only\n * need to know which branch of a union an input belongs to, paying for a deep\n * structural check of every leaf is wasteful.\n *\n * Because the check is shallow past depth `N`, a `true` result is **not** a\n * guarantee that the whole value conforms to `T`. The name `shallow` reflects\n * this: only the discriminating, near-surface part of the type is verified. For\n * a full guarantee, use {@link is}.\n *\n * Related functions:\n *\n * - {@link is} — Full-depth check, returns a sound type guard\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @param input Value to test\n * @returns `true` if valid up to depth `N`, `false` otherwise (type predicate\n * `input is T`)\n */\nexport function shallow<T, N extends number = 2>(input: T): input is T;\n\n/**\n * Tests type `T` up to a limited depth.\n *\n * Like {@link is}, but only descends into nested objects, arrays, and tuples\n * until the depth budget `N` is exhausted; beyond that point a value is\n * accepted as long as it is an `object` (or `null` where the type permits).\n * Useful for **discrimination** rather than full validation — when you only\n * need to know which branch of a union an input belongs to, paying for a deep\n * structural check of every leaf is wasteful.\n *\n * Because the check is shallow past depth `N`, a `true` result is **not** a\n * guarantee that the whole value conforms to `T`. The name `shallow` reflects\n * this: only the discriminating, near-surface part of the type is verified. For\n * a full guarantee, use {@link is}.\n *\n * Related functions:\n *\n * - {@link is} — Full-depth check, returns a sound type guard\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @param input Value to test\n * @returns `true` if valid up to depth `N`, `false` otherwise (type predicate\n * `input is T`)\n */\nexport function shallow<T, N extends number = 2>(input: unknown): input is T;\n\n/** @internal */\nexport function shallow(): never {\n NoTransformConfigurationError(\"shallow\");\n}\n\n/**\n * Validates type `T`.\n *\n * Unlike {@link assert} which throws on first error, this function continues\n * checking and collects all type mismatches into {@link IValidation.errors}\n * array. Never throws.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,\n * `expected`, `value`\n *\n * Related functions:\n *\n * - {@link assert} — Throws on first error instead of collecting all\n * - {@link is} — Simple boolean check\n * - {@link validateEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validate<T>(input: T): IValidation<T>;\n\n/**\n * Validates type `T`.\n *\n * Unlike {@link assert} which throws on first error, this function continues\n * checking and collects all type mismatches into {@link IValidation.errors}\n * array. Never throws.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,\n * `expected`, `value`\n *\n * Related functions:\n *\n * - {@link assert} — Throws on first error instead of collecting all\n * - {@link is} — Simple boolean check\n * - {@link validateEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validate<T>(input: unknown): IValidation<T>;\n\n/** @internal */\nexport function validate(): never {\n NoTransformConfigurationError(\"validate\");\n}\n\n/* -----------------------------------------------------------\n STRICT VALIDATORS\n----------------------------------------------------------- */\n/**\n * Asserts type `T` with strict equality.\n *\n * Stricter than {@link assert}: also fails when input contains any property not\n * defined in type `T`. For extra property errors, `expected` will be\n * `\"undefined\"`.\n *\n * Related functions:\n *\n * - {@link assert} — Allows extra properties\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n * - {@link assertGuardEquals} — Type guard version with no return value\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertEquals<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/**\n * Asserts type `T` with strict equality.\n *\n * Stricter than {@link assert}: also fails when input contains any property not\n * defined in type `T`. For extra property errors, `expected` will be\n * `\"undefined\"`.\n *\n * Related functions:\n *\n * - {@link assert} — Allows extra properties\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n * - {@link assertGuardEquals} — Type guard version with no return value\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertEquals<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/** @internal */\nexport function assertEquals(): never {\n NoTransformConfigurationError(\"assertEquals\");\n}\n\n/**\n * Asserts type `T` with strict equality as assertion guard.\n *\n * Combines {@link assertGuard} with strict equality checking. Returns nothing\n * but narrows input to type `T`. Also fails when input contains properties not\n * in `T`.\n *\n * Related functions:\n *\n * - {@link assertGuard} — Allows extra properties\n * - {@link assertEquals} — Returns value instead of type guard\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertGuardEquals<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/**\n * Asserts type `T` with strict equality as assertion guard.\n *\n * Combines {@link assertGuard} with strict equality checking. Returns nothing\n * but narrows input to type `T`. Also fails when input contains properties not\n * in `T`.\n *\n * Related functions:\n *\n * - {@link assertGuard} — Allows extra properties\n * - {@link assertEquals} — Returns value instead of type guard\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertGuardEquals<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/** @internal */\nexport function assertGuardEquals(): never {\n NoTransformConfigurationError(\"assertGuardEquals\");\n}\n\n/**\n * Tests type `T` with strict equality.\n *\n * Stricter than {@link is}: also returns `false` when input contains any\n * property not defined in type `T`. Useful for detecting unexpected data or\n * typos.\n *\n * Related functions:\n *\n * - {@link is} — Allows extra properties\n * - {@link assertEquals} — Throws with detailed error info on mismatch\n * - {@link validateEquals} — Returns all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function equals<T>(input: T): input is T;\n\n/**\n * Tests type `T` with strict equality.\n *\n * Stricter than {@link is}: also returns `false` when input contains any\n * property not defined in type `T`. Useful for detecting unexpected data or\n * typos.\n *\n * Related functions:\n *\n * - {@link is} — Allows extra properties\n * - {@link assertEquals} — Throws with detailed error info on mismatch\n * - {@link validateEquals} — Returns all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function equals<T>(input: unknown): input is T;\n\n/** @internal */\nexport function equals(): never {\n NoTransformConfigurationError(\"equals\");\n}\n\n/**\n * Validates type `T` with strict equality.\n *\n * Combines {@link validate} with strict equality checking. Collects all errors\n * including extra property violations into {@link IValidation.errors} array.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array with `path`, `expected`, `value` for each\n * mismatch\n *\n * Related functions:\n *\n * - {@link validate} — Allows extra properties\n * - {@link assertEquals} — Throws on first error\n * - {@link equals} — Simple boolean check\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validateEquals<T>(input: T): IValidation<T>;\n\n/**\n * Validates type `T` with strict equality.\n *\n * Combines {@link validate} with strict equality checking. Collects all errors\n * including extra property violations into {@link IValidation.errors} array.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array with `path`, `expected`, `value` for each\n * mismatch\n *\n * Related functions:\n *\n * - {@link validate} — Allows extra properties\n * - {@link assertEquals} — Throws on first error\n * - {@link equals} — Simple boolean check\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validateEquals<T>(input: unknown): IValidation<T>;\n\n/** @internal */\nexport function validateEquals(): never {\n NoTransformConfigurationError(\"validateEquals\");\n}\n\n/* -----------------------------------------------------------\n RANDOM\n----------------------------------------------------------- */\n/**\n * Generates random data of type `T`.\n *\n * Creates random instance conforming to compile-time type `T`. Generates only\n * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,\n * generates its return type instead.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Randomly generated data as `Resolved<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function random(generator?: Partial<IRandomGenerator>): never;\n\n/**\n * Generates random data of type `T`.\n *\n * Creates random instance conforming to compile-time type `T`. Generates only\n * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,\n * generates its return type instead.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Randomly generated data as `Resolved<T>`\n */\nexport function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;\n\n/** @internal */\nexport function random(): never {\n NoTransformConfigurationError(\"random\");\n}\n\n/* -----------------------------------------------------------\n FACTORY FUNCTIONS\n----------------------------------------------------------- */\n/**\n * Creates reusable {@link assert} function.\n *\n * Returns a function that can be called multiple times without recompilation.\n * Useful when the same type validation is needed repeatedly.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assert function `(input: unknown, errorFactory?) => T`\n * @danger You must configure the generic argument `T`\n */\nexport function createAssert(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assert} function.\n *\n * Returns a function that can be called multiple times without recompilation.\n * Useful when the same type validation is needed repeatedly.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assert function `(input: unknown, errorFactory?) => T`,\n * whose own `errorFactory` overrides this one for that single call\n */\nexport function createAssert<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T;\n\n/** @internal */\nexport function createAssert<T>(): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T {\n NoTransformConfigurationError(\"createAssert\");\n}\n\n/**\n * Creates reusable {@link assertGuard} function.\n *\n * Returns a reusable type guard assertion function.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.\n * That annotation is one parameter wide, so it also hides the call-time\n * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props:\n * TypeGuardError.IProps) => Error) => asserts input is T` when you need it.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertGuard(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertGuard} function.\n *\n * Returns a reusable type guard assertion function.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.\n * That annotation is one parameter wide, so it also hides the call-time\n * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props:\n * TypeGuardError.IProps) => Error) => asserts input is T` when you need it.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function, whose own `errorFactory`\n * overrides this one for that single call\n */\nexport function createAssertGuard<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => asserts input is T;\n\n/** @internal */\nexport function createAssertGuard<T>(): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => asserts input is T {\n NoTransformConfigurationError(\"createAssertGuard\");\n}\n\n/**\n * Creates reusable {@link is} function.\n *\n * Returns a type guard function that can be called multiple times without\n * recompilation.\n *\n * @template T Target type to check\n * @returns Reusable type guard function `(input: unknown) => input is T`\n * @danger You must configure the generic argument `T`\n */\nexport function createIs(): never;\n\n/**\n * Creates reusable {@link is} function.\n *\n * Returns a type guard function that can be called multiple times without\n * recompilation.\n *\n * @template T Target type to check\n * @returns Reusable type guard function `(input: unknown) => input is T`\n */\nexport function createIs<T>(): (input: unknown) => input is T;\n\n/** @internal */\nexport function createIs<T>(): (input: unknown) => input is T {\n NoTransformConfigurationError(\"createIs\");\n}\n\n/**\n * Creates reusable {@link shallow} function.\n *\n * Returns a depth-limited type guard function that can be called multiple times\n * without recompilation.\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @returns Reusable type guard function `(input: unknown) => input is T`\n * @danger You must configure the generic argument `T`\n */\nexport function createShallow(): never;\n\n/**\n * Creates reusable {@link shallow} function.\n *\n * Returns a depth-limited type guard function that can be called multiple times\n * without recompilation.\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @returns Reusable type guard function `(input: unknown) => input is T`\n */\nexport function createShallow<T, N extends number = 2>(): (\n input: unknown,\n) => input is T;\n\n/** @internal */\nexport function createShallow<T>(): (input: unknown) => input is T {\n NoTransformConfigurationError(\"createShallow\");\n}\n\n/**\n * Creates reusable {@link validate} function.\n *\n * Returns a validation function that can be called multiple times without\n * recompilation. Also implements {@link StandardSchemaV1} interface for\n * interoperability.\n *\n * @template T Target type to validate against\n * @returns Reusable validate function `(input: unknown) => IValidation<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function createValidate(): never;\n\n/**\n * Creates reusable {@link validate} function.\n *\n * Returns a validation function that can be called multiple times without\n * recompilation. Also implements {@link StandardSchemaV1} interface for\n * interoperability.\n *\n * @template T Target type to validate against\n * @returns Reusable validate function `(input: unknown) => IValidation<T>`\n */\nexport function createValidate<T>(): ((input: unknown) => IValidation<T>) &\n StandardSchemaV1<T, T>;\n\n/** @internal */\nexport function createValidate(): ((input: unknown) => IValidation) &\n StandardSchemaV1<unknown, unknown> {\n NoTransformConfigurationError(\"createValidate\");\n}\n\n/**\n * Creates reusable {@link assertEquals} function.\n *\n * Returns a strict assertion function that rejects superfluous properties. Can\n * be called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertEquals function `(input: unknown, errorFactory?) =>\n * T`\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertEquals(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertEquals} function.\n *\n * Returns a strict assertion function that rejects superfluous properties. Can\n * be called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertEquals function `(input: unknown, errorFactory?) =>\n * T`, whose own `errorFactory` overrides this one for that single call\n */\nexport function createAssertEquals<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T;\n\n/** @internal */\nexport function createAssertEquals<T>(): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T {\n NoTransformConfigurationError(\"createAssertEquals\");\n}\n\n/**\n * Creates reusable {@link assertGuardEquals} function.\n *\n * Returns a strict assertion guard that rejects superfluous properties.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile\n * error. That annotation is one parameter wide, so it also hides the call-time\n * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props:\n * TypeGuardError.IProps) => Error) => asserts input is T` when you need it.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertGuardEquals(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertGuardEquals} function.\n *\n * Returns a strict assertion guard that rejects superfluous properties.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile\n * error. That annotation is one parameter wide, so it also hides the call-time\n * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props:\n * TypeGuardError.IProps) => Error) => asserts input is T` when you need it.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function, whose own `errorFactory`\n * overrides this one for that single call\n */\nexport function createAssertGuardEquals<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => asserts input is T;\n\n/** @internal */\nexport function createAssertGuardEquals<T>(): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => asserts input is T {\n NoTransformConfigurationError(\"createAssertGuardEquals\");\n}\n\n/**\n * Creates reusable {@link equals} function.\n *\n * Returns a strict type guard that rejects superfluous properties. Can be\n * called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @returns Reusable type guard function `(input: unknown) => input is T`\n * @danger You must configure the generic argument `T`\n */\nexport function createEquals(): never;\n\n/**\n * Creates reusable {@link equals} function.\n *\n * Returns a strict type guard that rejects superfluous properties. Can be\n * called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @returns Reusable type guard function `(input: unknown) => input is T`\n */\nexport function createEquals<T>(): (input: unknown) => input is T;\n\n/** @internal */\nexport function createEquals<T>(): (input: unknown) => input is T {\n NoTransformConfigurationError(\"createEquals\");\n}\n\n/**\n * Creates reusable {@link validateEquals} function.\n *\n * Returns a strict validation function that rejects superfluous properties.\n * Also implements {@link StandardSchemaV1} interface for interoperability.\n *\n * @template T Target type for exact match\n * @returns Reusable validateEquals function `(input: unknown) =>\n * IValidation<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function createValidateEquals(): never;\n\n/**\n * Creates reusable {@link validateEquals} function.\n *\n * Returns a strict validation function that rejects superfluous properties.\n * Also implements {@link StandardSchemaV1} interface for interoperability.\n *\n * @template T Target type for exact match\n * @returns Reusable validateEquals function `(input: unknown) =>\n * IValidation<T>`\n */\nexport function createValidateEquals<T>(): ((\n input: unknown,\n) => IValidation<T>) &\n StandardSchemaV1<T, T>;\n\n/** @internal */\nexport function createValidateEquals(): ((input: unknown) => IValidation) &\n StandardSchemaV1<unknown, unknown> {\n NoTransformConfigurationError(\"createValidateEquals\");\n}\n\n/**\n * Creates reusable {@link random} function.\n *\n * Returns a random data generator that can be called multiple times without\n * recompilation.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Reusable random function `() => Resolved<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function createRandom(generator?: Partial<IRandomGenerator>): never;\n\n/**\n * Creates reusable {@link random} function.\n *\n * Returns a random data generator that can be called multiple times without\n * recompilation.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Reusable random function `() => Resolved<T>`\n */\nexport function createRandom<T>(\n generator?: Partial<IRandomGenerator>,\n): () => Resolved<T>;\n\n/** @internal */\nexport function createRandom(): never {\n NoTransformConfigurationError(\"createRandom\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFA,SAAgB,SAAgB;CAC9B,8BAA8B,QAAQ;AACxC;;AA6DA,SAAgB,cAAqB;CACnC,8BAA8B,aAAa;AAC7C;;AA2CA,SAAgB,KAAY;CAC1B,8BAA8B,IAAI;AACpC;;AAiEA,SAAgB,UAAiB;CAC/B,8BAA8B,SAAS;AACzC;;AAqDA,SAAgB,WAAkB;CAChC,8BAA8B,UAAU;AAC1C;;AA0DA,SAAgB,eAAsB;CACpC,8BAA8B,cAAc;AAC9C;;AAqDA,SAAgB,oBAA2B;CACzC,8BAA8B,mBAAmB;AACnD;;AAyCA,SAAgB,SAAgB;CAC9B,8BAA8B,QAAQ;AACxC;;AAmDA,SAAgB,iBAAwB;CACtC,8BAA8B,gBAAgB;AAChD;;AAiCA,SAAgB,SAAgB;CAC9B,8BAA8B,QAAQ;AACxC;;AAyCA,SAAgB,eAGT;CACL,8BAA8B,cAAc;AAC9C;;AAgDA,SAAgB,oBAGQ;CACtB,8BAA8B,mBAAmB;AACnD;;AA0BA,SAAgB,WAA8C;CAC5D,8BAA8B,UAAU;AAC1C;;AAgCA,SAAgB,gBAAmD;CACjE,8BAA8B,eAAe;AAC/C;;AA6BA,SAAgB,iBACqB;CACnC,8BAA8B,gBAAgB;AAChD;;AAuCA,SAAgB,qBAGT;CACL,8BAA8B,oBAAoB;AACpD;;AAgDA,SAAgB,0BAGQ;CACtB,8BAA8B,yBAAyB;AACzD;;AA0BA,SAAgB,eAAkD;CAChE,8BAA8B,cAAc;AAC9C;;AA+BA,SAAgB,uBACqB;CACnC,8BAA8B,sBAAsB;AACtD;;AA8BA,SAAgB,eAAsB;CACpC,8BAA8B,cAAc;AAC9C"}
1
+ {"version":3,"file":"module.mjs","names":[],"sources":["../src/module.ts"],"sourcesContent":["import {\n IRandomGenerator,\n IValidation,\n Resolved,\n StandardSchemaV1,\n} from \"@typia/interface\";\n\nimport { TypeGuardError } from \"./TypeGuardError\";\nimport { NoTransformConfigurationError } from \"./transformers/NoTransformConfigurationError\";\n\nexport * as compare from \"./compare\";\nexport * as functional from \"./functional\";\nexport * as http from \"./http\";\nexport * as llm from \"./llm\";\nexport * as json from \"./json\";\nexport * as plain from \"./plain\";\nexport * as notations from \"./notations\";\nexport * as protobuf from \"./protobuf\";\nexport * as reflect from \"./reflect\";\n\nexport * from \"./TypeGuardError\";\n\nexport * from \"./re-exports\";\n\n/* -----------------------------------------------------------\n BASIC VALIDATORS\n----------------------------------------------------------- */\n/**\n * Asserts type `T`.\n *\n * Performs runtime type checking against compile-time type `T`. Stops at first\n * mismatch and throws {@link TypeGuardError} containing:\n *\n * - `path`: Property path where error occurred (e.g., `\"input.user.age\"`)\n * - `expected`: Expected type string (e.g., `\"number & ExclusiveMinimum<19>\"`)\n * - `value`: Actual value that failed validation\n *\n * Related functions:\n *\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of stopping at first\n * - {@link assertGuard} — Type guard with no return value (narrows type only)\n * - {@link assertEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assert<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/**\n * Asserts type `T`.\n *\n * Performs runtime type checking against compile-time type `T`. Stops at first\n * mismatch and throws {@link TypeGuardError} containing:\n *\n * - `path`: Property path where error occurred (e.g., `\"input.user.age\"`)\n * - `expected`: Expected type string (e.g., `\"number & ExclusiveMinimum<19>\"`)\n * - `value`: Actual value that failed validation\n *\n * Related functions:\n *\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of stopping at first\n * - {@link assertGuard} — Type guard with no return value (narrows type only)\n * - {@link assertEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assert<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/** @internal */\nexport function assert(): never {\n NoTransformConfigurationError(\"assert\");\n}\n\n/**\n * Asserts type `T` as assertion guard.\n *\n * Unlike {@link assert}, returns nothing (`asserts input is T`). After this\n * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when\n * you need type narrowing with runtime validation but don't need the return\n * value.\n *\n * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and\n * `value`.\n *\n * Related functions:\n *\n * - {@link assert} — Same validation but returns the input value\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of throwing\n * - {@link assertGuardEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assertGuard<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/**\n * Asserts type `T` as assertion guard.\n *\n * Unlike {@link assert}, returns nothing (`asserts input is T`). After this\n * call, TypeScript narrows `input` to type `T` in subsequent code. Useful when\n * you need type narrowing with runtime validation but don't need the return\n * value.\n *\n * Throws {@link TypeGuardError} on first mismatch with `path`, `expected`, and\n * `value`.\n *\n * Related functions:\n *\n * - {@link assert} — Same validation but returns the input value\n * - {@link is} — Returns `boolean` instead of throwing\n * - {@link validate} — Collects all errors instead of throwing\n * - {@link assertGuardEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When input doesn't conform to type `T`\n */\nexport function assertGuard<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/** @internal */\nexport function assertGuard(): never {\n NoTransformConfigurationError(\"assertGuard\");\n}\n\n/**\n * Tests type `T`.\n *\n * Performs runtime type checking without throwing exceptions. Acts as\n * TypeScript type guard, narrowing the input type in conditional branches when\n * result is `true`.\n *\n * Related functions:\n *\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n * - {@link equals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to check\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function is<T>(input: T): input is T;\n\n/**\n * Tests type `T`.\n *\n * Performs runtime type checking without throwing exceptions. Acts as\n * TypeScript type guard, narrowing the input type in conditional branches when\n * result is `true`.\n *\n * Related functions:\n *\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n * - {@link equals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to check\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function is<T>(input: unknown): input is T;\n\n/** @internal */\nexport function is(): never {\n NoTransformConfigurationError(\"is\");\n}\n\n/**\n * Tests type `T` up to a limited depth.\n *\n * Like {@link is}, but only descends into nested objects, arrays, and tuples\n * until the depth budget `N` is exhausted; beyond that point a value is\n * accepted as long as it is an `object` (or `null` where the type permits).\n * Useful for **discrimination** rather than full validation — when you only\n * need to know which branch of a union an input belongs to, paying for a deep\n * structural check of every leaf is wasteful.\n *\n * Because the check is shallow past depth `N`, a `true` result is **not** a\n * guarantee that the whole value conforms to `T`. The name `shallow` reflects\n * this: only the discriminating, near-surface part of the type is verified. For\n * a full guarantee, use {@link is}.\n *\n * Related functions:\n *\n * - {@link is} — Full-depth check, returns a sound type guard\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @param input Value to test\n * @returns `true` if valid up to depth `N`, `false` otherwise (type predicate\n * `input is T`)\n */\nexport function shallow<T, N extends number = 2>(input: T): input is T;\n\n/**\n * Tests type `T` up to a limited depth.\n *\n * Like {@link is}, but only descends into nested objects, arrays, and tuples\n * until the depth budget `N` is exhausted; beyond that point a value is\n * accepted as long as it is an `object` (or `null` where the type permits).\n * Useful for **discrimination** rather than full validation — when you only\n * need to know which branch of a union an input belongs to, paying for a deep\n * structural check of every leaf is wasteful.\n *\n * Because the check is shallow past depth `N`, a `true` result is **not** a\n * guarantee that the whole value conforms to `T`. The name `shallow` reflects\n * this: only the discriminating, near-surface part of the type is verified. For\n * a full guarantee, use {@link is}.\n *\n * Related functions:\n *\n * - {@link is} — Full-depth check, returns a sound type guard\n * - {@link assert} — Throws {@link TypeGuardError} with detailed error info on\n * mismatch\n * - {@link validate} — Returns all errors without throwing\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @param input Value to test\n * @returns `true` if valid up to depth `N`, `false` otherwise (type predicate\n * `input is T`)\n */\nexport function shallow<T, N extends number = 2>(input: unknown): input is T;\n\n/** @internal */\nexport function shallow(): never {\n NoTransformConfigurationError(\"shallow\");\n}\n\n/**\n * Validates type `T`.\n *\n * Unlike {@link assert} which throws on first error, this function continues\n * checking and collects all type mismatches into {@link IValidation.errors}\n * array. Never throws.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,\n * `expected`, `value`\n *\n * Related functions:\n *\n * - {@link assert} — Throws on first error instead of collecting all\n * - {@link is} — Simple boolean check\n * - {@link validateEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validate<T>(input: T): IValidation<T>;\n\n/**\n * Validates type `T`.\n *\n * Unlike {@link assert} which throws on first error, this function continues\n * checking and collects all type mismatches into {@link IValidation.errors}\n * array. Never throws.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array of {@link IValidation.IError} with `path`,\n * `expected`, `value`\n *\n * Related functions:\n *\n * - {@link assert} — Throws on first error instead of collecting all\n * - {@link is} — Simple boolean check\n * - {@link validateEquals} — Also rejects properties not defined in `T`\n *\n * @template T Target type to validate against\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validate<T>(input: unknown): IValidation<T>;\n\n/** @internal */\nexport function validate(): never {\n NoTransformConfigurationError(\"validate\");\n}\n\n/* -----------------------------------------------------------\n STRICT VALIDATORS\n----------------------------------------------------------- */\n/**\n * Asserts type `T` with strict equality.\n *\n * Stricter than {@link assert}: also fails when input contains any property not\n * defined in type `T`. For extra property errors, `expected` will be\n * `\"undefined\"`.\n *\n * Related functions:\n *\n * - {@link assert} — Allows extra properties\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n * - {@link assertGuardEquals} — Type guard version with no return value\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertEquals<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/**\n * Asserts type `T` with strict equality.\n *\n * Stricter than {@link assert}: also fails when input contains any property not\n * defined in type `T`. For extra property errors, `expected` will be\n * `\"undefined\"`.\n *\n * Related functions:\n *\n * - {@link assert} — Allows extra properties\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n * - {@link assertGuardEquals} — Type guard version with no return value\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns The input value typed as `T`\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertEquals<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): T;\n\n/** @internal */\nexport function assertEquals(): never {\n NoTransformConfigurationError(\"assertEquals\");\n}\n\n/**\n * Asserts type `T` with strict equality as assertion guard.\n *\n * Combines {@link assertGuard} with strict equality checking. Returns nothing\n * but narrows input to type `T`. Also fails when input contains properties not\n * in `T`.\n *\n * Related functions:\n *\n * - {@link assertGuard} — Allows extra properties\n * - {@link assertEquals} — Returns value instead of type guard\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertGuardEquals<T>(\n input: T,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/**\n * Asserts type `T` with strict equality as assertion guard.\n *\n * Combines {@link assertGuard} with strict equality checking. Returns nothing\n * but narrows input to type `T`. Also fails when input contains properties not\n * in `T`.\n *\n * Related functions:\n *\n * - {@link assertGuard} — Allows extra properties\n * - {@link assertEquals} — Returns value instead of type guard\n * - {@link equals} — Boolean result without throwing\n * - {@link validateEquals} — Collects all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to assert (narrowed to `T` after call)\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @throws {TypeGuardError} When type mismatch or extra property detected\n */\nexport function assertGuardEquals<T>(\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): asserts input is T;\n\n/** @internal */\nexport function assertGuardEquals(): never {\n NoTransformConfigurationError(\"assertGuardEquals\");\n}\n\n/**\n * Tests type `T` with strict equality.\n *\n * Stricter than {@link is}: also returns `false` when input contains any\n * property not defined in type `T`. Useful for detecting unexpected data or\n * typos.\n *\n * Related functions:\n *\n * - {@link is} — Allows extra properties\n * - {@link assertEquals} — Throws with detailed error info on mismatch\n * - {@link validateEquals} — Returns all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function equals<T>(input: T): input is T;\n\n/**\n * Tests type `T` with strict equality.\n *\n * Stricter than {@link is}: also returns `false` when input contains any\n * property not defined in type `T`. Useful for detecting unexpected data or\n * typos.\n *\n * Related functions:\n *\n * - {@link is} — Allows extra properties\n * - {@link assertEquals} — Throws with detailed error info on mismatch\n * - {@link validateEquals} — Returns all errors without throwing\n *\n * @template T Target type for exact match\n * @param input Value to test\n * @returns `true` if valid, `false` otherwise (type predicate `input is T`)\n */\nexport function equals<T>(input: unknown): input is T;\n\n/** @internal */\nexport function equals(): never {\n NoTransformConfigurationError(\"equals\");\n}\n\n/**\n * Validates type `T` with strict equality.\n *\n * Combines {@link validate} with strict equality checking. Collects all errors\n * including extra property violations into {@link IValidation.errors} array.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array with `path`, `expected`, `value` for each\n * mismatch\n *\n * Related functions:\n *\n * - {@link validate} — Allows extra properties\n * - {@link assertEquals} — Throws on first error\n * - {@link equals} — Simple boolean check\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validateEquals<T>(input: T): IValidation<T>;\n\n/**\n * Validates type `T` with strict equality.\n *\n * Combines {@link validate} with strict equality checking. Collects all errors\n * including extra property violations into {@link IValidation.errors} array.\n *\n * Return structure:\n *\n * - `success: true` → `data` contains validated input as `T`\n * - `success: false` → `errors` array with `path`, `expected`, `value` for each\n * mismatch\n *\n * Related functions:\n *\n * - {@link validate} — Allows extra properties\n * - {@link assertEquals} — Throws on first error\n * - {@link equals} — Simple boolean check\n *\n * @template T Target type for exact match\n * @param input Value to validate\n * @returns {@link IValidation} <T> containing either `data` or `errors`\n */\nexport function validateEquals<T>(input: unknown): IValidation<T>;\n\n/** @internal */\nexport function validateEquals(): never {\n NoTransformConfigurationError(\"validateEquals\");\n}\n\n/* -----------------------------------------------------------\n RANDOM\n----------------------------------------------------------- */\n/**\n * Generates random data of type `T`.\n *\n * Creates random instance conforming to compile-time type `T`. Generates only\n * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,\n * generates its return type instead.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Randomly generated data as `Resolved<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function random(generator?: Partial<IRandomGenerator>): never;\n\n/**\n * Generates random data of type `T`.\n *\n * Creates random instance conforming to compile-time type `T`. Generates only\n * primitive data; methods in `T` are ignored. If `T` has `toJSON()` method,\n * generates its return type instead.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Randomly generated data as `Resolved<T>`\n */\nexport function random<T>(generator?: Partial<IRandomGenerator>): Resolved<T>;\n\n/** @internal */\nexport function random(): never {\n NoTransformConfigurationError(\"random\");\n}\n\n/* -----------------------------------------------------------\n FACTORY FUNCTIONS\n----------------------------------------------------------- */\n/**\n * Creates reusable {@link assert} function.\n *\n * Returns a function that can be called multiple times without recompilation.\n * Useful when the same type validation is needed repeatedly.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assert function `(input: unknown, errorFactory?) => T`\n * @danger You must configure the generic argument `T`\n */\nexport function createAssert(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assert} function.\n *\n * Returns a function that can be called multiple times without recompilation.\n * Useful when the same type validation is needed repeatedly.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assert function `(input: unknown, errorFactory?) => T`,\n * whose own `errorFactory` overrides this one for that single call\n */\nexport function createAssert<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T;\n\n/** @internal */\nexport function createAssert<T>(): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T {\n NoTransformConfigurationError(\"createAssert\");\n}\n\n/**\n * Creates reusable {@link assertGuard} function.\n *\n * Returns a reusable type guard assertion function.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.\n * That annotation is one parameter wide, so it also hides the call-time\n * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props:\n * TypeGuardError.IProps) => Error) => asserts input is T` when you need it.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertGuard(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertGuard} function.\n *\n * Returns a reusable type guard assertion function.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuard<T>()` — otherwise compile error.\n * That annotation is one parameter wide, so it also hides the call-time\n * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props:\n * TypeGuardError.IProps) => Error) => asserts input is T` when you need it.\n *\n * @template T Target type to validate against\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function, whose own `errorFactory`\n * overrides this one for that single call\n */\nexport function createAssertGuard<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => asserts input is T;\n\n/** @internal */\nexport function createAssertGuard<T>(): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => asserts input is T {\n NoTransformConfigurationError(\"createAssertGuard\");\n}\n\n/**\n * Creates reusable {@link is} function.\n *\n * Returns a type guard function that can be called multiple times without\n * recompilation.\n *\n * @template T Target type to check\n * @returns Reusable type guard function `(input: unknown) => input is T`\n * @danger You must configure the generic argument `T`\n */\nexport function createIs(): never;\n\n/**\n * Creates reusable {@link is} function.\n *\n * Returns a type guard function that can be called multiple times without\n * recompilation.\n *\n * @template T Target type to check\n * @returns Reusable type guard function `(input: unknown) => input is T`\n */\nexport function createIs<T>(): (input: unknown) => input is T;\n\n/** @internal */\nexport function createIs<T>(): (input: unknown) => input is T {\n NoTransformConfigurationError(\"createIs\");\n}\n\n/**\n * Creates reusable {@link shallow} function.\n *\n * Returns a depth-limited type guard function that can be called multiple times\n * without recompilation.\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @returns Reusable type guard function `(input: unknown) => input is T`\n * @danger You must configure the generic argument `T`\n */\nexport function createShallow(): never;\n\n/**\n * Creates reusable {@link shallow} function.\n *\n * Returns a depth-limited type guard function that can be called multiple times\n * without recompilation.\n *\n * @template T Target type to check\n * @template N Maximum depth to descend before accepting a value structurally.\n * Must be a non-negative integer literal. Defaults to `2`.\n * @returns Reusable type guard function `(input: unknown) => input is T`\n */\nexport function createShallow<T, N extends number = 2>(): (\n input: unknown,\n) => input is T;\n\n/** @internal */\nexport function createShallow<T>(): (input: unknown) => input is T {\n NoTransformConfigurationError(\"createShallow\");\n}\n\n/**\n * Creates reusable {@link validate} function.\n *\n * Returns a validation function that can be called multiple times without\n * recompilation. Also implements {@link StandardSchemaV1} interface for\n * interoperability.\n *\n * @template T Target type to validate against\n * @returns Reusable validate function `(input: unknown) => IValidation<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function createValidate(): never;\n\n/**\n * Creates reusable {@link validate} function.\n *\n * Returns a validation function that can be called multiple times without\n * recompilation. Also implements {@link StandardSchemaV1} interface for\n * interoperability.\n *\n * @template T Target type to validate against\n * @returns Reusable validate function `(input: unknown) => IValidation<T>`\n */\nexport function createValidate<T>(): ((input: unknown) => IValidation<T>) &\n StandardSchemaV1<T, T>;\n\n/** @internal */\nexport function createValidate(): ((input: unknown) => IValidation) &\n StandardSchemaV1<unknown, unknown> {\n NoTransformConfigurationError(\"createValidate\");\n}\n\n/**\n * Creates reusable {@link assertEquals} function.\n *\n * Returns a strict assertion function that rejects superfluous properties. Can\n * be called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertEquals function `(input: unknown, errorFactory?) =>\n * T`\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertEquals(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertEquals} function.\n *\n * Returns a strict assertion function that rejects superfluous properties. Can\n * be called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertEquals function `(input: unknown, errorFactory?) =>\n * T`, whose own `errorFactory` overrides this one for that single call\n */\nexport function createAssertEquals<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T;\n\n/** @internal */\nexport function createAssertEquals<T>(): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => T {\n NoTransformConfigurationError(\"createAssertEquals\");\n}\n\n/**\n * Creates reusable {@link assertGuardEquals} function.\n *\n * Returns a strict assertion guard that rejects superfluous properties.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile\n * error. That annotation is one parameter wide, so it also hides the call-time\n * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props:\n * TypeGuardError.IProps) => Error) => asserts input is T` when you need it.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function\n * @danger You must configure the generic argument `T`\n */\nexport function createAssertGuardEquals(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): never;\n\n/**\n * Creates reusable {@link assertGuardEquals} function.\n *\n * Returns a strict assertion guard that rejects superfluous properties.\n *\n * TypeScript requirement: You must declare the variable type explicitly. `const\n * fn: AssertionGuard<T> = createAssertGuardEquals<T>()` — otherwise compile\n * error. That annotation is one parameter wide, so it also hides the call-time\n * `errorFactory`; annotate with `(input: unknown, errorFactory?: (props:\n * TypeGuardError.IProps) => Error) => asserts input is T` when you need it.\n *\n * @template T Target type for exact match\n * @param errorFactory Custom error factory receiving\n * {@link TypeGuardError.IProps}\n * @returns Reusable assertion guard function, whose own `errorFactory`\n * overrides this one for that single call\n */\nexport function createAssertGuardEquals<T>(\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => asserts input is T;\n\n/** @internal */\nexport function createAssertGuardEquals<T>(): (\n input: unknown,\n errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),\n) => asserts input is T {\n NoTransformConfigurationError(\"createAssertGuardEquals\");\n}\n\n/**\n * Creates reusable {@link equals} function.\n *\n * Returns a strict type guard that rejects superfluous properties. Can be\n * called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @returns Reusable type guard function `(input: unknown) => input is T`\n * @danger You must configure the generic argument `T`\n */\nexport function createEquals(): never;\n\n/**\n * Creates reusable {@link equals} function.\n *\n * Returns a strict type guard that rejects superfluous properties. Can be\n * called multiple times without recompilation.\n *\n * @template T Target type for exact match\n * @returns Reusable type guard function `(input: unknown) => input is T`\n */\nexport function createEquals<T>(): (input: unknown) => input is T;\n\n/** @internal */\nexport function createEquals<T>(): (input: unknown) => input is T {\n NoTransformConfigurationError(\"createEquals\");\n}\n\n/**\n * Creates reusable {@link validateEquals} function.\n *\n * Returns a strict validation function that rejects superfluous properties.\n * Also implements {@link StandardSchemaV1} interface for interoperability.\n *\n * @template T Target type for exact match\n * @returns Reusable validateEquals function `(input: unknown) =>\n * IValidation<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function createValidateEquals(): never;\n\n/**\n * Creates reusable {@link validateEquals} function.\n *\n * Returns a strict validation function that rejects superfluous properties.\n * Also implements {@link StandardSchemaV1} interface for interoperability.\n *\n * @template T Target type for exact match\n * @returns Reusable validateEquals function `(input: unknown) =>\n * IValidation<T>`\n */\nexport function createValidateEquals<T>(): ((\n input: unknown,\n) => IValidation<T>) &\n StandardSchemaV1<T, T>;\n\n/** @internal */\nexport function createValidateEquals(): ((input: unknown) => IValidation) &\n StandardSchemaV1<unknown, unknown> {\n NoTransformConfigurationError(\"createValidateEquals\");\n}\n\n/**\n * Creates reusable {@link random} function.\n *\n * Returns a random data generator that can be called multiple times without\n * recompilation.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Reusable random function `() => Resolved<T>`\n * @danger You must configure the generic argument `T`\n */\nexport function createRandom(generator?: Partial<IRandomGenerator>): never;\n\n/**\n * Creates reusable {@link random} function.\n *\n * Returns a random data generator that can be called multiple times without\n * recompilation.\n *\n * @template T Type of data to generate\n * @param generator Custom random generator implementing {@link IRandomGenerator}\n * @returns Reusable random function `() => Resolved<T>`\n */\nexport function createRandom<T>(\n generator?: Partial<IRandomGenerator>,\n): () => Resolved<T>;\n\n/** @internal */\nexport function createRandom(): never {\n NoTransformConfigurationError(\"createRandom\");\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsFA,SAAgB,SAAgB;CAC9B,8BAA8B,QAAQ;AACxC;;AA6DA,SAAgB,cAAqB;CACnC,8BAA8B,aAAa;AAC7C;;AA2CA,SAAgB,KAAY;CAC1B,8BAA8B,IAAI;AACpC;;AAiEA,SAAgB,UAAiB;CAC/B,8BAA8B,SAAS;AACzC;;AAqDA,SAAgB,WAAkB;CAChC,8BAA8B,UAAU;AAC1C;;AA0DA,SAAgB,eAAsB;CACpC,8BAA8B,cAAc;AAC9C;;AAqDA,SAAgB,oBAA2B;CACzC,8BAA8B,mBAAmB;AACnD;;AAyCA,SAAgB,SAAgB;CAC9B,8BAA8B,QAAQ;AACxC;;AAmDA,SAAgB,iBAAwB;CACtC,8BAA8B,gBAAgB;AAChD;;AAiCA,SAAgB,SAAgB;CAC9B,8BAA8B,QAAQ;AACxC;;AAyCA,SAAgB,eAGT;CACL,8BAA8B,cAAc;AAC9C;;AAgDA,SAAgB,oBAGQ;CACtB,8BAA8B,mBAAmB;AACnD;;AA0BA,SAAgB,WAA8C;CAC5D,8BAA8B,UAAU;AAC1C;;AAgCA,SAAgB,gBAAmD;CACjE,8BAA8B,eAAe;AAC/C;;AA6BA,SAAgB,iBACqB;CACnC,8BAA8B,gBAAgB;AAChD;;AAuCA,SAAgB,qBAGT;CACL,8BAA8B,oBAAoB;AACpD;;AAgDA,SAAgB,0BAGQ;CACtB,8BAA8B,yBAAyB;AACzD;;AA0BA,SAAgB,eAAkD;CAChE,8BAA8B,cAAc;AAC9C;;AA+BA,SAAgB,uBACqB;CACnC,8BAA8B,sBAAsB;AACtD;;AA8BA,SAAgB,eAAsB;CACpC,8BAA8B,cAAc;AAC9C"}
@@ -1,2 +1,2 @@
1
- export type { AssertionGuard, IJsonParseResult, IValidation, IRandomGenerator, OpenApi, IJsonSchemaCollection, IJsonSchemaUnit, ILlmController, ILlmApplication, ILlmFunction, ILlmStructuredOutput, ILlmSchema, IMetadataSchema, IMetadataSchemaCollection, IMetadataSchemaUnit, IMetadataComponents, IMetadataTypeTag, IJsDocTagInfo, Classifiable, ClassifyResult, Primitive, Resolved, CamelCase, KebabCase, PascalCase, SnakeCase, IReadableURLSearchParams, } from "@typia/interface";
1
+ export type { AssertionGuard, IJsonParseResult, IValidation, IRandomGenerator, StandardSchemaV1, OpenApi, IJsonSchemaApplication, IJsonSchemaCollection, IJsonSchemaUnit, ILlmController, ILlmApplication, ILlmFunction, ILlmStructuredOutput, ILlmSchema, IMetadataSchema, IMetadataSchemaCollection, IMetadataSchemaUnit, IMetadataComponents, IMetadataTypeTag, IJsDocTagInfo, Atomic, Classifiable, ClassifyResult, Primitive, Resolved, CamelCase, KebabCase, PascalCase, SnakeCase, IReadableURLSearchParams, } from "@typia/interface";
2
2
  export { tags } from "@typia/interface";
@@ -1 +1 @@
1
- {"version":3,"file":"re-exports.js","sourceRoot":"","sources":["../src/re-exports.ts"],"names":[],"mappings":";;;AAoCA,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAC1E,mEAAmE;AACnE,sBAAsB;AACtB,8CAAwC;AAA/B,iGAAA,IAAI,OAAA"}
1
+ {"version":3,"file":"re-exports.js","sourceRoot":"","sources":["../src/re-exports.ts"],"names":[],"mappings":";;;AAiDA,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAC1E,mEAAmE;AACnE,sBAAsB;AACtB,8CAAwC;AAA/B,iGAAA,IAAI,OAAA"}
package/lib/transform.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import path from "node:path";
2
1
  import { createRequire } from "node:module";
2
+ import path from "node:path";
3
3
  //#region src/transform.ts
4
4
  function createTtscPlugin(context) {
5
5
  const requireFrom = createRequire(path.join(context.projectRoot, "package.json"));
@@ -120,8 +120,11 @@ const createAssertErrorFactorySentinel = "zzz"
120
120
  // never executed: the http, protobuf and notation members pull runtime helpers
121
121
  // this package stubs only for the emit it runs, so the executed fixture stays
122
122
  // on the module family.
123
- const createAssertErrorFactorySurfaceSource = `import { StandardSchemaV1 } from "@standard-schema/spec";
124
- import typia, { AssertionGuard, TypeGuardError } from "typia";
123
+ const createAssertErrorFactorySurfaceSource = `import typia, {
124
+ AssertionGuard,
125
+ StandardSchemaV1,
126
+ TypeGuardError,
127
+ } from "typia";
125
128
 
126
129
  interface User {
127
130
  id: number;
@@ -0,0 +1,52 @@
1
+ package main
2
+
3
+ import "testing"
4
+
5
+ // TestDependencyCollectorVirtualScheme verifies which dropped file still costs
6
+ // the current key its completeness declaration.
7
+ //
8
+ // The envelope reports no virtual URI source, because nothing can watch one. Two
9
+ // of them are not the same, though: `driver.NewTransformGraph` skips exactly
10
+ // `bundled:///`, so a bundled library is absent from the host-owned bound too
11
+ // and dropping it changes nothing, while a file under any other scheme is still
12
+ // a member of that bound. Narrowing to a list that cannot name it would stop
13
+ // watching an input the default bound watches, so the file that consulted it
14
+ // stays undeclared (samchon/typia#2357).
15
+ //
16
+ // The case is a collector probe rather than a fixture because no tsconfig this
17
+ // repository can write makes the compiler serve a non-bundled virtual source;
18
+ // the branch is reachable only from the listener side.
19
+ //
20
+ // 1. Report a `bundled:///` library against one key and a foreign-scheme source
21
+ // against another.
22
+ // 2. Render both sections.
23
+ // 3. Assert neither file reached `dependencies`.
24
+ // 4. Assert only the foreign-scheme key lost its completeness declaration.
25
+ func TestDependencyCollectorVirtualScheme(t *testing.T) {
26
+ collector := newTransformDependencyCollector("D:/project", func(string) bool { return false })
27
+
28
+ collector.Begin("src/bundled.ts")
29
+ collector.Touch("bundled:///lib.es5.d.ts")
30
+ collector.End()
31
+
32
+ collector.Begin("src/foreign.ts")
33
+ collector.Touch("vfs://memory/generated.d.ts")
34
+ collector.End()
35
+
36
+ if reported := collector.ToJSON(); reported != nil {
37
+ t.Fatalf("a virtual URI source is unwatchable and must never reach dependencies: %v", reported)
38
+ }
39
+ declared := map[string]bool{}
40
+ for _, key := range collector.ToCompleteJSON(map[string]string{
41
+ "src/bundled.ts": "",
42
+ "src/foreign.ts": "",
43
+ }) {
44
+ declared[key] = true
45
+ }
46
+ if !declared["src/bundled.ts"] {
47
+ t.Fatalf("the host graph drops bundled libraries too, so dropping one costs no declaration: %v", declared)
48
+ }
49
+ if declared["src/foreign.ts"] {
50
+ t.Fatalf("the host graph keeps a foreign scheme, so a file that consulted one must be withheld: %v", declared)
51
+ }
52
+ }