@cedarjs/forms 6.0.0-canary.2816 → 6.0.0-rc.189
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/Form.d.ts.map +1 -1
- package/dist/Form.js +1 -6
- package/dist/FormError.d.ts +2 -10
- package/dist/FormError.d.ts.map +1 -1
- package/dist/FormError.js +9 -16
- package/package.json +5 -5
package/dist/Form.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../src/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAI/E,MAAM,WAAW,SAAS,CACxB,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,CACjC,SAAQ,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7D,KAAK,CAAC,EAAE,GAAG,CAAA;IACX;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IACvE;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IACjE,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,kBAAkB,EACzB,KAAK,CAAC,EAAE,KAAK,CAAC,kBAAkB,KAC7B,IAAI,CAAA;CACV;
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../src/Form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAA;AAIzC,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAI/E,MAAM,WAAW,SAAS,CACxB,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,CACjC,SAAQ,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC;IAC7D,KAAK,CAAC,EAAE,GAAG,CAAA;IACX;;;;;;;;;;;;;;;;;;;OAmBG;IACH,WAAW,CAAC,EAAE,aAAa,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IACvE;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,CAAA;IACjE,QAAQ,CAAC,EAAE,CACT,KAAK,EAAE,kBAAkB,EACzB,KAAK,CAAC,EAAE,KAAK,CAAC,kBAAkB,KAC7B,IAAI,CAAA;CACV;AAsDD,eAAO,MAAM,IAAI,EAA4B,CAC3C,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,QAAQ,GAAG,GAAG,EACd,kBAAkB,GAAG,YAAY,EAEjC,KAAK,EAAE,SAAS,CAAC,YAAY,EAAE,QAAQ,EAAE,kBAAkB,CAAC,GAC1D,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,KACnC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAA"}
|
package/dist/Form.js
CHANGED
|
@@ -25,12 +25,7 @@ function FormInner({
|
|
|
25
25
|
/* @__PURE__ */ React.createElement(
|
|
26
26
|
ServerErrorsContext.Provider,
|
|
27
27
|
{
|
|
28
|
-
value:
|
|
29
|
-
// Apollo Client 4 stores GraphQL errors in `errors`
|
|
30
|
-
// (`CombinedGraphQLErrors`); `graphQLErrors` is the Apollo Client 3
|
|
31
|
-
// shape, kept for tests, Storybook mocks and other GraphQL clients
|
|
32
|
-
errorProps?.graphQLErrors?.[0]?.extensions?.properties?.messages || errorProps?.errors?.[0]?.extensions?.properties?.messages || {}
|
|
33
|
-
)
|
|
28
|
+
value: errorProps?.graphQLErrors?.[0]?.extensions?.properties?.messages || {}
|
|
34
29
|
},
|
|
35
30
|
/* @__PURE__ */ React.createElement(FormProvider, { ...formMethods }, children)
|
|
36
31
|
)
|
package/dist/FormError.d.ts
CHANGED
|
@@ -12,16 +12,8 @@ export interface ServerError extends Error {
|
|
|
12
12
|
}
|
|
13
13
|
export interface RWGqlError {
|
|
14
14
|
message: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
*/
|
|
18
|
-
errors?: readonly GraphQLFormattedError[];
|
|
19
|
-
/**
|
|
20
|
-
* GraphQL errors in the Apollo Client 3 shape. Kept so tests, Storybook
|
|
21
|
-
* mocks and other GraphQL clients that use this shape keep working
|
|
22
|
-
*/
|
|
23
|
-
graphQLErrors?: readonly GraphQLFormattedError[];
|
|
24
|
-
networkError?: Error | ServerParseError | ServerError | null;
|
|
15
|
+
graphQLErrors: readonly GraphQLFormattedError[];
|
|
16
|
+
networkError: Error | ServerParseError | ServerError | null;
|
|
25
17
|
}
|
|
26
18
|
export type RwGqlErrorProperties = Record<string, Record<string, string[]>>;
|
|
27
19
|
interface FormErrorProps {
|
package/dist/FormError.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormError.d.ts","sourceRoot":"","sources":["../src/FormError.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAA;AAEpD,MAAM,WAAW,gBAAiB,SAAQ,KAAK;IAC7C,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,QAAQ,EAAE,QAAQ,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAA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AC,EAAE,KAAK,CAAC,aAAa,CAAA;CACpC;AAED;;;GAGG;AACH,QAAA,MAAM,SAAS,GAAI,oIAUhB,cAAc,6BAyEhB,CAAA;AAED,eAAe,SAAS,CAAA"}
|
package/dist/FormError.js
CHANGED
|
@@ -15,21 +15,14 @@ const FormError = ({
|
|
|
15
15
|
}
|
|
16
16
|
let rootMessage = error.message;
|
|
17
17
|
const messages = [];
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const networkError = error.networkError ?? ("bodyText" in error || "result" in error ? (
|
|
21
|
-
// `RWGqlError` is a loose interface over what GraphQL clients throw;
|
|
22
|
-
// when the object has server-error fields the error itself is the
|
|
23
|
-
// network error
|
|
24
|
-
error
|
|
25
|
-
) : null);
|
|
26
|
-
const hasNetworkError = !!networkError && Object.keys(networkError).length > 0;
|
|
18
|
+
const hasGraphQLError = !!error.graphQLErrors?.[0];
|
|
19
|
+
const hasNetworkError = !!error.networkError && Object.keys(error.networkError).length > 0;
|
|
27
20
|
if (hasGraphQLError) {
|
|
28
|
-
rootMessage = graphQLErrors[0].message ?? "Something went wrong";
|
|
29
|
-
if (graphQLErrors[0]?.extensions?.code === "BAD_USER_INPUT") {
|
|
21
|
+
rootMessage = error.graphQLErrors[0].message ?? "Something went wrong";
|
|
22
|
+
if (error.graphQLErrors[0]?.extensions?.code === "BAD_USER_INPUT") {
|
|
30
23
|
rootMessage = "Errors prevented this form from being saved";
|
|
31
24
|
}
|
|
32
|
-
const properties = graphQLErrors[0].extensions?.["properties"];
|
|
25
|
+
const properties = error.graphQLErrors[0].extensions?.["properties"];
|
|
33
26
|
const propertyMessages = properties?.["messages"];
|
|
34
27
|
if (propertyMessages) {
|
|
35
28
|
for (const e in propertyMessages) {
|
|
@@ -40,11 +33,11 @@ const FormError = ({
|
|
|
40
33
|
}
|
|
41
34
|
} else if (hasNetworkError) {
|
|
42
35
|
rootMessage = rootMessage ?? "An error has occurred";
|
|
43
|
-
if ("bodyText"
|
|
44
|
-
const netErr = networkError;
|
|
36
|
+
if (Object.prototype.hasOwnProperty.call(error.networkError, "bodyText")) {
|
|
37
|
+
const netErr = error.networkError;
|
|
45
38
|
messages.push(`${netErr.name}: ${netErr.bodyText}`);
|
|
46
|
-
} else if ("result"
|
|
47
|
-
const netErr = networkError;
|
|
39
|
+
} else if (Object.prototype.hasOwnProperty.call(error.networkError, "result")) {
|
|
40
|
+
const netErr = error.networkError;
|
|
48
41
|
netErr.result.errors?.forEach((error2) => {
|
|
49
42
|
if (typeof error2.message === "string") {
|
|
50
43
|
if (error2.message.indexOf(";") >= 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/forms",
|
|
3
|
-
"version": "6.0.0-
|
|
3
|
+
"version": "6.0.0-rc.189",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/cedarjs/cedar.git",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"react-hook-form": "7.74.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@cedarjs/framework-tools": "6.0.0-
|
|
39
|
+
"@cedarjs/framework-tools": "6.0.0-rc.189",
|
|
40
40
|
"@testing-library/dom": "10.4.1",
|
|
41
41
|
"@testing-library/jest-dom": "6.9.1",
|
|
42
42
|
"@testing-library/react": "16.3.2",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"concurrently": "9.2.4",
|
|
48
48
|
"nodemon": "3.1.14",
|
|
49
49
|
"publint": "0.3.22",
|
|
50
|
-
"react": "
|
|
51
|
-
"react-dom": "
|
|
50
|
+
"react": "18.3.1",
|
|
51
|
+
"react-dom": "18.3.1",
|
|
52
52
|
"typescript": "5.9.3",
|
|
53
53
|
"vitest": "4.1.10"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
|
-
"react": "
|
|
56
|
+
"react": "18.3.1"
|
|
57
57
|
},
|
|
58
58
|
"engines": {
|
|
59
59
|
"node": ">=24"
|