Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency sveltekit-superforms to v2 #1774

Closed
wants to merge 1 commit into from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Feb 11, 2024

Mend Renovate

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
sveltekit-superforms (source) ^0.8.7 -> ^2.0.0 age adoption passing confidence

Release Notes

ciscoheat/sveltekit-superforms (sveltekit-superforms)

v2.0.0

Compare Source

Removed
  • superForm.fields was a rarely used and lesser version of formFieldProxy, switch to that instead.
  • Removed fields options when setting tainted status.
  • Remvoed message parameter in onError event, use $message directly instead.
Changed
  • Adapters required for validation! Import from sveltekit-superforms/adapters and use superValidate(zod(schema)) instead of superValidate(schema). If type parameters are used, it must now be wrapped with Infer for schemas.
  • Default superForm options now follow SvelteKit more closely: resetForm: true and taintedMessage: false are default now. Add define: { SUPERFORMS_LEGACY: true } in vite.config.ts to keep the old behavior.
  • superValidateSync is renamed to defaults. It returns default values for the schema, and does no validation anymore. Use +page.ts if initial validation is required, as described on the SPA page.
  • arrayProxy: fieldErrors renamed to valueErrors.
  • Enums must have an explicit default value in the schema.
  • Numeric enums cannot be parsed with their string values anymore.
  • Superform validator functions, previously just an object with functions, requires the superformClient adapter. The input for the validator functions can now be undefined.
  • If superValidate is called with just the schema, the default values aren't validated (i.e. no side-effects for default values) unless errors is set to true.
  • Properties with default values don't have required in their constraints anymore.
  • Form id cannot be undefined anymore, must be string. (Set automatically by default now).
  • flashMessage.onError.message option in superForm renamed to flashMessage.onError.flashMessage.
  • constraints are now optional in the SuperValidated type, and are returned only when loading data, not posting. This is only relevant if you modify constraints before calling superForm.
  • Removed the defaultValidators option, 'clear' can now be set directly on validators instead.
  • Removed the emptyIfZero setting from numberProxy and intProxy.
  • validate() called with no arguments is renamed to validateForm() and can take two extra options, update and schema.
Added
  • Support for unions in schemas. A union must have an explicit default value, and multi-type unions can only be used with dataType: 'json' set.
  • Added superForm.isTainted(path?) and superForm.isTainted($tainted) for better tainted fields check.
  • File upload support! Use withFiles when returning in form actions: return withFiles({ form }).
  • SuperDebug now displays File and FileList.
  • All proxies can now take the whole superForm object (previously only the form store was accepted), with an extra taint option to prevent tainting.
  • taintedMessage can now be an async function resolving to true if navigation should be allowed, despite the form being tainted.
  • Added an onChange event to superForm, that returns a list of modified fields whenever $form is updated.
  • Added 'zero' to the empty option of numberProxy and intProxy. Also added initiallyEmptyIfZero option, to show the placeholder for numeric inputs, which would otherwise display 0.

v1.13.4

Compare Source

Fixed
  • Error set on the server with setError didn't show up when submitting the form with an enter keypress.

v1.13.3

Compare Source

