@regle/mcp-server 1.14.4 → 1.14.5
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/regle-mcp-server.js +9 -9
- package/package.json +1 -1
package/dist/regle-mcp-server.js
CHANGED
|
@@ -82,6 +82,13 @@ var docs_data_default = {
|
|
|
82
82
|
"path": "common-usage/external-errors.md",
|
|
83
83
|
"content": "# External errors\n\nRegle handles only client side errors. But some validation may need to be submitted to a server and returned to the client.\n\nTo handle this, you can use the `externalErrors` modifier.\n\nIt matches the structure of your form, but you can also use dot path to define the errors.\n\n## Basic usage\n\n```ts\nimport { type RegleExternalErrorTree, useRegle } from '@regle/core'\n\nconst form = reactive({\n email: '',\n name: {\n pseudo: '',\n },\n})\n\nconst externalErrors = ref<RegleExternalErrorTree<typeof form>>({});\n\nconst { r$ } = useRegle(\n form,\n {\n email: { required },\n name: { pseudo: { required } },\n },\n {\n externalErrors,\n }\n);\n\nasync function submit() {\n const {valid} = await r$.$validate();\n\n if (valid) {\n externalErrors.value = {\n email: [\"Email already exists\"],\n name: {\n pseudo: [\"Pseudo already exists\"]\n },\n }\n }\n}\n```\n\nResult:\n\n:::warning\n\nIf you're working with collections and server-only validations, you'll have to at least specify an empty `$each` object in the client rules to tell Regle that the array is to be treated as a collection\n\n```ts\nconst { r$ } = useRegle({collection: []}, {\n collection: {\n $each: {}\n },\n}, { externalErrors })\n\n```\n\n:::\n\n## Dot path errors\n\n`externalErrors` can also be used to handle dot path errors. \n\nIt can be handy for some backend frameworks that return errors with dot path.\n\n```ts\nimport { useRegle } from '@regle/core';\n\nconst form = reactive({\n email: '',\n name: {\n pseudo: '',\n },\n collection: [{name: ''}]\n})\n\nconst externalErrors = ref<Record<string, string[]>>({});\n\nconst { r$ } = useRegle(form, {}, { externalErrors })\n\nasync function submit() {\n const {valid} = await r$.$validate();\n\n if (valid) {\n externalErrors.value = {\n email: [\"Email already exists\"],\n \"name.pseudo\": [\"Pseudo already exists\"],\n \"collection.0.name\": [\"Name already exists\"]\n }\n }\n}\n``` \n\n## Clearing errors\n\nBy default, when you set the external errors, Regle will keep them until the form is validated or modified again.\n\nYou can modify this behavior by setting the `clearExternalErrorsOnChange` modifier to `false`.\n\n```ts\nimport { useRegle } from '@regle/core';\n\nconst { r$ } = useRegle(form, {}, { \n externalErrors, \n clearExternalErrorsOnChange: false \n})\n```\n\nYou can also clear the errors manually by calling the `$clearExternalErrors` method.\n\n```ts\nr$.$clearExternalErrors();\n```"
|
|
84
84
|
},
|
|
85
|
+
{
|
|
86
|
+
"id": "common-usage-reseting-form",
|
|
87
|
+
"title": "Reseting forms",
|
|
88
|
+
"category": "common-usage",
|
|
89
|
+
"path": "common-usage/reseting-form.md",
|
|
90
|
+
"content": "# Reseting forms\n\nRegle offers multiple options to reset a form. It depends on your use case and what you want to achieve.\n\nIt can be either:\n- Only resetting the validation state ($dirty, $invalid, $pending etc..)\n- Only resetting the form state ($value) and keeping the validation state\n- Resetting the form state to a given state and keeping the validation state\n- Resetting the form state to a given state and clearing the validation state\n- Reset both form state and validation state to a pristine state\n\n## Basic usage, with `$reset` method\n\nThe `$reset` method is available on every nested instance of field of a form. So you can reset fields individually or the whole form.\n\n### Options\n\n### `toInitialState`\n- **Type:** `boolean`\n- **Description:** \n Reset validation status and reset form state to its initial state. \n Initial state is different from the original state, as it can be mutated when using `$reset`. This serves as the base comparison for `$edited`. \n ⚠️ This doesn't work if the state is a `reactive` object.\n\n### `toOriginalState`\n- **Type:** `boolean`\n- **Description:** \n Reset validation status and reset form state to its original state. \n Original state is the unmutated state that was passed to the form when it was initialized.\n\n### `toState`\n- **Type:** `TState` or `() => TState`\n- **Description:** \n Reset validation status and reset form state to the given state. Also sets the new state as the new initial state.\n\n### `clearExternalErrors`\n- **Type:** `boolean`\n- **Description:** \n Clears the `$externalErrors` state back to an empty object.\n\n```ts\nr$.$reset(); // Only reset validation state, set the initialValue as the current value\n```\n\n```ts\nr$.$reset({ toInitialState: true }); // Reset validation state and form state to initial state\n```\n\n```ts\nr$.$reset({ toOriginalState: true }); // Reset validation state and form state to original state\n```\n\n```ts\nr$.$reset({ toState: { email: 'test@test.com' } }); // Reset validation state and form state to the given state\n```\n\n```ts\nr$.$reset({ clearExternalErrors: true }); // Clear $externalErrors state\n```\n\n## Exemple\n\n```vue\n<template>\n <input\n v-model=\"r$.$value.email\"\n :class=\"{ valid: r$.email.$correct, error: r$.email.$error }\"\n placeholder=\"Type your email\"\n />\n <ul v-if=\"r$.$errors.email.length\">\n <li v-for=\"error of r$.$errors.email\" :key=\"error\">\n {{ error }}\n </li>\n </ul>\n <div>\n <button type=\"button\" @click=\"r$.$reset()\">Reset validation state</button>\n <button type=\"button\" @click=\"r$.$reset({ toInitialState: true })\">Reset to initial state</button>\n <button type=\"button\" @click=\"r$.$reset({ toOriginalState: true })\">Reset to original state</button>\n <button type=\"button\" @click=\"r$.$reset({ toState: { email: 'test@test.com' } })\"\n >Reset to a given state</button\n >\n <button class=\"primary\" type=\"button\" @click=\"r$.$validate()\">Submit</button>\n </div>\n</template>\n\n```"
|
|
91
|
+
},
|
|
85
92
|
{
|
|
86
93
|
"id": "common-usage-standard-schema",
|
|
87
94
|
"title": "Standard Schema",
|
|
@@ -171,7 +178,7 @@ var docs_data_default = {
|
|
|
171
178
|
"title": "Validation properties",
|
|
172
179
|
"category": "core-concepts",
|
|
173
180
|
"path": "core-concepts/validation-properties.md",
|
|
174
|
-
"content": "# Validation properties\n\nValidation properties are computed values or methods available for every nested rule status, including `r$` and `regle`.\n\nLet's take a look at a simple example to explain the different properties.\n\n``` vue twoslash\n\n```\n<br/>\n\n## Computed properties for fields\n\n### `$invalid` \n- Type: `readonly boolean`\n\nIndicates whether the field is invalid. It becomes `true` if any associated rules return `false`.\n\n### `$correct` \n- Type: `readonly boolean`\n \nThis is not the opposite of `$invalid`. Correct is meant to display UI validation report. \nThis will be `true` only if:\n- The field have at least one active rule\n- Is dirty and not empty\n- Passes validation\n\n### `$dirty` \n- Type: `readonly boolean`\n \nIndicates whether a field has been validated or interacted with by the user at least once. It's typically used to determine if a message should be displayed to the user. You can change this flag manually using the `$touch` and `$reset` methods. The `$dirty` flag is considered true if the current model has been touched or if all its children are dirty. \n\n### `$anyDirty` \n- Type: `readonly boolean`\n\nSimilar to `$dirty`, with one exception. The `$anyDirty` flag is considered true if given model was touched or any of its children are `$anyDirty` which means at least one descendant is `$dirty`.\n\n### `$edited` \n- Type: `readonly boolean`\n \nIndicates whether a field has been touched and if the value is different than the initial one.\n\n### `$anyEdited` \n- Type: `readonly boolean`\n\nSimilar to `$edited`, with one exception. The $anyEdited flag is considered true if given model was edited or any of its children are $anyEdited which means at least one descendant is `$edited`.\n\n### `$value` \n- Type: `TValue` (The current property value type)\n\nA reference to the original validated model. It can be used to bind your form with `v-model`.\n\n### `$silentValue` \n- Type: `TValue` (The current property value type)\n\n`$value` variant that will not \"touch\" the field and update the value silently, running only the rules, so you can easily swap values without impacting user interaction.\n\n### `$initialValue` \n- Type: `TValue` \n\nInitial value of the field
|
|
181
|
+
"content": "# Validation properties\n\nValidation properties are computed values or methods available for every nested rule status, including `r$` and `regle`.\n\nLet's take a look at a simple example to explain the different properties.\n\n``` vue twoslash\n\n```\n<br/>\n\n## Computed properties for fields\n\n### `$invalid` \n- Type: `readonly boolean`\n\nIndicates whether the field is invalid. It becomes `true` if any associated rules return `false`.\n\n### `$correct` \n- Type: `readonly boolean`\n \nThis is not the opposite of `$invalid`. Correct is meant to display UI validation report. \nThis will be `true` only if:\n- The field have at least one active rule\n- Is dirty and not empty\n- Passes validation\n\n### `$dirty` \n- Type: `readonly boolean`\n \nIndicates whether a field has been validated or interacted with by the user at least once. It's typically used to determine if a message should be displayed to the user. You can change this flag manually using the `$touch` and `$reset` methods. The `$dirty` flag is considered true if the current model has been touched or if all its children are dirty. \n\n### `$anyDirty` \n- Type: `readonly boolean`\n\nSimilar to `$dirty`, with one exception. The `$anyDirty` flag is considered true if given model was touched or any of its children are `$anyDirty` which means at least one descendant is `$dirty`.\n\n### `$edited` \n- Type: `readonly boolean`\n \nIndicates whether a field has been touched and if the value is different than the initial one.\n\n### `$anyEdited` \n- Type: `readonly boolean`\n\nSimilar to `$edited`, with one exception. The $anyEdited flag is considered true if given model was edited or any of its children are $anyEdited which means at least one descendant is `$edited`.\n\n### `$value` \n- Type: `TValue` (The current property value type)\n\nA reference to the original validated model. It can be used to bind your form with `v-model`.\n\n### `$silentValue` \n- Type: `TValue` (The current property value type)\n\n`$value` variant that will not \"touch\" the field and update the value silently, running only the rules, so you can easily swap values without impacting user interaction.\n\n### `$initialValue` \n- Type: `TValue` \n\nInitial value of the field. This value will be set to the current `$value` when using `$reset`.\n\n### `$originalValue` \n- Type: `TValue` \n\nOriginal value of the field. This value is the unmutated state that was passed to the form when it was initialized. This value will not be mutated when using `$reset`.\n\n \n### `$pending` \n- Type: `readonly boolean`\n\nIndicates if any async rule for the field is currently running. Always `false` for synchronous rules.\n\n### `$ready` \n- Type: `readonly boolean`\n\nIndicates whether the field is ready for submission. Equivalent to `!$invalid && !$pending`.\n\n### `$error` \n- Type: `readonly boolean`\n\nConvenience flag to easily decide if a message should be displayed. Equivalent to `$dirty && !$pending && $invalid`.\n\n### `$errors` \n- Type: `readonly string[]`\n\nCollection of all the error messages, collected for all children properties and nested forms. Only contains errors from properties where $dirty equals `true`.\n\n### `$silentErrors` \n- Type: `readonly string[]`\n\nCollection of all the error messages, collected for all children properties.\n\n### `$issues` \n- Type: `RegleFieldIssue[]`\n\nCollect all metadata of validators (errors, messages etc). Only contains metadata from properties where $dirty equals true.\n\n### `$name` \n- Type: `readonly string`\n\nReturn the current key name of the field.\n\n## Common methods for fields\n\n### `$validate` \n- Type: `(forceValues?: TState) => Promise<false | SafeOutput<TState>>`\n\nSets all properties as dirty, triggering all rules. \nIt returns a promise that will either resolve to `false` or a Headless copy of your form state. Values that had the `required` rule will be transformed into a non-nullable value (type only).\n\n#### `forceValues` parameter\n\nThe first argument is optional and can be used to assign a new state before validating. It's equivalent to use `r$.$value = x` and `r$.$validate();`.\n\n### `$extractDirtyFields` \n- Type: `(filterNullishValues = true) => DeepPartial<TState>`\n\nWill return a copy of your state with only the fields that are dirty.\nBy default it will filter out nullish values or objects, but you can override it with the first parameter `$extractDirtyFields(false)`.\n\n### `$touch` \n- Type: `() => void`\n\nMarks the field and all nested properties as `$dirty`.\n\n### `$reset` \n- Type: `(options?: ResetOptions) => void`\n\nReset the validation status to a pristine state while keeping the current state.\nThe current state is treated as the new initial state.\n\n:::tip\nFor more information about the `$reset` method, check the [reseting forms section](/common-usage/reseting-form)\n:::\n\n### `$clearExternalErrors` \n- Type: `() => void`\n\nClears the $externalResults state back to an empty object.\n\n## Specific properties for fields\n\n### `$rules` \n- Type: `Record<string, RegleRuleStatus>`\n\nThis is reactive tree containing all the declared rules of your field.\nTo know more about the rule properties check the [rules properties section](/core-concepts/rules/rules-properties)\n\n \n### `$silentIssues` \n- Type: `RegleFieldIssue[]`\n\nCollect all metadata of validators (errors, messages etc).\n \n\n## Specific properties for nested objects\n\n### `$fields` \n- Type: `Record<string, RegleStatus | RegleFieldStatus | RegleCollectionStatus>`\n\nThis represents all the children of your object. You can access any nested child at any depth to get the relevant data you need for your form.\n\n## Specific properties for collections\n\nCheck documentation for [collections here](/common-usage/collections)\n\n### `$each`\n- Type: `Array<string, RegleStatus>`\n\nThis will store the status of every item in your collection. Each item will be a field you can access, or map on it to display your elements.\n\n### `$self` \n- Type: `RegleFieldStatus`\nRepresents the status of the collection itself. You can have validation rules on the array like `minLength`, this field represents the isolated status of the collection."
|
|
175
182
|
},
|
|
176
183
|
{
|
|
177
184
|
"id": "examples-advanced",
|
|
@@ -229,13 +236,6 @@ var docs_data_default = {
|
|
|
229
236
|
"path": "examples/simple.md",
|
|
230
237
|
"content": "# Simple demo\n\nYou can play with the code of this example in the stackblitz sandbox.\n\nDon't forgot to install the `Vue` extension in the online IDE.\n\n<a target='_blank' href=\"https://stackblitz.com/~/github.com/victorgarciaesgi/regle-examples/tree/main/examples/simple-example?file=examples/simple-example/src/App.vue&configPath=examples/simple-example\">\n <img\n alt=\"Open in StackBlitz\"\n src=\"https://developer.stackblitz.com/img/open_in_stackblitz.svg\"\n />\n</a>\n\n<iframe style='width: 100%; height: 700px' src=\"https://stackblitz.com/github/victorgarciaesgi/regle-examples/tree/main/examples/simple-example?embed=1&file=src%2FApp.vue&theme=dark&view=preview\" title=\"Sandbox editor\" sandbox=\"allow-modals allow-forms allow-popups allow-scripts allow-same-origin\"></iframe>"
|
|
231
238
|
},
|
|
232
|
-
{
|
|
233
|
-
"id": "index",
|
|
234
|
-
"title": "Regle - Headless form validation library for Vue.js",
|
|
235
|
-
"category": "general",
|
|
236
|
-
"path": "index.md",
|
|
237
|
-
"content": "<h2 class=\"hidden-title\">Vue validation library</h2>\n<h2 class=\"hidden-title\">Vue form library</h2>\n<h2 class=\"hidden-title\">Vue zod forms</h2>\n<h2 class=\"hidden-title\">Vue zod</h2>\n<h2 class=\"hidden-title\">Vuelidate Zod</h2>\n<h2 class=\"hidden-title\">Vuelidate alternative</h2>\n<h2 class=\"hidden-title\">Veevalidate alternative</h2>\n<h2 class=\"hidden-title\">Vueforms alternative</h2>\n<h2 class=\"hidden-title\">Tanstack forms alternative</h2>"
|
|
238
|
-
},
|
|
239
239
|
{
|
|
240
240
|
"id": "integrations-mcp-server",
|
|
241
241
|
"title": "Regle MCP server",
|
|
@@ -1663,7 +1663,7 @@ function searchApi(query) {
|
|
|
1663
1663
|
return results;
|
|
1664
1664
|
}
|
|
1665
1665
|
|
|
1666
|
-
var version = "1.14.
|
|
1666
|
+
var version = "1.14.5";
|
|
1667
1667
|
|
|
1668
1668
|
function jsonResponse(data$1) {
|
|
1669
1669
|
return { content: [{
|