plugin-data-source-postgres 0.0.0-stage → 2.0.0

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.
Files changed (63) hide show
  1. package/README.md +9 -3
  2. package/client-v2.js +1 -0
  3. package/client.js +1 -0
  4. package/dist/client/index.js +10 -0
  5. package/dist/client-v2/985.34da95acdf7743ab.js +10 -0
  6. package/dist/client-v2/index.js +10 -0
  7. package/dist/constants.js +45 -0
  8. package/dist/externalVersion.js +28 -0
  9. package/dist/locale/en-US.json +141 -0
  10. package/dist/locale/zh-CN.json +141 -0
  11. package/dist/server/collections/adjacency-list-repository.js +340 -0
  12. package/dist/server/collections/index.js +45 -0
  13. package/dist/server/collections/sql-collection.js +84 -0
  14. package/dist/server/collections/sql-model.js +147 -0
  15. package/dist/server/collections/tree-collection.js +118 -0
  16. package/dist/server/hooks/field-hooks.js +392 -0
  17. package/dist/server/index.js +38 -0
  18. package/dist/server/plugin.js +690 -0
  19. package/dist/server/postgres-collection-manager.js +701 -0
  20. package/dist/server/postgres-datasource.js +327 -0
  21. package/dist/server/utils/sql-validator.js +203 -0
  22. package/dist/server/utils/validation-error.js +59 -0
  23. package/package.json +51 -4
  24. package/server.js +1 -0
  25. package/src/client/AddCollectionAction.tsx +307 -0
  26. package/src/client/ConfigurationForm.tsx +203 -0
  27. package/src/client/PostgresCollectionTemplate.tsx +109 -0
  28. package/src/client/__tests__/client-v1.test.tsx +265 -0
  29. package/src/client/collection-templates/CalendarCollectionTemplate.tsx +141 -0
  30. package/src/client/collection-templates/FileCollectionTemplate.tsx +154 -0
  31. package/src/client/collection-templates/SQLCollectionTemplate.tsx +184 -0
  32. package/src/client/collection-templates/TreeCollectionTemplate.tsx +136 -0
  33. package/src/client/collection-templates/base-template-helper.ts +62 -0
  34. package/src/client/collection-templates/field-interfaces-config.ts +73 -0
  35. package/src/client/collection-templates/index.ts +19 -0
  36. package/src/client/index.tsx +69 -0
  37. package/src/client-v2/PostgresAddCollection.tsx +422 -0
  38. package/src/client-v2/PostgresConfigForm.tsx +178 -0
  39. package/src/client-v2/PostgresDeleteCollection.tsx +83 -0
  40. package/src/client-v2/__tests__/plugin.test.tsx +372 -0
  41. package/src/client-v2/collection-options.ts +22 -0
  42. package/src/client-v2/index.tsx +10 -0
  43. package/src/client-v2/plugin.tsx +71 -0
  44. package/src/constants.ts +20 -0
  45. package/src/locale/en-US.json +141 -0
  46. package/src/locale/zh-CN.json +141 -0
  47. package/src/server/__tests__/field-hooks.test.ts +357 -0
  48. package/src/server/__tests__/postgres-data-source.integration.test.ts +543 -0
  49. package/src/server/__tests__/postgres-datasource.unit.test.ts +1538 -0
  50. package/src/server/__tests__/sql-model.test.ts +115 -0
  51. package/src/server/__tests__/sql-validator.test.ts +119 -0
  52. package/src/server/collections/adjacency-list-repository.ts +378 -0
  53. package/src/server/collections/index.ts +19 -0
  54. package/src/server/collections/sql-collection.ts +66 -0
  55. package/src/server/collections/sql-model.ts +158 -0
  56. package/src/server/collections/tree-collection.ts +102 -0
  57. package/src/server/hooks/field-hooks.ts +514 -0
  58. package/src/server/index.ts +13 -0
  59. package/src/server/plugin.ts +764 -0
  60. package/src/server/postgres-collection-manager.ts +827 -0
  61. package/src/server/postgres-datasource.ts +365 -0
  62. package/src/server/utils/sql-validator.ts +203 -0
  63. package/src/server/utils/validation-error.ts +38 -0
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # External PostgreSQL data source
2
+
3
+ Version 2.0.0 targets NocoBase 2.2.x and provides configuration for both the v1 and v2 clients. Enable the Data Source Manager and this plugin, then add an external PostgreSQL connection in Data Source Manager.
4
+
5
+ The connection form accepts a PostgreSQL schema and can load all collections or selected tables and views. Loading a table or view registers its schema for use in NocoBase without changing the PostgreSQL object. Existing datasource configurations keep the `postgres-external` type.
6
+
7
+ When SSL is enabled, the connection verifies the PostgreSQL server certificate. Supply a CA certificate in PEM format when the server certificate uses a private CA.
8
+
9
+ Deleting a collection through the plugin deletes the corresponding PostgreSQL table or view. The cascade option defaults to off, so PostgreSQL rejects deletion when dependent objects exist. Selecting cascade also drops dependent objects. SQL collections and imported views are read-only for record operations.
package/client-v2.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client-v2/index.js');
package/client.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./dist/client');
@@ -0,0 +1,10 @@
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
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("lodash"),require("react-router-dom"),require("@formily/antd-v5"),require("@nocobase/plugin-data-source-manager/client"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons")):"function"==typeof define&&define.amd?define("plugin-data-source-postgres",["lodash","react-router-dom","@formily/antd-v5","@nocobase/plugin-data-source-manager/client","react","antd","@nocobase/client","@formily/react","@ant-design/icons"],t):"object"==typeof exports?exports["plugin-data-source-postgres"]=t(require("lodash"),require("react-router-dom"),require("@formily/antd-v5"),require("@nocobase/plugin-data-source-manager/client"),require("react"),require("antd"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons")):e["plugin-data-source-postgres"]=t(e.lodash,e["react-router-dom"],e["@formily/antd-v5"],e["@nocobase/plugin-data-source-manager/client"],e.react,e.antd,e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"])}(self,function(e,t,n,r,o,a,i,l,s){return function(){"use strict";var c={375:function(e){e.exports=s},418:function(e){e.exports=n},230:function(e){e.exports=l},342:function(e){e.exports=i},699:function(e){e.exports=r},59:function(e){e.exports=a},773:function(t){t.exports=e},155:function(e){e.exports=o},442:function(e){e.exports=t}},u={};function d(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return c[e](n,n.exports,d),n.exports}d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,{a:t}),t},d.d=function(e,t){for(var n in t)d.o(t,n)&&!d.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},d.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.g.importScripts&&(p=d.g.location+"");var p,m=d.g.document;if(!p&&m&&(m.currentScript&&"SCRIPT"===m.currentScript.tagName.toUpperCase()&&(p=m.currentScript.src),!p)){var f=m.getElementsByTagName("script");if(f.length)for(var y=f.length-1;y>-1&&(!p||!/^http(s?):/.test(p));)p=f[y--].src}if(!p)throw Error("Automatic publicPath is not supported in this browser");d.p=p.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/");var b={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-data-source-postgres/dist/client/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-data-source-postgres/dist/client/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",a="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var i=window.location.pathname||"/",l=i.indexOf(a);e=l>=0?i.slice(0,l+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-data-source-postgres/dist/client/"}d.p=e}(),!function(){d.r(b),d.d(b,{PluginDataSourcePostgresClient:function(){return ep},default:function(){return em}});var e=d(375),t=d(342),n=d(699),r=d.n(n),o=d(418),a=d(230),i=d(155),l=d.n(i),s="postgres-external",c="plugin-data-source-postgres",u=function(e){return"{{t(".concat(JSON.stringify(e),', { ns: "').concat(c,'" })}}')},p=function(e){var n=e.from,r=(0,a.useForm)();(0,i.useEffect)(function(){var e,t=(null==r||null==(e=r.values)?void 0:e.options)||{},o="boolean"==typeof t.addAllCollections?t.addAllCollections:!1!==t.autoDiscover;t.addAllCollections!==o&&r.setValuesIn("options.addAllCollections",o),t.autoDiscover!==o&&r.setValuesIn("options.autoDiscover",o),"create"!==n&&(Array.isArray(t.selectedCollections)&&!Array.isArray(r.values.collections)&&r.setValuesIn("collections",t.selectedCollections.filter(function(e){return"string"==typeof e&&e.length>0}).map(function(e){return{name:e,selected:!0}})),"edit"!==n&&o||r.setValuesIn("__postgresPreserveSelection",!0))},[r,n]);var s={type:"object",properties:{displayName:{type:"string",title:u("Display Name"),"x-decorator":"FormItem","x-component":"Input","x-decorator-props":{tooltip:u("The connection name to display in NocoBase")},required:!0},options:{type:"object",properties:{tabs:{type:"void","x-component":"FormTab","x-component-props":{},properties:{connection:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:u("Connection Settings")},properties:{host:{type:"string",title:u("Host"),"x-decorator":"FormItem","x-component":"Input","x-decorator-props":{tooltip:u("PostgreSQL server hostname or IP address")},default:"localhost",required:!0},port:{type:"number",title:u("Port"),"x-decorator":"FormItem","x-component":"InputNumber","x-decorator-props":{tooltip:u("PostgreSQL server port number")},"x-component-props":{min:1,max:65535,style:{width:"100%"}},default:5432,required:!0},database:{type:"string",title:u("Database"),"x-decorator":"FormItem","x-component":"Input","x-decorator-props":{tooltip:u("Name of the PostgreSQL database")},required:!0},username:{type:"string",title:u("Username"),"x-decorator":"FormItem","x-component":"Input","x-decorator-props":{tooltip:u("Database username for authentication")},required:!0},password:{type:"string",title:u("Password"),"x-decorator":"FormItem","x-component":"Password","x-decorator-props":{tooltip:u("Database password for authentication")}}}},advanced:{type:"void","x-component":"FormTab.TabPane","x-component-props":{tab:u("Advanced Settings")},properties:{schema:{type:"string",title:u("Schema"),"x-decorator":"FormItem","x-component":"Input","x-decorator-props":{tooltip:u("PostgreSQL schema name, defaults to public")},default:"public"},ssl:{type:"boolean",title:u("Use SSL"),"x-decorator":"FormItem","x-component":"Checkbox","x-decorator-props":{tooltip:u("Enable SSL/TLS connection")},default:!1},sslCa:{type:"string",title:u("CA certificate (PEM)"),"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{rows:4}},addAllCollections:{type:"boolean",title:u("Auto Discover Tables"),"x-decorator":"FormItem","x-component":"Checkbox","x-decorator-props":{tooltip:u("Automatically discover tables from the database")},"x-reactions":{target:"options.autoDiscover",fulfill:{state:{value:"{{$self.value}}"}}},default:!0},autoDiscover:{type:"boolean","x-hidden":!0,default:!0}}}}}}}}};return l().createElement(t.SchemaComponent,{schema:s,components:{FormTab:o.FormTab}})},m={include:["input","textarea","phone","email","url","integer","number","percent","currency","password","color","icon","checkbox","select","multipleSelect","radio","checkboxGroup","markdown","richText","datetime","datetimeNoTz","date","time","unixTimestamp","json","uuid","m2o","obo","oho","o2m","m2m","m2m_array","id","createdAt","updatedAt","sort"]},f=function(e){return"{{t(".concat(JSON.stringify(e),', { ns: "').concat(c,'" })}}')},y={include:["input","textarea","email","url","phone","integer","number","percent","currency","password","color","icon","checkbox","select","radio","datetime","datetimeNoTz","date","time","unixTimestamp","json","uuid","richText","markdown","attachment","id","createdAt","updatedAt"]};function g(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function h(e){return(h=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 S(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(S=function(){return!!e})()}var x=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(e){var t,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=[e],r=h(r),g(t=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,S()?Reflect.construct(r,o||[],h(this).constructor):r.apply(this,o)),"name","general"),g(t,"title",f("General collection")),g(t,"order",1),g(t,"color","blue"),g(t,"supportDataSourceType",["postgres-external"]),t.availableFieldInterfaces=m,t.configurableProperties=t._getConfigurableProperties(),t.default=t._getDefault(),t}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&v(n,e),t=[{key:"_getConfigurableProperties",value:function(){return{title:{type:"string",title:f("Collection display name"),required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:f("Collection name"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-disabled":!1,"x-read-only":!1,"x-component-props":{disabled:!1,placeholder:f("Please input collection name")},"x-validator":[{pattern:/^[a-zA-Z][a-zA-Z0-9_]*$/,message:f("Must start with a letter and can only contain letters, numbers, and underscores")}],description:f("Use letters, numbers and underscores, must start with a letter. Example: users, products, orders")},description:{type:"string",title:f("Description"),"x-decorator":"FormItem","x-component":"Input.TextArea"},fields:{type:"array",title:f("Preset fields"),description:f("Select default fields to include in this collection"),"x-decorator":"FormItem","x-component":"Checkbox.Group","x-component-props":{options:[{label:f("ID - Primary key (auto-increment)"),value:"id"},{label:f("Created At - Timestamp when record is created"),value:"createdAt"},{label:f("Updated At - Timestamp when record is updated"),value:"updatedAt"}]},default:["id","createdAt","updatedAt"]}}}},{key:"_getDefault",value:function(){return{fields:["id","createdAt","updatedAt"],autoGenId:!0,createdBy:!1,updatedBy:!1,createdAt:!0,updatedAt:!0,sortable:!1,logging:!1}}}],function(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)}}(n.prototype,t),n}(t.CollectionTemplate);function C(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,t){return(P=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function L(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(L=function(){return!!e})()}var I=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(e){var t,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=[e],r=w(r),C(t=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,L()?Reflect.construct(r,o||[],w(this).constructor):r.apply(this,o)),"name","calendar"),C(t,"title",f("Calendar collection")),C(t,"order",2),C(t,"color","orange"),C(t,"supportDataSourceType",["postgres-external"]),C(t,"description",f("Collections used for calendar events, with start and end date fields")),t.availableFieldInterfaces=m,t.configurableProperties=t._getConfigurableProperties(),t.default=t._getDefault(),t}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&P(n,e),t=[{key:"_getConfigurableProperties",value:function(){return{title:{type:"string",title:f("Collection display name"),required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:f("Collection name"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-disabled":!1,"x-read-only":!1,"x-component-props":{disabled:!1,placeholder:f("Please input collection name")},"x-validator":[{pattern:/^[a-zA-Z][a-zA-Z0-9_]*$/,message:f("Must start with a letter and can only contain letters, numbers, and underscores")}],description:f("Use letters, numbers and underscores, must start with a letter. Example: events, meetings, tasks")},description:{type:"string",title:f("Description"),"x-decorator":"FormItem","x-component":"Input.TextArea"}}}},{key:"_getDefault",value:function(){return{fields:[{name:"id",type:"bigInt",interface:"id",primaryKey:!0,autoIncrement:!0,uiSchema:{type:"number",title:f("ID"),"x-component":"InputNumber","x-read-pretty":!0}},{name:"title",type:"string",interface:"input",uiSchema:{type:"string",title:f("Title"),"x-component":"Input",required:!0}},{name:"start",type:"date",interface:"datetime",uiSchema:{type:"string",title:f("Start date"),"x-component":"DatePicker","x-component-props":{showTime:!0},required:!0}},{name:"end",type:"date",interface:"datetime",uiSchema:{type:"string",title:f("End date"),"x-component":"DatePicker","x-component-props":{showTime:!0}}}],autoGenId:!0,createdBy:!1,updatedBy:!1,createdAt:!0,updatedAt:!0,sortable:!0,logging:!1}}}],function(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)}}(n.prototype,t),n}(t.CollectionTemplate);function A(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function T(e){return(T=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function O(e,t){return(O=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(q=function(){return!!e})()}var E=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(e){var t,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=[e],r=T(r),A(t=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,q()?Reflect.construct(r,o||[],T(this).constructor):r.apply(this,o)),"name","tree"),A(t,"title",f("Tree collection")),A(t,"order",3),A(t,"color","green"),A(t,"supportDataSourceType",["postgres-external"]),A(t,"description",f("Collections organized in parent-child tree structure, like categories, departments, etc")),t.availableFieldInterfaces=m,t.configurableProperties=t._getConfigurableProperties(),t.default=t._getDefault(),t}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&O(n,e),t=[{key:"_getConfigurableProperties",value:function(){return{title:{type:"string",title:f("Collection display name"),required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:f("Collection name"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-disabled":!1,"x-read-only":!1,"x-component-props":{disabled:!1,placeholder:f("Please input collection name")},"x-validator":[{pattern:/^[a-zA-Z][a-zA-Z0-9_]*$/,message:f("Must start with a letter and can only contain letters, numbers, and underscores")}],description:f("Use letters, numbers and underscores, must start with a letter. Example: categories, departments")},description:{type:"string",title:f("Description"),"x-decorator":"FormItem","x-component":"Input.TextArea"}}}},{key:"_getDefault",value:function(){return{fields:[{name:"id",type:"bigInt",interface:"id",primaryKey:!0,autoIncrement:!0,uiSchema:{type:"number",title:f("ID"),"x-component":"InputNumber","x-read-pretty":!0}},{name:"name",type:"string",interface:"input",uiSchema:{type:"string",title:f("Name"),"x-component":"Input",required:!0}},{name:"parentId",type:"bigInt",interface:"integer"},{name:"parent",type:"belongsTo",interface:"m2o",foreignKey:"parentId",targetKey:"id",treeParent:!0},{name:"children",type:"hasMany",interface:"o2m",foreignKey:"parentId",sourceKey:"id",treeChildren:!0}],tree:"parentId",autoGenId:!0,createdBy:!1,updatedBy:!1,createdAt:!0,updatedAt:!0,sortable:!0,logging:!1}}}],function(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)}}(n.prototype,t),n}(t.CollectionTemplate);function Q(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function F(e){return(F=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function D(e,t){return(D=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(_=function(){return!!e})()}var k=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(e){var t,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=[e],r=F(r),Q(t=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,_()?Reflect.construct(r,o||[],F(this).constructor):r.apply(this,o)),"name","file"),Q(t,"title",f("File collection")),Q(t,"order",4),Q(t,"color","purple"),Q(t,"supportDataSourceType",["postgres-external"]),Q(t,"description",f("Collections for storing file metadata and attachments")),t.availableFieldInterfaces=m,t.configurableProperties=t._getConfigurableProperties(),t.default=t._getDefault(),t}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&D(n,e),t=[{key:"_getConfigurableProperties",value:function(){return{title:{type:"string",title:f("Collection display name"),required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:f("Collection name"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-disabled":!1,"x-read-only":!1,"x-component-props":{disabled:!1,placeholder:f("Please input collection name")},"x-validator":[{pattern:/^[a-zA-Z][a-zA-Z0-9_]*$/,message:f("Must start with a letter and can only contain letters, numbers, and underscores")}],description:f("Use letters, numbers and underscores, must start with a letter. Example: documents, images, attachments")},description:{type:"string",title:f("Description"),"x-decorator":"FormItem","x-component":"Input.TextArea"}}}},{key:"_getDefault",value:function(){return{fields:[{name:"id",type:"bigInt",interface:"id",primaryKey:!0,autoIncrement:!0,uiSchema:{type:"number",title:f("ID"),"x-component":"InputNumber","x-read-pretty":!0}},{name:"filename",type:"string",interface:"input",uiSchema:{type:"string",title:f("Filename"),"x-component":"Input",required:!0}},{name:"title",type:"string",interface:"input",uiSchema:{type:"string",title:f("Title"),"x-component":"Input"}},{name:"url",type:"string",interface:"url",uiSchema:{type:"string",title:f("URL"),"x-component":"Input.URL"}},{name:"mimetype",type:"string",interface:"input",uiSchema:{type:"string",title:f("MIME type"),"x-component":"Input"}},{name:"size",type:"bigInt",interface:"integer",uiSchema:{type:"number",title:f("File size"),"x-component":"InputNumber"}}],autoGenId:!0,createdBy:!1,updatedBy:!1,createdAt:!0,updatedAt:!0,sortable:!1,logging:!1}}}],function(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)}}(n.prototype,t),n}(t.CollectionTemplate);function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(e){return(U=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function M(e,t){return(M=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function R(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(R=function(){return!!e})()}var B=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(e){var t,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=[e],r=U(r),j(t=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,R()?Reflect.construct(r,o||[],U(this).constructor):r.apply(this,o)),"name","sql"),j(t,"title",f("SQL collection")),j(t,"order",5),j(t,"color","cyan"),j(t,"supportDataSourceType",["postgres-external"]),j(t,"description",f("Collections created from custom SQL queries, read-only by default")),t.availableFieldInterfaces=y,t.configurableProperties=t._getConfigurableProperties(),t.default=t._getDefault(),t}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&M(n,e),t=[{key:"translate",value:function(e){var t,n,r,o=this.collectionTemplateManager;return(null==o||null==(r=o.dataSourceManager)||null==(n=r.app)||null==(t=n.i18n)?void 0:t.t(e,{ns:c}))||e}},{key:"_getConfigurableProperties",value:function(){var e=this;return{title:{type:"string",title:f("Collection display name"),required:!0,"x-decorator":"FormItem","x-component":"Input"},name:{type:"string",title:f("Collection name"),required:!0,"x-decorator":"FormItem","x-component":"Input","x-disabled":!1,"x-read-only":!1,"x-component-props":{disabled:!1,placeholder:f("Please input collection name")},"x-validator":[{pattern:/^[a-zA-Z][a-zA-Z0-9_]*$/,message:f("Must start with a letter and can only contain letters, numbers, and underscores")}],description:f("Use letters, numbers and underscores, must start with a letter. Example: analytics, reports, queries")},sql:{type:"string",title:f("SQL query"),required:!0,"x-decorator":"FormItem","x-component":"Input.TextArea","x-component-props":{rows:10,placeholder:f("SELECT * FROM your_table WHERE ...")},description:f("Custom SQL query to retrieve data. Must be a SELECT statement. The collection will be read-only.")},sqlFields:{type:"array",title:f("Query columns"),"x-decorator":"FormItem","x-component":"ArrayItems","x-validator":function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(!Array.isArray(t)||0===t.length)return e.translate("Add at least one query column");var n=t.map(function(e){var t;return null==e||null==(t=e.name)?void 0:t.trim()}).filter(Boolean);return n.length!==t.length?e.translate("Column name is required"):new Set(n).size!==n.length?e.translate("Column names must be unique"):""},items:{type:"object","x-component":"Space",properties:{name:{type:"string",required:!0,"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:f("Column name")}},type:{type:"string",required:!0,default:"string","x-decorator":"FormItem","x-component":"Select","x-component-props":{style:{width:150}},enum:[{value:"string",label:f("Text")},{value:"text",label:f("Long text")},{value:"integer",label:f("Integer")},{value:"bigInt",label:f("Big integer")},{value:"decimal",label:f("Decimal")},{value:"boolean",label:f("Boolean")},{value:"date",label:f("Date and time")},{value:"json",label:f("JSON")},{value:"uuid",label:f("UUID")}]},remove:{type:"void","x-decorator":"FormItem","x-component":"ArrayItems.Remove"}}},properties:{addition:{type:"void",title:f("Add query column"),"x-component":"ArrayItems.Addition","x-component-props":{defaultValue:{name:"",type:"string"}}}}},description:{type:"string",title:f("Description"),"x-decorator":"FormItem","x-component":"Input.TextArea"}}}},{key:"_getDefault",value:function(){return{fields:[],sqlFields:[{name:"",type:"string"}],autoGenId:!1,createdBy:!1,updatedBy:!1,createdAt:!1,updatedAt:!1,sortable:!1,logging:!1}}}],function(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)}}(n.prototype,t),n}(t.CollectionTemplate),N=d(773),z=d(442),$=d(59);function G(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 H(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,o)}function J(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function K(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){J(e,t,n[t])})}return e}function Z(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function W(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],i=!0,l=!1;try{for(o=o.call(e);!(i=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){l=!0,r=e}finally{try{i||null==o.return||o.return()}finally{if(l)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return G(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 G(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 V={string:"input",text:"textarea",integer:"integer",bigInt:"integer",decimal:"number",boolean:"checkbox",date:"datetime",json:"json",uuid:"uuid"},X=function(e,n){if(e){var r=(0,N.cloneDeep)(e.configurableProperties||{});if(r.name){r.name["x-disabled"]=!1,r.name["x-read-only"]=!1;var o=r.name["x-component-props"]||{};r.name["x-component-props"]=Z(K({},o),{disabled:!1,readOnly:!1,placeholder:"t_".concat((0,N.uniqueId)())})}var a=K({template:e.name,category:n||null},(0,N.cloneDeep)(e.default||{}));return{type:"object",properties:J({},(0,N.uniqueId)(),{type:"void","x-component":"Action.Drawer","x-component-props":{getContainer:"{{ getContainer }}"},"x-decorator":"Form","x-decorator-props":{useValues:function(e){return(0,t.useRequest)(function(){return Promise.resolve({data:a})},e)}},title:f("Create collection"),properties:Z(K({summary:{type:"void","x-component":"TemplateSummay","x-component-props":{schemaKey:e.name}}},r),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{action1:{title:f("Cancel"),"x-component":"Action","x-component-props":{useAction:"{{ useCancelAction }}"}},action2:{title:f("Submit"),"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ useCreatePostgresCollection }}"}}}}})})}}},Y=function(){var e=(0,a.useForm)(),n=(0,t.useCollectionManager_deprecated)().refreshCM,r=(0,t.useResourceActionContext)(),o=(0,t.useActionContext)(),i=(0,z.useParams)().name,l=(0,t.useAPIClient)(),s=(0,t.useDataSourceManager)(),c=(0,a.useField)();return{run:function(){var t;return(t=function(){var t,a,u,d,p,m;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(f){switch(f.label){case 0:c.data=c.data||{},c.data.loading=!0,f.label=1;case 1:return f.trys.push([1,9,10,11]),[4,e.submit()];case 2:return f.sent(),"sql"===(a=(0,N.cloneDeep)(e.values)).template&&Array.isArray(a.sqlFields)&&(a.fields=a.sqlFields.filter(function(e){var t;return!!(null==e||null==(t=e.name)?void 0:t.trim())}).map(function(e){var t=e.name,n=e.type,r=n&&n in V?n:"string";return{name:t.trim(),type:r,interface:V[r]}}),delete a.sqlFields),"general"===a.template&&Array.isArray(a.fields)&&(u=new Set(a.fields.map(function(e){return"string"==typeof e?e:null==e?void 0:e.name})),a.autoGenId=u.has("id"),a.createdAt=u.has("createdAt"),a.updatedAt=u.has("updatedAt")),"tree"===a.template&&Array.isArray(a.fields)&&"string"==typeof a.name&&(a.fields=a.fields.map(function(e){return(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&null!==e&&("belongsTo"===e.type||"hasMany"===e.type)?e.target?e:Z(K({},e),{target:a.name}):e})),[4,l.request({url:"dataSources/".concat(encodeURIComponent(i||""),"/collections:create"),method:"post",data:K({logging:!0},a)})];case 3:return f.sent(),o.setVisible(!1),[4,e.reset()];case 4:if(f.sent(),!(d=s.getDataSource(i)))return[3,6];return[4,d.reload()];case 5:f.sent(),f.label=6;case 6:return[4,n()];case 7:return f.sent(),[4,null==r||null==(t=r.refresh)?void 0:t.call(r)];case 8:return f.sent(),[3,11];case 9:var y,b;return y=p=f.sent(),m=(null!=(b=Error)&&"u">typeof Symbol&&b[Symbol.hasInstance]?!!b[Symbol.hasInstance](y):y instanceof b)?p.message:String(p||"Failed to create collection"),$.message.error(m),[3,11];case 10:return c.data.loading=!1,[7];case 11:return[2]}})},function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(e){H(a,r,o,i,l,"next",e)}function l(e){H(a,r,o,i,l,"throw",e)}i(void 0)})})()}}},ee=function(n){var r=n.scope,a=n.getContainer,s=n.item,c=n.children,u=n.trigger,d=(0,t.useDataSourceManager)(),p=W((0,i.useState)(!1),2),m=p[0],y=p[1],b=W((0,i.useState)({}),2),g=b[0],h=b[1],v=(0,t.useCompile)(),S=(0,i.useMemo)(function(){var e=null==d?void 0:d.collectionTemplateManager;return[new x(e),new I(e),new E(e),new k(e),new B(e)]},[d]),C=(0,i.useMemo)(function(){return S.map(function(e){return{label:v(e.title),key:e.name}})},[S,v]);return l().createElement(t.RecordProvider,{record:s},l().createElement(t.ActionContextProvider,{value:{visible:m,setVisible:y}},l().createElement($.Dropdown,{trigger:u,menu:{onClick:function(e){var t=X(S.find(function(t){return t.name===e.key}),(null==s?void 0:s.key)||(null==s?void 0:s.name)||null);t&&(h(t),y(!0))},items:C}},c||l().createElement($.Button,{icon:l().createElement(e.PlusOutlined,null),type:n.type},v(f("Create collection"))," ",l().createElement(e.DownOutlined,null))),l().createElement(t.SchemaComponent,{schema:g,components:{ArrayItems:o.ArrayItems,Space:o.Space},scope:K({getContainer:a,useCancelAction:t.useCancelAction,useCreatePostgresCollection:Y},r)})))},et=function(e){var n=(0,t.useRecord)();return l().createElement(ee,K({item:n},e))},en=JSON.parse('{"External PostgreSQL Database":"External PostgreSQL Database","Display Name":"Display Name","Host":"Host","Port":"Port","Database":"Database","Username":"Username","Password":"Password","Schema":"Schema","PostgreSQL schema name, defaults to public":"PostgreSQL schema name, defaults to public","Use SSL":"Use SSL","Enable SSL/TLS connection":"Enable SSL/TLS connection","Connection Settings":"Connection Settings","Advanced Settings":"Advanced Settings","Auto Discover Tables":"Auto Discover Tables","Automatically discover tables from the database":"Automatically discover tables from the database","The connection name to display in NocoBase":"The connection name to display in NocoBase","PostgreSQL server hostname or IP address":"PostgreSQL server hostname or IP address","PostgreSQL server port number":"PostgreSQL server port number","Name of the PostgreSQL database":"Name of the PostgreSQL database","Database username for authentication":"Database username for authentication","Database password for authentication":"Database password for authentication","CA certificate (PEM)":"CA certificate (PEM)","Load all collections":"Load all collections","Collections":"Collections","Unable to load collections":"Unable to load collections","Create collection":"Create collection","Load existing tables and views":"Load existing tables and views","Add collection":"Add collection","Collection name":"Collection name","Collection display name":"Collection display name","Collection template":"Collection template","General collection":"General collection","Calendar collection":"Calendar collection","File collection":"File collection","Tree collection":"Tree collection","SQL collection":"SQL collection","SQL query":"SQL query","Use a SELECT query. SQL collections are read-only.":"Use a SELECT query. SQL collections are read-only.","Add at least one query column":"Add at least one query column","Column names must be unique":"Column names must be unique","Column name {{number}}":"Column name {{number}}","Column type {{number}}":"Column type {{number}}","Remove query column {{number}}":"Remove query column {{number}}","Add query column":"Add query column","Text":"Text","Long text":"Long text","Integer":"Integer","Big integer":"Big integer","Decimal":"Decimal","Boolean":"Boolean","Date and time":"Date and time","JSON":"JSON","UUID":"UUID","Name":"Name","Title":"Title","Start date":"Start date","End date":"End date","Filename":"Filename","URL":"URL","MIME type":"MIME type","File size":"File size","Create timestamp fields":"Create timestamp fields","Create":"Create","Load":"Load","Delete":"Delete","Delete collection":"Delete collection","Delete the selected collection and its PostgreSQL table or view?":"Delete the selected collection and its PostgreSQL table or view?","Also drop dependent PostgreSQL objects":"Also drop dependent PostgreSQL objects","Failed to create collection":"Failed to create collection","Failed to delete collection":"Failed to delete collection","A collection name is required":"A collection name is required","Collection name is required":"Collection name is required","Unknown preset field {{name}}":"Unknown preset field {{name}}","This collection is read-only":"This collection is read-only","Collection {{name}} does not exist":"Collection {{name}} does not exist","Collection {{name}} already exists":"Collection {{name}} already exists","Table {{name}} already exists":"Table {{name}} already exists","Use Load tables to import an existing view":"Use Load tables to import an existing view","Delete one field at a time":"Delete one field at a time","Field {{name}} is referenced by another field":"Field {{name}} is referenced by another field","Field name is required":"Field name is required","Field name and type are required":"Field name and type are required","A generated field cannot also have a default value":"A generated field cannot also have a default value","Field {{name}} cannot change generated-id or primary-key settings":"Field {{name}} cannot change generated-id or primary-key settings","Field {{name}} does not exist":"Field {{name}} does not exist","Field {{name}} already exists":"Field {{name}} already exists","Field {{name}} is referenced by {{collection}}.{{field}}":"Field {{name}} is referenced by {{collection}}.{{field}}","Field {{name}} cannot be changed between a relation and a physical column":"Field {{name}} cannot be changed between a relation and a physical column","Relation field {{name}} requires a target":"Relation field {{name}} requires a target","Field type {{type}} does not represent a PostgreSQL column":"Field type {{type}} does not represent a PostgreSQL column","Cannot determine PostgreSQL type for field {{name}}":"Cannot determine PostgreSQL type for field {{name}}","Unsupported PostgreSQL default value":"Unsupported PostgreSQL default value","Invalid PostgreSQL foreign key action":"Invalid PostgreSQL foreign key action","Target column {{collection}}.{{field}} does not exist":"Target column {{collection}}.{{field}} does not exist","Conflicting foreign key exists for {{collection}}.{{field}}":"Conflicting foreign key exists for {{collection}}.{{field}}","Invalid PostgreSQL port":"Invalid PostgreSQL port","Test connection failed: {{reason}}":"Test connection failed: {{reason}}","Data source {{name}} does not exist":"Data source {{name}} does not exist","A tree collection requires one primary key":"A tree collection requires one primary key","Cycle detected in tree collection {{name}}":"Cycle detected in tree collection {{name}}","Tree parent changes require a transaction":"Tree parent changes require a transaction","Bulk changes to a tree parent require individual hooks":"Bulk changes to a tree parent require individual hooks","SQL collection queries require a read-only transaction":"SQL collection queries require a read-only transaction","SQL query is required":"SQL query is required","SQL query cannot be empty":"SQL query cannot be empty","Invalid or unsupported SQL syntax":"Invalid or unsupported SQL syntax","Only SELECT statements or WITH clauses are supported":"Only SELECT statements or WITH clauses are supported","SQL statement contains dangerous keyword: {{keyword}}":"SQL statement contains dangerous keyword: {{keyword}}","Multiple SQL statements are not allowed":"Multiple SQL statements are not allowed","Only SQL collections can update SQL queries":"Only SQL collections can update SQL queries","Join table {{name}} cannot match source or target collection":"Join table {{name}} cannot match source or target collection","Many-to-many foreign key and other key must be different":"Many-to-many foreign key and other key must be different","Cancel":"Cancel","Submit":"Submit","ID":"ID","Description":"Description","Please input collection name":"Please input collection name","Must start with a letter and can only contain letters, numbers, and underscores":"Must start with a letter and can only contain letters, numbers, and underscores","Use letters, numbers and underscores, must start with a letter. Example: users, products, orders":"Use letters, numbers and underscores, must start with a letter. Example: users, products, orders","Use letters, numbers and underscores, must start with a letter. Example: events, meetings, tasks":"Use letters, numbers and underscores, must start with a letter. Example: events, meetings, tasks","Use letters, numbers and underscores, must start with a letter. Example: documents, images, attachments":"Use letters, numbers and underscores, must start with a letter. Example: documents, images, attachments","Use letters, numbers and underscores, must start with a letter. Example: analytics, reports, queries":"Use letters, numbers and underscores, must start with a letter. Example: analytics, reports, queries","Use letters, numbers and underscores, must start with a letter. Example: categories, departments":"Use letters, numbers and underscores, must start with a letter. Example: categories, departments","Preset fields":"Preset fields","Select default fields to include in this collection":"Select default fields to include in this collection","ID - Primary key (auto-increment)":"ID - Primary key (auto-increment)","Created At - Timestamp when record is created":"Created At - Timestamp when record is created","Updated At - Timestamp when record is updated":"Updated At - Timestamp when record is updated","Collections used for calendar events, with start and end date fields":"Collections used for calendar events, with start and end date fields","Collections for storing file metadata and attachments":"Collections for storing file metadata and attachments","Collections created from custom SQL queries, read-only by default":"Collections created from custom SQL queries, read-only by default","Collections organized in parent-child tree structure, like categories, departments, etc":"Collections organized in parent-child tree structure, like categories, departments, etc","SELECT * FROM your_table WHERE ...":"SELECT * FROM your_table WHERE ...","Custom SQL query to retrieve data. Must be a SELECT statement. The collection will be read-only.":"Custom SQL query to retrieve data. Must be a SELECT statement. The collection will be read-only.","Query columns":"Query columns","Column name":"Column name","Column name is required":"Column name is required","Foreign key {{foreignKey}} cannot have the same name as relation field {{name}}":"Foreign key {{foreignKey}} cannot have the same name as relation field {{name}}","Foreign key {{collection}}.{{field}} has incompatible PostgreSQL type {{type}}":"Foreign key {{collection}}.{{field}} has incompatible PostgreSQL type {{type}}"}'),er=JSON.parse('{"External PostgreSQL Database":"外部PostgreSQL数据库","Display Name":"显示名称","Host":"主机","Port":"端口","Database":"数据库","Username":"用户名","Password":"密码","Schema":"模式","PostgreSQL schema name, defaults to public":"PostgreSQL模式名称,默认为public","Use SSL":"使用SSL","Enable SSL/TLS connection":"启用SSL/TLS连接","Connection Settings":"连接设置","Advanced Settings":"高级设置","Auto Discover Tables":"自动发现表","Automatically discover tables from the database":"自动从数据库中发现表","The connection name to display in NocoBase":"在NocoBase中显示的连接名称","PostgreSQL server hostname or IP address":"PostgreSQL服务器主机名或IP地址","PostgreSQL server port number":"PostgreSQL服务器端口号","Name of the PostgreSQL database":"PostgreSQL数据库名称","Database username for authentication":"用于身份验证的数据库用户名","Database password for authentication":"用于身份验证的数据库密码","CA certificate (PEM)":"CA 证书(PEM)","Load all collections":"加载所有数据表","Collections":"数据表","Unable to load collections":"无法加载数据表","Create collection":"创建数据表","Load existing tables and views":"加载已有数据表和视图","Add collection":"添加数据表","Collection name":"数据表名称","Collection display name":"数据表显示名称","Collection template":"数据表模板","General collection":"普通数据表","Calendar collection":"日历数据表","File collection":"文件数据表","Tree collection":"树形数据表","SQL collection":"SQL 数据表","SQL query":"SQL 查询","Use a SELECT query. SQL collections are read-only.":"使用 SELECT 查询。SQL 数据表为只读。","Add at least one query column":"至少添加一个查询列","Column names must be unique":"列名必须唯一","Column name {{number}}":"第 {{number}} 列名称","Column type {{number}}":"第 {{number}} 列类型","Remove query column {{number}}":"删除第 {{number}} 个查询列","Add query column":"添加查询列","Text":"文本","Long text":"长文本","Integer":"整数","Big integer":"大整数","Decimal":"小数","Boolean":"布尔值","Date and time":"日期和时间","JSON":"JSON","UUID":"UUID","Name":"名称","Title":"标题","Start date":"开始日期","End date":"结束日期","Filename":"文件名","URL":"网址","MIME type":"MIME 类型","File size":"文件大小","Create timestamp fields":"创建时间戳字段","Create":"创建","Load":"加载","Delete":"删除","Delete collection":"删除数据表","Delete the selected collection and its PostgreSQL table or view?":"确定删除所选数据表及其 PostgreSQL 表或视图吗?","Also drop dependent PostgreSQL objects":"同时删除依赖的 PostgreSQL 对象","Failed to create collection":"创建数据表失败","Failed to delete collection":"删除数据表失败","A collection name is required":"请输入数据表名称","Collection name is required":"请输入数据表名称","Unknown preset field {{name}}":"未知的预设字段 {{name}}","This collection is read-only":"此数据表为只读","Collection {{name}} does not exist":"数据表 {{name}} 不存在","Collection {{name}} already exists":"数据表 {{name}} 已存在","Table {{name}} already exists":"表 {{name}} 已存在","Use Load tables to import an existing view":"请使用加载数据表功能导入现有视图","Delete one field at a time":"请一次删除一个字段","Field {{name}} is referenced by another field":"字段 {{name}} 被其他字段引用","Field name is required":"请输入字段名称","Field name and type are required":"请输入字段名称和类型","A generated field cannot also have a default value":"自动生成字段不能同时设置默认值","Field {{name}} cannot change generated-id or primary-key settings":"不能更改字段 {{name}} 的自动生成或主键设置","Field {{name}} does not exist":"字段 {{name}} 不存在","Field {{name}} already exists":"字段 {{name}} 已存在","Field {{name}} is referenced by {{collection}}.{{field}}":"字段 {{name}} 被 {{collection}}.{{field}} 引用","Field {{name}} cannot be changed between a relation and a physical column":"字段 {{name}} 不能在关系字段和物理列之间转换","Relation field {{name}} requires a target":"关系字段 {{name}} 需要指定目标数据表","Field type {{type}} does not represent a PostgreSQL column":"字段类型 {{type}} 不是 PostgreSQL 列类型","Cannot determine PostgreSQL type for field {{name}}":"无法确定字段 {{name}} 的 PostgreSQL 类型","Unsupported PostgreSQL default value":"不支持此 PostgreSQL 默认值","Invalid PostgreSQL foreign key action":"PostgreSQL 外键操作无效","Target column {{collection}}.{{field}} does not exist":"目标列 {{collection}}.{{field}} 不存在","Conflicting foreign key exists for {{collection}}.{{field}}":"{{collection}}.{{field}} 存在冲突的外键","Invalid PostgreSQL port":"PostgreSQL 端口无效","Test connection failed: {{reason}}":"连接测试失败:{{reason}}","Data source {{name}} does not exist":"数据源 {{name}} 不存在","A tree collection requires one primary key":"树形数据表需要一个主键","Cycle detected in tree collection {{name}}":"树形数据表 {{name}} 存在循环引用","Tree parent changes require a transaction":"更改树节点的父级需要事务","Bulk changes to a tree parent require individual hooks":"批量更改树节点父级需要逐条执行钩子","SQL collection queries require a read-only transaction":"SQL 数据表查询需要只读事务","SQL query is required":"请输入 SQL 查询","SQL query cannot be empty":"SQL 查询不能为空","Invalid or unsupported SQL syntax":"SQL 语法无效或不受支持","Only SELECT statements or WITH clauses are supported":"仅支持 SELECT 语句或 WITH 子句","SQL statement contains dangerous keyword: {{keyword}}":"SQL 语句包含危险关键字:{{keyword}}","Multiple SQL statements are not allowed":"不允许执行多条 SQL 语句","Only SQL collections can update SQL queries":"仅 SQL 数据表支持更新 SQL 查询","Join table {{name}} cannot match source or target collection":"中间表 {{name}} 不能与源数据表或目标数据表相同","Many-to-many foreign key and other key must be different":"多对多关系的外键和另一外键必须不同","Cancel":"取消","Submit":"提交","ID":"ID","Description":"描述","Please input collection name":"请输入数据表名称","Must start with a letter and can only contain letters, numbers, and underscores":"必须以字母开头,且只能包含字母、数字和下划线","Use letters, numbers and underscores, must start with a letter. Example: users, products, orders":"使用字母、数字和下划线,必须以字母开头。示例:users、products、orders","Use letters, numbers and underscores, must start with a letter. Example: events, meetings, tasks":"使用字母、数字和下划线,必须以字母开头。示例:events、meetings、tasks","Use letters, numbers and underscores, must start with a letter. Example: documents, images, attachments":"使用字母、数字和下划线,必须以字母开头。示例:documents、images、attachments","Use letters, numbers and underscores, must start with a letter. Example: analytics, reports, queries":"使用字母、数字和下划线,必须以字母开头。示例:analytics、reports、queries","Use letters, numbers and underscores, must start with a letter. Example: categories, departments":"使用字母、数字和下划线,必须以字母开头。示例:categories、departments","Preset fields":"预设字段","Select default fields to include in this collection":"选择此数据表包含的默认字段","ID - Primary key (auto-increment)":"ID - 主键(自增)","Created At - Timestamp when record is created":"创建时间 - 记录创建时的时间戳","Updated At - Timestamp when record is updated":"更新时间 - 记录更新时的时间戳","Collections used for calendar events, with start and end date fields":"用于日历事件的数据表,包含开始和结束日期字段","Collections for storing file metadata and attachments":"用于存储文件元数据和附件的数据表","Collections created from custom SQL queries, read-only by default":"基于自定义 SQL 查询创建的数据表,默认为只读","Collections organized in parent-child tree structure, like categories, departments, etc":"按父子层级树形结构组织的数据表,如分类、部门等","SELECT * FROM your_table WHERE ...":"SELECT * FROM your_table WHERE ...","Custom SQL query to retrieve data. Must be a SELECT statement. The collection will be read-only.":"用于检索数据的自定义 SQL 查询。必须是 SELECT 语句。该数据表为只读。","Query columns":"查询列","Column name":"列名","Column name is required":"请输入列名","Foreign key {{foreignKey}} cannot have the same name as relation field {{name}}":"外键 {{foreignKey}} 不能与关系字段 {{name}} 同名","Foreign key {{collection}}.{{field}} has incompatible PostgreSQL type {{type}}":"外键 {{collection}}.{{field}} 的 PostgreSQL 类型 {{type}} 不兼容"}');function eo(e,t,n,r,o,a,i){try{var l=e[a](i),s=l.value}catch(e){n(e);return}l.done?t(s):Promise.resolve(s).then(r,o)}function ea(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function i(e){eo(a,r,o,i,l,"next",e)}function l(e){eo(a,r,o,i,l,"throw",e)}i(void 0)})}}function ei(e,t,n){return(ei=eu()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&es(o,n.prototype),o}).apply(null,arguments)}function el(e){return(el=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function es(e,t){return(es=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ec(e){var t="function"==typeof Map?new Map:void 0;return(ec=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,n)}function n(){return ei(e,arguments,el(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),es(n,e)})(e)}function eu(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eu=function(){return!!e})()}function ed(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:s(0)}),l(i,"throw",{value:s(1)}),l(i,"return",{value:s(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function s(l){return function(s){var c=[l,s];if(n)throw TypeError("Generator is already executing.");for(;i&&(i=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var ep=function(t){var n;if("function"!=typeof t&&null!==t)throw TypeError("Super expression must either be null or a function");function o(){var e,t;if(!(this instanceof o))throw TypeError("Cannot call a class as a function");return e=o,t=arguments,e=el(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,eu()?Reflect.construct(e,t||[],el(this).constructor):e.apply(this,t))}return o.prototype=Object.create(t&&t.prototype,{constructor:{value:o,writable:!0,configurable:!0}}),t&&es(o,t),n=[{key:"afterAdd",value:function(){return ea(function(){return ed(this,function(e){return this.app.i18n.addResources("en-US",c,en),this.app.i18n.addResources("zh-CN",c,er),[2]})}).call(this)}},{key:"load",value:function(){return ea(function(){var t,n;return ed(this,function(o){return(t=this.app.pm.get(r()))&&(n=[x,I,E,k,B],t.registerType(s,{name:s,label:this.app.i18n.t("External PostgreSQL Database",{ns:c}),icon:e.DatabaseOutlined,DataSourceSettingsForm:p,allowCollectionCreate:!0,allowCollectionDeletion:!0,disabledConfigureFields:!1,disableAddFields:!1,collectionListParams:function(){return{pageSize:50,sort:"sort",filter:{"hidden.$isFalsy":!0},appends:["fields"]}},AddCollection:et,collectionTemplates:n})),[2]})}).call(this)}}],function(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)}}(o.prototype,n),o}(ec(t.Plugin)),em=ep}(),b}()});
@@ -0,0 +1,10 @@
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.webpackChunkplugin_data_source_postgres_client_v2=self.webpackChunkplugin_data_source_postgres_client_v2||[]).push([["985"],{184:function(e,t,r){r.r(t),r.d(t,{default:function(){return y}});var n=r(155),o=r.n(n),l=r(59),a=r(694),s=r(953),u=r(981),i=r(582);function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function p(e,t,r,n,o,l,a){try{var s=e[l](a),u=s.value}catch(e){r(e);return}s.done?t(u):Promise.resolve(u).then(n,o)}function m(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r,n,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var l=[],a=!0,s=!1;try{for(o=o.call(e);!(a=(r=o.next()).done)&&(l.push(r.value),!t||l.length!==t);a=!0);}catch(e){s=!0,n=e}finally{try{a||null==o.return||o.return()}finally{if(s)throw n}}return l}}(e,t)||d(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 d(e,t){if(e){if("string"==typeof e)return c(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if("Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r)return Array.from(r);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return c(e,t)}}var f=["host","port","database","schema","username","password","ssl","sslCa"];function b(e,t){var r=null==t?void 0:t[e];return"port"===e?Number(null!=r?r:u.Wg):"schema"===e?"string"==typeof r&&r?r:u.my:"ssl"===e?!!r:"sslCa"===e?null!=r?r:"":r}function y(e){var t,r,y,h,v=e.mode,g=e.initialValues,F=e.loadCollections,w=(0,s.useTranslation)(u.CU).t,E=(0,a.useFlowContext)(),S=l.Form.useFormInstance(),I=l.Form.useWatch(["options","addAllCollections"],S),O=l.Form.useWatch(["options","host"],S),P=l.Form.useWatch(["options","port"],S),C=l.Form.useWatch(["options","database"],S),j=l.Form.useWatch(["options","schema"],S),A=l.Form.useWatch(["options","username"],S),k=l.Form.useWatch(["options","password"],S),_=l.Form.useWatch(["options","ssl"],S),V=l.Form.useWatch(["options","sslCa"],S),x=m((0,n.useState)([]),2),W=x[0],D=x[1],L=m((0,n.useState)(!1),2),R=L[0],T=L[1],U=(0,n.useRef)(0),q=(0,n.useRef)(),N=(0,n.useRef)(!1),M=(0,n.useRef)(!1),z=null==g||null==(r=g.options)?void 0:r.selectedCollections,G=null!=(t=null==g||null==(y=g.options)?void 0:y.addAllCollections)?t:(null==g||null==(h=g.options)?void 0:h.autoDiscover)!==!1,H=null!=I?I:G,K="edit"===v&&!G&&!Array.isArray(z);(0,n.useEffect)(function(){void 0===S.getFieldValue(["options","host"])&&S.setFieldValue(["options","host"],"localhost"),void 0===S.getFieldValue(["options","port"])&&S.setFieldValue(["options","port"],u.Wg),void 0===S.getFieldValue(["options","schema"])&&S.setFieldValue(["options","schema"],u.my),void 0===S.getFieldValue(["options","ssl"])&&S.setFieldValue(["options","ssl"],!1),void 0===S.getFieldValue(["options","addAllCollections"])&&S.setFieldValue(["options","addAllCollections"],G),void 0===S.getFieldValue("__postgresPreserveLegacySelection")&&S.setFieldValue("__postgresPreserveLegacySelection",K),"edit"===v&&Array.isArray(z)&&void 0===S.getFieldValue("collections")&&S.setFieldValue("collections",z)},[S,G,v,K,z]),(0,n.useEffect)(function(){U.current+=1,q.current=void 0,N.current=!1,M.current=!1,D([]),T(!1)},[O,P,C,j,A,k,_,V]);var $=(0,n.useCallback)(function(){var e;return(e=function(){var e,t,r,n,o,l,a,s;return function(e,t){var r,n,o,l={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),s=Object.defineProperty;return s(a,"next",{value:u(0)}),s(a,"throw",{value:u(1)}),s(a,"return",{value:u(2)}),"function"==typeof Symbol&&s(a,Symbol.iterator,{value:function(){return this}}),a;function u(s){return function(u){var i=[s,u];if(r)throw TypeError("Generator is already executing.");for(;a&&(a=0,i[0]&&(l=0)),l;)try{if(r=1,n&&(o=2&i[0]?n.return:i[0]?n.throw||((o=n.return)&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return l.label++,{value:i[1],done:!1};case 5:l.label++,n=i[1],i=[0];continue;case 7:i=l.ops.pop(),l.trys.pop();continue;default:if(!(o=(o=l.trys).length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){l=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){l.label=i[1];break}if(6===i[0]&&l.label<o[1]){l.label=o[1],o=i;break}if(o&&l.label<o[2]){l.label=o[2],l.ops.push(i);break}o[2]&&l.ops.pop(),l.trys.pop();continue}i=t.call(e,l)}catch(e){i=[6,e],n=0}finally{r=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}}}(this,function(p){var m,y,h;switch(p.label){case 0:if(r=[(t=S.getFieldsValue(!0)).key].concat(function(e){if(Array.isArray(e))return c(e)}(m=f.map(function(e){return b(e,t.options)}))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(m)||d(m)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),(n=null==(e=q.current)?void 0:e.every(function(e,t){return e===r[t]}))&&(N.current||M.current))return[2];n||(U.current+=1,q.current=r,N.current=!1),o=U.current,M.current=!0,T(!0),p.label=1;case 1:if(p.trys.push([1,6,7,8]),l=f.some(function(e){return b(e,t.options)!==b(e,null==g?void 0:g.options)}),!("create"===v||l))return[3,3];return[4,E.api.resource("dataSources").readTables({values:{dataSourceKey:t.key,dbOptions:(y=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),n.forEach(function(t){var n;n=r[t],t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n})}return e}({},t.options),h=h={type:u.uy},Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(h)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t.push.apply(t,r)}return t})(Object(h)).forEach(function(e){Object.defineProperty(y,e,Object.getOwnPropertyDescriptor(h,e))}),y)}})];case 2:return s=p.sent().data,[3,5];case 3:return[4,F(String(null==g?void 0:g.key))];case 4:s=p.sent(),p.label=5;case 5:return a=s,o===U.current&&(D((0,i.I)(a)),N.current=!0),[3,8];case 6:return p.sent(),o===U.current&&E.message.error(String(w("Unable to load collections"))),[3,8];case 7:return o===U.current&&(M.current=!1,T(!1)),[7];case 8:return[2]}})},function(){var t=this,r=arguments;return new Promise(function(n,o){var l=e.apply(t,r);function a(e){p(l,n,o,a,s,"next",e)}function s(e){p(l,n,o,a,s,"throw",e)}a(void 0)})})()},[E,S,g,F,v,w]);return o().createElement(o().Fragment,null,o().createElement(l.Form.Item,{name:["options","host"],label:w("Host"),rules:[{required:!0}]},o().createElement(l.Input,null)),o().createElement(l.Form.Item,{name:["options","port"],label:w("Port"),rules:[{required:!0}]},o().createElement(l.InputNumber,{min:1,max:65535,style:{width:"100%"}})),o().createElement(l.Form.Item,{name:["options","database"],label:w("Database"),rules:[{required:!0}]},o().createElement(l.Input,null)),o().createElement(l.Form.Item,{name:["options","schema"],label:w("Schema")},o().createElement(l.Input,null)),o().createElement(l.Form.Item,{name:["options","username"],label:w("Username"),rules:[{required:!0}]},o().createElement(l.Input,null)),o().createElement(l.Form.Item,{name:["options","password"],label:w("Password")},o().createElement(l.Input.Password,null)),o().createElement(l.Form.Item,{name:["options","ssl"],label:w("Use SSL"),valuePropName:"checked"},o().createElement(l.Checkbox,null)),_?o().createElement(l.Form.Item,{name:["options","sslCa"],label:w("CA certificate (PEM)")},o().createElement(l.Input.TextArea,{autoSize:{minRows:3,maxRows:8}})):null,o().createElement(l.Form.Item,{name:["options","addAllCollections"],label:w("Load all collections"),valuePropName:"checked"},o().createElement(l.Checkbox,null)),o().createElement(l.Form.Item,{name:"__postgresPreserveLegacySelection",hidden:!0},o().createElement(l.Input,null)),H?null:o().createElement(l.Form.Item,{name:"collections",label:w("Collections")},o().createElement(l.Select,{mode:"multiple",allowClear:!0,loading:R,options:W,optionFilterProp:"label",onFocus:$,onChange:function(){return S.setFieldValue("__postgresPreserveLegacySelection",!1)}})))}}}]);
@@ -0,0 +1,10 @@
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
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("@nocobase/plugin-data-source-manager/client-v2"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("plugin-data-source-postgres/client-v2",["react-i18next","@nocobase/plugin-data-source-manager/client-v2","@nocobase/client-v2","react","antd","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["plugin-data-source-postgres/client-v2"]=t(require("react-i18next"),require("@nocobase/plugin-data-source-manager/client-v2"),require("@nocobase/client-v2"),require("react"),require("antd"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["plugin-data-source-postgres/client-v2"]=t(e["react-i18next"],e["@nocobase/plugin-data-source-manager/client-v2"],e["@nocobase/client-v2"],e.react,e.antd,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,a,l){return function(){"use strict";var i,u,c,s={582:function(e,t,n){function r(e){return(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&null!==e&&!Array.isArray(e)}function o(e){var t=r(e)?e.data:e,n=r(t)?t.data:t;return Array.isArray(n)?n.flatMap(function(e){var t="string"==typeof e?e:r(e)?e.name:void 0;return"string"==typeof t?[{label:t,value:t}]:[]}):[]}n.d(t,{I:function(){return o}})},981:function(e,t,n){n.d(t,{CU:function(){return o},Wg:function(){return a},my:function(){return l},uy:function(){return r}});var r="postgres-external",o="plugin-data-source-postgres",a=5432,l="public"},375:function(e){e.exports=a},485:function(e){e.exports=n},694:function(e){e.exports=l},894:function(e){e.exports=t},59:function(e){e.exports=o},155:function(e){e.exports=r},953:function(t){t.exports=e}},p={};function f(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return s[e](n,n.exports,f),n.exports}f.m=s,f.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return f.d(t,{a:t}),t},f.d=function(e,t){for(var n in t)f.o(t,n)&&!f.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},f.f={},f.e=function(e){return Promise.all(Object.keys(f.f).reduce(function(t,n){return f.f[n](e,t),t},[]))},f.u=function(e){return""+e+".34da95acdf7743ab.js"},f.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),f.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d={},f.l=function(e,t,n,r){if(d[e])return void d[e].push(t);if(void 0!==n)for(var o,a,l=document.getElementsByTagName("script"),i=0;i<l.length;i++){var u=l[i];if(u.getAttribute("src")==e||u.getAttribute("data-rspack")=="plugin-data-source-postgres/client-v2:"+n){o=u;break}}o||(a=!0,(o=document.createElement("script")).timeout=120,f.nc&&o.setAttribute("nonce",f.nc),o.setAttribute("data-rspack","plugin-data-source-postgres/client-v2:"+n),o.src=e),d[e]=[t];var c=function(t,n){o.onerror=o.onload=null,clearTimeout(s);var r=d[e];if(delete d[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},s=setTimeout(c.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=c.bind(null,o.onerror),o.onload=c.bind(null,o.onload),a&&document.head.appendChild(o)},f.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},f.g.importScripts&&(m=f.g.location+"");var d,m,b=f.g.document;if(!m&&b&&(b.currentScript&&"SCRIPT"===b.currentScript.tagName.toUpperCase()&&(m=b.currentScript.src),!m)){var y=b.getElementsByTagName("script");if(y.length)for(var g=y.length-1;g>-1&&(!m||!/^http(s?):/.test(m));)m=y[g--].src}if(!m)throw Error("Automatic publicPath is not supported in this browser");f.p=m.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i={889:0},f.f.j=function(e,t){var n=f.o(i,e)?i[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=i[e]=[t,r]});t.push(n[2]=r);var o=f.p+f.u(e),a=Error();f.l(o,function(t){if(f.o(i,e)&&(0!==(n=i[e])&&(i[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;a.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",a.name="ChunkLoadError",a.type=r,a.request=o,n[1](a)}},"chunk-"+e,e)}},u=function(e,t){var n,r,o=t[0],a=t[1],l=t[2],u=0;if(o.some(function(e){return 0!==i[e]})){for(n in a)f.o(a,n)&&(f.m[n]=a[n]);l&&l(f)}for(e&&e(t);u<o.length;u++)r=o[u],f.o(i,r)&&i[r]&&i[r][0](),i[r]=0},(c=self.webpackChunkplugin_data_source_postgres_client_v2=self.webpackChunkplugin_data_source_postgres_client_v2||[]).forEach(u.bind(null,0)),c.push=u.bind(null,c.push.bind(c));var v={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/plugin-data-source-postgres/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/plugin-data-source-postgres/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",a="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var l=window.location.pathname||"/",i=l.indexOf(a);e=i>=0?l.slice(0,i+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/plugin-data-source-postgres/dist/client-v2/"}f.p=e}(),!function(){f.r(v),f.d(v,{default:function(){return T}});var e=f(155),t=f.n(e),n=f(485),r=f(894),o=f.n(r),a=f(981),l=f(59),i=f(375),u=f(694),c=f(953),s=f(582);function p(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 d(e,t,n,r,o,a,l){try{var i=e[a](l),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,o)}function m(e){return function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){d(a,r,o,l,i,"next",e)}function i(e){d(a,r,o,l,i,"throw",e)}l(void 0)})}}function b(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)throw r}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return p(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 p(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.")}()}function y(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}var g={string:"input",text:"textarea",integer:"integer",bigInt:"integer",decimal:"number",boolean:"checkbox",date:"datetime",json:"json",uuid:"uuid"};function h(n){var r=n.dataSourceKey,o=n.onSubmitted,p=n.children,f=(0,c.useTranslation)(a.CU).t,d=(0,u.useFlowContext)(),v=l.App.useApp().notification,h=b(l.Form.useForm(),1)[0],S=l.Form.useWatch("template",h),O=b((0,e.useState)(!1),2),x=O[0],E=O[1],j=b((0,e.useState)(!1),2),C=j[0],I=j[1],k=b((0,e.useState)(!1),2),P=k[0],_=k[1],A=b((0,e.useState)(!1),2),q=A[0],F=A[1],T=b((0,e.useState)(!1),2),D=T[0],U=T[1],L=b((0,e.useState)([]),2),B=L[0],R=L[1],M=b((0,e.useState)([]),2),K=M[0],N=M[1],$=function(){return m(function(){var e;return y(this,function(t){switch(t.label){case 0:return[4,null==(e=d.dataSourceManager.getDataSource(r))?void 0:e.reload()];case 1:return t.sent(),null==o||o(),[2]}})})()};return t().createElement(t().Fragment,null,t().createElement(l.Dropdown,{menu:{items:[{key:"create",label:f("Create collection")},{key:"load",label:f("Load existing tables and views")}],onClick:function(e){var t=e.key;"create"===t&&F(!0),"load"===t&&m(function(){var e,t;return y(this,function(n){switch(n.label){case 0:N([]),R([]),U(!0),I(!0),n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,d.api.resource("dataSources").readTables({values:{dataSourceKey:r}})];case 2:return e=n.sent(),R((0,s.I)(e.data)),[3,5];case 3:return t=n.sent(),v.error({message:String(f("Unable to load collections")),description:w(t)}),[3,5];case 4:return I(!1),[7];case 5:return[2]}})})()}}},t().createElement(l.Button,{icon:t().createElement(i.PlusOutlined,null)},p||f("Add collection")," ",t().createElement(i.DownOutlined,null))),t().createElement(l.Drawer,{open:q,title:f("Create collection"),onClose:function(){return F(!1)},extra:t().createElement(l.Button,{type:"primary",loading:x,onClick:function(){return h.submit()}},f("Create")),destroyOnClose:!0},t().createElement(l.Form,{form:h,layout:"vertical",onFinish:function(e){return m(function(){var t,n,o;return y(this,function(l){switch(l.label){case 0:n=(t="sql"===e.template)?(e.sqlFields||[]).map(function(e){var t=e.name,n=e.type;return{name:t.trim(),type:n,interface:g[n]}}):[{name:"id",type:"bigInt",interface:"id",primaryKey:!0,autoIncrement:!0,allowNull:!1}],"calendar"===e.template&&n.push({name:"title",type:"string",interface:"input",uiSchema:{title:'{{t("Title", { ns: "'.concat(a.CU,'" })}}'),type:"string","x-component":"Input"}},{name:"start",type:"date",interface:"datetime",uiSchema:{title:'{{t("Start date", { ns: "'.concat(a.CU,'" })}}'),type:"datetime","x-component":"DatePicker","x-component-props":{showTime:!0}}},{name:"end",type:"date",interface:"datetime",uiSchema:{title:'{{t("End date", { ns: "'.concat(a.CU,'" })}}'),type:"datetime","x-component":"DatePicker","x-component-props":{showTime:!0}}}),"file"===e.template&&n.push({name:"filename",type:"string",interface:"input",uiSchema:{title:'{{t("Filename", { ns: "'.concat(a.CU,'" })}}'),type:"string","x-component":"Input"}},{name:"title",type:"string",interface:"input",uiSchema:{title:'{{t("Title", { ns: "'.concat(a.CU,'" })}}'),type:"string","x-component":"Input"}},{name:"url",type:"string",interface:"url",uiSchema:{title:'{{t("URL", { ns: "'.concat(a.CU,'" })}}'),type:"string","x-component":"Input.URL"}},{name:"mimetype",type:"string",interface:"input",uiSchema:{title:'{{t("MIME type", { ns: "'.concat(a.CU,'" })}}'),type:"string","x-component":"Input"}},{name:"size",type:"bigInt",interface:"integer",uiSchema:{title:'{{t("File size", { ns: "'.concat(a.CU,'" })}}'),type:"number","x-component":"InputNumber"}}),"tree"===e.template&&n.push({name:"name",type:"string",interface:"input",uiSchema:{title:'{{t("Name", { ns: "'.concat(a.CU,'" })}}'),type:"string","x-component":"Input"}},{name:"parentId",type:"bigInt",interface:"integer"},{name:"parent",type:"belongsTo",interface:"m2o",target:e.name,foreignKey:"parentId",targetKey:"id",treeParent:!0},{name:"children",type:"hasMany",interface:"o2m",target:e.name,foreignKey:"parentId",sourceKey:"id",treeChildren:!0}),!t&&e.timestamps&&n.push({name:"createdAt",type:"date",interface:"createdAt",field:"createdAt"},{name:"updatedAt",type:"date",interface:"updatedAt",field:"updatedAt"}),E(!0),l.label=1;case 1:return l.trys.push([1,4,5,6]),[4,d.api.request({url:"dataSources/".concat(encodeURIComponent(r),"/collections:create"),method:"post",data: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;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({name:e.name,title:e.title,template:e.template,autoGenId:!t,createdAt:!t&&e.timestamps,updatedAt:!t&&e.timestamps,createdBy:!1,updatedBy:!1,fields:n},"tree"===e.template?{tree:"parentId"}:{},t?{sql:e.sql}:{})})];case 2:return l.sent(),F(!1),h.resetFields(),[4,$()];case 3:return l.sent(),[3,6];case 4:return o=l.sent(),v.error({message:String(f("Failed to create collection")),description:w(o)}),[3,6];case 5:return E(!1),[7];case 6:return[2]}})})()},initialValues:{timestamps:!0,template:"general",sqlFields:[{name:"",type:"string"}]}},t().createElement(l.Form.Item,{name:"template",label:f("Collection template"),rules:[{required:!0}]},t().createElement(l.Select,{options:[{value:"general",label:f("General collection")},{value:"calendar",label:f("Calendar collection")},{value:"file",label:f("File collection")},{value:"tree",label:f("Tree collection")},{value:"sql",label:f("SQL collection")}]})),t().createElement(l.Form.Item,{name:"name",label:f("Collection name"),rules:[{required:!0}]},t().createElement(l.Input,null)),t().createElement(l.Form.Item,{name:"title",label:f("Collection display name"),rules:[{required:!0}]},t().createElement(l.Input,null)),"sql"===S?t().createElement(t().Fragment,null,t().createElement(l.Form.Item,{name:"sql",label:f("SQL query"),extra:f("Use a SELECT query. SQL collections are read-only."),rules:[{required:!0,whitespace:!0}]},t().createElement(l.Input.TextArea,{autoSize:{minRows:5,maxRows:12}})),t().createElement(l.Form.List,{name:"sqlFields",rules:[{validator:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return m(function(){var e;return y(this,function(n){if(!t.length)throw Error(String(f("Add at least one query column")));if(new Set(e=t.map(function(e){var t;return null==e||null==(t=e.name)?void 0:t.trim()}).filter(Boolean)).size!==e.length)throw Error(String(f("Column names must be unique")));return[2]})})()}}]},function(e,n,r){var o=n.add,a=n.remove,u=r.errors;return t().createElement(t().Fragment,null,e.map(function(e,n){return t().createElement(l.Space,{key:e.key,align:"start",style:{display:"flex"}},t().createElement(l.Form.Item,{name:[e.name,"name"],rules:[{required:!0,whitespace:!0}]},t().createElement(l.Input,{"aria-label":String(f("Column name {{number}}",{number:n+1}))})),t().createElement(l.Form.Item,{name:[e.name,"type"],rules:[{required:!0}]},t().createElement(l.Select,{"aria-label":String(f("Column type {{number}}",{number:n+1})),style:{width:150},options:[{value:"string",label:f("Text")},{value:"text",label:f("Long text")},{value:"integer",label:f("Integer")},{value:"bigInt",label:f("Big integer")},{value:"decimal",label:f("Decimal")},{value:"boolean",label:f("Boolean")},{value:"date",label:f("Date and time")},{value:"json",label:f("JSON")},{value:"uuid",label:f("UUID")}]})),t().createElement(l.Button,{"aria-label":String(f("Remove query column {{number}}",{number:n+1})),icon:t().createElement(i.DeleteOutlined,null),onClick:function(){return a(e.name)}}))}),t().createElement(l.Form.ErrorList,{errors:u}),t().createElement(l.Button,{type:"dashed",icon:t().createElement(i.PlusOutlined,null),onClick:function(){return o({name:"",type:"string"})}},f("Add query column")))})):t().createElement(l.Form.Item,{name:"timestamps",valuePropName:"checked"},t().createElement(l.Checkbox,null,f("Create timestamp fields"))))),t().createElement(l.Modal,{open:D,title:f("Load existing tables and views"),okText:f("Load"),okButtonProps:{disabled:!K.length||C},confirmLoading:P,onOk:function(){return m(function(){var e;return y(this,function(t){switch(t.label){case 0:if(!K.length)return[2];_(!0),t.label=1;case 1:return t.trys.push([1,4,5,6]),[4,d.api.resource("dataSources").loadTables({values:{dataSourceKey:r,tables:K}})];case 2:return t.sent(),U(!1),[4,$()];case 3:return t.sent(),[3,6];case 4:return e=t.sent(),v.error({message:String(f("Unable to load collections")),description:w(e)}),[3,6];case 5:return _(!1),[7];case 6:return[2]}})})()},onCancel:function(){return U(!1)}},t().createElement(l.Select,{"aria-label":String(f("Collections")),mode:"multiple",allowClear:!0,loading:C,options:B,optionFilterProp:"label",value:K,onChange:N,style:{width:"100%"}})))}function w(e){var t;return(null!=(t=Error)&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t)?e.message:void 0}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 O(e,t,n,r,o,a,l){try{var i=e[a](l),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,o)}function x(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var a=[],l=!0,i=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(a.push(n.value),!t||a.length!==t);l=!0);}catch(e){i=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(i)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.")}()}function E(n){var r=n.dataSourceKey,o=n.record,i=n.selectedRowKeys,s=n.onSubmitted,p=n.children,f=n.isBulk,d=(0,c.useTranslation)(a.CU).t,m=(0,u.useFlowContext)(),b=l.App.useApp().notification,y=x((0,e.useState)(!1),2),g=y[0],v=y[1],h=x((0,e.useState)(!1),2),w=h[0],S=h[1],E=x((0,e.useState)(!1),2),j=E[0],C=E[1],I=f?i||[]:(null==o?void 0:o.name)?[o.name]:[];return t().createElement(t().Fragment,null,t().createElement(l.Button,{type:f?"default":"link",danger:!0,disabled:!I.length,onClick:function(){C(!1),v(!0)}},p||d("Delete")),t().createElement(l.Modal,{open:g,title:d("Delete collection"),confirmLoading:w,okButtonProps:{danger:!0},onOk:function(){var e;return(e=function(){var e,t;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){switch(n.label){case 0:if(!I.length)return[2];S(!0),n.label=1;case 1:return n.trys.push([1,4,5,6]),[4,m.api.request({url:"dataSources/".concat(encodeURIComponent(r),"/collections:destroy"),method:"post",params:{filterByTk:I,cascade:j}})];case 2:return n.sent(),v(!1),[4,null==(e=m.dataSourceManager.getDataSource(r))?void 0:e.reload()];case 3:return n.sent(),null==s||s(),[3,6];case 4:var o;return t=n.sent(),b.error({message:String(d("Failed to delete collection")),description:(null!=(o=Error)&&"u">typeof Symbol&&o[Symbol.hasInstance]?!!o[Symbol.hasInstance](t):t instanceof o)?t.message:void 0}),[3,6];case 5:return S(!1),[7];case 6:return[2]}})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){O(a,r,o,l,i,"next",e)}function i(e){O(a,r,o,l,i,"throw",e)}l(void 0)})})()},onCancel:function(){return v(!1)}},t().createElement("p",null,d("Delete the selected collection and its PostgreSQL table or view?")),t().createElement(l.Checkbox,{checked:j,onChange:function(e){return C(e.target.checked)}},d("Also drop dependent PostgreSQL objects"))))}function j(e,t,n,r,o,a,l){try{var i=e[a](l),u=i.value}catch(e){n(e);return}i.done?t(u):Promise.resolve(u).then(r,o)}function C(e,t,n){return(C=q()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&_(o,n.prototype),o}).apply(null,arguments)}function I(e){return(I=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function k(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;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function P(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function A(e){var t="function"==typeof Map?new Map:void 0;return(A=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,n)}function n(){return C(e,arguments,I(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),_(n,e)})(e)}function q(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(q=function(){return!!e})()}var F=["formula","sequence","tableoid","snapshot","subTable","linkTo","createdBy","updatedBy","attachment","o2o"],T=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=I(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,q()?Reflect.construct(e,t||[],I(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&_(r,e),n=[{key:"load",value:function(){var e;return(e=function(){var e;return function(e,t){var n,r,o,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:u(0)}),i(l,"throw",{value:u(1)}),i(l,"return",{value:u(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function u(i){return function(u){var c=[i,u];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,c[0]&&(a=0)),a;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return a.label++,{value:c[1],done:!1};case 5:a.label++,r=c[1],c=[0];continue;case 7:c=a.ops.pop(),a.trys.pop();continue;default:if(!(o=(o=a.trys).length>0&&o[o.length-1])&&(6===c[0]||2===c[0])){a=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){a.label=c[1];break}if(6===c[0]&&a.label<o[1]){a.label=o[1],o=c;break}if(o&&a.label<o[2]){a.label=o[2],a.ops.push(c);break}o[2]&&a.ops.pop(),a.trys.pop();continue}c=t.call(e,a)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}}(this,function(n){return null==(e=this.app.pm.get(o()))||e.registerType(a.uy,{label:String(this.t("External PostgreSQL Database")),defaultValues:{options:{host:"localhost",port:a.Wg,schema:a.my,ssl:!1,addAllCollections:!0}},SettingsForm:t().lazy(function(){return f.e("985").then(f.bind(f,184))}),allowCollectionCreate:!0,allowCollectionDeletion:!0,disableAddFields:!1,createFieldInterfaces:function(e){var t=e.collection;return(null==t?void 0:t.view)||(null==t?void 0:t.template)==="view"||(null==t?void 0:t.sql)||(null==t?void 0:t.template)==="sql"?{include:["__none__"]}:{exclude:F}},AddCollection:h,DeleteCollection:E,normalizeValues:function(e){var t,n,r,o=e.__postgresPreserveLegacySelection,a=function(e,t){if(null==e)return{};var n,r,o,a={};if("u">typeof Reflect&&Reflect.ownKeys){for(o=0,n=Reflect.ownKeys(Object(e));o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}if(a=function(e,t){if(null==e)return{};var n,r,o={},a=Object.getOwnPropertyNames(e);for(r=0;r<a.length;r++)n=a[r],!(t.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n]);return o}(e,t),Object.getOwnPropertySymbols)for(o=0,n=Object.getOwnPropertySymbols(e);o<n.length;o++)r=n[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r]);return a}(e,["__postgresPreserveLegacySelection"]),l=null!=(t=null==(n=e.options)?void 0:n.addAllCollections)?t:(null==(r=e.options)?void 0:r.autoDiscover)!==!1,i=P(k({},e.options),{addAllCollections:l,autoDiscover:l});return o&&!l?delete a.collections:l||(i.selectedCollections=e.collections),P(k({},a),{options:i})}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var a=e.apply(t,n);function l(e){j(a,r,o,l,i,"next",e)}function i(e){j(a,r,o,l,i,"throw",e)}l(void 0)})}).call(this)}}],function(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)}}(r.prototype,n),r}(A(n.Plugin))}(),v}()});
@@ -0,0 +1,45 @@
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
+ var __defProp = Object.defineProperty;
11
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
+ var __getOwnPropNames = Object.getOwnPropertyNames;
13
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+ var constants_exports = {};
28
+ __export(constants_exports, {
29
+ DATA_SOURCE_TYPE: () => DATA_SOURCE_TYPE,
30
+ DEFAULT_PORT: () => DEFAULT_PORT,
31
+ DEFAULT_SCHEMA: () => DEFAULT_SCHEMA,
32
+ NAMESPACE: () => NAMESPACE
33
+ });
34
+ module.exports = __toCommonJS(constants_exports);
35
+ const DATA_SOURCE_TYPE = "postgres-external";
36
+ const NAMESPACE = "plugin-data-source-postgres";
37
+ const DEFAULT_PORT = 5432;
38
+ const DEFAULT_SCHEMA = "public";
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ DATA_SOURCE_TYPE,
42
+ DEFAULT_PORT,
43
+ DEFAULT_SCHEMA,
44
+ NAMESPACE
45
+ });
@@ -0,0 +1,28 @@
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
+ module.exports = {
11
+ "react": "18.2.0",
12
+ "@formily/antd-v5": "1.2.3",
13
+ "@formily/react": "2.3.7",
14
+ "lodash": "4.18.1",
15
+ "@nocobase/client": "2.2.40",
16
+ "react-router-dom": "6.30.1",
17
+ "antd": "5.24.2",
18
+ "@ant-design/icons": "5.6.1",
19
+ "@nocobase/plugin-data-source-manager": "2.2.40",
20
+ "@nocobase/client-v2": "2.2.40",
21
+ "@nocobase/flow-engine": "2.2.40",
22
+ "react-i18next": "11.18.6",
23
+ "@nocobase/actions": "2.2.40",
24
+ "@nocobase/data-source-manager": "2.2.40",
25
+ "@nocobase/database": "2.2.40",
26
+ "@nocobase/server": "2.2.40",
27
+ "sequelize": "6.35.2"
28
+ };
@@ -0,0 +1,141 @@
1
+ {
2
+ "External PostgreSQL Database": "External PostgreSQL Database",
3
+ "Display Name": "Display Name",
4
+ "Host": "Host",
5
+ "Port": "Port",
6
+ "Database": "Database",
7
+ "Username": "Username",
8
+ "Password": "Password",
9
+ "Schema": "Schema",
10
+ "PostgreSQL schema name, defaults to public": "PostgreSQL schema name, defaults to public",
11
+ "Use SSL": "Use SSL",
12
+ "Enable SSL/TLS connection": "Enable SSL/TLS connection",
13
+ "Connection Settings": "Connection Settings",
14
+ "Advanced Settings": "Advanced Settings",
15
+ "Auto Discover Tables": "Auto Discover Tables",
16
+ "Automatically discover tables from the database": "Automatically discover tables from the database",
17
+ "The connection name to display in NocoBase": "The connection name to display in NocoBase",
18
+ "PostgreSQL server hostname or IP address": "PostgreSQL server hostname or IP address",
19
+ "PostgreSQL server port number": "PostgreSQL server port number",
20
+ "Name of the PostgreSQL database": "Name of the PostgreSQL database",
21
+ "Database username for authentication": "Database username for authentication",
22
+ "Database password for authentication": "Database password for authentication",
23
+ "CA certificate (PEM)": "CA certificate (PEM)",
24
+ "Load all collections": "Load all collections",
25
+ "Collections": "Collections",
26
+ "Unable to load collections": "Unable to load collections",
27
+ "Create collection": "Create collection",
28
+ "Load existing tables and views": "Load existing tables and views",
29
+ "Add collection": "Add collection",
30
+ "Collection name": "Collection name",
31
+ "Collection display name": "Collection display name",
32
+ "Collection template": "Collection template",
33
+ "General collection": "General collection",
34
+ "Calendar collection": "Calendar collection",
35
+ "File collection": "File collection",
36
+ "Tree collection": "Tree collection",
37
+ "SQL collection": "SQL collection",
38
+ "SQL query": "SQL query",
39
+ "Use a SELECT query. SQL collections are read-only.": "Use a SELECT query. SQL collections are read-only.",
40
+ "Add at least one query column": "Add at least one query column",
41
+ "Column names must be unique": "Column names must be unique",
42
+ "Column name {{number}}": "Column name {{number}}",
43
+ "Column type {{number}}": "Column type {{number}}",
44
+ "Remove query column {{number}}": "Remove query column {{number}}",
45
+ "Add query column": "Add query column",
46
+ "Text": "Text",
47
+ "Long text": "Long text",
48
+ "Integer": "Integer",
49
+ "Big integer": "Big integer",
50
+ "Decimal": "Decimal",
51
+ "Boolean": "Boolean",
52
+ "Date and time": "Date and time",
53
+ "JSON": "JSON",
54
+ "UUID": "UUID",
55
+ "Name": "Name",
56
+ "Title": "Title",
57
+ "Start date": "Start date",
58
+ "End date": "End date",
59
+ "Filename": "Filename",
60
+ "URL": "URL",
61
+ "MIME type": "MIME type",
62
+ "File size": "File size",
63
+ "Create timestamp fields": "Create timestamp fields",
64
+ "Create": "Create",
65
+ "Load": "Load",
66
+ "Delete": "Delete",
67
+ "Delete collection": "Delete collection",
68
+ "Delete the selected collection and its PostgreSQL table or view?": "Delete the selected collection and its PostgreSQL table or view?",
69
+ "Also drop dependent PostgreSQL objects": "Also drop dependent PostgreSQL objects",
70
+ "Failed to create collection": "Failed to create collection",
71
+ "Failed to delete collection": "Failed to delete collection",
72
+ "A collection name is required": "A collection name is required",
73
+ "Collection name is required": "Collection name is required",
74
+ "Unknown preset field {{name}}": "Unknown preset field {{name}}",
75
+ "This collection is read-only": "This collection is read-only",
76
+ "Collection {{name}} does not exist": "Collection {{name}} does not exist",
77
+ "Collection {{name}} already exists": "Collection {{name}} already exists",
78
+ "Table {{name}} already exists": "Table {{name}} already exists",
79
+ "Use Load tables to import an existing view": "Use Load tables to import an existing view",
80
+ "Delete one field at a time": "Delete one field at a time",
81
+ "Field {{name}} is referenced by another field": "Field {{name}} is referenced by another field",
82
+ "Field name is required": "Field name is required",
83
+ "Field name and type are required": "Field name and type are required",
84
+ "A generated field cannot also have a default value": "A generated field cannot also have a default value",
85
+ "Field {{name}} cannot change generated-id or primary-key settings": "Field {{name}} cannot change generated-id or primary-key settings",
86
+ "Field {{name}} does not exist": "Field {{name}} does not exist",
87
+ "Field {{name}} already exists": "Field {{name}} already exists",
88
+ "Field {{name}} is referenced by {{collection}}.{{field}}": "Field {{name}} is referenced by {{collection}}.{{field}}",
89
+ "Field {{name}} cannot be changed between a relation and a physical column": "Field {{name}} cannot be changed between a relation and a physical column",
90
+ "Relation field {{name}} requires a target": "Relation field {{name}} requires a target",
91
+ "Field type {{type}} does not represent a PostgreSQL column": "Field type {{type}} does not represent a PostgreSQL column",
92
+ "Cannot determine PostgreSQL type for field {{name}}": "Cannot determine PostgreSQL type for field {{name}}",
93
+ "Unsupported PostgreSQL default value": "Unsupported PostgreSQL default value",
94
+ "Invalid PostgreSQL foreign key action": "Invalid PostgreSQL foreign key action",
95
+ "Target column {{collection}}.{{field}} does not exist": "Target column {{collection}}.{{field}} does not exist",
96
+ "Conflicting foreign key exists for {{collection}}.{{field}}": "Conflicting foreign key exists for {{collection}}.{{field}}",
97
+ "Invalid PostgreSQL port": "Invalid PostgreSQL port",
98
+ "Test connection failed: {{reason}}": "Test connection failed: {{reason}}",
99
+ "Data source {{name}} does not exist": "Data source {{name}} does not exist",
100
+ "A tree collection requires one primary key": "A tree collection requires one primary key",
101
+ "Cycle detected in tree collection {{name}}": "Cycle detected in tree collection {{name}}",
102
+ "Tree parent changes require a transaction": "Tree parent changes require a transaction",
103
+ "Bulk changes to a tree parent require individual hooks": "Bulk changes to a tree parent require individual hooks",
104
+ "SQL collection queries require a read-only transaction": "SQL collection queries require a read-only transaction",
105
+ "SQL query is required": "SQL query is required",
106
+ "SQL query cannot be empty": "SQL query cannot be empty",
107
+ "Invalid or unsupported SQL syntax": "Invalid or unsupported SQL syntax",
108
+ "Only SELECT statements or WITH clauses are supported": "Only SELECT statements or WITH clauses are supported",
109
+ "SQL statement contains dangerous keyword: {{keyword}}": "SQL statement contains dangerous keyword: {{keyword}}",
110
+ "Multiple SQL statements are not allowed": "Multiple SQL statements are not allowed",
111
+ "Only SQL collections can update SQL queries": "Only SQL collections can update SQL queries",
112
+ "Join table {{name}} cannot match source or target collection": "Join table {{name}} cannot match source or target collection",
113
+ "Many-to-many foreign key and other key must be different": "Many-to-many foreign key and other key must be different",
114
+ "Cancel": "Cancel",
115
+ "Submit": "Submit",
116
+ "ID": "ID",
117
+ "Description": "Description",
118
+ "Please input collection name": "Please input collection name",
119
+ "Must start with a letter and can only contain letters, numbers, and underscores": "Must start with a letter and can only contain letters, numbers, and underscores",
120
+ "Use letters, numbers and underscores, must start with a letter. Example: users, products, orders": "Use letters, numbers and underscores, must start with a letter. Example: users, products, orders",
121
+ "Use letters, numbers and underscores, must start with a letter. Example: events, meetings, tasks": "Use letters, numbers and underscores, must start with a letter. Example: events, meetings, tasks",
122
+ "Use letters, numbers and underscores, must start with a letter. Example: documents, images, attachments": "Use letters, numbers and underscores, must start with a letter. Example: documents, images, attachments",
123
+ "Use letters, numbers and underscores, must start with a letter. Example: analytics, reports, queries": "Use letters, numbers and underscores, must start with a letter. Example: analytics, reports, queries",
124
+ "Use letters, numbers and underscores, must start with a letter. Example: categories, departments": "Use letters, numbers and underscores, must start with a letter. Example: categories, departments",
125
+ "Preset fields": "Preset fields",
126
+ "Select default fields to include in this collection": "Select default fields to include in this collection",
127
+ "ID - Primary key (auto-increment)": "ID - Primary key (auto-increment)",
128
+ "Created At - Timestamp when record is created": "Created At - Timestamp when record is created",
129
+ "Updated At - Timestamp when record is updated": "Updated At - Timestamp when record is updated",
130
+ "Collections used for calendar events, with start and end date fields": "Collections used for calendar events, with start and end date fields",
131
+ "Collections for storing file metadata and attachments": "Collections for storing file metadata and attachments",
132
+ "Collections created from custom SQL queries, read-only by default": "Collections created from custom SQL queries, read-only by default",
133
+ "Collections organized in parent-child tree structure, like categories, departments, etc": "Collections organized in parent-child tree structure, like categories, departments, etc",
134
+ "SELECT * FROM your_table WHERE ...": "SELECT * FROM your_table WHERE ...",
135
+ "Custom SQL query to retrieve data. Must be a SELECT statement. The collection will be read-only.": "Custom SQL query to retrieve data. Must be a SELECT statement. The collection will be read-only.",
136
+ "Query columns": "Query columns",
137
+ "Column name": "Column name",
138
+ "Column name is required": "Column name is required",
139
+ "Foreign key {{foreignKey}} cannot have the same name as relation field {{name}}": "Foreign key {{foreignKey}} cannot have the same name as relation field {{name}}",
140
+ "Foreign key {{collection}}.{{field}} has incompatible PostgreSQL type {{type}}": "Foreign key {{collection}}.{{field}} has incompatible PostgreSQL type {{type}}"
141
+ }