@tooluminati/forms 0.1.0 → 0.2.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-form-tools.d.ts","sourceRoot":"","sources":["../src/create-form-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,KAAK,EACV,qBAAqB,EAErB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAqBjB,wBAAgB,+BAA+B,CAAC,OAAO,EACrD,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAAC,GACtC,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,qBAAqB,CAAC,CA+BpE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAC1C,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAAC,GACtC,oBAAoB,
|
|
1
|
+
{"version":3,"file":"create-form-tools.d.ts","sourceRoot":"","sources":["../src/create-form-tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,OAAO,KAAK,EACV,qBAAqB,EAErB,qBAAqB,EACtB,MAAM,SAAS,CAAC;AAqBjB,wBAAgB,+BAA+B,CAAC,OAAO,EACrD,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAAC,GACtC,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,qBAAqB,CAAC,CA+BpE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAC1C,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAAC,GACtC,oBAAoB,CA4DtB;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAC3C,OAAO,EAAE,qBAAqB,CAAC,OAAO,CAAC,GACtC,oBAAoB,EAAE,CAYxB"}
|
|
@@ -19,7 +19,7 @@ export function createFormValidationSummaryTool(options) {
|
|
|
19
19
|
properties: {},
|
|
20
20
|
additionalProperties: false,
|
|
21
21
|
},
|
|
22
|
-
annotations: { readOnlyHint: true },
|
|
22
|
+
annotations: { readOnlyHint: true, debugging: true },
|
|
23
23
|
execute: () => {
|
|
24
24
|
const summary = {
|
|
25
25
|
name: options.name,
|
|
@@ -49,6 +49,8 @@ export function createFormSubmitTool(options) {
|
|
|
49
49
|
inputSchema: schema,
|
|
50
50
|
annotations: {
|
|
51
51
|
readOnlyHint: false,
|
|
52
|
+
consequentialHint: true,
|
|
53
|
+
debugging: true,
|
|
52
54
|
...options.annotations,
|
|
53
55
|
},
|
|
54
56
|
validateArgs: options.validateArgs,
|
|
@@ -26,14 +26,19 @@ describe('create-form-tools', () => {
|
|
|
26
26
|
it('returns validation summary without submitting', async () => {
|
|
27
27
|
const tool = createFormValidationSummaryTool({
|
|
28
28
|
...baseOptions,
|
|
29
|
-
getErrors: () => [
|
|
29
|
+
getErrors: () => [
|
|
30
|
+
{ kind: 'required', path: 'subject', message: 'Required' },
|
|
31
|
+
],
|
|
30
32
|
});
|
|
31
33
|
const summary = await tool.execute({}, {});
|
|
32
34
|
expect(summary.errors).toHaveLength(1);
|
|
33
35
|
expect(summary.schema).toBeDefined();
|
|
34
36
|
});
|
|
35
37
|
it('submits through the submit tool execute handler', async () => {
|
|
36
|
-
const submit = vi.fn(async () => ({
|
|
38
|
+
const submit = vi.fn(async () => ({
|
|
39
|
+
success: true,
|
|
40
|
+
message: 'ok',
|
|
41
|
+
}));
|
|
37
42
|
const tool = createFormSubmitTool({
|
|
38
43
|
...baseOptions,
|
|
39
44
|
submit,
|
|
@@ -43,3 +48,39 @@ describe('create-form-tools', () => {
|
|
|
43
48
|
expect(result).toBe('ok');
|
|
44
49
|
});
|
|
45
50
|
});
|
|
51
|
+
it('annotates submission and validation separately, preserving explicit overrides', () => {
|
|
52
|
+
const options = {
|
|
53
|
+
name: 'save',
|
|
54
|
+
description: 'Save form.',
|
|
55
|
+
getValues: () => ({ name: '' }),
|
|
56
|
+
setValues: vi.fn(),
|
|
57
|
+
submit: vi.fn(),
|
|
58
|
+
};
|
|
59
|
+
expect(createFormSubmitTool(options).annotations).toEqual({
|
|
60
|
+
readOnlyHint: false,
|
|
61
|
+
consequentialHint: true,
|
|
62
|
+
debugging: true,
|
|
63
|
+
});
|
|
64
|
+
expect(createFormValidationSummaryTool(options).annotations).toEqual({
|
|
65
|
+
readOnlyHint: true,
|
|
66
|
+
debugging: true,
|
|
67
|
+
});
|
|
68
|
+
const overridden = {
|
|
69
|
+
...options,
|
|
70
|
+
annotations: {
|
|
71
|
+
consequentialHint: false,
|
|
72
|
+
debugging: false,
|
|
73
|
+
untrustedContentHint: true,
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
expect(createFormSubmitTool(overridden).annotations).toEqual({
|
|
77
|
+
readOnlyHint: false,
|
|
78
|
+
consequentialHint: false,
|
|
79
|
+
debugging: false,
|
|
80
|
+
untrustedContentHint: true,
|
|
81
|
+
});
|
|
82
|
+
expect(createFormValidationSummaryTool(overridden).annotations).toEqual({
|
|
83
|
+
readOnlyHint: true,
|
|
84
|
+
debugging: true,
|
|
85
|
+
});
|
|
86
|
+
});
|
package/dist/index.cjs
CHANGED
|
@@ -118,7 +118,7 @@ function createFormValidationSummaryTool(options) {
|
|
|
118
118
|
properties: {},
|
|
119
119
|
additionalProperties: false
|
|
120
120
|
},
|
|
121
|
-
annotations: { readOnlyHint: true },
|
|
121
|
+
annotations: { readOnlyHint: true, debugging: true },
|
|
122
122
|
execute: () => {
|
|
123
123
|
const summary = {
|
|
124
124
|
name: options.name,
|
|
@@ -149,6 +149,8 @@ function createFormSubmitTool(options) {
|
|
|
149
149
|
inputSchema: schema,
|
|
150
150
|
annotations: {
|
|
151
151
|
readOnlyHint: false,
|
|
152
|
+
consequentialHint: true,
|
|
153
|
+
debugging: true,
|
|
152
154
|
...options.annotations
|
|
153
155
|
},
|
|
154
156
|
validateArgs: options.validateArgs,
|
package/dist/index.js
CHANGED
|
@@ -81,7 +81,7 @@ function createFormValidationSummaryTool(options) {
|
|
|
81
81
|
properties: {},
|
|
82
82
|
additionalProperties: false
|
|
83
83
|
},
|
|
84
|
-
annotations: { readOnlyHint: true },
|
|
84
|
+
annotations: { readOnlyHint: true, debugging: true },
|
|
85
85
|
execute: () => {
|
|
86
86
|
const summary = {
|
|
87
87
|
name: options.name,
|
|
@@ -112,6 +112,8 @@ function createFormSubmitTool(options) {
|
|
|
112
112
|
inputSchema: schema,
|
|
113
113
|
annotations: {
|
|
114
114
|
readOnlyHint: false,
|
|
115
|
+
consequentialHint: true,
|
|
116
|
+
debugging: true,
|
|
115
117
|
...options.annotations
|
|
116
118
|
},
|
|
117
119
|
validateArgs: options.validateArgs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tooluminati/forms",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Form diagnostics and submission adapters for Tooluminati.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@tooluminati/core": "0.
|
|
18
|
+
"@tooluminati/core": "0.2.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
21
|
"react": ">=18.0.0",
|
|
22
|
-
"@tooluminati/react": "0.
|
|
22
|
+
"@tooluminati/react": "0.2.0"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"dist"
|