@regle/mcp-server 1.19.11 → 1.19.13
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 +8 -8
- package/package.json +1 -1
package/dist/regle-mcp-server.js
CHANGED
|
@@ -132,7 +132,7 @@ var docs_data_default = {
|
|
|
132
132
|
"title": "Modifiers",
|
|
133
133
|
"category": "core-concepts",
|
|
134
134
|
"path": "core-concepts/modifiers.md",
|
|
135
|
-
"content": "# Modifiers\n\nModifiers allow you to control the behavior and settings of validation rules in your application. They can be applied globally to all fields or customized per field.\n\n## Deep modifiers\n\nDeep modifiers are specified as the third argument of the `useRegle` composable. They apply recursively to all fields within your state.\n\n```ts\nconst { r$ } = useRegle({}, {}, {\n /* modifiers */\n})\n```\n\n### `autoDirty`\n\n__Type__: `boolean`\n\n__Default__: `true`\n\nAutomatically set the dirty set without the need of `$value` or `$touch`.\n\n### `immediateDirty`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\nSet the dirty state to true when the form is initialized.\n\n### `silent`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\nRegle Automatically tracks changes in the state for all nested rules. If set to `true`, you must manually call `$touch` or `$validate` to display errors.\n\n### `lazy`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\nUsage:\n\nWhen set to false, tells the rules to be called on init, otherwise they are lazy and only called when the field is dirty.\n\n### `externalErrors`\n\n__Type__: `RegleExternalErrorTree<State>` \n\nPass an object, matching your error state, that holds external validation errors. These can be from a backend validations or something else.\n\nCheck the [External errors](/common-usage/external-errors) section for more details.\n\n### `rewardEarly`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\n__Side effect__: disable `$autoDirty` when `true`.\n\nEnables the `reward-early-punish-late` mode of Regle. This mode will not set fields as invalid once they are valid, unless manually triggered by `$validate` method.\n\nThis will have no effect only if you use `autoDirty: true`.\n\n### `clearExternalErrorsOnChange`\n\n__Type__: `boolean`\n\n__Default__: `true`\n\nThis mode is similar to `rewardEarly`, but only applies to external errors.\nSetting it to `false` will keep the server errors until `$clearExternalErrors` is called.\n\n### `clearExternalErrorsOnValidate`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\nThis mode is similar to `clearExternalErrorsOnChange`, but for the `$validate` and `$validateSync` methods.\nSetting it to `false` will keep the server errors until `$clearExternalErrors` is called manually, or the `externalErrors` is set again.\n\n### `validationGroups`\n\n__Type__: `(fields) => Record<string, (RegleFieldStatus |RegleCollectionStatus)[]>`\n\nValidation groups let you merge field properties under one, to better handle validation status.\n\nYou will have access to your declared groups in the `r$.$groups` object.\n\n```ts twoslash\n\nimport { ref } from 'vue';\n// ---cut---\nimport { useRegle } from '@regle/core';\nimport { required } from '@regle/rules';\n\nconst { r$ } = useRegle({ email: '', user: { firstName: '' } }, {\n email: { required },\n user: {\n firstName: { required },\n }\n}, {\n validationGroups: (fields) => ({\n group1: [fields.email, fields.user.firstName]\n })\n})\n\nr$.$groups.group1.\n\n```\n<br><br><br><br>\n\n## Per-field modifiers\n\nPer-field modifiers allow to customize more precisely which behavior you want for each field.\n\n```ts twoslash\n\nimport { useRegle } from '@regle/core';\n// ---cut---\nconst { r$ } = useRegle({ name: '' }, {\n name: { $ }\n\n})\n```\n\n<br><br>\n\n`$autoDirty` `$lazy`, `$silent`, `$immediateDirty` and `$rewardEarly` work the same as the deep modifiers.\n\n### `$debounce`\nType: `number` (ms)\n\nThis let you declare the number of milliseconds the rule needs to wait before executing. Useful for async or heavy computations.\n\n:::tip\nAll async rules have a default debounce of `200ms`, you can disable or modify this setting with `$debounce`\n:::\n\n### `$isEdited`\nType: `(currentValue: MaybeInput<TValue>, initialValue: MaybeInput<TValue>, defaultHandlerFn: (currentValue: unknown, initialValue: unknown) => boolean) => boolean`\n\nOverride the default `$edited` property handler. Useful to handle custom comparisons for complex object types.\n\n:::warning\nIt's highly recommended to use this modifier with the [`markStatic`](/advanced-usage/immutable-constructors) helper to handle immutable constructors.\n:::\n\n```ts\nimport { markStatic, useRegle } from '@regle/core';\nimport { Decimal } from 'decimal.js';\nimport { required } from '@regle/rules';\n\nconst { r$ } = useRegle({ decimal: markStatic(new Decimal(1)) }, {\n decimal: {\n required,\n $isEdited(currentValue, initialValue, defaultHandlerFn) {\n if (currentValue != null && initialValue != null) {\n return currentValue.toNearest(0.01).toString() !== initialValue.toNearest(0.01).toString();\n }\n // fallback to the default handler\n return defaultHandlerFn(currentValue, initialValue);\n },\n },\n})\n```\n\n## Array specific modifiers\n\nThis modifiers are only impacting Array collections.\n\n```ts\nconst { r$ } = useRegle({ collection: [] }, {\n collection: { /** Deep modifiers */ }\n})\n```\n\n### `$deepCompare`\nType: `boolean`\n\nDefault: `false`\n\nAllow deep compare of array children to compute the `$edited` property.\n\nIt's disabled by default for performance reasons."
|
|
135
|
+
"content": "# Modifiers\n\nModifiers allow you to control the behavior and settings of validation rules in your application. They can be applied globally to all fields or customized per field.\n\n## Deep modifiers\n\nDeep modifiers are specified as the third argument of the `useRegle` composable. They apply recursively to all fields within your state.\n\n```ts\nconst { r$ } = useRegle({}, {}, {\n /* modifiers */\n})\n```\n\n### `autoDirty`\n\n__Type__: `boolean`\n\n__Default__: `true`\n\nAutomatically set the dirty set without the need of `$value` or `$touch`.\n\n### `immediateDirty`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\nSet the dirty state to true when the form is initialized.\n\n### `disabled`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\nTemporarily pauses Regle reactivity and validation computation.\n\nWhen `disabled` is `true`, state changes still happen, but validation status does not update until you enable it again.\n\n```ts\nimport { ref } from 'vue';\nimport { useRegle } from '@regle/core';\nimport { required } from '@regle/rules';\n\nconst disabled = ref(false);\n\nconst { r$ } = useRegle(\n { name: '' },\n { name: { required } },\n { disabled }\n);\n\ndisabled.value = true;\nr$.$value.name = 'John'; // value updates, validation is paused\n\ndisabled.value = false; // validation reactivity resumes\n```\n\n### `silent`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\nRegle Automatically tracks changes in the state for all nested rules. If set to `true`, you must manually call `$touch` or `$validate` to display errors.\n\n### `lazy`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\nUsage:\n\nWhen set to false, tells the rules to be called on init, otherwise they are lazy and only called when the field is dirty.\n\n### `externalErrors`\n\n__Type__: `RegleExternalErrorTree<State>` \n\nPass an object, matching your error state, that holds external validation errors. These can be from a backend validations or something else.\n\nCheck the [External errors](/common-usage/external-errors) section for more details.\n\n### `rewardEarly`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\n__Side effect__: disable `$autoDirty` when `true`.\n\nEnables the `reward-early-punish-late` mode of Regle. This mode will not set fields as invalid once they are valid, unless manually triggered by `$validate` method.\n\nThis will have no effect only if you use `autoDirty: true`.\n\n### `clearExternalErrorsOnChange`\n\n__Type__: `boolean`\n\n__Default__: `true`\n\nThis mode is similar to `rewardEarly`, but only applies to external errors.\nSetting it to `false` will keep the server errors until `$clearExternalErrors` is called.\n\n### `clearExternalErrorsOnValidate`\n\n__Type__: `boolean`\n\n__Default__: `false`\n\nThis mode is similar to `clearExternalErrorsOnChange`, but for the `$validate` and `$validateSync` methods.\nSetting it to `false` will keep the server errors until `$clearExternalErrors` is called manually, or the `externalErrors` is set again.\n\n### `validationGroups`\n\n__Type__: `(fields) => Record<string, (RegleFieldStatus |RegleCollectionStatus)[]>`\n\nValidation groups let you merge field properties under one, to better handle validation status.\n\nYou will have access to your declared groups in the `r$.$groups` object.\n\n```ts twoslash\n\nimport { ref } from 'vue';\n// ---cut---\nimport { useRegle } from '@regle/core';\nimport { required } from '@regle/rules';\n\nconst { r$ } = useRegle({ email: '', user: { firstName: '' } }, {\n email: { required },\n user: {\n firstName: { required },\n }\n}, {\n validationGroups: (fields) => ({\n group1: [fields.email, fields.user.firstName]\n })\n})\n\nr$.$groups.group1.\n\n```\n<br><br><br><br>\n\n## Per-field modifiers\n\nPer-field modifiers allow to customize more precisely which behavior you want for each field.\n\n```ts twoslash\n\nimport { useRegle } from '@regle/core';\n// ---cut---\nconst { r$ } = useRegle({ name: '' }, {\n name: { $ }\n\n})\n```\n\n<br><br>\n\n`$autoDirty` `$lazy`, `$silent`, `$immediateDirty` and `$rewardEarly` work the same as the deep modifiers.\n\n### `$debounce`\nType: `number` (ms)\n\nThis let you declare the number of milliseconds the rule needs to wait before executing. Useful for async or heavy computations.\n\n:::tip\nAll async rules have a default debounce of `200ms`, you can disable or modify this setting with `$debounce`\n:::\n\n### `$isEdited`\nType: `(currentValue: MaybeInput<TValue>, initialValue: MaybeInput<TValue>, defaultHandlerFn: (currentValue: unknown, initialValue: unknown) => boolean) => boolean`\n\nOverride the default `$edited` property handler. Useful to handle custom comparisons for complex object types.\n\n:::warning\nIt's highly recommended to use this modifier with the [`markStatic`](/advanced-usage/immutable-constructors) helper to handle immutable constructors.\n:::\n\n```ts\nimport { markStatic, useRegle } from '@regle/core';\nimport { Decimal } from 'decimal.js';\nimport { required } from '@regle/rules';\n\nconst { r$ } = useRegle({ decimal: markStatic(new Decimal(1)) }, {\n decimal: {\n required,\n $isEdited(currentValue, initialValue, defaultHandlerFn) {\n if (currentValue != null && initialValue != null) {\n return currentValue.toNearest(0.01).toString() !== initialValue.toNearest(0.01).toString();\n }\n // fallback to the default handler\n return defaultHandlerFn(currentValue, initialValue);\n },\n },\n})\n```\n\n## Array specific modifiers\n\nThis modifiers are only impacting Array collections.\n\n```ts\nconst { r$ } = useRegle({ collection: [] }, {\n collection: { /** Deep modifiers */ }\n})\n```\n\n### `$deepCompare`\nType: `boolean`\n\nDefault: `false`\n\nAllow deep compare of array children to compute the `$edited` property.\n\nIt's disabled by default for performance reasons."
|
|
136
136
|
},
|
|
137
137
|
{
|
|
138
138
|
"id": "core-concepts-rules-built-in-rules",
|
|
@@ -472,7 +472,7 @@ var docs_data_default = {
|
|
|
472
472
|
"description": "Retrieves error messages for a specific field using a dot-notation path.\nProvides type-safe access to nested error arrays in a Regle instance.",
|
|
473
473
|
"parameters": [{
|
|
474
474
|
"name": "r$",
|
|
475
|
-
"type": "
|
|
475
|
+
"type": "MaybeRefOrGetter<TRegle>",
|
|
476
476
|
"description": "- The Regle instance (e.g., from `useRegle()`)",
|
|
477
477
|
"optional": false
|
|
478
478
|
}, {
|
|
@@ -494,7 +494,7 @@ var docs_data_default = {
|
|
|
494
494
|
"description": "Retrieves detailed validation issues for a specific field using a dot-notation path.\nIssues contain more information than errors, including the rule name, property, and metadata.",
|
|
495
495
|
"parameters": [{
|
|
496
496
|
"name": "r$",
|
|
497
|
-
"type": "
|
|
497
|
+
"type": "MaybeRefOrGetter<TRegle>",
|
|
498
498
|
"description": "- The Regle instance (e.g., from `useRegle()`)",
|
|
499
499
|
"optional": false
|
|
500
500
|
}, {
|
|
@@ -679,7 +679,7 @@ var docs_data_default = {
|
|
|
679
679
|
"description": "",
|
|
680
680
|
"optional": false
|
|
681
681
|
}],
|
|
682
|
-
"returnType": "NonNullable<Unwrap<TState>> extends PrimitiveTypes ? { r$: Raw<RegleFieldStatus<
|
|
682
|
+
"returnType": "NonNullable<Unwrap<TState>> extends PrimitiveTypes ? { r$: Raw<RegleFieldStatus<WidenPrimitiveLiterals<string & Unwrap<TState>> | ... 5 more ... | WidenPrimitiveLiterals<...>, TDecl, RegleShortcutDefi...",
|
|
683
683
|
"example": "import { useRegle } from '@regle/core';\nimport { required, email, minLength } from '@regle/rules';\n\nconst { r$ } = useRegle(\n { name: '', email: '' },\n {\n name: { required, minLength: minLength(2) },\n email: { required, email }\n }\n);\n\n// Access validation state\nr$.$valid // Whether all validations pass\nr$.$value // The current form values\nr$.name.$errors // Errors for the name field\n\n// Trigger validation\nconst result = await r$.$validate();",
|
|
684
684
|
"tags": { "see": "://reglejs.dev/core-concepts/ Documentation" }
|
|
685
685
|
},
|
|
@@ -688,7 +688,7 @@ var docs_data_default = {
|
|
|
688
688
|
"kind": "function",
|
|
689
689
|
"description": "",
|
|
690
690
|
"parameters": [],
|
|
691
|
-
"returnType": "
|
|
691
|
+
"returnType": "Ref<$InternalRegleStatusType, $InternalRegleStatusType>",
|
|
692
692
|
"example": "",
|
|
693
693
|
"tags": { "internal": "This is the internal function that creates the root storage for the Regle instance.\nThis allows shared logic between all `useRegle` like composables" }
|
|
694
694
|
},
|
|
@@ -721,7 +721,7 @@ var docs_data_default = {
|
|
|
721
721
|
"description": "",
|
|
722
722
|
"optional": false
|
|
723
723
|
}],
|
|
724
|
-
"returnType": "NonNullable<Unwrap<TState>> extends PrimitiveTypes ? RegleSingleField<
|
|
724
|
+
"returnType": "NonNullable<Unwrap<TState>> extends PrimitiveTypes ? RegleSingleField<WidenPrimitiveLiterals<string & Unwrap<TState>> | ... 5 more ... | WidenPrimitiveLiterals<...>, TDecl, never, { ...; }> : Regle<.....",
|
|
725
725
|
"example": "// ChildComponent.vue\nimport { useScopedRegle } from '@regle/core';\n\nconst { r$ } = useScopedRegle(\n { email: '' },\n { email: { required, email } },\n { namespace: 'contacts' }\n);",
|
|
726
726
|
"tags": { "see": "://reglejs.dev/advanced-usage/scoped-validation Documentation" }
|
|
727
727
|
},
|
|
@@ -1082,7 +1082,7 @@ var docs_data_default = {
|
|
|
1082
1082
|
"description": "Returns the length/size of any data type. Works with strings, arrays, objects and numbers.",
|
|
1083
1083
|
"parameters": [{
|
|
1084
1084
|
"name": "value",
|
|
1085
|
-
"type": "
|
|
1085
|
+
"type": "MaybeRefOrGetter<string | number | any[] | Record<string, any>>",
|
|
1086
1086
|
"description": "- The value to get the size of",
|
|
1087
1087
|
"optional": false
|
|
1088
1088
|
}],
|
|
@@ -1969,7 +1969,7 @@ function searchApi(query) {
|
|
|
1969
1969
|
return results;
|
|
1970
1970
|
}
|
|
1971
1971
|
|
|
1972
|
-
var version = "1.19.
|
|
1972
|
+
var version = "1.19.13";
|
|
1973
1973
|
|
|
1974
1974
|
let posthogClient = null;
|
|
1975
1975
|
posthogClient = new PostHog("phc_kqgJoylCpKkGkkRGxb4MyN2mViehoQcUFEGwVkk4l8E", {
|