@kintone/mcp-server 1.0.0 → 1.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.
- package/CHANGELOG.md +22 -0
- package/README.md +35 -14
- package/dist/{client.js → client/index.js} +4 -9
- package/dist/client/types/client.js +1 -0
- package/dist/config/command-line.js +2 -1
- package/dist/config/index.js +30 -62
- package/dist/config/parser.js +72 -0
- package/dist/config/schema.js +4 -0
- package/dist/config/types/config.js +1 -0
- package/dist/index.js +16 -6
- package/dist/lib/filesystem.js +47 -0
- package/dist/schema/app/field-properties.js +330 -0
- package/dist/schema/app/form-layout.js +105 -0
- package/dist/schema/app/index.js +3 -0
- package/dist/schema/app/properties-parameter.js +638 -0
- package/dist/schema/record/index.js +2 -0
- package/dist/schema/record/records.js +1 -1
- package/dist/server/index.js +17 -0
- package/dist/server/tool-filters.js +14 -0
- package/dist/server/types/server.js +1 -0
- package/dist/tools/factory.js +10 -0
- package/dist/tools/index.js +23 -0
- package/dist/tools/kintone/app/add-app.js +40 -0
- package/dist/tools/kintone/app/add-form-fields.js +50 -0
- package/dist/tools/kintone/app/delete-form-fields.js +51 -0
- package/dist/tools/kintone/app/deploy-app.js +48 -0
- package/dist/tools/kintone/app/get-app-deploy-status.js +42 -0
- package/dist/tools/kintone/app/get-app.js +7 -8
- package/dist/tools/kintone/app/get-apps.js +7 -8
- package/dist/tools/kintone/app/get-form-fields.js +20 -107
- package/dist/tools/kintone/app/get-form-layout.js +45 -0
- package/dist/tools/kintone/app/get-general-settings.js +119 -0
- package/dist/tools/kintone/app/get-process-management.js +12 -8
- package/dist/tools/kintone/app/update-form-fields.js +50 -0
- package/dist/tools/kintone/app/update-form-layout.js +48 -0
- package/dist/tools/kintone/app/update-general-settings.js +119 -0
- package/dist/tools/kintone/file/download-file.js +49 -0
- package/dist/tools/kintone/record/add-records.js +8 -9
- package/dist/tools/kintone/record/delete-records.js +7 -8
- package/dist/tools/kintone/record/get-records.js +8 -9
- package/dist/tools/kintone/record/update-records.js +8 -9
- package/dist/tools/kintone/record/update-statuses.js +7 -8
- package/dist/tools/types/tool.js +1 -0
- package/dist/version.js +1 -1
- package/package.json +11 -6
- package/dist/server.js +0 -20
- package/dist/tool-filters.js +0 -14
- package/dist/tools/utils.js +0 -8
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// サブテーブル内フィールド用の基本プロパティ(fieldsプロパティなし)
|
|
3
|
+
const subtableFieldProperties = {
|
|
4
|
+
type: z
|
|
5
|
+
.string()
|
|
6
|
+
.describe("Field type (e.g., 'SINGLE_LINE_TEXT', 'NUMBER', 'DROP_DOWN', 'SUBTABLE')"),
|
|
7
|
+
code: z
|
|
8
|
+
.string()
|
|
9
|
+
.describe("Unique field identifier (max 128 chars, cannot start with number, only '_' allowed as special char)"),
|
|
10
|
+
label: z.string().describe("Display name for the field shown to users"),
|
|
11
|
+
noLabel: z
|
|
12
|
+
.boolean()
|
|
13
|
+
.optional()
|
|
14
|
+
.describe("If true, hides the field label in the form"),
|
|
15
|
+
required: z
|
|
16
|
+
.boolean()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("If true, field value is mandatory for record submission"),
|
|
19
|
+
unique: z
|
|
20
|
+
.boolean()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("If true, field value must be unique across all records"),
|
|
23
|
+
maxValue: z
|
|
24
|
+
.string()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe("Maximum allowed value for numeric fields"),
|
|
27
|
+
minValue: z
|
|
28
|
+
.string()
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Minimum allowed value for numeric fields"),
|
|
31
|
+
maxLength: z
|
|
32
|
+
.string()
|
|
33
|
+
.optional()
|
|
34
|
+
.describe("Maximum character length for text fields"),
|
|
35
|
+
minLength: z
|
|
36
|
+
.string()
|
|
37
|
+
.optional()
|
|
38
|
+
.describe("Minimum character length for text fields"),
|
|
39
|
+
defaultValue: z
|
|
40
|
+
.any()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe("Initial value when creating new records (use empty string '' for selection fields)"),
|
|
43
|
+
defaultNowValue: z
|
|
44
|
+
.boolean()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe("If true, uses current date/time as default for DATE/TIME/DATETIME fields"),
|
|
47
|
+
entities: z
|
|
48
|
+
.array(z.object({
|
|
49
|
+
type: z.enum(["USER", "GROUP", "ORGANIZATION"]),
|
|
50
|
+
code: z.string(),
|
|
51
|
+
}))
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("Default selected users/groups/departments for USER_SELECT/GROUP_SELECT/ORGANIZATION_SELECT fields"),
|
|
54
|
+
options: z
|
|
55
|
+
.record(z.object({
|
|
56
|
+
label: z
|
|
57
|
+
.string()
|
|
58
|
+
.describe("Display label (must exactly match the option key)"),
|
|
59
|
+
index: z
|
|
60
|
+
.string()
|
|
61
|
+
.describe("Index number as string, starting from 0 (e.g., '0', '1', '2')"),
|
|
62
|
+
}))
|
|
63
|
+
.optional()
|
|
64
|
+
.describe("Options for selection fields (DROP_DOWN, RADIO_BUTTON, CHECK_BOX, MULTI_SELECT). IMPORTANT: Option keys must exactly match their corresponding label values. For Japanese environments, use Japanese characters as keys, not English identifiers. Example: {'営業部': {'label': '営業部', 'index': '0'}}"),
|
|
65
|
+
align: z
|
|
66
|
+
.enum(["HORIZONTAL", "VERTICAL"])
|
|
67
|
+
.optional()
|
|
68
|
+
.describe("Layout direction for RADIO_BUTTON/CHECK_BOX options (HORIZONTAL: side by side, VERTICAL: stacked)"),
|
|
69
|
+
expression: z
|
|
70
|
+
.string()
|
|
71
|
+
.optional()
|
|
72
|
+
.describe("Formula for CALC fields (e.g., 'price * quantity')"),
|
|
73
|
+
hideExpression: z
|
|
74
|
+
.boolean()
|
|
75
|
+
.optional()
|
|
76
|
+
.describe("If true, hides the calculation formula from users in CALC fields"),
|
|
77
|
+
format: z
|
|
78
|
+
.string()
|
|
79
|
+
.optional()
|
|
80
|
+
.describe("Display format for NUMBER/CALC fields (e.g., 'NUMBER', 'NUMBER_DIGIT', 'DECIMAL', 'CURRENCY')"),
|
|
81
|
+
displayScale: z
|
|
82
|
+
.string()
|
|
83
|
+
.optional()
|
|
84
|
+
.describe("Number of decimal places to display for NUMBER/CALC fields"),
|
|
85
|
+
unit: z
|
|
86
|
+
.string()
|
|
87
|
+
.optional()
|
|
88
|
+
.describe("Unit text to display with NUMBER fields (e.g., '円', 'USD', 'kg')"),
|
|
89
|
+
unitPosition: z
|
|
90
|
+
.enum(["BEFORE", "AFTER"])
|
|
91
|
+
.optional()
|
|
92
|
+
.describe("Where to display unit text relative to the value (BEFORE: '$100', AFTER: '100円')"),
|
|
93
|
+
digit: z
|
|
94
|
+
.boolean()
|
|
95
|
+
.optional()
|
|
96
|
+
.describe("If true, displays thousands separator in NUMBER/CALC fields (e.g., 1,000)"),
|
|
97
|
+
thumbnailSize: z
|
|
98
|
+
.string()
|
|
99
|
+
.optional()
|
|
100
|
+
.describe("Thumbnail size for FILE field previews (in pixels, e.g., '150')"),
|
|
101
|
+
protocol: z
|
|
102
|
+
.enum(["WEB", "CALL", "MAIL"])
|
|
103
|
+
.optional()
|
|
104
|
+
.describe("Protocol for LINK fields (WEB: http/https links, CALL: tel: links, MAIL: mailto: links)"),
|
|
105
|
+
lookup: z
|
|
106
|
+
.object({
|
|
107
|
+
relatedApp: z.object({
|
|
108
|
+
app: z.string().describe("ID of the related app"),
|
|
109
|
+
code: z.string().describe("Code of the related app"),
|
|
110
|
+
}),
|
|
111
|
+
relatedKeyField: z
|
|
112
|
+
.string()
|
|
113
|
+
.describe("Field code in related app to match against"),
|
|
114
|
+
fieldMappings: z
|
|
115
|
+
.array(z.object({
|
|
116
|
+
field: z.string().describe("Field code in current app"),
|
|
117
|
+
relatedField: z
|
|
118
|
+
.string()
|
|
119
|
+
.describe("Field code in related app to copy value from"),
|
|
120
|
+
}))
|
|
121
|
+
.describe("Mapping of fields to copy from related app"),
|
|
122
|
+
lookupPickerFields: z
|
|
123
|
+
.array(z.string())
|
|
124
|
+
.describe("Fields to display in lookup picker"),
|
|
125
|
+
filterCond: z
|
|
126
|
+
.string()
|
|
127
|
+
.optional()
|
|
128
|
+
.describe("Query condition to filter lookup results"),
|
|
129
|
+
sort: z.string().optional().describe("Sort order for lookup results"),
|
|
130
|
+
})
|
|
131
|
+
.optional()
|
|
132
|
+
.describe("Lookup configuration to retrieve values from related app records"),
|
|
133
|
+
referenceTable: z
|
|
134
|
+
.object({
|
|
135
|
+
relatedApp: z.object({
|
|
136
|
+
app: z.string().describe("ID of the related app"),
|
|
137
|
+
code: z.string().describe("Code of the related app"),
|
|
138
|
+
}),
|
|
139
|
+
condition: z.object({
|
|
140
|
+
field: z.string().describe("Field code in current app to match"),
|
|
141
|
+
relatedField: z
|
|
142
|
+
.string()
|
|
143
|
+
.describe("Field code in related app to match against"),
|
|
144
|
+
}),
|
|
145
|
+
filterCond: z
|
|
146
|
+
.string()
|
|
147
|
+
.optional()
|
|
148
|
+
.describe("Additional filter condition for related records"),
|
|
149
|
+
displayFields: z
|
|
150
|
+
.array(z.string())
|
|
151
|
+
.describe("Fields from related app to display in the table"),
|
|
152
|
+
sort: z.string().optional().describe("Sort order for related records"),
|
|
153
|
+
size: z
|
|
154
|
+
.string()
|
|
155
|
+
.optional()
|
|
156
|
+
.describe("Number of records to display per page"),
|
|
157
|
+
})
|
|
158
|
+
.optional()
|
|
159
|
+
.describe("Configuration for REFERENCE_TABLE field to display related app records"),
|
|
160
|
+
openGroup: z
|
|
161
|
+
.boolean()
|
|
162
|
+
.optional()
|
|
163
|
+
.describe("If true, GROUP field is expanded by default when viewing records"),
|
|
164
|
+
};
|
|
165
|
+
export const baseFieldProperties = {
|
|
166
|
+
type: z
|
|
167
|
+
.string()
|
|
168
|
+
.describe("Field type (e.g., 'SINGLE_LINE_TEXT', 'NUMBER', 'DROP_DOWN', 'SUBTABLE')"),
|
|
169
|
+
code: z
|
|
170
|
+
.string()
|
|
171
|
+
.describe("Unique field identifier (max 128 chars, cannot start with number, only '_' allowed as special char)"),
|
|
172
|
+
label: z.string().describe("Display name for the field shown to users"),
|
|
173
|
+
noLabel: z
|
|
174
|
+
.boolean()
|
|
175
|
+
.optional()
|
|
176
|
+
.describe("If true, hides the field label in the form"),
|
|
177
|
+
required: z
|
|
178
|
+
.boolean()
|
|
179
|
+
.optional()
|
|
180
|
+
.describe("If true, field value is mandatory for record submission"),
|
|
181
|
+
unique: z
|
|
182
|
+
.boolean()
|
|
183
|
+
.optional()
|
|
184
|
+
.describe("If true, field value must be unique across all records"),
|
|
185
|
+
maxValue: z
|
|
186
|
+
.string()
|
|
187
|
+
.optional()
|
|
188
|
+
.describe("Maximum allowed value for numeric fields"),
|
|
189
|
+
minValue: z
|
|
190
|
+
.string()
|
|
191
|
+
.optional()
|
|
192
|
+
.describe("Minimum allowed value for numeric fields"),
|
|
193
|
+
maxLength: z
|
|
194
|
+
.string()
|
|
195
|
+
.optional()
|
|
196
|
+
.describe("Maximum character length for text fields"),
|
|
197
|
+
minLength: z
|
|
198
|
+
.string()
|
|
199
|
+
.optional()
|
|
200
|
+
.describe("Minimum character length for text fields"),
|
|
201
|
+
defaultValue: z
|
|
202
|
+
.any()
|
|
203
|
+
.optional()
|
|
204
|
+
.describe("Initial value when creating new records (use empty string '' for selection fields)"),
|
|
205
|
+
defaultNowValue: z
|
|
206
|
+
.boolean()
|
|
207
|
+
.optional()
|
|
208
|
+
.describe("If true, uses current date/time as default for DATE/TIME/DATETIME fields"),
|
|
209
|
+
entities: z
|
|
210
|
+
.array(z.object({
|
|
211
|
+
type: z.enum(["USER", "GROUP", "ORGANIZATION"]),
|
|
212
|
+
code: z.string(),
|
|
213
|
+
}))
|
|
214
|
+
.optional()
|
|
215
|
+
.describe("Default selected users/groups/departments for USER_SELECT/GROUP_SELECT/ORGANIZATION_SELECT fields"),
|
|
216
|
+
options: z
|
|
217
|
+
.record(z.object({
|
|
218
|
+
label: z
|
|
219
|
+
.string()
|
|
220
|
+
.describe("Display label (must exactly match the option key)"),
|
|
221
|
+
index: z
|
|
222
|
+
.string()
|
|
223
|
+
.describe("Index number as string, starting from 0 (e.g., '0', '1', '2')"),
|
|
224
|
+
}))
|
|
225
|
+
.optional()
|
|
226
|
+
.describe("Options for selection fields (DROP_DOWN, RADIO_BUTTON, CHECK_BOX, MULTI_SELECT). IMPORTANT: Option keys must exactly match their corresponding label values. For Japanese environments, use Japanese characters as keys, not English identifiers. Example: {'営業部': {'label': '営業部', 'index': '0'}}"),
|
|
227
|
+
align: z
|
|
228
|
+
.enum(["HORIZONTAL", "VERTICAL"])
|
|
229
|
+
.optional()
|
|
230
|
+
.describe("Layout direction for RADIO_BUTTON/CHECK_BOX options (HORIZONTAL: side by side, VERTICAL: stacked)"),
|
|
231
|
+
expression: z
|
|
232
|
+
.string()
|
|
233
|
+
.optional()
|
|
234
|
+
.describe("Formula for CALC fields (e.g., 'price * quantity')"),
|
|
235
|
+
hideExpression: z
|
|
236
|
+
.boolean()
|
|
237
|
+
.optional()
|
|
238
|
+
.describe("If true, hides the calculation formula from users in CALC fields"),
|
|
239
|
+
format: z
|
|
240
|
+
.string()
|
|
241
|
+
.optional()
|
|
242
|
+
.describe("Display format for NUMBER/CALC fields (e.g., 'NUMBER', 'NUMBER_DIGIT', 'DECIMAL', 'CURRENCY')"),
|
|
243
|
+
displayScale: z
|
|
244
|
+
.string()
|
|
245
|
+
.optional()
|
|
246
|
+
.describe("Number of decimal places to display for NUMBER/CALC fields"),
|
|
247
|
+
unit: z
|
|
248
|
+
.string()
|
|
249
|
+
.optional()
|
|
250
|
+
.describe("Unit text to display with NUMBER fields (e.g., '円', 'USD', 'kg')"),
|
|
251
|
+
unitPosition: z
|
|
252
|
+
.enum(["BEFORE", "AFTER"])
|
|
253
|
+
.optional()
|
|
254
|
+
.describe("Where to display unit text relative to the value (BEFORE: '$100', AFTER: '100円')"),
|
|
255
|
+
digit: z
|
|
256
|
+
.boolean()
|
|
257
|
+
.optional()
|
|
258
|
+
.describe("If true, displays thousands separator in NUMBER/CALC fields (e.g., 1,000)"),
|
|
259
|
+
thumbnailSize: z
|
|
260
|
+
.string()
|
|
261
|
+
.optional()
|
|
262
|
+
.describe("Thumbnail size for FILE field previews (in pixels, e.g., '150')"),
|
|
263
|
+
protocol: z
|
|
264
|
+
.enum(["WEB", "CALL", "MAIL"])
|
|
265
|
+
.optional()
|
|
266
|
+
.describe("Protocol for LINK fields (WEB: http/https links, CALL: tel: links, MAIL: mailto: links)"),
|
|
267
|
+
lookup: z
|
|
268
|
+
.object({
|
|
269
|
+
relatedApp: z.object({
|
|
270
|
+
app: z.string().describe("ID of the related app"),
|
|
271
|
+
code: z.string().describe("Code of the related app"),
|
|
272
|
+
}),
|
|
273
|
+
relatedKeyField: z
|
|
274
|
+
.string()
|
|
275
|
+
.describe("Field code in related app to match against"),
|
|
276
|
+
fieldMappings: z
|
|
277
|
+
.array(z.object({
|
|
278
|
+
field: z.string().describe("Field code in current app"),
|
|
279
|
+
relatedField: z
|
|
280
|
+
.string()
|
|
281
|
+
.describe("Field code in related app to copy value from"),
|
|
282
|
+
}))
|
|
283
|
+
.describe("Mapping of fields to copy from related app"),
|
|
284
|
+
lookupPickerFields: z
|
|
285
|
+
.array(z.string())
|
|
286
|
+
.describe("Fields to display in lookup picker"),
|
|
287
|
+
filterCond: z
|
|
288
|
+
.string()
|
|
289
|
+
.optional()
|
|
290
|
+
.describe("Query condition to filter lookup results"),
|
|
291
|
+
sort: z.string().optional().describe("Sort order for lookup results"),
|
|
292
|
+
})
|
|
293
|
+
.optional()
|
|
294
|
+
.describe("Lookup configuration to retrieve values from related app records"),
|
|
295
|
+
referenceTable: z
|
|
296
|
+
.object({
|
|
297
|
+
relatedApp: z.object({
|
|
298
|
+
app: z.string().describe("ID of the related app"),
|
|
299
|
+
code: z.string().describe("Code of the related app"),
|
|
300
|
+
}),
|
|
301
|
+
condition: z.object({
|
|
302
|
+
field: z.string().describe("Field code in current app to match"),
|
|
303
|
+
relatedField: z
|
|
304
|
+
.string()
|
|
305
|
+
.describe("Field code in related app to match against"),
|
|
306
|
+
}),
|
|
307
|
+
filterCond: z
|
|
308
|
+
.string()
|
|
309
|
+
.optional()
|
|
310
|
+
.describe("Additional filter condition for related records"),
|
|
311
|
+
displayFields: z
|
|
312
|
+
.array(z.string())
|
|
313
|
+
.describe("Fields from related app to display in the table"),
|
|
314
|
+
sort: z.string().optional().describe("Sort order for related records"),
|
|
315
|
+
size: z
|
|
316
|
+
.string()
|
|
317
|
+
.optional()
|
|
318
|
+
.describe("Number of records to display per page"),
|
|
319
|
+
})
|
|
320
|
+
.optional()
|
|
321
|
+
.describe("Configuration for REFERENCE_TABLE field to display related app records"),
|
|
322
|
+
fields: z
|
|
323
|
+
.record(z.string(), z.object(subtableFieldProperties))
|
|
324
|
+
.optional()
|
|
325
|
+
.describe("Fields in subtable. For SUBTABLE type, define the fields that will be contained within the table. Each key should be the field code, and the value should be the field properties"),
|
|
326
|
+
openGroup: z
|
|
327
|
+
.boolean()
|
|
328
|
+
.optional()
|
|
329
|
+
.describe("If true, GROUP field is expanded by default when viewing records"),
|
|
330
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
// フィールドタイプの定義
|
|
3
|
+
const fieldTypeSchema = z.union([
|
|
4
|
+
z.literal("SINGLE_LINE_TEXT").describe("Text or Look-up field"),
|
|
5
|
+
z.literal("MULTI_LINE_TEXT").describe("Text Area field"),
|
|
6
|
+
z.literal("RICH_TEXT").describe("Rich text field"),
|
|
7
|
+
z.literal("NUMBER").describe("Number or Look-up field"),
|
|
8
|
+
z.literal("CALC").describe("Calculated field"),
|
|
9
|
+
z.literal("RADIO_BUTTON").describe("Radio button field"),
|
|
10
|
+
z.literal("CHECK_BOX").describe("Check box field"),
|
|
11
|
+
z.literal("MULTI_SELECT").describe("Multi-choice field"),
|
|
12
|
+
z.literal("DROP_DOWN").describe("Drop-down field"),
|
|
13
|
+
z.literal("USER_SELECT").describe("User selection field"),
|
|
14
|
+
z.literal("ORGANIZATION_SELECT").describe("Department selection field"),
|
|
15
|
+
z.literal("GROUP_SELECT").describe("Group selection field"),
|
|
16
|
+
z.literal("DATE").describe("Date field"),
|
|
17
|
+
z.literal("TIME").describe("Time field"),
|
|
18
|
+
z.literal("DATETIME").describe("Date and time field"),
|
|
19
|
+
z.literal("LINK").describe("Link field"),
|
|
20
|
+
z.literal("FILE").describe("Attachment field"),
|
|
21
|
+
z.literal("SUBTABLE").describe("Table field"),
|
|
22
|
+
z.literal("RECORD_NUMBER").describe("Record number field"),
|
|
23
|
+
z.literal("CREATOR").describe("Created by field"),
|
|
24
|
+
z.literal("CREATED_TIME").describe("Created datetime field"),
|
|
25
|
+
z.literal("MODIFIER").describe("Updated by field"),
|
|
26
|
+
z.literal("UPDATED_TIME").describe("Updated datetime field"),
|
|
27
|
+
z.literal("STATUS").describe("Process management status field"),
|
|
28
|
+
z
|
|
29
|
+
.literal("STATUS_ASSIGNEE")
|
|
30
|
+
.describe("Assignee of the Process Management status field"),
|
|
31
|
+
z.literal("CATEGORY").describe("Category field"),
|
|
32
|
+
z.literal("REFERENCE_TABLE").describe("Related Records field"),
|
|
33
|
+
z.literal("GROUP").describe("Field group"),
|
|
34
|
+
z.literal("LABEL").describe("Label field"),
|
|
35
|
+
z.literal("SPACER").describe("Blank space field"),
|
|
36
|
+
z.literal("HR").describe("Border field"),
|
|
37
|
+
]);
|
|
38
|
+
// サイズ設定スキーマ
|
|
39
|
+
const sizeSchema = z
|
|
40
|
+
.object({
|
|
41
|
+
width: z
|
|
42
|
+
.union([z.string(), z.number()])
|
|
43
|
+
.optional()
|
|
44
|
+
.describe("Field width in pixels"),
|
|
45
|
+
height: z
|
|
46
|
+
.union([z.string(), z.number()])
|
|
47
|
+
.optional()
|
|
48
|
+
.describe("Field height (only applicable for specific fields like Blank space and Text Area)"),
|
|
49
|
+
innerHeight: z
|
|
50
|
+
.union([z.string(), z.number()])
|
|
51
|
+
.optional()
|
|
52
|
+
.describe("Inner height for multi-line text fields"),
|
|
53
|
+
})
|
|
54
|
+
.optional()
|
|
55
|
+
.describe("Width and height configurations for fields");
|
|
56
|
+
// パラメータ用のフィールドスキーマ
|
|
57
|
+
const fieldForParameterSchema = z.object({
|
|
58
|
+
type: fieldTypeSchema.describe("The field type"),
|
|
59
|
+
code: z
|
|
60
|
+
.string()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("Field code (required for most field types except LABEL, SPACER, and HR). Must exactly match the existing field code in the app"),
|
|
63
|
+
label: z
|
|
64
|
+
.string()
|
|
65
|
+
.optional()
|
|
66
|
+
.describe("Text to set for Label fields (only used with Label field type)"),
|
|
67
|
+
elementId: z
|
|
68
|
+
.string()
|
|
69
|
+
.optional()
|
|
70
|
+
.describe("Element ID for Blank space fields (only used with Blank space field type)"),
|
|
71
|
+
size: sizeSchema,
|
|
72
|
+
});
|
|
73
|
+
// ROW レイアウトパラメータ
|
|
74
|
+
const rowLayoutForParameterSchema = z.object({
|
|
75
|
+
type: z.literal("ROW").describe("A normal row of fields"),
|
|
76
|
+
fields: z
|
|
77
|
+
.array(fieldForParameterSchema)
|
|
78
|
+
.describe("List of field layouts in the row"),
|
|
79
|
+
});
|
|
80
|
+
// SUBTABLE レイアウトパラメータ
|
|
81
|
+
const subtableLayoutForParameterSchema = z.object({
|
|
82
|
+
type: z.literal("SUBTABLE").describe("A Table"),
|
|
83
|
+
code: z
|
|
84
|
+
.string()
|
|
85
|
+
.describe("The field code of the SUBTABLE field (not individual fields inside)"),
|
|
86
|
+
fields: z
|
|
87
|
+
.array(fieldForParameterSchema)
|
|
88
|
+
.describe("List of field layouts INSIDE the subtable. These should be the field codes that exist within the subtable definition. Use kintone-get-form-fields to see the correct subtable structure. The subtable structure should be: {type: 'SUBTABLE', code: 'table_code', fields: [{type: 'TEXT', code: 'field_inside_table'}, ...]}"),
|
|
89
|
+
});
|
|
90
|
+
// GROUP レイアウトパラメータ
|
|
91
|
+
const groupLayoutForParameterSchema = z.object({
|
|
92
|
+
type: z.literal("GROUP").describe("A Group field"),
|
|
93
|
+
code: z.string().describe("The field code of the Group field"),
|
|
94
|
+
layout: z
|
|
95
|
+
.array(z.lazy(() => rowLayoutForParameterSchema))
|
|
96
|
+
.describe("List of field layouts inside the Group field"),
|
|
97
|
+
});
|
|
98
|
+
// LayoutForParameter スキーマ
|
|
99
|
+
export const layoutForParameterSchema = z
|
|
100
|
+
.array(z.union([
|
|
101
|
+
rowLayoutForParameterSchema,
|
|
102
|
+
subtableLayoutForParameterSchema,
|
|
103
|
+
groupLayoutForParameterSchema,
|
|
104
|
+
]))
|
|
105
|
+
.describe("List of field layouts for the form");
|