@drzl/validation-core 3.22.4 → 3.22.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  AFFIX_PREFIX_PATTERN: () => AFFIX_PREFIX_PATTERN,
34
34
  AFFIX_PROBE_TABLE: () => AFFIX_PROBE_TABLE,
35
35
  AFFIX_SUFFIX_PATTERN: () => AFFIX_SUFFIX_PATTERN,
36
+ BIGINT_DIGITS_PATTERN: () => BIGINT_DIGITS_PATTERN,
36
37
  CODEPOINT_LENGTH: () => CODEPOINT_LENGTH,
37
38
  COERCIBLE_DATE_STRING: () => COERCIBLE_DATE_STRING,
38
39
  COLUMN_FORMATS: () => COLUMN_FORMATS,
@@ -43,11 +44,15 @@ __export(index_exports, {
43
44
  DEFAULT_SCHEMA_SUFFIX: () => DEFAULT_SCHEMA_SUFFIX,
44
45
  DEFAULT_TYPE_SUFFIX: () => DEFAULT_TYPE_SUFFIX,
45
46
  IMPORT_EXTENSIONS: () => IMPORT_EXTENSIONS,
47
+ JSON_VALUE_TS_CONST: () => JSON_VALUE_TS_CONST,
48
+ JSON_VALUE_TS_SOURCE: () => JSON_VALUE_TS_SOURCE,
46
49
  MAX_NESTED_DEPTH: () => MAX_NESTED_DEPTH,
47
50
  NAME_MODES: () => NAME_MODES,
48
51
  NESTED_PREFIX: () => NESTED_PREFIX,
49
52
  NUMERIC_CANON_NAME: () => NUMERIC_CANON_NAME,
50
53
  NUMERIC_CANON_SOURCE: () => NUMERIC_CANON_SOURCE,
54
+ VALIBOT_JSON_CONST: () => VALIBOT_JSON_CONST,
55
+ VALIBOT_JSON_SOURCE: () => VALIBOT_JSON_SOURCE,
51
56
  applyTableCase: () => applyTableCase,
52
57
  applyWirePolicy: () => applyWirePolicy,
53
58
  buildBrandPlan: () => buildBrandPlan,
@@ -1798,6 +1803,47 @@ function parsesToADate(expr) {
1798
1803
  return `!Number.isNaN(${expr}.getTime())`;
1799
1804
  }
1800
1805
  var CODEPOINT_LENGTH = "[...v].length";
1806
+ var BIGINT_DIGITS_PATTERN = String.raw`/^-?\d+$/`;
1807
+ var JSON_VALUE_TS_CONST = "DrzlJsonValue";
1808
+ var JSON_VALUE_TS_SOURCE = `type ${JSON_VALUE_TS_CONST} =
1809
+ | string
1810
+ | number
1811
+ | boolean
1812
+ | null
1813
+ | ${JSON_VALUE_TS_CONST}[]
1814
+ | { [key: string]: ${JSON_VALUE_TS_CONST} };
1815
+ `;
1816
+ var VALIBOT_JSON_CONST = "DrzlJsonValue";
1817
+ var VALIBOT_JSON_SOURCE = `type ${VALIBOT_JSON_CONST}Type =
1818
+ | string
1819
+ | number
1820
+ | boolean
1821
+ | null
1822
+ | ${VALIBOT_JSON_CONST}Type[]
1823
+ | { [key: string]: ${VALIBOT_JSON_CONST}Type };
1824
+
1825
+ const ${VALIBOT_JSON_CONST}: v.GenericSchema<${VALIBOT_JSON_CONST}Type> = v.lazy(() =>
1826
+ v.union([
1827
+ v.string(),
1828
+ v.pipe(v.number(), v.finite()),
1829
+ v.boolean(),
1830
+ v.null(),
1831
+ v.array(${VALIBOT_JSON_CONST}),
1832
+ v.pipe(
1833
+ // The plain-object test comes before the record, not after it. A valibot pipe passes the
1834
+ // *output* of each step onward, and \`v.record\` outputs a freshly built object, so a check
1835
+ // placed after it inspects that new object and reports every input as plain. A Date sailed
1836
+ // through: it has no own enumerable keys, so the record accepted it and rebuilt it as \`{}\`.
1837
+ v.custom<Record<string, ${VALIBOT_JSON_CONST}Type>>((o) => {
1838
+ if (typeof o !== 'object' || o === null || Array.isArray(o)) return false;
1839
+ const p = Object.getPrototypeOf(o);
1840
+ return p === Object.prototype || p === null;
1841
+ }, 'not a plain object'),
1842
+ v.record(v.string(), ${VALIBOT_JSON_CONST})
1843
+ ),
1844
+ ])
1845
+ );
1846
+ `;
1801
1847
  function isIntegerColumn(c) {
1802
1848
  if (typeof c.integer === "boolean") return c.integer;
1803
1849
  return c.dbType === "INTEGER" || c.min !== void 0 && c.max !== void 0;
@@ -1959,6 +2005,7 @@ async function formatCode(code, filePath, fmt) {
1959
2005
  AFFIX_PREFIX_PATTERN,
1960
2006
  AFFIX_PROBE_TABLE,
1961
2007
  AFFIX_SUFFIX_PATTERN,
2008
+ BIGINT_DIGITS_PATTERN,
1962
2009
  CODEPOINT_LENGTH,
1963
2010
  COERCIBLE_DATE_STRING,
1964
2011
  COLUMN_FORMATS,
@@ -1969,11 +2016,15 @@ async function formatCode(code, filePath, fmt) {
1969
2016
  DEFAULT_SCHEMA_SUFFIX,
1970
2017
  DEFAULT_TYPE_SUFFIX,
1971
2018
  IMPORT_EXTENSIONS,
2019
+ JSON_VALUE_TS_CONST,
2020
+ JSON_VALUE_TS_SOURCE,
1972
2021
  MAX_NESTED_DEPTH,
1973
2022
  NAME_MODES,
1974
2023
  NESTED_PREFIX,
1975
2024
  NUMERIC_CANON_NAME,
1976
2025
  NUMERIC_CANON_SOURCE,
2026
+ VALIBOT_JSON_CONST,
2027
+ VALIBOT_JSON_SOURCE,
1977
2028
  applyTableCase,
1978
2029
  applyWirePolicy,
1979
2030
  buildBrandPlan,
package/dist/index.d.cts CHANGED
@@ -1567,6 +1567,46 @@ declare function parsesToADate(expr: string): string;
1567
1567
  * MySQL 8 on utf8mb4: `varchar(10)` takes ten emoji, `tinytext` takes 63 of them and refuses 64.
1568
1568
  */
1569
1569
  declare const CODEPOINT_LENGTH = "[...v].length";
1570
+ /**
1571
+ * The digits of an integer, as a regex literal for an emitted module.
1572
+ *
1573
+ * A bigint cannot cross JSON as a number: `JSON.stringify(1n)` throws on the way out, and a
1574
+ * `number` loses precision past 2^53. So every generator that puts a bigint column on a wire spells
1575
+ * it as its decimal digits, and they all spell it the same way from here.
1576
+ */
1577
+ declare const BIGINT_DIGITS_PATTERN: string;
1578
+ /** The name of the TypeScript alias a module declares for the json value space. */
1579
+ declare const JSON_VALUE_TS_CONST = "DrzlJsonValue";
1580
+ /**
1581
+ * The json value space as a TypeScript type, for the generators that emit types rather than
1582
+ * schemas: the service classes, the Fastify row types, the GraphQL resolver types and the NestJS
1583
+ * DTO fields.
1584
+ *
1585
+ * They all used to say `unknown` for a json column, or `any` in one case, while every validator
1586
+ * generator described the same column properly. A row type that says `unknown` makes the caller
1587
+ * cast to read a value the database guarantees is json, and one that says `any` is worse: it turns
1588
+ * the check off silently.
1589
+ *
1590
+ * Verified mutually assignable with zod's own `z.json()` output type, so a DTO field declared with
1591
+ * this satisfies a `StandardSchema<Dto>` static built from that schema.
1592
+ */
1593
+ declare const JSON_VALUE_TS_SOURCE = "type DrzlJsonValue =\n | string\n | number\n | boolean\n | null\n | DrzlJsonValue[]\n | { [key: string]: DrzlJsonValue };\n";
1594
+ /** The name of the recursive JSON schema a valibot module defines when it has a json column. */
1595
+ declare const VALIBOT_JSON_CONST = "DrzlJsonValue";
1596
+ /**
1597
+ * The JSON value space for valibot, emitted once into any module that needs it.
1598
+ *
1599
+ * Valibot has no `json()` built-in, unlike zod 4, and `v.any()` accepts `undefined`, `NaN`, bigints
1600
+ * and every class instance, none of which survive the round trip through a json column. So the
1601
+ * space is spelled out, recursively, with `v.finite()` so `Infinity` is rejected rather than
1602
+ * written out as `null`.
1603
+ *
1604
+ * Shared rather than copied because two kinds of generator need the same text: the standalone
1605
+ * valibot generator, whose json column is a value the driver hands back, and the route generators,
1606
+ * whose json column arrives from `JSON.parse` on a request body. The value space is the same in
1607
+ * both directions, and two copies of it would be two things to keep in step.
1608
+ */
1609
+ declare const VALIBOT_JSON_SOURCE = "type DrzlJsonValueType =\n | string\n | number\n | boolean\n | null\n | DrzlJsonValueType[]\n | { [key: string]: DrzlJsonValueType };\n\nconst DrzlJsonValue: v.GenericSchema<DrzlJsonValueType> = v.lazy(() =>\n v.union([\n v.string(),\n v.pipe(v.number(), v.finite()),\n v.boolean(),\n v.null(),\n v.array(DrzlJsonValue),\n v.pipe(\n // The plain-object test comes before the record, not after it. A valibot pipe passes the\n // *output* of each step onward, and `v.record` outputs a freshly built object, so a check\n // placed after it inspects that new object and reports every input as plain. A Date sailed\n // through: it has no own enumerable keys, so the record accepted it and rebuilt it as `{}`.\n v.custom<Record<string, DrzlJsonValueType>>((o) => {\n if (typeof o !== 'object' || o === null || Array.isArray(o)) return false;\n const p = Object.getPrototypeOf(o);\n return p === Object.prototype || p === null;\n }, 'not a plain object'),\n v.record(v.string(), DrzlJsonValue)\n ),\n ])\n);\n";
1570
1610
  declare function isIntegerColumn(c: Column): boolean;
1571
1611
  /**
1572
1612
  * The non-finite doubles the emitted schema must admit beside the column's range, as the analyzer
@@ -1696,4 +1736,4 @@ declare function isProjectInstallPath(manifestPath: string): boolean;
1696
1736
  */
1697
1737
  declare function formatCode(code: string, filePath: string, fmt?: FormatOptions): Promise<any>;
1698
1738
 
1699
- export { AFFIX_PREFIX_PATTERN, AFFIX_PROBE_TABLE, AFFIX_SUFFIX_PATTERN, type AffixIssue, type AffixOptions, type AffixValue, type BrandAlias, type BrandPlan, type BrandingOption, type BrandingOptions, CODEPOINT_LENGTH, COERCIBLE_DATE_STRING, COLUMN_FORMATS, CONSTRAINTS_MODULE, type CardinalityCheck, type CheckPart, type CheckPartPlace, type ClassifiedCheck, type ColumnCheck, type ColumnMetaFacts, type ColumnSet, type ComparisonWire, type ConstraintFacts, type ConstraintKind, type ConstraintsModuleOptions, type ConstraintsOption, DEFAULT_IMPORT_EXTENSION, DEFAULT_MODE_PREFIX, DEFAULT_NESTED_DEPTH, DEFAULT_SCHEMA_SUFFIX, DEFAULT_TYPE_SUFFIX, type FileSink, type FormatOptions, type GeneratorFs, IMPORT_EXTENSIONS, type ImportExtension, type LengthCheck, type LengthMeasure, MAX_NESTED_DEPTH, type MetaFactOptions, NAME_MODES, NESTED_PREFIX, NUMERIC_CANON_NAME, NUMERIC_CANON_SOURCE, type NameMode, type NestedArm, type NestedMode, type NestedNode, type NullCheck, type ParsedCheck, type ResolvedAffix, type ResolvedBranding, type RowCheck, type Table, type TableCase, type TableConstraints, type TableMetaFacts, type TableMetaOptions, type UnenforcedLiteral, type UnenforcedPart, type ValidationGenerateOptions, type ValidationLibrary, type ValidationRenderer, type WireLiteralFit, type WireLiteralQuestion, applyTableCase, applyWirePolicy, buildBrandPlan, buildNestedPlan, canonicalMembers, canonicalNumericText, classifyTableChecks, codePointCompare, columnMetaFacts, comparisonWire, describeSet, fileWriter, formatCode, importSpecifier, insertColumns, isGeneratedColumn, isIntegerColumn, isProjectInstallPath, lengthCheckLabel, lengthMeasure, measureCompare, measureExpression, moduleFileName, moduleSpecifier, needsNumericCanon, nestedArmNotes, nestedNodeColumns, nestedSchemaName, nestedTypeName, nonFiniteAccepted, nonFiniteRefused, parseCheck, parsesToADate, pascalCase, renderConstraintsModule, renderDuplicateFinder, resolveAffix, resolveBranding, resolveConfiguredImport, resolveConstraints, resolveNestedDepth, schemaName, selectColumns, tableConstraints, tableMetaFacts, typeName, updateColumns, validateAffix, wireLiteralFit, wireNumberLiteral };
1739
+ export { AFFIX_PREFIX_PATTERN, AFFIX_PROBE_TABLE, AFFIX_SUFFIX_PATTERN, type AffixIssue, type AffixOptions, type AffixValue, BIGINT_DIGITS_PATTERN, type BrandAlias, type BrandPlan, type BrandingOption, type BrandingOptions, CODEPOINT_LENGTH, COERCIBLE_DATE_STRING, COLUMN_FORMATS, CONSTRAINTS_MODULE, type CardinalityCheck, type CheckPart, type CheckPartPlace, type ClassifiedCheck, type ColumnCheck, type ColumnMetaFacts, type ColumnSet, type ComparisonWire, type ConstraintFacts, type ConstraintKind, type ConstraintsModuleOptions, type ConstraintsOption, DEFAULT_IMPORT_EXTENSION, DEFAULT_MODE_PREFIX, DEFAULT_NESTED_DEPTH, DEFAULT_SCHEMA_SUFFIX, DEFAULT_TYPE_SUFFIX, type FileSink, type FormatOptions, type GeneratorFs, IMPORT_EXTENSIONS, type ImportExtension, JSON_VALUE_TS_CONST, JSON_VALUE_TS_SOURCE, type LengthCheck, type LengthMeasure, MAX_NESTED_DEPTH, type MetaFactOptions, NAME_MODES, NESTED_PREFIX, NUMERIC_CANON_NAME, NUMERIC_CANON_SOURCE, type NameMode, type NestedArm, type NestedMode, type NestedNode, type NullCheck, type ParsedCheck, type ResolvedAffix, type ResolvedBranding, type RowCheck, type Table, type TableCase, type TableConstraints, type TableMetaFacts, type TableMetaOptions, type UnenforcedLiteral, type UnenforcedPart, VALIBOT_JSON_CONST, VALIBOT_JSON_SOURCE, type ValidationGenerateOptions, type ValidationLibrary, type ValidationRenderer, type WireLiteralFit, type WireLiteralQuestion, applyTableCase, applyWirePolicy, buildBrandPlan, buildNestedPlan, canonicalMembers, canonicalNumericText, classifyTableChecks, codePointCompare, columnMetaFacts, comparisonWire, describeSet, fileWriter, formatCode, importSpecifier, insertColumns, isGeneratedColumn, isIntegerColumn, isProjectInstallPath, lengthCheckLabel, lengthMeasure, measureCompare, measureExpression, moduleFileName, moduleSpecifier, needsNumericCanon, nestedArmNotes, nestedNodeColumns, nestedSchemaName, nestedTypeName, nonFiniteAccepted, nonFiniteRefused, parseCheck, parsesToADate, pascalCase, renderConstraintsModule, renderDuplicateFinder, resolveAffix, resolveBranding, resolveConfiguredImport, resolveConstraints, resolveNestedDepth, schemaName, selectColumns, tableConstraints, tableMetaFacts, typeName, updateColumns, validateAffix, wireLiteralFit, wireNumberLiteral };
package/dist/index.d.ts CHANGED
@@ -1567,6 +1567,46 @@ declare function parsesToADate(expr: string): string;
1567
1567
  * MySQL 8 on utf8mb4: `varchar(10)` takes ten emoji, `tinytext` takes 63 of them and refuses 64.
1568
1568
  */
1569
1569
  declare const CODEPOINT_LENGTH = "[...v].length";
1570
+ /**
1571
+ * The digits of an integer, as a regex literal for an emitted module.
1572
+ *
1573
+ * A bigint cannot cross JSON as a number: `JSON.stringify(1n)` throws on the way out, and a
1574
+ * `number` loses precision past 2^53. So every generator that puts a bigint column on a wire spells
1575
+ * it as its decimal digits, and they all spell it the same way from here.
1576
+ */
1577
+ declare const BIGINT_DIGITS_PATTERN: string;
1578
+ /** The name of the TypeScript alias a module declares for the json value space. */
1579
+ declare const JSON_VALUE_TS_CONST = "DrzlJsonValue";
1580
+ /**
1581
+ * The json value space as a TypeScript type, for the generators that emit types rather than
1582
+ * schemas: the service classes, the Fastify row types, the GraphQL resolver types and the NestJS
1583
+ * DTO fields.
1584
+ *
1585
+ * They all used to say `unknown` for a json column, or `any` in one case, while every validator
1586
+ * generator described the same column properly. A row type that says `unknown` makes the caller
1587
+ * cast to read a value the database guarantees is json, and one that says `any` is worse: it turns
1588
+ * the check off silently.
1589
+ *
1590
+ * Verified mutually assignable with zod's own `z.json()` output type, so a DTO field declared with
1591
+ * this satisfies a `StandardSchema<Dto>` static built from that schema.
1592
+ */
1593
+ declare const JSON_VALUE_TS_SOURCE = "type DrzlJsonValue =\n | string\n | number\n | boolean\n | null\n | DrzlJsonValue[]\n | { [key: string]: DrzlJsonValue };\n";
1594
+ /** The name of the recursive JSON schema a valibot module defines when it has a json column. */
1595
+ declare const VALIBOT_JSON_CONST = "DrzlJsonValue";
1596
+ /**
1597
+ * The JSON value space for valibot, emitted once into any module that needs it.
1598
+ *
1599
+ * Valibot has no `json()` built-in, unlike zod 4, and `v.any()` accepts `undefined`, `NaN`, bigints
1600
+ * and every class instance, none of which survive the round trip through a json column. So the
1601
+ * space is spelled out, recursively, with `v.finite()` so `Infinity` is rejected rather than
1602
+ * written out as `null`.
1603
+ *
1604
+ * Shared rather than copied because two kinds of generator need the same text: the standalone
1605
+ * valibot generator, whose json column is a value the driver hands back, and the route generators,
1606
+ * whose json column arrives from `JSON.parse` on a request body. The value space is the same in
1607
+ * both directions, and two copies of it would be two things to keep in step.
1608
+ */
1609
+ declare const VALIBOT_JSON_SOURCE = "type DrzlJsonValueType =\n | string\n | number\n | boolean\n | null\n | DrzlJsonValueType[]\n | { [key: string]: DrzlJsonValueType };\n\nconst DrzlJsonValue: v.GenericSchema<DrzlJsonValueType> = v.lazy(() =>\n v.union([\n v.string(),\n v.pipe(v.number(), v.finite()),\n v.boolean(),\n v.null(),\n v.array(DrzlJsonValue),\n v.pipe(\n // The plain-object test comes before the record, not after it. A valibot pipe passes the\n // *output* of each step onward, and `v.record` outputs a freshly built object, so a check\n // placed after it inspects that new object and reports every input as plain. A Date sailed\n // through: it has no own enumerable keys, so the record accepted it and rebuilt it as `{}`.\n v.custom<Record<string, DrzlJsonValueType>>((o) => {\n if (typeof o !== 'object' || o === null || Array.isArray(o)) return false;\n const p = Object.getPrototypeOf(o);\n return p === Object.prototype || p === null;\n }, 'not a plain object'),\n v.record(v.string(), DrzlJsonValue)\n ),\n ])\n);\n";
1570
1610
  declare function isIntegerColumn(c: Column): boolean;
1571
1611
  /**
1572
1612
  * The non-finite doubles the emitted schema must admit beside the column's range, as the analyzer
@@ -1696,4 +1736,4 @@ declare function isProjectInstallPath(manifestPath: string): boolean;
1696
1736
  */
1697
1737
  declare function formatCode(code: string, filePath: string, fmt?: FormatOptions): Promise<any>;
1698
1738
 
1699
- export { AFFIX_PREFIX_PATTERN, AFFIX_PROBE_TABLE, AFFIX_SUFFIX_PATTERN, type AffixIssue, type AffixOptions, type AffixValue, type BrandAlias, type BrandPlan, type BrandingOption, type BrandingOptions, CODEPOINT_LENGTH, COERCIBLE_DATE_STRING, COLUMN_FORMATS, CONSTRAINTS_MODULE, type CardinalityCheck, type CheckPart, type CheckPartPlace, type ClassifiedCheck, type ColumnCheck, type ColumnMetaFacts, type ColumnSet, type ComparisonWire, type ConstraintFacts, type ConstraintKind, type ConstraintsModuleOptions, type ConstraintsOption, DEFAULT_IMPORT_EXTENSION, DEFAULT_MODE_PREFIX, DEFAULT_NESTED_DEPTH, DEFAULT_SCHEMA_SUFFIX, DEFAULT_TYPE_SUFFIX, type FileSink, type FormatOptions, type GeneratorFs, IMPORT_EXTENSIONS, type ImportExtension, type LengthCheck, type LengthMeasure, MAX_NESTED_DEPTH, type MetaFactOptions, NAME_MODES, NESTED_PREFIX, NUMERIC_CANON_NAME, NUMERIC_CANON_SOURCE, type NameMode, type NestedArm, type NestedMode, type NestedNode, type NullCheck, type ParsedCheck, type ResolvedAffix, type ResolvedBranding, type RowCheck, type Table, type TableCase, type TableConstraints, type TableMetaFacts, type TableMetaOptions, type UnenforcedLiteral, type UnenforcedPart, type ValidationGenerateOptions, type ValidationLibrary, type ValidationRenderer, type WireLiteralFit, type WireLiteralQuestion, applyTableCase, applyWirePolicy, buildBrandPlan, buildNestedPlan, canonicalMembers, canonicalNumericText, classifyTableChecks, codePointCompare, columnMetaFacts, comparisonWire, describeSet, fileWriter, formatCode, importSpecifier, insertColumns, isGeneratedColumn, isIntegerColumn, isProjectInstallPath, lengthCheckLabel, lengthMeasure, measureCompare, measureExpression, moduleFileName, moduleSpecifier, needsNumericCanon, nestedArmNotes, nestedNodeColumns, nestedSchemaName, nestedTypeName, nonFiniteAccepted, nonFiniteRefused, parseCheck, parsesToADate, pascalCase, renderConstraintsModule, renderDuplicateFinder, resolveAffix, resolveBranding, resolveConfiguredImport, resolveConstraints, resolveNestedDepth, schemaName, selectColumns, tableConstraints, tableMetaFacts, typeName, updateColumns, validateAffix, wireLiteralFit, wireNumberLiteral };
1739
+ export { AFFIX_PREFIX_PATTERN, AFFIX_PROBE_TABLE, AFFIX_SUFFIX_PATTERN, type AffixIssue, type AffixOptions, type AffixValue, BIGINT_DIGITS_PATTERN, type BrandAlias, type BrandPlan, type BrandingOption, type BrandingOptions, CODEPOINT_LENGTH, COERCIBLE_DATE_STRING, COLUMN_FORMATS, CONSTRAINTS_MODULE, type CardinalityCheck, type CheckPart, type CheckPartPlace, type ClassifiedCheck, type ColumnCheck, type ColumnMetaFacts, type ColumnSet, type ComparisonWire, type ConstraintFacts, type ConstraintKind, type ConstraintsModuleOptions, type ConstraintsOption, DEFAULT_IMPORT_EXTENSION, DEFAULT_MODE_PREFIX, DEFAULT_NESTED_DEPTH, DEFAULT_SCHEMA_SUFFIX, DEFAULT_TYPE_SUFFIX, type FileSink, type FormatOptions, type GeneratorFs, IMPORT_EXTENSIONS, type ImportExtension, JSON_VALUE_TS_CONST, JSON_VALUE_TS_SOURCE, type LengthCheck, type LengthMeasure, MAX_NESTED_DEPTH, type MetaFactOptions, NAME_MODES, NESTED_PREFIX, NUMERIC_CANON_NAME, NUMERIC_CANON_SOURCE, type NameMode, type NestedArm, type NestedMode, type NestedNode, type NullCheck, type ParsedCheck, type ResolvedAffix, type ResolvedBranding, type RowCheck, type Table, type TableCase, type TableConstraints, type TableMetaFacts, type TableMetaOptions, type UnenforcedLiteral, type UnenforcedPart, VALIBOT_JSON_CONST, VALIBOT_JSON_SOURCE, type ValidationGenerateOptions, type ValidationLibrary, type ValidationRenderer, type WireLiteralFit, type WireLiteralQuestion, applyTableCase, applyWirePolicy, buildBrandPlan, buildNestedPlan, canonicalMembers, canonicalNumericText, classifyTableChecks, codePointCompare, columnMetaFacts, comparisonWire, describeSet, fileWriter, formatCode, importSpecifier, insertColumns, isGeneratedColumn, isIntegerColumn, isProjectInstallPath, lengthCheckLabel, lengthMeasure, measureCompare, measureExpression, moduleFileName, moduleSpecifier, needsNumericCanon, nestedArmNotes, nestedNodeColumns, nestedSchemaName, nestedTypeName, nonFiniteAccepted, nonFiniteRefused, parseCheck, parsesToADate, pascalCase, renderConstraintsModule, renderDuplicateFinder, resolveAffix, resolveBranding, resolveConfiguredImport, resolveConstraints, resolveNestedDepth, schemaName, selectColumns, tableConstraints, tableMetaFacts, typeName, updateColumns, validateAffix, wireLiteralFit, wireNumberLiteral };
package/dist/index.js CHANGED
@@ -1697,6 +1697,47 @@ function parsesToADate(expr) {
1697
1697
  return `!Number.isNaN(${expr}.getTime())`;
1698
1698
  }
1699
1699
  var CODEPOINT_LENGTH = "[...v].length";
1700
+ var BIGINT_DIGITS_PATTERN = String.raw`/^-?\d+$/`;
1701
+ var JSON_VALUE_TS_CONST = "DrzlJsonValue";
1702
+ var JSON_VALUE_TS_SOURCE = `type ${JSON_VALUE_TS_CONST} =
1703
+ | string
1704
+ | number
1705
+ | boolean
1706
+ | null
1707
+ | ${JSON_VALUE_TS_CONST}[]
1708
+ | { [key: string]: ${JSON_VALUE_TS_CONST} };
1709
+ `;
1710
+ var VALIBOT_JSON_CONST = "DrzlJsonValue";
1711
+ var VALIBOT_JSON_SOURCE = `type ${VALIBOT_JSON_CONST}Type =
1712
+ | string
1713
+ | number
1714
+ | boolean
1715
+ | null
1716
+ | ${VALIBOT_JSON_CONST}Type[]
1717
+ | { [key: string]: ${VALIBOT_JSON_CONST}Type };
1718
+
1719
+ const ${VALIBOT_JSON_CONST}: v.GenericSchema<${VALIBOT_JSON_CONST}Type> = v.lazy(() =>
1720
+ v.union([
1721
+ v.string(),
1722
+ v.pipe(v.number(), v.finite()),
1723
+ v.boolean(),
1724
+ v.null(),
1725
+ v.array(${VALIBOT_JSON_CONST}),
1726
+ v.pipe(
1727
+ // The plain-object test comes before the record, not after it. A valibot pipe passes the
1728
+ // *output* of each step onward, and \`v.record\` outputs a freshly built object, so a check
1729
+ // placed after it inspects that new object and reports every input as plain. A Date sailed
1730
+ // through: it has no own enumerable keys, so the record accepted it and rebuilt it as \`{}\`.
1731
+ v.custom<Record<string, ${VALIBOT_JSON_CONST}Type>>((o) => {
1732
+ if (typeof o !== 'object' || o === null || Array.isArray(o)) return false;
1733
+ const p = Object.getPrototypeOf(o);
1734
+ return p === Object.prototype || p === null;
1735
+ }, 'not a plain object'),
1736
+ v.record(v.string(), ${VALIBOT_JSON_CONST})
1737
+ ),
1738
+ ])
1739
+ );
1740
+ `;
1700
1741
  function isIntegerColumn(c) {
1701
1742
  if (typeof c.integer === "boolean") return c.integer;
1702
1743
  return c.dbType === "INTEGER" || c.min !== void 0 && c.max !== void 0;
@@ -1857,6 +1898,7 @@ export {
1857
1898
  AFFIX_PREFIX_PATTERN,
1858
1899
  AFFIX_PROBE_TABLE,
1859
1900
  AFFIX_SUFFIX_PATTERN,
1901
+ BIGINT_DIGITS_PATTERN,
1860
1902
  CODEPOINT_LENGTH,
1861
1903
  COERCIBLE_DATE_STRING,
1862
1904
  COLUMN_FORMATS,
@@ -1867,11 +1909,15 @@ export {
1867
1909
  DEFAULT_SCHEMA_SUFFIX,
1868
1910
  DEFAULT_TYPE_SUFFIX,
1869
1911
  IMPORT_EXTENSIONS,
1912
+ JSON_VALUE_TS_CONST,
1913
+ JSON_VALUE_TS_SOURCE,
1870
1914
  MAX_NESTED_DEPTH,
1871
1915
  NAME_MODES,
1872
1916
  NESTED_PREFIX,
1873
1917
  NUMERIC_CANON_NAME,
1874
1918
  NUMERIC_CANON_SOURCE,
1919
+ VALIBOT_JSON_CONST,
1920
+ VALIBOT_JSON_SOURCE,
1875
1921
  applyTableCase,
1876
1922
  applyWirePolicy,
1877
1923
  buildBrandPlan,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drzl/validation-core",
3
- "version": "3.22.4",
3
+ "version": "3.22.6",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -24,7 +24,7 @@
24
24
  ],
25
25
  "sideEffects": false,
26
26
  "dependencies": {
27
- "@drzl/analyzer": "^1.21.4"
27
+ "@drzl/analyzer": "^1.21.5"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "prettier": ">=3"