From 339b750795499f1646196dd36e68925c09dd8ad9 Mon Sep 17 00:00:00 2001 From: morrys Date: Tue, 7 Nov 2023 15:27:21 +0100 Subject: [PATCH 1/4] fix example --- examples/form/package.json | 4 ++-- examples/form/src/AppNoDeps.tsx | 2 +- examples/form/src/AppReactRelayForms.tsx | 2 +- examples/form/src/AppRelayForms.tsx | 7 +------ examples/form/src/Form.tsx | 4 ++-- examples/form/src/InputDateField.tsx | 4 ++-- examples/form/src/InputField.tsx | 4 ++-- examples/form/src/InputFiles.tsx | 4 ++-- examples/form/src/SelectField.tsx | 4 ++-- examples/form/src/index.tsx | 6 +++--- examples/form/yarn.lock | 16 ++++++++-------- 11 files changed, 26 insertions(+), 31 deletions(-) diff --git a/examples/form/package.json b/examples/form/package.json index 3bc5924..6ebf25e 100644 --- a/examples/form/package.json +++ b/examples/form/package.json @@ -3,9 +3,9 @@ "version": "0.1.0", "private": true, "dependencies": { - "react-relay-forms": "^1.1.1", + "react-relay-forms": "^2.0.0", "relay-forms": "2.0.0", - "relay-forms-nodeps": "^1.1.1", + "relay-forms-nodeps": "^2.0.0", "react-relay": "14.1.0", "relay-hooks": "8.0.0", "relay-runtime": "^14.1.0", diff --git a/examples/form/src/AppNoDeps.tsx b/examples/form/src/AppNoDeps.tsx index 3b01fb7..f999f72 100644 --- a/examples/form/src/AppNoDeps.tsx +++ b/examples/form/src/AppNoDeps.tsx @@ -17,6 +17,6 @@ const App = () => { ); }; -export { useFormSetValue, useFormSubmit, useFormState, useFormValue } from 'relay-forms-nodeps'; +export { useFormField, useForm, useFormState, useFormValue } from 'relay-forms-nodeps'; export default App; diff --git a/examples/form/src/AppReactRelayForms.tsx b/examples/form/src/AppReactRelayForms.tsx index 1563916..55e447d 100644 --- a/examples/form/src/AppReactRelayForms.tsx +++ b/examples/form/src/AppReactRelayForms.tsx @@ -16,6 +16,6 @@ const App = () => { ); }; -export { useFormSetValue, useFormSubmit, useFormState, useFormValue } from 'react-relay-forms'; +export { useFormField, useForm, useFormState, useFormValue } from 'react-relay-forms'; export default App; diff --git a/examples/form/src/AppRelayForms.tsx b/examples/form/src/AppRelayForms.tsx index 872b8f0..a3c49c8 100644 --- a/examples/form/src/AppRelayForms.tsx +++ b/examples/form/src/AppRelayForms.tsx @@ -16,11 +16,6 @@ const App = () => { ); }; -export { - useFormField as useFormSetValue, - useForm as useFormSubmit, - useFormState, - useFormValue, -} from 'relay-forms'; +export { useFormField, useForm, useFormState, useFormValue } from 'relay-forms'; export default App; diff --git a/examples/form/src/Form.tsx b/examples/form/src/Form.tsx index 23f51e5..c7f6f0c 100644 --- a/examples/form/src/Form.tsx +++ b/examples/form/src/Form.tsx @@ -1,7 +1,7 @@ import { Box, BoxProps, Paper } from '@mui/material'; import * as React from 'react'; import { InputField, required, validateMinFive } from './InputField'; -import { DELAY, useFormSubmit } from './index'; +import { DELAY, useForm } from './index'; import { InputDateField } from './InputDateField'; import { InputFiles } from './InputFiles'; import { SelectField } from './SelectField'; @@ -54,7 +54,7 @@ export const FormBox: React.FunctionComponent = (props) => ( ); export const FormInternal: React.FC = ({ onSubmit }) => { - const data = useFormSubmit({ + const data = useForm({ onSubmit: async (values) => { console.log('SUBMIT :)', values); diff --git a/examples/form/src/InputDateField.tsx b/examples/form/src/InputDateField.tsx index 2886bc8..60049e7 100644 --- a/examples/form/src/InputDateField.tsx +++ b/examples/form/src/InputDateField.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { useFormSetValue } from './index'; +import { useFormField } from './index'; import { TextField as TextFieldMUI } from '@mui/material'; export type InputDateFieldType = Date | undefined; @@ -7,7 +7,7 @@ export type InputDateFieldType = Date | undefined; const initialValue = new Date(); export const InputDateField: React.FC = ({ fieldKey, placeholder }) => { - const [{ value, error }, setValue] = useFormSetValue({ + const [{ value, error }, setValue] = useFormField({ key: fieldKey, initialValue, label: placeholder, diff --git a/examples/form/src/InputField.tsx b/examples/form/src/InputField.tsx index 4dd577f..c13dbd9 100644 --- a/examples/form/src/InputField.tsx +++ b/examples/form/src/InputField.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { TextField as TextFieldMUI } from '@mui/material'; -import { DELAY, useFormSetValue } from './index'; +import { DELAY, useFormField } from './index'; import { useCallback } from 'react'; import { sleep } from './Form'; @@ -32,7 +32,7 @@ export const InputField: React.FC = ({ initialValue, validate, }) => { - const [{ error, value }, setValue] = useFormSetValue({ + const [{ error, value }, setValue] = useFormField({ key: fieldKey, validate, initialValue: initialValue ? initialValue : '', diff --git a/examples/form/src/InputFiles.tsx b/examples/form/src/InputFiles.tsx index f36e2b0..806d0bb 100644 --- a/examples/form/src/InputFiles.tsx +++ b/examples/form/src/InputFiles.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { useFormSetValue } from './index'; +import { useFormField } from './index'; import Chip from '@mui/material/Chip'; import CloudUploadIcon from '@mui/icons-material/CloudUpload'; import PublishIcon from '@mui/icons-material/Publish'; @@ -10,7 +10,7 @@ import Button from '@mui/material/Button'; import { styled } from '@mui/styles'; export const InputFiles: React.FC = ({ fieldKey, initialValue }) => { - const [{ value }, setValue] = useFormSetValue({ + const [{ value }, setValue] = useFormField({ key: fieldKey, initialValue, }); diff --git a/examples/form/src/SelectField.tsx b/examples/form/src/SelectField.tsx index 3e78a95..aeb10c3 100644 --- a/examples/form/src/SelectField.tsx +++ b/examples/form/src/SelectField.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import { useFormSetValue } from './index'; +import { useFormField } from './index'; import { useCallback } from 'react'; import TextField from '@mui/material/TextField'; @@ -20,7 +20,7 @@ export const SelectField: React.FC = ({ width = 330, initialValue = 'None', }) => { - const [{ error, value }, setValue] = useFormSetValue({ + const [{ error, value }, setValue] = useFormField({ key: fieldKey, validate, initialValue, diff --git a/examples/form/src/index.tsx b/examples/form/src/index.tsx index 317da87..0f5f071 100644 --- a/examples/form/src/index.tsx +++ b/examples/form/src/index.tsx @@ -4,11 +4,11 @@ import ReactDOM from 'react-dom'; import './index.css'; //import App from './AppNoDeps'; -//export { useFormSetValue, useFormSubmit, useFormState, useFormValue } from './AppNoDeps'; +//export { useFormField, useForm, useFormState, useFormValue } from './AppNoDeps'; //import App from './AppReactRelayForms'; -//export { useFormSetValue, useFormSubmit, useFormState, useFormValue } from './AppReactRelayForms'; +//export { useFormField, useForm, useFormState, useFormValue } from './AppReactRelayForms'; import App from './AppRelayForms'; -export { useFormSetValue, useFormSubmit, useFormState, useFormValue } from './AppRelayForms'; +export { useFormField, useForm, useFormState, useFormValue } from './AppRelayForms'; // eslint-disable-next-line import/first import * as serviceWorker from './serviceWorker'; diff --git a/examples/form/yarn.lock b/examples/form/yarn.lock index f77c5b0..552f9f6 100644 --- a/examples/form/yarn.lock +++ b/examples/form/yarn.lock @@ -7758,10 +7758,10 @@ react-refresh@^0.11.0: resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.11.0.tgz#77198b944733f0f1f1a90e791de4541f9f074046" integrity sha512-F27qZr8uUqwhWZboondsPx8tnC3Ct3SxZA3V5WyEvujRyyNv0VYPhoBg1gZ8/MV5tubQp76Trw8lTv9hzRBa+A== -react-relay-forms@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/react-relay-forms/-/react-relay-forms-1.1.1.tgz#a1f54c87fd8dcc0336840daf46b17042b4981eab" - integrity sha512-dCCDL+7By6Bms9C3b2DJAhyl/y2H6lfF3KjMIk1mt6sb8kTYHPNXvNJVqKVpnAQBtZBACN7WyKwc88Do+TLHHg== +react-relay-forms@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/react-relay-forms/-/react-relay-forms-2.0.0.tgz#7e573b686e2d4c6628dcaea7958f8bca9a2dc6f5" + integrity sha512-xzVKBahGE0oF52Yrs66IztQI1e7XftvRdDTrDGw1AdvEm0gwi4OYbEba4lXv07rilRBPmlCHyeu3m662bW68Cw== react-relay@14.1.0: version "14.1.0" @@ -7962,10 +7962,10 @@ relateurl@^0.2.7: resolved "https://registry.yarnpkg.com/relateurl/-/relateurl-0.2.7.tgz#54dbf377e51440aca90a4cd274600d3ff2d888a9" integrity sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog== -relay-forms-nodeps@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/relay-forms-nodeps/-/relay-forms-nodeps-1.1.1.tgz#39072c0ed077746c73a7c03d129125b45df93142" - integrity sha512-5SOME+8Yfor+RwjNNEKAY2cAcYtYKx12aw4gE1HoYkdBqDKJ8dm8Bcl7XNQiQ4V5Vg6MQQqIquaxfau09/ODDg== +relay-forms-nodeps@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/relay-forms-nodeps/-/relay-forms-nodeps-2.0.0.tgz#ca531e568e20ecf40a6b5ab1f2f1d87e919f3d6f" + integrity sha512-eXgCQTee0amV08sTjmQ1eJtzP6dAC68ujz7Zn1LKFxZZu8C7X0E54rvwJOcU8BVSNP5x9NC2pPmykySvBs5vCw== relay-forms@2.0.0: version "2.0.0" From 6763d0375f4c5ad436e2bd736b947df072ceff8a Mon Sep 17 00:00:00 2001 From: morrys Date: Tue, 14 Nov 2023 17:18:07 +0100 Subject: [PATCH 2/4] added dependsOn in useFormField --- examples/form/src/Form.tsx | 7 ++- examples/form/src/InputField.tsx | 9 +++- package.json | 2 +- src/RelayFormsTypes.ts | 1 + src/relay/queryErrorsFieldQuery.graphql.ts | 4 +- src/relay/queryFieldQuery.graphql.ts | 4 +- src/useFormField.tsx | 63 ++++++++++++++++++---- 7 files changed, 73 insertions(+), 17 deletions(-) diff --git a/examples/form/src/Form.tsx b/examples/form/src/Form.tsx index c7f6f0c..b053d19 100644 --- a/examples/form/src/Form.tsx +++ b/examples/form/src/Form.tsx @@ -73,7 +73,12 @@ export const FormInternal: React.FC = ({ onSubmit }) => { sx={{ mt: 1, paddingTop: '15px' }} > - + None diff --git a/examples/form/src/InputField.tsx b/examples/form/src/InputField.tsx index c13dbd9..4d828b0 100644 --- a/examples/form/src/InputField.tsx +++ b/examples/form/src/InputField.tsx @@ -11,9 +11,11 @@ export function required(value: string) { return undefined; } -export async function validateMinFive(value: string) { +export async function validateMinFive(value: string, others: any) { + console.log('others', others); + const first = others.firstName.value; await sleep(DELAY.validate); - if (value && value.length < 5) { + if ((value && value.length < 5) || (first && first.length < 4)) { return 'Wrong length, minimum 5 current ' + value.length + ' (' + value + ')'; } return undefined; @@ -24,6 +26,7 @@ type TextFieldProps = { fieldKey: string; initialValue?: string; validate?: (value: string) => string | undefined | Promise; + dependsOn?: ReadonlyArray; }; export const InputField: React.FC = ({ @@ -31,12 +34,14 @@ export const InputField: React.FC = ({ fieldKey, initialValue, validate, + dependsOn, }) => { const [{ error, value }, setValue] = useFormField({ key: fieldKey, validate, initialValue: initialValue ? initialValue : '', label: placeholder, + dependsOn, //validateOnChange: true, }); diff --git a/package.json b/package.json index f2cc9a4..a61d001 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "relay-forms", - "version": "2.0.0", + "version": "2.1.0", "keywords": [ "forms", "relay", diff --git a/src/RelayFormsTypes.ts b/src/RelayFormsTypes.ts index 49dcd85..9d465eb 100644 --- a/src/RelayFormsTypes.ts +++ b/src/RelayFormsTypes.ts @@ -16,6 +16,7 @@ export type FormSetValueOptions = { validate?: (value: ValueType) => Promise | string | undefined; validateOnChange?: boolean; label?: string; + dependsOn?: ReadonlyArray | null | undefined; }; export type FormSetValueStateReturn = { diff --git a/src/relay/queryErrorsFieldQuery.graphql.ts b/src/relay/queryErrorsFieldQuery.graphql.ts index 00b6159..55e792a 100644 --- a/src/relay/queryErrorsFieldQuery.graphql.ts +++ b/src/relay/queryErrorsFieldQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<<5a0e2c9c0f979fb24973c3cb36a508ca>> + * @generated SignedSource<> * @relayHash 1e729a4dd469bbcedf1c07919286ff70 * @lightSyntaxTransform * @nogrep @@ -131,7 +131,7 @@ return { "selections": (v0/*: any*/) }, "params": { - "id": "1e729a4dd469bbcedf1c07919286ff70\r", + "id": "1e729a4dd469bbcedf1c07919286ff70", "metadata": {}, "name": "queryErrorsFieldQuery", "operationKind": "query", diff --git a/src/relay/queryFieldQuery.graphql.ts b/src/relay/queryFieldQuery.graphql.ts index 51e12b1..65c9b69 100644 --- a/src/relay/queryFieldQuery.graphql.ts +++ b/src/relay/queryFieldQuery.graphql.ts @@ -1,5 +1,5 @@ /** - * @generated SignedSource<> + * @generated SignedSource<> * @relayHash 0b493a6f66e132f2693f91a5da941414 * @lightSyntaxTransform * @nogrep @@ -107,7 +107,7 @@ return { "selections": (v0/*: any*/) }, "params": { - "id": "0b493a6f66e132f2693f91a5da941414\r", + "id": "0b493a6f66e132f2693f91a5da941414", "metadata": {}, "name": "queryFieldQuery", "operationKind": "query", diff --git a/src/useFormField.tsx b/src/useFormField.tsx index 43275cd..bf6fb57 100644 --- a/src/useFormField.tsx +++ b/src/useFormField.tsx @@ -3,6 +3,9 @@ import { useRelayEnvironment } from 'relay-hooks'; import { useForceUpdate } from 'relay-hooks/lib/useForceUpdate'; import { Snapshot, isPromise, IEnvironment } from 'relay-runtime'; import FragmentField, { queryFieldFragment$data } from './relay/queryFieldFragment.graphql'; +import FragmentValueField, { + queryValueFieldFragment$data, +} from './relay/queryValueFieldFragment.graphql'; import { FormSetValueOptions, FormSetValueReturn, @@ -39,12 +42,28 @@ export function isDone(check): boolean { } function logicSetValue(params: LogicParams): LogicReturn { - const { environment, key, initialValue, forceUpdate, validateOnChange, label } = params; + const { + environment, + key, + initialValue, + forceUpdate, + validateOnChange, + label, + dependsOn, + } = params; let validate = undefined; let firstSet = true; + let deps = {}; const localId = getFieldId(key); - function getValidate(): (value: ValueType) => Promise | string | undefined { + function getDeps(): any { + return deps; + } + + function getValidate(): ( + value: ValueType, + deps?: ReadonlyArray, + ) => Promise | string | undefined { return validate; } const ref = { @@ -129,13 +148,18 @@ function logicSetValue(params: LogicParams): LogicReturn(params: LogicParams): LogicReturn { + const snapshot = getSnapshot(environment, FragmentValueField, depKey); + const disposeDep = environment.subscribe(snapshot, (s: Snapshot) => { + const data: queryValueFieldFragment$data = (s as any).data; + deps = { + ...deps, + [depKey]: data, + }; + if (ref.check == DONEVALIDATED && !ref.isChecking) { + ref.check = VALIDATING; + commitField(false); + } + }).dispose; + disposeDeps.push(disposeDep); + }); + } const dispose = (): void => { disposeSubscrition(); @@ -173,10 +215,11 @@ function logicSetValue(params: LogicParams): LogicReturn dispose); }; if (validateOnChange) { - internalValidate(initialValue, getValidate()); + internalValidate(initialValue, getValidate(), deps); } return dispose; } @@ -195,6 +238,7 @@ export function useFormField({ validate, validateOnChange, label, + dependsOn, }: FormSetValueOptions): FormSetValueReturn { const forceUpdate = useForceUpdate(); const environment = useRelayEnvironment(); @@ -207,8 +251,9 @@ export function useFormField({ initialValue, forceUpdate, validateOnChange, + dependsOn, }); - }, [environment, key, initialValue, forceUpdate, validateOnChange, label]); + }, [environment, key, initialValue, forceUpdate, validateOnChange, label, dependsOn]); resolver.setValidate(validate); From 5257a66c6fbc6f7ef7c976c74ab22a4892f0cb7a Mon Sep 17 00:00:00 2001 From: morrys Date: Tue, 14 Nov 2023 17:42:35 +0100 Subject: [PATCH 3/4] added ValidateFunction Type --- package.json | 2 +- src/RelayFormsTypes.ts | 7 ++++++- src/useFormField.tsx | 6 ++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index a61d001..76defde 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "relay-forms", - "version": "2.1.0", + "version": "2.1.1", "keywords": [ "forms", "relay", diff --git a/src/RelayFormsTypes.ts b/src/RelayFormsTypes.ts index 9d465eb..3bd8e84 100644 --- a/src/RelayFormsTypes.ts +++ b/src/RelayFormsTypes.ts @@ -10,10 +10,15 @@ export type FormSubmitReturn = { reset: () => void; }; +export type ValidateFunction = ( + value: ValueType, + deps?: { [key: string]: FormValueStateReturn }, +) => Promise | string | undefined; + export type FormSetValueOptions = { key: string; initialValue?: ValueType; - validate?: (value: ValueType) => Promise | string | undefined; + validate?: ValidateFunction; validateOnChange?: boolean; label?: string; dependsOn?: ReadonlyArray | null | undefined; diff --git a/src/useFormField.tsx b/src/useFormField.tsx index bf6fb57..2ffadee 100644 --- a/src/useFormField.tsx +++ b/src/useFormField.tsx @@ -10,6 +10,7 @@ import { FormSetValueOptions, FormSetValueReturn, FormSetValueStateReturn, + ValidateFunction, } from './RelayFormsTypes'; import { getSnapshot, getFieldId, commit } from './Utils'; @@ -60,10 +61,7 @@ function logicSetValue(params: LogicParams): LogicReturn, - ) => Promise | string | undefined { + function getValidate(): ValidateFunction { return validate; } const ref = { From 21e0c10a18cd36418c3aea99bb792ccd018501f8 Mon Sep 17 00:00:00 2001 From: morrys Date: Tue, 26 Nov 2024 11:38:46 +0100 Subject: [PATCH 4/4] update relay-runtime perrDependencies --- examples/form/package.json | 2 +- examples/form/yarn.lock | 8 +-- package-lock.json | 112 ++++++++++++++++++------------------- package.json | 16 +++--- 4 files changed, 69 insertions(+), 69 deletions(-) diff --git a/examples/form/package.json b/examples/form/package.json index 6ebf25e..214e610 100644 --- a/examples/form/package.json +++ b/examples/form/package.json @@ -4,7 +4,7 @@ "private": true, "dependencies": { "react-relay-forms": "^2.0.0", - "relay-forms": "2.0.0", + "relay-forms": "2.1.1", "relay-forms-nodeps": "^2.0.0", "react-relay": "14.1.0", "relay-hooks": "8.0.0", diff --git a/examples/form/yarn.lock b/examples/form/yarn.lock index 552f9f6..95258c0 100644 --- a/examples/form/yarn.lock +++ b/examples/form/yarn.lock @@ -7967,10 +7967,10 @@ relay-forms-nodeps@^2.0.0: resolved "https://registry.yarnpkg.com/relay-forms-nodeps/-/relay-forms-nodeps-2.0.0.tgz#ca531e568e20ecf40a6b5ab1f2f1d87e919f3d6f" integrity sha512-eXgCQTee0amV08sTjmQ1eJtzP6dAC68ujz7Zn1LKFxZZu8C7X0E54rvwJOcU8BVSNP5x9NC2pPmykySvBs5vCw== -relay-forms@2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/relay-forms/-/relay-forms-2.0.0.tgz#86d1dde749ac33ca8a6cc11fe278051da6b6f49a" - integrity sha512-4WbYMt54w8UcO4PU3aVbIFeq17njsUvwM8lbpvKnGppwqvtXNWwEe+I4uuli7dTOURhLthU+x5utNWxUbCeauA== +relay-forms@2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/relay-forms/-/relay-forms-2.1.1.tgz#fa30e2631c59f3f3eb29a871e0ff3ceec7037816" + integrity sha512-CZiiNTpgns1C/7qeb/KKx2e67jP6+d+8CVKZiBQOWg8YLQlOoonOqDN8k6BLvD5aIET5GG8bwX67j8MujdMbVw== relay-hooks@8.0.0: version "8.0.0" diff --git a/package-lock.json b/package-lock.json index 3b6eb3c..4f35950 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "relay-forms", - "version": "2.0.0", + "version": "2.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "relay-forms", - "version": "2.0.0", + "version": "2.2.0", "license": "MIT", "devDependencies": { "@babel/cli": "^7.8.3", @@ -42,12 +42,12 @@ "react": "^18.0.0", "react-dom": "^18.0.0", "react-test-renderer": "^18.0.0", - "relay-compiler": "^14.0.0", + "relay-compiler": "^17.0.0", "relay-compiler-language-typescript": "12.0.0", - "relay-hooks": "^7.2.0", - "relay-runtime": "^14.0.0", - "relay-test-utils": "^14.0.0", - "relay-test-utils-internal": "^14.0.0", + "relay-hooks": "^9.1.0", + "relay-runtime": "^17.0.0", + "relay-test-utils": "^17.0.0", + "relay-test-utils-internal": "^17.0.0", "replace-in-file": "6.2.0", "rimraf": "^2.5.4", "rollup": "^2.23.0", @@ -59,8 +59,8 @@ }, "peerDependencies": { "react": "^16.9.0 || ^17 || ^18", - "relay-hooks": "^7.2.0 || ^8.0.0", - "relay-runtime": "^13.0.2 || ^14.0.0 || ^15.0.0" + "relay-hooks": "^7.2.0 || ^8.0.0 || ^9.0.0", + "relay-runtime": "^13.0.2 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" } }, "node_modules/@ampproject/remapping": { @@ -1558,12 +1558,12 @@ "optional": true }, "node_modules/@restart/hooks": { - "version": "0.3.27", - "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.3.27.tgz", - "integrity": "sha512-s984xV/EapUIfkjlf8wz9weP2O9TNKR96C68FfMEy2bE69+H4cNv3RD4Mf97lW7Htt7PjZrYTjSC8f3SB9VCXw==", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.16.tgz", + "integrity": "sha512-f7aCv7c+nU/3mF7NWLtVVr0Ra80RqsO89hO72r+Y/nvQr5+q0UFGkocElTH6MJApvReVh6JHUFYn2cw1WdHF3w==", "dev": true, "dependencies": { - "dequal": "^2.0.2" + "dequal": "^2.0.3" }, "peerDependencies": { "react": ">=16.8.0" @@ -8152,9 +8152,9 @@ } }, "node_modules/relay-compiler": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/relay-compiler/-/relay-compiler-14.1.0.tgz", - "integrity": "sha512-P8+CXm+Hq96z5NNwYl7hyGo5GgvMZDs9mXBRv7txUbJO4Ql9mXio3+D9EX3VfevRWTuE4ahM37i3Ssx1H604vA==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/relay-compiler/-/relay-compiler-17.0.0.tgz", + "integrity": "sha512-U2e/R0o40HJOQ13pwkvToqWqk6J3ASMyHmcxixVMZKfcwcpsTTOiKob215ZRh+4bqPwkNy97+V9CuzJ5hJmGtw==", "dev": true, "bin": { "relay-compiler": "cli.js" @@ -8178,20 +8178,20 @@ } }, "node_modules/relay-hooks": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/relay-hooks/-/relay-hooks-7.2.0.tgz", - "integrity": "sha512-5yBnAtjnxTPXArITn8oCqBqAIkYm06KykNWRY8cJCWFoBqBWbA2ygZ5AfOcsgNZk3cg1cEXxRzqj68vbDrr9TQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/relay-hooks/-/relay-hooks-9.1.0.tgz", + "integrity": "sha512-cmglzQ49AZDJ9hn75IQR0KEjuMjjKvFUfrrCRfXUNEAH3ReyBjh2t1GFFfYdmr0lPjy5eV8YqGSE38I84HTf0Q==", "dev": true, "dependencies": { - "@restart/hooks": "^0.3.1", - "fbjs": "^3.0.0" + "@restart/hooks": "^0.4.9", + "fbjs": "^3.0.2" }, "funding": { "url": "https://github.com/sponsors/morrys" }, "peerDependencies": { "react": "^16.9.0 || ^17 || ^18", - "relay-runtime": "^13.0.2 || ^14.0.0" + "relay-runtime": "^16.0.0 || ^17.0.0 " } }, "node_modules/relay-hooks/node_modules/fbjs": { @@ -8210,9 +8210,9 @@ } }, "node_modules/relay-runtime": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/relay-runtime/-/relay-runtime-14.1.0.tgz", - "integrity": "sha512-t2DR2hZviHrdEQrOvFqwmvRWvZ0SjI/r4bS5f3qvMyXt4g1kw3RTb2RNVmbKGg6zEQhf7Na/brdqE4roApmclQ==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/relay-runtime/-/relay-runtime-17.0.0.tgz", + "integrity": "sha512-7b2R3G3DP7VHq7/1ltwQfYn3KkTHIB2NNt3KijIZoNQ73avwpOXBEL0MelSXwq8L+K8lcgAW5VAT7o0LUhnJPQ==", "dev": true, "dependencies": { "@babel/runtime": "^7.0.0", @@ -8236,26 +8236,26 @@ } }, "node_modules/relay-test-utils": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/relay-test-utils/-/relay-test-utils-14.1.0.tgz", - "integrity": "sha512-4Ftqc+LnHyhqU2LNOtD/UEqqutFF9qJn+xqn+xfxgUGjU4X42vVhAN8KdG3q4KqE142EX0S8oPX5kA0FyFFiWg==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/relay-test-utils/-/relay-test-utils-17.0.0.tgz", + "integrity": "sha512-u6mv7P1bmMP1Ex5uxSaUu0pJMXEs/0c8Y3LPHyfPTQ9LghMd6OtPP/45C2Z8vczMxhDIZivQM+8KwrjC25CwEg==", "dev": true, "dependencies": { "@babel/runtime": "^7.0.0", "fbjs": "^3.0.2", "invariant": "^2.2.4", - "relay-runtime": "14.1.0" + "relay-runtime": "17.0.0" } }, "node_modules/relay-test-utils-internal": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/relay-test-utils-internal/-/relay-test-utils-internal-14.1.0.tgz", - "integrity": "sha512-8cxSjqzF4yiawWdM6cCGY94NBF84lYmcgSrv4a4lTvspvfxsz4twQehZA9t2eudNRcNQB3Z2zt7XbZyx2flRlw==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/relay-test-utils-internal/-/relay-test-utils-internal-17.0.0.tgz", + "integrity": "sha512-FbpHC62Gc1MXYtdC8mA2ebrFErUu+6ukm3Z1Ge1aFCMNs6MVvQlTcgIs7vuj7YNdcw9xbosimVrSgyvJraCD7w==", "dev": true, "dependencies": { "@babel/runtime": "^7.0.0", "fbjs": "^3.0.2", - "relay-runtime": "14.1.0" + "relay-runtime": "17.0.0" } }, "node_modules/relay-test-utils-internal/node_modules/fbjs": { @@ -11867,12 +11867,12 @@ "optional": true }, "@restart/hooks": { - "version": "0.3.27", - "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.3.27.tgz", - "integrity": "sha512-s984xV/EapUIfkjlf8wz9weP2O9TNKR96C68FfMEy2bE69+H4cNv3RD4Mf97lW7Htt7PjZrYTjSC8f3SB9VCXw==", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/@restart/hooks/-/hooks-0.4.16.tgz", + "integrity": "sha512-f7aCv7c+nU/3mF7NWLtVVr0Ra80RqsO89hO72r+Y/nvQr5+q0UFGkocElTH6MJApvReVh6JHUFYn2cw1WdHF3w==", "dev": true, "requires": { - "dequal": "^2.0.2" + "dequal": "^2.0.3" } }, "@rollup/plugin-babel": { @@ -16989,9 +16989,9 @@ "dev": true }, "relay-compiler": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/relay-compiler/-/relay-compiler-14.1.0.tgz", - "integrity": "sha512-P8+CXm+Hq96z5NNwYl7hyGo5GgvMZDs9mXBRv7txUbJO4Ql9mXio3+D9EX3VfevRWTuE4ahM37i3Ssx1H604vA==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/relay-compiler/-/relay-compiler-17.0.0.tgz", + "integrity": "sha512-U2e/R0o40HJOQ13pwkvToqWqk6J3ASMyHmcxixVMZKfcwcpsTTOiKob215ZRh+4bqPwkNy97+V9CuzJ5hJmGtw==", "dev": true }, "relay-compiler-language-typescript": { @@ -17005,13 +17005,13 @@ } }, "relay-hooks": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/relay-hooks/-/relay-hooks-7.2.0.tgz", - "integrity": "sha512-5yBnAtjnxTPXArITn8oCqBqAIkYm06KykNWRY8cJCWFoBqBWbA2ygZ5AfOcsgNZk3cg1cEXxRzqj68vbDrr9TQ==", + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/relay-hooks/-/relay-hooks-9.1.0.tgz", + "integrity": "sha512-cmglzQ49AZDJ9hn75IQR0KEjuMjjKvFUfrrCRfXUNEAH3ReyBjh2t1GFFfYdmr0lPjy5eV8YqGSE38I84HTf0Q==", "dev": true, "requires": { - "@restart/hooks": "^0.3.1", - "fbjs": "^3.0.0" + "@restart/hooks": "^0.4.9", + "fbjs": "^3.0.2" }, "dependencies": { "fbjs": { @@ -17032,9 +17032,9 @@ } }, "relay-runtime": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/relay-runtime/-/relay-runtime-14.1.0.tgz", - "integrity": "sha512-t2DR2hZviHrdEQrOvFqwmvRWvZ0SjI/r4bS5f3qvMyXt4g1kw3RTb2RNVmbKGg6zEQhf7Na/brdqE4roApmclQ==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/relay-runtime/-/relay-runtime-17.0.0.tgz", + "integrity": "sha512-7b2R3G3DP7VHq7/1ltwQfYn3KkTHIB2NNt3KijIZoNQ73avwpOXBEL0MelSXwq8L+K8lcgAW5VAT7o0LUhnJPQ==", "dev": true, "requires": { "@babel/runtime": "^7.0.0", @@ -17060,15 +17060,15 @@ } }, "relay-test-utils": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/relay-test-utils/-/relay-test-utils-14.1.0.tgz", - "integrity": "sha512-4Ftqc+LnHyhqU2LNOtD/UEqqutFF9qJn+xqn+xfxgUGjU4X42vVhAN8KdG3q4KqE142EX0S8oPX5kA0FyFFiWg==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/relay-test-utils/-/relay-test-utils-17.0.0.tgz", + "integrity": "sha512-u6mv7P1bmMP1Ex5uxSaUu0pJMXEs/0c8Y3LPHyfPTQ9LghMd6OtPP/45C2Z8vczMxhDIZivQM+8KwrjC25CwEg==", "dev": true, "requires": { "@babel/runtime": "^7.0.0", "fbjs": "^3.0.2", "invariant": "^2.2.4", - "relay-runtime": "14.1.0" + "relay-runtime": "17.0.0" }, "dependencies": { "fbjs": { @@ -17089,14 +17089,14 @@ } }, "relay-test-utils-internal": { - "version": "14.1.0", - "resolved": "https://registry.npmjs.org/relay-test-utils-internal/-/relay-test-utils-internal-14.1.0.tgz", - "integrity": "sha512-8cxSjqzF4yiawWdM6cCGY94NBF84lYmcgSrv4a4lTvspvfxsz4twQehZA9t2eudNRcNQB3Z2zt7XbZyx2flRlw==", + "version": "17.0.0", + "resolved": "https://registry.npmjs.org/relay-test-utils-internal/-/relay-test-utils-internal-17.0.0.tgz", + "integrity": "sha512-FbpHC62Gc1MXYtdC8mA2ebrFErUu+6ukm3Z1Ge1aFCMNs6MVvQlTcgIs7vuj7YNdcw9xbosimVrSgyvJraCD7w==", "dev": true, "requires": { "@babel/runtime": "^7.0.0", "fbjs": "^3.0.2", - "relay-runtime": "14.1.0" + "relay-runtime": "17.0.0" }, "dependencies": { "fbjs": { diff --git a/package.json b/package.json index 76defde..239f563 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "relay-forms", - "version": "2.1.1", + "version": "2.2.0", "keywords": [ "forms", "relay", @@ -52,8 +52,8 @@ }, "peerDependencies": { "react": "^16.9.0 || ^17 || ^18", - "relay-runtime": "^13.0.2 || ^14.0.0 || ^15.0.0", - "relay-hooks": "^7.2.0 || ^8.0.0" + "relay-runtime": "^13.0.2 || ^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", + "relay-hooks": "^7.2.0 || ^8.0.0 || ^9.0.0" }, "devDependencies": { "@babel/cli": "^7.8.3", @@ -68,13 +68,13 @@ "@types/react": "18.0.26", "@types/react-dom": "18.0.10", "@types/relay-runtime": "^14.0.0", - "relay-runtime": "^14.0.0", - "relay-compiler": "^14.0.0", - "relay-hooks": "^7.2.0", + "relay-runtime": "^17.0.0", + "relay-compiler": "^17.0.0", + "relay-hooks": "^9.1.0", "replace-in-file": "6.2.0", "react-test-renderer": "^18.0.0", - "relay-test-utils": "^14.0.0", - "relay-test-utils-internal": "^14.0.0", + "relay-test-utils": "^17.0.0", + "relay-test-utils-internal": "^17.0.0", "@types/jest": "24.0.18", "ts-jest": "^26.5.6", "jest": "^26.0.0",