@nocobase/plugin-data-source-main 2.0.22 → 2.1.0-alpha.10

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.
@@ -36,28 +36,111 @@ 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 synchronization"
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: "manager db views"
52
+ description: "Database view inspection for view-based collections"
50
53
  }
51
54
  ],
52
55
  paths: {
53
56
  "/collections:list": {
54
57
  get: {
55
58
  tags: ["collections"],
56
- description: "",
57
- parameters: [],
59
+ summary: "List collections",
60
+ description: [
61
+ "Get paginated collection records from the collection manager.",
62
+ "",
63
+ "Use this when you only need collection-level metadata. If you also need loaded field definitions,",
64
+ "prefer `collections:listMeta`."
65
+ ].join("\n"),
66
+ parameters: [
67
+ { $ref: "#/components/schemas/common/filter" },
68
+ { $ref: "#/components/schemas/common/sort" },
69
+ { $ref: "#/components/schemas/common/fields" },
70
+ { $ref: "#/components/schemas/common/appends" },
71
+ { $ref: "#/components/schemas/common/except" },
72
+ { $ref: "#/components/schemas/common/page" },
73
+ { $ref: "#/components/schemas/common/pageSize" },
74
+ { $ref: "#/components/schemas/common/paginate" }
75
+ ],
58
76
  responses: {
59
77
  "200": {
60
- description: "OK"
78
+ description: "OK",
79
+ content: {
80
+ "application/json": {
81
+ schema: {
82
+ type: "object",
83
+ properties: {
84
+ data: {
85
+ type: "array",
86
+ items: { $ref: "#/components/schemas/collection/model" }
87
+ },
88
+ meta: { $ref: "#/components/schemas/common/paginationMeta" }
89
+ }
90
+ }
91
+ }
92
+ }
93
+ }
94
+ }
95
+ }
96
+ },
97
+ "/collections:listMeta": {
98
+ get: {
99
+ tags: ["collections"],
100
+ summary: "List loaded collections with field metadata",
101
+ description: [
102
+ "Return the collections currently loaded in the application, including sorted field metadata.",
103
+ "",
104
+ "This is usually the best inspection endpoint before editing a schema because it exposes",
105
+ "collection options, `filterTargetKey`, unavailable actions, and field definitions together."
106
+ ].join("\n"),
107
+ responses: {
108
+ "200": {
109
+ description: "OK",
110
+ content: {
111
+ "application/json": {
112
+ schema: {
113
+ type: "object",
114
+ properties: {
115
+ data: {
116
+ type: "array",
117
+ items: {
118
+ allOf: [
119
+ { $ref: "#/components/schemas/collection/model" },
120
+ {
121
+ type: "object",
122
+ properties: {
123
+ filterTargetKey: {
124
+ type: "string",
125
+ description: "Field used by repository `filterByTk`, often `name` for collections"
126
+ },
127
+ unavailableActions: {
128
+ type: "array",
129
+ items: { type: "string" }
130
+ },
131
+ fields: {
132
+ type: "array",
133
+ items: { $ref: "#/components/schemas/field/model" }
134
+ }
135
+ }
136
+ }
137
+ ]
138
+ }
139
+ }
140
+ }
141
+ }
142
+ }
143
+ }
61
144
  }
62
145
  }
63
146
  }
@@ -65,11 +148,27 @@ var swagger_default = {
65
148
  "/collections:get": {
66
149
  get: {
67
150
  tags: ["collections"],
68
- description: "",
69
- parameters: [],
151
+ summary: "Get a collection",
152
+ description: "Get a single collection by collection name (`filterByTk`).",
153
+ parameters: [
154
+ { $ref: "#/components/schemas/collection/filterByTk" },
155
+ { $ref: "#/components/schemas/common/filter" },
156
+ { $ref: "#/components/schemas/common/appends" },
157
+ { $ref: "#/components/schemas/common/except" }
158
+ ],
70
159
  responses: {
71
160
  "200": {
72
- description: "OK"
161
+ description: "OK",
162
+ content: {
163
+ "application/json": {
164
+ schema: {
165
+ type: "object",
166
+ properties: {
167
+ data: { $ref: "#/components/schemas/collection/model" }
168
+ }
169
+ }
170
+ }
171
+ }
73
172
  }
74
173
  }
75
174
  }
@@ -77,11 +176,33 @@ var swagger_default = {
77
176
  "/collections:create": {
78
177
  post: {
79
178
  tags: ["collections"],
80
- description: "",
81
- parameters: [],
179
+ summary: "Create a collection",
180
+ description: [
181
+ "Create a new collection and optionally create fields in the same request.",
182
+ "",
183
+ "Request body uses collection values directly.",
184
+ "Do not wrap the payload in an extra `values` object."
185
+ ].join("\n"),
186
+ requestBody: {
187
+ content: {
188
+ "application/json": {
189
+ schema: { $ref: "#/components/schemas/collection/create" }
190
+ }
191
+ }
192
+ },
82
193
  responses: {
83
194
  "200": {
84
- description: "OK"
195
+ description: "OK",
196
+ content: {
197
+ "application/json": {
198
+ schema: {
199
+ type: "object",
200
+ properties: {
201
+ data: { $ref: "#/components/schemas/collection/model" }
202
+ }
203
+ }
204
+ }
205
+ }
85
206
  }
86
207
  }
87
208
  }
@@ -89,8 +210,21 @@ var swagger_default = {
89
210
  "/collections:update": {
90
211
  post: {
91
212
  tags: ["collections"],
92
- description: "",
93
- parameters: [],
213
+ summary: "Update a collection",
214
+ description: [
215
+ "Update a collection by collection name (`filterByTk`).",
216
+ "",
217
+ "Request body uses collection values directly.",
218
+ "Do not wrap the payload in an extra `values` object."
219
+ ].join("\n"),
220
+ parameters: [{ $ref: "#/components/schemas/collection/filterByTk" }],
221
+ requestBody: {
222
+ content: {
223
+ "application/json": {
224
+ schema: { $ref: "#/components/schemas/collection/update" }
225
+ }
226
+ }
227
+ },
94
228
  responses: {
95
229
  "200": {
96
230
  description: "OK"
@@ -101,8 +235,21 @@ var swagger_default = {
101
235
  "/collections:destroy": {
102
236
  post: {
103
237
  tags: ["collections"],
104
- description: "",
105
- parameters: [],
238
+ summary: "Destroy a collection",
239
+ description: [
240
+ "Delete a collection by collection name (`filterByTk`).",
241
+ "",
242
+ "If `cascade` is true, dependent database objects such as related views can be removed together."
243
+ ].join("\n"),
244
+ parameters: [
245
+ { $ref: "#/components/schemas/collection/filterByTk" },
246
+ {
247
+ name: "cascade",
248
+ in: "query",
249
+ description: "Whether to cascade deletion to dependent database objects",
250
+ schema: { type: "boolean" }
251
+ }
252
+ ],
106
253
  responses: {
107
254
  "200": {
108
255
  description: "OK"
@@ -113,8 +260,15 @@ var swagger_default = {
113
260
  "/collections:move": {
114
261
  post: {
115
262
  tags: ["collections"],
116
- description: "",
117
- parameters: [],
263
+ summary: "Move a collection",
264
+ description: "Reorder a collection inside collection manager sorting.",
265
+ requestBody: {
266
+ content: {
267
+ "application/json": {
268
+ schema: { $ref: "#/components/schemas/common/moveRequest" }
269
+ }
270
+ }
271
+ },
118
272
  responses: {
119
273
  "200": {
120
274
  description: "OK"
@@ -125,8 +279,40 @@ var swagger_default = {
125
279
  "/collections:setFields": {
126
280
  post: {
127
281
  tags: ["collections"],
128
- description: "",
129
- parameters: [],
282
+ summary: "Replace a collection field set",
283
+ description: [
284
+ "Synchronize the complete field list of a collection.",
285
+ "",
286
+ "Server behavior:",
287
+ "- fields present in request and already existing are updated",
288
+ "- fields missing from request are destroyed",
289
+ "- new fields are created",
290
+ "",
291
+ "This is the preferred bulk-sync endpoint for view collections after reading fresh metadata from `dbViews:get`."
292
+ ].join("\n"),
293
+ parameters: [{ $ref: "#/components/schemas/collection/filterByTk" }],
294
+ requestBody: {
295
+ content: {
296
+ "application/json": {
297
+ schema: {
298
+ type: "object",
299
+ required: ["values"],
300
+ properties: {
301
+ values: {
302
+ type: "object",
303
+ required: ["fields"],
304
+ properties: {
305
+ fields: {
306
+ type: "array",
307
+ items: { $ref: "#/components/schemas/field/write" }
308
+ }
309
+ }
310
+ }
311
+ }
312
+ }
313
+ }
314
+ }
315
+ },
130
316
  responses: {
131
317
  "200": {
132
318
  description: "OK"
@@ -137,11 +323,37 @@ var swagger_default = {
137
323
  "/collections/{collectionName}/fields:get": {
138
324
  get: {
139
325
  tags: ["collections.fields"],
140
- description: "",
141
- parameters: [],
326
+ summary: "Get a field in a collection",
327
+ description: [
328
+ "Get a single field by field name (`filterByTk`) under a collection.",
329
+ "",
330
+ "Use the logical field name, for example `title`, `company`, or `scheduledAt`.",
331
+ "Do not use the field `key` here.",
332
+ "",
333
+ "If field-name lookup is ambiguous in client tooling, fall back to `fields:list` and filter by `name` or `key`.",
334
+ "For MCP workflows, a reliable fallback is the generic CRUD tool with",
335
+ '`resource: "collections.fields"`, `sourceId: "<collectionName>"`, `action: "get"`, and the same `filterByTk`.'
336
+ ].join("\n"),
337
+ parameters: [
338
+ { $ref: "#/components/schemas/field/collectionName" },
339
+ { $ref: "#/components/schemas/field/filterByTk" },
340
+ { $ref: "#/components/schemas/common/filter" },
341
+ { $ref: "#/components/schemas/common/appends" },
342
+ { $ref: "#/components/schemas/common/except" }
343
+ ],
142
344
  responses: {
143
345
  "200": {
144
- description: "OK"
346
+ description: "OK",
347
+ content: {
348
+ "application/json": {
349
+ schema: {
350
+ type: "object",
351
+ properties: {
352
+ data: { $ref: "#/components/schemas/field/model" }
353
+ }
354
+ }
355
+ }
356
+ }
145
357
  }
146
358
  }
147
359
  }
@@ -149,11 +361,36 @@ var swagger_default = {
149
361
  "/collections/{collectionName}/fields:list": {
150
362
  get: {
151
363
  tags: ["collections.fields"],
152
- description: "",
153
- parameters: [],
364
+ summary: "List fields in a collection",
365
+ description: "List fields belonging to the specified collection.",
366
+ parameters: [
367
+ { $ref: "#/components/schemas/field/collectionName" },
368
+ { $ref: "#/components/schemas/common/filter" },
369
+ { $ref: "#/components/schemas/common/sort" },
370
+ { $ref: "#/components/schemas/common/fields" },
371
+ { $ref: "#/components/schemas/common/appends" },
372
+ { $ref: "#/components/schemas/common/except" },
373
+ { $ref: "#/components/schemas/common/page" },
374
+ { $ref: "#/components/schemas/common/pageSize" },
375
+ { $ref: "#/components/schemas/common/paginate" }
376
+ ],
154
377
  responses: {
155
378
  "200": {
156
- description: "OK"
379
+ description: "OK",
380
+ content: {
381
+ "application/json": {
382
+ schema: {
383
+ type: "object",
384
+ properties: {
385
+ data: {
386
+ type: "array",
387
+ items: { $ref: "#/components/schemas/field/model" }
388
+ },
389
+ meta: { $ref: "#/components/schemas/common/paginationMeta" }
390
+ }
391
+ }
392
+ }
393
+ }
157
394
  }
158
395
  }
159
396
  }
@@ -161,11 +398,49 @@ var swagger_default = {
161
398
  "/collections/{collectionName}/fields:create": {
162
399
  post: {
163
400
  tags: ["collections.fields"],
164
- description: "",
165
- parameters: [],
401
+ summary: "Create a field in a collection",
402
+ description: [
403
+ "Create a scalar field or relation field under `collectionName`.",
404
+ "",
405
+ "Pass `collectionName` as the path parameter, not inside the JSON body.",
406
+ "The JSON body contains field values directly.",
407
+ "",
408
+ "Example path + body:",
409
+ "```",
410
+ "POST /api/collections/crm_companies/fields:create",
411
+ '{ "name": "name", "type": "string", "interface": "input" }',
412
+ "```",
413
+ "",
414
+ "Relation defaults are generated server-side when omitted:",
415
+ "- `belongsTo`: infers `target` from field name pluralization and generates `foreignKey`",
416
+ "- `hasMany`: infers `target`, `sourceKey`, `targetKey`, and generates `foreignKey`",
417
+ "- `belongsToMany`: infers `target`, generates `through`, `foreignKey`, `otherKey`",
418
+ "",
419
+ "Relation creation may also create companion foreign-key fields such as `companyId` or `ownerId`.",
420
+ "",
421
+ "For stable automation, pass `target`, `foreignKey`, `sourceKey`, `targetKey`, and `through` explicitly."
422
+ ].join("\n"),
423
+ parameters: [{ $ref: "#/components/schemas/field/collectionName" }],
424
+ requestBody: {
425
+ content: {
426
+ "application/json": {
427
+ schema: { $ref: "#/components/schemas/field/create" }
428
+ }
429
+ }
430
+ },
166
431
  responses: {
167
432
  "200": {
168
- description: "OK"
433
+ description: "OK",
434
+ content: {
435
+ "application/json": {
436
+ schema: {
437
+ type: "object",
438
+ properties: {
439
+ data: { $ref: "#/components/schemas/field/model" }
440
+ }
441
+ }
442
+ }
443
+ }
169
444
  }
170
445
  }
171
446
  }
@@ -173,11 +448,45 @@ var swagger_default = {
173
448
  "/collections/{collectionName}/fields:update": {
174
449
  post: {
175
450
  tags: ["collections.fields"],
176
- description: "",
177
- parameters: [],
451
+ summary: "Update a field in a collection",
452
+ description: [
453
+ "Update an existing field in a collection.",
454
+ "",
455
+ "Pass `collectionName` as the path parameter.",
456
+ "The JSON body contains field values directly.",
457
+ "Do not wrap the payload in an extra `values` object.",
458
+ "",
459
+ "You can target the field either by `filterByTk` (recommended, field name in this association resource)",
460
+ 'or by a `filter` object such as `{ "key": "<field-key>" }`.'
461
+ ].join("\n"),
462
+ parameters: [
463
+ { $ref: "#/components/schemas/field/collectionName" },
464
+ { $ref: "#/components/schemas/field/filterByTkOptional" },
465
+ { $ref: "#/components/schemas/common/filter" }
466
+ ],
467
+ requestBody: {
468
+ content: {
469
+ "application/json": {
470
+ schema: { $ref: "#/components/schemas/field/update" }
471
+ }
472
+ }
473
+ },
178
474
  responses: {
179
475
  "200": {
180
- description: "OK"
476
+ description: "OK",
477
+ content: {
478
+ "application/json": {
479
+ schema: {
480
+ type: "object",
481
+ properties: {
482
+ data: {
483
+ type: "array",
484
+ items: { $ref: "#/components/schemas/field/model" }
485
+ }
486
+ }
487
+ }
488
+ }
489
+ }
181
490
  }
182
491
  }
183
492
  }
@@ -185,8 +494,17 @@ var swagger_default = {
185
494
  "/collections/{collectionName}/fields:destroy": {
186
495
  post: {
187
496
  tags: ["collections.fields"],
188
- description: "",
189
- parameters: [],
497
+ summary: "Destroy a field in a collection",
498
+ description: [
499
+ "Delete a field in a collection.",
500
+ "",
501
+ "Use `filterByTk` with the field name for the common case."
502
+ ].join("\n"),
503
+ parameters: [
504
+ { $ref: "#/components/schemas/field/collectionName" },
505
+ { $ref: "#/components/schemas/field/filterByTk" },
506
+ { $ref: "#/components/schemas/common/filter" }
507
+ ],
190
508
  responses: {
191
509
  "200": {
192
510
  description: "OK"
@@ -197,8 +515,16 @@ var swagger_default = {
197
515
  "/collections/{collectionName}/fields:move": {
198
516
  post: {
199
517
  tags: ["collections.fields"],
200
- description: "",
201
- parameters: [],
518
+ summary: "Move a field in a collection",
519
+ description: "Reorder fields within a collection.",
520
+ parameters: [{ $ref: "#/components/schemas/field/collectionName" }],
521
+ requestBody: {
522
+ content: {
523
+ "application/json": {
524
+ schema: { $ref: "#/components/schemas/common/moveRequest" }
525
+ }
526
+ }
527
+ },
202
528
  responses: {
203
529
  "200": {
204
530
  description: "OK"
@@ -209,11 +535,31 @@ var swagger_default = {
209
535
  "/collectionCategories:list": {
210
536
  post: {
211
537
  tags: ["collectionCategories"],
212
- description: "",
213
- parameters: [],
538
+ summary: "List collection categories",
539
+ description: "List collection category records.",
540
+ parameters: [
541
+ { $ref: "#/components/schemas/common/filter" },
542
+ { $ref: "#/components/schemas/common/sort" },
543
+ { $ref: "#/components/schemas/common/page" },
544
+ { $ref: "#/components/schemas/common/pageSize" }
545
+ ],
214
546
  responses: {
215
547
  "200": {
216
- description: "OK"
548
+ description: "OK",
549
+ content: {
550
+ "application/json": {
551
+ schema: {
552
+ type: "object",
553
+ properties: {
554
+ data: {
555
+ type: "array",
556
+ items: { $ref: "#/components/schemas/collectionCategory/model" }
557
+ },
558
+ meta: { $ref: "#/components/schemas/common/paginationMeta" }
559
+ }
560
+ }
561
+ }
562
+ }
217
563
  }
218
564
  }
219
565
  }
@@ -221,11 +567,21 @@ var swagger_default = {
221
567
  "/collectionCategories:get": {
222
568
  post: {
223
569
  tags: ["collectionCategories"],
224
- description: "",
225
- parameters: [],
570
+ summary: "Get a collection category",
571
+ parameters: [{ $ref: "#/components/schemas/collectionCategory/filterByTk" }],
226
572
  responses: {
227
573
  "200": {
228
- description: "OK"
574
+ description: "OK",
575
+ content: {
576
+ "application/json": {
577
+ schema: {
578
+ type: "object",
579
+ properties: {
580
+ data: { $ref: "#/components/schemas/collectionCategory/model" }
581
+ }
582
+ }
583
+ }
584
+ }
229
585
  }
230
586
  }
231
587
  }
@@ -233,8 +589,14 @@ var swagger_default = {
233
589
  "/collectionCategories:create": {
234
590
  post: {
235
591
  tags: ["collectionCategories"],
236
- description: "",
237
- parameters: [],
592
+ summary: "Create a collection category",
593
+ requestBody: {
594
+ content: {
595
+ "application/json": {
596
+ schema: { $ref: "#/components/schemas/collectionCategory/create" }
597
+ }
598
+ }
599
+ },
238
600
  responses: {
239
601
  "200": {
240
602
  description: "OK"
@@ -245,8 +607,15 @@ var swagger_default = {
245
607
  "/collectionCategories:update": {
246
608
  post: {
247
609
  tags: ["collectionCategories"],
248
- description: "",
249
- parameters: [],
610
+ summary: "Update a collection category",
611
+ parameters: [{ $ref: "#/components/schemas/collectionCategory/filterByTk" }],
612
+ requestBody: {
613
+ content: {
614
+ "application/json": {
615
+ schema: { $ref: "#/components/schemas/collectionCategory/update" }
616
+ }
617
+ }
618
+ },
250
619
  responses: {
251
620
  "200": {
252
621
  description: "OK"
@@ -257,8 +626,8 @@ var swagger_default = {
257
626
  "/collectionCategories:destroy": {
258
627
  post: {
259
628
  tags: ["collectionCategories"],
260
- description: "",
261
- parameters: [],
629
+ summary: "Destroy a collection category",
630
+ parameters: [{ $ref: "#/components/schemas/collectionCategory/filterByTk" }],
262
631
  responses: {
263
632
  "200": {
264
633
  description: "OK"
@@ -269,8 +638,14 @@ var swagger_default = {
269
638
  "/collectionCategories:move": {
270
639
  post: {
271
640
  tags: ["collectionCategories"],
272
- description: "",
273
- parameters: [],
641
+ summary: "Move a collection category",
642
+ requestBody: {
643
+ content: {
644
+ "application/json": {
645
+ schema: { $ref: "#/components/schemas/common/moveRequest" }
646
+ }
647
+ }
648
+ },
274
649
  responses: {
275
650
  "200": {
276
651
  description: "OK"
@@ -281,12 +656,12 @@ var swagger_default = {
281
656
  "/dbViews:get": {
282
657
  get: {
283
658
  tags: ["dbViews"],
284
- summary: "get db view fields",
659
+ summary: "Get database view fields",
285
660
  parameters: [
286
661
  {
287
662
  name: "filterByTk",
288
663
  in: "query",
289
- description: "view name in database",
664
+ description: "View name in database",
290
665
  schema: {
291
666
  type: "string"
292
667
  },
@@ -296,7 +671,7 @@ var swagger_default = {
296
671
  {
297
672
  name: "schema",
298
673
  in: "query",
299
- description: "postgres schema of view in database",
674
+ description: "PostgreSQL schema of the view",
300
675
  schema: {
301
676
  type: "string"
302
677
  }
@@ -318,9 +693,9 @@ var swagger_default = {
318
693
  additionalProperties: {
319
694
  type: "object",
320
695
  properties: {
321
- name: { type: "string", description: "field name" },
322
- type: { type: "string", description: "field type" },
323
- source: { type: "string", required: false, description: "source field of view field" }
696
+ name: { type: "string", description: "Field name" },
697
+ type: { type: "string", description: "Field type" },
698
+ source: { type: "string", description: "Source field of the view field" }
324
699
  }
325
700
  }
326
701
  },
@@ -341,7 +716,8 @@ var swagger_default = {
341
716
  "/dbViews:list": {
342
717
  get: {
343
718
  tags: ["dbViews"],
344
- summary: "list views that not connected to collections in database",
719
+ summary: "List detached database views",
720
+ description: "List database views that are not yet connected to collection definitions.",
345
721
  responses: {
346
722
  "200": {
347
723
  description: "OK",
@@ -355,9 +731,9 @@ var swagger_default = {
355
731
  items: {
356
732
  type: "object",
357
733
  properties: {
358
- name: { type: "string", description: "name of view" },
359
- definition: { type: "string", description: "definition of view" },
360
- schema: { type: "string", description: "schema of view" }
734
+ name: { type: "string", description: "View name" },
735
+ definition: { type: "string", description: "View definition SQL" },
736
+ schema: { type: "string", description: "Schema name" }
361
737
  }
362
738
  }
363
739
  }
@@ -372,12 +748,12 @@ var swagger_default = {
372
748
  "/dbViews:query": {
373
749
  get: {
374
750
  tags: ["dbViews"],
375
- summary: "query db view data",
751
+ summary: "Query database view rows",
376
752
  parameters: [
377
753
  {
378
754
  name: "filterByTk",
379
755
  in: "query",
380
- description: "view name in database",
756
+ description: "View name in database",
381
757
  schema: {
382
758
  type: "string"
383
759
  },
@@ -387,7 +763,7 @@ var swagger_default = {
387
763
  {
388
764
  name: "schema",
389
765
  in: "query",
390
- description: "postgres schema of view in database",
766
+ description: "PostgreSQL schema of the view",
391
767
  schema: {
392
768
  type: "string"
393
769
  }
@@ -395,7 +771,7 @@ var swagger_default = {
395
771
  {
396
772
  name: "page",
397
773
  in: "query",
398
- description: "page number",
774
+ description: "Page number",
399
775
  schema: {
400
776
  type: "integer"
401
777
  }
@@ -403,7 +779,7 @@ var swagger_default = {
403
779
  {
404
780
  name: "pageSize",
405
781
  in: "query",
406
- description: "page size",
782
+ description: "Page size",
407
783
  schema: {
408
784
  type: "integer"
409
785
  }
@@ -421,10 +797,10 @@ var swagger_default = {
421
797
  type: "array",
422
798
  items: {
423
799
  type: "object",
424
- description: "row data of view",
800
+ description: "Row data of the view",
425
801
  additionalProperties: {
426
802
  type: "object",
427
- description: "row data's field value"
803
+ description: "Field value in the row"
428
804
  }
429
805
  }
430
806
  }
@@ -436,5 +812,419 @@ var swagger_default = {
436
812
  }
437
813
  }
438
814
  }
815
+ },
816
+ components: {
817
+ schemas: {
818
+ common: {
819
+ filter: {
820
+ name: "filter",
821
+ in: "query",
822
+ description: "Structured NocoBase filter object",
823
+ schema: {
824
+ type: "object",
825
+ additionalProperties: true
826
+ }
827
+ },
828
+ sort: {
829
+ name: "sort",
830
+ in: "query",
831
+ description: "Sort fields. Prefix with `-` for descending",
832
+ schema: {
833
+ type: "string"
834
+ }
835
+ },
836
+ fields: {
837
+ name: "fields",
838
+ in: "query",
839
+ description: "Return only specified fields",
840
+ schema: {
841
+ type: "array",
842
+ items: { type: "string" }
843
+ }
844
+ },
845
+ appends: {
846
+ name: "appends",
847
+ in: "query",
848
+ description: "Append association data",
849
+ schema: {
850
+ type: "array",
851
+ items: { type: "string" }
852
+ }
853
+ },
854
+ except: {
855
+ name: "except",
856
+ in: "query",
857
+ description: "Exclude specified fields from response",
858
+ schema: {
859
+ type: "array",
860
+ items: { type: "string" }
861
+ }
862
+ },
863
+ page: {
864
+ name: "page",
865
+ in: "query",
866
+ description: "Page number (1-based)",
867
+ schema: {
868
+ type: "integer",
869
+ default: 1
870
+ }
871
+ },
872
+ pageSize: {
873
+ name: "pageSize",
874
+ in: "query",
875
+ description: "Number of items per page",
876
+ schema: {
877
+ type: "integer",
878
+ default: 20
879
+ }
880
+ },
881
+ paginate: {
882
+ name: "paginate",
883
+ in: "query",
884
+ description: "Whether to return paginated result format",
885
+ schema: {
886
+ type: "boolean",
887
+ default: true
888
+ }
889
+ },
890
+ paginationMeta: {
891
+ type: "object",
892
+ properties: {
893
+ count: { type: "integer" },
894
+ page: { type: "integer" },
895
+ pageSize: { type: "integer" },
896
+ totalPage: { type: "integer" }
897
+ }
898
+ },
899
+ moveRequest: {
900
+ type: "object",
901
+ properties: {
902
+ sourceId: {
903
+ type: "string",
904
+ description: "Source record identifier"
905
+ },
906
+ targetId: {
907
+ type: "string",
908
+ description: "Target record identifier"
909
+ },
910
+ method: {
911
+ type: "string",
912
+ description: "Move method, usually `insertAfter` or `insertBefore`",
913
+ enum: ["insertAfter", "insertBefore"]
914
+ },
915
+ sortField: {
916
+ type: "string",
917
+ description: "Sort field name, default is `sort`"
918
+ },
919
+ targetScope: {
920
+ type: "string",
921
+ description: "Target scope for scoped sorting"
922
+ },
923
+ sticky: {
924
+ type: "boolean",
925
+ description: "Whether to pin the source item to top"
926
+ }
927
+ }
928
+ }
929
+ },
930
+ collection: {
931
+ filterByTk: {
932
+ name: "filterByTk",
933
+ in: "query",
934
+ description: "Collection name",
935
+ required: true,
936
+ schema: { type: "string" },
937
+ example: "posts"
938
+ },
939
+ model: {
940
+ type: "object",
941
+ properties: {
942
+ key: { type: "string", description: "Collection manager primary key" },
943
+ name: { type: "string", description: "Collection name / table name" },
944
+ title: { type: "string", description: "Display title" },
945
+ description: { type: "string", nullable: true },
946
+ inherit: { type: "boolean" },
947
+ hidden: { type: "boolean" },
948
+ sortable: {
949
+ oneOf: [{ type: "boolean" }, { type: "string" }, { type: "object", additionalProperties: true }],
950
+ description: "Sorting configuration"
951
+ },
952
+ autoGenId: { type: "boolean" },
953
+ createdBy: { type: "boolean" },
954
+ updatedBy: { type: "boolean" },
955
+ timestamps: { type: "boolean" },
956
+ logging: { type: "boolean" },
957
+ shared: { type: "boolean" },
958
+ schema: { type: "string", nullable: true },
959
+ view: { type: "boolean" },
960
+ template: { type: "string", nullable: true },
961
+ filterTargetKey: { type: "string", nullable: true },
962
+ titleField: { type: "string", nullable: true },
963
+ origin: { type: "string", nullable: true },
964
+ from: { type: "string", nullable: true },
965
+ options: {
966
+ type: "object",
967
+ additionalProperties: true,
968
+ description: "Extra collection options not promoted to top-level properties"
969
+ }
970
+ }
971
+ },
972
+ create: {
973
+ type: "object",
974
+ properties: {
975
+ name: { type: "string", description: "Collection name. Randomly generated if omitted." },
976
+ title: { type: "string", description: "Display title" },
977
+ description: { type: "string" },
978
+ inherit: { type: "boolean" },
979
+ hidden: { type: "boolean" },
980
+ sortable: {
981
+ oneOf: [{ type: "boolean" }, { type: "string" }, { type: "object", additionalProperties: true }]
982
+ },
983
+ autoGenId: { type: "boolean" },
984
+ createdBy: { type: "boolean" },
985
+ updatedBy: { type: "boolean" },
986
+ timestamps: { type: "boolean" },
987
+ logging: { type: "boolean" },
988
+ schema: { type: "string" },
989
+ template: { type: "string" },
990
+ fields: {
991
+ type: "array",
992
+ description: "Optional initial fields created together with the collection",
993
+ items: { $ref: "#/components/schemas/field/write" }
994
+ }
995
+ },
996
+ additionalProperties: true
997
+ },
998
+ update: {
999
+ type: "object",
1000
+ properties: {
1001
+ title: { type: "string" },
1002
+ description: { type: "string" },
1003
+ inherit: { type: "boolean" },
1004
+ hidden: { type: "boolean" },
1005
+ sortable: {
1006
+ oneOf: [{ type: "boolean" }, { type: "string" }, { type: "object", additionalProperties: true }]
1007
+ },
1008
+ createdBy: { type: "boolean" },
1009
+ updatedBy: { type: "boolean" },
1010
+ timestamps: { type: "boolean" },
1011
+ logging: { type: "boolean" },
1012
+ schema: { type: "string" },
1013
+ template: { type: "string" }
1014
+ },
1015
+ additionalProperties: true
1016
+ }
1017
+ },
1018
+ field: {
1019
+ collectionName: {
1020
+ name: "collectionName",
1021
+ in: "path",
1022
+ description: "Collection name",
1023
+ required: true,
1024
+ schema: { type: "string" },
1025
+ example: "posts"
1026
+ },
1027
+ filterByTk: {
1028
+ name: "filterByTk",
1029
+ in: "query",
1030
+ description: "Field name in the target collection",
1031
+ required: true,
1032
+ schema: { type: "string" },
1033
+ example: "title"
1034
+ },
1035
+ filterByTkOptional: {
1036
+ name: "filterByTk",
1037
+ in: "query",
1038
+ description: "Field name in the target collection",
1039
+ schema: { type: "string" },
1040
+ example: "title"
1041
+ },
1042
+ reverseField: {
1043
+ type: "object",
1044
+ description: "Reverse association field created or updated together with the current field",
1045
+ properties: {
1046
+ key: { type: "string" },
1047
+ name: { type: "string" },
1048
+ type: { type: "string" },
1049
+ interface: { type: "string" },
1050
+ uiSchema: {
1051
+ type: "object",
1052
+ additionalProperties: true
1053
+ },
1054
+ target: { type: "string" },
1055
+ foreignKey: { type: "string" },
1056
+ sourceKey: { type: "string" },
1057
+ targetKey: { type: "string" }
1058
+ },
1059
+ additionalProperties: true
1060
+ },
1061
+ model: {
1062
+ type: "object",
1063
+ properties: {
1064
+ key: { type: "string" },
1065
+ name: { type: "string" },
1066
+ collectionName: { type: "string" },
1067
+ type: { type: "string", description: "Field type, for example `string`, `integer`, `belongsTo`" },
1068
+ interface: {
1069
+ type: "string",
1070
+ nullable: true,
1071
+ description: "UI interface hint, for example `input`, `m2o`, `m2m`, `o2m`"
1072
+ },
1073
+ description: { type: "string", nullable: true },
1074
+ source: { type: "string", nullable: true, description: "Source expression, mainly used by view fields" },
1075
+ field: { type: "string", nullable: true, description: "Underlying column name when different from `name`" },
1076
+ target: { type: "string", nullable: true },
1077
+ through: { type: "string", nullable: true },
1078
+ foreignKey: { type: "string", nullable: true },
1079
+ otherKey: { type: "string", nullable: true },
1080
+ sourceKey: { type: "string", nullable: true },
1081
+ targetKey: { type: "string", nullable: true },
1082
+ parentKey: { type: "string", nullable: true },
1083
+ reverseKey: { type: "string", nullable: true },
1084
+ onDelete: { type: "string", nullable: true },
1085
+ sortBy: { type: "string", nullable: true },
1086
+ sortable: { type: "boolean", nullable: true },
1087
+ primaryKey: { type: "boolean", nullable: true },
1088
+ autoIncrement: { type: "boolean", nullable: true },
1089
+ unique: { type: "boolean", nullable: true },
1090
+ allowNull: { type: "boolean", nullable: true },
1091
+ defaultValue: {
1092
+ nullable: true
1093
+ },
1094
+ enum: {
1095
+ type: "array",
1096
+ description: "Choice values.",
1097
+ items: {
1098
+ anyOf: [
1099
+ { type: "string" },
1100
+ {
1101
+ type: "object",
1102
+ properties: {
1103
+ label: { type: "string" },
1104
+ value: {},
1105
+ color: { type: "string" }
1106
+ },
1107
+ required: ["label", "value"],
1108
+ additionalProperties: true
1109
+ }
1110
+ ]
1111
+ }
1112
+ },
1113
+ isForeignKey: { type: "boolean", nullable: true },
1114
+ uiSchema: {
1115
+ type: "object",
1116
+ description: "UI schema payload.",
1117
+ additionalProperties: true
1118
+ },
1119
+ options: {
1120
+ type: "object",
1121
+ additionalProperties: true,
1122
+ description: "Extra field options not promoted to top-level properties"
1123
+ },
1124
+ reverseField: { $ref: "#/components/schemas/field/reverseField" }
1125
+ },
1126
+ additionalProperties: true
1127
+ },
1128
+ write: {
1129
+ type: "object",
1130
+ description: [
1131
+ "Field write schema used by create/update/setFields.",
1132
+ "",
1133
+ "Use direct field values in the request body.",
1134
+ "Do not wrap the payload in an extra `values` object."
1135
+ ].join("\n"),
1136
+ properties: {
1137
+ key: { type: "string" },
1138
+ name: { type: "string" },
1139
+ type: { type: "string" },
1140
+ interface: { type: "string" },
1141
+ description: { type: "string" },
1142
+ field: { type: "string" },
1143
+ source: { type: "string" },
1144
+ target: { type: "string" },
1145
+ through: { type: "string" },
1146
+ foreignKey: { type: "string" },
1147
+ otherKey: { type: "string" },
1148
+ sourceKey: { type: "string" },
1149
+ targetKey: { type: "string" },
1150
+ parentKey: { type: "string" },
1151
+ reverseKey: { type: "string" },
1152
+ onDelete: { type: "string", enum: ["CASCADE", "RESTRICT", "SET NULL", "NO ACTION"] },
1153
+ sortBy: { type: "string" },
1154
+ sortable: { type: "boolean" },
1155
+ primaryKey: { type: "boolean" },
1156
+ autoIncrement: { type: "boolean" },
1157
+ unique: { type: "boolean" },
1158
+ allowNull: { type: "boolean" },
1159
+ defaultValue: {},
1160
+ enum: {
1161
+ type: "array",
1162
+ description: "Choice values.",
1163
+ items: {
1164
+ anyOf: [
1165
+ { type: "string" },
1166
+ {
1167
+ type: "object",
1168
+ properties: {
1169
+ label: { type: "string" },
1170
+ value: {},
1171
+ color: { type: "string" }
1172
+ },
1173
+ required: ["label", "value"],
1174
+ additionalProperties: true
1175
+ }
1176
+ ]
1177
+ }
1178
+ },
1179
+ uiSchema: {
1180
+ type: "object",
1181
+ description: "UI schema payload.",
1182
+ additionalProperties: true
1183
+ },
1184
+ reverseField: { $ref: "#/components/schemas/field/reverseField" }
1185
+ },
1186
+ additionalProperties: true
1187
+ },
1188
+ create: {
1189
+ allOf: [{ $ref: "#/components/schemas/field/write" }]
1190
+ },
1191
+ update: {
1192
+ allOf: [{ $ref: "#/components/schemas/field/write" }]
1193
+ }
1194
+ },
1195
+ collectionCategory: {
1196
+ filterByTk: {
1197
+ name: "filterByTk",
1198
+ in: "query",
1199
+ description: "Category id",
1200
+ required: true,
1201
+ schema: { type: "integer" }
1202
+ },
1203
+ model: {
1204
+ type: "object",
1205
+ properties: {
1206
+ id: { type: "integer" },
1207
+ name: { type: "string" },
1208
+ color: { type: "string" }
1209
+ }
1210
+ },
1211
+ create: {
1212
+ type: "object",
1213
+ properties: {
1214
+ name: { type: "string" },
1215
+ color: { type: "string" }
1216
+ },
1217
+ additionalProperties: true
1218
+ },
1219
+ update: {
1220
+ type: "object",
1221
+ properties: {
1222
+ name: { type: "string" },
1223
+ color: { type: "string" }
1224
+ },
1225
+ additionalProperties: true
1226
+ }
1227
+ }
1228
+ }
439
1229
  }
440
1230
  };