@conform-to/zod
Advanced tools
Comparing version 1.0.0-pre.2 to 1.0.0-pre.3
@@ -5,22 +5,22 @@ 'use strict'; | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
function ownKeys(e, r) { | ||
var t = Object.keys(e); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
enumerableOnly && (symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
})), keys.push.apply(keys, symbols); | ||
var o = Object.getOwnPropertySymbols(e); | ||
r && (o = o.filter(function (r) { | ||
return Object.getOwnPropertyDescriptor(e, r).enumerable; | ||
})), t.push.apply(t, o); | ||
} | ||
return keys; | ||
return t; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = null != arguments[i] ? arguments[i] : {}; | ||
i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
function _objectSpread2(e) { | ||
for (var r = 1; r < arguments.length; r++) { | ||
var t = null != arguments[r] ? arguments[r] : {}; | ||
r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { | ||
_defineProperty(e, r, t[r]); | ||
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { | ||
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); | ||
}); | ||
} | ||
return target; | ||
return e; | ||
} | ||
@@ -27,0 +27,0 @@ function _defineProperty(obj, key, value) { |
import type { Constraint } from '@conform-to/dom'; | ||
import { type ZodTypeAny } from 'zod'; | ||
export declare function getConstraint(schema: ZodTypeAny): Record<string, Constraint>; | ||
export declare function getZodConstraint(schema: ZodTypeAny): Record<string, Constraint>; |
@@ -9,3 +9,3 @@ 'use strict'; | ||
var keys = ['required', 'minLength', 'maxLength', 'min', 'max', 'step', 'multiple', 'pattern']; | ||
function getConstraint(schema) { | ||
function getZodConstraint(schema) { | ||
function updateConstraint(schema, data) { | ||
@@ -101,2 +101,2 @@ var _data$name; | ||
exports.getConstraint = getConstraint; | ||
exports.getZodConstraint = getZodConstraint; |
@@ -1,2 +0,2 @@ | ||
export { getConstraint } from './constraint'; | ||
export { parse, refine } from './parse'; | ||
export { getZodConstraint } from './constraint'; | ||
export { parseWithZod, refine } from './parse'; |
@@ -10,4 +10,4 @@ 'use strict'; | ||
exports.getConstraint = constraint.getConstraint; | ||
exports.parse = parse.parse; | ||
exports.getZodConstraint = constraint.getZodConstraint; | ||
exports.parseWithZod = parse.parseWithZod; | ||
exports.refine = parse.refine; |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.0-pre.2", | ||
"version": "1.0.0-pre.3", | ||
"main": "index.js", | ||
@@ -28,4 +28,6 @@ "module": "index.mjs", | ||
}, | ||
"dependencies": { | ||
"@conform-to/dom": "1.0.0-pre.3" | ||
}, | ||
"peerDependencies": { | ||
"@conform-to/dom": "1.0.0-pre.2", | ||
"zod": "^3.21.0" | ||
@@ -32,0 +34,0 @@ }, |
import { type Intent, type Submission } from '@conform-to/dom'; | ||
import { type IssueData, type RefinementCtx, type ZodTypeAny, type ZodErrorMap, type input, type output, type ZodIssue } from 'zod'; | ||
export declare function parse<Schema extends ZodTypeAny>(payload: FormData | URLSearchParams, options: { | ||
schema: Schema | ((intents: Array<Intent> | null) => Schema); | ||
export declare function parseWithZod<Schema extends ZodTypeAny>(payload: FormData | URLSearchParams, options: { | ||
schema: Schema | ((intent: Intent | null) => Schema); | ||
async?: false; | ||
errorMap?: ZodErrorMap; | ||
}): Submission<input<Schema>, string[], output<Schema>>; | ||
export declare function parse<Schema extends ZodTypeAny, Error>(payload: FormData | URLSearchParams, options: { | ||
schema: Schema | ((intents: Array<Intent> | null) => Schema); | ||
export declare function parseWithZod<Schema extends ZodTypeAny, Error>(payload: FormData | URLSearchParams, options: { | ||
schema: Schema | ((intent: Intent | null) => Schema); | ||
async?: false; | ||
@@ -14,9 +14,9 @@ errorMap?: ZodErrorMap; | ||
}): Submission<input<Schema>, Error, output<Schema>>; | ||
export declare function parse<Schema extends ZodTypeAny>(payload: FormData | URLSearchParams, options: { | ||
schema: Schema | ((intents: Array<Intent> | null) => Schema); | ||
export declare function parseWithZod<Schema extends ZodTypeAny>(payload: FormData | URLSearchParams, options: { | ||
schema: Schema | ((intent: Intent | null) => Schema); | ||
async: true; | ||
errorMap?: ZodErrorMap; | ||
}): Promise<Submission<input<Schema>, string[], output<Schema>>>; | ||
export declare function parse<Schema extends ZodTypeAny, Error>(payload: FormData | URLSearchParams, options: { | ||
schema: Schema | ((intents: Array<Intent> | null) => Schema); | ||
export declare function parseWithZod<Schema extends ZodTypeAny, Error>(payload: FormData | URLSearchParams, options: { | ||
schema: Schema | ((intent: Intent | null) => Schema); | ||
async: true; | ||
@@ -23,0 +23,0 @@ errorMap?: ZodErrorMap; |
@@ -39,7 +39,7 @@ 'use strict'; | ||
} | ||
function parse(payload, options) { | ||
function parseWithZod(payload, options) { | ||
return dom.parse(payload, { | ||
resolve(payload, intents) { | ||
resolve(payload, intent) { | ||
var errorMap = options.errorMap; | ||
var schema = coercion.enableTypeCoercion(typeof options.schema === 'function' ? options.schema(intents) : options.schema); | ||
var schema = coercion.enableTypeCoercion(typeof options.schema === 'function' ? options.schema(intent) : options.schema); | ||
var resolveSubmission = result => { | ||
@@ -102,3 +102,3 @@ var _options$formatError; | ||
exports.parse = parse; | ||
exports.parseWithZod = parseWithZod; | ||
exports.refine = refine; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40306
+ Added@conform-to/dom@1.0.0-pre.3
+ Added@conform-to/dom@1.0.0-pre.3(transitive)
- Removed@conform-to/dom@1.0.0-pre.2(transitive)