@drzl/validation-core 3.22.4 → 3.22.5
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 +38 -0
- package/dist/index.d.cts +25 -1
- package/dist/index.d.ts +25 -1
- package/dist/index.js +35 -0
- package/package.json +2 -2
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,
|
|
@@ -48,6 +49,8 @@ __export(index_exports, {
|
|
|
48
49
|
NESTED_PREFIX: () => NESTED_PREFIX,
|
|
49
50
|
NUMERIC_CANON_NAME: () => NUMERIC_CANON_NAME,
|
|
50
51
|
NUMERIC_CANON_SOURCE: () => NUMERIC_CANON_SOURCE,
|
|
52
|
+
VALIBOT_JSON_CONST: () => VALIBOT_JSON_CONST,
|
|
53
|
+
VALIBOT_JSON_SOURCE: () => VALIBOT_JSON_SOURCE,
|
|
51
54
|
applyTableCase: () => applyTableCase,
|
|
52
55
|
applyWirePolicy: () => applyWirePolicy,
|
|
53
56
|
buildBrandPlan: () => buildBrandPlan,
|
|
@@ -1798,6 +1801,38 @@ function parsesToADate(expr) {
|
|
|
1798
1801
|
return `!Number.isNaN(${expr}.getTime())`;
|
|
1799
1802
|
}
|
|
1800
1803
|
var CODEPOINT_LENGTH = "[...v].length";
|
|
1804
|
+
var BIGINT_DIGITS_PATTERN = String.raw`/^-?\d+$/`;
|
|
1805
|
+
var VALIBOT_JSON_CONST = "DrzlJsonValue";
|
|
1806
|
+
var VALIBOT_JSON_SOURCE = `type ${VALIBOT_JSON_CONST}Type =
|
|
1807
|
+
| string
|
|
1808
|
+
| number
|
|
1809
|
+
| boolean
|
|
1810
|
+
| null
|
|
1811
|
+
| ${VALIBOT_JSON_CONST}Type[]
|
|
1812
|
+
| { [key: string]: ${VALIBOT_JSON_CONST}Type };
|
|
1813
|
+
|
|
1814
|
+
const ${VALIBOT_JSON_CONST}: v.GenericSchema<${VALIBOT_JSON_CONST}Type> = v.lazy(() =>
|
|
1815
|
+
v.union([
|
|
1816
|
+
v.string(),
|
|
1817
|
+
v.pipe(v.number(), v.finite()),
|
|
1818
|
+
v.boolean(),
|
|
1819
|
+
v.null(),
|
|
1820
|
+
v.array(${VALIBOT_JSON_CONST}),
|
|
1821
|
+
v.pipe(
|
|
1822
|
+
// The plain-object test comes before the record, not after it. A valibot pipe passes the
|
|
1823
|
+
// *output* of each step onward, and \`v.record\` outputs a freshly built object, so a check
|
|
1824
|
+
// placed after it inspects that new object and reports every input as plain. A Date sailed
|
|
1825
|
+
// through: it has no own enumerable keys, so the record accepted it and rebuilt it as \`{}\`.
|
|
1826
|
+
v.custom<Record<string, ${VALIBOT_JSON_CONST}Type>>((o) => {
|
|
1827
|
+
if (typeof o !== 'object' || o === null || Array.isArray(o)) return false;
|
|
1828
|
+
const p = Object.getPrototypeOf(o);
|
|
1829
|
+
return p === Object.prototype || p === null;
|
|
1830
|
+
}, 'not a plain object'),
|
|
1831
|
+
v.record(v.string(), ${VALIBOT_JSON_CONST})
|
|
1832
|
+
),
|
|
1833
|
+
])
|
|
1834
|
+
);
|
|
1835
|
+
`;
|
|
1801
1836
|
function isIntegerColumn(c) {
|
|
1802
1837
|
if (typeof c.integer === "boolean") return c.integer;
|
|
1803
1838
|
return c.dbType === "INTEGER" || c.min !== void 0 && c.max !== void 0;
|
|
@@ -1959,6 +1994,7 @@ async function formatCode(code, filePath, fmt) {
|
|
|
1959
1994
|
AFFIX_PREFIX_PATTERN,
|
|
1960
1995
|
AFFIX_PROBE_TABLE,
|
|
1961
1996
|
AFFIX_SUFFIX_PATTERN,
|
|
1997
|
+
BIGINT_DIGITS_PATTERN,
|
|
1962
1998
|
CODEPOINT_LENGTH,
|
|
1963
1999
|
COERCIBLE_DATE_STRING,
|
|
1964
2000
|
COLUMN_FORMATS,
|
|
@@ -1974,6 +2010,8 @@ async function formatCode(code, filePath, fmt) {
|
|
|
1974
2010
|
NESTED_PREFIX,
|
|
1975
2011
|
NUMERIC_CANON_NAME,
|
|
1976
2012
|
NUMERIC_CANON_SOURCE,
|
|
2013
|
+
VALIBOT_JSON_CONST,
|
|
2014
|
+
VALIBOT_JSON_SOURCE,
|
|
1977
2015
|
applyTableCase,
|
|
1978
2016
|
applyWirePolicy,
|
|
1979
2017
|
buildBrandPlan,
|
package/dist/index.d.cts
CHANGED
|
@@ -1567,6 +1567,30 @@ 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 recursive JSON schema a valibot module defines when it has a json column. */
|
|
1579
|
+
declare const VALIBOT_JSON_CONST = "DrzlJsonValue";
|
|
1580
|
+
/**
|
|
1581
|
+
* The JSON value space for valibot, emitted once into any module that needs it.
|
|
1582
|
+
*
|
|
1583
|
+
* Valibot has no `json()` built-in, unlike zod 4, and `v.any()` accepts `undefined`, `NaN`, bigints
|
|
1584
|
+
* and every class instance, none of which survive the round trip through a json column. So the
|
|
1585
|
+
* space is spelled out, recursively, with `v.finite()` so `Infinity` is rejected rather than
|
|
1586
|
+
* written out as `null`.
|
|
1587
|
+
*
|
|
1588
|
+
* Shared rather than copied because two kinds of generator need the same text: the standalone
|
|
1589
|
+
* valibot generator, whose json column is a value the driver hands back, and the route generators,
|
|
1590
|
+
* whose json column arrives from `JSON.parse` on a request body. The value space is the same in
|
|
1591
|
+
* both directions, and two copies of it would be two things to keep in step.
|
|
1592
|
+
*/
|
|
1593
|
+
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
1594
|
declare function isIntegerColumn(c: Column): boolean;
|
|
1571
1595
|
/**
|
|
1572
1596
|
* The non-finite doubles the emitted schema must admit beside the column's range, as the analyzer
|
|
@@ -1696,4 +1720,4 @@ declare function isProjectInstallPath(manifestPath: string): boolean;
|
|
|
1696
1720
|
*/
|
|
1697
1721
|
declare function formatCode(code: string, filePath: string, fmt?: FormatOptions): Promise<any>;
|
|
1698
1722
|
|
|
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 };
|
|
1723
|
+
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, 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,30 @@ 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 recursive JSON schema a valibot module defines when it has a json column. */
|
|
1579
|
+
declare const VALIBOT_JSON_CONST = "DrzlJsonValue";
|
|
1580
|
+
/**
|
|
1581
|
+
* The JSON value space for valibot, emitted once into any module that needs it.
|
|
1582
|
+
*
|
|
1583
|
+
* Valibot has no `json()` built-in, unlike zod 4, and `v.any()` accepts `undefined`, `NaN`, bigints
|
|
1584
|
+
* and every class instance, none of which survive the round trip through a json column. So the
|
|
1585
|
+
* space is spelled out, recursively, with `v.finite()` so `Infinity` is rejected rather than
|
|
1586
|
+
* written out as `null`.
|
|
1587
|
+
*
|
|
1588
|
+
* Shared rather than copied because two kinds of generator need the same text: the standalone
|
|
1589
|
+
* valibot generator, whose json column is a value the driver hands back, and the route generators,
|
|
1590
|
+
* whose json column arrives from `JSON.parse` on a request body. The value space is the same in
|
|
1591
|
+
* both directions, and two copies of it would be two things to keep in step.
|
|
1592
|
+
*/
|
|
1593
|
+
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
1594
|
declare function isIntegerColumn(c: Column): boolean;
|
|
1571
1595
|
/**
|
|
1572
1596
|
* The non-finite doubles the emitted schema must admit beside the column's range, as the analyzer
|
|
@@ -1696,4 +1720,4 @@ declare function isProjectInstallPath(manifestPath: string): boolean;
|
|
|
1696
1720
|
*/
|
|
1697
1721
|
declare function formatCode(code: string, filePath: string, fmt?: FormatOptions): Promise<any>;
|
|
1698
1722
|
|
|
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 };
|
|
1723
|
+
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, 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,38 @@ 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 VALIBOT_JSON_CONST = "DrzlJsonValue";
|
|
1702
|
+
var VALIBOT_JSON_SOURCE = `type ${VALIBOT_JSON_CONST}Type =
|
|
1703
|
+
| string
|
|
1704
|
+
| number
|
|
1705
|
+
| boolean
|
|
1706
|
+
| null
|
|
1707
|
+
| ${VALIBOT_JSON_CONST}Type[]
|
|
1708
|
+
| { [key: string]: ${VALIBOT_JSON_CONST}Type };
|
|
1709
|
+
|
|
1710
|
+
const ${VALIBOT_JSON_CONST}: v.GenericSchema<${VALIBOT_JSON_CONST}Type> = v.lazy(() =>
|
|
1711
|
+
v.union([
|
|
1712
|
+
v.string(),
|
|
1713
|
+
v.pipe(v.number(), v.finite()),
|
|
1714
|
+
v.boolean(),
|
|
1715
|
+
v.null(),
|
|
1716
|
+
v.array(${VALIBOT_JSON_CONST}),
|
|
1717
|
+
v.pipe(
|
|
1718
|
+
// The plain-object test comes before the record, not after it. A valibot pipe passes the
|
|
1719
|
+
// *output* of each step onward, and \`v.record\` outputs a freshly built object, so a check
|
|
1720
|
+
// placed after it inspects that new object and reports every input as plain. A Date sailed
|
|
1721
|
+
// through: it has no own enumerable keys, so the record accepted it and rebuilt it as \`{}\`.
|
|
1722
|
+
v.custom<Record<string, ${VALIBOT_JSON_CONST}Type>>((o) => {
|
|
1723
|
+
if (typeof o !== 'object' || o === null || Array.isArray(o)) return false;
|
|
1724
|
+
const p = Object.getPrototypeOf(o);
|
|
1725
|
+
return p === Object.prototype || p === null;
|
|
1726
|
+
}, 'not a plain object'),
|
|
1727
|
+
v.record(v.string(), ${VALIBOT_JSON_CONST})
|
|
1728
|
+
),
|
|
1729
|
+
])
|
|
1730
|
+
);
|
|
1731
|
+
`;
|
|
1700
1732
|
function isIntegerColumn(c) {
|
|
1701
1733
|
if (typeof c.integer === "boolean") return c.integer;
|
|
1702
1734
|
return c.dbType === "INTEGER" || c.min !== void 0 && c.max !== void 0;
|
|
@@ -1857,6 +1889,7 @@ export {
|
|
|
1857
1889
|
AFFIX_PREFIX_PATTERN,
|
|
1858
1890
|
AFFIX_PROBE_TABLE,
|
|
1859
1891
|
AFFIX_SUFFIX_PATTERN,
|
|
1892
|
+
BIGINT_DIGITS_PATTERN,
|
|
1860
1893
|
CODEPOINT_LENGTH,
|
|
1861
1894
|
COERCIBLE_DATE_STRING,
|
|
1862
1895
|
COLUMN_FORMATS,
|
|
@@ -1872,6 +1905,8 @@ export {
|
|
|
1872
1905
|
NESTED_PREFIX,
|
|
1873
1906
|
NUMERIC_CANON_NAME,
|
|
1874
1907
|
NUMERIC_CANON_SOURCE,
|
|
1908
|
+
VALIBOT_JSON_CONST,
|
|
1909
|
+
VALIBOT_JSON_SOURCE,
|
|
1875
1910
|
applyTableCase,
|
|
1876
1911
|
applyWirePolicy,
|
|
1877
1912
|
buildBrandPlan,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drzl/validation-core",
|
|
3
|
-
"version": "3.22.
|
|
3
|
+
"version": "3.22.5",
|
|
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.
|
|
27
|
+
"@drzl/analyzer": "^1.21.5"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"prettier": ">=3"
|