@nocobase/plugin-data-source-main 2.1.0-alpha.1 → 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.
- package/LICENSE +201 -661
- package/README.md +79 -10
- package/dist/client/index.js +1 -1
- package/dist/externalVersion.js +7 -7
- package/dist/server/migrations/20251214100636-id2integer.js +1 -1
- package/dist/server/models/collection.js +2 -2
- package/dist/server/models/field.d.ts +1 -0
- package/dist/server/models/field.js +21 -0
- package/dist/server/server.js +36 -22
- package/dist/swagger/index.d.ts +1075 -30
- package/dist/swagger/index.js +858 -68
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
# NocoBase
|
|
2
2
|
|
|
3
3
|
<video width="100%" controls>
|
|
4
|
-
|
|
4
|
+
<source src="https://github.com/user-attachments/assets/4d11a87b-00e2-48f3-9bf7-389d21072d13" type="video/mp4">
|
|
5
5
|
</video>
|
|
6
6
|
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://trendshift.io/repositories/4112" target="_blank"><img src="https://trendshift.io/api/badge/repositories/4112" alt="nocobase%2Fnocobase | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
|
9
|
+
<a href="https://www.producthunt.com/posts/nocobase?embed=true&utm_source=badge-top-post-topic-badge&utm_medium=badge&utm_souce=badge-nocobase" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/top-post-topic-badge.svg?post_id=456520&theme=light&period=weekly&topic_id=267" alt="NocoBase - Scalability-first, open-source no-code platform | Product Hunt" style="width: 250px; height: 54px;" width="250" height="54" /></a>
|
|
10
|
+
</p>
|
|
7
11
|
|
|
8
12
|
## What is NocoBase
|
|
9
13
|
|
|
10
|
-
NocoBase is
|
|
11
|
-
|
|
14
|
+
NocoBase is the most extensible AI-powered no-code platform.
|
|
15
|
+
Total control. Infinite extensibility. AI collaboration.
|
|
16
|
+
Enable your team to adapt quickly and cut costs dramatically.
|
|
17
|
+
No years of development. No millions wasted.
|
|
18
|
+
Deploy NocoBase in minutes — and take control of everything.
|
|
12
19
|
|
|
13
20
|
Homepage:
|
|
14
|
-
https://www.nocobase.com/
|
|
21
|
+
https://www.nocobase.com/
|
|
15
22
|
|
|
16
23
|
Online Demo:
|
|
17
24
|
https://demo.nocobase.com/new
|
|
@@ -19,12 +26,74 @@ https://demo.nocobase.com/new
|
|
|
19
26
|
Documents:
|
|
20
27
|
https://docs.nocobase.com/
|
|
21
28
|
|
|
22
|
-
|
|
23
|
-
https://
|
|
29
|
+
Forum:
|
|
30
|
+
https://forum.nocobase.com/
|
|
24
31
|
|
|
25
|
-
|
|
26
|
-
https://www.nocobase.com/en/
|
|
32
|
+
Use Cases:
|
|
33
|
+
https://www.nocobase.com/en/blog/tags/customer-stories
|
|
27
34
|
|
|
35
|
+
## Release Notes
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
Our [blog](https://www.nocobase.com/en/blog/timeline) is regularly updated with release notes and provides a weekly summary.
|
|
38
|
+
|
|
39
|
+
## Distinctive features
|
|
40
|
+
|
|
41
|
+
### 1. Data model-driven, not form/table–driven
|
|
42
|
+
|
|
43
|
+
Instead of being constrained by forms or tables, NocoBase adopts a data model–driven approach, separating data structure from user interface to unlock unlimited possibilities.
|
|
44
|
+
|
|
45
|
+
- UI and data structure are fully decoupled
|
|
46
|
+
- Multiple blocks and actions can be created for the same table or record in any quantity or form
|
|
47
|
+
- Supports the main database, external databases, and third-party APIs as data sources
|
|
48
|
+
|
|
49
|
+

|
|
50
|
+
|
|
51
|
+
### 2. AI employees, integrated into your business systems
|
|
52
|
+
Unlike standalone AI demos, NocoBase allows you to embed AI capabilities seamlessly into your interfaces, workflows, and data context, making AI truly useful in real business scenarios.
|
|
53
|
+
|
|
54
|
+
- Define AI employees for roles such as translator, analyst, researcher, or assistant
|
|
55
|
+
- Seamless AI–human collaboration in interfaces and workflows
|
|
56
|
+
- Ensure AI usage is secure, transparent, and customizable for your business needs
|
|
57
|
+
|
|
58
|
+

|
|
59
|
+
|
|
60
|
+
### 3. What you see is what you get, incredibly easy to use
|
|
61
|
+
|
|
62
|
+
While enabling the development of complex business systems, NocoBase keeps the experience simple and intuitive.
|
|
63
|
+
|
|
64
|
+
- One-click switch between usage mode and configuration mode
|
|
65
|
+
- Pages serve as a canvas to arrange blocks and actions, similar to Notion
|
|
66
|
+
- Configuration mode is designed for ordinary users, not just programmers
|
|
67
|
+
|
|
68
|
+

|
|
69
|
+
|
|
70
|
+
### 4. Everything is a plugin, designed for extension
|
|
71
|
+
Adding more no-code features will never cover every business case. NocoBase is built for extension through its plugin-based microkernel architecture.
|
|
72
|
+
|
|
73
|
+
- All functionalities are plugins, similar to WordPress
|
|
74
|
+
- Plugins are ready to use upon installation
|
|
75
|
+
- Pages, blocks, actions, APIs, and data sources can all be extended through custom plugins
|
|
76
|
+
|
|
77
|
+

|
|
78
|
+
|
|
79
|
+
## Installation
|
|
80
|
+
|
|
81
|
+
NocoBase supports three installation methods:
|
|
82
|
+
|
|
83
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/docker-compose">Installing With Docker (👍Recommended)</a>
|
|
84
|
+
|
|
85
|
+
Suitable for no-code scenarios, no code to write. When upgrading, just download the latest image and reboot.
|
|
86
|
+
|
|
87
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/create-nocobase-app">Installing from create-nocobase-app CLI</a>
|
|
88
|
+
|
|
89
|
+
The business code of the project is completely independent and supports low-code development.
|
|
90
|
+
|
|
91
|
+
- <a target="_blank" href="https://docs.nocobase.com/welcome/getting-started/installation/git-clone">Installing from Git source code</a>
|
|
92
|
+
|
|
93
|
+
If you want to experience the latest unreleased version, or want to participate in the contribution, you need to make changes and debug on the source code, it is recommended to choose this installation method, which requires a high level of development skills, and if the code has been updated, you can git pull the latest code.
|
|
94
|
+
|
|
95
|
+
## How NocoBase works
|
|
96
|
+
|
|
97
|
+
<video width="100%" controls>
|
|
98
|
+
<source src="https://github.com/user-attachments/assets/8d183b44-9bb5-4792-b08f-bc08fe8dfaaf" type="video/mp4">
|
|
99
|
+
</video>
|
package/dist/client/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("@nocobase/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-data-source-main",["lodash","@nocobase/client"],t):"object"==typeof exports?exports["@nocobase/plugin-data-source-main"]=t(require("lodash"),require("@nocobase/client")):e["@nocobase/plugin-data-source-main"]=t(e.lodash,e["@nocobase/client"])}(self,function(e,t){return function(){"use strict";var r={
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("@nocobase/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-data-source-main",["lodash","@nocobase/client"],t):"object"==typeof exports?exports["@nocobase/plugin-data-source-main"]=t(require("lodash"),require("@nocobase/client")):e["@nocobase/plugin-data-source-main"]=t(e.lodash,e["@nocobase/client"])}(self,function(e,t){return function(){"use strict";var r,o={342:function(e){e.exports=t},773:function(t){t.exports=e}},n={};function i(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return o[e](r,r.exports,i),r.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var r in t)i.o(t,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.g.importScripts&&(a=i.g.location+"");var a,c=i.g.document;if(!a&&c&&(c.currentScript&&"SCRIPT"===c.currentScript.tagName.toUpperCase()&&(a=c.currentScript.src),!a)){var u=c.getElementsByTagName("script");if(u.length)for(var l=u.length-1;l>-1&&(!a||!/^http(s?):/.test(a));)a=u[l--].src}if(!a)throw Error("Automatic publicPath is not supported in this browser");i.p=a.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var s={};return"/"!==(r=window.__webpack_public_path__||"/").charAt(r.length-1)&&(r+="/"),i.p=r+"static/plugins/@nocobase/plugin-data-source-main/dist/client/",!function(){i.r(s);var e=i(342),t=i(773);function r(e,t,r,o,n,i,a){try{var c=e[i](a),u=c.value}catch(e){r(e);return}c.done?t(u):Promise.resolve(u).then(o,n)}function o(e,t,r){return(o=u()?Reflect.construct:function(e,t,r){var o=[null];o.push.apply(o,t);var n=new(Function.bind.apply(e,o));return r&&a(n,r.prototype),n}).apply(null,arguments)}function n(e){return(n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function a(e,t){return(a=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e){var t="function"==typeof Map?new Map:void 0;return(c=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return o(e,arguments,n(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),a(r,e)})(e)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}s.default=function(e){var o;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function i(){var e,t,r,o,a;if(!(this instanceof i))throw TypeError("Cannot call a class as a function");return t=i,r=arguments,t=n(t),e=function(e,t){var r;if(t&&("object"==((r=t)&&"u">typeof Symbol&&r.constructor===Symbol?"symbol":typeof r)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,u()?Reflect.construct(t,r||[],n(this).constructor):t.apply(this,r)),a=[],(o="collectionPresetFields")in e?Object.defineProperty(e,o,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[o]=a,e}return i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&a(i,e),o=[{key:"addCollectionPresetField",value:function(e){this.collectionPresetFields.push(e)}},{key:"removeCollectionPresetField",value:function(e){this.collectionPresetFields=(0,t.reject)(this.collectionPresetFields,function(t){return t.value.name===e})}},{key:"getCollectionPresetFields",value:function(){return(0,t.orderBy)(this.collectionPresetFields,["order"],["asc"])}},{key:"load",value:function(){var e;return(e=function(){return function(e,t){var r,o,n,i={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),c=Object.defineProperty;return c(a,"next",{value:u(0)}),c(a,"throw",{value:u(1)}),c(a,"return",{value:u(2)}),"function"==typeof Symbol&&c(a,Symbol.iterator,{value:function(){return this}}),a;function u(c){return function(u){var l=[c,u];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,l[0]&&(i=0)),i;)try{if(r=1,o&&(n=2&l[0]?o.return:l[0]?o.throw||((n=o.return)&&n.call(o),0):o.next)&&!(n=n.call(o,l[1])).done)return n;switch(o=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,o=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(n=(n=i.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){i.label=l[1];break}if(6===l[0]&&i.label<n[1]){i.label=n[1],n=l;break}if(n&&i.label<n[2]){i.label=n[2],i.ops.push(l);break}n[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],o=0}finally{r=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.addCollectionPresetField({order:100,description:'{{t("Primary key, distributed uniqueness, time-ordering") }}',value:{name:"id",type:"snowflakeId",autoIncrement:!1,primaryKey:!0,allowNull:!1,uiSchema:{type:"number",title:'{{t("ID")}}',"x-component":"InputNumber","x-component-props":{stringMode:!0,separator:"0.00",step:"1"},"x-validator":"integer"},interface:"snowflakeId"}}),this.addCollectionPresetField({order:200,description:'{{t("Store the creation time of each record")}}',value:{name:"createdAt",interface:"createdAt",type:"date",field:"createdAt",uiSchema:{type:"datetime",title:'{{t("Created at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}}}),this.addCollectionPresetField({order:300,description:'{{t("Store the creation user of each record") }}',value:{name:"createdBy",interface:"createdBy",type:"belongsTo",target:"users",foreignKey:"createdById",uiSchema:{type:"object",title:'{{t("Created by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}}}),this.addCollectionPresetField({order:400,description:'{{t("Store the last update time of each record")}}',value:{type:"date",field:"updatedAt",name:"updatedAt",interface:"updatedAt",uiSchema:{type:"datetime",title:'{{t("Last updated at")}}',"x-component":"DatePicker","x-component-props":{},"x-read-pretty":!0}}}),this.addCollectionPresetField({order:500,description:'{{t("Store the last update user of each record")}}',value:{type:"belongsTo",target:"users",foreignKey:"updatedById",name:"updatedBy",interface:"updatedBy",uiSchema:{type:"object",title:'{{t("Last updated by")}}',"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"nickname"}},"x-read-pretty":!0}}}),[2]})},function(){var t=this,o=arguments;return new Promise(function(n,i){var a=e.apply(t,o);function c(e){r(a,n,i,c,u,"next",e)}function u(e){r(a,n,i,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(i.prototype,o),i}(c(e.Plugin))}(),s}()});
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "2.1.0-alpha.
|
|
11
|
+
"@nocobase/client": "2.1.0-alpha.10",
|
|
12
12
|
"lodash": "4.17.21",
|
|
13
|
-
"@nocobase/database": "2.1.0-alpha.
|
|
14
|
-
"@nocobase/plugin-error-handler": "2.1.0-alpha.
|
|
15
|
-
"@nocobase/server": "2.1.0-alpha.
|
|
13
|
+
"@nocobase/database": "2.1.0-alpha.10",
|
|
14
|
+
"@nocobase/plugin-error-handler": "2.1.0-alpha.10",
|
|
15
|
+
"@nocobase/server": "2.1.0-alpha.10",
|
|
16
16
|
"sequelize": "6.35.2",
|
|
17
17
|
"@formily/json-schema": "2.3.7",
|
|
18
|
-
"@nocobase/test": "2.1.0-alpha.
|
|
19
|
-
"@nocobase/utils": "2.1.0-alpha.
|
|
20
|
-
"@nocobase/actions": "2.1.0-alpha.
|
|
18
|
+
"@nocobase/test": "2.1.0-alpha.10",
|
|
19
|
+
"@nocobase/utils": "2.1.0-alpha.10",
|
|
20
|
+
"@nocobase/actions": "2.1.0-alpha.10",
|
|
21
21
|
"dayjs": "1.11.13"
|
|
22
22
|
};
|
|
@@ -33,7 +33,7 @@ var import_server = require("@nocobase/server");
|
|
|
33
33
|
class id2integer_default extends import_server.Migration {
|
|
34
34
|
on = "afterLoad";
|
|
35
35
|
// 'beforeLoad' or 'afterLoad'
|
|
36
|
-
appVersion = "<2.
|
|
36
|
+
appVersion = "<2.1.0";
|
|
37
37
|
async up() {
|
|
38
38
|
const repo = this.db.getRepository("fields");
|
|
39
39
|
await repo.update({
|
|
@@ -88,8 +88,8 @@ class CollectionModel extends import_database.MagicAttributeModel {
|
|
|
88
88
|
if (!collectionOptions.dumpRules) {
|
|
89
89
|
import_lodash.default.set(collectionOptions, "dumpRules.group", "custom");
|
|
90
90
|
}
|
|
91
|
-
const
|
|
92
|
-
const fieldModels = await
|
|
91
|
+
const fieldModel = this.db.getModel("fields");
|
|
92
|
+
const fieldModels = await fieldModel.findAll({ where: { collectionName: name }, transaction });
|
|
93
93
|
collectionOptions["fieldModels"] = fieldModels;
|
|
94
94
|
collection = this.db.collection(collectionOptions);
|
|
95
95
|
}
|
|
@@ -12,6 +12,7 @@ interface LoadOptions extends Transactionable {
|
|
|
12
12
|
}
|
|
13
13
|
export declare class FieldModel extends MagicAttributeModel {
|
|
14
14
|
get db(): Database;
|
|
15
|
+
set(key: any, value?: any, options?: any): this;
|
|
15
16
|
isAssociationField(): boolean;
|
|
16
17
|
load(loadOptions?: LoadOptions): Promise<import("@nocobase/database").Field>;
|
|
17
18
|
syncSortByField(options: Transactionable): Promise<void>;
|
|
@@ -45,6 +45,24 @@ class FieldModel extends import_database.MagicAttributeModel {
|
|
|
45
45
|
get db() {
|
|
46
46
|
return this.constructor.database;
|
|
47
47
|
}
|
|
48
|
+
set(key, value, options) {
|
|
49
|
+
if (typeof key === "string") {
|
|
50
|
+
if (key === "defaultValue") {
|
|
51
|
+
return this.setV1(`${this.magicAttribute}.defaultValue`, value, options);
|
|
52
|
+
}
|
|
53
|
+
return super.set(key, value, options);
|
|
54
|
+
}
|
|
55
|
+
if (import_lodash.default.isPlainObject(key) && Object.prototype.hasOwnProperty.call(key, "defaultValue")) {
|
|
56
|
+
const { defaultValue, ...rest } = key;
|
|
57
|
+
const setOptions = value;
|
|
58
|
+
if (Object.keys(rest).length) {
|
|
59
|
+
super.set(rest, setOptions);
|
|
60
|
+
}
|
|
61
|
+
this.setV1(`${this.magicAttribute}.defaultValue`, defaultValue, setOptions);
|
|
62
|
+
return this;
|
|
63
|
+
}
|
|
64
|
+
return super.set(key, value, options);
|
|
65
|
+
}
|
|
48
66
|
isAssociationField() {
|
|
49
67
|
return ["belongsTo", "hasOne", "hasMany", "belongsToMany"].includes(this.get("type"));
|
|
50
68
|
}
|
|
@@ -103,6 +121,9 @@ class FieldModel extends import_database.MagicAttributeModel {
|
|
|
103
121
|
async syncUniqueIndex(options) {
|
|
104
122
|
const unique = this.get("unique");
|
|
105
123
|
const collection = this.getFieldCollection();
|
|
124
|
+
if (!collection) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
106
127
|
const field = collection.getField(this.get("name"));
|
|
107
128
|
const columnName = collection.model.rawAttributes[this.get("name")].field;
|
|
108
129
|
const tableName = collection.model.tableName;
|
package/dist/server/server.js
CHANGED
|
@@ -415,22 +415,36 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
415
415
|
this.app.resourceManager.define(import_views.default);
|
|
416
416
|
this.app.resourceManager.registerActionHandlers(import_collections.default);
|
|
417
417
|
this.app.resourceManager.define(import_main_data_source.default);
|
|
418
|
-
const handleFieldSource = (
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
418
|
+
const handleFieldSource = ({
|
|
419
|
+
fields,
|
|
420
|
+
isRawValue,
|
|
421
|
+
rawFields
|
|
422
|
+
}) => {
|
|
423
|
+
import_lodash.default.castArray(fields).forEach((field, index) => {
|
|
424
|
+
var _a;
|
|
425
|
+
const source = isRawValue ? field.source : field.get("source");
|
|
426
|
+
if (!source) {
|
|
427
|
+
return;
|
|
428
|
+
}
|
|
429
|
+
const [collectionSource, fieldSource] = source.split(".");
|
|
430
|
+
const collectionField = (_a = this.app.db.getCollection(collectionSource)) == null ? void 0 : _a.getField(fieldSource);
|
|
431
|
+
if (!collectionField) {
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
const newOptions = {};
|
|
435
|
+
import_lodash.default.merge(newOptions, import_lodash.default.omit(collectionField.options, "name"));
|
|
436
|
+
const currentValues = isRawValue ? field : field.get();
|
|
437
|
+
import_lodash.default.mergeWith(newOptions, currentValues, (objValue, srcValue) => {
|
|
438
|
+
if (srcValue === null) {
|
|
439
|
+
return objValue;
|
|
426
440
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
441
|
+
});
|
|
442
|
+
if (isRawValue) {
|
|
443
|
+
fields[index] = {
|
|
444
|
+
...field,
|
|
445
|
+
...newOptions
|
|
446
|
+
};
|
|
447
|
+
} else {
|
|
434
448
|
field.set("options", newOptions);
|
|
435
449
|
}
|
|
436
450
|
const fieldTypes = import_database.fieldTypeMap[this.db.options.dialect];
|
|
@@ -442,16 +456,16 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
442
456
|
field.set("possibleTypes", possibleTypes);
|
|
443
457
|
}
|
|
444
458
|
}
|
|
445
|
-
}
|
|
459
|
+
});
|
|
446
460
|
};
|
|
447
461
|
this.app.resourceManager.use(async function handleFieldSourceMiddleware(ctx, next) {
|
|
448
|
-
var _a
|
|
462
|
+
var _a;
|
|
449
463
|
await next();
|
|
450
|
-
if (ctx.action.resourceName === "collections" && ctx.action.actionName == "
|
|
464
|
+
if (ctx.action.resourceName === "collections" && ctx.action.actionName == "listMeta") {
|
|
451
465
|
for (const collection of ctx.body) {
|
|
452
|
-
if (collection.
|
|
466
|
+
if (collection.view === true) {
|
|
453
467
|
const fields = collection.fields;
|
|
454
|
-
handleFieldSource(fields);
|
|
468
|
+
handleFieldSource({ fields, isRawValue: true });
|
|
455
469
|
}
|
|
456
470
|
}
|
|
457
471
|
}
|
|
@@ -467,10 +481,10 @@ class PluginDataSourceMainServer extends import_server.Plugin {
|
|
|
467
481
|
} catch (err) {
|
|
468
482
|
}
|
|
469
483
|
}
|
|
470
|
-
handleFieldSource(((
|
|
484
|
+
handleFieldSource({ fields: ((_a = ctx.action.params) == null ? void 0 : _a.paginate) == "false" ? ctx.body : ctx.body.rows, rawFields });
|
|
471
485
|
}
|
|
472
486
|
if (ctx.action.resourceName == "collections.fields" && ctx.action.actionName == "get") {
|
|
473
|
-
handleFieldSource(ctx.body);
|
|
487
|
+
handleFieldSource({ fields: ctx.body });
|
|
474
488
|
}
|
|
475
489
|
});
|
|
476
490
|
this.app.db.extendCollection({
|