@nocobase/plugin-file-manager 1.8.14 → 1.8.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("react"),require("lodash"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager",["react-i18next","react","lodash","@formily/shared","@nocobase/client","@formily/react","@ant-design/icons","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager"]=t(require("react-i18next"),require("react"),require("lodash"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("antd")):e["@nocobase/plugin-file-manager"]=t(e["react-i18next"],e.react,e.lodash,e["@formily/shared"],e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e.antd)}(self,function(e,t,n,o,r,a,i,c){return function(){"use strict";var l={482:function(e){e.exports=i},505:function(e){e.exports=a},875:function(e){e.exports=o},772:function(e){e.exports=r},721:function(e){e.exports=c},467:function(e){e.exports=n},156:function(e){e.exports=t},238:function(t){t.exports=e}},u={};function s(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return l[e](n,n.exports,s),n.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return!function(){s.r(p),s.d(p,{PluginFileManagerClient:function(){return eh},default:function(){return ex}});var e,t,n,o={};s.r(o),s.d(o,{useAttachmentFieldProps:function(){return x},useFileCollectionStorageRules:function(){return v},useStorageRules:function(){return h},useUploadFiles:function(){return b}});var r=s(772),a=Number.POSITIVE_INFINITY,i=s(156),c=s.n(i);function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function u(){var e,t,n,o,a,c,l,u=(0,r.useCollectionField)(),s=(0,r.useCollectionManager)().getCollection(null==u?void 0:u.target),p=(0,r.useCollection)(),m=(0,r.usePlugin)(ex),f=(t=null!=(e=(null==u?void 0:u.storage)||(null==p?void 0:p.getOption("storage"))||(null==s?void 0:s.getOption("storage")))?e:"",n="storages:getBasicInfo/".concat(t),a=(o=(0,r.useRequest)({url:n},{manual:!0,refreshDeps:[t],cacheKey:n})).loading,c=o.data,l=o.run,(0,i.useEffect)(function(){l()},[l]),!a&&(null==c?void 0:c.data)||null),d=m.getStorageType(null==f?void 0:f.type);return{storage:f,storageType:d}}function m(e){var t=u(),n=t.storage,o=t.storageType,r=null==o?void 0:o.useUploadProps,a=(null==r?void 0:r(l({storage:n,rules:n.rules},e)))||{};return l({rules:null==n?void 0:n.rules},a)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function d(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return f(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 f(e,t)}}var b=function(){var e=(0,r.useDataBlockRequestGetter)().getDataBlockRequest,t=((0,r.useDataBlockProps)()||{}).association,n=(0,r.useActionContext)().setVisible,o=(0,r.useCollection)(),a=(0,r.useSourceId)(),c=(0,i.useMemo)(function(){var e="".concat(o.name,":create");if(t){var n,r=(n=t.split("."),function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}(n,2)||y(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=r[0],c=r[1];e="".concat(i,"/").concat(a,"/").concat(c,":create")}return e},[o.name,t,a]),l=((0,i.useContext)(r.RecordPickerContext)||{}).setSelectedRows,u={},s=0,p={action:c,onChange:function(t){t.forEach(function(n){if("uploading"!==n.status||u[n.uid]||(s++,u[n.uid]=!0),"uploading"!==n.status&&u[n.uid]&&(delete u[n.uid],0==--s)){var o,r;null==(r=e())||null==(o=r.refresh)||o.call(r),null==l||l(function(e){return d(e).concat(d(t.filter(function(e){return"done"===e.status}).map(function(e){return e.response.data})))})}}),t.every(function(e){return"done"===e.status})&&n(!1)}},f=m(p);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},p,f)},g=s(505);function h(e){var t,n=null!=e?e:"";(0,r.useAPIClient)();var o=(0,g.useField)(),a=(0,r.useRequest)({url:"storages:getBasicInfo/".concat(n)},{manual:!0,refreshDeps:[n],cacheKey:n}),c=a.loading,l=a.data,u=a.run;return(0,i.useEffect)(function(){"editable"===o.pattern&&u()},[o.pattern,u]),!c&&(null==l||null==(t=l.data)?void 0:t.rules)||null}function x(){var e=(0,r.useCollectionField)(),t="".concat(e.target,":create").concat(e.storage?"?attachmentField=".concat(e.collectionName,".").concat(e.name):""),n=m({action:t});return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({action:t},n)}function v(){var e=(0,r.useCollectionField)(),t=(0,r.useCollectionManager)().getCollection(null==e?void 0:e.target);return h(null==t?void 0:t.getOption("storage"))}var O=function(e){var t,n,o={type:"void","x-action":"create",title:"{{t('Upload')}}","x-designer":"Action.Designer","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",icon:"UploadOutlined"},properties:{drawer:{type:"void",title:'{{ t("Upload files") }}',"x-component":"Action.Container",properties:{upload:{type:"void",title:'{{ t("Upload files") }}',"x-component":"Upload.DraggerV2","x-use-component-props":"useUploadFiles","x-component-props":{height:"50vh",multiple:!0,listType:"picture"}}}}}};return c().createElement(r.ActionInitializerItem,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},e),n=n={schema:o},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))},S={dumpRules:{group:"user"},migrationRules:["schema-only","overwrite"],asStrategyResource:!0,shared:!0,name:"attachments",createdBy:!0,updatedBy:!0,template:"file",filterTargetKey:"id",fields:[{comment:"用户文件名(不含扩展名)",type:"string",name:"title"},{comment:"系统文件名(含扩展名)",type:"string",name:"filename"},{comment:"扩展名(含“.”)",type:"string",name:"extname"},{comment:"文件体积(字节)",type:"integer",name:"size"},{type:"string",name:"mimetype"},{type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,interface:"m2o",uiSchema:{type:"object",title:"Storage","x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"title"}},"x-read-pretty":!0}},{comment:"相对路径(含“/”前缀)",type:"text",name:"path"},{comment:"其他文件信息(如图片的宽高)",type:"jsonb",name:"meta",defaultValue:{}},{comment:"网络访问地址",type:"text",name:"url"}]},j=function(e){return c().createElement(r.ExtendCollectionsProvider,{collections:[S]},c().createElement(r.SchemaComponentOptions,{scope:o,components:{UploadActionInitializer:O}},e.children))},w=s(721),P=[{value:1,label:"Byte"},{value:1024,label:"KB"},{value:1048576,label:"MB"},{value:0x40000000,label:"GB"}];function A(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1048576,n=e||t,o=P.length-1;o>=0;o--){var r=P[o];if(n%r.value==0)return r}return P[0]}function C(e,t,n){return Math.min(Math.max(t,e),n)}function I(e){var t,n=e.value,o=e.defaultUnit,r=void 0===o?1048576:o,l=e.min,u=void 0===l?1:l,s=e.max,p=void 0===s?a:s,m=e.step,f=e.onChange,d=null!=(t=e.defaultValue)?t:0x1400000,y=A(d,r),b=d/y.value,g=A(null!=n?n:d,r),h=null==n?n:n/g.value,x=(0,i.useCallback)(function(e){null==f||f(C(null==e?e:e*g.value,u,p))},[g.value]),v=(0,i.useCallback)(function(e){null==f||f(C(h*e,u,p))},[h]);return c().createElement(w.Space.Compact,null,c().createElement(w.InputNumber,{value:h,onChange:x,defaultValue:"".concat(b),step:void 0===m?1:m}),c().createElement(w.Select,{options:P,value:g.value,onChange:v,className:"auto-width"}))}var F=s(482),T=s(875),E=s(467),D=s.n(E),k=s(238),R="file-manager",q={name:"storages",fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{t("Title")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Storage name", { ns: "'.concat(R,'" })}}'),descriptions:'{{t("Will be used for API", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Storage type", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"Select",required:!0,enum:"{{ storageTypeOptions }}"}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:'{{t("Base URL", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:'{{t("Path", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}},{type:"boolean",name:"paranoid",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}}]},_={type:"object",properties:(e={},t=(0,T.uid)(),n={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:q,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:q},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateStorage","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Default storage", { ns: "'.concat(R,'" })}}'),properties:{default:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditStorage","x-component-props":{type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{cm.useDestroyAction}}"}}}}}}}}}},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},M={title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",required:!0,default:'{{ useNewId("s_") }}',description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'},baseUrl:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t(\'Base URL for file access, could be your CDN base URL. For example: "https://cdn.nocobase.com".\', { ns: "'.concat(R,'" })}}')},path:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t(\'Relative path the file will be saved to. Left blank as root path. The leading and trailing slashes "/" will be ignored. For example: "user/avatar".\', { ns: "'.concat(R,'" })}}')},rules:{type:"object","x-component":"fieldset",properties:{size:{type:"number",title:'{{t("File size limit", { ns: "'.concat(R,'" })}}'),description:'{{t("Minimum from 1 byte, maximum up to 1GB.", { ns: "'.concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"FileSizeField",required:!0,default:0x1400000},mimetype:{type:"string",title:'{{t("File type (in MIME type format)", { ns: "'.concat(R,'" })}}'),description:'{{t(\'Multi-types seperated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.\', { ns: "'.concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"*"}}}},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default storage", { ns: "'.concat(R,'" })}}')},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Keep file in storage when destroy the file record", { ns: "'.concat(R,'" })}}'),description:'{{t("Files are only removed when their corresponding records in the file collection are deleted. If a record from another collection includes an associating field referencing the file collection, the file will not be deleted unless cascade deletion is enabled for that association.", { ns: "'.concat(R,'" })}}')}},B={title:'{{t("Aliyun OSS", { ns: "'.concat(R,'" })}}'),name:"ali-oss",fieldset:{title:M.title,name:M.name,baseUrl:M.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",description:'{{t(\'Aliyun OSS region part of the bucket. For example: "oss-cn-beijing".\', { ns: "'.concat(R,'" })}}'),required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:'{{t("AccessKey Secret", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},timeout:{title:'{{t("Timeout", { ns: "'.concat(R,'" })}}'),description:"{{t('Upload timeout for a single file in milliseconds. Default is 600000.', { ns: \"".concat(R,'" })}}'),type:"number","x-decorator":"FormItem","x-component":"InputNumber",default:6e5},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{placeholder:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90"},description:'{{ renderThumbnailRuleDesc("ali-oss") }}'}}},path:M.path,rules:M.rules,default:M.default,paranoid:M.paranoid},thumbnailRuleLink:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4"},U={local:{title:'{{t("Local storage", { ns: "'.concat(R,'" })}}'),name:"local",fieldset:{title:M.title,name:M.name,baseUrl:{"x-component":"CollectionField","x-decorator":"FormItem","x-display":"hidden",default:"/storage/uploads"},options:{type:"object","x-component":"div",properties:{documentRoot:{title:'{{t("Destination", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"Input","x-display":"hidden",default:"storage/uploads"}}},path:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{addonBefore:"storage/uploads/"}},rules:M.rules,default:M.default,paranoid:M.paranoid}},"ali-oss":B,s3:{title:'{{t("Amazon S3", { ns: "'.concat(R,'" })}}'),name:"s3",fieldset:{title:M.title,name:M.name,baseUrl:M.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:'{{t("AccessKey Secret", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:'{{t("Endpoint", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},path:M.path,rules:M.rules,default:M.default,paranoid:M.paranoid}},"tx-cos":{title:'{{t("Tencent COS", { ns: "'.concat(R,'" })}}'),name:"tx-cos",fieldset:{title:M.title,name:M.name,baseUrl:M.baseUrl,options:{type:"object","x-component":"fieldset",properties:{Region:{title:'{{t("Region", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:'{{t("SecretId", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:'{{t("SecretKey", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},Bucket:{title:'{{t("Bucket", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{placeholder:"?imageMogr2/thumbnail/!50p"},description:'{{ renderThumbnailRuleDesc("tx-cos") }}'}}},path:M.path,rules:M.rules,default:M.default,paranoid:M.paranoid},thumbnailRuleLink:"https://cloud.tencent.com/document/product/436/42214"}};function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}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 z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){G(e,t,n[t])})}return e}function N(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(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,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}(e,t)||L(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 V(e){return function(e){if(Array.isArray(e))return K(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){if(e){if("string"==typeof e)return K(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 K(e,t)}}var $=function(){var e=W((0,i.useState)({}),2),t=e[0],n=e[1],o=(0,r.usePlugin)(ex),a=(0,r.useCompile)(),l=W((0,i.useState)(!1),2),u=l[0],s=l[1],p=(0,k.useTranslation)().t;return c().createElement("div",null,c().createElement(r.ActionContext.Provider,{value:{visible:u,setVisible:s}},c().createElement(w.Dropdown,{menu:{onClick:function(e){var t=o.storageTypes.get(e.key);s(!0),n({type:"object",properties:G({},(0,T.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:t.name}},title:a("{{t('Add new')}}")+" - "+a(t.title),properties:N(z({},D().cloneDeep(t.fieldset)),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}})})})},items:V(o.storageTypes.values()).map(function(e){return{key:e.name,label:a(e.title)}})}},c().createElement(w.Button,{type:"primary",icon:c().createElement(F.PlusOutlined,null)},p("Add new")," ",c().createElement(F.DownOutlined,null))),c().createElement(r.SchemaComponent,{scope:{createOnly:!0},schema:t})))},Y=function(){var e=(0,r.useRecord)(),t=W((0,i.useState)({}),2),n=t[0],o=t[1],a=(0,r.usePlugin)(ex),l=(0,r.useCompile)(),u=W((0,i.useState)(!1),2),s=u[0],p=u[1],m=(0,k.useTranslation)().t;return c().createElement("div",null,c().createElement(r.ActionContext.Provider,{value:{visible:s,setVisible:p}},c().createElement("a",{onClick:function(){p(!0);var t=a.storageTypes.get(e.type);t.fieldset.default&&(t.fieldset.default["x-reactions"]=function(e){e.initialValue?e.disabled=!0:e.disabled=!1}),o({type:"object",properties:G({},(0,T.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:z({},e)},title:l("{{t('Edit')}}")+" - "+l(t.title),properties:N(z({},D().cloneDeep(t.fieldset)),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}})})})}},m("Edit")),c().createElement(r.SchemaComponent,{scope:{createOnly:!1},schema:n})))};function H(e){var t=U[e];return(null==t?void 0:t.thumbnailRule)?c().createElement("div",null,c().createElement("a",{target:"_blank",href:t.thumbnailRuleLink,rel:"noreferrer"},r.i18n.t("See more"))):null}var J=function(){var e=(0,r.useCompile)(),t=V((0,r.usePlugin)(ex).storageTypes.values()).map(function(t){return{value:t.name,label:e(t.title)}});return c().createElement(w.Card,{bordered:!1},c().createElement(r.SchemaComponent,{components:{CreateStorage:$,EditStorage:Y},scope:{useNewId:function(e){return"".concat(e).concat((0,T.uid)())},storageTypeOptions:t,renderThumbnailRuleDesc:H},schema:_}))};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 X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ee=function(){return!!e})()}var et=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,o,a,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=X(t),Q(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,ee()?Reflect.construct(t,o||[],X(this).constructor):t.apply(this,o)),"name","attachment"),Q(e,"type","object"),Q(e,"group","media"),Q(e,"title",'{{t("Attachment", { ns: "'.concat(R,'" })}}')),Q(e,"isAssociation",!0),Q(e,"default",{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-use-component-props":"useAttachmentFieldProps"}}),Q(e,"availableTypes",["belongsToMany"]),Q(e,"properties",(a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){Q(e,t,n[t])})}return e}({},r.interfacesProperties.defaultProps),i=i={"uiSchema.x-component-props.accept":{type:"string",title:'{{t("MIME type", { ns: "'.concat(R,'" })}}'),"x-component":"Input","x-component-props":{placeholder:"image/*"},"x-decorator":"FormItem",description:"Example: image/png"},"uiSchema.x-component-props.multiple":{type:"boolean","x-content":"{{t('Allow uploading multiple files', { ns: \"".concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:'{{t("Storage", { ns: "'.concat(R,'" })}}'),description:"{{t('Default storage will be used when not selected', { ns: \"".concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(i)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(i,e))}),a)),Q(e,"filterable",{children:[{name:"id",value:"id",title:'{{t("Exists")}}',label:'{{t("Exists")}}',operators:[{label:'{{t("exists")}}',value:"$exists",noValue:!0},{label:'{{t("not exists")}}',value:"$notExists",noValue:!0}],schema:{title:'{{t("Exists")}}',type:"string","x-component":"Input"}},{name:"filename",value:"filename",title:'{{t("Filename", { ns: "'.concat(R,'" })}}'),label:'{{t("Filename", { ns: "'.concat(R,'" })}}'),operators:r.interfacesProperties.operators.string,schema:{title:'{{t("Filename", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"Input"}}]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&Z(n,e),t=[{key:"schemaInitialize",value:function(e,t){var n=t.block;t.field,e["x-component-props"]||(e["x-component-props"]={}),["Table","Kanban"].includes(n)&&(e["x-component-props"].size="small"),e["x-use-component-props"]="useAttachmentFieldProps"}},{key:"initialize",value:function(e){e.through||(e.through="t_".concat((0,T.uid)())),e.foreignKey||(e.foreignKey="f_".concat((0,T.uid)())),e.otherKey||(e.otherKey="f_".concat((0,T.uid)())),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id")}}],function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,t),n}(r.CollectionFieldInterface);function en(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eo(e){return(eo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function er(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){en(e,t,n[t])})}return e}function ea(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ei(e,t){return(ei=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ec(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ec=function(){return!!e})()}var el=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n,o;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return n=t,o=arguments,n=eo(n),en(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,ec()?Reflect.construct(n,o||[],eo(this).constructor):n.apply(this,o)),"name","file"),en(e,"title",'{{t("File collection", { ns: "'.concat(R,'" })}}')),en(e,"order",3),en(e,"color","blue"),en(e,"default",{createdBy:!0,updatedBy:!0,fields:[{interface:"input",type:"string",name:"title",deletable:!1,uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"input",type:"string",name:"filename",deletable:!1,uiSchema:{type:"string",title:'{{t("File name", { ns: "'.concat(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:'{{t("Extension name", { ns: "'.concat(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:'{{t("Size", { ns: "'.concat(R,'" })}}'),"x-component":"InputNumber","x-read-pretty":!0,"x-component-props":{stringMode:!0,step:"0"}}},{interface:"input",type:"string",name:"mimetype",deletable:!1,uiSchema:{type:"string",title:'{{t("MIME type", { ns: "'.concat(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"text",name:"path",deletable:!1,uiSchema:{type:"string",title:'{{t("Path", { ns: "'.concat(R,'" })}}'),"x-component":"TextAreaWithGlobalScope","x-read-pretty":!0}},{interface:"url",type:"text",name:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("URL")}}',"x-component":"Input.URL","x-read-pretty":!0}},{interface:"url",type:"text",name:"preview",field:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("Preview", { ns: "'.concat(R,'" })}}'),"x-component":"Preview","x-read-pretty":!0}},{type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,interface:"m2o",uiSchema:{type:"object",title:'{{t("Storage", { ns: "'.concat(R,'" })}}'),"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"title"}},"x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]}),en(e,"presetFieldsDisabled",!0),en(e,"configurableProperties",er(ea(er(ea(er({},(0,r.getConfigurableProperties)("title","name")),{inherits:ea(er({},(0,r.getConfigurableProperties)("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),(0,r.getConfigurableProperties)("category","description")),{storage:{type:"string",name:"storage",title:'{{t("File storage", { ns: "'.concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}),(0,r.getConfigurableProperties)("presetFields"))),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ei(t,e),t}(r.CollectionTemplate);function eu(e,t,n,o,r,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(o,r)}function es(e){return function(){var t=this,n=arguments;return new Promise(function(o,r){var a=e.apply(t,n);function i(e){eu(a,o,r,i,c,"next",e)}function c(e){eu(a,o,r,i,c,"throw",e)}i(void 0)})}}function ep(e,t,n){return(ep=eb()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&ed(r,n.prototype),r}).apply(null,arguments)}function em(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ef(e){return(ef=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ed(e,t){return(ed=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ey(e){var t="function"==typeof Map?new Map:void 0;return(ey=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 ep(e,arguments,ef(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ed(n,e)})(e)}function eb(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eb=function(){return!!e})()}function eg(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&l[0]?o.return:l[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,l[1])).done)return r;switch(o=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,o=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){i.label=l[1];break}if(6===l[0]&&i.label<r[1]){i.label=r[1],r=l;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(l);break}r[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],o=0}finally{n=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var eh=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=ef(t),em(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,eb()?Reflect.construct(t,o||[],ef(this).constructor):t.apply(this,o)),"storageTypes",new Map),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&ed(n,e),t=[{key:"load",value:function(){var e=this;return es(function(){var t;return eg(this,function(n){return e.app.dataSourceManager.addFieldInterfaces([et]),e.app.dataSourceManager.addCollectionTemplates([el]),e.app.use(j),e.app.pluginSettingsManager.add(R,{title:'{{t("File manager", { ns: "'.concat(R,'" })}}'),icon:"FileOutlined",Component:J,aclSnippet:"pm.file-manager.storages"}),Object.values(U).forEach(function(t){e.registerStorageType(t.name,t)}),null==(t=e.app.schemaInitializerManager.get("table:configureActions"))||t.add("enableActions.upload",{title:"{{t('Upload')}}",Component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:function(){return"file"===(0,r.useCollection)().template}}),e.app.addScopes({useAttachmentFieldProps:x,useFileCollectionStorageRules:v,useStorageCfg:u}),e.app.addComponents({FileSizeField:I}),[2]})})()}},{key:"registerStorageType",value:function(e,t){this.storageTypes.set(e,t)}},{key:"getStorageType",value:function(e){return this.storageTypes.get(e)}},{key:"uploadFile",value:function(e){var t=this;return es(function(){var n,o,r;return eg(this,function(a){switch(a.label){case 0:if(!(null==(n=t.getStorageType(null==e?void 0:e.storageType))?void 0:n.upload))return[3,2];return[4,n.upload({file:e.file,apiClient:t.app.apiClient,storageType:e.storageType,storageId:e.storageId,storageRules:e.storageRules,fileCollectionName:e.fileCollectionName})];case 1:return[2,a.sent()];case 2:return a.trys.push([2,4,,5]),(r=new FormData).append("file",e.file),[4,t.app.apiClient.request({url:"".concat(e.fileCollectionName||"attachments",":create"),method:"post",data:r})];case 3:return[2,{data:null==(o=a.sent().data)?void 0:o.data}];case 4:return[2,{errorMessage:a.sent().message}];case 5:return[2]}})})()}}],function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,t),n}(ey(r.Plugin));em(eh,"buildInStorage",["local","ali-oss","s3","tx-cos"]);var ex=eh}(),p}()});
10
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react-i18next"),require("react"),require("lodash"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("antd")):"function"==typeof define&&define.amd?define("@nocobase/plugin-file-manager",["react-i18next","react","lodash","@formily/shared","@nocobase/client","@formily/react","@ant-design/icons","antd"],t):"object"==typeof exports?exports["@nocobase/plugin-file-manager"]=t(require("react-i18next"),require("react"),require("lodash"),require("@formily/shared"),require("@nocobase/client"),require("@formily/react"),require("@ant-design/icons"),require("antd")):e["@nocobase/plugin-file-manager"]=t(e["react-i18next"],e.react,e.lodash,e["@formily/shared"],e["@nocobase/client"],e["@formily/react"],e["@ant-design/icons"],e.antd)}(self,function(e,t,n,o,r,a,i,c){return function(){"use strict";var l={482:function(e){e.exports=i},505:function(e){e.exports=a},875:function(e){e.exports=o},772:function(e){e.exports=r},721:function(e){e.exports=c},467:function(e){e.exports=n},156:function(e){e.exports=t},238:function(t){t.exports=e}},u={};function s(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return l[e](n,n.exports,s),n.exports}s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var p={};return!function(){s.r(p),s.d(p,{PluginFileManagerClient:function(){return eh},default:function(){return ex}});var e,t,n,o={};s.r(o),s.d(o,{useAttachmentFieldProps:function(){return x},useFileCollectionStorageRules:function(){return v},useStorageRules:function(){return h},useUploadFiles:function(){return b}});var r=s(772),a=Number.POSITIVE_INFINITY,i=s(156),c=s.n(i);function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}function u(){var e,t,n,o,a,c,l,u=(0,r.useCollectionField)(),s=(0,r.useCollectionManager)().getCollection(null==u?void 0:u.target),p=(0,r.useCollection)(),m=(0,r.usePlugin)(ex),f=(t=null!=(e=(null==u?void 0:u.storage)||(null==p?void 0:p.getOption("storage"))||(null==s?void 0:s.getOption("storage")))?e:"",n="storages:getBasicInfo/".concat(t),a=(o=(0,r.useRequest)({url:n},{manual:!0,refreshDeps:[t],cacheKey:n})).loading,c=o.data,l=o.run,(0,i.useEffect)(function(){l()},[l]),!a&&(null==c?void 0:c.data)||null),d=m.getStorageType(null==f?void 0:f.type);return{storage:f,storageType:d}}function m(e){var t=u(),n=t.storage,o=t.storageType,r=null==o?void 0:o.useUploadProps,a=(null==r?void 0:r(l({storage:n,rules:n.rules},e)))||{};return l({rules:null==n?void 0:n.rules},a)}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function d(e){return function(e){if(Array.isArray(e))return f(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||y(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function y(e,t){if(e){if("string"==typeof e)return f(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 f(e,t)}}var b=function(){var e=(0,r.useDataBlockRequestGetter)().getDataBlockRequest,t=((0,r.useDataBlockProps)()||{}).association,n=(0,r.useActionContext)().setVisible,o=(0,r.useCollection)(),a=(0,r.useSourceId)(),c=(0,i.useMemo)(function(){var e="".concat(o.name,":create");if(t){var n,r=(n=t.split("."),function(e){if(Array.isArray(e))return e}(n)||function(e,t){var n,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}(n,2)||y(n,2)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),i=r[0],c=r[1];e="".concat(i,"/").concat(a,"/").concat(c,":create")}return e},[o.name,t,a]),l=((0,i.useContext)(r.RecordPickerContext)||{}).setSelectedRows,u={},s=0,p={action:c,onChange:function(t){t.forEach(function(n){if("uploading"!==n.status||u[n.uid]||(s++,u[n.uid]=!0),"uploading"!==n.status&&u[n.uid]&&(delete u[n.uid],0==--s)){var o,r;null==(r=e())||null==(o=r.refresh)||o.call(r),null==l||l(function(e){return d(e).concat(d(t.filter(function(e){return"done"===e.status}).map(function(e){return e.response.data})))})}}),t.every(function(e){return"done"===e.status})&&n(!1)}},f=m(p);return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},p,f)},g=s(505);function h(e){var t,n=null!=e?e:"";(0,r.useAPIClient)();var o=(0,g.useField)(),a=(0,r.useRequest)({url:"storages:getBasicInfo/".concat(n)},{manual:!0,refreshDeps:[n],cacheKey:n}),c=a.loading,l=a.data,u=a.run;return(0,i.useEffect)(function(){"editable"===o.pattern&&u()},[o.pattern,u]),!c&&(null==l||null==(t=l.data)?void 0:t.rules)||null}function x(){var e=(0,r.useCollectionField)(),t="".concat(e.target,":create").concat(e.storage?"?attachmentField=".concat(e.collectionName,".").concat(e.name):""),n=m({action:t});return function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({action:t},n)}function v(){var e=(0,r.useCollectionField)(),t=(0,r.useCollectionManager)().getCollection(null==e?void 0:e.target);return h(null==t?void 0:t.getOption("storage"))}var O=function(e){var t,n,o={type:"void","x-action":"create",title:"{{t('Upload')}}","x-designer":"Action.Designer","x-component":"Action","x-decorator":"ACLActionProvider","x-component-props":{openMode:"drawer",type:"primary",icon:"UploadOutlined"},properties:{drawer:{type:"void",title:'{{ t("Upload files") }}',"x-component":"Action.Container",properties:{upload:{type:"void",title:'{{ t("Upload files") }}',"x-component":"Upload.DraggerV2","x-use-component-props":"useUploadFiles","x-component-props":{height:"50vh",multiple:!0,listType:"picture"}}}}}};return c().createElement(r.ActionInitializerItem,(t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){var o;o=n[t],t in e?Object.defineProperty(e,t,{value:o,enumerable:!0,configurable:!0,writable:!0}):e[t]=o})}return e}({},e),n=n={schema:o},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t))},S={dumpRules:{group:"user"},migrationRules:["schema-only","overwrite"],asStrategyResource:!0,shared:!0,name:"attachments",createdBy:!0,updatedBy:!0,template:"file",filterTargetKey:"id",fields:[{comment:"用户文件名(不含扩展名)",type:"string",name:"title"},{comment:"系统文件名(含扩展名)",type:"string",name:"filename"},{comment:"扩展名(含“.”)",type:"string",name:"extname"},{comment:"文件体积(字节)",type:"integer",name:"size"},{type:"string",name:"mimetype"},{type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,interface:"m2o",uiSchema:{type:"object",title:"{{t('Storage', { ns: '".concat("file-manager","' })}}"),"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"title"}},"x-read-pretty":!0}},{comment:"相对路径(含“/”前缀)",type:"text",name:"path"},{comment:"其他文件信息(如图片的宽高)",type:"jsonb",name:"meta",defaultValue:{}},{comment:"网络访问地址",type:"text",name:"url"}]},j=function(e){return c().createElement(r.ExtendCollectionsProvider,{collections:[S]},c().createElement(r.SchemaComponentOptions,{scope:o,components:{UploadActionInitializer:O}},e.children))},w=s(721),P=[{value:1,label:"Byte"},{value:1024,label:"KB"},{value:1048576,label:"MB"},{value:0x40000000,label:"GB"}];function A(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1048576,n=e||t,o=P.length-1;o>=0;o--){var r=P[o];if(n%r.value==0)return r}return P[0]}function C(e,t,n){return Math.min(Math.max(t,e),n)}function I(e){var t,n=e.value,o=e.defaultUnit,r=void 0===o?1048576:o,l=e.min,u=void 0===l?1:l,s=e.max,p=void 0===s?a:s,m=e.step,f=e.onChange,d=null!=(t=e.defaultValue)?t:0x1400000,y=A(d,r),b=d/y.value,g=A(null!=n?n:d,r),h=null==n?n:n/g.value,x=(0,i.useCallback)(function(e){null==f||f(C(null==e?e:e*g.value,u,p))},[g.value]),v=(0,i.useCallback)(function(e){null==f||f(C(h*e,u,p))},[h]);return c().createElement(w.Space.Compact,null,c().createElement(w.InputNumber,{value:h,onChange:x,defaultValue:"".concat(b),step:void 0===m?1:m}),c().createElement(w.Select,{options:P,value:g.value,onChange:v,className:"auto-width"}))}var F=s(482),T=s(875),E=s(467),D=s.n(E),k=s(238),R="file-manager",q={name:"storages",fields:[{type:"integer",name:"title",interface:"input",uiSchema:{title:'{{t("Title")}}',type:"string","x-component":"Input",required:!0}},{type:"string",name:"name",interface:"input",uiSchema:{title:'{{t("Storage name", { ns: "'.concat(R,'" })}}'),descriptions:'{{t("Will be used for API", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:'{{t("Storage type", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"Select",required:!0,enum:"{{ storageTypeOptions }}"}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:'{{t("Base URL", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:'{{t("Path", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"TextAreaWithGlobalScope"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}},{type:"boolean",name:"paranoid",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}}]},_={type:"object",properties:(e={},t=(0,T.uid)(),n={type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:q,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider_deprecated","x-component-props":{collection:q},properties:{actions:{type:"void","x-component":"ActionBar","x-component-props":{style:{marginBottom:16}},properties:{delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action","x-component-props":{icon:"DeleteOutlined",useAction:"{{ cm.useBulkDestroyAction }}",confirm:{title:"{{t('Delete')}}",content:"{{t('Are you sure you want to delete it?')}}"}}},create:{type:"void",title:'{{t("Add new")}}',"x-component":"CreateStorage","x-component-props":{type:"primary"}}}},table:{type:"void","x-uid":"input","x-component":"Table.Void","x-component-props":{rowKey:"id",rowSelection:{type:"checkbox"},useDataSource:"{{ cm.useDataSourceFromRAC }}"},properties:{title:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{title:{type:"number","x-component":"CollectionField","x-read-pretty":!0}}},name:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",properties:{name:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},default:{type:"void","x-decorator":"Table.Column.Decorator","x-component":"Table.Column",title:'{{t("Default storage", { ns: "'.concat(R,'" })}}'),properties:{default:{type:"string","x-component":"CollectionField","x-read-pretty":!0}}},actions:{type:"void",title:'{{t("Actions")}}',"x-component":"Table.Column",properties:{actions:{type:"void","x-component":"Space","x-component-props":{split:"|"},properties:{update:{type:"void",title:'{{t("Edit")}}',"x-component":"EditStorage","x-component-props":{type:"primary"}},delete:{type:"void",title:'{{ t("Delete") }}',"x-component":"Action.Link","x-component-props":{confirm:{title:'{{t("Delete")}}',content:'{{t("Are you sure you want to delete it?")}}'},useAction:"{{cm.useDestroyAction}}"}}}}}}}}}},t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e)},M={title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",required:!0,default:'{{ useNewId("s_") }}',description:'{{t("Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.")}}'},baseUrl:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t(\'Base URL for file access, could be your CDN base URL. For example: "https://cdn.nocobase.com".\', { ns: "'.concat(R,'" })}}')},path:{"x-component":"CollectionField","x-decorator":"FormItem",description:'{{t(\'Relative path the file will be saved to. Left blank as root path. The leading and trailing slashes "/" will be ignored. For example: "user/avatar".\', { ns: "'.concat(R,'" })}}')},rules:{type:"object","x-component":"fieldset",properties:{size:{type:"number",title:'{{t("File size limit", { ns: "'.concat(R,'" })}}'),description:'{{t("Minimum from 1 byte, maximum up to 1GB.", { ns: "'.concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"FileSizeField",required:!0,default:0x1400000},mimetype:{type:"string",title:'{{t("File type (in MIME type format)", { ns: "'.concat(R,'" })}}'),description:'{{t(\'Multi-types seperated with comma, for example: "image/*", "image/png", "image/*, application/pdf" etc.\', { ns: "'.concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"*"}}}},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Default storage", { ns: "'.concat(R,'" })}}')},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":'{{t("Keep file in storage when destroy the file record", { ns: "'.concat(R,'" })}}'),description:'{{t("Files are only removed when their corresponding records in the file collection are deleted. If a record from another collection includes an associating field referencing the file collection, the file will not be deleted unless cascade deletion is enabled for that association.", { ns: "'.concat(R,'" })}}')}},B={title:'{{t("Aliyun OSS", { ns: "'.concat(R,'" })}}'),name:"ali-oss",fieldset:{title:M.title,name:M.name,baseUrl:M.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",description:'{{t(\'Aliyun OSS region part of the bucket. For example: "oss-cn-beijing".\', { ns: "'.concat(R,'" })}}'),required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeySecret:{title:'{{t("AccessKey Secret", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},timeout:{title:'{{t("Timeout", { ns: "'.concat(R,'" })}}'),description:"{{t('Upload timeout for a single file in milliseconds. Default is 600000.', { ns: \"".concat(R,'" })}}'),type:"number","x-decorator":"FormItem","x-component":"InputNumber",default:6e5},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{placeholder:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90"},description:'{{ renderThumbnailRuleDesc("ali-oss") }}'}}},path:M.path,rules:M.rules,default:M.default,paranoid:M.paranoid},thumbnailRuleLink:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4"},U={local:{title:'{{t("Local storage", { ns: "'.concat(R,'" })}}'),name:"local",fieldset:{title:M.title,name:M.name,baseUrl:{"x-component":"CollectionField","x-decorator":"FormItem","x-display":"hidden",default:"/storage/uploads"},options:{type:"object","x-component":"div",properties:{documentRoot:{title:'{{t("Destination", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"Input","x-display":"hidden",default:"storage/uploads"}}},path:{"x-component":"CollectionField","x-decorator":"FormItem","x-component-props":{addonBefore:"storage/uploads/"}},rules:M.rules,default:M.default,paranoid:M.paranoid}},"ali-oss":B,s3:{title:'{{t("Amazon S3", { ns: "'.concat(R,'" })}}'),name:"s3",fieldset:{title:M.title,name:M.name,baseUrl:M.baseUrl,options:{type:"object","x-component":"fieldset",properties:{region:{title:'{{t("Region", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},accessKeyId:{title:'{{t("AccessKey ID", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},secretAccessKey:{title:'{{t("AccessKey Secret", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},bucket:{title:'{{t("Bucket", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},endpoint:{title:'{{t("Endpoint", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope"}}},path:M.path,rules:M.rules,default:M.default,paranoid:M.paranoid}},"tx-cos":{title:'{{t("Tencent COS", { ns: "'.concat(R,'" })}}'),name:"tx-cos",fieldset:{title:M.title,name:M.name,baseUrl:M.baseUrl,options:{type:"object","x-component":"fieldset",properties:{Region:{title:'{{t("Region", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretId:{title:'{{t("SecretId", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},SecretKey:{title:'{{t("SecretKey", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{password:!0},required:!0},Bucket:{title:'{{t("Bucket", { ns: "'.concat(R,'" })}}'),type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"TextAreaWithGlobalScope","x-component-props":{placeholder:"?imageMogr2/thumbnail/!50p"},description:'{{ renderThumbnailRuleDesc("tx-cos") }}'}}},path:M.path,rules:M.rules,default:M.default,paranoid:M.paranoid},thumbnailRuleLink:"https://cloud.tencent.com/document/product/436/42214"}};function K(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}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 z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){G(e,t,n[t])})}return e}function N(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(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,o,r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var a=[],i=!0,c=!1;try{for(r=r.call(e);!(i=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);i=!0);}catch(e){c=!0,o=e}finally{try{i||null==r.return||r.return()}finally{if(c)throw o}}return a}}(e,t)||L(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 V(e){return function(e){if(Array.isArray(e))return K(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){if(e){if("string"==typeof e)return K(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 K(e,t)}}var $=function(){var e=W((0,i.useState)({}),2),t=e[0],n=e[1],o=(0,r.usePlugin)(ex),a=(0,r.useCompile)(),l=W((0,i.useState)(!1),2),u=l[0],s=l[1],p=(0,k.useTranslation)().t;return c().createElement("div",null,c().createElement(r.ActionContext.Provider,{value:{visible:u,setVisible:s}},c().createElement(w.Dropdown,{menu:{onClick:function(e){var t=o.storageTypes.get(e.key);s(!0),n({type:"object",properties:G({},(0,T.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:t.name}},title:a("{{t('Add new')}}")+" - "+a(t.title),properties:N(z({},D().cloneDeep(t.fieldset)),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useCreateAction }}"}}}}})})})},items:V(o.storageTypes.values()).map(function(e){return{key:e.name,label:a(e.title)}})}},c().createElement(w.Button,{type:"primary",icon:c().createElement(F.PlusOutlined,null)},p("Add new")," ",c().createElement(F.DownOutlined,null))),c().createElement(r.SchemaComponent,{scope:{createOnly:!0},schema:t})))},Y=function(){var e=(0,r.useRecord)(),t=W((0,i.useState)({}),2),n=t[0],o=t[1],a=(0,r.usePlugin)(ex),l=(0,r.useCompile)(),u=W((0,i.useState)(!1),2),s=u[0],p=u[1],m=(0,k.useTranslation)().t;return c().createElement("div",null,c().createElement(r.ActionContext.Provider,{value:{visible:s,setVisible:p}},c().createElement("a",{onClick:function(){p(!0);var t=a.storageTypes.get(e.type);t.fieldset.default&&(t.fieldset.default["x-reactions"]=function(e){e.initialValue?e.disabled=!0:e.disabled=!1}),o({type:"object",properties:G({},(0,T.uid)(),{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:z({},e)},title:l("{{t('Edit')}}")+" - "+l(t.title),properties:N(z({},D().cloneDeep(t.fieldset)),{footer:{type:"void","x-component":"Action.Drawer.Footer",properties:{cancel:{title:'{{t("Cancel")}}',"x-component":"Action","x-component-props":{useAction:"{{ cm.useCancelAction }}"}},submit:{title:'{{t("Submit")}}',"x-component":"Action","x-component-props":{type:"primary",useAction:"{{ cm.useUpdateAction }}"}}}}})})})}},m("Edit")),c().createElement(r.SchemaComponent,{scope:{createOnly:!1},schema:n})))};function H(e){var t=U[e];return(null==t?void 0:t.thumbnailRule)?c().createElement("div",null,c().createElement("a",{target:"_blank",href:t.thumbnailRuleLink,rel:"noreferrer"},r.i18n.t("See more"))):null}var J=function(){var e=(0,r.useCompile)(),t=V((0,r.usePlugin)(ex).storageTypes.values()).map(function(t){return{value:t.name,label:e(t.title)}});return c().createElement(w.Card,{bordered:!1},c().createElement(r.SchemaComponent,{components:{CreateStorage:$,EditStorage:Y},scope:{useNewId:function(e){return"".concat(e).concat((0,T.uid)())},storageTypeOptions:t,renderThumbnailRuleDesc:H},schema:_}))};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 X(e){return(X=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Z(e,t){return(Z=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ee(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ee=function(){return!!e})()}var et=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,o,a,i;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=X(t),Q(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,ee()?Reflect.construct(t,o||[],X(this).constructor):t.apply(this,o)),"name","attachment"),Q(e,"type","object"),Q(e,"group","media"),Q(e,"title",'{{t("Attachment", { ns: "'.concat(R,'" })}}')),Q(e,"isAssociation",!0),Q(e,"default",{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-use-component-props":"useAttachmentFieldProps"}}),Q(e,"availableTypes",["belongsToMany"]),Q(e,"properties",(a=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){Q(e,t,n[t])})}return e}({},r.interfacesProperties.defaultProps),i=i={"uiSchema.x-component-props.accept":{type:"string",title:'{{t("MIME type", { ns: "'.concat(R,'" })}}'),"x-component":"Input","x-component-props":{placeholder:"image/*"},"x-decorator":"FormItem",description:"Example: image/png"},"uiSchema.x-component-props.multiple":{type:"boolean","x-content":"{{t('Allow uploading multiple files', { ns: \"".concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:'{{t("Storage", { ns: "'.concat(R,'" })}}'),description:"{{t('Default storage will be used when not selected', { ns: \"".concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}},Object.getOwnPropertyDescriptors?Object.defineProperties(a,Object.getOwnPropertyDescriptors(i)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(i)).forEach(function(e){Object.defineProperty(a,e,Object.getOwnPropertyDescriptor(i,e))}),a)),Q(e,"filterable",{children:[{name:"id",value:"id",title:'{{t("Exists")}}',label:'{{t("Exists")}}',operators:[{label:'{{t("exists")}}',value:"$exists",noValue:!0},{label:'{{t("not exists")}}',value:"$notExists",noValue:!0}],schema:{title:'{{t("Exists")}}',type:"string","x-component":"Input"}},{name:"filename",value:"filename",title:'{{t("Filename", { ns: "'.concat(R,'" })}}'),label:'{{t("Filename", { ns: "'.concat(R,'" })}}'),operators:r.interfacesProperties.operators.string,schema:{title:'{{t("Filename", { ns: "'.concat(R,'" })}}'),type:"string","x-component":"Input"}}]}),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&Z(n,e),t=[{key:"schemaInitialize",value:function(e,t){var n=t.block;t.field,e["x-component-props"]||(e["x-component-props"]={}),["Table","Kanban"].includes(n)&&(e["x-component-props"].size="small"),e["x-use-component-props"]="useAttachmentFieldProps"}},{key:"initialize",value:function(e){e.through||(e.through="t_".concat((0,T.uid)())),e.foreignKey||(e.foreignKey="f_".concat((0,T.uid)())),e.otherKey||(e.otherKey="f_".concat((0,T.uid)())),e.sourceKey||(e.sourceKey="id"),e.targetKey||(e.targetKey="id")}}],function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,t),n}(r.CollectionFieldInterface);function en(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function eo(e){return(eo=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function er(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},o=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),o.forEach(function(t){en(e,t,n[t])})}return e}function ea(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n.push.apply(n,o)}return n})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function ei(e,t){return(ei=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ec(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(ec=function(){return!!e})()}var el=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function t(){var e,n,o;if(!(this instanceof t))throw TypeError("Cannot call a class as a function");return n=t,o=arguments,n=eo(n),en(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,ec()?Reflect.construct(n,o||[],eo(this).constructor):n.apply(this,o)),"name","file"),en(e,"title",'{{t("File collection", { ns: "'.concat(R,'" })}}')),en(e,"order",3),en(e,"color","blue"),en(e,"default",{createdBy:!0,updatedBy:!0,fields:[{interface:"input",type:"string",name:"title",deletable:!1,uiSchema:{type:"string",title:'{{t("Title")}}',"x-component":"Input"}},{interface:"input",type:"string",name:"filename",deletable:!1,uiSchema:{type:"string",title:'{{t("File name", { ns: "'.concat(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:'{{t("Extension name", { ns: "'.concat(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:'{{t("Size", { ns: "'.concat(R,'" })}}'),"x-component":"InputNumber","x-read-pretty":!0,"x-component-props":{stringMode:!0,step:"0"}}},{interface:"input",type:"string",name:"mimetype",deletable:!1,uiSchema:{type:"string",title:'{{t("MIME type", { ns: "'.concat(R,'" })}}'),"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"text",name:"path",deletable:!1,uiSchema:{type:"string",title:'{{t("Path", { ns: "'.concat(R,'" })}}'),"x-component":"TextAreaWithGlobalScope","x-read-pretty":!0}},{interface:"url",type:"text",name:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("URL")}}',"x-component":"Input.URL","x-read-pretty":!0}},{interface:"url",type:"text",name:"preview",field:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("Preview", { ns: "'.concat(R,'" })}}'),"x-component":"Preview","x-read-pretty":!0}},{type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1,interface:"m2o",uiSchema:{type:"object",title:'{{t("Storage", { ns: "'.concat(R,'" })}}'),"x-component":"AssociationField","x-component-props":{fieldNames:{value:"id",label:"title"}},"x-read-pretty":!0}},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]}),en(e,"presetFieldsDisabled",!0),en(e,"configurableProperties",er(ea(er(ea(er({},(0,r.getConfigurableProperties)("title","name")),{inherits:ea(er({},(0,r.getConfigurableProperties)("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),(0,r.getConfigurableProperties)("category","description")),{storage:{type:"string",name:"storage",title:'{{t("File storage", { ns: "'.concat(R,'" })}}'),"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}),(0,r.getConfigurableProperties)("presetFields"))),e}return t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&ei(t,e),t}(r.CollectionTemplate);function eu(e,t,n,o,r,a,i){try{var c=e[a](i),l=c.value}catch(e){n(e);return}c.done?t(l):Promise.resolve(l).then(o,r)}function es(e){return function(){var t=this,n=arguments;return new Promise(function(o,r){var a=e.apply(t,n);function i(e){eu(a,o,r,i,c,"next",e)}function c(e){eu(a,o,r,i,c,"throw",e)}i(void 0)})}}function ep(e,t,n){return(ep=eb()?Reflect.construct:function(e,t,n){var o=[null];o.push.apply(o,t);var r=new(Function.bind.apply(e,o));return n&&ed(r,n.prototype),r}).apply(null,arguments)}function em(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ef(e){return(ef=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ed(e,t){return(ed=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function ey(e){var t="function"==typeof Map?new Map:void 0;return(ey=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 ep(e,arguments,ef(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ed(n,e)})(e)}function eb(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(eb=function(){return!!e})()}function eg(e,t){var n,o,r,a,i={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){var l=[a,c];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(r=2&l[0]?o.return:l[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,l[1])).done)return r;switch(o=0,r&&(l=[2&l[0],r.value]),l[0]){case 0:case 1:r=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,o=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(r=(r=i.trys).length>0&&r[r.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!r||l[1]>r[0]&&l[1]<r[3])){i.label=l[1];break}if(6===l[0]&&i.label<r[1]){i.label=r[1],r=l;break}if(r&&i.label<r[2]){i.label=r[2],i.ops.push(l);break}r[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],o=0}finally{n=r=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}var eh=function(e){var t;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,t,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return t=n,o=arguments,t=ef(t),em(e=function(e,t){var n;if(t&&("object"==((n=t)&&"undefined"!=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,eb()?Reflect.construct(t,o||[],ef(this).constructor):t.apply(this,o)),"storageTypes",new Map),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&ed(n,e),t=[{key:"load",value:function(){var e=this;return es(function(){var t;return eg(this,function(n){return e.app.dataSourceManager.addFieldInterfaces([et]),e.app.dataSourceManager.addCollectionTemplates([el]),e.app.use(j),e.app.pluginSettingsManager.add(R,{title:'{{t("File manager", { ns: "'.concat(R,'" })}}'),icon:"FileOutlined",Component:J,aclSnippet:"pm.file-manager.storages"}),Object.values(U).forEach(function(t){e.registerStorageType(t.name,t)}),null==(t=e.app.schemaInitializerManager.get("table:configureActions"))||t.add("enableActions.upload",{title:"{{t('Upload')}}",Component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},useVisible:function(){return"file"===(0,r.useCollection)().template}}),e.app.addScopes({useAttachmentFieldProps:x,useFileCollectionStorageRules:v,useStorageCfg:u}),e.app.addComponents({FileSizeField:I}),[2]})})()}},{key:"registerStorageType",value:function(e,t){this.storageTypes.set(e,t)}},{key:"getStorageType",value:function(e){return this.storageTypes.get(e)}},{key:"uploadFile",value:function(e){var t=this;return es(function(){var n,o,r;return eg(this,function(a){switch(a.label){case 0:if(!(null==(n=t.getStorageType(null==e?void 0:e.storageType))?void 0:n.upload))return[3,2];return[4,n.upload({file:e.file,apiClient:t.app.apiClient,storageType:e.storageType,storageId:e.storageId,storageRules:e.storageRules,fileCollectionName:e.fileCollectionName})];case 1:return[2,a.sent()];case 2:return a.trys.push([2,4,,5]),(r=new FormData).append("file",e.file),[4,t.app.apiClient.request({url:"".concat(e.fileCollectionName||"attachments",":create"),method:"post",data:r})];case 3:return[2,{data:null==(o=a.sent().data)?void 0:o.data}];case 4:return[2,{errorMessage:a.sent().message}];case 5:return[2]}})})()}}],function(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}(n.prototype,t),n}(ey(r.Plugin));em(eh,"buildInStorage",["local","ali-oss","s3","tx-cos"]);var ex=eh}(),p}()});
@@ -29,6 +29,7 @@ __export(attachments_exports, {
29
29
  default: () => attachments_default
30
30
  });
31
31
  module.exports = __toCommonJS(attachments_exports);
32
+ var import_constants = require("../constants");
32
33
  var attachments_default = {
33
34
  dumpRules: {
34
35
  group: "user"
@@ -81,7 +82,7 @@ var attachments_default = {
81
82
  interface: "m2o",
82
83
  uiSchema: {
83
84
  type: "object",
84
- title: "Storage",
85
+ title: `{{t('Storage', { ns: '${import_constants.NAMESPACE}' })}}`,
85
86
  "x-component": "AssociationField",
86
87
  "x-component-props": {
87
88
  fieldNames: {
@@ -6,4 +6,5 @@
6
6
  * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
+ export declare const NAMESPACE = "file-manager";
9
10
  export declare const INVALID_FILENAME_CHARS = "<>?*~\\/";
@@ -26,11 +26,14 @@ var __copyProps = (to, from, except, desc) => {
26
26
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
27
  var constants_exports = {};
28
28
  __export(constants_exports, {
29
- INVALID_FILENAME_CHARS: () => INVALID_FILENAME_CHARS
29
+ INVALID_FILENAME_CHARS: () => INVALID_FILENAME_CHARS,
30
+ NAMESPACE: () => NAMESPACE
30
31
  });
31
32
  module.exports = __toCommonJS(constants_exports);
33
+ const NAMESPACE = "file-manager";
32
34
  const INVALID_FILENAME_CHARS = "<>?*~\\/";
33
35
  // Annotate the CommonJS export names for ESM import in node:
34
36
  0 && (module.exports = {
35
- INVALID_FILENAME_CHARS
37
+ INVALID_FILENAME_CHARS,
38
+ NAMESPACE
36
39
  });
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.8.14",
11
+ "@nocobase/client": "1.8.15",
12
12
  "react": "18.2.0",
13
13
  "antd": "5.24.2",
14
14
  "@ant-design/icons": "5.6.1",
@@ -19,12 +19,12 @@ module.exports = {
19
19
  "@formily/core": "2.3.0",
20
20
  "@formily/react": "2.3.0",
21
21
  "multer": "1.4.5-lts.2",
22
- "@nocobase/database": "1.8.14",
23
- "@nocobase/server": "1.8.14",
24
- "@nocobase/utils": "1.8.14",
25
- "@nocobase/test": "1.8.14",
26
- "@nocobase/actions": "1.8.14",
22
+ "@nocobase/database": "1.8.15",
23
+ "@nocobase/server": "1.8.15",
24
+ "@nocobase/utils": "1.8.15",
25
+ "@nocobase/test": "1.8.15",
26
+ "@nocobase/actions": "1.8.15",
27
27
  "sequelize": "6.35.2",
28
- "@nocobase/plugin-data-source-main": "1.8.14",
28
+ "@nocobase/plugin-data-source-main": "1.8.15",
29
29
  "axios": "1.7.7"
30
30
  };
@@ -1 +1 @@
1
- {"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2025-08-05T01:19:27.456Z"}
1
+ {"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.750.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"node ../../scripts/compilation/inline client-s3","build:es":"tsc -p tsconfig.es.json","build:include:deps":"lerna run --scope $npm_package_name --include-dependencies build","build:types":"tsc -p tsconfig.types.json","build:types:downlevel":"downlevel-dts dist-types dist-types/ts3.4","clean":"rimraf ./dist-* && rimraf *.tsbuildinfo","extract:docs":"api-extractor run --local","generate:client":"node ../../scripts/generate-clients/single-service --solo s3","test":"yarn g:vitest run","test:browser":"node ./test/browser-build/esbuild && yarn g:vitest run -c vitest.config.browser.ts","test:browser:watch":"node ./test/browser-build/esbuild && yarn g:vitest watch -c vitest.config.browser.ts","test:e2e":"yarn g:vitest run -c vitest.config.e2e.ts && yarn test:browser","test:e2e:watch":"yarn g:vitest watch -c vitest.config.e2e.ts","test:watch":"yarn g:vitest watch"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"5.2.0","@aws-crypto/sha256-browser":"5.2.0","@aws-crypto/sha256-js":"5.2.0","@aws-sdk/core":"3.750.0","@aws-sdk/credential-provider-node":"3.750.0","@aws-sdk/middleware-bucket-endpoint":"3.734.0","@aws-sdk/middleware-expect-continue":"3.734.0","@aws-sdk/middleware-flexible-checksums":"3.750.0","@aws-sdk/middleware-host-header":"3.734.0","@aws-sdk/middleware-location-constraint":"3.734.0","@aws-sdk/middleware-logger":"3.734.0","@aws-sdk/middleware-recursion-detection":"3.734.0","@aws-sdk/middleware-sdk-s3":"3.750.0","@aws-sdk/middleware-ssec":"3.734.0","@aws-sdk/middleware-user-agent":"3.750.0","@aws-sdk/region-config-resolver":"3.734.0","@aws-sdk/signature-v4-multi-region":"3.750.0","@aws-sdk/types":"3.734.0","@aws-sdk/util-endpoints":"3.743.0","@aws-sdk/util-user-agent-browser":"3.734.0","@aws-sdk/util-user-agent-node":"3.750.0","@aws-sdk/xml-builder":"3.734.0","@smithy/config-resolver":"^4.0.1","@smithy/core":"^3.1.4","@smithy/eventstream-serde-browser":"^4.0.1","@smithy/eventstream-serde-config-resolver":"^4.0.1","@smithy/eventstream-serde-node":"^4.0.1","@smithy/fetch-http-handler":"^5.0.1","@smithy/hash-blob-browser":"^4.0.1","@smithy/hash-node":"^4.0.1","@smithy/hash-stream-node":"^4.0.1","@smithy/invalid-dependency":"^4.0.1","@smithy/md5-js":"^4.0.1","@smithy/middleware-content-length":"^4.0.1","@smithy/middleware-endpoint":"^4.0.5","@smithy/middleware-retry":"^4.0.6","@smithy/middleware-serde":"^4.0.2","@smithy/middleware-stack":"^4.0.1","@smithy/node-config-provider":"^4.0.1","@smithy/node-http-handler":"^4.0.2","@smithy/protocol-http":"^5.0.1","@smithy/smithy-client":"^4.1.5","@smithy/types":"^4.1.0","@smithy/url-parser":"^4.0.1","@smithy/util-base64":"^4.0.0","@smithy/util-body-length-browser":"^4.0.0","@smithy/util-body-length-node":"^4.0.0","@smithy/util-defaults-mode-browser":"^4.0.6","@smithy/util-defaults-mode-node":"^4.0.6","@smithy/util-endpoints":"^3.0.1","@smithy/util-middleware":"^4.0.1","@smithy/util-retry":"^4.0.1","@smithy/util-stream":"^4.1.1","@smithy/util-utf8":"^4.0.0","@smithy/util-waiter":"^4.0.2","tslib":"^2.6.2"},"devDependencies":{"@aws-sdk/signature-v4-crt":"3.750.0","@tsconfig/node18":"18.2.4","@types/node":"^18.19.69","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typescript":"~5.2.2"},"engines":{"node":">=18.0.0"},"typesVersions":{"<4.0":{"dist-types/*":["dist-types/ts3.4/*"]}},"files":["dist-*/**"],"author":{"name":"AWS SDK for JavaScript Team","url":"https://aws.amazon.com/javascript/"},"license":"Apache-2.0","browser":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.browser"},"react-native":{"./dist-es/runtimeConfig":"./dist-es/runtimeConfig.native"},"homepage":"https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-s3","repository":{"type":"git","url":"https://github.com/aws/aws-sdk-js-v3.git","directory":"clients/client-s3"},"_lastModified":"2025-08-11T16:30:19.760Z"}
@@ -1 +1 @@
1
- {"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2025-08-05T01:19:21.132Z"}
1
+ {"name":"mime-match","version":"1.0.2","description":"A simple function to check whether a mimetype matches the specified mimetype (with wildcard support)","main":"index.js","scripts":{"test":"node test.js","gendocs":"gendocs > README.md"},"repository":{"type":"git","url":"https://github.com/DamonOehlman/mime-match.git"},"keywords":["mime","wildcard"],"author":"Damon Oehlman <damon.oehlman@gmail.com>","license":"ISC","bugs":{"url":"https://github.com/DamonOehlman/mime-match/issues"},"homepage":"https://github.com/DamonOehlman/mime-match","dependencies":{"wildcard":"^1.1.0"},"devDependencies":{"tape":"^4.5.1"},"_lastModified":"2025-08-11T16:30:13.720Z"}
@@ -1 +1 @@
1
- {"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2025-08-05T01:19:21.440Z"}
1
+ {"name":"mime-types","description":"The ultimate javascript content-type utility.","version":"3.0.1","contributors":["Douglas Christopher Wilson <doug@somethingdoug.com>","Jeremiah Senkpiel <fishrock123@rocketmail.com> (https://searchbeam.jit.su)","Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)"],"license":"MIT","keywords":["mime","types"],"repository":"jshttp/mime-types","dependencies":{"mime-db":"^1.54.0"},"devDependencies":{"eslint":"8.33.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.27.5","eslint-plugin-markdown":"3.0.0","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"6.1.1","eslint-plugin-standard":"4.1.0","mocha":"10.2.0","nyc":"15.1.0"},"files":["HISTORY.md","LICENSE","index.js","mimeScore.js"],"engines":{"node":">= 0.6"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec test/test.js","test-ci":"nyc --reporter=lcov --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"_lastModified":"2025-08-11T16:30:14.022Z"}
@@ -1 +1 @@
1
- {"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2025-08-05T01:19:26.153Z"}
1
+ {"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"0.5.6","publishConfig":{"tag":"legacy"},"author":"James Halliday <mail@substack.net> (http://substack.net)","main":"index.js","keywords":["mkdir","directory"],"repository":{"type":"git","url":"https://github.com/substack/node-mkdirp.git"},"scripts":{"test":"tap test/*.js"},"dependencies":{"minimist":"^1.2.6"},"devDependencies":{"tap":"^16.0.1"},"bin":"bin/cmd.js","license":"MIT","files":["bin","index.js"],"_lastModified":"2025-08-11T16:30:18.469Z"}
@@ -1 +1 @@
1
- {"name":"multer-aliyun-oss","version":"2.1.3","description":"Multer Storage for AliYun OSS","main":"index.js","scripts":{},"author":"AngusYoung","license":"ISC","repository":{"type":"git","url":"git+https://github.com/ay86/multer-aliyun-oss.git"},"keywords":["multer","storage","aliyun","oss"],"dependencies":{"ali-oss":"^6.1.0"},"_lastModified":"2025-08-05T01:19:26.074Z"}
1
+ {"name":"multer-aliyun-oss","version":"2.1.3","description":"Multer Storage for AliYun OSS","main":"index.js","scripts":{},"author":"AngusYoung","license":"ISC","repository":{"type":"git","url":"git+https://github.com/ay86/multer-aliyun-oss.git"},"keywords":["multer","storage","aliyun","oss"],"dependencies":{"ali-oss":"^6.1.0"},"_lastModified":"2025-08-11T16:30:18.387Z"}
@@ -1 +1 @@
1
- {"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-08-05T01:19:32.644Z"}
1
+ {"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-08-11T16:30:24.999Z"}
@@ -1 +1 @@
1
- {"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2025-08-05T01:19:29.071Z"}
1
+ {"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2025-08-11T16:30:21.458Z"}
@@ -1 +1 @@
1
- {"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2025-08-05T01:19:21.217Z"}
1
+ {"name":"url-join","version":"4.0.1","description":"Join urls and normalize as in path.join.","main":"lib/url-join.js","scripts":{"test":"mocha --require should"},"repository":{"type":"git","url":"git://github.com/jfromaniello/url-join.git"},"keywords":["url","join"],"author":"José F. Romaniello <jfromaniello@gmail.com> (http://joseoncode.com)","license":"MIT","devDependencies":{"conventional-changelog":"^1.1.10","mocha":"^3.2.0","should":"~1.2.1"},"_lastModified":"2025-08-11T16:30:13.806Z"}
@@ -0,0 +1,14 @@
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
+ import { Migration } from '@nocobase/server';
10
+ export default class extends Migration {
11
+ on: string;
12
+ appVersion: string;
13
+ up(): Promise<void>;
14
+ }
@@ -0,0 +1,78 @@
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 add_storage_id_exports = {};
28
+ __export(add_storage_id_exports, {
29
+ default: () => add_storage_id_default
30
+ });
31
+ module.exports = __toCommonJS(add_storage_id_exports);
32
+ var import_server = require("@nocobase/server");
33
+ var import_database = require("@nocobase/database");
34
+ class add_storage_id_default extends import_server.Migration {
35
+ on = "afterLoad";
36
+ // 'beforeLoad' or 'afterLoad'
37
+ appVersion = "<1.9.0";
38
+ async up() {
39
+ const CollectionRepo = this.db.getRepository("collections");
40
+ const FieldRepo = this.db.getRepository("fields");
41
+ await CollectionRepo.load({
42
+ filter: {
43
+ "options.template": "file"
44
+ }
45
+ });
46
+ const collections = Array.from(this.db.collections.values()).filter(
47
+ (item) => item.name === "attachments" || item.options.template === "file"
48
+ );
49
+ await this.db.sequelize.transaction(async (transaction) => {
50
+ const toAddFields = [];
51
+ for (const collection of collections) {
52
+ if (collection instanceof import_database.InheritedCollection) {
53
+ continue;
54
+ }
55
+ const exist = await FieldRepo.findOne({
56
+ filter: {
57
+ collectionName: collection.name,
58
+ name: "storageId"
59
+ },
60
+ transaction
61
+ });
62
+ if (!exist) {
63
+ toAddFields.push({
64
+ collectionName: collection.name,
65
+ name: "storageId",
66
+ type: "bigInt",
67
+ required: true,
68
+ visible: true,
69
+ index: true
70
+ });
71
+ }
72
+ }
73
+ if (toAddFields.length) {
74
+ await FieldRepo.create({ values: toAddFields, transaction });
75
+ }
76
+ });
77
+ }
78
+ }
@@ -230,6 +230,17 @@ class PluginFileManagerServer extends import_server.Plugin {
230
230
  await this.loadStorages({ transaction });
231
231
  this.sendSyncMessage({ type: "reloadStorages" }, { transaction });
232
232
  });
233
+ this.db.on("afterDefineCollection", (collection) => {
234
+ const { template } = collection.options;
235
+ if (template === "file") {
236
+ collection.setField("storageId", {
237
+ type: "bigInt",
238
+ createOnly: true,
239
+ visible: true,
240
+ index: true
241
+ });
242
+ }
243
+ });
233
244
  this.app.acl.registerSnippet({
234
245
  name: `pm.${this.name}.storages`,
235
246
  actions: ["storages:*"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-file-manager",
3
- "version": "1.8.14",
3
+ "version": "1.8.15",
4
4
  "displayName": "File manager",
5
5
  "displayName.zh-CN": "文件管理器",
6
6
  "description": "Provides files storage services with files collection template and attachment field.",
@@ -51,5 +51,5 @@
51
51
  "Collections",
52
52
  "Collection fields"
53
53
  ],
54
- "gitHead": "16a9193a22b9a5c5ebb588727153583da8edb92e"
54
+ "gitHead": "6cbf5a6ef2023ebaedce11c60351df858d4832b2"
55
55
  }