@punica/form-mcp 0.3.0 → 0.3.1
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/bundled/form/package.json +1 -1
- package/bundled/form-kit/package.json +1 -1
- package/bundled/form-kit/react/index.d.ts +6 -1
- package/bundled/form-react/package.json +1 -1
- package/bundled/form-service/package.json +1 -1
- package/bundled/form-service/validateItem.d.ts +11 -8
- package/package.json +5 -5
- package/src/knowledge.mjs +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.1.
|
|
1
|
+
{"version":"2.1.1"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.
|
|
1
|
+
{"version":"0.2.0"}
|
|
@@ -10,6 +10,11 @@ export { fieldComponents } from './fields';
|
|
|
10
10
|
type ViewProps<E extends object> = {
|
|
11
11
|
/** Called with the values of a valid form when it is submitted. */
|
|
12
12
|
onSubmit?: (values: E, controller: FormController<E, KitItem<E>>) => void | Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Called with what a validation, a control function or `onSubmit` threw.
|
|
15
|
+
* Without it the error is logged to the console.
|
|
16
|
+
*/
|
|
17
|
+
onError?: (error: unknown) => void;
|
|
13
18
|
/** The text of the submit button, `Submit` by default. */
|
|
14
19
|
submitLabel?: string;
|
|
15
20
|
/** The text of the reset button; there is none without it. */
|
|
@@ -23,7 +28,7 @@ export type FormViewProps<E extends object> = ViewProps<E> & {
|
|
|
23
28
|
/**
|
|
24
29
|
* Renders the form of a started controller with `@punica/components`.
|
|
25
30
|
*/
|
|
26
|
-
export declare function FormView<E extends object>({ controller, onSubmit, submitLabel, resetLabel, components }: FormViewProps<E>): ReactNode;
|
|
31
|
+
export declare function FormView<E extends object>({ controller, onSubmit, onError, submitLabel, resetLabel, components }: FormViewProps<E>): ReactNode;
|
|
27
32
|
export type KitFormProps<E extends object> = ViewProps<E> & {
|
|
28
33
|
/** Returns the entity of the form, for example `() => new UserForm()`. */
|
|
29
34
|
entity: () => E;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"0.1.
|
|
1
|
+
{"version":"0.1.1"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.1.
|
|
1
|
+
{"version":"2.1.1"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
import { CommandService, ErrorDetail, FormItem } from '@punica/form';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* validated (no validation function, or hidden)
|
|
3
|
+
* Tells the validations of a form that are still running that their results
|
|
4
|
+
* are stale: of one property, or of every property.
|
|
6
5
|
*/
|
|
7
|
-
export declare const
|
|
6
|
+
export declare const dropValidations: <E, F extends FormItem<E>>(command: CommandService<E, F>, property?: keyof E) => void;
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
* have changed while
|
|
11
|
-
* what the validation knows.
|
|
8
|
+
* Validates items one after the other and writes the results onto the items
|
|
9
|
+
* as they are now: an item may have changed while it was validated, and only
|
|
10
|
+
* its error state is what the validation knows. A result is not written when
|
|
11
|
+
* it is stale: the value changed, the item was validated again or reset.
|
|
12
|
+
* Items without a validation function, hidden items and disabled items are
|
|
13
|
+
* not validated.
|
|
14
|
+
* @returns The results, by the property of the validated items
|
|
12
15
|
*/
|
|
13
|
-
export declare const
|
|
16
|
+
export declare const validateItems: <E, F extends FormItem<E>>(command: CommandService<E, F>, items: F[]) => Promise<Map<keyof E, ErrorDetail>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@punica/form-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "MCP server for Punica Form: look up the exact API of its packages, read the rules and check code that uses them.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"zod": "^4.6.7"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@punica/form": "^2.1.
|
|
43
|
-
"@punica/form-service": "^2.1.
|
|
44
|
-
"@punica/form-react": "^0.1.
|
|
45
|
-
"@punica/form-kit": "^0.
|
|
42
|
+
"@punica/form": "^2.1.1",
|
|
43
|
+
"@punica/form-service": "^2.1.1",
|
|
44
|
+
"@punica/form-react": "^0.1.1",
|
|
45
|
+
"@punica/form-kit": "^0.2.0"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "node build.mjs",
|
package/src/knowledge.mjs
CHANGED
|
@@ -62,8 +62,8 @@ function exportsOf(files, path, seen = new Set()) {
|
|
|
62
62
|
found.set(match[2], entry(source, match.index, match[1], match[2]));
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
// export * from './x';
|
|
66
|
-
for (const match of source.matchAll(/^export
|
|
65
|
+
// export * from './x'; export type * from './x';
|
|
66
|
+
for (const match of source.matchAll(/^export (?:type )?\* from ['"](.+?)['"];/gm)) {
|
|
67
67
|
const target = exportsOf(files, resolve(files, path, match[1]), seen);
|
|
68
68
|
|
|
69
69
|
for (const [name, value] of target) found.set(name, value);
|