@nocobase/plugin-data-source-main 2.1.0-alpha.13 → 2.1.0-alpha.14

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.
@@ -37,7 +37,7 @@ var swagger_default = {
37
37
  tags: [
38
38
  {
39
39
  name: "collections",
40
- description: "Collection modeling: CRUD, metadata inspection and bulk field synchronization"
40
+ description: "Collection modeling: CRUD, metadata inspection and bulk field updates"
41
41
  },
42
42
  {
43
43
  name: "collections.fields",
@@ -50,6 +50,10 @@ var swagger_default = {
50
50
  {
51
51
  name: "dbViews",
52
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"
53
57
  }
54
58
  ],
55
59
  paths: {
@@ -60,8 +64,8 @@ var swagger_default = {
60
64
  description: [
61
65
  "Get paginated collection records from the collection manager.",
62
66
  "",
63
- "Use this when you only need collection-level metadata. If you also need loaded field definitions,",
64
- "prefer `collections:listMeta`."
67
+ "Suitable for finding collection names, titles, templates, and other high-level metadata",
68
+ "before inspecting one collection in detail."
65
69
  ].join("\n"),
66
70
  parameters: [
67
71
  { $ref: "#/components/schemas/common/filter" },
@@ -149,7 +153,12 @@ var swagger_default = {
149
153
  get: {
150
154
  tags: ["collections"],
151
155
  summary: "Get a collection",
152
- description: "Get a single collection by collection name (`filterByTk`).",
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"),
153
162
  parameters: [
154
163
  { $ref: "#/components/schemas/collection/filterByTk" },
155
164
  { $ref: "#/components/schemas/common/filter" },
@@ -288,7 +297,7 @@ var swagger_default = {
288
297
  "- fields missing from request are destroyed",
289
298
  "- new fields are created",
290
299
  "",
291
- "This is the preferred bulk-sync endpoint for view collections after reading fresh metadata from `dbViews:get`."
300
+ "This is the preferred bulk replacement endpoint for view collections after reading fresh metadata from `dbViews:get`."
292
301
  ].join("\n"),
293
302
  parameters: [{ $ref: "#/components/schemas/collection/filterByTk" }],
294
303
  requestBody: {
@@ -320,6 +329,49 @@ var swagger_default = {
320
329
  }
321
330
  }
322
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
+ },
323
375
  "/collections/{collectionName}/fields:get": {
324
376
  get: {
325
377
  tags: ["collections.fields"],
@@ -532,6 +584,42 @@ var swagger_default = {
532
584
  }
533
585
  }
534
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
+ },
535
623
  "/collectionCategories:list": {
536
624
  post: {
537
625
  tags: ["collectionCategories"],
@@ -995,6 +1083,48 @@ var swagger_default = {
995
1083
  },
996
1084
  additionalProperties: true
997
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
+ },
998
1128
  update: {
999
1129
  type: "object",
1000
1130
  properties: {
@@ -1188,6 +1318,120 @@ var swagger_default = {
1188
1318
  create: {
1189
1319
  allOf: [{ $ref: "#/components/schemas/field/write" }]
1190
1320
  },
1321
+ apply: {
1322
+ type: "object",
1323
+ description: [
1324
+ "Compact field write schema for the high-level apply action.",
1325
+ "",
1326
+ "Typical payload only needs `collectionName`, `name`, `title`, and `interface`.",
1327
+ "For relations, add `target` and optional reverse-field helpers."
1328
+ ].join("\n"),
1329
+ properties: {
1330
+ collectionName: { type: "string", description: "Target collection name" },
1331
+ name: { type: "string" },
1332
+ title: { type: "string" },
1333
+ interface: { type: "string" },
1334
+ description: { type: "string" },
1335
+ target: { type: "string" },
1336
+ defaultValue: {
1337
+ description: "Optional default value JSON. Structure depends on the selected interface."
1338
+ },
1339
+ enum: {
1340
+ type: "array",
1341
+ description: "Choice options JSON.",
1342
+ items: {
1343
+ anyOf: [
1344
+ { type: "string" },
1345
+ {
1346
+ type: "object",
1347
+ properties: {
1348
+ label: { type: "string" },
1349
+ value: {},
1350
+ color: { type: "string" }
1351
+ },
1352
+ required: ["label", "value"],
1353
+ additionalProperties: true
1354
+ }
1355
+ ]
1356
+ }
1357
+ },
1358
+ reverseName: { type: "string" },
1359
+ reverseTitle: { type: "string" },
1360
+ reverseInterface: { type: "string" },
1361
+ settings: {
1362
+ type: "object",
1363
+ description: "Advanced raw field overrides. Use only when the compact fields are insufficient.",
1364
+ additionalProperties: true
1365
+ },
1366
+ reverseField: {
1367
+ allOf: [{ $ref: "#/components/schemas/field/applyShallow" }],
1368
+ description: "Reverse relation helper field definition."
1369
+ }
1370
+ },
1371
+ required: ["collectionName"],
1372
+ additionalProperties: true
1373
+ },
1374
+ applyShallow: {
1375
+ type: "object",
1376
+ description: "Compact reverse-field helper schema.",
1377
+ properties: {
1378
+ name: { type: "string" },
1379
+ title: { type: "string" },
1380
+ interface: { type: "string" },
1381
+ target: { type: "string" },
1382
+ settings: {
1383
+ type: "object",
1384
+ additionalProperties: true
1385
+ }
1386
+ },
1387
+ additionalProperties: true
1388
+ },
1389
+ applyNested: {
1390
+ type: "object",
1391
+ description: "Compact field schema used inside collection apply.",
1392
+ properties: {
1393
+ name: { type: "string" },
1394
+ title: { type: "string" },
1395
+ interface: { type: "string" },
1396
+ description: { type: "string" },
1397
+ target: { type: "string" },
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
+ additionalProperties: true
1434
+ },
1191
1435
  update: {
1192
1436
  allOf: [{ $ref: "#/components/schemas/field/write" }]
1193
1437
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "description": "NocoBase main database, supports relational databases such as PostgreSQL, MySQL, MariaDB and so on.",
7
7
  "description.ru-RU": "Основная база данных NocoBase: поддерживает реляционные СУБД, включая PostgreSQL, MySQL, MariaDB и другие.",
8
8
  "description.zh-CN": "NocoBase 主数据库,支持 PostgreSQL、MySQL、MariaDB 等关系型数据库。",
9
- "version": "2.1.0-alpha.13",
9
+ "version": "2.1.0-alpha.14",
10
10
  "main": "./dist/server/index.js",
11
11
  "homepage": "https://docs.nocobase.com/handbook/data-source-main",
12
12
  "homepage.ru-RU": "https://docs-ru.nocobase.com/handbook/data-source-main",
@@ -25,7 +25,7 @@
25
25
  "@nocobase/test": "2.x",
26
26
  "@nocobase/utils": "2.x"
27
27
  },
28
- "gitHead": "2807a8948412d9c235115a31a81a66f7c82dd173",
28
+ "gitHead": "d8735b541de0ff9557bba704de49c799b4962672",
29
29
  "keywords": [
30
30
  "Data sources"
31
31
  ]