@conform-to/yup 1.0.0-pre.2 → 1.0.0-pre.4

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/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
1
  import { type Constraint, type Intent, type Submission } from '@conform-to/dom';
2
2
  import * as yup from 'yup';
3
3
  export declare function getFieldsetConstraint<Source extends yup.AnyObjectSchema>(source: Source): Record<string, Constraint>;
4
- export declare function parse<Schema extends yup.AnyObjectSchema>(payload: FormData | URLSearchParams, config: {
5
- schema: Schema | ((intents: Array<Intent> | null) => Schema);
4
+ export declare function parseWithYup<Schema extends yup.AnyObjectSchema>(payload: FormData | URLSearchParams, config: {
5
+ schema: Schema | ((intent: Intent | null) => Schema);
6
6
  async?: false;
7
7
  }): Submission<yup.InferType<Schema>, string[]>;
8
- export declare function parse<Schema extends yup.AnyObjectSchema>(payload: FormData | URLSearchParams, config: {
9
- schema: Schema | ((intents: Array<Intent> | null) => Schema);
8
+ export declare function parseWithYup<Schema extends yup.AnyObjectSchema>(payload: FormData | URLSearchParams, config: {
9
+ schema: Schema | ((intent: Intent | null) => Schema);
10
10
  async: true;
11
11
  }): Promise<Submission<yup.InferType<Schema>, string[]>>;
package/index.js CHANGED
@@ -90,10 +90,10 @@ function getFieldsetConstraint(source) {
90
90
  return [key, constraint];
91
91
  }));
92
92
  }
93
- function parse(payload, config) {
93
+ function parseWithYup(payload, config) {
94
94
  return dom.parse(payload, {
95
- resolve(payload, intents) {
96
- var schema = typeof config.schema === 'function' ? config.schema(intents) : config.schema;
95
+ resolve(payload, intent) {
96
+ var schema = typeof config.schema === 'function' ? config.schema(intent) : config.schema;
97
97
  var resolveData = value => ({
98
98
  value
99
99
  });
@@ -128,4 +128,4 @@ function parse(payload, config) {
128
128
  }
129
129
 
130
130
  exports.getFieldsetConstraint = getFieldsetConstraint;
131
- exports.parse = parse;
131
+ exports.parseWithYup = parseWithYup;
package/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { invariant, parse as parse$1 } from '@conform-to/dom';
1
+ import { invariant, parse } from '@conform-to/dom';
2
2
  import * as yup from 'yup';
3
3
 
4
4
  function getFieldsetConstraint(source) {
@@ -66,10 +66,10 @@ function getFieldsetConstraint(source) {
66
66
  return [key, constraint];
67
67
  }));
68
68
  }
69
- function parse(payload, config) {
70
- return parse$1(payload, {
71
- resolve(payload, intents) {
72
- var schema = typeof config.schema === 'function' ? config.schema(intents) : config.schema;
69
+ function parseWithYup(payload, config) {
70
+ return parse(payload, {
71
+ resolve(payload, intent) {
72
+ var schema = typeof config.schema === 'function' ? config.schema(intent) : config.schema;
73
73
  var resolveData = value => ({
74
74
  value
75
75
  });
@@ -103,4 +103,4 @@ function parse(payload, config) {
103
103
  });
104
104
  }
105
105
 
106
- export { getFieldsetConstraint, parse };
106
+ export { getFieldsetConstraint, parseWithYup };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Conform helpers for integrating with yup",
4
4
  "homepage": "https://conform.guide",
5
5
  "license": "MIT",
6
- "version": "1.0.0-pre.2",
6
+ "version": "1.0.0-pre.4",
7
7
  "main": "index.js",
8
8
  "module": "index.mjs",
9
9
  "types": "index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "url": "https://github.com/edmundhung/conform/issues"
26
26
  },
27
27
  "peerDependencies": {
28
- "@conform-to/dom": "1.0.0-pre.2",
28
+ "@conform-to/dom": "1.0.0-pre.4",
29
29
  "yup": ">=0.32.0"
30
30
  },
31
31
  "devDependencies": {