Fixed
  • Using full version of klona to address a cloning issue. (#​312)
  • Nullable nested objects couldn't be set with $form when null. (#​311)

v1.13.2

Compare Source

Fixed
  • The timers didn't reset after navigation in certain cases.
  • Exported FormPathType in top export.

v1.13.1

Compare Source

Fixed
  • Inlined cloning library, didn't work properly on Stackblitz.

v1.13.0

Compare Source

Added
  • strict option added to superValidate, to ensure that all schema fields exist. In the default non-strict mode, non-existing fields are automatically using their default value. (#​295, thanks to 21RISK for the PR)
Fixed
  • Upgraded to faster cloning library (klona)

v1.12.0

Compare Source

Added
Fixed
  • Tainted fields were set to undefined when not needed, unwantingly triggering client-side validation.
  • Schema transformations now updates the form data depending on input type. Checkboxes, radio buttons and selects updates the data immediately. Other inputs waits until blurred. (#​298)
  • In SPA mode, the novalidate attribute now only disables the browser validation constraints, not the entire client-side validation. (#​297)
  • Errors thrown in hooks are now handled properly by onError. Status will always be 500 though. (#​292)

v1.11.0

Compare Source

Added
  • A fieldErrors store is added to arrayProxy, so field errors (for items in the array, not the array itself) can be accessed.
Fixed
  • When cancelling a request, timers were cancelled too early in SPA mode and when client-side validation failed.
  • Proxies didn't set or update a nested path unless it previously existed.
  • When the taint option was set to false or untaint-all, client-side validation was prevented.
  • The novalidate and formnovalidate attributes on forms and buttons weren't respected. (#​287)

v1.10.2

Compare Source

Fixed
  • Timers weren't starting until after onSubmit, which allowed multiple form submissions on longer async operations. (#​284)
  • Fixed constraints on fields that starts with a number. (#​285)

v1.10.1

Added
  • Added arrayProxy, for proxying arrays and their errors in the form data.
  • Added FormPathArrays type, enumerating all arrays in an object as string accessors. Used to access arrayProxy in a type-safe manner.
  • formFieldProxy now has a taint option, in case a modification should not taint the form.

v1.9.0

Compare Source

Added
  • In app.d.ts, by declaring namespace App.Superforms with a type Message, status messages will always be set to that type. (#​261)
  • Added FormResult<T>, which can be used in onResult to make the ActionResult strongly typed.
  • SuperDebug now has a collapsed prop, to make it initially collapsed. Use together with collapsible. (#​279)
Fixed
  • Schema transform operations weren't applied in SPA forms and when posting to the server with client-side validators enabled.

v1.8.0

Compare Source

Fixed
  • Array errors were always added, even if the array or any data in it hadn't tainted the form.
Added

v1.7.4

Compare Source

Fixed
  • Timing issue in SPA mode displayed errors for valid data, when submitting a form by pressing enter.

v1.7.3

Compare Source

Fixed
  • SuperDebug: Collapsible bar was a submit button and didn't toggle the collapsed status properly.

v1.7.2

Compare Source

Fixed

v1.7.1

Compare Source

Fixed
  • Regression: Forms didn't display validation errors when javascript was disabled.

v1.7.0

Compare Source

Fixed
  • Type error with formFieldProxy when using a strongly typed status message. (#​260)
  • Nested Superforms validators didn't work when a field was missing compared to the schema. (#​266)
Added
  • Added preprocessed option to superValidate, for handling the processing/coercion of posted form fields manually.

v1.6.1

Compare Source

Fixed
  • Client-side validation didn't take refine into account on a successful validation, not clearing all errors.

v1.6.0

Compare Source

Fixed
  • Client-side validation wasn't resetted properly, when a component containing a form was destroyed and mounted again.
  • Removed debug statement left from 1.5.3
Added
  • Added cookieOptions to actionResult, for customizing the cookie when setting a flash message.
  • SuperDebug now has a collapsible prop, that will make the component collapsible on a per-route basis.

v1.5.3

Compare Source

Fixed
  • Array-level errors weren't typed correctly when changing the cardinality of an array field in the schema (for example with nonempty).
  • customValidity now works with select, textarea and button, not just input.
  • SuperDebug looks a bit better now when there is no css styling on the page.

v1.5.2

Compare Source

Fixed
  • Forms in components weren't resetted properly when destroyed and created again.

v1.5.1

Compare Source

Fixed
  • In rare cases, timers weren't resetted when redirecting to the same route.
  • Client-side validation was ignored when a data property was missing or didn't match the schema type. It now fails with a console error. (#​243)

v1.5.0

Compare Source

Fixed
  • A boolean schema field didn't accept a boolean false value when posted, it was coerced as true.
  • A SuperDebug truncated string showed only the whole string length, not the truncated.
Added
  • Added customValidity option to superForm, which will use the browser's validation message reporting for validation errors. More information and an example here.
  • Added emptyIfZero option to numberProxy and intProxy.

v1.4.0

Compare Source

Fixed
  • When multiple forms exists with the same id, the warning is now displayed on superForm instantiation, not just when new form data is received.
  • Fixed client-side validation for Date schema fields. (#​232)
  • numberProxy and intProxy now works with the empty option. (#​232)
  • Fixed timer state in combination with navigation events.
Added
  • Added delimiter option to numberProxy.

v1.3.0

Compare Source

Fixed
  • Fixed persisting form data when component used data from $page in combination with onDestroy. (#​164, thank you to everyone in that thread!)
  • Fixed exception message when the dataType option isn't set to 'json' and the schema contains a nested object. (#​225)
  • Superforms are now ignoring normal SvelteKit form actions when they are posted. (#​230)
Added
  • More configuration options, customizable styling, automatic promise and store support for SuperDebug, thanks to Josue!

v1.2.0

Compare Source

Added
  • The scrollToError option can now take the same parameters as scrollIntoView, which makes it work for nested scrollbars.
  • Added setError signature, to more conveniently set a form-level error: setError(form, 'Form-level error message')
Fixed
  • If the resetForm option was enabled, the form was reset even if fail was returned.

v1.1.3

Compare Source

Fixed
  • Form-level errors couldn't be overwritten.
  • Array-level errors couldn't be added with setError.
  • Native string enums weren't working when posting the actual string value.

v1.1.2

Compare Source

Added
  • Svelte 4 compatibility.

v1.1.1

Compare Source

A quick-fix for the Set feature in 1.1.0.

Fixed
  • Set comparison added in 1.1.0 wasn't fully functional.

v1.1.0

Compare Source

Added
  • Support for Set in schemas, using z.set().
Fixed
  • Nested array and object-level errors are now all cleared on a successful client-side validation. (#​196)
  • Boolean fields with a default value of true always returned true when validating.
  • Fixed infinite deep type instantiation on message. (#​143, thanks to Alisson Cavalcante Agiani)
  • Fixed typesVersions map that caused incorrect auto-import paths (#​191, thanks to CokaKoala)

v1.0.0

Compare Source

Changed
  • It's not possible to send arbitrary data to superForm anymore, a SuperValidated structure is required, which is returned from superValidate on the server and superValidateSync, so in most cases this is not a problem.
  • message/setMessage and setError can only set a status in the range 400-599.
  • As with a Zod schema with refine/superRefine/transform, array and object validation now forces the whole Zod schema to be validated client-side, not just per field.
  • The Validation type is now called SuperValidated.
  • StringPath and StringPathLeaves are renamed to FormPath and FormPathLeaves.
Removed
  • The valid option is removed from message, any status >= 400 will return a fail.
  • The $valid, $empty and $firstError stores are removed from the client, they weren't that useful. allErrors can be used instead, together with the $posted store.
  • empty is removed from SuperForm.
  • options.noErrors is removed. Use options.errors instead.
  • The virtually unused meta has been removed. Use the Zod schema directly instead for reflection.
Fixed
  • When a redirect response is received, form timers will not reset until after navigation or onDestroy.
  • Fixed prototype mismatch for Zod schemas from different modules.
  • SuperDebug color scheme updated. (Thanks to gregorymcmillan)
  • Fixed flash messages being displayed early. This update also means that at least sveltekit-flash-message 1.0.0 is required to work together with Superforms.
  • Form data was reset to its previous state when error was thrown.
  • Form-level errors can be added with setError, using an empty string as path.
  • Explicitly setting a form id for multiple forms is not required anymore when using use:enhance, unless the forms are using the same schema. An id can be specified in the options or in a hidden form field called __superform_id.
  • FieldPath is gone - the following methods are now using a string accessor like tags[2].id instead of an array like ['tags', 2, 'id']: validate, setError and all proxy methods (ending with Proxy). This also applies to generic components.
  • The signature for allErrors and firstError has changed to { path: string; messages: string[] }.
  • The literal "any" is now an allowed value in step for constraints.
  • Multiple regex and step are now allowed on a schema field. A warning will be emitted by default, that can be turned off.
  • The signature for options.resetForm has changed to boolean | () => boolean (it was async before).
  • The undocumented defaultData is now called defaultValues.
  • Added [aria-invalid="true"] to errorSelector option.
  • options.resetForm now works without use:enhance!
  • Fixed deprecation notices for use:enhance.
Added
  • New Superforms domain! https://superforms.rocks
  • Added superValidateSync, useful in components for SPA:s.
  • Added defaultValues, which takes a schema and returns the default values for it.
  • Support for ZodPipeline.
  • Arrays and objects in the schema can now have errors! They can be found at field._errors in the $errors store.
  • validate will now validate the whole form when it's called with no arguments.
  • Support for passthrough() on a schema, superValidate will allow extra keys in that case.
  • Added a posted store, a boolean which is false if the form hasn't been posted during its current lifetime.
  • reset now has an additional data option that can be used to re-populate the form with data, and id to set a different form id.
  • intProxy, numberProxy, dateProxy and stringProxy now have an empty option, so empty values can be set to null or undefined.

Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR has been generated by Mend Renovate. View repository job log here.

@renovate renovate bot force-pushed the renovate/sveltekit-superforms-2.x branch from e44befa to 6ab9152 Compare February 18, 2024 01:55
@nichenqin nichenqin temporarily deployed to renovate/sveltekit-superforms-2.x - undb PR #1774 February 18, 2024 01:55 — with Render Destroyed
@nichenqin nichenqin closed this Feb 20, 2024
Copy link
Contributor Author

renovate bot commented Feb 20, 2024

Renovate Ignore Notification

Because you closed this PR without merging, Renovate will ignore this update. You will not get PRs for any future 2.x releases. But if you manually upgrade to 2.x then Renovate will re-enable minor and patch updates automatically.

If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR.

@renovate renovate bot deleted the renovate/sveltekit-superforms-2.x branch February 20, 2024 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant