@nocobase/plugin-data-source-manager 1.6.0-alpha.3 → 1.6.0-alpha.31

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.
@@ -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("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("@emotion/css"),require("react-i18next"),require("@formily/antd-v5"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("antd"),require("@dnd-kit/core"),require("antd-style"),require("react-router-dom"),require("@formily/reactive")):"function"==typeof define&&define.amd?define("@nocobase/plugin-data-source-manager",["@nocobase/client","@ant-design/icons","@formily/react","react","@emotion/css","react-i18next","@formily/antd-v5","@formily/shared","@nocobase/plugin-acl/client","@nocobase/utils/client","@formily/core","lodash","antd","@dnd-kit/core","antd-style","react-router-dom","@formily/reactive"],t):"object"==typeof exports?exports["@nocobase/plugin-data-source-manager"]=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("react"),require("@emotion/css"),require("react-i18next"),require("@formily/antd-v5"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("antd"),require("@dnd-kit/core"),require("antd-style"),require("react-router-dom"),require("@formily/reactive")):e["@nocobase/plugin-data-source-manager"]=t(e["@nocobase/client"],e["@ant-design/icons"],e["@formily/react"],e.react,e["@emotion/css"],e["react-i18next"],e["@formily/antd-v5"],e["@formily/shared"],e["@nocobase/plugin-acl/client"],e["@nocobase/utils/client"],e["@formily/core"],e.lodash,e.antd,e["@dnd-kit/core"],e["antd-style"],e["react-router-dom"],e["@formily/reactive"])}(self,function(e,t,n,r,o,i,a,c,u,l,s,f,p,d,b,y,m){return function(){var g,v,h,O,_,w={60:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginDataSourceManagerClient:function(){return C}});var r=n(772),o=n(465),i=n.n(o),a=n(584),c=n(156),u=n.n(c),l=n(382),s=n(573),f=n(581);function p(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){p(i,r,o,a,c,"next",e)}function c(e){p(i,r,o,a,c,"throw",e)}a(void 0)})}}function b(e,t,n){return(b=O()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&v(o,n.prototype),o}).apply(null,arguments)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function v(e,t){return(v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){var t="function"==typeof Map?new Map:void 0;return(h=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).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 b(e,arguments,g(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),v(r,e)})(e)}function O(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(O=function(){return!!e})()}function _(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var w=(0,r.lazy)(function(){return f("imported_174m4o3_component",n.e("721").then(n.bind(n,947)))},"DatabaseConnectionProvider").DatabaseConnectionProvider,S=(0,r.lazy)(function(){return f("imported_-1bdhn46_component",n.e("927").then(n.bind(n,580)))},"BreadcumbTitle").BreadcumbTitle,P=(0,r.lazy)(function(){return f("imported_l1a36j_component",Promise.all([n.e("833"),n.e("481")]).then(n.bind(n,791)))},"CollectionManagerPage").CollectionManagerPage,x=(0,r.lazy)(function(){return f("imported_k8ts4l_component",n.e("210").then(n.bind(n,186)))},"DatabaseConnectionManagerPane").DatabaseConnectionManagerPane,k=(0,r.lazy)(function(){return f("imported_1cub3nb_component",Promise.all([n.e("833"),n.e("542")]).then(n.bind(n,185)))},"MainDataSourceManager").MainDataSourceManager,j=(0,r.lazy)(function(){return f("imported_-1b29440_component",n.e("630").then(n.bind(n,994)))},"DataSourcePermissionManager").DataSourcePermissionManager,q=(0,r.lazy)(function(){return f("imported_cef22q_component",n.e("518").then(n.bind(n,865)))},"CollectionMainProvider").CollectionMainProvider,C=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=g(n),m(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,O()?Reflect.construct(n,r||[],g(t).constructor):n.apply(t,r)),"types",new Map),m(e,"extendedTabs",{}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}(o,e),t=o,n=[{key:"getExtendedTabs",value:function(){return this.extendedTabs}},{key:"registerPermissionTab",value:function(e){this.extendedTabs[(0,a.uid)()]=e}},{key:"load",value:function(){var e=this;return d(function(){return _(this,function(t){return e.app.pm.get(i()).settingsUI.addPermissionsTab(function(e){var t=e.t,n=e.TabLayout,r=e.activeRole;return{key:"dataSource",label:t("Data sources"),children:u().createElement(n,null,u().createElement(j,{role:r}))}}),e.app.use(w),e.app.pluginSettingsManager.add(s.A7,{title:'{{t("Data sources", { ns: "'.concat(s.A7,'" })}}'),icon:"ClusterOutlined",showTabs:!1,aclSnippet:"pm.data-source-manager*"}),e.app.pluginSettingsManager.add("".concat(s.A7,".list"),{title:'{{t("Data sources", { ns: "'.concat(s.A7,'" })}}'),Component:x,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/:name"),{title:u().createElement(S,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/main"),{title:u().createElement(S,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main",Component:q}),e.app.pluginSettingsManager.add("".concat(s.A7,"/main.collections"),{title:'{{t("Collections", { ns: "'.concat(s.A7,'" })}}'),Component:k,topLevelName:"".concat(s.A7,"/main"),pluginKey:s.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/:name.collections"),{title:'{{t("Collections", { ns: "'.concat(s.A7,'" })}}'),Component:P,topLevelName:"".concat(s.A7,"/:name"),pluginKey:s.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.dataSourceManager.addDataSources(e.getThirdDataSource.bind(e),l.F),[2]})})()}},{key:"setDataSources",value:function(){var e=this;return d(function(){var t,n;return _(this,function(r){switch(r.label){case 0:return[4,e.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1}})];case 1:return[2,null==(n=r.sent())?void 0:null===(t=n.data)||void 0===t?void 0:t.data]}})})()}},{key:"getThirdDataSource",value:function(){var e=this;return d(function(){var t,n;return _(this,function(r){switch(r.label){case 0:return[4,e.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1,appends:["collections"]}})];case 1:return[2,null==(n=r.sent())?void 0:null===(t=n.data)||void 0===t?void 0:t.data]}})})()}},{key:"registerType",value:function(e,t){this.types.set(e,t)}}],y(t.prototype,n),o}(h(r.Plugin));t.default=C},382:function(e,t,n){"use strict";n.d(t,{F:function(){return l}});var r=n(772);function o(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var l=function(e){var t,n,r;function l(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,l),e=this,t=l,n=arguments,t=a(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],a(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(l,e),t=l,n=[{key:"getDataSource",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(e){switch(e.label){case 0:return[4,t.app.apiClient.request({url:"dataSources:get/".concat(t.key),params:{appends:["collections"]}})];case 1:return[2,e.sent().data.data]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function c(e){o(a,r,i,c,u,"next",e)}function u(e){o(a,r,i,c,u,"throw",e)}c(void 0)})})()}}],i(t.prototype,n),l}(r.DataSource)},573:function(e,t,n){"use strict";n.d(t,{A7:function(){return i},EL:function(){return c},KQ:function(){return a}});var r=n(772),o=n(238),i="data-source-manager";function a(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.i18n.t(e,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},o),n=(n={ns:i},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function c(){return(0,o.useTranslation)([i,"client"],{nsMode:"fallback"})}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=t},948:function(e){"use strict";e.exports=d},964:function(e){"use strict";e.exports=o},632:function(e){"use strict";e.exports=a},563:function(e){"use strict";e.exports=s},505:function(e){"use strict";e.exports=n},229:function(e){"use strict";e.exports=m},875:function(e){"use strict";e.exports=c},772:function(t){"use strict";t.exports=e},465:function(e){"use strict";e.exports=u},584:function(e){"use strict";e.exports=l},721:function(e){"use strict";e.exports=p},202:function(e){"use strict";e.exports=b},467:function(e){"use strict";e.exports=f},156:function(e){"use strict";e.exports=r},238:function(e){"use strict";e.exports=i},128:function(e){"use strict";e.exports=y}},S={};function P(e){var t=S[e];if(void 0!==t)return t.exports;var n=S[e]={exports:{}};return w[e](n,n.exports,P),n.exports}return P.m=w,P.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return P.d(t,{a:t}),t},P.d=function(e,t){for(var n in t)P.o(t,n)&&!P.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},P.f={},P.e=function(e){return Promise.all(Object.keys(P.f).reduce(function(t,n){return P.f[n](e,t),t},[]))},P.u=function(e){return""+({210:"05fd9bbff4351687",481:"f872ce8b96bd8876",518:"93d7762d5a5ead48",542:"e442de49e2cdbac7",630:"260ea8a867c3a069",721:"7948d6c08bf3359d",833:"be315d279dcb549f",927:"435a0c316fa76b6f"})[e]+".js"},P.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},g={},v="@nocobase/plugin-data-source-manager:",P.l=function(e,t,n,r){if(g[e]){g[e].push(t);return}if(void 0!==n){for(var o,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var u=a[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==v+n){o=u;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,P.nc&&o.setAttribute("nonce",P.nc),o.setAttribute("data-webpack",v+n),o.src=e),g[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=g[e];if(delete g[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},P.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},P.p="/static/plugins/@nocobase/plugin-data-source-manager/dist/client/",h={909:0},P.f.j=function(e,t){var n=P.o(h,e)?h[e]:void 0;if(0!==n){if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=h[e]=[t,r]});t.push(n[2]=r);var o=P.p+P.u(e),i=Error();P.l(o,function(t){if(P.o(h,e)&&(0!==(n=h[e])&&(h[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}}},O=function(e,t){var n=t[0],r=t[1],o=t[2],i,a,c=0;if(n.some(function(e){return 0!==h[e]})){for(i in r)P.o(r,i)&&(P.m[i]=r[i]);o&&o(P)}for(e&&e(t);c<n.length;c++)a=n[c],P.o(h,a)&&h[a]&&h[a][0](),h[a]=0},(_=self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).forEach(O.bind(null,0)),_.push=O.bind(null,_.push.bind(_)),P("60")}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("@emotion/css"),require("react-i18next"),require("react"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("antd"),require("@dnd-kit/core"),require("antd-style"),require("react-router-dom"),require("@formily/reactive")):"function"==typeof define&&define.amd?define("@nocobase/plugin-data-source-manager",["@nocobase/client","@ant-design/icons","@formily/react","@formily/antd-v5","@emotion/css","react-i18next","react","@formily/shared","@nocobase/plugin-acl/client","@nocobase/utils/client","@formily/core","lodash","antd","@dnd-kit/core","antd-style","react-router-dom","@formily/reactive"],t):"object"==typeof exports?exports["@nocobase/plugin-data-source-manager"]=t(require("@nocobase/client"),require("@ant-design/icons"),require("@formily/react"),require("@formily/antd-v5"),require("@emotion/css"),require("react-i18next"),require("react"),require("@formily/shared"),require("@nocobase/plugin-acl/client"),require("@nocobase/utils/client"),require("@formily/core"),require("lodash"),require("antd"),require("@dnd-kit/core"),require("antd-style"),require("react-router-dom"),require("@formily/reactive")):e["@nocobase/plugin-data-source-manager"]=t(e["@nocobase/client"],e["@ant-design/icons"],e["@formily/react"],e["@formily/antd-v5"],e["@emotion/css"],e["react-i18next"],e.react,e["@formily/shared"],e["@nocobase/plugin-acl/client"],e["@nocobase/utils/client"],e["@formily/core"],e.lodash,e.antd,e["@dnd-kit/core"],e["antd-style"],e["react-router-dom"],e["@formily/reactive"])}(self,function(e,t,n,r,o,i,a,c,u,l,s,f,p,d,b,y,m){return function(){var g,h,v,_,w,O,S={60:function(e,t,n){"use strict";n.r(t),n.d(t,{PluginDataSourceManagerClient:function(){return C}});var r=n(772),o=n(465),i=n.n(o),a=n(584),c=n(156),u=n.n(c),l=n(382),s=n(573),f=n(581);function p(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function a(e){p(i,r,o,a,c,"next",e)}function c(e){p(i,r,o,a,c,"throw",e)}a(void 0)})}}function b(e,t,n){return(b=_()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&h(o,n.prototype),o}).apply(null,arguments)}function y(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function m(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(e){var t="function"==typeof Map?new Map:void 0;return(v=function(e){var n;if(null===e||(n=e,-1===Function.toString.call(n).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 b(e,arguments,g(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),h(r,e)})(e)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}function w(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}var O=(0,r.lazy)(function(){return f("imported_174m4o3_component",n.e("721").then(n.bind(n,947)))},"DatabaseConnectionProvider").DatabaseConnectionProvider,S=(0,r.lazy)(function(){return f("imported_-1bdhn46_component",n.e("927").then(n.bind(n,580)))},"BreadcumbTitle").BreadcumbTitle,P=(0,r.lazy)(function(){return f("imported_l1a36j_component",Promise.all([n.e("833"),n.e("481")]).then(n.bind(n,791)))},"CollectionManagerPage").CollectionManagerPage,x=(0,r.lazy)(function(){return f("imported_k8ts4l_component",n.e("210").then(n.bind(n,186)))},"DatabaseConnectionManagerPane").DatabaseConnectionManagerPane,j=(0,r.lazy)(function(){return f("imported_1cub3nb_component",Promise.all([n.e("833"),n.e("542")]).then(n.bind(n,185)))},"MainDataSourceManager").MainDataSourceManager,k=(0,r.lazy)(function(){return f("imported_-1b29440_component",n.e("630").then(n.bind(n,994)))},"DataSourcePermissionManager").DataSourcePermissionManager,q=(0,r.lazy)(function(){return f("imported_cef22q_component",n.e("518").then(n.bind(n,865)))},"CollectionMainProvider").CollectionMainProvider,C=function(e){var t,n,r;function o(){var e,t,n,r;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,o),t=this,n=o,r=arguments,n=g(n),m(e=function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(t,_()?Reflect.construct(n,r||[],g(t).constructor):n.apply(t,r)),"types",new Map),m(e,"extendedTabs",{}),e}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}(o,e),t=o,n=[{key:"getExtendedTabs",value:function(){return this.extendedTabs}},{key:"registerPermissionTab",value:function(e){this.extendedTabs[(0,a.uid)()]=e}},{key:"load",value:function(){var e=this;return d(function(){return w(this,function(t){return e.app.pm.get(i()).settingsUI.addPermissionsTab(function(e){var t=e.t,n=e.TabLayout,r=e.activeRole;return{key:"dataSource",label:t("Data sources"),sort:15,children:u().createElement(n,null,u().createElement(k,{role:r}))}}),e.app.use(O),e.app.pluginSettingsManager.add(s.A7,{title:'{{t("Data sources", { ns: "'.concat(s.A7,'" })}}'),icon:"ClusterOutlined",showTabs:!1,aclSnippet:"pm.data-source-manager*"}),e.app.pluginSettingsManager.add("".concat(s.A7,".list"),{title:'{{t("Data sources", { ns: "'.concat(s.A7,'" })}}'),Component:x,sort:1,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/:name"),{title:u().createElement(S,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/main"),{title:u().createElement(S,null),icon:"ClusterOutlined",isTopLevel:!1,sort:100,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main",Component:q}),e.app.pluginSettingsManager.add("".concat(s.A7,"/main.collections"),{title:'{{t("Collections", { ns: "'.concat(s.A7,'" })}}'),Component:j,topLevelName:"".concat(s.A7,"/main"),pluginKey:s.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.pluginSettingsManager.add("".concat(s.A7,"/:name.collections"),{title:'{{t("Collections", { ns: "'.concat(s.A7,'" })}}'),Component:P,topLevelName:"".concat(s.A7,"/:name"),pluginKey:s.A7,skipAclConfigure:!0,aclSnippet:"pm.data-source-manager.data-source-main"}),e.app.dataSourceManager.addDataSources(e.getThirdDataSource.bind(e),l.F),[2]})})()}},{key:"setDataSources",value:function(){var e=this;return d(function(){var t,n;return w(this,function(r){switch(r.label){case 0:return[4,e.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1}})];case 1:return[2,null==(n=r.sent())?void 0:null===(t=n.data)||void 0===t?void 0:t.data]}})})()}},{key:"getThirdDataSource",value:function(){var e=this;return d(function(){var t,n;return w(this,function(r){switch(r.label){case 0:return[4,e.app.apiClient.request({resource:"dataSources",action:"listEnabled",params:{paginate:!1,appends:["collections"]}})];case 1:return[2,null==(n=r.sent())?void 0:null===(t=n.data)||void 0===t?void 0:t.data]}})})()}},{key:"registerType",value:function(e,t){this.types.set(e,t)}}],y(t.prototype,n),o}(v(r.Plugin));t.default=C},382:function(e,t,n){"use strict";n.d(t,{F:function(){return l}});var r=n(772);function o(e,t,n,r,o,i,a){try{var c=e[i](a),u=c.value}catch(e){n(e);return}c.done?t(u):Promise.resolve(u).then(r,o)}function i(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(u=function(){return!!e})()}var l=function(e){var t,n,r;function l(){var e,t,n;return!function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,l),e=this,t=l,n=arguments,t=a(t),function(e,t){return t&&("object"===function(e){return e&&"undefined"!=typeof Symbol&&e.constructor===Symbol?"symbol":typeof e}(t)||"function"==typeof t)?t:function(e){if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,u()?Reflect.construct(t,n||[],a(e).constructor):t.apply(e,n))}return!function(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(l,e),t=l,n=[{key:"getDataSource",value:function(){var e,t=this;return(e=function(){return function(e,t){var n,r,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function c(i){return function(c){return function(i){if(n)throw TypeError("Generator is already executing.");for(;a;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,r=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){a.label=i[1];break}if(6===i[0]&&a.label<o[1]){a.label=o[1],o=i;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(i);break}o[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,c])}}}(this,function(e){switch(e.label){case 0:return[4,t.app.apiClient.request({url:"dataSources:get/".concat(t.key),params:{appends:["collections"]}})];case 1:return[2,e.sent().data.data]}})},function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function c(e){o(a,r,i,c,u,"next",e)}function u(e){o(a,r,i,c,u,"throw",e)}c(void 0)})})()}}],i(t.prototype,n),l}(r.DataSource)},573:function(e,t,n){"use strict";n.d(t,{A7:function(){return i},EL:function(){return c},KQ:function(){return a}});var r=n(772),o=n(238),i="data-source-manager";function a(e){var t,n,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return r.i18n.t(e,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,o,i;r=e,o=t,i=n[t],o in r?Object.defineProperty(r,o,{value:i,enumerable:!0,configurable:!0,writable:!0}):r[o]=i})}return e}({},o),n=(n={ns:i},n),Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))}function c(){return(0,o.useTranslation)([i,"client"],{nsMode:"fallback"})}},581:function(e){e.exports=function(e,t){return"undefined"!=typeof __deoptimization_sideEffect__&&__deoptimization_sideEffect__(e,t),t}},482:function(e){"use strict";e.exports=t},948:function(e){"use strict";e.exports=d},964:function(e){"use strict";e.exports=o},632:function(e){"use strict";e.exports=r},563:function(e){"use strict";e.exports=s},505:function(e){"use strict";e.exports=n},229:function(e){"use strict";e.exports=m},875:function(e){"use strict";e.exports=c},772:function(t){"use strict";t.exports=e},465:function(e){"use strict";e.exports=u},584:function(e){"use strict";e.exports=l},721:function(e){"use strict";e.exports=p},202:function(e){"use strict";e.exports=b},467:function(e){"use strict";e.exports=f},156:function(e){"use strict";e.exports=a},238:function(e){"use strict";e.exports=i},128:function(e){"use strict";e.exports=y}},P={};function x(e){var t=P[e];if(void 0!==t)return t.exports;var n=P[e]={exports:{}};return S[e](n,n.exports,x),n.exports}return x.m=S,x.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return x.d(t,{a:t}),t},x.d=function(e,t){for(var n in t)x.o(t,n)&&!x.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},x.f={},x.e=function(e){return Promise.all(Object.keys(x.f).reduce(function(t,n){return x.f[n](e,t),t},[]))},x.u=function(e){return""+({210:"05fd9bbff4351687",481:"730406514d9b8503",518:"93d7762d5a5ead48",542:"0920f4a14af0406f",630:"260ea8a867c3a069",721:"7948d6c08bf3359d",833:"4351378ca49a3620",927:"435a0c316fa76b6f"})[e]+".js"},x.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),x.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},g={},h="@nocobase/plugin-data-source-manager:",x.l=function(e,t,n,r){if(g[e]){g[e].push(t);return}if(void 0!==n){for(var o,i,a=document.getElementsByTagName("script"),c=0;c<a.length;c++){var u=a[c];if(u.getAttribute("src")==e||u.getAttribute("data-webpack")==h+n){o=u;break}}}!o&&(i=!0,(o=document.createElement("script")).charset="utf-8",o.timeout=120,x.nc&&o.setAttribute("nonce",x.nc),o.setAttribute("data-webpack",h+n),o.src=e),g[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=g[e];if(delete g[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},x.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},x.p=(!(v=window.__nocobase_public_path__||"/").endsWith("/")&&(v+="/"),v+"static/plugins/@nocobase/plugin-data-source-manager/dist/client/"),_={909:0},x.f.j=function(e,t){var n=x.o(_,e)?_[e]:void 0;if(0!==n){if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=_[e]=[t,r]});t.push(n[2]=r);var o=x.p+x.u(e),i=Error();x.l(o,function(t){if(x.o(_,e)&&(0!==(n=_[e])&&(_[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}}},w=function(e,t){var n=t[0],r=t[1],o=t[2],i,a,c=0;if(n.some(function(e){return 0!==_[e]})){for(i in r)x.o(r,i)&&(x.m[i]=r[i]);o&&o(x)}for(e&&e(t);c<n.length;c++)a=n[c],x.o(_,a)&&_[a]&&_[a][0](),_[a]=0},(O=self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).forEach(w.bind(null,0)),O.push=w.bind(null,O.push.bind(O)),x("60")}()});
@@ -8,24 +8,24 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.6.0-alpha.3",
11
+ "@nocobase/client": "1.6.0-alpha.31",
12
12
  "react": "18.2.0",
13
- "@nocobase/plugin-acl": "1.6.0-alpha.3",
14
- "@nocobase/utils": "1.6.0-alpha.3",
15
- "@nocobase/server": "1.6.0-alpha.3",
13
+ "@nocobase/plugin-acl": "1.6.0-alpha.31",
14
+ "@nocobase/utils": "1.6.0-alpha.31",
15
+ "@nocobase/server": "1.6.0-alpha.31",
16
+ "@nocobase/data-source-manager": "1.6.0-alpha.31",
16
17
  "lodash": "4.17.21",
17
- "@nocobase/data-source-manager": "1.6.0-alpha.3",
18
- "@ant-design/icons": "5.2.6",
18
+ "@ant-design/icons": "5.6.1",
19
19
  "antd": "5.12.8",
20
- "react-router-dom": "6.21.0",
20
+ "react-router-dom": "6.28.1",
21
21
  "@formily/shared": "2.3.2",
22
22
  "react-i18next": "11.18.6",
23
23
  "@formily/react": "2.3.0",
24
24
  "@emotion/css": "11.13.0",
25
- "@nocobase/database": "1.6.0-alpha.3",
26
- "@nocobase/acl": "1.6.0-alpha.3",
25
+ "@nocobase/database": "1.6.0-alpha.31",
26
+ "@nocobase/acl": "1.6.0-alpha.31",
27
27
  "sequelize": "6.35.2",
28
- "@nocobase/test": "1.6.0-alpha.3",
28
+ "@nocobase/test": "1.6.0-alpha.31",
29
29
  "@formily/antd-v5": "1.1.9",
30
30
  "@formily/core": "2.3.0",
31
31
  "@formily/reactive": "2.3.0",
@@ -0,0 +1,40 @@
1
+ {
2
+ "Data source name": "Nome origine dati",
3
+ "Data source display name": "Nome visualizzato origine dati",
4
+ "Host": "Host",
5
+ "Port": "Porta",
6
+ "Database": "Database",
7
+ "Data source manager": "Gestore origine dati",
8
+ "Data sources": "Origini dati",
9
+ "No external data source plugin installed": "Nessun plugin di origine dati esterna installato",
10
+ "View documentation": "Visualizza documentazione",
11
+ "Test Connection": "Test connessione",
12
+ "Connection successful": "Connessione riuscita",
13
+ "Display name": "Nome visualizzato",
14
+ "Username": "Nome utente",
15
+ "Password": "Password",
16
+ "Type": "Tipo",
17
+ "Description": "Descrizione",
18
+ "Storage": "Archivio",
19
+ "Collections": "Raccolte",
20
+ "Permissions": "Permessi",
21
+ "Allow adding and modifying collection": "Consenti aggiunta e modifica raccolta",
22
+ "Unknown field type": "Tipo di campo sconosciuto",
23
+ "The following field types are not compatible and do not support output and display": "I seguenti tipi di campo non sono compatibili e non supportano l'output e la visualizzazione",
24
+ "Field database type": "Tipo di campo database",
25
+ "Field interface": "Interfaccia utente",
26
+ "Status": "Stato",
27
+ "Loading": "Caricamento",
28
+ "Failed": "Fallito",
29
+ "Loaded": "Caricato",
30
+ "Reloading": "Ricaricamento",
31
+ "Data source synchronization in progress": "Sincronizzazione origine dati in corso",
32
+ "Data source synchronization successful": "Sincronizzazione origine dati riuscita",
33
+ "Filter target key": "Filtra chiave di destinazione",
34
+ "Select field": "Seleziona campo",
35
+ "OK": "OK",
36
+ "Please select a field.": "Seleziona un campo.",
37
+ "Are you sure you want to set the \"{{title}}\" field as a record unique key? This setting cannot be changed after it's been set.": "Sei sicuro di voler impostare il campo \"{{title}}\" come chiave univoca del record? Questa impostazione non può essere modificata.",
38
+ "If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection.": "Se una raccolta è priva di una chiave primaria, è necessario configurare una chiave di record univoca per individuare le righe dei record all'interno di un blocco; la mancata configurazione di ciò impedirà la creazione di blocchi dati per la raccolta.",
39
+ "Filter data based on the specific field, with the requirement that the field value must be unique.": "Filtra i dati in base al campo specifico, con il requisito che il valore del campo deve essere univoco."
40
+ }
@@ -34,6 +34,7 @@ var data_sources_collections_default = (0, import_database.defineCollection)({
34
34
  name: "dataSourcesCollections",
35
35
  model: "DataSourcesCollectionModel",
36
36
  dumpRules: "required",
37
+ migrationRules: ["overwrite", "schema-only"],
37
38
  shared: true,
38
39
  autoGenId: false,
39
40
  timestamps: false,
@@ -34,6 +34,7 @@ var data_sources_fields_default = (0, import_database.defineCollection)({
34
34
  name: "dataSourcesFields",
35
35
  model: "DataSourcesFieldModel",
36
36
  dumpRules: "required",
37
+ migrationRules: ["overwrite", "schema-only"],
37
38
  shared: true,
38
39
  autoGenId: false,
39
40
  timestamps: false,
@@ -32,6 +32,7 @@ module.exports = __toCommonJS(data_sources_roles_resources_actions_exports);
32
32
  var import_database = require("@nocobase/database");
33
33
  var data_sources_roles_resources_actions_default = (0, import_database.defineCollection)({
34
34
  dumpRules: "required",
35
+ migrationRules: ["overwrite", "schema-only"],
35
36
  name: "dataSourcesRolesResourcesActions",
36
37
  model: "DataSourcesRolesResourcesActionModel",
37
38
  fields: [
@@ -32,6 +32,7 @@ module.exports = __toCommonJS(data_sources_roles_resources_scopes_exports);
32
32
  var import_database = require("@nocobase/database");
33
33
  var data_sources_roles_resources_scopes_default = (0, import_database.defineCollection)({
34
34
  dumpRules: "required",
35
+ migrationRules: ["overwrite", "schema-only"],
35
36
  name: "dataSourcesRolesResourcesScopes",
36
37
  fields: [
37
38
  {
@@ -32,6 +32,7 @@ module.exports = __toCommonJS(data_sources_roles_resources_exports);
32
32
  var import_database = require("@nocobase/database");
33
33
  var data_sources_roles_resources_default = (0, import_database.defineCollection)({
34
34
  dumpRules: "required",
35
+ migrationRules: ["overwrite", "schema-only"],
35
36
  name: "dataSourcesRolesResources",
36
37
  model: "DataSourcesRolesResourcesModel",
37
38
  fields: [
@@ -33,6 +33,7 @@ var import_database = require("@nocobase/database");
33
33
  var data_sources_roles_default = (0, import_database.defineCollection)({
34
34
  name: "dataSourcesRoles",
35
35
  dumpRules: "required",
36
+ migrationRules: ["overwrite", "schema-only"],
36
37
  autoGenId: false,
37
38
  timestamps: false,
38
39
  model: "DataSourcesRolesModel",
@@ -36,6 +36,7 @@ var data_sources_default = (0, import_database.defineCollection)({
36
36
  autoGenId: false,
37
37
  shared: true,
38
38
  dumpRules: "required",
39
+ migrationRules: ["overwrite", "schema-only"],
39
40
  fields: [
40
41
  {
41
42
  type: "string",
@@ -6,9 +6,9 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ import { ACL } from '@nocobase/acl';
9
10
  import { Model, Transaction } from '@nocobase/database';
10
11
  import { Application } from '@nocobase/server';
11
- import { ACL } from '@nocobase/acl';
12
12
  export declare class DataSourceModel extends Model {
13
13
  isMainRecord(): boolean;
14
14
  loadIntoACL(options: {
@@ -20,6 +20,7 @@ export declare class DataSourceModel extends Model {
20
20
  app: Application;
21
21
  transaction?: Transaction;
22
22
  loadAtAfterStart?: boolean;
23
+ refresh?: boolean;
23
24
  }): Promise<void>;
24
25
  private loadLocalData;
25
26
  }
@@ -7,9 +7,11 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
+ var __create = Object.create;
10
11
  var __defProp = Object.defineProperty;
11
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
13
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
13
15
  var __hasOwnProp = Object.prototype.hasOwnProperty;
14
16
  var __export = (target, all) => {
15
17
  for (var name in all)
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
23
25
  }
24
26
  return to;
25
27
  };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
26
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
37
  var data_source_exports = {};
28
38
  __export(data_source_exports, {
@@ -31,6 +41,7 @@ __export(data_source_exports, {
31
41
  module.exports = __toCommonJS(data_source_exports);
32
42
  var import_database = require("@nocobase/database");
33
43
  var import_plugin_acl = require("@nocobase/plugin-acl");
44
+ var import_path = __toESM(require("path"));
34
45
  const availableActions = {
35
46
  create: {
36
47
  displayName: '{{t("Add new")}}',
@@ -87,7 +98,7 @@ class DataSourceModel extends import_database.Model {
87
98
  }
88
99
  }
89
100
  async loadIntoApplication(options) {
90
- const { app, loadAtAfterStart } = options;
101
+ const { app, loadAtAfterStart, refresh } = options;
91
102
  const dataSourceKey = this.get("key");
92
103
  const pluginDataSourceManagerServer = app.pm.get("data-source-manager");
93
104
  if (pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] === "loaded") {
@@ -102,7 +113,9 @@ class DataSourceModel extends import_database.Model {
102
113
  ...createOptions,
103
114
  name: dataSourceKey,
104
115
  logger: app.logger.child({ dataSourceKey }),
105
- sqlLogger: app.sqlLogger.child({ dataSourceKey })
116
+ sqlLogger: app.sqlLogger.child({ dataSourceKey }),
117
+ cache: app.cache,
118
+ storagePath: import_path.default.join(process.cwd(), "storage", "cache", "apps", app.name)
106
119
  });
107
120
  dataSource.on("loadingProgress", (progress) => {
108
121
  pluginDataSourceManagerServer.dataSourceLoadingProgress[dataSourceKey] = progress;
@@ -122,7 +135,8 @@ class DataSourceModel extends import_database.Model {
122
135
  dataSource.resourceManager.use(import_plugin_acl.setCurrentRole, { tag: "setCurrentRole", before: "acl", after: "auth" });
123
136
  await this.loadIntoACL({ app, acl, transaction: options.transaction });
124
137
  await app.dataSourceManager.add(dataSource, {
125
- localData: await this.loadLocalData()
138
+ localData: await this.loadLocalData(),
139
+ refresh
126
140
  });
127
141
  } catch (e) {
128
142
  app.logger.error(`load data source failed`, { cause: e });
@@ -14,5 +14,6 @@ type LoadOptions = {
14
14
  export declare class DataSourcesFieldModel extends MagicAttributeModel {
15
15
  load(loadOptions: LoadOptions): void;
16
16
  unload(loadOptions: LoadOptions): void;
17
+ toJSON(): any;
17
18
  }
18
19
  export {};
@@ -7,9 +7,11 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
+ var __create = Object.create;
10
11
  var __defProp = Object.defineProperty;
11
12
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
13
  var __getOwnPropNames = Object.getOwnPropertyNames;
14
+ var __getProtoOf = Object.getPrototypeOf;
13
15
  var __hasOwnProp = Object.prototype.hasOwnProperty;
14
16
  var __export = (target, all) => {
15
17
  for (var name in all)
@@ -23,6 +25,14 @@ var __copyProps = (to, from, except, desc) => {
23
25
  }
24
26
  return to;
25
27
  };
28
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
+ mod
35
+ ));
26
36
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
37
  var data_sources_field_model_exports = {};
28
38
  __export(data_sources_field_model_exports, {
@@ -30,11 +40,12 @@ __export(data_sources_field_model_exports, {
30
40
  });
31
41
  module.exports = __toCommonJS(data_sources_field_model_exports);
32
42
  var import_database = require("@nocobase/database");
43
+ var import_lodash = __toESM(require("lodash"));
33
44
  var import_utils = require("../utils");
34
45
  class DataSourcesFieldModel extends import_database.MagicAttributeModel {
35
46
  load(loadOptions) {
36
47
  const { app } = loadOptions;
37
- const options = this.get();
48
+ const options = this.toJSON();
38
49
  const { collectionName, name, dataSourceKey, field } = options;
39
50
  const dataSource = app.dataSourceManager.dataSources.get(dataSourceKey);
40
51
  const collection = dataSource.collectionManager.getCollection(collectionName);
@@ -52,7 +63,7 @@ class DataSourcesFieldModel extends import_database.MagicAttributeModel {
52
63
  }
53
64
  unload(loadOptions) {
54
65
  const { app } = loadOptions;
55
- const options = this.get();
66
+ const options = this.toJSON();
56
67
  const { collectionName, name, dataSourceKey } = options;
57
68
  const dataSource = app.dataSourceManager.dataSources.get(dataSourceKey);
58
69
  if (!dataSource) {
@@ -64,6 +75,13 @@ class DataSourcesFieldModel extends import_database.MagicAttributeModel {
64
75
  }
65
76
  collection.removeField(name);
66
77
  }
78
+ toJSON() {
79
+ const json = super.toJSON();
80
+ if (json.interface === "unixTimestamp" && json.accuracy) {
81
+ import_lodash.default.set(json, "uiSchema.x-component-props.accuracy", json.accuracy);
82
+ }
83
+ return json;
84
+ }
67
85
  }
68
86
  // Annotate the CommonJS export names for ESM import in node:
69
87
  0 && (module.exports = {
@@ -20,6 +20,7 @@ export declare class PluginDataSourceManagerServer extends Plugin {
20
20
  dataSourceLoadingProgress: {
21
21
  [dataSourceKey: string]: LoadingProgress;
22
22
  };
23
+ renderJsonTemplate(template: any): any;
23
24
  beforeLoad(): Promise<void>;
24
25
  load(): Promise<void>;
25
26
  }
@@ -134,6 +134,9 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
134
134
  }
135
135
  }
136
136
  dataSourceLoadingProgress = {};
137
+ renderJsonTemplate(template) {
138
+ return this.app.environment.renderJsonTemplate(template);
139
+ }
137
140
  async beforeLoad() {
138
141
  this.app.db.registerModels({
139
142
  DataSourcesCollectionModel: import_data_sources_collection_model.DataSourcesCollectionModel,
@@ -178,7 +181,7 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
178
181
  throw new Error(`Data source type "${type}" is not registered`);
179
182
  }
180
183
  try {
181
- await klass.testConnection(dataSourceOptions);
184
+ await klass.testConnection(this.renderJsonTemplate(dataSourceOptions || {}));
182
185
  } catch (error) {
183
186
  throw new Error(`Test connection failed: ${error.message}`);
184
187
  }
@@ -344,7 +347,7 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
344
347
  const { options, type } = values;
345
348
  const klass = ctx.app.dataSourceManager.factory.getClass(type);
346
349
  try {
347
- await klass.testConnection(options);
350
+ await klass.testConnection(self.renderJsonTemplate(options));
348
351
  } catch (error) {
349
352
  throw new Error(`Test connection failed: ${error.message}`);
350
353
  }
@@ -363,7 +366,8 @@ class PluginDataSourceManagerServer extends import_server.Plugin {
363
366
  const currentStatus = plugin.dataSourceStatus[filterByTk];
364
367
  if (canRefreshStatus.includes(currentStatus) && (clientStatus ? clientStatus && canRefreshStatus.includes(clientStatus) : true)) {
365
368
  dataSourceModel.loadIntoApplication({
366
- app: ctx.app
369
+ app: ctx.app,
370
+ refresh: true
367
371
  });
368
372
  ctx.app.syncMessageManager.publish(self.name, {
369
373
  type: "loadDataSource",
@@ -40,11 +40,11 @@ __export(data_sources_collections_exports, {
40
40
  });
41
41
  module.exports = __toCommonJS(data_sources_collections_exports);
42
42
  var import_lodash = __toESM(require("lodash"));
43
+ var import_database = require("@nocobase/database");
43
44
  var data_sources_collections_default = {
44
45
  name: "dataSources.collections",
45
46
  actions: {
46
47
  async list(ctx, next) {
47
- var _a, _b;
48
48
  const params = ctx.action.params;
49
49
  const { associatedIndex: dataSourceKey } = params;
50
50
  const dataSource = ctx.app.dataSourceManager.dataSources.get(dataSourceKey);
@@ -67,13 +67,10 @@ var data_sources_collections_default = {
67
67
  if (!dataSource) {
68
68
  throw new Error(`dataSource ${dataSourceKey} not found`);
69
69
  }
70
- const { paginate, filter } = ctx.action.params;
71
- const filterTitle = (_a = import_lodash.default.get(filter, "$and.0.title.$includes")) == null ? void 0 : _a.toLowerCase();
72
- const filterName = (_b = import_lodash.default.get(filter, "$and.0.name.$includes")) == null ? void 0 : _b.toLowerCase();
70
+ const { paginate, filter = {} } = ctx.action.params;
73
71
  const collections = import_lodash.default.sortBy(
74
72
  dataSource.collectionManager.getCollections().filter((collection) => {
75
- var _a2;
76
- return (!filterTitle || ((_a2 = import_lodash.default.get(collection, "options.title")) == null ? void 0 : _a2.toLowerCase().includes(filterTitle))) && (!filterName || collection.options.name.toLowerCase().includes(filterName));
73
+ return (0, import_database.filterMatch)(collection.options, filter);
77
74
  }),
78
75
  "name"
79
76
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-data-source-manager",
3
- "version": "1.6.0-alpha.3",
3
+ "version": "1.6.0-alpha.31",
4
4
  "main": "dist/server/index.js",
5
5
  "displayName": "Data source manager",
6
6
  "displayName.zh-CN": "数据源管理",
@@ -17,5 +17,5 @@
17
17
  "keywords": [
18
18
  "Data model tools"
19
19
  ],
20
- "gitHead": "205b4aca5556d5af70679fa401394943a9e51670"
20
+ "gitHead": "2f118f0a0691dd51c437f208b1166258a615b6a8"
21
21
  }
@@ -1,10 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- "use strict";(self.webpackChunk_nocobase_plugin_data_source_manager=self.webpackChunk_nocobase_plugin_data_source_manager||[]).push([["833"],{227:function(e,t,n){n.d(t,{E:function(){return s}});var r=n(482),i=n(772),a=n(505),l=n(721),o=n(156),c=n.n(o),u=n(286),s=function(e){var t=(0,i.useCollectionRecordData)()||{},n=(0,i.useCompile)();return(0,a.useField)().editable?c().createElement(i.Input,e):(null==t?void 0:t.filterTargetKey)?n(t.title):c().createElement("div",{style:{display:"inline"}},c().createElement(l.Popover,{trigger:["click"],content:c().createElement(u.L,{size:"small",style:{width:"20em"}})},c().createElement(r.ExclamationCircleTwoTone,{style:{marginRight:"0.3em"},twoToneColor:"#faad14"})),n(t.title))}},648:function(e,t,n){n.d(t,{a:function(){return u}});var r=n(772),i=n(721),a=n(156),l=n.n(a),o=n(128),c=n(286),u=function(e){var t=e.collectionName,n=(0,r.useApp)(),u=(0,o.useParams)().name,s=void 0===u?"main":u,f=(0,a.useMemo)(function(){return n.getCollectionManager(s).getCollection(t)},[n,s,t]);return!(null==f?void 0:f.filterTargetKey)&&l().createElement(i.Alert,{style:{marginBottom:16},type:"warning",message:l().createElement(c.L,null)})}},286:function(e,t,n){n.d(t,{L:function(){return m}});var r=n(772),i=n(721),a=n(156),l=n.n(a),o=n(128),c=n(573),u=n(550);function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function f(e,t,n,r,i,a,l){try{var o=e[a](l),c=o.value}catch(e){n(e);return}o.done?t(c):Promise.resolve(c).then(r,i)}function d(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var a=[],l=!0,o=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){o=!0,r=e}finally{try{!l&&null!=i.return&&i.return()}finally{if(o)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return s(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var m=function(e){var t,n=e.size,s=e.style,m=(0,r.useAPIClient)(),p=(0,o.useParams)().name,y=void 0===p?"main":p,h=(0,r.useCollectionRecordData)(),b=(0,r.useApp)(),g=d((0,a.useState)(),2),v=g[0],w=g[1],x=d((0,a.useState)(),2),E=x[0],S=x[1],C=(0,r.useCompile)(),A=(0,a.useMemo)(function(){return b.getCollectionManager(y).getCollection(h.name)},[b,y,h.name]),I=(0,a.useMemo)(function(){return b.getCollectionManager(y).getCollectionFields(h.name).filter(function(e){if(!e.interface)return!1;var t=b.dataSourceManager.collectionFieldInterfaceManager.getFieldInterface(e.interface);return(null==t?!!void 0:!!t.titleUsable)||!1}).map(function(e){var t;return{label:C(null===(t=e.uiSchema)||void 0===t?void 0:t.title),value:e.name}})},[b,C,y,h.name]),O=(0,r.useResourceActionContext)().refresh,k=(0,a.useContext)(u.I),F=(0,c.EL)().t;return l().createElement("div",{style:function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,i,a;r=e,i=t,a=n[t],i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a})}return e}({},s)},F("If a collection lacks a primary key, you must configure a unique record key to locate row records within a block, failure to configure this will prevent the creation of data blocks for the collection."),"small"===n?l().createElement("br",null):" ",l().createElement(i.Space.Compact,{style:{marginTop:5}},l().createElement(i.Select,{onChange:function(e,t){console.log(e,t),w(e),S(t.map(function(e){return e.label}).join(","))},placeholder:F("Select field"),size:"small",options:I,mode:"multiple",style:{width:"200px"}}),l().createElement(i.Popconfirm,{placement:"bottom",title:l().createElement("div",{style:{width:"15em"}},E?F('Are you sure you want to set the "{{title}}" field as a record unique key? This setting cannot be changed after it\'s been set.',{title:E}):F("Please select a field.")),onConfirm:(t=function(){var e;return function(e,t){var n,r,i,a,l={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(i=(i=l.trys).length>0&&i[i.length-1])&&(6===a[0]||2===a[0])){l=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){l.label=a[1];break}if(6===a[0]&&l.label<i[1]){l.label=i[1],i=a;break}if(i&&l.label<i[2]){l.label=i[2],l.ops.push(a);break}i[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}}(this,function(t){switch(t.label){case 0:if(!v)return[2];if("main"!==y)return[3,2];return[4,m.request({url:"collections:update?filterByTk=".concat(h.name),method:"post",data:{filterTargetKey:v}})];case 1:return t.sent(),[3,4];case 2:return[4,m.request({url:"dataSources/".concat(y,"/collections:update?filterByTk=").concat(h.name),method:"post",data:{filterTargetKey:v}})];case 3:t.sent(),t.label=4;case 4:return null==k||null===(e=k.refresh)||void 0===e||e.call(k),O(),[4,b.dataSourceManager.getDataSource(y).reload()];case 5:return t.sent(),A.setOption("filterTargetKey",v),[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,i){var a=t.apply(e,n);function l(e){f(a,r,i,l,o,"next",e)}function o(e){f(a,r,i,l,o,"throw",e)}l(void 0)})})},l().createElement(i.Button,{type:"primary",size:"small"},F("OK")))))}},550:function(e,t,n){n.d(t,{f:function(){return D},I:function(){return I}});var r=n("964"),i=n("563"),a=n("505"),l=n("772"),o=n("721"),c=n("156"),u=n.n(c),s=n("238"),f=n("648");function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function m(e,t,n,r,i,a,l){try{var o=e[a](l),c=o.value}catch(e){n(e);return}o.done?t(c):Promise.resolve(c).then(r,i)}function p(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function l(e){m(a,r,i,l,o,"next",e)}function o(e){m(a,r,i,l,o,"throw",e)}l(void 0)})}}function y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r,i,a;r=e,i=t,a=n[t],i in r?Object.defineProperty(r,i,{value:a,enumerable:!0,configurable:!0,writable:!0}):r[i]=a})}return e}function h(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n.push.apply(n,r)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,i=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=i){var a=[],l=!0,o=!1;try{for(i=i.call(e);!(l=(n=i.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){o=!0,r=e}finally{try{!l&&null!=i.return&&i.return()}finally{if(o)throw r}}return a}}(e,t)||v(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){return!t&&(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function v(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return d(e,t)}}function w(e,t){var n,r,i,a,l={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:o(0),throw:o(1),return:o(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function o(a){return function(o){return function(a){if(n)throw TypeError("Generator is already executing.");for(;l;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return l.label++,{value:a[1],done:!1};case 5:l.label++,r=a[1],a=[0];continue;case 7:a=l.ops.pop(),l.trys.pop();continue;default:if(!(i=(i=l.trys).length>0&&i[i.length-1])&&(6===a[0]||2===a[0])){l=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){l.label=a[1];break}if(6===a[0]&&l.label<i[1]){l.label=i[1],i=a;break}if(i&&l.label<i[2]){l.label=i[2],l.ops.push(a);break}i[2]&&l.ops.pop(),l.trys.pop();continue}a=t.call(e,l)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,o])}}}function x(){var e=g(["\n .ant-table {\n margin-left: -16px !important;\n }\n"]);return x=function(){return e},e}function E(){var e=g(["\n tr {\n display: flex;\n }\n td,\n th {\n flex: 2.3;\n width: 0;\n &:nth-child(5) {\n flex: 1.2;\n }\n &:last-child {\n flex: 1.5;\n }\n }\n .ant-table-selection-column,\n .ant-table-row-expand-icon-cell {\n flex-basis: 50px !important;\n min-width: 50px;\n flex: 0;\n }\n"]);return E=function(){return e},e}function S(){var e=g(["\n font-weight: 500;\n "]);return S=function(){return e},e}function C(){var e=g(["\n justify-content: flex-end;\n display: flex;\n margin-bottom: 16px;\n "]);return C=function(){return e},e}var A={association:{sourceKey:"name",targetKey:"name"},collection:{name:"fields",fields:[{type:"string",name:"type",interface:"input",uiSchema:{title:'{{ t("Storage type") }}',type:"string","x-component":"Select",enum:[{label:"String",value:"string"}],required:!0}},{type:"string",name:"interface",interface:"input",uiSchema:{title:'{{ t("Field interface") }}',type:"string","x-component":"Select",enum:"{{interfaces}}"}},{type:"string",name:"title",interface:"input",uiSchema:{title:'{{ t("Field display name") }}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{ t("Field name") }}',type:"string","x-component":"Input"}},{type:"string",name:"description",interface:"input",uiSchema:{title:'{{ t("Description") }}',type:"string","x-component":"Input.TextArea"}}]},request:{resource:"collections.fields",action:"list",params:{paginate:!1,filter:{$or:[{"interface.$not":null},{"options.source.$notEmpty":!0}]},sort:["sort"]}}},I=(0,c.createContext)(null),O=function(e){return u().createElement(I.Provider,{value:(0,l.useResourceActionContext)()},u().createElement(l.ResourceActionProvider,A,e.children))},k=(0,r.css)(x()),F=(0,r.css)(E()),P="Default title for each record",T=function(e){var t=(0,l.useCompile)(),n=(0,l.useCollectionManager_deprecated)().getInterface,r=(0,s.useTranslation)().t,i=(0,l.useResourceActionContext)().setState,a=(e.collectionResource||{}).targetKey,f=(0,l.useRecord)(),d=b(u().useState(null),2),m=d[0],g=d[1],v=(0,l.useCollectionManager_deprecated)(),x=v.refreshCM,E=v.isTitleField,S=v.getTemplate,C=f[a],A=f.titleField,O=S(f.template),F=(0,l.useAPIClient)(),T=(0,c.useContext)(I),j=[{dataIndex:["uiSchema","title"],title:r("Field display name"),render:function(e){return u().createElement("div",{style:{marginLeft:7}},t(e))}},{dataIndex:"name",title:r("Field name")},{dataIndex:"interface",title:r("Field interface"),render:function(e){var r;return u().createElement(o.Tag,null,t(null===(r=n(e))||void 0===r?void 0:r.title))}},{dataIndex:"titleField",title:r("Title field"),render:function(t,n){var i,a=(i=p(function(t){var i;return w(this,function(a){switch(a.label){case 0:return g(n),[4,F.request({url:"collections:update?filterByTk=".concat(C),method:"post",data:{titleField:t?n.name:"id"}})];case 1:return a.sent(),null==T||null===(i=T.refresh)||void 0===i||i.call(T),[4,e.refreshAsync()];case 2:return a.sent(),g(null),x(),o.message.success(r("Saved successfully")),[2]}})}),function(e){return i.apply(this,arguments)});return E(n)?u().createElement(o.Tooltip,{title:r(P),placement:"right",overlayInnerStyle:{textAlign:"center"}},u().createElement(o.Switch,{"aria-label":"switch-title-field-".concat(n.name),size:"small",loading:n.name===(null==m?void 0:m.name),checked:n.name===(A||"id"),onChange:a})):null}},{dataIndex:"description",title:r("Descriptio "),render:function(e){return u().createElement(l.Input.ReadPretty,{value:e,ellipsis:!0})}},{dataIndex:"actions",title:r("Actions"),render:function(e,t){var n={confirm:{title:r("Delete record"),content:r("Are you sure you want to delete it?")},useAction:l.useDestroyActionAndRefreshCM,disabled:(0,l.isDeleteButtonDisabled)(t)||(null==O?void 0:O.forbidDeletion),title:r("Delete")};return u().createElement(l.RecordProvider,{record:t,parent:f},u().createElement(o.Space,{size:"middle"},u().createElement(l.EditCollectionField,{role:"button","aria-label":"edit-button-".concat(t.name),type:"primary"}),u().createElement(l.Action.Link,n)))}}];return u().createElement(o.Table,{rowKey:"name",columns:j,showHeader:!1,pagination:!1,dataSource:e.fields,rowSelection:{type:"checkbox",getCheckboxProps:function(e){return{"aria-label":"checkbox-".concat(e.name)}},onChange:function(e){i(function(t){return h(y({},t),{selectedRowKeys:e})})}},className:k})},j=function(e){var t=(0,l.useCompile)(),n=(0,l.useCollectionManager_deprecated)().getInterface,r=(e.collectionResource||{}).targetKey,i=(0,l.useRecord)(),a=b(u().useState(null),2),f=a[0],d=a[1],m=(0,s.useTranslation)().t,y=(0,l.useCollectionManager_deprecated)(),h=y.refreshCM,g=y.isTitleField,v=i[r],x=i.titleField,E=i.name,S=(0,c.useContext)(I),C=(0,l.useAPIClient)(),A=[{dataIndex:["uiSchema","rawTitle"],title:m("Field display name"),render:function(e){return u().createElement("div",{style:{marginLeft:1}},t(e))}},{dataIndex:"name",title:m("Field name")},{dataIndex:"interface",title:m("Field interface"),render:function(e){var r;return u().createElement(o.Tag,null,t(null===(r=n(e))||void 0===r?void 0:r.title))}},{dataIndex:"titleField",title:m("Title field"),render:function(t,n){var r,i=(r=p(function(t){var r;return w(this,function(i){switch(i.label){case 0:return d(n),[4,C.request({url:"collections:update?filterByTk=".concat(v),method:"post",data:{titleField:t?n.name:"id"}})];case 1:return i.sent(),null==S||null===(r=S.refresh)||void 0===r||r.call(S),[4,e.refreshAsync()];case 2:return i.sent(),d(null),h(),o.message.success(m("Saved successfully")),[2]}})}),function(e){return r.apply(this,arguments)});return g(n)?u().createElement(o.Tooltip,{title:m(P),placement:"right",overlayInnerStyle:{textAlign:"center"}},u().createElement(o.Switch,{size:"small",loading:n.name===(null==f?void 0:f.name),checked:n.name===(x||"id"),onChange:i})):null}},{dataIndex:"actions",title:m("Actions"),render:function(e,t){return u().createElement(l.RecordProvider,{record:t,parent:i},u().createElement(o.Space,null,u().createElement(l.OverridingCollectionField,{type:"primary",currentCollection:E}),u().createElement(l.ViewCollectionField,{type:"primary"})))}}];return u().createElement(o.Table,{rowKey:"name",columns:A,showHeader:!1,pagination:!1,dataSource:e.fields.filter(function(e){return e.interface})})},R=function(){var e,t=(0,l.useCompile)(),n=(0,a.useField)(),m=(0,l.useRecord)(),p=m.name,b=m.template,g=((0,l.useCurrentAppInfo)()||{data:{database:{}}}).data.database,w=(0,l.useCollectionManager_deprecated)(),x=w.getInterface,E=w.getInheritCollections,A=w.getCollection,I=w.getTemplate,O=(0,c.useMemo)(function(){return(0,i.createForm)()},[]),k=(0,l.useAttach)(O.createArrayField(h(y({},n.props),{basePath:""}))),P=(0,s.useTranslation)().t,R=(0,l.useResourceContext)(),D=(0,c.useContext)(l.ResourceActionContext),M=D.refreshAsync,K=D.data,_=I(b),q=E(p),z=[{dataIndex:"title",title:P("Field display name"),render:function(e){return u().createElement("div",{className:(0,r.css)(S())},e)}},{dataIndex:"name",title:P("Field name")},{dataIndex:"interface",title:P("Field interface")},{dataIndex:"titleField",title:P("Title field")},{dataIndex:"description",title:P("Description")},{dataIndex:"actions",title:P("Actions")}],B=(null==K?void 0:K.data)||[],L={pf:[],association:[],general:[],system:[]};B.forEach(function(e){if(e.primaryKey||e.isForeignKey)L.pf.push(e);else if(e.interface){var t=x(e.interface);(null==t?void 0:t.group)==="systemInfo"?L.system.push(e):(null==t?void 0:t.group)==="relation"?L.association.push(e):L.general.push(e)}});var N=[{key:"pf",title:P("PK & FK fields"),fields:L.pf},{key:"association",title:P("Association fields"),fields:L.association},{key:"general",title:P("General fields"),fields:L.general},{key:"system",title:P("System fields"),fields:L.system}];N.push.apply(N,function(e){if(Array.isArray(e))return d(e)}(e=q.map(function(e){var n=A(e);if(!!n)return{key:e,title:"".concat(P("Inherited fields")," - ")+t(null==n?void 0:n.title),inherit:!0,fields:(null==n?void 0:n.fields)||[]}}).filter(Boolean))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||v(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());var $=(0,c.useMemo)(function(){return{useAction:function(){return(0,l.useBulkDestroyActionAndRefreshCM)(!0)},title:P("Delete"),icon:"DeleteOutlined",disabled:null==_?void 0:_.forbidDeletion,confirm:{title:P("Delete record"),content:P("Are you sure you want to delete it?")}}},[P]);return u().createElement(a.FormContext.Provider,{value:O},u().createElement(a.FieldContext.Provider,{value:k},u().createElement(f.a,{collectionName:p}),u().createElement(o.Space,{align:"end",className:(0,r.css)(C())},u().createElement(l.Action,$),u().createElement(l.SyncFieldsAction,{type:"primary"}),u().createElement(l.SyncSQLFieldsAction,{refreshCMList:M}),u().createElement(l.SchemaComponent,{schema:{type:"object",properties:y({},_.configureActions)}}),u().createElement(l.AddCollectionField,{type:"primary",database:g})),u().createElement(o.Table,{rowKey:"key",columns:z,dataSource:N.filter(function(e){return e.fields.length}),pagination:!1,className:F,expandable:{defaultExpandAllRows:!0,defaultExpandedRowKeys:N.map(function(e){return e.key}),expandedRowRender:function(e){return e.inherit?u().createElement(j,{fields:e.fields,collectionResource:R,refreshAsync:M}):u().createElement(T,{fields:e.fields,collectionResource:R,refreshAsync:M})}}})))},D=function(){return u().createElement(O,null,u().createElement(R,null))}}}]);