@nocobase/plugin-file-manager 0.14.0-alpha.7 → 0.14.0-alpha.8

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.
@@ -1,2 +1,4 @@
1
1
  import React from 'react';
2
+ export declare const CreateStorage: () => React.JSX.Element;
3
+ export declare const EditStorage: () => React.JSX.Element;
2
4
  export declare const FileStoragePane: () => React.JSX.Element;
@@ -1,5 +1,7 @@
1
1
  import { Plugin } from '@nocobase/client';
2
2
  export declare class FileManagerPlugin extends Plugin {
3
+ storageTypes: Map<any, any>;
3
4
  load(): Promise<void>;
5
+ registerStorageType(name: string, options: any): void;
4
6
  }
5
7
  export default FileManagerPlugin;
@@ -1 +1 @@
1
- (function(n,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@nocobase/utils/client"),require("react"),require("antd"),require("@formily/antd-v5"),require("@formily/react"),require("react-i18next"),require("@formily/shared")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@nocobase/utils/client","react","antd","@formily/antd-v5","@formily/react","react-i18next","@formily/shared"],t):(n=typeof globalThis!="undefined"?globalThis:n||self,t(n["@nocobase/plugin-file-manager"]={},n["@nocobase/client"],n.jsxRuntime,n["@nocobase/utils"],n.react,n.antd,n["@formily/antd-v5"],n["@formily/react"],n["react-i18next"],n["@formily/shared"]))})(this,function(n,t,r,b,u,f,h,s,p,c){"use strict";var B=Object.defineProperty,L=Object.defineProperties;var R=Object.getOwnPropertyDescriptors;var P=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable;var T=(n,t,r)=>t in n?B(n,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):n[t]=r,x=(n,t)=>{for(var r in t||(t={}))V.call(t,r)&&T(n,r,t[r]);if(P)for(var r of P(t))N.call(t,r)&&T(n,r,t[r]);return n},y=(n,t)=>L(n,R(t));var q=(n,t,r)=>new Promise((b,u)=>{var f=p=>{try{s(r.next(p))}catch(c){u(c)}},h=p=>{try{s(r.throw(p))}catch(c){u(c)}},s=p=>p.done?b(p.value):Promise.resolve(p.value).then(f,h);s((r=r.apply(n,t)).next())});const e="file-manager";function w(){return p.useTranslation(e)}const D={local:{properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",default:"storage/uploads"}}},"ali-oss":{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},"tx-cos":{properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},s3:{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}}},K=s.observer(o=>{const i=s.useForm(),a=s.useField(),[l,m]=u.useState(new s.Schema({}));return u.useEffect(()=>{m(new s.Schema(D[i.values.type]||{}))},[i.values.type]),r.jsx(h.FormLayout,{layout:"vertical",children:r.jsx(s.RecursionField,{basePath:a.address,onlyRenderProperties:!0,schema:l},i.values.type||"local")})},{displayName:"StorageOptions"}),A={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: "${e}" })}}`,descriptions:`{{t("Will be used for API", { ns: "${e}" })}}`,type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Storage type", { ns: "${e}" })}}`,type:"string","x-component":"Select",required:!0,enum:[{label:`{{t("Local storage", { ns: "${e}" })}}`,value:"local"},{label:`{{t("Aliyun OSS", { ns: "${e}" })}}`,value:"ali-oss"},{label:`{{t("Amazon S3", { ns: "${e}" })}}`,value:"s3"},{label:`{{t("Tencent COS", { ns: "${e}" })}}`,value:"tx-cos"}]}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:`{{t("Storage base URL", { ns: "${e}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:`{{t("Path", { ns: "${e}" })}}`,type:"string","x-component":"Input"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{title:`{{t("Default storage", { ns: "${e}" })}}`,type:"boolean","x-component":"Checkbox"}},{type:"boolean",name:"paranoid",interface:"boolean",uiSchema:{title:`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`,type:"boolean","x-component":"Checkbox"}}]},U={type:"object",properties:{[c.uid()]:{type:"void","x-decorator":"ResourceActionProvider","x-decorator-props":{collection:A,resourceName:"storages",request:{resource:"storages",action:"list",params:{pageSize:50,sort:["id"],appends:[]}}},"x-component":"CollectionProvider","x-component-props":{collection:A},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":{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":"Action","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues(o){const i=t.useActionContext();return t.useRequest(()=>Promise.resolve({data:{name:`s_${c.uid()}`}}),y(x({},o),{refreshDeps:[i.visible]}))}},title:'{{t("Add new")}}',properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem",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"},type:{"x-component":"CollectionField","x-decorator":"FormItem"},options:{type:"object","x-component":"StorageOptions"},path:{"x-component":"CollectionField","x-decorator":"FormItem"},default:{"x-component":"CollectionField","x-decorator":"FormItem",title:"","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{title:"","x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`},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 }}"}}}}}}}}}},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",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":"Action.Link","x-component-props":{type:"primary"},properties:{drawer:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{useValues:"{{ cm.useValuesFromRecord }}"},title:'{{t("Edit")}}',properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},baseUrl:{"x-component":"CollectionField","x-decorator":"FormItem"},type:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":!0},options:{type:"object","x-component":"StorageOptions"},path:{"x-component":"CollectionField","x-decorator":"FormItem"},default:{title:"","x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{title:"","x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`},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 }}"}}}}}}}},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}}"}}}}}}}}}}}},z=()=>r.jsx(f.Card,{bordered:!1,children:r.jsx(t.SchemaComponent,{components:{StorageOptions:K},schema:U})}),I=1024*1024*1024,M=Object.freeze(Object.defineProperty({__proto__:null,FILE_LIMIT_SIZE:I,useUploadFiles:()=>{const{service:o}=t.useBlockRequestContext(),{t:i}=w(),{setVisible:a}=t.useActionContext(),{setSelectedRows:l}=u.useContext(t.RecordPickerContext)||{},m={};let $=0;return{beforeUpload(g){return g.size>I?(f.notification.error({message:`${i("File size cannot exceed")} ${I/1024/1024}M`}),g.status="error",!1):!0},onChange(g){g.forEach(d=>{var v;d.status==="uploading"&&!m[d.uid]&&($++,m[d.uid]=!0),d.status!=="uploading"&&m[d.uid]&&(delete m[d.uid],--$===0&&((v=o==null?void 0:o.refresh)==null||v.call(o),l==null||l(O=>[...O,...g.filter(S=>S.status==="done").map(S=>S.response.data)])))}),g.every(d=>d.status==="done")&&a(!1)}}}},Symbol.toStringTag,{value:"Module"})),_=Object.freeze(Object.defineProperty({__proto__:null,UploadActionInitializer:o=>{const i=t.useCollection(),a={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-component-props":{height:"50vh",action:`${i.name}:create`,useProps:"{{useUploadFiles}}",multiple:!0,listType:"picture"}}}}}};return r.jsx(t.ActionInitializer,y(x({},o),{schema:a}))}},Symbol.toStringTag,{value:"Module"})),F={name:"attachment",type:"object",group:"media",title:`{{t("Attachment", { ns: "${e}" })}}`,isAssociation:!0,default:{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-component-props":{}}},availableTypes:["belongsToMany"],schemaInitialize(o,{block:i,field:a}){["Table","Kanban"].includes(i)&&(o["x-component-props"]=o["x-component-props"]||{},o["x-component-props"].size="small"),o["x-component-props"]||(o["x-component-props"]={}),o["x-component-props"].action=`${a.target}:create${a.storage?`?attachmentField=${a.collectionName}.${a.name}`:""}`},initialize:o=>{o.through||(o.through=`t_${c.uid()}`),o.foreignKey||(o.foreignKey=`f_${c.uid()}`),o.otherKey||(o.otherKey=`f_${c.uid()}`),o.sourceKey||(o.sourceKey="id"),o.targetKey||(o.targetKey="id")},properties:y(x({},t.interfacesProperties.defaultProps),{"uiSchema.x-component-props.accept":{type:"string",title:`{{t("MIME type", { ns: "${e}" })}}`,"x-component":"Input","x-decorator":"FormItem",description:"Example: image/png",default:"image/*"},"uiSchema.x-component-props.multiple":{type:"boolean","x-content":`{{t('Allow uploading multiple files', { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:`{{t("Storage", { ns: "${e}" })}}`,description:`{{t('Default storage will be used when not selected', { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}),filterable:{children:[{name:"id",title:'{{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",title:`{{t("Filename", { ns: "${e}" })}}`,operators:t.interfacesProperties.operators.string,schema:{title:`{{t("Filename", { ns: "${e}" })}}`,type:"string","x-component":"Input"}}]}},k={name:"file",title:`{{t("File collection", { ns: "${e}" })}}`,order:3,color:"blue",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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:`{{t("Extension name", { ns: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:`{{t("Size", { ns: "${e}" })}}`,"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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"path",deletable:!1,uiSchema:{type:"string",title:'{{t("Path")}}',"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("URL")}}',"x-component":"Input.URL","x-read-pretty":!0}},{interface:"url",type:"string",name:"preview",field:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("Preview")}}',"x-component":"Preview","x-read-pretty":!0}},{comment:"存储引擎",type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]},configurableProperties:y(x(y(x({},t.getConfigurableProperties("title","name")),{inherits:y(x({},t.getConfigurableProperties("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),t.getConfigurableProperties("category","description")),{storage:{title:`{{t("File storage", { ns: "${e}" })}}`,type:"hasOne",name:"storage",required:!0,"x-decorator":"FormItem","x-component":"Select","x-reactions":["{{useAsyncDataSource(loadStorages)}}"]}})},j=Object.freeze(Object.defineProperty({__proto__:null,file:k},Symbol.toStringTag,{value:"Module"}));b.forEach(j,(o,i)=>{t.registerTemplate(i,o)}),t.registerField(F.group,"attachment",F);const E=o=>{const i=u.useContext(t.SchemaInitializerContext);!i.TableActionInitializers.items[0].children.some(m=>m.component==="UploadActionInitializer")&&i.TableActionInitializers.items[0].children.push({type:"item",title:"{{t('Upload')}}",component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},visible:()=>t.useCollection().template==="file"});const l=u.useContext(t.PluginManagerContext);return r.jsx(t.SettingsCenterProvider,{settings:{"file-manager":{title:`{{t("File manager", { ns: "${e}" })}}`,icon:"FileOutlined",tabs:{storages:{title:`{{t("File storage", { ns: "${e}" })}}`,component:z}}}},children:r.jsx(t.PluginManagerContext.Provider,{value:{components:x({},l==null?void 0:l.components)},children:r.jsx(t.CollectionManagerProvider,{interfaces:{attachment:F},children:r.jsx(t.SchemaComponentOptions,{scope:M,children:r.jsx(t.SchemaInitializerProvider,{components:_,children:o.children})})})})})};class C extends t.Plugin{load(){return q(this,null,function*(){this.app.use(E)})}}n.FileManagerPlugin=C,n.default=C,Object.defineProperties(n,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(r,t){typeof exports=="object"&&typeof module!="undefined"?t(exports,require("@nocobase/client"),require("react/jsx-runtime"),require("@nocobase/utils/client"),require("react"),require("@ant-design/icons"),require("@formily/shared"),require("antd"),require("lodash"),require("react-i18next"),require("@formily/antd-v5"),require("@formily/react")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client","react/jsx-runtime","@nocobase/utils/client","react","@ant-design/icons","@formily/shared","antd","lodash","react-i18next","@formily/antd-v5","@formily/react"],t):(r=typeof globalThis!="undefined"?globalThis:r||self,t(r["@nocobase/plugin-file-manager"]={},r["@nocobase/client"],r.jsxRuntime,r["@nocobase/utils"],r.react,r["@ant-design/icons"],r["@formily/shared"],r.antd,r.lodash,r["react-i18next"],r["@formily/antd-v5"],r["@formily/react"]))})(this,function(r,t,o,S,l,C,g,f,d,h,K,b){"use strict";var Q=Object.defineProperty,X=Object.defineProperties;var Y=Object.getOwnPropertyDescriptors;var T=Object.getOwnPropertySymbols;var ee=Object.prototype.hasOwnProperty,te=Object.prototype.propertyIsEnumerable;var P=(r,t,o)=>t in r?Q(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o,x=(r,t)=>{for(var o in t||(t={}))ee.call(t,o)&&P(r,o,t[o]);if(T)for(var o of T(t))te.call(t,o)&&P(r,o,t[o]);return r},I=(r,t)=>X(r,Y(t));var w=(r,t,o)=>(P(r,typeof t!="symbol"?t+"":t,o),o);var D=(r,t,o)=>new Promise((S,l)=>{var C=d=>{try{f(o.next(d))}catch(h){l(h)}},g=d=>{try{f(o.throw(d))}catch(h){l(h)}},f=d=>d.done?S(d.value):Promise.resolve(d.value).then(C,g);f((o=o.apply(r,t)).next())});const e="file-manager";function k(){return h.useTranslation(e)}const z={local:{properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",default:"storage/uploads"}}},"ali-oss":{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"Input"}}},"tx-cos":{properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},s3:{properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}}},_=b.observer(n=>{const s=b.useForm(),i=b.useField(),[a,c]=l.useState(new b.Schema({}));return l.useEffect(()=>{c(new b.Schema(z[s.values.type]||{}))},[s.values.type]),o.jsx(K.FormLayout,{layout:"vertical",children:o.jsx(b.RecursionField,{basePath:i.address,onlyRenderProperties:!0,schema:a},s.values.type||"local")})},{displayName:"StorageOptions"}),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: "${e}" })}}`,descriptions:`{{t("Will be used for API", { ns: "${e}" })}}`,type:"string","x-component":"Input"}},{type:"string",name:"type",interface:"select",uiSchema:{title:`{{t("Storage type", { ns: "${e}" })}}`,type:"string","x-component":"Select",required:!0,enum:"{{ storageTypes }}"}},{type:"string",name:"baseUrl",interface:"input",uiSchema:{title:`{{t("Storage base URL", { ns: "${e}" })}}`,type:"string","x-component":"Input",required:!0}},{type:"string",name:"path",interface:"input",uiSchema:{title:`{{t("Path", { ns: "${e}" })}}`,type:"string","x-component":"Input"}},{type:"boolean",name:"default",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}},{type:"boolean",name:"paranoid",interface:"boolean",uiSchema:{type:"boolean","x-component":"Checkbox"}}]},U={type:"object",properties:{[g.uid()]:{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","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: "${e}" })}}`,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}}"}}}}}}}}}}}},O=()=>{const[n,s]=l.useState({}),i=t.usePlugin(F),a=t.useCompile(),[c,u]=l.useState(!1),{t:m}=h.useTranslation();return o.jsx("div",{children:o.jsxs(t.ActionContext.Provider,{value:{visible:c,setVisible:u},children:[o.jsx(f.Dropdown,{menu:{onClick(p){const y=i.storageTypes.get(p.key);u(!0),s({type:"object",properties:{[g.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:{type:y.name}},title:a("{{t('Add new')}}")+" - "+a(y.title),properties:I(x({},d.cloneDeep(y.properties)),{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:[...i.storageTypes.values()].map(p=>({key:p.name,label:a(p.title)}))},children:o.jsx(f.Button,{type:"primary",icon:o.jsx(C.PlusOutlined,{}),children:m("Add new")})}),o.jsx(t.SchemaComponent,{scope:{createOnly:!0},schema:n})]})})},M=()=>{const n=t.useRecord(),[s,i]=l.useState({}),a=t.usePlugin(F),c=t.useCompile(),[u,m]=l.useState(!1),{t:p}=h.useTranslation();return o.jsx("div",{children:o.jsxs(t.ActionContext.Provider,{value:{visible:u,setVisible:m},children:[o.jsx("a",{onClick:()=>{m(!0);const y=a.storageTypes.get(n.type);i({type:"object",properties:{[g.uid()]:{type:"void","x-component":"Action.Drawer","x-decorator":"Form","x-decorator-props":{initialValue:x({},n)},title:c("{{t('Edit')}}")+" - "+c(y.title),properties:I(x({},d.cloneDeep(y.properties)),{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 }}"}}}}})}}})},children:p("Edit")}),o.jsx(t.SchemaComponent,{scope:{createOnly:!1},schema:s})]})})},j=()=>{const{t:n}=h.useTranslation(),s=t.useCompile(),a=[...t.usePlugin(F).storageTypes.values()].map(u=>({value:u.name,label:s(u.title)})),c=o.jsxs("div",{children:[n("See more")," ",o.jsx("a",{target:"_blank",href:"https://help.aliyun.com/zh/oss/user-guide/resize-images-4",rel:"noreferrer",children:"x-oss-process"})]});return o.jsx(f.Card,{bordered:!1,children:o.jsx(t.SchemaComponent,{components:{StorageOptions:_,CreateStorage:O,EditStorage:M},scope:{storageTypes:a,xStyleProcessDesc:c},schema:U})})},A=1024*1024*1024,E=Object.freeze(Object.defineProperty({__proto__:null,FILE_LIMIT_SIZE:A,useUploadFiles:()=>{const{service:n}=t.useBlockRequestContext(),{t:s}=k(),{setVisible:i}=t.useActionContext(),{setSelectedRows:a}=l.useContext(t.RecordPickerContext)||{},c={};let u=0;return{beforeUpload(m){return m.size>A?(f.notification.error({message:`${s("File size cannot exceed")} ${A/1024/1024}M`}),m.status="error",!1):!0},onChange(m){m.forEach(p=>{var y;p.status==="uploading"&&!c[p.uid]&&(u++,c[p.uid]=!0),p.status!=="uploading"&&c[p.uid]&&(delete c[p.uid],--u===0&&((y=n==null?void 0:n.refresh)==null||y.call(n),a==null||a(J=>[...J,...m.filter(v=>v.status==="done").map(v=>v.response.data)])))}),m.every(p=>p.status==="done")&&i(!1)}}}},Symbol.toStringTag,{value:"Module"})),B=Object.freeze(Object.defineProperty({__proto__:null,UploadActionInitializer:n=>{const s=t.useCollection(),i={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-component-props":{height:"50vh",action:`${s.name}:create`,useProps:"{{useUploadFiles}}",multiple:!0,listType:"picture"}}}}}};return o.jsx(t.ActionInitializer,I(x({},n),{schema:i}))}},Symbol.toStringTag,{value:"Module"})),$={name:"attachment",type:"object",group:"media",title:`{{t("Attachment", { ns: "${e}" })}}`,isAssociation:!0,default:{type:"belongsToMany",target:"attachments",uiSchema:{type:"array","x-component":"Upload.Attachment","x-component-props":{}}},availableTypes:["belongsToMany"],schemaInitialize(n,{block:s,field:i}){["Table","Kanban"].includes(s)&&(n["x-component-props"]=n["x-component-props"]||{},n["x-component-props"].size="small"),n["x-component-props"]||(n["x-component-props"]={}),n["x-component-props"].action=`${i.target}:create${i.storage?`?attachmentField=${i.collectionName}.${i.name}`:""}`},initialize:n=>{n.through||(n.through=`t_${g.uid()}`),n.foreignKey||(n.foreignKey=`f_${g.uid()}`),n.otherKey||(n.otherKey=`f_${g.uid()}`),n.sourceKey||(n.sourceKey="id"),n.targetKey||(n.targetKey="id")},properties:I(x({},t.interfacesProperties.defaultProps),{"uiSchema.x-component-props.accept":{type:"string",title:`{{t("MIME type", { ns: "${e}" })}}`,"x-component":"Input","x-decorator":"FormItem",description:"Example: image/png",default:"image/*"},"uiSchema.x-component-props.multiple":{type:"boolean","x-content":`{{t('Allow uploading multiple files', { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"Checkbox",default:!0},storage:{type:"string",title:`{{t("Storage", { ns: "${e}" })}}`,description:`{{t('Default storage will be used when not selected', { ns: "${e}" })}}`,"x-decorator":"FormItem","x-component":"RemoteSelect","x-component-props":{service:{resource:"storages",params:{}},manual:!1,fieldNames:{label:"title",value:"name"}}}}),filterable:{children:[{name:"id",title:'{{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",title:`{{t("Filename", { ns: "${e}" })}}`,operators:t.interfacesProperties.operators.string,schema:{title:`{{t("Filename", { ns: "${e}" })}}`,type:"string","x-component":"Input"}}]}},V={name:"file",title:`{{t("File collection", { ns: "${e}" })}}`,order:3,color:"blue",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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"extname",deletable:!1,uiSchema:{type:"string",title:`{{t("Extension name", { ns: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"integer",type:"integer",name:"size",deletable:!1,uiSchema:{type:"number",title:`{{t("Size", { ns: "${e}" })}}`,"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: "${e}" })}}`,"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"path",deletable:!1,uiSchema:{type:"string",title:'{{t("Path")}}',"x-component":"Input","x-read-pretty":!0}},{interface:"input",type:"string",name:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("URL")}}',"x-component":"Input.URL","x-read-pretty":!0}},{interface:"url",type:"string",name:"preview",field:"url",deletable:!1,uiSchema:{type:"string",title:'{{t("Preview")}}',"x-component":"Preview","x-read-pretty":!0}},{comment:"存储引擎",type:"belongsTo",name:"storage",target:"storages",foreignKey:"storageId",deletable:!1},{type:"jsonb",name:"meta",deletable:!1,defaultValue:{}}]},configurableProperties:I(x(I(x({},t.getConfigurableProperties("title","name")),{inherits:I(x({},t.getConfigurableProperties("inherits").inherits),{"x-reactions":["{{useAsyncDataSource(loadCollections)}}"]})}),t.getConfigurableProperties("category","description")),{storage:{title:`{{t("File storage", { ns: "${e}" })}}`,type:"hasOne",name:"storage",required:!0,"x-decorator":"FormItem","x-component":"Select","x-reactions":["{{useAsyncDataSource(loadStorages)}}"]}})},L=Object.freeze(Object.defineProperty({__proto__:null,file:V},Symbol.toStringTag,{value:"Module"}));S.forEach(L,(n,s)=>{t.registerTemplate(s,n)}),t.registerField($.group,"attachment",$);const N=n=>{const s=l.useContext(t.SchemaInitializerContext);!s.TableActionInitializers.items[0].children.some(c=>c.component==="UploadActionInitializer")&&s.TableActionInitializers.items[0].children.push({type:"item",title:"{{t('Upload')}}",component:"UploadActionInitializer",schema:{"x-align":"right","x-decorator":"ACLActionProvider","x-acl-action-props":{skipScopeCheck:!0}},visible:()=>t.useCollection().template==="file"});const a=l.useContext(t.PluginManagerContext);return o.jsx(t.SettingsCenterProvider,{settings:{"file-manager":{title:`{{t("File manager", { ns: "${e}" })}}`,icon:"FileOutlined",tabs:{storages:{title:`{{t("File storage", { ns: "${e}" })}}`,component:j}}}},children:o.jsx(t.PluginManagerContext.Provider,{value:{components:x({},a==null?void 0:a.components)},children:o.jsx(t.CollectionManagerProvider,{interfaces:{attachment:$},children:o.jsx(t.SchemaComponentOptions,{scope:E,children:o.jsx(t.SchemaInitializerProvider,{components:B,children:n.children})})})})})},R={title:`{{t("Aliyun OSS", { ns: "${e}" })}}`,name:"ali-oss",properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",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"},options:{type:"object","x-component":"div",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeySecret:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},thumbnailRule:{title:"Thumbnail rule",type:"string","x-decorator":"FormItem","x-component":"Input","x-component-props":{placeholder:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90"},default:"?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90",description:"{{ xStyleProcessDesc }}"}}},path:{"x-component":"CollectionField","x-decorator":"FormItem"},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`}}},W={title:`{{t("Local storage", { ns: "${e}" })}}`,name:"local",properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",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",default:"/storage/uploads"},options:{type:"object","x-component":"div",properties:{documentRoot:{title:`{{t("Destination", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",default:"storage/uploads"}}},path:{"x-component":"CollectionField","x-decorator":"FormItem"},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`}}},Z={title:`{{t("Amazon S3", { ns: "${e}" })}}`,name:"s3",properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",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"},options:{type:"object","x-component":"div",properties:{region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},accessKeyId:{title:`{{t("AccessKey ID", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},secretAccessKey:{title:`{{t("AccessKey Secret", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},endpoint:{title:`{{t("Endpoint", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input"}}},path:{"x-component":"CollectionField","x-decorator":"FormItem"},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`}}},G={title:`{{t("Tencent COS", { ns: "${e}" })}}`,name:"tx-cos",properties:{title:{"x-component":"CollectionField","x-decorator":"FormItem"},name:{"x-component":"CollectionField","x-decorator":"FormItem","x-disabled":"{{ !createOnly }}",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"},options:{type:"object","x-component":"div",properties:{Region:{title:`{{t("Region", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretId:{title:`{{t("SecretId", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0},SecretKey:{title:`{{t("SecretKey", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Password",required:!0},Bucket:{title:`{{t("Bucket", { ns: "${e}" })}}`,type:"string","x-decorator":"FormItem","x-component":"Input",required:!0}}},path:{"x-component":"CollectionField","x-decorator":"FormItem"},default:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Default storage", { ns: "${e}" })}}`},paranoid:{"x-component":"CollectionField","x-decorator":"FormItem","x-content":`{{t("Keep file in storage when destroy record", { ns: "${e}" })}}`}}},H={local:W,"ali-oss":R,s3:Z,"tx-cos":G};class F extends t.Plugin{constructor(){super(...arguments);w(this,"storageTypes",new Map)}load(){return D(this,null,function*(){this.app.use(N),Object.values(H).forEach(i=>{this.registerStorageType(i.name,i)})})}registerStorageType(i,a){this.storageTypes.set(i,a)}}r.FileManagerPlugin=F,r.default=F,Object.defineProperties(r,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -0,0 +1,80 @@
1
+ declare const _default: {
2
+ title: string;
3
+ name: string;
4
+ properties: {
5
+ title: {
6
+ 'x-component': string;
7
+ 'x-decorator': string;
8
+ };
9
+ name: {
10
+ 'x-component': string;
11
+ 'x-decorator': string;
12
+ 'x-disabled': string;
13
+ description: string;
14
+ };
15
+ baseUrl: {
16
+ 'x-component': string;
17
+ 'x-decorator': string;
18
+ };
19
+ options: {
20
+ type: string;
21
+ 'x-component': string;
22
+ properties: {
23
+ region: {
24
+ title: string;
25
+ type: string;
26
+ 'x-decorator': string;
27
+ 'x-component': string;
28
+ required: boolean;
29
+ };
30
+ accessKeyId: {
31
+ title: string;
32
+ type: string;
33
+ 'x-decorator': string;
34
+ 'x-component': string;
35
+ required: boolean;
36
+ };
37
+ accessKeySecret: {
38
+ title: string;
39
+ type: string;
40
+ 'x-decorator': string;
41
+ 'x-component': string;
42
+ required: boolean;
43
+ };
44
+ bucket: {
45
+ title: string;
46
+ type: string;
47
+ 'x-decorator': string;
48
+ 'x-component': string;
49
+ required: boolean;
50
+ };
51
+ thumbnailRule: {
52
+ title: string;
53
+ type: string;
54
+ 'x-decorator': string;
55
+ 'x-component': string;
56
+ 'x-component-props': {
57
+ placeholder: string;
58
+ };
59
+ default: string;
60
+ description: string;
61
+ };
62
+ };
63
+ };
64
+ path: {
65
+ 'x-component': string;
66
+ 'x-decorator': string;
67
+ };
68
+ default: {
69
+ 'x-component': string;
70
+ 'x-decorator': string;
71
+ 'x-content': string;
72
+ };
73
+ paranoid: {
74
+ 'x-component': string;
75
+ 'x-decorator': string;
76
+ 'x-content': string;
77
+ };
78
+ };
79
+ };
80
+ export default _default;
@@ -0,0 +1,271 @@
1
+ export declare const storageTypes: {
2
+ local: {
3
+ title: string;
4
+ name: string;
5
+ properties: {
6
+ title: {
7
+ 'x-component': string;
8
+ 'x-decorator': string;
9
+ };
10
+ name: {
11
+ 'x-component': string;
12
+ 'x-decorator': string;
13
+ 'x-disabled': string;
14
+ description: string;
15
+ };
16
+ baseUrl: {
17
+ 'x-component': string;
18
+ 'x-decorator': string;
19
+ default: string;
20
+ };
21
+ options: {
22
+ type: string;
23
+ 'x-component': string;
24
+ properties: {
25
+ documentRoot: {
26
+ title: string;
27
+ type: string;
28
+ 'x-decorator': string;
29
+ 'x-component': string;
30
+ default: string;
31
+ };
32
+ };
33
+ };
34
+ path: {
35
+ 'x-component': string;
36
+ 'x-decorator': string;
37
+ };
38
+ default: {
39
+ 'x-component': string;
40
+ 'x-decorator': string;
41
+ 'x-content': string;
42
+ };
43
+ paranoid: {
44
+ 'x-component': string;
45
+ 'x-decorator': string;
46
+ 'x-content': string;
47
+ };
48
+ };
49
+ };
50
+ 'ali-oss': {
51
+ title: string;
52
+ name: string;
53
+ properties: {
54
+ title: {
55
+ 'x-component': string;
56
+ 'x-decorator': string;
57
+ };
58
+ name: {
59
+ 'x-component': string;
60
+ 'x-decorator': string;
61
+ 'x-disabled': string;
62
+ description: string;
63
+ };
64
+ baseUrl: {
65
+ 'x-component': string;
66
+ 'x-decorator': string;
67
+ };
68
+ options: {
69
+ type: string;
70
+ 'x-component': string;
71
+ properties: {
72
+ region: {
73
+ title: string;
74
+ type: string;
75
+ 'x-decorator': string;
76
+ 'x-component': string;
77
+ required: boolean;
78
+ };
79
+ accessKeyId: {
80
+ title: string;
81
+ type: string;
82
+ 'x-decorator': string;
83
+ 'x-component': string;
84
+ required: boolean;
85
+ };
86
+ accessKeySecret: {
87
+ title: string;
88
+ type: string;
89
+ 'x-decorator': string;
90
+ 'x-component': string;
91
+ required: boolean;
92
+ };
93
+ bucket: {
94
+ title: string;
95
+ type: string;
96
+ 'x-decorator': string;
97
+ 'x-component': string;
98
+ required: boolean;
99
+ };
100
+ thumbnailRule: {
101
+ title: string;
102
+ type: string;
103
+ 'x-decorator': string;
104
+ 'x-component': string;
105
+ 'x-component-props': {
106
+ placeholder: string;
107
+ };
108
+ default: string;
109
+ description: string;
110
+ };
111
+ };
112
+ };
113
+ path: {
114
+ 'x-component': string;
115
+ 'x-decorator': string;
116
+ };
117
+ default: {
118
+ 'x-component': string;
119
+ 'x-decorator': string;
120
+ 'x-content': string;
121
+ };
122
+ paranoid: {
123
+ 'x-component': string;
124
+ 'x-decorator': string;
125
+ 'x-content': string;
126
+ };
127
+ };
128
+ };
129
+ s3: {
130
+ title: string;
131
+ name: string;
132
+ properties: {
133
+ title: {
134
+ 'x-component': string;
135
+ 'x-decorator': string;
136
+ };
137
+ name: {
138
+ 'x-component': string;
139
+ 'x-decorator': string;
140
+ 'x-disabled': string;
141
+ description: string;
142
+ };
143
+ baseUrl: {
144
+ 'x-component': string;
145
+ 'x-decorator': string;
146
+ };
147
+ options: {
148
+ type: string;
149
+ 'x-component': string;
150
+ properties: {
151
+ region: {
152
+ title: string;
153
+ type: string;
154
+ 'x-decorator': string;
155
+ 'x-component': string;
156
+ required: boolean;
157
+ };
158
+ accessKeyId: {
159
+ title: string;
160
+ type: string;
161
+ 'x-decorator': string;
162
+ 'x-component': string;
163
+ required: boolean;
164
+ };
165
+ secretAccessKey: {
166
+ title: string;
167
+ type: string;
168
+ 'x-decorator': string;
169
+ 'x-component': string;
170
+ required: boolean;
171
+ };
172
+ bucket: {
173
+ title: string;
174
+ type: string;
175
+ 'x-decorator': string;
176
+ 'x-component': string;
177
+ required: boolean;
178
+ };
179
+ endpoint: {
180
+ title: string;
181
+ type: string;
182
+ 'x-decorator': string;
183
+ 'x-component': string;
184
+ };
185
+ };
186
+ };
187
+ path: {
188
+ 'x-component': string;
189
+ 'x-decorator': string;
190
+ };
191
+ default: {
192
+ 'x-component': string;
193
+ 'x-decorator': string;
194
+ 'x-content': string;
195
+ };
196
+ paranoid: {
197
+ 'x-component': string;
198
+ 'x-decorator': string;
199
+ 'x-content': string;
200
+ };
201
+ };
202
+ };
203
+ 'tx-cos': {
204
+ title: string;
205
+ name: string;
206
+ properties: {
207
+ title: {
208
+ 'x-component': string;
209
+ 'x-decorator': string;
210
+ };
211
+ name: {
212
+ 'x-component': string;
213
+ 'x-decorator': string;
214
+ 'x-disabled': string;
215
+ description: string;
216
+ };
217
+ baseUrl: {
218
+ 'x-component': string;
219
+ 'x-decorator': string;
220
+ };
221
+ options: {
222
+ type: string;
223
+ 'x-component': string;
224
+ properties: {
225
+ Region: {
226
+ title: string;
227
+ type: string;
228
+ 'x-decorator': string;
229
+ 'x-component': string;
230
+ required: boolean;
231
+ };
232
+ SecretId: {
233
+ title: string;
234
+ type: string;
235
+ 'x-decorator': string;
236
+ 'x-component': string;
237
+ required: boolean;
238
+ };
239
+ SecretKey: {
240
+ title: string;
241
+ type: string;
242
+ 'x-decorator': string;
243
+ 'x-component': string;
244
+ required: boolean;
245
+ };
246
+ Bucket: {
247
+ title: string;
248
+ type: string;
249
+ 'x-decorator': string;
250
+ 'x-component': string;
251
+ required: boolean;
252
+ };
253
+ };
254
+ };
255
+ path: {
256
+ 'x-component': string;
257
+ 'x-decorator': string;
258
+ };
259
+ default: {
260
+ 'x-component': string;
261
+ 'x-decorator': string;
262
+ 'x-content': string;
263
+ };
264
+ paranoid: {
265
+ 'x-component': string;
266
+ 'x-decorator': string;
267
+ 'x-content': string;
268
+ };
269
+ };
270
+ };
271
+ };
@@ -0,0 +1,49 @@
1
+ declare const _default: {
2
+ title: string;
3
+ name: string;
4
+ properties: {
5
+ title: {
6
+ 'x-component': string;
7
+ 'x-decorator': string;
8
+ };
9
+ name: {
10
+ 'x-component': string;
11
+ 'x-decorator': string;
12
+ 'x-disabled': string;
13
+ description: string;
14
+ };
15
+ baseUrl: {
16
+ 'x-component': string;
17
+ 'x-decorator': string;
18
+ default: string;
19
+ };
20
+ options: {
21
+ type: string;
22
+ 'x-component': string;
23
+ properties: {
24
+ documentRoot: {
25
+ title: string;
26
+ type: string;
27
+ 'x-decorator': string;
28
+ 'x-component': string;
29
+ default: string;
30
+ };
31
+ };
32
+ };
33
+ path: {
34
+ 'x-component': string;
35
+ 'x-decorator': string;
36
+ };
37
+ default: {
38
+ 'x-component': string;
39
+ 'x-decorator': string;
40
+ 'x-content': string;
41
+ };
42
+ paranoid: {
43
+ 'x-component': string;
44
+ 'x-decorator': string;
45
+ 'x-content': string;
46
+ };
47
+ };
48
+ };
49
+ export default _default;
@@ -0,0 +1,75 @@
1
+ declare const _default: {
2
+ title: string;
3
+ name: string;
4
+ properties: {
5
+ title: {
6
+ 'x-component': string;
7
+ 'x-decorator': string;
8
+ };
9
+ name: {
10
+ 'x-component': string;
11
+ 'x-decorator': string;
12
+ 'x-disabled': string;
13
+ description: string;
14
+ };
15
+ baseUrl: {
16
+ 'x-component': string;
17
+ 'x-decorator': string;
18
+ };
19
+ options: {
20
+ type: string;
21
+ 'x-component': string;
22
+ properties: {
23
+ region: {
24
+ title: string;
25
+ type: string;
26
+ 'x-decorator': string;
27
+ 'x-component': string;
28
+ required: boolean;
29
+ };
30
+ accessKeyId: {
31
+ title: string;
32
+ type: string;
33
+ 'x-decorator': string;
34
+ 'x-component': string;
35
+ required: boolean;
36
+ };
37
+ secretAccessKey: {
38
+ title: string;
39
+ type: string;
40
+ 'x-decorator': string;
41
+ 'x-component': string;
42
+ required: boolean;
43
+ };
44
+ bucket: {
45
+ title: string;
46
+ type: string;
47
+ 'x-decorator': string;
48
+ 'x-component': string;
49
+ required: boolean;
50
+ };
51
+ endpoint: {
52
+ title: string;
53
+ type: string;
54
+ 'x-decorator': string;
55
+ 'x-component': string;
56
+ };
57
+ };
58
+ };
59
+ path: {
60
+ 'x-component': string;
61
+ 'x-decorator': string;
62
+ };
63
+ default: {
64
+ 'x-component': string;
65
+ 'x-decorator': string;
66
+ 'x-content': string;
67
+ };
68
+ paranoid: {
69
+ 'x-component': string;
70
+ 'x-decorator': string;
71
+ 'x-content': string;
72
+ };
73
+ };
74
+ };
75
+ export default _default;
@@ -0,0 +1,69 @@
1
+ declare const _default: {
2
+ title: string;
3
+ name: string;
4
+ properties: {
5
+ title: {
6
+ 'x-component': string;
7
+ 'x-decorator': string;
8
+ };
9
+ name: {
10
+ 'x-component': string;
11
+ 'x-decorator': string;
12
+ 'x-disabled': string;
13
+ description: string;
14
+ };
15
+ baseUrl: {
16
+ 'x-component': string;
17
+ 'x-decorator': string;
18
+ };
19
+ options: {
20
+ type: string;
21
+ 'x-component': string;
22
+ properties: {
23
+ Region: {
24
+ title: string;
25
+ type: string;
26
+ 'x-decorator': string;
27
+ 'x-component': string;
28
+ required: boolean;
29
+ };
30
+ SecretId: {
31
+ title: string;
32
+ type: string;
33
+ 'x-decorator': string;
34
+ 'x-component': string;
35
+ required: boolean;
36
+ };
37
+ SecretKey: {
38
+ title: string;
39
+ type: string;
40
+ 'x-decorator': string;
41
+ 'x-component': string;
42
+ required: boolean;
43
+ };
44
+ Bucket: {
45
+ title: string;
46
+ type: string;
47
+ 'x-decorator': string;
48
+ 'x-component': string;
49
+ required: boolean;
50
+ };
51
+ };
52
+ };
53
+ path: {
54
+ 'x-component': string;
55
+ 'x-decorator': string;
56
+ };
57
+ default: {
58
+ 'x-component': string;
59
+ 'x-decorator': string;
60
+ 'x-content': string;
61
+ };
62
+ paranoid: {
63
+ 'x-component': string;
64
+ 'x-decorator': string;
65
+ 'x-content': string;
66
+ };
67
+ };
68
+ };
69
+ export default _default;
@@ -1,15 +1,17 @@
1
1
  module.exports = {
2
- "@nocobase/client": "0.14.0-alpha.7",
3
- "@nocobase/utils": "0.14.0-alpha.7",
2
+ "@nocobase/client": "0.14.0-alpha.8",
3
+ "@nocobase/utils": "0.14.0-alpha.8",
4
4
  "react": "18.2.0",
5
+ "@ant-design/icons": "5.1.4",
6
+ "@formily/shared": "2.2.27",
5
7
  "antd": "5.8.6",
6
- "@formily/antd-v5": "1.1.0",
8
+ "lodash": "4.17.21",
9
+ "react-i18next": "11.18.6",
10
+ "@formily/antd-v5": "1.1.7",
7
11
  "@formily/core": "2.2.27",
8
12
  "@formily/react": "2.2.27",
9
- "@nocobase/server": "0.14.0-alpha.7",
10
- "@formily/shared": "2.2.27",
11
- "react-i18next": "11.18.6",
12
- "@nocobase/database": "0.14.0-alpha.7",
13
- "@nocobase/actions": "0.14.0-alpha.7",
13
+ "@nocobase/database": "0.14.0-alpha.8",
14
+ "@nocobase/server": "0.14.0-alpha.8",
15
+ "@nocobase/actions": "0.14.0-alpha.8",
14
16
  "multer": "1.4.4"
15
17
  };
@@ -17,6 +17,7 @@ declare const _default: {
17
17
  Bucket: string;
18
18
  Path: string;
19
19
  Filename: string;
20
+ 'See more': string;
20
21
  'Will be used for API': string;
21
22
  };
22
23
  export default _default;
@@ -39,5 +39,6 @@ var en_US_default = {
39
39
  Bucket: "Bucket",
40
40
  Path: "Path",
41
41
  Filename: "Filename",
42
+ "See more": "See more",
42
43
  "Will be used for API": "Will be used for API"
43
44
  };
@@ -28,5 +28,6 @@ declare const _default: {
28
28
  'Will be used for API': string;
29
29
  'Default storage will be used when not selected': string;
30
30
  'Keep file in storage when destroy record': string;
31
+ 'See more': string;
31
32
  };
32
33
  export default _default;
@@ -49,5 +49,6 @@ var zh_CN_default = {
49
49
  Filename: "\u6587\u4EF6\u540D",
50
50
  "Will be used for API": "\u5C06\u7528\u4E8E API",
51
51
  "Default storage will be used when not selected": "\u7559\u7A7A\u5C06\u4F7F\u7528\u9ED8\u8BA4\u5B58\u50A8\u7A7A\u95F4",
52
- "Keep file in storage when destroy record": "\u5220\u9664\u8BB0\u5F55\u65F6\u4FDD\u7559\u6587\u4EF6"
52
+ "Keep file in storage when destroy record": "\u5220\u9664\u8BB0\u5F55\u65F6\u4FDD\u7559\u6587\u4EF6",
53
+ "See more": "\u66F4\u591A\u8BF7\u67E5\u9605"
53
54
  };
@@ -1 +1 @@
1
- {"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.363.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"tsc -p tsconfig.cjs.json","build:docs":"typedoc","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 test:unit","test:e2e":"ts-mocha test/**/*.ispec.ts && karma start karma.conf.js","test:unit":"ts-mocha test/**/*.spec.ts"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"3.0.0","@aws-crypto/sha256-browser":"3.0.0","@aws-crypto/sha256-js":"3.0.0","@aws-sdk/client-sts":"3.363.0","@aws-sdk/credential-provider-node":"3.363.0","@aws-sdk/hash-blob-browser":"3.357.0","@aws-sdk/hash-stream-node":"3.357.0","@aws-sdk/md5-js":"3.357.0","@aws-sdk/middleware-bucket-endpoint":"3.363.0","@aws-sdk/middleware-expect-continue":"3.363.0","@aws-sdk/middleware-flexible-checksums":"3.363.0","@aws-sdk/middleware-host-header":"3.363.0","@aws-sdk/middleware-location-constraint":"3.363.0","@aws-sdk/middleware-logger":"3.363.0","@aws-sdk/middleware-recursion-detection":"3.363.0","@aws-sdk/middleware-sdk-s3":"3.363.0","@aws-sdk/middleware-signing":"3.363.0","@aws-sdk/middleware-ssec":"3.363.0","@aws-sdk/middleware-user-agent":"3.363.0","@aws-sdk/signature-v4-multi-region":"3.363.0","@aws-sdk/types":"3.357.0","@aws-sdk/util-endpoints":"3.357.0","@aws-sdk/util-user-agent-browser":"3.363.0","@aws-sdk/util-user-agent-node":"3.363.0","@aws-sdk/xml-builder":"3.310.0","@smithy/config-resolver":"^1.0.1","@smithy/eventstream-serde-browser":"^1.0.1","@smithy/eventstream-serde-config-resolver":"^1.0.1","@smithy/eventstream-serde-node":"^1.0.1","@smithy/fetch-http-handler":"^1.0.1","@smithy/hash-node":"^1.0.1","@smithy/invalid-dependency":"^1.0.1","@smithy/middleware-content-length":"^1.0.1","@smithy/middleware-endpoint":"^1.0.1","@smithy/middleware-retry":"^1.0.2","@smithy/middleware-serde":"^1.0.1","@smithy/middleware-stack":"^1.0.1","@smithy/node-config-provider":"^1.0.1","@smithy/node-http-handler":"^1.0.2","@smithy/protocol-http":"^1.0.1","@smithy/smithy-client":"^1.0.3","@smithy/types":"^1.0.0","@smithy/url-parser":"^1.0.1","@smithy/util-base64":"^1.0.1","@smithy/util-body-length-browser":"^1.0.1","@smithy/util-body-length-node":"^1.0.1","@smithy/util-defaults-mode-browser":"^1.0.1","@smithy/util-defaults-mode-node":"^1.0.1","@smithy/util-retry":"^1.0.2","@smithy/util-stream":"^1.0.1","@smithy/util-utf8":"^1.0.1","@smithy/util-waiter":"^1.0.1","fast-xml-parser":"4.2.5","tslib":"^2.5.0"},"devDependencies":{"@aws-sdk/service-client-documentation-generator":"3.310.0","@smithy/service-client-documentation-generator":"^1.0.1","@tsconfig/node14":"1.0.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^14.14.31","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typedoc":"0.23.23","typescript":"~4.9.5"},"engines":{"node":">=14.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":"2023-10-07T08:29:50.746Z"}
1
+ {"name":"@aws-sdk/client-s3","description":"AWS SDK for JavaScript S3 Client for Node.js, Browser and React Native","version":"3.363.0","scripts":{"build":"concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'","build:cjs":"tsc -p tsconfig.cjs.json","build:docs":"typedoc","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 test:unit","test:e2e":"ts-mocha test/**/*.ispec.ts && karma start karma.conf.js","test:unit":"ts-mocha test/**/*.spec.ts"},"main":"./dist-cjs/index.js","types":"./dist-types/index.d.ts","module":"./dist-es/index.js","sideEffects":false,"dependencies":{"@aws-crypto/sha1-browser":"3.0.0","@aws-crypto/sha256-browser":"3.0.0","@aws-crypto/sha256-js":"3.0.0","@aws-sdk/client-sts":"3.363.0","@aws-sdk/credential-provider-node":"3.363.0","@aws-sdk/hash-blob-browser":"3.357.0","@aws-sdk/hash-stream-node":"3.357.0","@aws-sdk/md5-js":"3.357.0","@aws-sdk/middleware-bucket-endpoint":"3.363.0","@aws-sdk/middleware-expect-continue":"3.363.0","@aws-sdk/middleware-flexible-checksums":"3.363.0","@aws-sdk/middleware-host-header":"3.363.0","@aws-sdk/middleware-location-constraint":"3.363.0","@aws-sdk/middleware-logger":"3.363.0","@aws-sdk/middleware-recursion-detection":"3.363.0","@aws-sdk/middleware-sdk-s3":"3.363.0","@aws-sdk/middleware-signing":"3.363.0","@aws-sdk/middleware-ssec":"3.363.0","@aws-sdk/middleware-user-agent":"3.363.0","@aws-sdk/signature-v4-multi-region":"3.363.0","@aws-sdk/types":"3.357.0","@aws-sdk/util-endpoints":"3.357.0","@aws-sdk/util-user-agent-browser":"3.363.0","@aws-sdk/util-user-agent-node":"3.363.0","@aws-sdk/xml-builder":"3.310.0","@smithy/config-resolver":"^1.0.1","@smithy/eventstream-serde-browser":"^1.0.1","@smithy/eventstream-serde-config-resolver":"^1.0.1","@smithy/eventstream-serde-node":"^1.0.1","@smithy/fetch-http-handler":"^1.0.1","@smithy/hash-node":"^1.0.1","@smithy/invalid-dependency":"^1.0.1","@smithy/middleware-content-length":"^1.0.1","@smithy/middleware-endpoint":"^1.0.1","@smithy/middleware-retry":"^1.0.2","@smithy/middleware-serde":"^1.0.1","@smithy/middleware-stack":"^1.0.1","@smithy/node-config-provider":"^1.0.1","@smithy/node-http-handler":"^1.0.2","@smithy/protocol-http":"^1.0.1","@smithy/smithy-client":"^1.0.3","@smithy/types":"^1.0.0","@smithy/url-parser":"^1.0.1","@smithy/util-base64":"^1.0.1","@smithy/util-body-length-browser":"^1.0.1","@smithy/util-body-length-node":"^1.0.1","@smithy/util-defaults-mode-browser":"^1.0.1","@smithy/util-defaults-mode-node":"^1.0.1","@smithy/util-retry":"^1.0.2","@smithy/util-stream":"^1.0.1","@smithy/util-utf8":"^1.0.1","@smithy/util-waiter":"^1.0.1","fast-xml-parser":"4.2.5","tslib":"^2.5.0"},"devDependencies":{"@aws-sdk/service-client-documentation-generator":"3.310.0","@smithy/service-client-documentation-generator":"^1.0.1","@tsconfig/node14":"1.0.3","@types/chai":"^4.2.11","@types/mocha":"^8.0.4","@types/node":"^14.14.31","concurrently":"7.0.0","downlevel-dts":"0.10.1","rimraf":"3.0.2","typedoc":"0.23.23","typescript":"~4.9.5"},"engines":{"node":">=14.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":"2023-11-01T02:13:04.598Z"}
@@ -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":"2023-10-07T08:29:35.718Z"}
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":"2023-11-01T02:12:48.452Z"}
@@ -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":"2023-10-07T08:29:44.196Z"}
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":"2023-11-01T02:12:57.792Z"}
@@ -1 +1 @@
1
- {"name":"multer-aliyun-oss","version":"2.1.1","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.16.0"},"devDependencies":{},"_lastModified":"2023-10-07T08:29:44.081Z"}
1
+ {"name":"multer-aliyun-oss","version":"2.1.1","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.16.0"},"devDependencies":{},"_lastModified":"2023-11-01T02:12:57.680Z"}
@@ -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":"2023-10-07T08:30:02.145Z"}
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":"2023-11-01T02:13:17.387Z"}
@@ -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":"2023-10-07T08:29:56.194Z"}
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":"2023-11-01T02:13:11.337Z"}
@@ -0,0 +1,4 @@
1
+ import { Model } from '@nocobase/database';
2
+ export declare class FileModel extends Model {
3
+ toJSON(): any;
4
+ }
@@ -0,0 +1,42 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var FileModel_exports = {};
19
+ __export(FileModel_exports, {
20
+ FileModel: () => FileModel
21
+ });
22
+ module.exports = __toCommonJS(FileModel_exports);
23
+ var import_database = require("@nocobase/database");
24
+ class FileModel extends import_database.Model {
25
+ toJSON() {
26
+ var _a, _b;
27
+ const json = super.toJSON();
28
+ const fileStorages = (_a = this.constructor["database"]) == null ? void 0 : _a["_fileStorages"];
29
+ if (json.storageId && fileStorages && fileStorages.has(json.storageId)) {
30
+ const storage = fileStorages.get(json.storageId);
31
+ json["thumbnailRule"] = (_b = storage == null ? void 0 : storage.options) == null ? void 0 : _b.thumbnailRule;
32
+ if (!json["thumbnailRule"] && (storage == null ? void 0 : storage.type) === "ali-oss") {
33
+ json["thumbnailRule"] = "?x-oss-process=image/auto-orient,1/resize,m_fill,w_94,h_94/quality,q_90";
34
+ }
35
+ }
36
+ return json;
37
+ }
38
+ }
39
+ // Annotate the CommonJS export names for ESM import in node:
40
+ 0 && (module.exports = {
41
+ FileModel
42
+ });
@@ -2,6 +2,10 @@ import { Plugin } from '@nocobase/server';
2
2
  export { default as storageTypes } from './storages';
3
3
  export default class PluginFileManager extends Plugin {
4
4
  storageType(): string;
5
+ loadStorages(options?: {
6
+ transaction: any;
7
+ }): Promise<void>;
5
8
  install(): Promise<void>;
9
+ beforeLoad(): Promise<void>;
6
10
  load(): Promise<void>;
7
11
  }
@@ -33,6 +33,7 @@ __export(server_exports, {
33
33
  module.exports = __toCommonJS(server_exports);
34
34
  var import_server = require("@nocobase/server");
35
35
  var import_path = require("path");
36
+ var import_FileModel = require("./FileModel");
36
37
  var import_actions = __toESM(require("./actions"));
37
38
  var import_storages = require("./storages");
38
39
  var import_storages2 = __toESM(require("./storages"));
@@ -40,6 +41,17 @@ class PluginFileManager extends import_server.Plugin {
40
41
  storageType() {
41
42
  return process.env.DEFAULT_STORAGE_TYPE ?? "local";
42
43
  }
44
+ async loadStorages(options) {
45
+ const repository = this.db.getRepository("storages");
46
+ const storages = await repository.find({
47
+ transaction: options == null ? void 0 : options.transaction
48
+ });
49
+ const map = /* @__PURE__ */ new Map();
50
+ for (const storage of storages) {
51
+ map.set(storage.get("id"), storage.toJSON());
52
+ }
53
+ this.db["_fileStorages"] = map;
54
+ }
43
55
  async install() {
44
56
  const defaultStorageConfig = (0, import_storages.getStorageConfig)(this.storageType());
45
57
  if (defaultStorageConfig) {
@@ -60,8 +72,26 @@ class PluginFileManager extends import_server.Plugin {
60
72
  });
61
73
  }
62
74
  }
75
+ async beforeLoad() {
76
+ this.db.registerModels({ FileModel: import_FileModel.FileModel });
77
+ this.db.on("beforeDefineCollection", (options) => {
78
+ if (options.template === "file") {
79
+ options.model = "FileModel";
80
+ }
81
+ });
82
+ this.app.on("afterStart", async () => {
83
+ await this.loadStorages();
84
+ });
85
+ }
63
86
  async load() {
64
87
  await this.importCollections((0, import_path.resolve)(__dirname, "./collections"));
88
+ const Storage = this.db.getModel("storages");
89
+ Storage.afterSave(async (m, { transaction }) => {
90
+ await this.loadStorages({ transaction });
91
+ });
92
+ Storage.afterDestroy(async (m, { transaction }) => {
93
+ await this.loadStorages({ transaction });
94
+ });
65
95
  this.app.acl.registerSnippet({
66
96
  name: `pm.${this.name}.storages`,
67
97
  actions: ["storages:*"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/plugin-file-manager",
3
- "version": "0.14.0-alpha.7",
3
+ "version": "0.14.0-alpha.8",
4
4
  "displayName": "File manager",
5
5
  "displayName.zh-CN": "文件管理器",
6
6
  "description": "Provides file storage services, and extended the file collection template and the attachment field",
@@ -37,5 +37,5 @@
37
37
  "@nocobase/test": "0.x",
38
38
  "@nocobase/utils": "0.x"
39
39
  },
40
- "gitHead": "dc958417d27ed0753439bcef192be91a03dfc30f"
40
+ "gitHead": "59c82fef6e34707802b5841f5ec4d9b3b6b68abb"
41
41
  }