Version not found. Please check the version and try again.
@nocobase/plugin-data-source-main 2.1.0-beta.8 → 2.2.0-alpha.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/dist/client/index.js +1 -1
- package/dist/externalVersion.js +9 -8
- package/dist/server/collections/collectionCategories.js +1 -0
- package/dist/server/collections/collections.js +1 -0
- package/dist/server/collections/fields.js +1 -0
- package/dist/server/mcp-post-processors.d.ts +19 -0
- package/dist/server/mcp-post-processors.js +90 -0
- package/dist/server/modeling/capabilities.d.ts +62 -0
- package/dist/server/modeling/capabilities.js +175 -0
- package/dist/server/modeling/collections.d.ts +128 -0
- package/dist/server/modeling/collections.js +280 -0
- package/dist/server/modeling/constants.d.ts +26 -0
- package/dist/server/modeling/constants.js +239 -0
- package/dist/server/modeling/fields.d.ts +13 -0
- package/dist/server/modeling/fields.js +631 -0
- package/dist/server/modeling/service.d.ts +36 -0
- package/dist/server/modeling/service.js +170 -0
- package/dist/server/models/collection.js +2 -1
- package/dist/server/repositories/collection-repository.js +6 -0
- package/dist/server/resourcers/collections.d.ts +5 -0
- package/dist/server/resourcers/collections.js +87 -66
- package/dist/server/server.js +5 -2
- package/dist/swagger/index.d.ts +1454 -32
- package/dist/swagger/index.js +1168 -68
- package/package.json +2 -2
package/dist/swagger/index.js
CHANGED
|
@@ -36,28 +36,115 @@ var swagger_default = {
|
|
|
36
36
|
},
|
|
37
37
|
tags: [
|
|
38
38
|
{
|
|
39
|
-
name: "collections"
|
|
39
|
+
name: "collections",
|
|
40
|
+
description: "Collection modeling: CRUD, metadata inspection and bulk field updates"
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
|
-
name: "collections.fields"
|
|
43
|
+
name: "collections.fields",
|
|
44
|
+
description: "Field modeling under a collection: scalar fields, relations and ordering"
|
|
43
45
|
},
|
|
44
46
|
{
|
|
45
|
-
name: "collectionCategories"
|
|
47
|
+
name: "collectionCategories",
|
|
48
|
+
description: "Collection category management"
|
|
46
49
|
},
|
|
47
50
|
{
|
|
48
51
|
name: "dbViews",
|
|
49
|
-
description: "
|
|
52
|
+
description: "Database view inspection for view-based collections"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "fields",
|
|
56
|
+
description: "High-level field modeling entry for compact field application requests"
|
|
50
57
|
}
|
|
51
58
|
],
|
|
52
59
|
paths: {
|
|
53
60
|
"/collections:list": {
|
|
54
61
|
get: {
|
|
55
62
|
tags: ["collections"],
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
summary: "List collections",
|
|
64
|
+
description: [
|
|
65
|
+
"Get paginated collection records from the collection manager.",
|
|
66
|
+
"",
|
|
67
|
+
"Suitable for finding collection names, titles, templates, and other high-level metadata",
|
|
68
|
+
"before inspecting one collection in detail."
|
|
69
|
+
].join("\n"),
|
|
70
|
+
parameters: [
|
|
71
|
+
{ $ref: "#/components/schemas/common/filter" },
|
|
72
|
+
{ $ref: "#/components/schemas/common/sort" },
|
|
73
|
+
{ $ref: "#/components/schemas/common/fields" },
|
|
74
|
+
{ $ref: "#/components/schemas/common/appends" },
|
|
75
|
+
{ $ref: "#/components/schemas/common/except" },
|
|
76
|
+
{ $ref: "#/components/schemas/common/page" },
|
|
77
|
+
{ $ref: "#/components/schemas/common/pageSize" },
|
|
78
|
+
{ $ref: "#/components/schemas/common/paginate" }
|
|
79
|
+
],
|
|
58
80
|
responses: {
|
|
59
81
|
"200": {
|
|
60
|
-
description: "OK"
|
|
82
|
+
description: "OK",
|
|
83
|
+
content: {
|
|
84
|
+
"application/json": {
|
|
85
|
+
schema: {
|
|
86
|
+
type: "object",
|
|
87
|
+
properties: {
|
|
88
|
+
data: {
|
|
89
|
+
type: "array",
|
|
90
|
+
items: { $ref: "#/components/schemas/collection/model" }
|
|
91
|
+
},
|
|
92
|
+
meta: { $ref: "#/components/schemas/common/paginationMeta" }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"/collections:listMeta": {
|
|
102
|
+
get: {
|
|
103
|
+
tags: ["collections"],
|
|
104
|
+
summary: "List loaded collections with field metadata",
|
|
105
|
+
description: [
|
|
106
|
+
"Return the collections currently loaded in the application, including sorted field metadata.",
|
|
107
|
+
"",
|
|
108
|
+
"This is usually the best inspection endpoint before editing a schema because it exposes",
|
|
109
|
+
"collection options, `filterTargetKey`, unavailable actions, and field definitions together."
|
|
110
|
+
].join("\n"),
|
|
111
|
+
responses: {
|
|
112
|
+
"200": {
|
|
113
|
+
description: "OK",
|
|
114
|
+
content: {
|
|
115
|
+
"application/json": {
|
|
116
|
+
schema: {
|
|
117
|
+
type: "object",
|
|
118
|
+
properties: {
|
|
119
|
+
data: {
|
|
120
|
+
type: "array",
|
|
121
|
+
items: {
|
|
122
|
+
allOf: [
|
|
123
|
+
{ $ref: "#/components/schemas/collection/model" },
|
|
124
|
+
{
|
|
125
|
+
type: "object",
|
|
126
|
+
properties: {
|
|
127
|
+
filterTargetKey: {
|
|
128
|
+
type: "string",
|
|
129
|
+
description: "Field used by repository `filterByTk`, often `name` for collections"
|
|
130
|
+
},
|
|
131
|
+
unavailableActions: {
|
|
132
|
+
type: "array",
|
|
133
|
+
items: { type: "string" }
|
|
134
|
+
},
|
|
135
|
+
fields: {
|
|
136
|
+
type: "array",
|
|
137
|
+
items: { $ref: "#/components/schemas/field/model" }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
61
148
|
}
|
|
62
149
|
}
|
|
63
150
|
}
|
|
@@ -65,11 +152,32 @@ var swagger_default = {
|
|
|
65
152
|
"/collections:get": {
|
|
66
153
|
get: {
|
|
67
154
|
tags: ["collections"],
|
|
68
|
-
|
|
69
|
-
|
|
155
|
+
summary: "Get a collection",
|
|
156
|
+
description: [
|
|
157
|
+
"Get a single collection by collection name (`filterByTk`).",
|
|
158
|
+
"",
|
|
159
|
+
"Use this when you need the current collection definition before changing fields,",
|
|
160
|
+
"template-specific options, or other collection-level settings."
|
|
161
|
+
].join("\n"),
|
|
162
|
+
parameters: [
|
|
163
|
+
{ $ref: "#/components/schemas/collection/filterByTk" },
|
|
164
|
+
{ $ref: "#/components/schemas/common/filter" },
|
|
165
|
+
{ $ref: "#/components/schemas/common/appends" },
|
|
166
|
+
{ $ref: "#/components/schemas/common/except" }
|
|
167
|
+
],
|
|
70
168
|
responses: {
|
|
71
169
|
"200": {
|
|
72
|
-
description: "OK"
|
|
170
|
+
description: "OK",
|
|
171
|
+
content: {
|
|
172
|
+
"application/json": {
|
|
173
|
+
schema: {
|
|
174
|
+
type: "object",
|
|
175
|
+
properties: {
|
|
176
|
+
data: { $ref: "#/components/schemas/collection/model" }
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
73
181
|
}
|
|
74
182
|
}
|
|
75
183
|
}
|
|
@@ -77,11 +185,33 @@ var swagger_default = {
|
|
|
77
185
|
"/collections:create": {
|
|
78
186
|
post: {
|
|
79
187
|
tags: ["collections"],
|
|
80
|
-
|
|
81
|
-
|
|
188
|
+
summary: "Create a collection",
|
|
189
|
+
description: [
|
|
190
|
+
"Create a new collection and optionally create fields in the same request.",
|
|
191
|
+
"",
|
|
192
|
+
"Request body uses collection values directly.",
|
|
193
|
+
"Do not wrap the payload in an extra `values` object."
|
|
194
|
+
].join("\n"),
|
|
195
|
+
requestBody: {
|
|
196
|
+
content: {
|
|
197
|
+
"application/json": {
|
|
198
|
+
schema: { $ref: "#/components/schemas/collection/create" }
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
82
202
|
responses: {
|
|
83
203
|
"200": {
|
|
84
|
-
description: "OK"
|
|
204
|
+
description: "OK",
|
|
205
|
+
content: {
|
|
206
|
+
"application/json": {
|
|
207
|
+
schema: {
|
|
208
|
+
type: "object",
|
|
209
|
+
properties: {
|
|
210
|
+
data: { $ref: "#/components/schemas/collection/model" }
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
85
215
|
}
|
|
86
216
|
}
|
|
87
217
|
}
|
|
@@ -89,8 +219,21 @@ var swagger_default = {
|
|
|
89
219
|
"/collections:update": {
|
|
90
220
|
post: {
|
|
91
221
|
tags: ["collections"],
|
|
92
|
-
|
|
93
|
-
|
|
222
|
+
summary: "Update a collection",
|
|
223
|
+
description: [
|
|
224
|
+
"Update a collection by collection name (`filterByTk`).",
|
|
225
|
+
"",
|
|
226
|
+
"Request body uses collection values directly.",
|
|
227
|
+
"Do not wrap the payload in an extra `values` object."
|
|
228
|
+
].join("\n"),
|
|
229
|
+
parameters: [{ $ref: "#/components/schemas/collection/filterByTk" }],
|
|
230
|
+
requestBody: {
|
|
231
|
+
content: {
|
|
232
|
+
"application/json": {
|
|
233
|
+
schema: { $ref: "#/components/schemas/collection/update" }
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
},
|
|
94
237
|
responses: {
|
|
95
238
|
"200": {
|
|
96
239
|
description: "OK"
|
|
@@ -101,8 +244,21 @@ var swagger_default = {
|
|
|
101
244
|
"/collections:destroy": {
|
|
102
245
|
post: {
|
|
103
246
|
tags: ["collections"],
|
|
104
|
-
|
|
105
|
-
|
|
247
|
+
summary: "Destroy a collection",
|
|
248
|
+
description: [
|
|
249
|
+
"Delete a collection by collection name (`filterByTk`).",
|
|
250
|
+
"",
|
|
251
|
+
"If `cascade` is true, dependent database objects such as related views can be removed together."
|
|
252
|
+
].join("\n"),
|
|
253
|
+
parameters: [
|
|
254
|
+
{ $ref: "#/components/schemas/collection/filterByTk" },
|
|
255
|
+
{
|
|
256
|
+
name: "cascade",
|
|
257
|
+
in: "query",
|
|
258
|
+
description: "Whether to cascade deletion to dependent database objects",
|
|
259
|
+
schema: { type: "boolean" }
|
|
260
|
+
}
|
|
261
|
+
],
|
|
106
262
|
responses: {
|
|
107
263
|
"200": {
|
|
108
264
|
description: "OK"
|
|
@@ -113,8 +269,15 @@ var swagger_default = {
|
|
|
113
269
|
"/collections:move": {
|
|
114
270
|
post: {
|
|
115
271
|
tags: ["collections"],
|
|
116
|
-
|
|
117
|
-
|
|
272
|
+
summary: "Move a collection",
|
|
273
|
+
description: "Reorder a collection inside collection manager sorting.",
|
|
274
|
+
requestBody: {
|
|
275
|
+
content: {
|
|
276
|
+
"application/json": {
|
|
277
|
+
schema: { $ref: "#/components/schemas/common/moveRequest" }
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
},
|
|
118
281
|
responses: {
|
|
119
282
|
"200": {
|
|
120
283
|
description: "OK"
|
|
@@ -125,8 +288,40 @@ var swagger_default = {
|
|
|
125
288
|
"/collections:setFields": {
|
|
126
289
|
post: {
|
|
127
290
|
tags: ["collections"],
|
|
128
|
-
|
|
129
|
-
|
|
291
|
+
summary: "Replace a collection field set",
|
|
292
|
+
description: [
|
|
293
|
+
"Synchronize the complete field list of a collection.",
|
|
294
|
+
"",
|
|
295
|
+
"Server behavior:",
|
|
296
|
+
"- fields present in request and already existing are updated",
|
|
297
|
+
"- fields missing from request are destroyed",
|
|
298
|
+
"- new fields are created",
|
|
299
|
+
"",
|
|
300
|
+
"This is the preferred bulk replacement endpoint for view collections after reading fresh metadata from `dbViews:get`."
|
|
301
|
+
].join("\n"),
|
|
302
|
+
parameters: [{ $ref: "#/components/schemas/collection/filterByTk" }],
|
|
303
|
+
requestBody: {
|
|
304
|
+
content: {
|
|
305
|
+
"application/json": {
|
|
306
|
+
schema: {
|
|
307
|
+
type: "object",
|
|
308
|
+
required: ["values"],
|
|
309
|
+
properties: {
|
|
310
|
+
values: {
|
|
311
|
+
type: "object",
|
|
312
|
+
required: ["fields"],
|
|
313
|
+
properties: {
|
|
314
|
+
fields: {
|
|
315
|
+
type: "array",
|
|
316
|
+
items: { $ref: "#/components/schemas/field/write" }
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
},
|
|
130
325
|
responses: {
|
|
131
326
|
"200": {
|
|
132
327
|
description: "OK"
|
|
@@ -134,14 +329,83 @@ var swagger_default = {
|
|
|
134
329
|
}
|
|
135
330
|
}
|
|
136
331
|
},
|
|
332
|
+
"/collections:apply": {
|
|
333
|
+
post: {
|
|
334
|
+
tags: ["collections"],
|
|
335
|
+
summary: "Create or update a collection through the compact high-level modeling interface",
|
|
336
|
+
description: [
|
|
337
|
+
"Upsert a collection from a compact request body.",
|
|
338
|
+
"",
|
|
339
|
+
"This endpoint accepts a compact collection payload and fills derived defaults in server logic.",
|
|
340
|
+
"",
|
|
341
|
+
"Prefer concise inputs such as collection name, title, template, and only the extra options",
|
|
342
|
+
"that cannot be derived safely.",
|
|
343
|
+
"",
|
|
344
|
+
"Use `fields` only when creating or replacing multiple fields together.",
|
|
345
|
+
"Use `settings` only for advanced raw overrides."
|
|
346
|
+
].join("\n"),
|
|
347
|
+
requestBody: {
|
|
348
|
+
content: {
|
|
349
|
+
"application/json": {
|
|
350
|
+
schema: { $ref: "#/components/schemas/collection/apply" }
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
responses: {
|
|
355
|
+
"200": {
|
|
356
|
+
description: "OK",
|
|
357
|
+
content: {
|
|
358
|
+
"application/json": {
|
|
359
|
+
schema: {
|
|
360
|
+
type: "object",
|
|
361
|
+
properties: {
|
|
362
|
+
data: { $ref: "#/components/schemas/collection/model" },
|
|
363
|
+
verify: {
|
|
364
|
+
type: "object",
|
|
365
|
+
additionalProperties: true
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
},
|
|
137
375
|
"/collections/{collectionName}/fields:get": {
|
|
138
376
|
get: {
|
|
139
377
|
tags: ["collections.fields"],
|
|
140
|
-
|
|
141
|
-
|
|
378
|
+
summary: "Get a field in a collection",
|
|
379
|
+
description: [
|
|
380
|
+
"Get a single field by field name (`filterByTk`) under a collection.",
|
|
381
|
+
"",
|
|
382
|
+
"Use the logical field name, for example `title`, `company`, or `scheduledAt`.",
|
|
383
|
+
"Do not use the field `key` here.",
|
|
384
|
+
"",
|
|
385
|
+
"If field-name lookup is ambiguous in client tooling, fall back to `fields:list` and filter by `name` or `key`.",
|
|
386
|
+
"For MCP workflows, a reliable fallback is the generic CRUD tool with",
|
|
387
|
+
'`resource: "collections.fields"`, `sourceId: "<collectionName>"`, `action: "get"`, and the same `filterByTk`.'
|
|
388
|
+
].join("\n"),
|
|
389
|
+
parameters: [
|
|
390
|
+
{ $ref: "#/components/schemas/field/collectionName" },
|
|
391
|
+
{ $ref: "#/components/schemas/field/filterByTk" },
|
|
392
|
+
{ $ref: "#/components/schemas/common/filter" },
|
|
393
|
+
{ $ref: "#/components/schemas/common/appends" },
|
|
394
|
+
{ $ref: "#/components/schemas/common/except" }
|
|
395
|
+
],
|
|
142
396
|
responses: {
|
|
143
397
|
"200": {
|
|
144
|
-
description: "OK"
|
|
398
|
+
description: "OK",
|
|
399
|
+
content: {
|
|
400
|
+
"application/json": {
|
|
401
|
+
schema: {
|
|
402
|
+
type: "object",
|
|
403
|
+
properties: {
|
|
404
|
+
data: { $ref: "#/components/schemas/field/model" }
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
145
409
|
}
|
|
146
410
|
}
|
|
147
411
|
}
|
|
@@ -149,11 +413,36 @@ var swagger_default = {
|
|
|
149
413
|
"/collections/{collectionName}/fields:list": {
|
|
150
414
|
get: {
|
|
151
415
|
tags: ["collections.fields"],
|
|
152
|
-
|
|
153
|
-
|
|
416
|
+
summary: "List fields in a collection",
|
|
417
|
+
description: "List fields belonging to the specified collection.",
|
|
418
|
+
parameters: [
|
|
419
|
+
{ $ref: "#/components/schemas/field/collectionName" },
|
|
420
|
+
{ $ref: "#/components/schemas/common/filter" },
|
|
421
|
+
{ $ref: "#/components/schemas/common/sort" },
|
|
422
|
+
{ $ref: "#/components/schemas/common/fields" },
|
|
423
|
+
{ $ref: "#/components/schemas/common/appends" },
|
|
424
|
+
{ $ref: "#/components/schemas/common/except" },
|
|
425
|
+
{ $ref: "#/components/schemas/common/page" },
|
|
426
|
+
{ $ref: "#/components/schemas/common/pageSize" },
|
|
427
|
+
{ $ref: "#/components/schemas/common/paginate" }
|
|
428
|
+
],
|
|
154
429
|
responses: {
|
|
155
430
|
"200": {
|
|
156
|
-
description: "OK"
|
|
431
|
+
description: "OK",
|
|
432
|
+
content: {
|
|
433
|
+
"application/json": {
|
|
434
|
+
schema: {
|
|
435
|
+
type: "object",
|
|
436
|
+
properties: {
|
|
437
|
+
data: {
|
|
438
|
+
type: "array",
|
|
439
|
+
items: { $ref: "#/components/schemas/field/model" }
|
|
440
|
+
},
|
|
441
|
+
meta: { $ref: "#/components/schemas/common/paginationMeta" }
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
}
|
|
157
446
|
}
|
|
158
447
|
}
|
|
159
448
|
}
|
|
@@ -161,11 +450,49 @@ var swagger_default = {
|
|
|
161
450
|
"/collections/{collectionName}/fields:create": {
|
|
162
451
|
post: {
|
|
163
452
|
tags: ["collections.fields"],
|
|
164
|
-
|
|
165
|
-
|
|
453
|
+
summary: "Create a field in a collection",
|
|
454
|
+
description: [
|
|
455
|
+
"Create a scalar field or relation field under `collectionName`.",
|
|
456
|
+
"",
|
|
457
|
+
"Pass `collectionName` as the path parameter, not inside the JSON body.",
|
|
458
|
+
"The JSON body contains field values directly.",
|
|
459
|
+
"",
|
|
460
|
+
"Example path + body:",
|
|
461
|
+
"```",
|
|
462
|
+
"POST /api/collections/crm_companies/fields:create",
|
|
463
|
+
'{ "name": "name", "type": "string", "interface": "input" }',
|
|
464
|
+
"```",
|
|
465
|
+
"",
|
|
466
|
+
"Relation defaults are generated server-side when omitted:",
|
|
467
|
+
"- `belongsTo`: infers `target` from field name pluralization and generates `foreignKey`",
|
|
468
|
+
"- `hasMany`: infers `target`, `sourceKey`, `targetKey`, and generates `foreignKey`",
|
|
469
|
+
"- `belongsToMany`: infers `target`, generates `through`, `foreignKey`, `otherKey`",
|
|
470
|
+
"",
|
|
471
|
+
"Relation creation may also create companion foreign-key fields such as `companyId` or `ownerId`.",
|
|
472
|
+
"",
|
|
473
|
+
"For stable automation, pass `target`, `foreignKey`, `sourceKey`, `targetKey`, and `through` explicitly."
|
|
474
|
+
].join("\n"),
|
|
475
|
+
parameters: [{ $ref: "#/components/schemas/field/collectionName" }],
|
|
476
|
+
requestBody: {
|
|
477
|
+
content: {
|
|
478
|
+
"application/json": {
|
|
479
|
+
schema: { $ref: "#/components/schemas/field/create" }
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
},
|
|
166
483
|
responses: {
|
|
167
484
|
"200": {
|
|
168
|
-
description: "OK"
|
|
485
|
+
description: "OK",
|
|
486
|
+
content: {
|
|
487
|
+
"application/json": {
|
|
488
|
+
schema: {
|
|
489
|
+
type: "object",
|
|
490
|
+
properties: {
|
|
491
|
+
data: { $ref: "#/components/schemas/field/model" }
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
169
496
|
}
|
|
170
497
|
}
|
|
171
498
|
}
|
|
@@ -173,11 +500,45 @@ var swagger_default = {
|
|
|
173
500
|
"/collections/{collectionName}/fields:update": {
|
|
174
501
|
post: {
|
|
175
502
|
tags: ["collections.fields"],
|
|
176
|
-
|
|
177
|
-
|
|
503
|
+
summary: "Update a field in a collection",
|
|
504
|
+
description: [
|
|
505
|
+
"Update an existing field in a collection.",
|
|
506
|
+
"",
|
|
507
|
+
"Pass `collectionName` as the path parameter.",
|
|
508
|
+
"The JSON body contains field values directly.",
|
|
509
|
+
"Do not wrap the payload in an extra `values` object.",
|
|
510
|
+
"",
|
|
511
|
+
"You can target the field either by `filterByTk` (recommended, field name in this association resource)",
|
|
512
|
+
'or by a `filter` object such as `{ "key": "<field-key>" }`.'
|
|
513
|
+
].join("\n"),
|
|
514
|
+
parameters: [
|
|
515
|
+
{ $ref: "#/components/schemas/field/collectionName" },
|
|
516
|
+
{ $ref: "#/components/schemas/field/filterByTkOptional" },
|
|
517
|
+
{ $ref: "#/components/schemas/common/filter" }
|
|
518
|
+
],
|
|
519
|
+
requestBody: {
|
|
520
|
+
content: {
|
|
521
|
+
"application/json": {
|
|
522
|
+
schema: { $ref: "#/components/schemas/field/update" }
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
},
|
|
178
526
|
responses: {
|
|
179
527
|
"200": {
|
|
180
|
-
description: "OK"
|
|
528
|
+
description: "OK",
|
|
529
|
+
content: {
|
|
530
|
+
"application/json": {
|
|
531
|
+
schema: {
|
|
532
|
+
type: "object",
|
|
533
|
+
properties: {
|
|
534
|
+
data: {
|
|
535
|
+
type: "array",
|
|
536
|
+
items: { $ref: "#/components/schemas/field/model" }
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
}
|
|
181
542
|
}
|
|
182
543
|
}
|
|
183
544
|
}
|
|
@@ -185,8 +546,17 @@ var swagger_default = {
|
|
|
185
546
|
"/collections/{collectionName}/fields:destroy": {
|
|
186
547
|
post: {
|
|
187
548
|
tags: ["collections.fields"],
|
|
188
|
-
|
|
189
|
-
|
|
549
|
+
summary: "Destroy a field in a collection",
|
|
550
|
+
description: [
|
|
551
|
+
"Delete a field in a collection.",
|
|
552
|
+
"",
|
|
553
|
+
"Use `filterByTk` with the field name for the common case."
|
|
554
|
+
].join("\n"),
|
|
555
|
+
parameters: [
|
|
556
|
+
{ $ref: "#/components/schemas/field/collectionName" },
|
|
557
|
+
{ $ref: "#/components/schemas/field/filterByTk" },
|
|
558
|
+
{ $ref: "#/components/schemas/common/filter" }
|
|
559
|
+
],
|
|
190
560
|
responses: {
|
|
191
561
|
"200": {
|
|
192
562
|
description: "OK"
|
|
@@ -197,8 +567,16 @@ var swagger_default = {
|
|
|
197
567
|
"/collections/{collectionName}/fields:move": {
|
|
198
568
|
post: {
|
|
199
569
|
tags: ["collections.fields"],
|
|
200
|
-
|
|
201
|
-
|
|
570
|
+
summary: "Move a field in a collection",
|
|
571
|
+
description: "Reorder fields within a collection.",
|
|
572
|
+
parameters: [{ $ref: "#/components/schemas/field/collectionName" }],
|
|
573
|
+
requestBody: {
|
|
574
|
+
content: {
|
|
575
|
+
"application/json": {
|
|
576
|
+
schema: { $ref: "#/components/schemas/common/moveRequest" }
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
},
|
|
202
580
|
responses: {
|
|
203
581
|
"200": {
|
|
204
582
|
description: "OK"
|
|
@@ -206,14 +584,70 @@ var swagger_default = {
|
|
|
206
584
|
}
|
|
207
585
|
}
|
|
208
586
|
},
|
|
587
|
+
"/fields:apply": {
|
|
588
|
+
post: {
|
|
589
|
+
tags: ["fields"],
|
|
590
|
+
summary: "Create or update a field through the compact high-level modeling interface",
|
|
591
|
+
description: [
|
|
592
|
+
"Upsert one field from a compact request body.",
|
|
593
|
+
"",
|
|
594
|
+
"This endpoint accepts a compact field payload and fills derived defaults in server logic.",
|
|
595
|
+
"",
|
|
596
|
+
"Prefer concise inputs such as collection name, field name, title, and interface.",
|
|
597
|
+
"Supply relation target, enum, default value, reverse-field details, or raw settings only when needed."
|
|
598
|
+
].join("\n"),
|
|
599
|
+
requestBody: {
|
|
600
|
+
content: {
|
|
601
|
+
"application/json": {
|
|
602
|
+
schema: { $ref: "#/components/schemas/field/apply" }
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
},
|
|
606
|
+
responses: {
|
|
607
|
+
"200": {
|
|
608
|
+
description: "OK",
|
|
609
|
+
content: {
|
|
610
|
+
"application/json": {
|
|
611
|
+
schema: {
|
|
612
|
+
type: "object",
|
|
613
|
+
properties: {
|
|
614
|
+
data: { $ref: "#/components/schemas/field/model" }
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
},
|
|
209
623
|
"/collectionCategories:list": {
|
|
210
624
|
post: {
|
|
211
625
|
tags: ["collectionCategories"],
|
|
212
|
-
|
|
213
|
-
|
|
626
|
+
summary: "List collection categories",
|
|
627
|
+
description: "List collection category records.",
|
|
628
|
+
parameters: [
|
|
629
|
+
{ $ref: "#/components/schemas/common/filter" },
|
|
630
|
+
{ $ref: "#/components/schemas/common/sort" },
|
|
631
|
+
{ $ref: "#/components/schemas/common/page" },
|
|
632
|
+
{ $ref: "#/components/schemas/common/pageSize" }
|
|
633
|
+
],
|
|
214
634
|
responses: {
|
|
215
635
|
"200": {
|
|
216
|
-
description: "OK"
|
|
636
|
+
description: "OK",
|
|
637
|
+
content: {
|
|
638
|
+
"application/json": {
|
|
639
|
+
schema: {
|
|
640
|
+
type: "object",
|
|
641
|
+
properties: {
|
|
642
|
+
data: {
|
|
643
|
+
type: "array",
|
|
644
|
+
items: { $ref: "#/components/schemas/collectionCategory/model" }
|
|
645
|
+
},
|
|
646
|
+
meta: { $ref: "#/components/schemas/common/paginationMeta" }
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
}
|
|
217
651
|
}
|
|
218
652
|
}
|
|
219
653
|
}
|
|
@@ -221,11 +655,21 @@ var swagger_default = {
|
|
|
221
655
|
"/collectionCategories:get": {
|
|
222
656
|
post: {
|
|
223
657
|
tags: ["collectionCategories"],
|
|
224
|
-
|
|
225
|
-
parameters: [],
|
|
658
|
+
summary: "Get a collection category",
|
|
659
|
+
parameters: [{ $ref: "#/components/schemas/collectionCategory/filterByTk" }],
|
|
226
660
|
responses: {
|
|
227
661
|
"200": {
|
|
228
|
-
description: "OK"
|
|
662
|
+
description: "OK",
|
|
663
|
+
content: {
|
|
664
|
+
"application/json": {
|
|
665
|
+
schema: {
|
|
666
|
+
type: "object",
|
|
667
|
+
properties: {
|
|
668
|
+
data: { $ref: "#/components/schemas/collectionCategory/model" }
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
}
|
|
229
673
|
}
|
|
230
674
|
}
|
|
231
675
|
}
|
|
@@ -233,8 +677,14 @@ var swagger_default = {
|
|
|
233
677
|
"/collectionCategories:create": {
|
|
234
678
|
post: {
|
|
235
679
|
tags: ["collectionCategories"],
|
|
236
|
-
|
|
237
|
-
|
|
680
|
+
summary: "Create a collection category",
|
|
681
|
+
requestBody: {
|
|
682
|
+
content: {
|
|
683
|
+
"application/json": {
|
|
684
|
+
schema: { $ref: "#/components/schemas/collectionCategory/create" }
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
},
|
|
238
688
|
responses: {
|
|
239
689
|
"200": {
|
|
240
690
|
description: "OK"
|
|
@@ -245,8 +695,15 @@ var swagger_default = {
|
|
|
245
695
|
"/collectionCategories:update": {
|
|
246
696
|
post: {
|
|
247
697
|
tags: ["collectionCategories"],
|
|
248
|
-
|
|
249
|
-
parameters: [],
|
|
698
|
+
summary: "Update a collection category",
|
|
699
|
+
parameters: [{ $ref: "#/components/schemas/collectionCategory/filterByTk" }],
|
|
700
|
+
requestBody: {
|
|
701
|
+
content: {
|
|
702
|
+
"application/json": {
|
|
703
|
+
schema: { $ref: "#/components/schemas/collectionCategory/update" }
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
},
|
|
250
707
|
responses: {
|
|
251
708
|
"200": {
|
|
252
709
|
description: "OK"
|
|
@@ -257,8 +714,8 @@ var swagger_default = {
|
|
|
257
714
|
"/collectionCategories:destroy": {
|
|
258
715
|
post: {
|
|
259
716
|
tags: ["collectionCategories"],
|
|
260
|
-
|
|
261
|
-
parameters: [],
|
|
717
|
+
summary: "Destroy a collection category",
|
|
718
|
+
parameters: [{ $ref: "#/components/schemas/collectionCategory/filterByTk" }],
|
|
262
719
|
responses: {
|
|
263
720
|
"200": {
|
|
264
721
|
description: "OK"
|
|
@@ -269,8 +726,14 @@ var swagger_default = {
|
|
|
269
726
|
"/collectionCategories:move": {
|
|
270
727
|
post: {
|
|
271
728
|
tags: ["collectionCategories"],
|
|
272
|
-
|
|
273
|
-
|
|
729
|
+
summary: "Move a collection category",
|
|
730
|
+
requestBody: {
|
|
731
|
+
content: {
|
|
732
|
+
"application/json": {
|
|
733
|
+
schema: { $ref: "#/components/schemas/common/moveRequest" }
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
},
|
|
274
737
|
responses: {
|
|
275
738
|
"200": {
|
|
276
739
|
description: "OK"
|
|
@@ -281,12 +744,12 @@ var swagger_default = {
|
|
|
281
744
|
"/dbViews:get": {
|
|
282
745
|
get: {
|
|
283
746
|
tags: ["dbViews"],
|
|
284
|
-
summary: "
|
|
747
|
+
summary: "Get database view fields",
|
|
285
748
|
parameters: [
|
|
286
749
|
{
|
|
287
750
|
name: "filterByTk",
|
|
288
751
|
in: "query",
|
|
289
|
-
description: "
|
|
752
|
+
description: "View name in database",
|
|
290
753
|
schema: {
|
|
291
754
|
type: "string"
|
|
292
755
|
},
|
|
@@ -296,7 +759,7 @@ var swagger_default = {
|
|
|
296
759
|
{
|
|
297
760
|
name: "schema",
|
|
298
761
|
in: "query",
|
|
299
|
-
description: "
|
|
762
|
+
description: "PostgreSQL schema of the view",
|
|
300
763
|
schema: {
|
|
301
764
|
type: "string"
|
|
302
765
|
}
|
|
@@ -318,9 +781,9 @@ var swagger_default = {
|
|
|
318
781
|
additionalProperties: {
|
|
319
782
|
type: "object",
|
|
320
783
|
properties: {
|
|
321
|
-
name: { type: "string", description: "
|
|
322
|
-
type: { type: "string", description: "
|
|
323
|
-
source: { type: "string",
|
|
784
|
+
name: { type: "string", description: "Field name" },
|
|
785
|
+
type: { type: "string", description: "Field type" },
|
|
786
|
+
source: { type: "string", description: "Source field of the view field" }
|
|
324
787
|
}
|
|
325
788
|
}
|
|
326
789
|
},
|
|
@@ -341,7 +804,8 @@ var swagger_default = {
|
|
|
341
804
|
"/dbViews:list": {
|
|
342
805
|
get: {
|
|
343
806
|
tags: ["dbViews"],
|
|
344
|
-
summary: "
|
|
807
|
+
summary: "List detached database views",
|
|
808
|
+
description: "List database views that are not yet connected to collection definitions.",
|
|
345
809
|
responses: {
|
|
346
810
|
"200": {
|
|
347
811
|
description: "OK",
|
|
@@ -355,9 +819,9 @@ var swagger_default = {
|
|
|
355
819
|
items: {
|
|
356
820
|
type: "object",
|
|
357
821
|
properties: {
|
|
358
|
-
name: { type: "string", description: "name
|
|
359
|
-
definition: { type: "string", description: "definition
|
|
360
|
-
schema: { type: "string", description: "
|
|
822
|
+
name: { type: "string", description: "View name" },
|
|
823
|
+
definition: { type: "string", description: "View definition SQL" },
|
|
824
|
+
schema: { type: "string", description: "Schema name" }
|
|
361
825
|
}
|
|
362
826
|
}
|
|
363
827
|
}
|
|
@@ -372,12 +836,12 @@ var swagger_default = {
|
|
|
372
836
|
"/dbViews:query": {
|
|
373
837
|
get: {
|
|
374
838
|
tags: ["dbViews"],
|
|
375
|
-
summary: "
|
|
839
|
+
summary: "Query database view rows",
|
|
376
840
|
parameters: [
|
|
377
841
|
{
|
|
378
842
|
name: "filterByTk",
|
|
379
843
|
in: "query",
|
|
380
|
-
description: "
|
|
844
|
+
description: "View name in database",
|
|
381
845
|
schema: {
|
|
382
846
|
type: "string"
|
|
383
847
|
},
|
|
@@ -387,7 +851,7 @@ var swagger_default = {
|
|
|
387
851
|
{
|
|
388
852
|
name: "schema",
|
|
389
853
|
in: "query",
|
|
390
|
-
description: "
|
|
854
|
+
description: "PostgreSQL schema of the view",
|
|
391
855
|
schema: {
|
|
392
856
|
type: "string"
|
|
393
857
|
}
|
|
@@ -395,7 +859,7 @@ var swagger_default = {
|
|
|
395
859
|
{
|
|
396
860
|
name: "page",
|
|
397
861
|
in: "query",
|
|
398
|
-
description: "
|
|
862
|
+
description: "Page number",
|
|
399
863
|
schema: {
|
|
400
864
|
type: "integer"
|
|
401
865
|
}
|
|
@@ -403,7 +867,7 @@ var swagger_default = {
|
|
|
403
867
|
{
|
|
404
868
|
name: "pageSize",
|
|
405
869
|
in: "query",
|
|
406
|
-
description: "
|
|
870
|
+
description: "Page size",
|
|
407
871
|
schema: {
|
|
408
872
|
type: "integer"
|
|
409
873
|
}
|
|
@@ -421,10 +885,10 @@ var swagger_default = {
|
|
|
421
885
|
type: "array",
|
|
422
886
|
items: {
|
|
423
887
|
type: "object",
|
|
424
|
-
description: "
|
|
888
|
+
description: "Row data of the view",
|
|
425
889
|
additionalProperties: {
|
|
426
890
|
type: "object",
|
|
427
|
-
description: "
|
|
891
|
+
description: "Field value in the row"
|
|
428
892
|
}
|
|
429
893
|
}
|
|
430
894
|
}
|
|
@@ -436,5 +900,641 @@ var swagger_default = {
|
|
|
436
900
|
}
|
|
437
901
|
}
|
|
438
902
|
}
|
|
903
|
+
},
|
|
904
|
+
components: {
|
|
905
|
+
schemas: {
|
|
906
|
+
common: {
|
|
907
|
+
filter: {
|
|
908
|
+
name: "filter",
|
|
909
|
+
in: "query",
|
|
910
|
+
description: "Structured NocoBase filter object",
|
|
911
|
+
schema: {
|
|
912
|
+
type: "object",
|
|
913
|
+
additionalProperties: true
|
|
914
|
+
}
|
|
915
|
+
},
|
|
916
|
+
sort: {
|
|
917
|
+
name: "sort",
|
|
918
|
+
in: "query",
|
|
919
|
+
description: "Sort fields. Prefix with `-` for descending",
|
|
920
|
+
schema: {
|
|
921
|
+
type: "string"
|
|
922
|
+
}
|
|
923
|
+
},
|
|
924
|
+
fields: {
|
|
925
|
+
name: "fields",
|
|
926
|
+
in: "query",
|
|
927
|
+
description: "Return only specified fields",
|
|
928
|
+
schema: {
|
|
929
|
+
type: "array",
|
|
930
|
+
items: { type: "string" }
|
|
931
|
+
}
|
|
932
|
+
},
|
|
933
|
+
appends: {
|
|
934
|
+
name: "appends",
|
|
935
|
+
in: "query",
|
|
936
|
+
description: "Append association data",
|
|
937
|
+
schema: {
|
|
938
|
+
type: "array",
|
|
939
|
+
items: { type: "string" }
|
|
940
|
+
}
|
|
941
|
+
},
|
|
942
|
+
except: {
|
|
943
|
+
name: "except",
|
|
944
|
+
in: "query",
|
|
945
|
+
description: "Exclude specified fields from response",
|
|
946
|
+
schema: {
|
|
947
|
+
type: "array",
|
|
948
|
+
items: { type: "string" }
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
page: {
|
|
952
|
+
name: "page",
|
|
953
|
+
in: "query",
|
|
954
|
+
description: "Page number (1-based)",
|
|
955
|
+
schema: {
|
|
956
|
+
type: "integer",
|
|
957
|
+
default: 1
|
|
958
|
+
}
|
|
959
|
+
},
|
|
960
|
+
pageSize: {
|
|
961
|
+
name: "pageSize",
|
|
962
|
+
in: "query",
|
|
963
|
+
description: "Number of items per page",
|
|
964
|
+
schema: {
|
|
965
|
+
type: "integer",
|
|
966
|
+
default: 20
|
|
967
|
+
}
|
|
968
|
+
},
|
|
969
|
+
paginate: {
|
|
970
|
+
name: "paginate",
|
|
971
|
+
in: "query",
|
|
972
|
+
description: "Whether to return paginated result format",
|
|
973
|
+
schema: {
|
|
974
|
+
type: "boolean",
|
|
975
|
+
default: true
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
paginationMeta: {
|
|
979
|
+
type: "object",
|
|
980
|
+
properties: {
|
|
981
|
+
count: { type: "integer" },
|
|
982
|
+
page: { type: "integer" },
|
|
983
|
+
pageSize: { type: "integer" },
|
|
984
|
+
totalPage: { type: "integer" }
|
|
985
|
+
}
|
|
986
|
+
},
|
|
987
|
+
moveRequest: {
|
|
988
|
+
type: "object",
|
|
989
|
+
properties: {
|
|
990
|
+
sourceId: {
|
|
991
|
+
type: "string",
|
|
992
|
+
description: "Source record identifier"
|
|
993
|
+
},
|
|
994
|
+
targetId: {
|
|
995
|
+
type: "string",
|
|
996
|
+
description: "Target record identifier"
|
|
997
|
+
},
|
|
998
|
+
method: {
|
|
999
|
+
type: "string",
|
|
1000
|
+
description: "Move method, usually `insertAfter` or `insertBefore`",
|
|
1001
|
+
enum: ["insertAfter", "insertBefore"]
|
|
1002
|
+
},
|
|
1003
|
+
sortField: {
|
|
1004
|
+
type: "string",
|
|
1005
|
+
description: "Sort field name, default is `sort`"
|
|
1006
|
+
},
|
|
1007
|
+
targetScope: {
|
|
1008
|
+
type: "string",
|
|
1009
|
+
description: "Target scope for scoped sorting"
|
|
1010
|
+
},
|
|
1011
|
+
sticky: {
|
|
1012
|
+
type: "boolean",
|
|
1013
|
+
description: "Whether to pin the source item to top"
|
|
1014
|
+
}
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
},
|
|
1018
|
+
collection: {
|
|
1019
|
+
filterByTk: {
|
|
1020
|
+
name: "filterByTk",
|
|
1021
|
+
in: "query",
|
|
1022
|
+
description: "Collection name",
|
|
1023
|
+
required: true,
|
|
1024
|
+
schema: { type: "string" },
|
|
1025
|
+
example: "posts"
|
|
1026
|
+
},
|
|
1027
|
+
model: {
|
|
1028
|
+
type: "object",
|
|
1029
|
+
properties: {
|
|
1030
|
+
key: { type: "string", description: "Collection manager primary key" },
|
|
1031
|
+
name: { type: "string", description: "Collection name / table name" },
|
|
1032
|
+
title: { type: "string", description: "Display title" },
|
|
1033
|
+
description: { type: "string", nullable: true },
|
|
1034
|
+
inherit: { type: "boolean" },
|
|
1035
|
+
hidden: { type: "boolean" },
|
|
1036
|
+
sortable: {
|
|
1037
|
+
oneOf: [{ type: "boolean" }, { type: "string" }, { type: "object", additionalProperties: true }],
|
|
1038
|
+
description: "Sorting configuration"
|
|
1039
|
+
},
|
|
1040
|
+
autoGenId: { type: "boolean" },
|
|
1041
|
+
createdBy: { type: "boolean" },
|
|
1042
|
+
updatedBy: { type: "boolean" },
|
|
1043
|
+
timestamps: { type: "boolean" },
|
|
1044
|
+
logging: { type: "boolean" },
|
|
1045
|
+
shared: { type: "boolean" },
|
|
1046
|
+
schema: { type: "string", nullable: true },
|
|
1047
|
+
view: { type: "boolean" },
|
|
1048
|
+
template: { type: "string", nullable: true },
|
|
1049
|
+
filterTargetKey: { type: "string", nullable: true },
|
|
1050
|
+
titleField: { type: "string", nullable: true },
|
|
1051
|
+
origin: { type: "string", nullable: true },
|
|
1052
|
+
from: { type: "string", nullable: true },
|
|
1053
|
+
options: {
|
|
1054
|
+
type: "object",
|
|
1055
|
+
additionalProperties: true,
|
|
1056
|
+
description: "Extra collection options not promoted to top-level properties"
|
|
1057
|
+
}
|
|
1058
|
+
}
|
|
1059
|
+
},
|
|
1060
|
+
create: {
|
|
1061
|
+
type: "object",
|
|
1062
|
+
properties: {
|
|
1063
|
+
name: { type: "string", description: "Collection name. Randomly generated if omitted." },
|
|
1064
|
+
title: { type: "string", description: "Display title" },
|
|
1065
|
+
description: { type: "string" },
|
|
1066
|
+
inherit: { type: "boolean" },
|
|
1067
|
+
hidden: { type: "boolean" },
|
|
1068
|
+
sortable: {
|
|
1069
|
+
oneOf: [{ type: "boolean" }, { type: "string" }, { type: "object", additionalProperties: true }]
|
|
1070
|
+
},
|
|
1071
|
+
autoGenId: { type: "boolean" },
|
|
1072
|
+
createdBy: { type: "boolean" },
|
|
1073
|
+
updatedBy: { type: "boolean" },
|
|
1074
|
+
timestamps: { type: "boolean" },
|
|
1075
|
+
logging: { type: "boolean" },
|
|
1076
|
+
schema: { type: "string" },
|
|
1077
|
+
template: { type: "string" },
|
|
1078
|
+
fields: {
|
|
1079
|
+
type: "array",
|
|
1080
|
+
description: "Optional initial fields created together with the collection",
|
|
1081
|
+
items: { $ref: "#/components/schemas/field/write" }
|
|
1082
|
+
}
|
|
1083
|
+
},
|
|
1084
|
+
additionalProperties: true
|
|
1085
|
+
},
|
|
1086
|
+
apply: {
|
|
1087
|
+
type: "object",
|
|
1088
|
+
description: [
|
|
1089
|
+
"Compact collection write schema for the high-level apply action.",
|
|
1090
|
+
"",
|
|
1091
|
+
"Use a small set of high-signal properties by default.",
|
|
1092
|
+
"Pass `settings` only when you need an advanced override."
|
|
1093
|
+
].join("\n"),
|
|
1094
|
+
properties: {
|
|
1095
|
+
name: { type: "string", description: "Collection name" },
|
|
1096
|
+
title: { type: "string", description: "Display title. Derived from name when omitted on create." },
|
|
1097
|
+
description: { type: "string" },
|
|
1098
|
+
template: {
|
|
1099
|
+
type: "string",
|
|
1100
|
+
description: "Collection template such as `general`, `tree`, `file`, `view`, or `inherit`"
|
|
1101
|
+
},
|
|
1102
|
+
viewName: { type: "string", description: "Upstream database view name for `view` collections" },
|
|
1103
|
+
inherits: {
|
|
1104
|
+
oneOf: [{ type: "string" }, { type: "array", items: { type: "string" } }],
|
|
1105
|
+
description: "Parent collection name or names for `inherit` collections"
|
|
1106
|
+
},
|
|
1107
|
+
replaceFields: {
|
|
1108
|
+
type: "boolean",
|
|
1109
|
+
description: "When true on update, replace the full field set instead of patching"
|
|
1110
|
+
},
|
|
1111
|
+
verify: {
|
|
1112
|
+
type: "boolean",
|
|
1113
|
+
description: "Whether to include normalized verification result in the apply response. Default true."
|
|
1114
|
+
},
|
|
1115
|
+
fields: {
|
|
1116
|
+
type: "array",
|
|
1117
|
+
description: "Compact field definitions applied together with the collection.",
|
|
1118
|
+
items: { $ref: "#/components/schemas/field/applyNested" }
|
|
1119
|
+
},
|
|
1120
|
+
settings: {
|
|
1121
|
+
type: "object",
|
|
1122
|
+
description: "Advanced raw collection overrides. Use only when the compact fields are insufficient.",
|
|
1123
|
+
additionalProperties: true
|
|
1124
|
+
}
|
|
1125
|
+
},
|
|
1126
|
+
additionalProperties: true
|
|
1127
|
+
},
|
|
1128
|
+
update: {
|
|
1129
|
+
type: "object",
|
|
1130
|
+
properties: {
|
|
1131
|
+
title: { type: "string" },
|
|
1132
|
+
description: { type: "string" },
|
|
1133
|
+
inherit: { type: "boolean" },
|
|
1134
|
+
hidden: { type: "boolean" },
|
|
1135
|
+
sortable: {
|
|
1136
|
+
oneOf: [{ type: "boolean" }, { type: "string" }, { type: "object", additionalProperties: true }]
|
|
1137
|
+
},
|
|
1138
|
+
createdBy: { type: "boolean" },
|
|
1139
|
+
updatedBy: { type: "boolean" },
|
|
1140
|
+
timestamps: { type: "boolean" },
|
|
1141
|
+
logging: { type: "boolean" },
|
|
1142
|
+
schema: { type: "string" },
|
|
1143
|
+
template: { type: "string" }
|
|
1144
|
+
},
|
|
1145
|
+
additionalProperties: true
|
|
1146
|
+
}
|
|
1147
|
+
},
|
|
1148
|
+
field: {
|
|
1149
|
+
collectionName: {
|
|
1150
|
+
name: "collectionName",
|
|
1151
|
+
in: "path",
|
|
1152
|
+
description: "Collection name",
|
|
1153
|
+
required: true,
|
|
1154
|
+
schema: { type: "string" },
|
|
1155
|
+
example: "posts"
|
|
1156
|
+
},
|
|
1157
|
+
filterByTk: {
|
|
1158
|
+
name: "filterByTk",
|
|
1159
|
+
in: "query",
|
|
1160
|
+
description: "Field name in the target collection",
|
|
1161
|
+
required: true,
|
|
1162
|
+
schema: { type: "string" },
|
|
1163
|
+
example: "title"
|
|
1164
|
+
},
|
|
1165
|
+
filterByTkOptional: {
|
|
1166
|
+
name: "filterByTk",
|
|
1167
|
+
in: "query",
|
|
1168
|
+
description: "Field name in the target collection",
|
|
1169
|
+
schema: { type: "string" },
|
|
1170
|
+
example: "title"
|
|
1171
|
+
},
|
|
1172
|
+
reverseField: {
|
|
1173
|
+
type: "object",
|
|
1174
|
+
description: "Reverse association field created or updated together with the current field",
|
|
1175
|
+
properties: {
|
|
1176
|
+
key: { type: "string" },
|
|
1177
|
+
name: { type: "string" },
|
|
1178
|
+
type: { type: "string" },
|
|
1179
|
+
interface: { type: "string" },
|
|
1180
|
+
uiSchema: {
|
|
1181
|
+
type: "object",
|
|
1182
|
+
additionalProperties: true
|
|
1183
|
+
},
|
|
1184
|
+
target: { type: "string" },
|
|
1185
|
+
foreignKey: { type: "string" },
|
|
1186
|
+
sourceKey: { type: "string" },
|
|
1187
|
+
targetKey: { type: "string" }
|
|
1188
|
+
},
|
|
1189
|
+
additionalProperties: true
|
|
1190
|
+
},
|
|
1191
|
+
validationRule: {
|
|
1192
|
+
type: "object",
|
|
1193
|
+
description: "One server-side Joi validation rule for repository create/update.",
|
|
1194
|
+
properties: {
|
|
1195
|
+
key: {
|
|
1196
|
+
type: "string",
|
|
1197
|
+
description: "Stable rule key. Generated by fields:apply when omitted."
|
|
1198
|
+
},
|
|
1199
|
+
name: {
|
|
1200
|
+
type: "string",
|
|
1201
|
+
description: "Joi rule name, for example `required`, `min`, `max`, `length`, `pattern`, `email`, or `precision`."
|
|
1202
|
+
},
|
|
1203
|
+
args: {
|
|
1204
|
+
type: "object",
|
|
1205
|
+
description: 'Rule arguments. Common examples: `{ "limit": 2 }`, `{ "regex": "^[A-Z]+$" }`, `{ "allowUnicode": true }`.',
|
|
1206
|
+
additionalProperties: true
|
|
1207
|
+
},
|
|
1208
|
+
paramsType: {
|
|
1209
|
+
type: "string",
|
|
1210
|
+
enum: ["object"],
|
|
1211
|
+
description: "Use `object` when the Joi rule expects a single options object, such as `email` or `uuid`."
|
|
1212
|
+
}
|
|
1213
|
+
},
|
|
1214
|
+
required: ["name"],
|
|
1215
|
+
additionalProperties: true
|
|
1216
|
+
},
|
|
1217
|
+
validation: {
|
|
1218
|
+
type: "object",
|
|
1219
|
+
description: [
|
|
1220
|
+
"Server-side field validation executed by repository create/update.",
|
|
1221
|
+
"",
|
|
1222
|
+
"Validation is based on Joi. The `type` selects the Joi schema type, and `rules` are applied in order."
|
|
1223
|
+
].join("\n"),
|
|
1224
|
+
properties: {
|
|
1225
|
+
type: {
|
|
1226
|
+
type: "string",
|
|
1227
|
+
description: "Joi schema type, commonly `string`, `number`, `date`, `boolean`, or `object`."
|
|
1228
|
+
},
|
|
1229
|
+
rules: {
|
|
1230
|
+
type: "array",
|
|
1231
|
+
items: { $ref: "#/components/schemas/field/validationRule" }
|
|
1232
|
+
}
|
|
1233
|
+
},
|
|
1234
|
+
required: ["type", "rules"],
|
|
1235
|
+
additionalProperties: true
|
|
1236
|
+
},
|
|
1237
|
+
validators: {
|
|
1238
|
+
type: "array",
|
|
1239
|
+
description: [
|
|
1240
|
+
"AI-friendly shorthand for server-side validation rules.",
|
|
1241
|
+
"",
|
|
1242
|
+
"Each item can be a Joi rule name string or a validation rule object.",
|
|
1243
|
+
"fields:apply converts this to `validation.rules`, fills missing rule keys, and infers `validation.type` from the field interface when omitted."
|
|
1244
|
+
].join("\n"),
|
|
1245
|
+
items: {
|
|
1246
|
+
anyOf: [{ type: "string" }, { $ref: "#/components/schemas/field/validationRule" }]
|
|
1247
|
+
}
|
|
1248
|
+
},
|
|
1249
|
+
model: {
|
|
1250
|
+
type: "object",
|
|
1251
|
+
properties: {
|
|
1252
|
+
key: { type: "string" },
|
|
1253
|
+
name: { type: "string" },
|
|
1254
|
+
collectionName: { type: "string" },
|
|
1255
|
+
type: { type: "string", description: "Field type, for example `string`, `integer`, `belongsTo`" },
|
|
1256
|
+
interface: {
|
|
1257
|
+
type: "string",
|
|
1258
|
+
nullable: true,
|
|
1259
|
+
description: "UI interface hint, for example `input`, `m2o`, `m2m`, `o2m`"
|
|
1260
|
+
},
|
|
1261
|
+
description: { type: "string", nullable: true },
|
|
1262
|
+
source: { type: "string", nullable: true, description: "Source expression, mainly used by view fields" },
|
|
1263
|
+
field: { type: "string", nullable: true, description: "Underlying column name when different from `name`" },
|
|
1264
|
+
target: { type: "string", nullable: true },
|
|
1265
|
+
through: { type: "string", nullable: true },
|
|
1266
|
+
foreignKey: { type: "string", nullable: true },
|
|
1267
|
+
otherKey: { type: "string", nullable: true },
|
|
1268
|
+
sourceKey: { type: "string", nullable: true },
|
|
1269
|
+
targetKey: { type: "string", nullable: true },
|
|
1270
|
+
parentKey: { type: "string", nullable: true },
|
|
1271
|
+
reverseKey: { type: "string", nullable: true },
|
|
1272
|
+
onDelete: { type: "string", nullable: true },
|
|
1273
|
+
sortBy: { type: "string", nullable: true },
|
|
1274
|
+
sortable: { type: "boolean", nullable: true },
|
|
1275
|
+
primaryKey: { type: "boolean", nullable: true },
|
|
1276
|
+
autoIncrement: { type: "boolean", nullable: true },
|
|
1277
|
+
unique: { type: "boolean", nullable: true },
|
|
1278
|
+
allowNull: { type: "boolean", nullable: true },
|
|
1279
|
+
validation: { $ref: "#/components/schemas/field/validation" },
|
|
1280
|
+
defaultValue: {
|
|
1281
|
+
nullable: true
|
|
1282
|
+
},
|
|
1283
|
+
enum: {
|
|
1284
|
+
type: "array",
|
|
1285
|
+
description: "Choice values.",
|
|
1286
|
+
items: {
|
|
1287
|
+
anyOf: [
|
|
1288
|
+
{ type: "string" },
|
|
1289
|
+
{
|
|
1290
|
+
type: "object",
|
|
1291
|
+
properties: {
|
|
1292
|
+
label: { type: "string" },
|
|
1293
|
+
value: {},
|
|
1294
|
+
color: { type: "string" }
|
|
1295
|
+
},
|
|
1296
|
+
required: ["label", "value"],
|
|
1297
|
+
additionalProperties: true
|
|
1298
|
+
}
|
|
1299
|
+
]
|
|
1300
|
+
}
|
|
1301
|
+
},
|
|
1302
|
+
isForeignKey: { type: "boolean", nullable: true },
|
|
1303
|
+
uiSchema: {
|
|
1304
|
+
type: "object",
|
|
1305
|
+
description: "UI schema payload.",
|
|
1306
|
+
additionalProperties: true
|
|
1307
|
+
},
|
|
1308
|
+
options: {
|
|
1309
|
+
type: "object",
|
|
1310
|
+
additionalProperties: true,
|
|
1311
|
+
description: "Extra field options not promoted to top-level properties"
|
|
1312
|
+
},
|
|
1313
|
+
reverseField: { $ref: "#/components/schemas/field/reverseField" }
|
|
1314
|
+
},
|
|
1315
|
+
additionalProperties: true
|
|
1316
|
+
},
|
|
1317
|
+
write: {
|
|
1318
|
+
type: "object",
|
|
1319
|
+
description: [
|
|
1320
|
+
"Field write schema used by create/update/setFields.",
|
|
1321
|
+
"",
|
|
1322
|
+
"Use direct field values in the request body.",
|
|
1323
|
+
"Do not wrap the payload in an extra `values` object."
|
|
1324
|
+
].join("\n"),
|
|
1325
|
+
properties: {
|
|
1326
|
+
key: { type: "string" },
|
|
1327
|
+
name: { type: "string" },
|
|
1328
|
+
type: { type: "string" },
|
|
1329
|
+
interface: { type: "string" },
|
|
1330
|
+
description: { type: "string" },
|
|
1331
|
+
field: { type: "string" },
|
|
1332
|
+
source: { type: "string" },
|
|
1333
|
+
target: { type: "string" },
|
|
1334
|
+
through: { type: "string" },
|
|
1335
|
+
foreignKey: { type: "string" },
|
|
1336
|
+
otherKey: { type: "string" },
|
|
1337
|
+
sourceKey: { type: "string" },
|
|
1338
|
+
targetKey: { type: "string" },
|
|
1339
|
+
parentKey: { type: "string" },
|
|
1340
|
+
reverseKey: { type: "string" },
|
|
1341
|
+
onDelete: { type: "string", enum: ["CASCADE", "RESTRICT", "SET NULL", "NO ACTION"] },
|
|
1342
|
+
sortBy: { type: "string" },
|
|
1343
|
+
sortable: { type: "boolean" },
|
|
1344
|
+
primaryKey: { type: "boolean" },
|
|
1345
|
+
autoIncrement: { type: "boolean" },
|
|
1346
|
+
unique: { type: "boolean" },
|
|
1347
|
+
allowNull: { type: "boolean" },
|
|
1348
|
+
validation: { $ref: "#/components/schemas/field/validation" },
|
|
1349
|
+
defaultValue: {},
|
|
1350
|
+
enum: {
|
|
1351
|
+
type: "array",
|
|
1352
|
+
description: "Choice values.",
|
|
1353
|
+
items: {
|
|
1354
|
+
anyOf: [
|
|
1355
|
+
{ type: "string" },
|
|
1356
|
+
{
|
|
1357
|
+
type: "object",
|
|
1358
|
+
properties: {
|
|
1359
|
+
label: { type: "string" },
|
|
1360
|
+
value: {},
|
|
1361
|
+
color: { type: "string" }
|
|
1362
|
+
},
|
|
1363
|
+
required: ["label", "value"],
|
|
1364
|
+
additionalProperties: true
|
|
1365
|
+
}
|
|
1366
|
+
]
|
|
1367
|
+
}
|
|
1368
|
+
},
|
|
1369
|
+
uiSchema: {
|
|
1370
|
+
type: "object",
|
|
1371
|
+
description: "UI schema payload.",
|
|
1372
|
+
additionalProperties: true
|
|
1373
|
+
},
|
|
1374
|
+
reverseField: { $ref: "#/components/schemas/field/reverseField" }
|
|
1375
|
+
},
|
|
1376
|
+
additionalProperties: true
|
|
1377
|
+
},
|
|
1378
|
+
create: {
|
|
1379
|
+
allOf: [{ $ref: "#/components/schemas/field/write" }]
|
|
1380
|
+
},
|
|
1381
|
+
apply: {
|
|
1382
|
+
type: "object",
|
|
1383
|
+
description: [
|
|
1384
|
+
"Compact field write schema for the high-level apply action.",
|
|
1385
|
+
"",
|
|
1386
|
+
"Typical payload only needs `collectionName`, `name`, `title`, and `interface`.",
|
|
1387
|
+
"For relations, add `target` and optional reverse-field helpers."
|
|
1388
|
+
].join("\n"),
|
|
1389
|
+
properties: {
|
|
1390
|
+
collectionName: { type: "string", description: "Target collection name" },
|
|
1391
|
+
name: { type: "string" },
|
|
1392
|
+
title: { type: "string" },
|
|
1393
|
+
interface: { type: "string" },
|
|
1394
|
+
description: { type: "string" },
|
|
1395
|
+
target: { type: "string" },
|
|
1396
|
+
validation: { $ref: "#/components/schemas/field/validation" },
|
|
1397
|
+
validators: { $ref: "#/components/schemas/field/validators" },
|
|
1398
|
+
defaultValue: {
|
|
1399
|
+
description: "Optional default value JSON. Structure depends on the selected interface."
|
|
1400
|
+
},
|
|
1401
|
+
enum: {
|
|
1402
|
+
type: "array",
|
|
1403
|
+
description: "Choice options JSON.",
|
|
1404
|
+
items: {
|
|
1405
|
+
anyOf: [
|
|
1406
|
+
{ type: "string" },
|
|
1407
|
+
{
|
|
1408
|
+
type: "object",
|
|
1409
|
+
properties: {
|
|
1410
|
+
label: { type: "string" },
|
|
1411
|
+
value: {},
|
|
1412
|
+
color: { type: "string" }
|
|
1413
|
+
},
|
|
1414
|
+
required: ["label", "value"],
|
|
1415
|
+
additionalProperties: true
|
|
1416
|
+
}
|
|
1417
|
+
]
|
|
1418
|
+
}
|
|
1419
|
+
},
|
|
1420
|
+
reverseName: { type: "string" },
|
|
1421
|
+
reverseTitle: { type: "string" },
|
|
1422
|
+
reverseInterface: { type: "string" },
|
|
1423
|
+
settings: {
|
|
1424
|
+
type: "object",
|
|
1425
|
+
description: "Advanced raw field overrides. Use only when the compact fields are insufficient.",
|
|
1426
|
+
additionalProperties: true
|
|
1427
|
+
},
|
|
1428
|
+
reverseField: {
|
|
1429
|
+
allOf: [{ $ref: "#/components/schemas/field/applyShallow" }],
|
|
1430
|
+
description: "Reverse relation helper field definition."
|
|
1431
|
+
}
|
|
1432
|
+
},
|
|
1433
|
+
required: ["collectionName"],
|
|
1434
|
+
additionalProperties: true
|
|
1435
|
+
},
|
|
1436
|
+
applyShallow: {
|
|
1437
|
+
type: "object",
|
|
1438
|
+
description: "Compact reverse-field helper schema.",
|
|
1439
|
+
properties: {
|
|
1440
|
+
name: { type: "string" },
|
|
1441
|
+
title: { type: "string" },
|
|
1442
|
+
interface: { type: "string" },
|
|
1443
|
+
target: { type: "string" },
|
|
1444
|
+
validation: { $ref: "#/components/schemas/field/validation" },
|
|
1445
|
+
validators: { $ref: "#/components/schemas/field/validators" },
|
|
1446
|
+
settings: {
|
|
1447
|
+
type: "object",
|
|
1448
|
+
additionalProperties: true
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
additionalProperties: true
|
|
1452
|
+
},
|
|
1453
|
+
applyNested: {
|
|
1454
|
+
type: "object",
|
|
1455
|
+
description: "Compact field schema used inside collection apply.",
|
|
1456
|
+
properties: {
|
|
1457
|
+
name: { type: "string" },
|
|
1458
|
+
title: { type: "string" },
|
|
1459
|
+
interface: { type: "string" },
|
|
1460
|
+
description: { type: "string" },
|
|
1461
|
+
target: { type: "string" },
|
|
1462
|
+
validation: { $ref: "#/components/schemas/field/validation" },
|
|
1463
|
+
validators: { $ref: "#/components/schemas/field/validators" },
|
|
1464
|
+
defaultValue: {
|
|
1465
|
+
description: "Optional default value JSON. Structure depends on the selected interface."
|
|
1466
|
+
},
|
|
1467
|
+
enum: {
|
|
1468
|
+
type: "array",
|
|
1469
|
+
description: "Choice options JSON.",
|
|
1470
|
+
items: {
|
|
1471
|
+
anyOf: [
|
|
1472
|
+
{ type: "string" },
|
|
1473
|
+
{
|
|
1474
|
+
type: "object",
|
|
1475
|
+
properties: {
|
|
1476
|
+
label: { type: "string" },
|
|
1477
|
+
value: {},
|
|
1478
|
+
color: { type: "string" }
|
|
1479
|
+
},
|
|
1480
|
+
required: ["label", "value"],
|
|
1481
|
+
additionalProperties: true
|
|
1482
|
+
}
|
|
1483
|
+
]
|
|
1484
|
+
}
|
|
1485
|
+
},
|
|
1486
|
+
reverseName: { type: "string" },
|
|
1487
|
+
reverseTitle: { type: "string" },
|
|
1488
|
+
reverseInterface: { type: "string" },
|
|
1489
|
+
settings: {
|
|
1490
|
+
type: "object",
|
|
1491
|
+
description: "Advanced raw field overrides. Use only when the compact fields are insufficient.",
|
|
1492
|
+
additionalProperties: true
|
|
1493
|
+
},
|
|
1494
|
+
reverseField: {
|
|
1495
|
+
allOf: [{ $ref: "#/components/schemas/field/applyShallow" }],
|
|
1496
|
+
description: "Reverse relation helper field definition."
|
|
1497
|
+
}
|
|
1498
|
+
},
|
|
1499
|
+
additionalProperties: true
|
|
1500
|
+
},
|
|
1501
|
+
update: {
|
|
1502
|
+
allOf: [{ $ref: "#/components/schemas/field/write" }]
|
|
1503
|
+
}
|
|
1504
|
+
},
|
|
1505
|
+
collectionCategory: {
|
|
1506
|
+
filterByTk: {
|
|
1507
|
+
name: "filterByTk",
|
|
1508
|
+
in: "query",
|
|
1509
|
+
description: "Category id",
|
|
1510
|
+
required: true,
|
|
1511
|
+
schema: { type: "integer" }
|
|
1512
|
+
},
|
|
1513
|
+
model: {
|
|
1514
|
+
type: "object",
|
|
1515
|
+
properties: {
|
|
1516
|
+
id: { type: "integer" },
|
|
1517
|
+
name: { type: "string" },
|
|
1518
|
+
color: { type: "string" }
|
|
1519
|
+
}
|
|
1520
|
+
},
|
|
1521
|
+
create: {
|
|
1522
|
+
type: "object",
|
|
1523
|
+
properties: {
|
|
1524
|
+
name: { type: "string" },
|
|
1525
|
+
color: { type: "string" }
|
|
1526
|
+
},
|
|
1527
|
+
additionalProperties: true
|
|
1528
|
+
},
|
|
1529
|
+
update: {
|
|
1530
|
+
type: "object",
|
|
1531
|
+
properties: {
|
|
1532
|
+
name: { type: "string" },
|
|
1533
|
+
color: { type: "string" }
|
|
1534
|
+
},
|
|
1535
|
+
additionalProperties: true
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
439
1539
|
}
|
|
440
1540
|
};
|